Browse Source

BI-77753 新增不带全选的同步复选下拉框

es6
windy 4 years ago
parent
commit
ddc7127096
  1. 1
      changelog.md
  2. 8
      demo/js/component/demo.valuechoosercombo.js
  3. 96
      src/component/valuechooser/combo.valuechooser.nobar.js

1
changelog.md

@ -1,5 +1,6 @@
# 更新日志
2.0(2020-12)
- 新增不带全选的同步复选下拉框
- 日期选择控件为年月选择器子组件新增POPUP弹出前事件
- 文件上传控件新增API(setMaxFileLength)以动态设置最大上传文件数量
- 复选下拉树显示查看已选效果改成和复选下拉列表一致

8
demo/js/component/demo.valuechoosercombo.js

@ -4,10 +4,16 @@ Demo.ValueChooserCombo = BI.inherit(BI.Widget, {
},
render: function () {
var widget = BI.createWidget({
type: "bi.value_chooser_combo",
type: "bi.value_chooser_no_bar_combo",
itemsCreator: function (op, callback) {
callback(BI.deepClone(Demo.CONSTANTS.ITEMS));
},
listeners: [{
eventName: "EVENT_CONFIRM",
action: function () {
BI.Msg.toast(widget.getValue());
}
}]
});
return {
type: "bi.vertical",

96
src/component/valuechooser/combo.valuechooser.nobar.js

@ -0,0 +1,96 @@
/**
* @author windy
* @version 2.0
* Created by windy on 2020/12/31
*/
BI.ValueChooserNoBarCombo = BI.inherit(BI.AbstractValueChooser, {
_defaultConfig: function () {
return BI.extend(BI.ValueChooserNoBarCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-value-chooser-combo",
width: 200,
height: 24,
items: null,
itemsCreator: BI.emptyFn,
cache: true
});
},
_init: function () {
BI.ValueChooserNoBarCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
if (BI.isNotNull(o.items)) {
this.items = o.items;
}
this.combo = BI.createWidget({
type: "bi.multi_select_no_bar_combo",
element: this,
allowEdit: o.allowEdit,
text: o.text,
value: this._assertValue(o.value),
itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this),
width: o.width,
height: o.height,
listeners: [{
eventName: BI.MultiSelectCombo.EVENT_FOCUS,
action: function () {
self.fireEvent(BI.ValueChooserNoBarCombo.EVENT_FOCUS);
}
}, {
eventName: BI.MultiSelectCombo.EVENT_BLUR,
action: function () {
self.fireEvent(BI.ValueChooserNoBarCombo.EVENT_BLUR);
}
}, {
eventName: BI.MultiSelectCombo.EVENT_STOP,
action: function () {
self.fireEvent(BI.ValueChooserNoBarCombo.EVENT_STOP);
}
}, {
eventName: BI.MultiSelectCombo.EVENT_CLICK_ITEM,
action: function () {
self.fireEvent(BI.ValueChooserNoBarCombo.EVENT_CLICK_ITEM);
}
}, {
eventName: BI.MultiSelectCombo.EVENT_SEARCHING,
action: function () {
self.fireEvent(BI.ValueChooserNoBarCombo.EVENT_SEARCHING);
}
}, {
eventName: BI.MultiSelectCombo.EVENT_CONFIRM,
action: function () {
self.fireEvent(BI.ValueChooserNoBarCombo.EVENT_CONFIRM);
}
}]
});
},
setValue: function (v) {
this.combo.setValue(v);
},
getValue: function () {
return this.combo.getValue();
},
getAllValue: function() {
return this.getValue();
},
populate: function (items) {
// 直接用combo的populate不会作用到AbstractValueChooser上
if (BI.isNotNull(items)) {
this.items = items;
}
this.combo.populate();
}
});
BI.ValueChooserNoBarCombo.EVENT_BLUR = "EVENT_BLUR";
BI.ValueChooserNoBarCombo.EVENT_FOCUS = "EVENT_FOCUS";
BI.ValueChooserNoBarCombo.EVENT_STOP = "EVENT_STOP";
BI.ValueChooserNoBarCombo.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.ValueChooserNoBarCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM";
BI.ValueChooserNoBarCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.value_chooser_no_bar_combo", BI.ValueChooserNoBarCombo);
Loading…
Cancel
Save