UNPKG

armisa-models

Version:
110 lines (109 loc) 4.6 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TabPageData = void 0; const TabbingControl_1 = require("../TabbingControl"); const ValidatingControl_1 = require("../ValidatingControl"); const ChangingControl_1 = require("../ChangingControl"); const BasePageData_1 = require("../BasePageData"); const TouchingControl_1 = require("../TouchingControl"); const ModalData_1 = require("../Modal/ModalData"); const ModalPopup_1 = require("../Modal/ModalPopup"); const Main_1 = require("../../ModalOfStack/Main"); const Stack_1 = require("../../ModalOfStack/Stack"); class TabPageData extends BasePageData_1.BasePageData { get any() { return this; } get modal() { return this._modal; } set modal(value) { this._modal = value; } get popup() { return this._popup; } set popup(value) { this._popup = value; } get hasChange() { return this.ChangingControl.controls.length > 0; } constructor(mainStateManager) { super(mainStateManager); this.mainStateManager = mainStateManager; this.TouchingControl = new TouchingControl_1.TouchingControl(this); this.TabbingControl = new TabbingControl_1.TabbingControl(this); this.ValidatingControl = new ValidatingControl_1.ValidatingControl(this); this.ChangingControl = new ChangingControl_1.ChangingControl(this); this.updateHasChange = () => { this.Eventing.trigger('form.hasChangeOnTabs'); }; this.selectThisPage = () => { // this.mainStateManager.Tabing.selectThisTab(this); }; this.closeThisPage = () => { // this.mainStateManager.Tabing.closeThisTab(this); }; this.showModal = (component) => { this.modal = new ModalData_1.ModalPageData(this.mainStateManager, this); this.modal.component = component; // this.mainStateManager.Modaling.addModal(this.modal); }; this.showModalPage = (pageKey, props, isMainOfStacks) => { if (pageKey) { this.modal = new ModalData_1.ModalPageData(this.mainStateManager, this); this.modal.pageKey = pageKey; this.modal.props = props; this.modal.isMainOfStacks = isMainOfStacks; // this.mainStateManager.Modaling.addModalPage(this.modal); } }; this.showPopup = (component, mouseLocation, location, byArrow) => { this.popup = new ModalPopup_1.PopupPageData(this.mainStateManager, this, mouseLocation, location, byArrow); this.popup.component = component; // this.mainStateManager.Modaling.addPopup(this.popup); }; this.showPopupPage = (pageKey, props) => { if (pageKey) { this.popup = new ModalPopup_1.PopupPageData(this.mainStateManager, this); this.popup.pageKey = pageKey; this.popup.props = props; // this.mainStateManager.Modaling.addPopupPage(this.popup); } }; this.closeModal = () => { if (this._modal) { // this.mainStateManager.Modaling.closeThisModal(this._modal); this._modal = undefined; } }; this.closePopup = () => { if (this._popup) { // this.mainStateManager.Modaling.closeThisPopup(this._popup); this._popup = undefined; } }; } onClickCancelButton() { } onClickHelpButton() { } setHelpElementRef() { } addNewStack(pageKey, props, caption) { if (this.mainStacksFactory instanceof Main_1.MainStacksFactory) { const newTab = new TabPageData(this.mainStateManager); const stackFactory = new Stack_1.StackFactory(newTab, this.mainStacksFactory); newTab.pageKey = pageKey; newTab.props = props; if (caption) { newTab.caption = this.mainStateManager.getCaptionNaming(caption); } else { // newTab.caption = this.mainStateManager.MenuIteming.getCaptionOfPage(newTab.pageKey); } this.mainStacksFactory.stacks.push(stackFactory); this.mainStacksFactory.currentStack = stackFactory; this.mainStacksFactory.trigger('stack.add.new', newTab); } } } exports.TabPageData = TabPageData;