@adaptabletools/adaptable-cjs 20.0.0-canary.4 → 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 (29) hide show
  1. package/package.json +1 -1
  2. package/src/AdaptableInterfaces/IAdaptable.d.ts +2 -1
  3. package/src/AdaptableOptions/DefaultAdaptableOptions.js +1 -0
  4. package/src/AdaptableOptions/EditOptions.d.ts +13 -2
  5. package/src/AdaptableOptions/UserInterfaceOptions.d.ts +7 -0
  6. package/src/Api/Implementation/ThemeApiImpl.js +3 -1
  7. package/src/Api/Internal/RowFormInternalApi.js +1 -1
  8. package/src/Api/ThemeApi.d.ts +2 -0
  9. package/src/PredefinedConfig/AlertState.d.ts +1 -1
  10. package/src/PredefinedConfig/Common/AdaptablePredicate.js +0 -16
  11. package/src/PredefinedConfig/FlashingCellState.d.ts +1 -1
  12. package/src/PredefinedConfig/LayoutState.d.ts +2 -2
  13. package/src/Utilities/Services/ThemeService.d.ts +1 -1
  14. package/src/Utilities/Services/ThemeService.js +5 -5
  15. package/src/View/DataChangeHistory/DataChangeHistoryPopup.js +4 -1
  16. package/src/View/GridInfo/GridInfoPopup/GridInfoPopup.js +7 -2
  17. package/src/agGrid/AdaptableAgGrid.d.ts +2 -2
  18. package/src/agGrid/AdaptableAgGrid.js +10 -73
  19. package/src/agGrid/AgGridAdapter.d.ts +1 -1
  20. package/src/agGrid/AgGridAdapter.js +1 -5
  21. package/src/agGrid/AgGridColumnAdapter.js +0 -4
  22. package/src/agGrid/AgGridThemeAdapter.d.ts +19 -0
  23. package/src/agGrid/AgGridThemeAdapter.js +126 -0
  24. package/src/components/OverlayTrigger/useAgGridClassName.js +1 -1
  25. package/src/env.js +2 -2
  26. package/src/metamodel/adaptable.metamodel.d.ts +16 -0
  27. package/src/metamodel/adaptable.metamodel.js +1 -1
  28. package/src/migration/VersionUpgrade20.js +49 -5
  29. package/tsconfig.cjs.tsbuildinfo +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable-cjs",
3
- "version": "20.0.0-canary.4",
3
+ "version": "20.0.0-canary.5",
4
4
  "description": "Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements",
