material-react-table 0.4.7 → 0.5.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/MaterialReactTable.d.ts +66 -21
- package/dist/body/MRT_TableBodyCell.d.ts +12 -5
- package/dist/body/MRT_TableBodyRow.d.ts +3 -18
- package/dist/body/MRT_TableDetailPanel.d.ts +2 -2
- package/dist/buttons/MRT_EditActionButtons.d.ts +2 -2
- package/dist/buttons/MRT_ExpandButton.d.ts +2 -2
- package/dist/buttons/MRT_ToggleColumnActionMenuButton.d.ts +2 -2
- package/dist/buttons/MRT_ToggleRowActionMenuButton.d.ts +2 -2
- package/dist/footer/MRT_TableFooterCell.d.ts +2 -2
- package/dist/footer/MRT_TableFooterRow.d.ts +2 -2
- package/dist/head/MRT_TableHeadCell.d.ts +10 -6
- package/dist/head/MRT_TableHeadRow.d.ts +2 -2
- package/dist/inputs/MRT_EditCellTextField.d.ts +2 -2
- package/dist/inputs/MRT_FilterTextField.d.ts +2 -2
- package/dist/inputs/MRT_SelectCheckbox.d.ts +2 -2
- package/dist/material-react-table.cjs.development.js +412 -485
- 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 +416 -489
- package/dist/material-react-table.esm.js.map +1 -1
- package/dist/menus/MRT_ColumnActionMenu.d.ts +2 -2
- package/dist/menus/MRT_RowActionMenu.d.ts +2 -2
- package/dist/menus/MRT_ShowHideColumnsMenu.d.ts +2 -2
- package/dist/useMRT.d.ts +4 -4
- package/package.json +3 -3
- package/src/@types/react-table-config.d.ts +18 -121
- package/src/MaterialReactTable.tsx +181 -21
- package/src/body/MRT_TableBody.tsx +8 -8
- package/src/body/MRT_TableBodyCell.tsx +22 -13
- package/src/body/MRT_TableBodyRow.tsx +20 -17
- package/src/body/MRT_TableDetailPanel.tsx +12 -29
- package/src/buttons/MRT_EditActionButtons.tsx +5 -10
- package/src/buttons/MRT_ExpandAllButton.tsx +5 -5
- package/src/buttons/MRT_ExpandButton.tsx +12 -12
- package/src/buttons/MRT_ShowHideColumnsButton.tsx +11 -10
- package/src/buttons/MRT_ToggleColumnActionMenuButton.tsx +13 -14
- package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +11 -10
- package/src/footer/MRT_TableFooter.tsx +2 -1
- package/src/footer/MRT_TableFooterCell.tsx +12 -19
- package/src/footer/MRT_TableFooterRow.tsx +4 -4
- package/src/head/MRT_TableHead.tsx +2 -1
- package/src/head/MRT_TableHeadCell.tsx +49 -56
- package/src/head/MRT_TableHeadCellActions.tsx +5 -4
- package/src/head/MRT_TableHeadRow.tsx +8 -7
- package/src/index.tsx +2 -0
- package/src/inputs/MRT_EditCellTextField.tsx +2 -2
- package/src/inputs/MRT_FilterTextField.tsx +3 -2
- package/src/inputs/MRT_SearchTextField.tsx +2 -11
- package/src/inputs/MRT_SelectCheckbox.tsx +6 -6
- package/src/menus/MRT_ColumnActionMenu.tsx +19 -8
- package/src/menus/MRT_RowActionMenu.tsx +4 -9
- package/src/menus/MRT_ShowHideColumnsMenu.tsx +4 -3
- package/src/table/MRT_Table.tsx +1 -1
- package/src/table/MRT_TableContainer.tsx +19 -44
- package/src/table/MRT_TableSpacerCell.tsx +4 -3
- package/src/toolbar/MRT_TablePagination.tsx +6 -1
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +19 -29
- package/src/toolbar/MRT_ToolbarBottom.tsx +23 -20
- package/src/toolbar/MRT_ToolbarInternalButtons.tsx +13 -12
- package/src/toolbar/MRT_ToolbarTop.tsx +38 -35
- package/src/useMRT.tsx +18 -15
- package/dist/table/MRT_TableButtonCell.d.ts +0 -3
- package/src/table/MRT_TableButtonCell.tsx +0 -9
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React, { FC, MouseEvent } from 'react';
|
|
2
|
-
import { alpha,
|
|
3
|
-
import { Row } from 'react-table';
|
|
2
|
+
import { alpha, TableCell, TableRow } from '@mui/material';
|
|
4
3
|
import {
|
|
5
|
-
|
|
4
|
+
commonTableBodyCellStyles,
|
|
6
5
|
MRT_TableBodyCell,
|
|
7
6
|
} from './MRT_TableBodyCell';
|
|
8
7
|
import { useMRT } from '../useMRT';
|
|
@@ -10,22 +9,16 @@ import { MRT_TableDetailPanel } from './MRT_TableDetailPanel';
|
|
|
10
9
|
import { MRT_ExpandButton } from '../buttons/MRT_ExpandButton';
|
|
11
10
|
import { MRT_SelectCheckbox } from '../inputs/MRT_SelectCheckbox';
|
|
12
11
|
import { MRT_ToggleRowActionMenuButton } from '../buttons/MRT_ToggleRowActionMenuButton';
|
|
13
|
-
|
|
14
|
-
export const TableRow = styled(MuiTableRow, {
|
|
15
|
-
shouldForwardProp: (prop) => prop !== 'isSelected',
|
|
16
|
-
})<{ isSelected?: boolean }>(({ isSelected, theme }) => ({
|
|
17
|
-
backgroundColor: isSelected
|
|
18
|
-
? alpha(theme.palette.primary.light, 0.1)
|
|
19
|
-
: 'transparent',
|
|
20
|
-
}));
|
|
12
|
+
import { MRT_Cell, MRT_Row } from '..';
|
|
21
13
|
|
|
22
14
|
interface Props {
|
|
23
|
-
row:
|
|
15
|
+
row: MRT_Row;
|
|
24
16
|
}
|
|
25
17
|
|
|
26
18
|
export const MRT_TableBodyRow: FC<Props> = ({ row }) => {
|
|
27
19
|
const {
|
|
28
20
|
anyRowsCanExpand,
|
|
21
|
+
densePadding,
|
|
29
22
|
enableRowActions,
|
|
30
23
|
enableRowEditing,
|
|
31
24
|
enableRowNumbers,
|
|
@@ -46,22 +39,30 @@ export const MRT_TableBodyRow: FC<Props> = ({ row }) => {
|
|
|
46
39
|
...row.getRowProps(),
|
|
47
40
|
style: {
|
|
48
41
|
...row.getRowProps().style,
|
|
49
|
-
...
|
|
42
|
+
...mTableBodyRowProps?.style,
|
|
50
43
|
},
|
|
51
44
|
};
|
|
52
45
|
|
|
53
46
|
return (
|
|
54
47
|
<>
|
|
55
48
|
<TableRow
|
|
56
|
-
isSelected={row.isSelected}
|
|
57
49
|
hover
|
|
58
50
|
onClick={(event: MouseEvent<HTMLTableRowElement>) =>
|
|
59
51
|
onRowClick?.(event, row)
|
|
60
52
|
}
|
|
61
53
|
{...tableRowProps}
|
|
54
|
+
//@ts-ignore
|
|
55
|
+
sx={(theme) => ({
|
|
56
|
+
backgroundColor: row.isSelected
|
|
57
|
+
? alpha(theme.palette.primary.light, 0.1)
|
|
58
|
+
: 'transparent',
|
|
59
|
+
...tableRowProps?.sx,
|
|
60
|
+
})}
|
|
62
61
|
>
|
|
63
62
|
{enableRowNumbers && (
|
|
64
|
-
<
|
|
63
|
+
<TableCell sx={{ ...commonTableBodyCellStyles(densePadding) }}>
|
|
64
|
+
{row.index + 1}
|
|
65
|
+
</TableCell>
|
|
65
66
|
)}
|
|
66
67
|
{(enableRowActions || enableRowEditing) &&
|
|
67
68
|
positionActionsColumn === 'first' && (
|
|
@@ -71,7 +72,7 @@ export const MRT_TableBodyRow: FC<Props> = ({ row }) => {
|
|
|
71
72
|
<MRT_ExpandButton row={row} />
|
|
72
73
|
)}
|
|
73
74
|
{enableSelection && <MRT_SelectCheckbox row={row} />}
|
|
74
|
-
{row.cells.map((cell) => (
|
|
75
|
+
{row.cells.map((cell: MRT_Cell) => (
|
|
75
76
|
<MRT_TableBodyCell key={cell.getCellProps().key} cell={cell} />
|
|
76
77
|
))}
|
|
77
78
|
{(enableRowActions || enableRowEditing) &&
|
|
@@ -79,7 +80,9 @@ export const MRT_TableBodyRow: FC<Props> = ({ row }) => {
|
|
|
79
80
|
<MRT_ToggleRowActionMenuButton row={row} />
|
|
80
81
|
)}
|
|
81
82
|
</TableRow>
|
|
82
|
-
{renderDetailPanel &&
|
|
83
|
+
{renderDetailPanel && !row.isGrouped && (
|
|
84
|
+
<MRT_TableDetailPanel row={row} />
|
|
85
|
+
)}
|
|
83
86
|
</>
|
|
84
87
|
);
|
|
85
88
|
};
|
|
@@ -1,24 +1,10 @@
|
|
|
1
1
|
import React, { FC, MouseEvent } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
Collapse,
|
|
4
|
-
styled,
|
|
5
|
-
TableCell as MuiTableCell,
|
|
6
|
-
TableRow,
|
|
7
|
-
} from '@mui/material';
|
|
8
|
-
import { Row } from 'react-table';
|
|
2
|
+
import { Collapse, TableCell, TableRow } from '@mui/material';
|
|
9
3
|
import { useMRT } from '../useMRT';
|
|
10
|
-
|
|
11
|
-
const TableCell = styled(MuiTableCell, {
|
|
12
|
-
shouldForwardProp: (prop) => prop !== 'isExpanded',
|
|
13
|
-
})<{ isExpanded?: boolean }>(({ isExpanded }) => ({
|
|
14
|
-
borderBottom: !isExpanded ? 'none' : undefined,
|
|
15
|
-
paddingBottom: isExpanded ? '1rem' : 0,
|
|
16
|
-
paddingTop: isExpanded ? '1rem' : 0,
|
|
17
|
-
transition: 'all 0.2s ease-in-out',
|
|
18
|
-
}));
|
|
4
|
+
import { MRT_Row } from '..';
|
|
19
5
|
|
|
20
6
|
interface Props {
|
|
21
|
-
row:
|
|
7
|
+
row: MRT_Row;
|
|
22
8
|
}
|
|
23
9
|
|
|
24
10
|
export const MRT_TableDetailPanel: FC<Props> = ({ row }) => {
|
|
@@ -30,34 +16,31 @@ export const MRT_TableDetailPanel: FC<Props> = ({ row }) => {
|
|
|
30
16
|
tableInstance,
|
|
31
17
|
} = useMRT();
|
|
32
18
|
|
|
33
|
-
const
|
|
19
|
+
const tableRowProps =
|
|
34
20
|
muiTableBodyRowProps instanceof Function
|
|
35
21
|
? muiTableBodyRowProps(row)
|
|
36
22
|
: muiTableBodyRowProps;
|
|
37
23
|
|
|
38
|
-
const tableRowProps = {
|
|
39
|
-
...mTableBodyRowProps,
|
|
40
|
-
...row.getRowProps(),
|
|
41
|
-
style: {
|
|
42
|
-
...row.getRowProps().style,
|
|
43
|
-
...(mTableBodyRowProps?.style ?? {}),
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
|
|
47
24
|
const tableCellProps =
|
|
48
25
|
muiTableDetailPanelProps instanceof Function
|
|
49
26
|
? muiTableDetailPanelProps(row)
|
|
50
27
|
: muiTableDetailPanelProps;
|
|
51
28
|
|
|
52
29
|
return (
|
|
53
|
-
<TableRow
|
|
30
|
+
<TableRow {...tableRowProps}>
|
|
54
31
|
<TableCell
|
|
55
32
|
colSpan={tableInstance.visibleColumns.length + 10}
|
|
56
|
-
isExpanded={row.isExpanded}
|
|
57
33
|
onClick={(event: MouseEvent<HTMLTableCellElement>) =>
|
|
58
34
|
onDetailPanelClick?.(event, row)
|
|
59
35
|
}
|
|
60
36
|
{...tableCellProps}
|
|
37
|
+
sx={{
|
|
38
|
+
borderBottom: !row.isExpanded ? 'none' : undefined,
|
|
39
|
+
pb: row.isExpanded ? '1rem' : 0,
|
|
40
|
+
pt: row.isExpanded ? '1rem' : 0,
|
|
41
|
+
transition: 'all 0.2s ease-in-out',
|
|
42
|
+
...tableCellProps?.sx,
|
|
43
|
+
}}
|
|
61
44
|
>
|
|
62
45
|
<Collapse in={row.isExpanded}>{renderDetailPanel?.(row)}</Collapse>
|
|
63
46
|
</TableCell>
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { Box, IconButton, Tooltip } from '@mui/material';
|
|
3
3
|
import { useMRT } from '../useMRT';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
const EditActionButtonWrappers = styled('div')({
|
|
7
|
-
display: 'flex',
|
|
8
|
-
gap: '0.75rem',
|
|
9
|
-
});
|
|
4
|
+
import { MRT_Row } from '..';
|
|
10
5
|
|
|
11
6
|
interface Props {
|
|
12
|
-
row:
|
|
7
|
+
row: MRT_Row;
|
|
13
8
|
}
|
|
14
9
|
|
|
15
10
|
export const MRT_EditActionButtons: FC<Props> = ({ row }) => {
|
|
@@ -32,7 +27,7 @@ export const MRT_EditActionButtons: FC<Props> = ({ row }) => {
|
|
|
32
27
|
};
|
|
33
28
|
|
|
34
29
|
return (
|
|
35
|
-
<
|
|
30
|
+
<Box sx={{ display: 'flex', gap: '0.75rem' }}>
|
|
36
31
|
<Tooltip arrow title={localization.rowActionButtonCancel}>
|
|
37
32
|
<IconButton
|
|
38
33
|
aria-label={localization.rowActionButtonCancel}
|
|
@@ -50,6 +45,6 @@ export const MRT_EditActionButtons: FC<Props> = ({ row }) => {
|
|
|
50
45
|
<SaveIcon />
|
|
51
46
|
</IconButton>
|
|
52
47
|
</Tooltip>
|
|
53
|
-
</
|
|
48
|
+
</Box>
|
|
54
49
|
);
|
|
55
50
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
|
-
import { IconButton } from '@mui/material';
|
|
2
|
+
import { IconButton, TableCell } from '@mui/material';
|
|
3
3
|
import { useMRT } from '../useMRT';
|
|
4
|
-
import {
|
|
4
|
+
import { commonTableBodyButtonCellStyles } from '../body/MRT_TableBodyCell';
|
|
5
5
|
|
|
6
6
|
interface Props {}
|
|
7
7
|
|
|
@@ -15,10 +15,10 @@ export const MRT_ExpandAllButton: FC<Props> = () => {
|
|
|
15
15
|
} = useMRT();
|
|
16
16
|
|
|
17
17
|
return (
|
|
18
|
-
<
|
|
18
|
+
<TableCell
|
|
19
19
|
size="small"
|
|
20
|
-
densePadding={densePadding}
|
|
21
20
|
{...tableInstance.getToggleAllRowsExpandedProps()}
|
|
21
|
+
sx={commonTableBodyButtonCellStyles(densePadding)}
|
|
22
22
|
>
|
|
23
23
|
<IconButton
|
|
24
24
|
aria-label={localization.expandAllButtonTitle}
|
|
@@ -33,6 +33,6 @@ export const MRT_ExpandAllButton: FC<Props> = () => {
|
|
|
33
33
|
}}
|
|
34
34
|
/>
|
|
35
35
|
</IconButton>
|
|
36
|
-
</
|
|
36
|
+
</TableCell>
|
|
37
37
|
);
|
|
38
38
|
};
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
|
-
import { IconButton,
|
|
3
|
-
import { Row } from 'react-table';
|
|
2
|
+
import { IconButton, TableCell } from '@mui/material';
|
|
4
3
|
import { useMRT } from '../useMRT';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
const TableCell = styled(MRT_TableButtonCell, {
|
|
8
|
-
shouldForwardProp: (prop) => prop !== 'depth',
|
|
9
|
-
})<{ depth: number }>(({ depth }) => ({
|
|
10
|
-
paddingLeft: `${depth + 0.5}rem`,
|
|
11
|
-
textAlign: 'left',
|
|
12
|
-
}));
|
|
4
|
+
import { MRT_Row } from '..';
|
|
5
|
+
import { commonTableBodyButtonCellStyles } from '../body/MRT_TableBodyCell';
|
|
13
6
|
|
|
14
7
|
interface Props {
|
|
15
|
-
row:
|
|
8
|
+
row: MRT_Row;
|
|
16
9
|
}
|
|
17
10
|
|
|
18
11
|
export const MRT_ExpandButton: FC<Props> = ({ row }) => {
|
|
@@ -24,7 +17,14 @@ export const MRT_ExpandButton: FC<Props> = ({ row }) => {
|
|
|
24
17
|
} = useMRT();
|
|
25
18
|
|
|
26
19
|
return (
|
|
27
|
-
<TableCell
|
|
20
|
+
<TableCell
|
|
21
|
+
size="small"
|
|
22
|
+
sx={{
|
|
23
|
+
...commonTableBodyButtonCellStyles(densePadding),
|
|
24
|
+
pl: `${row.depth + 0.5}rem`,
|
|
25
|
+
textAlign: 'left',
|
|
26
|
+
}}
|
|
27
|
+
>
|
|
28
28
|
<IconButton
|
|
29
29
|
aria-label={localization.expandButtonTitle}
|
|
30
30
|
disabled={!row.canExpand && !renderDetailPanel}
|
|
@@ -4,18 +4,13 @@ import {
|
|
|
4
4
|
IconButton,
|
|
5
5
|
Menu,
|
|
6
6
|
Tooltip,
|
|
7
|
-
styled,
|
|
8
7
|
Divider,
|
|
9
8
|
IconButtonProps,
|
|
9
|
+
Box,
|
|
10
10
|
} from '@mui/material';
|
|
11
11
|
import { useMRT } from '../useMRT';
|
|
12
12
|
import { MRT_ShowHideColumnsMenu } from '../menus/MRT_ShowHideColumnsMenu';
|
|
13
|
-
|
|
14
|
-
const MenuButtons = styled('div')({
|
|
15
|
-
display: 'flex',
|
|
16
|
-
justifyContent: 'space-between',
|
|
17
|
-
padding: '0 0.5rem 0.5rem 0.5rem',
|
|
18
|
-
});
|
|
13
|
+
import { MRT_ColumnInstance } from '..';
|
|
19
14
|
|
|
20
15
|
interface Props extends IconButtonProps {}
|
|
21
16
|
|
|
@@ -49,7 +44,13 @@ export const MRT_ShowHideColumnsButton: FC<Props> = ({ ...rest }) => {
|
|
|
49
44
|
open={!!anchorEl}
|
|
50
45
|
onClose={() => setAnchorEl(null)}
|
|
51
46
|
>
|
|
52
|
-
<
|
|
47
|
+
<Box
|
|
48
|
+
sx={{
|
|
49
|
+
display: 'flex',
|
|
50
|
+
justifyContent: 'space-between',
|
|
51
|
+
p: '0 0.5rem 0.5rem 0.5rem',
|
|
52
|
+
}}
|
|
53
|
+
>
|
|
53
54
|
<Button
|
|
54
55
|
disabled={
|
|
55
56
|
!tableInstance.getToggleHideAllColumnsProps().checked &&
|
|
@@ -65,9 +66,9 @@ export const MRT_ShowHideColumnsButton: FC<Props> = ({ ...rest }) => {
|
|
|
65
66
|
>
|
|
66
67
|
{localization.columnShowHideMenuShowAll}
|
|
67
68
|
</Button>
|
|
68
|
-
</
|
|
69
|
+
</Box>
|
|
69
70
|
<Divider />
|
|
70
|
-
{tableInstance.columns.map((column, index) => (
|
|
71
|
+
{tableInstance.columns.map((column: MRT_ColumnInstance, index) => (
|
|
71
72
|
<MRT_ShowHideColumnsMenu
|
|
72
73
|
key={`${index}-${column.id}`}
|
|
73
74
|
column={column}
|
|
@@ -1,22 +1,11 @@
|
|
|
1
1
|
import React, { FC, MouseEvent, useState } from 'react';
|
|
2
|
-
import { IconButton
|
|
2
|
+
import { IconButton, Tooltip } from '@mui/material';
|
|
3
3
|
import { useMRT } from '../useMRT';
|
|
4
4
|
import { MRT_ColumnActionMenu } from '../menus/MRT_ColumnActionMenu';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
const IconButton = styled(MuiIconButton)({
|
|
8
|
-
opacity: 0.5,
|
|
9
|
-
transition: 'opacity 0.2s',
|
|
10
|
-
marginRight: '2px',
|
|
11
|
-
height: '1.6rem',
|
|
12
|
-
width: '1.6rem',
|
|
13
|
-
'&:hover': {
|
|
14
|
-
opacity: 1,
|
|
15
|
-
},
|
|
16
|
-
});
|
|
5
|
+
import { MRT_HeaderGroup } from '..';
|
|
17
6
|
|
|
18
7
|
interface Props {
|
|
19
|
-
column:
|
|
8
|
+
column: MRT_HeaderGroup;
|
|
20
9
|
}
|
|
21
10
|
|
|
22
11
|
export const MRT_ToggleColumnActionMenuButton: FC<Props> = ({ column }) => {
|
|
@@ -45,6 +34,16 @@ export const MRT_ToggleColumnActionMenuButton: FC<Props> = ({ column }) => {
|
|
|
45
34
|
aria-label={localization.columnActionMenuButtonTitle}
|
|
46
35
|
onClick={handleClick}
|
|
47
36
|
size="small"
|
|
37
|
+
sx={{
|
|
38
|
+
opacity: 0.5,
|
|
39
|
+
transition: 'opacity 0.2s',
|
|
40
|
+
marginRight: '2px',
|
|
41
|
+
height: '1.6rem',
|
|
42
|
+
width: '1.6rem',
|
|
43
|
+
'&:hover': {
|
|
44
|
+
opacity: 1,
|
|
45
|
+
},
|
|
46
|
+
}}
|
|
48
47
|
>
|
|
49
48
|
<MoreVertIcon />
|
|
50
49
|
</IconButton>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React, { FC, MouseEvent, useState } from 'react';
|
|
2
|
-
import { IconButton
|
|
2
|
+
import { IconButton, TableCell, Tooltip } from '@mui/material';
|
|
3
3
|
import { useMRT } from '../useMRT';
|
|
4
|
-
import { Row } from 'react-table';
|
|
5
4
|
import { MRT_RowActionMenu } from '../menus/MRT_RowActionMenu';
|
|
6
5
|
import { MRT_EditActionButtons } from './MRT_EditActionButtons';
|
|
7
|
-
import {
|
|
6
|
+
import { MRT_Row } from '..';
|
|
7
|
+
import { commonTableBodyButtonCellStyles } from '../body/MRT_TableBodyCell';
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const commonIconButtonStyles = {
|
|
10
10
|
opacity: 0.5,
|
|
11
11
|
transition: 'opacity 0.2s',
|
|
12
12
|
marginRight: '2px',
|
|
@@ -15,10 +15,10 @@ const IconButton = styled(MuiIconButton)({
|
|
|
15
15
|
'&:hover': {
|
|
16
16
|
opacity: 1,
|
|
17
17
|
},
|
|
18
|
-
}
|
|
18
|
+
};
|
|
19
19
|
|
|
20
20
|
interface Props {
|
|
21
|
-
row:
|
|
21
|
+
row: MRT_Row;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export const MRT_ToggleRowActionMenuButton: FC<Props> = ({ row }) => {
|
|
@@ -48,7 +48,7 @@ export const MRT_ToggleRowActionMenuButton: FC<Props> = ({ row }) => {
|
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
return (
|
|
51
|
-
<
|
|
51
|
+
<TableCell sx={commonTableBodyButtonCellStyles(densePadding)}>
|
|
52
52
|
{renderRowActions ? (
|
|
53
53
|
<>{renderRowActions(row, tableInstance)}</>
|
|
54
54
|
) : row.id === currentEditingRow?.id ? (
|
|
@@ -59,7 +59,7 @@ export const MRT_ToggleRowActionMenuButton: FC<Props> = ({ row }) => {
|
|
|
59
59
|
arrow
|
|
60
60
|
title={localization.rowActionMenuItemEdit}
|
|
61
61
|
>
|
|
62
|
-
<IconButton onClick={handleEdit}>
|
|
62
|
+
<IconButton sx={commonIconButtonStyles} onClick={handleEdit}>
|
|
63
63
|
<EditIcon />
|
|
64
64
|
</IconButton>
|
|
65
65
|
</Tooltip>
|
|
@@ -67,9 +67,10 @@ export const MRT_ToggleRowActionMenuButton: FC<Props> = ({ row }) => {
|
|
|
67
67
|
<>
|
|
68
68
|
<IconButton
|
|
69
69
|
aria-label={localization.rowActionMenuButtonTitle}
|
|
70
|
-
title={localization.rowActionMenuButtonTitle}
|
|
71
70
|
onClick={handleOpenRowActionMenu}
|
|
72
71
|
size="small"
|
|
72
|
+
sx={commonIconButtonStyles}
|
|
73
|
+
title={localization.rowActionMenuButtonTitle}
|
|
73
74
|
>
|
|
74
75
|
<MoreHorizIcon />
|
|
75
76
|
</IconButton>
|
|
@@ -81,6 +82,6 @@ export const MRT_ToggleRowActionMenuButton: FC<Props> = ({ row }) => {
|
|
|
81
82
|
/>
|
|
82
83
|
</>
|
|
83
84
|
) : null}
|
|
84
|
-
</
|
|
85
|
+
</TableCell>
|
|
85
86
|
);
|
|
86
87
|
};
|
|
@@ -2,6 +2,7 @@ import React, { FC } from 'react';
|
|
|
2
2
|
import { TableFooter } from '@mui/material';
|
|
3
3
|
import { MRT_TableFooterRow } from './MRT_TableFooterRow';
|
|
4
4
|
import { useMRT } from '../useMRT';
|
|
5
|
+
import { MRT_HeaderGroup } from '..';
|
|
5
6
|
|
|
6
7
|
interface Props {}
|
|
7
8
|
|
|
@@ -10,7 +11,7 @@ export const MRT_TableFooter: FC<Props> = () => {
|
|
|
10
11
|
|
|
11
12
|
return (
|
|
12
13
|
<TableFooter {...muiTableFooterProps}>
|
|
13
|
-
{tableInstance.footerGroups.map((footerGroup) => (
|
|
14
|
+
{tableInstance.footerGroups.map((footerGroup: MRT_HeaderGroup) => (
|
|
14
15
|
<MRT_TableFooterRow
|
|
15
16
|
key={footerGroup.getFooterGroupProps().key}
|
|
16
17
|
footerGroup={footerGroup}
|
|
@@ -1,22 +1,10 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { HeaderGroup } from 'react-table';
|
|
2
|
+
import { TableCell } from '@mui/material';
|
|
4
3
|
import { useMRT } from '../useMRT';
|
|
5
|
-
|
|
6
|
-
const TableCell = styled(MuiTableCell, {
|
|
7
|
-
shouldForwardProp: (prop) =>
|
|
8
|
-
prop !== 'densePadding' && prop !== 'enableColumnResizing',
|
|
9
|
-
})<{ densePadding?: boolean; enableColumnResizing?: boolean }>(
|
|
10
|
-
({ densePadding, enableColumnResizing }) => ({
|
|
11
|
-
fontWeight: 'bold',
|
|
12
|
-
verticalAlign: 'text-top',
|
|
13
|
-
padding: densePadding ? '0.5rem' : '1rem',
|
|
14
|
-
transition: `all ${enableColumnResizing ? '10ms' : '0.2s'} ease-in-out`,
|
|
15
|
-
}),
|
|
16
|
-
);
|
|
4
|
+
import { MRT_HeaderGroup } from '..';
|
|
17
5
|
|
|
18
6
|
interface Props {
|
|
19
|
-
column:
|
|
7
|
+
column: MRT_HeaderGroup;
|
|
20
8
|
}
|
|
21
9
|
|
|
22
10
|
export const MRT_TableFooterCell: FC<Props> = ({ column }) => {
|
|
@@ -41,18 +29,23 @@ export const MRT_TableFooterCell: FC<Props> = ({ column }) => {
|
|
|
41
29
|
...column.getFooterProps(),
|
|
42
30
|
style: {
|
|
43
31
|
...column.getFooterProps().style,
|
|
44
|
-
...
|
|
45
|
-
...
|
|
32
|
+
...mTableFooterCellProps?.style,
|
|
33
|
+
...mcTableFooterCellProps?.style,
|
|
46
34
|
},
|
|
47
35
|
};
|
|
48
36
|
|
|
49
37
|
return (
|
|
50
38
|
<TableCell
|
|
51
39
|
align={isParentHeader ? 'center' : 'left'}
|
|
52
|
-
densePadding={densePadding}
|
|
53
|
-
enableColumnResizing={enableColumnResizing}
|
|
54
40
|
variant="head"
|
|
55
41
|
{...tableCellProps}
|
|
42
|
+
sx={{
|
|
43
|
+
fontWeight: 'bold',
|
|
44
|
+
verticalAlign: 'text-top',
|
|
45
|
+
p: densePadding ? '0.5rem' : '1rem',
|
|
46
|
+
transition: `all ${enableColumnResizing ? '10ms' : '0.2s'} ease-in-out`,
|
|
47
|
+
...tableCellProps?.sx,
|
|
48
|
+
}}
|
|
56
49
|
>
|
|
57
50
|
{column.render('Footer')}
|
|
58
51
|
</TableCell>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
2
|
import { TableRow } from '@mui/material';
|
|
3
|
-
import { HeaderGroup } from 'react-table';
|
|
4
3
|
import { MRT_TableFooterCell } from './MRT_TableFooterCell';
|
|
5
4
|
import { MRT_TableSpacerCell } from '../table/MRT_TableSpacerCell';
|
|
6
5
|
import { useMRT } from '../useMRT';
|
|
6
|
+
import { MRT_HeaderGroup } from '..';
|
|
7
7
|
|
|
8
8
|
interface Props {
|
|
9
|
-
footerGroup:
|
|
9
|
+
footerGroup: MRT_HeaderGroup;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export const MRT_TableFooterRow: FC<Props> = ({ footerGroup }) => {
|
|
@@ -36,7 +36,7 @@ export const MRT_TableFooterRow: FC<Props> = ({ footerGroup }) => {
|
|
|
36
36
|
...footerGroup.getFooterGroupProps(),
|
|
37
37
|
style: {
|
|
38
38
|
...footerGroup.getFooterGroupProps().style,
|
|
39
|
-
...
|
|
39
|
+
...mTableFooterRowProps?.style,
|
|
40
40
|
},
|
|
41
41
|
};
|
|
42
42
|
|
|
@@ -53,7 +53,7 @@ export const MRT_TableFooterRow: FC<Props> = ({ footerGroup }) => {
|
|
|
53
53
|
/>
|
|
54
54
|
)}
|
|
55
55
|
{enableSelection && <MRT_TableSpacerCell width="1rem" />}
|
|
56
|
-
{footerGroup.headers.map((column) => (
|
|
56
|
+
{footerGroup.headers.map((column: MRT_HeaderGroup) => (
|
|
57
57
|
<MRT_TableFooterCell
|
|
58
58
|
key={column.getFooterProps().key}
|
|
59
59
|
column={column}
|
|
@@ -2,6 +2,7 @@ import React, { FC } from 'react';
|
|
|
2
2
|
import { TableHead } from '@mui/material';
|
|
3
3
|
import { MRT_TableHeadRow } from './MRT_TableHeadRow';
|
|
4
4
|
import { useMRT } from '../useMRT';
|
|
5
|
+
import { MRT_HeaderGroup } from '..';
|
|
5
6
|
|
|
6
7
|
interface Props {}
|
|
7
8
|
|
|
@@ -15,7 +16,7 @@ export const MRT_TableHead: FC<Props> = () => {
|
|
|
15
16
|
|
|
16
17
|
return (
|
|
17
18
|
<TableHead {...tableHeadProps}>
|
|
18
|
-
{tableInstance.headerGroups.map((headerGroup) => (
|
|
19
|
+
{tableInstance.headerGroups.map((headerGroup: MRT_HeaderGroup) => (
|
|
19
20
|
<MRT_TableHeadRow
|
|
20
21
|
key={headerGroup.getHeaderGroupProps().key}
|
|
21
22
|
headerGroup={headerGroup}
|