@ethlete/cdk 5.0.0-next.45 → 5.0.0-next.47

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @ethlete/cdk
2
2
 
3
+ ## 5.0.0-next.47
4
+
5
+ ### Patch Changes
6
+
7
+ - The combobox no longer clears the text you typed when its first options arrive, so that text is still used as the filter.
8
+ - The `migrate-from-cdk` generator now knows the tab group classes of `@ethlete/components`.
9
+
10
+ ## 5.0.0-next.46
11
+
12
+ ### Patch Changes
13
+
14
+ - Overlay: while the overlay enters, a backdrop click closes it; the second click of a double-click does not, so a double-click on the trigger no longer opens and closes it at once.
15
+
3
16
  ## 5.0.0-next.45
4
17
 
5
18
  ### Patch Changes
@@ -4,7 +4,7 @@ import * as i1$5 from "@angular/cdk/portal";
4
4
  import { CdkPortal, CdkPortalOutlet, ComponentPortal, PortalModule, TemplatePortal } from "@angular/cdk/portal";
5
5
  import { DomSanitizer, Title } from "@angular/platform-browser";
6
6
  import { outputFromObservable, outputToObservable, takeUntilDestroyed, toObservable, toSignal } from "@angular/core/rxjs-interop";
7
- import { BehaviorSubject, EMPTY, Observable, ReplaySubject, Subject, Subscription, asapScheduler, catchError, combineLatest, concatMap, debounceTime, distinctUntilChanged, filter, finalize, from, fromEvent, map, merge, observeOn, of, pairwise, shareReplay, skip, skipUntil, skipWhile, startWith, switchMap, take, takeUntil, takeWhile, tap, throwError, timer, withLatestFrom } from "rxjs";
7
+ import { BehaviorSubject, EMPTY, Observable, ReplaySubject, Subject, Subscription, asapScheduler, catchError, combineLatest, concatMap, debounceTime, distinctUntilChanged, filter, finalize, from, fromEvent, map, merge, observeOn, of, pairwise, shareReplay, skip, skipWhile, startWith, switchMap, take, takeUntil, takeWhile, tap, throwError, timer, withLatestFrom } from "rxjs";
8
8
  import { __decorate, __metadata } from "tslib";
9
9
  import { AsyncPipe, DOCUMENT as DOCUMENT$1, Location, NgClass, NgComponentOutlet, NgStyle, NgTemplateOutlet } from "@angular/common";
10
10
  import * as i1$4 from "@ethlete/core";
@@ -7074,7 +7074,8 @@ var OverlayRef = class {
7074
7074
  }
