diff --git a/changelog.md b/changelog.md index e7b76727c..44fc7a44f 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ # 更新日志 2.0(2020-12) +- [视觉]editor水印间距统一与文本域水印不可选中 - 修复bi.file的url参数拼接问题 - 修复了colorChooser选择透明后, 打开更多选色面板, 直接点保存会选中自动的问题 - bi.file支持限制上传文件数 diff --git a/src/case/editor/editor.shelter.js b/src/case/editor/editor.shelter.js index 0962e74d0..562cbe3a4 100644 --- a/src/case/editor/editor.shelter.js +++ b/src/case/editor/editor.shelter.js @@ -52,7 +52,7 @@ BI.ShelterEditor = BI.inherit(BI.Widget, { tipType: o.tipType, textAlign: o.textAlign, height: o.height, - hgap: o.hgap + hgap: o.hgap + 2 }); BI.createWidget({ type: "bi.absolute", diff --git a/src/case/editor/editor.sign.js b/src/case/editor/editor.sign.js index e71efc3bf..35ed78e4b 100644 --- a/src/case/editor/editor.sign.js +++ b/src/case/editor/editor.sign.js @@ -52,7 +52,7 @@ BI.SignEditor = BI.inherit(BI.Widget, { tipType: o.tipType, textAlign: o.textAlign, height: o.height, - hgap: o.hgap, + hgap: o.hgap + 2, handler: function () { self._showInput(); self.editor.focus(); diff --git a/src/case/editor/editor.state.js b/src/case/editor/editor.state.js index 450a08f2f..1773c04f7 100644 --- a/src/case/editor/editor.state.js +++ b/src/case/editor/editor.state.js @@ -51,7 +51,7 @@ BI.StateEditor = BI.inherit(BI.Widget, { textAlign: "left", height: o.height, text: o.text, - hgap: o.hgap, + hgap: o.hgap + 2, handler: function () { self._showInput(); self.editor.focus(); diff --git a/src/case/editor/editor.state.simple.js b/src/case/editor/editor.state.simple.js index 10cb45057..6fab8d6f8 100644 --- a/src/case/editor/editor.state.simple.js +++ b/src/case/editor/editor.state.simple.js @@ -51,7 +51,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, { textAlign: "left", text: o.text, height: o.height, - hgap: o.hgap, + hgap: o.hgap + 2, handler: function () { self._showInput(); self.editor.focus(); diff --git a/src/core/inject.js b/src/core/inject.js index 354950258..6cfa3abe1 100644 --- a/src/core/inject.js +++ b/src/core/inject.js @@ -49,7 +49,7 @@ var configFunctions = {}; BI.config = BI.config || function (type, configFn, opt) { - if (opt && opt.immediate) { + if (BI.initialized) { if (constantInjection[type]) { return (constantInjection[type] = configFn(constantInjection[type])); } @@ -67,17 +67,29 @@ } if (!configFunctions[type]) { configFunctions[type] = []; + BI.prepares.push(function () { + var queue = configFunctions[type]; + for (var i = 0; i < queue.length; i++) { + if (constantInjection[type]) { + constantInjection[type] = queue[i](constantInjection[type]); + continue; + } + if (providerInjection[type]) { + if (!providers[type]) { + providers[type] = new providerInjection[type](); + } + if (providerInstance[type]) { + delete providerInstance[type]; + } + queue[i](providers[type]); + continue; + } + BI.Plugin.configWidget(type, queue[i]); + } + configFunctions[type] = null; + }); } - configFunctions[type].push({fn: configFn, args: opt}); - }; - - BI.Configs = BI.Configs || { - getConfigs: function () { - return configFunctions; - }, - getConfig: function (type) { - return configFunctions[type]; - }, + configFunctions[type].push(configFn); }; var actions = {}; @@ -134,16 +146,7 @@ BI.Constants = BI.Constants || { getConstant: function (type) { - var instance = constantInjection[type]; - BI.each(configFunctions[type], function (i, cf) { - var res = cf.fn(instance); - if (res) { - instance = res; - } - }); - constantInjection[type] = instance; - configFunctions[type] && (configFunctions[type] = null); - return instance; + return constantInjection[type]; } }; @@ -232,17 +235,9 @@ if (!providers[type]) { providers[type] = new providerInjection[type](); } - var instance = providers[type]; - BI.each(configFunctions[type], function (i, cf) { - if (providerInstance[type]) { - delete providerInstance[type]; - } - cf.fn(instance); - }); if (!providerInstance[type]) { providerInstance[type] = new (providers[type].$get())(config); } - configFunctions[type] && (configFunctions[type] = null); return providerInstance[type]; } }; diff --git a/src/core/shortcut.js b/src/core/shortcut.js index 1a6568662..001a73b8c 100644 --- a/src/core/shortcut.js +++ b/src/core/shortcut.js @@ -32,17 +32,6 @@ return widget; }; - function configWidget (type) { - var configFunctions = BI.Configs.getConfig(type); - if (configFunctions) { - BI.each(configFunctions, function (i, cf) { - BI.Plugin.configWidget(type, cf.fn, cf.args); - }); - var configs = BI.Configs.getConfigs(); - configs[type] && (configs[type] = null); - } - } - BI.createWidget = BI.createWidget || function (item, options, context, lazy) { // 先把准备环境准备好 BI.init(); @@ -64,7 +53,6 @@ } if (item.type || options.type) { el = BI.extend({}, options, item); - configWidget(el.type); w = BI.Plugin.getWidget(el.type, el); w.listeners = (w.listeners || []).concat([{ eventName: BI.Events.MOUNT, @@ -76,7 +64,6 @@ } if (item.el && (item.el.type || options.type)) { el = BI.extend({}, options, item.el); - configWidget(el.type); w = BI.Plugin.getWidget(el.type, el); w.listeners = (w.listeners || []).concat([{ eventName: BI.Events.MOUNT, diff --git a/src/less/core/utils/common.less b/src/less/core/utils/common.less index 35a3e9dda..794c66b78 100644 --- a/src/less/core/utils/common.less +++ b/src/less/core/utils/common.less @@ -427,6 +427,7 @@ textarea { .bi-water-mark { color: @font-color-tips; cursor: text; + .user-select-disable(); & .bi-input { color: @font-color-tips; }