import { shortcut, Widget, extend, emptyFn, createWidget, Controller, AbsoluteLayout } from "@/core"; import { MultiSelectSearchLoader } from "./multiselect.search.loader"; @shortcut() export class MultiSelectSearchPane extends Widget { static xtype = "bi.multi_select_search_pane"; constants = { height: 24, lgap: 10, tgap: 5 }; static EVENT_CHANGE = "EVENT_CHANGE"; _defaultConfig() { return extend(super._defaultConfig(...arguments), { baseCls: "bi-multi-select-search-pane bi-card", itemsCreator: emptyFn, valueFormatter: emptyFn, keywordGetter: emptyFn, itemHeight: 24, }); } _init() { super._init(...arguments); const self = this, o = this.options; this.loader = createWidget({ type: MultiSelectSearchLoader.xtype, keywordGetter: o.keywordGetter, valueFormatter: o.valueFormatter, itemFormatter: o.itemFormatter, itemsCreator(op, callback) { o.itemsCreator.apply(self, [ op, function (res) { callback(res); } ]); }, itemHeight: o.itemHeight, value: o.value, }); this.loader.on(Controller.EVENT_CHANGE, function () { self.fireEvent(Controller.EVENT_CHANGE, arguments); }); this.resizer = createWidget({ type: AbsoluteLayout.xtype, element: this, items: [ { el: this.loader, left: 0, right: 0, bottom: 0, top: 0, } ], }); } isAllSelected() { return this.loader.isAllSelected(); } hasMatched() { } setValue(v) { this.loader.setValue(v); } getValue() { return this.loader.getValue(); } empty() { this.loader.empty(); } populate(items) { this.loader.populate(...arguments); } }