Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.

Commit 5753771

Browse files
feat(dialog): add backdropDismiss option to fiv dialog (defaults to true)
1 parent d3229aa commit 5753771

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

projects/core/src/lib/dialog/dialog.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<fiv-overlay #overlay>
22
<div *ngIf="backdrop" (@fade.done)="backdropAnimDone($event)"
3-
[@fade]="{value: dialogState, params: { opacity: 0, inDuration: '120ms' }}" (click)="close()" class="backdrop">
3+
[@fade]="{value: dialogState, params: { opacity: 0, inDuration: '120ms' }}" (click)="backdropClick()" class="backdrop">
44
</div>
55
<div #dialog class="dialog" [ngClass]="[verticalAlign, horizontalAlign, shape]">
66
<ng-container>

projects/core/src/lib/dialog/dialog.component.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export class FivDialog implements OnInit {
6262
@Input() shape: 'fill' | 'card' = 'card';
6363

6464
@Input() backdrop = true;
65+
@Input() backdropDismiss = true;
6566
@Input() duration: number;
6667
// animation data
6768
@Input() inDuration = 160;
@@ -101,6 +102,12 @@ export class FivDialog implements OnInit {
101102
this.bar.stopProgressAnimation();
102103
}
103104

105+
backdropClick() {
106+
if (this.backdropDismiss) {
107+
this.close();
108+
}
109+
}
110+
104111
animationDone(event) {
105112

106113
if (event.fromState !== 'void' && event.toState === 'out') {

0 commit comments

Comments
 (0)