@adaptabletools/adaptable-cjs 20.0.0-canary.2 → 20.0.0-canary.20

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 (116) hide show
  1. package/base.css +1288 -898
  2. package/base.css.map +1 -1
  3. package/index.css +428 -898
  4. package/index.css.map +1 -1
  5. package/package.json +4 -4
  6. package/src/AdaptableInterfaces/IAdaptable.d.ts +2 -1
  7. package/src/AdaptableOptions/CellSummaryOptions.d.ts +1 -1
  8. package/src/AdaptableOptions/ContainerOptions.d.ts +0 -7
  9. package/src/AdaptableOptions/DashboardOptions.d.ts +1 -1
  10. package/src/AdaptableOptions/DefaultAdaptableOptions.js +2 -2
  11. package/src/AdaptableOptions/EditOptions.d.ts +14 -3
  12. package/src/AdaptableOptions/ExportOptions.d.ts +11 -20
  13. package/src/AdaptableOptions/PredicateOptions.d.ts +4 -4
  14. package/src/AdaptableOptions/QuickSearchOptions.d.ts +2 -2
  15. package/src/AdaptableOptions/UserInterfaceOptions.d.ts +7 -0
  16. package/src/Api/ExportApi.d.ts +1 -6
  17. package/src/Api/Fdc3Api.d.ts +5 -3
  18. package/src/Api/Implementation/AdaptableApiImpl.js +1 -0
  19. package/src/Api/Implementation/ColumnFilterApiImpl.js +3 -3
  20. package/src/Api/Implementation/ExportApiImpl.d.ts +1 -2
  21. package/src/Api/Implementation/ExportApiImpl.js +17 -10
  22. package/src/Api/Implementation/Fdc3ApiImpl.d.ts +3 -3
  23. package/src/Api/Implementation/Fdc3ApiImpl.js +4 -4
  24. package/src/Api/Implementation/LayoutHelpers.js +8 -27
  25. package/src/Api/Implementation/PredicateApiImpl.js +1 -1
  26. package/src/Api/Implementation/ScheduleApiImpl.js +1 -1
  27. package/src/Api/Implementation/StyledColumnApiImpl.js +1 -1
  28. package/src/Api/Implementation/ThemeApiImpl.js +3 -1
  29. package/src/Api/Internal/ActionColumnInternalApi.js +16 -19
  30. package/src/Api/Internal/AdaptableInternalApi.js +1 -1
  31. package/src/Api/Internal/ColumnFilterInternalApi.js +2 -2
  32. package/src/Api/Internal/ColumnInternalApi.js +1 -2
  33. package/src/Api/Internal/EventInternalApi.js +6 -1
  34. package/src/Api/Internal/ExportInternalApi.d.ts +10 -6
  35. package/src/Api/Internal/ExportInternalApi.js +105 -136
  36. package/src/Api/Internal/RowFormInternalApi.js +1 -1
  37. package/src/Api/ThemeApi.d.ts +2 -0
  38. package/src/PredefinedConfig/AlertState.d.ts +1 -1
  39. package/src/PredefinedConfig/Common/AdaptableColumnContext.d.ts +1 -1
  40. package/src/PredefinedConfig/Common/AdaptablePredicate.d.ts +1 -1
  41. package/src/PredefinedConfig/Common/AdaptablePredicate.js +32 -48
  42. package/src/PredefinedConfig/Common/ColumnFilter.d.ts +6 -2
  43. package/src/PredefinedConfig/ExportState.d.ts +10 -17
  44. package/src/PredefinedConfig/FlashingCellState.d.ts +1 -1
  45. package/src/PredefinedConfig/LayoutState.d.ts +17 -17
  46. package/src/PredefinedConfig/StyledColumnState.d.ts +1 -1
  47. package/src/Redux/ActionsReducers/LayoutRedux.d.ts +4 -3
  48. package/src/Redux/ActionsReducers/LayoutRedux.js +3 -3
  49. package/src/Redux/Store/AdaptableStore.js +2 -2
  50. package/src/Strategy/ColumnFilterModule.js +4 -4
  51. package/src/Strategy/StyledColumnModule.js +6 -6
  52. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +5 -6
  53. package/src/Utilities/ExpressionFunctions/booleanExpressionFunctions.js +9 -10
  54. package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.js +27 -27
  55. package/src/Utilities/Helpers/AdaptableHelper.d.ts +2 -0
  56. package/src/Utilities/Helpers/AdaptableHelper.js +12 -1
  57. package/src/Utilities/Helpers/DateHelper.js +3 -5
  58. package/src/Utilities/Helpers/FormatHelper.js +19 -6
  59. package/src/Utilities/ObjectFactory.js +1 -0
  60. package/src/Utilities/Services/Fdc3Service.d.ts +2 -2
  61. package/src/Utilities/Services/Fdc3Service.js +7 -2
  62. package/src/Utilities/Services/ThemeService.d.ts +1 -1
  63. package/src/Utilities/Services/ThemeService.js +5 -5
  64. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ConfigurationWizard.js +41 -0
  65. package/src/View/ColumnInfo/ColumnInfo.js +0 -1
  66. package/src/View/Comments/CommentsEditor.js +5 -2
  67. package/src/View/Comments/CommentsPopup.js +5 -2
  68. package/src/View/Components/ColumnFilter/ColumnFilter.d.ts +1 -1
  69. package/src/View/Components/ColumnFilter/ColumnFilter.js +4 -2
  70. package/src/View/Components/ColumnFilter/FloatingFilter.js +1 -1
  71. package/src/View/Components/ColumnFilter/LayoutColumnFilter.js +1 -1
  72. package/src/View/Components/ColumnFilter/useAdaptableFilterWrapper.d.ts +1 -1
  73. package/src/View/Components/ColumnFilter/useAdaptableFilterWrapper.js +6 -2
  74. package/src/View/Components/ColumnFilter/utils.js +2 -2
  75. package/src/View/Components/FilterForm/ListBoxFilterForm.js +3 -3
  76. package/src/View/Dashboard/CustomToolbar.js +2 -2
  77. package/src/View/DataChangeHistory/DataChangeHistoryPopup.js +4 -1
  78. package/src/View/Filter/FilterSummary.js +1 -1
  79. package/src/View/GridInfo/GridInfoPopup/AdaptableObjectsSummary.js +6 -2
  80. package/src/View/GridInfo/GridInfoPopup/GridInfoPopup.js +7 -2
  81. package/src/View/Note/NotePopup.js +5 -2
  82. package/src/View/QuickSearch/QuickSearchPopup.js +2 -2
  83. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsReport.d.ts +2 -0
  84. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsReport.js +18 -2
  85. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsSummary.js +4 -0
  86. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsWizard.js +2 -1
  87. package/src/View/StatusBar/AdaptableStatusBar.js +7 -5
  88. package/src/View/StyledColumn/Wizard/StyledColumnSparklineSettingsSection.d.ts +3 -4
  89. package/src/View/StyledColumn/Wizard/StyledColumnSparklineSettingsSection.js +348 -191
  90. package/src/View/StyledColumn/Wizard/StyledColumnWizard.js +2 -2
  91. package/src/View/StyledColumn/Wizard/StyledColumnWizardColumnSection.js +1 -1
  92. package/src/View/StyledColumn/Wizard/StyledColumnWizardTypeSection.js +4 -4
  93. package/src/agGrid/AdaptableAgGrid.d.ts +4 -8
  94. package/src/agGrid/AdaptableAgGrid.js +71 -117
  95. package/src/agGrid/AgGridAdapter.d.ts +1 -1
  96. package/src/agGrid/AgGridAdapter.js +5 -6
  97. package/src/agGrid/AgGridColumnAdapter.js +5 -10
  98. package/src/agGrid/AgGridExportAdapter.d.ts +24 -1
  99. package/src/agGrid/AgGridExportAdapter.js +24 -25
  100. package/src/agGrid/AgGridThemeAdapter.d.ts +19 -0
  101. package/src/agGrid/AgGridThemeAdapter.js +126 -0
  102. package/src/agGrid/cellRenderers/BadgeRenderer.js +2 -1
  103. package/src/agGrid/editors/AdaptableDateEditor/InternalAdaptableDateEditor.js +2 -2
  104. package/src/components/ColorPicker/ColorPicker.js +2 -2
  105. package/src/components/Datepicker/DatepickerContext.d.ts +1 -0
  106. package/src/components/Datepicker/index.d.ts +1 -0
  107. package/src/components/OverlayTrigger/useAgGridClassName.js +1 -1
  108. package/src/components/Select/Select.d.ts +1 -0
  109. package/src/components/Select/Select.js +30 -7
  110. package/src/env.js +2 -2
  111. package/src/metamodel/adaptable.metamodel.d.ts +23 -15
  112. package/src/metamodel/adaptable.metamodel.js +1 -1
  113. package/src/migration/VersionUpgrade20.d.ts +3 -0
  114. package/src/migration/VersionUpgrade20.js +141 -12
  115. package/src/types.d.ts +3 -3
  116. package/tsconfig.cjs.tsbuildinfo +1 -1
