@adaptabletools/adaptable 24.0.2 → 24.0.4

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 (117) 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 +13 -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/AdaptableApi.d.ts +12 -0
  12. package/src/Api/GridApi.d.ts +13 -3
  13. package/src/Api/Implementation/AdaptableApiImpl.d.ts +1 -0
  14. package/src/Api/Implementation/AdaptableApiImpl.js +3 -0
  15. package/src/Api/Implementation/AlertApiImpl.js +2 -0
  16. package/src/Api/Implementation/FlashingCellApiImpl.js +3 -8
  17. package/src/Api/Implementation/GridApiImpl.js +1 -1
  18. package/src/Api/Internal/AlertInternalApi.d.ts +7 -0
  19. package/src/Api/Internal/AlertInternalApi.js +42 -9
  20. package/src/Api/Internal/CalculatedColumnInternalApi.js +25 -3
  21. package/src/Api/Internal/ExportInternalApi.d.ts +2 -0
  22. package/src/Api/Internal/ExportInternalApi.js +39 -3
  23. package/src/Api/Internal/LayoutInternalApi.d.ts +11 -1
  24. package/src/Api/Internal/LayoutInternalApi.js +34 -3
  25. package/src/Api/Internal/NoteInternalApi.d.ts +12 -0
  26. package/src/Api/Internal/NoteInternalApi.js +11 -0
  27. package/src/EnvVars.d.ts +1 -0
  28. package/src/EnvVars.js +1 -0
  29. package/src/Redux/Store/AdaptableStore.js +4 -7
  30. package/src/Strategy/FlashingCellModule.js +4 -1
  31. package/src/Utilities/Helpers/CellValueHelper.d.ts +20 -0
  32. package/src/Utilities/Helpers/CellValueHelper.js +35 -0
  33. package/src/Utilities/Services/CalculatedColumnExpressionService.d.ts +26 -1
  34. package/src/Utilities/Services/CalculatedColumnExpressionService.js +175 -42
  35. package/src/Utilities/Services/DataService.js +10 -6
  36. package/src/Utilities/Services/FlashingCellService.d.ts +12 -0
  37. package/src/Utilities/Services/FlashingCellService.js +40 -3
  38. package/src/Utilities/Services/Interface/ICalculatedColumnExpressionService.d.ts +12 -0
  39. package/src/Utilities/Services/Interface/IQueryLanguageService.d.ts +22 -1
  40. package/src/Utilities/Services/QueryLanguageService.d.ts +17 -1
  41. package/src/Utilities/Services/QueryLanguageService.js +75 -2
  42. package/src/Utilities/Services/RowSummaryService.d.ts +2 -0
  43. package/src/Utilities/Services/RowSummaryService.js +6 -1
  44. package/src/Utilities/license/instanceLicense.d.ts +12 -0
  45. package/src/Utilities/license/instanceLicense.js +10 -0
  46. package/src/Utilities/license/licenseStatus.d.ts +26 -0
  47. package/src/Utilities/license/licenseStatus.js +72 -0
  48. package/src/View/Components/CellPopup/index.js +15 -10
  49. package/src/View/GridInfo/GridInfoPopup.js +6 -1
  50. package/src/View/Layout/TransposedPopup.js +1 -0
  51. package/src/View/Layout/Wizard/sections/AggregationsSection.d.ts +3 -5
  52. package/src/View/Layout/Wizard/sections/AggregationsSection.js +10 -24
  53. package/src/View/Layout/Wizard/sections/RowSummarySection.js +5 -1
  54. package/src/View/ObjectItemViews/Layout/aggregationSummaryHelpers.d.ts +5 -1
  55. package/src/View/ObjectItemViews/Layout/aggregationSummaryHelpers.js +6 -3
  56. package/src/agGrid/AdaptableAgGrid.d.ts +87 -17
  57. package/src/agGrid/AdaptableAgGrid.js +586 -168
  58. package/src/agGrid/AdaptableFilterHandler.d.ts +2 -0
  59. package/src/agGrid/AdaptableFilterHandler.js +34 -0
  60. package/src/agGrid/AgGridAdapter.d.ts +19 -1
  61. package/src/agGrid/AgGridAdapter.js +39 -12
  62. package/src/agGrid/AgGridColumnAdapter.d.ts +2 -0
  63. package/src/agGrid/AgGridColumnAdapter.js +124 -78
  64. package/src/agGrid/AgGridExportAdapter.d.ts +5 -0
  65. package/src/agGrid/AgGridExportAdapter.js +31 -0
  66. package/src/agGrid/AgGridMenuAdapter.js +1 -1
  67. package/src/agGrid/applyGlobalGridOptions.d.ts +9 -0
  68. package/src/agGrid/applyGlobalGridOptions.js +36 -0
  69. package/src/agGrid/cellRenderers/BadgeRenderer.js +22 -0
  70. package/src/agGrid/columnMinMaxCache.d.ts +33 -0
  71. package/src/agGrid/columnMinMaxCache.js +50 -0
  72. package/src/devTools/PerfStore.d.ts +218 -0
  73. package/src/devTools/PerfStore.js +717 -0
  74. package/src/devTools/index.d.ts +33 -0
  75. package/src/devTools/index.js +132 -56
  76. package/src/devTools/logBuffer.d.ts +17 -0
  77. package/src/devTools/logBuffer.js +33 -0
  78. package/src/devTools/memoryInfo.d.ts +15 -0
  79. package/src/devTools/memoryInfo.js +229 -0
  80. package/src/devTools/memoryRoots.d.ts +41 -0
  81. package/src/devTools/memoryRoots.js +136 -0
  82. package/src/devTools/perfContext.d.ts +5 -0
  83. package/src/devTools/perfContext.js +155 -0
  84. package/src/devTools/perfInstrumentation.d.ts +13 -0
  85. package/src/devTools/perfInstrumentation.js +78 -0
  86. package/src/env.js +2 -2
  87. package/src/layout-manager/src/LayoutManagerModel.d.ts +3 -1
  88. package/src/layout-manager/src/expandAllRowGroups.d.ts +6 -0
  89. package/src/layout-manager/src/expandAllRowGroups.js +13 -0
  90. package/src/layout-manager/src/index.js +18 -10
  91. package/src/setupDevTools.js +560 -106
  92. package/tsconfig.esm.tsbuildinfo +1 -1
  93. package/vendor/components/Combobox/index.js +1 -1
  94. package/vendor/components/Combobox/index.js.map +1 -1
  95. package/vendor/components/Radio/index.d.ts.map +1 -1
  96. package/vendor/components/Radio/index.js +1 -1
  97. package/vendor/components/Radio/index.js.map +1 -1
  98. package/vendor/components/Resizable/index.d.ts +14 -9
  99. package/vendor/components/Resizable/index.d.ts.map +1 -1
  100. package/vendor/components/Resizable/index.js +23 -0
  101. package/vendor/components/Resizable/index.js.map +1 -1
  102. package/vendor/components/Resizable/resizableUtils.d.ts +24 -13
  103. package/vendor/components/Resizable/resizableUtils.d.ts.map +1 -1
  104. package/vendor/components/Resizable/resizableUtils.js +13 -3
  105. package/vendor/components/Resizable/resizableUtils.js.map +1 -1
  106. package/vendor/components/index.css +12 -5
  107. package/vendor/components/ui/combobox.js +1 -1
  108. package/vendor/components/ui/combobox.js.map +1 -1
  109. package/vendor/components/ui/input.js +1 -1
  110. package/vendor/components/ui/input.js.map +1 -1
  111. package/vendor/components/ui/select.js +1 -1
  112. package/vendor/components/ui/select.js.map +1 -1
  113. package/vendor/components/ui/textarea.js +1 -1
  114. package/vendor/components/ui/textarea.js.map +1 -1
  115. package/vendor/components/ui/tooltip.d.ts.map +1 -1
  116. package/vendor/components/ui/tooltip.js +3 -1
  117. package/vendor/components/ui/tooltip.js.map +1 -1
