@fundamental-ngx/cdk 0.61.3 → 0.61.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.
@@ -1,9 +1,9 @@
1
1
  import * as i0 from '@angular/core';
2
- import { INJECTOR, ElementRef, isDevMode, InjectionToken, EventEmitter, inject, NgZone, Input, Output, Directive, NgModule, DestroyRef, Injectable, signal, DOCUMENT, Optional, Inject, booleanAttribute, Renderer2, PLATFORM_ID, input, effect, Self, SkipSelf, computed, ChangeDetectorRef, ContentChildren, forwardRef, HostListener, HostBinding, output, linkedSignal, Injector, model, contentChildren, runInInjectionContext, untracked, ContentChild, QueryList, ViewContainerRef, TemplateRef, ViewChild, Component, NgModuleFactory, Pipe } from '@angular/core';
2
+ import { INJECTOR, ElementRef, isDevMode, InjectionToken, EventEmitter, inject, NgZone, Input, Output, Directive, NgModule, DestroyRef, Injectable, signal, DOCUMENT, Optional, Inject, booleanAttribute, Renderer2, PLATFORM_ID, input, effect, Injector, afterNextRender, Self, SkipSelf, computed, ChangeDetectorRef, ContentChildren, forwardRef, HostListener, HostBinding, output, linkedSignal, model, contentChildren, runInInjectionContext, untracked, ContentChild, QueryList, ViewContainerRef, TemplateRef, ViewChild, Component, NgModuleFactory, Pipe } from '@angular/core';
3
3
  import { RIGHT_ARROW, DOWN_ARROW, LEFT_ARROW, UP_ARROW, SPACE, ESCAPE, DELETE, ENTER, MAC_ENTER, TAB, HOME, END, ALT, CONTROL, META, SHIFT, BACKSPACE, A, C, V, X, PAGE_UP, PAGE_DOWN, DASH, NUMPAD_MINUS, NUMPAD_ZERO, NUMPAD_ONE, NUMPAD_TWO, NUMPAD_THREE, NUMPAD_FOUR, NUMPAD_FIVE, NUMPAD_SIX, NUMPAD_SEVEN, NUMPAD_EIGHT, NUMPAD_NINE, F2, F7, hasModifierKey } from '@angular/cdk/keycodes';
4
4
  import { takeUntilDestroyed, outputToObservable } from '@angular/core/rxjs-interop';
5
- import { Observable, NEVER, fromEvent, switchMap, map as map$1, Subject, BehaviorSubject, merge as merge$1, combineLatest, ReplaySubject, firstValueFrom, startWith as startWith$1, Subscription, isObservable, of, tap as tap$1, filter as filter$1, take as take$1 } from 'rxjs';
6
- import { map, first, distinctUntilChanged, startWith, takeUntil, filter, tap, switchMap as switchMap$1, finalize, take, debounceTime, pairwise, shareReplay, delay } from 'rxjs/operators';
5
+ import { Observable, NEVER, fromEvent, switchMap, map as map$1, Subject, BehaviorSubject, merge as merge$1, combineLatest, ReplaySubject, startWith as startWith$1, Subscription, isObservable, of, firstValueFrom, tap as tap$1, filter as filter$1, take as take$1 } from 'rxjs';
6
+ import { map, first, distinctUntilChanged, startWith, takeUntil, filter, tap, switchMap as switchMap$1, finalize, debounceTime, pairwise, shareReplay, delay, take } from 'rxjs/operators';
7
7
  import { coerceElement, coerceBooleanProperty, coerceNumberProperty, coerceArray, coerceCssPixelValue } from '@angular/cdk/coercion';
8
8
  import { createFocusTrap } from 'focus-trap';
9
9
  import * as i1$1 from '@angular/cdk/a11y';
