@adaptabletools/adaptable 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 (117) 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 +13 -29
  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 +3 -3
  50. package/src/Strategy/ColumnFilterModule.js +4 -4
  51. package/src/Strategy/StyledColumnModule.js +6 -6
  52. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +1 -1
  53. package/src/Utilities/ExpressionFunctions/booleanExpressionFunctions.js +3 -3
  54. package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.js +13 -13
  55. package/src/Utilities/Helpers/AdaptableHelper.d.ts +2 -0
  56. package/src/Utilities/Helpers/AdaptableHelper.js +10 -0
  57. package/src/Utilities/Helpers/DateHelper.js +1 -2
  58. package/src/Utilities/Helpers/FormatHelper.js +18 -5
  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 +72 -118
  95. package/src/agGrid/AgGridAdapter.d.ts +1 -1
  96. package/src/agGrid/AgGridAdapter.js +7 -8
  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 +122 -0
  102. package/src/agGrid/cellRenderers/BadgeRenderer.js +2 -1
  103. package/src/agGrid/editors/AdaptableDateEditor/InternalAdaptableDateEditor.js +1 -1
  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/Datepicker/index.js +1 -1
  108. package/src/components/OverlayTrigger/useAgGridClassName.js +1 -1
  109. package/src/components/Select/Select.d.ts +1 -0
  110. package/src/components/Select/Select.js +30 -7
  111. package/src/env.js +2 -2
  112. package/src/metamodel/adaptable.metamodel.d.ts +23 -15
  113. package/src/metamodel/adaptable.metamodel.js +1 -1
  114. package/src/migration/VersionUpgrade20.d.ts +3 -0
  115. package/src/migration/VersionUpgrade20.js +140 -12
  116. package/src/types.d.ts +3 -3
  117. package/tsconfig.esm.tsbuildinfo +1 -1