@@ -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;
@@ -1,4 +1,4 @@
1
- import { AgEvent, ColDef, ColGroupDef, Column, GridApi, GridOptions, IRowNode, ManagedGridOptionKey, ManagedGridOptions, Module } from 'ag-grid-enterprise';
1
+ import { AgEvent, CellValueChangedEvent, ColDef, ColGroupDef, Column, GridApi, GridOptions, IRowNode, ManagedGridOptionKey, ManagedGridOptions, Module } from 'ag-grid-enterprise';
2
2
  import type { AgChartInstance, AgSparklineOptions } from 'ag-charts-types';
3
3
  import { AdaptableAgGrid } from './AdaptableAgGrid';
4
4
  import { AdaptableColumn, AdaptableColumnGroup } from '../AdaptableState/Common/AdaptableColumn';
@@ -29,6 +29,10 @@ import { SelectedRowInfo } from '../AdaptableState/Selection/SelectedRowInfo';
29
29
  *
30
30
  * Row-node local events only fire on rendered rows. Off-screen updates are
31
31
  * covered by grid `cellValueChanged` plus the `updateRows` old-data diff.
32
+ *
33
+ * The grid's own `cellValueChanged` goes through the same prototype, so it is passed on too
34
+ * (see AgGridAdapter.handleCellValueChangedDispatch): listeners added with `GridApi.addEventListener`
35
+ * receive it only in a later task.
32
36
  */
