ng-ytl-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
106 lines (97 loc) • 3.36 kB
text/typescript
import {
ChangeDetectorRef,
Component,
EventEmitter,
Input,
Output,
ViewEncapsulation,
} from '@angular/core';
import { fadeAnimation } from '../core/animation/fade-animations';
import { NzLocaleService } from '../locale/index';
import { NzToolTipComponent } from '../tooltip/nz-tooltip.component';
import { toBoolean } from '../util/convert';
export class NzPopconfirmComponent extends NzToolTipComponent {
private _condition = false;
_prefix = 'ant-popover-placement';
_trigger = 'click';
_hasBackdrop = true;
nzContent;
nzOkText = this._locale.translate('Modal.okText');
nzCancelText = this._locale.translate('Modal.cancelText');
set nzCondition(value: boolean) {
this._condition = toBoolean(value);
}
get nzCondition(): boolean {
return this._condition;
}
nzOnCancel: EventEmitter<void> = new EventEmitter();
nzOnConfirm: EventEmitter<void> = new EventEmitter();
constructor(cdr: ChangeDetectorRef, private _locale: NzLocaleService) {
super(cdr);
}
show(): void {
if (!this._condition) {
this.nzVisible = true;
} else {
this.onConfirm();
}
}
onCancel(): void {
this.nzOnCancel.emit();
this.nzVisible = false;
}
onConfirm(): void {
this.nzOnConfirm.emit();
this.nzVisible = false;
}
}