@adaptabletools/adaptable 20.0.0-canary.3 → 20.0.0-canary.5

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 (56) hide show
  1. package/package.json +1 -1
  2. package/src/AdaptableInterfaces/IAdaptable.d.ts +2 -1
  3. package/src/AdaptableOptions/CellSummaryOptions.d.ts +1 -1
  4. package/src/AdaptableOptions/ContainerOptions.d.ts +0 -7
  5. package/src/AdaptableOptions/DefaultAdaptableOptions.js +1 -1
  6. package/src/AdaptableOptions/EditOptions.d.ts +14 -3
  7. package/src/AdaptableOptions/ExportOptions.d.ts +4 -18
  8. package/src/AdaptableOptions/PredicateOptions.d.ts +4 -4
  9. package/src/AdaptableOptions/UserInterfaceOptions.d.ts +7 -0
  10. package/src/Api/Implementation/AdaptableApiImpl.js +1 -0
  11. package/src/Api/Implementation/ExportApiImpl.js +3 -2
  12. package/src/Api/Implementation/ScheduleApiImpl.js +1 -1
  13. package/src/Api/Implementation/StyledColumnApiImpl.js +1 -1
  14. package/src/Api/Implementation/ThemeApiImpl.js +3 -1
  15. package/src/Api/Internal/EventInternalApi.js +6 -1
  16. package/src/Api/Internal/ExportInternalApi.js +1 -1
  17. package/src/Api/Internal/RowFormInternalApi.js +1 -1
  18. package/src/Api/ThemeApi.d.ts +2 -0
  19. package/src/PredefinedConfig/AlertState.d.ts +1 -1
  20. package/src/PredefinedConfig/Common/AdaptableColumnContext.d.ts +1 -1
  21. package/src/PredefinedConfig/Common/AdaptablePredicate.js +0 -16
  22. package/src/PredefinedConfig/ExportState.d.ts +3 -3
  23. package/src/PredefinedConfig/FlashingCellState.d.ts +1 -1
  24. package/src/PredefinedConfig/LayoutState.d.ts +16 -16
  25. package/src/PredefinedConfig/StyledColumnState.d.ts +1 -1
  26. package/src/Strategy/StyledColumnModule.js +6 -6
  27. package/src/Utilities/ObjectFactory.js +1 -0
  28. package/src/Utilities/Services/ThemeService.d.ts +1 -1
  29. package/src/Utilities/Services/ThemeService.js +5 -5
  30. package/src/View/DataChangeHistory/DataChangeHistoryPopup.js +4 -1
  31. package/src/View/GridInfo/GridInfoPopup/GridInfoPopup.js +7 -2
  32. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsReport.d.ts +2 -0
  33. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsReport.js +18 -2
  34. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsSummary.js +4 -0
  35. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsWizard.js +2 -1
  36. package/src/View/StyledColumn/Wizard/StyledColumnSparklineSettingsSection.d.ts +3 -4
  37. package/src/View/StyledColumn/Wizard/StyledColumnSparklineSettingsSection.js +348 -191
  38. package/src/View/StyledColumn/Wizard/StyledColumnWizard.js +2 -2
  39. package/src/View/StyledColumn/Wizard/StyledColumnWizardColumnSection.js +1 -1
  40. package/src/View/StyledColumn/Wizard/StyledColumnWizardTypeSection.js +4 -4
  41. package/src/agGrid/AdaptableAgGrid.d.ts +3 -8
  42. package/src/agGrid/AdaptableAgGrid.js +35 -116
  43. package/src/agGrid/AgGridAdapter.d.ts +1 -1
  44. package/src/agGrid/AgGridAdapter.js +6 -7
  45. package/src/agGrid/AgGridColumnAdapter.js +5 -7
  46. package/src/agGrid/AgGridThemeAdapter.d.ts +19 -0
  47. package/src/agGrid/AgGridThemeAdapter.js +122 -0
  48. package/src/components/ColorPicker/ColorPicker.js +2 -2
  49. package/src/components/OverlayTrigger/useAgGridClassName.js +1 -1
  50. package/src/env.js +2 -2
  51. package/src/metamodel/adaptable.metamodel.d.ts +16 -15
  52. package/src/metamodel/adaptable.metamodel.js +1 -1
  53. package/src/migration/VersionUpgrade20.d.ts +1 -0
  54. package/src/migration/VersionUpgrade20.js +69 -0
  55. package/src/types.d.ts +1 -1
  56. 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,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 {};
