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.
 
 
 

72 lines
1.9 KiB

import { shortcut, Widget, Selection, each, contains } from "@/core";
import { SearchMultiTextValueCombo } from "@/widget";
@shortcut()
export class AllValueMultiTextValueCombo extends Widget {
static xtype = "bi.all_value_multi_text_value_combo";
props = { baseCls: "bi-all-value-multi-text-value-combo", width: 200, height: 24, items: [] };
static EVENT_CONFIRM = "EVENT_CONFIRM";
render() {
const self = this,
o = this.options;
const value = this._digestValue(o.value);
return {
type: "bi.search_multi_text_value_combo",
simple: o.simple,
text: o.text,
height: o.height,
items: o.items,
value,
numOfPage: 100,
valueFormatter: o.valueFormatter,
warningTitle: o.warningTitle,
listeners: [
{
eventName: SearchMultiTextValueCombo.EVENT_CONFIRM,
action () {
self.fireEvent(AllValueMultiTextValueCombo.EVENT_CONFIRM);
},
}
],
ref () {
self.combo = this;
},
};
}
setValue(v) {
const value = this._digestValue(v);
this.combo.setValue(value);
}
getValue() {
const obj = this.combo.getValue() || {};
obj.value = obj.value || [];
if (obj.type === Selection.All) {
const values = [];
each(this.options.items, (idx, item) => {
!contains(obj.value, item.value) && values.push(item.value);
});
return values;
}
return obj.value || [];
}
populate(items) {
this.options.items = items;
this.combo.populate(...arguments);
}
_digestValue(v) {
return {
type: Selection.Multi,
value: v || [],
};
}
}