@adaptabletools/adaptable 21.0.5 → 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",
3
- "version": "21.0.5",
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",
@@ -28,6 +28,23 @@ export const layoutModelToLayoutState = (layoutModel) => {
28
28
  function cleanupAdaptableObjectPrimitives(layout) {
29
29
  const l = layout;
30
30
  for (const key in l) {
31
+ if (key === 'ColumnFilters') {
32
+ // we don't want to cleanup ColumnFilters
33
+ // as we rely on the Uuids for identifying the filters
34
+ if (Array.isArray(l[key])) {
35
+ l[key].forEach((item) => {
36
+ if (typeof item === 'object') {
37
+ // but we do want to cleanup further down - eg: predicates in the filter
38
+ for (const k in item) {
39
+ if (typeof item[k] === 'object') {
40
+ removeAdaptableObjectPrimitivesInlineDeep(item[k]);
41
+ }
42
+ }
43
+ }
44
+ });
45
+ }
46
+ continue;
47
+ }
31
48
  if (typeof l[key] === 'object') {
32
49
  removeAdaptableObjectPrimitivesInlineDeep(l[key]);
33
50
  }
@@ -355,9 +372,9 @@ export const tableLayoutModelToTableLayout = (layoutModel) => {
355
372
  if (layoutModel.Ignore_Metadata) {
356
373
  tableLayout.Metadata = layoutModel.Ignore_Metadata;
357
374
  }
358
- if (layoutModel.RowGroupDisplayType) {
359
- tableLayout.RowGroupDisplayType = layoutModel.RowGroupDisplayType;
360
- }
375
+ // if (layoutModel.RowGroupDisplayType) {
376
+ tableLayout.RowGroupDisplayType = layoutModel.RowGroupDisplayType ?? 'single';
377
+ // }
361
378
  if (layoutModel.RowGroupedColumns) {
362
379
  tableLayout.RowGroupedColumns = layoutModel.RowGroupedColumns;
363
380
  }
@@ -511,9 +528,9 @@ export const pivotLayoutModelToPivotLayout = (layoutModel) => {
511
528
  pivotLayout.ColumnGroupValues.ExceptionGroupKeys = layoutModel.ColumnGroupValues.Values;
512
529
  }
513
530
  }
514
- if (layoutModel.RowGroupDisplayType) {
515
- pivotLayout.RowGroupDisplayType = layoutModel.RowGroupDisplayType;
516
- }
531
+ // if (layoutModel.RowGroupDisplayType) {
532
+ pivotLayout.RowGroupDisplayType = layoutModel.RowGroupDisplayType ?? 'single';
533
+ // }
517
534
  return pivotLayout;
518
535
  };
519
536
  export const isPivotLayout = (layout) => Array.isArray(layout.PivotColumns);
@@ -22,7 +22,7 @@ import { ReorderDraggable } from '../../../Components/ReorderDraggable';
22
22
  import { AdaptableFormControlTextClear } from '../../../Components/Forms/AdaptableFormControlTextClear';
23
23
  import { sortColumnIdsByOrder } from '../../../../layout-manager/src/sortColumnIdsByOrder';
24
24
  import HelpBlock from '../../../../components/HelpBlock';
25
- import { AG_GRID_SELECTION_COLUMN } from '../../../../Utilities/Constants/GeneralConstants';
25
+ import { AG_GRID_GROUPED_COLUMN, AG_GRID_SELECTION_COLUMN, } from '../../../../Utilities/Constants/GeneralConstants';
26
26
  import { isPivotLayout } from '../../../../Utilities/isPivotLayout';
27
27
  const PropertyOrderText = (props) => (React.createElement(Text, { fontWeight: 600, fontSize: 2 }, props.children));
28
28
  const columnTypes = {
@@ -261,7 +261,8 @@ export const ColumnsSection = (props) => {
261
261
  });
262
262
  }
263
263
  }
