Skip to content

Commit 7c57951

Browse files
odinrCopilotgithub-actions[bot]
authored
fix(ag-grid): change theme to function and add charts export path (#3816)
* chore(changeset): update msal acquire-token-request default [hotfix] * fix(module-ag-grid): change theme to function for lazy evaluation BREAKING CHANGE: theme configuration now accepts a function () => Theme instead of Theme directly Fixes #747 * feat(react-ag-grid): add charts export path Add new ./charts export for AG Charts React components and enterprise module. Includes AgCharts and AgChartsEnterpriseModule exports. Fixes #747 * test(cookbook): add theme override example Add test theme override demonstrating theme function API with custom parameters. * refactor(cookbook): update AG Charts imports to use framework export Migrate chart components to use @equinor/fusion-framework-react-ag-grid/charts instead of direct ag-charts-react imports. Fixes #747 * chore: update dependencies in pnpm-lock.yaml - Bump '@types/node' from 24.9.2 to 24.10.1 across various packages. - Update 'ag-charts-react' and related dependencies to version 12.3.1. - Adjust 'react' and 'react-dom' versions to 18.3.1. - Upgrade 'rollup' from 4.52.5 to 4.53.3. - Remove deprecated esbuild versions and clean up unused packages. This update ensures compatibility with the latest versions and improves overall project stability. Signed-off-by: Odin Thomas Rochmann <[email protected]> * Update .changeset/module-ag-grid_theme-function.md Co-authored-by: Copilot <[email protected]> * refactor(ag-grid): remove unused createTheme import Eliminate the unused import of createTheme from AgGridProvider.ts to clean up the codebase and improve readability. Signed-off-by: Odin Thomas Rochmann <[email protected]> * Update packages/modules/ag-grid/src/AgGridProvider.ts Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * refactor(ag-grid): update exports for ag-charts modules Change exports in charts.ts to use a wildcard export for ag-charts-react, and remove AgCharts export from enterprise.ts to streamline module usage. This enhances clarity and maintains compatibility with the latest ag-charts updates. Signed-off-by: Odin Thomas Rochmann <[email protected]> --------- Signed-off-by: Odin Thomas Rochmann <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 4b1999e commit 7c57951

File tree

18 files changed

+136
-756
lines changed

18 files changed

+136
-756
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@equinor/fusion-framework-cookbook-app-react-ag-grid": patch
3+
---
4+
5+
Add test theme override example in cookbook configuration.
6+
7+
Demonstrates how to use the theme function API with custom theme parameters.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@equinor/fusion-framework-cookbook-app-react-charts": patch
3+
---
4+
5+
Update AG Charts imports to use new `@equinor/fusion-framework-react-ag-grid/charts` export path.
6+
7+
Migrate from direct `ag-charts-react` imports to the framework's unified charts export.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
"@equinor/fusion-framework-module-ag-grid": minor
3+
---
4+
5+
Internal: `theme` config property now expects a function `() => Theme` for lazy evaluation, but consumer APIs remain backward compatible.
6+
7+
Most consumers using `builder.setTheme()` do not need to migrate; it still accepts both `Theme` objects and functions. Only direct construction of `AgGridConfig` requires the function wrapper.
8+
9+
```typescript
10+
// Internal API change (rare, direct config construction)
11+
const config: AgGridConfig = {
12+
theme: () => myTheme
13+
};
14+
15+
// Builder API remains backward compatible
16+
builder.setTheme(myTheme); // still works
17+
builder.setTheme((theme) => theme.withParams({...})); // also works
18+
```
19+
20+
Fixes: https://github.com/equinor/fusion-framework/issues/747
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
"@equinor/fusion-framework-react-ag-grid": minor
3+
---
4+
5+
Add new `./charts` export path for AG Charts React components and enterprise module.
6+
7+
The package now exports `AgCharts` and `AgChartsEnterpriseModule` from a dedicated `./charts` export path. This provides a cleaner separation from the enterprise exports.
8+
9+
```typescript
10+
import { AgCharts, AgChartsEnterpriseModule } from '@equinor/fusion-framework-react-ag-grid/charts';
11+
```
12+
13+
Note: Charts exports are still available from `./enterprise` for backward compatibility but will be removed in a future minor release.
14+
15+
Fixes: https://github.com/equinor/fusion-framework/issues/747

cookbooks/app-react-ag-grid/src/config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ export const configure: AppModuleInitiator = (configurator, { env }) => {
2929
IntegratedChartsModule.with(AgChartsEnterpriseModule),
3030
AllCommunityModule,
3131
]);
32+
builder.setTheme((theme) =>
33+
theme.withParams({
34+
headerTextColor: 'cornflowerblue',
35+
}),
36+
);
3237
});
3338