5
5
  "keywords": [
6
6
  "web-components",
@@ -31,6 +31,7 @@ import { AgGridMenuAdapter } from '../agGrid/AgGridMenuAdapter';
31
31
  import { RowFormService } from '../Utilities/Services/RowFormService';
32
32
  import { FlashingCellService } from '../Utilities/Services/FlashingCellService';
33
33
  import { AgGridExportAdapter } from '../agGrid/AgGridExportAdapter';
34
+ import { AgGridThemeAdapter } from '../agGrid/AgGridThemeAdapter';
34
35
  /**
35
36
  * Contains AG Grid Options and Modules - used when instantiating AdapTable vanilla
36
37
  */
@@ -66,6 +67,7 @@ export interface IAdaptable {
66
67
  agGridMenuAdapter: AgGridMenuAdapter;
67
68
  agGridColumnAdapter: AgGridColumnAdapter;
68
69
  agGridExportAdapter: AgGridExportAdapter;
70
+ agGridThemeAdapter: AgGridThemeAdapter;
69
71
  hasAdaptableToolPanel: boolean;
70
72
  renderReactRoot: RenderReactRootFn;
71
73
  /**
@@ -244,7 +246,6 @@ export interface IAdaptable {
244
246
  isGridRangeSelectable(): boolean;
245
247
  isGridRowSelectable(): boolean;
246
248
  isGridGroupingActive(): boolean;
247
- getAgGridCurrentThemeName(): string;
248
249
  applyAdaptableTheme(theme: AdaptableTheme | string): void;
249
250
  setRowGroupColumns(columnIds: string[]): void;
250
251
  getAllGridColumns(): Column<any>[];
@@ -298,6 +298,7 @@ const DefaultAdaptableOptions = {
298
298
  styleClassNames: GeneralConstants_1.EMPTY_ARRAY,
299
299
  showDocumentationLinks: true,
300
300
  showAdapTableVersion: true,
301
+ showAgGridVersion: true,
301
302
  },
302
303
  };
303
304
  function applyDefaultAdaptableOptions(adaptableOptions) {
@@ -39,17 +39,28 @@ export interface EditOptions<TData = any> {
39
39
  */
40
40
  export interface CustomEditColumnValuesContext<TData = any> extends AdaptableColumnContext<TData> {
41
41
  /**
42
- * Current distinct values in Cell
42
+ * Current distinct values in Column
43
43
  */
44
44
  defaultValues: Required<CustomEditColumnValueInfo>[];
45
+ /**
46
+ * Search text in Edit - used when fetching values from server
47
+ */
45
48
  currentSearchValue: string;
46
49
  /**
47
50
  * Currently edited Grid Cell
48
51
  */
49
52
  gridCell: GridCell;
50
53
  }
54
+ /**
55
+ * Information about items in the Edit Controls
56
+ */
51
57
  export interface CustomEditColumnValueInfo {
52
- label?: string;
58
+ /**
59
+ * Item's label
60
+ */ label?: string;
61
+ /**
62
+ * Value of Item being shown
63
+ */
53
64
  value: any;
54
65
  }
55
66
  /**
@@ -68,6 +68,13 @@ export interface UserInterfaceOptions<TData = any> {
68
68
  * @gridInfoItem
69
69
  */
70
70
  showAdapTableVersion?: boolean;
71
+ /**
72
+ * Displays the AG Grid version in Grid Info section of Settings Panel
73
+ *
74
+ * @defaultValue true
75
+ * @gridInfoItem
76
+ */
77
+ showAgGridVersion?: boolean;
71
78
  /**
72
79
  * English variant to use in AdapTable UI
73
80
  *
@@ -8,6 +8,7 @@ const ApiBase_1 = require("./ApiBase");
8
8
  const themes_1 = require("../../themes");
9
9
  const ThemeInternalApi_1 = require("../Internal/ThemeInternalApi");
10
10
  const AdaptableHelper_1 = tslib_1.__importDefault(require("../../Utilities/Helpers/AdaptableHelper"));
11
+ const logDeprecation_1 = require("../../Utilities/logDeprecation");
11
12
  class ThemeApiImpl extends ApiBase_1.ApiBase {
12
13
  constructor(_adaptable) {
13
14
  super(_adaptable);
@@ -74,7 +75,8 @@ class ThemeApiImpl extends ApiBase_1.ApiBase {
74
75
  this.showModulePopup(ModuleConstants.ThemeModuleId);
75
76
  }
76
77
  getAgGridCurrentThemeName() {
77
- return this._adaptable.getAgGridCurrentThemeName();
78
+ (0, logDeprecation_1.logDeprecation)(this._adaptable.logger, 'ThemeApi', 'getAgGridCurrentThemeName', null, `This is required only for AG Grid's legacy themes. See https://www.ag-grid.com/javascript-data-grid/theming-v32/`);
79
+ return this._adaptable.agGridThemeAdapter.getAgGridCurrentThemeClassNames();
78
80
  }
79
81
  editTheme(theme) {
80
82
  this.dispatchAction(ThemeRedux.ThemeEdit(theme));
@@ -190,7 +190,7 @@ class RowFormInternalApi extends ApiBase_1.ApiBase {
190
190
  }
191
191
  const returnValues = this.getGridApi().internalApi.getDistinctDisplayValuesForColumnOld(column.columnId);
192
192
  // FIXME add support for asynchronous custom select cell editor values
193
- // it involves refactoring the AdaptableForm & AdapatableFormComponent
193
+ // it involves refactoring the AdaptableForm & adaptableFormComponent
194
194
  // await this.getSelectCellEditorValuesForColumn(
195
195
  // column,
196
196
  // gridCell
@@ -81,6 +81,8 @@ export interface ThemeApi {
81
81
  openThemeSettingsPanel(): void;
82
82
  /**
83
83
  * Get the name of the current AG Grid theme
84
+ *
85
+ * @deprecated required only for legacy AG Grid themes, see https://www.ag-grid.com/javascript-data-grid/theming-v32/
84
86
  */
85
87
  getAgGridCurrentThemeName(): string;
86
88
  }
@@ -150,4 +150,4 @@ export type SystemAlertPredicateIds = SystemAlertPredicateId[];
150
150
  /**
151
151
  * List of System Predicates available for Alerts
152
152
  */
153
- export type SystemAlertPredicateId = 'Blanks' | 'NonBlanks' | 'Equals' | 'NotEquals' | 'GreaterThan' | 'LessThan' | 'Positive' | 'Negative' | 'Zero' | 'Between' | 'NotBetween' | 'Is' | 'IsNot' | 'Contains' | 'NotContains' | 'StartsWith' | 'EndsWith' | 'Regex' | 'Today' | 'Yesterday' | 'Tomorrow' | 'ThisWeek' | 'ThisMonth' | 'ThisQuarter' | 'ThisYear' | 'InPast' | 'InFuture' | 'Before' | 'After' | 'On' | 'NotOn' | 'NextWorkDay' | 'LastWorkDay' | 'WorkDay' | 'Holiday' | 'True' | 'False' | 'PercentChange' | 'IsNumeric' | 'IsNotNumeric' | 'In' | 'NotIn' | 'AnyChange';
153
+ export type SystemAlertPredicateId = 'Blanks' | 'NonBlanks' | 'Equals' | 'NotEquals' | 'GreaterThan' | 'LessThan' | 'Positive' | 'Negative' | 'Zero' | 'Between' | 'NotBetween' | 'Is' | 'IsNot' | 'Contains' | 'NotContains' | 'StartsWith' | 'EndsWith' | 'Regex' | 'Today' | 'Yesterday' | 'Tomorrow' | 'ThisWeek' | 'ThisMonth' | 'ThisQuarter' | 'ThisYear' | 'InPast' | 'InFuture' | 'Before' | 'After' | 'On' | 'NotOn' | 'NextWorkDay' | 'LastWorkDay' | 'WorkDay' | 'Holiday' | 'True' | 'False' | 'PercentChange' | 'In' | 'NotIn' | 'AnyChange';
@@ -270,22 +270,6 @@ exports.SystemPredicateDefs = [
270
270
  toString: ({ inputs }) => `Not Between ${inputs[0] ?? ''}:${inputs[1]}`,
271
271
  shortcuts: ['!:'],
272
272
  },
273
- {
274
- id: 'IsNumeric',
275
- label: 'Is Numeric',
276
- icon: { text: '1' },
277
- columnScope: { DataTypes: ['number'] },
278
- moduleScope: ['alert', 'flashingcell'],
279
- handler: ({ value }) => !isNaN(Number(value)),
280
- },
281
- {
282
- id: 'IsNotNumeric',
283
- label: 'Is Not Numeric',
284
- icon: { text: '1' },
285
- columnScope: { DataTypes: ['number'] },
286
- moduleScope: ['alert', 'flashingcell'],
287
- handler: ({ value }) => isNaN(Number(value)),
288
- },
289
273
  // String System Filters
290
274
  {
291
275
  id: 'Is',
@@ -72,4 +72,4 @@ export type SystemFlashingCellPredicateIds = SystemFlashingCellPredicateId[];
72
72
  /**
73
73
  * List of System Predicates available for Flashing Cells
74
74
  */
75
- export type SystemFlashingCellPredicateId = 'Blanks' | 'NonBlanks' | 'Equals' | 'NotEquals' | 'GreaterThan' | 'LessThan' | 'Positive' | 'Negative' | 'Zero' | 'Between' | 'NotBetween' | 'Is' | 'IsNot' | 'Contains' | 'NotContains' | 'StartsWith' | 'EndsWith' | 'Regex' | 'Today' | 'Yesterday' | 'Tomorrow' | 'ThisWeek' | 'ThisMonth' | 'ThisQuarter' | 'ThisYear' | 'InPast' | 'InFuture' | 'Before' | 'After' | 'On' | 'NotOn' | 'NextWorkDay' | 'LastWorkDay' | 'WorkDay' | 'Holiday' | 'True' | 'False' | 'PercentChange' | 'IsNumeric' | 'IsNotNumeric' | 'In' | 'NotIn' | 'AnyChange';
75
+ export type SystemFlashingCellPredicateId = 'Blanks' | 'NonBlanks' | 'Equals' | 'NotEquals' | 'GreaterThan' | 'LessThan' | 'Positive' | 'Negative' | 'Zero' | 'Between' | 'NotBetween' | 'Is' | 'IsNot' | 'Contains' | 'NotContains' | 'StartsWith' | 'EndsWith' | 'Regex' | 'Today' | 'Yesterday' | 'Tomorrow' | 'ThisWeek' | 'ThisMonth' | 'ThisQuarter' | 'ThisYear' | 'InPast' | 'InFuture' | 'Before' | 'After' | 'On' | 'NotOn' | 'NextWorkDay' | 'LastWorkDay' | 'WorkDay' | 'Holiday' | 'True' | 'False' | 'PercentChange' | 'In' | 'NotIn' | 'AnyChange';
@@ -51,7 +51,7 @@ export interface LayoutBase extends AdaptableObject {
51
51
  */
52
52
  ColumnHeaders?: ColumnStringMap;
53
53
  /**
54
- * Whether to include aggFunc name in the Column header: e.g. 'sum(Price)' will just be 'Price'
54
+ * Whether to include aggFunc name in Column header: e.g. 'sum(Price)' becomes 'Price'
55
55
  */
56
56
  SuppressAggFuncInHeader?: boolean;
57
57
  /**
@@ -88,7 +88,7 @@ export interface TableLayout extends LayoutBase {
88
88
  */
89
89
  RowSummaries?: RowSummary[];
90
90
  /**
91
- * Columns showing aggregated values in Group Rows; 1st value in record is Column name, 2nd is either aggfunc (e.g. sum, avg etc.) or 'true' (to use default aggfunc)
91
+ * Columns showing aggregated values in Grouped Rows; a record of ColumnId and aggfunc (e.g. sum) or 'true' (to use default aggfunc)
92
92
  */
93
93
  TableAggregationColumns?: TableAggregationColumns;
94
94
  /**
@@ -5,10 +5,10 @@ export declare class ThemeService implements IThemeService {
5
5
  private unsubscribe;
6
6
  private styleSheetObject;
7
7
  constructor(api: AdaptableApi);
8
+ destroy(): void;
8
9
  subscribe(): void;
9
10
  onThemeChanged: () => void;
10
11
  applyNewThemeVariables(theme: AdaptableTheme): void;
11
- destroy(): void;
12
12
  showMissingThemeFiles(theme: AdaptableTheme): void;
13
13
  getDOMPrefferedColorScheme(): 'dark' | 'light';
14
14
  mapOsTheme(theme: AdaptableTheme | string): AdaptableTheme;
@@ -23,6 +23,11 @@ class ThemeService {
23
23
  ];
24
24
  }
25
25
  }
26
+ destroy() {
27
+ this.api = null;
28
+ this.unsubscribe();
29
+ document.adoptedStyleSheets = [...document.adoptedStyleSheets].filter((sheet) => sheet !== this.styleSheetObject);
30
+ }
26
31
  subscribe() {
27
32
  const themeChangedUnsubscribe = this.api.eventApi.on('ThemeChanged', this.onThemeChanged);
28
33
  const prefferedColorSchemeUnsubscribe = this.attachPrefferedColorSchemeListener();
@@ -47,11 +52,6 @@ class ThemeService {
47
52
  str += '}';
48
53
  this.styleSheetObject.replaceSync(str);
49
54
  }
50
- destroy() {
51
- this.api = null;
52
- this.unsubscribe();
53
- document.adoptedStyleSheets = [...document.adoptedStyleSheets].filter((sheet) => sheet !== this.styleSheetObject);
54
- }
55
55
  showMissingThemeFiles(theme) {
56
56
  // run time defined theme
57
57
  // because it may be an empty theme
@@ -58,7 +58,10 @@ class DataChangeHistoryPopupComponent extends React.Component {
58
58
  this.props.api.dataChangeHistoryApi.clearDataChangeHistoryEntry(changeToBeUndone);
59
59
  }
60
60
  };
61
- const currentAgGridTheme = this.props.api.themeApi.getAgGridCurrentThemeName();
61
+ const agGridThemeMode = this.props.api.internalApi
62
+ .getAdaptableInstance()
63
+ .agGridThemeAdapter.getAgGridThemeMode();
64
+ const currentAgGridTheme = agGridThemeMode === 'legacy' ? this.props.api.themeApi.getAgGridCurrentThemeName() : '';
62
65
  return (React.createElement(PopupPanel_1.PopupPanel, { headerText: this.props.moduleInfo.FriendlyName, glyphicon: this.props.moduleInfo.Glyph, infoLink: this.props.moduleInfo.HelpPage, infoLinkDisabled: !this.props.api.internalApi.isDocumentationLinksDisplayed() },
63
66
  React.createElement(rebass_1.Flex, { className: "ab-DataChangeHistoryPopup", flexDirection: "column", style: { height: '100%' } },
64
67
  React.createElement(rebass_1.Flex, { style: {
@@ -14,7 +14,9 @@ const AdaptableObjectRow_1 = require("../../Components/AdaptableObjectRow");
14
14
  const PopupPanel_1 = require("../../Components/Popups/AdaptablePopup/PopupPanel");
15
15
  const AdaptableObjectsSummary_1 = require("./AdaptableObjectsSummary");
16
16
  const EnvVars_1 = require("../../../EnvVars");
17
- const version = EnvVars_1.ADAPTABLE_VERSION;
17
+ const agGridModules_1 = require("../../../agGrid/agGridModules");
18
+ const adaptableVersion = EnvVars_1.ADAPTABLE_VERSION;
19
+ const agGridVersion = agGridModules_1.AG_GRID_VERSION;
18
20
  const GridInfoPopup = (props) => {
19
21
  const api = props.api;
20
22
  const CreateGridSummaries = (colItems) => {
@@ -37,7 +39,10 @@ const GridInfoPopup = (props) => {
37
39
  : null;
38
40
  const selectedRowInfo = api.gridApi.getSelectedRowInfo();
39
41
  if (api.optionsApi.getUserInterfaceOptions()?.showAdapTableVersion) {
40
- returnRows.push(createReadOnlyColItem(colItems, 'AdapTable Version', version));
42
+ returnRows.push(createReadOnlyColItem(colItems, 'AdapTable Version', adaptableVersion));
43
+ }
44
+ if (api.optionsApi.getUserInterfaceOptions()?.showAgGridVersion) {
45
+ returnRows.push(createReadOnlyColItem(colItems, 'AG Grid Version', agGridVersion));
41
46
  }
42
47
  returnRows.push(createReadOnlyColItem(colItems, 'Sorted Columns', ArrayExtensions_1.default.IsNotNullOrEmpty(sorts) ? sorts.join('; ') : 'None'));
43
48
  returnRows.push(createReadOnlyColItem(colItems, 'Column Filters', columnFilterDescription));
@@ -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> {
@@ -70,6 +71,7 @@ export declare class AdaptableAgGrid implements IAdaptable {
70
71
  agGridColumnAdapter: AgGridColumnAdapter;
71
72
  agGridMenuAdapter: AgGridMenuAdapter;
72
73
  agGridExportAdapter: AgGridExportAdapter;
74
+ agGridThemeAdapter: AgGridThemeAdapter;
73
75
  private DANGER_USE_GETTER_adaptableContainerElement;
74
76
  private DANGER_USE_GETTER_agGridContainerElement;
75
77
  api: AdaptableApi;
@@ -295,8 +297,6 @@ export declare class AdaptableAgGrid implements IAdaptable {
295
297
  isGridGroupingActive(): boolean;
296
298
  setAgGridQuickSearch(searchText: string): void;
297
299
  clearAgGridQuickSearch(): void;
298
- getAgGridCurrentThemeName(): string;
299
- private getAgGridLightThemeName;
300
300
  applyAdaptableTheme(theme: AdaptableTheme | string): void;
301
301
  setRowGroupColumns(columnIds: string[]): void;
302
302
  getAllGridColumns(): Column<any>[];
@@ -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) {
@@ -173,6 +174,7 @@ class AdaptableAgGrid {
173
174
  this.agGridMenuAdapter = new AgGridMenuAdapter_1.AgGridMenuAdapter(this);
174
175
  this.agGridColumnAdapter = new AgGridColumnAdapter_1.AgGridColumnAdapter(this);
175
176
  this.agGridExportAdapter = new AgGridExportAdapter_1.AgGridExportAdapter(this);
177
+ this.agGridThemeAdapter = new AgGridThemeAdapter_1.AgGridThemeAdapter(this);
176
178
  this.DataService = new DataService_1.DataService(this);
177
179
  }
178
180
  static forEachAdaptable(fn) {
@@ -600,12 +602,12 @@ You need to define at least one Layout!`);
600
602
  this.agGridAdapter.setAgGridId(agGridId);
601
603
  return agGridId;
602
604
  });
603
- // FIXME AFL: handle both ThemingApi and legacy CSS
604
605
  /**
605
606
  * `theme`
606
607
  */
607
- this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'theme', (original_gridId) => {
608
- return 'legacy';
608
+ this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'theme', (original_theme) => {
609
+ this.agGridThemeAdapter.setAgGridThemeMode(original_theme === 'legacy' ? 'legacy' : 'themingApi');
610
+ return original_theme;
609
611
  });
610
612
  /**
611
613
  * `getRowId`
@@ -722,7 +724,7 @@ You need to define at least one Layout!`);
722
724
  if (this.isGroupRowNode(node)) {
723
725
  return true;
724
726
  }
725
- // 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
726
728
  const isRowFilterable = this.api.optionsApi.getFilterOptions().isRowFilterable;
727
729
  if (typeof isRowFilterable === 'function') {
728
730
  const rowFilterableContext = {
@@ -2580,40 +2582,6 @@ You need to define at least one Layout!`);
2580
2582
  clearAgGridQuickSearch() {
2581
2583
  this.setAgGridQuickSearch('');
2582
2584
  }
2583
- getAgGridCurrentThemeName() {
2584
- const container = this.getAgGridContainerElement();
2585
- if (container && container.classList) {
2586
- // we detect the ag theme class
2587
- const classList = container.classList;
2588
- for (let i = 0, len = classList.length; i < len; i++) {
2589
- const cls = classList[i];
2590
- if (cls.indexOf('ag-theme-') === 0) {
2591
- return cls;
2592
- }
2593
- }
2594
- }
2595
- return this.getAgGridLightThemeName();
2596
- }
2597
- getAgGridLightThemeName() {
2598
- const container = this.getAgGridContainerElement();
2599
- if (container && container.classList) {
2600
- // we detect the ag theme class
2601
- const classList = container.classList;
2602
- for (let i = 0, len = classList.length; i < len; i++) {
2603
- const cls = classList[i];
2604
- if (cls.indexOf('ag-theme-') === 0) {
2605
- // even if dark theme is included, we compute the light theme name out of it
2606
- return cls.replace('-dark', '');
2607
- }
2608
- }
2609
- }
2610
- else {
2611
- this.logger.warn('No AgGrid container found, defaulting to ag-theme-balham for the light theme');
2612
- }
2613
- this.logger.warn('No ag-theme- class found on the grid container, defaulting to ag-theme-balham');
2614
- // fallback to the default light theme
2615
- return 'ag-theme-balham';
2616
- }
2617
2585
  applyAdaptableTheme(theme) {
2618
2586
  const container = this.getAgGridContainerElement();
2619
2587
  if (container != null) {
@@ -2678,41 +2646,8 @@ You need to define at least one Layout!`);
2678
2646
  else if (variantTheme) {
2679
2647
  el.classList.add(`infinite-${variantTheme}`);
2680
2648
  }
2681
- // AG THEME CLASS NAME
2682
- const getAgGridLightThemeName = () => this.getAgGridLightThemeName();
2683
- const getAgGridDarkThemeName = () => getAgGridLightThemeName() + '-dark';
2684
- if (newTheme && (isSystemTheme || variantTheme)) {
2685
- if ((variantTheme || themeName) === GeneralConstants_1.LIGHT_THEME) {
2686
- newTheme.AgGridClassName = newTheme.AgGridClassName || getAgGridLightThemeName();
2687
- }
2688
- if ((variantTheme || themeName) === GeneralConstants_1.DARK_THEME) {
2689
- newTheme.AgGridClassName = newTheme.AgGridClassName || getAgGridDarkThemeName();
2690
- }
2691
- }
2692
- if (!newTheme.AgGridClassName) {
2693
- // default AG Grid to its light theme
2694
- newTheme.AgGridClassName = getAgGridLightThemeName();
2695
- }
2696
- if (container != null) {
2697
- if (themesToRemove.length) {
2698
- themesToRemove.forEach((theme) => {
2699
- if (theme.AgGridClassName) {
2700
- container.classList.remove(theme.AgGridClassName);
2701
- }
2702
- });
2703
- }
2704
- // also remove all AG Grid theme class names
2705
- const agGridClassNamesToRemove = [];
2706
- container.classList.forEach((x) => {
2707
- if (x && x.indexOf('ag-theme-') === 0) {
2708
- agGridClassNamesToRemove.push(x);
2709
- }
2710
- });
2711
- agGridClassNamesToRemove.forEach((x) => container.classList.remove(x));
2712
- if (newTheme && newTheme.AgGridClassName) {
2713
- container.classList.add(newTheme.AgGridClassName);
2714
- }
2715
- }
2649
+ // Update AG THEME
2650
+ this.agGridThemeAdapter.applyAgGridThemeOnAdaptableThemeChange(newTheme, variantTheme, container, themesToRemove);
2716
2651
  // MAC LIKE SCROLLBARS
2717
2652
  if (this.adaptableOptions.userInterfaceOptions &&
2718
2653
  this.adaptableOptions.userInterfaceOptions.useCustomMacLikeScrollbars &&
@@ -2906,6 +2841,8 @@ You need to define at least one Layout!`);
2906
2841
  this.agGridColumnAdapter = null;
2907
2842
  this.agGridExportAdapter?.destroy();
2908
2843
  this.agGridExportAdapter = null;
2844
+ this.agGridThemeAdapter?.destroy();
2845
+ this.agGridThemeAdapter = null;
2909
2846
  this.rowListeners = null;
2910
2847
  this.emitter.destroy();
2911
2848
  this.emitter = null;
@@ -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;
@@ -371,10 +371,6 @@ class AgGridAdapter {
371
371
  }
372
372
  return false;
373
373
  }
374
- // TODO AFL MIG rename to getFirstGroupedColumnId()
375
- getFirstGroupedColumn() {
376
- return this.getAgGridApi?.()?.getRowGroupColumns()?.[0]?.getColId();
377
- }
378
374
  createAdaptableColumnFromAgGridColumn(agGridColumn, colsToGroups) {
379
375
  const colId = agGridColumn.getColId();
380
376
  const colDef = agGridColumn.getColDef();
@@ -529,7 +525,7 @@ class AgGridAdapter {
529
525
  else if (Array.isArray(value)) {
530
526
  const arrayDataType = agGridDataTypeDefinitions_1.ALL_ADAPTABLE_DATA_TYPES.find((arrayType) => {
531
527
  const dataTypeDefinition = agGridDataTypeDefinitions_1.agGridDataTypeDefinitions[arrayType];
532
- const dataTypeMatching = dataTypeDefinition.dataTypeMatcher(value);
528
+ const dataTypeMatching = dataTypeDefinition?.dataTypeMatcher(value);
533
529
  return dataTypeMatching;
534
530
  });
535
531
  if (arrayDataType) {
@@ -143,8 +143,6 @@ class AgGridColumnAdapter {
143
143
  this.setupColumnQuickFilerText(colSetupInfo);
144
144
  this.setupColumnAllowedAggFuncs(colSetupInfo);
145
145
  this.setupColumnType(colSetupInfo);
146
- // this is just to make sure that AG Grid does NOT infer the cellDataType
147
- // https://github.com/AdaptableTools/adaptable/issues/2230 should render it obsolete
148
146
  this.setupColumnCellDataType(colSetupInfo);
149
147
  });
150
148
  }
@@ -380,8 +378,6 @@ class AgGridColumnAdapter {
380
378
  }
381
379
  setupColumnCellDataType(columnSetupInfo) {
382
380
  const { col } = columnSetupInfo;
383
- // AG Grid introduced since v30.x an inferred cellDataType
384
- // the problem is that it breaks the default value formatter and/or editor (especially for Date columns)
385
381
  this.setColDefProperty(col, 'cellDataType', (original_cellDataType) => {
386
382
  return original_cellDataType ?? true;
387
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;
@@ -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: 1740989636450 || Date.now(),
6
- VERSION: "20.0.0-canary.4" || '--current-version--',
5
+ PUBLISH_TIMESTAMP: 1741156652553 || Date.now(),
6
+ VERSION: "20.0.0-canary.5" || '--current-version--',
7
7
  };