@ethlete/cdk 5.0.0-next.43 → 5.0.0-next.45
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,22 @@
|
|
|
1
1
|
# @ethlete/cdk
|
|
2
2
|
|
|
3
|
+
## 5.0.0-next.45
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- The combobox now closes on Escape pressed during its enter animation instead of ignoring it.
|
|
8
|
+
- The `@nx/devkit` peer range is now `>=23.0.0`, matching the Nx floor of the migration guide.
|
|
9
|
+
- Dialogs and selects now close on an Escape pressed during the enter animation instead of dropping it; the click that opens them still cannot close them.
|
|
10
|
+
- An auto-resized overlay, such as a menu, opened near the viewport bottom now flips to the top instead of staying squeezed below its trigger.
|
|
11
|
+
- The `to-v5` migration now renames `theme` and `altTheme` to `color` and `altColor` only on `et-button`, `et-fab`, `et-icon-button` and `et-text-button` hosts, not on app components with their own `theme` input.
|
|
12
|
+
|
|
13
|
+
## 5.0.0-next.44
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- `etInput` now follows a `[formControl]` that switches to a new FormControl, so errors and the invalid state reflect the current control.
|
|
18
|
+
- Fix `etSort` ignoring a replaced `sortControl`, `sortByControl` or `sortDirectionControl`: it now watches the new control instead of the old one.
|
|
19
|
+
|
|
3
20
|
## 5.0.0-next.43
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/fesm2022/ethlete-cdk.mjs
CHANGED
|
@@ -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, Subject, Subscription, catchError, combineLatest, debounceTime, distinctUntilChanged, filter, finalize, from, fromEvent, map, merge, 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, skipUntil, 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";
|
|
@@ -15,7 +15,7 @@ import { AutofillMonitor } from "@angular/cdk/text-field";
|
|
|
15
15
|
import { FormControl, NG_VALUE_ACCESSOR, NgControl, Validators } from "@angular/forms";
|
|
16
16
|
import { A, BACKSPACE, DOWN_ARROW, END, ENTER, ESCAPE, HOME, LEFT_ARROW, PAGE_DOWN, PAGE_UP, RIGHT_ARROW, SPACE, TAB as TAB$1, UP_ARROW, hasModifierKey } from "@angular/cdk/keycodes";
|
|
17
17
|
import { NoopScrollStrategy, Overlay, OverlayRef as OverlayRef$1 } from "@angular/cdk/overlay";
|
|
18
|
-
import { arrow, autoUpdate, computePosition, flip, hide, limitShift, offset, shift, size } from "@floating-ui/dom";
|
|
18
|
+
import { arrow, autoUpdate, computePosition, flip, hide, limitShift, offset, platform, shift, size } from "@floating-ui/dom";
|
|
19
19
|
import { _isNumberValue, coerceCssPixelValue, coerceElement } from "@angular/cdk/coercion";
|
|
20
20
|
import { CdkDialogContainer, Dialog, DialogConfig } from "@angular/cdk/dialog";
|
|
21
21
|
import * as i1$3 from "@angular/router";
|
|
@@ -5188,7 +5188,7 @@ var InputDirective = class InputDirective {
|
|
|
5188
5188
|
return this._formFieldStateService.labelId();
|
|
5189
5189
|
}
|
|
5190
5190
|
get invalid$() {
|
|
5191
|
-
return this.control.statusChanges.pipe(startWith(
|
|
5191
|
+
return this._control$.pipe(switchMap((control) => control.statusChanges.pipe(startWith(control.status))), map((s) => s === "INVALID"));
|
|
5192
5192
|
}
|
|
5193
5193
|
get invalid() {
|
|
5194
5194
|
return this.control.invalid;
|
|
@@ -5265,6 +5265,7 @@ var InputDirective = class InputDirective {
|
|
|
5265
5265
|
"time",
|
|
5266
5266
|
"week"
|
|
5267
5267
|
];
|
|
5268
|
+
this._control$ = new ReplaySubject(1);
|
|
5268
5269
|
this._id = `et-input-${++nextUniqueId$5}`;
|
|
5269
5270
|
this.autocomplete = input(null, ...ngDevMode ? [{ debugName: "autocomplete" }] : /* istanbul ignore next */ []);
|
|
5270
5271
|
this.placeholder = input(null, ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
|
|
@@ -5279,14 +5280,25 @@ var InputDirective = class InputDirective {
|
|
|
5279
5280
|
if (exposeInputVarsDirective) exposeInputVarsDirective._monitorInput(this);
|
|
5280
5281
|
});
|
|
5281
5282
|
}
|
|
5283
|
+
ngDoCheck() {
|
|
5284
|
+
this._syncControl();
|
|
5285
|
+
}
|
|
5286
|
+
_syncControl() {
|
|
5287
|
+
const control = this.control;
|
|
5288
|
+
if (control !== this._watchedControl) {
|
|
5289
|
+
this._watchedControl = control;
|
|
5290
|
+
this._control$.next(control);
|
|
5291
|
+
}
|
|
5292
|
+
}
|
|
5282
5293
|
ngOnInit() {
|
|
5283
|
-
|
|
5294
|
+
this._syncControl();
|
|
5295
|
+
const controlStateChanges$ = this._control$.pipe(switchMap((control) => combineLatest([control.statusChanges.pipe(startWith(control.status)), control.valueChanges.pipe(startWith(control.value))])), debounceTime(0), map(([status, value]) => ({
|
|
5284
5296
|
status,
|
|
5285
5297
|
value
|
|
5286
5298
|
})));
|
|
5287
5299
|
controlStateChanges$.pipe(map(() => this.control.errors), filter((errors) => !equal(errors, this.errors)), tap((errors) => this._inputStateService.errors$.next(errors)), takeUntil(this._destroy$)).subscribe();
|
|
5288
5300
|
controlStateChanges$.pipe(tap(() => this._detectControlRequiredValidationChanges()), tap(() => this._detectControlDisabledChanges()), takeUntil(this._destroy$)).subscribe();
|
|
5289
|
-
this.control.valueChanges
|
|
5301
|
+
this._control$.pipe(switchMap((control) => control.valueChanges), takeUntil(this._destroy$), tap((value) => {
|
|
5290
5302
|
if (this._inputStateService.lastUpdateType() === "internal") {
|
|
5291
5303
|
this._inputStateService.lastUpdateType$.next(null);
|
|
5292
5304
|
return;
|
|
@@ -6438,6 +6450,32 @@ const createFormChangesTracker = (config) => {
|
|
|
6438
6450
|
defaultFormValue: defaultFormValue.asReadonly()
|
|
6439
6451
|
};
|
|
6440
6452
|
};
|
|
6453
|
+
const FLOATING_MAX_SIZE_PROPERTIES = ["--et-floating-max-width", "--et-floating-max-height"];
|
|
6454
|
+
const platformMeasuringUncappedFloatingElFirst = (floatingEl) => {
|
|
6455
|
+
let measuredUncapped = false;
|
|
6456
|
+
return {
|
|
6457
|
+
...platform,
|
|
6458
|
+
getDimensions: (element) => {
|
|
6459
|
+
if (element !== floatingEl || measuredUncapped) return platform.getDimensions(element);
|
|
6460
|
+
measuredUncapped = true;
|
|
6461
|
+
const caps = FLOATING_MAX_SIZE_PROPERTIES.map((name) => [name, floatingEl.style.getPropertyValue(name)]);
|
|
6462
|
+
if (caps.every(([, value]) => !value)) return platform.getDimensions(element);
|
|
6463
|
+
const scrolled = [...floatingEl.querySelectorAll("*")].filter((el) => el.scrollTop || el.scrollLeft).map((el) => ({
|
|
6464
|
+
el,
|
|
6465
|
+
top: el.scrollTop,
|
|
6466
|
+
left: el.scrollLeft
|
|
6467
|
+
}));
|
|
6468
|
+
for (const [name] of caps) floatingEl.style.removeProperty(name);
|
|
6469
|
+
const dimensions = platform.getDimensions(element);
|
|
6470
|
+
for (const [name, value] of caps) if (value) floatingEl.style.setProperty(name, value);
|
|
6471
|
+
for (const { el, top, left } of scrolled) {
|
|
6472
|
+
el.scrollTop = top;
|
|
6473
|
+
el.scrollLeft = left;
|
|
6474
|
+
}
|
|
6475
|
+
return dimensions;
|
|
6476
|
+
}
|
|
6477
|
+
};
|
|
6478
|
+
};
|
|
6441
6479
|
var AnimatedOverlayDirective = class AnimatedOverlayDirective {
|
|
6442
6480
|
constructor() {
|
|
6443
6481
|
this.overlayService = inject(Overlay);
|
|
@@ -6596,10 +6634,9 @@ var AnimatedOverlayDirective = class AnimatedOverlayDirective {
|
|
|
6596
6634
|
floatingEl.classList.add("et-floating-element");
|
|
6597
6635
|
const refEl = this.referenceElement();
|
|
6598
6636
|
const boundary = this.rootBoundary?.value();
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
this.waitForRenderAndAnimate();
|
|
6637
|
+
const update = () => this.updateFloatingPosition(floatingEl, refEl, boundary, floatingElArrow);
|
|
6638
|
+
this.floatingElCleanupFn = autoUpdate(refEl, floatingEl, update);
|
|
6639
|
+
this.waitForRenderAndAnimate(update);
|
|
6603
6640
|
});
|
|
6604
6641
|
}
|
|
6605
6642
|
getFloatingArrow() {
|
|
@@ -6611,7 +6648,8 @@ var AnimatedOverlayDirective = class AnimatedOverlayDirective {
|
|
|
6611
6648
|
const middleware = this.buildFloatingMiddleware(floatingEl, boundary, floatingElArrow);
|
|
6612
6649
|
computePosition(refEl, floatingEl, {
|
|
6613
6650
|
placement: this.placement(),
|
|
6614
|
-
middleware
|
|
6651
|
+
middleware,
|
|
6652
|
+
platform: this.autoResize() ? platformMeasuringUncappedFloatingElFirst(floatingEl) : platform
|
|
6615
6653
|
}).then(({ x, y, placement, middlewareData }) => {
|
|
6616
6654
|
this.applyFloatingStyles(floatingEl, x, y, placement);
|
|
6617
6655
|
this.applyArrowStyles(floatingEl, middlewareData, floatingElArrow);
|
|
@@ -6670,9 +6708,10 @@ var AnimatedOverlayDirective = class AnimatedOverlayDirective {
|
|
|
6670
6708
|
this.isHidden.set(false);
|
|
6671
6709
|
}
|
|
6672
6710
|
}
|
|
6673
|
-
waitForRenderAndAnimate() {
|
|
6711
|
+
waitForRenderAndAnimate(updateFloatingPosition) {
|
|
6674
6712
|
nextFrame(() => {
|
|
6675
6713
|
if (!this.componentRef || this.state() !== "mounting") return;
|
|
6714
|
+
updateFloatingPosition();
|
|
6676
6715
|
const lifecycle = this.componentRef.instance.animatedLifecycle?.();
|
|
6677
6716
|
if (!lifecycle) {
|
|
6678
6717
|
console.error("AnimatedOverlayDirective: The component does not have an AnimatedLifecycleDirective. Please add one to the component.");
|
|
@@ -7034,7 +7073,8 @@ var OverlayRef = class {
|
|
|
7034
7073
|
});
|
|
7035
7074
|
}
|
|
7036
7075
|
setupCloseHandlers() {
|
|
7037
|
-
|
|
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) => {
|
|
7038
7078
|
const isEscapeKey = event.type === "keydown";
|
|
7039
7079
|
const isBackdropClick = !isEscapeKey;
|
|
7040
7080
|
if (this._isEscCloseControlledExternally && isEscapeKey || this._isBackdropCloseControlledExternally && isBackdropClick) return;
|
|
@@ -20263,6 +20303,10 @@ var ComboboxDirective = class ComboboxDirective {
|
|
|
20263
20303
|
})).subscribe();
|
|
20264
20304
|
}
|
|
20265
20305
|
close() {
|
|
20306
|
+
if (!this._animatedOverlay.canUnmount()) return;
|
|
20307
|
+
this._animatedOverlay.unmount();
|
|
20308
|
+
}
|
|
20309
|
+
_closeFromOutsideClick() {
|
|
20266
20310
|
if (!this._isOpen || this._animatedOverlay.isUnmounting()) return;
|
|
20267
20311
|
this._animatedOverlay.unmount();
|
|
20268
20312
|
}
|
|
@@ -20335,7 +20379,7 @@ var ComboboxDirective = class ComboboxDirective {
|
|
|
20335
20379
|
return this._interpretKeyHandlerResult(result);
|
|
20336
20380
|
}
|
|
20337
20381
|
if (keyCode === ESCAPE) {
|
|
20338
|
-
if (
|
|
20382
|
+
if (this._animatedOverlay.canUnmount()) {
|
|
20339
20383
|
result.overlayOperation = "close";
|
|
20340
20384
|
event.preventDefault();
|
|
20341
20385
|
event.stopPropagation();
|
|
@@ -21116,7 +21160,7 @@ var ComboboxBodyComponent = class ComboboxBodyComponent {
|
|
|
21116
21160
|
...inputs
|
|
21117
21161
|
}))));
|
|
21118
21162
|
this._bodyTemplate = null;
|
|
21119
|
-
outputToObservable(this.clickOutside.didClickOutside).pipe(tap(() => this.combobox.
|
|
21163
|
+
outputToObservable(this.clickOutside.didClickOutside).pipe(tap(() => this.combobox._closeFromOutsideClick()), takeUntilDestroyed()).subscribe();
|
|
21120
21164
|
}
|
|
21121
21165
|
setColorFromProvider(provider) {
|
|
21122
21166
|
this.colorProvider.syncWithProvider(provider);
|
|
@@ -22120,6 +22164,10 @@ var SelectDirective = class SelectDirective {
|
|
|
22120
22164
|
})).subscribe();
|
|
22121
22165
|
}
|
|
22122
22166
|
close() {
|
|
22167
|
+
if (!this._animatedOverlay.canUnmount()) return;
|
|
22168
|
+
this._animatedOverlay.unmount();
|
|
22169
|
+
}
|
|
22170
|
+
_closeFromOutsideClick() {
|
|
22123
22171
|
if (!this._animatedOverlay.isMounted()) return;
|
|
22124
22172
|
this._animatedOverlay.unmount();
|
|
22125
22173
|
}
|
|
@@ -22351,7 +22399,7 @@ var SelectBodyDirective = class SelectBodyDirective {
|
|
|
22351
22399
|
"aria-multiselectable": toSignal(this._select.multiple$),
|
|
22352
22400
|
"aria-labelledby": toSignal(this._select.input.labelId$)
|
|
22353
22401
|
});
|
|
22354
|
-
outputToObservable(this._clickOutside.didClickOutside).pipe(tap(() => this._select.
|
|
22402
|
+
outputToObservable(this._clickOutside.didClickOutside).pipe(tap(() => this._select._closeFromOutsideClick()), takeUntilDestroyed()).subscribe();
|
|
22355
22403
|
}
|
|
22356
22404
|
static {
|
|
22357
22405
|
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
@@ -26415,6 +26463,7 @@ var SortDirective = class SortDirective {
|
|
|
26415
26463
|
this._defaultOptions = inject(SORT_DEFAULT_OPTIONS, { optional: true });
|
|
26416
26464
|
this.sortables = /* @__PURE__ */ new Map();
|
|
26417
26465
|
this._stateChanges = new Subject();
|
|
26466
|
+
this._controlSubscription = new Subscription();
|
|
26418
26467
|
this._isInitialized = false;
|
|
26419
26468
|
this._pendingSubscribers = [];
|
|
26420
26469
|
this.initialized = new Observable((subscriber) => {
|
|
@@ -26469,7 +26518,12 @@ var SortDirective = class SortDirective {
|
|
|
26469
26518
|
this.active = this.sortByControl.value;
|
|
26470
26519
|
this.direction = this.sortDirectionControl.value;
|
|
26471
26520
|
}
|
|
26472
|
-
|
|
26521
|
+
this._watchControls();
|
|
26522
|
+
}
|
|
26523
|
+
_watchControls() {
|
|
26524
|
+
this._controlSubscription.unsubscribe();
|
|
26525
|
+
this._controlSubscription = new Subscription();
|
|
26526
|
+
if (this.sortControl) this._controlSubscription.add(this.sortControl.valueChanges.subscribe((value) => {
|
|
26473
26527
|
if (value) {
|
|
26474
26528
|
if (this.active !== value.active) this.active = value.active;
|
|
26475
26529
|
if (this.direction !== value.direction) this.direction = value.direction;
|
|
@@ -26478,24 +26532,30 @@ var SortDirective = class SortDirective {
|
|
|
26478
26532
|
this.direction = "";
|
|
26479
26533
|
}
|
|
26480
26534
|
this._stateChanges.next();
|
|
26481
|
-
});
|
|
26482
|
-
if (this.sortByControl) this.
|
|
26535
|
+
}));
|
|
26536
|
+
if (this.sortByControl) this._controlSubscription.add(this.sortByControl.valueChanges.subscribe((value) => {
|
|
26483
26537
|
if (value) {
|
|
26484
26538
|
if (this.active !== value) this.active = value;
|
|
26485
26539
|
} else this.active = void 0;
|
|
26486
26540
|
this._stateChanges.next();
|
|
26487
|
-
});
|
|
26488
|
-
if (this.sortDirectionControl) this.
|
|
26541
|
+
}));
|
|
26542
|
+
if (this.sortDirectionControl) this._controlSubscription.add(this.sortDirectionControl.valueChanges.subscribe((value) => {
|
|
26489
26543
|
if (value) {
|
|
26490
26544
|
if (this.direction !== value) this.direction = value;
|
|
26491
26545
|
} else this.direction = "";
|
|
26492
26546
|
this._stateChanges.next();
|
|
26493
|
-
});
|
|
26547
|
+
}));
|
|
26494
26548
|
}
|
|
26495
|
-
ngOnChanges() {
|
|
26549
|
+
ngOnChanges(changes) {
|
|
26550
|
+
if ([
|
|
26551
|
+
"sortControl",
|
|
26552
|
+
"sortByControl",
|
|
26553
|
+
"sortDirectionControl"
|
|
26554
|
+
].some((key) => changes[key] && !changes[key].firstChange)) this._watchControls();
|
|
26496
26555
|
this._stateChanges.next();
|
|
26497
26556
|
}
|
|
26498
26557
|
ngOnDestroy() {
|
|
26558
|
+
this._controlSubscription.unsubscribe();
|
|
26499
26559
|
this._stateChanges.complete();
|
|
26500
26560
|
}
|
|
26501
26561
|
_markInitialized() {
|