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.
 
 
 

95 lines
2.7 KiB

import { shortcut, Widget, extend, emptyFn, createWidget, i18nText } from "@/core";
import { MultiPopupView } from "@/case";
import { MultiSelectNoBarLoader } from "./multiselect.loader.nobar";
@shortcut()
export class MultiSelectNoBarPopupView extends Widget {
static xtype = "bi.multi_select_no_bar_popup_view";
static EVENT_CHANGE = "EVENT_CHANGE";
static EVENT_CLICK_CONFIRM = "EVENT_CLICK_CONFIRM";
static EVENT_CLICK_CLEAR = "EVENT_CLICK_CLEAR";
_defaultConfig() {
return extend(super._defaultConfig(...arguments), {
baseCls: "bi-multi-select-popup-view",
maxWidth: "auto",
minWidth: 135,
maxHeight: 400,
valueFormatter: emptyFn,
itemsCreator: emptyFn,
itemHeight: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
onLoaded: emptyFn,
});
}
_init() {
super._init(...arguments);
const self = this,
opts = this.options;
this.loader = createWidget({
type: MultiSelectNoBarLoader.xtype,
itemsCreator: opts.itemsCreator,
itemHeight: opts.itemHeight,
valueFormatter: opts.valueFormatter,
itemFormatter: opts.itemFormatter,
onLoaded: opts.onLoaded,
value: opts.value,
});
this.popupView = createWidget({
type: MultiPopupView.xtype,
stopPropagation: false,
maxWidth: opts.maxWidth,
minWidth: opts.minWidth,
maxHeight: opts.maxHeight,
element: this,
buttons: [i18nText("BI-Basic_Clears"), i18nText("BI-Basic_OK")],
el: this.loader,
value: opts.value,
});
this.popupView.on(MultiPopupView.EVENT_CHANGE, () => {
self.fireEvent(MultiSelectNoBarPopupView.EVENT_CHANGE);
});
this.popupView.on(MultiPopupView.EVENT_CLICK_TOOLBAR_BUTTON, index => {
switch (index) {
case 0:
self.fireEvent(MultiSelectNoBarPopupView.EVENT_CLICK_CLEAR);
break;
case 1:
self.fireEvent(MultiSelectNoBarPopupView.EVENT_CLICK_CONFIRM);
break;
}
});
}
setStartValue(v) {
this.loader.setStartValue(v);
}
setValue(v) {
this.popupView.setValue(v);
}
getValue() {
return this.popupView.getValue();
}
populate(items) {
this.popupView.populate(...arguments);
}
resetHeight(h) {
this.popupView.resetHeight(h);
}
resetWidth(w) {
this.popupView.resetWidth(w);
}
setDirection(direction, position) {
this.popupView.setDirection(direction, position);
}
}