@adaptabletools/adaptable 24.0.2 → 24.0.3

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.
Files changed (104) hide show
  1. package/devtools.d.ts +506 -5
  2. package/devtools.js +11 -1
  3. package/index.css +15 -5
  4. package/package.json +1 -1
  5. package/src/AdaptableInterfaces/IAdaptable.d.ts +6 -1
  6. package/src/AdaptableOptions/DataImportOptions.d.ts +1 -1
  7. package/src/AdaptableOptions/ExportOptions.d.ts +2 -2
  8. package/src/AdaptableState/Common/AdaptableFormat.d.ts +2 -10
  9. package/src/AdaptableState/Common/RowSummary.d.ts +2 -0
  10. package/src/AdaptableState/LayoutState.d.ts +1 -1
  11. package/src/Api/Implementation/AlertApiImpl.js +2 -0
  12. package/src/Api/Internal/CalculatedColumnInternalApi.js +25 -3
  13. package/src/Api/Internal/ExportInternalApi.d.ts +2 -0
  14. package/src/Api/Internal/ExportInternalApi.js +39 -3
  15. package/src/Api/Internal/LayoutInternalApi.d.ts +11 -1
  16. package/src/Api/Internal/LayoutInternalApi.js +34 -3
  17. package/src/Api/Internal/NoteInternalApi.d.ts +12 -0
  18. package/src/Api/Internal/NoteInternalApi.js +11 -0
  19. package/src/EnvVars.d.ts +1 -0
  20. package/src/EnvVars.js +1 -0
  21. package/src/Redux/Store/AdaptableStore.js +4 -7
  22. package/src/Strategy/FlashingCellModule.js +2 -0
  23. package/src/Utilities/Services/CalculatedColumnExpressionService.d.ts +1 -0
  24. package/src/Utilities/Services/CalculatedColumnExpressionService.js +15 -0
  25. package/src/Utilities/Services/Interface/ICalculatedColumnExpressionService.d.ts +7 -0
  26. package/src/Utilities/Services/Interface/IQueryLanguageService.d.ts +17 -1
  27. package/src/Utilities/Services/QueryLanguageService.d.ts +11 -1
  28. package/src/Utilities/Services/QueryLanguageService.js +46 -1
  29. package/src/Utilities/Services/RowSummaryService.d.ts +2 -0
  30. package/src/Utilities/Services/RowSummaryService.js +6 -1
  31. package/src/Utilities/license/instanceLicense.d.ts +12 -0
  32. package/src/Utilities/license/instanceLicense.js +10 -0
  33. package/src/Utilities/license/licenseStatus.d.ts +26 -0
  34. package/src/Utilities/license/licenseStatus.js +72 -0
  35. package/src/View/Components/CellPopup/index.js +15 -10
  36. package/src/View/GridInfo/GridInfoPopup.js +6 -1
  37. package/src/View/Layout/TransposedPopup.js +1 -0
  38. package/src/View/Layout/Wizard/sections/AggregationsSection.d.ts +3 -5
  39. package/src/View/Layout/Wizard/sections/AggregationsSection.js +10 -24
  40. package/src/View/Layout/Wizard/sections/RowSummarySection.js +5 -1
  41. package/src/View/ObjectItemViews/Layout/aggregationSummaryHelpers.d.ts +5 -1
  42. package/src/View/ObjectItemViews/Layout/aggregationSummaryHelpers.js +6 -3
  43. package/src/agGrid/AdaptableAgGrid.d.ts +7 -3
  44. package/src/agGrid/AdaptableAgGrid.js +122 -47
  45. package/src/agGrid/AdaptableFilterHandler.d.ts +2 -0
  46. package/src/agGrid/AdaptableFilterHandler.js +34 -0
  47. package/src/agGrid/AgGridAdapter.d.ts +9 -0
  48. package/src/agGrid/AgGridAdapter.js +23 -12
  49. package/src/agGrid/AgGridColumnAdapter.d.ts +2 -0
  50. package/src/agGrid/AgGridColumnAdapter.js +124 -78
  51. package/src/agGrid/AgGridExportAdapter.d.ts +5 -0
  52. package/src/agGrid/AgGridExportAdapter.js +31 -0
  53. package/src/agGrid/AgGridMenuAdapter.js +1 -1
  54. package/src/agGrid/applyGlobalGridOptions.d.ts +9 -0
  55. package/src/agGrid/applyGlobalGridOptions.js +36 -0
  56. package/src/agGrid/cellRenderers/BadgeRenderer.js +22 -0
  57. package/src/agGrid/columnMinMaxCache.d.ts +33 -0
  58. package/src/agGrid/columnMinMaxCache.js +50 -0
  59. package/src/devTools/PerfStore.d.ts +218 -0
  60. package/src/devTools/PerfStore.js +717 -0
  61. package/src/devTools/index.d.ts +33 -0
  62. package/src/devTools/index.js +132 -56
  63. package/src/devTools/logBuffer.d.ts +17 -0
  64. package/src/devTools/logBuffer.js +33 -0
  65. package/src/devTools/memoryInfo.d.ts +15 -0
  66. package/src/devTools/memoryInfo.js +229 -0
  67. package/src/devTools/memoryRoots.d.ts +41 -0
  68. package/src/devTools/memoryRoots.js +136 -0
  69. package/src/devTools/perfContext.d.ts +5 -0
  70. package/src/devTools/perfContext.js +155 -0
  71. package/src/devTools/perfInstrumentation.d.ts +13 -0
  72. package/src/devTools/perfInstrumentation.js +78 -0
  73. package/src/env.js +2 -2
  74. package/src/layout-manager/src/LayoutManagerModel.d.ts +3 -1
  75. package/src/layout-manager/src/expandAllRowGroups.d.ts +6 -0
  76. package/src/layout-manager/src/expandAllRowGroups.js +13 -0
  77. package/src/layout-manager/src/index.js +18 -10
  78. package/src/setupDevTools.js +560 -106
  79. package/tsconfig.esm.tsbuildinfo +1 -1
  80. package/vendor/components/Combobox/index.js +1 -1
  81. package/vendor/components/Combobox/index.js.map +1 -1
  82. package/vendor/components/Radio/index.d.ts.map +1 -1
  83. package/vendor/components/Radio/index.js +1 -1
  84. package/vendor/components/Radio/index.js.map +1 -1
  85. package/vendor/components/Resizable/index.d.ts +14 -9
  86. package/vendor/components/Resizable/index.d.ts.map +1 -1
  87. package/vendor/components/Resizable/index.js +23 -0
  88. package/vendor/components/Resizable/index.js.map +1 -1
  89. package/vendor/components/Resizable/resizableUtils.d.ts +24 -13
  90. package/vendor/components/Resizable/resizableUtils.d.ts.map +1 -1
  91. package/vendor/components/Resizable/resizableUtils.js +13 -3
  92. package/vendor/components/Resizable/resizableUtils.js.map +1 -1
  93. package/vendor/components/index.css +12 -5
  94. package/vendor/components/ui/combobox.js +1 -1
  95. package/vendor/components/ui/combobox.js.map +1 -1
  96. package/vendor/components/ui/input.js +1 -1
  97. package/vendor/components/ui/input.js.map +1 -1
  98. package/vendor/components/ui/select.js +1 -1
  99. package/vendor/components/ui/select.js.map +1 -1
  100. package/vendor/components/ui/textarea.js +1 -1
  101. package/vendor/components/ui/textarea.js.map +1 -1
  102. package/vendor/components/ui/tooltip.d.ts.map +1 -1
  103. package/vendor/components/ui/tooltip.js +3 -1
  104. package/vendor/components/ui/tooltip.js.map +1 -1
