@ethlete/cdk 3.22.1 → 3.22.3

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.
@@ -5,7 +5,7 @@ import * as i0 from '@angular/core';
5
5
  import { Component, ViewEncapsulation, ChangeDetectionStrategy, Directive, InjectionToken, booleanAttribute, Input, ContentChild, ContentChildren, inject, ElementRef, Injector, HostBinding, computed, signal, Optional, Inject, Injectable, SkipSelf, HostListener, ViewContainerRef, EventEmitter, NgZone, isDevMode, Output, NgModule, ChangeDetectorRef, ViewChild, assertInInjectionContext, runInInjectionContext, TemplateRef, forwardRef, LOCALE_ID, numberAttribute, ViewChildren, Pipe, Renderer2, Attribute } from '@angular/core';
6
6
  import * as i1$2 from '@ethlete/core';
7
7
  import { LetDirective, createDestroy, ScrollObserverFirstElementDirective, ScrollObserverLastElementDirective, Memo, signalHostAttributes, signalHostClasses, AnimatedIfDirective, AnimatedLifecycleDirective, SmartBlockScrollStrategy, RouterStateService, ANIMATED_LIFECYCLE_TOKEN, nextFrame, RootBoundaryDirective, elementCanScroll, equal, ViewportService, ROOT_BOUNDARY_TOKEN, AnimatedOverlayDirective, ClickObserverService, FocusVisibleService, cloneFormGroup, getFormGroupValue, ObserveVisibilityDirective, signalVisibilityChangeClasses, IS_EMAIL, MUST_MATCH, IS_ARRAY_NOT_EMPTY, AT_LEAST_ONE_REQUIRED, switchQueryListChanges, signalAttributes, ResizeObserverService, createFlipAnimation, RuntimeError, SelectionModel, ActiveSelectionModel, KeyPressManager, signalClasses, scrollToElement, isEmptyArray, isObjectArray, isPrimitiveArray, ClickOutsideDirective, ObserveContentDirective, clamp, DELAYABLE_TOKEN, ObserveResizeDirective, inferMimeType, getElementVisibleStates, IS_ACTIVE_ELEMENT, IS_ELEMENT, CursorDragScrollDirective, ObserveScrollStateDirective, IsElementDirective, IsActiveElementDirective, ScrollObserverIgnoreTargetDirective, TypedQueryList } from '@ethlete/core';
8
- import { BehaviorSubject, startWith, map, switchMap, combineLatest, pairwise, tap, takeUntil, skip, of, Subject, filter, take, merge, skipUntil, defer, fromEvent, partition, debounceTime as debounceTime$1, Observable, from, distinctUntilChanged as distinctUntilChanged$1, withLatestFrom, skipWhile, catchError, throwError, timer, Subscription } from 'rxjs';
8
+ import { BehaviorSubject, startWith, map, switchMap, combineLatest, pairwise, tap, takeUntil, skip, of, Subject, filter, take, merge, skipUntil, defer, fromEvent, partition, debounceTime as debounceTime$1, Observable, from, finalize, distinctUntilChanged as distinctUntilChanged$1, withLatestFrom, skipWhile, catchError, throwError, timer, Subscription } from 'rxjs';
9
9
  import { trigger, state, style, transition, animate } from '@angular/animations';
10
10
  import { __decorate, __metadata } from 'tslib';
11
11
  import { toSignal, takeUntilDestroyed } from '@angular/core/rxjs-interop';
@@ -1985,14 +1985,14 @@ class BottomSheetDragHandleComponent {
1985
1985
  }
1986
1986
  }
