Repository URL to install this package:
|
Version:
2.4.15 ▾
|
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
const tslib_1 = require("tslib");
const mobx_1 = require("xmobx/mobx");
class RangeSliderStateInstance {
constructor(props) {
this.stepValue = props.stepValue;
this.minValue = props.minValue;
this.maxValue = props.maxValue;
this.selectedValue = props.maxValue;
this.initialMaxValue = props.maxValue;
}
minValueView(event) {
this.minValue = event.target.value >= this.maxValue ? this.maxValue - this.stepValue : event.target.value;
this.selectedValueView();
}
maxValueView(event) {
this.maxValue = event.target.value <= this.minValue ? this.minValue + this.stepValue : event.target.value;
this.selectedValueView();
}
selectedValueView() {
this.selectedValue = this.maxValue - this.minValue;
}
get optionList() {
const arrayOfObject = [];
let range = 0;
let index = 0;
for (range; range <= this.initialMaxValue; range = range + this.stepValue) {
if (range % this.stepValue === 0) {
const config = {
value: range,
index: index,
stepValue: this.stepValue
};
arrayOfObject.push(config);
index++;
}
}
return arrayOfObject;
}
}
tslib_1.__decorate([mobx_1.observable], RangeSliderStateInstance.prototype, "minValue", void 0);
tslib_1.__decorate([mobx_1.observable], RangeSliderStateInstance.prototype, "maxValue", void 0);
tslib_1.__decorate([mobx_1.observable], RangeSliderStateInstance.prototype, "selectedValue", void 0);
tslib_1.__decorate([mobx_1.action.bound], RangeSliderStateInstance.prototype, "minValueView", null);
tslib_1.__decorate([mobx_1.action.bound], RangeSliderStateInstance.prototype, "maxValueView", null);
tslib_1.__decorate([mobx_1.action.bound], RangeSliderStateInstance.prototype, "selectedValueView", null);
tslib_1.__decorate([mobx_1.computed], RangeSliderStateInstance.prototype, "optionList", null);
exports.RangeSliderStateInstance = RangeSliderStateInstance; //# sourceMappingURL=state.js.map