33
37
  export type RowNodeEventType = 'dataChanged' | 'cellChanged';
34
38
  export interface RowNodeEvent extends AgEvent<RowNodeEventType> {
@@ -61,6 +65,11 @@ export declare class AgGridAdapter {
61
65
  * Called (for the grid managed by this adapter) whenever AG Grid dispatches a RowNode `cellChanged` / `dataChanged` event
62
66
  */
63
67
  handleRowNodeEvent(event: RowNodeEvent): void;
68
+ /**
69
+ * see #local_event_service_monkey_patch
70
+ * Called synchronously whenever the grid managed by this adapter dispatches `cellValueChanged`
71
+ */
72
+ handleCellValueChangedDispatch(event: CellValueChangedEvent): void;
64
73
  setAgGridApi(gridApi: GridApi): void;
65
74
  getAgGridApi(skipLogging?: boolean): GridApi | undefined;
66
75
  monkeyPatchingGridOptionsUpdates(): void;
@@ -86,6 +95,15 @@ export declare class AgGridAdapter {
86
95
  private enhanceColDefsWithSpecialColumns;
87
96
  private getSpecialColDefs;
88
97
  deriveSelectedCellInfoFromAgGrid(): SelectedCellInfo;
98
+ /**
99
+ * The first and last displayed body row index covered by a cell range, or `undefined` if it covers none.
100
+ *
101
+ * A range end in a pinned row has the row's index inside its pinned container, not a body index.
102
+ * Pinned rows (Row Summaries, a pinned Grand Total Row, user-pinned copies of body rows) are not
103
+ * included: a range reaching into the pinned top rows starts at the first body row, and one
104
+ * reaching into the pinned bottom rows ends at the last body row.
105
+ */
106
+ private getBodyRowIndexesInRange;
89
107
  deriveSelectedRowInfoFromAgGrid(): SelectedRowInfo;
90
108
  isPinnedRowNode(rowNode: IRowNode): boolean;
91
109
  createAdaptableColumnFromAgGridColumn(agGridColumn: Column, colsToGroups: Record<string, AdaptableColumnGroup>): AdaptableColumn;
@@ -14,6 +14,10 @@ import { ONLY_AGG_FN_NAME, WEIGHTED_AVERAGE_AGG_FN_NAME, } from '../AdaptableSta
14
14
  const DANGER_AG_GRID_BEANS_MAP = {};
15
15
  const DANGER_AG_GRID_ADAPTERS_MAP = {};
16
16
  const getColumnApiModule = () => ColumnApiModule;
17
+ const getAdapterForRowNode = (rowNode) => {
18
+ const gridId = rowNode?.beans?.context?.getId();
19
+ return gridId ? DANGER_AG_GRID_ADAPTERS_MAP[gridId] : undefined;
20
+ };
17
21
  const PATCHED_LOCAL_EVENT_SERVICE_PROTOTYPES = new WeakSet();
18
22
  const patchLocalEventServiceDispatchEvent = (beans) => {
19
23
  const localEventServiceInstance = beans?.eventSvc?.globalSvc;
@@ -52,6 +56,15 @@ const patchLocalEventServiceDispatchEvent = (beans) => {
52
56
  }
53
57
  }
54
58
  }
59
+ else if (event.type === 'cellValueChanged') {
60
+ const cellValueChangedEvent = event;
61
+ try {
62
+ getAdapterForRowNode(cellValueChangedEvent.node)?.handleCellValueChangedDispatch(cellValueChangedEvent);
63
+ }
64
+ catch (error) {
65
+ AdaptableLogger.consoleErrorBase('Adaptable cellValueChanged handler threw; AG Grid will still receive the event', error);
66
+ }
67
+ }
55
68
  LocalEventService_dispatchEvent.apply(this, arguments);
56
69
  };
57
70
  };
