@adaptabletools/adaptable-cjs 21.0.4 → 21.0.6

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable-cjs",
3
- "version": "21.0.4",
3
+ "version": "21.0.6",
4
4
  "description": "Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements",
5
5
  "keywords": [
6
6
  "web-components",
@@ -35,6 +35,23 @@ exports.layoutModelToLayoutState = layoutModelToLayoutState;
35
35
  function cleanupAdaptableObjectPrimitives(layout) {
36
36
  const l = layout;
37
37
  for (const key in l) {
38
+ if (key === 'ColumnFilters') {
39
+ // we don't want to cleanup ColumnFilters
40
+ // as we rely on the Uuids for identifying the filters
41
+ if (Array.isArray(l[key])) {
42
+ l[key].forEach((item) => {
43
+ if (typeof item === 'object') {
44
+ // but we do want to cleanup further down - eg: predicates in the filter
45
+ for (const k in item) {
46
+ if (typeof item[k] === 'object') {
47
+ (0, AdaptableHelper_1.removeAdaptableObjectPrimitivesInlineDeep)(item[k]);
48
+ }
49
+ }
50
+ }
51
+ });
52
+ }
53
+ continue;
54
+ }
38
55
  if (typeof l[key] === 'object') {
39
56
  (0, AdaptableHelper_1.removeAdaptableObjectPrimitivesInlineDeep)(l[key]);
40
57
  }
@@ -372,9 +389,9 @@ const tableLayoutModelToTableLayout = (layoutModel) => {
372
389
  if (layoutModel.Ignore_Metadata) {
373
390
  tableLayout.Metadata = layoutModel.Ignore_Metadata;
374
391
  }
375
- if (layoutModel.RowGroupDisplayType) {
376
- tableLayout.RowGroupDisplayType = layoutModel.RowGroupDisplayType;
377
- }
392
+ // if (layoutModel.RowGroupDisplayType) {
393
+ tableLayout.RowGroupDisplayType = layoutModel.RowGroupDisplayType ?? 'single';
394
+ // }
378
395
  if (layoutModel.RowGroupedColumns) {
379
396
  tableLayout.RowGroupedColumns = layoutModel.RowGroupedColumns;
380
397
  }
@@ -529,9 +546,9 @@ const pivotLayoutModelToPivotLayout = (layoutModel) => {
529
546
  pivotLayout.ColumnGroupValues.ExceptionGroupKeys = layoutModel.ColumnGroupValues.Values;
530
547
  }
531
548
  }
532
- if (layoutModel.RowGroupDisplayType) {
533
- pivotLayout.RowGroupDisplayType = layoutModel.RowGroupDisplayType;
534
- }
549
+ // if (layoutModel.RowGroupDisplayType) {
550
+ pivotLayout.RowGroupDisplayType = layoutModel.RowGroupDisplayType ?? 'single';
551
+ // }
535
552
  return pivotLayout;
536
553
  };
537
554
  exports.pivotLayoutModelToPivotLayout = pivotLayoutModelToPivotLayout;
@@ -266,7 +266,8 @@ const ColumnsSection = (props) => {
266
266
  });
267
267
  }
268
268
  }
