import {Component, ElementRef, EventEmitter, Input, OnInit, Output} from "@angular/core";
@Component({
selector: 'fs-modal',
template: `
`
})
export class FullScreenModalComponent implements OnInit {
okButtonText = 'OK';
cancelButtonText = 'Cancel';
keys: boolean = false;
title: string = null;
@Output()
okEmitter: EventEmitter = new EventEmitter();
opened: boolean = false;
private readonly element: any;
constructor(private el: ElementRef) {
this.element = el.nativeElement;
}
ngOnInit() {
if(typeof document !== "undefined") {
document.body.appendChild(this.element);
}
}
ngOnDestroy(): void {
this.element.remove();
}
open() {
if(typeof document !== "undefined") {
this.opened = true;
document.getElementsByTagName('html')[0].classList.add('fs-modal-open');
}
}
close() {
if(typeof document !== "undefined") {
this.opened = false;
document.getElementsByTagName('html')[0].classList.remove('fs-modal-open');
}
}
ok() {
this.close();
this.okEmitter.emit(true);
}
}