@@ -2104,9 +2104,8 @@ class DefaultDisabledViewModifier {
2104
2104
 
2105
2105
  class FdkDisabledProvider extends ReplaySubject {
2106
2106
  /** @hidden */
2107
- constructor(ngZone, elementRef, selfDisabled$, parentDisabled$) {
2107
+ constructor(elementRef, selfDisabled$, parentDisabled$) {
2108
2108
  super(1);
2109
- this.ngZone = ngZone;
2110
2109
  this.elementRef = elementRef;
2111
2110
  this.selfDisabled$ = selfDisabled$;
2112
2111
  this.parentDisabled$ = parentDisabled$;
@@ -2115,6 +2114,8 @@ class FdkDisabledProvider extends ReplaySubject {
2115
2114
  /** @Hidden */
2116
2115
  this._destroyRef = inject(DestroyRef);
2117
2116
  /** @hidden */
2117
+ this._injector = inject(Injector);
2118
+ /** @hidden */
2118
2119
  this.disabledObserver = inject(DisabledObserver);
2119
2120
  // Initialize properties that depend on injected services
2120
2121
  this._viewModifiers$ = new BehaviorSubject(this._getInitialViewModifiers());
@@ -2133,9 +2134,9 @@ class FdkDisabledProvider extends ReplaySubject {
2133
2134
  }
2134
2135
  /** @hidden */
2135
2136
  setDisabledState(isDisabled) {
2136
- firstValueFrom(this.ngZone.onStable).then(() => {
2137
+ afterNextRender(() => {
2137
2138
  this._viewModifiers$.value.forEach((viewModifier) => viewModifier.setDisabledState(isDisabled));
2138
- });
2139
+ }, { injector: this._injector });
2139
2140
  }
2140
2141
  /** @hidden */
2141
2142
  ngOnDestroy() {
@@ -2173,12 +2174,12 @@ class FdkDisabledProvider extends ReplaySubject {
2173
2174
  _getInitialViewModifiers() {
2174
2175
  return !this.selfDisabled$ ? [new DefaultDisabledViewModifier(this.elementRef)] : [this.selfDisabled$];
2175
2176
  }
2176
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: FdkDisabledProvider, deps: [{ token: i0.NgZone }, { token: i0.ElementRef }, { token: FDK_DISABLED_DIRECTIVE, optional: true, self: true }, { token: FDK_DISABLED_DIRECTIVE, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
2177
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: FdkDisabledProvider, deps: [{ token: i0.ElementRef }, { token: FDK_DISABLED_DIRECTIVE, optional: true, self: true }, { token: FDK_DISABLED_DIRECTIVE, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
2177
2178
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: FdkDisabledProvider }); }
2178
2179
  }
2179
2180
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: FdkDisabledProvider, decorators: [{
2180
2181
  type: Injectable
2181
- }], ctorParameters: () => [{ type: i0.NgZone }, { type: i0.ElementRef }, { type: undefined, decorators: [{
2182
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: undefined, decorators: [{
2182
2183
  type: Optional
2183
2184
  }, {
2184
2185
  type: Self
@@ -3420,9 +3421,8 @@ class InitialFocusDirective {
3420
3421
  return this._enabled$.getValue();
3421
3422
  }
3422
3423
  /** @hidden */
3423
- constructor(_elmRef, _ngZone, _tabbableService) {
3424
+ constructor(_elmRef, _tabbableService) {
3424
3425
  this._elmRef = _elmRef;
3425
- this._ngZone = _ngZone;
3426
3426
  this._tabbableService = _tabbableService;
3427
3427
  /**
3428
3428
  * CSS selector of an element that should be focused.
@@ -3435,6 +3435,8 @@ class InitialFocusDirective {
3435
3435
  /** @hidden */
3436
3436
  this._destroyRef = inject(DestroyRef);
3437
3437
  /** @hidden */
3438
+ this._injector = inject(Injector);
3439
+ /** @hidden */
3438
3440
  this._enabled$ = new BehaviorSubject(true);
3439
3441
  }
3440
3442
  /** @hidden */
@@ -3442,21 +3444,9 @@ class InitialFocusDirective {
3442
3444
  this._enabled$
3443
3445
  .pipe(distinctUntilChanged(), filter((enabled) => enabled), takeUntilDestroyed(this._destroyRef))
3444
3446
  .subscribe(() => {
3445
- this._executeOnEmpty(() => this._focus());
3447
+ afterNextRender(() => this._focus(), { injector: this._injector });
3446
3448
  });
3447
3449
  }
3448
- /**
3449
- * @hidden
3450
- * Executes a function when the zone is stable.
3451
- */
3452
- _executeOnEmpty(fn) {
3453
- if (!this._ngZone.hasPendingMicrotasks) {
3454
- fn();
3455
- }
3456
- else {
3457
- this._ngZone.onMicrotaskEmpty.pipe(take(1)).subscribe(fn);
3458
- }
3459
- }
3460
3450
  /**
3461
3451
  * @hidden
3462
3452
  * Searches for an appropriate focusable element
@@ -3480,7 +3470,7 @@ class InitialFocusDirective {
3480
3470
  const elm = this._getFocusableElement();
3481
3471
  elm?.focus();
3482
3472
  }
3483
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: InitialFocusDirective, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: TabbableElementService }], target: i0.ɵɵFactoryTarget.Directive }); }
3473
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: InitialFocusDirective, deps: [{ token: i0.ElementRef }, { token: TabbableElementService }], target: i0.ɵɵFactoryTarget.Directive }); }
3484
3474
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.0", type: InitialFocusDirective, isStandalone: true, selector: "[fdkInitialFocus]", inputs: { fdkInitialFocus: "fdkInitialFocus", enabled: "enabled", focusLastElement: "focusLastElement" }, providers: [TabbableElementService], ngImport: i0 }); }
3485
3475
  }
3486
3476
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: InitialFocusDirective, decorators: [{
@@ -3490,7 +3480,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
3490
3480
  standalone: true,
3491
3481
  providers: [TabbableElementService]
3492
3482
  }]
3493
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: TabbableElementService }], propDecorators: { fdkInitialFocus: [{
3483
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: TabbableElementService }], propDecorators: { fdkInitialFocus: [{
3494
3484
  type: Input
3495
3485
  }], enabled: [{
3496
3486
  type: Input
@@ -4217,9 +4207,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
4217
4207
 
4218
4208
  class FdkReadonlyProvider extends ReplaySubject {
4219
4209
  /** @hidden */
4220
- constructor(ngZone, elementRef, selfReadonly$, parentReadonly$) {
4210
+ constructor(elementRef, selfReadonly$, parentReadonly$) {
4221
4211
  super(1);
4222
- this.ngZone = ngZone;
4223
4212
  this.elementRef = elementRef;
4224
4213
  this.selfReadonly$ = selfReadonly$;
4225
4214
  this.parentReadonly$ = parentReadonly$;
@@ -4229,6 +4218,8 @@ class FdkReadonlyProvider extends ReplaySubject {
4229
4218
  this._destroyRef = inject(DestroyRef);
4230
4219
  /** @hidden */
4231
4220
  this.readonlyObserver = inject(ReadonlyObserver);
4221
+ /** @hidden */
4222
+ this._injector = inject(Injector);
4232
4223
  // Initialize properties that depend on injected services
4233
4224
  this._viewModifiers$ = new BehaviorSubject(this._getInitialViewModifiers());
4234
4225
  this._readonlyChange$ = this._getReadonlyChange$();
@@ -4246,9 +4237,9 @@ class FdkReadonlyProvider extends ReplaySubject {
4246
4237
  }
4247
4238
  /** @hidden */
4248
4239
  setReadonlyState(isReadonly) {
4249
- firstValueFrom(this.ngZone.onStable).then(() => {
4240
+ afterNextRender(() => {
4250
4241
  this._viewModifiers$.value.forEach((viewModifier) => viewModifier.setReadonlyState(isReadonly));
4251
- });
4242
+ }, { injector: this._injector });
4252
4243
  }
4253
4244
  /** @hidden */
4254
4245
  ngOnDestroy() {
@@ -4286,12 +4277,12 @@ class FdkReadonlyProvider extends ReplaySubject {
4286
4277
  _getInitialViewModifiers() {
4287
4278
  return !this.selfReadonly$ ? [new DefaultReadonlyViewModifier(this.elementRef)] : [this.selfReadonly$];
4288
4279
  }
4289
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: FdkReadonlyProvider, deps: [{ token: i0.NgZone }, { token: i0.ElementRef }, { token: FDK_READONLY_DIRECTIVE, optional: true, self: true }, { token: FDK_READONLY_DIRECTIVE, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
4280
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: FdkReadonlyProvider, deps: [{ token: i0.ElementRef }, { token: FDK_READONLY_DIRECTIVE, optional: true, self: true }, { token: FDK_READONLY_DIRECTIVE, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
4290
4281
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: FdkReadonlyProvider }); }
4291
4282
  }
4292
4283
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: FdkReadonlyProvider, decorators: [{
4293
4284
  type: Injectable
4294
- }], ctorParameters: () => [{ type: i0.NgZone }, { type: i0.ElementRef }, { type: undefined, decorators: [{
4285
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: undefined, decorators: [{
4295
4286
  type: Optional
4296
4287
  }, {
4297
4288
  type: Self