@@ -46,12 +46,13 @@ import RowMenuRenderer from '../renderers/rowMenuRenderer';
4646import { customFunctions } from '../renderers/customFunctions' ;
4747
4848import { AgGridReact , useGridFilter } from 'ag-grid-react' ;
49-
50- import 'ag-grid-community/styles/ag-grid.css' ;
51- import 'ag-grid-community/styles/ag-theme-alpine.css' ;
52- import 'ag-grid-community/styles/ag-theme-balham.css' ;
53- import 'ag-grid-community/styles/ag-theme-material.css' ;
54- import 'ag-grid-community/styles/ag-theme-quartz.css' ;
49+ import {
50+ themeAlpine ,
51+ themeBalham ,
52+ themeMaterial ,
53+ themeQuartz ,
54+ } from 'ag-grid-community' ;
55+ const themes = { themeAlpine, themeBalham, themeMaterial, themeQuartz} ;
5556
5657// d3 imports
5758import * as d3Format from 'd3-format' ;
@@ -159,6 +160,7 @@ export function DashAgGrid(props) {
159160 const parsedCondition =
160161 esprima . parse ( funcString ) . body [ 0 ] . expression ;
161162 const context = {
163+ ...themes ,
162164 d3,
163165 dash_clientside,
164166 ...customFunctions ,
@@ -176,6 +178,7 @@ export function DashAgGrid(props) {
176178 const parsedCondition =
177179 esprima . parse ( funcString ) . body [ 0 ] . expression ;
178180 const context = {
181+ ...themes ,
179182 d3,
180183 dash_clientside,
181184 ...customFunctions ,
@@ -195,6 +198,7 @@ export function DashAgGrid(props) {
195198 const parsedCondition =
196199 esprima . parse ( funcString ) . body [ 0 ] . expression ;
197200 const context = {
201+ ...themes ,
198202 d3,
199203 ...customFunctions ,
200204 ...window . dashAgGridFunctions ,
@@ -1532,6 +1536,14 @@ export function DashAgGrid(props) {
15321536 omit ( NO_CONVERT_PROPS , { ...dashGridOptions , ...restProps } )
15331537 ) ;
15341538
1539+ if ( 'theme' in convertedProps ) {
1540+ if ( typeof convertedProps . theme === 'function' ) {
1541+ convertedProps . theme = convertedProps . theme ( ) ;
1542+ } else if ( convertedProps . theme in themes ) {
1543+ convertedProps . theme = themes [ convertedProps . theme ] ;
1544+ }
1545+ }
1546+
15351547 let alignedGrids ;
15361548 if ( dashGridOptions ) {
15371549 if ( 'alignedGrids' in dashGridOptions ) {
0 commit comments