import * as tslib_1 from "tslib";
import { Component, Input, Output, EventEmitter, ElementRef, ViewEncapsulation, ChangeDetectionStrategy, ChangeDetectorRef, Renderer2, ViewChild } from '@angular/core';
import { OnChange } from '../core/decorators';
import { DialogComponent } from './dialog';
var AlertComponent = /** @class */ (function () {
    function AlertComponent(cdRef, el, renderer) {
        this.cdRef = cdRef;
        this.el = el;
        this.renderer = renderer;
        this.title = '';
        this.content = '';
        this.modalable = false;
        this.closable = false;
        this.confirmEvent = new EventEmitter();
        this.cancelEvent = new EventEmitter();
    }
    AlertComponent.prototype.open = function () {
        this.dialog.show();
    };
    AlertComponent.prototype.close = function () {
        this.dialog.hide();
        this.cancelEvent.emit();
    };
    AlertComponent.prototype.ok = function () {
        this.close();
        this.confirmEvent.emit();
    };
    tslib_1.__decorate([
        ViewChild(DialogComponent, { static: true }),
        tslib_1.__metadata("design:type", Object)
    ], AlertComponent.prototype, "dialog", void 0);
    tslib_1.__decorate([
        Input(),
        tslib_1.__metadata("design:type", String)
    ], AlertComponent.prototype, "type", void 0);
    tslib_1.__decorate([
        Input(),
        tslib_1.__metadata("design:type", String)
    ], AlertComponent.prototype, "title", void 0);
    tslib_1.__decorate([
        Input(),
        tslib_1.__metadata("design:type", String)
    ], AlertComponent.prototype, "content", void 0);
    tslib_1.__decorate([
        OnChange(true),
        Input(),
        tslib_1.__metadata("design:type", Boolean)
    ], AlertComponent.prototype, "modalable", void 0);
    tslib_1.__decorate([
        OnChange(true),
        Input(),
        tslib_1.__metadata("design:type", Boolean)
    ], AlertComponent.prototype, "closable", void 0);
    tslib_1.__decorate([
        Output(),
        tslib_1.__metadata("design:type", EventEmitter)
    ], AlertComponent.prototype, "confirmEvent", void 0);
    tslib_1.__decorate([
        Output(),
        tslib_1.__metadata("design:type", EventEmitter)
    ], AlertComponent.prototype, "cancelEvent", void 0);
    AlertComponent = tslib_1.__decorate([
        Component({
            selector: 'nb-alert',
            template: "<nb-dialog class=\"nb-alert-box\" [closable]=\"closable\"><nb-dialog-body><div [ngSwitch]=\"type\" class=\"nb-alert-severity\"><i *ngSwitchCase=\"'success'\" class=\"iconfont icon-check_c\"></i> <i *ngSwitchCase=\"'error'\" class=\"iconfont icon-close_c\"></i> <i *ngSwitchCase=\"'info'\" class=\"iconfont icon-info_c\"></i></div><h3 class=\"nb-alert-title\">{{ title }}</h3><div class=\"nb-alert-conent\">{{ content }}</div></nb-dialog-body><nb-dialog-footer><button nb-button (click)=\"ok()\" theme=\"default\">知道了</button></nb-dialog-footer></nb-dialog>",
            encapsulation: ViewEncapsulation.None,
            changeDetection: ChangeDetectionStrategy.OnPush,
            preserveWhitespaces: false,
            exportAs: 'nbAlert',
            host: {
                'class': 'nb-widget'
            }
        }),
        tslib_1.__metadata("design:paramtypes", [ChangeDetectorRef,
            ElementRef,
            Renderer2])
    ], AlertComponent);
    return AlertComponent;
}());
export { AlertComponent };
//# sourceMappingURL=alert.js.map