UNPKG

armisa-models

Version:
78 lines (77 loc) 3.42 kB
"use strict"; var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); }; var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; }; var _SelfCheckTree_value; Object.defineProperty(exports, "__esModule", { value: true }); exports.SelfCheckTree = void 0; const BaseSelfControl_1 = require("./BaseSelfControl"); class SelfCheckTree extends BaseSelfControl_1.BaseSelfControl { get value() { return __classPrivateFieldGet(this, _SelfCheckTree_value, "f"); } set value(value) { } constructor(value) { super(); this.isValueEmpty = () => { return typeof __classPrivateFieldGet(this, _SelfCheckTree_value, "f") === 'number'; }; this.isValueNotEmpty = () => { return !this.isValueEmpty(); }; this.validate = () => { this.validation = true; }; this.cleaningClassInitializer = () => { this.hasChange = false; this.defaultValue = undefined; this.initializeListener = false; this.initializeProperties = false; this.validation = true; }; this.refreshHasChange = () => { if (this.showHasChangeFlag) { this.hasChange = this.defaultValue !== __classPrivateFieldGet(this, _SelfCheckTree_value, "f"); } }; this.restartDefaultValue = () => { this.defaultValue = this.value; this.refreshHasChange(); }; _SelfCheckTree_value.set(this, void 0); this.setValue = (value) => { __classPrivateFieldSet(this, _SelfCheckTree_value, value, "f"); this.refreshHasChange(); }; this.deserialize = (value) => { __classPrivateFieldSet(this, _SelfCheckTree_value, value, "f"); this.restartDefaultValue(); }; __classPrivateFieldSet(this, _SelfCheckTree_value, value, "f"); this.restartDefaultValue(); } static empty() { return new SelfCheckTree(0); } static deserialize(value) { if (!value) { return new SelfCheckTree(0); } else if ([0, 1, 2, 3, 4].includes(value)) { return new SelfCheckTree(value); } else { return new SelfCheckTree(0); } } } exports.SelfCheckTree = SelfCheckTree; _SelfCheckTree_value = new WeakMap();