Browse Source

JSY-29426 fix:绑定空值时与刷新后展示不同

master
Claire 2 years ago
parent
commit
d51f921317
  1. 12
      src/widget/intervalslider/intervalslider.js

12
src/widget/intervalslider/intervalslider.js

@ -103,7 +103,7 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
var oldValueTwo = self.valueTwo;
var v = BI.parseFloat(this.getValue());
self.valueTwo = v;
var percent = self._getPercentByValue(v);
var percent = self._getPercentByValue(v, true);
var significantPercent = BI.parseFloat(percent.toFixed(1));
self._setSliderTwoPosition(significantPercent);
self._setBlueTrack();
@ -381,7 +381,7 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
_setBlueTrack: function () {
var percentOne = this._getPercentByValue(this.labelOne.getValue());
var percentTwo = this._getPercentByValue(this.labelTwo.getValue());
var percentTwo = this._getPercentByValue(this.labelTwo.getValue(), true);
if (percentOne <= percentTwo) {
this._setBlueTrackLeft(percentOne);
this._setBlueTrackWidth(percentTwo - percentOne);
@ -435,7 +435,11 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
},
_getPercentByValue: function (v) {
_getPercentByValue: function (v, isLast) {
if (this.max === this.min) {
return isLast ? 100 : 0;
}
return (v - this.min) * 100 / (this.max - this.min);
},
@ -545,7 +549,7 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
if ((BI.isNumeric(this.valueOne) || BI.isNotEmptyString(this.valueOne)) && (BI.isNumeric(this.valueTwo) || BI.isNotEmptyString(this.valueTwo))) {
this.labelOne.setValue(o.digit === false ? this.valueOne : BI.parseFloat(this.valueOne).toFixed(o.digit));
this.labelTwo.setValue(o.digit === false ? this.valueTwo : BI.parseFloat(this.valueTwo).toFixed(o.digit));
this._setAllPosition(this._getPercentByValue(this.valueOne), this._getPercentByValue(this.valueTwo));
this._setAllPosition(this._getPercentByValue(this.valueOne), this._getPercentByValue(this.valueTwo, true));
} else {
this.labelOne.setValue(this.min);
this.labelTwo.setValue(this.max);

Loading…
Cancel
Save