@firestitch/form 13.3.3 → 13.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/directives/form/form.directive.d.ts +1 -0
- package/esm2020/app/directives/form/form.directive.mjs +20 -13
- package/fesm2015/firestitch-form.mjs +20 -12
- package/fesm2015/firestitch-form.mjs.map +1 -1
- package/fesm2020/firestitch-form.mjs +19 -12
- package/fesm2020/firestitch-form.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -483,21 +483,26 @@ class FsFormDirective {
|
|
|
483
483
|
}
|
|
484
484
|
});
|
|
485
485
|
}
|
|
486
|
+
_activeDialog(el, dialog) {
|
|
487
|
+
if (el.isSameNode(dialog)) {
|
|
488
|
+
return true;
|
|
489
|
+
}
|
|
490
|
+
else if (el.parentElement) {
|
|
491
|
+
return this._activeDialog(el.parentElement, dialog);
|
|
492
|
+
}
|
|
493
|
+
return false;
|
|
494
|
+
}
|
|
486
495
|
_listenHotKeys() {
|
|
487
496
|
this._ngZone.runOutsideAngular(() => {
|
|
488
497
|
fromEvent(document, 'keydown')
|
|
489
498
|
.pipe(takeUntil(this._destroy$))
|
|
490
499
|
.subscribe((event) => {
|
|
491
500
|
if (this._dialogBackdropEscape && event.code === 'Escape') {
|
|
492
|
-
const
|
|
493
|
-
|
|
494
|
-
if (
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
this._ngZone.run(() => {
|
|
498
|
-
this._formClose();
|
|
499
|
-
});
|
|
500
|
-
}
|
|
501
|
+
const activeDialog = this
|
|
502
|
+
._activeDialog(document.activeElement, document.getElementById(this._dialogRef.id));
|
|
503
|
+
if (activeDialog) {
|
|
504
|
+
this._ngZone.run(() => {
|
|
505
|
+
this._formClose();
|
|
501
506
|
});
|
|
502
507
|
}
|
|
503
508
|
}
|
|
@@ -599,6 +604,9 @@ class FsFormDirective {
|
|
|
599
604
|
this.ngForm.form.valueChanges
|
|
600
605
|
.pipe(takeUntil(this._destroy$))
|
|
601
606
|
.subscribe((changes) => {
|
|
607
|
+
if (this._dialogBackdropEscape && this._dialogRef) {
|
|
608
|
+
this._dialogRef.disableClose = true;
|
|
609
|
+
}
|
|
602
610
|
if (this.confirm) {
|
|
603
611
|
const existing = Object.keys(this._snapshot);
|
|
604
612
|
Object.keys(changes)
|
|
@@ -703,9 +711,8 @@ class FsFormDirective {
|
|
|
703
711
|
});
|
|
704
712
|
}
|
|
705
713
|
_registerConfirmDialogBackdropEscape() {
|
|
706
|
-
this._dialogBackdropEscape =
|
|
707
|
-
if (this.
|
|
708
|
-
this._dialogRef.disableClose = true;
|
|
714
|
+
this._dialogBackdropEscape = !this._dialogRef?.disableClose;
|
|
715
|
+
if (this._dialogBackdropEscape) {
|
|
709
716
|
this._dialogRef.backdropClick()
|
|
710
717
|
.pipe(takeUntil(this._destroy$))
|
|
711
718
|
.subscribe(() => {
|