@@ -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,6 +95,7 @@ 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';
98
99
  const LocalEventService_Prototype = LocalEventService.prototype;
99
100
  const LocalEventService_dispatchEvent = LocalEventService_Prototype.dispatchEvent;
100
101
  LocalEventService_Prototype.dispatchEvent = function (event) {
@@ -131,11 +132,6 @@ const adaptableInstances = {};
131
132
  const publishTimestamp = Number(ADAPTABLE_PUBLISH_TIMESTAMP);
132
133
  export class AdaptableAgGrid {
133
134
  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
135
  this.filteredOutPrimaryKeys = new Set();
140
136
  this.columnMinMaxValuesCache = {};
141
137
  this.renderReactRoot = (node, container) => defaultRenderReactRoot(node, container);
@@ -174,6 +170,7 @@ export class AdaptableAgGrid {
174
170
  this.agGridMenuAdapter = new AgGridMenuAdapter(this);
175
171
  this.agGridColumnAdapter = new AgGridColumnAdapter(this);
176
172
  this.agGridExportAdapter = new AgGridExportAdapter(this);
173
+ this.agGridThemeAdapter = new AgGridThemeAdapter(this);
177
174
  this.DataService = new DataService(this);
178
175
  }
179
176
  static forEachAdaptable(fn) {
@@ -295,11 +292,6 @@ export class AdaptableAgGrid {
295
292
  this.api = new AdaptableApiImpl(this);
296
293
  this.forPlugins((plugin) => plugin.afterInitApi(this, this.api));
297
294
  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
295
  this.initServices();
304
296
  this.forPlugins((plugin) => plugin.afterInitServices(this));
305
297
  this.adaptableModules = this.initModules();
@@ -330,6 +322,7 @@ export class AdaptableAgGrid {
330
322
  perfLoadStore.end();
331
323
  // just in case Adaptable was destroyed while loading the store (which is an async operation)
332
324
  if (this.isDestroyed) {
325
+ this.midwayDestroy();
333
326
  return Promise.reject('Adaptable was destroyed while loading the store.');
334
327
  // FIXME AFL MIG: is this enough?! talk with the team
335
328
  }
@@ -365,6 +358,7 @@ export class AdaptableAgGrid {
365
358
  this.agGridColumnAdapter.setupColumnFloatingFilterTemporarily(gridOptions);
366
359
  const agGridApi = await this.initializeAgGrid(gridOptions, config.modules, config.renderAgGridFrameworkComponent);
367
360
  if (agGridApi === false) {
361
+ this.midwayDestroy();
368
362
  this.logger.consoleError(`Adaptable failed to initialize AG Grid!`);
369
363
  return Promise.reject('Adaptable failed to initialize AG Grid!');
370
364
  }
@@ -472,6 +466,12 @@ export class AdaptableAgGrid {
472
466
  perfInitAdaptableAgGrid.end();
473
467
  return Promise.resolve(this.api);
474
468
  }
469
+ midwayDestroy() {
470
+ this.destroy({
471
+ destroyAgGrid: false,
472
+ unmount: false,
473
+ });
474
+ }
475
475
  normalizeAdaptableState(state, agGridOptions) {
476
476
  state = this.normaliseLayoutState(state, agGridOptions);
477
477
  state = this.normaliseToolPanelState(state);
@@ -598,12 +598,12 @@ You need to define at least one Layout!`);
598
598
  this.agGridAdapter.setAgGridId(agGridId);
599
599
  return agGridId;
600
600
  });
601
- // FIXME AFL: handle both ThemingApi and legacy CSS
602
601
  /**
603
602
  * `theme`
604
603
  */
605
- this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'theme', (original_gridId) => {
606
- return 'legacy';
604
+ this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'theme', (original_theme) => {
605
+ this.agGridThemeAdapter.setAgGridThemeMode(original_theme === 'legacy' ? 'legacy' : 'themingApi');
606
+ return original_theme;
607
607
  });
608
608
  /**
609
609
  * `getRowId`
@@ -720,7 +720,7 @@ You need to define at least one Layout!`);
720
720
  if (this.isGroupRowNode(node)) {
721
721
  return true;
722
722
  }
723
- // first assess if the Row is filterable - if not, then return true so it appears in Grid
723
+ // first assess if the Row i s filterable - if not, then return true so it appears in Grid
724
724
  const isRowFilterable = this.api.optionsApi.getFilterOptions().isRowFilterable;
725
725
  if (typeof isRowFilterable === 'function') {
726
726
  const rowFilterableContext = {
@@ -1042,7 +1042,14 @@ You need to define at least one Layout!`);
1042
1042
  */
1043
1043
  async initializeAgGrid(gridOptions, modules, renderAgGridFrameworkComponent) {
1044
1044
  if (renderAgGridFrameworkComponent) {
1045
- const result = await renderAgGridFrameworkComponent(gridOptions);
1045
+ let result = false;
1046
+ try {
1047
+ result = await renderAgGridFrameworkComponent(gridOptions);
1048
+ }
1049
+ catch (err) {
1050
+ console.log('Failed to get AG Grid API');
1051
+ result = false;
1052
+ }
1046
1053
  if (result === false) {
1047
1054
  return false;
1048
1055
  }
@@ -1050,6 +1057,10 @@ You need to define at least one Layout!`);
1050
1057
  // framework wrapper may have altered the context value via props
1051
1058
  // in that case, we have to re-populate it with the Adaptable context values
1052
1059
  const agGridContext = agGridApi.getGridOption('context');
1060
+ if (!agGridContext) {
1061
+ console.log('Failed to get AG Grid context');
1062
+ return false;
1063
+ }
1053
1064
  if (!agGridContext.__adaptable) {
1054
1065
  agGridContext.__adaptable = this;
1055
1066
  agGridContext.adaptableApi = this.api;
@@ -1335,7 +1346,7 @@ You need to define at least one Layout!`);
1335
1346
  return currentLayout.AutoSizeColumns;
1336
1347
  }
1337
1348
  autoSizeLayoutIfNeeded() {
1338
- if (this.shouldAutoSizeLayout()) {
1349
+ if (this.isAvailable && this.shouldAutoSizeLayout()) {
1339
1350
  requestAnimationFrame(() => {
1340
1351
  if (this.isAvailable) {
1341
1352
  this.autoSizeAllColumns();
@@ -2567,40 +2578,6 @@ You need to define at least one Layout!`);
2567
2578
  clearAgGridQuickSearch() {
2568
2579
  this.setAgGridQuickSearch('');
2569
2580
  }
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
2581
  applyAdaptableTheme(theme) {
2605
2582
  const container = this.getAgGridContainerElement();
2606
2583
  if (container != null) {
@@ -2665,41 +2642,8 @@ You need to define at least one Layout!`);
2665
2642
  else if (variantTheme) {
2666
2643
  el.classList.add(`infinite-${variantTheme}`);
2667
2644
  }
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
- }
2702
- }
2645
+ // Update AG THEME
2646
+ this.agGridThemeAdapter.applyAgGridThemeOnAdaptableThemeChange(newTheme, variantTheme, container, themesToRemove);
2703
2647
  // MAC LIKE SCROLLBARS
2704
2648
  if (this.adaptableOptions.userInterfaceOptions &&
2705
2649
  this.adaptableOptions.userInterfaceOptions.useCustomMacLikeScrollbars &&
@@ -2792,8 +2736,9 @@ You need to define at least one Layout!`);
2792
2736
  }
2793
2737
  }
2794
2738
  this.__prevLayoutForOnChange = undefined;
2795
- this.layoutManager.destroy();
2796
- this.filteredOutPrimaryKeys.clear();
2739
+ this.layoutManager?.destroy();
2740
+ this.layoutManager = null;
2741
+ this.filteredOutPrimaryKeys?.clear();
2797
2742
  if (this.agGridAdapter?.getAgGridApi() && !this.agGridAdapter.getAgGridApi().isDestroyed()) {
2798
2743
  this.agGridAdapter
2799
2744
  .getAgGridApi()
@@ -2872,7 +2817,6 @@ You need to define at least one Layout!`);
2872
2817
  if (config?.destroyAgGrid === true) {
2873
2818
  this.agGridAdapter.getAgGridApi()?.destroy();
2874
2819
  }
2875
- this.previousAgGridLayoutState = '';
2876
2820
  const gridContainerElement = this.getAgGridContainerElement();
2877
2821
  if (gridContainerElement) {
2878
2822
  gridContainerElement.removeEventListener('keydown', this.agGridListenerKeydown, true);
@@ -2883,8 +2827,6 @@ You need to define at least one Layout!`);
2883
2827
  this.agGridListenerMouseLeave = null;
2884
2828
  }
2885
2829
  this.api._internalDestroySelf();
2886
- this.layoutManager?.destroy();
2887
- this.layoutManager = null;
2888
2830
  this.agGridOptionsService?.destroy();
2889
2831
  this.agGridOptionsService = null;
2890
2832
  this.agGridAdapter?.destroy();
@@ -2895,6 +2837,8 @@ You need to define at least one Layout!`);
2895
2837
  this.agGridColumnAdapter = null;
2896
2838
  this.agGridExportAdapter?.destroy();
2897
2839
  this.agGridExportAdapter = null;
2840
+ this.agGridThemeAdapter?.destroy();
2841
+ this.agGridThemeAdapter = null;
2898
2842
  this.rowListeners = null;
2899
2843
  this.emitter.destroy();
2900
2844
  this.emitter = null;
@@ -3340,29 +3284,4 @@ You need to define at least one Layout!`);
3340
3284
  this.__prevLayoutForOnChange = layout;
3341
3285
  this.api.layoutApi.createOrUpdateLayout(layout);
3342
3286
  }
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
- };
3366
- });
3367
- }
3368
3287
  }
