Browse Source

BI-71788 fix: 将所有值setValue进入同步复选下拉后触发器不显示全选

es6
windy 4 years ago
parent
commit
f033567b65
  1. 3
      changelog.md
  2. 19
      src/component/valuechooser/combo.valuechooser.insert.js
  3. 19
      src/component/valuechooser/combo.valuechooser.js

3
changelog.md

@ -1,4 +1,7 @@
# 更新日志 # 更新日志
2.0(2020-09)
- 修复同步复选下拉框系列setValue所有值后触发器不显示全选的问题
2.0(2020-08) 2.0(2020-08)
- bi.sign_editor支持显示值居左/居中/居右显示 - bi.sign_editor支持显示值居左/居中/居右显示
- bi.iframe新增EVENT_LOADED事件 - bi.iframe新增EVENT_LOADED事件

19
src/component/valuechooser/combo.valuechooser.insert.js

@ -26,7 +26,7 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, {
element: this, element: this,
allowEdit: o.allowEdit, allowEdit: o.allowEdit,
text: o.text, text: o.text,
value: o.value, value: this._assertValue(o.value),
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this), valueFormatter: BI.bind(this._valueFormatter, this),
width: o.width, width: o.width,
@ -65,8 +65,23 @@ BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, {
}); });
}, },
_assertValue: function (v) {
v = v || {};
var value = v;
if (v.type === BI.Selection.Multi && BI.isNotNull(this.items)) {
var isAllSelect = BI.difference(BI.map(this.items, "value"), v.value).length === 0;
if (isAllSelect) {
value = {
type: BI.Selection.All,
value: [],
};
}
}
return value;
},
setValue: function (v) { setValue: function (v) {
this.combo.setValue(v); this.combo.setValue(this._assertValue(v));
}, },
getValue: function () { getValue: function () {

19
src/component/valuechooser/combo.valuechooser.js

@ -30,7 +30,7 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, {
element: this, element: this,
allowEdit: o.allowEdit, allowEdit: o.allowEdit,
text: o.text, text: o.text,
value: o.value, value: this._assertValue(o.value),
itemsCreator: BI.bind(this._itemsCreator, this), itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: BI.bind(this._valueFormatter, this), valueFormatter: BI.bind(this._valueFormatter, this),
width: o.width, width: o.width,
@ -69,8 +69,23 @@ BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, {
}); });
}, },
_assertValue: function (v) {
v = v || {};
var value = v;
if (v.type === BI.Selection.Multi && BI.isNotNull(this.items)) {
var isAllSelect = BI.difference(BI.map(this.items, "value"), v.value).length === 0;
if (isAllSelect) {
value = {
type: BI.Selection.All,
value: [],
};
}
}
return value;
},
setValue: function (v) { setValue: function (v) {
this.combo.setValue(v); this.combo.setValue(this._assertValue(v));
}, },
getValue: function () { getValue: function () {

Loading…
Cancel
Save