material-react-table 2.9.0 → 2.9.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.esm.js +67 -65
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +66 -64
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
- package/src/components/body/MRT_TableBodyCell.tsx +0 -5
- package/src/components/body/MRT_TableBodyRow.tsx +15 -17
- package/src/components/footer/MRT_TableFooter.tsx +1 -1
- package/src/components/footer/MRT_TableFooterCell.tsx +2 -4
- package/src/components/footer/MRT_TableFooterRow.tsx +1 -0
- package/src/components/head/MRT_TableHeadCell.tsx +0 -6
- package/src/components/head/MRT_TableHeadRow.tsx +5 -1
- package/src/components/inputs/MRT_EditCellTextField.tsx +4 -1
- package/src/components/inputs/MRT_FilterTextField.tsx +1 -0
- package/src/components/menus/MRT_ColumnActionMenu.tsx +1 -0
- package/src/components/menus/MRT_FilterOptionMenu.tsx +1 -0
- package/src/components/menus/MRT_RowActionMenu.tsx +1 -0
- package/src/components/menus/MRT_ShowHideColumnsMenu.tsx +1 -0
- package/src/components/table/MRT_Table.tsx +1 -0
- package/src/components/toolbar/MRT_TablePagination.tsx +14 -5
- package/src/hooks/useMRT_TableInstance.ts +1 -42
- package/src/hooks/useMRT_TableOptions.ts +33 -0
- package/src/utils/row.utils.ts +4 -1
- package/src/utils/style.utils.ts +17 -4
- package/src/utils.ts +0 -0
package/package.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"version": "2.9.
|
2
|
+
"version": "2.9.2",
|
3
3
|
"license": "MIT",
|
4
4
|
"name": "material-react-table",
|
5
5
|
"description": "A fully featured Material UI V5 implementation of TanStack React Table V8, written from the ground up in TypeScript.",
|
@@ -61,14 +61,14 @@
|
|
61
61
|
"storybook:dev": "storybook dev -p 6006"
|
62
62
|
},
|
63
63
|
"devDependencies": {
|
64
|
-
"@babel/core": "^7.23.
|
64
|
+
"@babel/core": "^7.23.9",
|
65
65
|
"@babel/preset-react": "^7.23.3",
|
66
66
|
"@emotion/react": "^11.11.3",
|
67
67
|
"@emotion/styled": "^11.11.0",
|
68
|
-
"@faker-js/faker": "^8.
|
69
|
-
"@mui/icons-material": "^5.15.
|
70
|
-
"@mui/material": "^5.15.
|
71
|
-
"@mui/x-date-pickers": "^6.19.
|
68
|
+
"@faker-js/faker": "^8.4.0",
|
69
|
+
"@mui/icons-material": "^5.15.6",
|
70
|
+
"@mui/material": "^5.15.6",
|
71
|
+
"@mui/x-date-pickers": "^6.19.2",
|
72
72
|
"@rollup/plugin-typescript": "^11.1.6",
|
73
73
|
"@size-limit/preset-small-lib": "^11.0.2",
|
74
74
|
"@storybook/addon-a11y": "^7.6.10",
|
@@ -80,11 +80,11 @@
|
|
80
80
|
"@storybook/react": "^7.6.10",
|
81
81
|
"@storybook/react-vite": "^7.6.10",
|
82
82
|
"@storybook/testing-library": "^0.2.2",
|
83
|
-
"@types/node": "^20.11.
|
83
|
+
"@types/node": "^20.11.6",
|
84
84
|
"@types/react": "^18.2.48",
|
85
85
|
"@types/react-dom": "^18.2.18",
|
86
|
-
"@typescript-eslint/eslint-plugin": "^6.19.
|
87
|
-
"@typescript-eslint/parser": "^6.19.
|
86
|
+
"@typescript-eslint/eslint-plugin": "^6.19.1",
|
87
|
+
"@typescript-eslint/parser": "^6.19.1",
|
88
88
|
"@vitejs/plugin-react": "^4.2.1",
|
89
89
|
"eslint": "^8.56.0",
|
90
90
|
"eslint-plugin-mui-path-imports": "^0.0.15",
|
@@ -115,8 +115,8 @@
|
|
115
115
|
"react-dom": ">=18.0"
|
116
116
|
},
|
117
117
|
"dependencies": {
|
118
|
-
"@tanstack/match-sorter-utils": "8.11.
|
119
|
-
"@tanstack/react-table": "8.11.
|
118
|
+
"@tanstack/match-sorter-utils": "8.11.7",
|
119
|
+
"@tanstack/react-table": "8.11.7",
|
120
120
|
"@tanstack/react-virtual": "3.0.2",
|
121
121
|
"highlight-words": "1.2.2"
|
122
122
|
}
|
@@ -241,9 +241,6 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
|
|
241
241
|
alignItems: layoutMode?.startsWith('grid') ? 'center' : undefined,
|
242
242
|
cursor:
|
243
243
|
isEditable && editDisplayMode === 'cell' ? 'pointer' : 'inherit',
|
244
|
-
justifyContent: layoutMode?.startsWith('grid')
|
245
|
-
? tableCellProps.align
|
246
|
-
: undefined,
|
247
244
|
overflow: 'hidden',
|
248
245
|
p:
|
249
246
|
density === 'compact'
|
@@ -260,8 +257,6 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
|
|
260
257
|
textOverflow: columnDefType !== 'display' ? 'ellipsis' : undefined,
|
261
258
|
whiteSpace:
|
262
259
|
row.getIsPinned() || density === 'compact' ? 'nowrap' : 'normal',
|
263
|
-
zIndex:
|
264
|
-
draggingColumn?.id === column.id ? 2 : column.getIsPinned() ? 1 : 0,
|
265
260
|
...getCommonMRTCellStyles({
|
266
261
|
column,
|
267
262
|
table,
|
@@ -21,9 +21,9 @@ import {
|
|
21
21
|
} from '../../types';
|
22
22
|
import { getIsRowSelected } from '../../utils/row.utils';
|
23
23
|
import {
|
24
|
+
commonCellBeforeAfterStyles,
|
24
25
|
getCommonPinnedCellStyles,
|
25
26
|
getMRTTheme,
|
26
|
-
pinnedBeforeAfterStyles,
|
27
27
|
} from '../../utils/style.utils';
|
28
28
|
import { parseFromValuesOrFunc } from '../../utils/utils';
|
29
29
|
|
@@ -176,14 +176,12 @@ export const MRT_TableBodyRow = <TData extends MRT_RowData>({
|
|
176
176
|
...tableRowProps?.style,
|
177
177
|
}}
|
178
178
|
sx={(theme: Theme) => ({
|
179
|
-
'&:hover td':
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
},
|
186
|
-
},
|
179
|
+
'&:hover td:after': cellHighlightColorHover
|
180
|
+
? {
|
181
|
+
backgroundColor: alpha(cellHighlightColorHover, 0.3),
|
182
|
+
...commonCellBeforeAfterStyles,
|
183
|
+
}
|
184
|
+
: undefined,
|
187
185
|
backgroundColor: `${baseBackgroundColor} !important`,
|
188
186
|
bottom:
|
189
187
|
!virtualRow && bottomPinnedIndex !== undefined && isRowPinned
|
@@ -199,14 +197,16 @@ export const MRT_TableBodyRow = <TData extends MRT_RowData>({
|
|
199
197
|
? 'absolute'
|
200
198
|
: rowPinningDisplayMode?.includes('sticky') && isRowPinned
|
201
199
|
? 'sticky'
|
202
|
-
:
|
200
|
+
: 'relative',
|
203
201
|
td: {
|
204
|
-
'&:after': {
|
205
|
-
backgroundColor: cellHighlightColor,
|
206
|
-
...pinnedBeforeAfterStyles,
|
207
|
-
},
|
208
202
|
...getCommonPinnedCellStyles({ table, theme }),
|
209
203
|
},
|
204
|
+
'td:after': cellHighlightColor
|
205
|
+
? {
|
206
|
+
backgroundColor: cellHighlightColor,
|
207
|
+
...commonCellBeforeAfterStyles,
|
208
|
+
}
|
209
|
+
: undefined,
|
210
210
|
top: virtualRow
|
211
211
|
? 0
|
212
212
|
: topPinnedIndex !== undefined && isRowPinned
|
@@ -218,9 +218,7 @@ export const MRT_TableBodyRow = <TData extends MRT_RowData>({
|
|
218
218
|
transition: virtualRow ? 'none' : 'all 150ms ease-in-out',
|
219
219
|
width: '100%',
|
220
220
|
zIndex:
|
221
|
-
rowPinningDisplayMode?.includes('sticky') && isRowPinned
|
222
|
-
? 2
|
223
|
-
: undefined,
|
221
|
+
rowPinningDisplayMode?.includes('sticky') && isRowPinned ? 2 : 0,
|
224
222
|
...(sx as any),
|
225
223
|
})}
|
226
224
|
>
|
@@ -54,7 +54,7 @@ export const MRT_TableFooter = <TData extends MRT_RowData>({
|
|
54
54
|
? `1px solid ${theme.palette.grey[300]}`
|
55
55
|
: `1px solid ${theme.palette.grey[700]}`
|
56
56
|
: undefined,
|
57
|
-
position: stickFooter ? 'sticky' :
|
57
|
+
position: stickFooter ? 'sticky' : 'relative',
|
58
58
|
zIndex: stickFooter ? 1 : undefined,
|
59
59
|
...(parseFromValuesOrFunc(tableFooterProps?.sx, theme) as any),
|
60
60
|
})}
|
@@ -23,7 +23,7 @@ export const MRT_TableFooterCell = <TData extends MRT_RowData>({
|
|
23
23
|
const theme = useTheme();
|
24
24
|
const {
|
25
25
|
getState,
|
26
|
-
options: { enableColumnPinning,
|
26
|
+
options: { enableColumnPinning, muiTableFooterCellProps },
|
27
27
|
} = table;
|
28
28
|
const { density } = getState();
|
29
29
|
const { column } = footer;
|
@@ -57,9 +57,7 @@ export const MRT_TableFooterCell = <TData extends MRT_RowData>({
|
|
57
57
|
variant="footer"
|
58
58
|
{...tableCellProps}
|
59
59
|
sx={(theme) => ({
|
60
|
-
display: layoutMode?.startsWith('grid') ? 'grid' : undefined,
|
61
60
|
fontWeight: 'bold',
|
62
|
-
justifyContent: columnDefType === 'group' ? 'center' : undefined,
|
63
61
|
p:
|
64
62
|
density === 'compact'
|
65
63
|
? '0.5rem'
|
@@ -67,9 +65,9 @@ export const MRT_TableFooterCell = <TData extends MRT_RowData>({
|
|
67
65
|
? '1rem'
|
68
66
|
: '1.5rem',
|
69
67
|
verticalAlign: 'top',
|
70
|
-
zIndex: column.getIsPinned() && columnDefType !== 'group' ? 2 : 1,
|
71
68
|
...getCommonMRTCellStyles({
|
72
69
|
column,
|
70
|
+
header: footer,
|
73
71
|
table,
|
74
72
|
tableCellProps,
|
75
73
|
theme,
|
@@ -55,6 +55,7 @@ export const MRT_TableFooterRow = <TData extends MRT_RowData>({
|
|
55
55
|
sx={(theme) => ({
|
56
56
|
backgroundColor: getMRTTheme(table, theme).baseBackgroundColor,
|
57
57
|
display: layoutMode?.startsWith('grid') ? 'flex' : undefined,
|
58
|
+
position: 'relative',
|
58
59
|
width: '100%',
|
59
60
|
...(parseFromValuesOrFunc(tableRowProps?.sx, theme) as any),
|
60
61
|
})}
|
@@ -197,12 +197,6 @@ export const MRT_TableHeadCell = <TData extends MRT_RowData>({
|
|
197
197
|
: '1.25rem',
|
198
198
|
userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined,
|
199
199
|
verticalAlign: 'top',
|
200
|
-
zIndex:
|
201
|
-
column.getIsResizing() || draggingColumn?.id === column.id
|
202
|
-
? 3
|
203
|
-
: column.getIsPinned() && columnDefType !== 'group'
|
204
|
-
? 2
|
205
|
-
: 1,
|
206
200
|
...getCommonMRTCellStyles({
|
207
201
|
column,
|
208
202
|
header,
|
@@ -25,7 +25,7 @@ export const MRT_TableHeadRow = <TData extends MRT_RowData>({
|
|
25
25
|
...rest
|
26
26
|
}: Props<TData>) => {
|
27
27
|
const {
|
28
|
-
options: { layoutMode, muiTableHeadRowProps },
|
28
|
+
options: { enableStickyHeader, layoutMode, muiTableHeadRowProps },
|
29
29
|
} = table;
|
30
30
|
|
31
31
|
const { virtualColumns, virtualPaddingLeft, virtualPaddingRight } =
|
@@ -46,6 +46,10 @@ export const MRT_TableHeadRow = <TData extends MRT_RowData>({
|
|
46
46
|
backgroundColor: getMRTTheme(table, theme).baseBackgroundColor,
|
47
47
|
boxShadow: `4px 0 8px ${alpha(theme.palette.common.black, 0.1)}`,
|
48
48
|
display: layoutMode?.startsWith('grid') ? 'flex' : undefined,
|
49
|
+
position:
|
50
|
+
enableStickyHeader && layoutMode === 'semantic'
|
51
|
+
? 'sticky'
|
52
|
+
: 'relative',
|
49
53
|
top: 0,
|
50
54
|
...(parseFromValuesOrFunc(tableRowProps?.sx, theme) as any),
|
51
55
|
})}
|
@@ -148,8 +148,11 @@ export const MRT_EditCellTextField = <TData extends MRT_RowData>({
|
|
148
148
|
) as any),
|
149
149
|
}),
|
150
150
|
}}
|
151
|
+
SelectProps={{
|
152
|
+
MenuProps: { disableScrollLock: true },
|
153
|
+
}}
|
151
154
|
inputProps={{
|
152
|
-
autoComplete: 'new-password', //
|
155
|
+
autoComplete: 'new-password', //disable autocomplete and autofill
|
153
156
|
...textFieldProps.inputProps,
|
154
157
|
}}
|
155
158
|
onBlur={handleBlur}
|
@@ -468,6 +468,7 @@ export const MRT_FilterTextField = <TData extends MRT_RowData>({
|
|
468
468
|
select={isSelectFilter || isMultiSelectFilter}
|
469
469
|
{...commonTextFieldProps}
|
470
470
|
SelectProps={{
|
471
|
+
MenuProps: { disableScrollLock: true },
|
471
472
|
displayEmpty: true,
|
472
473
|
multiple: isMultiSelectFilter,
|
473
474
|
renderValue: isMultiSelectFilter
|
@@ -252,6 +252,7 @@ export const MRT_FilterOptionMenu = <TData extends MRT_RowData>({
|
|
252
252
|
}}
|
253
253
|
anchorEl={anchorEl}
|
254
254
|
anchorOrigin={{ horizontal: 'right', vertical: 'center' }}
|
255
|
+
disableScrollLock
|
255
256
|
onClose={() => setAnchorEl(null)}
|
256
257
|
open={!!anchorEl}
|
257
258
|
{...rest}
|
@@ -67,6 +67,7 @@ export const MRT_Table = <TData extends MRT_RowData>({
|
|
67
67
|
sx={(theme) => ({
|
68
68
|
borderCollapse: 'separate',
|
69
69
|
display: layoutMode?.startsWith('grid') ? 'grid' : undefined,
|
70
|
+
position: 'relative',
|
70
71
|
...(parseFromValuesOrFunc(tableProps?.sx, theme) as any),
|
71
72
|
})}
|
72
73
|
>
|
@@ -8,6 +8,7 @@ import Select, { type SelectProps } from '@mui/material/Select';
|
|
8
8
|
import Tooltip from '@mui/material/Tooltip';
|
9
9
|
import Typography from '@mui/material/Typography';
|
10
10
|
import { useTheme } from '@mui/material/styles';
|
11
|
+
import useMediaQuery from '@mui/material/useMediaQuery';
|
11
12
|
import { type MRT_RowData, type MRT_TableInstance } from '../../types';
|
12
13
|
import { flipIconStyles, getCommonTooltipProps } from '../../utils/style.utils';
|
13
14
|
import { parseFromValuesOrFunc } from '../../utils/utils';
|
@@ -33,6 +34,7 @@ export const MRT_TablePagination = <TData extends MRT_RowData>({
|
|
33
34
|
...rest
|
34
35
|
}: Props<TData>) => {
|
35
36
|
const theme = useTheme();
|
37
|
+
const isMobile = useMediaQuery('(max-width: 720px)');
|
36
38
|
|
37
39
|
const {
|
38
40
|
getPrePaginationRowModel,
|
@@ -67,18 +69,22 @@ export const MRT_TablePagination = <TData extends MRT_RowData>({
|
|
67
69
|
const lastRowIndex = Math.min(pageIndex * pageSize + pageSize, totalRowCount);
|
68
70
|
|
69
71
|
const {
|
70
|
-
SelectProps,
|
72
|
+
SelectProps = {},
|
71
73
|
disabled = false,
|
72
74
|
rowsPerPageOptions = defaultRowsPerPage,
|
73
75
|
showFirstButton = showFirstLastPageButtons,
|
74
76
|
showLastButton = showFirstLastPageButtons,
|
75
77
|
showRowsPerPage = true,
|
76
|
-
...
|
78
|
+
...restPaginationProps
|
77
79
|
} = paginationProps ?? {};
|
78
80
|
|
79
81
|
const disableBack = pageIndex <= 0 || disabled;
|
80
82
|
const disableNext = lastRowIndex >= totalRowCount || disabled;
|
81
83
|
|
84
|
+
if (isMobile && SelectProps?.native !== false) {
|
85
|
+
SelectProps.native = true;
|
86
|
+
}
|
87
|
+
|
82
88
|
const tooltipProps = getCommonTooltipProps();
|
83
89
|
|
84
90
|
return (
|
@@ -109,10 +115,13 @@ export const MRT_TablePagination = <TData extends MRT_RowData>({
|
|
109
115
|
{localization.rowsPerPage}
|
110
116
|
</InputLabel>
|
111
117
|
<Select
|
118
|
+
MenuProps={{ disableScrollLock: true }}
|
112
119
|
disableUnderline
|
113
120
|
disabled={disabled}
|
114
|
-
|
115
|
-
|
121
|
+
inputProps={{
|
122
|
+
'aria-label': localization.rowsPerPage,
|
123
|
+
id: 'mrt-rows-per-page',
|
124
|
+
}}
|
116
125
|
label={localization.rowsPerPage}
|
117
126
|
onChange={(event) => setPageSize(+(event.target.value as any))}
|
118
127
|
sx={{ mb: 0 }}
|
@@ -159,7 +168,7 @@ export const MRT_TablePagination = <TData extends MRT_RowData>({
|
|
159
168
|
)}
|
160
169
|
showFirstButton={showFirstButton}
|
161
170
|
showLastButton={showLastButton}
|
162
|
-
{...
|
171
|
+
{...restPaginationProps}
|
163
172
|
/>
|
164
173
|
) : paginationDisplayMode === 'default' ? (
|
165
174
|
<>
|
@@ -1,16 +1,5 @@
|
|
1
1
|
import { useMemo, useRef, useState } from 'react';
|
2
|
-
import {
|
3
|
-
getCoreRowModel,
|
4
|
-
getExpandedRowModel,
|
5
|
-
getFacetedMinMaxValues,
|
6
|
-
getFacetedRowModel,
|
7
|
-
getFacetedUniqueValues,
|
8
|
-
getFilteredRowModel,
|
9
|
-
getGroupedRowModel,
|
10
|
-
getPaginationRowModel,
|
11
|
-
getSortedRowModel,
|
12
|
-
useReactTable,
|
13
|
-
} from '@tanstack/react-table';
|
2
|
+
import { useReactTable } from '@tanstack/react-table';
|
14
3
|
import {
|
15
4
|
type MRT_Cell,
|
16
5
|
type MRT_Column,
|
@@ -207,36 +196,6 @@ export const useMRT_TableInstance = <TData extends MRT_RowData>(
|
|
207
196
|
|
208
197
|
//@ts-ignore
|
209
198
|
const table = useReactTable({
|
210
|
-
getCoreRowModel: getCoreRowModel(),
|
211
|
-
getExpandedRowModel:
|
212
|
-
tableOptions.enableExpanding || tableOptions.enableGrouping
|
213
|
-
? getExpandedRowModel()
|
214
|
-
: undefined,
|
215
|
-
getFacetedMinMaxValues: tableOptions.enableFacetedValues
|
216
|
-
? getFacetedMinMaxValues()
|
217
|
-
: undefined,
|
218
|
-
getFacetedRowModel: tableOptions.enableFacetedValues
|
219
|
-
? getFacetedRowModel()
|
220
|
-
: undefined,
|
221
|
-
getFacetedUniqueValues: tableOptions.enableFacetedValues
|
222
|
-
? getFacetedUniqueValues()
|
223
|
-
: undefined,
|
224
|
-
getFilteredRowModel:
|
225
|
-
tableOptions.enableColumnFilters ||
|
226
|
-
tableOptions.enableGlobalFilter ||
|
227
|
-
tableOptions.enableFilters
|
228
|
-
? getFilteredRowModel()
|
229
|
-
: undefined,
|
230
|
-
getGroupedRowModel: tableOptions.enableGrouping
|
231
|
-
? getGroupedRowModel()
|
232
|
-
: undefined,
|
233
|
-
getPaginationRowModel: tableOptions.enablePagination
|
234
|
-
? getPaginationRowModel()
|
235
|
-
: undefined,
|
236
|
-
getSortedRowModel: tableOptions.enableSorting
|
237
|
-
? getSortedRowModel()
|
238
|
-
: undefined,
|
239
|
-
getSubRows: (row) => row?.subRows,
|
240
199
|
onColumnOrderChange,
|
241
200
|
onColumnSizingInfoChange,
|
242
201
|
onGroupingChange,
|
@@ -1,4 +1,15 @@
|
|
1
1
|
import { useMemo } from 'react';
|
2
|
+
import {
|
3
|
+
getCoreRowModel,
|
4
|
+
getExpandedRowModel,
|
5
|
+
getFacetedMinMaxValues,
|
6
|
+
getFacetedRowModel,
|
7
|
+
getFacetedUniqueValues,
|
8
|
+
getFilteredRowModel,
|
9
|
+
getGroupedRowModel,
|
10
|
+
getPaginationRowModel,
|
11
|
+
getSortedRowModel,
|
12
|
+
} from '@tanstack/react-table';
|
2
13
|
import { useTheme } from '@mui/material/styles';
|
3
14
|
import { MRT_AggregationFns } from '../fns/aggregationFns';
|
4
15
|
import { MRT_FilterFns } from '../fns/filterFns';
|
@@ -55,6 +66,7 @@ export const useMRT_TableOptions: <TData extends MRT_RowData>(
|
|
55
66
|
enableDensityToggle = true,
|
56
67
|
enableExpandAll = true,
|
57
68
|
enableExpanding,
|
69
|
+
enableFacetedValues = false,
|
58
70
|
enableFilterMatchHighlighting = true,
|
59
71
|
enableFilters = true,
|
60
72
|
enableFullScreenToggle = true,
|
@@ -178,6 +190,7 @@ export const useMRT_TableOptions: <TData extends MRT_RowData>(
|
|
178
190
|
enableDensityToggle,
|
179
191
|
enableExpandAll,
|
180
192
|
enableExpanding,
|
193
|
+
enableFacetedValues,
|
181
194
|
enableFilterMatchHighlighting,
|
182
195
|
enableFilters,
|
183
196
|
enableFullScreenToggle,
|
@@ -199,6 +212,26 @@ export const useMRT_TableOptions: <TData extends MRT_RowData>(
|
|
199
212
|
enableToolbarInternalActions,
|
200
213
|
enableTopToolbar,
|
201
214
|
filterFns,
|
215
|
+
getCoreRowModel: getCoreRowModel(),
|
216
|
+
getExpandedRowModel:
|
217
|
+
enableExpanding || enableGrouping ? getExpandedRowModel() : undefined,
|
218
|
+
getFacetedMinMaxValues: enableFacetedValues
|
219
|
+
? getFacetedMinMaxValues()
|
220
|
+
: undefined,
|
221
|
+
getFacetedRowModel: enableFacetedValues ? getFacetedRowModel() : undefined,
|
222
|
+
getFacetedUniqueValues: enableFacetedValues
|
223
|
+
? getFacetedUniqueValues()
|
224
|
+
: undefined,
|
225
|
+
getFilteredRowModel:
|
226
|
+
enableColumnFilters || enableGlobalFilter || enableFilters
|
227
|
+
? getFilteredRowModel()
|
228
|
+
: undefined,
|
229
|
+
getGroupedRowModel: enableGrouping ? getGroupedRowModel() : undefined,
|
230
|
+
getPaginationRowModel: enablePagination
|
231
|
+
? getPaginationRowModel()
|
232
|
+
: undefined,
|
233
|
+
getSortedRowModel: enableSorting ? getSortedRowModel() : undefined,
|
234
|
+
getSubRows: (row) => row?.subRows,
|
202
235
|
icons,
|
203
236
|
layoutMode,
|
204
237
|
localization,
|
package/src/utils/row.utils.ts
CHANGED
@@ -12,7 +12,10 @@ export const getIsRowSelected = <TData extends MRT_RowData>({
|
|
12
12
|
row: MRT_Row<TData>;
|
13
13
|
table: MRT_TableInstance<TData>;
|
14
14
|
}) => {
|
15
|
-
const {
|
15
|
+
const {
|
16
|
+
options: { enableRowSelection },
|
17
|
+
} = table;
|
18
|
+
|
16
19
|
return (
|
17
20
|
row.getIsSelected() ||
|
18
21
|
(parseFromValuesOrFunc(enableRowSelection, row) &&
|
package/src/utils/style.utils.ts
CHANGED
@@ -42,7 +42,7 @@ export const getMRTTheme = <TData extends MRT_RowData>(
|
|
42
42
|
};
|
43
43
|
};
|
44
44
|
|
45
|
-
export const
|
45
|
+
export const commonCellBeforeAfterStyles = {
|
46
46
|
content: '""',
|
47
47
|
height: '100%',
|
48
48
|
left: 0,
|
@@ -79,7 +79,7 @@ export const getCommonPinnedCellStyles = <TData extends MRT_RowData>({
|
|
79
79
|
? `4px 0 4px -4px ${alpha(theme.palette.grey[700], 0.5)} inset`
|
80
80
|
: undefined
|
81
81
|
: undefined,
|
82
|
-
...
|
82
|
+
...commonCellBeforeAfterStyles,
|
83
83
|
},
|
84
84
|
},
|
85
85
|
};
|
@@ -99,9 +99,12 @@ export const getCommonMRTCellStyles = <TData extends MRT_RowData>({
|
|
99
99
|
theme: Theme;
|
100
100
|
}) => {
|
101
101
|
const {
|
102
|
+
getState,
|
102
103
|
options: { enableColumnVirtualization, layoutMode },
|
103
104
|
} = table;
|
105
|
+
const { draggingColumn } = getState();
|
104
106
|
const { columnDef } = column;
|
107
|
+
const { columnDefType } = columnDef;
|
105
108
|
|
106
109
|
const isColumnPinned =
|
107
110
|
columnDef.columnDefType !== 'group' && column.getIsPinned();
|
@@ -140,7 +143,6 @@ export const getCommonMRTCellStyles = <TData extends MRT_RowData>({
|
|
140
143
|
isColumnPinned === 'right'
|
141
144
|
? `${getTotalRight(table, column)}px`
|
142
145
|
: undefined,
|
143
|
-
zIndex: 1,
|
144
146
|
}
|
145
147
|
: {};
|
146
148
|
|
@@ -148,6 +150,12 @@ export const getCommonMRTCellStyles = <TData extends MRT_RowData>({
|
|
148
150
|
backgroundColor: 'inherit',
|
149
151
|
backgroundImage: 'inherit',
|
150
152
|
display: layoutMode?.startsWith('grid') ? 'flex' : undefined,
|
153
|
+
justifyContent:
|
154
|
+
columnDefType === 'group'
|
155
|
+
? 'center'
|
156
|
+
: layoutMode?.startsWith('grid')
|
157
|
+
? tableCellProps.align
|
158
|
+
: undefined,
|
151
159
|
opacity:
|
152
160
|
table.getState().draggingColumn?.id === column.id ||
|
153
161
|
table.getState().hoveredColumn?.id === column.id
|
@@ -157,7 +165,12 @@ export const getCommonMRTCellStyles = <TData extends MRT_RowData>({
|
|
157
165
|
transition: enableColumnVirtualization
|
158
166
|
? 'none'
|
159
167
|
: `padding 150ms ease-in-out`,
|
160
|
-
zIndex:
|
168
|
+
zIndex:
|
169
|
+
column.getIsResizing() || draggingColumn?.id === column.id
|
170
|
+
? 2
|
171
|
+
: columnDefType !== 'group' && isColumnPinned
|
172
|
+
? 1
|
173
|
+
: 0,
|
161
174
|
...pinnedStyles,
|
162
175
|
...widthStyles,
|
163
176
|
...(parseFromValuesOrFunc(tableCellProps?.sx, theme) as any),
|
package/src/utils.ts
DELETED
File without changes
|