UNPKG

armisa-models

Version:
67 lines (66 loc) 3.51 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 _SidbarFactory_value, _SidbarFactory_defaultValue; Object.defineProperty(exports, "__esModule", { value: true }); exports.SidItemFactory = exports.SidbarFactory = void 0; const ElementFactory_1 = require("../Page/ElementsOfFormFactory/ElementFactory"); const Cach_1 = require("./Cach"); class SidbarFactory extends ElementFactory_1.ElementFactory { get value() { return __classPrivateFieldGet(this, _SidbarFactory_value, "f")?.value || null; } get defaultValue() { return __classPrivateFieldGet(this, _SidbarFactory_defaultValue, "f"); } constructor(_mainStateFactory, _fieldName, _dispose, tabIndex, payLoadKey) { super(_mainStateFactory, _fieldName, _dispose, payLoadKey); this.tabIndex = tabIndex; this.restartDefaultValue = () => { }; this.refreshHasChange = () => { }; this.validate = () => { }; this.deseriallize = (jsonValue) => { }; this.clearData = () => { }; this.isActiveItem = (slidItemFactory) => { return __classPrivateFieldGet(this, _SidbarFactory_value, "f") === slidItemFactory; }; this.forceUpdate = () => { }; this.items = []; this.addNewItem = (caption, value, icon) => { this.items.push(new SidItemFactory(this, caption, value, icon)); }; _SidbarFactory_value.set(this, null); this.setValue = (value) => { __classPrivateFieldSet(this, _SidbarFactory_value, value, "f"); Cach_1.Cach.setValue(this, __classPrivateFieldGet(this, _SidbarFactory_value, "f")); this.forceUpdate(); }; _SidbarFactory_defaultValue.set(this, null); if (Cach_1.Cach.isCached(this)) { const cach = Cach_1.Cach.getCached(this); __classPrivateFieldSet(this, _SidbarFactory_value, cach.value, "f"); this.validation = cach.validation; this._hasChange = cach.hasChange; } } } exports.SidbarFactory = SidbarFactory; _SidbarFactory_value = new WeakMap(), _SidbarFactory_defaultValue = new WeakMap(); class SidItemFactory { constructor(SlidbarFactory, caption, value, icon) { this.SlidbarFactory = SlidbarFactory; this.caption = caption; this.value = value; this.icon = icon; } } exports.SidItemFactory = SidItemFactory;