From 9def32893b766cf000055847332f05c2476c50ca Mon Sep 17 00:00:00 2001 From: qiucong Date: Mon, 7 Dec 2020 10:55:55 +0800 Subject: [PATCH] =?UTF-8?q?KERNEL-6272=20fix:=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E4=BC=A0=E5=85=A5autocomplete=E8=A7=A3=E5=86=B3=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E8=87=AA=E5=8A=A8=E5=A1=AB=E5=85=85=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog.md | 1 + demo/js/base/editor/demo.editor.js | 44 ++++++++++++++++++++---------- src/base/single/editor/editor.js | 4 ++- 3 files changed, 34 insertions(+), 15 deletions(-) diff --git a/changelog.md b/changelog.md index e7b76727c..847dd453f 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ # 更新日志 2.0(2020-12) +- bi.editor支持传入autocomplete - 修复bi.file的url参数拼接问题 - 修复了colorChooser选择透明后, 打开更多选色面板, 直接点保存会选中自动的问题 - bi.file支持限制上传文件数 diff --git a/demo/js/base/editor/demo.editor.js b/demo/js/base/editor/demo.editor.js index 26c4ed4f2..bc06b2242 100644 --- a/demo/js/base/editor/demo.editor.js +++ b/demo/js/base/editor/demo.editor.js @@ -1,6 +1,6 @@ Demo.Editor = BI.inherit(BI.Widget, { props: { - baseCls: "demo-editor" + baseCls: "demo-editor", }, render: function () { var editor1 = BI.createWidget({ @@ -9,7 +9,7 @@ Demo.Editor = BI.inherit(BI.Widget, { watermark: "报错信息显示在控件上方", errorText: "字段不可重名!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", width: 200, - height: 24 + height: 24, }); editor1.on(BI.Editor.EVENT_ENTER, function () { editor1.blur(); @@ -24,11 +24,12 @@ Demo.Editor = BI.inherit(BI.Widget, { if (v == "a") { return false; } + return true; }, allowBlank: true, width: 200, - height: 24 + height: 24, }); var editor3 = BI.createWidget({ type: "bi.editor", @@ -40,6 +41,7 @@ Demo.Editor = BI.inherit(BI.Widget, { if (v == "a") { return false; } + return true; }, quitChecker: function (v) { @@ -47,7 +49,17 @@ Demo.Editor = BI.inherit(BI.Widget, { }, allowBlank: true, width: 300, - height: 24 + height: 24, + }); + var editor4 = BI.createWidget({ + type: "bi.editor", + cls: "bi-border", + inputType: "password", + autocomplete: "new-password", + watermark: "请输入密码", + allowBlank: true, + width: 300, + height: 24, }); BI.createWidget({ type: "bi.absolute", @@ -55,15 +67,19 @@ Demo.Editor = BI.inherit(BI.Widget, { items: [{ el: editor1, left: 0, - top: 0 + top: 0, }, { el: editor2, left: 250, - top: 30 + top: 30, }, { el: editor3, left: 500, - top: 60 + top: 60, + }, { + el: editor4, + left: 700, + top: 60, }, { el: { type: "bi.button", @@ -73,10 +89,10 @@ Demo.Editor = BI.inherit(BI.Widget, { editor2.setEnable(false); editor3.setEnable(false); }, - height: 30 + height: 30, }, left: 100, - bottom: 60 + bottom: 60, }, { el: { type: "bi.button", @@ -86,12 +102,12 @@ Demo.Editor = BI.inherit(BI.Widget, { editor2.setEnable(true); editor3.setEnable(true); }, - height: 30 + height: 30, }, left: 200, - bottom: 60 - }] + bottom: 60, + }], }); - } + }, }); -BI.shortcut("demo.editor", Demo.Editor); \ No newline at end of file +BI.shortcut("demo.editor", Demo.Editor); diff --git a/src/base/single/editor/editor.js b/src/base/single/editor/editor.js index a5c455ed1..9af71c408 100644 --- a/src/base/single/editor/editor.js +++ b/src/base/single/editor/editor.js @@ -29,9 +29,11 @@ BI.Editor = BI.inherit(BI.Single, { _init: function () { BI.Editor.superclass._init.apply(this, arguments); var self = this, o = this.options; + // 密码输入框设置autocomplete="new-password"的情况下Firefox和chrome不会自动填充密码 + var autocomplete = o.autocomplete ? " autocomplete=" + o.autocomplete : ""; this.editor = this.addWidget(BI.createWidget({ type: "bi.input", - element: "", + element: "", root: true, value: o.value, watermark: o.watermark,