264
- if (adaptable.api.gridApi.isTreeDataGrid()) {
264
+ if (adaptable.api.gridApi.isTreeDataGrid() &&
265
+ !allColumns.find((col) => col.columnId === AG_GRID_GROUPED_COLUMN)) {
265
266
  allColumns.unshift(generateAutoTreeSingleColumn());
266
267
  }
267
268
  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;
@@ -179,6 +179,7 @@ export class AdaptableAgGrid {
179
179
  }
180
180
  return this.emitter.onIncludeFired(eventName, callback);
181
181
  };
182
+ this.__updateColumnModelAndRefreshGrid_already_called = false;
182
183
  this.lifecycleState = 'initial';
183
184
  this.emitter = new Emitter();
184
185
  this.agGridOptionsService = new AgGridOptionsService(this);
@@ -712,18 +713,30 @@ You need to define at least one Layout!`);
712
713
  };
713
714
  }
714
715
  return (params) => {
716
+ // might be a summary row
717
+ if (params.data?.[ROW_SUMMARY_ROW_ID]) {
718
+ return params.data[ROW_SUMMARY_ROW_ID];
719
+ }
720
+ if (params.level > 0) {
721
+ const parentKeys = params.parentKeys ?? [];
722
+ const values = Object.values(params.data);
723
+ let hash = 0;
724
+ for (let i = 0; i < values.length; i++) {
725
+ const str = String(values[i] ?? '');
726
+ for (let j = 0; j < str.length; j++) {
727
+ hash = ((hash << 5) - hash + str.charCodeAt(j)) | 0;
728
+ }
729
+ }
730
+ const id = [...parentKeys, Math.abs(hash)].join('/');
731
+ return id;
732
+ }
715
733
  if (params.data?.[primaryKey]) {
716
734
  const primaryKeyValue = params.data[primaryKey];
717
735
  return typeof primaryKeyValue === 'number'
718
736
  ? `${primaryKeyValue}`
719
737
  : params.data[primaryKey];
720
738
  }
721
- // might be a summary row
722
- if (params.data?.[ROW_SUMMARY_ROW_ID]) {
723
- return params.data[ROW_SUMMARY_ROW_ID];
724
- }
725
- // AFL 2024.08.17 - no idea why is this here and when it's used
726
- // might be a group row
739
+ // fallback
727
740
  const parentKeys = params.parentKeys ?? [];
728
741
  const values = Object.values(params.data);
729
742
  if (values.length) {
@@ -1865,6 +1878,20 @@ You need to define at least one Layout!`);
1865
1878
  return rawValue;
1866
1879
  }
