@adaptabletools/adaptable-cjs 20.0.0-canary.1 → 20.0.0-canary.10

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 (93) hide show
  1. package/base.css +317 -866
  2. package/base.css.map +1 -1
  3. package/index.css +317 -866
  4. package/index.css.map +1 -1
  5. package/package.json +3 -3
  6. package/src/AdaptableInterfaces/IAdaptable.d.ts +2 -1
  7. package/src/AdaptableOptions/ActionColumnOptions.d.ts +2 -2
  8. package/src/AdaptableOptions/CellSummaryOptions.d.ts +1 -1
  9. package/src/AdaptableOptions/ContainerOptions.d.ts +0 -7
  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/FilterOptions.d.ts +2 -2
  14. package/src/AdaptableOptions/PredicateOptions.d.ts +4 -4
  15. package/src/AdaptableOptions/UserInterfaceOptions.d.ts +7 -0
  16. package/src/Api/ColumnScopeApi.d.ts +2 -2
  17. package/src/Api/ExportApi.d.ts +1 -6
  18. package/src/Api/Fdc3Api.d.ts +5 -3
  19. package/src/Api/Implementation/AdaptableApiImpl.js +1 -0
  20. package/src/Api/Implementation/ColumnScopeApiImpl.d.ts +1 -1
  21. package/src/Api/Implementation/ColumnScopeApiImpl.js +1 -1
  22. package/src/Api/Implementation/ExportApiImpl.d.ts +1 -2
  23. package/src/Api/Implementation/ExportApiImpl.js +17 -10
  24. package/src/Api/Implementation/Fdc3ApiImpl.d.ts +3 -3
  25. package/src/Api/Implementation/Fdc3ApiImpl.js +4 -4
  26. package/src/Api/Implementation/LayoutHelpers.js +8 -27
  27. package/src/Api/Implementation/ScheduleApiImpl.js +1 -1
  28. package/src/Api/Implementation/StyledColumnApiImpl.js +1 -1
  29. package/src/Api/Implementation/ThemeApiImpl.js +3 -1
  30. package/src/Api/Internal/ActionColumnInternalApi.js +16 -19
  31. package/src/Api/Internal/AdaptableInternalApi.js +1 -1
  32. package/src/Api/Internal/EventInternalApi.js +6 -1
  33. package/src/Api/Internal/ExportInternalApi.d.ts +10 -6
  34. package/src/Api/Internal/ExportInternalApi.js +105 -136
  35. package/src/Api/Internal/RowFormInternalApi.js +1 -1
  36. package/src/Api/ThemeApi.d.ts +2 -0
  37. package/src/PredefinedConfig/AlertState.d.ts +1 -1
  38. package/src/PredefinedConfig/Common/AdaptableColumn.d.ts +5 -5
  39. package/src/PredefinedConfig/Common/AdaptableColumnContext.d.ts +1 -1
  40. package/src/PredefinedConfig/Common/AdaptablePredicate.js +0 -16
  41. package/src/PredefinedConfig/Common/RowSummary.d.ts +1 -1
  42. package/src/PredefinedConfig/Common/RowSummary.js +3 -3
  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 +20 -16
  46. package/src/PredefinedConfig/StyledColumnState.d.ts +1 -1
  47. package/src/Redux/Store/AdaptableStore.js +1 -1
  48. package/src/Strategy/StyledColumnModule.js +6 -6
  49. package/src/Utilities/Helpers/AdaptableHelper.d.ts +2 -0
  50. package/src/Utilities/Helpers/AdaptableHelper.js +12 -1
  51. package/src/Utilities/ObjectFactory.js +1 -0
  52. package/src/Utilities/Services/Fdc3Service.d.ts +2 -2
  53. package/src/Utilities/Services/Fdc3Service.js +7 -2
  54. package/src/Utilities/Services/RowSummaryService.js +1 -1
  55. package/src/Utilities/Services/ThemeService.d.ts +1 -1
  56. package/src/Utilities/Services/ThemeService.js +5 -5
  57. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ConfigurationWizard.js +41 -0
  58. package/src/View/Components/ColumnFilter/utils.js +2 -2
  59. package/src/View/Components/FilterForm/ListBoxFilterForm.js +1 -1
  60. package/src/View/DataChangeHistory/DataChangeHistoryPopup.js +4 -1
  61. package/src/View/GridInfo/GridInfoPopup/GridInfoPopup.js +7 -2
  62. package/src/View/Layout/Wizard/LayoutWizard.js +1 -1
  63. package/src/View/Layout/Wizard/sections/RowSummarySection.js +1 -1
  64. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsReport.d.ts +2 -0
  65. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsReport.js +18 -2
  66. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsSummary.js +4 -0
  67. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsWizard.js +2 -1
  68. package/src/View/StyledColumn/Wizard/StyledColumnSparklineSettingsSection.d.ts +3 -4
  69. package/src/View/StyledColumn/Wizard/StyledColumnSparklineSettingsSection.js +348 -191
  70. package/src/View/StyledColumn/Wizard/StyledColumnWizard.js +2 -2
  71. package/src/View/StyledColumn/Wizard/StyledColumnWizardColumnSection.js +1 -1
  72. package/src/View/StyledColumn/Wizard/StyledColumnWizardTypeSection.js +4 -4
  73. package/src/agGrid/AdaptableAgGrid.d.ts +3 -8
  74. package/src/agGrid/AdaptableAgGrid.js +40 -117
  75. package/src/agGrid/AgGridAdapter.d.ts +1 -1
  76. package/src/agGrid/AgGridAdapter.js +5 -6
  77. package/src/agGrid/AgGridColumnAdapter.js +6 -11
  78. package/src/agGrid/AgGridExportAdapter.d.ts +24 -1
  79. package/src/agGrid/AgGridExportAdapter.js +24 -25
  80. package/src/agGrid/AgGridThemeAdapter.d.ts +19 -0
  81. package/src/agGrid/AgGridThemeAdapter.js +126 -0
  82. package/src/agGrid/cellRenderers/BadgeRenderer.js +2 -1
  83. package/src/components/ColorPicker/ColorPicker.js +2 -2
  84. package/src/components/OverlayTrigger/useAgGridClassName.js +1 -1
  85. package/src/components/Select/Select.d.ts +1 -0
  86. package/src/components/Select/Select.js +29 -6
  87. package/src/env.js +2 -2
  88. package/src/metamodel/adaptable.metamodel.d.ts +26 -20
  89. package/src/metamodel/adaptable.metamodel.js +1 -1
  90. package/src/migration/VersionUpgrade20.d.ts +1 -0
  91. package/src/migration/VersionUpgrade20.js +103 -3
  92. package/src/types.d.ts +3 -3
  93. package/tsconfig.cjs.tsbuildinfo +1 -1
