material-react-table 1.2.1 → 1.2.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/cjs/column.utils.d.ts +1 -1
- package/dist/cjs/index.js +98 -39
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/table/MRT_TableRoot.d.ts +2 -2
- package/dist/esm/column.utils.d.ts +1 -1
- package/dist/esm/material-react-table.esm.js +68 -39
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/table/MRT_TableRoot.d.ts +2 -2
- package/package.json +1 -1
- package/src/body/MRT_TableDetailPanel.tsx +2 -6
- package/src/buttons/MRT_ExpandAllButton.tsx +4 -2
- package/src/column.utils.ts +3 -3
- package/src/head/MRT_TableHeadCell.tsx +3 -3
- package/src/icons.ts +60 -62
- package/src/inputs/MRT_SelectCheckbox.tsx +2 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { MRT_Cell, MRT_Column, MRT_ColumnDef, MRT_FilterOption, MRT_Row, MRT_TableInstance, MRT_TableState, MaterialReactTableProps, MRT_Localization } from '..';
|
|
3
|
-
export declare const MRT_TableRoot: <TData extends Record<string, any> = {}>(props: Omit<Partial<import("@tanstack/table-core").TableOptions<TData>>, "
|
|
3
|
+
export declare const MRT_TableRoot: <TData extends Record<string, any> = {}>(props: Omit<Partial<import("@tanstack/table-core").TableOptions<TData>>, "state" | "data" | "onStateChange" | "initialState" | "columns" | "defaultColumn" | "enableRowSelection" | "expandRowsFn"> & {
|
|
4
4
|
columnFilterModeOptions?: (string | (string & Record<never, never>))[] | null | undefined;
|
|
5
5
|
columns: MRT_ColumnDef<TData>[];
|
|
6
6
|
data: TData[];
|
|
@@ -13,7 +13,7 @@ export declare const MRT_TableRoot: <TData extends Record<string, any> = {}>(pro
|
|
|
13
13
|
"mrt-row-select": Partial<MRT_ColumnDef<{}>>;
|
|
14
14
|
"mrt-row-numbers": Partial<MRT_ColumnDef<{}>>;
|
|
15
15
|
}> | undefined;
|
|
16
|
-
editingMode?: "
|
|
16
|
+
editingMode?: "cell" | "row" | "table" | "modal" | undefined;
|
|
17
17
|
enableBottomToolbar?: boolean | undefined;
|
|
18
18
|
enableClickToCopy?: boolean | undefined;
|
|
19
19
|
enableColumnActions?: boolean | undefined;
|
package/package.json
CHANGED
|
@@ -46,12 +46,8 @@ export const MRT_TableDetailPanel: FC<Props> = ({ row, table }) => {
|
|
|
46
46
|
})}
|
|
47
47
|
>
|
|
48
48
|
{renderDetailPanel && (
|
|
49
|
-
<Collapse
|
|
50
|
-
|
|
51
|
-
mountOnEnter
|
|
52
|
-
unmountOnExit
|
|
53
|
-
>
|
|
54
|
-
{renderDetailPanel({ row, table })}
|
|
49
|
+
<Collapse in={row.getIsExpanded()} mountOnEnter unmountOnExit>
|
|
50
|
+
{!isLoading && renderDetailPanel({ row, table })}
|
|
55
51
|
</Collapse>
|
|
56
52
|
)}
|
|
57
53
|
</TableCell>
|
|
@@ -20,7 +20,7 @@ export const MRT_ExpandAllButton: FC<Props> = ({ table }) => {
|
|
|
20
20
|
},
|
|
21
21
|
toggleAllRowsExpanded,
|
|
22
22
|
} = table;
|
|
23
|
-
const { density } = getState();
|
|
23
|
+
const { density, isLoading } = getState();
|
|
24
24
|
|
|
25
25
|
const iconButtonProps =
|
|
26
26
|
muiExpandAllButtonProps instanceof Function
|
|
@@ -37,7 +37,9 @@ export const MRT_ExpandAllButton: FC<Props> = ({ table }) => {
|
|
|
37
37
|
<span>
|
|
38
38
|
<IconButton
|
|
39
39
|
aria-label={localization.expandAll}
|
|
40
|
-
disabled={
|
|
40
|
+
disabled={
|
|
41
|
+
isLoading || (!renderDetailPanel && !getCanSomeRowsExpand())
|
|
42
|
+
}
|
|
41
43
|
onClick={() => toggleAllRowsExpanded(!getIsAllRowsExpanded())}
|
|
42
44
|
{...iconButtonProps}
|
|
43
45
|
sx={(theme) => ({
|
package/src/column.utils.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ColumnOrderState, GroupingState } from '@tanstack/react-table';
|
|
2
2
|
import { alpha, lighten, TableCellProps, Theme } from '@mui/material';
|
|
3
|
-
import {
|
|
3
|
+
import { MRT_FilterFns } from './filterFns';
|
|
4
|
+
import { MRT_SortingFns } from './sortingFns';
|
|
5
|
+
import type {
|
|
4
6
|
MaterialReactTableProps,
|
|
5
7
|
MRT_Column,
|
|
6
8
|
MRT_ColumnDef,
|
|
@@ -10,8 +12,6 @@ import {
|
|
|
10
12
|
MRT_Header,
|
|
11
13
|
MRT_TableInstance,
|
|
12
14
|
} from '.';
|
|
13
|
-
import { MRT_FilterFns } from './filterFns';
|
|
14
|
-
import { MRT_SortingFns } from './sortingFns';
|
|
15
15
|
|
|
16
16
|
export const getColumnId = <TData extends Record<string, any> = {}>(
|
|
17
17
|
columnDef: MRT_ColumnDef<TData>,
|
|
@@ -198,7 +198,7 @@ export const MRT_TableHeadCell: FC<Props> = ({ header, table }) => {
|
|
|
198
198
|
display: 'flex',
|
|
199
199
|
flexDirection:
|
|
200
200
|
tableCellProps?.align === 'right' ? 'row-reverse' : 'row',
|
|
201
|
-
overflow: 'hidden',
|
|
201
|
+
overflow: columnDefType === 'data' ? 'hidden' : undefined,
|
|
202
202
|
pl:
|
|
203
203
|
tableCellProps?.align === 'center'
|
|
204
204
|
? `${headerPL}rem`
|
|
@@ -208,12 +208,12 @@ export const MRT_TableHeadCell: FC<Props> = ({ header, table }) => {
|
|
|
208
208
|
<Box
|
|
209
209
|
className="Mui-TableHeadCell-Content-Wrapper"
|
|
210
210
|
sx={{
|
|
211
|
-
overflow: 'hidden',
|
|
211
|
+
overflow: columnDefType === 'data' ? 'hidden' : undefined,
|
|
212
212
|
textOverflow: 'ellipsis',
|
|
213
213
|
whiteSpace:
|
|
214
214
|
(columnDef.header?.length ?? 0) < 20 ? 'nowrap' : 'normal',
|
|
215
215
|
}}
|
|
216
|
-
title={columnDef.header}
|
|
216
|
+
title={columnDefType === 'data' ? columnDef.header : undefined}
|
|
217
217
|
>
|
|
218
218
|
{headerElement}
|
|
219
219
|
</Box>
|
package/src/icons.ts
CHANGED
|
@@ -1,35 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
VisibilityOff,
|
|
32
|
-
} from '@mui/icons-material';
|
|
1
|
+
import ArrowRightIcon from '@mui/icons-material/ArrowRight';
|
|
2
|
+
import CancelIcon from '@mui/icons-material/Cancel';
|
|
3
|
+
import CheckBoxIcon from '@mui/icons-material/CheckBox';
|
|
4
|
+
import ClearAllIcon from '@mui/icons-material/ClearAll';
|
|
5
|
+
import CloseIcon from '@mui/icons-material/Close';
|
|
6
|
+
import DensityLargeIcon from '@mui/icons-material/DensityLarge';
|
|
7
|
+
import DensityMediumIcon from '@mui/icons-material/DensityMedium';
|
|
8
|
+
import DensitySmallIcon from '@mui/icons-material/DensitySmall';
|
|
9
|
+
import DragHandleIcon from '@mui/icons-material/DragHandle';
|
|
10
|
+
import DynamicFeedIcon from '@mui/icons-material/DynamicFeed';
|
|
11
|
+
import EditIcon from '@mui/icons-material/Edit';
|
|
12
|
+
import ExpandLessIcon from '@mui/icons-material/ExpandLess';
|
|
13
|
+
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
14
|
+
import FilterAltIcon from '@mui/icons-material/FilterAlt';
|
|
15
|
+
import FilterAltOffIcon from '@mui/icons-material/FilterAltOff';
|
|
16
|
+
import FilterListIcon from '@mui/icons-material/FilterList';
|
|
17
|
+
import FilterListOffIcon from '@mui/icons-material/FilterListOff';
|
|
18
|
+
import FullscreenExitIcon from '@mui/icons-material/FullscreenExit';
|
|
19
|
+
import FullscreenIcon from '@mui/icons-material/Fullscreen';
|
|
20
|
+
import KeyboardDoubleArrowDownIcon from '@mui/icons-material/KeyboardDoubleArrowDown';
|
|
21
|
+
import MoreHorizIcon from '@mui/icons-material/MoreHoriz';
|
|
22
|
+
import MoreVertIcon from '@mui/icons-material/MoreVert';
|
|
23
|
+
import PushPinIcon from '@mui/icons-material/PushPin';
|
|
24
|
+
import RestartAltIcon from '@mui/icons-material/RestartAlt';
|
|
25
|
+
import SaveIcon from '@mui/icons-material/Save';
|
|
26
|
+
import SearchIcon from '@mui/icons-material/Search';
|
|
27
|
+
import SearchOffIcon from '@mui/icons-material/SearchOff';
|
|
28
|
+
import SortIcon from '@mui/icons-material/Sort';
|
|
29
|
+
import ViewColumnIcon from '@mui/icons-material/ViewColumn';
|
|
30
|
+
import VisibilityOffIcon from '@mui/icons-material/VisibilityOff';
|
|
33
31
|
|
|
34
32
|
export interface MRT_Icons {
|
|
35
33
|
ArrowRightIcon: any;
|
|
@@ -65,34 +63,34 @@ export interface MRT_Icons {
|
|
|
65
63
|
}
|
|
66
64
|
|
|
67
65
|
export const MRT_Default_Icons: MRT_Icons = {
|
|
68
|
-
ArrowRightIcon
|
|
69
|
-
CancelIcon
|
|
70
|
-
CheckBoxIcon
|
|
71
|
-
ClearAllIcon
|
|
72
|
-
CloseIcon
|
|
73
|
-
DensityLargeIcon
|
|
74
|
-
DensityMediumIcon
|
|
75
|
-
DensitySmallIcon
|
|
76
|
-
DragHandleIcon
|
|
77
|
-
DynamicFeedIcon
|
|
78
|
-
EditIcon
|
|
79
|
-
ExpandLessIcon
|
|
80
|
-
ExpandMoreIcon
|
|
81
|
-
FilterAltIcon
|
|
82
|
-
FilterAltOffIcon
|
|
83
|
-
FilterListIcon
|
|
84
|
-
FilterListOffIcon
|
|
85
|
-
FullscreenExitIcon
|
|
86
|
-
FullscreenIcon
|
|
87
|
-
KeyboardDoubleArrowDownIcon
|
|
88
|
-
MoreHorizIcon
|
|
89
|
-
MoreVertIcon
|
|
90
|
-
PushPinIcon
|
|
91
|
-
RestartAltIcon
|
|
92
|
-
SaveIcon
|
|
93
|
-
SearchIcon
|
|
94
|
-
SearchOffIcon
|
|
95
|
-
SortIcon
|
|
96
|
-
ViewColumnIcon
|
|
97
|
-
VisibilityOffIcon
|
|
66
|
+
ArrowRightIcon,
|
|
67
|
+
CancelIcon,
|
|
68
|
+
CheckBoxIcon,
|
|
69
|
+
ClearAllIcon,
|
|
70
|
+
CloseIcon,
|
|
71
|
+
DensityLargeIcon,
|
|
72
|
+
DensityMediumIcon,
|
|
73
|
+
DensitySmallIcon,
|
|
74
|
+
DragHandleIcon,
|
|
75
|
+
DynamicFeedIcon,
|
|
76
|
+
EditIcon,
|
|
77
|
+
ExpandLessIcon,
|
|
78
|
+
ExpandMoreIcon,
|
|
79
|
+
FilterAltIcon,
|
|
80
|
+
FilterAltOffIcon,
|
|
81
|
+
FilterListIcon,
|
|
82
|
+
FilterListOffIcon,
|
|
83
|
+
FullscreenExitIcon,
|
|
84
|
+
FullscreenIcon,
|
|
85
|
+
KeyboardDoubleArrowDownIcon,
|
|
86
|
+
MoreHorizIcon,
|
|
87
|
+
MoreVertIcon,
|
|
88
|
+
PushPinIcon,
|
|
89
|
+
RestartAltIcon,
|
|
90
|
+
SaveIcon,
|
|
91
|
+
SearchIcon,
|
|
92
|
+
SearchOffIcon,
|
|
93
|
+
SortIcon,
|
|
94
|
+
ViewColumnIcon,
|
|
95
|
+
VisibilityOffIcon,
|
|
98
96
|
};
|
|
@@ -19,7 +19,7 @@ export const MRT_SelectCheckbox: FC<Props> = ({ row, selectAll, table }) => {
|
|
|
19
19
|
selectAllMode,
|
|
20
20
|
},
|
|
21
21
|
} = table;
|
|
22
|
-
const { density } = getState();
|
|
22
|
+
const { density, isLoading } = getState();
|
|
23
23
|
|
|
24
24
|
const checkboxProps = !row
|
|
25
25
|
? muiSelectAllCheckboxProps instanceof Function
|
|
@@ -35,6 +35,7 @@ export const MRT_SelectCheckbox: FC<Props> = ({ row, selectAll, table }) => {
|
|
|
35
35
|
? table.getIsAllPageRowsSelected()
|
|
36
36
|
: table.getIsAllRowsSelected()
|
|
37
37
|
: row?.getIsSelected(),
|
|
38
|
+
disabled: isLoading,
|
|
38
39
|
inputProps: {
|
|
39
40
|
'aria-label': selectAll
|
|
40
41
|
? localization.toggleSelectAll
|