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.

65 lines
2.0 KiB

BI.TextValueComboPopup = BI.inherit(BI.Pane, {
_defaultConfig: function () {
return BI.extend(BI.TextValueComboPopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-text-icon-popup",
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE
});
},
_init: function () {
BI.TextValueComboPopup.superclass._init.apply(this, arguments);
var o = this.options, self = this;
this.popup = BI.createWidget({
type: "bi.button_group",
3 years ago
items: this._formatItems(o.items),
chooseType: o.chooseType,
layouts: [{
type: "bi.vertical"
}],
value: o.value
});
this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if (type === BI.Events.CLICK) {
self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val, obj);
}
});
7 years ago
this.check();
BI.createWidget({
type: "bi.vertical",
element: this,
7 years ago
vgap: 5,
items: [this.popup]
});
},
3 years ago
_formatItems: function (items) {
var o = this.options;
return BI.map(items, function (i, item) {
return BI.extend({
type: o.chooseType === BI.ButtonGroup.CHOOSE_TYPE_SINGLE ? "bi.single_select_item" : "bi.multi_select_item",
3 years ago
textAlign: o.textAlign,
title: item.title || item.text
}, item);
});
},
populate: function (items) {
BI.TextValueComboPopup.superclass.populate.apply(this, arguments);
3 years ago
this.popup.populate(this._formatItems(items));
},
getValue: function () {
return this.popup.getValue();
},
setValue: function (v) {
this.popup.setValue(v);
}
});
BI.TextValueComboPopup.EVENT_CHANGE = "EVENT_CHANGE";
3 years ago
BI.shortcut("bi.text_value_combo_popup", BI.TextValueComboPopup);