Browse Source

Pull request #2361: BI-98802 fix: 文本列表同步改下

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

* commit '605602a436edd34d5186a3cbb0484b923ccfb22c':
  BI-98802 fix: 文本列表同步改下
es6
windy 3 years ago
parent
commit
3f6e1994e5
  1. 17
      src/widget/multiselectlist/multiselectlist.insert.js
  2. 17
      src/widget/multiselectlist/multiselectlist.insert.nobar.js

17
src/widget/multiselectlist/multiselectlist.insert.js

@ -101,7 +101,11 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, {
}, { }, {
eventName: BI.Searcher.EVENT_PAUSE, eventName: BI.Searcher.EVENT_PAUSE,
action: function () { action: function () {
var keyword = this.getKeyword(); var keywords = self._getKeywords();
if (keywords[keywords.length - 1] === BI.BlankSplitChar) {
keywords = keywords.slice(0, keywords.length - 1);
}
var keyword = BI.isEmptyArray(keywords) ? "" : keywords[keywords.length - 1];
self._join({ self._join({
type: BI.Selection.Multi, type: BI.Selection.Multi,
value: [keyword] value: [keyword]
@ -126,7 +130,7 @@ BI.MultiSelectInsertList = 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.adapter.setValue(self.storeValue); self.adapter.setValue(self.storeValue);
assertShowValue(); assertShowValue();
@ -191,16 +195,17 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, {
keywords = keywords.slice(0, keywords.length - 1); keywords = keywords.slice(0, keywords.length - 1);
} }
if (/\u200b\s\u200b$/.test(val)) { if (/\u200b\s\u200b$/.test(val)) {
return keywords.concat([BI.BlankSplitChar]); keywords = keywords.concat([BI.BlankSplitChar]);
} }
return keywords; return keywords.length > 2000 ? keywords.slice(0, 2000).concat([BI.BlankSplitChar]) : keywords.slice(0, 2000);
}, },
_getKeywordsLength: function () { _getKeywordsLength: function () {
var keywords = this._getKeywords(); var val = this.editor.getValue();
var keywords = val.split(/\u200b\s\u200b/);
return keywords[keywords.length - 1] === BI.BlankSplitChar ? keywords.length - 1 : keywords.length; return keywords.length - 1;
}, },
_showAdapter: function () { _showAdapter: function () {

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

@ -105,7 +105,11 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, {
}, { }, {
eventName: BI.Searcher.EVENT_PAUSE, eventName: BI.Searcher.EVENT_PAUSE,
action: function () { action: function () {
var keyword = this.getKeyword(); var keywords = self._getKeywords();
if (keywords[keywords.length - 1] === BI.BlankSplitChar) {
keywords = keywords.slice(0, keywords.length - 1);
}
var keyword = BI.isEmptyArray(keywords) ? "" : keywords[keywords.length - 1];
self._join({ self._join({
type: BI.Selection.Multi, type: BI.Selection.Multi,
value: [keyword] value: [keyword]
@ -129,7 +133,7 @@ BI.MultiSelectInsertNoBarList = 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.adapter.setValue(self.storeValue); self.adapter.setValue(self.storeValue);
assertShowValue(); assertShowValue();
@ -197,16 +201,17 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, {
keywords = keywords.slice(0, keywords.length - 1); keywords = keywords.slice(0, keywords.length - 1);
} }
if (/\u200b\s\u200b$/.test(val)) { if (/\u200b\s\u200b$/.test(val)) {
return keywords.concat([BI.BlankSplitChar]); keywords = keywords.concat([BI.BlankSplitChar]);
} }
return keywords; return keywords.length > 2000 ? keywords.slice(0, 2000).concat([BI.BlankSplitChar]) : keywords.slice(0, 2000);
}, },
_getKeywordsLength: function () { _getKeywordsLength: function () {
var keywords = this._getKeywords(); var val = this.editor.getValue();
var keywords = val.split(/\u200b\s\u200b/);
return keywords[keywords.length - 1] === BI.BlankSplitChar ? keywords.length - 1 : keywords.length; return keywords.length - 1;
}, },
_showAdapter: function () { _showAdapter: function () {

Loading…
Cancel
Save