@@ -1,6 +1,8 @@
1
1
  import { debounce } from '../Utilities/Helpers/TimingHelper';
2
2
  import { createGrid, } from 'ag-grid-enterprise';
3
+ import { computeMinMax, updateColumnMinMaxCacheEntry, } from './columnMinMaxCache';
3
4
  import { AdaptableLogger } from './AdaptableLogger';
5
+ import { applyGlobalGridOptions } from './applyGlobalGridOptions';
4
6
  import { PrimaryKeyDocsLink } from '../Utilities/Constants/DocumentationLinkConstants';
5
7
  import { describeGridRefreshScope, FULL_GRID_REFRESH_SCOPE, getMissingGridRefreshScope, mergeGridRefreshScopes, } from './gridRefreshScope';
6
8
  import StringExtensions from '../Utilities/Extensions/StringExtensions';
@@ -84,7 +86,8 @@ import { AgGridColumnAdapter } from './AgGridColumnAdapter';
84
86
  import getScrollbarSize from '../Utilities/getScrollbarSize';
85
87
  import { ONLY_AGG_FN_NAME, WEIGHTED_AVERAGE_AGG_FN_NAME, } from '../AdaptableState/Common/AggregationColumns';
86
88
  import { RowFormService } from '../Utilities/Services/RowFormService';
87
- import { ADAPTABLE_PUBLISH_TIMESTAMP } from '../EnvVars';
89
+ import { ADAPTABLE_PUBLISH_DATE } from '../EnvVars';
90
+ import { getInstanceLicenseKey } from '../Utilities/license/instanceLicense';
88
91
  import { AdaptableUpgradeHelper } from '../migration/AdaptableUpgradeHelper';
89
92
  import { stripDeprecatedStateKeys } from '../migration/DeprecatedStateKeys';
90
93
  import { ensureLoadingScreenPortalElement } from '../components/Modal';