1987
1987
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.5", ngImport: i0, type: BottomSheetDragHandleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1988
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.5", type: BottomSheetDragHandleComponent, isStandalone: true, selector: "[et-bottom-sheet-drag-handle], [etBottomSheetDragHandle]", inputs: { ariaLabel: ["aria-label", "ariaLabel"], type: "type", bottomSheetResult: ["et-bottom-sheet-drag-handle", "bottomSheetResult"], _etBottomSheetDragHandle: ["etBottomSheetDragHandle", "_etBottomSheetDragHandle"] }, host: { listeners: { "click": "_onButtonClick($event)" }, properties: { "attr.aria-label": "ariaLabel || null", "attr.type": "this.type" }, classAttribute: "et-bottom-sheet-drag-handle" }, providers: [BottomSheetSwipeHandlerService], exportAs: ["etBottomSheetDragHandle"], usesOnChanges: true, ngImport: i0, template: '', isInline: true, styles: [":where(.et-bottom-sheet-drag-handle){--background-color: red}.et-bottom-sheet-drag-handle{--_tap-target-width: 100px;--_tap-target-height: 25px;inset-inline-start:calc(50% - var(--_tap-target-width) / 2);inline-size:var(--_tap-target-width);block-size:var(--_tap-target-height);border:none;position:relative;background-color:#0000;touch-action:manipulation;-webkit-appearance:none;appearance:none}.et-bottom-sheet-drag-handle:before{--_toggle-width: 32px;--_toggle-height: 4px;inline-size:var(--_toggle-width);block-size:var(--_toggle-height);content:\"\";position:absolute;background-color:var(--background-color);border-radius:9999px;inset-inline-start:calc(50% - var(--_toggle-width) / 2);inset-block-start:calc(50% - var(--_toggle-height) / 2);z-index:1}.et-bottom-sheet-drag-handle:after{opacity:0;inline-size:100%;block-size:100%;content:\"\";position:absolute;background-color:#0003;border-radius:8px;inset-block-start:0;inset-inline-start:0;transform:scale(0);transition:opacity .3s var(--ease-5),transform .3s var(--ease-5)}.et-bottom-sheet-drag-handle:focus-visible{outline:none}.et-bottom-sheet-drag-handle:focus-visible:after{opacity:1;transform:scale(1);transition:opacity .3s var(--ease-5),transform .3s var(--ease-squish-3)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
1988
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.5", type: BottomSheetDragHandleComponent, isStandalone: true, selector: "[et-bottom-sheet-drag-handle], [etBottomSheetDragHandle]", inputs: { ariaLabel: ["aria-label", "ariaLabel"], type: "type", bottomSheetResult: ["et-bottom-sheet-drag-handle", "bottomSheetResult"], _etBottomSheetDragHandle: ["etBottomSheetDragHandle", "_etBottomSheetDragHandle"] }, host: { listeners: { "click": "_onButtonClick($event)" }, properties: { "attr.aria-label": "ariaLabel || null", "attr.type": "this.type" }, classAttribute: "et-bottom-sheet-drag-handle" }, providers: [BottomSheetSwipeHandlerService], exportAs: ["etBottomSheetDragHandle"], usesOnChanges: true, ngImport: i0, template: '', isInline: true, styles: [":where(.et-bottom-sheet-drag-handle){--background-color: red}.et-bottom-sheet-drag-handle{--_tap-target-width: 100px;--_tap-target-height: 25px;inset-inline-start:calc(50% - var(--_tap-target-width) / 2);inline-size:var(--_tap-target-width);block-size:var(--_tap-target-height);border:none;position:relative;background-color:#0000;touch-action:manipulation;appearance:none}.et-bottom-sheet-drag-handle:before{--_toggle-width: 32px;--_toggle-height: 4px;inline-size:var(--_toggle-width);block-size:var(--_toggle-height);content:\"\";position:absolute;background-color:var(--background-color);border-radius:9999px;inset-inline-start:calc(50% - var(--_toggle-width) / 2);inset-block-start:calc(50% - var(--_toggle-height) / 2);z-index:1}.et-bottom-sheet-drag-handle:after{opacity:0;inline-size:100%;block-size:100%;content:\"\";position:absolute;background-color:#0003;border-radius:8px;inset-block-start:0;inset-inline-start:0;transform:scale(0);transition:opacity .3s var(--ease-5),transform .3s var(--ease-5)}.et-bottom-sheet-drag-handle:focus-visible{outline:none}.et-bottom-sheet-drag-handle:focus-visible:after{opacity:1;transform:scale(1);transition:opacity .3s var(--ease-5),transform .3s var(--ease-squish-3)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
1989
1989
  }
1990
1990
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.5", ngImport: i0, type: BottomSheetDragHandleComponent, decorators: [{
1991
1991
  type: Component,
1992
1992
  args: [{ selector: '[et-bottom-sheet-drag-handle], [etBottomSheetDragHandle]', template: '', exportAs: 'etBottomSheetDragHandle', host: {
1993
1993
  class: 'et-bottom-sheet-drag-handle',
1994
1994
  '[attr.aria-label]': 'ariaLabel || null',
1995
- }, standalone: true, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [BottomSheetSwipeHandlerService], styles: [":where(.et-bottom-sheet-drag-handle){--background-color: red}.et-bottom-sheet-drag-handle{--_tap-target-width: 100px;--_tap-target-height: 25px;inset-inline-start:calc(50% - var(--_tap-target-width) / 2);inline-size:var(--_tap-target-width);block-size:var(--_tap-target-height);border:none;position:relative;background-color:#0000;touch-action:manipulation;-webkit-appearance:none;appearance:none}.et-bottom-sheet-drag-handle:before{--_toggle-width: 32px;--_toggle-height: 4px;inline-size:var(--_toggle-width);block-size:var(--_toggle-height);content:\"\";position:absolute;background-color:var(--background-color);border-radius:9999px;inset-inline-start:calc(50% - var(--_toggle-width) / 2);inset-block-start:calc(50% - var(--_toggle-height) / 2);z-index:1}.et-bottom-sheet-drag-handle:after{opacity:0;inline-size:100%;block-size:100%;content:\"\";position:absolute;background-color:#0003;border-radius:8px;inset-block-start:0;inset-inline-start:0;transform:scale(0);transition:opacity .3s var(--ease-5),transform .3s var(--ease-5)}.et-bottom-sheet-drag-handle:focus-visible{outline:none}.et-bottom-sheet-drag-handle:focus-visible:after{opacity:1;transform:scale(1);transition:opacity .3s var(--ease-5),transform .3s var(--ease-squish-3)}\n"] }]
1995
+ }, standalone: true, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [BottomSheetSwipeHandlerService], styles: [":where(.et-bottom-sheet-drag-handle){--background-color: red}.et-bottom-sheet-drag-handle{--_tap-target-width: 100px;--_tap-target-height: 25px;inset-inline-start:calc(50% - var(--_tap-target-width) / 2);inline-size:var(--_tap-target-width);block-size:var(--_tap-target-height);border:none;position:relative;background-color:#0000;touch-action:manipulation;appearance:none}.et-bottom-sheet-drag-handle:before{--_toggle-width: 32px;--_toggle-height: 4px;inline-size:var(--_toggle-width);block-size:var(--_toggle-height);content:\"\";position:absolute;background-color:var(--background-color);border-radius:9999px;inset-inline-start:calc(50% - var(--_toggle-width) / 2);inset-block-start:calc(50% - var(--_toggle-height) / 2);z-index:1}.et-bottom-sheet-drag-handle:after{opacity:0;inline-size:100%;block-size:100%;content:\"\";position:absolute;background-color:#0003;border-radius:8px;inset-block-start:0;inset-inline-start:0;transform:scale(0);transition:opacity .3s var(--ease-5),transform .3s var(--ease-5)}.et-bottom-sheet-drag-handle:focus-visible{outline:none}.et-bottom-sheet-drag-handle:focus-visible:after{opacity:1;transform:scale(1);transition:opacity .3s var(--ease-5),transform .3s var(--ease-squish-3)}\n"] }]
1996
1996
  }], propDecorators: { ariaLabel: [{
1997
1997
  type: Input,
1998
1998
  args: ['aria-label']
@@ -2556,6 +2556,10 @@ const provideDialog = () => {
2556
2556
  };
2557
2557
 
2558
2558
  /* eslint-disable @angular-eslint/directive-class-suffix */
2559
+ /* eslint-disable @angular-eslint/no-output-rename */
2560
+ /* eslint-disable @angular-eslint/no-outputs-metadata-property */
2561
+ /* eslint-disable @angular-eslint/no-input-rename */
2562
+ /* eslint-disable @angular-eslint/no-inputs-metadata-property */
2559
2563
  const MENU_STACK = new InjectionToken('cdk-menu-stack');
2560
2564
  const PARENT_OR_NEW_MENU_STACK_PROVIDER = {
2561
2565
  provide: MENU_STACK,
@@ -2721,6 +2725,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.5", ngImpor
2721
2725
  }] });
