import { shortcut, Widget, extend, emptyFn, createWidget } from "@/core"; import { TreeView, Asynctree } from "@/case"; @shortcut() export class MultiSelectTreePopup extends Widget { static xtype = "bi.multi_select_tree_popup"; static EVENT_AFTER_INIT = "EVENT_AFTER_INIT"; static EVENT_CHANGE = "EVENT_CHANGE"; _defaultConfig() { return extend(super._defaultConfig(...arguments), { baseCls: "bi-multi-select-tree-popup bi-border-left bi-border-right bi-border-bottom", itemsCreator: emptyFn, }); } _init() { super._init(...arguments); const self = this, o = this.options; this.popup = createWidget({ type: Asynctree.xtype, showLine: o.showLine, element: this, itemsCreator: o.itemsCreator, }); this.popup.on(TreeView.EVENT_AFTERINIT, () => { self.fireEvent(MultiSelectTreePopup.EVENT_AFTER_INIT); }); this.popup.on(TreeView.EVENT_CHANGE, () => { self.fireEvent(MultiSelectTreePopup.EVENT_CHANGE); }); } hasChecked() { return this.popup.hasChecked(); } getValue() { return this.popup.getValue(); } setValue(v) { v || (v = {}); this.popup.setValue(v); } setSelectedValue(v) { v || (v = {}); this.popup.setSelectedValue(v); } updateValue(v) { this.popup.updateValue(v); this.popup.refresh(); } populate(config) { this.popup.stroke(config); } }