From 7ce9234ffbfa6c5b28e841439d9ba35324b10a89 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Mon, 7 Dec 2020 10:09:55 +0800 Subject: [PATCH 1/5] =?UTF-8?q?KERNEL-6382=20=E6=98=BE=E7=A4=BA=E5=80=BC?= =?UTF-8?q?=E7=9A=84=E5=B7=A6=E8=BE=B9=E8=B7=9D=E4=B8=8E=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E5=B7=A6=E8=BE=B9=E8=B7=9D=E7=BB=9F=E4=B8=80=20&&=20=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E5=9F=9F=E6=B0=B4=E5=8D=B0=E5=8F=AF=E9=80=89=E4=B8=AD?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog.md | 1 + src/base/single/editor/editor.textarea.js | 2 +- src/case/editor/editor.shelter.js | 2 +- src/case/editor/editor.sign.js | 2 +- src/case/editor/editor.state.js | 2 +- src/case/editor/editor.state.simple.js | 2 +- 6 files changed, 6 insertions(+), 5 deletions(-) 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/base/single/editor/editor.textarea.js b/src/base/single/editor/editor.textarea.js index 91274d7af..47ee9e186 100644 --- a/src/base/single/editor/editor.textarea.js +++ b/src/base/single/editor/editor.textarea.js @@ -84,7 +84,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { if (!this.watermark) { this.watermark = BI.createWidget({ type: "bi.text_button", - cls: "bi-water-mark cursor-default textarea-watermark", + cls: "bi-water-mark cursor-default textarea-watermark bi-user-select-disable", textAlign: "left", whiteSpace: "normal", text: o.watermark, 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(); From 749e1029d573821af23c6a7542fbb5bf0f33f2ec Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Mon, 7 Dec 2020 10:13:50 +0800 Subject: [PATCH 2/5] update --- src/base/single/editor/editor.textarea.js | 2 +- src/less/core/utils/common.less | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/base/single/editor/editor.textarea.js b/src/base/single/editor/editor.textarea.js index 47ee9e186..91274d7af 100644 --- a/src/base/single/editor/editor.textarea.js +++ b/src/base/single/editor/editor.textarea.js @@ -84,7 +84,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { if (!this.watermark) { this.watermark = BI.createWidget({ type: "bi.text_button", - cls: "bi-water-mark cursor-default textarea-watermark bi-user-select-disable", + cls: "bi-water-mark cursor-default textarea-watermark", textAlign: "left", whiteSpace: "normal", text: o.watermark, 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; } From e4ed0bdab4a0e2b57299aa84119a0227d9bc5f9d Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Mon, 7 Dec 2020 10:41:29 +0800 Subject: [PATCH 3/5] Revert "update" This reverts commit 2bee7da9af207df4cb481a206c1d7b49e4315305. --- src/core/inject.js | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/core/inject.js b/src/core/inject.js index 354950258..fe09a0ca5 100644 --- a/src/core/inject.js +++ b/src/core/inject.js @@ -69,6 +69,47 @@ configFunctions[type] = []; } configFunctions[type].push({fn: configFn, args: opt}); + // if (BI.initialized) { + // 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]; + // 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(configFn); }; BI.Configs = BI.Configs || { From dee2daa1ec09b7fed3b521e1972ab44966639061 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Mon, 7 Dec 2020 10:46:33 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20=E5=9B=9E?= =?UTF-8?q?=E6=BB=9ABI.config=E7=9A=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/inject.js | 83 ++++++++++++-------------------------------- src/core/shortcut.js | 13 ------- 2 files changed, 23 insertions(+), 73 deletions(-) diff --git a/src/core/inject.js b/src/core/inject.js index fe09a0ca5..13e9f9e4c 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,49 +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}); - // if (BI.initialized) { - // 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]; - // 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(configFn); }; BI.Configs = BI.Configs || { @@ -175,16 +155,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]; } }; @@ -273,17 +244,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, From 3c7358faa46c79697fdf496458d793dd2a6d2f51 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Mon, 7 Dec 2020 10:59:26 +0800 Subject: [PATCH 5/5] =?UTF-8?q?fix:=20=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/inject.js | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/core/inject.js b/src/core/inject.js index 13e9f9e4c..6cfa3abe1 100644 --- a/src/core/inject.js +++ b/src/core/inject.js @@ -89,16 +89,7 @@ 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 = {};