2722
2726
 
2723
2727
  /* eslint-disable @angular-eslint/directive-class-suffix */
2728
+ /* eslint-disable @angular-eslint/no-output-rename */
2729
+ /* eslint-disable @angular-eslint/no-outputs-metadata-property */
2730
+ /* eslint-disable @angular-eslint/no-input-rename */
2731
+ /* eslint-disable @angular-eslint/no-inputs-metadata-property */
2724
2732
  const CONTEXT_MENU_POSITIONS = STANDARD_DROPDOWN_BELOW_POSITIONS.map((position) => {
2725
2733
  const offsetX = position.overlayX === 'start' ? 2 : -2;
2726
2734
  const offsetY = position.overlayY === 'top' ? 2 : -2;
@@ -2877,6 +2885,10 @@ function throwMissingMenuReference() {
2877
2885
  }
2878
2886
 
2879
2887
  /* eslint-disable @angular-eslint/directive-class-suffix */
2888
+ /* eslint-disable @angular-eslint/no-output-rename */
2889
+ /* eslint-disable @angular-eslint/no-outputs-metadata-property */
2890
+ /* eslint-disable @angular-eslint/no-input-rename */
2891
+ /* eslint-disable @angular-eslint/no-inputs-metadata-property */
2880
2892
  const MENU_AIM = new InjectionToken('cdk-menu-aim');
2881
2893
  const MOUSE_MOVE_SAMPLE_FREQUENCY = 3;
2882
2894
  const NUM_POINTS = 5;
@@ -3008,6 +3020,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.5", ngImpor
3008
3020
  }] });
