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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGlhbG9nLWFsZXJ0LmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0B0cnVlLWRpcmVjdGl2ZS9ncmlkLyIsInNvdXJjZXMiOlsic3JjL2NvbnRyb2xzL2RpYWxvZy1hbGVydC5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQUUsS0FBSyxFQUFFLE1BQU0sRUFBRSxZQUFZLEVBQUUsU0FBUyxFQUFFLFVBQVUsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQVM5RixJQUFhLG9CQUFvQixHQUFqQyxNQUFhLG9CQUFvQjtJQXVDL0IsWUFBbUIsVUFBc0I7UUFBdEIsZUFBVSxHQUFWLFVBQVUsQ0FBWTtRQXBDekMsU0FBSSxHQUFXLEVBQUUsQ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