1867
1880
  updateColumnModelAndRefreshGrid() {
1881
+ if (this.__updateColumnModelAndRefreshGrid_already_called) {
1882
+ return;
1883
+ }
1884
+ try {
1885
+ this._updateColumnModelAndRefreshGridNow();
1886
+ this.__updateColumnModelAndRefreshGrid_already_called = true;
1887
+ }
1888
+ finally {
1889
+ queueMicrotask(() => {
1890
+ this.__updateColumnModelAndRefreshGrid_already_called = false;
1891
+ });
1892
+ }
1893
+ }
1894
+ _updateColumnModelAndRefreshGridNow() {
1868
1895
  this.logger.info(`Updating Column Model and Refreshing Grid.`);
1869
1896
  this.deriveAdaptableColumnStateFromAgGrid();
1870
1897
  this.agGridColumnAdapter.setupColumns();
@@ -3551,8 +3578,8 @@ You need to define at least one Layout!`);
3551
3578
  isRowGroupDifferentInLayout(one, other) {
3552
3579
  const prevRowGroupedColumns = one.RowGroupedColumns || one.PivotGroupedColumns || [];
3553
3580
  const currentRowGroupedColumns = other.RowGroupedColumns || other.PivotGroupedColumns || [];
3554
- const prevRowGroupDisplayType = one.RowGroupDisplayType;
3555
- const currentRowGroupDisplayType = other.RowGroupDisplayType;
3581
+ const prevRowGroupDisplayType = one.RowGroupDisplayType ?? 'single';
3582
+ const currentRowGroupDisplayType = other.RowGroupDisplayType ?? 'single';
3556
3583
  if (prevRowGroupDisplayType !== currentRowGroupDisplayType) {
3557
3584
  return true;
3558
3585
  }
@@ -16,7 +16,20 @@ export class AgGridModulesAdapter {
16
16
  return this.adaptableInstance.agGridAdapter.getAgGridApi();
17
17
  }
18
18
  isAgGridModuleRegistered(moduleName) {
19
- return this.agGridApi.isModuleRegistered(moduleName);
19
+ let isModuleRegistered = this.agGridApi.isModuleRegistered(moduleName);
20
+ if (!isModuleRegistered) {
21
+ // SSRM module comes with its own implementations of Pivot, MasterDetail and TreeData
22
+ // #ssrm_pivot_module
23
+ const serverSideDependencies = [
24
+ 'PivotModule',
25
+ 'MasterDetailModule',
26
+ 'TreeDataModule',
27
+ ];
28
+ if (serverSideDependencies.includes(moduleName)) {
29
+ isModuleRegistered = this.agGridApi.isModuleRegistered('ServerSideRowModelModule');
30
+ }
31
+ }
32
+ return isModuleRegistered;
20
33
  }
21
34
  getAgGridRegisteredModules() {
22
35
  const registeredModules = [];
@@ -279,10 +279,10 @@ export const Select = function (props) {
279
279
  // ignore the event if the focus is still inside the menu
280
280
  return;
281
281
  }
282
- setTimeout(() => {
282
+ requestAnimationFrame(() => {
283
283
  // wee need to wait for the single value selection to complete before closing
284
284
  closeSelectMenu();
285
- }, 100);
285
+ });
286
286
  },
287
287
  onMouseDown: (event) => {
288
288
  if (!props.isMulti) {
package/src/env.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export default {
2
2
  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" || '',
3
- PUBLISH_TIMESTAMP: 1759139175072 || Date.now(),
4
- VERSION: "21.0.5" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1759506293070 || Date.now(),
4
+ VERSION: "21.0.6" || '--current-version--',
5
5
  };
@@ -342,9 +342,15 @@ export class LayoutManager extends LMEmitter {
342
342
  let ColumnSizing = layout.ColumnSizing || {};
343
343
  //let's also include the column widths of the pivotResult columns
344
344
  pivotResultColumns.forEach((col) => {
345
- ColumnSizing[col.getColId()] = {
346
- Width: col.getActualWidth(),
347
- };
345
+ const colId = col.getColId();
346
+ const Width = col.getActualWidth();
347
+ const initialWidth = this.initialColumnWidths[colId] ?? DEFAULT_COLUMN_WIDTH;
348
+ // but if the width is the initial/default width, don't include it in the ColumnSizing
349
+ if (Width !== initialWidth) {
350
+ ColumnSizing[colId] = {
351
+ Width,
352
+ };
353
+ }
348
354
  });
349
355
  if (!Object.keys(ColumnSizing).length) {
350
356
  ColumnSizing = undefined;
@@ -1707,6 +1713,10 @@ export class LayoutManager extends LMEmitter {
1707
1713
  }
1708
1714
  }
1709
1715
  isInPivotMode() {
1710
- return this.gridApi.isModuleRegistered('PivotModule') && this.gridApi.isPivotMode();
1716
+ // SSRM comes with its own pivot module implementation
1717
+ // see #ssrm_pivot_module
1718
+ const isModuleRegistered = this.gridApi.isModuleRegistered('PivotModule') ||
1719
+ this.gridApi.isModuleRegistered('ServerSideRowModelModule');
1720
+ return isModuleRegistered && this.gridApi.isPivotMode();
1711
1721
  }
1712
1722
  }