@@ -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
  }
@@ -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
  });
@@ -0,0 +1,19 @@
1
+ import { AdaptableAgGrid } from './AdaptableAgGrid';
2
+ import { AgGridThemeMode } from './AgGridAdapter';
3
+ import { AdaptableTheme } from '../PredefinedConfig/ThemeState';
4
+ export declare class AgGridThemeAdapter {
5
+ private _adaptableInstance;
6
+ private agGridThemeMode;
7
+ constructor(_adaptableInstance: AdaptableAgGrid);
8
+ destroy(): void;
9
+ get logger(): import("./AdaptableLogger").AdaptableLogger;
10
+ get api(): import("../types").AdaptableApi;
11
+ setAgGridThemeMode(themeMode: AgGridThemeMode): void;
12
+ getAgGridThemeMode(): AgGridThemeMode;
13
+ applyAgGridThemeOnAdaptableThemeChange(adaptableTheme: AdaptableTheme, variantTheme: string, agGridContainer: HTMLElement, themesToRemove: AdaptableTheme[]): void;
14
+ private getAgGridContainerElement;
15
+ private legacy_applyAgGridThemeOnAdaptableThemeChange;
16
+ getAgGridCurrentThemeClassNames(): string;
17
+ private getAgGridLightThemeName;
18
+ private legacy_getAgGridCurrentThemeClassNames;
19
+ }
@@ -0,0 +1,122 @@
1
+ import { DARK_THEME, LIGHT_THEME } from '../Utilities/Constants/GeneralConstants';
2
+ export class AgGridThemeAdapter {
3
+ constructor(_adaptableInstance) {
4
+ this._adaptableInstance = _adaptableInstance;
5
+ }
6
+ destroy() { }
7
+ get logger() {
8
+ return this._adaptableInstance.logger;
9
+ }
10
+ get api() {
11
+ return this._adaptableInstance.api;
12
+ }
13
+ setAgGridThemeMode(themeMode) {
14
+ this.agGridThemeMode = themeMode;
15
+ }
16
+ getAgGridThemeMode() {
17
+ return this.agGridThemeMode;
18
+ }
19
+ applyAgGridThemeOnAdaptableThemeChange(adaptableTheme, variantTheme, agGridContainer, themesToRemove) {
20
+ if (this.agGridThemeMode === 'legacy') {
21
+ this.legacy_applyAgGridThemeOnAdaptableThemeChange(adaptableTheme, variantTheme, agGridContainer, themesToRemove);
22
+ }
23
+ const themeName = adaptableTheme.Name;
24
+ const isSystemTheme = this.api.themeApi.internalApi.isSystemTheme(themeName);
25
+ if (adaptableTheme && (isSystemTheme || variantTheme)) {
26
+ if ((variantTheme || themeName) === LIGHT_THEME) {
27
+ document.body.dataset.agThemeMode = 'light';
28
+ }
29
+ if ((variantTheme || themeName) === DARK_THEME) {
30
+ document.body.dataset.agThemeMode = 'dark';
31
+ }
32
+ }
33
+ }
34
+ getAgGridContainerElement() {
35
+ return this._adaptableInstance.getAgGridContainerElement();
36
+ }
37
+ legacy_applyAgGridThemeOnAdaptableThemeChange(adaptableTheme, variantTheme, agGridContainer, themesToRemove) {
38
+ const themeName = adaptableTheme.Name;
39
+ const isSystemTheme = this.api.themeApi.internalApi.isSystemTheme(themeName);
40
+ const getAgGridLightThemeName = () => this.getAgGridLightThemeName();
41
+ const getAgGridDarkThemeName = () => getAgGridLightThemeName() + '-dark';
42
+ if (adaptableTheme && (isSystemTheme || variantTheme)) {
43
+ if ((variantTheme || themeName) === LIGHT_THEME) {
44
+ adaptableTheme.AgGridClassName =
45
+ adaptableTheme.AgGridClassName || getAgGridLightThemeName();
46
+ }
47
+ if ((variantTheme || themeName) === DARK_THEME) {
48
+ adaptableTheme.AgGridClassName = adaptableTheme.AgGridClassName || getAgGridDarkThemeName();
49
+ }
50
+ }
51
+ if (!adaptableTheme.AgGridClassName) {
52
+ // default AG Grid to its light theme
53
+ adaptableTheme.AgGridClassName = getAgGridLightThemeName();
54
+ }
55
+ if (agGridContainer != null) {
56
+ if (themesToRemove.length) {
57
+ themesToRemove.forEach((theme) => {
58
+ if (theme.AgGridClassName) {
59
+ agGridContainer.classList.remove(theme.AgGridClassName);
60
+ }
61
+ });
62
+ }
63
+ // also remove all AG Grid theme class names
64
+ const agGridClassNamesToRemove = [];
65
+ agGridContainer.classList.forEach((x) => {
66
+ if (x && x.indexOf('ag-theme-') === 0) {
67
+ agGridClassNamesToRemove.push(x);
68
+ }
69
+ });
70
+ agGridClassNamesToRemove.forEach((x) => agGridContainer.classList.remove(x));
71
+ if (adaptableTheme && adaptableTheme.AgGridClassName) {
72
+ agGridContainer.classList.add(adaptableTheme.AgGridClassName);
73
+ }
74
+ }
75
+ }
76
+ getAgGridCurrentThemeClassNames() {
77
+ if (this.agGridThemeMode === 'legacy') {
78
+ this.legacy_getAgGridCurrentThemeClassNames();
79
+ }
80
+ const currentAgGridTheme = this._adaptableInstance.agGridAdapter.getGridOption('theme');
81
+ if (currentAgGridTheme === 'legacy') {
82
+ return this.legacy_getAgGridCurrentThemeClassNames();
83
+ }
84
+ // @ts-ignore no other way than to use internals
85
+ const currentAgGridTheme__cssClassCache = currentAgGridTheme?._cssClassCache;
86
+ return currentAgGridTheme__cssClassCache ?? '';
87
+ }
88
+ getAgGridLightThemeName() {
89
+ const container = this.getAgGridContainerElement();
90
+ if (container && container.classList) {
91
+ // we detect the ag theme class
92
+ const classList = container.classList;
93
+ for (let i = 0, len = classList.length; i < len; i++) {
94
+ const cls = classList[i];
95
+ if (cls.indexOf('ag-theme-') === 0) {
96
+ // even if dark theme is included, we compute the light theme name out of it
97
+ return cls.replace('-dark', '');
98
+ }
99
+ }
100
+ }
101
+ else {
102
+ this.logger.warn('No AgGrid container found, defaulting to ag-theme-balham for the light theme');
103
+ }
104
+ this.logger.warn('No ag-theme- class found on the grid container, defaulting to ag-theme-balham');
105
+ // fallback to the default light theme
106
+ return 'ag-theme-balham';
107
+ }
108
+ legacy_getAgGridCurrentThemeClassNames() {
109
+ const container = this.getAgGridContainerElement();
110
+ if (container && container.classList) {
111
+ // we detect the ag theme class
112
+ const classList = container.classList;
113
+ for (let i = 0, len = classList.length; i < len; i++) {
114
+ const cls = classList[i];
115
+ if (cls.indexOf('ag-theme-') === 0) {
116
+ return cls;
117
+ }
118
+ }
119
+ }
120
+ return this.getAgGridLightThemeName();
121
+ }
122
+ }
@@ -31,11 +31,11 @@ export const ColorPicker = React.forwardRef((props, ref) => {
31
31
  }, value: preparedValue, ref: ref, type: "color", style: {
32
32
  width: 70,
33
33
  padding: 0 /* we need this to be 0, since otherwise on Windows browsers, the chosen color cannot be seen */,
34
- }, list: "ABcolorChoices" }),
34
+ }, list: "ABcolorChoices", title: props.title }),
35
35
  ABcolorChoices,