3439
/** callback when configurations is created */

cookbooks/app-react-charts/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,16 @@
2323
"@equinor/fusion-framework-cli": "workspace:^",
2424
"@equinor/fusion-framework-module-navigation": "workspace:^",
2525
"@equinor/fusion-framework-react-app": "workspace:^",
26+
"@equinor/fusion-framework-react-ag-grid": "workspace:^",
2627
"@types/react": "^18.2.50",
2728
"@types/react-dom": "^18.2.7",
2829
"react": "^18.2.0",
2930
"react-dom": "^18.2.0",
3031
"react-router-dom": "^7.6.0",
31-
"typescript": "^5.8.2",
32-
"styled-components": "^6.1.19"
32+
"styled-components": "^6.1.19",
33+
"typescript": "^5.8.2"
3334
},
3435
"dependencies": {
35-
"ag-charts-community": "^12.2.0",
36-
"ag-charts-react": "^12.2.0",
3736
"chart.js": "^4.4.9",
3837
"react-chartjs-2": "^5.3.0"
3938
}

cookbooks/app-react-charts/src/pages/ag-charts/AgArea.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { AgChartOptions } from 'ag-charts-community';
22
import { salesData } from './Data';
33
import { type ReactElement, useMemo } from 'react';
44
import Styled from '../../App.style';
5-
import { AgCharts } from 'ag-charts-react';
5+
import { AgCharts } from '@equinor/fusion-framework-react-ag-grid/charts';
66

77
/**
88
* AgArea Component - Stacked Area Chart Visualization

cookbooks/app-react-charts/src/pages/ag-charts/AgBar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { AgChartOptions } from 'ag-charts-community';
22
import { salesData } from './Data';
33
import { type ReactElement, useMemo } from 'react';
44
import Styled from '../../App.style';
5-
import { AgCharts } from 'ag-charts-react';
5+
import { AgCharts } from '@equinor/fusion-framework-react-ag-grid/charts';
66

77
/**
88
* AgBar Component - Bar Chart Visualization

cookbooks/app-react-charts/src/pages/ag-charts/AgLine.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { AgChartOptions } from 'ag-charts-community';
22
import { temperatureData } from './Data';
33
import { type ReactElement, useMemo } from 'react';
44
import Styled from '../../App.style';
5-
import { AgCharts } from 'ag-charts-react';
5+
import { AgCharts } from '@equinor/fusion-framework-react-ag-grid/charts';
66

77
/**
88
* AgLine Component - Line Chart Visualization

cookbooks/app-react-charts/src/pages/ag-charts/AgPie.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { AgChartOptions } from 'ag-charts-community';
22
import { marketShareData } from './Data';
33
import { type ReactElement, useMemo } from 'react';
44
import Styled from '../../App.style';
5-
import { AgCharts } from 'ag-charts-react';
5+
import { AgCharts } from '@equinor/fusion-framework-react-ag-grid/charts';
66

77
/**
88
* AgPie Component - Pie Chart Visualization

0 commit comments

Comments
 (0)