Browse Source

Pull request #1435: BI-70667 fix:

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

* commit '22ccfcbbee60ecb6726543c351e833b22b8322d1':
  BI-70667 fix:
es6
windy 4 years ago
parent
commit
36c03d8292
  1. 1
      changelog.md
  2. 2
      src/widget/multiselect/multiselect.combo.js
  3. 6
      src/widget/multiselect/multiselect.combo.nobar.js
  4. 6
      src/widget/multiselect/multiselect.insert.combo.js
  5. 6
      src/widget/multiselect/multiselect.insert.combo.nobar.js
  6. 16
      src/widget/multiselect/search/multiselect.search.insert.pane.js
  7. 16
      src/widget/multiselect/search/multiselect.search.pane.js
  8. 4
      src/widget/multiselect/trigger/searcher.multiselect.insert.js
  9. 4
      src/widget/multiselect/trigger/searcher.multiselect.js
  10. 16
      src/widget/singleselect/search/singleselect.search.pane.insert.js
  11. 16
      src/widget/singleselect/search/singleselect.search.pane.js
  12. 2
      src/widget/singleselect/singleselect.combo.js
  13. 2
      src/widget/singleselect/singleselect.insert.combo.js
  14. 4
      src/widget/singleselect/trigger/searcher.singleselect.js

1
changelog.md

@ -1,5 +1,6 @@
# 更新日志 # 更新日志
2.0(2020-08) 2.0(2020-08)
- 修复了复选下拉系列'点按空格添加完全匹配项'添加的是显示值而非实际值的问题
- search_text_value_combo支持水印 - search_text_value_combo支持水印
- BI.makeObject 方法支持传入iteratee - BI.makeObject 方法支持传入iteratee

2
src/widget/multiselect/multiselect.combo.js

