material-react-table 0.4.5 → 0.4.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 +4 -2
- package/dist/icons.d.ts +25 -0
- package/dist/{utils/localization.d.ts → localization.d.ts} +1 -1
- package/dist/material-react-table.cjs.development.js +156 -130
- 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 +156 -130
- package/dist/material-react-table.esm.js.map +1 -1
- package/dist/useMRT.d.ts +6 -2
- package/package.json +1 -1
- package/src/MaterialReactTable.tsx +7 -3
- package/src/body/MRT_TableBodyRow.tsx +8 -6
- package/src/buttons/MRT_EditActionButtons.tsx +5 -6
- package/src/buttons/MRT_ExpandAllButton.tsx +17 -18
- package/src/buttons/MRT_ExpandButton.tsx +18 -19
- package/src/buttons/MRT_FullScreenToggleButton.tsx +9 -6
- package/src/buttons/MRT_ShowHideColumnsButton.tsx +9 -6
- package/src/buttons/MRT_ToggleColumnActionMenuButton.tsx +6 -4
- package/src/buttons/MRT_ToggleDensePaddingButton.tsx +8 -5
- package/src/buttons/MRT_ToggleFiltersButton.tsx +8 -5
- package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +6 -7
- package/src/buttons/MRT_ToggleSearchButton.tsx +8 -5
- package/src/head/MRT_TableHeadCell.tsx +5 -5
- package/src/head/MRT_TableHeadCellActions.tsx +1 -1
- package/src/icons.tsx +72 -0
- package/src/inputs/MRT_FilterTextField.tsx +12 -13
- package/src/inputs/MRT_SearchTextField.tsx +4 -5
- package/src/inputs/MRT_SelectCheckbox.tsx +4 -4
- package/src/{utils/localization.ts → localization.ts} +1 -1
- package/src/menus/MRT_ColumnActionMenu.tsx +14 -12
- package/src/menus/MRT_RowActionMenu.tsx +2 -2
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +3 -3
- package/src/useMRT.tsx +6 -2
package/dist/useMRT.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from 'react';
|
|
2
2
|
import { Row, TableInstance } from 'react-table';
|
|
3
|
+
import { MRT_Icons } from './icons';
|
|
4
|
+
import { MRT_Localization } from './localization';
|
|
3
5
|
import { MaterialReactTableProps } from './MaterialReactTable';
|
|
4
|
-
export
|
|
6
|
+
export declare type UseMRT<D extends {} = {}> = MaterialReactTableProps<D> & {
|
|
5
7
|
anyRowsCanExpand: boolean;
|
|
6
8
|
anyRowsExpanded: boolean;
|
|
7
9
|
currentEditingRow: Row<D> | null;
|
|
8
10
|
densePadding: boolean;
|
|
9
11
|
fullScreen: boolean;
|
|
12
|
+
icons: MRT_Icons;
|
|
13
|
+
localization: MRT_Localization;
|
|
10
14
|
setCurrentEditingRow: (currentRowEditingId: Row<D> | null) => void;
|
|
11
15
|
setDensePadding: (densePadding: boolean) => void;
|
|
12
16
|
setFullScreen: (fullScreen: boolean) => void;
|
|
@@ -15,6 +19,6 @@ export interface UseMRT<D extends {} = {}> extends MaterialReactTableProps<D> {
|
|
|
15
19
|
showFilters: boolean;
|
|
16
20
|
showSearch: boolean;
|
|
17
21
|
tableInstance: TableInstance<D>;
|
|
18
|
-
}
|
|
22
|
+
};
|
|
19
23
|
export declare const MaterialReactTableProvider: <D extends {}>(props: React.PropsWithChildren<MaterialReactTableProps<D>>) => JSX.Element;
|
|
20
24
|
export declare const useMRT: <D extends {}>() => UseMRT<D>;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.4.
|
|
2
|
+
"version": "0.4.6",
|
|
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.",
|
|
@@ -33,8 +33,9 @@ import {
|
|
|
33
33
|
} from 'react-table';
|
|
34
34
|
import { MaterialReactTableProvider } from './useMRT';
|
|
35
35
|
import { MRT_TableContainer } from './table/MRT_TableContainer';
|
|
36
|
-
import { defaultLocalization, MRT_Localization } from './utils/localization';
|
|
37
36
|
import { MRT_ColumnInterface } from './@types/react-table-config';
|
|
37
|
+
import { MRT_Localization, MRT_DefaultLocalization_EN } from './localization';
|
|
38
|
+
import { MRT_Default_Icons, MRT_Icons } from './icons';
|
|
38
39
|
|
|
39
40
|
export type MaterialReactTableProps<D extends {} = {}> = TableOptions<D> &
|
|
40
41
|
UseTableOptions<D> &
|
|
@@ -70,6 +71,7 @@ export type MaterialReactTableProps<D extends {} = {}> = TableOptions<D> &
|
|
|
70
71
|
hideToolbarInternalActions?: boolean;
|
|
71
72
|
hideToolbarBottom?: boolean;
|
|
72
73
|
hideToolbarTop?: boolean;
|
|
74
|
+
icons?: Partial<MRT_Icons>;
|
|
73
75
|
isFetching?: boolean;
|
|
74
76
|
isLoading?: boolean;
|
|
75
77
|
localization?: Partial<MRT_Localization>;
|
|
@@ -175,7 +177,8 @@ export type MaterialReactTableProps<D extends {} = {}> = TableOptions<D> &
|
|
|
175
177
|
|
|
176
178
|
export default <D extends {}>({
|
|
177
179
|
defaultColumn = { minWidth: 50, maxWidth: 1000 },
|
|
178
|
-
|
|
180
|
+
icons,
|
|
181
|
+
localization,
|
|
179
182
|
positionActionsColumn = 'first',
|
|
180
183
|
positionPagination = 'bottom',
|
|
181
184
|
positionToolbarActions = 'top',
|
|
@@ -184,7 +187,8 @@ export default <D extends {}>({
|
|
|
184
187
|
}: MaterialReactTableProps<D>) => (
|
|
185
188
|
<MaterialReactTableProvider
|
|
186
189
|
defaultColumn={defaultColumn}
|
|
187
|
-
|
|
190
|
+
icons={{ ...MRT_Default_Icons, ...icons }}
|
|
191
|
+
localization={{ ...MRT_DefaultLocalization_EN, ...localization }}
|
|
188
192
|
positionActionsColumn={positionActionsColumn}
|
|
189
193
|
positionPagination={positionPagination}
|
|
190
194
|
positionToolbarActions={positionToolbarActions}
|
|
@@ -63,9 +63,10 @@ export const MRT_TableBodyRow: FC<Props> = ({ row }) => {
|
|
|
63
63
|
{enableRowNumbers && (
|
|
64
64
|
<MRT_StyledTableBodyCell>{row.index + 1}</MRT_StyledTableBodyCell>
|
|
65
65
|
)}
|
|
66
|
-
{(enableRowActions || enableRowEditing) &&
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
{(enableRowActions || enableRowEditing) &&
|
|
67
|
+
positionActionsColumn === 'first' && (
|
|
68
|
+
<MRT_ToggleRowActionMenuButton row={row} />
|
|
69
|
+
)}
|
|
69
70
|
{(anyRowsCanExpand || renderDetailPanel) && (
|
|
70
71
|
<MRT_ExpandButton row={row} />
|
|
71
72
|
)}
|
|
@@ -73,9 +74,10 @@ export const MRT_TableBodyRow: FC<Props> = ({ row }) => {
|
|
|
73
74
|
{row.cells.map((cell) => (
|
|
74
75
|
<MRT_TableBodyCell key={cell.getCellProps().key} cell={cell} />
|
|
75
76
|
))}
|
|
76
|
-
{(enableRowActions || enableRowEditing) &&
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
{(enableRowActions || enableRowEditing) &&
|
|
78
|
+
positionActionsColumn === 'last' && (
|
|
79
|
+
<MRT_ToggleRowActionMenuButton row={row} />
|
|
80
|
+
)}
|
|
79
81
|
</TableRow>
|
|
80
82
|
{renderDetailPanel && <MRT_TableDetailPanel row={row} />}
|
|
81
83
|
</>
|
|
@@ -1,7 +1,5 @@
|
|
|
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
4
|
import { Row } from 'react-table';
|
|
7
5
|
|
|
@@ -16,6 +14,7 @@ interface Props {
|
|
|
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,7 +1,6 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
2
|
import { IconButton, styled } from '@mui/material';
|
|
3
3
|
import { Row } from 'react-table';
|
|
4
|
-
import MuiExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
5
4
|
import { useMRT } from '../useMRT';
|
|
6
5
|
import { MRT_TableButtonCell } from '../table/MRT_TableButtonCell';
|
|
7
6
|
|
|
@@ -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
15
|
row: 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,7 +8,6 @@ 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';
|
|
14
13
|
|
|
@@ -21,7 +20,11 @@ const MenuButtons = styled('div')({
|
|
|
21
20
|
interface Props extends IconButtonProps {}
|
|
22
21
|
|
|
23
22
|
export const MRT_ShowHideColumnsButton: FC<Props> = ({ ...rest }) => {
|
|
24
|
-
const {
|
|
23
|
+
const {
|
|
24
|
+
tableInstance,
|
|
25
|
+
localization,
|
|
26
|
+
icons: { ViewColumnIcon },
|
|
27
|
+
} = useMRT();
|
|
25
28
|
|
|
26
29
|
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
|
|
27
30
|
|
|
@@ -31,9 +34,9 @@ export const MRT_ShowHideColumnsButton: FC<Props> = ({ ...rest }) => {
|
|
|
31
34
|
|
|
32
35
|
return (
|
|
33
36
|
<>
|
|
34
|
-
<Tooltip arrow title={localization
|
|
37
|
+
<Tooltip arrow title={localization.showHideColumnsButtonTitle}>
|
|
35
38
|
<IconButton
|
|
36
|
-
aria-label={localization
|
|
39
|
+
aria-label={localization.showHideColumnsButtonTitle}
|
|
37
40
|
onClick={handleClick}
|
|
38
41
|
size="small"
|
|
39
42
|
{...rest}
|
|
@@ -54,13 +57,13 @@ export const MRT_ShowHideColumnsButton: FC<Props> = ({ ...rest }) => {
|
|
|
54
57
|
}
|
|
55
58
|
onClick={() => tableInstance.toggleHideAllColumns(true)}
|
|
56
59
|
>
|
|
57
|
-
{localization
|
|
60
|
+
{localization.columnShowHideMenuHideAll}
|
|
58
61
|
</Button>
|
|
59
62
|
<Button
|
|
60
63
|
disabled={tableInstance.getToggleHideAllColumnsProps().checked}
|
|
61
64
|
onClick={() => tableInstance.toggleHideAllColumns(false)}
|
|
62
65
|
>
|
|
63
|
-
{localization
|
|
66
|
+
{localization.columnShowHideMenuShowAll}
|
|
64
67
|
</Button>
|
|
65
68
|
</MenuButtons>
|
|
66
69
|
<Divider />
|
|
@@ -1,6 +1,5 @@
|
|
|
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
5
|
import { HeaderGroup } from 'react-table';
|
|
@@ -21,7 +20,10 @@ interface Props {
|
|
|
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,7 +1,5 @@
|
|
|
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
4
|
import { Row } from 'react-table';
|
|
7
5
|
import { MRT_RowActionMenu } from '../menus/MRT_RowActionMenu';
|
|
@@ -27,11 +25,12 @@ 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>
|
|
@@ -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
|
package/src/icons.tsx
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import CancelIcon from '@mui/icons-material/Cancel';
|
|
2
|
+
import ClearAllIcon from '@mui/icons-material/ClearAll';
|
|
3
|
+
import CloseIcon from '@mui/icons-material/Close';
|
|
4
|
+
import DensityMediumIcon from '@mui/icons-material/DensityMedium';
|
|
5
|
+
import DensitySmallIcon from '@mui/icons-material/DensitySmall';
|
|
6
|
+
import DoubleArrowDownIcon from '@mui/icons-material/KeyboardDoubleArrowDown';
|
|
7
|
+
import DynamicFeedIcon from '@mui/icons-material/DynamicFeed';
|
|
8
|
+
import EditIcon from '@mui/icons-material/Edit';
|
|
9
|
+
import ExpandLessIcon from '@mui/icons-material/ExpandLess';
|
|
10
|
+
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
11
|
+
import FilterListIcon from '@mui/icons-material/FilterList';
|
|
12
|
+
import FilterListOffIcon from '@mui/icons-material/FilterListOff';
|
|
13
|
+
import FullscreenExitIcon from '@mui/icons-material/FullscreenExit';
|
|
14
|
+
import FullscreenIcon from '@mui/icons-material/Fullscreen';
|
|
15
|
+
import MoreHorizIcon from '@mui/icons-material/MoreHoriz';
|
|
16
|
+
import MoreVertIcon from '@mui/icons-material/MoreVert';
|
|
17
|
+
import SaveIcon from '@mui/icons-material/Save';
|
|
18
|
+
import SearchIcon from '@mui/icons-material/Search';
|
|
19
|
+
import SearchOffIcon from '@mui/icons-material/SearchOff';
|
|
20
|
+
import SortIcon from '@mui/icons-material/Sort';
|
|
21
|
+
import ViewColumnIcon from '@mui/icons-material/ViewColumn';
|
|
22
|
+
import VisibilityOffIcon from '@mui/icons-material/VisibilityOff';
|
|
23
|
+
|
|
24
|
+
export interface MRT_Icons {
|
|
25
|
+
CancelIcon: any;
|
|
26
|
+
ClearAllIcon: any;
|
|
27
|
+
CloseIcon: any;
|
|
28
|
+
DensityMediumIcon: any;
|
|
29
|
+
DensitySmallIcon: any;
|
|
30
|
+
DoubleArrowDownIcon: any;
|
|
31
|
+
DynamicFeedIcon: any;
|
|
32
|
+
EditIcon: any;
|
|
33
|
+
ExpandLessIcon: any;
|
|
34
|
+
ExpandMoreIcon: any;
|
|
35
|
+
FilterListIcon: any;
|
|
36
|
+
FilterListOffIcon: any;
|
|
37
|
+
FullscreenExitIcon: any;
|
|
38
|
+
FullscreenIcon: any;
|
|
39
|
+
MoreHorizIcon: any;
|
|
40
|
+
MoreVertIcon: any;
|
|
41
|
+
SaveIcon: any;
|
|
42
|
+
SearchIcon: any;
|
|
43
|
+
SearchOffIcon: any;
|
|
44
|
+
SortIcon: any;
|
|
45
|
+
ViewColumnIcon: any;
|
|
46
|
+
VisibilityOffIcon: any;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const MRT_Default_Icons: MRT_Icons = {
|
|
50
|
+
CancelIcon,
|
|
51
|
+
ClearAllIcon,
|
|
52
|
+
CloseIcon,
|
|
53
|
+
DensityMediumIcon,
|
|
54
|
+
DensitySmallIcon,
|
|
55
|
+
DoubleArrowDownIcon,
|
|
56
|
+
DynamicFeedIcon,
|
|
57
|
+
EditIcon,
|
|
58
|
+
ExpandLessIcon,
|
|
59
|
+
ExpandMoreIcon,
|
|
60
|
+
FilterListIcon,
|
|
61
|
+
FilterListOffIcon,
|
|
62
|
+
FullscreenExitIcon,
|
|
63
|
+
FullscreenIcon,
|
|
64
|
+
MoreHorizIcon,
|
|
65
|
+
MoreVertIcon,
|
|
66
|
+
SaveIcon,
|
|
67
|
+
SearchIcon,
|
|
68
|
+
SearchOffIcon,
|
|
69
|
+
SortIcon,
|
|
70
|
+
ViewColumnIcon,
|
|
71
|
+
VisibilityOffIcon,
|
|
72
|
+
};
|