Skip to content

Commit

Permalink
Merge pull request #17713 from majkers/feature/issue17512
Browse files Browse the repository at this point in the history
Fixes issue #17512
  • Loading branch information
cetincakiroglu authored Feb 24, 2025
2 parents f78a6a0 + 742aa5d commit df199ef
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions packages/primeng/src/confirmdialog/confirmdialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ const hideAnimation = animation([animate('{{transition}}', style({ transform: '{
template: `
<p-dialog
#dialog
[(visible)]="visible"
[visible]="visible"
(visibleChange)="onVisibleChange($event)"
role="alertdialog"
[closable]="option('closable')"
[styleClass]="containerClass"
Expand Down Expand Up @@ -556,13 +557,12 @@ export class ConfirmDialog extends BaseComponent implements OnInit, OnDestroy {
}
}

close(event: Event) {
close() {
if (this.confirmation?.rejectEvent) {
this.confirmation.rejectEvent.emit(ConfirmEventType.CANCEL);
}

this.hide(ConfirmEventType.CANCEL);
event.preventDefault();
}

hide(type?: ConfirmEventType) {
Expand All @@ -589,6 +589,14 @@ export class ConfirmDialog extends BaseComponent implements OnInit, OnDestroy {
super.ngOnDestroy();
}

onVisibleChange(value: boolean) {
if (!value) {
this.close();
} else {
this.visible = value;
}
}

onAccept() {
if (this.confirmation && this.confirmation.acceptEvent) {
this.confirmation.acceptEvent.emit();
Expand Down

0 comments on commit df199ef

Please sign in to comment.