material-react-table 0.40.9 → 0.40.10
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/cjs/MaterialReactTable.d.ts +4 -2
- package/dist/cjs/index.js +46 -23
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/MaterialReactTable.d.ts +4 -2
- package/dist/esm/material-react-table.esm.js +46 -23
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/package.json +1 -1
- package/src/MaterialReactTable.tsx +5 -1
- package/src/buttons/MRT_CopyButton.tsx +7 -1
- package/src/buttons/MRT_ExpandAllButton.tsx +2 -1
- package/src/buttons/MRT_ExpandButton.tsx +2 -1
- package/src/buttons/MRT_FullScreenToggleButton.tsx +2 -1
- package/src/buttons/MRT_GrabHandleButton.tsx +2 -1
- package/src/buttons/MRT_ShowHideColumnsButton.tsx +2 -1
- package/src/buttons/MRT_ToggleDensePaddingButton.tsx +2 -1
- package/src/buttons/MRT_ToggleFiltersButton.tsx +2 -1
- package/src/buttons/MRT_ToggleGlobalFilterButton.tsx +2 -2
- package/src/head/MRT_TableHeadCellColumnActionsButton.tsx +2 -1
- package/src/inputs/MRT_FilterTextField.tsx +18 -3
- package/src/inputs/MRT_SelectCheckbox.tsx +5 -1
package/dist/index.d.ts
CHANGED
|
@@ -373,9 +373,11 @@ declare type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit<Column
|
|
|
373
373
|
* @default gets set to the same value as `accessorKey` by default
|
|
374
374
|
*/
|
|
375
375
|
id?: LiteralUnion<string & keyof TData>;
|
|
376
|
-
muiTableBodyCellCopyButtonProps?: ButtonProps | (({ cell, table, }: {
|
|
377
|
-
table: MRT_TableInstance<TData>;
|
|
376
|
+
muiTableBodyCellCopyButtonProps?: ButtonProps | (({ cell, column, row, table, }: {
|
|
378
377
|
cell: MRT_Cell<TData>;
|
|
378
|
+
column: MRT_Column<TData>;
|
|
379
|
+
row: MRT_Row<TData>;
|
|
380
|
+
table: MRT_TableInstance<TData>;
|
|
379
381
|
}) => ButtonProps);
|
|
380
382
|
muiTableBodyCellEditTextFieldProps?: TextFieldProps | (({ cell, column, row, table, }: {
|
|
381
383
|
cell: MRT_Cell<TData>;
|
package/package.json
CHANGED
|
@@ -288,10 +288,14 @@ export type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit<
|
|
|
288
288
|
| ButtonProps
|
|
289
289
|
| (({
|
|
290
290
|
cell,
|
|
291
|
+
column,
|
|
292
|
+
row,
|
|
291
293
|
table,
|
|
292
294
|
}: {
|
|
293
|
-
table: MRT_TableInstance<TData>;
|
|
294
295
|
cell: MRT_Cell<TData>;
|
|
296
|
+
column: MRT_Column<TData>;
|
|
297
|
+
row: MRT_Row<TData>;
|
|
298
|
+
table: MRT_TableInstance<TData>;
|
|
295
299
|
}) => ButtonProps);
|
|
296
300
|
muiTableBodyCellEditTextFieldProps?:
|
|
297
301
|
| TextFieldProps
|
|
@@ -37,6 +37,8 @@ export const MRT_CopyButton = <TData extends Record<string, any> = {}>({
|
|
|
37
37
|
columnDef.muiTableBodyCellCopyButtonProps instanceof Function
|
|
38
38
|
? columnDef.muiTableBodyCellCopyButtonProps({
|
|
39
39
|
cell,
|
|
40
|
+
column,
|
|
41
|
+
row,
|
|
40
42
|
table,
|
|
41
43
|
})
|
|
42
44
|
: columnDef.muiTableBodyCellCopyButtonProps;
|
|
@@ -52,7 +54,10 @@ export const MRT_CopyButton = <TData extends Record<string, any> = {}>({
|
|
|
52
54
|
enterDelay={1000}
|
|
53
55
|
enterNextDelay={1000}
|
|
54
56
|
placement="top"
|
|
55
|
-
title={
|
|
57
|
+
title={
|
|
58
|
+
buttonProps?.title ??
|
|
59
|
+
(copied ? localization.copiedToClipboard : localization.clickToCopy)
|
|
60
|
+
}
|
|
56
61
|
>
|
|
57
62
|
<Button
|
|
58
63
|
onClick={(e) => handleCopy(e, cell.getValue())}
|
|
@@ -76,6 +81,7 @@ export const MRT_CopyButton = <TData extends Record<string, any> = {}>({
|
|
|
76
81
|
? buttonProps.sx(theme)
|
|
77
82
|
: (buttonProps?.sx as any)),
|
|
78
83
|
})}
|
|
84
|
+
title={undefined}
|
|
79
85
|
>
|
|
80
86
|
{children}
|
|
81
87
|
</Button>
|
|
@@ -32,7 +32,7 @@ export const MRT_ExpandAllButton: FC<Props> = ({ table }) => {
|
|
|
32
32
|
arrow
|
|
33
33
|
enterDelay={1000}
|
|
34
34
|
enterNextDelay={1000}
|
|
35
|
-
title={localization.expandAll}
|
|
35
|
+
title={iconButtonProps?.title ?? localization.expandAll}
|
|
36
36
|
>
|
|
37
37
|
<span>
|
|
38
38
|
<IconButton
|
|
@@ -48,6 +48,7 @@ export const MRT_ExpandAllButton: FC<Props> = ({ table }) => {
|
|
|
48
48
|
? iconButtonProps?.sx(theme)
|
|
49
49
|
: (iconButtonProps?.sx as any)),
|
|
50
50
|
})}
|
|
51
|
+
title={undefined}
|
|
51
52
|
>
|
|
52
53
|
<KeyboardDoubleArrowDownIcon
|
|
53
54
|
style={{
|
|
@@ -35,7 +35,7 @@ export const MRT_ExpandButton: FC<Props> = ({ row, table }) => {
|
|
|
35
35
|
arrow
|
|
36
36
|
enterDelay={1000}
|
|
37
37
|
enterNextDelay={1000}
|
|
38
|
-
title={localization.expand}
|
|
38
|
+
title={iconButtonProps?.title ?? localization.expand}
|
|
39
39
|
>
|
|
40
40
|
<span>
|
|
41
41
|
<IconButton
|
|
@@ -50,6 +50,7 @@ export const MRT_ExpandButton: FC<Props> = ({ row, table }) => {
|
|
|
50
50
|
? iconButtonProps.sx(theme)
|
|
51
51
|
: (iconButtonProps?.sx as any)),
|
|
52
52
|
})}
|
|
53
|
+
title={undefined}
|
|
53
54
|
>
|
|
54
55
|
<ExpandMoreIcon
|
|
55
56
|
style={{
|
|
@@ -28,11 +28,12 @@ export const MRT_FullScreenToggleButton = <
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
return (
|
|
31
|
-
<Tooltip arrow title={localization.toggleFullScreen}>
|
|
31
|
+
<Tooltip arrow title={rest?.title ?? localization.toggleFullScreen}>
|
|
32
32
|
<IconButton
|
|
33
33
|
aria-label={localization.showHideFilters}
|
|
34
34
|
onClick={handleToggleFullScreen}
|
|
35
35
|
{...rest}
|
|
36
|
+
title={undefined}
|
|
36
37
|
>
|
|
37
38
|
{isFullScreen ? <FullscreenExitIcon /> : <FullscreenIcon />}
|
|
38
39
|
</IconButton>
|
|
@@ -28,7 +28,7 @@ export const MRT_GrabHandleButton = <TData extends Record<string, any> = {}>({
|
|
|
28
28
|
enterDelay={1000}
|
|
29
29
|
enterNextDelay={1000}
|
|
30
30
|
placement="top"
|
|
31
|
-
title={localization.move}
|
|
31
|
+
title={iconButtonProps?.title ?? localization.move}
|
|
32
32
|
>
|
|
33
33
|
<IconButton
|
|
34
34
|
disableRipple
|
|
@@ -58,6 +58,7 @@ export const MRT_GrabHandleButton = <TData extends Record<string, any> = {}>({
|
|
|
58
58
|
? iconButtonProps?.sx(theme)
|
|
59
59
|
: (iconButtonProps?.sx as any)),
|
|
60
60
|
})}
|
|
61
|
+
title={undefined}
|
|
61
62
|
>
|
|
62
63
|
<DragHandleIcon />
|
|
63
64
|
</IconButton>
|
|
@@ -29,11 +29,12 @@ export const MRT_ShowHideColumnsButton = <
|
|
|
29
29
|
|
|
30
30
|
return (
|
|
31
31
|
<>
|
|
32
|
-
<Tooltip arrow title={localization.showHideColumns}>
|
|
32
|
+
<Tooltip arrow title={rest?.title ?? localization.showHideColumns}>
|
|
33
33
|
<IconButton
|
|
34
34
|
aria-label={localization.showHideColumns}
|
|
35
35
|
onClick={handleClick}
|
|
36
36
|
{...rest}
|
|
37
|
+
title={undefined}
|
|
37
38
|
>
|
|
38
39
|
<ViewColumnIcon />
|
|
39
40
|
</IconButton>
|
|
@@ -34,11 +34,12 @@ export const MRT_ToggleDensePaddingButton = <
|
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
return (
|
|
37
|
-
<Tooltip arrow title={localization.toggleDensity}>
|
|
37
|
+
<Tooltip arrow title={rest?.title ?? localization.toggleDensity}>
|
|
38
38
|
<IconButton
|
|
39
39
|
aria-label={localization.toggleDensity}
|
|
40
40
|
onClick={handleToggleDensePadding}
|
|
41
41
|
{...rest}
|
|
42
|
+
title={undefined}
|
|
42
43
|
>
|
|
43
44
|
{density === 'compact' ? (
|
|
44
45
|
<DensitySmallIcon />
|
|
@@ -28,11 +28,12 @@ export const MRT_ToggleFiltersButton = <
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
return (
|
|
31
|
-
<Tooltip arrow title={localization.showHideFilters}>
|
|
31
|
+
<Tooltip arrow title={rest?.title ?? localization.showHideFilters}>
|
|
32
32
|
<IconButton
|
|
33
33
|
aria-label={localization.showHideFilters}
|
|
34
34
|
onClick={handleToggleShowFilters}
|
|
35
35
|
{...rest}
|
|
36
|
+
title={undefined}
|
|
36
37
|
>
|
|
37
38
|
{showColumnFilters ? <FilterListOffIcon /> : <FilterListIcon />}
|
|
38
39
|
</IconButton>
|
|
@@ -31,8 +31,8 @@ export const MRT_ToggleGlobalFilterButton = <
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
return (
|
|
34
|
-
<Tooltip arrow title={localization.showHideSearch}>
|
|
35
|
-
<IconButton onClick={handleToggleSearch} {...rest}>
|
|
34
|
+
<Tooltip arrow title={rest?.title ?? localization.showHideSearch}>
|
|
35
|
+
<IconButton onClick={handleToggleSearch} {...rest} title={undefined}>
|
|
36
36
|
{showGlobalFilter ? <SearchOffIcon /> : <SearchIcon />}
|
|
37
37
|
</IconButton>
|
|
38
38
|
</Tooltip>
|
|
@@ -55,7 +55,7 @@ export const MRT_TableHeadCellColumnActionsButton: FC<Props> = ({
|
|
|
55
55
|
enterDelay={1000}
|
|
56
56
|
enterNextDelay={1000}
|
|
57
57
|
placement="top"
|
|
58
|
-
title={localization.columnActions}
|
|
58
|
+
title={iconButtonProps?.title ?? localization.columnActions}
|
|
59
59
|
>
|
|
60
60
|
<IconButton
|
|
61
61
|
aria-label={localization.columnActions}
|
|
@@ -75,6 +75,7 @@ export const MRT_TableHeadCellColumnActionsButton: FC<Props> = ({
|
|
|
75
75
|
? iconButtonProps.sx(theme)
|
|
76
76
|
: (iconButtonProps?.sx as any)),
|
|
77
77
|
})}
|
|
78
|
+
title={undefined}
|
|
78
79
|
>
|
|
79
80
|
<MoreVertIcon />
|
|
80
81
|
</IconButton>
|
|
@@ -278,9 +278,24 @@ export const MRT_FilterTextField: FC<Props> = ({
|
|
|
278
278
|
<Box sx={{ opacity: 0.5 }}>{filterPlaceholder}</Box>
|
|
279
279
|
) : (
|
|
280
280
|
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: '2px' }}>
|
|
281
|
-
{(selected as string[])?.map((value) =>
|
|
282
|
-
|
|
283
|
-
|
|
281
|
+
{(selected as string[])?.map((value) => {
|
|
282
|
+
const selectedValue = columnDef.filterSelectOptions?.find(
|
|
283
|
+
(option) =>
|
|
284
|
+
option instanceof Object
|
|
285
|
+
? option.value === value
|
|
286
|
+
: option === value,
|
|
287
|
+
);
|
|
288
|
+
return (
|
|
289
|
+
<Chip
|
|
290
|
+
key={value}
|
|
291
|
+
label={
|
|
292
|
+
selectedValue instanceof Object
|
|
293
|
+
? selectedValue.text
|
|
294
|
+
: selectedValue
|
|
295
|
+
}
|
|
296
|
+
/>
|
|
297
|
+
);
|
|
298
|
+
})}
|
|
284
299
|
</Box>
|
|
285
300
|
)
|
|
286
301
|
: undefined,
|
|
@@ -34,7 +34,10 @@ export const MRT_SelectCheckbox: FC<Props> = ({ row, selectAll, table }) => {
|
|
|
34
34
|
enterDelay={1000}
|
|
35
35
|
enterNextDelay={1000}
|
|
36
36
|
title={
|
|
37
|
-
|
|
37
|
+
checkboxProps?.title ??
|
|
38
|
+
(selectAll
|
|
39
|
+
? localization.toggleSelectAll
|
|
40
|
+
: localization.toggleSelectRow)
|
|
38
41
|
}
|
|
39
42
|
>
|
|
40
43
|
<Checkbox
|
|
@@ -70,6 +73,7 @@ export const MRT_SelectCheckbox: FC<Props> = ({ row, selectAll, table }) => {
|
|
|
70
73
|
? checkboxProps.sx(theme)
|
|
71
74
|
: (checkboxProps?.sx as any)),
|
|
72
75
|
})}
|
|
76
|
+
title={undefined}
|
|
73
77
|
/>
|
|
74
78
|
</Tooltip>
|
|
75
79
|
);
|