From 8b468c4b48e0cd8f8a2785b112dde6be820ed825 Mon Sep 17 00:00:00 2001 From: guy Date: Sun, 22 Nov 2020 01:44:02 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hooks.html | 36 ++++++++++++++++-------------------- webpack/attachments.js | 15 +++++++++------ 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/hooks.html b/hooks.html index 40d5ba6e6..4953dc389 100644 --- a/hooks.html +++ b/hooks.html @@ -50,11 +50,10 @@ }); BI.model("demo.model", Model); - function expandFunction () { + + function expandFunction (storeCreator) { var button; - var store = BI.useStore(function () { - return BI.Models.getModel("demo.model"); - }); + var store = BI.useStore(storeCreator); BI.onBeforeMount(function () { }); @@ -84,11 +83,9 @@ }; } - function clearAllFunction () { + function clearAllFunction (storeCreator) { var button; - var store = BI.useStore(function () { - return BI.Models.getModel("demo.model"); - }); + var store = BI.useStore(storeCreator); BI.onBeforeMount(function () { }); @@ -118,11 +115,9 @@ }; } - function undoFunction () { + function undoFunction (storeCreator) { var button; - var store = BI.useStore(function () { - return BI.Models.getModel("demo.model"); - }); + var store = BI.useStore(storeCreator); BI.onBeforeMount(function () { }); @@ -152,11 +147,9 @@ }; } - function redoFunction () { + function redoFunction (storeCreator) { var button; - var store = BI.useStore(function () { - return BI.Models.getModel("demo.model"); - }); + var store = BI.useStore(storeCreator); BI.onBeforeMount(function () { }); @@ -188,10 +181,13 @@ var Widget = BI.inherit(BI.Widget, { setup: function () { - var expandComponent = expandFunction(); - var clearAllComponent = clearAllFunction(); - var undoComponent = undoFunction(); - var redoComponent = redoFunction(); + var storeCreator = function () { + return BI.Models.getModel("demo.model"); + }; + var expandComponent = expandFunction(storeCreator); + var clearAllComponent = clearAllFunction(storeCreator); + var undoComponent = undoFunction(storeCreator); + var redoComponent = redoFunction(storeCreator); return function () { return { type: "bi.vertical", diff --git a/webpack/attachments.js b/webpack/attachments.js index 07cbb6897..fd6711f38 100644 --- a/webpack/attachments.js +++ b/webpack/attachments.js @@ -10,6 +10,9 @@ function sync(patterns) { const fixJs = "./dist/fix/fix.js"; const fixIEJs = "./dist/fix/fix.ie.js"; +const fixCompact = "./dist/fix/fix.compact.js"; +const fixIECompact = './dist/fix/fix.compact.ie.js'; +const workerCompact = './dist/fix/worker.compact.js'; const lodashJs = "src/core/lodash.js"; const basicAttachmentMap = { @@ -125,7 +128,7 @@ const bundle = [].concat( basicAttachmentMap.case, basicAttachmentMap.widget, sync(["public/less/app.less", "public/less/**/*.less"]), - ['./dist/fix/fix.compact.js'], + [fixCompact, workerCompact], basicAttachmentMap.router, sync(["public/js/**/*.js", "public/js/index.js", "i18n/i18n.cn.js"]), basicAttachmentMap.ts, @@ -139,7 +142,7 @@ const bundleIE = [].concat( basicAttachmentMap.case, basicAttachmentMap.widget, sync(["public/less/app.less", "public/less/**/*.less"]), - ['./dist/fix/fix.compact.ie.js'], + [fixIECompact, workerCompact], basicAttachmentMap.router, sync(["public/js/**/*.js", "public/js/index.js", "i18n/i18n.cn.js"]), basicAttachmentMap.ts, @@ -164,7 +167,7 @@ const fineui = [].concat( basicAttachmentMap.case, basicAttachmentMap.widget, basicAttachmentMap.router, - ["./dist/fix/fix.compact.js"], + [fixCompact, workerCompact], basicAttachmentMap.ui, basicAttachmentMap.ts, ); @@ -177,7 +180,7 @@ const fineuiIE = [].concat( basicAttachmentMap.case, basicAttachmentMap.widget, basicAttachmentMap.router, - ["./dist/fix/fix.compact.ie.js"], + [fixIECompact, workerCompact], basicAttachmentMap.ui, basicAttachmentMap.ts, ); @@ -220,7 +223,7 @@ const fineuiWithoutJqueryAndPolyfillJs = [].concat( "!src/case/tree/ztree/**/*.js", ]), basicAttachmentMap.widget, - sync(["dist/fix/fix.compact.js", "ui/js/**/*.js"]), + sync([fixCompact, workerCompact, "ui/js/**/*.js"]), basicAttachmentMap.ts, ); @@ -233,7 +236,7 @@ const demo = [].concat( basicAttachmentMap.case, basicAttachmentMap.widget, sync(["public/less/app.less", "public/less/**/*.less"]), - ['./dist/fix/fix.compact.js'], + [fixCompact, workerCompact], basicAttachmentMap.config, basicAttachmentMap.ts, sync(["demo/less/*.less", "demo/less/**/*.less", "demo/app.js", "demo/js/**/*.js", "demo/config.js"]), From fce70ac37092ad9120c6e65d187c642b473ebf45 Mon Sep 17 00:00:00 2001 From: guy Date: Sun, 22 Nov 2020 02:06:46 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/inject.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/inject.js b/src/core/inject.js index 99abd2239..6cfa3abe1 100644 --- a/src/core/inject.js +++ b/src/core/inject.js @@ -264,7 +264,7 @@ } }; - BI.getContext = BI.getContext || function (type, config) { + BI.getResource = BI.getResource || function (type, config) { if (constantInjection[type]) { return BI.Constants.getConstant(type); }