ng-zorro-antd-yj
Version:
An enterprise-class UI components based on Ant Design and Angular
110 lines • 10.2 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
import * as tslib_1 from "tslib";
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Host, Input, Optional, Output, ViewEncapsulation } from '@angular/core';
import { zoomBigMotion } from '../core/animation/zoom';
import { NzNoAnimationDirective } from '../core/no-animation/nz-no-animation.directive';
import { InputBoolean } from '../core/util/convert';
import { NzToolTipComponent } from '../tooltip/nz-tooltip.component';
export class NzPopconfirmComponent extends NzToolTipComponent {
/**
* @param {?} cdr
* @param {?=} noAnimation
*/
constructor(cdr, noAnimation) {
super(cdr, noAnimation);
this.noAnimation = noAnimation;
this._prefix = 'ant-popover-placement';
this._trigger = 'click';
this._hasBackdrop = true;
this.nzOkType = 'primary';
this.nzCondition = false;
this.nzOnCancel = new EventEmitter();
this.nzOnConfirm = new EventEmitter();
}
/**
* @return {?}
*/
show() {
if (!this.nzCondition) {
this.nzVisible = true;
}
else {
this.onConfirm();
}
}
/**
* @return {?}
*/
onCancel() {
this.nzOnCancel.emit();
this.nzVisible = false;
}
/**
* @return {?}
*/
onConfirm() {
this.nzOnConfirm.emit();
this.nzVisible = false;
}
}
NzPopconfirmComponent.decorators = [
{ type: Component, args: [{
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
selector: 'nz-popconfirm',
preserveWhitespaces: false,
animations: [zoomBigMotion],
template: "<ng-content></ng-content>\n<ng-template\n #overlay=\"cdkConnectedOverlay\"\n cdkConnectedOverlay\n nzConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"overlayOrigin\"\n [cdkConnectedOverlayHasBackdrop]=\"_hasBackdrop\"\n (backdropClick)=\"hide()\"\n (detach)=\"hide()\"\n (positionChange)=\"onPositionChange($event)\"\n [cdkConnectedOverlayPositions]=\"_positions\"\n [cdkConnectedOverlayOpen]=\"visible$ | async\">\n <div class=\"ant-popover\"\n [ngClass]=\"_classMap\"\n [ngStyle]=\"nzOverlayStyle\"\n [nzNoAnimation]=\"noAnimation?.nzNoAnimation\"\n [@zoomBigMotion]=\"'active'\"\n (@zoomBigMotion.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\">\n <ng-container *nzStringTemplateOutlet=\"nzTitle\">\n <ng-container *nzStringTemplateOutlet=\"nzIcon\">\n <i nz-icon [nzType]=\"nzIcon || 'exclamation-circle'\" nzTheme=\"fill\"></i>\n </ng-container>\n <div class=\"ant-popover-message-title\">{{ nzTitle }}</div>\n </ng-container>\n </div>\n <div class=\"ant-popover-buttons\">\n <button nz-button [nzSize]=\"'small'\" (click)=\"onCancel()\">\n <ng-container *ngIf=\"nzCancelText\">{{ nzCancelText }}</ng-container>\n <ng-container *ngIf=\"!nzCancelText\">{{ 'Modal.cancelText' | nzI18n }}</ng-container>\n </button>\n <button nz-button [nzSize]=\"'small'\" [nzType]=\"nzOkType\" (click)=\"onConfirm()\">\n <ng-container *ngIf=\"nzOkText\">{{ nzOkText }}</ng-container>\n <ng-container *ngIf=\"!nzOkText\">{{ 'Modal.okText' | nzI18n }}</ng-container>\n </button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</ng-template>",
styles: [`
.ant-popover {
position: relative;
}
`]
}] }
];
/** @nocollapse */
NzPopconfirmComponent.ctorParameters = () => [
{ type: ChangeDetectorRef },
{ type: NzNoAnimationDirective, decorators: [{ type: Host }, { type: Optional }] }
];
NzPopconfirmComponent.propDecorators = {
nzOkText: [{ type: Input }],
nzOkType: [{ type: Input }],
nzCancelText: [{ type: Input }],
nzCondition: [{ type: Input }],
nzIcon: [{ type: Input }],
nzOnCancel: [{ type: Output }],
nzOnConfirm: [{ type: Output }]
};
tslib_1.__decorate([
InputBoolean(),
tslib_1.__metadata("design:type", Object)
], NzPopconfirmComponent.prototype, "nzCondition", void 0);
if (false) {
/** @type {?} */
NzPopconfirmComponent.prototype._prefix;
/** @type {?} */
NzPopconfirmComponent.prototype._trigger;
/** @type {?} */
NzPopconfirmComponent.prototype._hasBackdrop;
/** @type {?} */
NzPopconfirmComponent.prototype.nzOkText;
/** @type {?} */
NzPopconfirmComponent.prototype.nzOkType;
/** @type {?} */
NzPopconfirmComponent.prototype.nzCancelText;
/** @type {?} */
NzPopconfirmComponent.prototype.nzCondition;
/** @type {?} */
NzPopconfirmComponent.prototype.nzIcon;
/** @type {?} */
NzPopconfirmComponent.prototype.nzOnCancel;
/** @type {?} */
NzPopconfirmComponent.prototype.nzOnConfirm;
/** @type {?} */
NzPopconfirmComponent.prototype.noAnimation;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnotcG9wY29uZmlybS5jb21wb25lbnQuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9uZy16b3Jyby1hbnRkLXlqLyIsInNvdXJjZXMiOlsicG9wY29uZmlybS9uei1wb3Bjb25maXJtLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLE9BQU8sRUFDTCx1QkFBdUIsRUFDdkIsaUJBQWlCLEVBQ2pCLFNBQVMsRUFDVCxZQUFZLEVBQ1osSUFBSSxFQUNKLEtBQUssRUFDTCxRQUFRLEVBQ1IsTUFBTSxFQUVOLGlCQUFpQixFQUNsQixNQUFNLGVBQWUsQ0FBQztBQUN2QixPQUFPLEVBQUUsYUFBYSxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFDdkQsT0FBTyxFQUFFLHNCQUFzQixFQUFFLE1BQU0sZ0RBQWdELENBQUM7QUFDeEYsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQ3BELE9BQU8sRUFBRSxrQkF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