3009
3021
 
3010
3022
  /* eslint-disable @angular-eslint/directive-class-suffix */
3023
+ /* eslint-disable @angular-eslint/no-output-rename */
3024
+ /* eslint-disable @angular-eslint/no-outputs-metadata-property */
3025
+ /* eslint-disable @angular-eslint/no-input-rename */
3026
+ /* eslint-disable @angular-eslint/no-inputs-metadata-property */
3011
3027
  class CdkMenuGroup {
3012
3028
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.5", ngImport: i0, type: CdkMenuGroup, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
3013
3029
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.5", type: CdkMenuGroup, isStandalone: true, selector: "[cdkMenuGroup]", host: { attributes: { "role": "group" }, classAttribute: "cdk-menu-group" }, providers: [{ provide: UniqueSelectionDispatcher, useClass: UniqueSelectionDispatcher }], exportAs: ["cdkMenuGroup"], ngImport: i0 }); }
@@ -3029,6 +3045,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.5", ngImpor
3029
3045
  const CDK_MENU = new InjectionToken('cdk-menu');
3030
3046
 
3031
3047
  /* eslint-disable @angular-eslint/directive-class-suffix */
3048
+ /* eslint-disable @angular-eslint/no-output-rename */
3049
+ /* eslint-disable @angular-eslint/no-outputs-metadata-property */
3050
+ /* eslint-disable @angular-eslint/no-input-rename */
3051
+ /* eslint-disable @angular-eslint/no-inputs-metadata-property */
3032
3052
  class CdkMenuTrigger extends CdkMenuTriggerBase {
3033
3053
  constructor() {
3034
3054
  super();
@@ -3252,6 +3272,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.5", ngImpor
3252
3272
  }], ctorParameters: function () { return []; } });
3253
3273
 
3254
3274
  /* eslint-disable @angular-eslint/directive-class-suffix */
3275
+ /* eslint-disable @angular-eslint/no-output-rename */
3276
+ /* eslint-disable @angular-eslint/no-outputs-metadata-property */
3277
+ /* eslint-disable @angular-eslint/no-input-rename */
3278
+ /* eslint-disable @angular-eslint/no-inputs-metadata-property */
3255
3279
  class CdkMenuItem {
3256
3280
  get disabled() {
3257
3281
  return this._disabled;
@@ -3470,6 +3494,10 @@ class PointerFocusTracker {
3470
3494
  }
3471
3495
 
3472
3496
  /* eslint-disable @angular-eslint/directive-class-suffix */
3497
+ /* eslint-disable @angular-eslint/no-output-rename */
3498
+ /* eslint-disable @angular-eslint/no-outputs-metadata-property */
3499
+ /* eslint-disable @angular-eslint/no-input-rename */
3500
+ /* eslint-disable @angular-eslint/no-inputs-metadata-property */
3473
3501
  let nextId$2 = 0;
3474
3502
  class CdkMenuBase extends CdkMenuGroup {
3475
3503
  constructor() {
@@ -3609,6 +3637,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.5", ngImpor
3609
3637
  }] } });
3610
3638
 
3611
3639
  /* eslint-disable @angular-eslint/directive-class-suffix */
3640
+ /* eslint-disable @angular-eslint/no-output-rename */
3641
+ /* eslint-disable @angular-eslint/no-outputs-metadata-property */
3642
+ /* eslint-disable @angular-eslint/no-input-rename */
3643
+ /* eslint-disable @angular-eslint/no-inputs-metadata-property */
3612
3644
  class CdkMenu extends CdkMenuBase {
3613
3645
  constructor() {
3614
3646
  super();
@@ -3712,6 +3744,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.5", ngImpor
3712
3744
  }] } });
