Browse Source

Pull request #2351: 无JIRA任务 调用debounce的方式改一下

Merge in VISUAL/fineui from ~WINDY/fui:master to master

* commit '69a2ec1bf1ddcb8b54977c079e5da943a789812c':
  BI-98494 fix: 提示不对
  无JIRA任务 debounce改一下
es6
windy 3 years ago
parent
commit
756a5b995b
  1. 12
      src/base/list/virtualgrouplist.js
  2. 4
      src/widget/multiselect/multiselect.insert.combo.js
  3. 4
      src/widget/multiselect/multiselect.insert.combo.nobar.js
  4. 15
      src/widget/multiselect/trigger/searcher.multiselect.insert.js
  5. 8
      src/widget/multiselectlist/multiselectlist.insert.js
  6. 8
      src/widget/multiselectlist/multiselectlist.insert.nobar.js

12
src/base/list/virtualgrouplist.js

@ -55,18 +55,10 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
mounted: function () { mounted: function () {
var self = this, o = this.options; var self = this, o = this.options;
this._populate(); this._populate();
this._debounceRelease = BI.debounce(function () { this.element.scroll(BI.debounce(function (e) {
self._scrollLock = false;
}, 30);
this.element.scroll(function (e) {
if (self._scrollLock === true) {
return;
}
self._scrollLock = true;
o.scrollTop = self.element.scrollTop(); o.scrollTop = self.element.scrollTop();
self._debounceRelease();
self._calculateBlocksToRender(); self._calculateBlocksToRender();
}); }, 30));
BI.ResizeDetector.addResizeListener(this, function () { BI.ResizeDetector.addResizeListener(this, function () {
self._calculateBlocksToRender(); self._calculateBlocksToRender();
}); });

4
src/widget/multiselect/multiselect.insert.combo.js

@ -81,7 +81,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
var last = BI.last(keywords); var last = BI.last(keywords);
keywords = BI.initial(keywords || []); keywords = BI.initial(keywords || []);
if (keywords.length > 0) { 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)) { if (BI.endWith(last, BI.BlankSplitChar)) {
self.combo.setValue(self.storeValue); self.combo.setValue(self.storeValue);
assertShowValue(); assertShowValue();
@ -93,7 +93,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
} }
self._dataChange = true; 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); self.fireEvent(BI.MultiSelectInsertCombo.EVENT_SEARCHING);
}); });

4
src/widget/multiselect/multiselect.insert.combo.nobar.js

@ -76,7 +76,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
var last = BI.last(keywords); var last = BI.last(keywords);
keywords = BI.initial(keywords || []); keywords = BI.initial(keywords || []);
if (keywords.length > 0) { 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)) { if (BI.endWith(last, BI.BlankSplitChar)) {
self.combo.setValue(self.storeValue); self.combo.setValue(self.storeValue);
assertShowValue(); assertShowValue();
@ -88,7 +88,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
} }
self._dataChange = true; 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"));
} }
}); });

15
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 () { this.searcher.on(BI.Searcher.EVENT_SEARCHING, function () {
var keywords = this.getKeywords(); 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)) { if (BI.isNotNull(o.value)) {
this.setState(o.value); this.setState(o.value);
@ -108,8 +108,19 @@ BI.MultiSelectInsertSearcher = BI.inherit(BI.Widget, {
this.searcher.stopSearch(); this.searcher.stopSearch();
}, },
getKeywordsLength: function () {
var keywords = this.editor.getKeywords();
return keywords[keywords.length - 1] === BI.BlankSplitChar ? keywords.length - 1 : keywords.length;
},
getKeyword: function () { 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 () { hasMatched: function () {

8
src/widget/multiselectlist/multiselectlist.insert.js

@ -138,7 +138,7 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, {
} }
self.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE); 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; return keywords;
}, },
_getKeywordsLength: function () {
var keywords = this._getKeywords();
return keywords[keywords.length - 1] === BI.BlankSplitChar ? keywords.length - 1 : keywords.length;
},
_showAdapter: function () { _showAdapter: function () {
this.adapter.setVisible(true); this.adapter.setVisible(true);
this.searcherPane.setVisible(false); this.searcherPane.setVisible(false);

8
src/widget/multiselectlist/multiselectlist.insert.nobar.js

@ -141,7 +141,7 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, {
} }
self.fireEvent(BI.MultiSelectInsertNoBarList.EVENT_CHANGE); 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; return keywords;
}, },
_getKeywordsLength: function () {
var keywords = this._getKeywords();
return keywords[keywords.length - 1] === BI.BlankSplitChar ? keywords.length - 1 : keywords.length;
},
_showAdapter: function () { _showAdapter: function () {
this.adapter.setVisible(true); this.adapter.setVisible(true);
this.searcherPane.setVisible(false); this.searcherPane.setVisible(false);

Loading…
Cancel
Save