(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@ng-tangram/components/button'), require('@ng-tangram/components/overlay'), require('@angular/cdk/overlay')) :
    typeof define === 'function' && define.amd ? define('@ng-tangram/components/popconfirm', ['exports', '@angular/common', '@angular/core', '@ng-tangram/components/button', '@ng-tangram/components/overlay', '@angular/cdk/overlay'], factory) :
    (global = global || self, factory((global.nt = global.nt || {}, global.nt.components = global.nt.components || {}, global.nt.components.popconfirm = {}), global.ng.common, global.ng.core, global.nt.components.button, global.nt.components.overlay, global.ng.cdk.overlay));
}(this, (function (exports, common, core, button, overlay, overlay$1) { 'use strict';

    var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
        else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    };
    var NtPopConfirmComponent = (function () {
        function NtPopConfirmComponent(_elementRef) {
            this._elementRef = _elementRef;
            this._title = '';
            this.position = overlay.NtOverlayPosition.Top;
            this.confirmText = '确认';
            this.cancelText = '取消';
            this.confirm = new core.EventEmitter();
            this.cancel = new core.EventEmitter();
            this.afterOpen = new core.EventEmitter();
            this.afterClosed = new core.EventEmitter();
            this.beforeOpen = new core.EventEmitter();
            this.beforeClosed = new core.EventEmitter();
            this.positionChange = new core.EventEmitter();
            this.origin = new overlay$1.CdkOverlayOrigin(this._elementRef);
        }
        Object.defineProperty(NtPopConfirmComponent.prototype, "title", {
            get: function () { return this._title; },
            set: function (value) { this._title = value; },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NtPopConfirmComponent.prototype, "template", {
            get: function () { return this._template; },
            set: function (value) { this._template = value; },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NtPopConfirmComponent.prototype, "popconfirm", {
            set: function (value) {
                if (value instanceof core.TemplateRef) {
                    this._template = value;
                }
                else {
                    this._title = value;
                    this._template = null;
                }
            },
            enumerable: true,
            configurable: true
        });
        NtPopConfirmComponent.prototype.ngOnChanges = function (changes) {
            var _this = this;
            var change = changes.title || changes.template || changes.popover;
            if (change && !change.firstChange) {
                Promise.resolve().then(function () {
                    _this.overlay.forceUpdatePosition();
                });
            }
        };
        NtPopConfirmComponent.prototype._closeOverlay = function (event, isConfirm) {
            (isConfirm ? this.confirm : this.cancel).emit();
            this.overlay.close();
            event.stopPropagation();
        };
        NtPopConfirmComponent.prototype._afterOpen = function (event) {
            this.afterOpen.next(event);
        };
        NtPopConfirmComponent.prototype._afterClosed = function (event) {
            this.afterClosed.next(event);
        };
        NtPopConfirmComponent.prototype._beforeOpen = function (event) {
            this.beforeOpen.next(event);
        };
        NtPopConfirmComponent.prototype._beforeClosed = function (event) {
            this.beforeClosed.next(event);
        };
        NtPopConfirmComponent.prototype._positionChange = function (change) {
            this.positionChange.next(change);
        };
        NtPopConfirmComponent.ctorParameters = function () { return [
            { type: core.ElementRef }
        ]; };
        __decorate([
            core.Input()
        ], NtPopConfirmComponent.prototype, "title", null);
        __decorate([
            core.Input()
        ], NtPopConfirmComponent.prototype, "template", null);
        __decorate([
            core.Input('nt-popconfirm')
        ], NtPopConfirmComponent.prototype, "popconfirm", null);
        __decorate([
            core.Input()
        ], NtPopConfirmComponent.prototype, "position", void 0);
        __decorate([
            core.Input()
        ], NtPopConfirmComponent.prototype, "confirmText", void 0);
        __decorate([
            core.Input()
        ], NtPopConfirmComponent.prototype, "cancelText", void 0);
        __decorate([
            core.Output()
        ], NtPopConfirmComponent.prototype, "confirm", void 0);
        __decorate([
            core.Output()
        ], NtPopConfirmComponent.prototype, "cancel", void 0);
        __decorate([
            core.Output()
        ], NtPopConfirmComponent.prototype, "afterOpen", void 0);
        __decorate([
            core.Output()
        ], NtPopConfirmComponent.prototype, "afterClosed", void 0);
        __decorate([
            core.Output()
        ], NtPopConfirmComponent.prototype, "beforeOpen", void 0);
        __decorate([
            core.Output()
        ], NtPopConfirmComponent.prototype, "beforeClosed", void 0);
        __decorate([
            core.Output()
        ], NtPopConfirmComponent.prototype, "positionChange", void 0);
        __decorate([
            core.ViewChild(overlay.NtOverlayComponent, { static: true })
        ], NtPopConfirmComponent.prototype, "overlay", void 0);
        NtPopConfirmComponent = __decorate([
            core.Component({
                selector: '[nt-popconfirm]',
                template: "<ng-content></ng-content>\n<nt-overlay\n  overlayClass=\"nt-popconfirm-overlay\"\n  arrow\n  [origin]=\"origin\"\n  [position]=\"position\"\n  (afterOpen)=\"_afterOpen($event)\"\n  (afterClosed)=\"_afterClosed($event)\"\n  (beforeOpen)=\"_beforeOpen($event)\"\n  (beforeClosed)=\"_beforeClosed($event)\"\n  (positionChange)=\"_positionChange($event)\">\n  <div class=\"nt-popconfirm\">\n    <div class=\"nt-popconfirm-title\" *ngIf=\"template\"><ng-container *ngTemplateOutlet=\"template\"></ng-container></div>\n    <div class=\"nt-popconfirm-title\" *ngIf=\"!template\" [innerHtml]=\"title\"></div>\n    <div class=\"nt-popconfirm-action\">\n      <button nt-button color=\"secondary\" size=\"tiny\" (click)=\"_closeOverlay($event, false)\">{{cancelText}}</button>\n      <button nt-button size=\"tiny\" (click)=\"_closeOverlay($event, true)\">{{confirmText}}</button>\n    </div>\n  </div>\n</nt-overlay>\n",
                encapsulation: core.ViewEncapsulation.None,
                host: {
                    '(click)': 'overlay.toggle()'
                }
            })
        ], NtPopConfirmComponent);
        return NtPopConfirmComponent;
    }());

    var __decorate$1 = (this && this.__decorate) || function (decorators, target, key, desc) {
        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
        else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    };
    var NtPopConfirmModule = (function () {
        function NtPopConfirmModule() {
        }
        NtPopConfirmModule = __decorate$1([
            core.NgModule({
                imports: [common.CommonModule, overlay.NtOverlayModule, button.NtButtonModule],
                exports: [NtPopConfirmComponent],
                declarations: [NtPopConfirmComponent]
            })
        ], NtPopConfirmModule);
        return NtPopConfirmModule;
    }());

    exports.NtPopConfirmComponent = NtPopConfirmComponent;
    exports.NtPopConfirmModule = NtPopConfirmModule;

    Object.defineProperty(exports, '__esModule', { value: true });

})));
//# sourceMappingURL=popconfirm.umd.js.map
