armisa-models
Version:
models of armisa!
64 lines (63 loc) • 3.13 kB
JavaScript
"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 _PageFactory_hasChange;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PageFactory = void 0;
class PageFactory {
get any() {
return this;
}
get hasChange() {
return __classPrivateFieldGet(this, _PageFactory_hasChange, "f");
}
get isActivePage() {
return this.tabPageContainer.activeTab === this;
}
constructor(tabPageContainer, pageKey, caption, lazyLoadPage) {
this.tabPageContainer = tabPageContainer;
this.pageKey = pageKey;
this.caption = caption;
_PageFactory_hasChange.set(this, void 0);
this.subPages = [];
this.subPagesOrder = [];
this.closeThisSubPage = (subPage) => {
this.subPages = this.subPages.filter((t) => t !== subPage);
this.subPagesOrder = this.subPagesOrder.filter((t) => t !== subPage);
if (this.subPagesOrder.length > 0) {
this.activeSubPage = this.subPagesOrder[this.subPagesOrder.length - 1];
}
else {
this.activeSubPage = undefined;
}
this.forceUpdate();
};
this.selectThisSubPage = (subPage) => {
const newSubPage = this.subPagesOrder.filter((t) => t !== subPage);
newSubPage.push(subPage);
this.subPagesOrder = newSubPage;
this.forceUpdate();
};
this.id = Math.random().toString() + '-' + new Date().getMilliseconds().toString();
this.mainStateManager = this.tabPageContainer.mainStateManager;
this.Component = lazyLoadPage(this.pageKey);
__classPrivateFieldSet(this, _PageFactory_hasChange, false, "f");
this.forceUpdate = () => { };
this.forceUpdateHeadr = () => { };
this.forceUpdateToolStrip = () => { };
}
close() {
this.tabPageContainer.closeThisTab(this);
}
}
exports.PageFactory = PageFactory;
_PageFactory_hasChange = new WeakMap();