Browse Source

BI-56574 fix: setValue之后,populate需要刷新label

es6
windy 5 years ago
parent
commit
062afd48e2
  1. 13
      src/widget/intervalslider/intervalslider.js

13
src/widget/intervalslider/intervalslider.js

@ -334,11 +334,15 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
valueTwo = BI.parseFloat(valueTwo); valueTwo = BI.parseFloat(valueTwo);
if((oldValueOne <= oldValueTwo && valueOne > valueTwo) || (oldValueOne >= oldValueTwo && valueOne < valueTwo)) { if((oldValueOne <= oldValueTwo && valueOne > valueTwo) || (oldValueOne >= oldValueTwo && valueOne < valueTwo)) {
var isSliderOneLeft = BI.parseFloat(this.sliderOne.element[0].style.left) < BI.parseFloat(this.sliderTwo.element[0].style.left); var isSliderOneLeft = BI.parseFloat(this.sliderOne.element[0].style.left) < BI.parseFloat(this.sliderTwo.element[0].style.left);
this.labelOne.element.css({left: isSliderOneLeft ? "0%" : "100%"}); this._resetLabelPosition(!isSliderOneLeft);
this.labelTwo.element.css({left: isSliderOneLeft ? "100%" : "0%"});
} }
}, },
_resetLabelPosition: function(needReverse) {
this.labelOne.element.css({left: needReverse ? "100%" : "0%"});
this.labelTwo.element.css({left: needReverse ? "0%" : "100%"});
},
_setSliderOnePosition: function (percent) { _setSliderOnePosition: function (percent) {
this.sliderOne.element.css({left: percent + "%"}); this.sliderOne.element.css({left: percent + "%"});
}, },
@ -481,8 +485,8 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
var o = this.options; var o = this.options;
var valueOne = BI.parseFloat(v.min); var valueOne = BI.parseFloat(v.min);
var valueTwo = BI.parseFloat(v.max); var valueTwo = BI.parseFloat(v.max);
valueOne = o.digit === false ? valueOne : valueOne.toFixed(o.digit); valueOne = o.digit === false ? valueOne : BI.parseFloat(valueOne.toFixed(o.digit));
valueTwo = o.digit === false ? valueTwo : valueTwo.toFixed(o.digit); valueTwo = o.digit === false ? valueTwo : BI.parseFloat(valueTwo.toFixed(o.digit));
if (!isNaN(valueOne) && !isNaN(valueTwo)) { if (!isNaN(valueOne) && !isNaN(valueTwo)) {
if (this._checkValidation(valueOne)) { if (this._checkValidation(valueOne)) {
this.valueOne = (this.valueOne <= this.valueTwo ? valueOne : valueTwo); this.valueOne = (this.valueOne <= this.valueTwo ? valueOne : valueTwo);
@ -523,6 +527,7 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
this.labelTwo.setValue(this.max); this.labelTwo.setValue(this.max);
this._setAllPosition(0, 100); this._setAllPosition(0, 100);
} }
this._resetLabelPosition();
} }
} }
}); });

Loading…
Cancel
Save