material-react-table 0.26.0 → 0.26.1
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.
- package/README.md +2 -2
- package/dist/material-react-table.cjs.development.js +100 -80
- package/dist/material-react-table.cjs.development.js.map +1 -1
- package/dist/material-react-table.cjs.production.min.js +1 -1
- package/dist/material-react-table.cjs.production.min.js.map +1 -1
- package/dist/material-react-table.esm.js +100 -80
- package/dist/material-react-table.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/body/MRT_TableBodyCell.tsx +3 -1
- package/src/body/MRT_TableBodyRow.tsx +3 -1
- package/src/body/MRT_TableDetailPanel.tsx +5 -3
- package/src/buttons/MRT_CopyButton.tsx +5 -3
- package/src/buttons/MRT_ExpandButton.tsx +5 -3
- package/src/footer/MRT_TableFooterCell.tsx +3 -1
- package/src/head/MRT_TableHeadCell.tsx +3 -1
- package/src/head/MRT_TableHeadCellColumnActionsButton.tsx +5 -3
- package/src/inputs/MRT_FilterTextField.tsx +9 -4
- package/src/inputs/MRT_SelectCheckbox.tsx +5 -3
- package/src/menus/MRT_FilterOptionMenu.tsx +1 -1
- package/src/table/MRT_Table.tsx +5 -3
- package/src/table/MRT_TableContainer.tsx +5 -3
- package/src/toolbar/MRT_TablePagination.tsx +5 -3
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +5 -3
- package/src/toolbar/MRT_ToolbarBottom.tsx +3 -1
- package/src/toolbar/MRT_ToolbarTop.tsx +3 -1
package/package.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"version": "0.26.
|
2
|
+
"version": "0.26.1",
|
3
3
|
"license": "MIT",
|
4
4
|
"name": "material-react-table",
|
5
5
|
"description": "A fully featured Material UI implementation of TanStack React Table, inspired by material-table and the MUI X DataGrid, written from the ground up in TypeScript.",
|
@@ -224,7 +224,9 @@ export const MRT_TableBodyCell: FC<Props> = ({
|
|
224
224
|
: `${darken(theme.palette.background.default, 0.07)} !important`
|
225
225
|
: undefined,
|
226
226
|
},
|
227
|
-
...(tableCellProps?.sx
|
227
|
+
...(tableCellProps?.sx instanceof Function
|
228
|
+
? tableCellProps.sx(theme)
|
229
|
+
: (tableCellProps?.sx as any)),
|
228
230
|
...draggingBorders,
|
229
231
|
maxWidth: `min(${column.getSize()}px, fit-content)`,
|
230
232
|
minWidth: `max(${column.getSize()}px, ${columnDef.minSize ?? 30}px)`,
|
@@ -70,7 +70,9 @@ export const MRT_TableBodyRow: FC<Props> = ({ row, rowIndex, table }) => {
|
|
70
70
|
: `${darken(theme.palette.background.default, 0.05)}`
|
71
71
|
: undefined,
|
72
72
|
},
|
73
|
-
...(tableRowProps?.sx
|
73
|
+
...(tableRowProps?.sx instanceof Function
|
74
|
+
? tableRowProps.sx(theme)
|
75
|
+
: (tableRowProps?.sx as any)),
|
74
76
|
...draggingBorders,
|
75
77
|
})}
|
76
78
|
>
|
@@ -32,14 +32,16 @@ export const MRT_TableDetailPanel: FC<Props> = ({ row, table }) => {
|
|
32
32
|
<TableCell
|
33
33
|
colSpan={getVisibleLeafColumns().length}
|
34
34
|
{...tableCellProps}
|
35
|
-
sx={{
|
35
|
+
sx={(theme) => ({
|
36
36
|
borderBottom: !row.getIsExpanded() ? 'none' : undefined,
|
37
37
|
pb: row.getIsExpanded() ? '1rem' : 0,
|
38
38
|
pt: row.getIsExpanded() ? '1rem' : 0,
|
39
39
|
transition: 'all 0.2s ease-in-out',
|
40
40
|
width: `${table.getTotalSize()}px`,
|
41
|
-
...tableCellProps?.sx
|
42
|
-
|
41
|
+
...(tableCellProps?.sx instanceof Function
|
42
|
+
? tableCellProps.sx(theme)
|
43
|
+
: (tableCellProps?.sx as any)),
|
44
|
+
})}
|
43
45
|
>
|
44
46
|
{renderDetailPanel && (
|
45
47
|
<Collapse in={row.getIsExpanded()}>
|
@@ -55,7 +55,7 @@ export const MRT_CopyButton: FC<Props> = ({ cell, children, table }) => {
|
|
55
55
|
type="button"
|
56
56
|
variant="text"
|
57
57
|
{...buttonProps}
|
58
|
-
sx={{
|
58
|
+
sx={(theme) => ({
|
59
59
|
backgroundColor: 'transparent',
|
60
60
|
border: 'none',
|
61
61
|
color: 'inherit',
|
@@ -67,8 +67,10 @@ export const MRT_CopyButton: FC<Props> = ({ cell, children, table }) => {
|
|
67
67
|
minWidth: 'unset',
|
68
68
|
textAlign: 'inherit',
|
69
69
|
textTransform: 'inherit',
|
70
|
-
...buttonProps?.sx
|
71
|
-
|
70
|
+
...(buttonProps?.sx instanceof Function
|
71
|
+
? buttonProps.sx(theme)
|
72
|
+
: (buttonProps?.sx as any)),
|
73
|
+
})}
|
72
74
|
>
|
73
75
|
{children}
|
74
76
|
</Button>
|
@@ -41,11 +41,13 @@ export const MRT_ExpandButton: FC<Props> = ({ row, table }) => {
|
|
41
41
|
disabled={!row.getCanExpand() && !renderDetailPanel}
|
42
42
|
onClick={handleToggleExpand}
|
43
43
|
{...iconButtonProps}
|
44
|
-
sx={{
|
44
|
+
sx={(theme) => ({
|
45
45
|
height: density === 'compact' ? '1.75rem' : '2.25rem',
|
46
46
|
width: density === 'compact' ? '1.75rem' : '2.25rem',
|
47
|
-
...iconButtonProps?.sx
|
48
|
-
|
47
|
+
...(iconButtonProps?.sx instanceof Function
|
48
|
+
? iconButtonProps.sx(theme)
|
49
|
+
: (iconButtonProps?.sx as any)),
|
50
|
+
})}
|
49
51
|
>
|
50
52
|
<ExpandMoreIcon
|
51
53
|
style={{
|
@@ -56,7 +56,9 @@ export const MRT_TableFooterCell: FC<Props> = ({ footer, table }) => {
|
|
56
56
|
transition: `all ${enableColumnResizing ? '10ms' : '0.2s'} ease-in-out`,
|
57
57
|
width: column.getSize(),
|
58
58
|
verticalAlign: 'text-top',
|
59
|
-
...(tableCellProps?.sx
|
59
|
+
...(tableCellProps?.sx instanceof Function
|
60
|
+
? tableCellProps.sx(theme)
|
61
|
+
: (tableCellProps?.sx as any)),
|
60
62
|
})}
|
61
63
|
>
|
62
64
|
<>
|
@@ -162,7 +162,9 @@ export const MRT_TableHeadCell: FC<Props> = ({ header, table }) => {
|
|
162
162
|
: column.getIsPinned() && columnDefType !== 'group'
|
163
163
|
? 2
|
164
164
|
: 1,
|
165
|
-
...(tableCellProps?.sx
|
165
|
+
...(tableCellProps?.sx instanceof Function
|
166
|
+
? tableCellProps.sx(theme)
|
167
|
+
: (tableCellProps?.sx as any)),
|
166
168
|
...draggingBorders,
|
167
169
|
maxWidth: `min(${column.getSize()}px, fit-content)`,
|
168
170
|
minWidth: `max(${column.getSize()}px, ${columnDef.minSize ?? 30}px)`,
|
@@ -62,7 +62,7 @@ export const MRT_TableHeadCellColumnActionsButton: FC<Props> = ({
|
|
62
62
|
onClick={handleClick}
|
63
63
|
size="small"
|
64
64
|
{...iconButtonProps}
|
65
|
-
sx={{
|
65
|
+
sx={(theme) => ({
|
66
66
|
height: '2rem',
|
67
67
|
mt: '-0.2rem',
|
68
68
|
opacity: 0.5,
|
@@ -71,8 +71,10 @@ export const MRT_TableHeadCellColumnActionsButton: FC<Props> = ({
|
|
71
71
|
'&:hover': {
|
72
72
|
opacity: 1,
|
73
73
|
},
|
74
|
-
...iconButtonProps
|
75
|
-
|
74
|
+
...(iconButtonProps?.sx instanceof Function
|
75
|
+
? iconButtonProps.sx(theme)
|
76
|
+
: (iconButtonProps?.sx as any)),
|
77
|
+
})}
|
76
78
|
>
|
77
79
|
<MoreVertIcon />
|
78
80
|
</IconButton>
|
@@ -73,7 +73,10 @@ export const MRT_FilterTextField: FC<Props> = ({
|
|
73
73
|
|
74
74
|
const handleChangeDebounced = useCallback(
|
75
75
|
debounce((event: ChangeEvent<HTMLInputElement>) => {
|
76
|
-
let value =
|
76
|
+
let value =
|
77
|
+
textFieldProps.type === 'date'
|
78
|
+
? new Date(event.target.value)
|
79
|
+
: event.target.value;
|
77
80
|
if (inputIndex !== undefined) {
|
78
81
|
column.setFilterValue((old: [string, string | Date]) => {
|
79
82
|
const newFilterValues = old ?? ['', ''];
|
@@ -256,7 +259,7 @@ export const MRT_FilterTextField: FC<Props> = ({
|
|
256
259
|
),
|
257
260
|
}}
|
258
261
|
{...textFieldProps}
|
259
|
-
sx={{
|
262
|
+
sx={(theme) => ({
|
260
263
|
m: '-0.25rem',
|
261
264
|
p: 0,
|
262
265
|
minWidth: !filterChipLabel ? '8rem' : 'auto',
|
@@ -264,8 +267,10 @@ export const MRT_FilterTextField: FC<Props> = ({
|
|
264
267
|
'& .MuiSelect-icon': {
|
265
268
|
mr: '1.5rem',
|
266
269
|
},
|
267
|
-
...textFieldProps?.sx
|
268
|
-
|
270
|
+
...(textFieldProps?.sx instanceof Function
|
271
|
+
? textFieldProps.sx(theme)
|
272
|
+
: (textFieldProps?.sx as any)),
|
273
|
+
})}
|
269
274
|
>
|
270
275
|
{isSelectFilter && (
|
271
276
|
<MenuItem divider disabled={!filterValue} value="">
|
@@ -58,12 +58,14 @@ export const MRT_SelectCheckbox: FC<Props> = ({ row, selectAll, table }) => {
|
|
58
58
|
}
|
59
59
|
size={density === 'compact' ? 'small' : 'medium'}
|
60
60
|
{...checkboxProps}
|
61
|
-
sx={{
|
61
|
+
sx={(theme) => ({
|
62
62
|
height: density === 'compact' ? '1.5rem' : '2rem',
|
63
63
|
width: density === 'compact' ? '1.5rem' : '2rem',
|
64
64
|
m: '-1re.m',
|
65
|
-
...checkboxProps?.sx
|
66
|
-
|
65
|
+
...(checkboxProps?.sx instanceof Function
|
66
|
+
? checkboxProps.sx(theme)
|
67
|
+
: (checkboxProps?.sx as any)),
|
68
|
+
})}
|
67
69
|
/>
|
68
70
|
</Tooltip>
|
69
71
|
);
|
package/src/table/MRT_Table.tsx
CHANGED
@@ -35,11 +35,13 @@ export const MRT_Table: FC<Props> = ({ tableContainerRef, table }) => {
|
|
35
35
|
enableStickyHeader || enableRowVirtualization || isFullScreen
|
36
36
|
}
|
37
37
|
{...tableProps}
|
38
|
-
sx={{
|
38
|
+
sx={(theme) => ({
|
39
39
|
tableLayout:
|
40
40
|
enableColumnResizing || enableRowVirtualization ? 'fixed' : 'auto',
|
41
|
-
...tableProps?.sx
|
42
|
-
|
41
|
+
...(tableProps?.sx instanceof Function
|
42
|
+
? tableProps.sx(theme)
|
43
|
+
: (tableProps?.sx as any)),
|
44
|
+
})}
|
43
45
|
>
|
44
46
|
{enableTableHead && <MRT_TableHead table={table} />}
|
45
47
|
<MRT_TableBody tableContainerRef={tableContainerRef} table={table} />
|
@@ -51,15 +51,17 @@ export const MRT_TableContainer: FC<Props> = ({ table }) => {
|
|
51
51
|
<TableContainer
|
52
52
|
ref={tableContainerRef}
|
53
53
|
{...tableContainerProps}
|
54
|
-
sx={{
|
54
|
+
sx={(theme) => ({
|
55
55
|
maxWidth: '100%',
|
56
56
|
maxHeight:
|
57
57
|
enableStickyHeader || enableRowVirtualization
|
58
58
|
? `clamp(350px, calc(100vh - ${totalToolbarHeight}px), 9999px)`
|
59
59
|
: undefined,
|
60
60
|
overflow: 'auto',
|
61
|
-
...tableContainerProps?.sx
|
62
|
-
|
61
|
+
...(tableContainerProps?.sx instanceof Function
|
62
|
+
? tableContainerProps.sx(theme)
|
63
|
+
: (tableContainerProps?.sx as any)),
|
64
|
+
})}
|
63
65
|
style={{
|
64
66
|
maxHeight: isFullScreen
|
65
67
|
? `calc(100vh - ${totalToolbarHeight}px)`
|
@@ -52,7 +52,7 @@ export const MRT_TablePagination: FC<Props> = ({ table, position }) => {
|
|
52
52
|
showFirstButton={showFirstLastPageButtons}
|
53
53
|
showLastButton={showFirstLastPageButtons}
|
54
54
|
{...tablePaginationProps}
|
55
|
-
sx={{
|
55
|
+
sx={(theme) => ({
|
56
56
|
m: '0 0.5rem',
|
57
57
|
mt:
|
58
58
|
position === 'top' &&
|
@@ -62,8 +62,10 @@ export const MRT_TablePagination: FC<Props> = ({ table, position }) => {
|
|
62
62
|
: undefined,
|
63
63
|
position: 'relative',
|
64
64
|
zIndex: 2,
|
65
|
-
...tablePaginationProps?.sx
|
66
|
-
|
65
|
+
...(tablePaginationProps?.sx instanceof Function
|
66
|
+
? tablePaginationProps.sx(theme)
|
67
|
+
: (tablePaginationProps?.sx as any)),
|
68
|
+
})}
|
67
69
|
/>
|
68
70
|
);
|
69
71
|
};
|
@@ -63,7 +63,7 @@ export const MRT_ToolbarAlertBanner: FC<Props> = ({
|
|
63
63
|
color="info"
|
64
64
|
icon={false}
|
65
65
|
{...alertProps}
|
66
|
-
sx={{
|
66
|
+
sx={(theme) => ({
|
67
67
|
borderRadius: 0,
|
68
68
|
fontSize: '1rem',
|
69
69
|
left: 0,
|
@@ -73,8 +73,10 @@ export const MRT_ToolbarAlertBanner: FC<Props> = ({
|
|
73
73
|
top: 0,
|
74
74
|
width: '100%',
|
75
75
|
zIndex: 2,
|
76
|
-
...alertProps?.sx
|
77
|
-
|
76
|
+
...(alertProps?.sx instanceof Function
|
77
|
+
? alertProps.sx(theme)
|
78
|
+
: (alertProps?.sx as any)),
|
79
|
+
})}
|
78
80
|
>
|
79
81
|
{alertProps?.title && <AlertTitle>{alertProps.title}</AlertTitle>}
|
80
82
|
<Box sx={{ p: '0.5rem 1rem' }}>
|
@@ -49,7 +49,9 @@ export const MRT_ToolbarBottom: FC<Props> = ({ table }) => {
|
|
49
49
|
left: 0,
|
50
50
|
position: isFullScreen ? 'fixed' : 'relative',
|
51
51
|
right: 0,
|
52
|
-
...toolbarProps?.sx
|
52
|
+
...(toolbarProps?.sx instanceof Function
|
53
|
+
? toolbarProps.sx(theme)
|
54
|
+
: (toolbarProps?.sx as any)),
|
53
55
|
} as any)
|
54
56
|
}
|
55
57
|
>
|
@@ -62,7 +62,9 @@ export const MRT_ToolbarTop: FC<Props> = ({ table }) => {
|
|
62
62
|
position: isFullScreen ? 'sticky' : undefined,
|
63
63
|
top: isFullScreen ? '0' : undefined,
|
64
64
|
...commonToolbarStyles({ theme }),
|
65
|
-
...toolbarProps?.sx
|
65
|
+
...(toolbarProps?.sx instanceof Function
|
66
|
+
? toolbarProps.sx(theme)
|
67
|
+
: (toolbarProps?.sx as any)),
|
66
68
|
} as any)
|
67
69
|
}
|
68
70
|
>
|