@@ -14,7 +14,7 @@ export const renderStyledColumnTypeSummary = (data) => {
14
14
  else if (data.PercentBarStyle) {
15
15
  type = 'Percent Bar';
16
16
  }
17
- else if (data.SparkLineStyle) {
17
+ else if (data.SparklineStyle) {
18
18
  type = 'Spark Line';
19
19
  }
20
20
  else if (data.BadgeStyle) {
@@ -33,7 +33,7 @@ export const StyledColumnWizardTypeSection = (props) => {
33
33
  };
34
34
  delete newStyledColumn.GradientStyle;
35
35
  delete newStyledColumn.PercentBarStyle;
36
- delete newStyledColumn.SparkLineStyle;
36
+ delete newStyledColumn.SparklineStyle;
37
37
  delete newStyledColumn.BadgeStyle;
38
38
  switch (type) {
39
39
  case 'gradient':
@@ -43,7 +43,7 @@ export const StyledColumnWizardTypeSection = (props) => {
43
43
  newStyledColumn.PercentBarStyle = {};
44
44
  break;
45
45
  case 'sparkline':
46
- newStyledColumn.SparkLineStyle = {
46
+ newStyledColumn.SparklineStyle = {
47
47
  options: {
48
48
  type: 'line',
49
49
  },
@@ -64,6 +64,6 @@ export const StyledColumnWizardTypeSection = (props) => {
64
64
  React.createElement(Tabs.Content, null,
65
65
  React.createElement(TypeRadio, { text: "Gradient", description: "Colour each cell in the column using a Gradient value (Numeric Columns)", checked: Boolean(data.GradientStyle), onClick: () => handleTypeChange('gradient') }),
66
66
  React.createElement(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') }),
67
- adaptable.api.styledColumnApi.canDisplaySparklines() && (React.createElement(TypeRadio, { text: "Sparkline", description: "Render the column as a Sparkline (Numeric Array Columns)", checked: Boolean(data.SparkLineStyle), onClick: () => handleTypeChange('sparkline') })),
67
+ adaptable.api.styledColumnApi.canDisplaySparklines() && (React.createElement(TypeRadio, { text: "Sparkline", description: "Render the column as a Sparkline (Numeric Array Columns)", checked: Boolean(data.SparklineStyle), onClick: () => handleTypeChange('sparkline') })),
68
68
  React.createElement(TypeRadio, { text: "Badge", description: "Display the column's values as Badges (All Columns)", checked: Boolean(data.BadgeStyle), onClick: () => handleTypeChange('badge') })))));
69
69
  };
@@ -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 {};
@@ -8,7 +8,7 @@ import Emitter from '../Utilities/Emitter';
8
8
  import { applyDefaultAdaptableOptions } from '../AdaptableOptions/DefaultAdaptableOptions';
9
9
  import { AgGridAdapter } from './AgGridAdapter';
10
10
  import * as GeneralConstants from '../Utilities/Constants/GeneralConstants';
11
- import { AUTOGENERATED_PK_COLUMN, DARK_THEME, ERROR_LAYOUT, GROUP_PATH_SEPARATOR, HALF_SECOND, LIGHT_THEME, QUARTER_SECOND, } from '../Utilities/Constants/GeneralConstants';
11
+ import { AUTOGENERATED_PK_COLUMN, ERROR_LAYOUT, GROUP_PATH_SEPARATOR, HALF_SECOND, QUARTER_SECOND, } from '../Utilities/Constants/GeneralConstants';
12
12
  import { DataService } from '../Utilities/Services/DataService';
13
13
  import { AdaptableStore } from '../Redux/Store/AdaptableStore';
14
14
  import { AdaptableApiImpl } from '../Api/Implementation/AdaptableApiImpl';
@@ -95,9 +95,16 @@ import { LayoutManager } from '../layout-manager/src';
95
95
  import { isPivotLayoutModel } from '../layout-manager/src/isPivotLayoutModel';
96
96
  import { ACTION_COLUMN_TYPE, CALCULATED_COLUMN_TYPE, FDC3_COLUMN_TYPE, FREE_TEXT_COLUMN_TYPE, } from '../PredefinedConfig/Common/AdaptableColumn';
97
97
  import { agGridDataTypeDefinitions } from './agGridDataTypeDefinitions';
98
+ import { AgGridThemeAdapter } from './AgGridThemeAdapter';
99
+ import { mapOldTypeToDataType } from '../migration/VersionUpgrade20';
98
100
  const LocalEventService_Prototype = LocalEventService.prototype;
99
101
  const LocalEventService_dispatchEvent = LocalEventService_Prototype.dispatchEvent;
100
102
  LocalEventService_Prototype.dispatchEvent = function (event) {
103
+ const agGridApi = event.api;
104
+ if (agGridApi?.isDestroyed()) {
105
+ // do nothing if AG Grid was destroyed in the meantime
106
+ return;
107
+ }
101
108
  LocalEventService_dispatchEvent.apply(this, arguments);
102
109
  if (event.type === 'cellChanged' || event.type === 'dataChanged') {
103
110
  const eventRowNode = event.node;
@@ -117,6 +124,10 @@ LocalEventService_Prototype.dispatchEvent = function (event) {
117
124
  // so IGNORE IT
118
125
  return;
119
126
  }
127
+ if (adaptable.isDestroyed) {
128
+ // do nothing if adaptable is destroyed (this is a rare case and happens when Adaptable is quickly destroyed and recreated)
129
+ return;
130
+ }
120
131
  // we're on the correct instance, so do this
121
132
  //@ts-ignore
122
133
  const fn = adaptable.rowListeners ? adaptable.rowListeners[event.type] : null;
@@ -131,11 +142,6 @@ const adaptableInstances = {};
131
142
  const publishTimestamp = Number(ADAPTABLE_PUBLISH_TIMESTAMP);
132
143
  export class AdaptableAgGrid {
133
144
  constructor(config) {
134
- /**
135
- * once layouts are properly handled with the new aggrid methods & events
136
- * we can remove this hack
137
- */
138
- this.previousAgGridLayoutState = '';
139
145
  this.filteredOutPrimaryKeys = new Set();
140
146
  this.columnMinMaxValuesCache = {};
141
147
  this.renderReactRoot = (node, container) => defaultRenderReactRoot(node, container);
@@ -174,6 +180,7 @@ export class AdaptableAgGrid {
174
180
  this.agGridMenuAdapter = new AgGridMenuAdapter(this);
175
181
  this.agGridColumnAdapter = new AgGridColumnAdapter(this);
176
182
  this.agGridExportAdapter = new AgGridExportAdapter(this);
183
+ this.agGridThemeAdapter = new AgGridThemeAdapter(this);
177
184
  this.DataService = new DataService(this);
178
185
  }
179
186
  static forEachAdaptable(fn) {
@@ -295,11 +302,6 @@ export class AdaptableAgGrid {
295
302
  this.api = new AdaptableApiImpl(this);
296
303
  this.forPlugins((plugin) => plugin.afterInitApi(this, this.api));
297
304
  this.lifecycleState = 'initAdaptableState';
298
- // just in case Adaptable was destroyed while loading the store (which is an async operation)
299
- if (this.isDestroyed) {
300
- return Promise.reject('Adaptable was destroyed while loading the store.');
301
- // FIXME AFL MIG: is this enough?! talk with the team
302
- }
303
305
  this.initServices();
304
306
  this.forPlugins((plugin) => plugin.afterInitServices(this));
305
307
  this.adaptableModules = this.initModules();
@@ -330,6 +332,7 @@ export class AdaptableAgGrid {
330
332
  perfLoadStore.end();
331
333
  // just in case Adaptable was destroyed while loading the store (which is an async operation)
332
334
  if (this.isDestroyed) {
335
+ this.midwayDestroy();
333
336
  return Promise.reject('Adaptable was destroyed while loading the store.');
334
337
  // FIXME AFL MIG: is this enough?! talk with the team
335
338
  }
@@ -360,11 +363,13 @@ export class AdaptableAgGrid {
360
363
  this.lifecycleState = 'initAgGrid';
361
364
  this.agGridAdapter.initialGridOptions = gridOptions;
362
365
  const perfInitAgGrid = this.logger.beginPerf(`initAgGrid()`);
363
- // AG Grid evaluates early on the floatingFilter params, so we need to "suppres" the floating filter temporarily
366
+ // AG Grid evaluates early on the floatingFilter params, so we need to "suppress" the floating filter temporarily
364
367
  // we will reset it once Adaptable is ready
365
368
  this.agGridColumnAdapter.setupColumnFloatingFilterTemporarily(gridOptions);
369
+ this.validateColumnDefTypes(gridOptions.columnDefs);
366
370
  const agGridApi = await this.initializeAgGrid(gridOptions, config.modules, config.renderAgGridFrameworkComponent);
367
371
  if (agGridApi === false) {
372
+ this.midwayDestroy();
368
373
  this.logger.consoleError(`Adaptable failed to initialize AG Grid!`);
369
374
  return Promise.reject('Adaptable failed to initialize AG Grid!');
370
375
  }
@@ -472,6 +477,12 @@ export class AdaptableAgGrid {
472
477
  perfInitAdaptableAgGrid.end();
473
478
  return Promise.resolve(this.api);
474
479
  }
480
+ midwayDestroy() {
481
+ this.destroy({
482
+ destroyAgGrid: false,
483
+ unmount: false,
484
+ });
485
+ }
475
486
  normalizeAdaptableState(state, agGridOptions) {
476
487
  state = this.normaliseLayoutState(state, agGridOptions);
477
488
  state = this.normaliseToolPanelState(state);
@@ -598,12 +609,12 @@ You need to define at least one Layout!`);
598
609
  this.agGridAdapter.setAgGridId(agGridId);
599
610
  return agGridId;
600
611
  });
601
- // FIXME AFL: handle both ThemingApi and legacy CSS
602
612
  /**
603
613
  * `theme`
604
614
  */
605
- this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'theme', (original_gridId) => {
606
- return 'legacy';
615
+ this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'theme', (original_theme) => {
616
+ this.agGridThemeAdapter.setAgGridThemeMode(original_theme === 'legacy' ? 'legacy' : 'themingApi');
617
+ return original_theme;
607
618
  });
608
619
  /**
609
620
  * `getRowId`
@@ -720,7 +731,7 @@ You need to define at least one Layout!`);
720
731
  if (this.isGroupRowNode(node)) {
721
732
  return true;
722
733
  }
723
- // first assess if the Row is filterable - if not, then return true so it appears in Grid
734
+ // first assess if the Row i s filterable - if not, then return true so it appears in Grid
724
735
  const isRowFilterable = this.api.optionsApi.getFilterOptions().isRowFilterable;
725
736
  if (typeof isRowFilterable === 'function') {
726
737
  const rowFilterableContext = {
@@ -1042,7 +1053,14 @@ You need to define at least one Layout!`);
1042
1053
  */
1043
1054
  async initializeAgGrid(gridOptions, modules, renderAgGridFrameworkComponent) {
1044
1055
  if (renderAgGridFrameworkComponent) {
1045
- const result = await renderAgGridFrameworkComponent(gridOptions);
1056
+ let result = false;
1057
+ try {
1058
+ result = await renderAgGridFrameworkComponent(gridOptions);
1059
+ }
1060
+ catch (err) {
1061
+ console.log('Failed to get AG Grid API');
1062
+ result = false;
1063
+ }
1046
1064
  if (result === false) {
1047
1065
  return false;
1048
1066
  }
@@ -1050,6 +1068,10 @@ You need to define at least one Layout!`);
1050
1068
  // framework wrapper may have altered the context value via props
1051
1069
  // in that case, we have to re-populate it with the Adaptable context values
1052
1070
  const agGridContext = agGridApi.getGridOption('context');
1071
+ if (!agGridContext) {
1072
+ console.log('Failed to get AG Grid context');
1073
+ return false;
1074
+ }
1053
1075
  if (!agGridContext.__adaptable) {
1054
1076
  agGridContext.__adaptable = this;
1055
1077
  agGridContext.adaptableApi = this.api;
@@ -1335,7 +1357,7 @@ You need to define at least one Layout!`);
1335
1357
  return currentLayout.AutoSizeColumns;
1336
1358
  }
1337
1359
  autoSizeLayoutIfNeeded() {
1338
- if (this.shouldAutoSizeLayout()) {
1360
+ if (this.isAvailable && this.shouldAutoSizeLayout()) {
1339
1361
  requestAnimationFrame(() => {
1340
1362
  if (this.isAvailable) {
1341
1363
  this.autoSizeAllColumns();
@@ -2567,40 +2589,6 @@ You need to define at least one Layout!`);
2567
2589
  clearAgGridQuickSearch() {
2568
2590
  this.setAgGridQuickSearch('');
2569
2591
  }
2570
- getAgGridCurrentThemeName() {
2571
- const container = this.getAgGridContainerElement();
2572
- if (container && container.classList) {
2573
- // we detect the ag theme class
2574
- const classList = container.classList;
2575
- for (let i = 0, len = classList.length; i < len; i++) {
2576
- const cls = classList[i];
2577
- if (cls.indexOf('ag-theme-') === 0) {
2578
- return cls;
2579
- }
2580
- }
2581
- }
2582
- return this.getAgGridLightThemeName();
2583
- }
2584
- getAgGridLightThemeName() {
2585
- const container = this.getAgGridContainerElement();
2586
- if (container && container.classList) {
2587
- // we detect the ag theme class
2588
- const classList = container.classList;
2589
- for (let i = 0, len = classList.length; i < len; i++) {
2590
- const cls = classList[i];
2591
- if (cls.indexOf('ag-theme-') === 0) {
2592
- // even if dark theme is included, we compute the light theme name out of it
2593
- return cls.replace('-dark', '');
2594
- }
2595
- }
2596
- }
2597
- else {
2598
- this.logger.warn('No AgGrid container found, defaulting to ag-theme-balham for the light theme');
2599
- }
2600
- this.logger.warn('No ag-theme- class found on the grid container, defaulting to ag-theme-balham');
2601
- // fallback to the default light theme
2602
- return 'ag-theme-balham';
2603
- }
2604
2592
  applyAdaptableTheme(theme) {
2605
2593
  const container = this.getAgGridContainerElement();
2606
2594
  if (container != null) {
@@ -2644,7 +2632,7 @@ You need to define at least one Layout!`);
2644
2632
  themeClassNamesToRemove.forEach((cssClassName) => el.classList.remove(cssClassName));
2645
2633
  // remove infinite table classnames
2646
2634
  themesToRemove.forEach((theme) => {
2647
- el.classList.remove(`infinite-${theme.Name}`);
2635
+ el.classList.remove(`infinite-theme-mode--${theme.Name}`);
2648
2636
  });
2649
2637
  // VARIANT
2650
2638
  let variantTheme = '';
@@ -2660,46 +2648,13 @@ You need to define at least one Layout!`);
2660
2648
  }
2661
2649
  if (isSystemTheme) {
2662
2650
  // add infinite table classname for theme
2663
- el.classList.add(`infinite-${themeName}`);
2651
+ el.classList.add(`infinite-theme-mode--${themeName}`);
2664
2652
  }
2665
2653
  else if (variantTheme) {
2666
- el.classList.add(`infinite-${variantTheme}`);
2667
- }
2668
- // AG THEME CLASS NAME
2669
- const getAgGridLightThemeName = () => this.getAgGridLightThemeName();
2670
- const getAgGridDarkThemeName = () => getAgGridLightThemeName() + '-dark';
2671
- if (newTheme && (isSystemTheme || variantTheme)) {
2672
- if ((variantTheme || themeName) === LIGHT_THEME) {
2673
- newTheme.AgGridClassName = newTheme.AgGridClassName || getAgGridLightThemeName();
2674
- }
2675
- if ((variantTheme || themeName) === DARK_THEME) {
2676
- newTheme.AgGridClassName = newTheme.AgGridClassName || getAgGridDarkThemeName();
2677
- }
2678
- }
2679
- if (!newTheme.AgGridClassName) {
2680
- // default AG Grid to its light theme
2681
- newTheme.AgGridClassName = getAgGridLightThemeName();
2682
- }
2683
- if (container != null) {
2684
- if (themesToRemove.length) {
2685
- themesToRemove.forEach((theme) => {
2686
- if (theme.AgGridClassName) {
2687
- container.classList.remove(theme.AgGridClassName);
2688
- }
2689
- });
2690
- }
2691
- // also remove all AG Grid theme class names
2692
- const agGridClassNamesToRemove = [];
2693
- container.classList.forEach((x) => {
2694
- if (x && x.indexOf('ag-theme-') === 0) {
2695
- agGridClassNamesToRemove.push(x);
2696
- }
2697
- });
2698
- agGridClassNamesToRemove.forEach((x) => container.classList.remove(x));
2699
- if (newTheme && newTheme.AgGridClassName) {
2700
- container.classList.add(newTheme.AgGridClassName);
2701
- }
2654
+ el.classList.add(`infinite-theme-mode--${variantTheme}`);
2702
2655
  }
2656
+ // Update AG THEME
2657
+ this.agGridThemeAdapter.applyAgGridThemeOnAdaptableThemeChange(newTheme, variantTheme, container, themesToRemove);
2703
2658
  // MAC LIKE SCROLLBARS
2704
2659
  if (this.adaptableOptions.userInterfaceOptions &&
2705
2660
  this.adaptableOptions.userInterfaceOptions.useCustomMacLikeScrollbars &&
@@ -2792,8 +2747,9 @@ You need to define at least one Layout!`);
2792
2747
  }
2793
2748
  }
2794
2749
  this.__prevLayoutForOnChange = undefined;
2795
- this.layoutManager.destroy();
2796
- this.filteredOutPrimaryKeys.clear();
2750
+ this.layoutManager?.destroy();
2751
+ this.layoutManager = null;
2752
+ this.filteredOutPrimaryKeys?.clear();
2797
2753
  if (this.agGridAdapter?.getAgGridApi() && !this.agGridAdapter.getAgGridApi().isDestroyed()) {
2798
2754
  this.agGridAdapter
2799
2755
  .getAgGridApi()
@@ -2872,7 +2828,6 @@ You need to define at least one Layout!`);
2872
2828
  if (config?.destroyAgGrid === true) {
2873
2829
  this.agGridAdapter.getAgGridApi()?.destroy();
2874
2830
  }
2875
- this.previousAgGridLayoutState = '';
2876
2831
  const gridContainerElement = this.getAgGridContainerElement();
2877
2832
  if (gridContainerElement) {
2878
2833
  gridContainerElement.removeEventListener('keydown', this.agGridListenerKeydown, true);
@@ -2883,8 +2838,6 @@ You need to define at least one Layout!`);
2883
2838
  this.agGridListenerMouseLeave = null;
2884
2839
  }
2885
2840
  this.api._internalDestroySelf();
2886
- this.layoutManager?.destroy();
2887
- this.layoutManager = null;
2888
2841
  this.agGridOptionsService?.destroy();
2889
2842
  this.agGridOptionsService = null;
2890
2843
  this.agGridAdapter?.destroy();
@@ -2895,6 +2848,8 @@ You need to define at least one Layout!`);
2895
2848
  this.agGridColumnAdapter = null;
2896
2849
  this.agGridExportAdapter?.destroy();
2897
2850
  this.agGridExportAdapter = null;
2851
+ this.agGridThemeAdapter?.destroy();
2852
+ this.agGridThemeAdapter = null;
2898
2853
  this.rowListeners = null;
2899
2854
  this.emitter.destroy();
2900
2855
  this.emitter = null;
@@ -3017,6 +2972,10 @@ You need to define at least one Layout!`);
3017
2972
  };
3018
2973
  this.agGridColumnAdapter.setupColumnHeader(colSetupInfo);
3019
2974
  });
2975
+ // need to refresh the header,
2976
+ // as the Layout.ColumnHeaders state property is not implemented in the LayoutManager
2977
+ // and is specific to Adaptable, therefore we need to refresh it manually
2978
+ this.refreshHeader();
3020
2979
  const layoutModel = layoutStateToLayoutModel(layout);
3021
2980
  this.layoutManager?.setLayout(layoutModel, {
3022
2981
  skipApplyRowGroupsExpandedState: !shouldUpdateExpandState,
@@ -3340,29 +3299,24 @@ You need to define at least one Layout!`);
3340
3299
  this.__prevLayoutForOnChange = layout;
3341
3300
  this.api.layoutApi.createOrUpdateLayout(layout);
3342
3301
  }
3343
- getColumnSorts() {
3344
- const columnSorts = [];
3345
- const { columnApi } = this.api;
3346
- const columnState = this.agGridAdapter.getAgGridApi().getColumnState();
3347
- columnState.forEach((colState) => {
3348
- const { colId } = colState;
3349
- if (columnApi.isAutoRowGroupColumn(colId)) {
3350
- return;
3351
- }
3352
- if (colState.sort && colState.sortIndex != null) {
3353
- columnSorts.push({
3354
- ColumnId: colId,
3355
- SortOrder: colState.sort === 'asc' ? 'Asc' : 'Desc',
3356
- SortIndex: colState.sortIndex,
3357
- });
3358
- }
3359
- });
3360
- columnSorts.sort((a, b) => a.SortIndex - b.SortIndex);
3361
- return columnSorts.map((c) => {
3362
- return {
3363
- ColumnId: c.ColumnId,
3364
- SortOrder: c.SortOrder,
3365
- };
3302
+ validateColumnDefTypes(columnDefs) {
3303
+ // in Adaptable version 20 we switched from colDef.type to colDef.cellDataType
3304
+ // 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
3305
+ columnDefs.forEach((colDef) => {
3306
+ if (colDef.children?.length) {
3307
+ this.validateColumnDefTypes(colDef.children);
3308
+ }
3309
+ const columnDefinition = colDef;
3310
+ const colDefType = columnDefinition.type;
3311
+ const colDefTypes = typeof colDefType === 'string' ? [colDefType] : colDefType || [];
3312
+ colDefTypes
3313
+ .filter((colType) => colType.startsWith('abColDef'))
3314
+ .forEach((colType) => {
3315
+ const newValidCellDataType = mapOldTypeToDataType(colType);
3316
+ if (newValidCellDataType) {
3317
+ 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}` : ''}`);
3318
+ }
3319
+ });
3366
3320
  });
3367
3321
  }
3368
3322
  }
@@ -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;
@@ -1,11 +1,11 @@
1
1
  import { ColumnApiModule, } from 'ag-grid-enterprise';
2
2
  import { ACTION_COLUMN_TYPE, CALCULATED_COLUMN_TYPE, FDC3_COLUMN_TYPE, FREE_TEXT_COLUMN_TYPE, } from '../PredefinedConfig/Common/AdaptableColumn';
3
- import { ADAPTABLE_FDC3_ACTION_COLUMN_FRIENDLY_NAME } from '../Utilities/Constants/GeneralConstants';
3
+ import { ADAPTABLE_FDC3_ACTION_COLUMN_FRIENDLY_NAME, } from '../Utilities/Constants/GeneralConstants';
4
4
  import { createUuid } from '../PredefinedConfig/Uuid';
5
5
  import ArrayExtensions from '../Utilities/Extensions/ArrayExtensions';
6
6
  import * as ModuleConstants from '../Utilities/Constants/ModuleConstants';
7
7
  import { ALL_AG_GRID_MODULES } from './agGridModules';
8
- import { agGridDataTypeDefinitions, ALL_ADAPTABLE_DATA_TYPES, } from './agGridDataTypeDefinitions';
8
+ import { agGridDataTypeDefinitions, ALL_ADAPTABLE_DATA_TYPES } from './agGridDataTypeDefinitions';
9
9
  // AG GRID obfuscates its internals, this is (currently) the best way to get hold of its internal services
10
10
  const DANGER_AG_GRID_BEANS_MAP = {};
11
11
  const getColumnApiModule = () => ColumnApiModule;
@@ -31,6 +31,9 @@ export class AgGridAdapter {
31
31
  }
32
32
  destroy() {
33
33
  delete DANGER_AG_GRID_BEANS_MAP[this._agGridId];
34
+ this.initialGridOptions = null;
35
+ this.DANGER_gridApi_from_args = null;
36
+ this.DANGER_USE_GETTER_gridApi = null;
34
37
  this.DANGER_updateGridOptionsMonkeyPatcher = null;
35
38
  this._adaptableInstance = null;
36
39
  }
@@ -93,7 +96,7 @@ export class AgGridAdapter {
93
96
  // `context`
94
97
  const passedContext = options.context;
95
98
  if (passedContext) {
96
- passedContext['__adaptable'] = self;
99
+ passedContext['__adaptable'] = self._adaptableInstance;
97
100
  passedContext['adaptableApi'] = self.adaptableApi;
98
101
  }
99
102
  // we mutated the options array, so it's OK to use the 'arguments' object
@@ -364,10 +367,6 @@ export class AgGridAdapter {
364
367
  }
365
368
  return false;
366
369
  }
367
- // TODO AFL MIG rename to getFirstGroupedColumnId()
368
- getFirstGroupedColumn() {
369
- return this.getAgGridApi?.()?.getRowGroupColumns()?.[0]?.getColId();
370
- }
371
370
  createAdaptableColumnFromAgGridColumn(agGridColumn, colsToGroups) {
372
371
  const colId = agGridColumn.getColId();
373
372
  const colDef = agGridColumn.getColDef();
@@ -522,7 +521,7 @@ export class AgGridAdapter {
522
521
  else if (Array.isArray(value)) {
523
522
  const arrayDataType = ALL_ADAPTABLE_DATA_TYPES.find((arrayType) => {
524
523
  const dataTypeDefinition = agGridDataTypeDefinitions[arrayType];
525
- const dataTypeMatching = dataTypeDefinition.dataTypeMatcher(value);
524
+ const dataTypeMatching = dataTypeDefinition?.dataTypeMatcher?.(value);
526
525
  return dataTypeMatching;
527
526
  });
528
527
  if (arrayDataType) {
@@ -12,6 +12,7 @@ import Helper from '../Utilities/Helpers/Helper';
12
12
  import { AdaptableNumberEditor, AdaptableReactNumberEditor } from './editors/AdaptableNumberEditor';
13
13
  import { AdaptableDateEditor, AdaptableReactDateEditor } from './editors/AdaptableDateEditor';
14
14
  import { AgGridExportAdapter } from './AgGridExportAdapter';
15
+ import { AdaptableHelper, } from '../Utilities/Helpers/AdaptableHelper';
15
16
  export function getEditorForColumnDataType(columnDataType, variant) {
16
17
  if (columnDataType === 'number') {
17
18
  return variant === 'react' ? AdaptableReactNumberEditor : AdaptableNumberEditor;
@@ -137,8 +138,6 @@ export class AgGridColumnAdapter {
137
138
  this.setupColumnQuickFilerText(colSetupInfo);
138
139
  this.setupColumnAllowedAggFuncs(colSetupInfo);
139
140
  this.setupColumnType(colSetupInfo);
140
- // this is just to make sure that AG Grid does NOT infer the cellDataType
141
- // https://github.com/AdaptableTools/adaptable/issues/2230 should render it obsolete
142
141
  this.setupColumnCellDataType(colSetupInfo);
143
142
  });
144
143
  }
@@ -278,7 +277,7 @@ export class AgGridColumnAdapter {
278
277
  if (styledColumn.BadgeStyle) {
279
278
  return getBadgeRendererForColumn(styledColumn.BadgeStyle, abColumn, this.adaptableApi);
280
279
  }
281
- if (styledColumn.SparkLineStyle) {
280
+ if (styledColumn.SparklineStyle) {
282
281
  return 'agSparklineCellRenderer';
283
282
  }
284
283
  }
@@ -286,8 +285,9 @@ export class AgGridColumnAdapter {
286
285
  this.setColDefProperty(col, 'cellRendererParams', (userDefined) => {
287
286
  const styledColumn = this.adaptableApi.styledColumnApi.getStyledColumnForColumnId(abColumn.columnId);
288
287
  if (styledColumn && !styledColumn.IsSuspended) {
289
- if (styledColumn.SparkLineStyle) {
290
- const sparklineOptions = merge({}, userDefined?.sparklineOptions, styledColumn.SparkLineStyle.options);
288
+ if (styledColumn.SparklineStyle) {
289
+ const sanitizedSparklineOptions = AdaptableHelper.removeAdaptableObjectPrimitives(styledColumn.SparklineStyle.options);
290
+ const sparklineOptions = merge({}, userDefined?.sparklineOptions, sanitizedSparklineOptions);
291
291
  return {
292
292
  ...userDefined,
293
293
  sparklineOptions,
@@ -373,8 +373,6 @@ export class AgGridColumnAdapter {
373
373
  }
374
374
  setupColumnCellDataType(columnSetupInfo) {
375
375
  const { col } = columnSetupInfo;
376
- // AG Grid introduced since v30.x an inferred cellDataType
377
- // the problem is that it breaks the default value formatter and/or editor (especially for Date columns)
378
376
  this.setColDefProperty(col, 'cellDataType', (original_cellDataType) => {
379
377
  return original_cellDataType ?? true;
380
378
  });
@@ -389,9 +387,6 @@ export class AgGridColumnAdapter {
389
387
  if (layoutCustomHeader) {
390
388
  resultHeaderName = layoutCustomHeader;
391
389
  }
392
- // required here for the initial layout rendering
393
- // Removed by JW, 3 october 2023; i don't think we need it and it overrides stuff unnecessarily
394
- abColumn.friendlyName = resultHeaderName;
395
390
  return resultHeaderName;
396
391
  });
397
392
  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 {};