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 ConfirmComponent = /** @class */ (function () {
    function ConfirmComponent(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();
    }
    ConfirmComponent.prototype.open = function () {
        this.dialog.show();
    };
    ConfirmComponent.prototype.close = function () {
        this.dialog.hide();
        this.cancelEvent.emit();
    };
    ConfirmComponent.prototype.cancel = function () {
        this.dialog.hide();
        this.cancelEvent.emit();
    };
    ConfirmComponent.prototype.confirm = function () {
        this.dialog.hide();
        this.confirmEvent.emit();
    };
    tslib_1.__decorate([
        ViewChild(DialogComponent, { static: true }),
        tslib_1.__metadata("design:type", Object)
    ], ConfirmComponent.prototype, "dialog", void 0);
    tslib_1.__decorate([
        Input(),
        tslib_1.__metadata("design:type", String)
    ], ConfirmComponent.prototype, "type", void 0);
    tslib_1.__decorate([
        Input(),
        tslib_1.__metadata("design:type", String)
    ], ConfirmComponent.prototype, "title", void 0);
    tslib_1.__decorate([
        Input(),
        tslib_1.__metadata("design:type", String)
    ], ConfirmComponent.prototype, "content", void 0);
    tslib_1.__decorate([
        OnChange(true),
        Input(),
        tslib_1.__metadata("design:type", Boolean)
    ], ConfirmComponent.prototype, "modalable", void 0);
    tslib_1.__decorate([
        OnChange(true),
        Input(),
        tslib_1.__metadata("design:type", Boolean)
    ], ConfirmComponent.prototype, "closable", void 0);
    tslib_1.__decorate([
        Output(),
        tslib_1.__metadata("design:type", EventEmitter)
    ], ConfirmComponent.prototype, "confirmEvent", void 0);
    tslib_1.__decorate([
        Output(),
        tslib_1.__metadata("design:type", EventEmitter)
    ], ConfirmComponent.prototype, "cancelEvent", void 0);
    ConfirmComponent = tslib_1.__decorate([
        Component({
            selector: 'nb-confirm',
            template: "<nb-dialog class=\"nb-confirm-box\" [closable]=\"closable\"><nb-dialog-header>{{ title }}</nb-dialog-header><nb-dialog-body><div class=\"nb-confirm-content\">{{ content }}</div></nb-dialog-body><nb-dialog-footer><button nb-button (click)=\"confirm()\" theme=\"primary\">确定</button> <button nb-button (click)=\"cancel()\" theme=\"default\">取消</button></nb-dialog-footer></nb-dialog>",
            encapsulation: ViewEncapsulation.None,
            changeDetection: ChangeDetectionStrategy.OnPush,
            preserveWhitespaces: false,
            exportAs: 'nbConfirm',
            host: {
                'class': 'nb-widget'
            }
        }),
        tslib_1.__metadata("design:paramtypes", [ChangeDetectorRef,
            ElementRef,
            Renderer2])
    ], ConfirmComponent);
    return ConfirmComponent;
}());
export { ConfirmComponent };
//# sourceMappingURL=confirm.js.map