material-react-table 0.9.5 → 0.9.6
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 +2 -0
- package/dist/material-react-table.cjs.development.js +26 -22
- 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 +26 -22
- package/dist/material-react-table.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/MaterialReactTable.tsx +3 -1
- package/src/body/MRT_TableBody.tsx +7 -1
- package/src/body/MRT_TableBodyCell.tsx +1 -3
- package/src/body/MRT_TableDetailPanel.tsx +3 -2
- package/src/head/MRT_TableHeadCell.tsx +1 -3
- package/src/table/MRT_Table.tsx +1 -1
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.9.
|
|
2
|
+
"version": "0.9.6",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"name": "material-react-table",
|
|
5
5
|
"description": "A fully featured Material UI implementation of TanStack React Table, inspired by material-table and the MUI X DataGrid, written from the ground up in TypeScript.",
|
|
@@ -43,6 +43,7 @@ import {
|
|
|
43
43
|
UseTableInstanceOptions,
|
|
44
44
|
VisibilityState,
|
|
45
45
|
} from '@tanstack/react-table';
|
|
46
|
+
import { Options as VirtualizerOptions } from 'react-virtual';
|
|
46
47
|
import { MRT_Localization, MRT_DefaultLocalization_EN } from './localization';
|
|
47
48
|
import { MRT_Default_Icons, MRT_Icons } from './icons';
|
|
48
49
|
import { MRT_FILTER_OPTION } from './enums';
|
|
@@ -770,12 +771,13 @@ export type MaterialReactTableProps<D extends Record<string, any> = {}> =
|
|
|
770
771
|
rowNumberMode?: 'original' | 'static';
|
|
771
772
|
selectAllMode?: 'all' | 'page';
|
|
772
773
|
tableId?: string;
|
|
774
|
+
virtualizerProps?: VirtualizerOptions<HTMLDivElement>;
|
|
773
775
|
};
|
|
774
776
|
|
|
775
777
|
export default <D extends Record<string, any> = {}>({
|
|
776
778
|
autoResetExpanded = false,
|
|
777
779
|
columnResizeMode = 'onEnd',
|
|
778
|
-
defaultColumn = { minSize:
|
|
780
|
+
defaultColumn = { minSize: 40, maxSize: 1000, size: 180 },
|
|
779
781
|
editingMode = 'row',
|
|
780
782
|
enableColumnActions = true,
|
|
781
783
|
enableColumnFilters = true,
|
|
@@ -17,7 +17,12 @@ export const MRT_TableBody: FC<Props> = ({
|
|
|
17
17
|
getPaginationRowModel,
|
|
18
18
|
getPrePaginationRowModel,
|
|
19
19
|
getState,
|
|
20
|
-
options: {
|
|
20
|
+
options: {
|
|
21
|
+
enablePagination,
|
|
22
|
+
enableRowVirtualization,
|
|
23
|
+
muiTableBodyProps,
|
|
24
|
+
virtualizerProps,
|
|
25
|
+
},
|
|
21
26
|
} = tableInstance;
|
|
22
27
|
|
|
23
28
|
const { isDensePadding } = getState();
|
|
@@ -36,6 +41,7 @@ export const MRT_TableBody: FC<Props> = ({
|
|
|
36
41
|
overscan: isDensePadding ? 15 : 5,
|
|
37
42
|
size: rows.length,
|
|
38
43
|
parentRef: tableContainerRef,
|
|
44
|
+
...virtualizerProps,
|
|
39
45
|
})
|
|
40
46
|
: ({} as any);
|
|
41
47
|
|
|
@@ -184,12 +184,10 @@ export const MRT_TableBodyCell: FC<Props> = ({
|
|
|
184
184
|
: undefined,
|
|
185
185
|
},
|
|
186
186
|
...(tableCellProps?.sx as any),
|
|
187
|
-
})}
|
|
188
|
-
style={{
|
|
189
187
|
maxWidth: `min(${column.getSize()}px, fit-content)`,
|
|
190
188
|
minWidth: `max(${column.getSize()}px, ${columnDef.minSize ?? 30}px)`,
|
|
191
189
|
width: column.getSize(),
|
|
192
|
-
}}
|
|
190
|
+
})}
|
|
193
191
|
>
|
|
194
192
|
<>
|
|
195
193
|
{isLoading || showSkeletons ? (
|
|
@@ -9,7 +9,7 @@ interface Props {
|
|
|
9
9
|
|
|
10
10
|
export const MRT_TableDetailPanel: FC<Props> = ({ row, tableInstance }) => {
|
|
11
11
|
const {
|
|
12
|
-
|
|
12
|
+
getVisibleLeafColumns,
|
|
13
13
|
options: {
|
|
14
14
|
muiTableBodyRowProps,
|
|
15
15
|
muiTableDetailPanelProps,
|
|
@@ -31,7 +31,7 @@ export const MRT_TableDetailPanel: FC<Props> = ({ row, tableInstance }) => {
|
|
|
31
31
|
return (
|
|
32
32
|
<TableRow {...tableRowProps}>
|
|
33
33
|
<TableCell
|
|
34
|
-
colSpan={
|
|
34
|
+
colSpan={getVisibleLeafColumns().length}
|
|
35
35
|
onClick={(event: MouseEvent<HTMLTableCellElement>) =>
|
|
36
36
|
onMrtDetailPanelClick?.({ event, row, tableInstance })
|
|
37
37
|
}
|
|
@@ -41,6 +41,7 @@ export const MRT_TableDetailPanel: FC<Props> = ({ row, tableInstance }) => {
|
|
|
41
41
|
pb: row.getIsExpanded() ? '1rem' : 0,
|
|
42
42
|
pt: row.getIsExpanded() ? '1rem' : 0,
|
|
43
43
|
transition: 'all 0.2s ease-in-out',
|
|
44
|
+
width: `${tableInstance.getTotalSize()}px`,
|
|
44
45
|
...tableCellProps?.sx,
|
|
45
46
|
}}
|
|
46
47
|
>
|
|
@@ -136,12 +136,10 @@ export const MRT_TableHeadCell: FC<Props> = ({
|
|
|
136
136
|
? 2
|
|
137
137
|
: 1,
|
|
138
138
|
...(tableCellProps?.sx as any),
|
|
139
|
-
})}
|
|
140
|
-
style={{
|
|
141
139
|
maxWidth: `min(${column.getSize()}px, fit-content)`,
|
|
142
140
|
minWidth: `max(${column.getSize()}px, ${columnDef.minSize ?? 30}px)`,
|
|
143
141
|
width: header.getSize(),
|
|
144
|
-
}}
|
|
142
|
+
})}
|
|
145
143
|
>
|
|
146
144
|
{header.isPlaceholder ? null : columnDefType === 'display' ? (
|
|
147
145
|
headerElement
|
package/src/table/MRT_Table.tsx
CHANGED
|
@@ -33,7 +33,7 @@ export const MRT_Table: FC<Props> = ({ tableContainerRef, tableInstance }) => {
|
|
|
33
33
|
{...tableProps}
|
|
34
34
|
sx={{
|
|
35
35
|
tableLayout:
|
|
36
|
-
enableColumnResizing || enableRowVirtualization ? 'fixed' :
|
|
36
|
+
enableColumnResizing || enableRowVirtualization ? 'fixed' : 'auto',
|
|
37
37
|
...tableProps?.sx,
|
|
38
38
|
}}
|
|
39
39
|
>
|