From b692a207854cb230014a67a88dae3124d347d93a Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 7 Dec 2021 10:15:37 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=94=AF=E6=8C=81BI.config(function(){})?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E7=B3=BB=E7=BB=9F=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/6.inject.js | 82 +++----------------------------------------- 1 file changed, 4 insertions(+), 78 deletions(-) diff --git a/src/core/6.inject.js b/src/core/6.inject.js index e4ccbf665..1ef56c1d1 100644 --- a/src/core/6.inject.js +++ b/src/core/6.inject.js @@ -151,6 +151,10 @@ }; BI.config = BI.config || function (type, configFn, opt) { opt = opt || {}; + if (BI.isFunction(type)) { + configFn = type; + type = "bi.provider.system"; + } // 系统配置直接执行 if ("bi.provider.system" === type) { @@ -171,84 +175,6 @@ fn: configFn, opt: opt }); - - // // 初始化过或者系统配置需要立刻执行 - // if (BI.initialized || "bi.provider.system" === type) { - // if (constantInjection[type]) { - // return (constantInjection[type] = configFn(constantInjection[type])); - // } - // if (providerInjection[type]) { - // if (!providers[type]) { - // providers[type] = new providerInjection[type](); - // } - // // 如果config被重新配置的话,需要删除掉之前的实例 - // if (providerInstance[type]) { - // delete providerInstance[type]; - // } - // return configFn(providers[type]); - // } - // return BI.Plugin.configWidget(type, configFn, opt); - // } - // if (!configFunctions[type]) { - // configFunctions[type] = []; - // BI.prepares.push(function () { - // var queue = configFunctions[type]; - // var dependencies = BI.Providers.getProvider("bi.provider.system").getDependencies(); - // var modules = moduleInjectionMap.components[type] - // || moduleInjectionMap.constants[type] - // || moduleInjectionMap.services[type] - // || moduleInjectionMap.stores[type] - // || moduleInjectionMap.models[type] - // || moduleInjectionMap.providers[type]; - // for (var i = 0; i < queue.length; i++) { - // var conf = queue[i]; - // var version = conf.opt.version; - // var fn = conf.fn; - // if (modules && version) { - // var findVersion = false; - // for (var j = 0; j < modules.length; j++) { - // var module = modules[i]; - // if (module && dependencies[module.moduleId] && module.version === version) { - // var minVersion = dependencies[module.moduleId].minVersion, - // maxVersion = dependencies[module.moduleId].maxVersion; - // if (minVersion && (moduleInjection[module.moduleId].version || version) < minVersion) { - // findVersion = true; - // break; - // } - // if (maxVersion && (moduleInjection[module.moduleId].version || version) > maxVersion) { - // findVersion = true; - // break; - // } - // } - // } - // if (findVersion === true) { - // _global.console && console.error("moduleId: [" + module.moduleId + "] 接口: [" + type + "] 接口版本: [" + version + "] 已过期,版本要求为:", dependencies[module.moduleId], "=>", moduleInjection[module.moduleId]); - // continue; - // } - // } - // if (constantInjection[type]) { - // constantInjection[type] = fn(constantInjection[type]); - // continue; - // } - // if (providerInjection[type]) { - // if (!providers[type]) { - // providers[type] = new providerInjection[type](); - // } - // if (providerInstance[type]) { - // delete providerInstance[type]; - // } - // fn(providers[type]); - // continue; - // } - // BI.Plugin.configWidget(type, fn); - // } - // configFunctions[type] = null; - // }); - // } - // configFunctions[type].push({ - // fn: configFn, - // opt: opt - // }); }; BI.getReference = BI.getReference || function (type, fn) { From ce4f270d6dec7b36bd9b19f91c2df127354fd56f Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 7 Dec 2021 10:18:41 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=94=AF=E6=8C=81BI.config(function(){})?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E7=B3=BB=E7=BB=9F=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/6.inject.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/6.inject.js b/src/core/6.inject.js index 1ef56c1d1..e86c925d8 100644 --- a/src/core/6.inject.js +++ b/src/core/6.inject.js @@ -150,11 +150,12 @@ } }; BI.config = BI.config || function (type, configFn, opt) { - opt = opt || {}; if (BI.isFunction(type)) { + opt = configFn; configFn = type; type = "bi.provider.system"; } + opt = opt || {}; // 系统配置直接执行 if ("bi.provider.system" === type) { From ba18381fcd4615b40d1ce32c7ea7ed83a05dc5e1 Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 7 Dec 2021 10:19:51 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=94=AF=E6=8C=81BI.config(function(){})?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E7=B3=BB=E7=BB=9F=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/changelog.md b/changelog.md index bbbb0f3c5..a00c12798 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,7 @@ # 更新日志 +2.0(2021-12) +- 支持BI.config(function(){})进行系统配置 + 2.0(2021-11) - 限制了复选下拉框一次粘贴添加值个数最大2000