7075
7075
  setupCloseHandlers() {
7076
7076
  const lifecycleState$ = this._containerInstance.animatedLifecycle.state$;
7077
- merge(this.backdropClick().pipe(skipUntil(lifecycleState$.pipe(filter((e) => e === "entering"), switchMap(() => fromNextFrame())))), this.keydownEvents().pipe(filter((event) => event.keyCode === ESCAPE && !this.disableClose && !hasModifierKey(event)), concatMap((event) => this._containerInstance.animatedLifecycle.state() === "init" ? lifecycleState$.pipe(filter((state) => state !== "init"), take(1), observeOn(asapScheduler), map(() => event)) : of(event)))).pipe(takeUntil(this.afterClosed())).subscribe((event) => {
7077
+ const afterEnterStarted = (event) => this._containerInstance.animatedLifecycle.state() === "init" ? lifecycleState$.pipe(filter((state) => state !== "init"), take(1), observeOn(asapScheduler), map(() => event)) : of(event);
7078
+ merge(this.backdropClick().pipe(filter((event) => !this.isDoubleClickWhileEntering(event))), this.keydownEvents().pipe(filter((event) => event.keyCode === ESCAPE && !this.disableClose && !hasModifierKey(event)))).pipe(concatMap(afterEnterStarted), takeUntil(this.afterClosed())).subscribe((event) => {
7078
7079
  const isEscapeKey = event.type === "keydown";
7079
7080
  const isBackdropClick = !isEscapeKey;
7080
7081
  if (this._isEscCloseControlledExternally && isEscapeKey || this._isBackdropCloseControlledExternally && isBackdropClick) return;
@@ -7084,6 +7085,10 @@ var OverlayRef = class {
7084
7085
  }
7085
7086
  });
7086
7087
  }
7088
+ isDoubleClickWhileEntering(event) {
7089
+ const state = this._containerInstance.animatedLifecycle.state();
7090
+ return event.detail > 1 && (state === "init" || state === "entering");
7091
+ }
7087
7092
  finishOverlayClose() {
7088
7093
  this._ref.close(this._result, { focusOrigin: this._closeInteractionType });
7089
7094
  this.componentInstance = null;
@@ -20166,6 +20171,7 @@ var ComboboxDirective = class ComboboxDirective {
20166
20171
  this.colorProvider = inject(COLOR_PROVIDER, { optional: true });
20167
20172
  this._initialValue$ = new BehaviorSubject(null);
20168
20173
  this._hasReceivedSelectionValue = false;
20174
+ this._hasTypedSinceSelectionSync = false;
20169
20175
  this._filterInternal$ = new BehaviorSubject(false);
20170
20176
  this._loading$ = new BehaviorSubject(false);
20171
20177
  this.loading$ = this._loading$.asObservable();
@@ -20249,15 +20255,16 @@ var ComboboxDirective = class ComboboxDirective {
20249
20255
  this._debugValidateComboboxConfig();
20250
20256
  this._debugValidateOptionAndInitialValueSchema();
20251
20257
  }
20252
- this._selectionModel.setSelectionFromValue$(this._input.value);
20258
+ this._syncSelectionFromInputValue();
20253
20259
  const hasInitialControlValue = this._input.value !== null && this._input.value !== void 0;
20254
20260
  this._selectionModel.value$.pipe(takeUntil(this._destroy$), tap((value) => {
20255
20261
  const isInitialEmission = !this._hasReceivedSelectionValue;
20256
20262
  this._hasReceivedSelectionValue = true;
20257
20263
  if (!(this._selectionModel.isSyncingSelectionFromValue || isInitialEmission && hasInitialControlValue)) this._input._updateValue(value);
20264
+ if (this._selectionModel.isSyncingSelectionFromValue && value === null && this._hasTypedSinceSelectionSync) return;
20258
20265
  this._setFilterFromInputValue();
20259
20266
  })).subscribe();
20260
- this._input.onExternalUpdate$.pipe(takeUntil(this._destroy$), tap(() => this._selectionModel.setSelectionFromValue$(this._input.value))).subscribe();
20267
+ this._input.onExternalUpdate$.pipe(takeUntil(this._destroy$), tap(() => this._syncSelectionFromInputValue())).subscribe();
20261
20268
  }
20262
20269
  setBodyComponent(component) {
20263
20270
  this._comboboxBodyComponent = component;
@@ -20421,6 +20428,7 @@ var ComboboxDirective = class ComboboxDirective {
20421
20428
  }
20422
20429
  _processInputEvent(event) {
20423
20430
  const value = event.target.value;
20431
+ this._hasTypedSinceSelectionSync = true;
20424
20432
  this._updateFilter(value);
20425
20433
  }
20426
20434
  _handleBlurEvent() {
@@ -20478,6 +20486,10 @@ var ComboboxDirective = class ComboboxDirective {
20478
20486
  this.userInteraction.emit();
20479
20487
  }
20480
20488
  }
20489
+ _syncSelectionFromInputValue() {
20490
+ this._hasTypedSinceSelectionSync = false;
20491
+ this._selectionModel.setSelectionFromValue$(this._input.value);
20492
+ }
20481
20493
  _initDispatchFilterChanges() {
20482
20494
  this._currentFilter$.pipe(skipWhile(() => this.filterInternal), debounceTime(300), distinctUntilChanged(), takeUntil(this._destroy$), tap((v) => this.filterChange.emit(v))).subscribe();
20483
20495
  }