1
- import { Theme , ThemeProvider , createTheme , styled } from '@mui/material' ;
1
+ import { Theme , ThemeProvider , createTheme , styled } from '@mui/material/styles ' ;
2
2
import MUIDataTable , { MUIDataTableColumn } from 'mui-datatables' ;
3
3
import React , { useCallback } from 'react' ;
4
4
import { Checkbox , Collapse , ListItemIcon , ListItemText , Menu , MenuItem } from '../base' ;
@@ -7,7 +7,9 @@ import { EllipsisIcon } from '../icons/Ellipsis';
7
7
import { ColView } from './Helpers/ResponsiveColumns/responsive-coulmns.tsx' ;
8
8
import { TooltipIcon } from './TooltipIconButton' ;
9
9
10
- export const IconWrapper = styled ( 'div' ) < { disabled ?: boolean } > ( ( { disabled = false } ) => ( {
10
+ export const IconWrapper = styled ( 'div' , {
11
+ shouldForwardProp : ( prop ) => prop !== 'disabled'
12
+ } ) < { disabled ?: boolean } > ( ( { disabled = false } ) => ( {
11
13
cursor : disabled ? 'not-allowed' : 'pointer' ,
12
14
opacity : disabled ? '0.5' : '1' ,
13
15
display : 'flex' ,
@@ -126,17 +128,18 @@ const dataTableTheme = (theme: Theme, backgroundColor?: string) =>
126
128
typography : {
127
129
fontFamily : theme . typography . fontFamily
128
130
} ,
129
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
130
- //@ts -ignore
131
131
palette : {
132
+ mode : theme . palette . mode ,
132
133
text : {
133
134
primary : theme . palette . text . default ,
134
135
secondary : theme . palette . text . secondary
135
136
} ,
136
137
background : {
137
- default : backgroundColor || theme . palette . background . constant ?. table ,
138
- paper : backgroundColor || theme . palette . background . constant ?. table
139
- }
138
+ default : backgroundColor || theme . palette . background ?. constant ?. table ,
139
+ paper : backgroundColor || theme . palette . background ?. constant ?. table
140
+ } ,
141
+ border : { ...theme . palette . border } ,
142
+ icon : { ...theme . palette . icon }
140
143
} ,
141
144
components : {
142
145
MuiTableCell : {
@@ -190,6 +193,7 @@ const dataTableTheme = (theme: Theme, backgroundColor?: string) =>
190
193
intermediate : false ,
191
194
color : 'transparent' ,
192
195
'&.Mui-checked' : {
196
+ color : theme . palette . primary . main ,
193
197
'& .MuiSvgIcon-root' : {
194
198
width : '1.25rem' ,
195
199
height : '1.25rem' ,
@@ -287,7 +291,7 @@ const ResponsiveDataTable = ({
287
291
updateCols,
288
292
columnVisibility,
289
293
rowsPerPageOptions = [ 10 , 25 , 50 , 100 ] ,
290
- theme,
294
+ theme : customTheme ,
291
295
backgroundColor,
292
296
...props
293
297
} : ResponsiveDataTableProps ) : JSX . Element => {
@@ -391,8 +395,11 @@ const ResponsiveDataTable = ({
391
395
392
396
const finalTheme = ( baseTheme : Theme ) => {
393
397
const defaultTheme = dataTableTheme ( baseTheme , backgroundColor ) ;
394
- if ( theme ) {
395
- return createTheme ( defaultTheme , typeof theme === 'function' ? theme ( baseTheme ) : theme ) ;
398
+ if ( customTheme ) {
399
+ return createTheme (
400
+ defaultTheme ,
401
+ typeof customTheme === 'function' ? customTheme ( baseTheme ) : customTheme
402
+ ) ;
396
403
}
397
404
return defaultTheme ;
398
405
} ;
@@ -404,7 +411,11 @@ const ResponsiveDataTable = ({
404
411
data = { data || [ ] }
405
412
title = { undefined }
406
413
components = { components }
407
- options = { updatedOptions }
414
+ options = { {
415
+ ...updatedOptions ,
416
+ elevation : 0 ,
417
+ enableNestedDataAccess : '.'
418
+ } }
408
419
{ ...props }
409
420
/>
410
421
</ ThemeProvider >
0 commit comments