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.

85 lines
2.0 KiB

2 years ago
import {
shortcut,
Widget,
extend,
i18nText,
emptyFn,
createWidget,
Controller,
VerticalLayout,
isArray
} from "@/core";
import { MultiLayerSingleLevelTree } from "./multilayersingletree.leveltree";
2 years ago
@shortcut()
export class MultiLayerSingleTreePopup extends Widget {
static xtype = "bi.multilayer_single_tree_popup";
2 years ago
static EVENT_CHANGE = "EVENT_CHANGE";
_defaultConfig() {
return extend(super._defaultConfig(...arguments), {
baseCls: "bi-multilayer-singletree-popup",
2 years ago
tipText: i18nText("BI-No_Selected_Item"),
isDefaultInit: false,
2 years ago
itemsCreator: emptyFn,
items: [],
2 years ago
onLoaded: emptyFn,
minHeight: 240,
});
2 years ago
}
2 years ago
_init() {
super._init(...arguments);
2 years ago
const self = this,
o = this.options;
2 years ago
this.tree = createWidget({
type: MultiLayerSingleLevelTree.xtype,
isDefaultInit: o.isDefaultInit,
items: o.items,
6 years ago
itemsCreator: o.itemsCreator,
keywordGetter: o.keywordGetter,
6 years ago
value: o.value,
scrollable: null,
2 years ago
onLoaded() {
self.tree.check();
o.onLoaded();
2 years ago
},
});
2 years ago
createWidget({
type: VerticalLayout.xtype,
scrolly: false,
scrollable: true,
element: this,
7 years ago
vgap: 5,
2 years ago
items: [this.tree],
});
2 years ago
this.tree.on(Controller.EVENT_CHANGE, function () {
self.fireEvent(Controller.EVENT_CHANGE, arguments);
});
2 years ago
this.tree.on(MultiLayerSingleLevelTree.EVENT_CHANGE, () => {
self.fireEvent(MultiLayerSingleTreePopup.EVENT_CHANGE);
});
this.tree.css("min-height", BI.pixFormat(o.minHeight - 10));
2 years ago
}
6 years ago
2 years ago
getValue() {
return this.tree.getValue();
2 years ago
}
2 years ago
setValue(v) {
v = isArray(v) ? v : [v];
this.tree.setValue(v);
2 years ago
}
2 years ago
populate(items) {
this.tree.populate(items);
}
2 years ago
}