From 5acdba1e5b7159666566f01a5f28940a3f7bb684 Mon Sep 17 00:00:00 2001 From: Anny Date: Fri, 7 Jul 2023 10:27:18 +0800 Subject: [PATCH 1/4] =?UTF-8?q?KERNEL-14848=20feat:=20VirtualGroupList?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=96=B0=E5=A2=9EgetNodeByValue=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fineui/src/base/list/virtualgrouplist.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/fineui/src/base/list/virtualgrouplist.js b/packages/fineui/src/base/list/virtualgrouplist.js index df033bbbc..06edd5692 100644 --- a/packages/fineui/src/base/list/virtualgrouplist.js +++ b/packages/fineui/src/base/list/virtualgrouplist.js @@ -214,4 +214,8 @@ export class VirtualGroupList extends Widget { ResizeDetector.removeResizeListener(this); this.restore(); } + + getNodeByValue(value) { + return this.container.getNodeByValue(value); + } } From 00b8eb7be808d124871fe85cac6b1e7e172b45be Mon Sep 17 00:00:00 2001 From: dailer Date: Fri, 7 Jul 2023 14:19:59 +0800 Subject: [PATCH 2/4] =?UTF-8?q?BI-128437=20fix:=20=E3=80=90=E6=9D=A5?= =?UTF-8?q?=E6=BA=90PT=E9=A1=B9=E7=9B=AE=E3=80=91BI=E7=BB=91=E5=AE=9A?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E6=96=87=E6=9C=AC=E4=B8=8B=E6=8B=89=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fineui/src/widget/multiselect/loader.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/fineui/src/widget/multiselect/loader.js b/packages/fineui/src/widget/multiselect/loader.js index db341ce95..f7146250f 100644 --- a/packages/fineui/src/widget/multiselect/loader.js +++ b/packages/fineui/src/widget/multiselect/loader.js @@ -72,7 +72,8 @@ export class MultiSelectInnerLoader extends Widget { this.next.setLoading(); if (this.cachItems && this.cachItems.length > 0) { this.next.setLoaded(); - this.addItems(this.cachItems.slice(0, 100)); + const items = this._composeItems(this.cachItems.slice(0, 100)); + this.addItems(items); this.cachItems = this.cachItems.slice(100); return; @@ -204,6 +205,16 @@ export class MultiSelectInnerLoader extends Widget { this.button_group.addItems(...arguments); } + _composeItems(items) { + const cacheValue = this.cachGroup.getValue(); + return items.map(item => { + return { + ...item, + selected: cacheValue.includes(item.value || item.id) + }; + }); + } + _populate(items) { const self = this, o = this.options; From 6e562ece5ace1cc992216e62403de0ee8074d8c9 Mon Sep 17 00:00:00 2001 From: dailer Date: Fri, 7 Jul 2023 16:53:46 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=97=A0JIRA=20=E6=B7=BB=E5=8A=A0EVENT=5FA?= =?UTF-8?q?FTER=5FHIDEVIEW=20=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/widget/multiselect/multiselect.combo.js | 12 +++++++----- .../multiselect/multiselect.combo.nobar.js | 12 +++++++----- .../multiselect/multiselect.insert.combo.js | 16 +++++++++------- .../multiselect.insert.combo.nobar.js | 16 +++++++++------- .../widget/multiselect/multiselect.combo.ts | 3 ++- .../multiselect/multiselect.insert.combo.ts | 3 ++- 6 files changed, 36 insertions(+), 26 deletions(-) diff --git a/packages/fineui/src/widget/multiselect/multiselect.combo.js b/packages/fineui/src/widget/multiselect/multiselect.combo.js index c4b2445cf..fb5f31968 100644 --- a/packages/fineui/src/widget/multiselect/multiselect.combo.js +++ b/packages/fineui/src/widget/multiselect/multiselect.combo.js @@ -47,6 +47,7 @@ export class MultiSelectCombo extends Single { static EVENT_SEARCHING = "EVENT_SEARCHING"; static EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM"; static EVENT_CONFIRM = "EVENT_CONFIRM"; + static MultiSelectCombo = "MultiSelectCombo"; _defaultConfig() { return extend(super._defaultConfig(...arguments), { @@ -116,7 +117,7 @@ export class MultiSelectCombo extends Single { self.fireEvent(MultiSelectCombo.EVENT_BLUR); }); - this.trigger.on(MultiSelectTrigger.EVENT_START, function () { + this.trigger.on(MultiSelectTrigger.EVENT_START, function() { self._setStartValue(""); this.getSearcher().setValue(self.storeValue); }); @@ -144,7 +145,7 @@ export class MultiSelectCombo extends Single { self.fireEvent(MultiSelectCombo.EVENT_SEARCHING); }); - this.trigger.on(MultiSelectTrigger.EVENT_CHANGE, function (value, obj) { + this.trigger.on(MultiSelectTrigger.EVENT_CHANGE, function(value, obj) { if (obj instanceof MultiSelectBar) { self._joinAll(this.getValue(), () => { assertShowValue(); @@ -230,7 +231,7 @@ export class MultiSelectCombo extends Single { }, }); - this.combo.on(Combo.EVENT_BEFORE_POPUPVIEW, function () { + this.combo.on(Combo.EVENT_BEFORE_POPUPVIEW, function() { if (!this.isViewVisible()) { self._dataChange = false; // 标记数据是否发生变化 } @@ -249,6 +250,7 @@ export class MultiSelectCombo extends Single { } else { self._dataChange && self.fireEvent(MultiSelectCombo.EVENT_CONFIRM); } + this.fireEvent(MultiSelectCombo.EVENT_AFTER_HIDEVIEW); }); triggerBtn.on(TriggerIconButton.EVENT_CHANGE, () => { @@ -274,7 +276,7 @@ export class MultiSelectCombo extends Single { self.combo.showView(); } }); - this.numberCounter.on(MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW, function () { + this.numberCounter.on(MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW, function() { this.updateSelectedValue(self.storeValue); }); @@ -331,7 +333,7 @@ export class MultiSelectCombo extends Single { _itemsCreator4Trigger(op, callback) { const self = this; const o = this.options; - o.itemsCreator(op, function (res) { + o.itemsCreator(op, function(res) { if (op.times === 1 && isNotNull(op.keywords)) { // 预防trigger内部把当前的storeValue改掉 self.trigger.setValue(deepClone(self.getValue())); diff --git a/packages/fineui/src/widget/multiselect/multiselect.combo.nobar.js b/packages/fineui/src/widget/multiselect/multiselect.combo.nobar.js index 3c9bb5689..32d4dfde8 100644 --- a/packages/fineui/src/widget/multiselect/multiselect.combo.nobar.js +++ b/packages/fineui/src/widget/multiselect/multiselect.combo.nobar.js @@ -48,6 +48,7 @@ export class MultiSelectNoBarCombo extends Single { static EVENT_SEARCHING = "EVENT_SEARCHING"; static EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM"; static EVENT_CONFIRM = "EVENT_CONFIRM"; + static EVENT_AFTER_HIDEVIEW = "EVENT_AFTER_HIDEVIEW"; _defaultConfig() { return extend(super._defaultConfig(...arguments), { @@ -117,7 +118,7 @@ export class MultiSelectNoBarCombo extends Single { self.fireEvent(MultiSelectNoBarCombo.EVENT_BLUR); }); - this.trigger.on(MultiSelectTrigger.EVENT_START, function () { + this.trigger.on(MultiSelectTrigger.EVENT_START, function() { self._setStartValue(""); this.getSearcher().setValue(self.storeValue); }); @@ -145,7 +146,7 @@ export class MultiSelectNoBarCombo extends Single { } }); - this.trigger.on(MultiSelectTrigger.EVENT_CHANGE, function (value, obj) { + this.trigger.on(MultiSelectTrigger.EVENT_CHANGE, function(value, obj) { if (obj instanceof MultiSelectBar) { self._joinAll(this.getValue(), () => { assertShowValue(); @@ -233,7 +234,7 @@ export class MultiSelectNoBarCombo extends Single { }, }); - this.combo.on(Combo.EVENT_BEFORE_POPUPVIEW, function () { + this.combo.on(Combo.EVENT_BEFORE_POPUPVIEW, function() { if (!this.isViewVisible()) { self._dataChange = false; // 标记数据是否发生变化 } @@ -252,6 +253,7 @@ export class MultiSelectNoBarCombo extends Single { } else { self._dataChange && self.fireEvent(MultiSelectNoBarCombo.EVENT_CONFIRM); } + this.fireEvent(MultiSelectNoBarCombo.EVENT_AFTER_HIDEVIEW); }); triggerBtn.on(TriggerIconButton.EVENT_CHANGE, () => { @@ -280,7 +282,7 @@ export class MultiSelectNoBarCombo extends Single { self.combo.showView(); } }); - this.numberCounter.on(MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW, function () { + this.numberCounter.on(MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW, function() { this.updateSelectedValue(self.storeValue); }); @@ -360,7 +362,7 @@ export class MultiSelectNoBarCombo extends Single { _itemsCreator4Trigger(op, callback) { const self = this, o = this.options; - o.itemsCreator(op, function (res) { + o.itemsCreator(op, function(res) { if (op.times === 1 && isNotNull(op.keywords)) { // 预防trigger内部把当前的storeValue改掉 self.trigger.setValue(deepClone(self.storeValue)); diff --git a/packages/fineui/src/widget/multiselect/multiselect.insert.combo.js b/packages/fineui/src/widget/multiselect/multiselect.insert.combo.js index 8a9ef9546..9a047fbd0 100644 --- a/packages/fineui/src/widget/multiselect/multiselect.insert.combo.js +++ b/packages/fineui/src/widget/multiselect/multiselect.insert.combo.js @@ -50,6 +50,7 @@ export class MultiSelectInsertCombo extends Single { static EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM"; static EVENT_CONFIRM = "EVENT_CONFIRM"; static EVENT_ADD_ITEM = "EVENT_ADD_ITEM"; + static EVENT_AFTER_HIDEVIEW = "EVENT_AFTER_HIDEVIEW"; _defaultConfig() { return extend(super._defaultConfig(...arguments), { @@ -116,7 +117,7 @@ export class MultiSelectInsertCombo extends Single { self.fireEvent(MultiSelectInsertCombo.EVENT_BLUR); }); - this.trigger.on(MultiSelectInsertTrigger.EVENT_START, function () { + this.trigger.on(MultiSelectInsertTrigger.EVENT_START, function() { self._setStartValue(""); this.getSearcher().setValue(self.storeValue); }); @@ -124,11 +125,11 @@ export class MultiSelectInsertCombo extends Single { self._setStartValue(""); self.fireEvent(MultiSelectInsertCombo.EVENT_STOP); }); - this.trigger.on(MultiSelectInsertTrigger.EVENT_PAUSE, function () { + this.trigger.on(MultiSelectInsertTrigger.EVENT_PAUSE, function() { self._addItem(assertShowValue, true); self.fireEvent(MultiSelectInsertCombo.EVENT_ADD_ITEM, this.getSearcher().getKeyword()); }); - this.trigger.on(MultiSelectInsertTrigger.EVENT_SEARCHING, function (keywords) { + this.trigger.on(MultiSelectInsertTrigger.EVENT_SEARCHING, function(keywords) { const lastKeyword = last(keywords); keywords = initial(keywords || []); if (keywords.length > 0) { @@ -150,7 +151,7 @@ export class MultiSelectInsertCombo extends Single { self.fireEvent(MultiSelectInsertCombo.EVENT_SEARCHING); }); - this.trigger.on(MultiSelectInsertTrigger.EVENT_CHANGE, function (value, obj) { + this.trigger.on(MultiSelectInsertTrigger.EVENT_CHANGE, function(value, obj) { if (obj instanceof MultiSelectBar) { self._joinAll(this.getValue(), () => { assertShowValue(); @@ -236,7 +237,7 @@ export class MultiSelectInsertCombo extends Single { }, }); - this.combo.on(Combo.EVENT_BEFORE_POPUPVIEW, function () { + this.combo.on(Combo.EVENT_BEFORE_POPUPVIEW, function() { if (!this.isViewVisible()) { self._dataChange = false; // 标记数据是否发生变化 } @@ -255,6 +256,7 @@ export class MultiSelectInsertCombo extends Single { } else { self._dataChange && self.fireEvent(MultiSelectInsertCombo.EVENT_CONFIRM); } + this.fireEvent(MultiSelectInsertCombo.EVENT_AFTER_HIDEVIEW); }); triggerBtn.on(TriggerIconButton.EVENT_CHANGE, () => { @@ -280,7 +282,7 @@ export class MultiSelectInsertCombo extends Single { self.combo.showView(); } }); - this.numberCounter.on(MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW, function () { + this.numberCounter.on(MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW, function() { this.updateSelectedValue(self.storeValue); }); @@ -337,7 +339,7 @@ export class MultiSelectInsertCombo extends Single { _itemsCreator4Trigger(op, callback) { const self = this, o = this.options; - o.itemsCreator(op, function (res) { + o.itemsCreator(op, function(res) { if (op.times === 1 && isNotNull(op.keywords)) { // 预防trigger内部把当前的storeValue改掉 self.trigger.setValue(deepClone(self.getValue())); 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 4a20ef6fd..03300f29c 100644 --- a/packages/fineui/src/widget/multiselect/multiselect.insert.combo.nobar.js +++ b/packages/fineui/src/widget/multiselect/multiselect.insert.combo.nobar.js @@ -45,6 +45,7 @@ export class MultiSelectInsertNoBarCombo extends Single { static REQ_GET_ALL_DATA = "-1"; static EVENT_CONFIRM = "EVENT_CONFIRM"; static EVENT_ADD_ITEM = "EVENT_ADD_ITEM"; + static EVENT_AFTER_HIDEVIEW = "EVENT_AFTER_HIDEVIEW"; _defaultConfig() { return extend(super._defaultConfig(...arguments), { @@ -106,18 +107,18 @@ export class MultiSelectInsertNoBarCombo extends Single { }, }); - this.trigger.on(MultiSelectInsertTrigger.EVENT_START, function () { + this.trigger.on(MultiSelectInsertTrigger.EVENT_START, function() { self._setStartValue(""); this.getSearcher().setValue(self.storeValue); }); this.trigger.on(MultiSelectInsertTrigger.EVENT_STOP, () => { self._setStartValue(""); }); - this.trigger.on(MultiSelectInsertTrigger.EVENT_PAUSE, function () { + this.trigger.on(MultiSelectInsertTrigger.EVENT_PAUSE, function() { self._addItem(assertShowValue, true); self.fireEvent(MultiSelectInsertNoBarCombo.EVENT_ADD_ITEM, this.getSearcher().getKeyword()); }); - this.trigger.on(MultiSelectInsertTrigger.EVENT_SEARCHING, function (keywords) { + this.trigger.on(MultiSelectInsertTrigger.EVENT_SEARCHING, function(keywords) { const lastKeyword = last(keywords); keywords = initial(keywords || []); if (keywords.length > 0) { @@ -138,7 +139,7 @@ export class MultiSelectInsertNoBarCombo extends Single { } }); - this.trigger.on(MultiSelectInsertTrigger.EVENT_CHANGE, function (value, obj) { + this.trigger.on(MultiSelectInsertTrigger.EVENT_CHANGE, function(value, obj) { if (obj instanceof MultiSelectBar) { self._joinAll(this.getValue(), () => { assertShowValue(); @@ -223,7 +224,7 @@ export class MultiSelectInsertNoBarCombo extends Single { }, }); - this.combo.on(Combo.EVENT_BEFORE_POPUPVIEW, function () { + this.combo.on(Combo.EVENT_BEFORE_POPUPVIEW, function() { if (!this.isViewVisible()) { self._dataChange = false; // 标记数据是否发生变化 } @@ -242,6 +243,7 @@ export class MultiSelectInsertNoBarCombo extends Single { } else { self._dataChange && self.fireEvent(MultiSelectInsertNoBarCombo.EVENT_CONFIRM); } + this.fireEvent(MultiSelectInsertNoBarCombo.EVENT_AFTER_HIDEVIEW); }); triggerBtn.on(TriggerIconButton.EVENT_CHANGE, () => { @@ -270,7 +272,7 @@ export class MultiSelectInsertNoBarCombo extends Single { self.combo.showView(); } }); - this.numberCounter.on(MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW, function () { + this.numberCounter.on(MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW, function() { this.updateSelectedValue(self.storeValue); }); @@ -327,7 +329,7 @@ export class MultiSelectInsertNoBarCombo extends Single { _itemsCreator4Trigger(op, callback) { const self = this, o = this.options; - o.itemsCreator(op, function (res) { + o.itemsCreator(op, function(res) { if (op.times === 1 && isNotNull(op.keywords)) { // 预防trigger内部把当前的storeValue改掉 self.trigger.setValue(deepClone(self.storeValue)); diff --git a/packages/fineui/typescript/widget/multiselect/multiselect.combo.ts b/packages/fineui/typescript/widget/multiselect/multiselect.combo.ts index 9ebe8b9fb..1fc48731b 100644 --- a/packages/fineui/typescript/widget/multiselect/multiselect.combo.ts +++ b/packages/fineui/typescript/widget/multiselect/multiselect.combo.ts @@ -10,6 +10,7 @@ export declare class MultiSelectCombo extends Single { static EVENT_CONFIRM: string; static REQ_GET_DATA_LENGTH: 1; static REQ_GET_ALL_DATA: -1; + static EVENT_AFTER_HIDEVIEW: string; props: { itemsCreator: (options: any, callback: () => any[]) => void; @@ -17,7 +18,7 @@ export declare class MultiSelectCombo extends Single { text: string; valueFormatter: (v: string) => string; allowEdit: boolean; - } & Single['props'] + } & Single["props"]; _itemsCreator4Trigger(op: any, callback: Function): void; diff --git a/packages/fineui/typescript/widget/multiselect/multiselect.insert.combo.ts b/packages/fineui/typescript/widget/multiselect/multiselect.insert.combo.ts index 98e33d28e..bd0a75ece 100644 --- a/packages/fineui/typescript/widget/multiselect/multiselect.insert.combo.ts +++ b/packages/fineui/typescript/widget/multiselect/multiselect.insert.combo.ts @@ -11,6 +11,7 @@ export declare class MultiSelectInsertCombo extends Single { static EVENT_ADD_ITEM: string; static REQ_GET_DATA_LENGTH: 1; static REQ_GET_ALL_DATA: -1; + static EVENT_AFTER_HIDEVIEW: string; props: { itemsCreator?: Function; @@ -20,7 +21,7 @@ export declare class MultiSelectInsertCombo extends Single { text?: string; watermark?: string; container?: any; - } & Single['props']; + } & Single["props"]; _itemsCreator4Trigger(op: any, callback: Function): void; From ac0912dd4ce3e56d7148ff30548a14a7dd7fc5b8 Mon Sep 17 00:00:00 2001 From: dailer Date: Fri, 7 Jul 2023 16:56:50 +0800 Subject: [PATCH 4/4] update --- packages/fineui/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fineui/package.json b/packages/fineui/package.json index 58a694a8d..a03894e62 100644 --- a/packages/fineui/package.json +++ b/packages/fineui/package.json @@ -1,6 +1,6 @@ { "name": "@fui/core", - "version": "3.0.20230627163539", + "version": "3.0.20230707165537", "description": "fineui", "main": "dist/fineui.min.js", "module": "dist/lib/index.js",