@fundamental-ngx/cdk 0.61.2 → 0.62.0-rc.1

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, DestroyRef, Input, Output, Directive, NgModule, Injectable, signal, DOCUMENT, Optional, Inject, booleanAttribute, output, Renderer2, PLATFORM_ID, input, effect, Self, SkipSelf, computed, ChangeDetectorRef, ContentChildren, forwardRef, HostListener, HostBinding, linkedSignal, Injector, model, contentChildren, runInInjectionContext, untracked, ContentChild, QueryList, TemplateRef, numberAttribute, ViewContainerRef, 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
- 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';
4
+ import { takeUntilDestroyed, outputToObservable, outputFromObservable } from '@angular/core/rxjs-interop';
5
+ import { Observable, NEVER, fromEvent, Subject, BehaviorSubject, merge as merge$1, map as map$1, combineLatest, ReplaySubject, firstValueFrom, startWith as startWith$1, switchMap as switchMap$1, Subscription, isObservable, of, tap as tap$1, filter as filter$1, take as take$1 } from 'rxjs';
6
+ import { map, distinctUntilChanged, startWith, takeUntil, filter, tap, switchMap, finalize, take, debounceTime, pairwise, shareReplay, delay } 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';
@@ -657,7 +657,10 @@ class AutoCompleteDirective {
657
657
  this._isComposing = false;
658
658
  /** @hidden */
659
659
  this._elementRef = inject(ElementRef);
660
+ /** @hidden */
660
661
  this._zone = inject(NgZone);
662
+ /** @hidden */
663
+ this._destroyRef = inject(DestroyRef);
661
664
  /** Matcher function for testing the str for a search term */
662
665
  this.matcher = (str, searchTerm) => str.startsWith(searchTerm);
663
666
  /**
@@ -666,16 +669,14 @@ class AutoCompleteDirective {
666
669
  * By ensuring that we set all properties we can proceed with stable data.
667
670
  */
668
671
  this._zone.runOutsideAngular(() => {
669
- const keyupEvent = fromEvent(this._elementRef.nativeElement, 'keydown');
672
+ const keyupEvent = fromEvent(this._elementRef.nativeElement, 'keyup');
670
673
  const compositionStartEvent = fromEvent(this._elementRef.nativeElement, 'compositionstart');
671
674
  const compositionEndEvent = fromEvent(this._elementRef.nativeElement, 'compositionend');
672
- keyupEvent
673
- .pipe(switchMap((evt) => this._zone.onStable.pipe(first(), map$1(() => evt))), takeUntilDestroyed())
674
- .subscribe((evt) => this._handleKeyboardEvent(evt));
675
- compositionStartEvent.pipe(takeUntilDestroyed()).subscribe(() => {
675
+ keyupEvent.pipe(takeUntilDestroyed()).subscribe((evt) => this._handleKeyboardEvent(evt));
676
+ compositionStartEvent.pipe(takeUntilDestroyed(this._destroyRef)).subscribe(() => {
676
677
  this._isComposing = true;
677
678
  });
678
- compositionEndEvent.pipe(takeUntilDestroyed()).subscribe(() => {
679
+ compositionEndEvent.pipe(takeUntilDestroyed(this._destroyRef)).subscribe(() => {
679
680
  this._isComposing = false;
680
681
  this.inputText = this._elementRef.nativeElement.value;
681
682
  });
@@ -1648,7 +1649,7 @@ class BreakpointDirective {
1648
1649
  }
1649
1650
  /** @hidden */
1650
1651
  ngAfterViewInit() {
1651
- combineLatest([this._sizeObservable$.pipe(switchMap$1((obs$) => obs$)), this.onChanges$.pipe(startWith(void 0))])
1652
+ combineLatest([this._sizeObservable$.pipe(switchMap((obs$) => obs$)), this.onChanges$.pipe(startWith(void 0))])
1652
1653
  .pipe(map(([w]) => [w, getBreakpointName(w)]), map(([width, breakpointName]) => this._shouldShow(width, breakpointName)), tap((shouldShow) => {
1653
1654
  if (shouldShow) {
1654
1655
  if (!this.templateViewRef) {
@@ -1739,6 +1740,11 @@ class ClickedDirective {
1739
1740
  static { this.eventName = 'fdkClicked'; }
1740
1741
  /** @hidden */
1741
1742
  constructor() {
1743
+ /**
1744
+ * Event emitted when user either clicks with mouse, or
1745
+ * clicks on space or enter keys
1746
+ */
1747
+ this.fdkClicked = output();
1742
1748
  const { nativeElement: element } = inject(ElementRef);
1743
1749
  const renderer = inject(Renderer2);
1744
1750
  const destroyRef = inject(DestroyRef);
@@ -1750,7 +1756,11 @@ class ClickedDirective {
1750
1756
  enter$.complete();
1751
1757
  space$.complete();
1752
1758
  });
1753
- this.fdkClicked = merge$1(fromEvent(element, 'click'), enter$, space$);
1759
+ // Subscribe to merged events and emit through output
1760
+ const subscription = merge$1(fromEvent(element, 'click'), enter$, space$).subscribe((event) => {
1761
+ this.fdkClicked.emit(event);
1762
+ });
1763
+ destroyRef.onDestroy(() => subscription.unsubscribe());
1754
1764
  }
1755
1765
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: ClickedDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1756
1766
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.0", type: ClickedDirective, isStandalone: true, selector: "[fdkClicked]", outputs: { fdkClicked: "fdkClicked" }, ngImport: i0 }); }
@@ -1761,9 +1771,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
1761
1771
  selector: '[fdkClicked]',
1762
1772
  standalone: true
1763
1773
  }]
1764
- }], ctorParameters: () => [], propDecorators: { fdkClicked: [{
1765
- type: Output
1766
- }] } });
1774
+ }], ctorParameters: () => [], propDecorators: { fdkClicked: [{ type: i0.Output, args: ["fdkClicked"] }] } });
1767
1775
 
1768
1776
  /**
1769
1777
  * @deprecated
@@ -2479,7 +2487,7 @@ class FocusableItemDirective {
2479
2487
  });
2480
2488
  this._focusableObserver
2481
2489
  .observe(this.elementRef, false)
2482
- .pipe(takeUntilDestroyed())
2490
+ .pipe(takeUntilDestroyed(this._destroyRef))
2483
2491
  .subscribe((isFocusable) => {
2484
2492
  if (isFocusable !== this.isFocusable()) {
2485
2493
  this.setFocusable(isFocusable);
@@ -2512,22 +2520,28 @@ class FocusableItemDirective {
2512
2520
  }
2513
2521
  /** @hidden */
2514
2522
  enableTabbableElements() {
2515
- if (this._tabbableElements.size === 0) {
2523
+ const size = this._tabbableElements.size;
2524
+ if (size === 0) {
2516
2525
  return;
2517
2526
  }
2518
- this._tabbableElements.forEach((tabIndex, element) => (element.tabIndex = tabIndex));
2527
+ for (const [element, tabIndex] of this._tabbableElements) {
2528
+ element.tabIndex = tabIndex;
2529
+ }
2519
2530
  this._tabbable = false;
2520
2531
  }
2521
2532
  /** @hidden */
2522
2533
  disableTabbableElements() {
2523
2534
  // Since we cannot select by tabindex attribute (links, inputs, buttons might not have one but still can be focusable),
2524
2535
  // Select all elements from the cell and filter by tabIndex property.
2525
- Array.from(this.elementRef.nativeElement.querySelectorAll('*'))
2526
- .filter((elm) => elm.tabIndex >= 0)
2527
- .forEach((elm) => {
2528
- this._tabbableElements.set(elm, elm.tabIndex);
2529
- elm.tabIndex = -1;
2530
- });
2536
+ const allElements = this.elementRef.nativeElement.querySelectorAll('*');
2537
+ const length = allElements.length;
2538
+ for (let i = 0; i < length; i++) {
2539
+ const elm = allElements[i];
2540
+ if (elm.tabIndex >= 0) {
2541
+ this._tabbableElements.set(elm, elm.tabIndex);
2542
+ elm.tabIndex = -1;
2543
+ }
2544
+ }
2531
2545
  }
2532
2546
  /** @hidden */
2533
2547
  async _onFocusin() {
@@ -2543,10 +2557,11 @@ class FocusableItemDirective {
2543
2557
  }
2544
2558
  }
2545
2559
  const activeEl = this._document.activeElement;
2546
- if (activeEl === this.elementRef.nativeElement) {
2560
+ const nativeElement = this.elementRef.nativeElement;
2561
+ if (activeEl === nativeElement) {
2547
2562
  this._parentFocusableItemFocused.emit();
2548
2563
  }
2549
- else if (activeEl && activeEl !== this.elementRef.nativeElement && this._checker.isFocusable(activeEl)) {
2564
+ else if (activeEl && this._checker.isFocusable(activeEl)) {
2550
2565
  this.focusableChildElementFocused.emit();
2551
2566
  }
2552
2567
  }
@@ -2851,11 +2866,11 @@ class FocusableListDirective {
2851
2866
  /** @hidden */
2852
2867
  this._document = inject(DOCUMENT);
2853
2868
  intersectionObservable(this._elementRef.nativeElement, { threshold: 0.25 })
2854
- .pipe(takeUntilDestroyed())
2869
+ .pipe(takeUntilDestroyed(this._destroyRef))
2855
2870
  .subscribe((isVisible) => this._isVisible.set(isVisible[0]?.isIntersecting));
2856
2871
  this._focusableObserver
2857
2872
  .observe(this._elementRef, false)
2858
- .pipe(takeUntilDestroyed())
2873
+ .pipe(takeUntilDestroyed(this._destroyRef))
2859
2874
  .subscribe((isFocusable) => {
2860
2875
  if (!isFocusable && isFocusable !== this.focusable) {
2861
2876
  this.focusable = isFocusable;
@@ -2880,13 +2895,14 @@ class FocusableListDirective {
2880
2895
  return;
2881
2896
  }
2882
2897
  const items = this._focusableItems();
2883
- items.forEach((item, index) => {
2884
- item._position = {
2898
+ const totalCols = items.length;
2899
+ for (let index = 0; index < totalCols; index++) {
2900
+ items[index]._position = {
2885
2901
  ...gridPosition,
2886
2902
  colIndex: index,
2887
- totalCols: items.length
2903
+ totalCols
2888
2904
  };
2889
- });
2905
+ }
2890
2906
  });
2891
2907
  }
2892
2908
  /** @hidden */
@@ -2976,7 +2992,11 @@ class FocusableListDirective {
2976
2992
  }
2977
2993
  /** @hidden */
2978
2994
  _setItemsTabbable(state) {
2979
- this._focusableItems().forEach((item) => item.setTabbable(state));
2995
+ const items = this._focusableItems();
2996
+ const length = items.length;
2997
+ for (let i = 0; i < length; i++) {
2998
+ items[i].setTabbable(state);
2999
+ }
2980
3000
  }
2981
3001
  /** @hidden */
2982
3002
  _setGridPosition(position) {
@@ -2996,29 +3016,44 @@ class FocusableListDirective {
2996
3016
  }
2997
3017
  keyManager.skipPredicate((i) => !isItemFocusable(i));
2998
3018
  this._keyManager = keyManager;
2999
- const focusListenerDestroyers = items.map((item, index) => this._renderer.listen(getItemElement(item), 'focus', () => {
3000
- const directiveItem = this._focusableItems()[index];
3001
- if (!directiveItem) {
3002
- return;
3003
- }
3004
- const gridPosition = this._gridPosition();
3005
- if (gridPosition) {
3006
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
3007
- this._gridItemFocused$.next(directiveItem._position);
3008
- }
3009
- const id = getItemElement(item)?.id ?? null;
3010
- this.itemFocused.emit({ index, total: items.length, id });
3011
- this._focusableItems().forEach((i) => i.setTabbable(i === directiveItem));
3012
- this._keyManager?.setActiveItem(index);
3013
- }));
3014
- merge$1(...items.map((item) => item.keydown))
3019
+ const itemsLength = items.length;
3020
+ const focusListenerDestroyers = new Array(itemsLength);
3021
+ const keydownObservables = new Array(itemsLength);
3022
+ for (let index = 0; index < itemsLength; index++) {
3023
+ const item = items[index];
3024
+ keydownObservables[index] = item.keydown;
3025
+ focusListenerDestroyers[index] = this._renderer.listen(getItemElement(item), 'focus', () => {
3026
+ const directiveItem = this._focusableItems()[index];
3027
+ if (!directiveItem) {
3028
+ return;
3029
+ }
3030
+ const gridPosition = this._gridPosition();
3031
+ if (gridPosition) {
3032
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
3033
+ this._gridItemFocused$.next(directiveItem._position);
3034
+ }
3035
+ const id = getItemElement(item)?.id ?? null;
3036
+ this.itemFocused.emit({ index, total: itemsLength, id });
3037
+ const focusableItems = this._focusableItems();
3038
+ const focusableItemsLength = focusableItems.length;
3039
+ for (let i = 0; i < focusableItemsLength; i++) {
3040
+ focusableItems[i].setTabbable(focusableItems[i] === directiveItem);
3041
+ }
3042
+ this._keyManager?.setActiveItem(index);
3043
+ });
3044
+ }
3045
+ merge$1(...keydownObservables)
3015
3046
  .pipe(tap((event) => {
3016
3047
  // Already handled
3017
3048
  if (event.defaultPrevented) {
3018
3049
  return;
3019
3050
  }
3020
3051
  this._keyManager?.onKeydown(event);
3021
- }), takeUntil(merge$1(this._refreshItems$, destroyObservable(this._destroyRef))), finalize(() => focusListenerDestroyers.forEach((d) => d())))
3052
+ }), takeUntil(merge$1(this._refreshItems$, destroyObservable(this._destroyRef))), finalize(() => {
3053
+ for (let i = 0; i < focusListenerDestroyers.length; i++) {
3054
+ focusListenerDestroyers[i]();
3055
+ }
3056
+ }))
3022
3057
  .subscribe();
3023
3058
  }
3024
3059
  /** @hidden */
@@ -3125,10 +3160,15 @@ class FocusableGridDirective {
3125
3160
  this._focusableLists.changes
3126
3161
  .pipe(startWith$1(this._focusableLists), takeUntilDestroyed(this._destroyRef))
3127
3162
  .subscribe((lists) => {
3128
- lists.forEach((list, index) => {
3129
- list._setGridPosition({ rowIndex: index, totalRows: this._focusableLists.length });
3130
- this._watchListItems(list);
3131
- });
3163
+ const totalRows = this._focusableLists.length;
3164
+ const listsLength = lists.length;
3165
+ for (let i = 0; i < listsLength; i++) {
3166
+ const list = lists.get(i);
3167
+ if (list) {
3168
+ list._setGridPosition({ rowIndex: i, totalRows });
3169
+ this._watchListItems(list);
3170
+ }
3171
+ }
3132
3172
  });
3133
3173
  this._focusableItems.changes
3134
3174
  .pipe(startWith$1(this._focusableItems), takeUntilDestroyed(this._destroyRef))
@@ -3136,21 +3176,40 @@ class FocusableGridDirective {
3136
3176
  this._handleItemSubscriptions(items.toArray());
3137
3177
  });
3138
3178
  this._focusableLists.changes
3139
- .pipe(startWith$1(this._focusableLists), switchMap((queryList) => merge$1(...queryList.toArray().map((list) => list._gridListFocused$))), takeUntilDestroyed(this._destroyRef))
3179
+ .pipe(startWith$1(this._focusableLists), switchMap$1((queryList) => {
3180
+ const lists = queryList.toArray();
3181
+ return merge$1(...lists.map((list) => list._gridListFocused$));
3182
+ }), takeUntilDestroyed(this._destroyRef))
3140
3183
  .subscribe((focusedEvent) => {
3141
3184
  this.rowFocused.emit(focusedEvent);
3142
- this._focusableLists.forEach((list) => list.setTabbable(false));
3143
- this._focusableLists.forEach((list) => list._setItemsTabbable(false));
3185
+ const lists = this._focusableLists.toArray();
3186
+ const listsLength = lists.length;
3187
+ for (let i = 0; i < listsLength; i++) {
3188
+ const list = lists[i];
3189
+ list.setTabbable(false);
3190
+ list._setItemsTabbable(false);
3191
+ }
3144
3192
  });
3145
3193
  this._focusableLists.changes
3146
- .pipe(startWith$1(this._focusableLists), switchMap((queryList) => merge$1(...queryList.toArray().map((list) => list._gridItemFocused$))), takeUntilDestroyed(this._destroyRef))
3194
+ .pipe(startWith$1(this._focusableLists), switchMap$1((queryList) => {
3195
+ const lists = queryList.toArray();
3196
+ return merge$1(...lists.map((list) => list._gridItemFocused$));
3197
+ }), takeUntilDestroyed(this._destroyRef))
3147
3198
  .subscribe((focusedEvent) => {
3148
3199
  this.itemFocused.emit(focusedEvent);
3149
- this._focusableLists.forEach((list) => list.setTabbable(false));
3150
- this._focusableLists.forEach((list) => list._setItemsTabbable(false));
3200
+ const lists = this._focusableLists.toArray();
3201
+ const listsLength = lists.length;
3202
+ for (let i = 0; i < listsLength; i++) {
3203
+ const list = lists[i];
3204
+ list.setTabbable(false);
3205
+ list._setItemsTabbable(false);
3206
+ }
3151
3207
  });
3152
3208
  this._focusableLists.changes
3153
- .pipe(startWith$1(this._focusableLists), switchMap((queryList) => merge$1(...queryList.toArray().map((list) => list._keydown$))), takeUntilDestroyed(this._destroyRef))
3209
+ .pipe(startWith$1(this._focusableLists), switchMap$1((queryList) => {
3210
+ const lists = queryList.toArray();
3211
+ return merge$1(...lists.map((list) => list._keydown$));
3212
+ }), takeUntilDestroyed(this._destroyRef))
3154
3213
  .subscribe(({ event, list, activeItemIndex }) => this._onKeydown(event, list, activeItemIndex));
3155
3214
  }
3156
3215
  /**
@@ -3174,10 +3233,11 @@ class FocusableGridDirective {
3174
3233
  let nextRowIndex;
3175
3234
  let nextRowItemIndex = activeItemIndex ?? 0;
3176
3235
  let scrollIntoView;
3236
+ const listItemsLength = list._focusableItems().length;
3177
3237
  const isFirstItemLtr = activeItemIndex === 0 && this.contentDirection !== 'rtl';
3178
- const isLastItemRtl = activeItemIndex === list._focusableItems().length - 1 && this.contentDirection === 'rtl';
3238
+ const isLastItemRtl = activeItemIndex === listItemsLength - 1 && this.contentDirection === 'rtl';
3179
3239
  const isFirstItemRtl = activeItemIndex === 0 && this.contentDirection === 'rtl';
3180
- const isLastItemLtr = activeItemIndex === list._focusableItems().length - 1 && this.contentDirection !== 'rtl';
3240
+ const isLastItemLtr = activeItemIndex === listItemsLength - 1 && this.contentDirection !== 'rtl';
3181
3241
  switch (event.keyCode) {
3182
3242
  case UP_ARROW:
3183
3243
  event.preventDefault();
@@ -3236,36 +3296,48 @@ class FocusableGridDirective {
3236
3296
  }
3237
3297
  /** @hidden */
3238
3298
  _handleItemSubscriptions(items) {
3239
- items.forEach((item) => {
3299
+ const itemsLength = items.length;
3300
+ for (let i = 0; i < itemsLength; i++) {
3301
+ const item = items[i];
3240
3302
  if (!(item instanceof FocusableItemDirective) || this._subscribedItems.has(item)) {
3241
- return;
3303
+ continue;
3242
3304
  }
3243
3305
  this._subscribedItems.add(item);
3244
3306
  outputToObservable(item.focusableChildElementFocused)
3245
3307
  .pipe(takeUntilDestroyed(this._destroyRef))
3246
3308
  .subscribe(() => {
3247
- this._focusableLists.forEach((focusableList) => {
3248
- focusableList._focusableItems().forEach((focusableItem) => {
3309
+ const lists = this._focusableLists.toArray();
3310
+ const listsLength = lists.length;
3311
+ for (let j = 0; j < listsLength; j++) {
3312
+ const focusableItems = lists[j]._focusableItems();
3313
+ const focusableItemsLength = focusableItems.length;
3314
+ for (let k = 0; k < focusableItemsLength; k++) {
3315
+ const focusableItem = focusableItems[k];
3249
3316
  focusableItem.setTabbable(false);
3250
3317
  focusableItem.enableTabbableElements();
3251
- });
3252
- });
3318
+ }
3319
+ }
3253
3320
  });
3254
3321
  outputToObservable(item._parentFocusableItemFocused)
3255
3322
  .pipe(takeUntilDestroyed(this._destroyRef))
3256
3323
  .subscribe(() => {
3257
- this._focusableLists.forEach((focusableList) => {
3258
- focusableList._focusableItems().forEach((focusableItem) => {
3324
+ const lists = this._focusableLists.toArray();
3325
+ const listsLength = lists.length;
3326
+ for (let j = 0; j < listsLength; j++) {
3327
+ const focusableItems = lists[j]._focusableItems();
3328
+ const focusableItemsLength = focusableItems.length;
3329
+ for (let k = 0; k < focusableItemsLength; k++) {
3330
+ const focusableItem = focusableItems[k];
3259
3331
  if (item !== focusableItem) {
3260
3332
  focusableItem.disableTabbableElements();
3261
3333
  }
3262
3334
  else {
3263
3335
  focusableItem.enableTabbableElements();
3264
3336
  }
3265
- });
3266
- });
3337
+ }
3338
+ }
3267
3339
  });
3268
- });
3340
+ }
3269
3341
  }
3270
3342
  /** @hidden */
3271
3343
  _watchListItems(list) {
@@ -4438,15 +4510,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
4438
4510
  }] });
