windy 4 years ago
parent
commit
fe265a4047
  1. 17
      src/component/valuechooser/abstract.valuechooser.js
  2. 15
      src/component/valuechooser/combo.valuechooser.insert.js
  3. 15
      src/component/valuechooser/combo.valuechooser.js

17
src/component/valuechooser/abstract.valuechooser.js

@ -88,5 +88,20 @@ BI.AbstractValueChooser = BI.inherit(BI.Widget, {
hasNext: self._hasNextByTimes(resultItems, options.times) hasNext: self._hasNextByTimes(resultItems, options.times)
}); });
} }
} },
_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;
},
}); });

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

@ -65,21 +65,6 @@ 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(this._assertValue(v)); this.combo.setValue(this._assertValue(v));
}, },

15
src/component/valuechooser/combo.valuechooser.js

@ -69,21 +69,6 @@ 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(this._assertValue(v)); this.combo.setValue(this._assertValue(v));
}, },

Loading…
Cancel
Save