material-react-table 0.6.6 → 0.6.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/dist/MaterialReactTable.d.ts +2 -2
- package/dist/head/MRT_TableHeadCell.d.ts +9 -2
- package/dist/material-react-table.cjs.development.js +31 -30
- 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 +31 -30
- package/dist/material-react-table.esm.js.map +1 -1
- package/package.json +4 -4
- package/src/MaterialReactTable.tsx +2 -2
- package/src/body/MRT_TableBodyCell.tsx +4 -7
- package/src/buttons/MRT_CopyButton.tsx +19 -19
- package/src/head/MRT_TableHeadCell.tsx +12 -1
- package/src/head/MRT_TableHeadCellActions.tsx +6 -1
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.6.
|
|
2
|
+
"version": "0.6.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.",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@emotion/react": "^11.8.2",
|
|
60
60
|
"@emotion/styled": "^11.8.1",
|
|
61
61
|
"@etchteam/storybook-addon-status": "^4.2.0",
|
|
62
|
-
"@faker-js/faker": "^6.0.0
|
|
62
|
+
"@faker-js/faker": "^6.0.0",
|
|
63
63
|
"@mui/icons-material": "^5.5.1",
|
|
64
64
|
"@mui/material": "^5.5.1",
|
|
65
65
|
"@size-limit/preset-small-lib": "^7.0.8",
|
|
@@ -75,10 +75,10 @@
|
|
|
75
75
|
"@types/faker": "^6.6.8",
|
|
76
76
|
"@types/react": "^17.0.40",
|
|
77
77
|
"@types/react-dom": "^17.0.13",
|
|
78
|
-
"@types/react-table": "^7.7.
|
|
78
|
+
"@types/react-table": "^7.7.10",
|
|
79
79
|
"babel-loader": "^8.2.3",
|
|
80
80
|
"husky": "^7.0.4",
|
|
81
|
-
"prettier": "^2.
|
|
81
|
+
"prettier": "^2.6.0",
|
|
82
82
|
"react": "^17.0.2",
|
|
83
83
|
"react-dom": "^17.0.2",
|
|
84
84
|
"react-is": "^17.0.2",
|
|
@@ -134,9 +134,9 @@ export type MRT_ColumnInterface<D extends {} = {}> = ColumnInterface<D> &
|
|
|
134
134
|
Header?: string;
|
|
135
135
|
accessor?: string;
|
|
136
136
|
columns?: MRT_ColumnInterface<D>[];
|
|
137
|
+
disableClickToCopy?: boolean;
|
|
137
138
|
disableEditing?: boolean;
|
|
138
139
|
disableFilters?: boolean;
|
|
139
|
-
disableCellCopyButton?: boolean;
|
|
140
140
|
filter?: MRT_FilterType | string | FilterType<D>;
|
|
141
141
|
filterSelectOptions?: (string | { text: string; value: string })[];
|
|
142
142
|
filterTypes?: (MRT_FILTER_TYPE | string)[];
|
|
@@ -233,7 +233,7 @@ export type MaterialReactTableProps<D extends {} = {}> = UseTableOptions<D> &
|
|
|
233
233
|
disableFullScreenToggle?: boolean;
|
|
234
234
|
disableSelectAll?: boolean;
|
|
235
235
|
disableSubRowTree?: boolean;
|
|
236
|
-
|
|
236
|
+
enableClickToCopy?: boolean;
|
|
237
237
|
enableColumnGrouping?: boolean;
|
|
238
238
|
enableColumnResizing?: boolean;
|
|
239
239
|
enableRowActions?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { FC, MouseEvent } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { Skeleton, TableCell, TableCellProps } from '@mui/material';
|
|
3
3
|
import { useMRT } from '../useMRT';
|
|
4
4
|
import { MRT_EditCellTextField } from '../inputs/MRT_EditCellTextField';
|
|
5
5
|
import type { MRT_Cell } from '..';
|
|
@@ -23,7 +23,7 @@ interface Props {
|
|
|
23
23
|
|
|
24
24
|
export const MRT_TableBodyCell: FC<Props> = ({ cell }) => {
|
|
25
25
|
const {
|
|
26
|
-
|
|
26
|
+
enableClickToCopy,
|
|
27
27
|
isLoading,
|
|
28
28
|
muiTableBodyCellProps,
|
|
29
29
|
muiTableBodyCellSkeletonProps,
|
|
@@ -83,11 +83,8 @@ export const MRT_TableBodyCell: FC<Props> = ({ cell }) => {
|
|
|
83
83
|
<span>
|
|
84
84
|
{cell.render('Cell')} ({cell.row.subRows.length})
|
|
85
85
|
</span>
|
|
86
|
-
) :
|
|
87
|
-
<
|
|
88
|
-
{cell.render('Cell')}
|
|
89
|
-
{<MRT_CopyButton cell={cell} />}
|
|
90
|
-
</Box>
|
|
86
|
+
) : enableClickToCopy && !cell.column.disableClickToCopy ? (
|
|
87
|
+
<MRT_CopyButton cell={cell} />
|
|
91
88
|
) : (
|
|
92
89
|
cell.render('Cell')
|
|
93
90
|
)}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { FC, useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { Button, Tooltip } from '@mui/material';
|
|
3
3
|
import { useMRT } from '../useMRT';
|
|
4
4
|
import { MRT_Cell } from '..';
|
|
5
5
|
|
|
@@ -8,43 +8,43 @@ interface Props {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export const MRT_CopyButton: FC<Props> = ({ cell }) => {
|
|
11
|
-
const {
|
|
12
|
-
icons: { CheckBoxIcon, ContentCopyIcon },
|
|
13
|
-
localization,
|
|
14
|
-
} = useMRT();
|
|
11
|
+
const { localization } = useMRT();
|
|
15
12
|
|
|
16
13
|
const [copied, setCopied] = useState(false);
|
|
17
14
|
|
|
18
15
|
const handleCopy = (text: string) => {
|
|
19
16
|
navigator.clipboard.writeText(text);
|
|
20
17
|
setCopied(true);
|
|
21
|
-
setTimeout(() => setCopied(false),
|
|
18
|
+
setTimeout(() => setCopied(false), 4000);
|
|
22
19
|
};
|
|
23
20
|
|
|
24
21
|
return (
|
|
25
22
|
<Tooltip
|
|
26
23
|
arrow
|
|
24
|
+
enterDelay={1000}
|
|
25
|
+
enterNextDelay={1000}
|
|
26
|
+
placement="top"
|
|
27
27
|
title={copied ? localization.copiedToClipboard : localization.clickToCopy}
|
|
28
28
|
>
|
|
29
|
-
<
|
|
29
|
+
<Button
|
|
30
30
|
aria-label={localization.clickToCopy}
|
|
31
31
|
onClick={() => handleCopy(cell.value)}
|
|
32
32
|
size="small"
|
|
33
33
|
sx={{
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
'
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
backgroundColor: 'transparent',
|
|
35
|
+
color: 'inherit',
|
|
36
|
+
letterSpacing: 'inherit',
|
|
37
|
+
fontFamily: 'inherit',
|
|
38
|
+
fontSize: 'inherit',
|
|
39
|
+
m: '-0.25rem',
|
|
40
|
+
textTransform: 'inherit',
|
|
41
|
+
textAlign: 'inherit',
|
|
42
|
+
minWidth: 'unset',
|
|
40
43
|
}}
|
|
44
|
+
variant="text"
|
|
41
45
|
>
|
|
42
|
-
{
|
|
43
|
-
|
|
44
|
-
) : (
|
|
45
|
-
<ContentCopyIcon fontSize="small" />
|
|
46
|
-
)}
|
|
47
|
-
</IconButton>
|
|
46
|
+
{cell.render('Cell')}
|
|
47
|
+
</Button>
|
|
48
48
|
</Tooltip>
|
|
49
49
|
);
|
|
50
50
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { FC } from 'react';
|
|
1
|
+
import React, { CSSProperties, FC } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
TableCell,
|
|
4
4
|
TableSortLabel,
|
|
@@ -16,6 +16,11 @@ import type { MRT_HeaderGroup } from '..';
|
|
|
16
16
|
export const commonTableHeadCellStyles = (
|
|
17
17
|
densePadding: boolean,
|
|
18
18
|
enableColumnResizing?: boolean,
|
|
19
|
+
widths?: {
|
|
20
|
+
maxWidth?: CSSProperties['maxWidth'];
|
|
21
|
+
minWidth?: CSSProperties['minWidth'];
|
|
22
|
+
width?: CSSProperties['width'];
|
|
23
|
+
},
|
|
19
24
|
) => ({
|
|
20
25
|
fontWeight: 'bold',
|
|
21
26
|
height: '100%',
|
|
@@ -23,6 +28,7 @@ export const commonTableHeadCellStyles = (
|
|
|
23
28
|
pt: densePadding ? '0.75rem' : '1.25rem',
|
|
24
29
|
transition: `all ${enableColumnResizing ? '10ms' : '0.2s'} ease-in-out`,
|
|
25
30
|
verticalAlign: 'text-top',
|
|
31
|
+
...widths,
|
|
26
32
|
});
|
|
27
33
|
|
|
28
34
|
interface Props {
|
|
@@ -105,6 +111,11 @@ export const MRT_TableHeadCell: FC<Props> = ({ column }) => {
|
|
|
105
111
|
...commonTableHeadCellStyles(
|
|
106
112
|
tableInstance.state.densePadding,
|
|
107
113
|
enableColumnResizing,
|
|
114
|
+
{
|
|
115
|
+
maxWidth: column.maxWidth,
|
|
116
|
+
minWidth: column.minWidth,
|
|
117
|
+
width: column.width,
|
|
118
|
+
},
|
|
108
119
|
),
|
|
109
120
|
...tableCellProps?.sx,
|
|
110
121
|
}}
|
|
@@ -16,7 +16,12 @@ export const MRT_TableHeadCellActions: FC<Props> = () => {
|
|
|
16
16
|
return (
|
|
17
17
|
<TableCell
|
|
18
18
|
style={{ textAlign: 'center' }}
|
|
19
|
-
sx={{
|
|
19
|
+
sx={{
|
|
20
|
+
...commonTableHeadCellStyles(densePadding),
|
|
21
|
+
textAlign: 'center',
|
|
22
|
+
maxWidth: '4rem',
|
|
23
|
+
width: '4rem',
|
|
24
|
+
}}
|
|
20
25
|
>
|
|
21
26
|
{localization.actions}
|
|
22
27
|
</TableCell>
|