4439
4511
 
4440
4512
  class ResizeObserverDirective {
4441
- /** @hidden */
4442
4513
  constructor() {
4443
4514
  /**
4444
4515
  * The reference to the Resize target element.
4445
4516
  **/
4446
4517
  this.elementRef = inject(ElementRef);
4447
- /** @hidden */
4448
- this._resizeObserverService = inject(ResizeObserverService);
4449
- this.resized = this._resizeObserverService.observe(this.elementRef.nativeElement);
4518
+ /**
4519
+ * Observable that emits when the element is resized.
4520
+ * Use this for programmatic subscriptions.
4521
+ **/
4522
+ this.resizeEvents$ = inject(ResizeObserverService).observe(this.elementRef.nativeElement);
4523
+ /**
4524
+ * When the element is resized, emits an array of ResizeObserverEntry objects.
4525
+ **/
4526
+ this.resized = outputFromObservable(this.resizeEvents$);
4450
4527
  }
4451
4528
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: ResizeObserverDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
4452
4529
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.0", type: ResizeObserverDirective, isStandalone: true, selector: "[fdkResizeObserver]", outputs: { resized: "resized" }, exportAs: ["fdkResizeObserver"], ngImport: i0 }); }
@@ -4455,12 +4532,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
4455
4532
  type: Directive,
4456
4533
  args: [{
4457
4534
  selector: '[fdkResizeObserver]',
4458
- exportAs: 'fdkResizeObserver',
4459
- standalone: true
4535
+ exportAs: 'fdkResizeObserver'
4460
4536
  }]
4461
- }], ctorParameters: () => [], propDecorators: { resized: [{
4462
- type: Output
4463
- }] } });
4537
+ }], propDecorators: { resized: [{ type: i0.Output, args: ["resized"] }] } });
4464
4538
 
