@adaptabletools/adaptable-cjs 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 +34 -115
  43. package/src/agGrid/AgGridAdapter.d.ts +1 -1
  44. package/src/agGrid/AgGridAdapter.js +4 -5
  45. package/src/agGrid/AgGridColumnAdapter.js +5 -7
  46. package/src/agGrid/AgGridThemeAdapter.d.ts +19 -0
  47. package/src/agGrid/AgGridThemeAdapter.js +126 -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.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 = {
@@ -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;
@@ -3344,30 +3288,5 @@ You need to define at least one Layout!`);
3344
3288
  this.__prevLayoutForOnChange = layout;
3345
3289
  this.api.layoutApi.createOrUpdateLayout(layout);
3346
3290
  }
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
3291
  }
3373
3292
  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
  }
@@ -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
  });
@@ -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,126 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AgGridThemeAdapter = void 0;
4
+ const GeneralConstants_1 = require("../Utilities/Constants/GeneralConstants");
5
+ class AgGridThemeAdapter {
6
+ constructor(_adaptableInstance) {
7
+ this._adaptableInstance = _adaptableInstance;
8
+ }
9
+ destroy() { }
10
+ get logger() {
11
+ return this._adaptableInstance.logger;
12
+ }
13
+ get api() {
14
+ return this._adaptableInstance.api;
15
+ }
16
+ setAgGridThemeMode(themeMode) {
17
+ this.agGridThemeMode = themeMode;
18
+ }
19
+ getAgGridThemeMode() {
20
+ return this.agGridThemeMode;
21
+ }
22
+ applyAgGridThemeOnAdaptableThemeChange(adaptableTheme, variantTheme, agGridContainer, themesToRemove) {
23
+ if (this.agGridThemeMode === 'legacy') {
24
+ this.legacy_applyAgGridThemeOnAdaptableThemeChange(adaptableTheme, variantTheme, agGridContainer, themesToRemove);
25
+ }
26
+ const themeName = adaptableTheme.Name;
27
+ const isSystemTheme = this.api.themeApi.internalApi.isSystemTheme(themeName);
28
+ if (adaptableTheme && (isSystemTheme || variantTheme)) {
29
+ if ((variantTheme || themeName) === GeneralConstants_1.LIGHT_THEME) {
30
+ document.body.dataset.agThemeMode = 'light';
31
+ }
32
+ if ((variantTheme || themeName) === GeneralConstants_1.DARK_THEME) {
33
+ document.body.dataset.agThemeMode = 'dark';
34
+ }
35
+ }
36
+ }
37
+ getAgGridContainerElement() {
38
+ return this._adaptableInstance.getAgGridContainerElement();
39
+ }
40
+ legacy_applyAgGridThemeOnAdaptableThemeChange(adaptableTheme, variantTheme, agGridContainer, themesToRemove) {
41
+ const themeName = adaptableTheme.Name;
42
+ const isSystemTheme = this.api.themeApi.internalApi.isSystemTheme(themeName);
43
+ const getAgGridLightThemeName = () => this.getAgGridLightThemeName();
44
+ const getAgGridDarkThemeName = () => getAgGridLightThemeName() + '-dark';
45
+ if (adaptableTheme && (isSystemTheme || variantTheme)) {
46
+ if ((variantTheme || themeName) === GeneralConstants_1.LIGHT_THEME) {
47
+ adaptableTheme.AgGridClassName =
48
+ adaptableTheme.AgGridClassName || getAgGridLightThemeName();
49
+ }
50
+ if ((variantTheme || themeName) === GeneralConstants_1.DARK_THEME) {
51
+ adaptableTheme.AgGridClassName = adaptableTheme.AgGridClassName || getAgGridDarkThemeName();
52
+ }
53
+ }
54
+ if (!adaptableTheme.AgGridClassName) {
55
+ // default AG Grid to its light theme
56
+ adaptableTheme.AgGridClassName = getAgGridLightThemeName();
57
+ }
58
+ if (agGridContainer != null) {
59
+ if (themesToRemove.length) {
60
+ themesToRemove.forEach((theme) => {
61
+ if (theme.AgGridClassName) {
62
+ agGridContainer.classList.remove(theme.AgGridClassName);
63
+ }
64
+ });
65
+ }
66
+ // also remove all AG Grid theme class names
67
+ const agGridClassNamesToRemove = [];
68
+ agGridContainer.classList.forEach((x) => {
69
+ if (x && x.indexOf('ag-theme-') === 0) {
70
+ agGridClassNamesToRemove.push(x);
71
+ }
72
+ });
73
+ agGridClassNamesToRemove.forEach((x) => agGridContainer.classList.remove(x));
74
+ if (adaptableTheme && adaptableTheme.AgGridClassName) {
75
+ agGridContainer.classList.add(adaptableTheme.AgGridClassName);
76
+ }
77
+ }
78
+ }
79
+ getAgGridCurrentThemeClassNames() {
80
+ if (this.agGridThemeMode === 'legacy') {
81
+ this.legacy_getAgGridCurrentThemeClassNames();
82
+ }
83
+ const currentAgGridTheme = this._adaptableInstance.agGridAdapter.getGridOption('theme');
84
+ if (currentAgGridTheme === 'legacy') {
85
+ return this.legacy_getAgGridCurrentThemeClassNames();
86
+ }
87
+ // @ts-ignore no other way than to use internals
88
+ const currentAgGridTheme__cssClassCache = currentAgGridTheme?._cssClassCache;
89
+ return currentAgGridTheme__cssClassCache ?? '';
90
+ }
91
+ getAgGridLightThemeName() {
92
+ const container = this.getAgGridContainerElement();
93
+ if (container && container.classList) {
94
+ // we detect the ag theme class
95
+ const classList = container.classList;
96
+ for (let i = 0, len = classList.length; i < len; i++) {
97
+ const cls = classList[i];
98
+ if (cls.indexOf('ag-theme-') === 0) {
99
+ // even if dark theme is included, we compute the light theme name out of it
100
+ return cls.replace('-dark', '');
101
+ }
102
+ }
103
+ }
104
+ else {
105
+ this.logger.warn('No AgGrid container found, defaulting to ag-theme-balham for the light theme');
106
+ }
107
+ this.logger.warn('No ag-theme- class found on the grid container, defaulting to ag-theme-balham');
108
+ // fallback to the default light theme
109
+ return 'ag-theme-balham';
110
+ }
111
+ legacy_getAgGridCurrentThemeClassNames() {
112
+ const container = this.getAgGridContainerElement();
113
+ if (container && container.classList) {
114
+ // we detect the ag theme class
115
+ const classList = container.classList;
116
+ for (let i = 0, len = classList.length; i < len; i++) {
117
+ const cls = classList[i];
118
+ if (cls.indexOf('ag-theme-') === 0) {
119
+ return cls;
120
+ }
121
+ }
122
+ }
123
+ return this.getAgGridLightThemeName();
124
+ }
125
+ }
126
+ exports.AgGridThemeAdapter = AgGridThemeAdapter;
@@ -35,11 +35,11 @@ exports.ColorPicker = React.forwardRef((props, ref) => {
35
35
  }, value: preparedValue, ref: ref, type: "color", style: {
36
36
  width: 70,
37
37
  padding: 0 /* we need this to be 0, since otherwise on Windows browsers, the chosen color cannot be seen */,
38
- }, list: "ABcolorChoices" }),
38
+ }, list: "ABcolorChoices", title: props.title }),
39
39
  ABcolorChoices,
40
40
  includeAlpha && (React.createElement(rebass_1.Flex, { alignItems: "center" },
41
41
  React.createElement(rebass_1.Box, { mr: 1 }, "Opacity"),
42
- React.createElement(Input_1.default, { className: "ab-ColorPicker-range", style: { background: rangeBackround }, value: alpha, onChange: (event) => {
42
+ React.createElement(Input_1.default, { disabled: props.disabled, className: "ab-ColorPicker-range", style: { background: rangeBackround }, value: alpha, onChange: (event) => {
43
43
  const color = (0, tinycolor2_1.default)(value).setAlpha(event.target.value).toRgbString();
44
44
  props.onChange(color);
45
45
  }, min: 0, max: 1, step: 0.01, type: "range" })))));
@@ -6,7 +6,7 @@ const useAgGridClassName = (deps = []) => {
6
6
  const adaptable = (0, AdaptableContext_1.useAdaptable)();
7
7
  return (0, react_1.useMemo)(() => {
8
8
  if (adaptable) {
9
- return adaptable.getAgGridCurrentThemeName();
9
+ return adaptable.agGridThemeAdapter.getAgGridCurrentThemeClassNames();
10
10
  }
11
11
  return '';
12
12
  }, deps);
package/src/env.js CHANGED
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = {
4
4
  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" || '',
5
- PUBLISH_TIMESTAMP: 1740403780188 || Date.now(),
6
- VERSION: "20.0.0-canary.3" || '--current-version--',
5
+ PUBLISH_TIMESTAMP: 1741156652553 || Date.now(),
6
+ VERSION: "20.0.0-canary.5" || '--current-version--',
7
7
  };