@fundamental-ngx/cdk 0.61.2-rc.8 → 0.61.2

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