UNPKG

ng-zorro-antd

Version:

An enterprise-class UI components based on Ant Design and Angular

294 lines (287 loc) 12 kB
import { __decorate, __metadata } from 'tslib'; import { EventEmitter, Component, ChangeDetectionStrategy, ViewEncapsulation, ChangeDetectorRef, Host, Optional, Input, Output, Directive, ElementRef, ViewContainerRef, ComponentFactoryResolver, Renderer2, NgModule } from '@angular/core'; import { zoomBigMotion, NzNoAnimationDirective, InputBoolean, NzAddOnModule, NzOverlayModule, NzNoAnimationModule } from 'ng-zorro-antd/core'; import { NzToolTipComponent, NzTooltipBaseComponentLegacy, NzTooltipBaseDirective, NzToolTipModule } from 'ng-zorro-antd/tooltip'; import { takeUntil } from 'rxjs/operators'; import { OverlayModule } from '@angular/cdk/overlay'; import { CommonModule } from '@angular/common'; import { NzButtonModule } from 'ng-zorro-antd/button'; import { NzI18nModule } from 'ng-zorro-antd/i18n'; import { NzIconModule } from 'ng-zorro-antd/icon'; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class NzPopconfirmComponent extends NzToolTipComponent { /** * @param {?} cdr * @param {?=} noAnimation */ constructor(cdr, noAnimation) { super(cdr, noAnimation); this.noAnimation = noAnimation; this.nzOkType = 'primary'; this.nzCondition = false; this.nzOnCancel = new EventEmitter(); this.nzOnConfirm = new EventEmitter(); this._prefix = 'ant-popover-placement'; this._trigger = 'click'; this._hasBackdrop = true; } /** * @return {?} */ show() { if (!this.nzCondition) { super.show(); } else { this.onConfirm(); } } /** * @return {?} */ onCancel() { this.nzOnCancel.emit(); super.hide(); } /** * @return {?} */ onConfirm() { this.nzOnConfirm.emit(); super.hide(); } } NzPopconfirmComponent.decorators = [ { type: Component, args: [{ changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, selector: 'nz-popconfirm', exportAs: 'nzPopconfirmComponent', preserveWhitespaces: false, animations: [zoomBigMotion], template: "<ng-content></ng-content>\n<ng-template\n #overlay=\"cdkConnectedOverlay\"\n cdkConnectedOverlay\n nzConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"origin\"\n [cdkConnectedOverlayHasBackdrop]=\"_hasBackdrop\"\n (backdropClick)=\"hide()\"\n (detach)=\"hide()\"\n (positionChange)=\"onPositionChange($event)\"\n [cdkConnectedOverlayPositions]=\"_positions\"\n [cdkConnectedOverlayOpen]=\"_visible\">\n <div class=\"ant-popover\"\n [ngClass]=\"_classMap\"\n [ngStyle]=\"nzOverlayStyle\"\n [@.disabled]=\"noAnimation?.nzNoAnimation\"\n [nzNoAnimation]=\"noAnimation?.nzNoAnimation\"\n [@zoomBigMotion]=\"'active'\">\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=\"title\">\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\">{{ title }}</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>", providers: [ { provide: NzTooltipBaseComponentLegacy, useExisting: NzPopconfirmComponent } ], 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 }] }; __decorate([ InputBoolean(), __metadata("design:type", Object) ], NzPopconfirmComponent.prototype, "nzCondition", void 0); if (false) { /** @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._prefix; /** @type {?} */ NzPopconfirmComponent.prototype._trigger; /** @type {?} */ NzPopconfirmComponent.prototype._hasBackdrop; /** @type {?} */ NzPopconfirmComponent.prototype.noAnimation; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class NzPopconfirmDirective extends NzTooltipBaseDirective { /** * @param {?} elementRef * @param {?} hostView * @param {?} resolver * @param {?} renderer * @param {?} tooltip * @param {?=} noAnimation */ constructor(elementRef, hostView, resolver, renderer, tooltip, noAnimation) { super(elementRef, hostView, resolver, renderer, tooltip, noAnimation); this.noAnimation = noAnimation; /** * @deprecated 9.0.0. This is deprecated and going to be removed in 9.0.0. * Please use a more specific API. Like `nzTooltipTrigger`. */ this.nzTrigger = 'click'; this.nzOnCancel = new EventEmitter(); this.nzOnConfirm = new EventEmitter(); this.componentFactory = this.resolver.resolveComponentFactory(NzPopconfirmComponent); this.needProxyProperties = [ 'nzOverlayClassName', 'nzOverlayStyle', 'nzMouseEnterDelay', 'nzMouseLeaveDelay', 'nzVisible', 'nzOkText', 'nzOkType', 'nzCancelText', 'nzCondition', 'nzIcon' ]; } /** * @override * @protected * @return {?} */ createDynamicTooltipComponent() { super.createDynamicTooltipComponent(); ((/** @type {?} */ (this.tooltip))).nzOnCancel.pipe(takeUntil(this.$destroy)).subscribe((/** * @return {?} */ () => { this.nzOnCancel.emit(); })); ((/** @type {?} */ (this.tooltip))).nzOnConfirm.pipe(takeUntil(this.$destroy)).subscribe((/** * @return {?} */ () => { this.nzOnConfirm.emit(); })); } } NzPopconfirmDirective.decorators = [ { type: Directive, args: [{ selector: '[nz-popconfirm]', exportAs: 'nzPopconfirm', host: { '[class.ant-popover-open]': 'isTooltipComponentVisible' } },] } ]; /** @nocollapse */ NzPopconfirmDirective.ctorParameters = () => [ { type: ElementRef }, { type: ViewContainerRef }, { type: ComponentFactoryResolver }, { type: Renderer2 }, { type: NzPopconfirmComponent, decorators: [{ type: Optional }] }, { type: NzNoAnimationDirective, decorators: [{ type: Host }, { type: Optional }] } ]; NzPopconfirmDirective.propDecorators = { specificTitle: [{ type: Input, args: ['nzPopconfirmTitle',] }], directiveNameTitle: [{ type: Input, args: ['nz-popconfirm',] }], specificTrigger: [{ type: Input, args: ['nzPopconfirmTrigger',] }], specificPlacement: [{ type: Input, args: ['nzPopconfirmPlacement',] }], nzOkText: [{ type: Input }], nzOkType: [{ type: Input }], nzCancelText: [{ type: Input }], nzIcon: [{ type: Input }], nzCondition: [{ type: Input }], nzTrigger: [{ type: Input }], nzOnCancel: [{ type: Output }], nzOnConfirm: [{ type: Output }] }; __decorate([ InputBoolean(), __metadata("design:type", Boolean) ], NzPopconfirmDirective.prototype, "nzCondition", void 0); if (false) { /** @type {?} */ NzPopconfirmDirective.prototype.specificTitle; /** @type {?} */ NzPopconfirmDirective.prototype.directiveNameTitle; /** @type {?} */ NzPopconfirmDirective.prototype.specificTrigger; /** @type {?} */ NzPopconfirmDirective.prototype.specificPlacement; /** @type {?} */ NzPopconfirmDirective.prototype.nzOkText; /** @type {?} */ NzPopconfirmDirective.prototype.nzOkType; /** @type {?} */ NzPopconfirmDirective.prototype.nzCancelText; /** @type {?} */ NzPopconfirmDirective.prototype.nzIcon; /** @type {?} */ NzPopconfirmDirective.prototype.nzCondition; /** * @deprecated 9.0.0. This is deprecated and going to be removed in 9.0.0. * Please use a more specific API. Like `nzTooltipTrigger`. * @type {?} */ NzPopconfirmDirective.prototype.nzTrigger; /** @type {?} */ NzPopconfirmDirective.prototype.nzOnCancel; /** @type {?} */ NzPopconfirmDirective.prototype.nzOnConfirm; /** @type {?} */ NzPopconfirmDirective.prototype.componentFactory; /** * @type {?} * @protected */ NzPopconfirmDirective.prototype.needProxyProperties; /** @type {?} */ NzPopconfirmDirective.prototype.noAnimation; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class NzPopconfirmModule { } NzPopconfirmModule.decorators = [ { type: NgModule, args: [{ declarations: [NzPopconfirmComponent, NzPopconfirmDirective], exports: [NzPopconfirmComponent, NzPopconfirmDirective], imports: [ CommonModule, NzButtonModule, OverlayModule, NzI18nModule, NzIconModule, NzAddOnModule, NzOverlayModule, NzNoAnimationModule, NzToolTipModule ], entryComponents: [NzPopconfirmComponent] },] } ]; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ export { NzPopconfirmComponent, NzPopconfirmDirective, NzPopconfirmModule }; //# sourceMappingURL=ng-zorro-antd-popconfirm.js.map