@@ -137,6 +150,9 @@ export class AgGridAdapter {
137
150
  handleRowNodeEvent(event) {
138
151
  this._adaptableInstance?.onAgGridRowNodeEvent(event);
139
152
  }
153
+ handleCellValueChangedDispatch(event) {
154
+ this._adaptableInstance?.onAgGridCellValueChangedDispatch(event);
155
+ }
140
156
  setAgGridApi(gridApi) {
141
157
  this.DANGER_USE_GETTER_gridApi = gridApi;
142
158
  }
@@ -387,19 +403,10 @@ export class AgGridAdapter {
387
403
  const columns = [];
388
404
  const gridCells = [];
389
405
  selected.forEach((rangeSelection) => {
390
- let shouldIncludeRange = true;
391
406
  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);
407
+ const bodyRowIndexes = this.getBodyRowIndexesInRange(rangeSelection.startRow, rangeSelection.endRow);
408
+ if (bodyRowIndexes) {
409
+ const [y1, y2] = bodyRowIndexes;
403
410
  for (const column of rangeSelection.columns) {
404
411
  if (column != null) {
405
412
  const colId = column.getColId();
@@ -425,6 +432,26 @@ export class AgGridAdapter {
425
432
  };
426
433
  return selectedCellInfo;
427
434
  }
435
+ getBodyRowIndexesInRange(startRow, endRow) {
436
+ const sectionOrder = (row) => row.rowPinned === 'top' ? 0 : row.rowPinned === 'bottom' ? 2 : 1;
437
+ const isBefore = (a, b) => sectionOrder(a) !== sectionOrder(b)
438
+ ? sectionOrder(a) < sectionOrder(b)
439
+ : a.rowIndex < b.rowIndex;
440
+ const [first, last] = isBefore(endRow, startRow) ? [endRow, startRow] : [startRow, endRow];
441
+ const lastBodyRowIndex = this.getAgGridApi().getDisplayedRowCount() - 1;
442
+ const firstBodyRowIndex = first.rowPinned === 'top' ? 0 : first.rowPinned === 'bottom' ? undefined : first.rowIndex;
443
+ const endBodyRowIndex = last.rowPinned === 'bottom'
444
+ ? lastBodyRowIndex
445
+ : last.rowPinned === 'top'
446
+ ? undefined
447
+ : last.rowIndex;
448
+ if (firstBodyRowIndex == undefined ||
449
+ endBodyRowIndex == undefined ||
450
+ firstBodyRowIndex > endBodyRowIndex) {
451
+ return undefined;
452
+ }
453
+ return [firstBodyRowIndex, endBodyRowIndex];
454
+ }
428
455
  deriveSelectedRowInfoFromAgGrid() {
429
456
  const nodes = this.getAgGridApi().getSelectedNodes();
430
457
  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.
@@ -1,3 +1,4 @@
1
+ import { getPerfRecorder } from '../devTools/PerfStore';
1
2
  import { kebabCase } from '../Utilities/Extensions/StringExtensions';
2
3
  import { resolveDisplayFormat } from '../AdaptableState/Common/AdaptableFormatPresets';
3
4
  import { merge } from '../Utilities/Extensions/ObjectExtensions';
@@ -71,6 +72,13 @@ const STABLE_CALLBACK_COL_DEF_PROPERTIES = new Set([
71
72
  'cellEditorParams',
72
73
  'suppressNoteActions',
73
74
  ]);
75
+ const PERF_HOT_PATH_KINDS = {
76
+ cellStyle: 'cellStyle',
77
+ cellClass: 'cellClass',
78
+ valueFormatter: 'valueFormatter',
79
+ comparator: 'comparator',
80
+ getQuickFilterText: 'quickFilterText',
81
+ };
74
82
  export function getEditorForColumnDataType(columnDataType, variant) {
75
83
  if (columnDataType === 'number') {
76
84
  return variant === 'react' ? AdaptableReactNumberEditor : AdaptableNumberEditor;
@@ -175,6 +183,10 @@ export class AgGridColumnAdapter {
175
183
  this.stableCallbackImplementations.set(key, implementation);
176
184
  let stableCallback = this.stableCallbacks.get(key);
177
185
  if (!stableCallback) {
186
+ const perfKind = PERF_HOT_PATH_KINDS[propertyName];
187
+ const perfKey = perfKind ? `${perfKind}:${colId}` : '';
188
+ const describePerf = () => ({ columnId: colId });
189
+ const adaptableId = this.adaptableInstance?.adaptableOptions?.adaptableId;
178
190
  stableCallback = (...args) => {
179
191
  if (!this.adaptableInstance || this.adaptableInstance.isDestroyed) {
180
192
  const userValue = this.colDefPropertyCache?.get(`user.${colId}.${propertyName}`);
@@ -183,7 +195,20 @@ export class AgGridColumnAdapter {
183
195
  }
184
196
  return userValue;
185
197
  }
186
- return this.stableCallbackImplementations?.get(key)?.(...args);
198
+ const implementation = this.stableCallbackImplementations?.get(key);
199
+ if (perfKind && implementation) {
200
+ const recorder = getPerfRecorder(adaptableId);
201
+ if (recorder) {
202
+ const start = performance.now();
203
+ try {
204
+ return implementation(...args);
205
+ }
206
+ finally {
207
+ recorder.add(perfKind, perfKey, start, describePerf);
208
+ }
209
+ }
210
+ }
211
+ return implementation?.(...args);
187
212
  };
188
213
  this.stableCallbacks.set(key, stableCallback);
189
214
  this.stableCallbackOwners.set(stableCallback, { colId, propertyName });
@@ -677,101 +702,122 @@ export class AgGridColumnAdapter {
677
702
  });
678
703
  }
679
704
  setupColumnTooltip({ col, colId, abColumn }) {
680
- let hasTooptip = false;
681
- this.setColDefProperty(col, 'tooltip', () => {
705
+ this.setColDefProperty(col, 'tooltip', (userTooltip) => {
682
706
  const styledColumn = this.adaptableApi.styledColumnApi.getStyledColumnForColumnId(colId);
683
707
  if (!styledColumn || styledColumn.IsSuspended) {
684
708
  return undefined;
685
709
  }
686
- if (styledColumn.IconStyle && !isUnsupportedColumnDataTypeForIconStyle(abColumn.dataType)) {
687
- const iconTokens = styledColumn.IconStyle.ToolTipText ?? [];
688
- if (iconTokens.length === 0) {
689
- return undefined;
690
- }
691
- hasTooptip = true;
692
- return (params) => {
693
- const parts = [];
694
- if (iconTokens.includes('CellValue')) {
695
- parts.push(String(params.value ?? ''));
696
- }
697
- if (iconTokens.includes('IconDescription')) {
698
- const matched = findIconStyleMappingForValue(styledColumn.IconStyle, params.value);
699
- if (matched?.Description) {
700
- parts.push(matched.Description);
701
- }
702
- }
703
- const trimmed = parts.filter(Boolean).join(' · ').trim();
704
- return trimmed ? trimmed : String(params.value ?? '');
705
- };
710
+ const styledColumnTooltip = this.getStyledColumnTooltip(styledColumn, abColumn);
711
+ if (!styledColumnTooltip) {
712
+ return undefined;
706
713
  }
707
- if (styledColumn.RatingStyle) {
708
- const ratingToolTip = styledColumn.RatingStyle.ToolTipText ?? [];
709
- if (ratingToolTip.length === 0) {
710
- return undefined;
714
+ return (params) => {
715
+ if (params.node &&
716
+ !shouldRenderStyledColumnOnRow(styledColumn, params.node, this.adaptableApi)) {
717
+ return this.resolveColDefTooltip(userTooltip, params);
711
718
  }
712
- hasTooptip = true;
713
- const ratingMax = styledColumn.RatingStyle.Max ?? 5;
714
- return (params) => {
715
- let returnValue = '';
716
- if (ratingToolTip.includes('CellValue')) {
717
- returnValue = String(params.value ?? '');
718
- }
719
- if (ratingToolTip.includes('PercentageValue') && ratingMax > 0) {
720
- const n = Number(params.value);
721
- if (!isNaN(n)) {
722
- const clamped = clamp(n, 0, ratingMax);
723
- const percentageValue = (clamped / ratingMax) * 100;
724
- const pct = `${percentageValue.toFixed(0)}%`;
725
- returnValue = returnValue ? `${returnValue} (${pct})` : pct;
726
- }
727
- }
728
- const trimmed = returnValue.trim();
729
- return trimmed ? trimmed : String(params.value ?? '');
730
- };
731
- }
732
- const tooltipStyle = styledColumn.PercentBarStyle ??
733
- styledColumn.BulletChartStyle ??
734
- styledColumn.GradientStyle ??
735
- styledColumn.RangeBarStyle;
736
- const textOptions = tooltipStyle?.ToolTipText;
737
- if (!tooltipStyle || !textOptions || textOptions.length === 0) {
719
+ return styledColumnTooltip(params);
720
+ };
721
+ });
722
+ }
723
+ resolveColDefTooltip(userTooltip, params) {
724
+ if (typeof userTooltip === 'function') {
725
+ return userTooltip(params);
726
+ }
727
+ if (typeof userTooltip === 'string') {
728
+ return userTooltip;
729
+ }
730
+ if (userTooltip === true) {
731
+ return params.valueFormatted ?? params.value;
732
+ }
733
+ return undefined;
734
+ }
735
+ getStyledColumnTooltip(styledColumn, abColumn) {
736
+ if (styledColumn.IconStyle && !isUnsupportedColumnDataTypeForIconStyle(abColumn.dataType)) {
737
+ const iconTokens = styledColumn.IconStyle.ToolTipText ?? [];
738
+ if (iconTokens.length === 0) {
738
739
  return undefined;
739
740
  }
740
- hasTooptip = true;
741
741
  return (params) => {
742
- const isRangeBar = tooltipStyle === styledColumn.RangeBarStyle;
743
- let min;
744
- let max;
745
- if (isRangeBar) {
746
- const rangeStyle = styledColumn.RangeBarStyle;
747
- min = this.resolveRangeBarBound(rangeStyle.Min, abColumn, params.node);
748
- max = this.resolveRangeBarBound(rangeStyle.Max, abColumn, params.node);
742
+ const parts = [];
743
+ if (iconTokens.includes('CellValue')) {
744
+ parts.push(String(params.value ?? ''));
749
745
  }
750
- else {
751
- min = this.adaptableApi.styledColumnApi.internalApi.getNumericStyleMinValue(styledColumn, abColumn, params.node, params.value);
752
- max = this.adaptableApi.styledColumnApi.internalApi.getNumericStyleMaxValue(styledColumn, abColumn, params.node, params.value);
746
+ if (iconTokens.includes('IconDescription')) {
747
+ const matched = findIconStyleMappingForValue(styledColumn.IconStyle, params.value);
748
+ if (matched?.Description) {
749
+ parts.push(matched.Description);
750
+ }
753
751
  }
752
+ const trimmed = parts.filter(Boolean).join(' · ').trim();
753
+ return trimmed ? trimmed : String(params.value ?? '');
754
+ };
755
+ }
756
+ if (styledColumn.RatingStyle) {
757
+ const ratingToolTip = styledColumn.RatingStyle.ToolTipText ?? [];
758
+ if (ratingToolTip.length === 0) {
759
+ return undefined;
760
+ }
761
+ const ratingMax = styledColumn.RatingStyle.Max ?? 5;
762
+ return (params) => {
754
763
  let returnValue = '';
755
- if (textOptions.includes('CellValue')) {
764
+ if (ratingToolTip.includes('CellValue')) {
756
765
  returnValue = String(params.value ?? '');
757
766
  }
758
- if (textOptions.includes('PercentageValue') && min != undefined && max != undefined) {
759
- let percentageValue;
760
- if (styledColumn.PercentBarStyle?.ColumnComparison) {
761
- const absMax = Math.abs(max);
762
- percentageValue = absMax === 0 ? 0 : (Number(params.value) / absMax) * 100;
767
+ if (ratingToolTip.includes('PercentageValue') && ratingMax > 0) {
768
+ const n = Number(params.value);
769
+ if (!isNaN(n)) {
770
+ const clamped = clamp(n, 0, ratingMax);
771
+ const percentageValue = (clamped / ratingMax) * 100;
772
+ const pct = `${percentageValue.toFixed(0)}%`;
773
+ returnValue = returnValue ? `${returnValue} (${pct})` : pct;
763
774
  }
764
- else {
765
- const scaleSpan = max - min;
766
- const clamped = clamp(Number(params.value), min, max);
767
- percentageValue = scaleSpan === 0 ? 0 : ((clamped - min) / scaleSpan) * 100;
768
- }
769
- returnValue += ` (${percentageValue.toFixed(0)}%)`;
770
775
  }
771
776
  const trimmed = returnValue.trim();
772
777
  return trimmed ? trimmed : String(params.value ?? '');
773
778
  };
774
- });
779
+ }
780
+ const tooltipStyle = styledColumn.PercentBarStyle ??
781
+ styledColumn.BulletChartStyle ??
782
+ styledColumn.GradientStyle ??
783
+ styledColumn.RangeBarStyle;
784
+ const textOptions = tooltipStyle?.ToolTipText;
785
+ if (!tooltipStyle || !textOptions || textOptions.length === 0) {
786
+ return undefined;
787
+ }
788
+ return (params) => {
789
+ const isRangeBar = tooltipStyle === styledColumn.RangeBarStyle;
790
+ let min;
791
+ let max;
792
+ if (isRangeBar) {
793
+ const rangeStyle = styledColumn.RangeBarStyle;
794
+ min = this.resolveRangeBarBound(rangeStyle.Min, abColumn, params.node);
795
+ max = this.resolveRangeBarBound(rangeStyle.Max, abColumn, params.node);
796
+ }
797
+ else {
798
+ min = this.adaptableApi.styledColumnApi.internalApi.getNumericStyleMinValue(styledColumn, abColumn, params.node, params.value);
799
+ max = this.adaptableApi.styledColumnApi.internalApi.getNumericStyleMaxValue(styledColumn, abColumn, params.node, params.value);
800
+ }
801
+ let returnValue = '';
802
+ if (textOptions.includes('CellValue')) {
803
+ returnValue = String(params.value ?? '');
804
+ }
805
+ if (textOptions.includes('PercentageValue') && min != undefined && max != undefined) {
806
+ let percentageValue;
807
+ if (styledColumn.PercentBarStyle?.ColumnComparison) {
808
+ const absMax = Math.abs(max);
809
+ percentageValue = absMax === 0 ? 0 : (Number(params.value) / absMax) * 100;
810
+ }
811
+ else {
812
+ const scaleSpan = max - min;
813
+ const clamped = clamp(Number(params.value), min, max);
814
+ percentageValue = scaleSpan === 0 ? 0 : ((clamped - min) / scaleSpan) * 100;
815
+ }
816
+ returnValue += ` (${percentageValue.toFixed(0)}%)`;
817
+ }
818
+ const trimmed = returnValue.trim();
819
+ return trimmed ? trimmed : String(params.value ?? '');
820
+ };
775
821
  }
776
822
  resolveRangeBarBound(bound, abColumn, rowNode) {
777
823
  if (bound == undefined) {
@@ -1293,7 +1339,7 @@ export class AgGridColumnAdapter {
1293
1339
  if (!note) {
1294
1340
  return;
1295
1341
  }
1296
- const noteType = note.NoteType ?? this.adaptableApi.optionsApi.getNoteOptions()?.defaultNoteType ?? 'Info';
1342
+ const noteType = this.adaptableApi.noteApi.internalApi.getNoteType(note);
1297
1343
  return `ab-NoteType-${noteType}`;
1298
1344
  }
1299
1345
  getCommentCellClassName(gridCell, params) {
@@ -52,6 +52,11 @@ export declare class AgGridExportAdapter {
52
52
  buildExportProcessData(config: ExportConfig): ExportProcessData;
53
53
  private buildExportParams;
54
54
  private buildBaseExportParams;
55
+ /**
56
+ * Excel cannot colour the note indicator per comment, so when any Note has a non-default type,
57
+ * the type is prepended to every exported note text (e.g. `Warning: <text>`).
58
+ */
59
+ private computeProcessNoteCallback;
55
60
  private computeProcessRowGroupCallback;
56
61
  private computeProcessCellCallback;
57
62
  private getReportColsAndRows;
@@ -137,10 +137,18 @@ export class AgGridExportAdapter {
137
137
  if (exportContext.format === 'Excel' || exportContext.format === 'VisualExcel') {
138
138
  const excelExportParams = baseExportParams;
139
139
  excelExportParams.sheetName = resolveValueOrFunction(this.exportOptions.excelSheetName, this.adaptableApi.exportApi.internalApi.buildBaseExportContext(exportContext.report.Name, exportContext.format, exportContext.destination));
140
+ excelExportParams.processNoteCallback = this.computeProcessNoteCallback();
140
141
  return excelExportParams;
141
142
  }
142
143
  const csvExportParams = baseExportParams;
143
144
  csvExportParams.columnSeparator = this.getCsvSeparator(exportContext);
145
+ if (exportContext.format !== 'CSV') {
146
+ Object.keys(this.agGridApi.getGridOption('defaultCsvExportParams') ?? {}).forEach((key) => {
147
+ if (!(key in csvExportParams)) {
148
+ csvExportParams[key] = undefined;
149
+ }
150
+ });
151
+ }
144
152
  return csvExportParams;
145
153
  }
146
154
  buildBaseExportParams(exportContext) {
@@ -161,6 +169,29 @@ export class AgGridExportAdapter {
161
169
  params.processRowGroupCallback = this.computeProcessRowGroupCallback(exportContext);
162
170
  return params;
163
171
  }
172
+ computeProcessNoteCallback() {
173
+ const noteInternalApi = this.adaptableApi.noteApi.internalApi;
174
+ if (!noteInternalApi.isAgGridNotesActive() || !noteInternalApi.hasNonDefaultNoteTypes()) {
175
+ return undefined;
176
+ }
177
+ return (params) => {
178
+ const { excelNote, node, column } = params;
179
+ if (!excelNote || !node || !column) {
180
+ return undefined;
181
+ }
182
+ const note = this.adaptableApi.noteApi.getNoteForCell({
183
+ PrimaryKeyValue: this.adaptableApi.gridApi.getPrimaryKeyValueForRowNode(node),
184
+ ColumnId: column.getColId(),
185
+ });
186
+ if (!note) {
187
+ return undefined;
188
+ }
189
+ return {
190
+ ...excelNote,
191
+ text: `${noteInternalApi.getNoteType(note)}: ${excelNote.text}`,
192
+ };
193
+ };
194
+ }
164
195
  computeProcessRowGroupCallback(exportContext) {
165
196
  return (params) => {
166
197
  let rowGroupNode = params.node;
@@ -182,7 +182,7 @@ export class AgGridMenuAdapter {
182
182
  const agGridMenuItems = this.filterSuppressedAgGridDualUiMenuItems(params.defaultItems ? [...params.defaultItems] : []);
183
183
  const agGridCopyItems = agGridMenuItems.filter((item) => ['copy', 'copyWithHeaders', 'copyWithGroupHeaders', 'cut', 'paste'].includes(item));
184
184
  const otherAgGridItems = agGridMenuItems.filter((item) => !agGridCopyItems.includes(item) &&
185
- !['export', 'csvExport', 'excelExport'].includes(item));
185
+ !['export', 'csvExport', 'excelExport', 'pdfExport'].includes(item));
186
186
  const agGridDefaultStructure = [
187
187
  {
188
188
  menuType: 'Group',
@@ -0,0 +1,9 @@
1
+ import { GridOptions } from 'ag-grid-enterprise';
2
+ /**
3
+ * Copies onto `gridOptions` the options set with AG Grid's `provideGlobalGridOptions` which the grid
4
+ * itself does not set, so AdapTable handles them exactly as if they were set on the grid.
5
+ *
6
+ * Must run before AdapTable reads or wraps any GridOptions property: AdapTable writes its own value
7
+ * for the properties it manages, and AG Grid's global merge never overrides a value set on the grid.
8
+ */
9
+ export declare function applyGlobalGridOptions(gridOptions: GridOptions): GridOptions;
@@ -0,0 +1,36 @@
1
+ import { _getGlobalGridOption, _GET_ALL_GRID_OPTIONS } from 'ag-grid-enterprise';
2
+ export function applyGlobalGridOptions(gridOptions) {
3
+ if (!gridOptions) {
4
+ return gridOptions;
5
+ }
6
+ const options = gridOptions;
7
+ for (const key of _GET_ALL_GRID_OPTIONS()) {
8
+ if (options[key] !== undefined) {
9
+ continue;
10
+ }
11
+ const globalValue = _getGlobalGridOption(key);
12
+ if (globalValue !== undefined) {
13
+ options[key] = copyGlobalValue(globalValue);
14
+ }
15
+ }
16
+ return gridOptions;
17
+ }
18
+ function copyGlobalValue(value) {
19
+ if (Array.isArray(value)) {
20
+ return [...value];
21
+ }
22
+ return copyPlainObjects(value);
23
+ }
24
+ function copyPlainObjects(value) {
25
+ if (!isPlainObject(value)) {
26
+ return value;
27
+ }
28
+ const copy = {};
29
+ for (const [key, nestedValue] of Object.entries(value)) {
30
+ copy[key] = copyPlainObjects(nestedValue);
31
+ }
32
+ return copy;
33
+ }
34
+ function isPlainObject(value) {
35
+ return typeof value === 'object' && value !== null && value.constructor === Object;
36
+ }
@@ -2,6 +2,7 @@ import { Badge } from '../../View/StyledColumn/Badge';
2
2
  import { renderWithAdaptableContext } from '../../View/AdaptableContext';
3
3
  import * as React from 'react';
4
4
  import { shouldRenderStyledColumnOnRow } from '../../Utilities/Helpers/StyledColumns/StyledColumnHelper';
5
+ import { getPerfRecorder } from '../../devTools/PerfStore';
5
6
  const OVERFLOW_CLASS = {
6
7
  Truncate: 'ab-Badge__wrapper--truncate',
7
8
  Wrap: 'ab-Badge__wrapper--wrap',
@@ -25,6 +26,13 @@ export const getBadgeRendererForColumn = (styledColumn, abColumn, api) => {
25
26
  const wrapperClassName = `ab-Badge__wrapper ${OVERFLOW_CLASS[overflowMode]}`;
26
27
  const spacing = typeof badgeStyle.Spacing === 'number' ? badgeStyle.Spacing : null;
27
28
  const rowJustify = resolveBadgeRowJustify(badgeStyle.Font?.Alignment);
29
+ const perfKey = `badge:${abColumn.columnId}`;
30
+ const describePerf = () => ({
31
+ module: 'StyledColumn',
32
+ objectId: styledColumn.Uuid,
33
+ objectName: styledColumn.Name,
34
+ columnId: abColumn.columnId,
35
+ });
28
36
  return class BadgetRenderer {
29
37
  eGui;
30
38
  unmountReactRoot;
@@ -33,6 +41,20 @@ export const getBadgeRendererForColumn = (styledColumn, abColumn, api) => {
33
41
  return adaptable;
34
42
  }
35
43
  init(params) {
44
+ const recorder = getPerfRecorder(this.getAdaptableInstance(params)?.adaptableOptions?.adaptableId);
45
+ if (!recorder) {
46
+ this.initNow(params);
47
+ return;
48
+ }
49
+ const start = performance.now();
50
+ try {
51
+ this.initNow(params);
52
+ }
53
+ finally {
54
+ recorder.add('badge', perfKey, start, describePerf);
55
+ }
56
+ }
57
+ initNow(params) {
36
58
  const adaptable = this.getAdaptableInstance(params);
37
59
  const adaptableApi = adaptable.api;
38
60
  this.eGui = document.createElement('div');