@ -80,7 +80,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_PAUSE, function () { this.trigger.on(BI.MultiSelectTrigger.EVENT_PAUSE, function () {
if (this.getSearcher().hasMatched()) { if (this.getSearcher().hasMatched()) {
var keyword = this.getSearcher().getKeyword(); var keyword = this.getSearcher().getMatchedItemValue();
self._join({ self._join({
type: BI.Selection.Multi, type: BI.Selection.Multi,
value: [keyword] value: [keyword]

6
src/widget/multiselect/multiselect.combo.nobar.js

@ -80,7 +80,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
}); });
this.trigger.on(BI.MultiSelectTrigger.EVENT_PAUSE, function () { this.trigger.on(BI.MultiSelectTrigger.EVENT_PAUSE, function () {
if (this.getSearcher().hasMatched()) { if (this.getSearcher().hasMatched()) {
self._addItem(assertShowValue); self._addItem(assertShowValue, true);
} }
}); });
@ -277,9 +277,9 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
}); });
}, },
_addItem: function (assertShowValue) { _addItem: function (assertShowValue, matched) {
var self = this; var self = this;
var keyword = this.trigger.getSearcher().getKeyword(); var keyword = matched ? this.trigger.getSearcher().getMatchedItemValue() : this.trigger.getSearcher().getKeyword();
this._join({ this._join({
type: BI.Selection.Multi, type: BI.Selection.Multi,
value: [keyword] value: [keyword]

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

@ -77,7 +77,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
}); });
this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_PAUSE, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_PAUSE, function () {
if (this.getSearcher().hasMatched()) { if (this.getSearcher().hasMatched()) {
self._addItem(assertShowValue); self._addItem(assertShowValue, true);
} }
}); });
this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_ADD_ITEM, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_ADD_ITEM, function () {
@ -289,9 +289,9 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
}); });
}, },
_addItem: function (assertShowValue) { _addItem: function (assertShowValue, matched) {
var self = this; var self = this;
var keyword = this.trigger.getSearcher().getKeyword(); var keyword = matched ? this.trigger.getSearcher().getMatchedItemValue() : this.trigger.getSearcher().getKeyword();
this._join({ this._join({
type: BI.Selection.Multi, type: BI.Selection.Multi,
value: [keyword] value: [keyword]

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

@ -72,7 +72,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
}); });
this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_PAUSE, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_PAUSE, function () {
if (this.getSearcher().hasMatched()) { if (this.getSearcher().hasMatched()) {
self._addItem(assertShowValue); self._addItem(assertShowValue, true);
} }
}); });
this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_ADD_ITEM, function () { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_ADD_ITEM, function () {
@ -285,9 +285,9 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, {
}); });
}, },
_addItem: function (assertShowValue) { _addItem: function (assertShowValue, matched) {
var self = this; var self = this;
var keyword = this.trigger.getSearcher().getKeyword(); var keyword = matched ? this.trigger.getSearcher().getMatchedItemValue() : this.trigger.getSearcher().getKeyword();
this._join({ this._join({
type: BI.Selection.Multi, type: BI.Selection.Multi,
value: [keyword] value: [keyword]

16
src/widget/multiselect/search/multiselect.search.insert.pane.js

@ -78,7 +78,7 @@ BI.MultiSelectSearchInsertPane = BI.inherit(BI.Widget, {
setKeyword: function (keyword) { setKeyword: function (keyword) {
var o = this.options; var o = this.options;
var hasSameValue = BI.some(this.loader.getAllButtons(), function (idx, btn) { var hasSameValue = BI.some(this.loader.getAllButtons(), function (idx, btn) {
return keyword === btn.getValue(); return keyword === (o.valueFormatter(btn.getValue()) || btn.getValue());
}); });
var isMatchTipVisible = this.loader.getAllButtons().length > 0 && hasSameValue; var isMatchTipVisible = this.loader.getAllButtons().length > 0 && hasSameValue;
this.tooltipClick.setVisible(isMatchTipVisible); this.tooltipClick.setVisible(isMatchTipVisible);
@ -86,6 +86,20 @@ BI.MultiSelectSearchInsertPane = BI.inherit(BI.Widget, {
!isMatchTipVisible && this.addNotMatchTip.setText(BI.i18nText("BI-Basic_Click_To_Add_Text", keyword)); !isMatchTipVisible && this.addNotMatchTip.setText(BI.i18nText("BI-Basic_Click_To_Add_Text", keyword));
}, },
getMatchedItemValue: function () {
var value;
var o = this.options;
BI.some(this.loader.getAllButtons(), function (idx, btn) {
var v = btn.getValue();
if (o.keywordGetter() === (o.valueFormatter(v) || v)) {
value = v;
return true;
}
});
return value;
},
isAllSelected: function () { isAllSelected: function () {
return this.loader.isAllSelected(); return this.loader.isAllSelected();
}, },

16
src/widget/multiselect/search/multiselect.search.pane.js

@ -65,7 +65,7 @@ BI.MultiSelectSearchPane = BI.inherit(BI.Widget, {
setKeyword: function (keyword) { setKeyword: function (keyword) {
var btn, o = this.options; var btn, o = this.options;
var isVisible = this.loader.getAllButtons().length > 0 && (btn = this.loader.getAllButtons()[0]) && keyword === btn.getValue(); var isVisible = this.loader.getAllButtons().length > 0 && (btn = this.loader.getAllButtons()[0]) && (keyword === (o.valueFormatter(btn.getValue()) || btn.getValue()));
if (isVisible !== this.tooltipClick.isVisible()) { if (isVisible !== this.tooltipClick.isVisible()) {
this.tooltipClick.setVisible(isVisible); this.tooltipClick.setVisible(isVisible);
this.resizer.attr("items")[0].height = (isVisible ? this.constants.height : 0); this.resizer.attr("items")[0].height = (isVisible ? this.constants.height : 0);
@ -73,6 +73,20 @@ BI.MultiSelectSearchPane = BI.inherit(BI.Widget, {
} }
}, },
getMatchedItemValue: function () {
var value;
var o = this.options;
BI.some(this.loader.getAllButtons(), function (idx, btn) {
var v = btn.getValue();
if (o.keywordGetter() === (o.valueFormatter(v) || v)) {
value = v;
return true;
}
});
return value;
},
isAllSelected: function () { isAllSelected: function () {
return this.loader.isAllSelected(); return this.loader.isAllSelected();
}, },

4
src/widget/multiselect/trigger/searcher.multiselect.insert.js

@ -167,6 +167,10 @@ BI.MultiSelectInsertSearcher = BI.inherit(BI.Widget, {
} }
}, },
getMatchedItemValue: function() {
return this.searcher.getView().getMatchedItemValue();
},
getState: function() { getState: function() {
return this.editor.getState(); return this.editor.getState();
}, },

4
src/widget/multiselect/trigger/searcher.multiselect.js

@ -94,6 +94,10 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
} }
}, },
getMatchedItemValue: function() {
return this.searcher.getView().getMatchedItemValue();
},
adjustView: function () { adjustView: function () {
this.searcher.adjustView(); this.searcher.adjustView();
}, },

16
src/widget/singleselect/search/singleselect.search.pane.insert.js

@ -80,7 +80,7 @@ BI.SingleSelectSearchInsertPane = BI.inherit(BI.Widget, {
setKeyword: function (keyword) { setKeyword: function (keyword) {
var o = this.options; var o = this.options;
var hasSameValue = BI.some(this.loader.getAllButtons(), function (idx, btn) { var hasSameValue = BI.some(this.loader.getAllButtons(), function (idx, btn) {
return keyword === btn.getValue(); return keyword === (o.valueFormatter(btn.getValue()) || btn.getValue());
}); });
var isMatchTipVisible = this.loader.getAllButtons().length > 0 && hasSameValue; var isMatchTipVisible = this.loader.getAllButtons().length > 0 && hasSameValue;
this.tooltipClick.setVisible(isMatchTipVisible); this.tooltipClick.setVisible(isMatchTipVisible);
@ -88,6 +88,20 @@ BI.SingleSelectSearchInsertPane = BI.inherit(BI.Widget, {
!isMatchTipVisible && this.addNotMatchTip.setText(BI.i18nText("BI-Basic_Click_To_Add_Text", keyword)); !isMatchTipVisible && this.addNotMatchTip.setText(BI.i18nText("BI-Basic_Click_To_Add_Text", keyword));
}, },
getMatchedItemValue: function () {
var value;
var o = this.options;
BI.some(this.loader.getAllButtons(), function (idx, btn) {
var v = btn.getValue();
if (o.keywordGetter() === (o.valueFormatter(v) || v)) {
value = v;
return true;
}
});
return value;
},
hasMatched: function () { hasMatched: function () {
return this.tooltipClick.isVisible(); return this.tooltipClick.isVisible();
}, },

16
src/widget/singleselect/search/singleselect.search.pane.js

@ -67,7 +67,7 @@ BI.SingleSelectSearchPane = BI.inherit(BI.Widget, {
setKeyword: function (keyword) { setKeyword: function (keyword) {
var btn, o = this.options; var btn, o = this.options;
var isVisible = this.loader.getAllButtons().length > 0 && (btn = this.loader.getAllButtons()[0]) && keyword === btn.getValue(); var isVisible = this.loader.getAllButtons().length > 0 && (btn = this.loader.getAllButtons()[0]) && (keyword === (o.valueFormatter(btn.getValue()) || btn.getValue()));
if (isVisible !== this.tooltipClick.isVisible()) { if (isVisible !== this.tooltipClick.isVisible()) {
this.tooltipClick.setVisible(isVisible); this.tooltipClick.setVisible(isVisible);
this.resizer.attr("items")[0].height = (isVisible ? this.constants.height : 0); this.resizer.attr("items")[0].height = (isVisible ? this.constants.height : 0);
@ -75,6 +75,20 @@ BI.SingleSelectSearchPane = BI.inherit(BI.Widget, {
} }
}, },
getMatchedItemValue: function () {
var value;
var o = this.options;
BI.some(this.loader.getAllButtons(), function (idx, btn) {
var v = btn.getValue();
if (o.keywordGetter() === (o.valueFormatter(v) || v)) {
value = v;
return true;
}
});
return value;
},
hasMatched: function () { hasMatched: function () {
return this.tooltipClick.isVisible(); return this.tooltipClick.isVisible();
}, },

2
src/widget/singleselect/singleselect.combo.js

@ -68,7 +68,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, {
}); });
this.trigger.on(BI.SingleSelectTrigger.EVENT_PAUSE, function () { this.trigger.on(BI.SingleSelectTrigger.EVENT_PAUSE, function () {
if (this.getSearcher().hasMatched()) { if (this.getSearcher().hasMatched()) {
var keyword = this.getSearcher().getKeyword(); var keyword = this.getSearcher().getMatchedItemValue();
self.combo.setValue(self.storeValue); self.combo.setValue(self.storeValue);
self._setStartValue(keyword); self._setStartValue(keyword);
assertShowValue(); assertShowValue();

2
src/widget/singleselect/singleselect.insert.combo.js

@ -83,7 +83,7 @@ BI.SingleSelectInsertCombo = BI.inherit(BI.Single, {
}); });
this.trigger.on(BI.SingleSelectTrigger.EVENT_PAUSE, function () { this.trigger.on(BI.SingleSelectTrigger.EVENT_PAUSE, function () {
if (this.getSearcher().hasMatched()) { if (this.getSearcher().hasMatched()) {
var keyword = this.getSearcher().getKeyword(); var keyword = this.getSearcher().getMatchedItemValue();
self.storeValue = keyword; self.storeValue = keyword;
self.combo.setValue(self.storeValue); self.combo.setValue(self.storeValue);
self._setStartValue(keyword); self._setStartValue(keyword);

4
src/widget/singleselect/trigger/searcher.singleselect.js

@ -95,6 +95,10 @@ BI.SingleSelectSearcher = BI.inherit(BI.Widget, {
} }
}, },
getMatchedItemValue: function() {
return this.searcher.getView().getMatchedItemValue();
},
adjustView: function () { adjustView: function () {
this.searcher.adjustView(); this.searcher.adjustView();
}, },

Loading…
Cancel
Save