var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
import { Component, ViewEncapsulation, Input, Output, EventEmitter, ContentChild } from '@angular/core';
import { NzPopconfirmDirective } from './nz-popconfirm.directive';
import { FadeAnimation } from '../core/animation/fade-animations';
import { NzToolTipComponent } from '../tooltip/nz-tooltip.component';
var NzPopconfirmComponent = (function (_super) {
    __extends(NzPopconfirmComponent, _super);
    function NzPopconfirmComponent() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this._prefix = 'ant-popover-placement';
        _this._trigger = 'click';
        _this._hasBackdrop = true;
        _this._condition = false;
        _this.nzOkText = '确定';
        _this.nzCancelText = '取消';
        _this.nzOnCancel = new EventEmitter();
        _this.nzOnConfirm = new EventEmitter();
        return _this;
    }
    Object.defineProperty(NzPopconfirmComponent.prototype, "nzCondition", {
        get: function () {
            return this._condition;
        },
        set: function (value) {
            this._condition = value;
        },
        enumerable: true,
        configurable: true
    });
    NzPopconfirmComponent.prototype.show = function () {
        if (!this._condition) {
            this.nzVisible = true;
        }
        else {
            this.onConfirm();
        }
    };
    NzPopconfirmComponent.prototype.onCancel = function () {
        this.nzOnCancel.emit();
        this.nzVisible = false;
    };
    NzPopconfirmComponent.prototype.onConfirm = function () {
        this.nzOnConfirm.emit();
        this.nzVisible = false;
    };
    return NzPopconfirmComponent;
}(NzToolTipComponent));
export { NzPopconfirmComponent };
NzPopconfirmComponent.decorators = [
    { type: Component, args: [{
                selector: 'nz-popconfirm',
                encapsulation: ViewEncapsulation.None,
                animations: [
                    FadeAnimation
                ],
                template: "\n    <ng-content></ng-content>\n    <ng-template\n      nz-connected-overlay\n      [origin]=\"nzOrigin\"\n      [hasBackdrop]=\"_hasBackdrop\"\n      (backdropClick)=\"hide()\"\n      (detach)=\"hide()\"\n      (positionChange)=\"onPositionChange($event)\"\n      [positions]=\"_positions\"\n      [open]=\"visible$ | async\">\n      <div class=\"ant-popover\" [ngClass]=\"_classMap\" [ngStyle]=\"nzOverlayStyle\" [@fadeAnimation]=\"''+(visible$ | async)\"\n        (@fadeAnimation.done)=\"_afterVisibilityAnimation($event)\">\n        <div class=\"ant-popover-content\">\n          <div class=\"ant-popover-arrow\"></div>\n          <div class=\"ant-popover-inner\">\n            <div>\n              <div class=\"ant-popover-inner-content\">\n                <div class=\"ant-popover-message\" *ngIf=\"!nzTemplate\">\n                  <i class=\"anticon anticon-exclamation-circle\"></i>\n                  <div class=\"ant-popover-message-title\">{{nzTitle}}</div>\n                </div>\n                <div class=\"ant-popover-buttons\" *ngIf=\"!nzTemplate\">\n                  <button nz-button [nzSize]=\"'small'\" (click)=\"onCancel()\"><span>{{nzCancelText}}</span></button>\n                  <button nz-button [nzSize]=\"'small'\" [nzType]=\"'primary'\" (click)=\"onConfirm()\">\n                    <span>{{nzOkText}}</span></button>\n                </div>\n                <ng-template\n                  *ngIf=\"nzTemplate\"\n                  [ngTemplateOutlet]=\"nzTemplate\">\n                </ng-template>\n              </div>\n            </div>\n          </div>\n        </div>\n      </div>\n    </ng-template>",
                styles: [
                    "/* stylelint-disable at-rule-empty-line-before,at-rule-name-space-after,at-rule-no-unknown */\n/* stylelint-disable declaration-bang-space-before */\n/* stylelint-disable declaration-bang-space-before */\n.ant-popover {\n  position: absolute;\n  top: 0;\n  left: 0;\n  z-index: 1030;\n  cursor: auto;\n  user-select: text;\n  white-space: normal;\n  font-size: 12px;\n  line-height: 1.5;\n  font-weight: normal;\n  text-align: left;\n}\n.ant-popover:after {\n  content: \"\";\n  position: absolute;\n  background: rgba(255, 255, 255, 0.01);\n}\n.ant-popover-hidden {\n  display: none;\n}\n.ant-popover-placement-top,\n.ant-popover-placement-topLeft,\n.ant-popover-placement-topRight {\n  padding-bottom: 8px;\n}\n.ant-popover-placement-right,\n.ant-popover-placement-rightTop,\n.ant-popover-placement-rightBottom {\n  padding-left: 8px;\n}\n.ant-popover-placement-bottom,\n.ant-popover-placement-bottomLeft,\n.ant-popover-placement-bottomRight {\n  padding-top: 8px;\n}\n.ant-popover-placement-left,\n.ant-popover-placement-leftTop,\n.ant-popover-placement-leftBottom {\n  padding-right: 8px;\n}\n.ant-popover-inner {\n  background-color: #fff;\n  background-clip: padding-box;\n  border-radius: 4px;\n  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);\n}\n.ant-popover-title {\n  min-width: 177px;\n  margin: 0;\n  padding: 0 16px;\n  line-height: 32px;\n  height: 32px;\n  border-bottom: 1px solid #e9e9e9;\n  color: rgba(0, 0, 0, 0.65);\n  font-weight: 500;\n}\n.ant-popover-inner-content {\n  padding: 8px 16px;\n  color: rgba(0, 0, 0, 0.65);\n}\n.ant-popover-message {\n  padding: 8px 0 16px;\n  font-size: 12px;\n  color: rgba(0, 0, 0, 0.65);\n}\n.ant-popover-message > .anticon {\n  color: #ffbf00;\n  line-height: 17px;\n  position: absolute;\n}\n.ant-popover-message-title {\n  padding-left: 20px;\n}\n.ant-popover-buttons {\n  text-align: right;\n  margin-bottom: 8px;\n}\n.ant-popover-buttons button {\n  margin-left: 8px;\n}\n.ant-popover-arrow,\n.ant-popover-arrow:after {\n  position: absolute;\n  display: block;\n  width: 0;\n  height: 0;\n  border-color: transparent;\n  border-style: solid;\n}\n.ant-popover-arrow {\n  border-width: 5px;\n}\n.ant-popover-arrow:after {\n  border-width: 4px;\n  content: \"\";\n}\n.ant-popover-placement-top > .ant-popover-content > .ant-popover-arrow,\n.ant-popover-placement-topLeft > .ant-popover-content > .ant-popover-arrow,\n.ant-popover-placement-topRight > .ant-popover-content > .ant-popover-arrow {\n  border-bottom-width: 0;\n  border-top-color: rgba(217, 217, 217, 0.7);\n  bottom: 3px;\n}\n.ant-popover-placement-top > .ant-popover-content > .ant-popover-arrow:after,\n.ant-popover-placement-topLeft > .ant-popover-content > .ant-popover-arrow:after,\n.ant-popover-placement-topRight > .ant-popover-content > .ant-popover-arrow:after {\n  content: \" \";\n  bottom: 1px;\n  margin-left: -4px;\n  border-bottom-width: 0;\n  border-top-color: #fff;\n}\n.ant-popover-placement-top > .ant-popover-content > .ant-popover-arrow {\n  left: 50%;\n  margin-left: -5px;\n}\n.ant-popover-placement-topLeft > .ant-popover-content > .ant-popover-arrow {\n  left: 16px;\n}\n.ant-popover-placement-topRight > .ant-popover-content > .ant-popover-arrow {\n  right: 16px;\n}\n.ant-popover-placement-right > .ant-popover-content > .ant-popover-arrow,\n.ant-popover-placement-rightTop > .ant-popover-content > .ant-popover-arrow,\n.ant-popover-placement-rightBottom > .ant-popover-content > .ant-popover-arrow {\n  left: 3px;\n  border-left-width: 0;\n  border-right-color: rgba(217, 217, 217, 0.7);\n}\n.ant-popover-placement-right > .ant-popover-content > .ant-popover-arrow:after,\n.ant-popover-placement-rightTop > .ant-popover-content > .ant-popover-arrow:after,\n.ant-popover-placement-rightBottom > .ant-popover-content > .ant-popover-arrow:after {\n  content: \" \";\n  left: 1px;\n  bottom: -4px;\n  border-left-width: 0;\n  border-right-color: #fff;\n}\n.ant-popover-placement-right > .ant-popover-content > .ant-popover-arrow {\n  top: 50%;\n  margin-top: -5px;\n}\n.ant-popover-placement-rightTop > .ant-popover-content > .ant-popover-arrow {\n  top: 12px;\n}\n.ant-popover-placement-rightBottom > .ant-popover-content > .ant-popover-arrow {\n  bottom: 12px;\n}\n.ant-popover-placement-bottom > .ant-popover-content > .ant-popover-arrow,\n.ant-popover-placement-bottomLeft > .ant-popover-content > .ant-popover-arrow,\n.ant-popover-placement-bottomRight > .ant-popover-content > .ant-popover-arrow {\n  border-top-width: 0;\n  border-bottom-color: rgba(217, 217, 217, 0.7);\n  top: 3px;\n}\n.ant-popover-placement-bottom > .ant-popover-content > .ant-popover-arrow:after,\n.ant-popover-placement-bottomLeft > .ant-popover-content > .ant-popover-arrow:after,\n.ant-popover-placement-bottomRight > .ant-popover-content > .ant-popover-arrow:after {\n  content: \" \";\n  top: 1px;\n  margin-left: -4px;\n  border-top-width: 0;\n  border-bottom-color: #fff;\n}\n.ant-popover-placement-bottom > .ant-popover-content > .ant-popover-arrow {\n  left: 50%;\n  margin-left: -5px;\n}\n.ant-popover-placement-bottomLeft > .ant-popover-content > .ant-popover-arrow {\n  left: 16px;\n}\n.ant-popover-placement-bottomRight > .ant-popover-content > .ant-popover-arrow {\n  right: 16px;\n}\n.ant-popover-placement-left > .ant-popover-content > .ant-popover-arrow,\n.ant-popover-placement-leftTop > .ant-popover-content > .ant-popover-arrow,\n.ant-popover-placement-leftBottom > .ant-popover-content > .ant-popover-arrow {\n  right: 3px;\n  border-right-width: 0;\n  border-left-color: rgba(217, 217, 217, 0.7);\n}\n.ant-popover-placement-left > .ant-popover-content > .ant-popover-arrow:after,\n.ant-popover-placement-leftTop > .ant-popover-content > .ant-popover-arrow:after,\n.ant-popover-placement-leftBottom > .ant-popover-content > .ant-popover-arrow:after {\n  content: \" \";\n  right: 1px;\n  border-right-width: 0;\n  border-left-color: #fff;\n  bottom: -4px;\n}\n.ant-popover-placement-left > .ant-popover-content > .ant-popover-arrow {\n  top: 50%;\n  margin-top: -5px;\n}\n.ant-popover-placement-leftTop > .ant-popover-content > .ant-popover-arrow {\n  top: 12px;\n}\n.ant-popover-placement-leftBottom > .ant-popover-content > .ant-popover-arrow {\n  bottom: 12px;\n}\n",
                    "/* stylelint-disable at-rule-empty-line-before,at-rule-name-space-after,at-rule-no-unknown */\n/* stylelint-disable declaration-bang-space-before */\n/* stylelint-disable declaration-bang-space-before */\n.ant-popover {\n  position: absolute;\n  top: 0;\n  left: 0;\n  z-index: 1030;\n  cursor: auto;\n  user-select: text;\n  white-space: normal;\n  font-size: 12px;\n  line-height: 1.5;\n  font-weight: normal;\n  text-align: left;\n}\n.ant-popover:after {\n  content: \"\";\n  position: absolute;\n  background: rgba(255, 255, 255, 0.01);\n}\n.ant-popover-hidden {\n  display: none;\n}\n.ant-popover-placement-top,\n.ant-popover-placement-topLeft,\n.ant-popover-placement-topRight {\n  padding-bottom: 8px;\n}\n.ant-popover-placement-right,\n.ant-popover-placement-rightTop,\n.ant-popover-placement-rightBottom {\n  padding-left: 8px;\n}\n.ant-popover-placement-bottom,\n.ant-popover-placement-bottomLeft,\n.ant-popover-placement-bottomRight {\n  padding-top: 8px;\n}\n.ant-popover-placement-left,\n.ant-popover-placement-leftTop,\n.ant-popover-placement-leftBottom {\n  padding-right: 8px;\n}\n.ant-popover-inner {\n  background-color: #fff;\n  background-clip: padding-box;\n  border-radius: 4px;\n  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);\n}\n.ant-popover-title {\n  min-width: 177px;\n  margin: 0;\n  padding: 0 16px;\n  line-height: 32px;\n  height: 32px;\n  border-bottom: 1px solid #e9e9e9;\n  color: rgba(0, 0, 0, 0.65);\n  font-weight: 500;\n}\n.ant-popover-inner-content {\n  padding: 8px 16px;\n  color: rgba(0, 0, 0, 0.65);\n}\n.ant-popover-message {\n  padding: 8px 0 16px;\n  font-size: 12px;\n  color: rgba(0, 0, 0, 0.65);\n}\n.ant-popover-message > .anticon {\n  color: #ffbf00;\n  line-height: 17px;\n  position: absolute;\n}\n.ant-popover-message-title {\n  padding-left: 20px;\n}\n.ant-popover-buttons {\n  text-align: right;\n  margin-bottom: 8px;\n}\n.ant-popover-buttons button {\n  margin-left: 8px;\n}\n.ant-popover-arrow,\n.ant-popover-arrow:after {\n  position: absolute;\n  display: block;\n  width: 0;\n  height: 0;\n  border-color: transparent;\n  border-style: solid;\n}\n.ant-popover-arrow {\n  border-width: 5px;\n}\n.ant-popover-arrow:after {\n  border-width: 4px;\n  content: \"\";\n}\n.ant-popover-placement-top > .ant-popover-content > .ant-popover-arrow,\n.ant-popover-placement-topLeft > .ant-popover-content > .ant-popover-arrow,\n.ant-popover-placement-topRight > .ant-popover-content > .ant-popover-arrow {\n  border-bottom-width: 0;\n  border-top-color: rgba(217, 217, 217, 0.7);\n  bottom: 3px;\n}\n.ant-popover-placement-top > .ant-popover-content > .ant-popover-arrow:after,\n.ant-popover-placement-topLeft > .ant-popover-content > .ant-popover-arrow:after,\n.ant-popover-placement-topRight > .ant-popover-content > .ant-popover-arrow:after {\n  content: \" \";\n  bottom: 1px;\n  margin-left: -4px;\n  border-bottom-width: 0;\n  border-top-color: #fff;\n}\n.ant-popover-placement-top > .ant-popover-content > .ant-popover-arrow {\n  left: 50%;\n  margin-left: -5px;\n}\n.ant-popover-placement-topLeft > .ant-popover-content > .ant-popover-arrow {\n  left: 16px;\n}\n.ant-popover-placement-topRight > .ant-popover-content > .ant-popover-arrow {\n  right: 16px;\n}\n.ant-popover-placement-right > .ant-popover-content > .ant-popover-arrow,\n.ant-popover-placement-rightTop > .ant-popover-content > .ant-popover-arrow,\n.ant-popover-placement-rightBottom > .ant-popover-content > .ant-popover-arrow {\n  left: 3px;\n  border-left-width: 0;\n  border-right-color: rgba(217, 217, 217, 0.7);\n}\n.ant-popover-placement-right > .ant-popover-content > .ant-popover-arrow:after,\n.ant-popover-placement-rightTop > .ant-popover-content > .ant-popover-arrow:after,\n.ant-popover-placement-rightBottom > .ant-popover-content > .ant-popover-arrow:after {\n  content: \" \";\n  left: 1px;\n  bottom: -4px;\n  border-left-width: 0;\n  border-right-color: #fff;\n}\n.ant-popover-placement-right > .ant-popover-content > .ant-popover-arrow {\n  top: 50%;\n  margin-top: -5px;\n}\n.ant-popover-placement-rightTop > .ant-popover-content > .ant-popover-arrow {\n  top: 12px;\n}\n.ant-popover-placement-rightBottom > .ant-popover-content > .ant-popover-arrow {\n  bottom: 12px;\n}\n.ant-popover-placement-bottom > .ant-popover-content > .ant-popover-arrow,\n.ant-popover-placement-bottomLeft > .ant-popover-content > .ant-popover-arrow,\n.ant-popover-placement-bottomRight > .ant-popover-content > .ant-popover-arrow {\n  border-top-width: 0;\n  border-bottom-color: rgba(217, 217, 217, 0.7);\n  top: 3px;\n}\n.ant-popover-placement-bottom > .ant-popover-content > .ant-popover-arrow:after,\n.ant-popover-placement-bottomLeft > .ant-popover-content > .ant-popover-arrow:after,\n.ant-popover-placement-bottomRight > .ant-popover-content > .ant-popover-arrow:after {\n  content: \" \";\n  top: 1px;\n  margin-left: -4px;\n  border-top-width: 0;\n  border-bottom-color: #fff;\n}\n.ant-popover-placement-bottom > .ant-popover-content > .ant-popover-arrow {\n  left: 50%;\n  margin-left: -5px;\n}\n.ant-popover-placement-bottomLeft > .ant-popover-content > .ant-popover-arrow {\n  left: 16px;\n}\n.ant-popover-placement-bottomRight > .ant-popover-content > .ant-popover-arrow {\n  right: 16px;\n}\n.ant-popover-placement-left > .ant-popover-content > .ant-popover-arrow,\n.ant-popover-placement-leftTop > .ant-popover-content > .ant-popover-arrow,\n.ant-popover-placement-leftBottom > .ant-popover-content > .ant-popover-arrow {\n  right: 3px;\n  border-right-width: 0;\n  border-left-color: rgba(217, 217, 217, 0.7);\n}\n.ant-popover-placement-left > .ant-popover-content > .ant-popover-arrow:after,\n.ant-popover-placement-leftTop > .ant-popover-content > .ant-popover-arrow:after,\n.ant-popover-placement-leftBottom > .ant-popover-content > .ant-popover-arrow:after {\n  content: \" \";\n  right: 1px;\n  border-right-width: 0;\n  border-left-color: #fff;\n  bottom: -4px;\n}\n.ant-popover-placement-left > .ant-popover-content > .ant-popover-arrow {\n  top: 50%;\n  margin-top: -5px;\n}\n.ant-popover-placement-leftTop > .ant-popover-content > .ant-popover-arrow {\n  top: 12px;\n}\n.ant-popover-placement-leftBottom > .ant-popover-content > .ant-popover-arrow {\n  bottom: 12px;\n}\n.ant-popover {\n  position: relative;\n  margin: 1px;\n}\n"
                ]
            },] },
];
/** @nocollapse */
NzPopconfirmComponent.ctorParameters = function () { return []; };
NzPopconfirmComponent.propDecorators = {
    'nzContent': [{ type: Input },],
    'nzOkText': [{ type: Input },],
    'nzCancelText': [{ type: Input },],
    'nzCondition': [{ type: Input },],
    'nzOnCancel': [{ type: Output },],
    'nzOnConfirm': [{ type: Output },],
    'nzOrigin': [{ type: ContentChild, args: [NzPopconfirmDirective,] },],
};
