@adaptabletools/adaptable 18.1.13 → 18.1.15-canary.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.
Files changed (156) hide show
  1. package/package.json +2 -2
  2. package/src/AdaptableInterfaces/IAdaptable.d.ts +3 -5
  3. package/src/AdaptableOptions/AlertOptions.d.ts +2 -1
  4. package/src/AdaptableOptions/ChartingOptions.d.ts +5 -1
  5. package/src/AdaptableOptions/ColumnFilterOptions.d.ts +5 -1
  6. package/src/AdaptableOptions/DashboardOptions.d.ts +5 -1
  7. package/src/AdaptableOptions/FlashingCellOptions.d.ts +5 -1
  8. package/src/AdaptableOptions/LayoutOptions.d.ts +5 -1
  9. package/src/AdaptableOptions/NotificationsOptions.d.ts +6 -2
  10. package/src/AdaptableOptions/SettingsPanelOptions.d.ts +5 -1
  11. package/src/AdaptableOptions/UserInterfaceOptions.d.ts +1 -1
  12. package/src/Api/ChartingApi.d.ts +2 -2
  13. package/src/Api/ColumnApi.d.ts +6 -0
  14. package/src/Api/ConfigApi.d.ts +22 -2
  15. package/src/Api/Events/LiveDataChanged.d.ts +1 -1
  16. package/src/Api/Implementation/AdaptableApiImpl.d.ts +1 -1
  17. package/src/Api/Implementation/ChartingApiImpl.d.ts +1 -1
  18. package/src/Api/Implementation/ChartingApiImpl.js +2 -2
  19. package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
  20. package/src/Api/Implementation/ColumnApiImpl.js +3 -0
  21. package/src/Api/Implementation/ConfigApiImpl.d.ts +4 -1
  22. package/src/Api/Implementation/ConfigApiImpl.js +16 -1
  23. package/src/Api/Implementation/EntitlementApiImpl.d.ts +4 -1
  24. package/src/Api/Implementation/EntitlementApiImpl.js +31 -6
  25. package/src/Api/Implementation/ExportApiImpl.js +5 -7
  26. package/src/Api/Implementation/GridApiImpl.js +1 -1
  27. package/src/Api/Implementation/TeamSharingApiImpl.js +2 -6
  28. package/src/Api/Internal/AdaptableInternalApi.d.ts +2 -6
  29. package/src/Api/Internal/AdaptableInternalApi.js +5 -11
  30. package/src/Api/Internal/EntitlementInternalApi.d.ts +4 -0
  31. package/src/Api/Internal/EntitlementInternalApi.js +11 -0
  32. package/src/Api/Internal/ExportInternalApi.d.ts +33 -8
  33. package/src/Api/Internal/ExportInternalApi.js +576 -5
  34. package/src/Api/Internal/NamedQueryInternalApi.d.ts +0 -1
  35. package/src/Api/Internal/NamedQueryInternalApi.js +0 -4
  36. package/src/PredefinedConfig/AdaptableState.d.ts +0 -5
  37. package/src/PredefinedConfig/Common/FilterActionOnDataChange.d.ts +2 -1
  38. package/src/PredefinedConfig/StyledColumnState.d.ts +1 -1
  39. package/src/Redux/ActionsReducers/GridRedux.d.ts +6 -6
  40. package/src/Redux/ActionsReducers/GridRedux.js +8 -8
  41. package/src/Redux/ActionsReducers/LayoutRedux.d.ts +3 -3
  42. package/src/Redux/ActionsReducers/LayoutRedux.js +9 -9
  43. package/src/Redux/ActionsReducers/NamedQueryRedux.d.ts +1 -1
  44. package/src/Redux/ActionsReducers/NamedQueryRedux.js +1 -1
  45. package/src/Redux/ActionsReducers/PluginsRedux.d.ts +2 -2
  46. package/src/Redux/ActionsReducers/PluginsRedux.js +2 -2
  47. package/src/Redux/Store/AdaptableReduxMerger.js +3 -3
  48. package/src/Redux/Store/AdaptableStore.js +2 -4
  49. package/src/Strategy/AdaptableModuleBase.js +1 -2
  50. package/src/Strategy/ColumnFilterModule.js +1 -2
  51. package/src/Strategy/ExportModule.js +17 -44
  52. package/src/Strategy/FlashingCellModule.js +2 -10
  53. package/src/Strategy/ScheduleModule.js +4 -6
  54. package/src/Strategy/SmartEditModule.js +1 -7
  55. package/src/Strategy/TeamSharingModule.js +2 -2
  56. package/src/Strategy/Utilities/Export/getExportColumnsViewItems.js +1 -1
  57. package/src/Strategy/Utilities/Export/getExportRowsViewItems.js +1 -3
  58. package/src/Utilities/Constants/FilterConstants.d.ts +10 -0
  59. package/src/Utilities/Constants/FilterConstants.js +8 -0
  60. package/src/Utilities/Constants/GeneralConstants.d.ts +41 -4
  61. package/src/Utilities/Constants/GeneralConstants.js +42 -3
  62. package/src/Utilities/Defaults/DefaultSettingsPanel.d.ts +0 -2
  63. package/src/Utilities/Defaults/DefaultSettingsPanel.js +0 -5
  64. package/src/Utilities/Extensions/ArrayExtensions.d.ts +14 -0
  65. package/src/Utilities/Extensions/ArrayExtensions.js +65 -0
  66. package/src/Utilities/Extensions/EnumExtensions.d.ts +0 -4
  67. package/src/Utilities/Extensions/EnumExtensions.js +2 -12
  68. package/src/Utilities/Helpers/AdaptableHelper.d.ts +4 -10
  69. package/src/Utilities/Helpers/AdaptableHelper.js +7 -59
  70. package/src/Utilities/Helpers/FormatHelper.d.ts +9 -0
  71. package/src/Utilities/Helpers/FormatHelper.js +26 -14
  72. package/src/Utilities/Helpers/Helper.d.ts +0 -10
  73. package/src/Utilities/Helpers/Helper.js +0 -70
  74. package/src/Utilities/Services/ChartingService.d.ts +2 -2
  75. package/src/Utilities/Services/ChartingService.js +5 -11
  76. package/src/Utilities/Services/ModuleService.js +35 -31
  77. package/src/Utilities/Services/RowEditService.js +1 -6
  78. package/src/Utilities/Services/RowSummaryService.js +2 -2
  79. package/src/Utilities/Services/ValidationService.js +2 -16
  80. package/src/View/Alert/AlertEmptyView.js +1 -2
  81. package/src/View/Charting/ChartingStatusBarPopover.js +1 -2
  82. package/src/View/Charting/useChartingElements.js +1 -1
  83. package/src/View/Components/AdaptableObjectList/AdaptableObjectCompactList.js +2 -6
  84. package/src/View/Components/AdaptableObjectList/AdaptableObjectList.js +2 -4
  85. package/src/View/Components/FilterForm/QuickFilterForm.js +2 -12
  86. package/src/View/Components/ModuleValueSelector/index.js +2 -2
  87. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopup.js +2 -5
  88. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupBody.js +1 -3
  89. package/src/View/Components/Popups/AdaptablePopup/useMenuItems.js +2 -1
  90. package/src/View/Components/Popups/AdaptablePopupAlert.js +1 -7
  91. package/src/View/Components/ToolPanel/AdaptableToolPanel.js +6 -12
  92. package/src/View/Components/ToolPanel/CustomToolPanelContent.js +3 -23
  93. package/src/View/Components/ToolPanel/ToolPanelPopup.js +4 -5
  94. package/src/View/Components/ToolPanel/ToolPanelWrapper.js +1 -3
  95. package/src/View/Components/ValueSelector/index.js +2 -2
  96. package/src/View/CustomSort/Wizard/CustomSortValuesWizardSection.js +2 -2
  97. package/src/View/Dashboard/CustomDashboardButton.js +1 -6
  98. package/src/View/Dashboard/CustomToolbar.js +2 -9
  99. package/src/View/Dashboard/Dashboard.js +2 -4
  100. package/src/View/Dashboard/DashboardPopup.js +1 -3
  101. package/src/View/Dashboard/DashboardToolbarFactory.js +1 -2
  102. package/src/View/Dashboard/PinnedToolbarsSelector.js +1 -2
  103. package/src/View/DataChangeHistory/DataChangeHistoryGrid.js +1 -3
  104. package/src/View/Export/ExportViewPanel.js +2 -4
  105. package/src/View/Export/Wizard/ReportSummaryWizard.js +2 -6
  106. package/src/View/GridFilter/GridFilterExpressionEditor.js +2 -2
  107. package/src/View/GridFilter/useGridFilterExpressionEditor.js +2 -6
  108. package/src/View/Layout/LayoutViewPanel.js +1 -1
  109. package/src/View/Layout/PivotDetailsPopoup.js +1 -7
  110. package/src/View/Layout/SaveLayoutButton.js +1 -3
  111. package/src/View/Layout/Wizard/sections/AggregationsSection.js +2 -2
  112. package/src/View/Layout/Wizard/sections/ColumnsSection.js +2 -2
  113. package/src/View/Layout/Wizard/sections/PivotColumnsSection.js +2 -2
  114. package/src/View/Layout/Wizard/sections/RowGroupingSection.js +2 -2
  115. package/src/View/Layout/Wizard/sections/RowSummarySection.js +2 -2
  116. package/src/View/Layout/Wizard/sections/SortSection.js +2 -2
  117. package/src/View/NamedQuery/Wizard/NamedQueryWizard.js +3 -3
  118. package/src/View/SpecialColumnSettingsWizardStep.js +1 -1
  119. package/src/View/SystemStatus/SystemStatusPopup.js +1 -1
  120. package/src/View/Wizard/OnePageAdaptableWizard.js +2 -2
  121. package/src/agGrid/ActionColumnRenderer.js +8 -22
  122. package/src/agGrid/AdaptableAgGrid.d.ts +5 -7
  123. package/src/agGrid/AdaptableAgGrid.js +159 -148
  124. package/src/agGrid/AgGridAdapter.d.ts +0 -1
  125. package/src/agGrid/AgGridAdapter.js +8 -11
  126. package/src/agGrid/AgGridColumnAdapter.d.ts +3 -1
  127. package/src/agGrid/AgGridColumnAdapter.js +40 -14
  128. package/src/agGrid/BadgeRenderer.js +4 -22
  129. package/src/agGrid/FloatingFilterWrapper.js +21 -0
  130. package/src/agGrid/buildSortedColumnStateForLayout.d.ts +1 -1
  131. package/src/agGrid/buildSortedColumnStateForLayout.js +2 -2
  132. package/src/agGrid/defaultAdaptableOptions.js +35 -30
  133. package/src/components/AdaptableFormComponent/AdaptableFormComponent.js +3 -15
  134. package/src/env.js +2 -2
  135. package/src/metamodel/adaptable.metamodel.d.ts +84 -8
  136. package/src/metamodel/adaptable.metamodel.js +1 -1
  137. package/src/types.d.ts +9 -9
  138. package/tsconfig.esm.tsbuildinfo +1 -1
  139. package/src/Redux/ActionsReducers/QueryRedux.d.ts +0 -10
  140. package/src/Redux/ActionsReducers/QueryRedux.js +0 -20
  141. package/src/Utilities/Helpers/FormatContentHelper.d.ts +0 -22
  142. package/src/Utilities/Helpers/FormatContentHelper.js +0 -34
  143. package/src/Utilities/Services/EntitlementService.d.ts +0 -14
  144. package/src/Utilities/Services/EntitlementService.js +0 -63
  145. package/src/Utilities/Services/Interface/IEntitlementService.d.ts +0 -10
  146. package/src/Utilities/Services/Interface/IEntitlementService.js +0 -1
  147. package/src/Utilities/Services/Interface/IReportService.d.ts +0 -27
  148. package/src/Utilities/Services/Interface/IReportService.js +0 -1
  149. package/src/Utilities/Services/ReportService.d.ts +0 -41
  150. package/src/Utilities/Services/ReportService.js +0 -603
  151. package/src/Utilities/isAdaptableObject.d.ts +0 -2
  152. package/src/Utilities/isAdaptableObject.js +0 -4
  153. package/src/Utilities/reorder.d.ts +0 -1
  154. package/src/Utilities/reorder.js +0 -13
  155. package/src/Utilities/sortWithOrder.d.ts +0 -11
  156. package/src/Utilities/sortWithOrder.js +0 -50
