material-react-table 2.6.1 → 2.7.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/dist/index.d.ts +224 -240
- package/dist/index.esm.js +2248 -2211
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2353 -2315
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/body/MRT_TableBody.tsx +3 -25
- package/src/body/MRT_TableBodyRow.tsx +4 -2
- package/src/body/MRT_TableDetailPanel.tsx +3 -3
- package/src/buttons/MRT_CopyButton.tsx +2 -3
- package/src/buttons/MRT_ExpandAllButton.tsx +2 -2
- package/src/buttons/MRT_ExpandButton.tsx +5 -2
- package/src/buttons/MRT_GrabHandleButton.tsx +2 -3
- package/src/buttons/MRT_RowPinButton.tsx +2 -2
- package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +6 -6
- package/src/column.utils.ts +22 -29
- package/src/head/MRT_TableHead.tsx +1 -1
- package/src/head/MRT_TableHeadCellColumnActionsButton.tsx +2 -3
- package/src/hooks/useMRT_DisplayColumns.tsx +43 -52
- package/src/hooks/useMRT_Effects.ts +6 -5
- package/src/hooks/useMRT_Rows.ts +30 -4
- package/src/hooks/useMRT_TableInstance.ts +44 -55
- package/src/hooks/useMRT_TableOptions.ts +2 -0
- package/src/icons.ts +4 -38
- package/src/index.ts +84 -10
- package/src/inputs/MRT_FilterCheckbox.tsx +2 -2
- package/src/inputs/MRT_SelectCheckbox.tsx +2 -2
- package/src/menus/MRT_ColumnActionMenu.tsx +11 -3
- package/src/menus/MRT_FilterOptionMenu.tsx +8 -0
- package/src/menus/MRT_RowActionMenu.tsx +14 -3
- package/src/menus/MRT_ShowHideColumnsMenu.tsx +8 -0
- package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +2 -3
- package/src/style.utils.ts +29 -13
- package/src/table/MRT_TableContainer.tsx +1 -1
- package/src/toolbar/MRT_TablePagination.tsx +7 -5
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +1 -1
- package/src/types.ts +5 -0
- package/src/body/index.ts +0 -7
- package/src/buttons/index.ts +0 -13
- package/src/footer/index.ts +0 -3
- package/src/head/index.ts +0 -9
- package/src/hooks/index.ts +0 -7
- package/src/inputs/index.ts +0 -7
- package/src/menus/index.ts +0 -5
- package/src/modals/index.ts +0 -1
- package/src/table/index.ts +0 -5
- package/src/toolbar/index.ts +0 -7
@@ -11,6 +11,7 @@ export const useMRT_Effects = <TData extends MRT_RowData>(
|
|
11
11
|
) => {
|
12
12
|
const {
|
13
13
|
getIsSomeRowsPinned,
|
14
|
+
getPrePaginationRowModel,
|
14
15
|
getState,
|
15
16
|
options: { enablePagination, enableRowPinning, rowCount },
|
16
17
|
} = table;
|
@@ -24,6 +25,8 @@ export const useMRT_Effects = <TData extends MRT_RowData>(
|
|
24
25
|
sorting,
|
25
26
|
} = getState();
|
26
27
|
|
28
|
+
const totalRowCount = rowCount ?? getPrePaginationRowModel().rows.length;
|
29
|
+
|
27
30
|
const rerender = useReducer(() => ({}), {})[1];
|
28
31
|
const isMounted = useRef(false);
|
29
32
|
const initialBodyHeight = useRef<string>();
|
@@ -57,13 +60,11 @@ export const useMRT_Effects = <TData extends MRT_RowData>(
|
|
57
60
|
useEffect(() => {
|
58
61
|
if (!enablePagination || isLoading || showSkeletons) return;
|
59
62
|
const { pageIndex, pageSize } = pagination;
|
60
|
-
const totalRowCount =
|
61
|
-
rowCount ?? table.getPrePaginationRowModel().rows.length;
|
62
63
|
const firstVisibleRowIndex = pageIndex * pageSize;
|
63
|
-
if (firstVisibleRowIndex
|
64
|
-
table.setPageIndex(Math.
|
64
|
+
if (firstVisibleRowIndex >= totalRowCount) {
|
65
|
+
table.setPageIndex(Math.ceil(totalRowCount / pageSize) - 1);
|
65
66
|
}
|
66
|
-
}, [
|
67
|
+
}, [totalRowCount]);
|
67
68
|
|
68
69
|
//turn off sort when global filter is looking for ranked results
|
69
70
|
const appliedSort = useRef<MRT_SortingState>(sorting);
|
package/src/hooks/useMRT_Rows.ts
CHANGED
@@ -19,6 +19,7 @@ export const useMRT_Rows = <TData extends MRT_RowData>(
|
|
19
19
|
getState,
|
20
20
|
getTopRows,
|
21
21
|
options: {
|
22
|
+
createDisplayMode,
|
22
23
|
enableGlobalFilterRankedResults,
|
23
24
|
enablePagination,
|
24
25
|
enableRowPinning,
|
@@ -27,11 +28,18 @@ export const useMRT_Rows = <TData extends MRT_RowData>(
|
|
27
28
|
manualGrouping,
|
28
29
|
manualPagination,
|
29
30
|
manualSorting,
|
31
|
+
positionCreatingRow,
|
30
32
|
rowPinningDisplayMode,
|
31
33
|
},
|
32
34
|
} = table;
|
33
|
-
const {
|
34
|
-
|
35
|
+
const {
|
36
|
+
creatingRow,
|
37
|
+
expanded,
|
38
|
+
globalFilter,
|
39
|
+
pagination,
|
40
|
+
rowPinning,
|
41
|
+
sorting,
|
42
|
+
} = getState();
|
35
43
|
|
36
44
|
const shouldRankRows = useMemo(
|
37
45
|
() =>
|
@@ -73,14 +81,32 @@ export const useMRT_Rows = <TData extends MRT_RowData>(
|
|
73
81
|
...getBottomRows().filter((row) => !pinnedRowIds.includes(row.id)),
|
74
82
|
];
|
75
83
|
}
|
84
|
+
if (
|
85
|
+
positionCreatingRow !== undefined &&
|
86
|
+
creatingRow &&
|
87
|
+
createDisplayMode === 'row'
|
88
|
+
) {
|
89
|
+
const creatingRowIndex = !isNaN(+positionCreatingRow)
|
90
|
+
? +positionCreatingRow
|
91
|
+
: positionCreatingRow === 'top'
|
92
|
+
? 0
|
93
|
+
: rows.length;
|
94
|
+
rows = [
|
95
|
+
...rows.slice(0, creatingRowIndex),
|
96
|
+
creatingRow,
|
97
|
+
...rows.slice(creatingRowIndex),
|
98
|
+
];
|
99
|
+
}
|
76
100
|
|
77
101
|
return rows;
|
78
102
|
}, [
|
79
|
-
|
80
|
-
shouldRankRows ? getPrePaginationRowModel().rows : getRowModel().rows,
|
103
|
+
creatingRow,
|
81
104
|
pagination.pageIndex,
|
82
105
|
pagination.pageSize,
|
106
|
+
positionCreatingRow,
|
83
107
|
rowPinning,
|
108
|
+
shouldRankRows ? getPrePaginationRowModel().rows : getRowModel().rows,
|
109
|
+
shouldRankRows,
|
84
110
|
]);
|
85
111
|
|
86
112
|
return rows;
|
@@ -29,6 +29,7 @@ import {
|
|
29
29
|
type MRT_DensityState,
|
30
30
|
type MRT_FilterOption,
|
31
31
|
type MRT_GroupingState,
|
32
|
+
type MRT_PaginationState,
|
32
33
|
type MRT_Row,
|
33
34
|
type MRT_RowData,
|
34
35
|
type MRT_TableInstance,
|
@@ -62,6 +63,8 @@ export const useMRT_TableInstance: <TData extends MRT_RowData>(
|
|
62
63
|
return initState;
|
63
64
|
}, []);
|
64
65
|
|
66
|
+
tableOptions.initialState = initialState;
|
67
|
+
|
65
68
|
const [creatingRow, _setCreatingRow] = useState<MRT_Row<TData> | null>(
|
66
69
|
initialState.creatingRow ?? null,
|
67
70
|
);
|
@@ -81,7 +84,7 @@ export const useMRT_TableInstance: <TData extends MRT_RowData>(
|
|
81
84
|
})),
|
82
85
|
),
|
83
86
|
);
|
84
|
-
const [columnOrder,
|
87
|
+
const [columnOrder, onColumnOrderChange] = useState<MRT_ColumnOrderState>(
|
85
88
|
initialState.columnOrder ?? [],
|
86
89
|
);
|
87
90
|
const [density, setDensity] = useState<MRT_DensityState>(
|
@@ -101,7 +104,7 @@ export const useMRT_TableInstance: <TData extends MRT_RowData>(
|
|
101
104
|
const [globalFilterFn, setGlobalFilterFn] = useState<MRT_FilterOption>(
|
102
105
|
initialState.globalFilterFn ?? 'fuzzy',
|
103
106
|
);
|
104
|
-
const [grouping,
|
107
|
+
const [grouping, onGroupingChange] = useState<MRT_GroupingState>(
|
105
108
|
initialState.grouping ?? [],
|
106
109
|
);
|
107
110
|
const [hoveredColumn, setHoveredColumn] = useState<Partial<
|
@@ -113,6 +116,9 @@ export const useMRT_TableInstance: <TData extends MRT_RowData>(
|
|
113
116
|
const [isFullScreen, setIsFullScreen] = useState<boolean>(
|
114
117
|
initialState?.isFullScreen ?? false,
|
115
118
|
);
|
119
|
+
const [pagination, onPaginationChange] = useState<MRT_PaginationState>(
|
120
|
+
initialState?.pagination ?? { pageIndex: 0, pageSize: 10 },
|
121
|
+
);
|
116
122
|
const [showAlertBanner, setShowAlertBanner] = useState<boolean>(
|
117
123
|
tableOptions.initialState?.showAlertBanner ?? false,
|
118
124
|
);
|
@@ -126,32 +132,40 @@ export const useMRT_TableInstance: <TData extends MRT_RowData>(
|
|
126
132
|
initialState?.showToolbarDropZone ?? false,
|
127
133
|
);
|
128
134
|
|
129
|
-
|
135
|
+
tableOptions.state = {
|
136
|
+
columnFilterFns,
|
130
137
|
columnOrder,
|
131
138
|
creatingRow,
|
139
|
+
density,
|
140
|
+
draggingColumn,
|
141
|
+
draggingRow,
|
142
|
+
editingCell,
|
143
|
+
editingRow,
|
144
|
+
globalFilterFn,
|
132
145
|
grouping,
|
133
|
-
|
134
|
-
|
146
|
+
hoveredColumn,
|
147
|
+
hoveredRow,
|
148
|
+
isFullScreen,
|
149
|
+
pagination,
|
150
|
+
showAlertBanner,
|
151
|
+
showColumnFilters,
|
152
|
+
showGlobalFilter,
|
153
|
+
showToolbarDropZone,
|
154
|
+
...tableOptions.state,
|
155
|
+
};
|
156
|
+
|
157
|
+
const displayColumns = useMRT_DisplayColumns(tableOptions);
|
135
158
|
|
136
|
-
|
159
|
+
tableOptions.columns = useMemo(
|
137
160
|
() =>
|
138
161
|
prepareColumns({
|
139
|
-
aggregationFns: tableOptions.aggregationFns as any,
|
140
162
|
columnDefs: [...displayColumns, ...tableOptions.columns],
|
141
|
-
|
142
|
-
defaultDisplayColumn: tableOptions.defaultDisplayColumn ?? {},
|
143
|
-
filterFns: tableOptions.filterFns as any,
|
144
|
-
sortingFns: tableOptions.sortingFns as any,
|
163
|
+
tableOptions,
|
145
164
|
}),
|
146
|
-
[
|
147
|
-
columnFilterFns,
|
148
|
-
displayColumns,
|
149
|
-
tableOptions.columns,
|
150
|
-
tableOptions.state?.columnFilterFns,
|
151
|
-
],
|
165
|
+
[displayColumns, tableOptions.columns],
|
152
166
|
);
|
153
167
|
|
154
|
-
|
168
|
+
tableOptions.data = useMemo(
|
155
169
|
() =>
|
156
170
|
(tableOptions.state?.isLoading || tableOptions.state?.showSkeletons) &&
|
157
171
|
!tableOptions.data.length
|
@@ -209,58 +223,35 @@ export const useMRT_TableInstance: <TData extends MRT_RowData>(
|
|
209
223
|
? getSortedRowModel()
|
210
224
|
: undefined,
|
211
225
|
getSubRows: (row) => row?.subRows,
|
212
|
-
onColumnOrderChange
|
213
|
-
onGroupingChange
|
226
|
+
onColumnOrderChange,
|
227
|
+
onGroupingChange,
|
228
|
+
onPaginationChange,
|
214
229
|
...tableOptions,
|
215
|
-
//@ts-ignore
|
216
|
-
columns: columnDefs,
|
217
|
-
data,
|
218
230
|
globalFilterFn: tableOptions.filterFns?.[globalFilterFn ?? 'fuzzy'],
|
219
|
-
initialState,
|
220
|
-
state: {
|
221
|
-
columnFilterFns,
|
222
|
-
columnOrder,
|
223
|
-
creatingRow,
|
224
|
-
density,
|
225
|
-
draggingColumn,
|
226
|
-
draggingRow,
|
227
|
-
editingCell,
|
228
|
-
editingRow,
|
229
|
-
globalFilterFn,
|
230
|
-
grouping,
|
231
|
-
hoveredColumn,
|
232
|
-
hoveredRow,
|
233
|
-
isFullScreen,
|
234
|
-
showAlertBanner,
|
235
|
-
showColumnFilters,
|
236
|
-
showGlobalFilter,
|
237
|
-
showToolbarDropZone,
|
238
|
-
...tableOptions.state,
|
239
|
-
},
|
240
231
|
}) as MRT_TableInstance<TData>;
|
241
232
|
|
242
|
-
|
233
|
+
//@ts-ignore
|
243
234
|
table.refs = {
|
244
|
-
|
235
|
+
//@ts-ignore
|
245
236
|
bottomToolbarRef,
|
246
237
|
editInputRefs,
|
247
238
|
filterInputRefs,
|
248
|
-
|
239
|
+
//@ts-ignore
|
249
240
|
searchInputRef,
|
250
|
-
|
241
|
+
//@ts-ignore
|
251
242
|
tableContainerRef,
|
252
|
-
|
243
|
+
//@ts-ignore
|
253
244
|
tableFooterRef,
|
254
245
|
tableHeadCellRefs,
|
255
|
-
|
246
|
+
//@ts-ignore
|
256
247
|
tableHeadRef,
|
257
|
-
|
248
|
+
//@ts-ignore
|
258
249
|
tablePaperRef,
|
259
|
-
|
250
|
+
//@ts-ignore
|
260
251
|
topToolbarRef,
|
261
252
|
};
|
262
253
|
|
263
|
-
|
254
|
+
table.setCreatingRow = (row: MRT_Updater<MRT_Row<TData> | null | true>) => {
|
264
255
|
let _row = row;
|
265
256
|
if (row === true) {
|
266
257
|
_row = createRow(table);
|
@@ -268,8 +259,6 @@ export const useMRT_TableInstance: <TData extends MRT_RowData>(
|
|
268
259
|
tableOptions?.onCreatingRowChange?.(_row as MRT_Row<TData> | null) ??
|
269
260
|
_setCreatingRow(_row as MRT_Row<TData> | null);
|
270
261
|
};
|
271
|
-
|
272
|
-
table.setCreatingRow = setCreatingRow;
|
273
262
|
table.setColumnFilterFns =
|
274
263
|
tableOptions.onColumnFilterFnsChange ?? setColumnFilterFns;
|
275
264
|
table.setDensity = tableOptions.onDensityChange ?? setDensity;
|
@@ -83,6 +83,7 @@ export const useMRT_TableOptions: <TData extends MRT_RowData>(
|
|
83
83
|
manualSorting,
|
84
84
|
paginationDisplayMode = 'default',
|
85
85
|
positionActionsColumn = 'first',
|
86
|
+
positionCreatingRow = 'top',
|
86
87
|
positionExpandColumn = 'first',
|
87
88
|
positionGlobalFilter = 'right',
|
88
89
|
positionPagination = 'bottom',
|
@@ -197,6 +198,7 @@ export const useMRT_TableOptions: <TData extends MRT_RowData>(
|
|
197
198
|
manualSorting,
|
198
199
|
paginationDisplayMode,
|
199
200
|
positionActionsColumn,
|
201
|
+
positionCreatingRow,
|
200
202
|
positionExpandColumn,
|
201
203
|
positionGlobalFilter,
|
202
204
|
positionPagination,
|
package/src/icons.ts
CHANGED
@@ -32,43 +32,7 @@ import SyncAltIcon from '@mui/icons-material/SyncAlt';
|
|
32
32
|
import ViewColumnIcon from '@mui/icons-material/ViewColumn';
|
33
33
|
import VisibilityOffIcon from '@mui/icons-material/VisibilityOff';
|
34
34
|
|
35
|
-
export
|
36
|
-
ArrowDownwardIcon: any;
|
37
|
-
ArrowRightIcon: any;
|
38
|
-
CancelIcon: any;
|
39
|
-
ChevronLeftIcon: any;
|
40
|
-
ChevronRightIcon: any;
|
41
|
-
ClearAllIcon: any;
|
42
|
-
CloseIcon: any;
|
43
|
-
DensityLargeIcon: any;
|
44
|
-
DensityMediumIcon: any;
|
45
|
-
DensitySmallIcon: any;
|
46
|
-
DragHandleIcon: any;
|
47
|
-
DynamicFeedIcon: any;
|
48
|
-
EditIcon: any;
|
49
|
-
ExpandMoreIcon: any;
|
50
|
-
FilterAltIcon: any;
|
51
|
-
FilterListIcon: any;
|
52
|
-
FilterListOffIcon: any;
|
53
|
-
FirstPageIcon?: any;
|
54
|
-
FullscreenExitIcon: any;
|
55
|
-
FullscreenIcon: any;
|
56
|
-
KeyboardDoubleArrowDownIcon: any;
|
57
|
-
LastPageIcon?: any;
|
58
|
-
MoreHorizIcon: any;
|
59
|
-
MoreVertIcon: any;
|
60
|
-
PushPinIcon: any;
|
61
|
-
RestartAltIcon: any;
|
62
|
-
SaveIcon: any;
|
63
|
-
SearchIcon: any;
|
64
|
-
SearchOffIcon: any;
|
65
|
-
SortIcon: any;
|
66
|
-
SyncAltIcon?: any;
|
67
|
-
ViewColumnIcon: any;
|
68
|
-
VisibilityOffIcon: any;
|
69
|
-
}
|
70
|
-
|
71
|
-
export const MRT_Default_Icons: MRT_Icons = {
|
35
|
+
export const MRT_Default_Icons = {
|
72
36
|
ArrowDownwardIcon,
|
73
37
|
ArrowRightIcon,
|
74
38
|
CancelIcon,
|
@@ -102,4 +66,6 @@ export const MRT_Default_Icons: MRT_Icons = {
|
|
102
66
|
SyncAltIcon,
|
103
67
|
ViewColumnIcon,
|
104
68
|
VisibilityOffIcon,
|
105
|
-
};
|
69
|
+
} as const;
|
70
|
+
|
71
|
+
export type MRT_Icons = Record<keyof typeof MRT_Default_Icons, any>;
|
package/src/index.ts
CHANGED
@@ -1,18 +1,92 @@
|
|
1
|
+
//root
|
1
2
|
export * from './MaterialReactTable';
|
2
3
|
export * from './aggregationFns';
|
3
|
-
export * from './body';
|
4
|
-
export * from './buttons';
|
5
4
|
export * from './column.utils';
|
6
5
|
export * from './filterFns';
|
7
|
-
export * from './footer';
|
8
|
-
export * from './head';
|
9
|
-
export * from './hooks';
|
10
|
-
export * from './inputs';
|
11
|
-
export * from './menus';
|
12
|
-
export * from './modals';
|
13
6
|
export * from './sortingFns';
|
14
7
|
export * from './style.utils';
|
15
|
-
export * from './table';
|
16
|
-
export * from './toolbar';
|
17
8
|
export * from './types';
|
18
9
|
export * from './useMaterialReactTable';
|
10
|
+
|
11
|
+
//hooks
|
12
|
+
export * from './hooks/useMRT_ColumnVirtualizer';
|
13
|
+
export * from './hooks/useMRT_DisplayColumns';
|
14
|
+
export * from './hooks/useMRT_Effects';
|
15
|
+
export * from './hooks/useMRT_RowVirtualizer';
|
16
|
+
export * from './hooks/useMRT_Rows';
|
17
|
+
export * from './hooks/useMRT_TableInstance';
|
18
|
+
export * from './hooks/useMRT_TableOptions';
|
19
|
+
|
20
|
+
//body
|
21
|
+
export * from './body/MRT_TableBody';
|
22
|
+
export * from './body/MRT_TableBodyCell';
|
23
|
+
export * from './body/MRT_TableBodyCellValue';
|
24
|
+
export * from './body/MRT_TableBodyRow';
|
25
|
+
export * from './body/MRT_TableBodyRowGrabHandle';
|
26
|
+
export * from './body/MRT_TableBodyRowPinButton';
|
27
|
+
export * from './body/MRT_TableDetailPanel';
|
28
|
+
|
29
|
+
//buttons
|
30
|
+
export * from './buttons/MRT_ColumnPinningButtons';
|
31
|
+
export * from './buttons/MRT_CopyButton';
|
32
|
+
export * from './buttons/MRT_EditActionButtons';
|
33
|
+
export * from './buttons/MRT_ExpandAllButton';
|
34
|
+
export * from './buttons/MRT_ExpandButton';
|
35
|
+
export * from './buttons/MRT_GrabHandleButton';
|
36
|
+
export * from './buttons/MRT_RowPinButton';
|
37
|
+
export * from './buttons/MRT_ShowHideColumnsButton';
|
38
|
+
export * from './buttons/MRT_ToggleDensePaddingButton';
|
39
|
+
export * from './buttons/MRT_ToggleFiltersButton';
|
40
|
+
export * from './buttons/MRT_ToggleFullScreenButton';
|
41
|
+
export * from './buttons/MRT_ToggleGlobalFilterButton';
|
42
|
+
export * from './buttons/MRT_ToggleRowActionMenuButton';
|
43
|
+
|
44
|
+
//footer
|
45
|
+
export * from './footer/MRT_TableFooter';
|
46
|
+
export * from './footer/MRT_TableFooterCell';
|
47
|
+
export * from './footer/MRT_TableFooterRow';
|
48
|
+
|
49
|
+
//head
|
50
|
+
export * from './head/MRT_TableHead';
|
51
|
+
export * from './head/MRT_TableHeadCell';
|
52
|
+
export * from './head/MRT_TableHeadCellColumnActionsButton';
|
53
|
+
export * from './head/MRT_TableHeadCellFilterContainer';
|
54
|
+
export * from './head/MRT_TableHeadCellFilterLabel';
|
55
|
+
export * from './head/MRT_TableHeadCellGrabHandle';
|
56
|
+
export * from './head/MRT_TableHeadCellResizeHandle';
|
57
|
+
export * from './head/MRT_TableHeadCellSortLabel';
|
58
|
+
export * from './head/MRT_TableHeadRow';
|
59
|
+
|
60
|
+
//inputs
|
61
|
+
export * from './inputs/MRT_EditCellTextField';
|
62
|
+
export * from './inputs/MRT_FilterCheckbox';
|
63
|
+
export * from './inputs/MRT_FilterRangeFields';
|
64
|
+
export * from './inputs/MRT_FilterRangeSlider';
|
65
|
+
export * from './inputs/MRT_FilterTextField';
|
66
|
+
export * from './inputs/MRT_GlobalFilterTextField';
|
67
|
+
export * from './inputs/MRT_SelectCheckbox';
|
68
|
+
|
69
|
+
//menus
|
70
|
+
export * from './menus/MRT_ColumnActionMenu';
|
71
|
+
export * from './menus/MRT_FilterOptionMenu';
|
72
|
+
export * from './menus/MRT_RowActionMenu';
|
73
|
+
export * from './menus/MRT_ShowHideColumnsMenu';
|
74
|
+
export * from './menus/MRT_ShowHideColumnsMenuItems';
|
75
|
+
|
76
|
+
//modals
|
77
|
+
export * from './modals/MRT_EditRowModal';
|
78
|
+
|
79
|
+
//table
|
80
|
+
export * from './table/MRT_Table';
|
81
|
+
export * from './table/MRT_TableContainer';
|
82
|
+
export * from './table/MRT_TableLoadingOverlay';
|
83
|
+
export * from './table/MRT_TablePaper';
|
84
|
+
|
85
|
+
//toolbar
|
86
|
+
export * from './toolbar/MRT_BottomToolbar';
|
87
|
+
export * from './toolbar/MRT_LinearProgressBar';
|
88
|
+
export * from './toolbar/MRT_TablePagination';
|
89
|
+
export * from './toolbar/MRT_ToolbarAlertBanner';
|
90
|
+
export * from './toolbar/MRT_ToolbarDropZone';
|
91
|
+
export * from './toolbar/MRT_ToolbarInternalButtons';
|
92
|
+
export * from './toolbar/MRT_TopToolbar';
|
@@ -2,6 +2,7 @@ import Checkbox, { type CheckboxProps } from '@mui/material/Checkbox';
|
|
2
2
|
import FormControlLabel from '@mui/material/FormControlLabel';
|
3
3
|
import Tooltip from '@mui/material/Tooltip';
|
4
4
|
import { parseFromValuesOrFunc } from '../column.utils';
|
5
|
+
import { getCommonTooltipProps } from '../style.utils';
|
5
6
|
import {
|
6
7
|
type MRT_Column,
|
7
8
|
type MRT_RowData,
|
@@ -44,8 +45,7 @@ export const MRT_FilterCheckbox = <TData extends MRT_RowData>({
|
|
44
45
|
|
45
46
|
return (
|
46
47
|
<Tooltip
|
47
|
-
|
48
|
-
enterNextDelay={1000}
|
48
|
+
{...getCommonTooltipProps()}
|
49
49
|
title={checkboxProps?.title ?? filterLabel}
|
50
50
|
>
|
51
51
|
<FormControlLabel
|
@@ -4,6 +4,7 @@ import Radio, { type RadioProps } from '@mui/material/Radio';
|
|
4
4
|
import Tooltip from '@mui/material/Tooltip';
|
5
5
|
import { type Theme } from '@mui/material/styles';
|
6
6
|
import { parseFromValuesOrFunc } from '../column.utils';
|
7
|
+
import { getCommonTooltipProps } from '../style.utils';
|
7
8
|
import {
|
8
9
|
type MRT_Row,
|
9
10
|
type MRT_RowData,
|
@@ -124,8 +125,7 @@ export const MRT_SelectCheckbox = <TData extends MRT_RowData>({
|
|
124
125
|
|
125
126
|
return (
|
126
127
|
<Tooltip
|
127
|
-
|
128
|
-
enterNextDelay={1000}
|
128
|
+
{...getCommonTooltipProps()}
|
129
129
|
title={
|
130
130
|
checkboxProps?.title ??
|
131
131
|
(selectAll
|
@@ -5,7 +5,9 @@ import IconButton from '@mui/material/IconButton';
|
|
5
5
|
import ListItemIcon from '@mui/material/ListItemIcon';
|
6
6
|
import Menu, { type MenuProps } from '@mui/material/Menu';
|
7
7
|
import MenuItem from '@mui/material/MenuItem';
|
8
|
+
import { useTheme } from '@mui/material/styles';
|
8
9
|
import { MRT_FilterOptionMenu } from './MRT_FilterOptionMenu';
|
10
|
+
import { getMRTTheme } from '../style.utils';
|
9
11
|
import {
|
10
12
|
type MRT_Header,
|
11
13
|
type MRT_RowData,
|
@@ -396,11 +398,17 @@ export const MRT_ColumnActionMenu = <TData extends MRT_RowData>({
|
|
396
398
|
: []),
|
397
399
|
].filter(Boolean);
|
398
400
|
|
401
|
+
const theme = useTheme();
|
402
|
+
const { menuBackgroundColor } = getMRTTheme(table, theme);
|
403
|
+
|
399
404
|
return (
|
400
405
|
<Menu
|
401
|
-
|
402
|
-
|
403
|
-
|
406
|
+
MenuListProps={{
|
407
|
+
dense: density === 'compact',
|
408
|
+
sx: {
|
409
|
+
backgroundColor: menuBackgroundColor,
|
410
|
+
},
|
411
|
+
}}
|
404
412
|
anchorEl={anchorEl}
|
405
413
|
onClose={() => setAnchorEl(null)}
|
406
414
|
open={!!anchorEl}
|
@@ -2,6 +2,8 @@ import { useMemo } from 'react';
|
|
2
2
|
import Box from '@mui/material/Box';
|
3
3
|
import Menu, { type MenuProps } from '@mui/material/Menu';
|
4
4
|
import MenuItem from '@mui/material/MenuItem';
|
5
|
+
import { useTheme } from '@mui/material/styles';
|
6
|
+
import { getMRTTheme } from '../style.utils';
|
5
7
|
import {
|
6
8
|
type MRT_FilterOption,
|
7
9
|
type MRT_Header,
|
@@ -237,10 +239,16 @@ export const MRT_FilterOptionMenu = <TData extends MRT_RowData>({
|
|
237
239
|
const filterOption =
|
238
240
|
!!header && columnDef ? columnDef._filterFn : globalFilterFn;
|
239
241
|
|
242
|
+
const theme = useTheme();
|
243
|
+
const { menuBackgroundColor } = getMRTTheme(table, theme);
|
244
|
+
|
240
245
|
return (
|
241
246
|
<Menu
|
242
247
|
MenuListProps={{
|
243
248
|
dense: density === 'compact',
|
249
|
+
sx: {
|
250
|
+
backgroundColor: menuBackgroundColor,
|
251
|
+
},
|
244
252
|
}}
|
245
253
|
anchorEl={anchorEl}
|
246
254
|
anchorOrigin={{ horizontal: 'right', vertical: 'center' }}
|
@@ -3,11 +3,13 @@ import Box from '@mui/material/Box';
|
|
3
3
|
import ListItemIcon from '@mui/material/ListItemIcon';
|
4
4
|
import Menu, { type MenuProps } from '@mui/material/Menu';
|
5
5
|
import MenuItem from '@mui/material/MenuItem';
|
6
|
+
import { useTheme } from '@mui/material/styles';
|
6
7
|
import {
|
7
8
|
commonListItemStyles,
|
8
9
|
commonMenuItemStyles,
|
9
10
|
} from './MRT_ColumnActionMenu';
|
10
11
|
import { parseFromValuesOrFunc } from '../column.utils';
|
12
|
+
import { getMRTTheme } from '../style.utils';
|
11
13
|
import {
|
12
14
|
type MRT_Row,
|
13
15
|
type MRT_RowData,
|
@@ -19,6 +21,7 @@ interface Props<TData extends MRT_RowData> extends Partial<MenuProps> {
|
|
19
21
|
handleEdit: (event: MouseEvent) => void;
|
20
22
|
row: MRT_Row<TData>;
|
21
23
|
setAnchorEl: (anchorEl: HTMLElement | null) => void;
|
24
|
+
staticRowIndex?: number;
|
22
25
|
table: MRT_TableInstance<TData>;
|
23
26
|
}
|
24
27
|
|
@@ -27,6 +30,7 @@ export const MRT_RowActionMenu = <TData extends MRT_RowData>({
|
|
27
30
|
handleEdit,
|
28
31
|
row,
|
29
32
|
setAnchorEl,
|
33
|
+
staticRowIndex,
|
30
34
|
table,
|
31
35
|
...rest
|
32
36
|
}: Props<TData>) => {
|
@@ -42,11 +46,17 @@ export const MRT_RowActionMenu = <TData extends MRT_RowData>({
|
|
42
46
|
} = table;
|
43
47
|
const { density } = getState();
|
44
48
|
|
49
|
+
const theme = useTheme();
|
50
|
+
const { menuBackgroundColor } = getMRTTheme(table, theme);
|
51
|
+
|
45
52
|
return (
|
46
53
|
<Menu
|
47
|
-
|
48
|
-
|
49
|
-
|
54
|
+
MenuListProps={{
|
55
|
+
dense: density === 'compact',
|
56
|
+
sx: {
|
57
|
+
backgroundColor: menuBackgroundColor,
|
58
|
+
},
|
59
|
+
}}
|
50
60
|
anchorEl={anchorEl}
|
51
61
|
onClick={(event) => event.stopPropagation()}
|
52
62
|
onClose={() => setAnchorEl(null)}
|
@@ -67,6 +77,7 @@ export const MRT_RowActionMenu = <TData extends MRT_RowData>({
|
|
67
77
|
{renderRowActionMenuItems?.({
|
68
78
|
closeMenu: () => setAnchorEl(null),
|
69
79
|
row,
|
80
|
+
staticRowIndex,
|
70
81
|
table,
|
71
82
|
})}
|
72
83
|
</Menu>
|
@@ -1,10 +1,12 @@
|
|
1
1
|
import { useMemo, useState } from 'react';
|
2
|
+
import { useTheme } from '@mui/material';
|
2
3
|
import Box from '@mui/material/Box';
|
3
4
|
import Button from '@mui/material/Button';
|
4
5
|
import Divider from '@mui/material/Divider';
|
5
6
|
import Menu, { type MenuProps } from '@mui/material/Menu';
|
6
7
|
import { MRT_ShowHideColumnsMenuItems } from './MRT_ShowHideColumnsMenuItems';
|
7
8
|
import { getDefaultColumnOrderIds } from '../column.utils';
|
9
|
+
import { getMRTTheme } from '../style.utils';
|
8
10
|
import {
|
9
11
|
type MRT_Column,
|
10
12
|
type MRT_RowData,
|
@@ -77,10 +79,16 @@ export const MRT_ShowHideColumnsMenu = <TData extends MRT_RowData>({
|
|
77
79
|
null,
|
78
80
|
);
|
79
81
|
|
82
|
+
const theme = useTheme();
|
83
|
+
const { menuBackgroundColor } = getMRTTheme(table, theme);
|
84
|
+
|
80
85
|
return (
|
81
86
|
<Menu
|
82
87
|
MenuListProps={{
|
83
88
|
dense: density === 'compact',
|
89
|
+
sx: {
|
90
|
+
backgroundColor: menuBackgroundColor,
|
91
|
+
},
|
84
92
|
}}
|
85
93
|
anchorEl={anchorEl}
|
86
94
|
onClose={() => setAnchorEl(null)}
|
@@ -14,7 +14,7 @@ import Typography from '@mui/material/Typography';
|
|
14
14
|
import { MRT_ColumnPinningButtons } from '../buttons/MRT_ColumnPinningButtons';
|
15
15
|
import { MRT_GrabHandleButton } from '../buttons/MRT_GrabHandleButton';
|
16
16
|
import { parseFromValuesOrFunc, reorderColumn } from '../column.utils';
|
17
|
-
import { getMRTTheme } from '../style.utils';
|
17
|
+
import { getCommonTooltipProps, getMRTTheme } from '../style.utils';
|
18
18
|
import {
|
19
19
|
type MRT_Column,
|
20
20
|
type MRT_RowData,
|
@@ -160,8 +160,7 @@ export const MRT_ShowHideColumnsMenuItems = <TData extends MRT_RowData>({
|
|
160
160
|
}}
|
161
161
|
control={
|
162
162
|
<Tooltip
|
163
|
-
|
164
|
-
enterNextDelay={1000}
|
163
|
+
{...getCommonTooltipProps()}
|
165
164
|
title={localization.toggleVisibility}
|
166
165
|
>
|
167
166
|
<Switch />
|