fineui是帆软报表和BI产品线所使用的前端框架。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
3.3 KiB

8 years ago
Demo.Editor = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-editor",
8 years ago
},
render: function () {
var editor1 = BI.createWidget({
type: "bi.editor",
7 years ago
cls: "bi-border",
watermark: "报错信息显示在控件上方",
8 years ago
errorText: "字段不可重名!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
width: 200,
height: 24,
8 years ago
});
editor1.on(BI.Editor.EVENT_ENTER, function () {
editor1.blur();
});
var editor2 = BI.createWidget({
type: "bi.editor",
cls: "bi-border",
8 years ago
watermark: "输入'a'会有错误信息",
disabled: true,
errorText: "字段不可重名",
validationChecker: function (v) {
if (v == "a") {
return false;
}
8 years ago
return true;
},
allowBlank: true,
width: 200,
height: 24,
8 years ago
});
var editor3 = BI.createWidget({
type: "bi.editor",
cls: "bi-border",
8 years ago
watermark: "输入'a'会有错误信息且回车键不能退出编辑",
errorText: "字段不可重名",
value: "a",
8 years ago
validationChecker: function (v) {
if (v == "a") {
return false;
}
8 years ago
return true;
},
quitChecker: function (v) {
return false;
},
allowBlank: true,
width: 300,
height: 24,
});
var editor4 = BI.createWidget({
type: "bi.editor",
cls: "bi-border",
inputType: "password",
autocomplete: "new-password",
watermark: "请输入密码",
allowBlank: true,
width: 300,
height: 24,
8 years ago
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: editor1,
left: 0,
top: 0,
8 years ago
}, {
el: editor2,
left: 250,
top: 30,
8 years ago
}, {
el: editor3,
left: 500,
top: 60,
}, {
el: editor4,
left: 700,
top: 60,
8 years ago
}, {
el: {
type: "bi.button",
text: "disable",
handler: function () {
editor1.setEnable(false);
editor2.setEnable(false);
editor3.setEnable(false);
},
height: 30,
8 years ago
},
left: 100,
bottom: 60,
8 years ago
}, {
el: {
type: "bi.button",
text: "enable",
handler: function () {
editor1.setEnable(true);
editor2.setEnable(true);
editor3.setEnable(true);
},
height: 30,
8 years ago
},
left: 200,
bottom: 60,
}],
7 years ago
});
},
8 years ago
});
BI.shortcut("demo.editor", Demo.Editor);