diff --git a/packages/fineui/src/base/combination/switcher.js b/packages/fineui/src/base/combination/switcher.js index 518690ca0..85e4a8083 100644 --- a/packages/fineui/src/base/combination/switcher.js +++ b/packages/fineui/src/base/combination/switcher.js @@ -11,7 +11,7 @@ import { isNull, Events, Direction, - EVENT_RESPONSE_TIME + EVENT_RESPONSE_TIME, isFunction } from "@/core"; import { ButtonGroup } from "./group.button"; import { Maskers } from "@/base/0.base"; @@ -188,7 +188,8 @@ export class Switcher extends Widget { } _assertPopupView() { - const { popup, adapter, masker, value, direction } = this.options; + const { popup, masker, value, direction } = this.options; + const adapter = isFunction(this.options.adapter) ? this.options.adapter() : this.options.adapter; if (!this._created) { this.popupView = createWidget( popup, diff --git a/packages/fineui/src/widget/multiselect/multiselect.combo.js b/packages/fineui/src/widget/multiselect/multiselect.combo.js index 2c807beac..c4b2445cf 100644 --- a/packages/fineui/src/widget/multiselect/multiselect.combo.js +++ b/packages/fineui/src/widget/multiselect/multiselect.combo.js @@ -99,13 +99,8 @@ export class MultiSelectCombo extends Single { height: toPix(o.height, o.simple ? 1 : 2), text: o.text, defaultText: o.defaultText, - masker: { - offset: { - left: 0, - top: 0, - right: 0, - bottom: SIZE_CONSANTS.LIST_ITEM_HEIGHT + 1, - }, + adapter: () => { + return this.popup.getView(); }, valueFormatter: o.valueFormatter, itemFormatter: o.itemFormatter, @@ -185,8 +180,6 @@ export class MultiSelectCombo extends Single { type: MultiSelectPopupView.xtype, ref() { self.popup = this; - self.trigger.setAdapter(this); - self.numberCounter.setAdapter(this); }, listeners: [ { @@ -269,13 +262,8 @@ export class MultiSelectCombo extends Single { this.numberCounter = createWidget({ type: MultiSelectCheckSelectedSwitcher.xtype, - masker: { - offset: { - left: 0, - top: 0, - right: 0, - bottom: SIZE_CONSANTS.LIST_ITEM_HEIGHT + 1, - }, + adapter: () => { + return this.popup.getView(); }, valueFormatter: o.valueFormatter, itemsCreator: bind(this._itemsCreator4Trigger, this), diff --git a/packages/fineui/src/widget/multiselect/multiselect.combo.nobar.js b/packages/fineui/src/widget/multiselect/multiselect.combo.nobar.js index cc1a1196a..3c9bb5689 100644 --- a/packages/fineui/src/widget/multiselect/multiselect.combo.nobar.js +++ b/packages/fineui/src/widget/multiselect/multiselect.combo.nobar.js @@ -97,13 +97,8 @@ export class MultiSelectNoBarCombo extends Single { height: toPix(o.height, o.simple ? 1 : 2), text: o.text, defaultText: o.defaultText, - masker: { - offset: { - left: 0, - top: 0, - right: 0, - bottom: SIZE_CONSANTS.LIST_ITEM_HEIGHT + 1, - }, + adapter: () => { + return this.popup.getView(); }, valueFormatter: o.valueFormatter, itemsCreator: bind(this._itemsCreator4Trigger, this), @@ -185,8 +180,6 @@ export class MultiSelectNoBarCombo extends Single { type: MultiSelectNoBarPopupView.xtype, ref() { self.popup = this; - self.trigger.setAdapter(this); - self.numberCounter.setAdapter(this); }, listeners: [ { @@ -272,13 +265,8 @@ export class MultiSelectNoBarCombo extends Single { this.numberCounter = createWidget({ type: MultiSelectCheckSelectedSwitcher.xtype, - masker: { - offset: { - left: 0, - top: 0, - right: 0, - bottom: SIZE_CONSANTS.LIST_ITEM_HEIGHT + 1, - }, + adapter: () => { + return this.popup.getView(); }, valueFormatter: o.valueFormatter, itemsCreator: bind(this._itemsCreator4Trigger, this), diff --git a/packages/fineui/src/widget/multiselect/multiselect.insert.combo.js b/packages/fineui/src/widget/multiselect/multiselect.insert.combo.js index 008d1039b..8a9ef9546 100644 --- a/packages/fineui/src/widget/multiselect/multiselect.insert.combo.js +++ b/packages/fineui/src/widget/multiselect/multiselect.insert.combo.js @@ -99,14 +99,8 @@ export class MultiSelectInsertCombo extends Single { text: o.text, watermark: o.watermark, defaultText: o.defaultText, - // adapter: this.popup, - masker: { - offset: { - left: 0, - top: 0, - right: 0, - bottom: SIZE_CONSANTS.LIST_ITEM_HEIGHT + 1, - }, + adapter: () => { + return this.popup.getView(); }, valueFormatter: o.valueFormatter, itemsCreator: bind(this._itemsCreator4Trigger, this), @@ -151,7 +145,7 @@ export class MultiSelectInsertCombo extends Single { self._dataChange = true; }); this.getSearcher().getKeywordsLength() > 2000 && - Msg.alert(i18nText("BI-Basic_Prompt"), i18nText("BI-Basic_Too_Much_Value_Get_Two_Thousand")); + Msg.alert(i18nText("BI-Basic_Prompt"), i18nText("BI-Basic_Too_Much_Value_Get_Two_Thousand")); } self.fireEvent(MultiSelectInsertCombo.EVENT_SEARCHING); }); @@ -192,8 +186,6 @@ export class MultiSelectInsertCombo extends Single { type: MultiSelectPopupView.xtype, ref() { self.popup = this; - self.trigger.setAdapter(this); - self.numberCounter.setAdapter(this); }, listeners: [ { @@ -276,13 +268,8 @@ export class MultiSelectInsertCombo extends Single { this.numberCounter = createWidget({ type: MultiSelectCheckSelectedSwitcher.xtype, - masker: { - offset: { - left: 0, - top: 0, - right: 0, - bottom: SIZE_CONSANTS.LIST_ITEM_HEIGHT + 1, - }, + adapter: () => { + return this.popup.getView(); }, valueFormatter: o.valueFormatter, itemsCreator: bind(this._itemsCreator4Trigger, this), diff --git a/packages/fineui/src/widget/multiselect/multiselect.insert.combo.nobar.js b/packages/fineui/src/widget/multiselect/multiselect.insert.combo.nobar.js index 0110bc518..4a20ef6fd 100644 --- a/packages/fineui/src/widget/multiselect/multiselect.insert.combo.nobar.js +++ b/packages/fineui/src/widget/multiselect/multiselect.insert.combo.nobar.js @@ -93,14 +93,8 @@ export class MultiSelectInsertNoBarCombo extends Single { type: MultiSelectInsertTrigger.xtype, height: toPix(o.height, o.simple ? 1 : 2), text: o.text, - // adapter: this.popup, - masker: { - offset: { - left: 0, - top: 0, - right: 0, - bottom: SIZE_CONSANTS.LIST_ITEM_HEIGHT + 1, - }, + adapter: () => { + return this.popup.getView(); }, valueFormatter: o.valueFormatter, itemsCreator: bind(this._itemsCreator4Trigger, this), @@ -140,7 +134,7 @@ export class MultiSelectInsertNoBarCombo extends Single { self._dataChange = true; }); this.getSearcher().getKeywordsLength() > 2000 && - Msg.alert(i18nText("BI-Basic_Prompt"), i18nText("BI-Basic_Too_Much_Value_Get_Two_Thousand")); + Msg.alert(i18nText("BI-Basic_Prompt"), i18nText("BI-Basic_Too_Much_Value_Get_Two_Thousand")); } }); @@ -178,8 +172,6 @@ export class MultiSelectInsertNoBarCombo extends Single { type: MultiSelectNoBarPopupView.xtype, ref() { self.popup = this; - self.trigger.setAdapter(this); - self.numberCounter.setAdapter(this); }, listeners: [ { @@ -263,13 +255,8 @@ export class MultiSelectInsertNoBarCombo extends Single { this.numberCounter = createWidget({ type: MultiSelectCheckSelectedSwitcher.xtype, - masker: { - offset: { - left: 0, - top: 0, - right: 0, - bottom: SIZE_CONSANTS.LIST_ITEM_HEIGHT + 1, - }, + adapter: () => { + return this.popup.getView(); }, valueFormatter: o.valueFormatter, itemsCreator: bind(this._itemsCreator4Trigger, this), diff --git a/packages/fineui/src/widget/multiselect/multiselect.popup.view.js b/packages/fineui/src/widget/multiselect/multiselect.popup.view.js index 2a833446e..84e3faf58 100644 --- a/packages/fineui/src/widget/multiselect/multiselect.popup.view.js +++ b/packages/fineui/src/widget/multiselect/multiselect.popup.view.js @@ -98,4 +98,8 @@ export class MultiSelectPopupView extends Widget { setDirection(direction, position) { this.popupView.setDirection(direction, position); } + + getView() { + return this.popupView.getView(); + } } diff --git a/packages/fineui/src/widget/multiselect/multiselect.popup.view.nobar.js b/packages/fineui/src/widget/multiselect/multiselect.popup.view.nobar.js index 1ba871201..728ccf50c 100644 --- a/packages/fineui/src/widget/multiselect/multiselect.popup.view.nobar.js +++ b/packages/fineui/src/widget/multiselect/multiselect.popup.view.nobar.js @@ -93,4 +93,8 @@ export class MultiSelectNoBarPopupView extends Widget { setDirection(direction, position) { this.popupView.setDirection(direction, position); } + + getView() { + return this.popupView.getView(); + } }