@skyux/ag-grid 13.16.0 → 13.16.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.
@@ -7,7 +7,7 @@ import { SkyLibResourcesService, SkyI18nModule } from '@skyux/i18n';
7
7
  import { toSignal, toObservable, takeUntilDestroyed } from '@angular/core/rxjs-interop';
8
8
  import * as i1 from '@skyux/core';
9
9
  import { SkyMutationObserverService, SkyIdModule, SkyViewkeeperModule, SkyMediaQueryService, SkyResizeObserverService, SkyAffixModule, SkyOverlayService, SkyScrollableHostService, SKY_STACKING_CONTEXT, SkyNumericModule, SkyDynamicComponentService, SkyDynamicComponentLocation, SkyLogService } from '@skyux/core';
10
- import { SkyDataManagerService } from '@skyux/data-manager';
10
+ import { SkyDataManagerService, SkyDataManagerState, SkyDataViewState } from '@skyux/data-manager';
11
11
  import { Subject, BehaviorSubject, ReplaySubject, takeUntil, combineLatest, distinctUntilChanged, of, take, map, switchMap, filter, fromEvent, Subscription, merge, startWith, scan, first, fromEventPattern, isObservable, observeOn, asyncScheduler } from 'rxjs';
12
12
  import * as i2$4 from '@skyux/theme';
13
13
  import { SkyThemeService, SkyThemeModule } from '@skyux/theme';
@@ -894,7 +894,7 @@ class SkyAgGridDataManagerAdapterDirective {
894
894
  const viewConfig = this.#viewConfig();
895
895
  if (viewConfig && this.#currentDataState) {
896
896
  const row = event.node;
897
- const selectedIds = this.#currentDataState.selectedIds || [];
897
+ const selectedIds = [...(this.#currentDataState.selectedIds || [])];
898
898
  const rowIndex = selectedIds.indexOf(row.data.id);
899
899
  if (row.isSelected() && rowIndex === -1) {
900
900
  selectedIds.push(row.data.id);
@@ -902,8 +902,10 @@ class SkyAgGridDataManagerAdapterDirective {
902
902
  else if (!row.isSelected() && rowIndex !== -1) {
903
903
  selectedIds.splice(rowIndex, 1);
904
904
  }
905
- this.#currentDataState.selectedIds = selectedIds;
906
- this.#dataManagerSvc.updateDataState(this.#currentDataState, viewConfig.id);
905
+ const newState = new SkyDataManagerState(this.#currentDataState.getStateOptions());
906
+ newState.selectedIds = selectedIds;
907
+ this.#currentDataState = newState;
908
+ this.#dataManagerSvc.updateDataState(newState, viewConfig.id);
907
909
  this.#changeDetector.markForCheck();
908
910
  }
909
911
  });
@@ -913,9 +915,10 @@ class SkyAgGridDataManagerAdapterDirective {
913
915
  const activeSortColumnState = gridColumnStates?.find((aGridColumnState) => aGridColumnState.sortIndex === 0) ??
914
916
  gridColumnStates?.find((aGridColumnState) => aGridColumnState.sort);
915
917
  if (viewConfig && this.#currentDataState) {
918
+ const newState = new SkyDataManagerState(this.#currentDataState.getStateOptions());
916
919
  if (activeSortColumnState) {
917
920
  const activeSortColumnDef = agGrid.api.getColumnDef(activeSortColumnState.colId);
918
- this.#currentDataState.activeSortOption = {
921
+ newState.activeSortOption = {
919
922
  descending: activeSortColumnState.sort === 'desc',
920
923
  id: activeSortColumnState.colId,
921
924
  propertyName: activeSortColumnDef?.field || '',
@@ -923,9 +926,10 @@ class SkyAgGridDataManagerAdapterDirective {
923
926
  };
924
927
  }
925
928
  else {
926
- this.#currentDataState.activeSortOption = undefined;
929
+ newState.activeSortOption = undefined;
927
930
  }
928
- this.#dataManagerSvc.updateDataState(this.#currentDataState, viewConfig.id);
931
+ this.#currentDataState = newState;
932
+ this.#dataManagerSvc.updateDataState(newState, viewConfig.id);
929
933
  }
930
934
  });
931
935
  }
@@ -938,8 +942,11 @@ class SkyAgGridDataManagerAdapterDirective {
938
942
  if (viewState &&
939
943
  (viewState.displayedColumnIds.length !== columnOrder.length ||
940
944
  viewState.displayedColumnIds.some((col, i) => col !== columnOrder[i]))) {
941
- viewState.displayedColumnIds = columnOrder;
942
- this.#dataManagerSvc.updateDataState(this.#currentDataState.addOrUpdateView(viewConfig.id, viewState), viewConfig.id);
945
+ const updatedViewState = new SkyDataViewState(viewState.getViewStateOptions());
946
+ updatedViewState.displayedColumnIds = columnOrder;
947
+ const newDataState = this.#currentDataState.addOrUpdateView(viewConfig.id, updatedViewState);
948
+ this.#currentDataState = newDataState;
949
+ this.#dataManagerSvc.updateDataState(newDataState, viewConfig.id);
943
950
  }
944
951
  }
945
952
  }
@@ -993,23 +1000,26 @@ class SkyAgGridDataManagerAdapterDirective {
993
1000
  const viewId = this.viewId();
994
1001
  const viewState = viewId && this.#currentDataState?.getViewStateById(viewId);
995
1002
  if (viewState && viewId && this.#currentDataState) {
996
- const currentWidths = viewState?.columnWidths;
997
- currentWidths[toColumnWidthName(breakpoint)][colId] = width;
998
- viewState.columnWidths = currentWidths;
999
- this.#dataManagerSvc.updateDataState(this.#currentDataState.addOrUpdateView(viewId, viewState), viewId);
1003
+ const updatedViewState = new SkyDataViewState(viewState.getViewStateOptions());
1004
+ updatedViewState.columnWidths[toColumnWidthName(breakpoint)][colId] =
1005
+ width;
1006
+ const newDataState = this.#currentDataState.addOrUpdateView(viewId, updatedViewState);
1007
+ this.#currentDataState = newDataState;
1008
+ this.#dataManagerSvc.updateDataState(newDataState, viewId);
1000
1009
  }
1001
1010
  }
1002
1011
  #removeColumnWidths(colIds) {
1003
1012
  const viewId = this.viewId();
1004
1013
  const viewState = viewId && this.#currentDataState?.getViewStateById(viewId);
1005
1014
  if (viewState && viewId && this.#currentDataState) {
1006
- const currentWidths = viewState?.columnWidths;
1015
+ const updatedViewState = new SkyDataViewState(viewState.getViewStateOptions());
1007
1016
  for (const colId of colIds) {
1008
- delete currentWidths['xs'][colId];
1009
- delete currentWidths['sm'][colId];
1017
+ delete updatedViewState.columnWidths['xs'][colId];
1018
+ delete updatedViewState.columnWidths['sm'][colId];
1010
1019
  }
1011
- viewState.columnWidths = currentWidths;
1012
- this.#dataManagerSvc.updateDataState(this.#currentDataState.addOrUpdateView(viewId, viewState), viewId);
1020
+ const newDataState = this.#currentDataState.addOrUpdateView(viewId, updatedViewState);
1021
+ this.#currentDataState = newDataState;
1022
+ this.#dataManagerSvc.updateDataState(newDataState, viewId);
1013
1023
  }
1014
1024
  }
1015
1025
  #applyColumnWidths(breakpoint) {