armisa-models
Version:
models of armisa!
120 lines (119 loc) • 4.94 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PopupPageData = exports.MouseLocationProps = 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 ModalData_1 = require("./ModalData");
class MouseLocationProps {
constructor(X, Y) {
this.X = X;
this.Y = Y;
}
static buildFromMouseEvent(e) {
return new MouseLocationProps(e.clientX, e.clientY);
}
}
exports.MouseLocationProps = MouseLocationProps;
class PopupPageData extends BasePageData_1.BasePageData {
get any() {
return this;
}
constructor(maniStateManage, parent, mouseLocation, location, byArrow) {
super(maniStateManage);
this.parent = parent;
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.closeThisPopup(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.isMainOfStacks = isMainOfStacks;
// this.mainStateManager.Modaling.addModalPage(this.modal);
}
};
this.showPopup = (component, mouseLocation, location) => {
this.popup = new PopupPageData(this.mainStateManager, this, mouseLocation, location);
this.popup.component = component;
// this.mainStateManager.Modaling.addPopup(this.popup);
};
this.showPopupPage = (pageKey, props) => {
if (pageKey) {
this.popup = new 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.backdropElement = document.createElement('div');
this.backdropElement.classList.add('backdrop-popup');
// this.backdropElement.style.zIndex = `${4000 + this.mainStateManager.Modaling.modals.length }`;
this.mainElement = document.createElement('div');
this.mainElement.classList.add('popup');
if (mouseLocation instanceof MouseLocationProps) {
this.mainElement.style.left = `${mouseLocation.X}px`;
this.mainElement.style.top = `${mouseLocation.Y}px`;
}
else if (typeof mouseLocation === 'object') {
this.mainElement.style.left = `${mouseLocation.clientX}px`;
this.mainElement.style.top = `${mouseLocation.clientY}px`;
}
else {
this.backdropElement.classList.add('back-drop');
}
if (byArrow) {
this.mainElement.classList.add('arrow');
}
if (location && mouseLocation) {
this.mainElement.classList.add(location);
}
// this.mainElement.style.zIndex = `${4000 + this.mainStateManager.Modaling.modals.length }`;
this.backdropElement.onclick = this.closeThisPage;
}
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.PopupPageData = PopupPageData;