material-react-table 0.4.5 → 0.4.8
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/README.md +3 -2
- package/dist/MaterialReactTable.d.ts +71 -25
- package/dist/body/MRT_TableBodyCell.d.ts +2 -2
- package/dist/body/MRT_TableBodyRow.d.ts +2 -2
- 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 +2 -2
- package/dist/head/MRT_TableHeadRow.d.ts +2 -2
- package/dist/icons.d.ts +25 -0
- 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/{utils/localization.d.ts → localization.d.ts} +1 -1
- package/dist/material-react-table.cjs.development.js +197 -155
- 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 +198 -156
- 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 +10 -6
- package/package.json +1 -1
- package/src/@types/react-table-config.d.ts +18 -121
- package/src/MaterialReactTable.tsx +188 -25
- package/src/body/MRT_TableBody.tsx +2 -1
- package/src/body/MRT_TableBodyCell.tsx +2 -2
- package/src/body/MRT_TableBodyRow.tsx +11 -9
- package/src/body/MRT_TableDetailPanel.tsx +9 -16
- package/src/buttons/MRT_EditActionButtons.tsx +7 -8
- package/src/buttons/MRT_ExpandAllButton.tsx +17 -18
- package/src/buttons/MRT_ExpandButton.tsx +20 -21
- package/src/buttons/MRT_FullScreenToggleButton.tsx +9 -6
- package/src/buttons/MRT_ShowHideColumnsButton.tsx +11 -7
- package/src/buttons/MRT_ToggleColumnActionMenuButton.tsx +8 -6
- package/src/buttons/MRT_ToggleDensePaddingButton.tsx +8 -5
- package/src/buttons/MRT_ToggleFiltersButton.tsx +8 -5
- package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +8 -9
- package/src/buttons/MRT_ToggleSearchButton.tsx +8 -5
- package/src/footer/MRT_TableFooter.tsx +2 -1
- package/src/footer/MRT_TableFooterCell.tsx +2 -2
- package/src/footer/MRT_TableFooterRow.tsx +3 -3
- package/src/head/MRT_TableHead.tsx +2 -1
- package/src/head/MRT_TableHeadCell.tsx +7 -7
- package/src/head/MRT_TableHeadCellActions.tsx +1 -1
- package/src/head/MRT_TableHeadRow.tsx +3 -3
- package/src/icons.tsx +72 -0
- package/src/index.tsx +2 -0
- package/src/inputs/MRT_EditCellTextField.tsx +2 -2
- package/src/inputs/MRT_FilterTextField.tsx +15 -15
- package/src/inputs/MRT_SearchTextField.tsx +4 -5
- package/src/inputs/MRT_SelectCheckbox.tsx +7 -7
- package/src/{utils/localization.ts → localization.ts} +1 -1
- package/src/menus/MRT_ColumnActionMenu.tsx +16 -14
- package/src/menus/MRT_RowActionMenu.tsx +4 -4
- package/src/menus/MRT_ShowHideColumnsMenu.tsx +3 -2
- package/src/table/MRT_TableContainer.tsx +19 -1
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +3 -3
- package/src/useMRT.tsx +24 -17
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
TableCell as MuiTableCell,
|
|
6
6
|
TableRow,
|
|
7
7
|
} from '@mui/material';
|
|
8
|
-
import { Row } from 'react-table';
|
|
9
8
|
import { useMRT } from '../useMRT';
|
|
9
|
+
import { MRT_Row } from '..';
|
|
10
10
|
|
|
11
11
|
const TableCell = styled(MuiTableCell, {
|
|
12
12
|
shouldForwardProp: (prop) => prop !== 'isExpanded',
|
|
@@ -18,16 +18,16 @@ const TableCell = styled(MuiTableCell, {
|
|
|
18
18
|
}));
|
|
19
19
|
|
|
20
20
|
interface Props {
|
|
21
|
-
row:
|
|
21
|
+
row: MRT_Row;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export const MRT_TableDetailPanel: FC<Props> = ({ row }) => {
|
|
25
25
|
const {
|
|
26
|
-
tableInstance,
|
|
27
|
-
renderDetailPanel,
|
|
28
|
-
muiTableDetailPanelProps,
|
|
29
26
|
muiTableBodyRowProps,
|
|
27
|
+
muiTableDetailPanelProps,
|
|
30
28
|
onDetailPanelClick,
|
|
29
|
+
renderDetailPanel,
|
|
30
|
+
tableInstance,
|
|
31
31
|
} = useMRT();
|
|
32
32
|
|
|
33
33
|
const mTableBodyRowProps =
|
|
@@ -37,27 +37,20 @@ export const MRT_TableDetailPanel: FC<Props> = ({ row }) => {
|
|
|
37
37
|
|
|
38
38
|
const tableRowProps = {
|
|
39
39
|
...mTableBodyRowProps,
|
|
40
|
-
...row.
|
|
40
|
+
...row.getRowProps(),
|
|
41
41
|
style: {
|
|
42
|
-
...row.
|
|
42
|
+
...row.getRowProps().style,
|
|
43
43
|
...(mTableBodyRowProps?.style ?? {}),
|
|
44
44
|
},
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
const
|
|
47
|
+
const tableCellProps =
|
|
48
48
|
muiTableDetailPanelProps instanceof Function
|
|
49
49
|
? muiTableDetailPanelProps(row)
|
|
50
50
|
: muiTableDetailPanelProps;
|
|
51
51
|
|
|
52
|
-
const tableCellProps = {
|
|
53
|
-
...mTableDetailPanelProps,
|
|
54
|
-
style: {
|
|
55
|
-
...(mTableDetailPanelProps?.style ?? {}),
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
|
|
59
52
|
return (
|
|
60
|
-
<TableRow
|
|
53
|
+
<TableRow {...tableRowProps}>
|
|
61
54
|
<TableCell
|
|
62
55
|
colSpan={tableInstance.visibleColumns.length + 10}
|
|
63
56
|
isExpanded={row.isExpanded}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
2
|
import { IconButton, styled, Tooltip } from '@mui/material';
|
|
3
|
-
import SaveIcon from '@mui/icons-material/Save';
|
|
4
|
-
import CancelIcon from '@mui/icons-material/Cancel';
|
|
5
3
|
import { useMRT } from '../useMRT';
|
|
6
|
-
import {
|
|
4
|
+
import { MRT_Row } from '..';
|
|
7
5
|
|
|
8
6
|
const EditActionButtonWrappers = styled('div')({
|
|
9
7
|
display: 'flex',
|
|
@@ -11,11 +9,12 @@ const EditActionButtonWrappers = styled('div')({
|
|
|
11
9
|
});
|
|
12
10
|
|
|
13
11
|
interface Props {
|
|
14
|
-
row:
|
|
12
|
+
row: MRT_Row;
|
|
15
13
|
}
|
|
16
14
|
|
|
17
15
|
export const MRT_EditActionButtons: FC<Props> = ({ row }) => {
|
|
18
16
|
const {
|
|
17
|
+
icons: { CancelIcon, SaveIcon },
|
|
19
18
|
localization,
|
|
20
19
|
setCurrentEditingRow,
|
|
21
20
|
onRowEditSubmit,
|
|
@@ -34,17 +33,17 @@ export const MRT_EditActionButtons: FC<Props> = ({ row }) => {
|
|
|
34
33
|
|
|
35
34
|
return (
|
|
36
35
|
<EditActionButtonWrappers>
|
|
37
|
-
<Tooltip arrow title={localization
|
|
36
|
+
<Tooltip arrow title={localization.rowActionButtonCancel}>
|
|
38
37
|
<IconButton
|
|
39
|
-
aria-label={localization
|
|
38
|
+
aria-label={localization.rowActionButtonCancel}
|
|
40
39
|
onClick={handleCancel}
|
|
41
40
|
>
|
|
42
41
|
<CancelIcon />
|
|
43
42
|
</IconButton>
|
|
44
43
|
</Tooltip>
|
|
45
|
-
<Tooltip arrow title={localization
|
|
44
|
+
<Tooltip arrow title={localization.rowActionButtonSave}>
|
|
46
45
|
<IconButton
|
|
47
|
-
aria-label={localization
|
|
46
|
+
aria-label={localization.rowActionButtonSave}
|
|
48
47
|
color="info"
|
|
49
48
|
onClick={handleSave}
|
|
50
49
|
>
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
|
-
import { IconButton
|
|
3
|
-
import MuiArrowRightIcon from '@mui/icons-material/KeyboardDoubleArrowDown';
|
|
2
|
+
import { IconButton } from '@mui/material';
|
|
4
3
|
import { useMRT } from '../useMRT';
|
|
5
4
|
import { MRT_TableButtonCell } from '../table/MRT_TableButtonCell';
|
|
6
5
|
|
|
7
|
-
const ArrowRightIcon = styled(MuiArrowRightIcon, {
|
|
8
|
-
shouldForwardProp: (prop) => prop !== 'rotation',
|
|
9
|
-
})<{ rotation?: number }>(({ rotation }) => ({
|
|
10
|
-
transform: `rotate(${rotation}deg)`,
|
|
11
|
-
transition: 'transform 0.2s',
|
|
12
|
-
}));
|
|
13
|
-
|
|
14
6
|
interface Props {}
|
|
15
7
|
|
|
16
8
|
export const MRT_ExpandAllButton: FC<Props> = () => {
|
|
17
|
-
const {
|
|
18
|
-
|
|
9
|
+
const {
|
|
10
|
+
tableInstance,
|
|
11
|
+
localization,
|
|
12
|
+
anyRowsExpanded,
|
|
13
|
+
densePadding,
|
|
14
|
+
icons: { DoubleArrowDownIcon },
|
|
15
|
+
} = useMRT();
|
|
19
16
|
|
|
20
17
|
return (
|
|
21
18
|
<MRT_TableButtonCell
|
|
@@ -24,14 +21,16 @@ export const MRT_ExpandAllButton: FC<Props> = () => {
|
|
|
24
21
|
{...tableInstance.getToggleAllRowsExpandedProps()}
|
|
25
22
|
>
|
|
26
23
|
<IconButton
|
|
27
|
-
aria-label={localization
|
|
28
|
-
title={localization
|
|
24
|
+
aria-label={localization.expandAllButtonTitle}
|
|
25
|
+
title={localization.expandAllButtonTitle}
|
|
29
26
|
>
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
<DoubleArrowDownIcon
|
|
28
|
+
style={{
|
|
29
|
+
transform: `rotate(${
|
|
30
|
+
tableInstance.isAllRowsExpanded ? -180 : anyRowsExpanded ? -90 : 0
|
|
31
|
+
}deg)`,
|
|
32
|
+
transition: 'transform 0.2s',
|
|
33
|
+
}}
|
|
35
34
|
/>
|
|
36
35
|
</IconButton>
|
|
37
36
|
</MRT_TableButtonCell>
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
2
|
import { IconButton, styled } from '@mui/material';
|
|
3
|
-
import { Row } from 'react-table';
|
|
4
|
-
import MuiExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
5
3
|
import { useMRT } from '../useMRT';
|
|
6
4
|
import { MRT_TableButtonCell } from '../table/MRT_TableButtonCell';
|
|
5
|
+
import { MRT_Row } from '..';
|
|
7
6
|
|
|
8
7
|
const TableCell = styled(MRT_TableButtonCell, {
|
|
9
8
|
shouldForwardProp: (prop) => prop !== 'depth',
|
|
@@ -12,37 +11,37 @@ const TableCell = styled(MRT_TableButtonCell, {
|
|
|
12
11
|
textAlign: 'left',
|
|
13
12
|
}));
|
|
14
13
|
|
|
15
|
-
const ExpandMoreIcon = styled(MuiExpandMoreIcon, {
|
|
16
|
-
shouldForwardProp: (prop) => prop !== 'rotation',
|
|
17
|
-
})<{ rotation?: number }>(({ rotation }) => ({
|
|
18
|
-
transform: `rotate(${rotation}deg)`,
|
|
19
|
-
transition: 'transform 0.2s',
|
|
20
|
-
}));
|
|
21
|
-
|
|
22
14
|
interface Props {
|
|
23
|
-
row:
|
|
15
|
+
row: MRT_Row;
|
|
24
16
|
}
|
|
25
17
|
|
|
26
18
|
export const MRT_ExpandButton: FC<Props> = ({ row }) => {
|
|
27
|
-
const {
|
|
19
|
+
const {
|
|
20
|
+
densePadding,
|
|
21
|
+
icons: { ExpandMoreIcon },
|
|
22
|
+
localization,
|
|
23
|
+
renderDetailPanel,
|
|
24
|
+
} = useMRT();
|
|
28
25
|
|
|
29
26
|
return (
|
|
30
27
|
<TableCell size="small" densePadding={densePadding} depth={row.depth}>
|
|
31
28
|
<IconButton
|
|
32
|
-
aria-label={localization
|
|
29
|
+
aria-label={localization.expandButtonTitle}
|
|
33
30
|
disabled={!row.canExpand && !renderDetailPanel}
|
|
34
|
-
title={localization
|
|
31
|
+
title={localization.expandButtonTitle}
|
|
35
32
|
{...row.getToggleRowExpandedProps()}
|
|
36
33
|
>
|
|
37
34
|
<ExpandMoreIcon
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
35
|
+
style={{
|
|
36
|
+
transform: `rotate(${
|
|
37
|
+
!row.canExpand && !renderDetailPanel
|
|
38
|
+
? -90
|
|
39
|
+
: row.isExpanded
|
|
40
|
+
? -180
|
|
41
|
+
: 0
|
|
42
|
+
}deg)`,
|
|
43
|
+
transition: 'transform 0.2s',
|
|
44
|
+
}}
|
|
46
45
|
/>
|
|
47
46
|
</IconButton>
|
|
48
47
|
</TableCell>
|
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
2
|
import { IconButton, IconButtonProps, Tooltip } from '@mui/material';
|
|
3
3
|
import { useMRT } from '../useMRT';
|
|
4
|
-
import FilterListIcon from '@mui/icons-material/Fullscreen';
|
|
5
|
-
import FilterListOffIcon from '@mui/icons-material/FullscreenExit';
|
|
6
4
|
|
|
7
5
|
interface Props extends IconButtonProps {}
|
|
8
6
|
|
|
9
7
|
export const MRT_FullScreenToggleButton: FC<Props> = ({ ...rest }) => {
|
|
10
|
-
const {
|
|
8
|
+
const {
|
|
9
|
+
fullScreen,
|
|
10
|
+
icons: { FullscreenExitIcon, FullscreenIcon },
|
|
11
|
+
localization,
|
|
12
|
+
setFullScreen,
|
|
13
|
+
} = useMRT();
|
|
11
14
|
|
|
12
15
|
return (
|
|
13
|
-
<Tooltip arrow title={localization
|
|
16
|
+
<Tooltip arrow title={localization.toggleFullScreenButtonTitle}>
|
|
14
17
|
<IconButton
|
|
15
|
-
aria-label={localization
|
|
18
|
+
aria-label={localization.toggleFilterButtonTitle}
|
|
16
19
|
onClick={() => setFullScreen(!fullScreen)}
|
|
17
20
|
size="small"
|
|
18
21
|
{...rest}
|
|
19
22
|
>
|
|
20
|
-
{fullScreen ? <
|
|
23
|
+
{fullScreen ? <FullscreenExitIcon /> : <FullscreenIcon />}
|
|
21
24
|
</IconButton>
|
|
22
25
|
</Tooltip>
|
|
23
26
|
);
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
Divider,
|
|
9
9
|
IconButtonProps,
|
|
10
10
|
} from '@mui/material';
|
|
11
|
-
import ViewColumnIcon from '@mui/icons-material/ViewColumn';
|
|
12
11
|
import { useMRT } from '../useMRT';
|
|
13
12
|
import { MRT_ShowHideColumnsMenu } from '../menus/MRT_ShowHideColumnsMenu';
|
|
13
|
+
import { MRT_ColumnInstance } from '..';
|
|
14
14
|
|
|
15
15
|
const MenuButtons = styled('div')({
|
|
16
16
|
display: 'flex',
|
|
@@ -21,7 +21,11 @@ const MenuButtons = styled('div')({
|
|
|
21
21
|
interface Props extends IconButtonProps {}
|
|
22
22
|
|
|
23
23
|
export const MRT_ShowHideColumnsButton: FC<Props> = ({ ...rest }) => {
|
|
24
|
-
const {
|
|
24
|
+
const {
|
|
25
|
+
tableInstance,
|
|
26
|
+
localization,
|
|
27
|
+
icons: { ViewColumnIcon },
|
|
28
|
+
} = useMRT();
|
|
25
29
|
|
|
26
30
|
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
|
|
27
31
|
|
|
@@ -31,9 +35,9 @@ export const MRT_ShowHideColumnsButton: FC<Props> = ({ ...rest }) => {
|
|
|
31
35
|
|
|
32
36
|
return (
|
|
33
37
|
<>
|
|
34
|
-
<Tooltip arrow title={localization
|
|
38
|
+
<Tooltip arrow title={localization.showHideColumnsButtonTitle}>
|
|
35
39
|
<IconButton
|
|
36
|
-
aria-label={localization
|
|
40
|
+
aria-label={localization.showHideColumnsButtonTitle}
|
|
37
41
|
onClick={handleClick}
|
|
38
42
|
size="small"
|
|
39
43
|
{...rest}
|
|
@@ -54,17 +58,17 @@ export const MRT_ShowHideColumnsButton: FC<Props> = ({ ...rest }) => {
|
|
|
54
58
|
}
|
|
55
59
|
onClick={() => tableInstance.toggleHideAllColumns(true)}
|
|
56
60
|
>
|
|
57
|
-
{localization
|
|
61
|
+
{localization.columnShowHideMenuHideAll}
|
|
58
62
|
</Button>
|
|
59
63
|
<Button
|
|
60
64
|
disabled={tableInstance.getToggleHideAllColumnsProps().checked}
|
|
61
65
|
onClick={() => tableInstance.toggleHideAllColumns(false)}
|
|
62
66
|
>
|
|
63
|
-
{localization
|
|
67
|
+
{localization.columnShowHideMenuShowAll}
|
|
64
68
|
</Button>
|
|
65
69
|
</MenuButtons>
|
|
66
70
|
<Divider />
|
|
67
|
-
{tableInstance.columns.map((column, index) => (
|
|
71
|
+
{tableInstance.columns.map((column: MRT_ColumnInstance, index) => (
|
|
68
72
|
<MRT_ShowHideColumnsMenu
|
|
69
73
|
key={`${index}-${column.id}`}
|
|
70
74
|
column={column}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React, { FC, MouseEvent, useState } from 'react';
|
|
2
2
|
import { IconButton as MuiIconButton, styled, Tooltip } from '@mui/material';
|
|
3
|
-
import MoreVertIcon from '@mui/icons-material/MoreVert';
|
|
4
3
|
import { useMRT } from '../useMRT';
|
|
5
4
|
import { MRT_ColumnActionMenu } from '../menus/MRT_ColumnActionMenu';
|
|
6
|
-
import {
|
|
5
|
+
import { MRT_HeaderGroup } from '..';
|
|
7
6
|
|
|
8
7
|
const IconButton = styled(MuiIconButton)({
|
|
9
8
|
opacity: 0.5,
|
|
@@ -17,11 +16,14 @@ const IconButton = styled(MuiIconButton)({
|
|
|
17
16
|
});
|
|
18
17
|
|
|
19
18
|
interface Props {
|
|
20
|
-
column:
|
|
19
|
+
column: MRT_HeaderGroup;
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
export const MRT_ToggleColumnActionMenuButton: FC<Props> = ({ column }) => {
|
|
24
|
-
const {
|
|
23
|
+
const {
|
|
24
|
+
localization,
|
|
25
|
+
icons: { MoreVertIcon },
|
|
26
|
+
} = useMRT();
|
|
25
27
|
|
|
26
28
|
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
|
|
27
29
|
|
|
@@ -37,10 +39,10 @@ export const MRT_ToggleColumnActionMenuButton: FC<Props> = ({ column }) => {
|
|
|
37
39
|
arrow
|
|
38
40
|
enterDelay={1000}
|
|
39
41
|
enterNextDelay={1000}
|
|
40
|
-
title={localization
|
|
42
|
+
title={localization.columnActionMenuButtonTitle}
|
|
41
43
|
>
|
|
42
44
|
<IconButton
|
|
43
|
-
aria-label={localization
|
|
45
|
+
aria-label={localization.columnActionMenuButtonTitle}
|
|
44
46
|
onClick={handleClick}
|
|
45
47
|
size="small"
|
|
46
48
|
>
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
2
|
import { IconButton, IconButtonProps, Tooltip } from '@mui/material';
|
|
3
3
|
import { useMRT } from '../useMRT';
|
|
4
|
-
import DensityMediumIcon from '@mui/icons-material/DensityMedium';
|
|
5
|
-
import DensitySmallIcon from '@mui/icons-material/DensitySmall';
|
|
6
4
|
|
|
7
5
|
interface Props extends IconButtonProps {}
|
|
8
6
|
|
|
9
7
|
export const MRT_ToggleDensePaddingButton: FC<Props> = ({ ...rest }) => {
|
|
10
|
-
const {
|
|
8
|
+
const {
|
|
9
|
+
densePadding,
|
|
10
|
+
setDensePadding,
|
|
11
|
+
localization,
|
|
12
|
+
icons: { DensityMediumIcon, DensitySmallIcon },
|
|
13
|
+
} = useMRT();
|
|
11
14
|
|
|
12
15
|
return (
|
|
13
|
-
<Tooltip arrow title={localization
|
|
16
|
+
<Tooltip arrow title={localization.toggleDensePaddingSwitchTitle}>
|
|
14
17
|
<IconButton
|
|
15
|
-
aria-label={localization
|
|
18
|
+
aria-label={localization.toggleDensePaddingSwitchTitle}
|
|
16
19
|
onClick={() => setDensePadding(!densePadding)}
|
|
17
20
|
size="small"
|
|
18
21
|
{...rest}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
2
|
import { IconButton, IconButtonProps, Tooltip } from '@mui/material';
|
|
3
3
|
import { useMRT } from '../useMRT';
|
|
4
|
-
import FilterListIcon from '@mui/icons-material/FilterList';
|
|
5
|
-
import FilterListOffIcon from '@mui/icons-material/FilterListOff';
|
|
6
4
|
|
|
7
5
|
interface Props extends IconButtonProps {}
|
|
8
6
|
|
|
9
7
|
export const MRT_ToggleFiltersButton: FC<Props> = ({ ...rest }) => {
|
|
10
|
-
const {
|
|
8
|
+
const {
|
|
9
|
+
localization,
|
|
10
|
+
setShowFilters,
|
|
11
|
+
showFilters,
|
|
12
|
+
icons: { FilterListIcon, FilterListOffIcon },
|
|
13
|
+
} = useMRT();
|
|
11
14
|
|
|
12
15
|
return (
|
|
13
|
-
<Tooltip arrow title={localization
|
|
16
|
+
<Tooltip arrow title={localization.toggleFilterButtonTitle}>
|
|
14
17
|
<IconButton
|
|
15
|
-
aria-label={localization
|
|
18
|
+
aria-label={localization.toggleFilterButtonTitle}
|
|
16
19
|
onClick={() => setShowFilters(!showFilters)}
|
|
17
20
|
size="small"
|
|
18
21
|
{...rest}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React, { FC, MouseEvent, useState } from 'react';
|
|
2
2
|
import { IconButton as MuiIconButton, styled, Tooltip } from '@mui/material';
|
|
3
|
-
import MoreHorizIcon from '@mui/icons-material/MoreHoriz';
|
|
4
|
-
import EditIcon from '@mui/icons-material/Edit';
|
|
5
3
|
import { useMRT } from '../useMRT';
|
|
6
|
-
import { Row } from 'react-table';
|
|
7
4
|
import { MRT_RowActionMenu } from '../menus/MRT_RowActionMenu';
|
|
8
5
|
import { MRT_EditActionButtons } from './MRT_EditActionButtons';
|
|
9
6
|
import { MRT_TableButtonCell } from '../table/MRT_TableButtonCell';
|
|
7
|
+
import { MRT_Row } from '..';
|
|
10
8
|
|
|
11
9
|
const IconButton = styled(MuiIconButton)({
|
|
12
10
|
opacity: 0.5,
|
|
@@ -20,18 +18,19 @@ const IconButton = styled(MuiIconButton)({
|
|
|
20
18
|
});
|
|
21
19
|
|
|
22
20
|
interface Props {
|
|
23
|
-
row:
|
|
21
|
+
row: MRT_Row;
|
|
24
22
|
}
|
|
25
23
|
|
|
26
24
|
export const MRT_ToggleRowActionMenuButton: FC<Props> = ({ row }) => {
|
|
27
25
|
const {
|
|
28
26
|
currentEditingRow,
|
|
29
27
|
densePadding,
|
|
28
|
+
enableRowEditing,
|
|
29
|
+
icons: { EditIcon, MoreHorizIcon },
|
|
30
30
|
localization,
|
|
31
31
|
renderRowActionMenuItems,
|
|
32
|
-
enableRowEditing,
|
|
33
|
-
setCurrentEditingRow,
|
|
34
32
|
renderRowActions,
|
|
33
|
+
setCurrentEditingRow,
|
|
35
34
|
tableInstance,
|
|
36
35
|
} = useMRT();
|
|
37
36
|
|
|
@@ -58,7 +57,7 @@ export const MRT_ToggleRowActionMenuButton: FC<Props> = ({ row }) => {
|
|
|
58
57
|
<Tooltip
|
|
59
58
|
placement="right"
|
|
60
59
|
arrow
|
|
61
|
-
title={localization
|
|
60
|
+
title={localization.rowActionMenuItemEdit}
|
|
62
61
|
>
|
|
63
62
|
<IconButton onClick={handleEdit}>
|
|
64
63
|
<EditIcon />
|
|
@@ -67,8 +66,8 @@ export const MRT_ToggleRowActionMenuButton: FC<Props> = ({ row }) => {
|
|
|
67
66
|
) : renderRowActionMenuItems ? (
|
|
68
67
|
<>
|
|
69
68
|
<IconButton
|
|
70
|
-
aria-label={localization
|
|
71
|
-
title={localization
|
|
69
|
+
aria-label={localization.rowActionMenuButtonTitle}
|
|
70
|
+
title={localization.rowActionMenuButtonTitle}
|
|
72
71
|
onClick={handleOpenRowActionMenu}
|
|
73
72
|
size="small"
|
|
74
73
|
>
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
2
|
import { IconButton, IconButtonProps, Tooltip } from '@mui/material';
|
|
3
3
|
import { useMRT } from '../useMRT';
|
|
4
|
-
import SearchIcon from '@mui/icons-material/Search';
|
|
5
|
-
import SearchOffIcon from '@mui/icons-material/SearchOff';
|
|
6
4
|
|
|
7
5
|
interface Props extends IconButtonProps {}
|
|
8
6
|
|
|
9
7
|
export const MRT_ToggleSearchButton: FC<Props> = ({ ...rest }) => {
|
|
10
|
-
const {
|
|
11
|
-
|
|
8
|
+
const {
|
|
9
|
+
icons: { SearchIcon, SearchOffIcon },
|
|
10
|
+
localization,
|
|
11
|
+
muiSearchTextFieldProps,
|
|
12
|
+
setShowSearch,
|
|
13
|
+
showSearch,
|
|
14
|
+
} = useMRT();
|
|
12
15
|
|
|
13
16
|
const handleToggleSearch = () => {
|
|
14
17
|
setShowSearch(!showSearch);
|
|
@@ -24,7 +27,7 @@ export const MRT_ToggleSearchButton: FC<Props> = ({ ...rest }) => {
|
|
|
24
27
|
};
|
|
25
28
|
|
|
26
29
|
return (
|
|
27
|
-
<Tooltip arrow title={localization
|
|
30
|
+
<Tooltip arrow title={localization.toggleSearchButtonTitle}>
|
|
28
31
|
<IconButton size="small" onClick={handleToggleSearch} {...rest}>
|
|
29
32
|
{showSearch ? <SearchOffIcon /> : <SearchIcon />}
|
|
30
33
|
</IconButton>
|
|
@@ -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,7 +1,7 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
2
|
import { styled, TableCell as MuiTableCell } from '@mui/material';
|
|
3
|
-
import { HeaderGroup } from 'react-table';
|
|
4
3
|
import { useMRT } from '../useMRT';
|
|
4
|
+
import { MRT_HeaderGroup } from '..';
|
|
5
5
|
|
|
6
6
|
const TableCell = styled(MuiTableCell, {
|
|
7
7
|
shouldForwardProp: (prop) =>
|
|
@@ -16,7 +16,7 @@ const TableCell = styled(MuiTableCell, {
|
|
|
16
16
|
);
|
|
17
17
|
|
|
18
18
|
interface Props {
|
|
19
|
-
column:
|
|
19
|
+
column: MRT_HeaderGroup;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export const MRT_TableFooterCell: FC<Props> = ({ column }) => {
|
|
@@ -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 }) => {
|
|
@@ -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}
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
Collapse,
|
|
8
8
|
Tooltip,
|
|
9
9
|
} from '@mui/material';
|
|
10
|
-
import { HeaderGroup } from 'react-table';
|
|
11
10
|
import { useMRT } from '../useMRT';
|
|
12
11
|
import { MRT_FilterTextField } from '../inputs/MRT_FilterTextField';
|
|
13
12
|
import { MRT_ToggleColumnActionMenuButton } from '../buttons/MRT_ToggleColumnActionMenuButton';
|
|
13
|
+
import { MRT_HeaderGroup } from '..';
|
|
14
14
|
|
|
15
15
|
export const MRT_StyledTableHeadCell = styled(MuiTableCell, {
|
|
16
16
|
shouldForwardProp: (prop) =>
|
|
@@ -52,7 +52,7 @@ const Divider = styled(MuiDivider)({
|
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
interface Props {
|
|
55
|
-
column:
|
|
55
|
+
column: MRT_HeaderGroup;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
export const MRT_TableHeadCell: FC<Props> = ({ column }) => {
|
|
@@ -92,15 +92,15 @@ export const MRT_TableHeadCell: FC<Props> = ({ column }) => {
|
|
|
92
92
|
|
|
93
93
|
const sortTooltip = column.isSorted
|
|
94
94
|
? column.isSortedDesc
|
|
95
|
-
? localization
|
|
96
|
-
: localization
|
|
95
|
+
? localization.columnActionMenuItemClearSort
|
|
96
|
+
: localization.columnActionMenuItemSortDesc?.replace(
|
|
97
97
|
'{column}',
|
|
98
98
|
column.Header as string,
|
|
99
|
-
)
|
|
100
|
-
: localization
|
|
99
|
+
)
|
|
100
|
+
: localization.columnActionMenuItemSortAsc?.replace(
|
|
101
101
|
'{column}',
|
|
102
102
|
column.Header as string,
|
|
103
|
-
)
|
|
103
|
+
);
|
|
104
104
|
|
|
105
105
|
return (
|
|
106
106
|
<MRT_StyledTableHeadCell
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { FC, useMemo } from 'react';
|
|
2
2
|
import { TableRow } from '@mui/material';
|
|
3
|
-
import { HeaderGroup } from 'react-table';
|
|
4
3
|
import {
|
|
5
4
|
MRT_StyledTableHeadCell,
|
|
6
5
|
MRT_TableHeadCell,
|
|
@@ -10,9 +9,10 @@ import { MRT_SelectCheckbox } from '../inputs/MRT_SelectCheckbox';
|
|
|
10
9
|
import { MRT_ExpandAllButton } from '../buttons/MRT_ExpandAllButton';
|
|
11
10
|
import { MRT_TableSpacerCell } from '../table/MRT_TableSpacerCell';
|
|
12
11
|
import { MRT_TableHeadCellActions } from './MRT_TableHeadCellActions';
|
|
12
|
+
import { MRT_HeaderGroup } from '..';
|
|
13
13
|
|
|
14
14
|
interface Props {
|
|
15
|
-
headerGroup:
|
|
15
|
+
headerGroup: MRT_HeaderGroup;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export const MRT_TableHeadRow: FC<Props> = ({ headerGroup }) => {
|
|
@@ -81,7 +81,7 @@ export const MRT_TableHeadRow: FC<Props> = ({ headerGroup }) => {
|
|
|
81
81
|
<MRT_TableSpacerCell width="1rem" />
|
|
82
82
|
)
|
|
83
83
|
) : null}
|
|
84
|
-
{headerGroup.headers.map((column:
|
|
84
|
+
{headerGroup.headers.map((column: MRT_HeaderGroup) => (
|
|
85
85
|
<MRT_TableHeadCell key={column.getHeaderProps().key} column={column} />
|
|
86
86
|
))}
|
|
87
87
|
{(enableRowActions || enableRowEditing) &&
|