ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
340 lines (334 loc) • 11.8 kB
JavaScript
import { __decorate, __metadata } from 'tslib';
import { EventEmitter, Directive, ElementRef, ViewContainerRef, ComponentFactoryResolver, Renderer2, Host, Optional, Input, Output, Component, ChangeDetectionStrategy, ViewEncapsulation, ChangeDetectorRef, NgModule } from '@angular/core';
import { zoomBigMotion } from 'ng-zorro-antd/core/animation';
import { NzNoAnimationDirective, NzNoAnimationModule } from 'ng-zorro-antd/core/no-animation';
import { InputBoolean } from 'ng-zorro-antd/core/util';
import { NzTooltipBaseDirective, NzToolTipComponent, NzToolTipModule } from 'ng-zorro-antd/tooltip';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { OverlayModule } from '@angular/cdk/overlay';
import { CommonModule } from '@angular/common';
import { NzButtonModule } from 'ng-zorro-antd/button';
import { NzOutletModule } from 'ng-zorro-antd/core/outlet';
import { NzOverlayModule } from 'ng-zorro-antd/core/overlay';
import { NzI18nModule } from 'ng-zorro-antd/i18n';
import { NzIconModule } from 'ng-zorro-antd/icon';
/**
* @fileoverview added by tsickle
* Generated from: popconfirm.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class NzPopconfirmDirective extends NzTooltipBaseDirective {
/**
* @param {?} elementRef
* @param {?} hostView
* @param {?} resolver
* @param {?} renderer
* @param {?=} noAnimation
*/
constructor(elementRef, hostView, resolver, renderer, noAnimation) {
super(elementRef, hostView, resolver, renderer, noAnimation);
this.nzCondition = false;
/**
* @deprecated 10.0.0. This is deprecated and going to be removed in 10.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 {?}
*/
createComponent() {
super.createComponent();
((/** @type {?} */ (this.component))).nzOnCancel.pipe(takeUntil(this.destroy$)).subscribe((/**
* @return {?}
*/
() => {
this.nzOnCancel.emit();
}));
((/** @type {?} */ (this.component))).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]': 'visible'
}
},] }
];
/** @nocollapse */
NzPopconfirmDirective.ctorParameters = () => [
{ type: ElementRef },
{ type: ViewContainerRef },
{ type: ComponentFactoryResolver },
{ type: Renderer2 },
{ 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',] }],
specificOrigin: [{ type: Input, args: ['nzPopconfirmOrigin',] }],
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.ngAcceptInputType_nzCondition;
/** @type {?} */
NzPopconfirmDirective.prototype.specificTitle;
/** @type {?} */
NzPopconfirmDirective.prototype.directiveNameTitle;
/** @type {?} */
NzPopconfirmDirective.prototype.specificTrigger;
/** @type {?} */
NzPopconfirmDirective.prototype.specificPlacement;
/** @type {?} */
NzPopconfirmDirective.prototype.specificOrigin;
/** @type {?} */
NzPopconfirmDirective.prototype.nzOkText;
/** @type {?} */
NzPopconfirmDirective.prototype.nzOkType;
/** @type {?} */
NzPopconfirmDirective.prototype.nzCancelText;
/** @type {?} */
NzPopconfirmDirective.prototype.nzIcon;
/** @type {?} */
NzPopconfirmDirective.prototype.nzCondition;
/**
* @deprecated 10.0.0. This is deprecated and going to be removed in 10.0.0.
* Please use a more specific API. Like `nzTooltipTrigger`.
* @type {?}
*/
NzPopconfirmDirective.prototype.nzTrigger;
/** @type {?} */
NzPopconfirmDirective.prototype.nzOnCancel;
/** @type {?} */
NzPopconfirmDirective.prototype.nzOnConfirm;
/**
* @type {?}
* @protected
*/
NzPopconfirmDirective.prototype.componentFactory;
/**
* @type {?}
* @protected
*/
NzPopconfirmDirective.prototype.needProxyProperties;
}
class NzPopconfirmComponent extends NzToolTipComponent {
/**
* @param {?} cdr
* @param {?=} noAnimation
*/
constructor(cdr, noAnimation) {
super(cdr, noAnimation);
this.noAnimation = noAnimation;
this.nzCondition = false;
this.nzOkType = 'primary';
this.nzOnCancel = new Subject();
this.nzOnConfirm = new Subject();
this._trigger = 'click';
this._prefix = 'ant-popover-placement';
this._hasBackdrop = true;
}
/**
* @return {?}
*/
ngOnDestroy() {
super.ngOnDestroy();
this.nzOnCancel.complete();
this.nzOnConfirm.complete();
}
/**
* @override
* @return {?}
*/
show() {
if (!this.nzCondition) {
super.show();
}
else {
this.onConfirm();
}
}
/**
* @return {?}
*/
onCancel() {
this.nzOnCancel.next();
super.hide();
}
/**
* @return {?}
*/
onConfirm() {
this.nzOnConfirm.next();
super.hide();
}
}
NzPopconfirmComponent.decorators = [
{ type: Component, args: [{
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
selector: 'nz-popconfirm',
exportAs: 'nzPopconfirmComponent',
preserveWhitespaces: false,
animations: [zoomBigMotion],
template: `
<ng-template
#overlay="cdkConnectedOverlay"
cdkConnectedOverlay
nzConnectedOverlay
[cdkConnectedOverlayOrigin]="origin"
[cdkConnectedOverlayHasBackdrop]="_hasBackdrop"
(backdropClick)="hide()"
(detach)="hide()"
(positionChange)="onPositionChange($event)"
[cdkConnectedOverlayPositions]="_positions"
[cdkConnectedOverlayOpen]="_visible"
>
<div
class="ant-popover"
[ngClass]="_classMap"
[ngStyle]="nzOverlayStyle"
[@.disabled]="noAnimation?.nzNoAnimation"
[nzNoAnimation]="noAnimation?.nzNoAnimation"
[]="'active'"
>
<div class="ant-popover-content">
<div class="ant-popover-arrow"></div>
<div class="ant-popover-inner">
<div>
<div class="ant-popover-inner-content">
<div class="ant-popover-message">
<ng-container *nzStringTemplateOutlet="nzTitle">
<ng-container *nzStringTemplateOutlet="nzIcon; let icon">
<i nz-icon [nzType]="icon || 'exclamation-circle'" nzTheme="fill"></i>
</ng-container>
<div class="ant-popover-message-title">{{ nzTitle }}</div>
</ng-container>
</div>
<div class="ant-popover-buttons">
<button nz-button [nzSize]="'small'" (click)="onCancel()">
<ng-container *ngIf="nzCancelText">{{ nzCancelText }}</ng-container>
<ng-container *ngIf="!nzCancelText">{{ 'Modal.cancelText' | nzI18n }}</ng-container>
</button>
<button nz-button [nzSize]="'small'" [nzType]="nzOkType" (click)="onConfirm()">
<ng-container *ngIf="nzOkText">{{ nzOkText }}</ng-container>
<ng-container *ngIf="!nzOkText">{{ 'Modal.okText' | nzI18n }}</ng-container>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</ng-template>
`
}] }
];
/** @nocollapse */
NzPopconfirmComponent.ctorParameters = () => [
{ type: ChangeDetectorRef },
{ type: NzNoAnimationDirective, decorators: [{ type: Host }, { type: Optional }] }
];
if (false) {
/** @type {?} */
NzPopconfirmComponent.prototype.nzCancelText;
/** @type {?} */
NzPopconfirmComponent.prototype.nzCondition;
/** @type {?} */
NzPopconfirmComponent.prototype.nzIcon;
/** @type {?} */
NzPopconfirmComponent.prototype.nzOkText;
/** @type {?} */
NzPopconfirmComponent.prototype.nzOkType;
/** @type {?} */
NzPopconfirmComponent.prototype.nzOnCancel;
/** @type {?} */
NzPopconfirmComponent.prototype.nzOnConfirm;
/**
* @type {?}
* @protected
*/
NzPopconfirmComponent.prototype._trigger;
/** @type {?} */
NzPopconfirmComponent.prototype._prefix;
/** @type {?} */
NzPopconfirmComponent.prototype._hasBackdrop;
/** @type {?} */
NzPopconfirmComponent.prototype.noAnimation;
}
/**
* @fileoverview added by tsickle
* Generated from: popconfirm.module.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class NzPopconfirmModule {
}
NzPopconfirmModule.decorators = [
{ type: NgModule, args: [{
declarations: [NzPopconfirmComponent, NzPopconfirmDirective],
exports: [NzPopconfirmComponent, NzPopconfirmDirective],
entryComponents: [NzPopconfirmComponent],
imports: [
CommonModule,
NzButtonModule,
OverlayModule,
NzI18nModule,
NzIconModule,
NzOutletModule,
NzOverlayModule,
NzNoAnimationModule,
NzToolTipModule
]
},] }
];
/**
* @fileoverview added by tsickle
* Generated from: public-api.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* Generated from: ng-zorro-antd-popconfirm.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
export { NzPopconfirmComponent, NzPopconfirmDirective, NzPopconfirmModule };
//# sourceMappingURL=ng-zorro-antd-popconfirm.js.map