Browse Source

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

es6
Treecat 2 years 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.
*/
Demo.TextValueCombo = BI.inherit(BI.Widget, {
props: {
baseCls: ""
},
render: function () {
var combo1, combo2;
import { shortcut, Widget, Label, VerticalLayout, TextValueCombo, Button, Selection } from "@fui/core";
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",
iconCls: "date-font",
value: 1
}, {
value: 1,
},
{
text: "MVC-2",
iconCls: "search-font",
value: 2
}, {
value: 2,
},
{
text: "MVC-3",
iconCls: "pull-right-font",
value: 3
}
value: 3,
},
];
// 创建下拉框各种场景用例
return {
type: "bi.vertical",
type: VerticalLayout.xtype,
vgap: 20,
hgap: 20,
items: [
this.createCombo("无初始值,带提示文字", {
type: "bi.text_value_combo",
ref: (ref) => {
this.combo1 = ref;
type: TextValueCombo.xtype,
ref() {
combo1 = ref;
},
defaultText: "请选择",
width: 300,
items: items,
listeners: [
{
eventName: BI.TextValueCombo.EVENT_CHANGE,
eventName: TextValueCombo.EVENT_CHANGE,
action: function () {
console.log(this.getValue());
}
}
]
},
},
],
}),
this.createCombo("自动根据value匹配text", {
type: "bi.text_value_combo",
ref: function () {
combo = this;
},
type: TextValueCombo.xtype,
defaultText: "请选择",
width: 300,
value: 1,
items: items,
listeners: [
{
eventName: BI.TextValueCombo.EVENT_CHANGE,
eventName: TextValueCombo.EVENT_CHANGE,
action: function () {
console.log(this.getValue());
}
}
]
},
},
],
}),
this.createCombo("无初始值,可以清空", {
type: "bi.text_value_combo",
ref: function () {
combo = this;
},
type: TextValueCombo.xtype,
defaultText: "请选择",
width: 300,
items: items,
allowClear: true,
listeners: [
{
eventName: BI.TextValueCombo.EVENT_CHANGE,
action: function () {
eventName: TextValueCombo.EVENT_CHANGE,
action() {
console.log(this.getValue());
}
}
]
},
},
],
}),
this.createCombo("有初始值,可以清空", {
type: "bi.text_value_combo",
ref: function () {
combo = this;
},
type: TextValueCombo.xtype,
defaultText: "请选择",
width: 300,
value: 1,
@ -95,17 +92,17 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, {
allowClear: true,
listeners: [
{
eventName: BI.TextValueCombo.EVENT_CHANGE,
eventName: TextValueCombo.EVENT_CHANGE,
action: function () {
console.log(this.getValue());
}
}
]
},
},
],
}),
this.createCombo("有初始值,value不匹配,自动标红,指定标红文字", {
type: "bi.text_value_combo",
ref: function () {
combo = this;
type: TextValueCombo.xtype,
ref() {
self.combo = this;
},
width: 300,
text: "MVC-111",
@ -116,19 +113,19 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, {
warningTitle: "value值不合法",
listeners: [
{
eventName: BI.TextValueCombo.EVENT_CHANGE,
eventName: TextValueCombo.EVENT_CHANGE,
action: function () {
console.log(this.getValue());
}
}
]
},
},
],
}),
this.createCombo("无初始值,外部受控调用setValue", {
type: "bi.vertical",
type: VerticalLayout.xtype,
items: [
{
type: "bi.text_value_combo",
ref: function () {
type: TextValueCombo.xtype,
ref() {
combo1 = this;
},
width: 300,
@ -137,29 +134,30 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, {
defaultText: "请选择",
listeners: [
{
eventName: BI.TextValueCombo.EVENT_CHANGE,
eventName: TextValueCombo.EVENT_CHANGE,
action: function () {
console.log(this.getValue());
}
}
]
}, {
},
},
],
},
{
el: {
type: "bi.button",
type: Button.xtype,
text: "setValue(1)",
handler: function () {
combo1.setValue(1);
},
},
vgap: 10,
}
]
},
],
}),
this.createCombo("无初始值,外部受控调用setStatus", {
type: "bi.vertical",
items: [
{
type: "bi.text_value_combo",
type: TextValueCombo.xtype,
ref: function () {
combo2 = this;
},
@ -169,92 +167,92 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, {
defaultText: "请选择",
listeners: [
{
eventName: BI.TextValueCombo.EVENT_CHANGE,
eventName: TextValueCombo.EVENT_CHANGE,
action: function () {
console.log(this.getValue());
}
}
]
}, {
},
},
],
},
{
el: {
type: "bi.button",
type: Button.xtype,
text: "setStatus()",
handler: function () {
combo2.setStatus("error");
},
},
vgap: 10,
}
]
},
],
}),
this.createCombo("支持复选", {
type: "bi.vertical",
type: VerticalLayout.xtype,
items: [
{
type: "bi.text_value_combo",
type: TextValueCombo.xtype,
width: 300,
items: items,
allowClear: true,
defaultText: "请选择",
chooseType: BI.Selection.Multi,
chooseType: Selection.Multi,
value: [1],
// allowSelectAll: false,
listeners: [
{
eventName: BI.TextValueCombo.EVENT_CHANGE,
eventName: TextValueCombo.EVENT_CHANGE,
action: function () {
console.log(this.getValue());
}
}
]
}
]
},
},
],
},
],
}),
this.createCombo("支持复选,不要全选功能", {
type: "bi.vertical",
type: VerticalLayout.xtype,
items: [
{
type: "bi.text_value_combo",
type: TextValueCombo.xtype,
width: 300,
items: items,
allowClear: true,
defaultText: "请选择",
chooseType: BI.Selection.Multi,
chooseType: Selection.Multi,
value: [1],
allowSelectAll: false,
listeners: [
{
eventName: BI.TextValueCombo.EVENT_CHANGE,
eventName: TextValueCombo.EVENT_CHANGE,
action: function () {
console.log(this.getValue());
}
}
]
}
]
})
]
},
},
],
},
],
}),
],
};
},
}
createCombo: function (text, combo) {
createCombo(text, combo) {
return {
type: "bi.vertical",
type: VerticalLayout.xtype,
items: [
{
el: {
type: "bi.label",
type: Label.xtype,
textAlign: "left",
text,
},
bgap: 10
}, {
bgap: 10,
},
{
el: combo,
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("我是无法被触发的!");
},
},
{
type: Button.xtype,
text: "自定义图标按钮(点我修改)",
icon: {
type: "demo.joker.icon",
},
handler() {
console.log("触发点击事件");
this.loading();
setTimeout(() => {
this.loaded();
}, 5 * 1000);
},
},
{
type: Button.xtype,
text: "文字偏左的按钮",

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

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