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.
 
 
 

80 lines
2.2 KiB

import { shortcut, extend, createWidget, createItems, Controller, Events, VerticalLayout } from "@/core";
import { Pane, ButtonGroup } from "@/base";
import { SingleSelectIconTextItem } from "../../button";
@shortcut()
export class IconTextValueComboPopup extends Pane {
static xtype = "bi.icon_text_value_combo_popup";
static EVENT_CHANGE = "EVENT_CHANGE";
_defaultConfig() {
return extend(super._defaultConfig(...arguments), {
baseCls: "bi-icon-text-icon-popup",
behaviors: {
redmark() {
return true;
},
},
});
}
_init() {
super._init(...arguments);
const o = this.options;
this.popup = createWidget({
type: ButtonGroup.xtype,
items: createItems(o.items, {
type: SingleSelectIconTextItem.xtype,
iconHeight: o.iconHeight,
iconWidth: o.iconWidth,
iconWrapperWidth: o.iconWrapperWidth,
}),
chooseType: ButtonGroup.CHOOSE_TYPE_SINGLE,
layouts: [
{
type: VerticalLayout.xtype,
}
],
behaviors: o.behaviors,
value: o.value,
});
this.popup.on(Controller.EVENT_CHANGE, (...args) => {
const [type, val, obj] = args;
this.fireEvent(Controller.EVENT_CHANGE, ...args);
if (type === Events.CLICK) {
this.fireEvent(IconTextValueComboPopup.EVENT_CHANGE, val, obj);
}
});
this.check();
createWidget({
type: VerticalLayout.xtype,
element: this,
vgap: 5,
items: [this.popup],
});
}
populate(items, keyword) {
super.populate(...arguments);
const o = this.options;
items = createItems(items, {
type: SingleSelectIconTextItem.xtype,
iconWrapperWidth: o.iconWrapperWidth,
iconHeight: o.iconHeight,
iconWidth: o.iconWidth,
});
this.popup.populate(items, keyword);
}
getValue() {
return this.popup.getValue();
}
setValue(v) {
this.popup.setValue(v);
}
}