UNPKG

armisa-models

Version:
127 lines (126 loc) 6.75 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 _CheckBoxTreeFactory_value, _CheckBoxTreeFactory_defaultValue; Object.defineProperty(exports, "__esModule", { value: true }); exports.CheckBoxTreeFactory = void 0; const chainOfResponsibility_1 = require("../chainOfResponsibility"); const ElementFactory_1 = require("../Page/ElementsOfFormFactory/ElementFactory"); const Cach_1 = require("./Cach"); class CheckBoxTreeFactory extends ElementFactory_1.ElementFactory { get value() { return __classPrivateFieldGet(this, _CheckBoxTreeFactory_value, "f"); } get defaultValue() { return __classPrivateFieldGet(this, _CheckBoxTreeFactory_defaultValue, "f"); } constructor(_mainStateFactory, _fieldName, _dispose, caption, disabled, readonly, showHasChangeFlag, dirLeftToRight, tabIndex, payLoadKey, responseKey) { super(_mainStateFactory, _fieldName, _dispose, payLoadKey, responseKey); this.caption = caption; this.disabled = disabled; this.readonly = readonly; this.showHasChangeFlag = showHasChangeFlag; this.dirLeftToRight = dirLeftToRight; this.tabIndex = tabIndex; this.forceUpdate = () => { }; _CheckBoxTreeFactory_value.set(this, void 0); this.setValue = (value) => { __classPrivateFieldSet(this, _CheckBoxTreeFactory_value, value, "f"); this.refreshHasChange(); Cach_1.Cach.setValue(this, __classPrivateFieldGet(this, _CheckBoxTreeFactory_value, "f")); this.forceUpdate(); }; this.deseriallize = (e) => { const deseriallizeNumber = (numberValue) => { if (numberValue === 1) { __classPrivateFieldSet(this, _CheckBoxTreeFactory_defaultValue, 1, "f"); __classPrivateFieldSet(this, _CheckBoxTreeFactory_value, 1, "f"); } else if (numberValue === 2) { __classPrivateFieldSet(this, _CheckBoxTreeFactory_defaultValue, 2, "f"); __classPrivateFieldSet(this, _CheckBoxTreeFactory_value, 2, "f"); } else if (numberValue === 3) { __classPrivateFieldSet(this, _CheckBoxTreeFactory_defaultValue, 3, "f"); __classPrivateFieldSet(this, _CheckBoxTreeFactory_value, 3, "f"); } else if (numberValue === 4) { __classPrivateFieldSet(this, _CheckBoxTreeFactory_defaultValue, 4, "f"); __classPrivateFieldSet(this, _CheckBoxTreeFactory_value, 4, "f"); } else { __classPrivateFieldSet(this, _CheckBoxTreeFactory_defaultValue, 0, "f"); __classPrivateFieldSet(this, _CheckBoxTreeFactory_value, 0, "f"); } }; this.clearData(); if (e === null) { //do nothing } else if (e === undefined) { //do nothing } else if (typeof e === 'number') { deseriallizeNumber(e); } else if (typeof e === 'string') { const numberValue = +e; if (!isNaN(numberValue)) { deseriallizeNumber(numberValue); } } Cach_1.Cach.setValue(this, __classPrivateFieldGet(this, _CheckBoxTreeFactory_value, "f")); }; this.clearData = () => { Cach_1.Cach.clear(this); __classPrivateFieldSet(this, _CheckBoxTreeFactory_value, 0, "f"); __classPrivateFieldSet(this, _CheckBoxTreeFactory_defaultValue, 0, "f"); this.validation = true; this._hasChange = false; }; _CheckBoxTreeFactory_defaultValue.set(this, void 0); this.focusToElement = () => { this.mainStateFactory.elementsOfForm.focuseToThisElement(this); }; this.restartDefaultValue = () => { __classPrivateFieldSet(this, _CheckBoxTreeFactory_defaultValue, this.value, "f"); this.refreshHasChange(); }; this.refreshHasChange = () => { if (this.showHasChangeFlag) { this._hasChange = this.defaultValue !== __classPrivateFieldGet(this, _CheckBoxTreeFactory_value, "f"); } }; this.validate = () => { var validationChain = new chainOfResponsibility_1.ValidationChain(); validationChain.validators.add(this.validateNormal); this.validation = validationChain.validate(); }; this.validateNormal = (_eventArgs) => { }; this.isValueEmpty = () => { return typeof __classPrivateFieldGet(this, _CheckBoxTreeFactory_value, "f") === 'string' && __classPrivateFieldGet(this, _CheckBoxTreeFactory_value, "f") !== ''; }; this.isValueNotEmpty = () => { return !this.isValueEmpty(); }; __classPrivateFieldSet(this, _CheckBoxTreeFactory_value, 0, "f"); __classPrivateFieldSet(this, _CheckBoxTreeFactory_defaultValue, 0, "f"); if (Cach_1.Cach.isCached(this)) { const cach = Cach_1.Cach.getCached(this); __classPrivateFieldSet(this, _CheckBoxTreeFactory_value, cach.value, "f"); this.validation = cach.validation; this._hasChange = cach.hasChange; } } } exports.CheckBoxTreeFactory = CheckBoxTreeFactory; _CheckBoxTreeFactory_value = new WeakMap(), _CheckBoxTreeFactory_defaultValue = new WeakMap();