Repository URL to install this package:
|
Version:
3.1.1 ▾
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const mobx_1 = require("mobx");
const deps_1 = require("./deps");
class CommonState {
constructor() {
/**
* @note: these seem attribute-like
*/
/** @description for inputs, this is `isFocused` */
this.isActive = false;
/** @description for inputs, this is value for checkbox? or something else... */
this.isSelected = false;
/** @description for inputs, this is what was @name labelText */
this.label = '';
/** @description for inputs, the VALUE OF THE INPUT */
this.value = '';
/** @description for disabling inputs from being changed */
this.isDisabled = false;
/** @description for hiding / showing inputs so we can adjust them dynamically */
this.isVisible = true;
}
setValue(value) {
this.value = deps_1.toValue(value);
}
setLabel(label) {
this.label = label;
}
setIsDisabled(isDisabled) {
this.isDisabled = isDisabled;
}
setIsVisible(isVisible) {
this.isVisible = isVisible;
}
setIsSelected(isSelected) {
this.isSelected = isSelected;
}
/** @description for inputs, this is `isFocused` */
setIsActive(isActive) {
this.isActive = isActive;
}
}
tslib_1.__decorate([
mobx_1.observable
], CommonState.prototype, "isActive", void 0);
tslib_1.__decorate([
mobx_1.observable
], CommonState.prototype, "isSelected", void 0);
tslib_1.__decorate([
mobx_1.observable
], CommonState.prototype, "label", void 0);
tslib_1.__decorate([
mobx_1.observable
], CommonState.prototype, "value", void 0);
tslib_1.__decorate([
mobx_1.observable
], CommonState.prototype, "isDisabled", void 0);
tslib_1.__decorate([
mobx_1.observable
], CommonState.prototype, "isVisible", void 0);
tslib_1.__decorate([
mobx_1.action
], CommonState.prototype, "setValue", null);
tslib_1.__decorate([
mobx_1.action
], CommonState.prototype, "setLabel", null);
tslib_1.__decorate([
mobx_1.action
], CommonState.prototype, "setIsDisabled", null);
tslib_1.__decorate([
mobx_1.action
], CommonState.prototype, "setIsVisible", null);
tslib_1.__decorate([
mobx_1.action
], CommonState.prototype, "setIsSelected", null);
tslib_1.__decorate([
mobx_1.action
], CommonState.prototype, "setIsActive", null);
exports.CommonState = CommonState;
//# sourceMappingURL=CommonState.js.map