material-react-table 0.5.2 → 0.5.3
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/MaterialReactTable.d.ts +5 -5
- package/dist/material-react-table.cjs.development.js +15 -6
- package/dist/material-react-table.cjs.development.js.map +1 -1
- package/dist/material-react-table.cjs.production.min.js +1 -1
- package/dist/material-react-table.cjs.production.min.js.map +1 -1
- package/dist/material-react-table.esm.js +15 -6
- package/dist/material-react-table.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/MaterialReactTable.tsx +11 -5
- package/src/body/MRT_TableBody.tsx +7 -2
- package/src/footer/MRT_TableFooter.tsx +6 -1
- package/src/table/MRT_Table.tsx +7 -2
- package/src/table/MRT_TableContainer.tsx +15 -2
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.5.
|
|
2
|
+
"version": "0.5.3",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"name": "material-react-table",
|
|
5
5
|
"description": "A fully featured Material-UI implementation of react-table, inspired by material-table and the mui DataGrid, written from the ground up in TypeScript.",
|
|
@@ -239,18 +239,22 @@ export type MaterialReactTableProps<D extends {} = {}> = UseTableOptions<D> &
|
|
|
239
239
|
muiTableBodyCellProps?:
|
|
240
240
|
| TableCellProps
|
|
241
241
|
| ((cell?: MRT_Cell<D>) => TableCellProps);
|
|
242
|
-
muiTableBodyProps?:
|
|
242
|
+
muiTableBodyProps?:
|
|
243
|
+
| TableBodyProps
|
|
244
|
+
| ((tableInstance: MRT_TableInstance<D>) => TableBodyProps);
|
|
243
245
|
muiTableBodyRowProps?: TableRowProps | ((row: Row<D>) => TableRowProps);
|
|
244
246
|
muiTableContainerProps?:
|
|
245
247
|
| TableContainerProps
|
|
246
|
-
| ((
|
|
248
|
+
| ((tableInstance: MRT_TableInstance<D>) => TableContainerProps);
|
|
247
249
|
muiTableDetailPanelProps?:
|
|
248
250
|
| TableCellProps
|
|
249
251
|
| ((row: Row<D>) => TableCellProps);
|
|
250
252
|
muiTableFooterCellProps?:
|
|
251
253
|
| TableCellProps
|
|
252
254
|
| ((column: Column<D>) => TableCellProps);
|
|
253
|
-
muiTableFooterProps?:
|
|
255
|
+
muiTableFooterProps?:
|
|
256
|
+
| TableFooterProps
|
|
257
|
+
| ((tableInstance: MRT_TableInstance<D>) => TableFooterProps);
|
|
254
258
|
muiTableFooterRowProps?:
|
|
255
259
|
| TableRowProps
|
|
256
260
|
| ((footerGroup: MRT_HeaderGroup<D>) => TableRowProps);
|
|
@@ -260,7 +264,9 @@ export type MaterialReactTableProps<D extends {} = {}> = UseTableOptions<D> &
|
|
|
260
264
|
muiTableHeadCellProps?:
|
|
261
265
|
| TableCellProps
|
|
262
266
|
| ((column: Column<D>) => TableCellProps);
|
|
263
|
-
muiTableHeadProps?:
|
|
267
|
+
muiTableHeadProps?:
|
|
268
|
+
| TableHeadProps
|
|
269
|
+
| ((tableInstance: MRT_TableInstance<D>) => TableHeadProps);
|
|
264
270
|
muiTableHeadRowProps?:
|
|
265
271
|
| TableRowProps
|
|
266
272
|
| ((row: MRT_HeaderGroup<D>) => TableRowProps);
|
|
@@ -269,7 +275,7 @@ export type MaterialReactTableProps<D extends {} = {}> = UseTableOptions<D> &
|
|
|
269
275
|
| ((
|
|
270
276
|
tableInstance: MRT_TableInstance<D>,
|
|
271
277
|
) => Partial<TablePaginationProps>);
|
|
272
|
-
muiTableProps?: TableProps;
|
|
278
|
+
muiTableProps?: TableProps | ((tableInstance: MRT_TableInstance<D>) => TableProps);
|
|
273
279
|
muiTableToolbarAlertBannerProps?:
|
|
274
280
|
| AlertProps
|
|
275
281
|
| ((tableInstance: MRT_TableInstance<D>) => AlertProps);
|
|
@@ -11,12 +11,17 @@ export const MRT_TableBody: FC<Props> = () => {
|
|
|
11
11
|
|
|
12
12
|
const rows = manualPagination ? tableInstance.rows : tableInstance.page;
|
|
13
13
|
|
|
14
|
+
const mTableBodyProps =
|
|
15
|
+
muiTableBodyProps instanceof Function
|
|
16
|
+
? muiTableBodyProps(tableInstance)
|
|
17
|
+
: muiTableBodyProps;
|
|
18
|
+
|
|
14
19
|
const tableBodyProps = {
|
|
15
|
-
...
|
|
20
|
+
...mTableBodyProps,
|
|
16
21
|
...tableInstance.getTableBodyProps(),
|
|
17
22
|
style: {
|
|
18
23
|
...tableInstance.getTableBodyProps().style,
|
|
19
|
-
...
|
|
24
|
+
...mTableBodyProps?.style,
|
|
20
25
|
},
|
|
21
26
|
};
|
|
22
27
|
|
|
@@ -9,8 +9,13 @@ interface Props {}
|
|
|
9
9
|
export const MRT_TableFooter: FC<Props> = () => {
|
|
10
10
|
const { muiTableFooterProps, tableInstance } = useMRT();
|
|
11
11
|
|
|
12
|
+
const tableFooterProps =
|
|
13
|
+
muiTableFooterProps instanceof Function
|
|
14
|
+
? muiTableFooterProps(tableInstance)
|
|
15
|
+
: muiTableFooterProps;
|
|
16
|
+
|
|
12
17
|
return (
|
|
13
|
-
<TableFooter {...
|
|
18
|
+
<TableFooter {...tableFooterProps}>
|
|
14
19
|
{tableInstance.footerGroups.map((footerGroup: MRT_HeaderGroup) => (
|
|
15
20
|
<MRT_TableFooterRow
|
|
16
21
|
key={footerGroup.getFooterGroupProps().key}
|
package/src/table/MRT_Table.tsx
CHANGED
|
@@ -11,12 +11,17 @@ export const MRT_Table: FC<Props> = () => {
|
|
|
11
11
|
const { tableInstance, muiTableProps, hideTableHead, hideTableFooter } =
|
|
12
12
|
useMRT();
|
|
13
13
|
|
|
14
|
+
const mTableProps =
|
|
15
|
+
muiTableProps instanceof Function
|
|
16
|
+
? muiTableProps(tableInstance)
|
|
17
|
+
: muiTableProps;
|
|
18
|
+
|
|
14
19
|
const tableProps = {
|
|
15
|
-
...
|
|
20
|
+
...mTableProps,
|
|
16
21
|
...tableInstance.getTableProps(),
|
|
17
22
|
style: {
|
|
18
23
|
...tableInstance.getTableProps().style,
|
|
19
|
-
...
|
|
24
|
+
...mTableProps?.style,
|
|
20
25
|
},
|
|
21
26
|
};
|
|
22
27
|
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import React, { FC, useEffect, useRef } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
LinearProgress,
|
|
4
|
+
Paper,
|
|
5
|
+
TableContainer,
|
|
6
|
+
Collapse,
|
|
7
|
+
Box,
|
|
8
|
+
} from '@mui/material';
|
|
3
9
|
import { useMRT } from '../useMRT';
|
|
4
10
|
import { MRT_Table } from './MRT_Table';
|
|
5
11
|
import { MRT_ToolbarTop } from '../toolbar/MRT_ToolbarTop';
|
|
@@ -63,7 +69,14 @@ export const MRT_TableContainer: FC<Props> = () => {
|
|
|
63
69
|
<Collapse in={isFetching || isLoading} unmountOnExit>
|
|
64
70
|
<LinearProgress />
|
|
65
71
|
</Collapse>
|
|
66
|
-
<
|
|
72
|
+
<Box
|
|
73
|
+
sx={{
|
|
74
|
+
maxWidth: '100%',
|
|
75
|
+
overflowX: 'auto',
|
|
76
|
+
}}
|
|
77
|
+
>
|
|
78
|
+
<MRT_Table />
|
|
79
|
+
</Box>
|
|
67
80
|
{!hideToolbarBottom && <MRT_ToolbarBottom />}
|
|
68
81
|
</TableContainer>
|
|
69
82
|
);
|