@@ -1,6 +1,6 @@
1
1
  import throttle from 'lodash/throttle';
2
2
  import debounce from 'lodash/debounce';
3
- import { createGrid, Events, ModuleNames, RowNode, GridOptionsService, } from '@ag-grid-community/core';
3
+ import { createGrid, EventService, GridOptionsService, LocalEventService, ModuleNames, } from '@ag-grid-community/core';
4
4
  import { AdaptableLogger } from './AdaptableLogger';
5
5
  import { PrimaryKeyDocsLink } from '../Utilities/Constants/DocumentationLinkConstants';
6
6
  import StringExtensions from '../Utilities/Extensions/StringExtensions';
@@ -17,10 +17,8 @@ import { CellPopupService } from '../Utilities/Services/CellPopupService';
17
17
  import { ChartingService } from '../Utilities/Services/ChartingService';
18
18
  import { ThemeService } from '../Utilities/Services/ThemeService';
19
19
  import { ValidationService } from '../Utilities/Services/ValidationService';
20
- import { ReportService } from '../Utilities/Services/ReportService';
21
20
  import { ModuleService } from '../Utilities/Services/ModuleService';
22
21
  import { CalculatedColumnExpressionService } from '../Utilities/Services/CalculatedColumnExpressionService';
23
- import { EntitlementService } from '../Utilities/Services/EntitlementService';
24
22
  import { QueryLanguageService } from '../Utilities/Services/QueryLanguageService';
25
23
  import { AlertService } from '../Utilities/Services/AlertService';
26
24
  import { TeamSharingService } from '../Utilities/Services/TeamSharingService';
@@ -85,7 +83,6 @@ import { isWeightedAverageAggregation, WEIGHTED_AVERAGE_AGG_FN_NAME, } from '../
85
83
  import lodashIsEqual from 'lodash/isEqual';
86
84
  import { RowEditService } from '../Utilities/Services/RowEditService';
87
85
  import { weightedAverage } from './weightedAverage';
88
- import { sortWithOrderArray } from '../Utilities/sortWithOrder';
89
86
  import { FilterOnDataChangeOptions } from '../PredefinedConfig/Common/Enums';
90
87
  import ObjectFactory, { createBaseContext } from '../Utilities/ObjectFactory';
91
88
  import { ADAPTABLE_PUBLISH_TIMESTAMP } from '../EnvVars';
@@ -95,45 +92,49 @@ import { AdaptableLoadingScreen } from '../View/Components/Popups/AdaptableLoadi
95
92
  import { createElement } from 'react';
96
93
  import { removeUuidAndSource } from '../Utilities/Helpers/AdaptableHelper';
97
94
  import { buildSortedColumnStateForLayout } from './buildSortedColumnStateForLayout';
