diff --git a/changelog.md b/changelog.md index d480587b13..c23791f5bb 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ # 更新日志 2.0(2020-09) +- 修复区间滑块setEnable(false)滑块不灰化的问题 - 修复同步复选下拉框系列setValue所有值后触发器不显示全选的问题 - BI.Tree.traversal方法迭代函数增加父节点参数 diff --git a/src/component/allvaluechooser/abstract.allvaluechooser.js b/src/component/allvaluechooser/abstract.allvaluechooser.js index 332a1737dd..1f30e8de8b 100644 --- a/src/component/allvaluechooser/abstract.allvaluechooser.js +++ b/src/component/allvaluechooser/abstract.allvaluechooser.js @@ -82,5 +82,20 @@ BI.AbstractAllValueChooser = BI.inherit(BI.Widget, { hasNext: false }); } - } + }, + + _assertValue: function (v) { + v = v || {}; + var value = v; + if (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; + }, }); \ No newline at end of file diff --git a/src/component/allvaluechooser/combo.allvaluechooser.js b/src/component/allvaluechooser/combo.allvaluechooser.js index 3b7306a6ad..8c170867af 100644 --- a/src/component/allvaluechooser/combo.allvaluechooser.js +++ b/src/component/allvaluechooser/combo.allvaluechooser.js @@ -33,10 +33,10 @@ BI.AllValueChooserCombo = BI.inherit(BI.AbstractAllValueChooser, { valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, height: o.height, - value: { + value: this._assertValue({ type: BI.Selection.Multi, value: o.value || [] - } + }) }); this.combo.on(BI.MultiSelectCombo.EVENT_CONFIRM, function () { @@ -45,10 +45,10 @@ BI.AllValueChooserCombo = BI.inherit(BI.AbstractAllValueChooser, { }, setValue: function (v) { - this.combo.setValue({ + this.combo.setValue(this._assertValue({ type: BI.Selection.Multi, value: v || [] - }); + })); }, getValue: function () { diff --git a/src/widget/intervalslider/intervalslider.js b/src/widget/intervalslider/intervalslider.js index e8b09fcc41..b7dc379b58 100644 --- a/src/widget/intervalslider/intervalslider.js +++ b/src/widget/intervalslider/intervalslider.js @@ -421,11 +421,6 @@ BI.IntervalSlider = BI.inherit(BI.Single, { return (v - this.min) * 100 / (this.max - this.min); }, - _setDraggableEnable: function (enable) { - this.sliderOne.setEnable(enable); - this.sliderTwo.setEnable(enable); - }, - _getPrecision: function () { // 计算每一份值的精度(最大值和最小值的差值保留4为有效数字后的精度) // 如果差值的整数位数大于4,toPrecision(4)得到的是科学计数法123456 => 1.235e+5 @@ -483,10 +478,10 @@ BI.IntervalSlider = BI.inherit(BI.Single, { this.valueOne = minNumber; this.valueTwo = maxNumber; this.precision = this._getPrecision(); - this._setDraggableEnable(true); + this.setEnable(true); } if (maxNumber === minNumber) { - this._setDraggableEnable(false); + this.setEnable(false); } },