36
36
  includeAlpha && (React.createElement(Flex, { alignItems: "center" },
37
37
  React.createElement(Box, { mr: 1 }, "Opacity"),
38
- React.createElement(Input, { className: "ab-ColorPicker-range", style: { background: rangeBackround }, value: alpha, onChange: (event) => {
38
+ React.createElement(Input, { disabled: props.disabled, className: "ab-ColorPicker-range", style: { background: rangeBackround }, value: alpha, onChange: (event) => {
39
39
  const color = tinycolor(value).setAlpha(event.target.value).toRgbString();
40
40
  props.onChange(color);
41
41
  }, min: 0, max: 1, step: 0.01, type: "range" })))));
@@ -4,7 +4,7 @@ const useAgGridClassName = (deps = []) => {
4
4
  const adaptable = useAdaptable();
5
5
  return useMemo(() => {
6
6
  if (adaptable) {
7
- return adaptable.getAgGridCurrentThemeName();
7
+ return adaptable.agGridThemeAdapter.getAgGridCurrentThemeClassNames();
8
8
  }
9
9
  return '';
10
10
  }, deps);
package/src/env.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export default {
2
2
  NEXT_PUBLIC_INFINITE_TABLE_LICENSE_KEY: "StartDate=2021-06-29|EndDate=2030-01-01|Owner=Adaptable|Type=distribution|TS=1624971462479|C=137829811,1004007071,2756196225,1839832928,3994409405,636616862" || '',
3
- PUBLISH_TIMESTAMP: 1740403751637 || Date.now(),
4
- VERSION: "20.0.0-canary.3" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1741156623359 || Date.now(),
4
+ VERSION: "20.0.0-canary.5" || '--current-version--',
5
5
  };