material-react-table 3.0.0-alpha.0 → 3.0.0-beta.0
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/index.d.ts +51 -5
- package/dist/index.esm.js +167 -54
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +167 -53
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/body/MRT_TableBodyCell.tsx +15 -1
- package/src/components/body/MRT_TableBodyRow.tsx +3 -2
- package/src/components/buttons/MRT_ToggleRowActionMenuButton.tsx +5 -1
- package/src/components/footer/MRT_TableFooter.tsx +17 -2
- package/src/components/footer/MRT_TableFooterCell.tsx +14 -1
- package/src/components/head/MRT_TableHeadCell.tsx +11 -0
- package/src/components/menus/MRT_RowActionMenu.tsx +26 -16
- package/src/fns/filterFns.ts +43 -35
- package/src/hooks/useMRT_TableOptions.ts +2 -0
- package/src/types.ts +49 -7
- package/src/utils/cell.utils.ts +75 -0
- package/src/utils/style.utils.ts +5 -0
package/package.json
CHANGED
@@ -16,7 +16,11 @@ import {
|
|
16
16
|
type MRT_RowData,
|
17
17
|
type MRT_TableInstance,
|
18
18
|
} from '../../types';
|
19
|
-
import {
|
19
|
+
import {
|
20
|
+
isCellEditable,
|
21
|
+
cellNavigation,
|
22
|
+
openEditingCell,
|
23
|
+
} from '../../utils/cell.utils';
|
20
24
|
import { getCommonMRTCellStyles } from '../../utils/style.utils';
|
21
25
|
import { parseFromValuesOrFunc } from '../../utils/utils';
|
22
26
|
import { MRT_CopyButton } from '../buttons/MRT_CopyButton';
|
@@ -54,6 +58,7 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
|
|
54
58
|
enableColumnOrdering,
|
55
59
|
enableColumnPinning,
|
56
60
|
enableGrouping,
|
61
|
+
enableCellNavigation,
|
57
62
|
layoutMode,
|
58
63
|
mrtTheme: { draggingBorderColor },
|
59
64
|
muiSkeletonProps,
|
@@ -227,12 +232,21 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
|
|
227
232
|
}
|
228
233
|
};
|
229
234
|
|
235
|
+
const handleKeyDown = (e: React.KeyboardEvent<HTMLTableCellElement>) => {
|
236
|
+
if (enableCellNavigation) {
|
237
|
+
cellNavigation(e);
|
238
|
+
}
|
239
|
+
tableCellProps?.onKeyDown?.(e);
|
240
|
+
};
|
241
|
+
|
230
242
|
return (
|
231
243
|
<TableCell
|
232
244
|
align={theme.direction === 'rtl' ? 'right' : 'left'}
|
233
245
|
data-index={staticColumnIndex}
|
234
246
|
data-pinned={!!isColumnPinned || undefined}
|
247
|
+
tabIndex={enableCellNavigation ? 0 : undefined}
|
235
248
|
{...tableCellProps}
|
249
|
+
onKeyDown={handleKeyDown}
|
236
250
|
onContextMenu={handleContextMenu}
|
237
251
|
onDoubleClick={handleDoubleClick}
|
238
252
|
onDragEnter={handleDragEnter}
|
@@ -248,6 +248,7 @@ export const MRT_TableBodyRow = <TData extends MRT_RowData>({
|
|
248
248
|
staticRowIndex,
|
249
249
|
table,
|
250
250
|
};
|
251
|
+
const key = `${cell.id}-${staticRowIndex}`;
|
251
252
|
return cell ? (
|
252
253
|
memoMode === 'cells' &&
|
253
254
|
cell.column.columnDef.columnDefType === 'data' &&
|
@@ -255,9 +256,9 @@ export const MRT_TableBodyRow = <TData extends MRT_RowData>({
|
|
255
256
|
!draggingRow &&
|
256
257
|
editingCell?.id !== cell.id &&
|
257
258
|
editingRow?.id !== row.id ? (
|
258
|
-
<Memo_MRT_TableBodyCell key={
|
259
|
+
<Memo_MRT_TableBodyCell key={key} {...props} />
|
259
260
|
) : (
|
260
|
-
<MRT_TableBodyCell key={
|
261
|
+
<MRT_TableBodyCell key={key} {...props} />
|
261
262
|
)
|
262
263
|
) : null;
|
263
264
|
},
|
@@ -94,7 +94,11 @@ export const MRT_ToggleRowActionMenuButton = <TData extends MRT_RowData>({
|
|
94
94
|
<EditIcon />
|
95
95
|
</IconButton>
|
96
96
|
</Tooltip>
|
97
|
-
) : renderRowActionMenuItems
|
97
|
+
) : renderRowActionMenuItems?.({
|
98
|
+
row,
|
99
|
+
staticRowIndex,
|
100
|
+
table,
|
101
|
+
} as any)?.length ? (
|
98
102
|
<>
|
99
103
|
<Tooltip {...getCommonTooltipProps()} title={localization.rowActions}>
|
100
104
|
<IconButton
|
@@ -19,7 +19,6 @@ export const MRT_TableFooter = <TData extends MRT_RowData>({
|
|
19
19
|
...rest
|
20
20
|
}: MRT_TableFooterProps<TData>) => {
|
21
21
|
const {
|
22
|
-
getFooterGroups,
|
23
22
|
getState,
|
24
23
|
options: { enableStickyFooter, layoutMode, muiTableFooterProps },
|
25
24
|
refs: { tableFooterRef },
|
@@ -36,6 +35,22 @@ export const MRT_TableFooter = <TData extends MRT_RowData>({
|
|
36
35
|
const stickFooter =
|
37
36
|
(isFullScreen || enableStickyFooter) && enableStickyFooter !== false;
|
38
37
|
|
38
|
+
const footerGroups = table.getFooterGroups();
|
39
|
+
|
40
|
+
//if no footer cells at all, skip footer
|
41
|
+
if (
|
42
|
+
!footerGroups.some((footerGroup) =>
|
43
|
+
footerGroup.headers?.some(
|
44
|
+
(header) =>
|
45
|
+
(typeof header.column.columnDef.footer === 'string' &&
|
46
|
+
!!header.column.columnDef.footer) ||
|
47
|
+
header.column.columnDef.Footer,
|
48
|
+
),
|
49
|
+
)
|
50
|
+
) {
|
51
|
+
return null;
|
52
|
+
}
|
53
|
+
|
39
54
|
return (
|
40
55
|
<TableFooter
|
41
56
|
{...tableFooterProps}
|
@@ -60,7 +75,7 @@ export const MRT_TableFooter = <TData extends MRT_RowData>({
|
|
60
75
|
...(parseFromValuesOrFunc(tableFooterProps?.sx, theme) as any),
|
61
76
|
})}
|
62
77
|
>
|
63
|
-
{
|
78
|
+
{footerGroups.map((footerGroup) => (
|
64
79
|
<MRT_TableFooterRow
|
65
80
|
columnVirtualizer={columnVirtualizer}
|
66
81
|
footerGroup={footerGroup as any}
|
@@ -7,6 +7,7 @@ import {
|
|
7
7
|
} from '../../types';
|
8
8
|
import { getCommonMRTCellStyles } from '../../utils/style.utils';
|
9
9
|
import { parseFromValuesOrFunc } from '../../utils/utils';
|
10
|
+
import { cellNavigation } from '../../utils/cell.utils';
|
10
11
|
|
11
12
|
export interface MRT_TableFooterCellProps<TData extends MRT_RowData>
|
12
13
|
extends TableCellProps {
|
@@ -24,7 +25,11 @@ export const MRT_TableFooterCell = <TData extends MRT_RowData>({
|
|
24
25
|
const theme = useTheme();
|
25
26
|
const {
|
26
27
|
getState,
|
27
|
-
options: {
|
28
|
+
options: {
|
29
|
+
enableColumnPinning,
|
30
|
+
muiTableFooterCellProps,
|
31
|
+
enableCellNavigation,
|
32
|
+
},
|
28
33
|
} = table;
|
29
34
|
const { density } = getState();
|
30
35
|
const { column } = footer;
|
@@ -43,6 +48,13 @@ export const MRT_TableFooterCell = <TData extends MRT_RowData>({
|
|
43
48
|
...rest,
|
44
49
|
};
|
45
50
|
|
51
|
+
const handleKeyDown = (e: React.KeyboardEvent<HTMLTableCellElement>) => {
|
52
|
+
if (enableCellNavigation) {
|
53
|
+
cellNavigation(e);
|
54
|
+
}
|
55
|
+
tableCellProps?.onKeyDown?.(e);
|
56
|
+
};
|
57
|
+
|
46
58
|
return (
|
47
59
|
<TableCell
|
48
60
|
align={
|
@@ -57,6 +69,7 @@ export const MRT_TableFooterCell = <TData extends MRT_RowData>({
|
|
57
69
|
data-pinned={!!isColumnPinned || undefined}
|
58
70
|
variant="footer"
|
59
71
|
{...tableCellProps}
|
72
|
+
onKeyDown={handleKeyDown}
|
60
73
|
sx={(theme) => ({
|
61
74
|
fontWeight: 'bold',
|
62
75
|
p:
|
@@ -17,6 +17,7 @@ import {
|
|
17
17
|
} from '../../types';
|
18
18
|
import { getCommonMRTCellStyles } from '../../utils/style.utils';
|
19
19
|
import { parseFromValuesOrFunc } from '../../utils/utils';
|
20
|
+
import { cellNavigation } from '../../utils/cell.utils';
|
20
21
|
|
21
22
|
export interface MRT_TableHeadCellProps<TData extends MRT_RowData>
|
22
23
|
extends TableCellProps {
|
@@ -45,6 +46,7 @@ export const MRT_TableHeadCell = <TData extends MRT_RowData>({
|
|
45
46
|
enableColumnOrdering,
|
46
47
|
enableColumnPinning,
|
47
48
|
enableGrouping,
|
49
|
+
enableCellNavigation,
|
48
50
|
enableMultiSort,
|
49
51
|
layoutMode,
|
50
52
|
mrtTheme: { draggingBorderColor },
|
@@ -147,6 +149,13 @@ export const MRT_TableHeadCell = <TData extends MRT_RowData>({
|
|
147
149
|
}
|
148
150
|
};
|
149
151
|
|
152
|
+
const handleKeyDown = (e: React.KeyboardEvent<HTMLTableCellElement>) => {
|
153
|
+
if (enableCellNavigation) {
|
154
|
+
cellNavigation(e);
|
155
|
+
}
|
156
|
+
tableCellProps?.onKeyDown?.(e);
|
157
|
+
};
|
158
|
+
|
150
159
|
const HeaderElement =
|
151
160
|
parseFromValuesOrFunc(columnDef.Header, {
|
152
161
|
column,
|
@@ -185,7 +194,9 @@ export const MRT_TableHeadCell = <TData extends MRT_RowData>({
|
|
185
194
|
}
|
186
195
|
}
|
187
196
|
}}
|
197
|
+
tabIndex={enableCellNavigation ? 0 : undefined}
|
188
198
|
{...tableCellProps}
|
199
|
+
onKeyDown={handleKeyDown}
|
189
200
|
sx={(theme: Theme) => ({
|
190
201
|
'& :hover': {
|
191
202
|
'.MuiButtonBase-root': {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { type MouseEvent } from 'react';
|
1
|
+
import { ReactNode, useMemo, type MouseEvent } from 'react';
|
2
2
|
import Menu, { type MenuProps } from '@mui/material/Menu';
|
3
3
|
import { MRT_ActionMenuItem } from './MRT_ActionMenuItem';
|
4
4
|
import {
|
@@ -40,6 +40,30 @@ export const MRT_RowActionMenu = <TData extends MRT_RowData>({
|
|
40
40
|
} = table;
|
41
41
|
const { density } = getState();
|
42
42
|
|
43
|
+
const menuItems = useMemo(() => {
|
44
|
+
const items: ReactNode[] = [];
|
45
|
+
const editItem = parseFromValuesOrFunc(enableEditing, row) &&
|
46
|
+
['modal', 'row'].includes(editDisplayMode!) && (
|
47
|
+
<MRT_ActionMenuItem
|
48
|
+
icon={<EditIcon />}
|
49
|
+
label={localization.edit}
|
50
|
+
onClick={handleEdit}
|
51
|
+
table={table}
|
52
|
+
/>
|
53
|
+
);
|
54
|
+
if (editItem) items.push(editItem);
|
55
|
+
const rowActionMenuItems = renderRowActionMenuItems?.({
|
56
|
+
closeMenu: () => setAnchorEl(null),
|
57
|
+
row,
|
58
|
+
staticRowIndex,
|
59
|
+
table,
|
60
|
+
});
|
61
|
+
if (rowActionMenuItems?.length) items.push(...rowActionMenuItems);
|
62
|
+
return items;
|
63
|
+
}, [renderRowActionMenuItems, row, staticRowIndex, table]);
|
64
|
+
|
65
|
+
if (!menuItems.length) return null;
|
66
|
+
|
43
67
|
return (
|
44
68
|
<Menu
|
45
69
|
MenuListProps={{
|
@@ -55,21 +79,7 @@ export const MRT_RowActionMenu = <TData extends MRT_RowData>({
|
|
55
79
|
open={!!anchorEl}
|
56
80
|
{...rest}
|
57
81
|
>
|
58
|
-
{
|
59
|
-
['modal', 'row'].includes(editDisplayMode!) && (
|
60
|
-
<MRT_ActionMenuItem
|
61
|
-
icon={<EditIcon />}
|
62
|
-
label={localization.edit}
|
63
|
-
onClick={handleEdit}
|
64
|
-
table={table}
|
65
|
-
/>
|
66
|
-
)}
|
67
|
-
{renderRowActionMenuItems?.({
|
68
|
-
closeMenu: () => setAnchorEl(null),
|
69
|
-
row,
|
70
|
-
staticRowIndex,
|
71
|
-
table,
|
72
|
-
})}
|
82
|
+
{menuItems}
|
73
83
|
</Menu>
|
74
84
|
);
|
75
85
|
};
|
package/src/fns/filterFns.ts
CHANGED
@@ -11,10 +11,14 @@ const fuzzy = <TData extends MRT_RowData>(
|
|
11
11
|
columnId: string,
|
12
12
|
filterValue: number | string,
|
13
13
|
addMeta: (item: RankingInfo) => void,
|
14
|
-
) => {
|
15
|
-
const itemRank = rankItem(
|
16
|
-
|
17
|
-
|
14
|
+
): boolean => {
|
15
|
+
const itemRank = rankItem(
|
16
|
+
row.getValue<string | number | null>(columnId),
|
17
|
+
filterValue as string,
|
18
|
+
{
|
19
|
+
threshold: rankings.MATCHES,
|
20
|
+
},
|
21
|
+
);
|
18
22
|
addMeta(itemRank);
|
19
23
|
return itemRank.passed;
|
20
24
|
};
|
@@ -25,10 +29,10 @@ const contains = <TData extends MRT_RowData>(
|
|
25
29
|
row: Row<TData>,
|
26
30
|
id: string,
|
27
31
|
filterValue: number | string,
|
28
|
-
) =>
|
29
|
-
row
|
30
|
-
.getValue<number | string>(id)
|
31
|
-
|
32
|
+
): boolean =>
|
33
|
+
!!row
|
34
|
+
.getValue<number | string | null>(id)
|
35
|
+
?.toString()
|
32
36
|
.toLowerCase()
|
33
37
|
.trim()
|
34
38
|
.includes(filterValue.toString().toLowerCase().trim());
|
@@ -39,10 +43,10 @@ const startsWith = <TData extends MRT_RowData>(
|
|
39
43
|
row: Row<TData>,
|
40
44
|
id: string,
|
41
45
|
filterValue: number | string,
|
42
|
-
) =>
|
43
|
-
row
|
44
|
-
.getValue<number | string>(id)
|
45
|
-
|
46
|
+
): boolean =>
|
47
|
+
!!row
|
48
|
+
.getValue<number | string | null>(id)
|
49
|
+
?.toString()
|
46
50
|
.toLowerCase()
|
47
51
|
.trim()
|
48
52
|
.startsWith(filterValue.toString().toLowerCase().trim());
|
@@ -53,10 +57,10 @@ const endsWith = <TData extends MRT_RowData>(
|
|
53
57
|
row: Row<TData>,
|
54
58
|
id: string,
|
55
59
|
filterValue: number | string,
|
56
|
-
) =>
|
57
|
-
row
|
58
|
-
.getValue<number | string>(id)
|
59
|
-
|
60
|
+
): boolean =>
|
61
|
+
!!row
|
62
|
+
.getValue<number | string | null>(id)
|
63
|
+
?.toString()
|
60
64
|
.toLowerCase()
|
61
65
|
.trim()
|
62
66
|
.endsWith(filterValue.toString().toLowerCase().trim());
|
@@ -67,9 +71,9 @@ const equals = <TData extends MRT_RowData>(
|
|
67
71
|
row: Row<TData>,
|
68
72
|
id: string,
|
69
73
|
filterValue: number | string,
|
70
|
-
) =>
|
71
|
-
row.getValue<number | string>(id)
|
72
|
-
filterValue
|
74
|
+
): boolean =>
|
75
|
+
row.getValue<number | string | null>(id)?.toString().toLowerCase().trim() ===
|
76
|
+
filterValue.toString().toLowerCase().trim();
|
73
77
|
|
74
78
|
equals.autoRemove = (val: any) => !val;
|
75
79
|
|
@@ -77,8 +81,8 @@ const notEquals = <TData extends MRT_RowData>(
|
|
77
81
|
row: Row<TData>,
|
78
82
|
id: string,
|
79
83
|
filterValue: number | string,
|
80
|
-
) =>
|
81
|
-
row.getValue<number | string>(id)
|
84
|
+
): boolean =>
|
85
|
+
row.getValue<number | string | null>(id)?.toString().toLowerCase().trim() !==
|
82
86
|
filterValue.toString().toLowerCase().trim();
|
83
87
|
|
84
88
|
notEquals.autoRemove = (val: any) => !val;
|
@@ -87,11 +91,13 @@ const greaterThan = <TData extends MRT_RowData>(
|
|
87
91
|
row: Row<TData>,
|
88
92
|
id: string,
|
89
93
|
filterValue: number | string,
|
90
|
-
) =>
|
94
|
+
): boolean =>
|
91
95
|
!isNaN(+filterValue) && !isNaN(+row.getValue<number | string>(id))
|
92
|
-
? +row.getValue<number | string>(id) > +filterValue
|
93
|
-
: row.getValue<number | string>(id)
|
94
|
-
|
96
|
+
? +(row.getValue<number | string | null>(id) ?? 0) > +filterValue
|
97
|
+
: (row.getValue<number | string | null>(id) ?? '')
|
98
|
+
?.toString()
|
99
|
+
.toLowerCase()
|
100
|
+
.trim() > filterValue.toString().toLowerCase().trim();
|
95
101
|
|
96
102
|
greaterThan.autoRemove = (val: any) => !val;
|
97
103
|
|
@@ -99,7 +105,7 @@ const greaterThanOrEqualTo = <TData extends MRT_RowData>(
|
|
99
105
|
row: Row<TData>,
|
100
106
|
id: string,
|
101
107
|
filterValue: number | string,
|
102
|
-
) => equals(row, id, filterValue) || greaterThan(row, id, filterValue);
|
108
|
+
): boolean => equals(row, id, filterValue) || greaterThan(row, id, filterValue);
|
103
109
|
|
104
110
|
greaterThanOrEqualTo.autoRemove = (val: any) => !val;
|
105
111
|
|
@@ -107,11 +113,13 @@ const lessThan = <TData extends MRT_RowData>(
|
|
107
113
|
row: Row<TData>,
|
108
114
|
id: string,
|
109
115
|
filterValue: number | string,
|
110
|
-
) =>
|
116
|
+
): boolean =>
|
111
117
|
!isNaN(+filterValue) && !isNaN(+row.getValue<number | string>(id))
|
112
|
-
? +row.getValue<number | string>(id) < +filterValue
|
113
|
-
: row.getValue<number | string>(id)
|
114
|
-
|
118
|
+
? +(row.getValue<number | string | null>(id) ?? 0) < +filterValue
|
119
|
+
: (row.getValue<number | string | null>(id) ?? '')
|
120
|
+
?.toString()
|
121
|
+
.toLowerCase()
|
122
|
+
.trim() < filterValue.toString().toLowerCase().trim();
|
115
123
|
|
116
124
|
lessThan.autoRemove = (val: any) => !val;
|
117
125
|
|
@@ -119,7 +127,7 @@ const lessThanOrEqualTo = <TData extends MRT_RowData>(
|
|
119
127
|
row: Row<TData>,
|
120
128
|
id: string,
|
121
129
|
filterValue: number | string,
|
122
|
-
) => equals(row, id, filterValue) || lessThan(row, id, filterValue);
|
130
|
+
): boolean => equals(row, id, filterValue) || lessThan(row, id, filterValue);
|
123
131
|
|
124
132
|
lessThanOrEqualTo.autoRemove = (val: any) => !val;
|
125
133
|
|
@@ -127,7 +135,7 @@ const between = <TData extends MRT_RowData>(
|
|
127
135
|
row: Row<TData>,
|
128
136
|
id: string,
|
129
137
|
filterValues: [number | string, number | string],
|
130
|
-
) =>
|
138
|
+
): boolean =>
|
131
139
|
((['', undefined] as any[]).includes(filterValues[0]) ||
|
132
140
|
greaterThan(row, id, filterValues[0])) &&
|
133
141
|
((!isNaN(+filterValues[0]) &&
|
@@ -142,7 +150,7 @@ const betweenInclusive = <TData extends MRT_RowData>(
|
|
142
150
|
row: Row<TData>,
|
143
151
|
id: string,
|
144
152
|
filterValues: [number | string, number | string],
|
145
|
-
) =>
|
153
|
+
): boolean =>
|
146
154
|
((['', undefined] as any[]).includes(filterValues[0]) ||
|
147
155
|
greaterThanOrEqualTo(row, id, filterValues[0])) &&
|
148
156
|
((!isNaN(+filterValues[0]) &&
|
@@ -157,7 +165,7 @@ const empty = <TData extends MRT_RowData>(
|
|
157
165
|
row: Row<TData>,
|
158
166
|
id: string,
|
159
167
|
_filterValue: number | string,
|
160
|
-
) => !row.getValue<number | string>(id)
|
168
|
+
): boolean => !row.getValue<number | string | null>(id)?.toString().trim();
|
161
169
|
|
162
170
|
empty.autoRemove = (val: any) => !val;
|
163
171
|
|
@@ -165,7 +173,7 @@ const notEmpty = <TData extends MRT_RowData>(
|
|
165
173
|
row: Row<TData>,
|
166
174
|
id: string,
|
167
175
|
_filterValue: number | string,
|
168
|
-
) => !!row.getValue<number | string>(id)
|
176
|
+
): boolean => !!row.getValue<number | string | null>(id)?.toString().trim();
|
169
177
|
|
170
178
|
notEmpty.autoRemove = (val: any) => !val;
|
171
179
|
|
@@ -76,6 +76,7 @@ export const useMRT_TableOptions: <TData extends MRT_RowData>(
|
|
76
76
|
enableGlobalFilterRankedResults = true,
|
77
77
|
enableGrouping = false,
|
78
78
|
enableHiding = true,
|
79
|
+
enableCellNavigation = true,
|
79
80
|
enableMultiRowSelection = true,
|
80
81
|
enableMultiSort = true,
|
81
82
|
enablePagination = true,
|
@@ -203,6 +204,7 @@ export const useMRT_TableOptions: <TData extends MRT_RowData>(
|
|
203
204
|
enableGlobalFilterRankedResults,
|
204
205
|
enableGrouping,
|
205
206
|
enableHiding,
|
207
|
+
enableCellNavigation,
|
206
208
|
enableMultiRowSelection,
|
207
209
|
enableMultiSort,
|
208
210
|
enablePagination,
|
package/src/types.ts
CHANGED
@@ -246,6 +246,7 @@ export interface MRT_Localization {
|
|
246
246
|
|
247
247
|
export interface MRT_Theme {
|
248
248
|
baseBackgroundColor: string;
|
249
|
+
cellNavigationOutlineColor: string;
|
249
250
|
draggingBorderColor: string;
|
250
251
|
matchHighlightColor: string;
|
251
252
|
menuBackgroundColor: string;
|
@@ -270,6 +271,7 @@ export type MRT_TableInstance<TData extends MRT_RowData> = Omit<
|
|
270
271
|
| 'getColumn'
|
271
272
|
| 'getExpandedRowModel'
|
272
273
|
| 'getFlatHeaders'
|
274
|
+
| 'getFooterGroups'
|
273
275
|
| 'getHeaderGroups'
|
274
276
|
| 'getLeafHeaders'
|
275
277
|
| 'getLeftLeafColumns'
|
@@ -292,6 +294,7 @@ export type MRT_TableInstance<TData extends MRT_RowData> = Omit<
|
|
292
294
|
getColumn: (columnId: string) => MRT_Column<TData>;
|
293
295
|
getExpandedRowModel: () => MRT_RowModel<TData>;
|
294
296
|
getFlatHeaders: () => MRT_Header<TData>[];
|
297
|
+
getFooterGroups: () => MRT_HeaderGroup<TData>[];
|
295
298
|
getHeaderGroups: () => MRT_HeaderGroup<TData>[];
|
296
299
|
getLeafHeaders: () => MRT_Header<TData>[];
|
297
300
|
getLeftLeafColumns: () => MRT_Column<TData>[];
|
@@ -810,9 +813,7 @@ export interface MRT_TableOptions<TData extends MRT_RowData>
|
|
810
813
|
columnFilterModeOptions?: Array<
|
811
814
|
LiteralUnion<string & MRT_FilterOption>
|
812
815
|
> | null;
|
813
|
-
columnVirtualizerInstanceRef?: MutableRefObject<
|
814
|
-
MRT_ColumnVirtualizer | null
|
815
|
-
>;
|
816
|
+
columnVirtualizerInstanceRef?: MutableRefObject<MRT_ColumnVirtualizer | null>;
|
816
817
|
columnVirtualizerOptions?:
|
817
818
|
| ((props: {
|
818
819
|
table: MRT_TableInstance<TData>;
|
@@ -869,6 +870,7 @@ export interface MRT_TableOptions<TData extends MRT_RowData>
|
|
869
870
|
enableFullScreenToggle?: boolean;
|
870
871
|
enableGlobalFilterModes?: boolean;
|
871
872
|
enableGlobalFilterRankedResults?: boolean;
|
873
|
+
enableCellNavigation?: boolean;
|
872
874
|
enablePagination?: boolean;
|
873
875
|
enableRowActions?: boolean;
|
874
876
|
enableRowDragging?: boolean;
|
@@ -920,18 +922,27 @@ export interface MRT_TableOptions<TData extends MRT_RowData>
|
|
920
922
|
table: MRT_TableInstance<TData>;
|
921
923
|
}) => CircularProgressProps & { Component?: ReactNode })
|
922
924
|
| (CircularProgressProps & { Component?: ReactNode });
|
925
|
+
/**
|
926
|
+
* @deprecated Specify this in the `defaultColumn` table option instead if you want to apply to all columns.
|
927
|
+
*/
|
923
928
|
muiColumnActionsButtonProps?:
|
924
929
|
| ((props: {
|
925
930
|
column: MRT_Column<TData>;
|
926
931
|
table: MRT_TableInstance<TData>;
|
927
932
|
}) => IconButtonProps)
|
928
933
|
| IconButtonProps;
|
934
|
+
/**
|
935
|
+
* @deprecated Specify this in the `defaultColumn` table option instead if you want to apply to all columns.
|
936
|
+
*/
|
929
937
|
muiColumnDragHandleProps?:
|
930
938
|
| ((props: {
|
931
939
|
column: MRT_Column<TData>;
|
932
940
|
table: MRT_TableInstance<TData>;
|
933
941
|
}) => IconButtonProps)
|
934
942
|
| IconButtonProps;
|
943
|
+
/**
|
944
|
+
* @deprecated Specify this in the `defaultColumn` table option instead if you want to apply to all columns.
|
945
|
+
*/
|
935
946
|
muiCopyButtonProps?:
|
936
947
|
| ((props: {
|
937
948
|
cell: MRT_Cell<TData>;
|
@@ -958,6 +969,9 @@ export interface MRT_TableOptions<TData extends MRT_RowData>
|
|
958
969
|
table: MRT_TableInstance<TData>;
|
959
970
|
}) => DialogProps)
|
960
971
|
| DialogProps;
|
972
|
+
/**
|
973
|
+
* @deprecated Specify this in the `defaultColumn` table option instead if you want to apply to all columns.
|
974
|
+
*/
|
961
975
|
muiEditTextFieldProps?:
|
962
976
|
| ((props: {
|
963
977
|
cell: MRT_Cell<TData>;
|
@@ -976,18 +990,27 @@ export interface MRT_TableOptions<TData extends MRT_RowData>
|
|
976
990
|
table: MRT_TableInstance<TData>;
|
977
991
|
}) => IconButtonProps)
|
978
992
|
| IconButtonProps;
|
993
|
+
/**
|
994
|
+
* @deprecated Specify this in the `defaultColumn` table option instead if you want to apply to all columns.
|
995
|
+
*/
|
979
996
|
muiFilterAutocompleteProps?:
|
980
997
|
| ((props: {
|
981
998
|
column: MRT_Column<TData>;
|
982
999
|
table: MRT_TableInstance<TData>;
|
983
1000
|
}) => AutocompleteProps<any, any, any, any>)
|
984
1001
|
| AutocompleteProps<any, any, any, any>;
|
1002
|
+
/**
|
1003
|
+
* @deprecated Specify this in the `defaultColumn` table option instead if you want to apply to all columns.
|
1004
|
+
*/
|
985
1005
|
muiFilterCheckboxProps?:
|
986
1006
|
| ((props: {
|
987
1007
|
column: MRT_Column<TData>;
|
988
1008
|
table: MRT_TableInstance<TData>;
|
989
1009
|
}) => CheckboxProps)
|
990
1010
|
| CheckboxProps;
|
1011
|
+
/**
|
1012
|
+
* @deprecated Specify this in the `defaultColumn` table option instead if you want to apply to all columns.
|
1013
|
+
*/
|
991
1014
|
muiFilterDatePickerProps?:
|
992
1015
|
| ((props: {
|
993
1016
|
column: MRT_Column<TData>;
|
@@ -995,6 +1018,9 @@ export interface MRT_TableOptions<TData extends MRT_RowData>
|
|
995
1018
|
table: MRT_TableInstance<TData>;
|
996
1019
|
}) => DatePickerProps<never>)
|
997
1020
|
| DatePickerProps<never>;
|
1021
|
+
/**
|
1022
|
+
* @deprecated Specify this in the `defaultColumn` table option instead if you want to apply to all columns.
|
1023
|
+
*/
|
998
1024
|
muiFilterDateTimePickerProps?:
|
999
1025
|
| ((props: {
|
1000
1026
|
column: MRT_Column<TData>;
|
@@ -1002,12 +1028,18 @@ export interface MRT_TableOptions<TData extends MRT_RowData>
|
|
1002
1028
|
table: MRT_TableInstance<TData>;
|
1003
1029
|
}) => DateTimePickerProps<never>)
|
1004
1030
|
| DateTimePickerProps<never>;
|
1031
|
+
/**
|
1032
|
+
* @deprecated Specify this in the `defaultColumn` table option instead if you want to apply to all columns.
|
1033
|
+
*/
|
1005
1034
|
muiFilterSliderProps?:
|
1006
1035
|
| ((props: {
|
1007
1036
|
column: MRT_Column<TData>;
|
1008
1037
|
table: MRT_TableInstance<TData>;
|
1009
1038
|
}) => SliderProps)
|
1010
1039
|
| SliderProps;
|
1040
|
+
/**
|
1041
|
+
* @deprecated Specify this in the `defaultColumn` table option instead if you want to apply to all columns.
|
1042
|
+
*/
|
1011
1043
|
muiFilterTextFieldProps?:
|
1012
1044
|
| ((props: {
|
1013
1045
|
column: MRT_Column<TData>;
|
@@ -1015,6 +1047,9 @@ export interface MRT_TableOptions<TData extends MRT_RowData>
|
|
1015
1047
|
table: MRT_TableInstance<TData>;
|
1016
1048
|
}) => TextFieldProps)
|
1017
1049
|
| TextFieldProps;
|
1050
|
+
/**
|
1051
|
+
* @deprecated Specify this in the `defaultColumn` table option instead if you want to apply to all columns.
|
1052
|
+
*/
|
1018
1053
|
muiFilterTimePickerProps?:
|
1019
1054
|
| ((props: {
|
1020
1055
|
column: MRT_Column<TData>;
|
@@ -1064,6 +1099,9 @@ export interface MRT_TableOptions<TData extends MRT_RowData>
|
|
1064
1099
|
table: MRT_TableInstance<TData>;
|
1065
1100
|
}) => CheckboxProps | RadioProps)
|
1066
1101
|
| (CheckboxProps | RadioProps);
|
1102
|
+
/**
|
1103
|
+
* @deprecated Specify this in the `defaultColumn` table option instead if you want to apply to all columns.
|
1104
|
+
*/
|
1067
1105
|
muiSkeletonProps?:
|
1068
1106
|
| ((props: {
|
1069
1107
|
cell: MRT_Cell<TData>;
|
@@ -1072,6 +1110,9 @@ export interface MRT_TableOptions<TData extends MRT_RowData>
|
|
1072
1110
|
table: MRT_TableInstance<TData>;
|
1073
1111
|
}) => SkeletonProps)
|
1074
1112
|
| SkeletonProps;
|
1113
|
+
/**
|
1114
|
+
* @deprecated Specify this in the `defaultColumn` table option instead if you want to apply to all columns.
|
1115
|
+
*/
|
1075
1116
|
muiTableBodyCellProps?:
|
1076
1117
|
| ((props: {
|
1077
1118
|
cell: MRT_Cell<TData>;
|
@@ -1109,6 +1150,9 @@ export interface MRT_TableOptions<TData extends MRT_RowData>
|
|
1109
1150
|
table: MRT_TableInstance<TData>;
|
1110
1151
|
}) => TableRowProps)
|
1111
1152
|
| TableRowProps;
|
1153
|
+
/**
|
1154
|
+
* @deprecated Specify this in the `defaultColumn` table option instead if you want to apply to all columns.
|
1155
|
+
*/
|
1112
1156
|
muiTableHeadCellProps?:
|
1113
1157
|
| ((props: {
|
1114
1158
|
column: MRT_Column<TData>;
|
@@ -1241,7 +1285,7 @@ export interface MRT_TableOptions<TData extends MRT_RowData>
|
|
1241
1285
|
row: MRT_Row<TData>;
|
1242
1286
|
staticRowIndex?: number;
|
1243
1287
|
table: MRT_TableInstance<TData>;
|
1244
|
-
}) => ReactNode[];
|
1288
|
+
}) => ReactNode[] | undefined;
|
1245
1289
|
renderRowActions?: (props: {
|
1246
1290
|
cell: MRT_Cell<TData>;
|
1247
1291
|
row: MRT_Row<TData>;
|
@@ -1271,9 +1315,7 @@ export interface MRT_TableOptions<TData extends MRT_RowData>
|
|
1271
1315
|
| 'sticky'
|
1272
1316
|
| 'top'
|
1273
1317
|
| 'top-and-bottom';
|
1274
|
-
rowVirtualizerInstanceRef?: MutableRefObject<
|
1275
|
-
MRT_RowVirtualizer | null
|
1276
|
-
>;
|
1318
|
+
rowVirtualizerInstanceRef?: MutableRefObject<MRT_RowVirtualizer | null>;
|
1277
1319
|
rowVirtualizerOptions?:
|
1278
1320
|
| ((props: {
|
1279
1321
|
table: MRT_TableInstance<TData>;
|