Browse Source

Pull request #1622: KERNEL-6272 fix: 支持传入autocomplete解决密码自动填充的问题

Merge in VISUAL/fineui from ~FRANK.QIU/fineui:master to master

* commit 'be2bed5e4529b3621f34cef6ea7dbec4da819935':
  KERNEL-6272 fix: 支持传入autocomplete解决密码自动填充的问题
es6
Frank.Qiu 4 years ago
parent
commit
2ba34335dc
  1. 1
      changelog.md
  2. 42
      demo/js/base/editor/demo.editor.js
  3. 4
      src/base/single/editor/editor.js

1
changelog.md

@ -1,5 +1,6 @@
# 更新日志 # 更新日志
2.0(2020-12) 2.0(2020-12)
- bi.editor支持传入autocomplete
- [视觉]editor水印间距统一与文本域水印不可选中 - [视觉]editor水印间距统一与文本域水印不可选中
- 修复bi.file的url参数拼接问题 - 修复bi.file的url参数拼接问题
- 修复了colorChooser选择透明后, 打开更多选色面板, 直接点保存会选中自动的问题 - 修复了colorChooser选择透明后, 打开更多选色面板, 直接点保存会选中自动的问题

42
demo/js/base/editor/demo.editor.js

@ -1,6 +1,6 @@
Demo.Editor = BI.inherit(BI.Widget, { Demo.Editor = BI.inherit(BI.Widget, {
props: { props: {
baseCls: "demo-editor" baseCls: "demo-editor",
}, },
render: function () { render: function () {
var editor1 = BI.createWidget({ var editor1 = BI.createWidget({
@ -9,7 +9,7 @@ Demo.Editor = BI.inherit(BI.Widget, {
watermark: "报错信息显示在控件上方", watermark: "报错信息显示在控件上方",
errorText: "字段不可重名!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", errorText: "字段不可重名!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
width: 200, width: 200,
height: 24 height: 24,
}); });
editor1.on(BI.Editor.EVENT_ENTER, function () { editor1.on(BI.Editor.EVENT_ENTER, function () {
editor1.blur(); editor1.blur();
@ -24,11 +24,12 @@ Demo.Editor = BI.inherit(BI.Widget, {
if (v == "a") { if (v == "a") {
return false; return false;
} }
return true; return true;
}, },
allowBlank: true, allowBlank: true,
width: 200, width: 200,
height: 24 height: 24,
}); });
var editor3 = BI.createWidget({ var editor3 = BI.createWidget({
type: "bi.editor", type: "bi.editor",
@ -40,6 +41,7 @@ Demo.Editor = BI.inherit(BI.Widget, {
if (v == "a") { if (v == "a") {
return false; return false;
} }
return true; return true;
}, },
quitChecker: function (v) { quitChecker: function (v) {
@ -47,7 +49,17 @@ Demo.Editor = BI.inherit(BI.Widget, {
}, },
allowBlank: true, allowBlank: true,
width: 300, 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({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
@ -55,15 +67,19 @@ Demo.Editor = BI.inherit(BI.Widget, {
items: [{ items: [{
el: editor1, el: editor1,
left: 0, left: 0,
top: 0 top: 0,
}, { }, {
el: editor2, el: editor2,
left: 250, left: 250,
top: 30 top: 30,
}, { }, {
el: editor3, el: editor3,
left: 500, left: 500,
top: 60 top: 60,
}, {
el: editor4,
left: 700,
top: 60,
}, { }, {
el: { el: {
type: "bi.button", type: "bi.button",
@ -73,10 +89,10 @@ Demo.Editor = BI.inherit(BI.Widget, {
editor2.setEnable(false); editor2.setEnable(false);
editor3.setEnable(false); editor3.setEnable(false);
}, },
height: 30 height: 30,
}, },
left: 100, left: 100,
bottom: 60 bottom: 60,
}, { }, {
el: { el: {
type: "bi.button", type: "bi.button",
@ -86,12 +102,12 @@ Demo.Editor = BI.inherit(BI.Widget, {
editor2.setEnable(true); editor2.setEnable(true);
editor3.setEnable(true); editor3.setEnable(true);
}, },
height: 30 height: 30,
}, },
left: 200, left: 200,
bottom: 60 bottom: 60,
}] }],
}); });
} },
}); });
BI.shortcut("demo.editor", Demo.Editor); BI.shortcut("demo.editor", Demo.Editor);

4
src/base/single/editor/editor.js

@ -29,9 +29,11 @@ BI.Editor = BI.inherit(BI.Single, {
_init: function () { _init: function () {
BI.Editor.superclass._init.apply(this, arguments); BI.Editor.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
// 密码输入框设置autocomplete="new-password"的情况下Firefox和chrome不会自动填充密码
var autocomplete = o.autocomplete ? " autocomplete=" + o.autocomplete : "";
this.editor = this.addWidget(BI.createWidget({ this.editor = this.addWidget(BI.createWidget({
type: "bi.input", type: "bi.input",
element: "<input type='" + o.inputType + "'/>", element: "<input type='" + o.inputType + "'" + autocomplete + " />",
root: true, root: true,
value: o.value, value: o.value,
watermark: o.watermark, watermark: o.watermark,

Loading…
Cancel
Save