3713
3745
 
3714
3746
  /* eslint-disable @angular-eslint/directive-class-suffix */
3747
+ /* eslint-disable @angular-eslint/no-output-rename */
3748
+ /* eslint-disable @angular-eslint/no-outputs-metadata-property */
3749
+ /* eslint-disable @angular-eslint/no-input-rename */
3750
+ /* eslint-disable @angular-eslint/no-inputs-metadata-property */
3715
3751
  class CdkMenuBar extends CdkMenuBase {
3716
3752
  constructor() {
3717
3753
  super(...arguments);
@@ -3841,6 +3877,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.5", ngImpor
3841
3877
  }] } });
3842
3878
 
3843
3879
  /* eslint-disable @angular-eslint/directive-class-suffix */
3880
+ /* eslint-disable @angular-eslint/no-output-rename */
3881
+ /* eslint-disable @angular-eslint/no-outputs-metadata-property */
3882
+ /* eslint-disable @angular-eslint/no-input-rename */
3883
+ /* eslint-disable @angular-eslint/no-inputs-metadata-property */
3844
3884
  class CdkMenuItemCheckbox extends CdkMenuItemSelectable {
3845
3885
  trigger(options) {
3846
3886
  super.trigger(options);
@@ -3872,6 +3912,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.5", ngImpor
3872
3912
  }] });
3873
3913
 
3874
3914
  /* eslint-disable @angular-eslint/directive-class-suffix */
3915
+ /* eslint-disable @angular-eslint/no-output-rename */
3916
+ /* eslint-disable @angular-eslint/no-outputs-metadata-property */
3917
+ /* eslint-disable @angular-eslint/no-input-rename */
3918
+ /* eslint-disable @angular-eslint/no-inputs-metadata-property */
3875
3919
  let nextId$1 = 0;