4465
4539
  class ResizeHandleDirective {
4466
4540
  /** @hidden */
@@ -4793,7 +4867,7 @@ class SelectionService {
4793
4867
  const unsubscribe$ = merge$1(destroyObservable(this._destroyRef), this._clear$);
4794
4868
  if (this._items$) {
4795
4869
  this._items$
4796
- .pipe(map((items) => items.filter((itm) => itm.fdkSelectableItem !== false)), switchMap((items) => {
4870
+ .pipe(map((items) => items.filter((itm) => itm.fdkSelectableItem !== false)), switchMap$1((items) => {
4797
4871
  const clickedEvents$ = items.map((item) => item.clicked.pipe(map(() => item)));
4798
4872
  return merge$1(...clickedEvents$);
4799
4873
  }), tap((clickedItem) => this._itemClicked(clickedItem)), takeUntil(unsubscribe$))
@@ -5094,27 +5168,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
5094
5168
  }] });
5095
5169
 
5096
5170
  class TemplateDirective {
5097
- /** @hidden */
5098
- constructor(templateRef) {
5099
- this.templateRef = templateRef;
5171
+ constructor() {
5172
+ /** Name of the template */
5173
+ this.name = input('', { ...(ngDevMode ? { debugName: "name" } : {}), alias: 'fdkTemplate' });
5174
+ /** @hidden */
5175
+ this.templateRef = inject(TemplateRef);
5100
5176
  }
5101
5177
  /** @hidden */
5102
5178
  getName() {
5103
- return this.name;
5179
+ return this.name();
5104
5180
  }
5105
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: TemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
5106
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.0", type: TemplateDirective, isStandalone: true, selector: "[fdkTemplate]", inputs: { name: ["fdkTemplate", "name"] }, ngImport: i0 }); }
5181
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: TemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
5182
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.0", type: TemplateDirective, isStandalone: true, selector: "[fdkTemplate]", inputs: { name: { classPropertyName: "name", publicName: "fdkTemplate", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
5107
5183
  }
5108
5184
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: TemplateDirective, decorators: [{
5109
5185
  type: Directive,
5110
5186
  args: [{
5111
- selector: '[fdkTemplate]',
5112
- standalone: true
5187
+ selector: '[fdkTemplate]'
5113
5188
  }]
5114
- }], ctorParameters: () => [{ type: i0.TemplateRef }], propDecorators: { name: [{
5115
- type: Input,
5116
- args: ['fdkTemplate']
5117
- }] } });
5189
+ }], propDecorators: { name: [{ type: i0.Input, args: [{ isSignal: true, alias: "fdkTemplate", required: false }] }] } });
5118
5190
 
