From 0c6cc5fc3da378b35da65638dbbcb604551dee04 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Wed, 15 Dec 2021 19:06:08 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20debounce?= =?UTF-8?q?=E6=94=B9=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/list/virtualgrouplist.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/base/list/virtualgrouplist.js b/src/base/list/virtualgrouplist.js index 95ed647e0..aab04efdc 100644 --- a/src/base/list/virtualgrouplist.js +++ b/src/base/list/virtualgrouplist.js @@ -55,18 +55,10 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, { mounted: function () { var self = this, o = this.options; this._populate(); - this._debounceRelease = BI.debounce(function () { - self._scrollLock = false; - }, 30); - this.element.scroll(function (e) { - if (self._scrollLock === true) { - return; - } - self._scrollLock = true; + this.element.scroll(BI.debounce(function (e) { o.scrollTop = self.element.scrollTop(); - self._debounceRelease(); self._calculateBlocksToRender(); - }); + }, 30)); BI.ResizeDetector.addResizeListener(this, function () { self._calculateBlocksToRender(); }); From 69a2ec1bf1ddcb8b54977c079e5da943a789812c Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 16 Dec 2021 11:08:37 +0800 Subject: [PATCH 2/2] =?UTF-8?q?BI-98494=20fix:=20=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E4=B8=8D=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../multiselect/multiselect.insert.combo.js | 4 ++-- .../multiselect/multiselect.insert.combo.nobar.js | 4 ++-- .../trigger/searcher.multiselect.insert.js | 15 +++++++++++++-- .../multiselectlist/multiselectlist.insert.js | 8 +++++++- .../multiselectlist.insert.nobar.js | 8 +++++++- 5 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/widget/multiselect/multiselect.insert.combo.js b/src/widget/multiselect/multiselect.insert.combo.js index f0435f6f7..af2c44f97 100644 --- a/src/widget/multiselect/multiselect.insert.combo.js +++ b/src/widget/multiselect/multiselect.insert.combo.js @@ -81,7 +81,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { var last = BI.last(keywords); keywords = BI.initial(keywords || []); if (keywords.length > 0) { - self._joinKeywords(keywords.slice(0, last === BI.BlankSplitChar ? 1999 : 2000), function () { + self._joinKeywords(keywords, function () { if (BI.endWith(last, BI.BlankSplitChar)) { self.combo.setValue(self.storeValue); assertShowValue(); @@ -93,7 +93,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { } self._dataChange = true; }); - keywords.length > 2000 && BI.Msg.alert(BI.i18nText("BI-Basic_Prompt"), BI.i18nText("BI-Basic_Too_Much_Value_Get_Two_Thousand")); + this.getSearcher().getKeywordsLength() > 2000 && BI.Msg.alert(BI.i18nText("BI-Basic_Prompt"), BI.i18nText("BI-Basic_Too_Much_Value_Get_Two_Thousand")); } self.fireEvent(BI.MultiSelectInsertCombo.EVENT_SEARCHING); }); diff --git a/src/widget/multiselect/multiselect.insert.combo.nobar.js b/src/widget/multiselect/multiselect.insert.combo.nobar.js index 18bfc8a82..00ac76506 100644 --- a/src/widget/multiselect/multiselect.insert.combo.nobar.js +++ b/src/widget/multiselect/multiselect.insert.combo.nobar.js @@ -76,7 +76,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, { var last = BI.last(keywords); keywords = BI.initial(keywords || []); if (keywords.length > 0) { - self._joinKeywords(keywords.slice(0, last === BI.BlankSplitChar ? 1999 : 2000), function () { + self._joinKeywords(keywords, function () { if (BI.endWith(last, BI.BlankSplitChar)) { self.combo.setValue(self.storeValue); assertShowValue(); @@ -88,7 +88,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, { } self._dataChange = true; }); - keywords.length > 2000 && BI.Msg.alert(BI.i18nText("BI-Basic_Prompt"), BI.i18nText("BI-Basic_Too_Much_Value_Get_Two_Thousand")); + this.getSearcher().getKeywordsLength() > 2000 && BI.Msg.alert(BI.i18nText("BI-Basic_Prompt"), BI.i18nText("BI-Basic_Too_Much_Value_Get_Two_Thousand")); } }); diff --git a/src/widget/multiselect/trigger/searcher.multiselect.insert.js b/src/widget/multiselect/trigger/searcher.multiselect.insert.js index e055f86f8..404a0e4e8 100644 --- a/src/widget/multiselect/trigger/searcher.multiselect.insert.js +++ b/src/widget/multiselect/trigger/searcher.multiselect.insert.js @@ -89,7 +89,7 @@ BI.MultiSelectInsertSearcher = BI.inherit(BI.Widget, { }); this.searcher.on(BI.Searcher.EVENT_SEARCHING, function () { var keywords = this.getKeywords(); - self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_SEARCHING, keywords); + self.fireEvent(BI.MultiSelectInsertSearcher.EVENT_SEARCHING, keywords.length > 2000 ? keywords.slice(0, 2000).concat([BI.BlankSplitChar]) : keywords.slice(0, 2000)); }); if (BI.isNotNull(o.value)) { this.setState(o.value); @@ -108,8 +108,19 @@ BI.MultiSelectInsertSearcher = BI.inherit(BI.Widget, { this.searcher.stopSearch(); }, + getKeywordsLength: function () { + var keywords = this.editor.getKeywords(); + + return keywords[keywords.length - 1] === BI.BlankSplitChar ? keywords.length - 1 : keywords.length; + }, + getKeyword: function () { - return this.editor.getKeyword(); + var keywords = this.editor.getKeywords().slice(0, 2000); + if (keywords[keywords.length - 1] === BI.BlankSplitChar) { + keywords = keywords.slice(0, keywords.length - 1); + } + + return BI.isEmptyArray(keywords) ? "" : keywords[keywords.length - 1]; }, hasMatched: function () { diff --git a/src/widget/multiselectlist/multiselectlist.insert.js b/src/widget/multiselectlist/multiselectlist.insert.js index e4a6a004b..4fbf258e2 100644 --- a/src/widget/multiselectlist/multiselectlist.insert.js +++ b/src/widget/multiselectlist/multiselectlist.insert.js @@ -138,7 +138,7 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, { } self.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE); }); - keywords.length > 2000 && BI.Msg.alert(BI.i18nText("BI-Basic_Prompt"), BI.i18nText("BI-Basic_Too_Much_Value_Get_Two_Thousand")); + self._getKeywordsLength() > 2000 && BI.Msg.alert(BI.i18nText("BI-Basic_Prompt"), BI.i18nText("BI-Basic_Too_Much_Value_Get_Two_Thousand")); } } }, { @@ -197,6 +197,12 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, { return keywords; }, + _getKeywordsLength: function () { + var keywords = this._getKeywords(); + + return keywords[keywords.length - 1] === BI.BlankSplitChar ? keywords.length - 1 : keywords.length; + }, + _showAdapter: function () { this.adapter.setVisible(true); this.searcherPane.setVisible(false); diff --git a/src/widget/multiselectlist/multiselectlist.insert.nobar.js b/src/widget/multiselectlist/multiselectlist.insert.nobar.js index f4f1adff4..8369b2acf 100644 --- a/src/widget/multiselectlist/multiselectlist.insert.nobar.js +++ b/src/widget/multiselectlist/multiselectlist.insert.nobar.js @@ -141,7 +141,7 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, { } self.fireEvent(BI.MultiSelectInsertNoBarList.EVENT_CHANGE); }); - keywords.length > 2000 && BI.Msg.alert(BI.i18nText("BI-Basic_Prompt"), BI.i18nText("BI-Basic_Too_Much_Value_Get_Two_Thousand")); + self._getKeywordsLength() > 2000 && BI.Msg.alert(BI.i18nText("BI-Basic_Prompt"), BI.i18nText("BI-Basic_Too_Much_Value_Get_Two_Thousand")); } } }, { @@ -203,6 +203,12 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, { return keywords; }, + _getKeywordsLength: function () { + var keywords = this._getKeywords(); + + return keywords[keywords.length - 1] === BI.BlankSplitChar ? keywords.length - 1 : keywords.length; + }, + _showAdapter: function () { this.adapter.setVisible(true); this.searcherPane.setVisible(false);