UNPKG

armisa-models

Version:
116 lines (115 loc) 5.05 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ModalPageData = void 0; const ValidatingControl_1 = require("../ValidatingControl"); const ChangingControl_1 = require("../ChangingControl"); const BasePageData_1 = require("../BasePageData"); const TabbingControl_1 = require("../TabbingControl"); const TouchingControl_1 = require("../TouchingControl"); const ModalPopup_1 = require("./ModalPopup"); class ModalPageData extends BasePageData_1.BasePageData { get any() { return this; } constructor(maniStateManage, parent, closeFunction) { super(maniStateManage); this.parent = parent; this.widthPecent = undefined; this.heightPecent = undefined; this.isInitializeOpicity = undefined; 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.mainStateManager.Eventing.trigger('hasChangeOnTabs'); }; this.selectThisPage = () => { }; this.closeThisPage = () => { // this.mainStateManager.Modaling.closeThisModal(this); }; this.showModal = (component) => { this.modal = new ModalPageData(this.mainStateManager, this); this.modal.component = component; // this.mainStateManager.Modaling.addModal(this.modal); }; this.showModalPage = (pageKey, props, isMainOfStacks) => { if (pageKey) { this.modal = new ModalPageData(this.mainStateManager, this); this.modal.pageKey = pageKey; this.modal.props = props; this.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.closePopup = () => { if (this._popup) { // this.mainStateManager.Modaling.closeThisPopup(this._popup); } }; this.parent.modal = this; this.backdropDivElement = document.createElement('div'); this.backdropDivElement.classList.add('backdrop-main-show'); // this.backdropDivElement.style.zIndex = `${4000 + this.mainStateManager.Modaling.modals.length }`; this.backdropDivElement.style.opacity = '0'; this.mainDivElement = document.createElement('div'); this.mainDivElement.classList.add('modal-main-show'); // this.mainDivElement.style.zIndex = `${4000 + this.mainStateManager.Modaling.modals.length }`; this.backdropDivElement.onclick = closeFunction || this.closeThisPage; } UpdateWidthAndHeightSize() { if (this.widthPecent) { if (typeof this.widthPecent === 'number' && this.widthPecent > 10) { this.mainDivElement.style.width = `${this.widthPecent}%`; } else if (typeof this.widthPecent === 'string' && this.widthPecent !== '') { this.mainDivElement.style.width = this.widthPecent; } } if (this.heightPecent) { if (typeof this.heightPecent === 'number' && this.heightPecent > 10) { this.mainDivElement.style.height = `${this.heightPecent}%`; } else if (typeof this.heightPecent === 'string' && this.heightPecent !== '') { this.mainDivElement.style.height = this.heightPecent; } } } 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; } onClickCancelButton() { } onClickHelpButton() { } setHelpElementRef() { } } exports.ModalPageData = ModalPageData;