UNPKG

ng-zorro-antd

Version:

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

251 lines (244 loc) 11.4 kB
import { __extends, __decorate, __metadata } from 'tslib'; import { distinctUntilChanged } from 'rxjs/operators'; import { OverlayModule } from '@angular/cdk/overlay'; import { CommonModule } from '@angular/common'; import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Host, Input, Optional, Output, ViewEncapsulation, ComponentFactoryResolver, Directive, ElementRef, Renderer2, ViewContainerRef, NgModule } from '@angular/core'; import { NzButtonModule } from 'ng-zorro-antd/button'; import { zoomBigMotion, InputBoolean, NzNoAnimationDirective, NzAddOnModule, NzNoAnimationModule, NzOverlayModule } from 'ng-zorro-antd/core'; import { NzI18nModule } from 'ng-zorro-antd/i18n'; import { NzIconModule } from 'ng-zorro-antd/icon'; import { NzToolTipComponent, NzTooltipDirective, NzToolTipModule } from 'ng-zorro-antd/tooltip'; /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var NzPopconfirmComponent = /** @class */ (function (_super) { __extends(NzPopconfirmComponent, _super); function NzPopconfirmComponent(cdr, noAnimation) { var _this = _super.call(this, cdr, noAnimation) || this; _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 _this; } /** * @return {?} */ NzPopconfirmComponent.prototype.show = /** * @return {?} */ function () { if (!this.nzCondition) { this.nzVisible = true; } else { this.onConfirm(); } }; /** * @return {?} */ NzPopconfirmComponent.prototype.onCancel = /** * @return {?} */ function () { this.nzOnCancel.emit(); this.nzVisible = false; }; /** * @return {?} */ NzPopconfirmComponent.prototype.onConfirm = /** * @return {?} */ function () { this.nzOnConfirm.emit(); this.nzVisible = false; }; 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]=\"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: ["\n .ant-popover {\n position: relative;\n }\n "] }] } ]; /** @nocollapse */ NzPopconfirmComponent.ctorParameters = function () { return [ { 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); return NzPopconfirmComponent; }(NzToolTipComponent)); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var NzPopconfirmDirective = /** @class */ (function (_super) { __extends(NzPopconfirmDirective, _super); function NzPopconfirmDirective(elementRef, hostView, resolver, renderer, tooltip, noAnimation) { var _this = _super.call(this, elementRef, hostView, resolver, renderer, tooltip, noAnimation) || this; _this.noAnimation = noAnimation; _this.factory = _this.resolver.resolveComponentFactory(NzPopconfirmComponent); _this.needProxyProperties = [ 'nzTitle', 'nzContent', 'nzOverlayClassName', 'nzOverlayStyle', 'nzMouseEnterDelay', 'nzMouseLeaveDelay', 'nzVisible', 'nzTrigger', 'nzPlacement', 'nzOkText', 'nzOkType', 'nzCancelText', 'nzCondition', 'nzIcon' ]; _this.nzOnCancel = new EventEmitter(); _this.nzOnConfirm = new EventEmitter(); return _this; } /** * @return {?} */ NzPopconfirmDirective.prototype.ngOnInit = /** * @return {?} */ function () { var _this = this; if (!this.tooltip) { /** @type {?} */ var tooltipComponent = this.hostView.createComponent(this.factory); this.tooltip = tooltipComponent.instance; this.tooltip.noAnimation = this.noAnimation; // Remove element when use directive https://github.com/NG-ZORRO/ng-zorro-antd/issues/1967 this.renderer.removeChild(this.renderer.parentNode(this.elementRef.nativeElement), tooltipComponent.location.nativeElement); this.isDynamicTooltip = true; this.needProxyProperties.forEach((/** * @param {?} property * @return {?} */ function (property) { return _this.updateCompValue(property, _this[property]); })); /** @type {?} */ var visible_ = this.tooltip.nzVisibleChange.pipe(distinctUntilChanged()).subscribe((/** * @param {?} data * @return {?} */ function (data) { _this.visible = data; _this.nzVisibleChange.emit(data); })); /** @type {?} */ var cancel_ = ((/** @type {?} */ (this.tooltip))).nzOnCancel.subscribe((/** * @return {?} */ function () { _this.nzOnCancel.emit(); })); /** @type {?} */ var confirm_ = ((/** @type {?} */ (this.tooltip))).nzOnConfirm.subscribe((/** * @return {?} */ function () { _this.nzOnConfirm.emit(); })); this.subs_.add(visible_); this.subs_.add(cancel_); this.subs_.add(confirm_); } this.tooltip.setOverlayOrigin(this); }; NzPopconfirmDirective.decorators = [ { type: Directive, args: [{ selector: '[nz-popconfirm]', exportAs: 'nzPopconfirm', host: { '[class.ant-popover-open]': 'isTooltipOpen' } },] } ]; /** @nocollapse */ NzPopconfirmDirective.ctorParameters = function () { return [ { type: ElementRef }, { type: ViewContainerRef }, { type: ComponentFactoryResolver }, { type: Renderer2 }, { type: NzPopconfirmComponent, decorators: [{ type: Optional }] }, { type: NzNoAnimationDirective, decorators: [{ type: Host }, { type: Optional }] } ]; }; NzPopconfirmDirective.propDecorators = { nzOkText: [{ type: Input }], nzOkType: [{ type: Input }], nzCancelText: [{ type: Input }], nzIcon: [{ type: Input }], nzCondition: [{ type: Input }], nzOnCancel: [{ type: Output }], nzOnConfirm: [{ type: Output }] }; __decorate([ InputBoolean(), __metadata("design:type", Boolean) ], NzPopconfirmDirective.prototype, "nzCondition", void 0); return NzPopconfirmDirective; }(NzTooltipDirective)); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var NzPopconfirmModule = /** @class */ (function () { function NzPopconfirmModule() { } NzPopconfirmModule.decorators = [ { type: NgModule, args: [{ declarations: [NzPopconfirmComponent, NzPopconfirmDirective], exports: [NzPopconfirmComponent, NzPopconfirmDirective], imports: [ CommonModule, NzButtonModule, OverlayModule, NzI18nModule, NzIconModule, NzAddOnModule, NzOverlayModule, NzNoAnimationModule, NzToolTipModule ], entryComponents: [NzPopconfirmComponent] },] } ]; return NzPopconfirmModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ export { NzPopconfirmComponent, NzPopconfirmDirective, NzPopconfirmModule }; //# sourceMappingURL=ng-zorro-antd-popconfirm.js.map