@@ -100,6 +103,7 @@ import { checkForDuplicateColumns, resetLayoutHelperErrorOnceMessages, getLayout
100
103
  import { applyAutoCreatedLayout, buildLayoutFromColDefs, resolveAutoCreateLayoutConfig, } from '../Utilities/Helpers/Layouts/AutoCreateLayoutHelper';
101
104
  import { LayoutManager } from '../layout-manager/src';
102
105
  import { rowGroupDisplayTypeToGridOption } from '../layout-manager/src/rowGroupDisplayType';
106
+ import { expandAllRowGroups } from '../layout-manager/src/expandAllRowGroups';
103
107
  import { isPivotLayoutModel } from '../layout-manager/src/isPivotLayoutModel';
104
108
  import { ACTION_COLUMN_TYPE, CALCULATED_COLUMN_TYPE, FDC3_COLUMN_TYPE, FREE_TEXT_COLUMN_TYPE, HIDDEN_COLUMN_TYPE, hiddenColDefConfig, PIVOT_AGGREGATION_TOTAL_COLUMN_TYPE, PIVOT_ANY_TOTAL_COLUMN_TYPE, PIVOT_COLUMN_TOTAL_COLUMN_TYPE, PIVOT_GRAND_TOTAL_COLUMN_TYPE, } from '../AdaptableState/Common/AdaptableColumn';
105
109
  import { mergeDataTypeDefinitions } from './AgGridCellDataTypeHelper';
@@ -107,7 +111,18 @@ import { AgGridThemeAdapter } from './AgGridThemeAdapter';
107
111
  import { mapOldTypeToDataType } from '../migration/VersionUpgrade20';
108
112
  import { tagProvidedByAdaptable } from '../Utilities/adaptableOverrideCheck';
109
113
  import { AgGridModulesAdapter } from './AgGridModulesAdapter';
110
- import { getMarker } from '../devTools';
114
+ import { getMarker, getStartupMarker } from '../devTools';
115
+ import { getPerfRecorder } from '../devTools/PerfStore';
116
+ const describeGridFilterPerf = () => ({
117
+ module: 'GridFilter',
118
+ objectName: 'Grid Filter (per row)',
119
+ });
120
+ const describeDataChangePerf = () => ({
121
+ objectName: 'Data change handling (Alerts, Flashing, Validation, history, refresh)',
122
+ });
123
+ const describeRefilterPerf = () => ({
124
+ objectName: 'Full re-filter after a data change',
125
+ });
111
126
  import { DeepMap } from '@infinite-table/infinite-react';
112
127
  import { DateFormatter } from '../Utilities/Helpers/DisplayFormatHelper';
113
128
  import { AgGridFilterAdapterFactory } from './AgGridFilterAdapter';
@@ -115,7 +130,6 @@ import { AdaptableFilterHandler } from './AdaptableFilterHandler';
115
130
  import { getColumnFilterInListValues } from '../aql/columnFilterQl';
116
131
  import { AgGridFloatingFilterAdapterFactory } from './AgGridFloatingFilterAdapter';
117
132
  import { listenForDevTools } from '../setupDevTools';
118
- const publishTimestamp = Number(ADAPTABLE_PUBLISH_TIMESTAMP);
119
133
  export class AdaptableAgGrid {
120
134
  logger;
121
135
  lifecycleState;
@@ -166,7 +180,6 @@ export class AdaptableAgGrid {
166
180
  listenerGlobalChartingChanges;
167
181
  listenerCellEditingStarted;
168
182
  listenerFirstDataRendered;
169
- listenerPivotChanged;
170
183
  listenerCellSelectionChanged;
171
184
  listenerSortChanged;
172
185
  listenerColumnGroupOpened;
@@ -233,6 +246,7 @@ export class AdaptableAgGrid {
233
246
  return this.emitter.onIncludeFired(eventName, callback);
234
247
  };
235
248
  static async _initInternal(config) {
249
+ applyGlobalGridOptions(config.gridOptions);
236
250
  let promise = null;
237
251
  if (Array.isArray(config.adaptableOptions.plugins)) {
238
252
  const agGridOptions = {
@@ -288,7 +302,7 @@ export class AdaptableAgGrid {
288
302
  this.logger = this.logger ?? new AdaptableLogger(this._rawAdaptableOptions.adaptableId);
289
303
  resetLayoutHelperErrorOnceMessages();
290
304
  const adaptableId = this._rawAdaptableOptions.adaptableId;
291
- const initMarker = getMarker(adaptableId).track.Init.label.Init.start();
305
+ const initMarker = getStartupMarker(adaptableId).track.Init.label.Init.start();
292
306
  const perfInitAdaptableAgGrid = this.logger.beginPerf(`Adaptable._initAdaptableAgGrid()`);
293
307
  this.variant = config.variant;
294
308
  this.initWithLazyData =
@@ -320,7 +334,7 @@ export class AdaptableAgGrid {
320
334
  this.forPlugins((plugin) => plugin.afterInitServices(this));
321
335
  this.adaptableModules = this.initModules();
322
336
  this.forPlugins((plugin) => plugin.afterInitModules(this, this.adaptableModules));
323
- const loadStoreMarker = getMarker(adaptableId).track.Init.label.LoadStore.start();
337
+ const loadStoreMarker = getStartupMarker(adaptableId).track.Init.label.LoadStore.start();
324
338
  const perfLoadStore = this.logger.beginPerf(`loadStore()`);
325
339
  this.adaptableStore = this.initAdaptableStore();
326
340
  this.forPlugins((plugin) => plugin.afterInitStore(this));
@@ -348,7 +362,7 @@ export class AdaptableAgGrid {
348
362
  this.disableUnsupportedAdaptableFilter(colDef, String(colDef.colId ?? colDef.field ?? ''));
349
363
  });
350
364
  gridOptions.columnDefs = columnDefs;
351
- this.setInitialGridOptions(gridOptions, config.variant);
365
+ this.setInitialGridOptions(gridOptions);
352
366
  const { gridState: initialGridState, layoutModel } = this.mapAdaptableStateToAgGridState(this.adaptableStore.TheStore.getState(), gridOptions.columnDefs, {
353
367
  isTree: !!gridOptions.treeData,
354
368
  colTypes: gridOptions.columnTypes,
@@ -376,7 +390,7 @@ export class AdaptableAgGrid {
376
390
  this.lifecycleState = 'initAgGrid';
377
391
  this.agGridAdapter.initialGridOptions = gridOptions;
378
392
  const perfInitAgGrid = this.logger.beginPerf(`initAgGrid()`);
379
- const initAgGridMarker = getMarker(adaptableId).track.Init.label.InitAGGrid.start();
393
+ const initAgGridMarker = getStartupMarker(adaptableId).track.Init.label.InitAGGrid.start();
380
394
  this.validateColumnDefTypes(gridOptions.columnDefs);
381
395
  const agGridApi = await this.initializeAgGrid(gridOptions, config.modules, config.renderAgGridFrameworkComponent);
382
396
  if (agGridApi === false) {
@@ -751,7 +765,7 @@ export class AdaptableAgGrid {
751
765
  }
752
766
  return adaptableOptions;
753
767
  }
754
- setInitialGridOptions(gridOptions, variant) {
768
+ setInitialGridOptions(gridOptions) {
755
769
  this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'context', (original_context) => {
756
770
  const userContext = original_context || {};
757
771
  return {
@@ -936,6 +950,13 @@ export class AdaptableAgGrid {
936
950
  }
937
951
  return currentLayout.SuppressAggFuncInHeader;
938
952
  });
953
+ this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'ssrmExpandAllAffectsAllRows', (original_ssrmExpandAllAffectsAllRows) => {
954
+ if (original_ssrmExpandAllAffectsAllRows != undefined ||
955
+ gridOptions.rowModelType !== 'serverSide') {
956
+ return original_ssrmExpandAllAffectsAllRows;
957
+ }
958
+ return true;
959
+ });
939
960
  this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'aggFuncs', (original_aggFuncs) => {
940
961
  const aggregationFunctions = original_aggFuncs || {};
941
962
  aggregationFunctions[ONLY_AGG_FN_NAME] = (params) => {
@@ -1029,8 +1050,19 @@ export class AdaptableAgGrid {
1029
1050
  return true;
1030
1051
  }
1031
1052
  const gridFilterPasses = resolveGridFilterPassPlan().passes;
1032
- if (gridFilterPasses && !gridFilterPasses(node)) {
1033
- return false;
1053
+ if (gridFilterPasses) {
1054
+ const recorder = getPerfRecorder(this.adaptableOptions?.adaptableId);
1055
+ if (recorder) {
1056
+ const start = performance.now();
1057
+ const passes = gridFilterPasses(node);
1058
+ recorder.add('gridFilter', 'gridFilter', start, describeGridFilterPerf);
1059
+ if (!passes) {
1060
+ return false;
1061
+ }
1062
+ }
1063
+ else if (!gridFilterPasses(node)) {
1064
+ return false;
1065
+ }
1034
1066
  }
1035
1067
  const result = original_doesExternalFilterPass
1036
1068
  ? original_doesExternalFilterPass(node)
@@ -1056,6 +1088,12 @@ export class AdaptableAgGrid {
1056
1088
  return this.agGridMenuAdapter.buildContextMenu(params, original_getContextMenuItems);
1057
1089
  };
1058
1090
  });
1091
+ if (this._isDetailGridForIndex == null) {
1092
+ const ignoredMenuCallbacks = ['getContextMenuItems', 'getColumnMenuItems', 'getMainMenuItems'].filter((propertyName) => this.agGridOptionsService.getUserGridOptionsProperty(propertyName));
1093
+ if (ignoredMenuCallbacks.length) {
1094
+ this.logger.consoleWarn(`GridOptions ${ignoredMenuCallbacks.join(', ')} ${ignoredMenuCallbacks.length === 1 ? 'is' : 'are'} ignored, as AdapTable builds the Context and Column Menus. Use contextMenuOptions.customContextMenu and columnMenuOptions.customColumnMenu instead.`);
1095
+ }
1096
+ }
1059
1097
  this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'components', (original_components) => {
1060
1098
  const AdaptableToolPanel = getAdaptableToolPanelAgGridComponent(this);
1061
1099
  const components = original_components || {};
@@ -1065,8 +1103,6 @@ export class AdaptableAgGrid {
1065
1103
  };
1066
1104
  return adaptableComponents;
1067
1105
  });
1068
- if (variant === 'react') {
1069
- }
1070
1106
  if (gridOptions.sideBar != undefined) {
1071
1107
  this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'sideBar', (original_sideBar) => {
1072
1108
  if (!original_sideBar) {
@@ -1414,7 +1450,7 @@ export class AdaptableAgGrid {
1414
1450
  }
1415
1451
  initAdaptableStore() {
1416
1452
  const perfNewAdaptableStore = this.logger.beginPerf(`initAdaptableStore()`);
1417
- const initAdaptableStoreMarker = getMarker(this.adaptableOptions.adaptableId).track.Init.label.InitStore.start();
1453
+ const initAdaptableStoreMarker = getStartupMarker(this.adaptableOptions.adaptableId).track.Init.label.InitStore.start();
1418
1454
  const adaptableStore = new AdaptableStore(this);
1419
1455
  adaptableStore.onBeforeAny((eventName, data) => {
1420
1456
  if (this.isReady) {
@@ -1482,16 +1518,6 @@ export class AdaptableAgGrid {
1482
1518
  });
1483
1519
  }
1484
1520
  }));
1485
- this.agGridAdapter.getAgGridApi().addEventListener('columnPivotChanged', (this.listenerPivotChanged = (params) => {
1486
- if (params.type == 'columnPivotChanged' &&
1487
- params.columnApi != null &&
1488
- params.columnApi.columnController != null &&
1489
- params.columnApi.columnController.pivotMode == true) {
1490
- if (this.api.layoutApi.getCurrentLayout().AutoSizeColumns) {
1491
- this.agGridAdapter.getAgGridApi().autoSizeAllColumns();
1492
- }
1493
- }
1494
- }));
1495
1521
  this.debouncedSetSelectedRows = debounce(() => {
1496
1522
  if (!this.isReady) {
1497
1523
  return;
@@ -1626,8 +1652,7 @@ export class AdaptableAgGrid {
1626
1652
  if (node.__localEventService) {
1627
1653
  return;
1628
1654
  }
1629
- if (node.rowPinned != null &&
1630
- node.pinnedSibling) {
1655
+ if (node.rowPinned != null && node.pinnedSibling) {
1631
1656
  return;
1632
1657
  }
1633
1658
  this.onCellDataChanged({
@@ -1704,10 +1729,8 @@ export class AdaptableAgGrid {
1704
1729
  this.RowFormService = new RowFormService(this.api);
1705
1730
  }
1706
1731
  initLicenseService() {
1707
- const globalObject = typeof globalThis !== 'undefined' ? globalThis : window;
1708
- const licenseKey = globalObject.ADAPTABLE_LICENSE_KEY || this.api.optionsApi.getLicenseKey();
1709
- return new LicenseService(this, licenseKey, {
1710
- publishedAt: publishTimestamp,
1732
+ return new LicenseService(this, getInstanceLicenseKey(this.api), {
1733
+ publishedAt: ADAPTABLE_PUBLISH_DATE,
1711
1734
  });
1712
1735
  }
1713
1736
  initModules() {
@@ -2272,9 +2295,18 @@ export class AdaptableAgGrid {
2272
2295
  });
2273
2296
  return data;
2274
2297
  }
2298
+ countTransactionForPerf(transaction) {
2299
+ const recorder = getPerfRecorder(this.adaptableOptions?.adaptableId);
2300
+ if (recorder) {
2301
+ recorder.count('rowTransactions', (transaction.add?.length ?? 0) +
2302
+ (transaction.update?.length ?? 0) +
2303
+ (transaction.remove?.length ?? 0));
2304
+ }
2305
+ }
2275
2306
  applyAgGridTransaction(transaction) {
2276
2307
  const isServerSideRowModel = this.getAgGridRowModelType() === 'serverSide';
2277
2308
  const agGridApi = this.agGridAdapter.getAgGridApi();
2309
+ this.countTransactionForPerf(transaction);
2278
2310
  if (isServerSideRowModel) {
2279
2311
  return agGridApi.applyServerSideTransaction(transaction);
2280
2312
  }
@@ -2291,6 +2323,7 @@ export class AdaptableAgGrid {
2291
2323
  applyAgGridTransactionAsync(transaction, callback) {
2292
2324
  const isServerSideRowModel = this.getAgGridRowModelType() === 'serverSide';
2293
2325
  const agGridApi = this.agGridAdapter.getAgGridApi();
2326
+ this.countTransactionForPerf(transaction);
2294
2327
  if (isServerSideRowModel) {
2295
2328
  return agGridApi.applyServerSideTransactionAsync(transaction, callback);
2296
2329
  }
@@ -3520,7 +3553,7 @@ export class AdaptableAgGrid {
3520
3553
  .removeRowGroupColumns(this.agGridAdapter.getAgGridApi().getRowGroupColumns());
3521
3554
  }
3522
3555
  expandAllRowGroups() {
3523
- this.agGridAdapter.getAgGridApi().expandAll();
3556
+ expandAllRowGroups(this.agGridAdapter.getAgGridApi());
3524
3557
  }
3525
3558
  collapseAllRowGroups() {
3526
3559
  this.agGridAdapter.getAgGridApi().collapseAll();
@@ -3570,11 +3603,14 @@ export class AdaptableAgGrid {
3570
3603
  if (distinctRawValues.length === 0) {
3571
3604
  return undefined;
3572
3605
  }
3573
- if (aggregation === 'min') {
3574
- value = Math.min(...distinctRawValues);
3575
- }
3576
- else if (aggregation === 'max') {
3577
- value = Math.max(...distinctRawValues);
3606
+ if (aggregation === 'min' || aggregation === 'max') {
3607
+ const { min, max } = computeMinMax(distinctRawValues);
3608
+ this.columnMinMaxValuesCache[columnId] = {
3609
+ ...this.columnMinMaxValuesCache[columnId],
3610
+ min,
3611
+ max,
3612
+ };
3613
+ return aggregation === 'min' ? min : max;
3578
3614
  }
3579
3615
  else if (aggregation === 'avg') {
3580
3616
  const sum = distinctRawValues.reduce((acc, v) => acc + v, 0);
@@ -3613,7 +3649,6 @@ export class AdaptableAgGrid {
3613
3649
  const agGridApi = this.agGridAdapter?.getAgGridApi();
3614
3650
  if (agGridApi && !agGridApi.isDestroyed()) {
3615
3651
  agGridApi.removeEventListener('firstDataRendered', this.listenerFirstDataRendered);
3616
- agGridApi.removeEventListener('columnPivotChanged', this.listenerPivotChanged);
3617
3652
  agGridApi.removeEventListener('cellEditingStarted', this.listenerCellEditingStarted);
3618
3653
  agGridApi.removeEventListener('cellSelectionChanged', this.listenerCellSelectionChanged);
3619
3654
  agGridApi.removeEventListener('columnGroupOpened', this.listenerColumnGroupOpened);
@@ -3626,7 +3661,6 @@ export class AdaptableAgGrid {
3626
3661
  this.agGridAdapter.getAgGridApi().removeGlobalListener(this.listenerGlobalChartingChanges);
3627
3662
  }
3628
3663
  this.listenerFirstDataRendered = null;
3629
- this.listenerPivotChanged = null;
3630
3664
  this.listenerColumnGroupOpened = null;
3631
3665
  this.listenerCellEditingStarted = null;
3632
3666
  this.listenerCellSelectionChanged = null;
@@ -3965,6 +3999,21 @@ export class AdaptableAgGrid {
3965
3999
  return !!undoChange;
3966
4000
  }
3967
4001
  performPostEditChecks(rowNode, cellDataChangedInfos) {
4002
+ const recorder = getPerfRecorder(this.adaptableOptions?.adaptableId);
4003
+ if (!recorder) {
4004
+ this.performPostEditChecksNow(rowNode, cellDataChangedInfos);
4005
+ return;
4006
+ }
4007
+ const start = performance.now();
4008
+ try {
4009
+ this.performPostEditChecksNow(rowNode, cellDataChangedInfos);
4010
+ }
4011
+ finally {
4012
+ recorder.count('cellChanges', cellDataChangedInfos.length);
4013
+ recorder.add('dataChange', 'dataChange', start, describeDataChangePerf);
4014
+ }
4015
+ }
4016
+ performPostEditChecksNow(rowNode, cellDataChangedInfos) {
3968
4017
  cellDataChangedInfos = expandCellDataChangedInfosWithCalculatedColumns(this.api, cellDataChangedInfos);
3969
4018
  cellDataChangedInfos.forEach((cellDataChangedInfo) => {
3970
4019
  if (cellDataChangedInfo.trigger === 'undo') {
@@ -3976,7 +4025,7 @@ export class AdaptableAgGrid {
3976
4025
  this.checkIfChangedCellCurrentlySelected(cellDataChangedInfo);
3977
4026
  }
3978
4027
  this.DataService.CreateCellDataChangedEvent(cellDataChangedInfo);
3979
- this.resetMinMaxCachedValueForColumn(cellDataChangedInfo.column);
4028
+ this.updateMinMaxCachedValueForColumn(cellDataChangedInfo);
3980
4029
  });
3981
4030
  this.applyPostEditRefresh(rowNode, this.collectPostEditRefreshScope(rowNode, cellDataChangedInfos));
3982
4031
  const colIds = cellDataChangedInfos.map((c) => c.column.columnId);
@@ -4018,6 +4067,11 @@ export class AdaptableAgGrid {
4018
4067
  scope.columnIds.add(affected.columnId);
4019
4068
  }
4020
4069
  });
4070
+ if (isVisible) {
4071
+ expressionService
4072
+ .getAggregatedCalculatedColumnsAffectedByColumn(columnId)
4073
+ .forEach((affectedColumnId) => scope.columnIds.add(affectedColumnId));
4074
+ }
4021
4075
  }
4022
4076
  }
4023
4077
  const styledColumn = this.api.styledColumnApi.getActiveStyledColumnForColumn(info.column);
@@ -4124,24 +4178,45 @@ export class AdaptableAgGrid {
4124
4178
  }
4125
4179
  }
4126
4180
  }
4127
- resetMinMaxCachedValueForColumn(column) {
4128
- if (!column) {
4129
- this.columnMinMaxValuesCache[column.columnId] = {};
4130
- }
4131
- if (this.columnMinMaxValuesCache[column.columnId]) {
4132
- this.columnMinMaxValuesCache[column.columnId] = undefined;
4181
+ updateMinMaxCachedValueForColumn(cellDataChangedInfo) {
4182
+ const columnId = cellDataChangedInfo.column?.columnId;
4183
+ if (!columnId || !this.columnMinMaxValuesCache?.[columnId]) {
4184
+ return;
4133
4185
  }
4186
+ this.columnMinMaxValuesCache[columnId] = updateColumnMinMaxCacheEntry(this.columnMinMaxValuesCache[columnId], cellDataChangedInfo);
4134
4187
  }
4135
4188
  filterOnDataChange() {
4136
- this.agGridAdapter.getAgGridApi()?.onFilterChanged();
4189
+ const recorder = getPerfRecorder(this.adaptableOptions?.adaptableId);
4190
+ if (!recorder) {
4191
+ this.agGridAdapter.getAgGridApi()?.onFilterChanged();
4192
+ return;
4193
+ }
4194
+ const start = performance.now();
4195
+ try {
4196
+ this.agGridAdapter.getAgGridApi()?.onFilterChanged();
4197
+ }
4198
+ finally {
4199
+ recorder.count('refiltersFromDataChange');
4200
+ recorder.add('filterPass', 'filterPass:dataChange', start, describeRefilterPerf);
4201
+ }
4137
4202
  }
4138
- refreshLayout() {
4203
+ refreshLayout(config) {
4139
4204
  const columnDefs = this.agGridAdapter.getColumnDefinitionsInclSpecialColumns();
4140
4205
  this.agGridAdapter.setGridOption('columnDefs', columnDefs);
4141
4206
  this.__forceUpdateColumnModel = true;
4142
4207
  this.updateLayoutInManagerAfterStoreHasChanged();
4208
+ if (config?.columnsChanged &&
4209
+ this.getAgGridRowModelType() === 'serverSide' &&
4210
+ !this.isAnyFilterActive()) {
4211
+ return;
4212
+ }
4143
4213
  this.applyFiltering();
4144
4214
  }
4215
+ isAnyFilterActive() {
4216
+ return (this.api.filterApi.columnFilterApi.getActiveColumnFilters().length > 0 ||
4217
+ StringExtensions.IsNotNullOrEmpty(this.api.filterApi.gridFilterApi.getCurrentGridFilterExpression()) ||
4218
+ Object.keys(this.agGridAdapter.getAgGridApi().getFilterModel() ?? {}).length > 0);
4219
+ }
4145
4220
  isRowGroupDifferentInLayout(one, other) {
4146
4221
  const prevRowGroupedColumns = one.RowGroupedColumns || one.PivotGroupedColumns || [];
4147
4222
  const currentRowGroupedColumns = other.RowGroupedColumns || other.PivotGroupedColumns || [];
@@ -16,6 +16,8 @@ export declare class AdaptableFilterHandler implements FilterHandler<any, any, C
16
16
  */
17
17
  onDisplayValuesInvalidated(listener: () => void): () => void;
18
18
  private notifyDisplayValuesInvalidated;
19
+ private perfAdaptableId?;
20
+ private getAdaptableIdForPerf;
19
21
  init(params: FilterHandlerParams): void;
20
22
  doesFilterPass(params: DoesFilterPassParams<any, any, ColumnFilter>): boolean;
21
23
  getCachedFilterDisplayValues(): InFilterValueResult | undefined;
@@ -1,3 +1,4 @@
1
+ import { getPerfRecorder } from '../devTools/PerfStore';
1
2
  import { getColumnFilterInListValues } from '../aql/columnFilterQl';
2
3
  export class AdaptableFilterHandler {
3
4
  adaptableApi;
@@ -20,6 +21,18 @@ export class AdaptableFilterHandler {
20
21
  listener();
21
22
  });
22
23
  }
24
+ perfAdaptableId;
25
+ getAdaptableIdForPerf() {
26
+ if (this.perfAdaptableId === undefined) {
27
+ try {
28
+ this.perfAdaptableId = this.adaptableApi.optionsApi.getAdaptableId();
29
+ }
30
+ catch {
31
+ return undefined;
32
+ }
33
+ }
34
+ return this.perfAdaptableId;
35
+ }
23
36
  init(params) {
24
37
  this.colId = params.column.getColId();
25
38
  }
@@ -38,6 +51,20 @@ export class AdaptableFilterHandler {
38
51
  if (columnFilterModel.IsSuspended) {
39
52
  return true;
40
53
  }
54
+ const recorder = getPerfRecorder(this.getAdaptableIdForPerf());
55
+ if (recorder) {
56
+ const start = performance.now();
57
+ try {
58
+ return this.adaptableApi.filterApi.columnFilterApi.internalApi.evaluateColumnFilter(columnFilterModel, rowNode);
59
+ }
60
+ finally {
61
+ recorder.add('columnFilter', `columnFilter:${this.colId}`, start, () => ({
62
+ module: 'ColumnFilter',
63
+ columnId: this.colId,
64
+ objectName: `Column Filter on "${this.colId}"`,
65
+ }));
66
+ }
67
+ }
41
68
  return this.adaptableApi.filterApi.columnFilterApi.internalApi.evaluateColumnFilter(columnFilterModel, rowNode);
42
69
  }
43
70
  catch (ex) {
@@ -59,6 +86,8 @@ export class AdaptableFilterHandler {
59
86
  }
60
87
  async fetchFilterDisplayValues(options) {
61
88
  this.rememberSelectedLazyInFilterValues(undefined);
89
+ const recorder = getPerfRecorder(this.getAdaptableIdForPerf());
90
+ const start = recorder ? performance.now() : 0;
62
91
  return this.adaptableApi.gridApi.internalApi
63
92
  .getDistinctFilterDisplayValuesForColumn({
64
93
  columnId: this.colId,
@@ -70,6 +99,11 @@ export class AdaptableFilterHandler {
70
99
  limit: options.limit,
71
100
  })
72
101
  .then((result) => {
102
+ recorder?.add('inFilterValues', `inFilterValues:${this.colId}`, start, () => ({
103
+ module: 'ColumnFilter',
104
+ columnId: this.colId,
105
+ objectName: `IN filter values of "${this.colId}"`,
106
+ }));
73
107
  this.rememberSelectedLazyInFilterValues(result);
74
108
  this.filterDisplayValuesResult = result;
75
109
  return result;
@@ -86,6 +86,15 @@ export declare class AgGridAdapter {
86
86
  private enhanceColDefsWithSpecialColumns;
87
87
  private getSpecialColDefs;
88
88
  deriveSelectedCellInfoFromAgGrid(): SelectedCellInfo;
89
+ /**
90
+ * The first and last displayed body row index covered by a cell range, or `undefined` if it covers none.
91
+ *
92
+ * A range end in a pinned row has the row's index inside its pinned container, not a body index.
93
+ * Pinned rows (Row Summaries, a pinned Grand Total Row, user-pinned copies of body rows) are not
94
+ * included: a range reaching into the pinned top rows starts at the first body row, and one
95
+ * reaching into the pinned bottom rows ends at the last body row.
96
+ */
97
+ private getBodyRowIndexesInRange;
89
98
  deriveSelectedRowInfoFromAgGrid(): SelectedRowInfo;
90
99
  isPinnedRowNode(rowNode: IRowNode): boolean;
91
100
  createAdaptableColumnFromAgGridColumn(agGridColumn: Column, colsToGroups: Record<string, AdaptableColumnGroup>): AdaptableColumn;
@@ -387,19 +387,10 @@ export class AgGridAdapter {
387
387
  const columns = [];
388
388
  const gridCells = [];
389
389
  selected.forEach((rangeSelection) => {
390
- let shouldIncludeRange = true;
391
390
  if (rangeSelection.startRow && rangeSelection.endRow) {
392
- let isStartRowPin = rangeSelection.startRow.rowPinned != null;
393
- let isEndRowPin = rangeSelection.endRow.rowPinned != null;
394
- if (isStartRowPin) {
395
- if (isEndRowPin) {
396
- shouldIncludeRange = false;
397
- }
398
- this.logger.consoleWarn('Pinned rows cannot be selected in AG Grid.');
399
- }
400
- if (shouldIncludeRange) {
401
- const y1 = Math.min(rangeSelection.startRow.rowIndex, rangeSelection.endRow.rowIndex);
402
- const y2 = Math.max(rangeSelection.startRow.rowIndex, rangeSelection.endRow.rowIndex);
391
+ const bodyRowIndexes = this.getBodyRowIndexesInRange(rangeSelection.startRow, rangeSelection.endRow);
392
+ if (bodyRowIndexes) {
393
+ const [y1, y2] = bodyRowIndexes;
403
394
  for (const column of rangeSelection.columns) {
404
395
  if (column != null) {
405
396
  const colId = column.getColId();
@@ -425,6 +416,26 @@ export class AgGridAdapter {
425
416
  };
426
417
  return selectedCellInfo;
427
418
  }
419
+ getBodyRowIndexesInRange(startRow, endRow) {
420
+ const sectionOrder = (row) => row.rowPinned === 'top' ? 0 : row.rowPinned === 'bottom' ? 2 : 1;
421
+ const isBefore = (a, b) => sectionOrder(a) !== sectionOrder(b)
422
+ ? sectionOrder(a) < sectionOrder(b)
423
+ : a.rowIndex < b.rowIndex;
424
+ const [first, last] = isBefore(endRow, startRow) ? [endRow, startRow] : [startRow, endRow];
425
+ const lastBodyRowIndex = this.getAgGridApi().getDisplayedRowCount() - 1;
426
+ const firstBodyRowIndex = first.rowPinned === 'top' ? 0 : first.rowPinned === 'bottom' ? undefined : first.rowIndex;
427
+ const endBodyRowIndex = last.rowPinned === 'bottom'
428
+ ? lastBodyRowIndex
429
+ : last.rowPinned === 'top'
430
+ ? undefined
431
+ : last.rowIndex;
432
+ if (firstBodyRowIndex == undefined ||
433
+ endBodyRowIndex == undefined ||
434
+ firstBodyRowIndex > endBodyRowIndex) {
435
+ return undefined;
436
+ }
437
+ return [firstBodyRowIndex, endBodyRowIndex];
438
+ }
428
439
  deriveSelectedRowInfoFromAgGrid() {
429
440
  const nodes = this.getAgGridApi().getSelectedNodes();
430
441
  const selectedRows = [];
@@ -89,6 +89,8 @@ export declare class AgGridColumnAdapter {
89
89
  private setupColumnCellEditor;
90
90
  private setupColumnCellRenderer;
91
91
  private setupColumnTooltip;
92
+ private resolveColDefTooltip;
93
+ private getStyledColumnTooltip;
92
94
  /**
93
95
  * Resolves a Range Bar bound (number / column id / Col-Min / Col-Max /
94
96
  * Col-Avg / Col-Median) into a concrete numeric value for the supplied row.