3876
3920
  class CdkMenuItemRadio extends CdkMenuItemSelectable {
3877
3921
  constructor() {
@@ -4455,8 +4499,17 @@ class OverlayRef {
4455
4499
  this._beforeClosed = new Subject();
4456
4500
  this._closeCalled = new Subject();
4457
4501
  this._state = OVERLAY_STATE.OPEN;
4502
+ /**
4503
+ * @internal
4504
+ */
4458
4505
  this._isEscCloseControlledExternally = false;
4506
+ /**
4507
+ * @internal
4508
+ */
4459
4509
  this._isBackdropCloseControlledExternally = false;
4510
+ /**
4511
+ * @internal
4512
+ */
4460
4513
  this._isCloseFnCloseControlledExternally = false;
4461
4514
  this._disableCloseFromInternalInitiators = new Set();
4462
4515
  this.disableClose = config.disableClose;
@@ -4494,7 +4547,7 @@ class OverlayRef {
4494
4547
  if (this._state === OVERLAY_STATE.CLOSING || this._state === OVERLAY_STATE.CLOSED) {
4495
4548
  return;
4496
4549
  }
4497
- this._closeCalled.next(result);
4550
+ this._closeCalled.next({ result, forced: force ?? false });
4498
4551
  if (this._isCloseFnCloseControlledExternally && !force) {
4499
4552
  return;
4500
4553
  }
@@ -4513,13 +4566,13 @@ class OverlayRef {
4513
4566
  this._containerInstance._animatedLifecycle.leave();
4514
4567
  }
4515
4568
  afterOpened() {
4516
- return this._afterOpened;
4569
+ return this._afterOpened.asObservable();
4517
4570
  }
4518
4571
  afterClosed() {
4519
4572
  return this._ref.closed;
4520
4573
  }
4521
4574
  beforeClosed() {
4522
- return this._beforeClosed;
4575
+ return this._beforeClosed.asObservable();
4523
4576
  }
4524
4577
  backdropClick() {
4525
4578
  return this._ref.backdropClick;
@@ -4528,7 +4581,7 @@ class OverlayRef {
4528
4581
  return this._ref.keydownEvents;
4529
4582
  }
4530
4583
  closeCalled() {
4531
- return this._closeCalled;
4584
+ return this._closeCalled.asObservable();
4532
4585
  }
4533
4586
  updatePosition(position) {
4534
4587
  const strategy = this._ref.config.positionStrategy;
@@ -5565,40 +5618,58 @@ const createOverlayDismissChecker = (config) => {
5565
5618
  }
5566
5619
  }
5567
5620
  if (checkCloseCall) {
5568
- eventStreams.push(overlayRef.closeCalled());
5621
+ eventStreams.push(overlayRef.closeCalled().pipe(filter((e) => !e.forced), map((e) => e.result)));
5569
5622
  }
5570
5623
  const sub = merge(...eventStreams)
5571
- .pipe(takeUntil(destroy$), filter(() => {
5572
- const isNotEqual = !equal(form.getRawValue(), defaultValue);
5573
- const hasNoOtherInternalOverlays = !overlayRef._internalDisableClose;
5574
- const wasKeyboard = overlayRef._closeInteractionType === 'keyboard';
5575
- const wasMouse = overlayRef._closeInteractionType === 'mouse';
5576
- if ((wasKeyboard && !checkEscapeKey) || (wasMouse && !checkBackdropClick)) {
5577
- return false;
5578
- }
5579
- return isNotEqual && hasNoOtherInternalOverlays;
5580
- }), switchMap((result) => {
5581
- const checkResponse = dismissCheckFn(form.getRawValue());
5582
- let nextObservable;
5583
- if (checkResponse instanceof Observable) {
5584
- nextObservable = checkResponse;
5585
- }
5586
- else if (checkResponse instanceof Promise) {
5587
- nextObservable = from(checkResponse);
5624
+ .pipe(switchMap((eventOrResult) => {
5625
+ const isDefaultFormValue = equal(form.getRawValue(), defaultValue);
5626
+ if (isDefaultFormValue) {
5627
+ return of(eventOrResult).pipe(tap(() => {
5628
+ sub.unsubscribe();
5629
+ if (eventOrResult === 'keyboard' || eventOrResult === 'mouse') {
5630
+ overlayRef._closeOverlayVia(eventOrResult, undefined, true);
5631
+ }
5632
+ else {
5633
+ overlayRef.close(eventOrResult, true);
5634
+ }
5635
+ }));
5588
5636
  }
5589
5637
  else {
5590
- nextObservable = of(checkResponse);
5638
+ return of(eventOrResult).pipe(filter(() => {
5639
+ const wasKeyboard = overlayRef._closeInteractionType === 'keyboard';
5640
+ const wasMouse = overlayRef._closeInteractionType === 'mouse';
5641
+ if ((wasKeyboard && !checkEscapeKey) || (wasMouse && !checkBackdropClick)) {
5642
+ return false;
5643
+ }
5644
+ return !overlayRef._internalDisableClose;
5645
+ }), switchMap(() => {
5646
+ const checkResponse = dismissCheckFn(form.getRawValue());
5647
+ let nextObservable;
5648
+ if (checkResponse instanceof Observable) {
5649
+ nextObservable = checkResponse;
5650
+ }
5651
+ else if (checkResponse instanceof Promise) {
5652
+ nextObservable = from(checkResponse);
5653
+ }
5654
+ else {
5655
+ nextObservable = of(checkResponse);
5656
+ }
5657
+ return nextObservable.pipe(filter((checkFnResult) => !!checkFnResult), tap(() => {
5658
+ sub.unsubscribe();
5659
+ if (eventOrResult === 'keyboard' || eventOrResult === 'mouse') {
5660
+ overlayRef._closeOverlayVia(eventOrResult, undefined, true);
5661
+ }
5662
+ else {
5663
+ overlayRef.close(eventOrResult, true);
5664
+ }
5665
+ }));
5666
+ }));
5591
5667
  }
5592
- return nextObservable.pipe(filter((response) => !!response), tap((response) => {
5593
- sub.unsubscribe();
5594
- if (response === 'keyboard' || response === 'mouse') {
5595
- overlayRef._closeOverlayVia(response, undefined, true);
5596
- }
5597
- else {
5598
- overlayRef.close(result, true);
5599
- }
5600
- }), take(1));
5601
- }), takeUntil(destroy$), take(1))
5668
+ }), takeUntil(destroy$), finalize(() => {
5669
+ overlayRef._isBackdropCloseControlledExternally = false;
5670
+ overlayRef._isEscCloseControlledExternally = false;
5671
+ overlayRef._isCloseFnCloseControlledExternally = false;
5672
+ }))
5602
5673
  .subscribe();
5603
5674
  return sub;
5604
5675
  };