import * as tslib_1 from "tslib";
import { Component, Input, Output, EventEmitter, ViewChild, ElementRef } from '@angular/core';
let DialogAlertComponent = class DialogAlertComponent {
    constructor(elementRef) {
        this.elementRef = elementRef;
        this.text = '';
        this.close = new EventEmitter();
        this.dialog = null;
    }
    closeAlert() {
        this.close.emit(null);
    }
    btnClick(e, btn) {
        this.close.emit(btn);
    }
    overlayClick(e) {
        this.close.emit(null);
    }
    init(txt, dialog) {
        this.text = txt;
        this.dialog = dialog;
        setTimeout(() => {
            // Animation
            this.alert.nativeElement.style.transform = 'translateY(0px)';
            this.alert.nativeElement.style.opacity = '1.0';
            this.overlay.nativeElement.style.opacity = '0.4';
        });
    }
};
tslib_1.__decorate([
    Input(),
    tslib_1.__metadata("design:type", String)
], DialogAlertComponent.prototype, "text", void 0);
tslib_1.__decorate([
    Output(),
    tslib_1.__metadata("design:type", EventEmitter)
], DialogAlertComponent.prototype, "close", void 0);
tslib_1.__decorate([
    ViewChild('alert'),
    tslib_1.__metadata("design:type", Object)
], DialogAlertComponent.prototype, "alert", void 0);
tslib_1.__decorate([
    ViewChild('overlay'),
    tslib_1.__metadata("design:type", Object)
], DialogAlertComponent.prototype, "overlay", void 0);
DialogAlertComponent = tslib_1.__decorate([
    Component({
        selector: 'true-dialog-alert',
        template: "<div #alert class=\"true-dialog-alert\">\r\n  <div class=\"true-dialog-alert__content\">{{text}}</div>\r\n  <div class=\"true-dialog-alert__footer\">\r\n    <p>\r\n      <button\r\n        *ngFor=\"let b of dialog.buttons\"\r\n        class=\"true-button\"\r\n        [ngClass]=\"b.cssClass\"\r\n        (click)=\"btnClick($event, b)\"\r\n        [disabled]=\"b.disabled\">{{b.caption}}</button>\r\n    </p>\r\n  </div>\r\n</div>\r\n<div #overlay\r\n     class=\"true-dialog-alert__overlay\"\r\n     (click)=\"overlayClick($event)\">\r\n</div>\r\n",
        styles: [":host{display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;align-content:flex-start}.true-dialog-alert{display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;align-content:flex-start;z-index:10;opacity:0;-webkit-transform:translateY(-15px);transform:translateY(-15px);-webkit-transition:opacity .2s,-webkit-transform .15s ease-out;transition:opacity .2s,transform .15s ease-out,-webkit-transform .15s ease-out}.true-dialog-alert .true-dialog-alert__content{display:block;padding:1em;text-align:center}.true-dialog-alert .true-dialog-alert__footer{display:-webkit-box;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-direction:row;-webkit-box-pack:end;justify-content:flex-end;padding:0 1.2em 1em}.true-dialog-alert .true-dialog-alert__footer p{margin:0}.true-dialog-alert .true-dialog-alert__footer button{padding:.4em 1em;margin-left:1em}.true-dialog-alert__overlay{position:absolute;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,.3);opacity:0;z-index:9;-webkit-transition:opacity .5s;transition:opacity .5s}"]
    }),
    tslib_1.__metadata("design:paramtypes", [ElementRef])
], DialogAlertComponent);
export { DialogAlertComponent };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGlhbG9nLWFsZXJ0LmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0B0cnVlLWRpcmVjdGl2ZS9ncmlkLyIsInNvdXJjZXMiOlsic3JjL2NvbnRyb2xzL2RpYWxvZy1hbGVydC5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQUUsS0FBSyxFQUFFLE1BQU0sRUFBRSxZQUFZLEVBQUUsU0FBUyxFQUFFLFVBQVUsRUFBRyxNQUFNLGVBQWUsQ0FBQztBQVMvRixJQUFhLG9CQUFvQixHQUFqQyxNQUFhLG9CQUFvQjtJQXVDL0IsWUFBbUIsVUFBc0I7UUFBdEIsZUFBVSxHQUFWLFVBQVUsQ0FBWTtRQXBDekMsU0FBSSxHQUFXLEVBQUUsQ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