guy 7 years ago
parent
commit
10e82d024f
  1. 22
      bi/sliders.js
  2. 22
      dist/sliders.js

22
bi/sliders.js

@ -1485,7 +1485,7 @@ BI.SingleSliderLabel = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.SingleSliderLabel.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.SingleSliderLabel.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-single-slider-label bi-slider-track", baseCls: "bi-single-slider-label bi-slider-track",
digit: "", digit: false,
unit: "" unit: ""
}); });
}, },
@ -1493,7 +1493,6 @@ BI.SingleSliderLabel = BI.inherit(BI.Widget, {
BI.SingleSliderLabel.superclass._init.apply(this, arguments); BI.SingleSliderLabel.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
var digitExist = (o.digit === "") ? false : true;
var c = this._constant; var c = this._constant;
this.enable = false; this.enable = false;
this.value = ""; this.value = "";
@ -1523,7 +1522,7 @@ BI.SingleSliderLabel = BI.inherit(BI.Widget, {
self._setBlueTrack(significantPercent); self._setBlueTrack(significantPercent);
self._setLabelPosition(significantPercent); self._setLabelPosition(significantPercent);
var v = self._getValueByPercent(significantPercent); var v = self._getValueByPercent(significantPercent);
v = digitExist ? v.toFixed(o.digit) : v; v = o.digit === false ? v : v.toFixed(o.digit);
self.label.setText(v + o.unit); self.label.setText(v + o.unit);
self.value = v; self.value = v;
self.fireEvent(BI.SingleSliderLabel.EVENT_CHANGE); self.fireEvent(BI.SingleSliderLabel.EVENT_CHANGE);
@ -1561,7 +1560,7 @@ BI.SingleSliderLabel = BI.inherit(BI.Widget, {
var significantPercent = BI.parseFloat(percent.toFixed(1)); var significantPercent = BI.parseFloat(percent.toFixed(1));
self._setAllPosition(significantPercent); self._setAllPosition(significantPercent);
var v = self._getValueByPercent(significantPercent); var v = self._getValueByPercent(significantPercent);
v = digitExist ? v.toFixed(o.digit) : v; v = o.digit === false ? v : v.toFixed(o.digit);
self.label.setText(v + o.unit); self.label.setText(v + o.unit);
self.value = v; self.value = v;
self.fireEvent(BI.SingleSliderLabel.EVENT_CHANGE); self.fireEvent(BI.SingleSliderLabel.EVENT_CHANGE);
@ -1692,17 +1691,16 @@ BI.SingleSliderLabel = BI.inherit(BI.Widget, {
setValue: function (v) { setValue: function (v) {
var o = this.options; var o = this.options;
var digitExist = (o.digit === "") ? false : true; v = BI.parseFloat(v);
var value = BI.parseFloat(v); v = o.digit === false ? v : v.toFixed(o.digit);
value = digitExist ? value.toFixed(o.digit) : value; if ((!isNaN(v))) {
if ((!isNaN(value))) { if (this._checkValidation(v)) {
if (this._checkValidation(value)) { this.value = v;
this.value = value;
} }
if (value > this.max) { if (v > this.max) {
this.value = this.max; this.value = this.max;
} }
if (value < this.min) { if (v < this.min) {
this.value = this.min; this.value = this.min;
} }
} }

22
dist/sliders.js vendored

@ -1485,7 +1485,7 @@ BI.SingleSliderLabel = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.SingleSliderLabel.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.SingleSliderLabel.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-single-slider-label bi-slider-track", baseCls: "bi-single-slider-label bi-slider-track",
digit: "", digit: false,
unit: "" unit: ""
}); });
}, },
@ -1493,7 +1493,6 @@ BI.SingleSliderLabel = BI.inherit(BI.Widget, {
BI.SingleSliderLabel.superclass._init.apply(this, arguments); BI.SingleSliderLabel.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
var digitExist = (o.digit === "") ? false : true;
var c = this._constant; var c = this._constant;
this.enable = false; this.enable = false;
this.value = ""; this.value = "";
@ -1523,7 +1522,7 @@ BI.SingleSliderLabel = BI.inherit(BI.Widget, {
self._setBlueTrack(significantPercent); self._setBlueTrack(significantPercent);
self._setLabelPosition(significantPercent); self._setLabelPosition(significantPercent);
var v = self._getValueByPercent(significantPercent); var v = self._getValueByPercent(significantPercent);
v = digitExist ? v.toFixed(o.digit) : v; v = o.digit === false ? v : v.toFixed(o.digit);
self.label.setText(v + o.unit); self.label.setText(v + o.unit);
self.value = v; self.value = v;
self.fireEvent(BI.SingleSliderLabel.EVENT_CHANGE); self.fireEvent(BI.SingleSliderLabel.EVENT_CHANGE);
@ -1561,7 +1560,7 @@ BI.SingleSliderLabel = BI.inherit(BI.Widget, {
var significantPercent = BI.parseFloat(percent.toFixed(1)); var significantPercent = BI.parseFloat(percent.toFixed(1));
self._setAllPosition(significantPercent); self._setAllPosition(significantPercent);
var v = self._getValueByPercent(significantPercent); var v = self._getValueByPercent(significantPercent);
v = digitExist ? v.toFixed(o.digit) : v; v = o.digit === false ? v : v.toFixed(o.digit);
self.label.setText(v + o.unit); self.label.setText(v + o.unit);
self.value = v; self.value = v;
self.fireEvent(BI.SingleSliderLabel.EVENT_CHANGE); self.fireEvent(BI.SingleSliderLabel.EVENT_CHANGE);
@ -1692,17 +1691,16 @@ BI.SingleSliderLabel = BI.inherit(BI.Widget, {
setValue: function (v) { setValue: function (v) {
var o = this.options; var o = this.options;
var digitExist = (o.digit === "") ? false : true; v = BI.parseFloat(v);
var value = BI.parseFloat(v); v = o.digit === false ? v : v.toFixed(o.digit);
value = digitExist ? value.toFixed(o.digit) : value; if ((!isNaN(v))) {
if ((!isNaN(value))) { if (this._checkValidation(v)) {
if (this._checkValidation(value)) { this.value = v;
this.value = value;
} }
if (value > this.max) { if (v > this.max) {
this.value = this.max; this.value = this.max;
} }
if (value < this.min) { if (v < this.min) {
this.value = this.min; this.value = this.min;
} }
} }

Loading…
Cancel
Save