@slickgrid-universal/vanilla-bundle 5.11.0 → 5.12.0

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.
@@ -29,10 +29,13 @@ class SlickVanillaGridBundle {
29
29
  set dataset(newDataset) {
30
30
  const prevDatasetLn = this._currentDatasetLength;
31
31
  const isDatasetEqual = (0, lite_1.dequal)(newDataset, this.dataset || []);
32
- const isDeepCopyDataOnPageLoadEnabled = !!(this._gridOptions?.enableDeepCopyDatasetOnPageLoad);
32
+ const isDeepCopyDataOnPageLoadEnabled = !!this._gridOptions?.enableDeepCopyDatasetOnPageLoad;
33
33
  let data = isDeepCopyDataOnPageLoadEnabled ? (0, utils_1.extend)(true, [], newDataset) : newDataset;
34
34
  // when Tree Data is enabled and we don't yet have the hierarchical dataset filled, we can force a convert+sort of the array
35
- if (this.slickGrid && this.gridOptions?.enableTreeData && Array.isArray(newDataset) && (newDataset.length > 0 || newDataset.length !== prevDatasetLn || !isDatasetEqual)) {
35
+ if (this.slickGrid &&
36
+ this.gridOptions?.enableTreeData &&
37
+ Array.isArray(newDataset) &&
38
+ (newDataset.length > 0 || newDataset.length !== prevDatasetLn || !isDatasetEqual)) {
36
39
  this._isDatasetHierarchicalInitialized = false;
37
40
  data = this.sortTreeDataset(newDataset, !isDatasetEqual); // if dataset changed, then force a refresh anyway
38
41
  }
@@ -85,7 +88,7 @@ class SlickVanillaGridBundle {
85
88
  // if we already have grid options, when grid was already initialized, we'll merge with those options
86
89
  // else we'll merge with global grid options
87
90
  if (this.slickGrid?.getOptions) {
88
- mergedOptions = ((0, utils_1.extend)(true, {}, this.slickGrid.getOptions(), options));
91
+ mergedOptions = (0, utils_1.extend)(true, {}, this.slickGrid.getOptions(), options);
89
92
  }
90
93
  else {
91
94
  mergedOptions = this.mergeGridOptions(options);
@@ -170,7 +173,7 @@ class SlickVanillaGridBundle {
170
173
  gridParentContainerElm.appendChild(this._gridContainerElm);
171
174
  // check if the user wants to hide the header row from the start
172
175
  // we only want to do this check once in the constructor
173
- this._hideHeaderRowAfterPageLoad = (options?.showHeaderRow === false);
176
+ this._hideHeaderRowAfterPageLoad = options?.showHeaderRow === false;
174
177
  this._columnDefinitions = columnDefs || [];
175
178
  if (this._columnDefinitions.length > 0) {
176
179
  this.copyColumnWidthsReference(this._columnDefinitions);
@@ -179,7 +182,7 @@ class SlickVanillaGridBundle {
179
182
  // since a deep copy of grid options would lose original resource refs but we want to keep them as singleton
180
183
  this._registeredResources = options?.externalResources || [];
181
184
  this._gridOptions = this.mergeGridOptions(options || {});
182
- const isDeepCopyDataOnPageLoadEnabled = !!(this._gridOptions?.enableDeepCopyDatasetOnPageLoad);
185
+ const isDeepCopyDataOnPageLoadEnabled = !!this._gridOptions?.enableDeepCopyDatasetOnPageLoad;
183
186
  // add dark mode CSS class when enabled
184
187
  if (this._gridOptions.darkMode) {
185
188
  this.setDarkMode(true);
@@ -195,19 +198,28 @@ class SlickVanillaGridBundle {
195
198
  this.gridEventService = services?.gridEventService ?? new common_1.GridEventService();
196
199
  this.sharedService = services?.sharedService ?? new common_1.SharedService();
197
200
  this.collectionService = services?.collectionService ?? new common_1.CollectionService(this.translaterService);
198
- this.extensionUtility = services?.extensionUtility ?? new common_1.ExtensionUtility(this.sharedService, this.backendUtilityService, this.translaterService);
201
+ this.extensionUtility =
202
+ services?.extensionUtility ?? new common_1.ExtensionUtility(this.sharedService, this.backendUtilityService, this.translaterService);
199
203
  this.filterFactory = new common_1.FilterFactory(slickgridConfig, this.translaterService, this.collectionService);
204
+ // prettier-ignore
200
205
  this.filterService = services?.filterService ?? new common_1.FilterService(this.filterFactory, this._eventPubSubService, this.sharedService, this.backendUtilityService);
201
206
  this.resizerService = services?.resizerService ?? new common_1.ResizerService(this._eventPubSubService);
207
+ // prettier-ignore
202
208
  this.sortService = services?.sortService ?? new common_1.SortService(this.collectionService, this.sharedService, this._eventPubSubService, this.backendUtilityService);
203
209
  this.treeDataService = services?.treeDataService ?? new common_1.TreeDataService(this._eventPubSubService, this.sharedService, this.sortService);
210
+ // prettier-ignore
204
211
  this.paginationService = services?.paginationService ?? new common_1.PaginationService(this._eventPubSubService, this.sharedService, this.backendUtilityService);
205
- this.extensionService = services?.extensionService ?? new common_1.ExtensionService(this.extensionUtility, this.filterService, this._eventPubSubService, this.sharedService, this.sortService, this.treeDataService, this.translaterService, () => this.gridService);
212
+ this.extensionService =
213
+ services?.extensionService ??
214
+ new common_1.ExtensionService(this.extensionUtility, this.filterService, this._eventPubSubService, this.sharedService, this.sortService, this.treeDataService, this.translaterService, () => this.gridService);
215
+ // prettier-ignore
206
216
  this.gridStateService = services?.gridStateService ?? new common_1.GridStateService(this.extensionService, this.filterService, this._eventPubSubService, this.sharedService, this.sortService, this.treeDataService);
217
+ // prettier-ignore
207
218
  this.gridService = services?.gridService ?? new common_1.GridService(this.gridStateService, this.filterService, this._eventPubSubService, this.paginationService, this.sharedService, this.sortService, this.treeDataService);
208
219
  this.headerGroupingService = services?.headerGroupingService ?? new common_1.HeaderGroupingService(this.extensionUtility);
209
220
  if (hierarchicalDataset) {
210
- this.sharedService.hierarchicalDataset = (isDeepCopyDataOnPageLoadEnabled ? (0, utils_1.extend)(true, [], hierarchicalDataset) : hierarchicalDataset) || [];
221
+ this.sharedService.hierarchicalDataset =
222
+ (isDeepCopyDataOnPageLoadEnabled ? (0, utils_1.extend)(true, [], hierarchicalDataset) : hierarchicalDataset) || [];
211
223
  }
212
224
  const eventHandler = new common_1.SlickEventHandler();
213
225
  // register all service instances in the container
@@ -289,7 +301,7 @@ class SlickVanillaGridBundle {
289
301
  if (shouldEmptyDomElementContainer) {
290
302
  this.emptyGridContainerElm();
291
303
  }
292
- this._collectionObservers.forEach(obs => obs?.disconnect());
304
+ this._collectionObservers.forEach((obs) => obs?.disconnect());
293
305
  this._eventPubSubService?.dispose();
294
306
  this._slickerGridInstances = null;
295
307
  }
@@ -306,7 +318,10 @@ class SlickVanillaGridBundle {
306
318
  }
307
319
  initialization(gridContainerElm, eventHandler, inputDataset) {
308
320
  // when detecting a frozen grid, we'll automatically enable the mousewheel scroll handler so that we can scroll from both left/right frozen containers
309
- if (this.gridOptions && ((this.gridOptions.frozenRow !== undefined && this.gridOptions.frozenRow >= 0) || this.gridOptions.frozenColumn !== undefined && this.gridOptions.frozenColumn >= 0) && this.gridOptions.enableMouseWheelScrollHandler === undefined) {
321
+ if (this.gridOptions &&
322
+ ((this.gridOptions.frozenRow !== undefined && this.gridOptions.frozenRow >= 0) ||
323
+ (this.gridOptions.frozenColumn !== undefined && this.gridOptions.frozenColumn >= 0)) &&
324
+ this.gridOptions.enableMouseWheelScrollHandler === undefined) {
310
325
  this.gridOptions.enableMouseWheelScrollHandler = true;
311
326
  }
312
327
  // create the slickgrid container and add it to the user's grid container
@@ -503,7 +518,10 @@ class SlickVanillaGridBundle {
503
518
  // using copy extend to do a deep clone has an unwanted side on objects and pageSizes but ES6 spread has other worst side effects
504
519
  // so we will just overwrite the pageSizes when needed, this is the only one causing issues so far.
505
520
  // On a deep extend, Object and Array are extended, but object wrappers on primitive types such as String, Boolean, and Number are not.
506
- if (options?.pagination && (gridOptions.enablePagination || gridOptions.backendServiceApi) && gridOptions.pagination && Array.isArray(gridOptions.pagination.pageSizes)) {
521
+ if (options?.pagination &&
522
+ (gridOptions.enablePagination || gridOptions.backendServiceApi) &&
523
+ gridOptions.pagination &&
524
+ Array.isArray(gridOptions.pagination.pageSizes)) {
507
525
  options.pagination.pageSizes = gridOptions.pagination.pageSizes;
508
526
  }
509
527
  // when we use Pagination on Local Grid, it doesn't seem to work without enableFiltering
@@ -528,10 +546,15 @@ class SlickVanillaGridBundle {
528
546
  // internalPostProcess only works (for now) with a GraphQL Service, so make sure it is of that type
529
547
  if ( /* backendApiService instanceof GraphqlService || */typeof backendApiService.getDatasetName === 'function') {
530
548
  backendApi.internalPostProcess = (processResult) => {
549
+ // prettier-ignore
531
550
  const datasetName = (backendApi && backendApiService && typeof backendApiService.getDatasetName === 'function') ? backendApiService.getDatasetName() : '';
532
551
  if (processResult && processResult.data && processResult.data[datasetName]) {
533
- const data = processResult.data[datasetName].hasOwnProperty('nodes') ? processResult.data[datasetName].nodes : processResult.data[datasetName];
534
- const totalCount = processResult.data[datasetName].hasOwnProperty('totalCount') ? processResult.data[datasetName].totalCount : processResult.data[datasetName].length;
552
+ const data = processResult.data[datasetName].hasOwnProperty('nodes')
553
+ ? processResult.data[datasetName].nodes
554
+ : processResult.data[datasetName];
555
+ const totalCount = processResult.data[datasetName].hasOwnProperty('totalCount')
556
+ ? processResult.data[datasetName].totalCount
557
+ : processResult.data[datasetName].length;
535
558
  this.refreshGridData(data, totalCount || 0);
536
559
  }
537
560
  };
@@ -552,7 +575,8 @@ class SlickVanillaGridBundle {
552
575
  this.subscriptions.push(this._eventPubSubService.subscribe('onLanguageChange', (args) => {
553
576
  if (gridOptions.enableTranslate) {
554
577
  this.extensionService.translateAllExtensions(args.language);
555
- if ((gridOptions.createPreHeaderPanel && gridOptions.createTopHeaderPanel) || (gridOptions.createPreHeaderPanel && !gridOptions.enableDraggableGrouping)) {
578
+ if ((gridOptions.createPreHeaderPanel && gridOptions.createTopHeaderPanel) ||
579
+ (gridOptions.createPreHeaderPanel && !gridOptions.enableDraggableGrouping)) {
556
580
  this.headerGroupingService.translateHeaderGrouping();
557
581
  }
558
582
  }
@@ -596,20 +620,19 @@ class SlickVanillaGridBundle {
596
620
  this.sharedService.isItemsDateParsed = false;
597
621
  this.handleOnItemCountChanged(this.dataView?.getFilteredItemCount() || 0, args.itemCount);
598
622
  // when user has resize by content enabled, we'll force a full width calculation since we change our entire dataset
599
- if (args.itemCount > 0 && (this.gridOptions.autosizeColumnsByCellContentOnFirstLoad || this.gridOptions.enableAutoResizeColumnsByCellContent)) {
623
+ if (args.itemCount > 0 &&
624
+ (this.gridOptions.autosizeColumnsByCellContentOnFirstLoad || this.gridOptions.enableAutoResizeColumnsByCellContent)) {
600
625
  this.resizerService.resizeColumnsByCellContent(!this.gridOptions?.resizeByContentOnlyOnFirstLoad);
601
626
  }
602
627
  });
603
- if (gridOptions?.enableFiltering && !gridOptions.enableRowDetailView) {
628
+ if ((gridOptions?.enableFiltering || gridOptions?.dataView?.globalItemMetadataProvider) && !gridOptions.enableRowDetailView) {
604
629
  this._eventHandler.subscribe(dataView.onRowsChanged, (_e, { calledOnRowCountChanged, rows }) => {
605
630
  // filtering data with local dataset will not always show correctly unless we call this updateRow/render
606
631
  // also don't use "invalidateRows" since it destroys the entire row and as bad user experience when updating a row
607
632
  // see commit: https://github.com/ghiscoding/aurelia-slickgrid/commit/8c503a4d45fba11cbd8d8cc467fae8d177cc4f60
608
633
  if (!calledOnRowCountChanged && Array.isArray(rows)) {
609
634
  const ranges = grid.getRenderedRange();
610
- rows
611
- .filter(row => row >= ranges.top && row <= ranges.bottom)
612
- .forEach((row) => grid.updateRow(row));
635
+ rows.filter((row) => row >= ranges.top && row <= ranges.bottom).forEach((row) => grid.updateRow(row));
613
636
  grid.render();
614
637
  }
615
638
  });
@@ -629,6 +652,7 @@ class SlickVanillaGridBundle {
629
652
  this.loadColumnPresetsWhenDatasetInitialized();
630
653
  this.loadFilterPresetsWhenDatasetInitialized();
631
654
  }
655
+ // @deprecated @user `dataview.globalItemMetadataProvider.getRowMetadata`
632
656
  // did the user add a colspan callback? If so, hook it into the DataView getItemMetadata
633
657
  if (gridOptions?.colspanCallback && dataView?.getItem && dataView?.getItemMetadata) {
634
658
  dataView.getItemMetadata = (rowNumber) => {
@@ -644,6 +668,7 @@ class SlickVanillaGridBundle {
644
668
  const backendApi = gridOptions.backendServiceApi;
645
669
  const backendApiService = backendApi?.service;
646
670
  const serviceOptions = backendApiService?.options ?? {};
671
+ // prettier-ignore
647
672
  const isExecuteCommandOnInit = (!serviceOptions) ? false : ((serviceOptions?.hasOwnProperty('executeProcessCommandOnInit')) ? serviceOptions['executeProcessCommandOnInit'] : true);
648
673
  if (backendApiService) {
649
674
  // update backend filters (if need be) BEFORE the query runs (via the onInit command a few lines below)
@@ -673,7 +698,7 @@ class SlickVanillaGridBundle {
673
698
  }
674
699
  // execute onInit command when necessary
675
700
  if (backendApi && backendApiService && (backendApi.onInit || isExecuteCommandOnInit)) {
676
- const query = (typeof backendApiService.buildQuery === 'function') ? backendApiService.buildQuery() : '';
701
+ const query = typeof backendApiService.buildQuery === 'function' ? backendApiService.buildQuery() : '';
677
702
  const process = isExecuteCommandOnInit ? (backendApi.process?.(query) ?? null) : (backendApi.onInit?.(query) ?? null);
678
703
  // wrap this inside a microtask to be executed at the end of the task and avoid timing issue since the gridOptions needs to be ready before running this onInit
679
704
  queueMicrotask(() => {
@@ -703,13 +728,16 @@ class SlickVanillaGridBundle {
703
728
  }
704
729
  }
705
730
  addBackendInfiniteScrollCallback() {
706
- if (this.slickGrid && this.gridOptions.backendServiceApi && this.hasBackendInfiniteScroll() && !this.gridOptions.backendServiceApi?.onScrollEnd) {
731
+ if (this.slickGrid &&
732
+ this.gridOptions.backendServiceApi &&
733
+ this.hasBackendInfiniteScroll() &&
734
+ !this.gridOptions.backendServiceApi?.onScrollEnd) {
707
735
  const onScrollEnd = () => {
708
736
  this.backendUtilityService.setInfiniteScrollBottomHit(true);
709
737
  // even if we're not showing pagination, we still use pagination service behind the scene
710
738
  // to keep track of the scroll position and fetch next set of data (aka next page)
711
739
  // we also need a flag to know if we reached the of the dataset or not (no more pages)
712
- this.paginationService.goToNextPage().then(hasNext => {
740
+ this.paginationService.goToNextPage().then((hasNext) => {
713
741
  if (!hasNext) {
714
742
  this.backendUtilityService.setInfiniteScrollBottomHit(false);
715
743
  }
@@ -720,10 +748,10 @@ class SlickVanillaGridBundle {
720
748
  // run onScrollEnd() method when that happens
721
749
  this._eventHandler.subscribe(this.slickGrid.onScroll, (_e, args) => {
722
750
  const viewportElm = args.grid.getViewportNode();
723
- if (['mousewheel', 'scroll'].includes(args.triggeredBy || '')
724
- && this.paginationService?.totalItems
725
- && args.scrollTop > 0
726
- && Math.ceil(viewportElm.offsetHeight + args.scrollTop) >= args.scrollHeight) {
751
+ if (['mousewheel', 'scroll'].includes(args.triggeredBy || '') &&
752
+ this.paginationService?.totalItems &&
753
+ args.scrollTop > 0 &&
754
+ Math.ceil(viewportElm.offsetHeight + args.scrollTop) >= args.scrollHeight) {
727
755
  if (!this._scrollEndCalled) {
728
756
  onScrollEnd();
729
757
  this._scrollEndCalled = true;
@@ -742,7 +770,8 @@ class SlickVanillaGridBundle {
742
770
  }
743
771
  }
744
772
  bindResizeHook(grid, options) {
745
- if ((options.autoFitColumnsOnFirstLoad && options.autosizeColumnsByCellContentOnFirstLoad) || (options.enableAutoSizeColumns && options.enableAutoResizeColumnsByCellContent)) {
773
+ if ((options.autoFitColumnsOnFirstLoad && options.autosizeColumnsByCellContentOnFirstLoad) ||
774
+ (options.enableAutoSizeColumns && options.enableAutoResizeColumnsByCellContent)) {
746
775
  throw new Error(`[Slickgrid-Universal] You cannot enable both autosize/fit viewport & resize by content, you must choose which resize technique to use. You can enable these 2 options ("autoFitColumnsOnFirstLoad" and "enableAutoSizeColumns") OR these other 2 options ("autosizeColumnsByCellContentOnFirstLoad" and "enableAutoResizeColumnsByCellContent").`);
747
776
  }
748
777
  // auto-resize grid on browser resize (optionally provide grid height or width)
@@ -753,7 +782,11 @@ class SlickVanillaGridBundle {
753
782
  this.resizerService.resizeGrid();
754
783
  }
755
784
  // expand/autofit columns on first page load
756
- if (grid && options?.enableAutoResize && options.autoFitColumnsOnFirstLoad && options.enableAutoSizeColumns && !this._isAutosizeColsCalled) {
785
+ if (grid &&
786
+ options?.enableAutoResize &&
787
+ options.autoFitColumnsOnFirstLoad &&
788
+ options.enableAutoSizeColumns &&
789
+ !this._isAutosizeColsCalled) {
757
790
  grid.autosizeColumns();
758
791
  this._isAutosizeColsCalled = true;
759
792
  }
@@ -774,7 +807,10 @@ class SlickVanillaGridBundle {
774
807
  */
775
808
  paginationChanged(pagination) {
776
809
  const isSyncGridSelectionEnabled = this.gridStateService?.needToPreserveRowSelection() ?? false;
777
- if (this.slickGrid && !isSyncGridSelectionEnabled && this._gridOptions?.backendServiceApi && (this.gridOptions.enableRowSelection || this.gridOptions.enableCheckboxSelector)) {
810
+ if (this.slickGrid &&
811
+ !isSyncGridSelectionEnabled &&
812
+ this._gridOptions?.backendServiceApi &&
813
+ (this.gridOptions.enableRowSelection || this.gridOptions.enableCheckboxSelector)) {
778
814
  this.slickGrid.setSelectedRows([]);
779
815
  }
780
816
  const { pageNumber, pageSize } = pagination;
@@ -783,7 +819,7 @@ class SlickVanillaGridBundle {
783
819
  }
784
820
  this._eventPubSubService.publish('onGridStateChanged', {
785
821
  change: { newValues: { pageNumber, pageSize }, type: common_1.GridStateType.pagination },
786
- gridState: this.gridStateService.getCurrentGridState()
822
+ gridState: this.gridStateService.getCurrentGridState(),
787
823
  });
788
824
  }
789
825
  /**
@@ -817,12 +853,13 @@ class SlickVanillaGridBundle {
817
853
  this.slickGrid.invalidate();
818
854
  }
819
855
  // display the Pagination component only after calling this refresh data first, we call it here so that if we preset pagination page number it will be shown correctly
820
- this.showPagination = !!(this._gridOptions && (this._gridOptions.enablePagination || (this._gridOptions.backendServiceApi && this._gridOptions.enablePagination === undefined)));
856
+ this.showPagination = !!(this._gridOptions &&
857
+ (this._gridOptions.enablePagination || (this._gridOptions.backendServiceApi && this._gridOptions.enablePagination === undefined)));
821
858
  if (this._paginationOptions && this._gridOptions?.pagination && this._gridOptions?.backendServiceApi) {
822
859
  const paginationOptions = this.setPaginationOptionsWhenPresetDefined(this._gridOptions, this._paginationOptions);
823
860
  // when we have a totalCount use it, else we'll take it from the pagination object
824
861
  // only update the total items if it's different to avoid refreshing the UI
825
- const totalRecords = (totalCount !== undefined) ? totalCount : (this._gridOptions?.pagination?.totalItems);
862
+ const totalRecords = totalCount !== undefined ? totalCount : this._gridOptions?.pagination?.totalItems;
826
863
  if (totalRecords !== undefined && totalRecords !== this.totalItems) {
827
864
  this.totalItems = +totalRecords;
828
865
  }
@@ -920,7 +957,7 @@ class SlickVanillaGridBundle {
920
957
  * We will use this when doing a resize by cell content, if user provided a `width` it won't override it.
921
958
  */
922
959
  copyColumnWidthsReference(columnDefinitions) {
923
- columnDefinitions.forEach(col => col.originalWidth = col.width);
960
+ columnDefinitions.forEach((col) => (col.originalWidth = col.width));
924
961
  }
925
962
  displayEmptyDataWarning(showWarning = true) {
926
963
  if (this.gridOptions.enableEmptyDataWarningMessage) {
@@ -934,7 +971,7 @@ class SlickVanillaGridBundle {
934
971
  startTime: new Date(),
935
972
  endTime: new Date(),
936
973
  itemCount: currentPageRowItemCount,
937
- totalItemCount
974
+ totalItemCount,
938
975
  };
939
976
  // if custom footer is enabled, then we'll update its metrics
940
977
  if (this.slickFooter) {
@@ -954,7 +991,7 @@ class SlickVanillaGridBundle {
954
991
  };
955
992
  this.paginationService.totalItems = this.totalItems;
956
993
  this.paginationService.init(this.slickGrid, paginationOptions, this.backendServiceApi);
957
- this.subscriptions.push(this._eventPubSubService.subscribe('onPaginationChanged', paginationChanges => this.paginationChanged(paginationChanges)), this._eventPubSubService.subscribe('onPaginationVisibilityChanged', visibility => {
994
+ this.subscriptions.push(this._eventPubSubService.subscribe('onPaginationChanged', (paginationChanges) => this.paginationChanged(paginationChanges)), this._eventPubSubService.subscribe('onPaginationVisibilityChanged', (visibility) => {
958
995
  this.showPagination = visibility?.visible ?? false;
959
996
  if (this.gridOptions?.backendServiceApi) {
960
997
  this.backendUtilityService?.refreshBackendDataset(this.gridOptions);
@@ -1018,12 +1055,12 @@ class SlickVanillaGridBundle {
1018
1055
  }
1019
1056
  else if (response?.status >= 200 && response.status < 300 && typeof response.json === 'function') {
1020
1057
  if (response.bodyUsed) {
1021
- console.warn(`[SlickGrid-Universal] The response body passed to collectionAsync was already read.`
1022
- + `Either pass the dataset from the Response or clone the response first using response.clone()`);
1058
+ console.warn(`[SlickGrid-Universal] The response body passed to collectionAsync was already read.` +
1059
+ `Either pass the dataset from the Response or clone the response first using response.clone()`);
1023
1060
  }
1024
1061
  else {
1025
1062
  // from Fetch
1026
- response.json().then(data => this.updateEditorCollection(column, data));
1063
+ response.json().then((data) => this.updateEditorCollection(column, data));
1027
1064
  }
1028
1065
  }
1029
1066
  else if (response?.content) {
@@ -1041,13 +1078,11 @@ class SlickVanillaGridBundle {
1041
1078
  }
1042
1079
  insertDynamicPresetColumns(columnId, gridPresetColumns) {
1043
1080
  if (this._columnDefinitions) {
1044
- const columnPosition = this._columnDefinitions.findIndex(c => c.id === columnId);
1081
+ const columnPosition = this._columnDefinitions.findIndex((c) => c.id === columnId);
1045
1082
  if (columnPosition >= 0) {
1046
1083
  const dynColumn = this._columnDefinitions[columnPosition];
1047
- if (dynColumn?.id === columnId && !gridPresetColumns.some(c => c.id === columnId)) {
1048
- columnPosition > 0
1049
- ? gridPresetColumns.splice(columnPosition, 0, dynColumn)
1050
- : gridPresetColumns.unshift(dynColumn);
1084
+ if (dynColumn?.id === columnId && !gridPresetColumns.some((c) => c.id === columnId)) {
1085
+ columnPosition > 0 ? gridPresetColumns.splice(columnPosition, 0, dynColumn) : gridPresetColumns.unshift(dynColumn);
1051
1086
  }
1052
1087
  }
1053
1088
  }
@@ -1055,7 +1090,10 @@ class SlickVanillaGridBundle {
1055
1090
  /** Load any possible Columns Grid Presets */
1056
1091
  loadColumnPresetsWhenDatasetInitialized() {
1057
1092
  // if user entered some Columns "presets", we need to reflect them all in the grid
1058
- if (this.slickGrid && this.gridOptions.presets && Array.isArray(this.gridOptions.presets.columns) && this.gridOptions.presets.columns.length > 0) {
1093
+ if (this.slickGrid &&
1094
+ this.gridOptions.presets &&
1095
+ Array.isArray(this.gridOptions.presets.columns) &&
1096
+ this.gridOptions.presets.columns.length > 0) {
1059
1097
  const gridPresetColumns = this.gridStateService.getAssociatedGridColumns(this.slickGrid, this.gridOptions.presets.columns);
1060
1098
  if (gridPresetColumns && Array.isArray(gridPresetColumns) && gridPresetColumns.length > 0 && Array.isArray(this._columnDefinitions)) {
1061
1099
  // make sure that the dynamic columns are included in presets (1.Row Move, 2. Row Selection, 3. Row Detail)
@@ -1073,7 +1111,7 @@ class SlickVanillaGridBundle {
1073
1111
  }
1074
1112
  // keep copy the original optional `width` properties optionally provided by the user.
1075
1113
  // We will use this when doing a resize by cell content, if user provided a `width` it won't override it.
1076
- gridPresetColumns.forEach(col => col.originalWidth = col.width);
1114
+ gridPresetColumns.forEach((col) => (col.originalWidth = col.width));
1077
1115
  // finally set the new presets columns (including checkbox selector if need be)
1078
1116
  this.slickGrid.setColumns(gridPresetColumns);
1079
1117
  this.sharedService.visibleColumns = gridPresetColumns;
@@ -1086,7 +1124,8 @@ class SlickVanillaGridBundle {
1086
1124
  // if user entered some Filter "presets", we need to reflect them all in the DOM
1087
1125
  // also note that a presets of Tree Data Toggling will also call this method because Tree Data toggling does work with data filtering
1088
1126
  // (collapsing a parent will basically use Filter for hidding (aka collapsing) away the child underneat it)
1089
- if (this.gridOptions.presets && (Array.isArray(this.gridOptions.presets.filters) || Array.isArray(this.gridOptions.presets?.treeData?.toggledItems))) {
1127
+ if (this.gridOptions.presets &&
1128
+ (Array.isArray(this.gridOptions.presets.filters) || Array.isArray(this.gridOptions.presets?.treeData?.toggledItems))) {
1090
1129
  this.filterService.populateColumnFilterSearchTermPresets(this.gridOptions.presets?.filters || []);
1091
1130
  }
1092
1131
  }
@@ -1116,7 +1155,12 @@ class SlickVanillaGridBundle {
1116
1155
  const presets = this.gridOptions?.presets;
1117
1156
  const selectionModel = this.slickGrid?.getSelectionModel();
1118
1157
  const enableRowSelection = this.gridOptions && (this.gridOptions.enableCheckboxSelector || this.gridOptions.enableRowSelection);
1119
- if (this.slickGrid && this.dataView && enableRowSelection && selectionModel && presets?.rowSelection && (Array.isArray(presets.rowSelection.gridRowIndexes) || Array.isArray(presets.rowSelection.dataContextIds))) {
1158
+ if (this.slickGrid &&
1159
+ this.dataView &&
1160
+ enableRowSelection &&
1161
+ selectionModel &&
1162
+ presets?.rowSelection &&
1163
+ (Array.isArray(presets.rowSelection.gridRowIndexes) || Array.isArray(presets.rowSelection.dataContextIds))) {
1120
1164
  let dataContextIds = presets.rowSelection.dataContextIds;
1121
1165
  let gridRowIndexes = presets.rowSelection.gridRowIndexes;
1122
1166
  // maps the IDs to the Grid Rows and vice versa, the "dataContextIds" has precedence over the other
@@ -1132,7 +1176,7 @@ class SlickVanillaGridBundle {
1132
1176
  this.dataView.setSelectedIds(dataContextIds || [], {
1133
1177
  isRowBeingAdded: true,
1134
1178
  shouldTriggerEvent: false, // do not trigger when presetting the grid
1135
- applyRowSelectionToGrid: true
1179
+ applyRowSelectionToGrid: true,
1136
1180
  });
1137
1181
  }
1138
1182
  }
@@ -1142,7 +1186,7 @@ class SlickVanillaGridBundle {
1142
1186
  if (disposePreviousResources) {
1143
1187
  this.disposeExternalResources();
1144
1188
  }
1145
- resources.forEach(res => this._registeredResources.push(res));
1189
+ resources.forEach((res) => this._registeredResources.push(res));
1146
1190
  this.initializeExternalResources(resources);
1147
1191
  }
1148
1192
  resetExternalResources() {
@@ -1177,7 +1221,8 @@ class SlickVanillaGridBundle {
1177
1221
  // push all other Services that we want to be registered
1178
1222
  this._registeredResources.push(this.gridService, this.gridStateService);
1179
1223
  // when using Grouping/DraggableGrouping/Colspan register its Service
1180
- if ((this.gridOptions.createPreHeaderPanel && this.gridOptions.createTopHeaderPanel) || (this.gridOptions.createPreHeaderPanel && !this.gridOptions.enableDraggableGrouping)) {
1224
+ if ((this.gridOptions.createPreHeaderPanel && this.gridOptions.createTopHeaderPanel) ||
1225
+ (this.gridOptions.createPreHeaderPanel && !this.gridOptions.enableDraggableGrouping)) {
1181
1226
  this._registeredResources.push(this.headerGroupingService);
1182
1227
  }
1183
1228
  // when using Tree Data View, register its Service
@@ -1235,7 +1280,7 @@ class SlickVanillaGridBundle {
1235
1280
  /** Prepare and load all SlickGrid editors, if an async editor is found then we'll also execute it. */
1236
1281
  loadSlickGridEditors(columnDefinitions) {
1237
1282
  const columns = Array.isArray(columnDefinitions) ? columnDefinitions : [];
1238
- if (columns.some(col => `${col.id}`.includes('.'))) {
1283
+ if (columns.some((col) => `${col.id}`.includes('.'))) {
1239
1284
  console.error('[Slickgrid-Universal] Make sure that none of your Column Definition "id" property includes a dot in its name because that will cause some problems with the Editors. For example if your column definition "field" property is "user.firstName" then use "firstName" as the column "id".');
1240
1285
  }
1241
1286
  return columns.map((column) => {
@@ -1247,7 +1292,11 @@ class SlickVanillaGridBundle {
1247
1292
  });
1248
1293
  }
1249
1294
  suggestDateParsingWhenHelpful() {
1250
- if (!this.gridOptions.silenceWarnings && this.dataView && this.dataView.getItemCount() > WARN_NO_PREPARSE_DATE_SIZE && !this.gridOptions.preParseDateColumns && this.slickGrid?.getColumns().some(c => (0, common_1.isColumnDateType)(c.type))) {
1295
+ if (!this.gridOptions.silenceWarnings &&
1296
+ this.dataView &&
1297
+ this.dataView.getItemCount() > WARN_NO_PREPARSE_DATE_SIZE &&
1298
+ !this.gridOptions.preParseDateColumns &&
1299
+ this.slickGrid?.getColumns().some((c) => (0, common_1.isColumnDateType)(c.type))) {
1251
1300
  console.warn('[Slickgrid-Universal] For getting better perf, we suggest you enable the `preParseDateColumns` grid option, ' +
1252
1301
  'for more info visit => https://ghiscoding.gitbook.io/slickgrid-universal/column-functionalities/sorting#pre-parse-date-columns-for-better-perf');
1253
1302
  }
@@ -1262,7 +1311,7 @@ class SlickVanillaGridBundle {
1262
1311
  column.editor.disabled = false;
1263
1312
  // get current Editor, remove it from the DOm then re-enable it and re-render it with the new collection.
1264
1313
  const currentEditor = this.slickGrid.getCellEditor();
1265
- if (currentEditor?.disable && currentEditor?.renderDomElement) {
1314
+ if (currentEditor?.disable && currentEditor.renderDomElement) {
1266
1315
  if (typeof currentEditor.destroy === 'function') {
1267
1316
  currentEditor.destroy();
1268
1317
  }