Browse Source

KERNEL-14316 fix: 修复一些细节问题

es6
Treecat 1 year ago
parent
commit
29b46bc888
  1. 204
      packages/demo/src/case/combo/demo.text_value_combo.js
  2. 14
      packages/demo/src/demo/base/button/demo.button.js
  3. 2012
      packages/fineui/src/core/controller/popper.js

204
packages/demo/src/case/combo/demo.text_value_combo.js

@ -1,93 +1,90 @@
/** /**
* Created by Dailer on 2017/7/11. * Created by Dailer on 2017/7/11.
*/ */
Demo.TextValueCombo = BI.inherit(BI.Widget, { import { shortcut, Widget, Label, VerticalLayout, TextValueCombo, Button, Selection } from "@fui/core";
props: {
baseCls: ""
},
render: function () {
var combo1, combo2;
var items = [ @shortcut()
export class TextValueCombo extends Widget {
static xtype = "demo.text_value_combo";
props = {
baseCls: "",
};
render() {
let combo1, combo2;
const items = [
{ {
text: "MVC-1", text: "MVC-1",
iconCls: "date-font", iconCls: "date-font",
value: 1 value: 1,
}, { },
{
text: "MVC-2", text: "MVC-2",
iconCls: "search-font", iconCls: "search-font",
value: 2 value: 2,
}, { },
{
text: "MVC-3", text: "MVC-3",
iconCls: "pull-right-font", iconCls: "pull-right-font",
value: 3 value: 3,
} },
]; ];
// 创建下拉框各种场景用例 // 创建下拉框各种场景用例
return { return {
type: "bi.vertical", type: VerticalLayout.xtype,
vgap: 20, vgap: 20,
hgap: 20, hgap: 20,
items: [ items: [
this.createCombo("无初始值,带提示文字", { this.createCombo("无初始值,带提示文字", {
type: "bi.text_value_combo", type: TextValueCombo.xtype,
ref: (ref) => { ref() {
this.combo1 = ref; combo1 = ref;
}, },
defaultText: "请选择", defaultText: "请选择",
width: 300, width: 300,
items: items, items: items,
listeners: [ listeners: [
{ {
eventName: BI.TextValueCombo.EVENT_CHANGE, eventName: TextValueCombo.EVENT_CHANGE,
action: function () { action: function () {
console.log(this.getValue()); console.log(this.getValue());
} },
} },
] ],
}), }),
this.createCombo("自动根据value匹配text", { this.createCombo("自动根据value匹配text", {
type: "bi.text_value_combo", type: TextValueCombo.xtype,
ref: function () {
combo = this;
},
defaultText: "请选择", defaultText: "请选择",
width: 300, width: 300,
value: 1, value: 1,
items: items, items: items,
listeners: [ listeners: [
{ {
eventName: BI.TextValueCombo.EVENT_CHANGE, eventName: TextValueCombo.EVENT_CHANGE,
action: function () { action: function () {
console.log(this.getValue()); console.log(this.getValue());
} },
} },
] ],
}), }),
this.createCombo("无初始值,可以清空", { this.createCombo("无初始值,可以清空", {
type: "bi.text_value_combo", type: TextValueCombo.xtype,
ref: function () {
combo = this;
},
defaultText: "请选择", defaultText: "请选择",
width: 300, width: 300,
items: items, items: items,
allowClear: true, allowClear: true,
listeners: [ listeners: [
{ {
eventName: BI.TextValueCombo.EVENT_CHANGE, eventName: TextValueCombo.EVENT_CHANGE,
action: function () { action() {
console.log(this.getValue()); console.log(this.getValue());
} },
} },
] ],
}), }),
this.createCombo("有初始值,可以清空", { this.createCombo("有初始值,可以清空", {
type: "bi.text_value_combo", type: TextValueCombo.xtype,
ref: function () {
combo = this;
},
defaultText: "请选择", defaultText: "请选择",
width: 300, width: 300,
value: 1, value: 1,
@ -95,17 +92,17 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, {
allowClear: true, allowClear: true,
listeners: [ listeners: [
{ {
eventName: BI.TextValueCombo.EVENT_CHANGE, eventName: TextValueCombo.EVENT_CHANGE,
action: function () { action: function () {
console.log(this.getValue()); console.log(this.getValue());
} },
} },
] ],
}), }),
this.createCombo("有初始值,value不匹配,自动标红,指定标红文字", { this.createCombo("有初始值,value不匹配,自动标红,指定标红文字", {
type: "bi.text_value_combo", type: TextValueCombo.xtype,
ref: function () { ref() {
combo = this; self.combo = this;
}, },
width: 300, width: 300,
text: "MVC-111", text: "MVC-111",
@ -116,19 +113,19 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, {
warningTitle: "value值不合法", warningTitle: "value值不合法",
listeners: [ listeners: [
{ {
eventName: BI.TextValueCombo.EVENT_CHANGE, eventName: TextValueCombo.EVENT_CHANGE,
action: function () { action: function () {
console.log(this.getValue()); console.log(this.getValue());
} },
} },
] ],
}), }),
this.createCombo("无初始值,外部受控调用setValue", { this.createCombo("无初始值,外部受控调用setValue", {
type: "bi.vertical", type: VerticalLayout.xtype,
items: [ items: [
{ {
type: "bi.text_value_combo", type: TextValueCombo.xtype,
ref: function () { ref() {
combo1 = this; combo1 = this;
}, },
width: 300, width: 300,
@ -137,29 +134,30 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, {
defaultText: "请选择", defaultText: "请选择",
listeners: [ listeners: [
{ {
eventName: BI.TextValueCombo.EVENT_CHANGE, eventName: TextValueCombo.EVENT_CHANGE,
action: function () { action: function () {
console.log(this.getValue()); console.log(this.getValue());
} },
} },
] ],
}, { },
{
el: { el: {
type: "bi.button", type: Button.xtype,
text: "setValue(1)", text: "setValue(1)",
handler: function () { handler: function () {
combo1.setValue(1); combo1.setValue(1);
}, },
}, },
vgap: 10, vgap: 10,
} },
] ],
}), }),
this.createCombo("无初始值,外部受控调用setStatus", { this.createCombo("无初始值,外部受控调用setStatus", {
type: "bi.vertical", type: "bi.vertical",
items: [ items: [
{ {
type: "bi.text_value_combo", type: TextValueCombo.xtype,
ref: function () { ref: function () {
combo2 = this; combo2 = this;
}, },
@ -169,92 +167,92 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, {
defaultText: "请选择", defaultText: "请选择",
listeners: [ listeners: [
{ {
eventName: BI.TextValueCombo.EVENT_CHANGE, eventName: TextValueCombo.EVENT_CHANGE,
action: function () { action: function () {
console.log(this.getValue()); console.log(this.getValue());
} },
} },
] ],
}, { },
{
el: { el: {
type: "bi.button", type: Button.xtype,
text: "setStatus()", text: "setStatus()",
handler: function () { handler: function () {
combo2.setStatus("error"); combo2.setStatus("error");
}, },
}, },
vgap: 10, vgap: 10,
} },
] ],
}), }),
this.createCombo("支持复选", { this.createCombo("支持复选", {
type: "bi.vertical", type: VerticalLayout.xtype,
items: [ items: [
{ {
type: "bi.text_value_combo", type: TextValueCombo.xtype,
width: 300, width: 300,
items: items, items: items,
allowClear: true, allowClear: true,
defaultText: "请选择", defaultText: "请选择",
chooseType: BI.Selection.Multi, chooseType: Selection.Multi,
value: [1], value: [1],
// allowSelectAll: false, // allowSelectAll: false,
listeners: [ listeners: [
{ {
eventName: BI.TextValueCombo.EVENT_CHANGE, eventName: TextValueCombo.EVENT_CHANGE,
action: function () { action: function () {
console.log(this.getValue()); console.log(this.getValue());
} },
} },
] ],
} },
] ],
}), }),
this.createCombo("支持复选,不要全选功能", { this.createCombo("支持复选,不要全选功能", {
type: "bi.vertical", type: VerticalLayout.xtype,
items: [ items: [
{ {
type: "bi.text_value_combo", type: TextValueCombo.xtype,
width: 300, width: 300,
items: items, items: items,
allowClear: true, allowClear: true,
defaultText: "请选择", defaultText: "请选择",
chooseType: BI.Selection.Multi, chooseType: Selection.Multi,
value: [1], value: [1],
allowSelectAll: false, allowSelectAll: false,
listeners: [ listeners: [
{ {
eventName: BI.TextValueCombo.EVENT_CHANGE, eventName: TextValueCombo.EVENT_CHANGE,
action: function () { action: function () {
console.log(this.getValue()); console.log(this.getValue());
} },
} },
] ],
} },
] ],
}) }),
] ],
}; };
}, }
createCombo: function (text, combo) { createCombo(text, combo) {
return { return {
type: "bi.vertical", type: VerticalLayout.xtype,
items: [ items: [
{ {
el: { el: {
type: "bi.label", type: Label.xtype,
textAlign: "left", textAlign: "left",
text, text,
}, },
bgap: 10 bgap: 10,
}, { },
{
el: combo, el: combo,
bgap: 10, bgap: 10,
}, },
] ],
}; };
} }
}); }
BI.shortcut("demo.text_value_combo", Demo.TextValueCombo);

14
packages/demo/src/demo/base/button/demo.button.js

@ -403,20 +403,6 @@ export class ButtonDemo extends Widget {
console.log("我是无法被触发的!"); console.log("我是无法被触发的!");
}, },
}, },
{
type: Button.xtype,
text: "自定义图标按钮(点我修改)",
icon: {
type: "demo.joker.icon",
},
handler() {
console.log("触发点击事件");
this.loading();
setTimeout(() => {
this.loaded();
}, 5 * 1000);
},
},
{ {
type: Button.xtype, type: Button.xtype,
text: "文字偏左的按钮", text: "文字偏左的按钮",

2012
packages/fineui/src/core/controller/popper.js

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save