material-react-table 1.0.0-beta.4 → 1.0.0-beta.7
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/dist/cjs/MaterialReactTable.d.ts +2 -15
- package/dist/cjs/index.js +55 -34
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/localization.d.ts +2 -0
- package/dist/esm/MaterialReactTable.d.ts +2 -15
- package/dist/esm/localization.d.ts +2 -0
- package/dist/esm/material-react-table.esm.js +55 -34
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/index.d.ts +4 -15
- package/package.json +1 -1
- package/src/MaterialReactTable.tsx +1 -19
- package/src/body/MRT_TableBody.tsx +52 -28
- package/src/body/MRT_TableBodyRowGrabHandle.tsx +5 -8
- package/src/buttons/MRT_GrabHandleButton.tsx +2 -2
- package/src/footer/MRT_TableFooter.tsx +3 -2
- package/src/head/MRT_TableHeadCellFilterLabel.tsx +7 -7
- package/src/head/MRT_TableHeadCellGrabHandle.tsx +5 -12
- package/src/localization.ts +4 -0
- package/src/table/MRT_TablePaper.tsx +8 -0
- package/src/table/MRT_TableRoot.tsx +2 -0
- package/src/toolbar/MRT_TopToolbar.tsx +7 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MutableRefObject, Dispatch, SetStateAction, ReactNode
|
|
1
|
+
import { MutableRefObject, Dispatch, SetStateAction, ReactNode } from 'react';
|
|
2
2
|
import { ButtonProps, TextFieldProps, TableCellProps, IconButtonProps, ToolbarProps, LinearProgressProps, CheckboxProps, SkeletonProps, TableBodyProps, TableRowProps, TableContainerProps, TableFooterProps, TableHeadProps, TablePaginationProps, PaperProps, TableProps, ChipProps, AlertProps } from '@mui/material';
|
|
3
3
|
import { Row, Table, TableState, ColumnDef, DeepKeys, Column, Header, HeaderGroup, Cell, SortingFn, FilterFn, TableOptions, OnChangeFn } from '@tanstack/react-table';
|
|
4
4
|
import { Options, VirtualItem } from 'react-virtual';
|
|
@@ -154,6 +154,8 @@ interface MRT_Localization {
|
|
|
154
154
|
max: string;
|
|
155
155
|
min: string;
|
|
156
156
|
move: string;
|
|
157
|
+
noRecordsToDisplay: string;
|
|
158
|
+
noResultsFound: string;
|
|
157
159
|
or: string;
|
|
158
160
|
pinToLeft: string;
|
|
159
161
|
pinToRight: string;
|
|
@@ -231,6 +233,7 @@ declare type MRT_TableInstance<TData extends Record<string, any> = {}> = Omit<Ta
|
|
|
231
233
|
filterInputRefs: MutableRefObject<Record<string, HTMLInputElement>>;
|
|
232
234
|
searchInputRef: MutableRefObject<HTMLInputElement>;
|
|
233
235
|
tableContainerRef: MutableRefObject<HTMLDivElement>;
|
|
236
|
+
tablePaperRef: MutableRefObject<HTMLDivElement>;
|
|
234
237
|
topToolbarRef: MutableRefObject<HTMLDivElement>;
|
|
235
238
|
};
|
|
236
239
|
setColumnFilterFns: Dispatch<SetStateAction<{
|
|
@@ -630,13 +633,6 @@ declare type MaterialReactTableProps<TData extends Record<string, any> = {}> = O
|
|
|
630
633
|
muiTopToolbarProps?: ToolbarProps | (({ table }: {
|
|
631
634
|
table: MRT_TableInstance<TData>;
|
|
632
635
|
}) => ToolbarProps);
|
|
633
|
-
onColumnDrop?: ({ event, draggedColumn, targetColumn, }: {
|
|
634
|
-
event: DragEvent<HTMLButtonElement>;
|
|
635
|
-
draggedColumn: MRT_Column<TData>;
|
|
636
|
-
targetColumn: MRT_Column<TData> | {
|
|
637
|
-
id: string;
|
|
638
|
-
} | null;
|
|
639
|
-
}) => void;
|
|
640
636
|
onDensityChange?: OnChangeFn<boolean>;
|
|
641
637
|
onDraggingColumnChange?: OnChangeFn<MRT_Column<TData> | null>;
|
|
642
638
|
onDraggingRowChange?: OnChangeFn<MRT_Row<TData> | null>;
|
|
@@ -655,13 +651,6 @@ declare type MaterialReactTableProps<TData extends Record<string, any> = {}> = O
|
|
|
655
651
|
onHoveredColumnChange?: OnChangeFn<MRT_Column<TData> | null>;
|
|
656
652
|
onHoveredRowChange?: OnChangeFn<MRT_Row<TData> | null>;
|
|
657
653
|
onIsFullScreenChange?: OnChangeFn<boolean>;
|
|
658
|
-
onRowDrop?: ({ event, draggedRow, targetRow, }: {
|
|
659
|
-
event: DragEvent<HTMLButtonElement>;
|
|
660
|
-
draggedRow: MRT_Row<TData>;
|
|
661
|
-
targetRow: MRT_Row<TData> | {
|
|
662
|
-
id: string;
|
|
663
|
-
} | null;
|
|
664
|
-
}) => void;
|
|
665
654
|
onShowAlertBannerChange?: OnChangeFn<boolean>;
|
|
666
655
|
onShowFiltersChange?: OnChangeFn<boolean>;
|
|
667
656
|
onShowGlobalFilterChange?: OnChangeFn<boolean>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, {
|
|
2
2
|
Dispatch,
|
|
3
|
-
DragEvent,
|
|
4
3
|
MutableRefObject,
|
|
5
4
|
ReactNode,
|
|
6
5
|
SetStateAction,
|
|
@@ -101,6 +100,7 @@ export type MRT_TableInstance<TData extends Record<string, any> = {}> = Omit<
|
|
|
101
100
|
filterInputRefs: MutableRefObject<Record<string, HTMLInputElement>>;
|
|
102
101
|
searchInputRef: MutableRefObject<HTMLInputElement>;
|
|
103
102
|
tableContainerRef: MutableRefObject<HTMLDivElement>;
|
|
103
|
+
tablePaperRef: MutableRefObject<HTMLDivElement>;
|
|
104
104
|
topToolbarRef: MutableRefObject<HTMLDivElement>;
|
|
105
105
|
};
|
|
106
106
|
setColumnFilterFns: Dispatch<
|
|
@@ -753,15 +753,6 @@ export type MaterialReactTableProps<TData extends Record<string, any> = {}> =
|
|
|
753
753
|
muiTopToolbarProps?:
|
|
754
754
|
| ToolbarProps
|
|
755
755
|
| (({ table }: { table: MRT_TableInstance<TData> }) => ToolbarProps);
|
|
756
|
-
onColumnDrop?: ({
|
|
757
|
-
event,
|
|
758
|
-
draggedColumn,
|
|
759
|
-
targetColumn,
|
|
760
|
-
}: {
|
|
761
|
-
event: DragEvent<HTMLButtonElement>;
|
|
762
|
-
draggedColumn: MRT_Column<TData>;
|
|
763
|
-
targetColumn: MRT_Column<TData> | { id: string } | null;
|
|
764
|
-
}) => void;
|
|
765
756
|
onDensityChange?: OnChangeFn<boolean>;
|
|
766
757
|
onDraggingColumnChange?: OnChangeFn<MRT_Column<TData> | null>;
|
|
767
758
|
onDraggingRowChange?: OnChangeFn<MRT_Row<TData> | null>;
|
|
@@ -783,15 +774,6 @@ export type MaterialReactTableProps<TData extends Record<string, any> = {}> =
|
|
|
783
774
|
onHoveredColumnChange?: OnChangeFn<MRT_Column<TData> | null>;
|
|
784
775
|
onHoveredRowChange?: OnChangeFn<MRT_Row<TData> | null>;
|
|
785
776
|
onIsFullScreenChange?: OnChangeFn<boolean>;
|
|
786
|
-
onRowDrop?: ({
|
|
787
|
-
event,
|
|
788
|
-
draggedRow,
|
|
789
|
-
targetRow,
|
|
790
|
-
}: {
|
|
791
|
-
event: DragEvent<HTMLButtonElement>;
|
|
792
|
-
draggedRow: MRT_Row<TData>;
|
|
793
|
-
targetRow: MRT_Row<TData> | { id: string } | null;
|
|
794
|
-
}) => void;
|
|
795
777
|
onShowAlertBannerChange?: OnChangeFn<boolean>;
|
|
796
778
|
onShowFiltersChange?: OnChangeFn<boolean>;
|
|
797
779
|
onShowGlobalFilterChange?: OnChangeFn<boolean>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { FC, useMemo } from 'react';
|
|
2
2
|
import { useVirtual } from 'react-virtual'; //stuck on v2 for now
|
|
3
3
|
// import { useVirtualizer, Virtualizer } from '@tanstack/react-virtual';
|
|
4
|
-
import { TableBody } from '@mui/material';
|
|
4
|
+
import { TableBody, Typography } from '@mui/material';
|
|
5
5
|
import { MRT_TableBodyRow } from './MRT_TableBodyRow';
|
|
6
6
|
import { rankGlobalFuzzy } from '../sortingFns';
|
|
7
7
|
import type { MRT_Row, MRT_TableInstance } from '..';
|
|
@@ -19,15 +19,16 @@ export const MRT_TableBody: FC<Props> = ({ table }) => {
|
|
|
19
19
|
enableGlobalFilterRankedResults,
|
|
20
20
|
enablePagination,
|
|
21
21
|
enableRowVirtualization,
|
|
22
|
+
localization,
|
|
22
23
|
manualFiltering,
|
|
23
24
|
manualSorting,
|
|
24
25
|
muiTableBodyProps,
|
|
25
26
|
virtualizerInstanceRef,
|
|
26
27
|
virtualizerProps,
|
|
27
28
|
},
|
|
28
|
-
refs: { tableContainerRef },
|
|
29
|
+
refs: { tableContainerRef, tablePaperRef },
|
|
29
30
|
} = table;
|
|
30
|
-
const { globalFilter, pagination, sorting } = getState();
|
|
31
|
+
const { columnFilters, globalFilter, pagination, sorting } = getState();
|
|
31
32
|
|
|
32
33
|
const tableBodyProps =
|
|
33
34
|
muiTableBodyProps instanceof Function
|
|
@@ -116,33 +117,56 @@ export const MRT_TableBody: FC<Props> = ({ table }) => {
|
|
|
116
117
|
|
|
117
118
|
return (
|
|
118
119
|
<TableBody {...tableBodyProps}>
|
|
119
|
-
{
|
|
120
|
+
{!rows.length ? (
|
|
120
121
|
<tr>
|
|
121
|
-
<td
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
virtualRow={enableRowVirtualization ? rowOrVirtualRow : null}
|
|
138
|
-
/>
|
|
139
|
-
);
|
|
140
|
-
},
|
|
141
|
-
)}
|
|
142
|
-
{enableRowVirtualization && paddingBottom > 0 && (
|
|
143
|
-
<tr>
|
|
144
|
-
<td style={{ height: `${paddingBottom}px` }} />
|
|
122
|
+
<td colSpan={table.getVisibleLeafColumns().length}>
|
|
123
|
+
<Typography
|
|
124
|
+
sx={{
|
|
125
|
+
color: 'text.secondary',
|
|
126
|
+
fontStyle: 'italic',
|
|
127
|
+
maxWidth: `min(100vw, ${tablePaperRef.current?.clientWidth}px)`,
|
|
128
|
+
py: '2rem',
|
|
129
|
+
textAlign: 'center',
|
|
130
|
+
width: '100%',
|
|
131
|
+
}}
|
|
132
|
+
>
|
|
133
|
+
{globalFilter || columnFilters.length
|
|
134
|
+
? localization.noResultsFound
|
|
135
|
+
: localization.noRecordsToDisplay}
|
|
136
|
+
</Typography>
|
|
137
|
+
</td>
|
|
145
138
|
</tr>
|
|
139
|
+
) : (
|
|
140
|
+
<>
|
|
141
|
+
{enableRowVirtualization && paddingTop > 0 && (
|
|
142
|
+
<tr>
|
|
143
|
+
<td style={{ height: `${paddingTop}px` }} />
|
|
144
|
+
</tr>
|
|
145
|
+
)}
|
|
146
|
+
{(enableRowVirtualization ? virtualRows : rows).map(
|
|
147
|
+
(rowOrVirtualRow: any, rowIndex: number) => {
|
|
148
|
+
const row = enableRowVirtualization
|
|
149
|
+
? (rows[rowOrVirtualRow.index] as MRT_Row)
|
|
150
|
+
: (rowOrVirtualRow as MRT_Row);
|
|
151
|
+
return (
|
|
152
|
+
<MRT_TableBodyRow
|
|
153
|
+
key={row.id}
|
|
154
|
+
row={row}
|
|
155
|
+
rowIndex={
|
|
156
|
+
enableRowVirtualization ? rowOrVirtualRow.index : rowIndex
|
|
157
|
+
}
|
|
158
|
+
table={table}
|
|
159
|
+
virtualRow={enableRowVirtualization ? rowOrVirtualRow : null}
|
|
160
|
+
/>
|
|
161
|
+
);
|
|
162
|
+
},
|
|
163
|
+
)}
|
|
164
|
+
{enableRowVirtualization && paddingBottom > 0 && (
|
|
165
|
+
<tr>
|
|
166
|
+
<td style={{ height: `${paddingBottom}px` }} />
|
|
167
|
+
</tr>
|
|
168
|
+
)}
|
|
169
|
+
</>
|
|
146
170
|
)}
|
|
147
171
|
</TableBody>
|
|
148
172
|
);
|
|
@@ -14,7 +14,7 @@ export const MRT_TableBodyRowGrabHandle: FC<Props> = ({
|
|
|
14
14
|
table,
|
|
15
15
|
}) => {
|
|
16
16
|
const {
|
|
17
|
-
options: { muiTableBodyRowDragHandleProps
|
|
17
|
+
options: { muiTableBodyRowDragHandleProps },
|
|
18
18
|
} = table;
|
|
19
19
|
const { row } = cell;
|
|
20
20
|
|
|
@@ -23,17 +23,14 @@ export const MRT_TableBodyRowGrabHandle: FC<Props> = ({
|
|
|
23
23
|
? muiTableBodyRowDragHandleProps({ row, table })
|
|
24
24
|
: muiTableBodyRowDragHandleProps;
|
|
25
25
|
|
|
26
|
-
const handleDragStart = (
|
|
27
|
-
|
|
26
|
+
const handleDragStart = (event: DragEvent<HTMLButtonElement>) => {
|
|
27
|
+
iconButtonProps?.onDragStart?.(event);
|
|
28
|
+
event.dataTransfer.setDragImage(rowRef.current as HTMLElement, 0, 0);
|
|
28
29
|
table.setDraggingRow(row as any);
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
const handleDragEnd = (event: DragEvent<HTMLButtonElement>) => {
|
|
32
|
-
|
|
33
|
-
event,
|
|
34
|
-
draggedRow: table.getState().draggingRow as any,
|
|
35
|
-
targetRow: table.getState().hoveredRow as any,
|
|
36
|
-
});
|
|
33
|
+
iconButtonProps?.onDragEnd?.(event);
|
|
37
34
|
table.setDraggingRow(null);
|
|
38
35
|
table.setHoveredRow(null);
|
|
39
36
|
};
|
|
@@ -33,14 +33,14 @@ export const MRT_GrabHandleButton = <TData extends Record<string, any> = {}>({
|
|
|
33
33
|
<IconButton
|
|
34
34
|
disableRipple
|
|
35
35
|
draggable="true"
|
|
36
|
-
onDragStart={onDragStart}
|
|
37
|
-
onDragEnd={onDragEnd}
|
|
38
36
|
size="small"
|
|
39
37
|
{...iconButtonProps}
|
|
40
38
|
onClick={(e) => {
|
|
41
39
|
e.stopPropagation();
|
|
42
40
|
iconButtonProps?.onClick?.(e);
|
|
43
41
|
}}
|
|
42
|
+
onDragStart={onDragStart}
|
|
43
|
+
onDragEnd={onDragEnd}
|
|
44
44
|
sx={(theme) => ({
|
|
45
45
|
cursor: 'grab',
|
|
46
46
|
m: 0,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
|
-
import { TableFooter } from '@mui/material';
|
|
2
|
+
import { lighten, TableFooter } from '@mui/material';
|
|
3
3
|
import { MRT_TableFooterRow } from './MRT_TableFooterRow';
|
|
4
4
|
import type { MRT_TableInstance } from '..';
|
|
5
5
|
|
|
@@ -27,7 +27,7 @@ export const MRT_TableFooter: FC<Props> = ({ table }) => {
|
|
|
27
27
|
<TableFooter
|
|
28
28
|
{...tableFooterProps}
|
|
29
29
|
sx={(theme) => ({
|
|
30
|
-
|
|
30
|
+
backgroundColor: lighten(theme.palette.background.default, 0.06),
|
|
31
31
|
bottom: stickFooter ? 0 : undefined,
|
|
32
32
|
opacity: stickFooter ? 0.95 : undefined,
|
|
33
33
|
outline: stickFooter
|
|
@@ -35,6 +35,7 @@ export const MRT_TableFooter: FC<Props> = ({ table }) => {
|
|
|
35
35
|
? `1px solid ${theme.palette.grey[300]}`
|
|
36
36
|
: `1px solid ${theme.palette.grey[700]}`
|
|
37
37
|
: undefined,
|
|
38
|
+
position: stickFooter ? 'sticky' : undefined,
|
|
38
39
|
...(tableFooterProps?.sx instanceof Function
|
|
39
40
|
? tableFooterProps?.sx(theme)
|
|
40
41
|
: (tableFooterProps?.sx as any)),
|
|
@@ -17,11 +17,11 @@ export const MRT_TableHeadCellFilterLabel: FC<Props> = ({ header, table }) => {
|
|
|
17
17
|
const { column } = header;
|
|
18
18
|
const { columnDef } = column;
|
|
19
19
|
|
|
20
|
-
const isRangeFilter =
|
|
21
|
-
'
|
|
22
|
-
'betweenInclusive',
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
const isRangeFilter =
|
|
21
|
+
columnDef.filterVariant === 'range' ||
|
|
22
|
+
['between', 'betweenInclusive', 'inNumberRange'].includes(
|
|
23
|
+
columnDef._filterFn,
|
|
24
|
+
);
|
|
25
25
|
const currentFilterOption = columnDef._filterFn;
|
|
26
26
|
const filterTooltip = localization.filteringByColumn
|
|
27
27
|
.replace('{column}', String(columnDef.header))
|
|
@@ -51,8 +51,8 @@ export const MRT_TableHeadCellFilterLabel: FC<Props> = ({ header, table }) => {
|
|
|
51
51
|
<Grow
|
|
52
52
|
unmountOnExit
|
|
53
53
|
in={
|
|
54
|
-
(!!column.getFilterValue() && isRangeFilter) ||
|
|
55
|
-
(
|
|
54
|
+
(!!column.getFilterValue() && !isRangeFilter) ||
|
|
55
|
+
(isRangeFilter && // @ts-ignore
|
|
56
56
|
(!!column.getFilterValue()?.[0] || !!column.getFilterValue()?.[1]))
|
|
57
57
|
}
|
|
58
58
|
>
|
|
@@ -16,11 +16,7 @@ export const MRT_TableHeadCellGrabHandle: FC<Props> = ({
|
|
|
16
16
|
}) => {
|
|
17
17
|
const {
|
|
18
18
|
getState,
|
|
19
|
-
options: {
|
|
20
|
-
enableColumnOrdering,
|
|
21
|
-
muiTableHeadCellDragHandleProps,
|
|
22
|
-
onColumnDrop,
|
|
23
|
-
},
|
|
19
|
+
options: { enableColumnOrdering, muiTableHeadCellDragHandleProps },
|
|
24
20
|
setColumnOrder,
|
|
25
21
|
setDraggingColumn,
|
|
26
22
|
setHoveredColumn,
|
|
@@ -43,17 +39,14 @@ export const MRT_TableHeadCellGrabHandle: FC<Props> = ({
|
|
|
43
39
|
...mcIconButtonProps,
|
|
44
40
|
};
|
|
45
41
|
|
|
46
|
-
const handleDragStart = (
|
|
42
|
+
const handleDragStart = (event: DragEvent<HTMLButtonElement>) => {
|
|
43
|
+
iconButtonProps?.onDragStart?.(event);
|
|
47
44
|
setDraggingColumn(column);
|
|
48
|
-
|
|
45
|
+
event.dataTransfer.setDragImage(tableHeadCellRef.current as HTMLElement, 0, 0);
|
|
49
46
|
};
|
|
50
47
|
|
|
51
48
|
const handleDragEnd = (event: DragEvent<HTMLButtonElement>) => {
|
|
52
|
-
|
|
53
|
-
event,
|
|
54
|
-
draggedColumn: column,
|
|
55
|
-
targetColumn: hoveredColumn,
|
|
56
|
-
});
|
|
49
|
+
iconButtonProps?.onDragEnd?.(event);
|
|
57
50
|
if (hoveredColumn?.id === 'drop-zone') {
|
|
58
51
|
column.toggleGrouping();
|
|
59
52
|
} else if (
|
package/src/localization.ts
CHANGED
|
@@ -47,6 +47,8 @@ export interface MRT_Localization {
|
|
|
47
47
|
max: string;
|
|
48
48
|
min: string;
|
|
49
49
|
move: string;
|
|
50
|
+
noRecordsToDisplay: string;
|
|
51
|
+
noResultsFound: string;
|
|
50
52
|
or: string;
|
|
51
53
|
pinToLeft: string;
|
|
52
54
|
pinToRight: string;
|
|
@@ -129,6 +131,8 @@ export const MRT_DefaultLocalization_EN: MRT_Localization = {
|
|
|
129
131
|
max: 'Max',
|
|
130
132
|
min: 'Min',
|
|
131
133
|
move: 'Move',
|
|
134
|
+
noRecordsToDisplay: 'No records to display',
|
|
135
|
+
noResultsFound: 'No results found',
|
|
132
136
|
or: 'or',
|
|
133
137
|
pinToLeft: 'Pin to left',
|
|
134
138
|
pinToRight: 'Pin to right',
|
|
@@ -13,6 +13,7 @@ export const MRT_TablePaper: FC<Props> = ({ table }) => {
|
|
|
13
13
|
const {
|
|
14
14
|
getState,
|
|
15
15
|
options: { enableBottomToolbar, enableTopToolbar, muiTablePaperProps },
|
|
16
|
+
refs: { tablePaperRef },
|
|
16
17
|
} = table;
|
|
17
18
|
const { isFullScreen } = getState();
|
|
18
19
|
|
|
@@ -35,6 +36,13 @@ export const MRT_TablePaper: FC<Props> = ({ table }) => {
|
|
|
35
36
|
<Paper
|
|
36
37
|
elevation={2}
|
|
37
38
|
{...tablePaperProps}
|
|
39
|
+
ref={(ref: HTMLDivElement) => {
|
|
40
|
+
tablePaperRef.current = ref;
|
|
41
|
+
if (tablePaperProps?.ref) {
|
|
42
|
+
//@ts-ignore
|
|
43
|
+
tablePaperProps.ref.current = ref;
|
|
44
|
+
}
|
|
45
|
+
}}
|
|
38
46
|
sx={(theme) => ({
|
|
39
47
|
transition: 'all 0.2s ease-in-out',
|
|
40
48
|
...(tablePaperProps?.sx instanceof Function
|
|
@@ -45,6 +45,7 @@ export const MRT_TableRoot = <TData extends Record<string, any> = {}>(
|
|
|
45
45
|
const filterInputRefs = useRef<Record<string, HTMLInputElement>>({});
|
|
46
46
|
const searchInputRef = useRef<HTMLInputElement>(null);
|
|
47
47
|
const tableContainerRef = useRef<HTMLDivElement>(null);
|
|
48
|
+
const tablePaperRef = useRef<HTMLDivElement>(null);
|
|
48
49
|
const topToolbarRef = useRef<HTMLDivElement>(null);
|
|
49
50
|
|
|
50
51
|
const initialState: Partial<MRT_TableState<TData>> = useMemo(() => {
|
|
@@ -292,6 +293,7 @@ export const MRT_TableRoot = <TData extends Record<string, any> = {}>(
|
|
|
292
293
|
filterInputRefs,
|
|
293
294
|
searchInputRef,
|
|
294
295
|
tableContainerRef,
|
|
296
|
+
tablePaperRef,
|
|
295
297
|
topToolbarRef,
|
|
296
298
|
},
|
|
297
299
|
setColumnFilterFns: props.onFilterFnsChange ?? setColumnFilterFns,
|
|
@@ -102,7 +102,13 @@ export const MRT_TopToolbar: FC<Props> = ({ table }) => {
|
|
|
102
102
|
)}
|
|
103
103
|
{renderTopToolbarCustomActions?.({ table }) ?? <span />}
|
|
104
104
|
{enableToolbarInternalActions ? (
|
|
105
|
-
<Box
|
|
105
|
+
<Box
|
|
106
|
+
sx={{
|
|
107
|
+
display: 'flex',
|
|
108
|
+
flexWrap: 'wrap-reverse',
|
|
109
|
+
justifyContent: 'flex-end',
|
|
110
|
+
}}
|
|
111
|
+
>
|
|
106
112
|
{enableGlobalFilter && positionGlobalFilter === 'right' && (
|
|
107
113
|
<MRT_GlobalFilterTextField table={table} />
|
|
108
114
|
)}
|