import { Component, ElementRef, HostListener, Inject, ViewChild } from '@angular/core';
import { FormBuilder } from '@angular/forms';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
export class QMSConfirmDialog {
    constructor(fb, _elRef, dialogRef, data) {
        this.fb = fb;
        this._elRef = _elRef;
        this.dialogRef = dialogRef;
        this.info = Object.assign({}, data);
    }
    onResize(event) {
        this.orderActionButton();
    }
    ngOnInit() {
    }
    ngAfterViewInit() {
        this.orderActionButton();
    }
    orderActionButton() {
        const divHeight = this.actionGroup.nativeElement.offsetHeight;
        document.getElementById('action-btn').style.order = divHeight > 68 ? '1' : '2';
    }
    save() {
        this.dialogRef.close(true);
    }
    close() {
        this.dialogRef.close(false);
    }
}
QMSConfirmDialog.decorators = [
    { type: Component, args: [{
                selector: 'qms-dialog-confirm',
                template: "<div class=\"dialog-container\">\r\n  <div mat-dialog-title class=\"dialog-title\">\r\n    <h3 class=\"title\" *ngIf=\"info.title\">{{info.title}}</h3>\r\n    <h3 class=\"title text-normal\" *ngIf=\"info.normalTitle\">\r\n      {{info.normalTitle}}\r\n    </h3>\r\n    <button\r\n      *ngIf=\"info.closeButton\"\r\n      qms-btn-icon\r\n      color=\"light\"\r\n      (click)=\"close()\"\r\n    >\r\n      <mat-icon>close</mat-icon>\r\n    </button>\r\n  </div>\r\n\r\n  <mat-dialog-content [innerHTML]=\"info.body\"></mat-dialog-content>\r\n\r\n  <mat-dialog-actions align=\"end\" #actionGroup>\r\n    <button qms-btn-text class=\"cancel-btn\" (click)=\"close()\">\r\n      {{info.cancelText}}\r\n    </button>\r\n    <button\r\n      *ngIf=\"info.buttonType == 'normal'\"\r\n      qms-btn\r\n      id=\"action-btn\"\r\n      class=\"action-btn\"\r\n      (click)=\"save()\"\r\n    >\r\n      {{info.actionText}}\r\n    </button>\r\n    <button\r\n      *ngIf=\"info.buttonType == 'outline'\"\r\n      qms-btn-text\r\n      id=\"action-btn\"\r\n      class=\"action-btn\"\r\n      (click)=\"save()\"\r\n    >\r\n      {{info.actionText}}\r\n    </button>\r\n  </mat-dialog-actions>\r\n</div>\r\n",
                styles: ["::ng-deep .qms-dialog.dark-mode .mat-dialog-container{background-color:#323232}::ng-deep .qms-dialog.dark-mode .dialog-container{background-color:#323232}::ng-deep .qms-dialog.dark-mode .dialog-container .cancel-btn,::ng-deep .qms-dialog.dark-mode .dialog-container .close-btn,::ng-deep .qms-dialog.dark-mode .dialog-container h3.title{color:#fff}::ng-deep .qms-dialog.dark-mode .dialog-container .close-btn:focus,::ng-deep .qms-dialog.dark-mode .dialog-container .close-btn:hover{color:#fff}::ng-deep .qms-dialog.dark-mode .dialog-container .mat-dialog-content{color:hsla(0,0%,100%,.6)}::ng-deep .qms-dialog.dark-mode .dialog-container .action-btn{background:#b7daf8;color:#1954a9}::ng-deep .qms-dialog.dark-mode .qms-btn-icon.qms-light{color:#fff}::ng-deep .qms-dialog.dark-mode .qms-btn-icon.qms-light:hover{color:#fff}::ng-deep .qms-dialog .dialog-container .dialog-title{display:flex;justify-content:space-between;align-items:baseline;margin:0 0 10px}::ng-deep .qms-dialog .dialog-container .close-btn{color:rgba(0,0,0,.6);height:30px;padding:0}::ng-deep .qms-dialog .dialog-container .close-btn:focus,::ng-deep .qms-dialog .dialog-container .close-btn:hover{color:rgba(0,0,0,.6)}::ng-deep .qms-dialog .dialog-container .mat-dialog-content{font-size:14px;font-family:Open Sans}::ng-deep .qms-dialog .dialog-container .action-btn{margin-left:16px;order:2}::ng-deep .qms-dialog .dialog-container .action-btn.priority{order:1}::ng-deep .qms-dialog .dialog-container .cancel-btn{order:2}::ng-deep .qms-dialog .dialog-container h3.title{font-family:Raleway;font-size:1rem;line-height:22px;font-weight:600}::ng-deep .qms-dialog .dialog-container h3.title.text-normal{font-family:Open Sans;font-weight:400;line-height:28px;color:inherit}"]
            },] }
];
QMSConfirmDialog.ctorParameters = () => [
    { type: FormBuilder },
    { type: ElementRef },
    { type: MatDialogRef },
    { type: undefined, decorators: [{ type: Inject, args: [MAT_DIALOG_DATA,] }] }
];
QMSConfirmDialog.propDecorators = {
    actionGroup: [{ type: ViewChild, args: ['actionGroup',] }],
    onResize: [{ type: HostListener, args: ['window:resize', ['$event'],] }]
};
export class QMSFormDialog {
    ngOnInit() {
    }
}
QMSFormDialog.decorators = [
    { type: Component, args: [{
                selector: 'qms-dialog-form',
                template: "<div class=\"dialog-container\">\r\n  <ng-content></ng-content>\r\n</div>\r\n",
                styles: ["::ng-deep .qms-dialog.dark-mode .mat-dialog-container{background-color:#323232}::ng-deep .qms-dialog.dark-mode .dialog-container{background-color:#323232}::ng-deep .qms-dialog.dark-mode .dialog-container .cancel-btn,::ng-deep .qms-dialog.dark-mode .dialog-container .close-btn,::ng-deep .qms-dialog.dark-mode .dialog-container h3.title{color:#fff}::ng-deep .qms-dialog.dark-mode .dialog-container .close-btn:focus,::ng-deep .qms-dialog.dark-mode .dialog-container .close-btn:hover{color:#fff}::ng-deep .qms-dialog.dark-mode .dialog-container .mat-dialog-content{color:hsla(0,0%,100%,.6)}::ng-deep .qms-dialog.dark-mode .dialog-container .action-btn{background:#b7daf8;color:#1954a9}::ng-deep .qms-dialog.dark-mode .qms-btn-icon.qms-light{color:#fff}::ng-deep .qms-dialog.dark-mode .qms-btn-icon.qms-light:hover{color:#fff}::ng-deep .qms-dialog .dialog-container .dialog-title{display:flex;justify-content:space-between;align-items:baseline;margin:0 0 10px}::ng-deep .qms-dialog .dialog-container .close-btn{color:rgba(0,0,0,.6);height:30px;padding:0}::ng-deep .qms-dialog .dialog-container .close-btn:focus,::ng-deep .qms-dialog .dialog-container .close-btn:hover{color:rgba(0,0,0,.6)}::ng-deep .qms-dialog .dialog-container .mat-dialog-content{font-size:14px;font-family:Open Sans}::ng-deep .qms-dialog .dialog-container .action-btn{margin-left:16px;order:2}::ng-deep .qms-dialog .dialog-container .action-btn.priority{order:1}::ng-deep .qms-dialog .dialog-container .cancel-btn{order:2}::ng-deep .qms-dialog .dialog-container h3.title{font-family:Raleway;font-size:1rem;line-height:22px;font-weight:600}::ng-deep .qms-dialog .dialog-container h3.title.text-normal{font-family:Open Sans;font-weight:400;line-height:28px;color:inherit}"]
            },] }
];
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGlhbG9nLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvcW1zLWFuZ3VsYXIvc3JjL2xpYi9jb21wb25lbnRzL2RpYWxvZy9kaWFsb2cudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFpQixTQUFTLEVBQUUsVUFBVSxFQUFFLFlBQVksRUFBRSxNQUFNLEVBQVUsU0FBUyxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQzlHLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQUM3QyxPQUFPLEVBQUUsWUFBWSxFQUFFLGVBQWUsRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBUXpFLE1BQU0sT0FBTyxnQkFBZ0I7SUFTM0IsWUFBb0IsRUFBZSxFQUN6QixNQUFrQixFQUNsQixTQUF5QyxFQUN4QixJQUFJO1FBSFgsT0FBRSxHQUFGLEVBQUUsQ0FBYTtRQUN6QixXQUFNLEdBQU4sTUFBTSxDQUFZO1FBQ2xCLGNBQVMsR0FBVCxTQUFTLENBQWdDO1FBR2pELElBQUksQ0FBQyxJQUFJLHFCQUFRLElBQUksQ0FBRSxDQUFDO0lBQzFCLENBQUM7SUFWRCxRQUFRLENBQUMsS0FBSztRQUNaLElBQUksQ0FBQyxpQkFBaUIsRUFBRSxDQUFDO0lBQzNCLENBQUM7SUFXRCxRQUFRO0lBRVIsQ0FBQztJQUVELGVBQWU7UUFDYixJQUFJLENBQUMsaUJBQWlCLEVBQUUsQ0FBQztJQUMzQixDQUFDO0lBRUQsaUJBQWlCO1FBQ2YsTUFBTSxTQUFTLEdBQUcsSU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