5119
5191
  /**
5120
5192
  * @deprecated
@@ -5133,62 +5205,61 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
5133
5205
  }]
5134
5206
  }] });
5135
5207
 
5208
+ const DEFAULT_TRUNCATE_WIDTH = 200;
5136
5209
  class TruncateDirective {
5137
5210
  /**
5138
- * Width in pixel for truncation of an element , by default
5211
+ * Root native element
5139
5212
  */
5140
- set fdkTruncateWidth(value) {
5141
- this._customWidthCount = coerceNumberProperty(value);
5213
+ get rootElement() {
5214
+ return this._elementRef.nativeElement;
5142
5215
  }
5143
5216
  /** @hidden */
5144
- constructor(_elementRef) {
5145
- this._elementRef = _elementRef;
5217
+ constructor() {
5218
+ /**
5219
+ * Width in pixel for truncation of an element, by default 200
5220
+ */
5221
+ this.fdkTruncateWidth = input(DEFAULT_TRUNCATE_WIDTH, { ...(ngDevMode ? { debugName: "fdkTruncateWidth" } : {}), transform: numberAttribute });
5146
5222
  /**
5147
5223
  * Truncating state
5148
5224
  */
5149
- this.fdkTruncateState = false;
5225
+ this.fdkTruncateState = input(false, ...(ngDevMode ? [{ debugName: "fdkTruncateState" }] : []));
5150
5226
  /** @hidden */
5151
- this._customWidthCount = 200;
5227
+ this._elementRef = inject(ElementRef);
5152
5228
  /** @hidden */
5153
- this.takeDefaultStyleOnce = true;
5154
- }
5155
- /**
5156
- * Root native element
5157
- */
5158
- get rootElement() {
5159
- return this._elementRef.nativeElement;
5229
+ this._defaultStyleCaptured = false;
5230
+ effect(() => {
5231
+ const state = this.fdkTruncateState();
5232
+ const width = this.fdkTruncateWidth();
5233
+ untracked(() => this._truncate(state, width));
5234
+ });
5160
5235
  }
5161
5236
  /**
5162
5237
  * Method saves default style of target element before first truncate.
5163
5238
  */
5164
5239
  setDefaultStyle() {
5165
- if (this.takeDefaultStyleOnce) {
5240
+ if (!this._defaultStyleCaptured) {
5166
5241
  this._defaultStyle = this._truncateTarget.style.cssText;
5167
- this.takeDefaultStyleOnce = false;
5242
+ this._defaultStyleCaptured = true;
5168
5243
  }
5169
5244
  }
5170
5245
  /** @hidden */
5171
5246
  ngAfterViewInit() {
5172
5247
  if (this.rootElement) {
5173
- this._truncate();
5248
+ this._truncate(this.fdkTruncateState(), this.fdkTruncateWidth());
5174
5249
  }
5175
5250
  }
5176
5251
  /** @hidden */
5177
- ngOnChanges() {
5178
- this._truncate();
5179
- }
5180
- /** @hidden */
5181
- _truncate() {
5252
+ _truncate(state, width) {
5182
5253
  this._truncateTarget = this.rootElement;
5183
5254
  if (!this._truncateTarget) {
5184
5255
  return;
5185
5256
  }
5186
5257
  this.setDefaultStyle();
5187
- this._truncationStyle = `${this._defaultStyle} max-width: ${this._customWidthCount}px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;`;
5188
- this._truncateTarget.style.cssText = this.fdkTruncateState ? this._truncationStyle : this._defaultStyle;
5258
+ const truncationStyle = `${this._defaultStyle} max-width: ${width}px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;`;
5259
+ this._truncateTarget.style.cssText = state ? truncationStyle : this._defaultStyle;
5189
5260
  }
5190
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: TruncateDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
5191
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.0", type: TruncateDirective, isStandalone: true, selector: "[fdkTruncate]", inputs: { fdkTruncateWidth: "fdkTruncateWidth", fdkTruncateState: "fdkTruncateState" }, usesOnChanges: true, ngImport: i0 }); }
5261
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: TruncateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
5262
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.0", type: TruncateDirective, isStandalone: true, selector: "[fdkTruncate]", inputs: { fdkTruncateWidth: { classPropertyName: "fdkTruncateWidth", publicName: "fdkTruncateWidth", isSignal: true, isRequired: false, transformFunction: null }, fdkTruncateState: { classPropertyName: "fdkTruncateState", publicName: "fdkTruncateState", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
5192
5263
  }
5193
5264
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: TruncateDirective, decorators: [{
5194
5265
  type: Directive,
@@ -5196,11 +5267,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
5196
5267
  selector: '[fdkTruncate]',
5197
5268
  standalone: true
5198
5269
  }]
5199
- }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { fdkTruncateWidth: [{
5200
- type: Input
5201
- }], fdkTruncateState: [{
5202
- type: Input
5203
- }] } });
5270
+ }], ctorParameters: () => [], propDecorators: { fdkTruncateWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "fdkTruncateWidth", required: false }] }], fdkTruncateState: [{ type: i0.Input, args: [{ isSignal: true, alias: "fdkTruncateState", required: false }] }] } });
5204
5271
  class TruncatedTitleDirective {
5205
5272
  /** @hidden */
5206
5273
  constructor(_elRef) {