material-react-table 0.4.4 → 0.4.7
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 +13 -10
- package/dist/buttons/MRT_FullScreenToggleButton.d.ts +3 -1
- package/dist/buttons/MRT_ShowHideColumnsButton.d.ts +2 -1
- package/dist/buttons/MRT_ToggleDensePaddingButton.d.ts +2 -1
- package/dist/buttons/MRT_ToggleFiltersButton.d.ts +3 -1
- package/dist/buttons/MRT_ToggleSearchButton.d.ts +3 -1
- package/dist/icons.d.ts +25 -0
- package/dist/inputs/MRT_SelectCheckbox.d.ts +2 -1
- package/dist/{utils/localization.d.ts → localization.d.ts} +1 -1
- package/dist/material-react-table.cjs.development.js +273 -209
- 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 +274 -210
- package/dist/material-react-table.esm.js.map +1 -1
- package/dist/useMRT.d.ts +6 -2
- package/package.json +5 -6
- package/src/MaterialReactTable.tsx +16 -10
- package/src/body/MRT_TableBodyRow.tsx +9 -6
- package/src/body/MRT_TableDetailPanel.tsx +6 -13
- 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 +13 -9
- package/src/buttons/MRT_ShowHideColumnsButton.tsx +13 -8
- package/src/buttons/MRT_ToggleColumnActionMenuButton.tsx +18 -10
- package/src/buttons/MRT_ToggleDensePaddingButton.tsx +12 -8
- package/src/buttons/MRT_ToggleFiltersButton.tsx +12 -8
- package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +6 -7
- package/src/buttons/MRT_ToggleSearchButton.tsx +12 -9
- package/src/footer/MRT_TableFooterRow.tsx +9 -10
- package/src/head/MRT_TableHeadCell.tsx +21 -12
- package/src/head/MRT_TableHeadCellActions.tsx +1 -1
- package/src/head/MRT_TableHeadRow.tsx +6 -5
- package/src/icons.tsx +72 -0
- package/src/inputs/MRT_EditCellTextField.tsx +1 -2
- package/src/inputs/MRT_FilterTextField.tsx +12 -13
- package/src/inputs/MRT_SearchTextField.tsx +4 -5
- package/src/inputs/MRT_SelectCheckbox.tsx +44 -15
- package/src/{utils/localization.ts → localization.ts} +4 -4
- package/src/menus/MRT_ColumnActionMenu.tsx +14 -12
- package/src/menus/MRT_RowActionMenu.tsx +2 -2
- package/src/table/MRT_TableContainer.tsx +15 -5
- package/src/toolbar/MRT_TablePagination.tsx +1 -0
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +3 -3
- package/src/useMRT.tsx +6 -2
- package/dist/inputs/MRT_DensePaddingSwitch.d.ts +0 -5
- package/dist/inputs/MRT_SelectAllCheckbox.d.ts +0 -2
- package/src/inputs/MRT_DensePaddingSwitch.tsx +0 -23
- package/src/inputs/MRT_SelectAllCheckbox.tsx +0 -22
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.7",
|
|
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.",
|
|
@@ -57,12 +57,12 @@
|
|
|
57
57
|
],
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@babel/core": "^7.17.5",
|
|
60
|
-
"@emotion/react": "^11.8.
|
|
61
|
-
"@emotion/styled": "^11.8.
|
|
60
|
+
"@emotion/react": "^11.8.1",
|
|
61
|
+
"@emotion/styled": "^11.8.1",
|
|
62
62
|
"@etchteam/storybook-addon-status": "^4.2.0",
|
|
63
|
-
"@faker-js/faker": "^6.0.0-alpha.
|
|
63
|
+
"@faker-js/faker": "^6.0.0-alpha.7",
|
|
64
64
|
"@mui/icons-material": "^5.4.2",
|
|
65
|
-
"@mui/material": "^5.4.
|
|
65
|
+
"@mui/material": "^5.4.3",
|
|
66
66
|
"@size-limit/preset-small-lib": "^7.0.8",
|
|
67
67
|
"@storybook/addon-a11y": "^6.4.19",
|
|
68
68
|
"@storybook/addon-actions": "^6.4.19",
|
|
@@ -86,7 +86,6 @@
|
|
|
86
86
|
"react-table": "^7.7.0",
|
|
87
87
|
"size-limit": "^7.0.8",
|
|
88
88
|
"storybook-addon-paddings": "^4.2.1",
|
|
89
|
-
"storybook-addon-performance": "^0.16.1",
|
|
90
89
|
"storybook-dark-mode": "^1.0.9",
|
|
91
90
|
"tsdx": "^0.14.1",
|
|
92
91
|
"tslib": "^2.3.1",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { ChangeEvent, FC, MouseEvent, ReactNode } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
AlertProps,
|
|
4
|
+
IconButtonProps,
|
|
4
5
|
TableBodyProps,
|
|
5
6
|
TableCellProps,
|
|
6
7
|
TableContainerProps,
|
|
@@ -32,8 +33,9 @@ import {
|
|
|
32
33
|
} from 'react-table';
|
|
33
34
|
import { MaterialReactTableProvider } from './useMRT';
|
|
34
35
|
import { MRT_TableContainer } from './table/MRT_TableContainer';
|
|
35
|
-
import { defaultLocalization, MRT_Localization } from './utils/localization';
|
|
36
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';
|
|
37
39
|
|
|
38
40
|
export type MaterialReactTableProps<D extends {} = {}> = TableOptions<D> &
|
|
39
41
|
UseTableOptions<D> &
|
|
@@ -58,17 +60,18 @@ export type MaterialReactTableProps<D extends {} = {}> = TableOptions<D> &
|
|
|
58
60
|
disableFullScreenToggle?: boolean;
|
|
59
61
|
disableSelectAll?: boolean;
|
|
60
62
|
disableSubRowTree?: boolean;
|
|
61
|
-
enableRowNumbers?: boolean;
|
|
62
63
|
enableColumnGrouping?: boolean;
|
|
63
64
|
enableColumnResizing?: boolean;
|
|
64
65
|
enableRowActions?: boolean;
|
|
65
66
|
enableRowEditing?: boolean;
|
|
67
|
+
enableRowNumbers?: boolean;
|
|
66
68
|
enableSelection?: boolean;
|
|
67
69
|
hideTableFooter?: boolean;
|
|
68
70
|
hideTableHead?: boolean;
|
|
69
|
-
hideToolbarInternalActions?: boolean;
|
|
70
71
|
hideToolbarBottom?: boolean;
|
|
72
|
+
hideToolbarInternalActions?: boolean;
|
|
71
73
|
hideToolbarTop?: boolean;
|
|
74
|
+
icons?: Partial<MRT_Icons>;
|
|
72
75
|
isFetching?: boolean;
|
|
73
76
|
isLoading?: boolean;
|
|
74
77
|
localization?: Partial<MRT_Localization>;
|
|
@@ -138,6 +141,7 @@ export type MaterialReactTableProps<D extends {} = {}> = TableOptions<D> &
|
|
|
138
141
|
row: Row<D>,
|
|
139
142
|
selectedRows: Row<D>[],
|
|
140
143
|
) => void;
|
|
144
|
+
onSelectAllChange?: (event: ChangeEvent, selectedRows: Row<D>[]) => void;
|
|
141
145
|
positionActionsColumn?: 'first' | 'last';
|
|
142
146
|
positionPagination?: 'bottom' | 'top' | 'both';
|
|
143
147
|
positionToolbarActions?: 'bottom' | 'top';
|
|
@@ -162,18 +166,19 @@ export type MaterialReactTableProps<D extends {} = {}> = TableOptions<D> &
|
|
|
162
166
|
MRT_ToggleDensePaddingButton,
|
|
163
167
|
MRT_FullScreenToggleButton,
|
|
164
168
|
}: {
|
|
165
|
-
MRT_ToggleSearchButton: FC
|
|
166
|
-
MRT_ToggleFiltersButton: FC
|
|
167
|
-
MRT_ShowHideColumnsButton: FC
|
|
168
|
-
MRT_ToggleDensePaddingButton: FC
|
|
169
|
-
MRT_FullScreenToggleButton: FC
|
|
169
|
+
MRT_ToggleSearchButton: FC<IconButtonProps>;
|
|
170
|
+
MRT_ToggleFiltersButton: FC<IconButtonProps>;
|
|
171
|
+
MRT_ShowHideColumnsButton: FC<IconButtonProps>;
|
|
172
|
+
MRT_ToggleDensePaddingButton: FC<IconButtonProps>;
|
|
173
|
+
MRT_FullScreenToggleButton: FC<IconButtonProps>;
|
|
170
174
|
},
|
|
171
175
|
) => ReactNode;
|
|
172
176
|
};
|
|
173
177
|
|
|
174
178
|
export default <D extends {}>({
|
|
175
179
|
defaultColumn = { minWidth: 50, maxWidth: 1000 },
|
|
176
|
-
|
|
180
|
+
icons,
|
|
181
|
+
localization,
|
|
177
182
|
positionActionsColumn = 'first',
|
|
178
183
|
positionPagination = 'bottom',
|
|
179
184
|
positionToolbarActions = 'top',
|
|
@@ -182,7 +187,8 @@ export default <D extends {}>({
|
|
|
182
187
|
}: MaterialReactTableProps<D>) => (
|
|
183
188
|
<MaterialReactTableProvider
|
|
184
189
|
defaultColumn={defaultColumn}
|
|
185
|
-
|
|
190
|
+
icons={{ ...MRT_Default_Icons, ...icons }}
|
|
191
|
+
localization={{ ...MRT_DefaultLocalization_EN, ...localization }}
|
|
186
192
|
positionActionsColumn={positionActionsColumn}
|
|
187
193
|
positionPagination={positionPagination}
|
|
188
194
|
positionToolbarActions={positionToolbarActions}
|
|
@@ -27,6 +27,7 @@ export const MRT_TableBodyRow: FC<Props> = ({ row }) => {
|
|
|
27
27
|
const {
|
|
28
28
|
anyRowsCanExpand,
|
|
29
29
|
enableRowActions,
|
|
30
|
+
enableRowEditing,
|
|
30
31
|
enableRowNumbers,
|
|
31
32
|
enableSelection,
|
|
32
33
|
muiTableBodyRowProps,
|
|
@@ -62,9 +63,10 @@ export const MRT_TableBodyRow: FC<Props> = ({ row }) => {
|
|
|
62
63
|
{enableRowNumbers && (
|
|
63
64
|
<MRT_StyledTableBodyCell>{row.index + 1}</MRT_StyledTableBodyCell>
|
|
64
65
|
)}
|
|
65
|
-
{enableRowActions
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
{(enableRowActions || enableRowEditing) &&
|
|
67
|
+
positionActionsColumn === 'first' && (
|
|
68
|
+
<MRT_ToggleRowActionMenuButton row={row} />
|
|
69
|
+
)}
|
|
68
70
|
{(anyRowsCanExpand || renderDetailPanel) && (
|
|
69
71
|
<MRT_ExpandButton row={row} />
|
|
70
72
|
)}
|
|
@@ -72,9 +74,10 @@ export const MRT_TableBodyRow: FC<Props> = ({ row }) => {
|
|
|
72
74
|
{row.cells.map((cell) => (
|
|
73
75
|
<MRT_TableBodyCell key={cell.getCellProps().key} cell={cell} />
|
|
74
76
|
))}
|
|
75
|
-
{enableRowActions
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
{(enableRowActions || enableRowEditing) &&
|
|
78
|
+
positionActionsColumn === 'last' && (
|
|
79
|
+
<MRT_ToggleRowActionMenuButton row={row} />
|
|
80
|
+
)}
|
|
78
81
|
</TableRow>
|
|
79
82
|
{renderDetailPanel && <MRT_TableDetailPanel row={row} />}
|
|
80
83
|
</>
|
|
@@ -23,11 +23,11 @@ interface Props {
|
|
|
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,25 +37,18 @@ 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
53
|
<TableRow hover {...tableRowProps}>
|
|
61
54
|
<TableCell
|
|
@@ -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,22 +1,26 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
|
-
import { IconButton, Tooltip } from '@mui/material';
|
|
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
|
-
export const MRT_FullScreenToggleButton: FC<Props> = () => {
|
|
10
|
-
const {
|
|
7
|
+
export const MRT_FullScreenToggleButton: FC<Props> = ({ ...rest }) => {
|
|
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"
|
|
21
|
+
{...rest}
|
|
18
22
|
>
|
|
19
|
-
{fullScreen ? <
|
|
23
|
+
{fullScreen ? <FullscreenExitIcon /> : <FullscreenIcon />}
|
|
20
24
|
</IconButton>
|
|
21
25
|
</Tooltip>
|
|
22
26
|
);
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
Tooltip,
|
|
7
7
|
styled,
|
|
8
8
|
Divider,
|
|
9
|
+
IconButtonProps,
|
|
9
10
|
} from '@mui/material';
|
|
10
|
-
import ViewColumnIcon from '@mui/icons-material/ViewColumn';
|
|
11
11
|
import { useMRT } from '../useMRT';
|
|
12
12
|
import { MRT_ShowHideColumnsMenu } from '../menus/MRT_ShowHideColumnsMenu';
|
|
13
13
|
|
|
@@ -17,10 +17,14 @@ const MenuButtons = styled('div')({
|
|
|
17
17
|
padding: '0 0.5rem 0.5rem 0.5rem',
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
interface Props {}
|
|
20
|
+
interface Props extends IconButtonProps {}
|
|
21
21
|
|
|
22
|
-
export const MRT_ShowHideColumnsButton: FC<Props> = () => {
|
|
23
|
-
const {
|
|
22
|
+
export const MRT_ShowHideColumnsButton: FC<Props> = ({ ...rest }) => {
|
|
23
|
+
const {
|
|
24
|
+
tableInstance,
|
|
25
|
+
localization,
|
|
26
|
+
icons: { ViewColumnIcon },
|
|
27
|
+
} = useMRT();
|
|
24
28
|
|
|
25
29
|
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
|
|
26
30
|
|
|
@@ -30,11 +34,12 @@ export const MRT_ShowHideColumnsButton: FC<Props> = () => {
|
|
|
30
34
|
|
|
31
35
|
return (
|
|
32
36
|
<>
|
|
33
|
-
<Tooltip arrow title={localization
|
|
37
|
+
<Tooltip arrow title={localization.showHideColumnsButtonTitle}>
|
|
34
38
|
<IconButton
|
|
35
|
-
aria-label={localization
|
|
39
|
+
aria-label={localization.showHideColumnsButtonTitle}
|
|
36
40
|
onClick={handleClick}
|
|
37
41
|
size="small"
|
|
42
|
+
{...rest}
|
|
38
43
|
>
|
|
39
44
|
<ViewColumnIcon />
|
|
40
45
|
</IconButton>
|
|
@@ -52,13 +57,13 @@ export const MRT_ShowHideColumnsButton: FC<Props> = () => {
|
|
|
52
57
|
}
|
|
53
58
|
onClick={() => tableInstance.toggleHideAllColumns(true)}
|
|
54
59
|
>
|
|
55
|
-
{localization
|
|
60
|
+
{localization.columnShowHideMenuHideAll}
|
|
56
61
|
</Button>
|
|
57
62
|
<Button
|
|
58
63
|
disabled={tableInstance.getToggleHideAllColumnsProps().checked}
|
|
59
64
|
onClick={() => tableInstance.toggleHideAllColumns(false)}
|
|
60
65
|
>
|
|
61
|
-
{localization
|
|
66
|
+
{localization.columnShowHideMenuShowAll}
|
|
62
67
|
</Button>
|
|
63
68
|
</MenuButtons>
|
|
64
69
|
<Divider />
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { FC, MouseEvent, useState } from 'react';
|
|
2
|
-
import { IconButton as MuiIconButton, styled } from '@mui/material';
|
|
3
|
-
import MoreVertIcon from '@mui/icons-material/MoreVert';
|
|
2
|
+
import { IconButton as MuiIconButton, styled, Tooltip } from '@mui/material';
|
|
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
|
|
|
@@ -33,14 +35,20 @@ export const MRT_ToggleColumnActionMenuButton: FC<Props> = ({ column }) => {
|
|
|
33
35
|
|
|
34
36
|
return (
|
|
35
37
|
<>
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
title={localization
|
|
38
|
+
<Tooltip
|
|
39
|
+
arrow
|
|
40
|
+
enterDelay={1000}
|
|
41
|
+
enterNextDelay={1000}
|
|
42
|
+
title={localization.columnActionMenuButtonTitle}
|
|
41
43
|
>
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
+
<IconButton
|
|
45
|
+
aria-label={localization.columnActionMenuButtonTitle}
|
|
46
|
+
onClick={handleClick}
|
|
47
|
+
size="small"
|
|
48
|
+
>
|
|
49
|
+
<MoreVertIcon />
|
|
50
|
+
</IconButton>
|
|
51
|
+
</Tooltip>
|
|
44
52
|
<MRT_ColumnActionMenu
|
|
45
53
|
anchorEl={anchorEl}
|
|
46
54
|
column={column}
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
|
-
import { IconButton, Tooltip } from '@mui/material';
|
|
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
|
-
interface Props {}
|
|
5
|
+
interface Props extends IconButtonProps {}
|
|
8
6
|
|
|
9
|
-
export const MRT_ToggleDensePaddingButton: FC<Props> = () => {
|
|
10
|
-
const {
|
|
7
|
+
export const MRT_ToggleDensePaddingButton: FC<Props> = ({ ...rest }) => {
|
|
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"
|
|
21
|
+
{...rest}
|
|
18
22
|
>
|
|
19
23
|
{densePadding ? <DensitySmallIcon /> : <DensityMediumIcon />}
|
|
20
24
|
</IconButton>
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
|
-
import { IconButton, Tooltip } from '@mui/material';
|
|
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
|
-
export const MRT_ToggleFiltersButton: FC<Props> = () => {
|
|
10
|
-
const {
|
|
7
|
+
export const MRT_ToggleFiltersButton: FC<Props> = ({ ...rest }) => {
|
|
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"
|
|
21
|
+
{...rest}
|
|
18
22
|
>
|
|
19
23
|
{showFilters ? <FilterListOffIcon /> : <FilterListIcon />}
|
|
20
24
|
</IconButton>
|
|
@@ -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
|
-
import { IconButton, Tooltip } from '@mui/material';
|
|
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
|
-
export const MRT_ToggleSearchButton: FC<Props> = () => {
|
|
10
|
-
const {
|
|
11
|
-
|
|
7
|
+
export const MRT_ToggleSearchButton: FC<Props> = ({ ...rest }) => {
|
|
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,8 +27,8 @@ export const MRT_ToggleSearchButton: FC<Props> = () => {
|
|
|
24
27
|
};
|
|
25
28
|
|
|
26
29
|
return (
|
|
27
|
-
<Tooltip arrow title={localization
|
|
28
|
-
<IconButton size="small" onClick={handleToggleSearch}>
|
|
30
|
+
<Tooltip arrow title={localization.toggleSearchButtonTitle}>
|
|
31
|
+
<IconButton size="small" onClick={handleToggleSearch} {...rest}>
|
|
29
32
|
{showSearch ? <SearchOffIcon /> : <SearchIcon />}
|
|
30
33
|
</IconButton>
|
|
31
34
|
</Tooltip>
|