@@ -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,5 @@ export declare class AdaptableAgGrid implements IAdaptable {
337
333
  refreshLayout(): void;
338
334
  private isRowGroupDifferentInLayout;
339
335
  private onLayoutChange;
340
- private getColumnSorts;
341
336
  }
342
337
  export {};
@@ -99,6 +99,7 @@ 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");
102
103
  const LocalEventService_Prototype = ag_grid_enterprise_1.LocalEventService.prototype;
103
104
  const LocalEventService_dispatchEvent = LocalEventService_Prototype.dispatchEvent;
104
105
  LocalEventService_Prototype.dispatchEvent = function (event) {
@@ -135,11 +136,6 @@ const adaptableInstances = {};
135
136
  const publishTimestamp = Number(EnvVars_1.ADAPTABLE_PUBLISH_TIMESTAMP);
136
137
  class AdaptableAgGrid {
137
138
  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
139
  this.filteredOutPrimaryKeys = new Set();
144
140
  this.columnMinMaxValuesCache = {};
145
141
  this.renderReactRoot = (node, container) => (0, renderReactRoot_1.renderReactRoot)(node, container);
@@ -178,6 +174,7 @@ class AdaptableAgGrid {
178
174
  this.agGridMenuAdapter = new AgGridMenuAdapter_1.AgGridMenuAdapter(this);
179
175
  this.agGridColumnAdapter = new AgGridColumnAdapter_1.AgGridColumnAdapter(this);
180
176
  this.agGridExportAdapter = new AgGridExportAdapter_1.AgGridExportAdapter(this);
177
+ this.agGridThemeAdapter = new AgGridThemeAdapter_1.AgGridThemeAdapter(this);
181
178
  this.DataService = new DataService_1.DataService(this);
182
179
  }
183
180
  static forEachAdaptable(fn) {
@@ -299,11 +296,6 @@ class AdaptableAgGrid {
299
296
  this.api = new AdaptableApiImpl_1.AdaptableApiImpl(this);
300
297
  this.forPlugins((plugin) => plugin.afterInitApi(this, this.api));
301
298
  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
299
  this.initServices();
308
300
  this.forPlugins((plugin) => plugin.afterInitServices(this));
309
301
  this.adaptableModules = this.initModules();
@@ -334,6 +326,7 @@ class AdaptableAgGrid {
334
326
  perfLoadStore.end();
335
327
  // just in case Adaptable was destroyed while loading the store (which is an async operation)
336
328
  if (this.isDestroyed) {
329
+ this.midwayDestroy();
337
330
  return Promise.reject('Adaptable was destroyed while loading the store.');
338
331
  // FIXME AFL MIG: is this enough?! talk with the team
339
332
  }
@@ -369,6 +362,7 @@ class AdaptableAgGrid {
369
362
  this.agGridColumnAdapter.setupColumnFloatingFilterTemporarily(gridOptions);
370
363
  const agGridApi = await this.initializeAgGrid(gridOptions, config.modules, config.renderAgGridFrameworkComponent);
371
364
  if (agGridApi === false) {
365
+ this.midwayDestroy();
372
366
  this.logger.consoleError(`Adaptable failed to initialize AG Grid!`);
373
367
  return Promise.reject('Adaptable failed to initialize AG Grid!');
374
368
  }
@@ -476,6 +470,12 @@ class AdaptableAgGrid {
476
470
  perfInitAdaptableAgGrid.end();
477
471
  return Promise.resolve(this.api);
478
472
  }
473
+ midwayDestroy() {
474
+ this.destroy({
475
+ destroyAgGrid: false,
476
+ unmount: false,
477
+ });
478
+ }
479
479
  normalizeAdaptableState(state, agGridOptions) {
480
480
  state = this.normaliseLayoutState(state, agGridOptions);
481
481
  state = this.normaliseToolPanelState(state);
@@ -602,12 +602,12 @@ You need to define at least one Layout!`);
602
602
  this.agGridAdapter.setAgGridId(agGridId);
603
603
  return agGridId;
604
604
  });
605
- // FIXME AFL: handle both ThemingApi and legacy CSS
606
605
  /**
607
606
  * `theme`
608
607
  */
609
- this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'theme', (original_gridId) => {
610
- return 'legacy';
608
+ this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'theme', (original_theme) => {
609
+ this.agGridThemeAdapter.setAgGridThemeMode(original_theme === 'legacy' ? 'legacy' : 'themingApi');
610
+ return original_theme;
611
611
  });
612
612
  /**
613
613
  * `getRowId`
@@ -724,7 +724,7 @@ You need to define at least one Layout!`);
724
724
  if (this.isGroupRowNode(node)) {
725
725
  return true;
726
726
  }
727
- // first assess if the Row is filterable - if not, then return true so it appears in Grid
727
+ // first assess if the Row i s filterable - if not, then return true so it appears in Grid
728
728
  const isRowFilterable = this.api.optionsApi.getFilterOptions().isRowFilterable;
729
729
  if (typeof isRowFilterable === 'function') {
730
730
  const rowFilterableContext = {
@@ -1018,13 +1018,13 @@ You need to define at least one Layout!`);
1018
1018
  // this will have to go/be heavily extended with https://github.com/AdaptableTools/adaptable/issues/2230
1019
1019
  this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'columnTypes', (original_columnTypes) => {
1020
1020
  const providedColumnTypes = original_columnTypes || {};
1021
- const adaptableColumnTypes = {
1021
+ const adaptableSpecialColumnTypes = {
1022
1022
  [AdaptableColumn_1.CALCULATED_COLUMN_TYPE]: {},
1023
1023
  [AdaptableColumn_1.FREE_TEXT_COLUMN_TYPE]: {},
1024
1024
  [AdaptableColumn_1.ACTION_COLUMN_TYPE]: {},
1025
1025
  [AdaptableColumn_1.FDC3_COLUMN_TYPE]: {},
1026
1026
  };
1027
- const patchedColumnTypes = Object.assign({}, providedColumnTypes, adaptableColumnTypes);
1027
+ const patchedColumnTypes = Object.assign({}, providedColumnTypes, adaptableSpecialColumnTypes);
1028
1028
  const customColumnTypes = this.api.columnApi.getColumnTypes() ?? [];
1029
1029
  for (const customColumnType of customColumnTypes) {
1030
1030
  if (!patchedColumnTypes[customColumnType]) {
@@ -1046,7 +1046,14 @@ You need to define at least one Layout!`);
1046
1046
  */
1047
1047
  async initializeAgGrid(gridOptions, modules, renderAgGridFrameworkComponent) {
1048
1048
  if (renderAgGridFrameworkComponent) {
1049
- const result = await renderAgGridFrameworkComponent(gridOptions);
1049
+ let result = false;
1050
+ try {
1051
+ result = await renderAgGridFrameworkComponent(gridOptions);
1052
+ }
1053
+ catch (err) {
1054
+ console.log('Failed to get AG Grid API');
1055
+ result = false;
1056
+ }
1050
1057
  if (result === false) {
1051
1058
  return false;
1052
1059
  }
@@ -1054,6 +1061,10 @@ You need to define at least one Layout!`);
1054
1061
  // framework wrapper may have altered the context value via props
1055
1062
  // in that case, we have to re-populate it with the Adaptable context values
1056
1063
  const agGridContext = agGridApi.getGridOption('context');
1064
+ if (!agGridContext) {
1065
+ console.log('Failed to get AG Grid context');
1066
+ return false;
1067
+ }
1057
1068
  if (!agGridContext.__adaptable) {
1058
1069
  agGridContext.__adaptable = this;
1059
1070
  agGridContext.adaptableApi = this.api;
@@ -1339,7 +1350,7 @@ You need to define at least one Layout!`);
1339
1350
  return currentLayout.AutoSizeColumns;
1340
1351
  }
1341
1352
  autoSizeLayoutIfNeeded() {
1342
- if (this.shouldAutoSizeLayout()) {
1353
+ if (this.isAvailable && this.shouldAutoSizeLayout()) {
1343
1354
  requestAnimationFrame(() => {
1344
1355
  if (this.isAvailable) {
1345
1356
  this.autoSizeAllColumns();
@@ -2571,40 +2582,6 @@ You need to define at least one Layout!`);
2571
2582
  clearAgGridQuickSearch() {
2572
2583
  this.setAgGridQuickSearch('');
2573
2584
  }
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
2585
  applyAdaptableTheme(theme) {
2609
2586
  const container = this.getAgGridContainerElement();
2610
2587
  if (container != null) {
@@ -2669,41 +2646,8 @@ You need to define at least one Layout!`);
2669
2646
  else if (variantTheme) {
2670
2647
  el.classList.add(`infinite-${variantTheme}`);
2671
2648
  }
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
- }
2706
- }
2649
+ // Update AG THEME
2650
+ this.agGridThemeAdapter.applyAgGridThemeOnAdaptableThemeChange(newTheme, variantTheme, container, themesToRemove);
2707
2651
  // MAC LIKE SCROLLBARS
2708
2652
  if (this.adaptableOptions.userInterfaceOptions &&
2709
2653
  this.adaptableOptions.userInterfaceOptions.useCustomMacLikeScrollbars &&
@@ -2796,8 +2740,9 @@ You need to define at least one Layout!`);
2796
2740
  }
2797
2741
  }
2798
2742
  this.__prevLayoutForOnChange = undefined;
2799
- this.layoutManager.destroy();
2800
- this.filteredOutPrimaryKeys.clear();
2743
+ this.layoutManager?.destroy();
2744
+ this.layoutManager = null;
2745
+ this.filteredOutPrimaryKeys?.clear();
2801
2746
  if (this.agGridAdapter?.getAgGridApi() && !this.agGridAdapter.getAgGridApi().isDestroyed()) {
2802
2747
  this.agGridAdapter
2803
2748
  .getAgGridApi()
@@ -2876,7 +2821,6 @@ You need to define at least one Layout!`);
2876
2821
  if (config?.destroyAgGrid === true) {
2877
2822
  this.agGridAdapter.getAgGridApi()?.destroy();
2878
2823
  }
2879
- this.previousAgGridLayoutState = '';
2880
2824
  const gridContainerElement = this.getAgGridContainerElement();
2881
2825
  if (gridContainerElement) {
2882
2826
  gridContainerElement.removeEventListener('keydown', this.agGridListenerKeydown, true);
@@ -2887,8 +2831,6 @@ You need to define at least one Layout!`);
2887
2831
  this.agGridListenerMouseLeave = null;
2888
2832
  }
2889
2833
  this.api._internalDestroySelf();
2890
- this.layoutManager?.destroy();
2891
- this.layoutManager = null;
2892
2834
  this.agGridOptionsService?.destroy();
2893
2835
  this.agGridOptionsService = null;
2894
2836
  this.agGridAdapter?.destroy();
@@ -2899,6 +2841,8 @@ You need to define at least one Layout!`);
2899
2841
  this.agGridColumnAdapter = null;
2900
2842
  this.agGridExportAdapter?.destroy();
2901
2843
  this.agGridExportAdapter = null;
2844
+ this.agGridThemeAdapter?.destroy();
2845
+ this.agGridThemeAdapter = null;
2902
2846
  this.rowListeners = null;
2903
2847
  this.emitter.destroy();
2904
2848
  this.emitter = null;
@@ -3021,6 +2965,10 @@ You need to define at least one Layout!`);
3021
2965
  };
3022
2966
  this.agGridColumnAdapter.setupColumnHeader(colSetupInfo);
3023
2967
  });
2968
+ // need to refresh the header,
2969
+ // as the Layout.ColumnHeaders state property is not implemented in the LayoutManager
2970
+ // and is specific to Adaptable, therefore we need to refresh it manually
2971
+ this.refreshHeader();
3024
2972
  const layoutModel = (0, LayoutHelpers_1.layoutStateToLayoutModel)(layout);
3025
2973
  this.layoutManager?.setLayout(layoutModel, {
3026
2974
  skipApplyRowGroupsExpandedState: !shouldUpdateExpandState,
@@ -3344,30 +3292,5 @@ You need to define at least one Layout!`);
3344
3292
  this.__prevLayoutForOnChange = layout;
3345
3293
  this.api.layoutApi.createOrUpdateLayout(layout);
3346
3294
  }
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
- };
3370
- });
3371
- }
3372
3295
  }
3373
3296
  exports.AdaptableAgGrid = AdaptableAgGrid;
@@ -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;
@@ -484,7 +479,7 @@ class AgGridColumnAdapter {
484
479
  }
485
480
  if (mostRelevantFormatColumn.DisplayFormat.Formatter === 'StringFormatter') {
486
481
  // change the String format - if the scope allows it
487
- if (this.adaptableApi.columnScopeApi.isColumnInStringsScope(abColumn, mostRelevantFormatColumn.Scope)) {
482
+ if (this.adaptableApi.columnScopeApi.isColumnInTextScope(abColumn, mostRelevantFormatColumn.Scope)) {
488
483
  let cellValue = params.value;
489
484
  if (typeof params.value?.toNumber === 'function' &&
490
485
  typeof params.value?.toString === 'function') {
@@ -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 {};
@@ -33,6 +33,9 @@ class AgGridExportAdapter {
33
33
  get exportOptions() {
34
34
  return this._adaptableInstance.api.optionsApi.getExportOptions();
35
35
  }
36
+ get logger() {
37
+ return this._adaptableInstance.logger;
38
+ }
36
39
  static getExcelClassNameForCell(colId, primaryKeyValue, userDefinedCellClass) {
37
40
  let excelClassName = `--excel-cell-${colId}-${primaryKeyValue}`;
38
41
  if (excelClassName.indexOf(' ') > 0) {
@@ -61,14 +64,12 @@ class AgGridExportAdapter {
61
64
  await (0, waitForTimeout_1.waitForTimeout)(16);
62
65
  }
63
66
  this.adaptableApi.exportApi.internalApi.setExportInProgress(config.report.Name, config.format, config.destination);
64
- const exportContext = this.buildExportProcessContext(config);
67
+ const { exportContext, exportParams } = this.buildExportProcessData(config);
65
68
  if (exportContext.isVisualExcelReport) {
66
69
  // FIXME AFL patch styles only for exported columns!
67
70
  // or even better, only cells
68
71
  this.patchExcelStyles();
69
72
  }
70
- const exportParams = this.buildExportParams(exportContext);
71
- exportContext.exportedColumnIds = exportParams.columnKeys;
72
73
  // 1. easiest case, we download the file using AG Grid
73
74
  // these methods will automatically handle the file download
74
75
  if (exportContext.destination === 'Download' && exportContext.isExcelReport) {
@@ -102,8 +103,7 @@ class AgGridExportAdapter {
102
103
  };
103
104
  }
104
105
  catch (error) {
105
- // FIXME AFL improve logging
106
- console.error(error);
106
+ this.logger.consoleError(`Error exporting ${report.Name} in ${format} format to ${config.destination}`, error);
107
107
  }
108
108
  finally {
109
109
  /**
@@ -118,6 +118,21 @@ class AgGridExportAdapter {
118
118
  }
119
119
  }
120
120
  }
121
+ /**
122
+ * Creates export context and parameters for a given export configuration
123
+ */
124
+ buildExportProcessData(config) {
125
+ const exportContext = this.buildExportProcessContext(config);
126
+ if (exportContext.isVisualExcelReport) {
127
+ this.patchExcelStyles();
128
+ }
129
+ const exportParams = this.buildExportParams(exportContext);
130
+ exportContext.exportedColumnIds = exportParams.columnKeys;
131
+ return {
132
+ exportContext,
133
+ exportParams,
134
+ };
135
+ }
121
136
  buildExportParams(exportContext) {
122
137
  const baseExportParams = this.buildBaseExportParams(exportContext);
123
138
  if (exportContext.format === 'Excel' || exportContext.format === 'VisualExcel') {
@@ -656,9 +671,9 @@ class AgGridExportAdapter {
656
671
  .map((columnId) => this.adaptableApi.columnApi.getColumnWithColumnId(columnId))
657
672
  .map((column) => ({
658
673
  columnId: column.columnId,
674
+ field: column.field ?? column.columnId,
659
675
  friendlyName: column.friendlyName,
660
676
  dataType: column.dataType,
661
- field: column.field ?? column.columnId,
662
677
  }));
663
678
  const reportData = {
664
679
  columns,
@@ -730,27 +745,11 @@ class AgGridExportAdapter {
730
745
  masterRowNode: node,
731
746
  masterRowData: node?.data,
732
747
  isExpanded: node.expanded,
733
- createCellCsv: (cellContent) => {
734
- return {
735
- data: {
736
- value: cellContent != undefined ? String(cellContent) : null,
737
- },
738
- };
739
- },
740
- createCellExcel: (cellContent, cellType) => {
741
- return {
742
- data: {
743
- value: cellContent != undefined ? String(cellContent) : null,
744
- type: cellType,
745
- },
746
- };
747
- },
748
+ createCellCsv: (cellContent) => this.adaptableApi.exportApi.internalApi.createCellCsv(cellContent),
749
+ createCellExcel: (cellContent, cellType) => this.adaptableApi.exportApi.internalApi.createCellExcel(cellContent, cellType),
748
750
  createCellHeader: (cellContent) => {
749
751
  return {
750
- data: {
751
- value: cellContent != undefined ? String(cellContent) : null,
752
- type: 'String',
753
- },
752
+ ...this.adaptableApi.exportApi.internalApi.createCellHeader(cellContent),
754
753
  // see #masterDetailHeader
755
754
  styleId: '_masterDetailHeader',
756
755
  };