@fundamental-ngx/platform 0.64.2-rc.4 → 0.64.2-rc.41

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.
@@ -740,6 +740,8 @@ class TableColumnResizeService {
740
740
  this._rtlService = inject(RtlService, {
741
741
  optional: true
742
742
  });
743
+ /** @hidden */
744
+ this._ngZone = inject(NgZone, { optional: true });
743
745
  this._tableScrollDispatcherService
744
746
  ?.horizontallyScrolled()
745
747
  .pipe(takeUntilDestroyed(this._destroyed))
@@ -937,7 +939,7 @@ class TableColumnResizeService {
937
939
  }
938
940
  /** Update column resizer position. */
939
941
  _updateResizerPositionOnMouseMove() {
940
- this._resizerMoveSubscription = fromEvent(document, 'mousemove')
942
+ const setupMouseMove = () => fromEvent(document, 'mousemove')
941
943
  .pipe(debounceTime(10))
942
944
  .subscribe((event) => {
943
945
  const clientStartX = this._clientStartX ?? 0;
@@ -945,6 +947,9 @@ class TableColumnResizeService {
945
947
  this._resizerPosition = (this._startX ?? 0) + diffX;
946
948
  this.resizerPosition$.next(this.resizerPosition);
947
949
  });
950
+ this._resizerMoveSubscription = this._ngZone
951
+ ? this._ngZone.runOutsideAngular(setupMouseMove)
952
+ : setupMouseMove();
948
953
  }
949
954
  /**
950
955
  * Check if the header text length goes over the column width. In such case applies text truncation with
@@ -989,7 +994,7 @@ class PlatformTableCellResizableDirective extends TableCellDirective {
989
994
  optional: true
990
995
  });
991
996
  /** @hidden */
992
- this._zone = inject(NgZone);
997
+ this._ngZone = inject(NgZone, { optional: true });
993
998
  }
994
999
  /** First column can be resized only by its end */
995
1000
  set resizableSide(value) {
@@ -1000,17 +1005,23 @@ class PlatformTableCellResizableDirective extends TableCellDirective {
1000
1005
  }
1001
1006
  /** @hidden */
1002
1007
  ngOnInit() {
1003
- this._zone.runOutsideAngular(() => {
1008
+ const setupMouseMove = () => {
1004
1009
  fromEvent(this.elementRef.nativeElement, 'mousemove')
1005
1010
  .pipe(filter(() => this._tableColumnResizeService?.resizeInProgress !== true), debounceTime(5), map((event) => this._getResizer(event) || { resizerPosition: 0, resizedColumn: this.columnName }), takeUntilDestroyed(this._destroyRef))
1006
1011
  .subscribe((data) => {
1007
1012
  this._tableColumnResizeService.setInitialResizerPosition(data.resizerPosition, data.resizedColumn);
1008
1013
  });
1009
- fromEvent(this.elementRef.nativeElement, 'focus')
1010
- .pipe(takeUntilDestroyed(this._destroyRef))
1011
- .subscribe(() => {
1012
- this._tableColumnResizeService.setInitialResizerPosition(0, this.columnName);
1013
- });
1014
+ };
1015
+ if (this._ngZone) {
1016
+ this._ngZone.runOutsideAngular(setupMouseMove);
1017
+ }
1018
+ else {
1019
+ setupMouseMove();
1020
+ }
1021
+ fromEvent(this.elementRef.nativeElement, 'focus')
1022
+ .pipe(takeUntilDestroyed(this._destroyRef))
1023
+ .subscribe(() => {
1024
+ this._tableColumnResizeService.setInitialResizerPosition(0, this.columnName);
1014
1025
  });
1015
1026
  }
1016
1027
  /** @hidden */
@@ -3265,8 +3276,6 @@ class TableHeaderResizerDirective {
3265
3276
  /** @hidden */
3266
3277
  this._tableRowService = inject(TableRowService);
3267
3278
  /** @hidden */
3268
- this._zone = inject(NgZone);
3269
- /** @hidden */
3270
3279
  this._document = inject(DOCUMENT);
3271
3280
  }
3272
3281
  /** @hidden */
@@ -3275,42 +3284,40 @@ class TableHeaderResizerDirective {
3275
3284
  }
3276
3285
  /** @hidden */
3277
3286
  ngOnInit() {
3278
- this._zone.runOutsideAngular(() => {
3279
- fromEvent(this._elmRef.nativeElement, 'keydown')
3280
- .pipe(takeUntilDestroyed(this._destroyRef))
3281
- .subscribe((event) => {
3282
- if ((KeyUtil.isKeyCode(event, LEFT_ARROW) ||
3283
- (this._isRtl() && KeyUtil.isKeyCode(event, RIGHT_ARROW))) &&
3284
- event.shiftKey &&
3285
- this._headerCellFocused) {
3286
- this._tableColumnResizeService._processResize(-32);
3287
- event.preventDefault();
3288
- event.stopImmediatePropagation();
3289
- }
3290
- else if ((KeyUtil.isKeyCode(event, RIGHT_ARROW) ||
3291
- (this._isRtl() && KeyUtil.isKeyCode(event, LEFT_ARROW))) &&
3292
- event.shiftKey &&
3293
- this._headerCellFocused) {
3294
- this._tableColumnResizeService._processResize(32);
3295
- event.preventDefault();
3296
- event.stopImmediatePropagation();
3297
- }
3298
- });
3299
- fromEvent(this._elmRef.nativeElement, 'focusin')
3300
- .pipe(takeUntilDestroyed(this._destroyRef))
3301
- .subscribe(() => {
3302
- if (!this._focusinTimerId) {
3303
- return;
3304
- }
3305
- clearTimeout(this._focusinTimerId);
3306
- this._focusinTimerId = null;
3307
- });
3308
- fromEvent(this._elmRef.nativeElement, 'focusout')
3309
- .pipe(takeUntilDestroyed(this._destroyRef))
3310
- .subscribe(() => {
3311
- this._focusinTimerId = setTimeout(() => {
3312
- this.focusedCellPosition = null;
3313
- });
3287
+ fromEvent(this._elmRef.nativeElement, 'keydown')
3288
+ .pipe(takeUntilDestroyed(this._destroyRef))
3289
+ .subscribe((event) => {
3290
+ if ((KeyUtil.isKeyCode(event, LEFT_ARROW) ||
3291
+ (this._isRtl() && KeyUtil.isKeyCode(event, RIGHT_ARROW))) &&
3292
+ event.shiftKey &&
3293
+ this._headerCellFocused) {
3294
+ this._tableColumnResizeService._processResize(-32);
3295
+ event.preventDefault();
3296
+ event.stopImmediatePropagation();
3297
+ }
3298
+ else if ((KeyUtil.isKeyCode(event, RIGHT_ARROW) ||
3299
+ (this._isRtl() && KeyUtil.isKeyCode(event, LEFT_ARROW))) &&
3300
+ event.shiftKey &&
3301
+ this._headerCellFocused) {
3302
+ this._tableColumnResizeService._processResize(32);
3303
+ event.preventDefault();
3304
+ event.stopImmediatePropagation();
3305
+ }
3306
+ });
3307
+ fromEvent(this._elmRef.nativeElement, 'focusin')
3308
+ .pipe(takeUntilDestroyed(this._destroyRef))
3309
+ .subscribe(() => {
3310
+ if (!this._focusinTimerId) {
3311
+ return;
3312
+ }
3313
+ clearTimeout(this._focusinTimerId);
3314
+ this._focusinTimerId = null;
3315
+ });
3316
+ fromEvent(this._elmRef.nativeElement, 'focusout')
3317
+ .pipe(takeUntilDestroyed(this._destroyRef))
3318
+ .subscribe(() => {
3319
+ this._focusinTimerId = setTimeout(() => {
3320
+ this.focusedCellPosition = null;
3314
3321
  });
3315
3322
  });
3316
3323
  this._tableRowService.cellFocused$.subscribe((evt) => {
@@ -3376,6 +3383,14 @@ class TableInitialStateDirective extends TableInitialState {
3376
3383
  this.initialPage = 1;
3377
3384
  /** @hidden */
3378
3385
  this._tableService = inject(TableService);
3386
+ /** @hidden Snapshot of initialSortBy captured on first setInitialState() call */
3387
+ this._initialSortBySnapshot = [];
3388
+ /** @hidden Snapshot of initialFilterBy captured on first setInitialState() call */
3389
+ this._initialFilterBySnapshot = [];
3390
+ /** @hidden Snapshot of initialGroupBy captured on first setInitialState() call */
3391
+ this._initialGroupBySnapshot = [];
3392
+ /** @hidden */
3393
+ this._initialStateApplied = false;
3379
3394
  }
3380
3395
  /**
3381
3396
  * Initial state of table.
@@ -3407,6 +3422,13 @@ class TableInitialStateDirective extends TableInitialState {
3407
3422
  : directiveInitialPage;
3408
3423
  const initialPageSize = (this._table._loadPreviousPages ? directiveInitialPage : initialPage) *
3409
3424
  (this._table.pageSize || page.pageSize);
3425
+ // Capture the initial state values on first call only
3426
+ if (!this._initialStateApplied) {
3427
+ this._initialSortBySnapshot = this.initialSortBy ? [...this.initialSortBy] : [];
3428
+ this._initialFilterBySnapshot = this.initialFilterBy ? [...this.initialFilterBy] : [];
3429
+ this._initialGroupBySnapshot = this.initialGroupBy ? [...this.initialGroupBy] : [];
3430
+ this._initialStateApplied = true;
3431
+ }
3410
3432
  this.setTableState({
3411
3433
  ...prevState,
3412
3434
  columns: visibleColumns,
@@ -3430,6 +3452,18 @@ class TableInitialStateDirective extends TableInitialState {
3430
3452
  setTableState(state) {
3431
3453
  this._tableService.setTableState(state);
3432
3454
  }
3455
+ /** Returns the initial sort state snapshot captured when setInitialState() was first called. */
3456
+ getInitialSortBySnapshot() {
3457
+ return this._initialSortBySnapshot;
3458
+ }
3459
+ /** Returns the initial filter state snapshot captured when setInitialState() was first called. */
3460
+ getInitialFilterBySnapshot() {
3461
+ return this._initialFilterBySnapshot;
3462
+ }
3463
+ /** Returns the initial group state snapshot captured when setInitialState() was first called. */
3464
+ getInitialGroupBySnapshot() {
3465
+ return this._initialGroupBySnapshot;
3466
+ }
3433
3467
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: TableInitialStateDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
3434
3468
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.5", type: TableInitialStateDirective, isStandalone: true, selector: "[fdpTableInitialState],\n fdp-table", inputs: { initialVisibleColumns: "initialVisibleColumns", initialSortBy: "initialSortBy", initialFilterBy: "initialFilterBy", initialGroupBy: "initialGroupBy", initialPage: "initialPage", state: "state" }, providers: [
3435
3469
  {
@@ -3475,10 +3509,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
3475
3509
  */
3476
3510
  class TableScrollableDirective {
3477
3511
  /** @hidden */
3478
- constructor(elementRef, scrollDispatcher, ngZone) {
3512
+ constructor(elementRef, scrollDispatcher) {
3479
3513
  this.elementRef = elementRef;
3480
3514
  this.scrollDispatcher = scrollDispatcher;
3481
- this.ngZone = ngZone;
3482
3515
  /** @hidden */
3483
3516
  this._skipEvent = false;
3484
3517
  /** @hidden */
@@ -3489,9 +3522,12 @@ class TableScrollableDirective {
3489
3522
  this._destroyRef = inject(DestroyRef);
3490
3523
  /** @hidden */
3491
3524
  this._document = inject(DOCUMENT);
3525
+ /** @hidden */
3526
+ this._ngZone = inject(NgZone, { optional: true });
3492
3527
  /** Scroll events stream */
3493
3528
  this._elementScrollStream = new Observable((observer) => {
3494
- const subscription = this.ngZone.runOutsideAngular(() => fromEvent(this.elementRef.nativeElement, 'scroll').subscribe(observer));
3529
+ const subscribeToScroll = () => fromEvent(this.elementRef.nativeElement, 'scroll').subscribe(observer);
3530
+ const subscription = this._ngZone ? this._ngZone.runOutsideAngular(subscribeToScroll) : subscribeToScroll();
3495
3531
  return () => subscription.unsubscribe();
3496
3532
  }).pipe(filter(() => {
3497
3533
  if (this._skipEvent) {
@@ -3597,13 +3633,19 @@ class TableScrollableDirective {
3597
3633
  }
3598
3634
  /** Set Scroll Position during component initialization. */
3599
3635
  initializeScrollTop(scrollTop) {
3600
- this.ngZone.runOutsideAngular(() => {
3636
+ const setScrollTimeout = () => {
3601
3637
  setTimeout(() => {
3602
3638
  this.setScrollTop(scrollTop, false);
3603
3639
  });
3604
- });
3640
+ };
3641
+ if (this._ngZone) {
3642
+ this._ngZone.runOutsideAngular(setScrollTimeout);
3643
+ }
3644
+ else {
3645
+ setScrollTimeout();
3646
+ }
3605
3647
  }
3606
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: TableScrollableDirective, deps: [{ token: i0.ElementRef }, { token: TableScrollDispatcherService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive }); }
3648
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: TableScrollableDirective, deps: [{ token: i0.ElementRef }, { token: TableScrollDispatcherService }], target: i0.ɵɵFactoryTarget.Directive }); }
3607
3649
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.5", type: TableScrollableDirective, isStandalone: true, selector: "[fdpTableScrollable]", providers: [{ provide: TABLE_SCROLLABLE, useExisting: forwardRef(() => TableScrollableDirective) }], exportAs: ["tableScrollable"], ngImport: i0 }); }
3608
3650
  }
3609
3651
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: TableScrollableDirective, decorators: [{
@@ -3614,7 +3656,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
3614
3656
  standalone: true,
3615
3657
  providers: [{ provide: TABLE_SCROLLABLE, useExisting: forwardRef(() => TableScrollableDirective) }]
3616
3658
  }]
3617
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: TableScrollDispatcherService }, { type: i0.NgZone }] });
3659
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: TableScrollDispatcherService }] });
3618
3660
 
3619
3661
  class FdpViewSettingsFilterCustomDef {
3620
3662
  /** @hidden */