98
- const RowNodeProto = RowNode.prototype;
99
- const RowNode_dispatchLocalEvent = RowNodeProto.dispatchLocalEvent;
95
+ import { ROW_SUMMARY_ROW_ID } from '../PredefinedConfig/Common/RowSummary';
96
+ const LocalEventService_Prototype = LocalEventService.prototype;
97
+ const LocalEventService_dispatchEvent = LocalEventService_Prototype.dispatchEvent;
100
98
  const GridOptionsService_updateGridOptions = GridOptionsService.prototype.updateGridOptions;
101
- /**
102
- * AgGrid does not expose 'cellChanged' and 'dataChanged'
103
- * so we have to override `dispatchLocalEvent`
104
- * and hook our own functionality into it
105
- */
106
- RowNodeProto.dispatchLocalEvent = function (event) {
107
- const node = event.node;
108
- const result = RowNode_dispatchLocalEvent.apply(this, arguments);
109
- const extractGridApiFromRowNode = (rowNode) => {
110
- var _a, _b, _c, _d;
111
- // starting with AG Grid 26.1.0 the gridApi is wrapped in a Beans property
112
- const rowNodeApi = (_b = (_a = rowNode === null || rowNode === void 0 ? void 0 : rowNode.beans) === null || _a === void 0 ? void 0 : _a.gridApi) !== null && _b !== void 0 ? _b : (_d = (_c = rowNode === null || rowNode === void 0 ? void 0 : rowNode.beans) === null || _c === void 0 ? void 0 : _c.gos) === null || _d === void 0 ? void 0 : _d.api;
113
- if (!rowNodeApi) {
114
- AdaptableLogger.consoleErrorBase(`No GridAPI found in passed RowNode, this should never happen!`, rowNode);
115
- }
116
- return rowNodeApi;
117
- };
118
- // we don't know from which instance of aggrid this is coming,
119
- // as this fn is shared by all instances
120
- if (node) {
121
- AdaptableAgGrid.forEachAdaptable((adaptable) => {
99
+ const EventService_Prototype = EventService.prototype;
100
+ const EventService_wireBeans = EventService_Prototype.wireBeans;
101
+ // AG GRID obfuscates its internals, this is (currently) the best way to get hold of its internal services
102
+ let DANGER_AG_GRID_BEANS;
103
+ EventService_Prototype.wireBeans = function (beans) {
104
+ EventService_wireBeans.apply(this, arguments);
105
+ DANGER_AG_GRID_BEANS = beans;
106
+ };
107
+ LocalEventService_Prototype.dispatchEvent = function (event) {
108
+ LocalEventService_dispatchEvent.apply(this, arguments);
109
+ if (event.type === 'cellChanged' || event.type === 'dataChanged') {
110
+ const eventRowNode = event.node;
111
+ const extractGridApiFromRowNode = (rowNode) => {
122
112
  var _a;
123
- if (extractGridApiFromRowNode(node) !== ((_a = adaptable.agGridAdapter) === null || _a === void 0 ? void 0 : _a.getAgGridApi(true))) {
124
- // the event is coming from another aggrid instance
125
- // so IGNORE IT
126
- return;
113
+ const rowNodeApi = (_a = rowNode === null || rowNode === void 0 ? void 0 : rowNode.beans) === null || _a === void 0 ? void 0 : _a.gridApi;
114
+ if (!rowNodeApi) {
115
+ AdaptableLogger.consoleErrorBase(`No GridAPI found in passed RowNode, this should never happen!`, rowNode);
127
116
  }
128
- // we're on the correct instance, so do this
129
- //@ts-ignore
130
- const fn = adaptable.rowListeners ? adaptable.rowListeners[event.type] : null;
131
- if (fn) {
132
- fn(event);
133
- }
134
- });
117
+ return rowNodeApi;
118
+ };
119
+ // we don't know from which instance of aggrid this is coming,
120
+ // as this fn is shared by all instances
121
+ if (eventRowNode) {
122
+ AdaptableAgGrid.forEachAdaptable((adaptable) => {
123
+ var _a;
124
+ if (extractGridApiFromRowNode(eventRowNode) !== ((_a = adaptable.agGridAdapter) === null || _a === void 0 ? void 0 : _a.getAgGridApi(true))) {
125
+ // the event is coming from another aggrid instance
126
+ // so IGNORE IT
127
+ return;
128
+ }
129
+ // we're on the correct instance, so do this
130
+ //@ts-ignore
131
+ const fn = adaptable.rowListeners ? adaptable.rowListeners[event.type] : null;
132
+ if (fn) {
133
+ fn(event);
134
+ }
135
+ });
136
+ }
135
137
  }
136
- return result;
137
138
  };
138
139
  const adaptableInstances = {};
139
140
  const publishTimestamp = Number(ADAPTABLE_PUBLISH_TIMESTAMP);
@@ -199,6 +200,9 @@ export class AdaptableAgGrid {
199
200
  static dismissInstance(adaptable) {
200
201
  delete adaptableInstances[adaptable._id];
201
202
  }
203
+ get isAgGridInitialising() {
204
+ return this.lifecycleState === 'initAgGrid';
205
+ }
202
206
  get isReady() {
203
207
  return this.lifecycleState === 'ready';
204
208
  }
@@ -334,7 +338,7 @@ export class AdaptableAgGrid {
334
338
  }
335
339
  this.forPlugins((plugin) => plugin.afterInitialStateLoaded(this));
336
340
  // do this now so it sets module entitlements
337
- this.EntitlementService.setModulesEntitlements();
341
+ this.api.entitlementApi.internalApi.setModulesEntitlements();
338
342
  /**
339
343
  * At this point it's mandatory to have the ALL the Adaptable blocks initialized:
340
344
  * Store, APIs, Services, Modules
@@ -349,6 +353,9 @@ export class AdaptableAgGrid {
349
353
  this.lifecycleState = 'initAgGrid';
350
354
  this.agGridAdapter.initialGridOptions = gridOptions;
351
355
  const perfInitAgGrid = this.logger.beginPerf(`initAgGrid()`);
356
+ // AG Grid evaluates early on the floatingFilter params, so we need to "suppres" the floating filter temporarily
357
+ // we will reset it once Adaptable is ready
358
+ this.agGridColumnAdapter.setupColumnFloatingFilterTemporarily(gridOptions);
352
359
  const agGridApi = await this.initializeAgGrid(gridOptions, config.modules, config.renderAgGridFrameworkComponent);
353
360
  if (agGridApi === false) {
354
361
  this.logger.consoleError(`Adaptable failed to initialize AG Grid!`);
@@ -360,6 +367,7 @@ export class AdaptableAgGrid {
360
367
  // we need to intercept several AG Grid Api methods and trigger Adaptale state changes
361
368
  this.monkeyPatchingGridOptionsUpdates(agGridApi);
362
369
  this.agGridAdapter.setAgGridApi(agGridApi);
370
+ this.lifecycleState = 'agGridReady';
363
371
  this.logger.info(`Registered AG Grid modules: `, this.agGridAdapter.getRegisteredModuleNames().sort());
364
372
  /**
365
373
  * At this point AG Grid is initialized!
@@ -427,15 +435,15 @@ export class AdaptableAgGrid {
427
435
  perfInitAdaptableAgGrid.end();
428
436
  return Promise.resolve(this.api);
429
437
  }
430
- normalizeAdaptableState(state, gridOptions) {
431
- state = this.normaliseLayoutState(state, gridOptions);
438
+ normalizeAdaptableState(state, agGridOptions) {
439
+ state = this.normaliseLayoutState(state, agGridOptions);
432
440
  state = this.normaliseToolPanelState(state);
433
441
  return state;
434
442
  }
435
443
  normaliseLayoutState(state, gridOptions) {
436
444
  var _a, _b, _c, _d, _e, _f;
437
445
  if (this.shouldCreateDefaultLayout(state, this.adaptableOptions)) {
438
- const defaultLayout = this.createDefaultLayout(state, gridOptions.columnDefs, gridOptions.autoGroupColumnDef);
446
+ const defaultLayout = this.createDefaultLayout(state, gridOptions);
439
447
  const layoutState = state.Layout || {};
440
448
  const availableLayouts = layoutState.Layouts || [];
441
449
  availableLayouts.push(defaultLayout);
@@ -598,12 +606,20 @@ export class AdaptableAgGrid {
598
606
  };
599
607
  }
600
608
  return (params) => {
601
- var _a;
602
- if (params.data[primaryKey]) {
603
- return params.data[primaryKey];
604
- }
605
- // row does not have primary key => might be a group row
606
- const parentKeys = (_a = params.parentKeys) !== null && _a !== void 0 ? _a : [];
609
+ var _a, _b, _c;
610
+ if ((_a = params.data) === null || _a === void 0 ? void 0 : _a[primaryKey]) {
611
+ const primaryKeyValue = params.data[primaryKey];
612
+ return typeof primaryKeyValue === 'number'
613
+ ? `${primaryKeyValue}`
614
+ : params.data[primaryKey];
615
+ }
616
+ // might be a summary row
617
+ if ((_b = params.data) === null || _b === void 0 ? void 0 : _b[ROW_SUMMARY_ROW_ID]) {
618
+ return params.data[ROW_SUMMARY_ROW_ID];
619
+ }
620
+ // AFL 2024.08.17 - no idea why is this here and when it's used
621
+ // might be a group row
622
+ const parentKeys = (_c = params.parentKeys) !== null && _c !== void 0 ? _c : [];
607
623
  const values = Object.values(params.data);
608
624
  if (values.length) {
609
625
  const id = [...parentKeys, values[0]].join('/');
@@ -804,7 +820,7 @@ export class AdaptableAgGrid {
804
820
  // lucky us, no sideBar is defined, so we don't have to do anything
805
821
  return original_sideBar;
806
822
  }
807
- const isAdaptableToolPanelHidden = this.EntitlementService.isModuleHiddenEntitlement('ToolPanel');
823
+ const isAdaptableToolPanelHidden = this.api.entitlementApi.isModuleHiddenEntitlement('ToolPanel');
808
824
  const adaptableToolPanelDef = {
809
825
  id: GeneralConstants.ADAPTABLE_TOOLPANEL_ID,
810
826
  toolPanel: GeneralConstants.ADAPTABLE_TOOLPANEL_COMPONENT,
@@ -1032,7 +1048,7 @@ export class AdaptableAgGrid {
1032
1048
  * Either initializes the AG Grid instance or delegates it to the framework wrappers (React/Anglar)
1033
1049
  */
1034
1050
  async initializeAgGrid(gridOptions, modules, renderAgGridFrameworkComponent) {
1035
- var _a, _b, _c;
1051
+ var _a;
1036
1052
  if (renderAgGridFrameworkComponent) {
1037
1053
  const result = await renderAgGridFrameworkComponent(gridOptions);
1038
1054
  if (result === false) {
@@ -1055,7 +1071,7 @@ export class AdaptableAgGrid {
1055
1071
  if (!this.getAgGridContainerElement()) {
1056
1072
  // initialize the agGridContainerElement from the AgGrid instance
1057
1073
  // @ts-ignore
1058
- const gridRoot = (_c = (_b = (_a = agGridApi.ctrlsService) === null || _a === void 0 ? void 0 : _a.getGridBodyCtrl) === null || _b === void 0 ? void 0 : _b.call(_a)) === null || _c === void 0 ? void 0 : _c.eGridBody;
1074
+ const gridRoot = (_a = this.DANGER_getPrivateAgGridBeans()) === null || _a === void 0 ? void 0 : _a.eGridDiv;
1059
1075
  const gridContainer = gridRoot === null || gridRoot === void 0 ? void 0 : gridRoot.closest('[class*="ag-theme"]');
1060
1076
  if (!gridContainer) {
1061
1077
  this.logger.consoleError(`No AG Grid container could be derived from the Adaptable framework wrapper.
@@ -1102,14 +1118,10 @@ export class AdaptableAgGrid {
1102
1118
  }
1103
1119
  return false;
1104
1120
  };
1105
- const isColGroupDef = (columnDefinition) => {
1106
- // @ts-ignore
1107
- return columnDefinition['children'] != null;
1108
- };
1109
1121
  const processedSpecialColDefIds = [];
1110
1122
  const mapColDefs = (colDefs) => {
1111
1123
  return colDefs.map((colDef) => {
1112
- if (isColGroupDef(colDef)) {
1124
+ if (this.agGridColumnAdapter.isColGroupDef(colDef)) {
1113
1125
  // if it's a group column, recursively map its children
1114
1126
  colDef.children = mapColDefs(colDef.children);
1115
1127
  return colDef;
@@ -1245,7 +1257,7 @@ export class AdaptableAgGrid {
1245
1257
  .map((colDef) => colDef.colId),
1246
1258
  };
1247
1259
  agGridState.columnOrder = {
1248
- orderedColIds: sortWithOrderArray(allAgGridColDefIds, currentLayout.Columns || [], {
1260
+ orderedColIds: ArrayExtensions.sortArrayWithOrder(allAgGridColDefIds, currentLayout.Columns || [], {
1249
1261
  sortUnorderedItems: false,
1250
1262
  }),
1251
1263
  };
@@ -1354,12 +1366,12 @@ export class AdaptableAgGrid {
1354
1366
  this.deriveAdaptableColumnStateFromAgGrid();
1355
1367
  }, HALF_SECOND);
1356
1368
  const columnEventsThatTriggersStateChange = [
1357
- Events.EVENT_COLUMN_MOVED,
1358
- Events.EVENT_GRID_COLUMNS_CHANGED,
1359
- Events.EVENT_COLUMN_EVERYTHING_CHANGED,
1360
- Events.EVENT_DISPLAYED_COLUMNS_CHANGED,
1361
- Events.EVENT_COLUMN_VISIBLE,
1362
- Events.EVENT_NEW_COLUMNS_LOADED,
1369
+ 'columnMoved',
1370
+ 'gridColumnsChanged',
1371
+ 'columnEverythingChanged',
1372
+ 'displayedColumnsChanged',
1373
+ 'columnVisible',
1374
+ 'newColumnsLoaded',
1363
1375
  ];
1364
1376
  this.agGridAdapter.getAgGridApi().addGlobalListener((this.listenerGlobalColumnEventsThatTriggerStateChange = (type) => {
1365
1377
  if (columnEventsThatTriggersStateChange.indexOf(type) > -1) {
@@ -1370,7 +1382,7 @@ export class AdaptableAgGrid {
1370
1382
  * Use Case: User has started inline editing but its distabled in Action Row Options
1371
1383
  * Action: Stop editing
1372
1384
  */
1373
- this.agGridAdapter.getAgGridApi().addEventListener(Events.EVENT_CELL_EDITING_STARTED, (this.listenerCellEditingStarted = () => {
1385
+ this.agGridAdapter.getAgGridApi().addEventListener('cellEditingStarted', (this.listenerCellEditingStarted = () => {
1374
1386
  var _a;
1375
1387
  if ((_a = this.adaptableOptions.actionRowOptions) === null || _a === void 0 ? void 0 : _a.disableInlineEditing)
1376
1388
  this.agGridAdapter.getAgGridApi().stopEditing();
@@ -1381,7 +1393,7 @@ export class AdaptableAgGrid {
1381
1393
  * Action2: Ensure that we have set column data types
1382
1394
  * Note: Deals with scenario where the data is provided to AdapTable after grid has been setup
1383
1395
  */
1384
- this.agGridAdapter.getAgGridApi().addEventListener(Events.EVENT_FIRST_DATA_RENDERED, (this.listenerFirstDataRendered = () => {
1396
+ this.agGridAdapter.getAgGridApi().addEventListener('firstDataRendered', (this.listenerFirstDataRendered = () => {
1385
1397
  if (this.initWithLazyData) {
1386
1398
  this.updateColumnModelAndRefreshGrid({ skipColDefsRefresh: true });
1387
1399
  this.api.calculatedColumnApi.refreshAggregatedCalculatedColumns();
@@ -1394,7 +1406,7 @@ export class AdaptableAgGrid {
1394
1406
  * Action 1: Autosize pivot columns when entering pivot mode (if autosize pivot in Layout is true)
1395
1407
  * Action 2: Set pivot mode on / off in api as necessary
1396
1408
  */
1397
- this.agGridAdapter.getAgGridApi().addEventListener(Events.EVENT_COLUMN_PIVOT_MODE_CHANGED, (this.listenerPivotModeChanged = (params) => {
1409
+ this.agGridAdapter.getAgGridApi().addEventListener('columnPivotModeChanged', (this.listenerPivotModeChanged = (params) => {
1398
1410
  if (params.type == 'columnPivotModeChanged' &&
1399
1411
  params.columnApi != null &&
1400
1412
  params.columnApi.columnController != null &&
@@ -1412,7 +1424,7 @@ export class AdaptableAgGrid {
1412
1424
  * Use Case: A pivot column has changed
1413
1425
  * Action: Autosize pivot columns (if autosize pivot in Layout is true)
1414
1426
  */
1415
- this.agGridAdapter.getAgGridApi().addEventListener(Events.EVENT_COLUMN_PIVOT_CHANGED, (this.listenerPivotChanged = (params) => {
1427
+ this.agGridAdapter.getAgGridApi().addEventListener('columnPivotChanged', (this.listenerPivotChanged = (params) => {
1416
1428
  if (params.type == 'columnPivotChanged' &&
1417
1429
  params.columnApi != null &&
1418
1430
  params.columnApi.columnController != null &&
@@ -1427,13 +1439,13 @@ export class AdaptableAgGrid {
1427
1439
  * Action: Save the Layout (on a debounce)
1428
1440
  */
1429
1441
  const columnEventsThatTriggersAutoLayoutSave = [
1430
- Events.EVENT_COLUMN_PINNED,
1431
- Events.EVENT_COLUMN_PIVOT_CHANGED,
1432
- Events.EVENT_COLUMN_PIVOT_MODE_CHANGED,
1433
- Events.EVENT_DISPLAYED_COLUMNS_CHANGED,
1434
- Events.EVENT_SORT_CHANGED,
1435
- Events.EVENT_COLUMN_ROW_GROUP_CHANGED,
1436
- Events.EVENT_COLUMN_VALUE_CHANGED,
1442
+ 'columnPinned',
1443
+ 'columnPivotChanged',
1444
+ 'columnPivotModeChanged',
1445
+ 'displayedColumnsChanged',
1446
+ 'sortChanged',
1447
+ 'columnRowGroupChanged',
1448
+ 'columnValueChanged',
1437
1449
  ];
1438
1450
  // ADD filter event
1439
1451
  this.agGridAdapter.getAgGridApi().addGlobalListener((this.listenerGlobalColumnEventsThatTriggerAutoLayoutSave = (type) => {
@@ -1452,8 +1464,8 @@ export class AdaptableAgGrid {
1452
1464
  this.updateLayoutFromGrid();
1453
1465
  }, HALF_SECOND);
1454
1466
  const rowGroupEventsThatTriggersAutoLayoutSave = [
1455
- Events.EVENT_ROW_GROUP_OPENED,
1456
- Events.EVENT_EXPAND_COLLAPSE_ALL,
1467
+ 'rowGroupOpened',
1468
+ 'expandOrCollapseAll',
1457
1469
  ];
1458
1470
  this.agGridAdapter.getAgGridApi().addGlobalListener((this.listenerGlobalRowGroupEventsThatTriggerAutoLayoutSave = (type) => {
1459
1471
  if (rowGroupEventsThatTriggersAutoLayoutSave.indexOf(type) > -1) {
@@ -1466,7 +1478,7 @@ export class AdaptableAgGrid {
1466
1478
  * Use Case: Column Row Grouping changes and 'restoreUngroupedColumns' is true
1467
1479
  * Action: Make the column invisiblel
1468
1480
  */
1469
- this.agGridAdapter.getAgGridApi().addEventListener(Events.EVENT_COLUMN_ROW_GROUP_CHANGED, (this.listenerColumnRowGroupChanged = (params) => {
1481
+ this.agGridAdapter.getAgGridApi().addEventListener('columnRowGroupChanged', (this.listenerColumnRowGroupChanged = (params) => {
1470
1482
  var _a, _b;
1471
1483
  if (this.api.internalApi.isGridInPivotMode()) {
1472
1484
  return;
@@ -1480,7 +1492,7 @@ export class AdaptableAgGrid {
1480
1492
  * Action 1: Save the Layout (on a debounce)
1481
1493
  * Action 2: Emit the internal ColumnResized event - used by Sparkline Column (in Charts)
1482
1494
  */
1483
- this.agGridAdapter.getAgGridApi().addEventListener(Events.EVENT_COLUMN_RESIZED, (this.listenerColumnResized = (params) => {
1495
+ this.agGridAdapter.getAgGridApi().addEventListener('columnResized', (this.listenerColumnResized = (params) => {
1484
1496
  if (params.finished == true && params.type == 'columnResized' && params.column) {
1485
1497
  this.debouncedSaveGridLayout(params.type);
1486
1498
  }
@@ -1496,9 +1508,9 @@ export class AdaptableAgGrid {
1496
1508
  this.refreshSelectedRowsState();
1497
1509
  }, HALF_SECOND);
1498
1510
  const columnEventsThatTriggerSetRowSelection = [
1499
- Events.EVENT_ROW_GROUP_OPENED,
1500
- Events.EVENT_SELECTION_CHANGED,
1501
- Events.EVENT_ROW_SELECTED,
1511
+ 'rowGroupOpened',
1512
+ 'selectionChanged',
1513
+ 'rowSelected',
1502
1514
  ];
1503
1515
  this.agGridAdapter.getAgGridApi().addGlobalListener((this.listenerGlobalSetRowSelection = (type) => {
1504
1516
  if (ArrayExtensions.ContainsItem(columnEventsThatTriggerSetRowSelection, type)) {
@@ -1515,7 +1527,7 @@ export class AdaptableAgGrid {
1515
1527
  }
1516
1528
  this.refreshSelectedCellsState();
1517
1529
  }, 250);
1518
- this.agGridAdapter.getAgGridApi().addEventListener(Events.EVENT_RANGE_SELECTION_CHANGED, (this.listenerRangeSelectionChanged = (params) => {
1530
+ this.agGridAdapter.getAgGridApi().addEventListener('rangeSelectionChanged', (this.listenerRangeSelectionChanged = (params) => {
1519
1531
  if (params.finished == true) {
1520
1532
  this.debouncedSetSelectedCells();
1521
1533
  }
@@ -1525,18 +1537,18 @@ export class AdaptableAgGrid {
1525
1537
  * Action1: Update AdapTable Sort Info
1526
1538
  * Action2: Set Selected Cells (on a debounce)
1527
1539
  */
1528
- this.agGridAdapter.getAgGridApi().addEventListener(Events.EVENT_SORT_CHANGED, (this.listenerSortChanged = () => {
1540
+ this.agGridAdapter.getAgGridApi().addEventListener('sortChanged', (this.listenerSortChanged = () => {
1529
1541
  this.onSortChanged();
1530
1542
  this.debouncedSetSelectedCells();
1531
1543
  }));
1532
1544
  const eventsThatTriggerChartingChanges = [
1533
- Events.EVENT_CHART_CREATED,
1545
+ 'chartCreated',
1534
1546
  /** Chart Range selection has changed */
1535
- Events.EVENT_CHART_RANGE_SELECTION_CHANGED,
1547
+ 'chartRangeSelectionChanged',
1536
1548
  /** Chart Options have changed */
1537
- Events.EVENT_CHART_OPTIONS_CHANGED,
1549
+ 'chartOptionsChanged',
1538
1550
  /** Chart was destroyed */
1539
- Events.EVENT_CHART_DESTROYED,
1551
+ 'chartDestroyed',
1540
1552
  ];
1541
1553
  const chartingModule = this.ModuleService.getModuleById('Charting');
1542
1554
  if (chartingModule.isModuleAvailable()) {
@@ -1591,17 +1603,7 @@ export class AdaptableAgGrid {
1591
1603
  }
1592
1604
  performAudit(action, oldState, newState) {
1593
1605
  if (this.isReady) {
1594
- const adaptableStateChangedInfo = {
1595
- adaptableApi: this.api,
1596
- actionName: action.type,
1597
- clientTimestamp: new Date(),
1598
- userName: this.adaptableOptions.userName,
1599
- adaptableId: this.adaptableOptions.adaptableId,
1600
- adaptableStateKey: this.adaptableOptions.adaptableStateKey,
1601
- action: action,
1602
- oldState: oldState,
1603
- newState: newState,
1604
- };
1606
+ const adaptableStateChangedInfo = Object.assign(Object.assign({ actionName: action.type, clientTimestamp: new Date() }, this.api.internalApi.buildBaseContext()), { adaptableStateKey: this.adaptableOptions.adaptableStateKey, action: action, oldState: oldState, newState: newState });
1605
1607
  this.api.eventApi.emit('AdaptableStateChanged', adaptableStateChangedInfo);
1606
1608
  }
1607
1609
  }
@@ -1636,10 +1638,8 @@ export class AdaptableAgGrid {
1636
1638
  this.ChartingService = new ChartingService(this.api);
1637
1639
  this.ThemeService = new ThemeService(this.api);
1638
1640
  this.ValidationService = new ValidationService(this.api);
1639
- this.ReportService = new ReportService(this.api);
1640
1641
  this.ModuleService = new ModuleService(this.api);
1641
1642
  this.CalculatedColumnExpressionService = new CalculatedColumnExpressionService(this.api);
1642
- this.EntitlementService = new EntitlementService(this.api);
1643
1643
  this.QueryLanguageService = new QueryLanguageService(this.api);
1644
1644
  this.AlertService = new AlertService(this.api);
1645
1645
  this.TeamSharingService = new TeamSharingService(this.api);
@@ -1713,20 +1713,27 @@ export class AdaptableAgGrid {
1713
1713
  });
1714
1714
  }
1715
1715
  validatePrimaryKey() {
1716
+ var _a;
1716
1717
  if (this.hasAutogeneratedPrimaryKey) {
1717
1718
  return;
1718
1719
  }
1719
1720
  const primaryKey = this.adaptableOptions.primaryKey;
1721
+ // first check if there is a primary key column
1720
1722
  const primaryKeyColDef = this.agGridAdapter.getAgGridApi().getColumnDef(primaryKey);
1721
1723
  if (!primaryKeyColDef) {
1722
- const errorMessage = `The Primary Key Column '${this.adaptableOptions.primaryKey}' does not exist. This will affect many functions in Adaptable.`;
1723
- if (this.adaptableOptions.alertOptions.showMissingPrimaryKeyAlert) {
1724
- // show an alert if that is the option
1725
- this.api.alertApi.showAlertError('No Primary Key', errorMessage);
1726
- }
1727
- else {
1728
- if (this.adaptableOptions.columnOptions.showMissingColumnsWarning) {
1729
- this.logger.consoleError(errorMessage);
1724
+ let errorMessage;
1725
+ // if no primary key column then lets check the first row to see if its a data item
1726
+ const primaryKeyDataItem = (_a = this.getFirstRowNode()) === null || _a === void 0 ? void 0 : _a.data[primaryKey];
1727
+ if (!primaryKeyDataItem) {
1728
+ errorMessage = `The Primary Key '${this.adaptableOptions.primaryKey}' does not exist. This will affect many functions in AdapTable.`;
1729
+ if (this.adaptableOptions.alertOptions.showMissingPrimaryKeyAlert) {
1730
+ // show an alert if that is the option
1731
+ this.api.alertApi.showAlertError('No Primary Key', errorMessage);
1732
+ }
1733
+ else {
1734
+ if (this.adaptableOptions.columnOptions.showMissingColumnsWarning) {
1735
+ this.logger.consoleError(errorMessage);
1736
+ }
1730
1737
  }
1731
1738
  }
1732
1739
  }
@@ -1855,7 +1862,6 @@ export class AdaptableAgGrid {
1855
1862
  return this.getDisplayValueFromRawValue(rowNode, columnId, rawValue);
1856
1863
  }
1857
1864
  getDisplayValueFromRawValue(rowNode, columnId, rawValue) {
1858
- var _a;
1859
1865
  const isActionColumn = this.api.columnApi.isActionColumn(columnId);
1860
1866
  if (isActionColumn) {
1861
1867
  return this.getCleanValue(rawValue);
@@ -1871,8 +1877,7 @@ export class AdaptableAgGrid {
1871
1877
  colDef,
1872
1878
  column,
1873
1879
  api: this.agGridAdapter.getAgGridApi(),
1874
- columnApi: (_a = this.agGridAdapter.getLiveGridOptions()) === null || _a === void 0 ? void 0 : _a.columnApi,
1875
- context: this.agGridAdapter.getLiveGridOptions().context,
1880
+ context: this.agGridAdapter.getGridOption('context'),
1876
1881
  };
1877
1882
  const formattedValue = colDef.valueFormatter(params);
1878
1883
  return formattedValue || '';
@@ -2297,7 +2302,7 @@ export class AdaptableAgGrid {
2297
2302
  };
2298
2303
  }),
2299
2304
  layout: Object.assign(Object.assign({}, layout), { Columns: visibleColumnList }),
2300
- gridOptions: this.agGridAdapter.getLiveGridOptions(),
2305
+ groupDisplayType: this.agGridAdapter.getGridOption('groupDisplayType'),
2301
2306
  });
2302
2307
  }
2303
2308
  getDistinctValuesForColumn(column, distinctValuesParams) {
@@ -2439,8 +2444,8 @@ export class AdaptableAgGrid {
2439
2444
  return this.agGridAdapter.getAgGridApi().getDisplayedRowAtIndex(index);
2440
2445
  }
2441
2446
  getAgGridStatusPanels() {
2442
- var _a, _b, _c;
2443
- return (_c = (_b = (_a = this.agGridAdapter.getLiveGridOptions()) === null || _a === void 0 ? void 0 : _a.statusBar) === null || _b === void 0 ? void 0 : _b.statusPanels) !== null && _c !== void 0 ? _c : [];
2447
+ var _a, _b;
2448
+ return (_b = (_a = this.agGridAdapter.getGridOption('statusBar')) === null || _a === void 0 ? void 0 : _a.statusPanels) !== null && _b !== void 0 ? _b : [];
2444
2449
  }
2445
2450
  setDataValue(value, column, primaryKeyValue, rowNode) {
2446
2451
  // note: because we use RowNode.setDataValue() this will cause Validation to fire
@@ -2938,35 +2943,35 @@ export class AdaptableAgGrid {
2938
2943
  return this.agGridAdapter.getRegisteredModules();
2939
2944
  }
2940
2945
  destroy(config) {
2941
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10;
2946
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6;
2942
2947
  if (((_a = this.agGridAdapter) === null || _a === void 0 ? void 0 : _a.getAgGridApi()) && !this.agGridAdapter.getAgGridApi().isDestroyed()) {
2943
2948
  this.agGridAdapter
2944
2949
  .getAgGridApi()
2945
- .removeEventListener(Events.EVENT_FIRST_DATA_RENDERED, this.listenerFirstDataRendered);
2950
+ .removeEventListener('firstDataRendered', this.listenerFirstDataRendered);
2946
2951
  this.agGridAdapter
2947
2952
  .getAgGridApi()
2948
- .removeEventListener(Events.EVENT_COLUMN_PIVOT_MODE_CHANGED, this.listenerPivotModeChanged);
2953
+ .removeEventListener('columnPivotModeChanged', this.listenerPivotModeChanged);
2949
2954
  this.agGridAdapter
2950
2955
  .getAgGridApi()
2951
- .removeEventListener(Events.EVENT_COLUMN_PIVOT_CHANGED, this.listenerPivotChanged);
2956
+ .removeEventListener('columnPivotChanged', this.listenerPivotChanged);
2952
2957
  this.agGridAdapter
2953
2958
  .getAgGridApi()
2954
- .removeEventListener(Events.EVENT_CELL_EDITING_STARTED, this.listenerCellEditingStarted);
2959
+ .removeEventListener('cellEditingStarted', this.listenerCellEditingStarted);
2955
2960
  this.agGridAdapter
2956
2961
  .getAgGridApi()
2957
- .removeEventListener(Events.EVENT_COLUMN_ROW_GROUP_CHANGED, this.listenerColumnRowGroupChanged);
2962
+ .removeEventListener('columnRowGroupChanged', this.listenerColumnRowGroupChanged);
2958
2963
  this.agGridAdapter
2959
2964
  .getAgGridApi()
2960
- .removeEventListener(Events.EVENT_RANGE_SELECTION_CHANGED, this.listenerRangeSelectionChanged);
2965
+ .removeEventListener('rangeSelectionChanged', this.listenerRangeSelectionChanged);
2961
2966
  this.agGridAdapter
2962
2967
  .getAgGridApi()
2963
- .removeEventListener(Events.EVENT_COLUMN_RESIZED, this.listenerColumnResized);
2968
+ .removeEventListener('columnResized', this.listenerColumnResized);
2964
2969
  this.agGridAdapter
2965
2970
  .getAgGridApi()
2966
- .removeEventListener(Events.EVENT_SORT_CHANGED, this.listenerSortChanged);
2971
+ .removeEventListener('sortChanged', this.listenerSortChanged);
2967
2972
  this.agGridAdapter
2968
2973
  .getAgGridApi()
2969
- .removeEventListener(Events.EVENT_MODEL_UPDATED, this.listenerModelUpdated);
2974
+ .removeEventListener('modelUpdated', this.listenerModelUpdated);
2970
2975
  this.agGridAdapter.getAgGridApi().removeGlobalListener(this.listenerGlobalSetRowSelection);
2971
2976
  this.agGridAdapter
2972
2977
  .getAgGridApi()
@@ -2992,7 +2997,7 @@ export class AdaptableAgGrid {
2992
2997
  this.listenerGlobalRowGroupEventsThatTriggerAutoLayoutSave = null;
2993
2998
  this.throttleFilterOnEditDataChange = null;
2994
2999
  this.throttleFilterOnTickingDataChange = null;
2995
- const liveGridOptions = this.agGridAdapter.getLiveGridOptions();
3000
+ const liveGridOptions = this.DANGER_getPrivateAgGridBeans().gridOptions;
2996
3001
  if (liveGridOptions) {
2997
3002
  this.agGridOptionsService.revertGridOptionsPropertiesToUserValue(liveGridOptions, [
2998
3003
  'aggFuncs',
@@ -3020,6 +3025,7 @@ export class AdaptableAgGrid {
3020
3025
  }
3021
3026
  }
3022
3027
  }
3028
+ DANGER_AG_GRID_BEANS = null;
3023
3029
  if ((config === null || config === void 0 ? void 0 : config.destroyApi) === true) {
3024
3030
  (_b = this.agGridAdapter.getAgGridApi()) === null || _b === void 0 ? void 0 : _b.destroy();
3025
3031
  }
@@ -3069,27 +3075,23 @@ export class AdaptableAgGrid {
3069
3075
  this.CalculatedColumnExpressionService = null;
3070
3076
  (_o = (_m = this.DataService) === null || _m === void 0 ? void 0 : _m.destroy) === null || _o === void 0 ? void 0 : _o.call(_m);
3071
3077
  this.DataService = null;
3072
- (_q = (_p = this.EntitlementService) === null || _p === void 0 ? void 0 : _p.destroy) === null || _q === void 0 ? void 0 : _q.call(_p);
3073
- this.EntitlementService = null;
3074
- (_s = (_r = this.Fdc3Service) === null || _r === void 0 ? void 0 : _r.destroy) === null || _s === void 0 ? void 0 : _s.call(_r);
3078
+ (_q = (_p = this.Fdc3Service) === null || _p === void 0 ? void 0 : _p.destroy) === null || _q === void 0 ? void 0 : _q.call(_p);
3075
3079
  this.Fdc3Service = null;
3076
- (_u = (_t = this.ReportService) === null || _t === void 0 ? void 0 : _t.destroy) === null || _u === void 0 ? void 0 : _u.call(_t);
3077
- this.ReportService = null;
3078
- (_w = (_v = this.ModuleService) === null || _v === void 0 ? void 0 : _v.destroy) === null || _w === void 0 ? void 0 : _w.call(_v);
3080
+ (_s = (_r = this.ModuleService) === null || _r === void 0 ? void 0 : _r.destroy) === null || _s === void 0 ? void 0 : _s.call(_r);
3079
3081
  this.ModuleService = null;
3080
- (_y = (_x = this.ValidationService) === null || _x === void 0 ? void 0 : _x.destroy) === null || _y === void 0 ? void 0 : _y.call(_x);
3082
+ (_u = (_t = this.ValidationService) === null || _t === void 0 ? void 0 : _t.destroy) === null || _u === void 0 ? void 0 : _u.call(_t);
3081
3083
  this.ValidationService = null;
3082
- (_0 = (_z = this.QueryLanguageService) === null || _z === void 0 ? void 0 : _z.destroy) === null || _0 === void 0 ? void 0 : _0.call(_z);
3084
+ (_w = (_v = this.QueryLanguageService) === null || _v === void 0 ? void 0 : _v.destroy) === null || _w === void 0 ? void 0 : _w.call(_v);
3083
3085
  this.QueryLanguageService = null;
3084
- (_2 = (_1 = this.AlertService) === null || _1 === void 0 ? void 0 : _1.destroy) === null || _2 === void 0 ? void 0 : _2.call(_1);
3086
+ (_y = (_x = this.AlertService) === null || _x === void 0 ? void 0 : _x.destroy) === null || _y === void 0 ? void 0 : _y.call(_x);
3085
3087
  this.AlertService = null;
3086
- (_4 = (_3 = this.TeamSharingService) === null || _3 === void 0 ? void 0 : _3.destroy) === null || _4 === void 0 ? void 0 : _4.call(_3);
3088
+ (_0 = (_z = this.TeamSharingService) === null || _z === void 0 ? void 0 : _z.destroy) === null || _0 === void 0 ? void 0 : _0.call(_z);
3087
3089
  this.TeamSharingService = null;
3088
- (_6 = (_5 = this.RowEditService) === null || _5 === void 0 ? void 0 : _5.destroy) === null || _6 === void 0 ? void 0 : _6.call(_5);
3090
+ (_2 = (_1 = this.RowEditService) === null || _1 === void 0 ? void 0 : _1.destroy) === null || _2 === void 0 ? void 0 : _2.call(_1);
3089
3091
  this.RowEditService = null;
3090
- (_8 = (_7 = this.MetamodelService) === null || _7 === void 0 ? void 0 : _7.destroy) === null || _8 === void 0 ? void 0 : _8.call(_7);
3092
+ (_4 = (_3 = this.MetamodelService) === null || _3 === void 0 ? void 0 : _3.destroy) === null || _4 === void 0 ? void 0 : _4.call(_3);
3091
3093
  this.MetamodelService = null;
3092
- (_10 = (_9 = this.LicenseService) === null || _9 === void 0 ? void 0 : _9.destroy) === null || _10 === void 0 ? void 0 : _10.call(_9);
3094
+ (_6 = (_5 = this.LicenseService) === null || _5 === void 0 ? void 0 : _5.destroy) === null || _6 === void 0 ? void 0 : _6.call(_5);
3093
3095
  this.LicenseService = null;
3094
3096
  }
3095
3097
  canExportToExcel() {
@@ -3142,13 +3144,13 @@ export class AdaptableAgGrid {
3142
3144
  }
3143
3145
  exportVisualDataToExcel() {
3144
3146
  try {
3145
- const exportExcelStyles = this.ReportService.buildExcelStylesForVisualReports();
3147
+ const exportExcelStyles = this.api.exportApi.internalApi.buildExcelStylesForVisualReports();
3146
3148
  // set DANGER_excelStyles without changing the array reference
3147
3149
  this.DANGER_excelStyles.splice(0, this.DANGER_excelStyles.length, ...exportExcelStyles);
3148
3150
  // this.agGridOptionsService.CAREFUL_patchGridOptionsProperty('excelStyles', exportExcelStyles);
3149
3151
  this.agGridAdapter.getAgGridApi().exportDataAsExcel({
3150
3152
  sheetName: 'Sheet 1',
3151
- fileName: this.ReportService.getReportFileName(this.adaptableOptions.adaptableId, 'Excel'),
3153
+ fileName: this.api.exportApi.internalApi.getReportFileName(this.adaptableOptions.adaptableId, 'Excel'),
3152
3154
  // delegate the cell value processing to Adaptable
3153
3155
  processCellCallback: ({ node, column, value }) => {
3154
3156
  var _a;
@@ -3207,18 +3209,18 @@ export class AdaptableAgGrid {
3207
3209
  rawValue = dateRawValue;
3208
3210
  }
3209
3211
  }
3210
- return this.ReportService.getCellExportValueFromRawValue(rowNode, rawValue, columnId);
3212
+ return this.api.exportApi.internalApi.getCellExportValueFromRawValue(rowNode, rawValue, columnId);
3211
3213
  }
3212
3214
  processCellForExcelExport(rowNode, columnId) {
3213
3215
  if (this.api.exportApi.internalApi.isVisualDataExportInProgress()) {
3214
3216
  const cellKey = this.agGridColumnAdapter.getExcelClassNameForCell(columnId, this.getPrimaryKeyValueFromRowNode(rowNode));
3215
- const isoFormattedDate = this.ReportService.getExcelStyleWithFormattedDate(cellKey);
3217
+ const isoFormattedDate = this.api.exportApi.internalApi.getExcelStyleWithFormattedDate(cellKey);
3216
3218
  if (isoFormattedDate) {
3217
3219
  // this is a Date cell which will be formatted by Excel
3218
3220
  return isoFormattedDate;
3219
3221
  }
3220
3222
  }
3221
- return this.ReportService.getCellExportValueFromRowNode(rowNode, columnId);
3223
+ return this.api.exportApi.internalApi.getCellExportValueFromRowNode(rowNode, columnId);
3222
3224
  }
3223
3225
  isQuickFilterAvailable() {
3224
3226
  if (this.api.layoutApi.isCurrentLayoutPivot() &&
@@ -3730,8 +3732,10 @@ export class AdaptableAgGrid {
3730
3732
  }
3731
3733
  return !((_c = layoutState.Layouts) === null || _c === void 0 ? void 0 : _c.length);
3732
3734
  }
3733
- createDefaultLayout(state, agGridColDefs, agGridAutoGroupColDef) {
3735
+ createDefaultLayout(state, agGridOptions) {
3734
3736
  var _a, _b, _c;
3737
+ const agGridColDefs = agGridOptions.columnDefs;
3738
+ const agGridAutoGroupColDef = agGridOptions.autoGroupColumnDef;
3735
3739
  const allColumnDefs = this.agGridAdapter.getFlattenedColDefs(agGridColDefs);
3736
3740
  const defaultLayout = ObjectFactory.CreateEmptyLayout({
3737
3741
  Name: DEFAULT_LAYOUT,
@@ -3757,7 +3761,8 @@ export class AdaptableAgGrid {
3757
3761
  }, []),
3758
3762
  });
3759
3763
  // handle optional 'gridOptions.autoGroupColumnDefs' parameter
3760
- if (agGridAutoGroupColDef && ((_a = defaultLayout.RowGroupedColumns) === null || _a === void 0 ? void 0 : _a.length)) {
3764
+ if (agGridAutoGroupColDef &&
3765
+ (((_a = defaultLayout.RowGroupedColumns) === null || _a === void 0 ? void 0 : _a.length) || agGridOptions.treeData)) {
3761
3766
  defaultLayout.Columns = [AG_GRID_GROUPED_COLUMN, ...defaultLayout.Columns];
3762
3767
  }
3763
3768
  if (agGridAutoGroupColDef === null || agGridAutoGroupColDef === void 0 ? void 0 : agGridAutoGroupColDef.pinned) {
@@ -4006,8 +4011,11 @@ export class AdaptableAgGrid {
4006
4011
  }
4007
4012
  // we need to intercept some of the GridOptions updates and refresh the Adaptable state
4008
4013
  monkeyPatchingGridOptionsUpdates(agGridApi) {
4009
- // @ts-ignore
4010
- const gridOptionsService = agGridApi.gos;
4014
+ var _a;
4015
+ const gridOptionsService = (_a = this.DANGER_getPrivateAgGridBeans()) === null || _a === void 0 ? void 0 : _a.gos;
4016
+ if (!gridOptionsService) {
4017
+ this.logger.consoleError('Could not get hold of GridOptionsService! This is a critical error and will prevent Adaptable from working correctly.');
4018
+ }
4011
4019
  const self = this;
4012
4020
  gridOptionsService.updateGridOptions = function ({ options, force, source = 'api', }) {
4013
4021
  // `columnDefs`
@@ -4037,4 +4045,7 @@ export class AdaptableAgGrid {
4037
4045
  GridOptionsService_updateGridOptions.apply(this, arguments);
4038
4046
  };
4039
4047
  }
4048
+ DANGER_getPrivateAgGridBeans() {
4049
+ return DANGER_AG_GRID_BEANS;
4050
+ }
4040
4051
  }