@@ -36,7 +36,7 @@ const StyledColumnWizard = (props) => {
36
36
  delete newData.GradientStyle;
37
37
  }
38
38
  else if (props.popupParams.column.dataType.includes('Array')) {
39
- newData.SparkLineStyle = {};
39
+ newData.SparklineStyle = {};
40
40
  delete newData.GradientStyle;
41
41
  }
42
42
  }
@@ -62,7 +62,7 @@ const StyledColumnWizard = (props) => {
62
62
  title: 'Settings',
63
63
  };
64
64
  const specificSteps = [];
65
- if (styledColumn.SparkLineStyle) {
65
+ if (styledColumn.SparklineStyle) {
66
66
  specificSteps.push({
67
67
  title: 'Settings',
68
68
  render: () => (React.createElement(rebass_1.Box, { p: 2 },
@@ -29,7 +29,7 @@ const StyledColumnWizardColumnSection = (props) => {
29
29
  const { data, api } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
30
30
  const sortableCols = React.useMemo(() => {
31
31
  let sortableColumns = [];
32
- if (data.SparkLineStyle) {
32
+ if (data.SparklineStyle) {
33
33
  sortableColumns = api.columnApi.getNumericArrayColumns();
34
34
  }
35
35
  else if (data.BadgeStyle) {
@@ -18,7 +18,7 @@ const renderStyledColumnTypeSummary = (data) => {
18
18
  else if (data.PercentBarStyle) {
19
19
  type = 'Percent Bar';
20
20
  }
21
- else if (data.SparkLineStyle) {
21
+ else if (data.SparklineStyle) {
22
22
  type = 'Spark Line';
23
23
  }
24
24
  else if (data.BadgeStyle) {
@@ -38,7 +38,7 @@ const StyledColumnWizardTypeSection = (props) => {
38
38
  };
39
39
  delete newStyledColumn.GradientStyle;
40
40
  delete newStyledColumn.PercentBarStyle;
41
- delete newStyledColumn.SparkLineStyle;
41
+ delete newStyledColumn.SparklineStyle;
42
42
  delete newStyledColumn.BadgeStyle;
43
43
  switch (type) {
44
44
  case 'gradient':
@@ -48,7 +48,7 @@ const StyledColumnWizardTypeSection = (props) => {
48
48
  newStyledColumn.PercentBarStyle = {};
49
49
  break;
50
50
  case 'sparkline':
51
- newStyledColumn.SparkLineStyle = {
51
+ newStyledColumn.SparklineStyle = {
52
52
  options: {
53
53
  type: 'line',
54
54
  },
@@ -69,7 +69,7 @@ const StyledColumnWizardTypeSection = (props) => {
69
69
  React.createElement(Tabs_1.Tabs.Content, null,
70
70
  React.createElement(TypeRadio_1.TypeRadio, { text: "Gradient", description: "Colour each cell in the column using a Gradient value (Numeric Columns)", checked: Boolean(data.GradientStyle), onClick: () => handleTypeChange('gradient') }),
71
71
  React.createElement(TypeRadio_1.TypeRadio, { text: "Percent Bar", description: "Display a coloured Bar where the width is based on the cell (Numeric Columns)", checked: Boolean(data.PercentBarStyle), onClick: () => handleTypeChange('percent') }),
72
- adaptable.api.styledColumnApi.canDisplaySparklines() && (React.createElement(TypeRadio_1.TypeRadio, { text: "Sparkline", description: "Render the column as a Sparkline (Numeric Array Columns)", checked: Boolean(data.SparkLineStyle), onClick: () => handleTypeChange('sparkline') })),
72
+ adaptable.api.styledColumnApi.canDisplaySparklines() && (React.createElement(TypeRadio_1.TypeRadio, { text: "Sparkline", description: "Render the column as a Sparkline (Numeric Array Columns)", checked: Boolean(data.SparklineStyle), onClick: () => handleTypeChange('sparkline') })),
73
73
  React.createElement(TypeRadio_1.TypeRadio, { text: "Badge", description: "Display the column's values as Badges (All Columns)", checked: Boolean(data.BadgeStyle), onClick: () => handleTypeChange('badge') })))));
74
74
  };
75
75
  exports.StyledColumnWizardTypeSection = StyledColumnWizardTypeSection;
@@ -29,6 +29,7 @@ import { RowFormService } from '../Utilities/Services/RowFormService';
29
29
  import { GridCellWithCount } from '../PredefinedConfig/Selection/GridCell';
30
30
  import { FlashingCellService } from '../Utilities/Services/FlashingCellService';
31
31
  import { AgGridExportAdapter } from './AgGridExportAdapter';
32
+ import { AgGridThemeAdapter } from './AgGridThemeAdapter';
32
33
  export type AdaptableLifecycleState = 'initial' | 'preprocessOptions' | 'initAdaptableState' | 'setupAgGrid' | 'initAgGrid' | 'agGridReady' | 'available' | 'ready' | 'preDestroyed';
33
34
  type RenderAgGridFrameworkComponentResult = false | GridApi;
34
35
  interface AdaptableInitInternalConfig<TData = any> {
@@ -61,11 +62,6 @@ export declare class AdaptableAgGrid implements IAdaptable {
61
62
  hasAutogeneratedPrimaryKey: boolean;
62
63
  hasAdaptableToolPanel: boolean;
63
64
  private initWithLazyData;
64
- /**
65
- * once layouts are properly handled with the new aggrid methods & events
66
- * we can remove this hack
67
- */
68
- private previousAgGridLayoutState;
69
65
  _rawAdaptableOptions: AdaptableOptions;
70
66
  adaptableOptions: AdaptableOptions;
71
67
  _isDetailGrid: boolean;
@@ -75,6 +71,7 @@ export declare class AdaptableAgGrid implements IAdaptable {
75
71
  agGridColumnAdapter: AgGridColumnAdapter;
76
72
  agGridMenuAdapter: AgGridMenuAdapter;
77
73
  agGridExportAdapter: AgGridExportAdapter;
74
+ agGridThemeAdapter: AgGridThemeAdapter;
78
75
  private DANGER_USE_GETTER_adaptableContainerElement;
79
76
  private DANGER_USE_GETTER_agGridContainerElement;
80
77
  api: AdaptableApi;
@@ -147,6 +144,7 @@ export declare class AdaptableAgGrid implements IAdaptable {
147
144
  */
148
145
  static _initInternal(config: AdaptableInitInternalConfig): Promise<AdaptableApi>;
149
146
  private _initAdaptableAgGrid;
147
+ midwayDestroy(): void;
150
148
  normalizeAdaptableState(state: AdaptableState, agGridOptions: NormalizeAdaptableStateOptions): AdaptableState;
151
149
  private normaliseLayoutState;
152
150
  private normaliseToolPanelState;
@@ -299,8 +297,6 @@ export declare class AdaptableAgGrid implements IAdaptable {
299
297
  isGridGroupingActive(): boolean;
300
298
  setAgGridQuickSearch(searchText: string): void;
301
299
  clearAgGridQuickSearch(): void;
302
- getAgGridCurrentThemeName(): string;
303
- private getAgGridLightThemeName;
304
300
  applyAdaptableTheme(theme: AdaptableTheme | string): void;
305
301
  setRowGroupColumns(columnIds: string[]): void;
306
302
  getAllGridColumns(): Column<any>[];
@@ -337,6 +333,6 @@ export declare class AdaptableAgGrid implements IAdaptable {
337
333
  refreshLayout(): void;
338
334
  private isRowGroupDifferentInLayout;
339
335
  private onLayoutChange;
340
- private getColumnSorts;
336
+ private validateColumnDefTypes;
341
337
  }
342
338
  export {};
@@ -99,9 +99,16 @@ const src_1 = require("../layout-manager/src");
99
99
  const isPivotLayoutModel_1 = require("../layout-manager/src/isPivotLayoutModel");
100
100
  const AdaptableColumn_1 = require("../PredefinedConfig/Common/AdaptableColumn");
101
101
  const agGridDataTypeDefinitions_1 = require("./agGridDataTypeDefinitions");
102
+ const AgGridThemeAdapter_1 = require("./AgGridThemeAdapter");
103
+ const VersionUpgrade20_1 = require("../migration/VersionUpgrade20");
102
104
  const LocalEventService_Prototype = ag_grid_enterprise_1.LocalEventService.prototype;
103
105
  const LocalEventService_dispatchEvent = LocalEventService_Prototype.dispatchEvent;
104
106
  LocalEventService_Prototype.dispatchEvent = function (event) {
107
+ const agGridApi = event.api;
108
+ if (agGridApi?.isDestroyed()) {
109
+ // do nothing if AG Grid was destroyed in the meantime
110
+ return;
111
+ }
105
112
  LocalEventService_dispatchEvent.apply(this, arguments);
106
113
  if (event.type === 'cellChanged' || event.type === 'dataChanged') {
107
114
  const eventRowNode = event.node;
@@ -121,6 +128,10 @@ LocalEventService_Prototype.dispatchEvent = function (event) {
121
128
  // so IGNORE IT
122
129
  return;
123
130
  }
131
+ if (adaptable.isDestroyed) {
132
+ // do nothing if adaptable is destroyed (this is a rare case and happens when Adaptable is quickly destroyed and recreated)
133
+ return;
134
+ }
124
135
  // we're on the correct instance, so do this
125
136
  //@ts-ignore
126
137
  const fn = adaptable.rowListeners ? adaptable.rowListeners[event.type] : null;
@@ -135,11 +146,6 @@ const adaptableInstances = {};
135
146
  const publishTimestamp = Number(EnvVars_1.ADAPTABLE_PUBLISH_TIMESTAMP);
136
147
  class AdaptableAgGrid {
137
148
  constructor(config) {
138
- /**
139
- * once layouts are properly handled with the new aggrid methods & events
140
- * we can remove this hack
141
- */
142
- this.previousAgGridLayoutState = '';
143
149
  this.filteredOutPrimaryKeys = new Set();
144
150
  this.columnMinMaxValuesCache = {};
145
151
  this.renderReactRoot = (node, container) => (0, renderReactRoot_1.renderReactRoot)(node, container);
@@ -178,6 +184,7 @@ class AdaptableAgGrid {
178
184
  this.agGridMenuAdapter = new AgGridMenuAdapter_1.AgGridMenuAdapter(this);
179
185
  this.agGridColumnAdapter = new AgGridColumnAdapter_1.AgGridColumnAdapter(this);
180
186
  this.agGridExportAdapter = new AgGridExportAdapter_1.AgGridExportAdapter(this);
187
+ this.agGridThemeAdapter = new AgGridThemeAdapter_1.AgGridThemeAdapter(this);
181
188
  this.DataService = new DataService_1.DataService(this);
182
189
  }
183
190
  static forEachAdaptable(fn) {
@@ -299,11 +306,6 @@ class AdaptableAgGrid {
299
306
  this.api = new AdaptableApiImpl_1.AdaptableApiImpl(this);
300
307
  this.forPlugins((plugin) => plugin.afterInitApi(this, this.api));
301
308
  this.lifecycleState = 'initAdaptableState';
302
- // just in case Adaptable was destroyed while loading the store (which is an async operation)
303
- if (this.isDestroyed) {
304
- return Promise.reject('Adaptable was destroyed while loading the store.');
305
- // FIXME AFL MIG: is this enough?! talk with the team
306
- }
307
309
  this.initServices();
308
310
  this.forPlugins((plugin) => plugin.afterInitServices(this));
309
311
  this.adaptableModules = this.initModules();
@@ -334,6 +336,7 @@ class AdaptableAgGrid {
334
336
  perfLoadStore.end();
335
337
  // just in case Adaptable was destroyed while loading the store (which is an async operation)
336
338
  if (this.isDestroyed) {
339
+ this.midwayDestroy();
337
340
  return Promise.reject('Adaptable was destroyed while loading the store.');
338
341
  // FIXME AFL MIG: is this enough?! talk with the team
339
342
  }
@@ -364,11 +367,13 @@ class AdaptableAgGrid {
364
367
  this.lifecycleState = 'initAgGrid';
365
368
  this.agGridAdapter.initialGridOptions = gridOptions;
366
369
  const perfInitAgGrid = this.logger.beginPerf(`initAgGrid()`);
367
- // AG Grid evaluates early on the floatingFilter params, so we need to "suppres" the floating filter temporarily
370
+ // AG Grid evaluates early on the floatingFilter params, so we need to "suppress" the floating filter temporarily
368
371
  // we will reset it once Adaptable is ready
369
372
  this.agGridColumnAdapter.setupColumnFloatingFilterTemporarily(gridOptions);
373
+ this.validateColumnDefTypes(gridOptions.columnDefs);
370
374
  const agGridApi = await this.initializeAgGrid(gridOptions, config.modules, config.renderAgGridFrameworkComponent);
371
375
  if (agGridApi === false) {
376
+ this.midwayDestroy();
372
377
  this.logger.consoleError(`Adaptable failed to initialize AG Grid!`);
373
378
  return Promise.reject('Adaptable failed to initialize AG Grid!');
374
379
  }
@@ -476,6 +481,12 @@ class AdaptableAgGrid {
476
481
  perfInitAdaptableAgGrid.end();
477
482
  return Promise.resolve(this.api);
478
483
  }
484
+ midwayDestroy() {
485
+ this.destroy({
486
+ destroyAgGrid: false,
487
+ unmount: false,
488
+ });
489
+ }
479
490
  normalizeAdaptableState(state, agGridOptions) {
480
491
  state = this.normaliseLayoutState(state, agGridOptions);
481
492
  state = this.normaliseToolPanelState(state);
@@ -602,12 +613,12 @@ You need to define at least one Layout!`);
602
613
  this.agGridAdapter.setAgGridId(agGridId);
603
614
  return agGridId;
604
615
  });
605
- // FIXME AFL: handle both ThemingApi and legacy CSS
606
616
  /**
607
617
  * `theme`
608
618
  */
609
- this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'theme', (original_gridId) => {
610
- return 'legacy';
619
+ this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'theme', (original_theme) => {
620
+ this.agGridThemeAdapter.setAgGridThemeMode(original_theme === 'legacy' ? 'legacy' : 'themingApi');
621
+ return original_theme;
611
622
  });
612
623
  /**
613
624
  * `getRowId`
@@ -724,7 +735,7 @@ You need to define at least one Layout!`);
724
735
  if (this.isGroupRowNode(node)) {
725
736
  return true;
726
737
  }
727
- // first assess if the Row is filterable - if not, then return true so it appears in Grid
738
+ // first assess if the Row i s filterable - if not, then return true so it appears in Grid
728
739
  const isRowFilterable = this.api.optionsApi.getFilterOptions().isRowFilterable;
729
740
  if (typeof isRowFilterable === 'function') {
730
741
  const rowFilterableContext = {
@@ -1046,7 +1057,14 @@ You need to define at least one Layout!`);
1046
1057
  */
1047
1058
  async initializeAgGrid(gridOptions, modules, renderAgGridFrameworkComponent) {
1048
1059
  if (renderAgGridFrameworkComponent) {
1049
- const result = await renderAgGridFrameworkComponent(gridOptions);
1060
+ let result = false;
1061
+ try {
1062
+ result = await renderAgGridFrameworkComponent(gridOptions);
1063
+ }
1064
+ catch (err) {
1065
+ console.log('Failed to get AG Grid API');
1066
+ result = false;
1067
+ }
1050
1068
  if (result === false) {
1051
1069
  return false;
1052
1070
  }
@@ -1054,6 +1072,10 @@ You need to define at least one Layout!`);
1054
1072
  // framework wrapper may have altered the context value via props
1055
1073
  // in that case, we have to re-populate it with the Adaptable context values
1056
1074
  const agGridContext = agGridApi.getGridOption('context');
1075
+ if (!agGridContext) {
1076
+ console.log('Failed to get AG Grid context');
1077
+ return false;
1078
+ }
1057
1079
  if (!agGridContext.__adaptable) {
1058
1080
  agGridContext.__adaptable = this;
1059
1081
  agGridContext.adaptableApi = this.api;
@@ -1339,7 +1361,7 @@ You need to define at least one Layout!`);
1339
1361
  return currentLayout.AutoSizeColumns;
1340
1362
  }
1341
1363
  autoSizeLayoutIfNeeded() {
1342
- if (this.shouldAutoSizeLayout()) {
1364
+ if (this.isAvailable && this.shouldAutoSizeLayout()) {
1343
1365
  requestAnimationFrame(() => {
1344
1366
  if (this.isAvailable) {
1345
1367
  this.autoSizeAllColumns();
@@ -2571,40 +2593,6 @@ You need to define at least one Layout!`);
2571
2593
  clearAgGridQuickSearch() {
2572
2594
  this.setAgGridQuickSearch('');
2573
2595
  }
2574
- getAgGridCurrentThemeName() {
2575
- const container = this.getAgGridContainerElement();
2576
- if (container && container.classList) {
2577
- // we detect the ag theme class
2578
- const classList = container.classList;
2579
- for (let i = 0, len = classList.length; i < len; i++) {
2580
- const cls = classList[i];
2581
- if (cls.indexOf('ag-theme-') === 0) {
2582
- return cls;
2583
- }
2584
- }
2585
- }
2586
- return this.getAgGridLightThemeName();
2587
- }
2588
- getAgGridLightThemeName() {
2589
- const container = this.getAgGridContainerElement();
2590
- if (container && container.classList) {
2591
- // we detect the ag theme class
2592
- const classList = container.classList;
2593
- for (let i = 0, len = classList.length; i < len; i++) {
2594
- const cls = classList[i];
2595
- if (cls.indexOf('ag-theme-') === 0) {
2596
- // even if dark theme is included, we compute the light theme name out of it
2597
- return cls.replace('-dark', '');
2598
- }
2599
- }
2600
- }
2601
- else {
2602
- this.logger.warn('No AgGrid container found, defaulting to ag-theme-balham for the light theme');
2603
- }
2604
- this.logger.warn('No ag-theme- class found on the grid container, defaulting to ag-theme-balham');
2605
- // fallback to the default light theme
2606
- return 'ag-theme-balham';
2607
- }
2608
2596
  applyAdaptableTheme(theme) {
2609
2597
  const container = this.getAgGridContainerElement();
2610
2598
  if (container != null) {
@@ -2648,7 +2636,7 @@ You need to define at least one Layout!`);
2648
2636
  themeClassNamesToRemove.forEach((cssClassName) => el.classList.remove(cssClassName));
2649
2637
  // remove infinite table classnames
2650
2638
  themesToRemove.forEach((theme) => {
2651
- el.classList.remove(`infinite-${theme.Name}`);
2639
+ el.classList.remove(`infinite-theme-mode--${theme.Name}`);
2652
2640
  });
2653
2641
  // VARIANT
2654
2642
  let variantTheme = '';
@@ -2664,46 +2652,13 @@ You need to define at least one Layout!`);
2664
2652
  }
2665
2653
  if (isSystemTheme) {
2666
2654
  // add infinite table classname for theme
2667
- el.classList.add(`infinite-${themeName}`);
2655
+ el.classList.add(`infinite-theme-mode--${themeName}`);
2668
2656
  }
2669
2657
  else if (variantTheme) {
2670
- el.classList.add(`infinite-${variantTheme}`);
2671
- }
2672
- // AG THEME CLASS NAME
2673
- const getAgGridLightThemeName = () => this.getAgGridLightThemeName();
2674
- const getAgGridDarkThemeName = () => getAgGridLightThemeName() + '-dark';
2675
- if (newTheme && (isSystemTheme || variantTheme)) {
2676
- if ((variantTheme || themeName) === GeneralConstants_1.LIGHT_THEME) {
2677
- newTheme.AgGridClassName = newTheme.AgGridClassName || getAgGridLightThemeName();
2678
- }
2679
- if ((variantTheme || themeName) === GeneralConstants_1.DARK_THEME) {
2680
- newTheme.AgGridClassName = newTheme.AgGridClassName || getAgGridDarkThemeName();
2681
- }
2682
- }
2683
- if (!newTheme.AgGridClassName) {
2684
- // default AG Grid to its light theme
2685
- newTheme.AgGridClassName = getAgGridLightThemeName();
2686
- }
2687
- if (container != null) {
2688
- if (themesToRemove.length) {
2689
- themesToRemove.forEach((theme) => {
2690
- if (theme.AgGridClassName) {
2691
- container.classList.remove(theme.AgGridClassName);
2692
- }
2693
- });
2694
- }
2695
- // also remove all AG Grid theme class names
2696
- const agGridClassNamesToRemove = [];
2697
- container.classList.forEach((x) => {
2698
- if (x && x.indexOf('ag-theme-') === 0) {
2699
- agGridClassNamesToRemove.push(x);
2700
- }
2701
- });
2702
- agGridClassNamesToRemove.forEach((x) => container.classList.remove(x));
2703
- if (newTheme && newTheme.AgGridClassName) {
2704
- container.classList.add(newTheme.AgGridClassName);
2705
- }
2658
+ el.classList.add(`infinite-theme-mode--${variantTheme}`);
2706
2659
  }
2660
+ // Update AG THEME
2661
+ this.agGridThemeAdapter.applyAgGridThemeOnAdaptableThemeChange(newTheme, variantTheme, container, themesToRemove);
2707
2662
  // MAC LIKE SCROLLBARS
2708
2663
  if (this.adaptableOptions.userInterfaceOptions &&
2709
2664
  this.adaptableOptions.userInterfaceOptions.useCustomMacLikeScrollbars &&
@@ -2796,8 +2751,9 @@ You need to define at least one Layout!`);
2796
2751
  }
2797
2752
  }
2798
2753
  this.__prevLayoutForOnChange = undefined;
2799
- this.layoutManager.destroy();
2800
- this.filteredOutPrimaryKeys.clear();
2754
+ this.layoutManager?.destroy();
2755
+ this.layoutManager = null;
2756
+ this.filteredOutPrimaryKeys?.clear();
2801
2757
  if (this.agGridAdapter?.getAgGridApi() && !this.agGridAdapter.getAgGridApi().isDestroyed()) {
2802
2758
  this.agGridAdapter
2803
2759
  .getAgGridApi()
@@ -2876,7 +2832,6 @@ You need to define at least one Layout!`);
2876
2832
  if (config?.destroyAgGrid === true) {
2877
2833
  this.agGridAdapter.getAgGridApi()?.destroy();
2878
2834
  }
2879
- this.previousAgGridLayoutState = '';
2880
2835
  const gridContainerElement = this.getAgGridContainerElement();
2881
2836
  if (gridContainerElement) {
2882
2837
  gridContainerElement.removeEventListener('keydown', this.agGridListenerKeydown, true);
@@ -2887,8 +2842,6 @@ You need to define at least one Layout!`);
2887
2842
  this.agGridListenerMouseLeave = null;
2888
2843
  }
2889
2844
  this.api._internalDestroySelf();
2890
- this.layoutManager?.destroy();
2891
- this.layoutManager = null;
2892
2845
  this.agGridOptionsService?.destroy();
2893
2846
  this.agGridOptionsService = null;
2894
2847
  this.agGridAdapter?.destroy();
@@ -2899,6 +2852,8 @@ You need to define at least one Layout!`);
2899
2852
  this.agGridColumnAdapter = null;
2900
2853
  this.agGridExportAdapter?.destroy();
2901
2854
  this.agGridExportAdapter = null;
2855
+ this.agGridThemeAdapter?.destroy();
2856
+ this.agGridThemeAdapter = null;
2902
2857
  this.rowListeners = null;
2903
2858
  this.emitter.destroy();
2904
2859
  this.emitter = null;
@@ -3021,6 +2976,10 @@ You need to define at least one Layout!`);
3021
2976
  };
3022
2977
  this.agGridColumnAdapter.setupColumnHeader(colSetupInfo);
3023
2978
  });
2979
+ // need to refresh the header,
2980
+ // as the Layout.ColumnHeaders state property is not implemented in the LayoutManager
2981
+ // and is specific to Adaptable, therefore we need to refresh it manually
2982
+ this.refreshHeader();
3024
2983
  const layoutModel = (0, LayoutHelpers_1.layoutStateToLayoutModel)(layout);
3025
2984
  this.layoutManager?.setLayout(layoutModel, {
3026
2985
  skipApplyRowGroupsExpandedState: !shouldUpdateExpandState,
@@ -3344,29 +3303,24 @@ You need to define at least one Layout!`);
3344
3303
  this.__prevLayoutForOnChange = layout;
3345
3304
  this.api.layoutApi.createOrUpdateLayout(layout);
3346
3305
  }
3347
- getColumnSorts() {
3348
- const columnSorts = [];
3349
- const { columnApi } = this.api;
3350
- const columnState = this.agGridAdapter.getAgGridApi().getColumnState();
3351
- columnState.forEach((colState) => {
3352
- const { colId } = colState;
3353
- if (columnApi.isAutoRowGroupColumn(colId)) {
3354
- return;
3355
- }
3356
- if (colState.sort && colState.sortIndex != null) {
3357
- columnSorts.push({
3358
- ColumnId: colId,
3359
- SortOrder: colState.sort === 'asc' ? 'Asc' : 'Desc',
3360
- SortIndex: colState.sortIndex,
3361
- });
3362
- }
3363
- });
3364
- columnSorts.sort((a, b) => a.SortIndex - b.SortIndex);
3365
- return columnSorts.map((c) => {
3366
- return {
3367
- ColumnId: c.ColumnId,
3368
- SortOrder: c.SortOrder,
3369
- };
3306
+ validateColumnDefTypes(columnDefs) {
3307
+ // in Adaptable version 20 we switched from colDef.type to colDef.cellDataType
3308
+ // although we documented this change and try to infer the correct cellDataTypes, it's best to also check if the client dev forgot to adjust his colDefs
3309
+ columnDefs.forEach((colDef) => {
3310
+ if (colDef.children?.length) {
3311
+ this.validateColumnDefTypes(colDef.children);
3312
+ }
3313
+ const columnDefinition = colDef;
3314
+ const colDefType = columnDefinition.type;
3315
+ const colDefTypes = typeof colDefType === 'string' ? [colDefType] : colDefType || [];
3316
+ colDefTypes
3317
+ .filter((colType) => colType.startsWith('abColDef'))
3318
+ .forEach((colType) => {
3319
+ const newValidCellDataType = (0, VersionUpgrade20_1.mapOldTypeToDataType)(colType);
3320
+ if (newValidCellDataType) {
3321
+ this.logger.consoleWarn(`Column ${columnDefinition.colId ?? columnDefinition.field} has a type of ${colType} which is no longer in use${newValidCellDataType !== 'unknown' ? `. Please use 'colDef.cellDataType' instead: ${newValidCellDataType}` : ''}`);
3322
+ }
3323
+ });
3370
3324
  });
3371
3325
  }
3372
3326
  }
@@ -3,6 +3,7 @@ import { AdaptableAgGrid } from './AdaptableAgGrid';
3
3
  import { AdaptableColumn, AdaptableColumnGroup } from '../PredefinedConfig/Common/AdaptableColumn';
4
4
  import { SelectedCellInfo } from '../PredefinedConfig/Selection/SelectedCellInfo';
5
5
  import { SelectedRowInfo } from '../PredefinedConfig/Selection/SelectedRowInfo';
6
+ export type AgGridThemeMode = 'legacy' | 'themingApi';
6
7
  export declare class AgGridAdapter {
7
8
  private _adaptableInstance;
8
9
  private DANGER_USE_GETTER_gridApi;
@@ -45,7 +46,6 @@ export declare class AgGridAdapter {
45
46
  deriveSelectedCellInfoFromAgGrid(): SelectedCellInfo;
46
47
  deriveSelectedRowInfoFromAgGrid(): SelectedRowInfo;
47
48
  isPinnedRowNode(rowNode: IRowNode): boolean;
48
- getFirstGroupedColumn(): string | undefined;
49
49
  createAdaptableColumnFromAgGridColumn(agGridColumn: Column, colsToGroups: Record<string, AdaptableColumnGroup>): AdaptableColumn;
50
50
  private deriveAdaptableColumnDataType;
51
51
  private isColumnReadonly;
@@ -35,6 +35,9 @@ class AgGridAdapter {
35
35
  }
36
36
  destroy() {
37
37
  delete DANGER_AG_GRID_BEANS_MAP[this._agGridId];
38
+ this.initialGridOptions = null;
39
+ this.DANGER_gridApi_from_args = null;
40
+ this.DANGER_USE_GETTER_gridApi = null;
38
41
  this.DANGER_updateGridOptionsMonkeyPatcher = null;
39
42
  this._adaptableInstance = null;
40
43
  }
@@ -97,7 +100,7 @@ class AgGridAdapter {
97
100
  // `context`
98
101
  const passedContext = options.context;
99
102
  if (passedContext) {
100
- passedContext['__adaptable'] = self;
103
+ passedContext['__adaptable'] = self._adaptableInstance;
101
104
  passedContext['adaptableApi'] = self.adaptableApi;
102
105
  }
103
106
  // we mutated the options array, so it's OK to use the 'arguments' object
@@ -368,10 +371,6 @@ class AgGridAdapter {
368
371
  }
369
372
  return false;
370
373
  }
371
- // TODO AFL MIG rename to getFirstGroupedColumnId()
372
- getFirstGroupedColumn() {
373
- return this.getAgGridApi?.()?.getRowGroupColumns()?.[0]?.getColId();
374
- }
375
374
  createAdaptableColumnFromAgGridColumn(agGridColumn, colsToGroups) {
376
375
  const colId = agGridColumn.getColId();
377
376
  const colDef = agGridColumn.getColDef();
@@ -526,7 +525,7 @@ class AgGridAdapter {
526
525
  else if (Array.isArray(value)) {
527
526
  const arrayDataType = agGridDataTypeDefinitions_1.ALL_ADAPTABLE_DATA_TYPES.find((arrayType) => {
528
527
  const dataTypeDefinition = agGridDataTypeDefinitions_1.agGridDataTypeDefinitions[arrayType];
529
- const dataTypeMatching = dataTypeDefinition.dataTypeMatcher(value);
528
+ const dataTypeMatching = dataTypeDefinition?.dataTypeMatcher?.(value);
530
529
  return dataTypeMatching;
531
530
  });
532
531
  if (arrayDataType) {
@@ -16,6 +16,7 @@ const Helper_1 = tslib_1.__importDefault(require("../Utilities/Helpers/Helper"))
16
16
  const AdaptableNumberEditor_1 = require("./editors/AdaptableNumberEditor");
17
17
  const AdaptableDateEditor_1 = require("./editors/AdaptableDateEditor");
18
18
  const AgGridExportAdapter_1 = require("./AgGridExportAdapter");
19
+ const AdaptableHelper_1 = require("../Utilities/Helpers/AdaptableHelper");
19
20
  function getEditorForColumnDataType(columnDataType, variant) {
20
21
  if (columnDataType === 'number') {
21
22
  return variant === 'react' ? AdaptableNumberEditor_1.AdaptableReactNumberEditor : AdaptableNumberEditor_1.AdaptableNumberEditor;
@@ -142,8 +143,6 @@ class AgGridColumnAdapter {
142
143
  this.setupColumnQuickFilerText(colSetupInfo);
143
144
  this.setupColumnAllowedAggFuncs(colSetupInfo);
144
145
  this.setupColumnType(colSetupInfo);
145
- // this is just to make sure that AG Grid does NOT infer the cellDataType
146
- // https://github.com/AdaptableTools/adaptable/issues/2230 should render it obsolete
147
146
  this.setupColumnCellDataType(colSetupInfo);
148
147
  });
149
148
  }
@@ -283,7 +282,7 @@ class AgGridColumnAdapter {
283
282
  if (styledColumn.BadgeStyle) {
284
283
  return (0, BadgeRenderer_1.getBadgeRendererForColumn)(styledColumn.BadgeStyle, abColumn, this.adaptableApi);
285
284
  }
286
- if (styledColumn.SparkLineStyle) {
285
+ if (styledColumn.SparklineStyle) {
287
286
  return 'agSparklineCellRenderer';
288
287
  }
289
288
  }
@@ -291,8 +290,9 @@ class AgGridColumnAdapter {
291
290
  this.setColDefProperty(col, 'cellRendererParams', (userDefined) => {
292
291
  const styledColumn = this.adaptableApi.styledColumnApi.getStyledColumnForColumnId(abColumn.columnId);
293
292
  if (styledColumn && !styledColumn.IsSuspended) {
294
- if (styledColumn.SparkLineStyle) {
295
- const sparklineOptions = (0, merge_1.default)({}, userDefined?.sparklineOptions, styledColumn.SparkLineStyle.options);
293
+ if (styledColumn.SparklineStyle) {
294
+ const sanitizedSparklineOptions = AdaptableHelper_1.AdaptableHelper.removeAdaptableObjectPrimitives(styledColumn.SparklineStyle.options);
295
+ const sparklineOptions = (0, merge_1.default)({}, userDefined?.sparklineOptions, sanitizedSparklineOptions);
296
296
  return {
297
297
  ...userDefined,
298
298
  sparklineOptions,
@@ -378,8 +378,6 @@ class AgGridColumnAdapter {
378
378
  }
379
379
  setupColumnCellDataType(columnSetupInfo) {
380
380
  const { col } = columnSetupInfo;
381
- // AG Grid introduced since v30.x an inferred cellDataType
382
- // the problem is that it breaks the default value formatter and/or editor (especially for Date columns)
383
381
  this.setColDefProperty(col, 'cellDataType', (original_cellDataType) => {
384
382
  return original_cellDataType ?? true;
385
383
  });
@@ -394,9 +392,6 @@ class AgGridColumnAdapter {
394
392
  if (layoutCustomHeader) {
395
393
  resultHeaderName = layoutCustomHeader;
396
394
  }
397
- // required here for the initial layout rendering
398
- // Removed by JW, 3 october 2023; i don't think we need it and it overrides stuff unnecessarily
399
- abColumn.friendlyName = resultHeaderName;
400
395
  return resultHeaderName;
401
396
  });
402
397
  const newColumnHeader = col?.getColDef()?.headerName;
@@ -1,13 +1,30 @@
1
1
  import { AdaptableAgGrid } from './AdaptableAgGrid';
2
2
  import { Report, ReportFormatType } from '../PredefinedConfig/ExportState';
3
- import { ExcelStyle } from 'ag-grid-enterprise';
3
+ import { CsvExportParams, ExcelExportParams, ExcelStyle } from 'ag-grid-enterprise';
4
4
  import { ExportDestinationType, ExportResultData } from '../AdaptableOptions/ExportOptions';
5
+ import { Layout } from '../PredefinedConfig/LayoutState';
5
6
  export interface ExportConfig {
6
7
  report: Report;
7
8
  format: ReportFormatType;
8
9
  destination: ExportDestinationType;
9
10
  showProgressIndicator: boolean;
10
11
  }
12
+ interface ExportProcessContext extends ExportConfig {
13
+ exportedColumnIds: string[];
14
+ isExcelReport: boolean;
15
+ isVisualExcelReport: boolean;
16
+ isExportingVisibleColumnToJSON: boolean;
17
+ getCurrent: () => {
18
+ layout: Layout;
19
+ groupColumnIds: string[];
20
+ pivotColumnIds: string[];
21
+ };
22
+ isCellPartOfSelection: (rowId: string, columnId: string) => boolean;
23
+ }
24
+ export interface ExportProcessData {
25
+ exportContext: ExportProcessContext;
26
+ exportParams: ExcelExportParams | CsvExportParams;
27
+ }
11
28
  export declare class AgGridExportAdapter {
12
29
  private _adaptableInstance;
13
30
  /**
@@ -23,9 +40,14 @@ export declare class AgGridExportAdapter {
23
40
  private get agGridApi();
24
41
  private get adaptableApi();
25
42
  private get exportOptions();
43
+ private get logger();
26
44
  static getExcelClassNameForCell(colId: string, primaryKeyValue: any, userDefinedCellClass?: string | string[]): string;
27
45
  destroy(): void;
28
46
  exportData(config: ExportConfig): Promise<null | ExportResultData>;
47
+ /**
48
+ * Creates export context and parameters for a given export configuration
49
+ */
50
+ buildExportProcessData(config: ExportConfig): ExportProcessData;
29
51
  private buildExportParams;
30
52
  private buildBaseExportParams;
31
53
  private computeProcessRowGroupCallback;
@@ -50,3 +72,4 @@ export declare class AgGridExportAdapter {
50
72
  private computeSkipColumnHeaders;
51
73
  private computeGetCustomContentBelowRow;
52
74
  }
75
+ export {};