import * as tslib_1 from "tslib";
import { Component, Input, Output, EventEmitter, ViewChild, ElementRef } from '@angular/core';
var DialogAlertComponent = /** @class */ (function () {
    function DialogAlertComponent(elementRef) {
        this.elementRef = elementRef;
        this.text = '';
        this.close = new EventEmitter();
        this.dialog = null;
    }
    DialogAlertComponent.prototype.closeAlert = function () {
        this.close.emit(null);
    };
    DialogAlertComponent.prototype.btnClick = function (e, btn) {
        this.close.emit(btn);
    };
    DialogAlertComponent.prototype.overlayClick = function (e) {
        this.close.emit(null);
    };
    DialogAlertComponent.prototype.init = function (txt, dialog) {
        var _this = this;
        this.text = txt;
        this.dialog = dialog;
        setTimeout(function () {
            // 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);
    return DialogAlertComponent;
}());
export { DialogAlertComponent };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGlhbG9nLWFsZXJ0LmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0B0cnVlLWRpcmVjdGl2ZS9ncmlkLyIsInNvdXJjZXMiOlsic3JjL2NvbnRyb2xzL2RpYWxvZy1hbGVydC5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQUUsS0FBSyxFQUFFLE1BQU0sRUFBRSxZQUFZLEVBQUUsU0FBUyxFQUFFLFVBQVUsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQVM5RjtJQXVDRSw4QkFBbUIsVU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