269
- if (adaptable.api.gridApi.isTreeDataGrid()) {
269
+ if (adaptable.api.gridApi.isTreeDataGrid() &&
270
+ !allColumns.find((col) => col.columnId === GeneralConstants_1.AG_GRID_GROUPED_COLUMN)) {
270
271
  allColumns.unshift((0, ColumnApiImpl_1.generateAutoTreeSingleColumn)());
271
272
  }
272
273
  const colIdToCol = allColumns.reduce((acc, col) => {
@@ -200,7 +200,9 @@ export declare class AdaptableAgGrid implements IAdaptable {
200
200
  getDisplayValueFromRawValue(rowNode: IRowNode, columnId: string, rawValue: any): string | undefined;
201
201
  private getCleanValue;
202
202
  getNormalisedValueFromRawValue(rawValue: any, column: AdaptableColumn): string | number | boolean | Date | unknown;
203
+ private __updateColumnModelAndRefreshGrid_already_called;
203
204
  updateColumnModelAndRefreshGrid(): void;
205
+ _updateColumnModelAndRefreshGridNow(): void;
204
206
  redrawBody(): void;
205
207
  refreshHeader(): void;
206
208
  redrawRows(rowNodes?: IRowNode[]): void;
@@ -183,6 +183,7 @@ class AdaptableAgGrid {
183
183
  }
184
184
  return this.emitter.onIncludeFired(eventName, callback);
185
185
  };
186
+ this.__updateColumnModelAndRefreshGrid_already_called = false;
186
187
  this.lifecycleState = 'initial';
187
188
  this.emitter = new Emitter_1.default();
188
189
  this.agGridOptionsService = new AgGridOptionsService_1.AgGridOptionsService(this);
@@ -360,6 +361,13 @@ class AdaptableAgGrid {
360
361
  const gridOptions = config.gridOptions;
361
362
  // Needed here because special column defs are required for deriving the adaptable column state
362
363
  let columnDefs = this.agGridAdapter.getColumnDefinitionsInclSpecialColumns(gridOptions.columnDefs || []);
364
+ // see #map_dateString_to_date
365
+ this.agGridAdapter.patchColDefs(columnDefs, (colDef) => {
366
+ if (colDef.cellDataType === 'dateString') {
367
+ this.logger.consoleError(`AG Grid: Column '${colDef.colId}' specifies cellDataType='dateString' which is no longer supported. It has been automatically replaced with cellDataType='date'. Please update your column definition.`);
368
+ colDef.cellDataType = 'date';
369
+ }
370
+ });
363
371
  gridOptions.columnDefs = columnDefs;
364
372
  this.setInitialGridOptions(gridOptions, config.variant);
365
373
  const { gridState: initialGridState, layoutModel } = this.mapAdaptableStateToAgGridState(this.adaptableStore.TheStore.getState(), gridOptions.columnDefs, {
@@ -709,18 +717,30 @@ You need to define at least one Layout!`);
709
717
  };
710
718
  }
711
719
  return (params) => {
720
+ // might be a summary row
721
+ if (params.data?.[RowSummary_1.ROW_SUMMARY_ROW_ID]) {
722
+ return params.data[RowSummary_1.ROW_SUMMARY_ROW_ID];
723
+ }
724
+ if (params.level > 0) {
725
+ const parentKeys = params.parentKeys ?? [];
726
+ const values = Object.values(params.data);
727
+ let hash = 0;
728
+ for (let i = 0; i < values.length; i++) {
729
+ const str = String(values[i] ?? '');
730
+ for (let j = 0; j < str.length; j++) {
731
+ hash = ((hash << 5) - hash + str.charCodeAt(j)) | 0;
732
+ }
733
+ }
734
+ const id = [...parentKeys, Math.abs(hash)].join('/');
735
+ return id;
736
+ }
712
737
  if (params.data?.[primaryKey]) {
713
738
  const primaryKeyValue = params.data[primaryKey];
714
739
  return typeof primaryKeyValue === 'number'
715
740
  ? `${primaryKeyValue}`
716
741
  : params.data[primaryKey];
717
742
  }
718
- // might be a summary row
719
- if (params.data?.[RowSummary_1.ROW_SUMMARY_ROW_ID]) {
720
- return params.data[RowSummary_1.ROW_SUMMARY_ROW_ID];
721
- }
722
- // AFL 2024.08.17 - no idea why is this here and when it's used
723
- // might be a group row
743
+ // fallback
724
744
  const parentKeys = params.parentKeys ?? [];
725
745
  const values = Object.values(params.data);
726
746
  if (values.length) {
@@ -1862,6 +1882,20 @@ You need to define at least one Layout!`);
1862
1882
  return rawValue;
1863
1883
  }
1864
1884
  updateColumnModelAndRefreshGrid() {
1885
+ if (this.__updateColumnModelAndRefreshGrid_already_called) {
1886
+ return;
1887
+ }
1888
+ try {
1889
+ this._updateColumnModelAndRefreshGridNow();
1890
+ this.__updateColumnModelAndRefreshGrid_already_called = true;
1891
+ }
1892
+ finally {
1893
+ queueMicrotask(() => {
1894
+ this.__updateColumnModelAndRefreshGrid_already_called = false;
1895
+ });
1896
+ }
1897
+ }
1898
+ _updateColumnModelAndRefreshGridNow() {
1865
1899
  this.logger.info(`Updating Column Model and Refreshing Grid.`);
1866
1900
  this.deriveAdaptableColumnStateFromAgGrid();
1867
1901
  this.agGridColumnAdapter.setupColumns();
@@ -3548,8 +3582,8 @@ You need to define at least one Layout!`);
3548
3582
  isRowGroupDifferentInLayout(one, other) {
3549
3583
  const prevRowGroupedColumns = one.RowGroupedColumns || one.PivotGroupedColumns || [];
3550
3584
  const currentRowGroupedColumns = other.RowGroupedColumns || other.PivotGroupedColumns || [];
3551
- const prevRowGroupDisplayType = one.RowGroupDisplayType;
3552
- const currentRowGroupDisplayType = other.RowGroupDisplayType;
3585
+ const prevRowGroupDisplayType = one.RowGroupDisplayType ?? 'single';
3586
+ const currentRowGroupDisplayType = other.RowGroupDisplayType ?? 'single';
3553
3587
  if (prevRowGroupDisplayType !== currentRowGroupDisplayType) {
3554
3588
  return true;
3555
3589
  }
@@ -537,6 +537,7 @@ class AgGridColumnAdapter {
537
537
  setupColumnCellDataType(columnSetupInfo) {
538
538
  const { col, colId } = columnSetupInfo;
539
539
  this.setColDefProperty(col, 'cellDataType', (original_cellDataType) => {
540
+ // #map_dateString_to_date
540
541
  if (original_cellDataType === 'dateString') {
541
542
  (0, AdaptableLogger_1.errorOnce)(`AG Grid: Column '${colId}' specifies cellDataType='dateString' which is no longer supported. It has been automatically replaced with cellDataType='date'. Please update your column definition.`);
542
543
  return 'date';
@@ -19,7 +19,20 @@ class AgGridModulesAdapter {
19
19
  return this.adaptableInstance.agGridAdapter.getAgGridApi();
20
20
  }
21
21
  isAgGridModuleRegistered(moduleName) {
22
- return this.agGridApi.isModuleRegistered(moduleName);
22
+ let isModuleRegistered = this.agGridApi.isModuleRegistered(moduleName);
23
+ if (!isModuleRegistered) {
24
+ // SSRM module comes with its own implementations of Pivot, MasterDetail and TreeData
25
+ // #ssrm_pivot_module
26
+ const serverSideDependencies = [
27
+ 'PivotModule',
28
+ 'MasterDetailModule',
29
+ 'TreeDataModule',
30
+ ];
31
+ if (serverSideDependencies.includes(moduleName)) {
32
+ isModuleRegistered = this.agGridApi.isModuleRegistered('ServerSideRowModelModule');
33
+ }
34
+ }
35
+ return isModuleRegistered;
23
36
  }
24
37
  getAgGridRegisteredModules() {
25
38
  const registeredModules = [];
@@ -283,10 +283,10 @@ const Select = function (props) {
283
283
  // ignore the event if the focus is still inside the menu
284
284
  return;
285
285
  }
286
- setTimeout(() => {
286
+ requestAnimationFrame(() => {
287
287
  // wee need to wait for the single value selection to complete before closing
288
288
  closeSelectMenu();
289
- }, 100);
289
+ });
290
290
  },
291
291
  onMouseDown: (event) => {
292
292
  if (!props.isMulti) {
package/src/env.js CHANGED
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = {
4
4
  NEXT_PUBLIC_INFINITE_TABLE_LICENSE_KEY: "StartDate=2021-06-29|EndDate=2030-01-01|Owner=Adaptable|Type=distribution|TS=1624971462479|C=137829811,1004007071,2756196225,1839832928,3994409405,636616862" || '',
5
- PUBLISH_TIMESTAMP: 1758887620106 || Date.now(),
6
- VERSION: "21.0.4" || '--current-version--',
5
+ PUBLISH_TIMESTAMP: 1759506326299 || Date.now(),
6
+ VERSION: "21.0.6" || '--current-version--',
7
7
  };
@@ -345,9 +345,15 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
345
345
  let ColumnSizing = layout.ColumnSizing || {};
346
346
  //let's also include the column widths of the pivotResult columns
347
347
  pivotResultColumns.forEach((col) => {
348
- ColumnSizing[col.getColId()] = {
349
- Width: col.getActualWidth(),
350
- };
348
+ const colId = col.getColId();
349
+ const Width = col.getActualWidth();
350
+ const initialWidth = this.initialColumnWidths[colId] ?? DEFAULT_COLUMN_WIDTH;
351
+ // but if the width is the initial/default width, don't include it in the ColumnSizing
352
+ if (Width !== initialWidth) {
353
+ ColumnSizing[colId] = {
354
+ Width,
355
+ };
356
+ }
351
357
  });
352
358
  if (!Object.keys(ColumnSizing).length) {
353
359
  ColumnSizing = undefined;
@@ -1710,7 +1716,11 @@ class LayoutManager extends LMEmitter_1.LMEmitter {
1710
1716
  }
1711
1717
  }
1712
1718
  isInPivotMode() {
1713
- return this.gridApi.isModuleRegistered('PivotModule') && this.gridApi.isPivotMode();
1719
+ // SSRM comes with its own pivot module implementation
1720
+ // see #ssrm_pivot_module
1721
+ const isModuleRegistered = this.gridApi.isModuleRegistered('PivotModule') ||
1722
+ this.gridApi.isModuleRegistered('ServerSideRowModelModule');
1723
+ return isModuleRegistered && this.gridApi.isPivotMode();
1714
1724
  }
1715
1725
  }
1716
1726
  exports.LayoutManager = LayoutManager;