material-react-table 0.40.9 → 0.40.12
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 +15 -13
- package/dist/cjs/MaterialReactTable.d.ts +8 -4
- package/dist/cjs/column.utils.d.ts +81 -76
- package/dist/cjs/index.js +81 -52
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/MaterialReactTable.d.ts +8 -4
- package/dist/esm/column.utils.d.ts +81 -76
- package/dist/esm/material-react-table.esm.js +81 -52
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/index.d.ts +8 -4
- package/package.json +4 -4
- package/src/MaterialReactTable.tsx +24 -2
- 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/column.utils.ts +18 -25
- 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/src/table/MRT_TableRoot.tsx +18 -13
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>;
|
|
@@ -421,7 +423,8 @@ declare type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit<Column
|
|
|
421
423
|
}) => ReactNode[];
|
|
422
424
|
sortingFn?: MRT_SortingFn;
|
|
423
425
|
};
|
|
424
|
-
declare type MRT_DefinedColumnDef<TData extends Record<string, any> = {}> = Omit<MRT_ColumnDef<TData>, 'id'> & {
|
|
426
|
+
declare type MRT_DefinedColumnDef<TData extends Record<string, any> = {}> = Omit<MRT_ColumnDef<TData>, 'id' | 'defaultDisplayColumn'> & {
|
|
427
|
+
defaultDisplayColumn: Partial<MRT_ColumnDef<TData>>;
|
|
425
428
|
id: string;
|
|
426
429
|
_filterFn: MRT_FilterOption;
|
|
427
430
|
};
|
|
@@ -473,6 +476,7 @@ declare type MaterialReactTableProps<TData extends Record<string, any> = {}> = O
|
|
|
473
476
|
columns: MRT_ColumnDef<TData>[];
|
|
474
477
|
data: TData[];
|
|
475
478
|
defaultColumn?: Partial<MRT_ColumnDef<TData>>;
|
|
479
|
+
defaultDisplayColumn?: Partial<MRT_ColumnDef<TData>>;
|
|
476
480
|
displayColumnDefOptions?: Partial<{
|
|
477
481
|
[key in MRT_DisplayColumnIds]: Partial<MRT_ColumnDef>;
|
|
478
482
|
}>;
|
|
@@ -722,7 +726,7 @@ declare type Virtualizer = {
|
|
|
722
726
|
scrollToIndex: (index: number, options?: any | undefined) => void;
|
|
723
727
|
measure: () => void;
|
|
724
728
|
};
|
|
725
|
-
declare const _default: <TData extends Record<string, any> = {}>({ aggregationFns, autoResetExpanded, columnResizeMode, defaultColumn, editingMode, enableBottomToolbar, enableColumnActions, enableColumnFilters, enableColumnOrdering, enableColumnResizing, enableDensityToggle, enableExpandAll, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableGlobalFilterRankedResults, enableGrouping, enableHiding, enableMultiRowSelection, enableMultiSort, enablePagination, enablePinning, enableRowSelection, enableSelectAll, enableSorting, enableStickyHeader, enableTableFooter, enableTableHead, enableToolbarInternalActions, enableTopToolbar, filterFns, icons, localization, positionActionsColumn, positionExpandColumn, positionGlobalFilter, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, rowNumberMode, selectAllMode, sortingFns, ...rest }: MaterialReactTableProps<TData>) => JSX.Element;
|
|
729
|
+
declare const _default: <TData extends Record<string, any> = {}>({ aggregationFns, autoResetExpanded, columnResizeMode, defaultColumn, defaultDisplayColumn, editingMode, enableBottomToolbar, enableColumnActions, enableColumnFilters, enableColumnOrdering, enableColumnResizing, enableDensityToggle, enableExpandAll, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableGlobalFilterRankedResults, enableGrouping, enableHiding, enableMultiRowSelection, enableMultiSort, enablePagination, enablePinning, enableRowSelection, enableSelectAll, enableSorting, enableStickyHeader, enableTableFooter, enableTableHead, enableToolbarInternalActions, enableTopToolbar, filterFns, icons, localization, positionActionsColumn, positionExpandColumn, positionGlobalFilter, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, rowNumberMode, selectAllMode, sortingFns, ...rest }: MaterialReactTableProps<TData>) => JSX.Element;
|
|
726
730
|
|
|
727
731
|
interface Props$6<TData extends Record<string, any> = {}> {
|
|
728
732
|
cell: MRT_Cell<TData>;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.40.
|
|
2
|
+
"version": "0.40.12",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"name": "material-react-table",
|
|
5
5
|
"description": "A fully featured Material UI V5 implementation of TanStack React Table V8, written from the ground up in TypeScript.",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"@babel/preset-react": "^7.18.6",
|
|
54
54
|
"@emotion/react": "^11.10.0",
|
|
55
55
|
"@emotion/styled": "^11.10.0",
|
|
56
|
-
"@faker-js/faker": "^7.
|
|
57
|
-
"@mui/icons-material": "^5.10.
|
|
58
|
-
"@mui/material": "^5.10.
|
|
56
|
+
"@faker-js/faker": "^7.5.0",
|
|
57
|
+
"@mui/icons-material": "^5.10.3",
|
|
58
|
+
"@mui/material": "^5.10.3",
|
|
59
59
|
"@rollup/plugin-babel": "^5.3.1",
|
|
60
60
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
61
61
|
"@rollup/plugin-typescript": "^8.4.0",
|
|
@@ -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
|
|
@@ -387,8 +391,9 @@ export type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit<
|
|
|
387
391
|
|
|
388
392
|
export type MRT_DefinedColumnDef<TData extends Record<string, any> = {}> = Omit<
|
|
389
393
|
MRT_ColumnDef<TData>,
|
|
390
|
-
'id'
|
|
394
|
+
'id' | 'defaultDisplayColumn'
|
|
391
395
|
> & {
|
|
396
|
+
defaultDisplayColumn: Partial<MRT_ColumnDef<TData>>;
|
|
392
397
|
id: string;
|
|
393
398
|
_filterFn: MRT_FilterOption;
|
|
394
399
|
};
|
|
@@ -491,6 +496,7 @@ export type MaterialReactTableProps<TData extends Record<string, any> = {}> =
|
|
|
491
496
|
columns: MRT_ColumnDef<TData>[];
|
|
492
497
|
data: TData[];
|
|
493
498
|
defaultColumn?: Partial<MRT_ColumnDef<TData>>;
|
|
499
|
+
defaultDisplayColumn?: Partial<MRT_ColumnDef<TData>>;
|
|
494
500
|
displayColumnDefOptions?: Partial<{
|
|
495
501
|
[key in MRT_DisplayColumnIds]: Partial<MRT_ColumnDef>;
|
|
496
502
|
}>;
|
|
@@ -894,6 +900,7 @@ export default <TData extends Record<string, any> = {}>({
|
|
|
894
900
|
autoResetExpanded = false,
|
|
895
901
|
columnResizeMode = 'onEnd',
|
|
896
902
|
defaultColumn = { minSize: 40, maxSize: 1000, size: 180 },
|
|
903
|
+
defaultDisplayColumn,
|
|
897
904
|
editingMode = 'modal',
|
|
898
905
|
enableBottomToolbar = true,
|
|
899
906
|
enableColumnActions = true,
|
|
@@ -939,6 +946,21 @@ export default <TData extends Record<string, any> = {}>({
|
|
|
939
946
|
autoResetExpanded={autoResetExpanded}
|
|
940
947
|
columnResizeMode={columnResizeMode}
|
|
941
948
|
defaultColumn={defaultColumn}
|
|
949
|
+
defaultDisplayColumn={{
|
|
950
|
+
columnDefType: 'display',
|
|
951
|
+
enableClickToCopy: false,
|
|
952
|
+
enableColumnActions: false,
|
|
953
|
+
enableColumnDragging: false,
|
|
954
|
+
enableColumnFilter: false,
|
|
955
|
+
enableColumnOrdering: false,
|
|
956
|
+
enableEditing: false,
|
|
957
|
+
enableGlobalFilter: false,
|
|
958
|
+
enableGrouping: false,
|
|
959
|
+
enableHiding: false,
|
|
960
|
+
enableResizing: false,
|
|
961
|
+
enableSorting: false,
|
|
962
|
+
...defaultDisplayColumn,
|
|
963
|
+
}}
|
|
942
964
|
editingMode={editingMode}
|
|
943
965
|
enableBottomToolbar={enableBottomToolbar}
|
|
944
966
|
enableColumnActions={enableColumnActions}
|
|
@@ -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>
|
package/src/column.utils.ts
CHANGED
|
@@ -10,21 +10,6 @@ import {
|
|
|
10
10
|
import { MRT_FilterFns } from './filterFns';
|
|
11
11
|
import { MRT_SortingFns } from './sortingFns';
|
|
12
12
|
|
|
13
|
-
export const defaultDisplayColumnDefOptions = {
|
|
14
|
-
columnDefType: 'display',
|
|
15
|
-
enableClickToCopy: false,
|
|
16
|
-
enableColumnActions: false,
|
|
17
|
-
enableColumnDragging: false,
|
|
18
|
-
enableColumnFilter: false,
|
|
19
|
-
enableColumnOrdering: false,
|
|
20
|
-
enableEditing: false,
|
|
21
|
-
enableGlobalFilter: false,
|
|
22
|
-
enableGrouping: false,
|
|
23
|
-
enableHiding: false,
|
|
24
|
-
enableResizing: false,
|
|
25
|
-
enableSorting: false,
|
|
26
|
-
} as Partial<MRT_ColumnDef>;
|
|
27
|
-
|
|
28
13
|
export const getColumnId = <TData extends Record<string, any> = {}>(
|
|
29
14
|
columnDef: MRT_ColumnDef<TData>,
|
|
30
15
|
): string =>
|
|
@@ -48,13 +33,20 @@ export const getAllLeafColumnDefs = <TData extends Record<string, any> = {}>(
|
|
|
48
33
|
return lowestLevelColumns.filter((col) => !col.columns);
|
|
49
34
|
};
|
|
50
35
|
|
|
51
|
-
export const prepareColumns = <TData extends Record<string, any> = {}>(
|
|
52
|
-
columnDefs
|
|
53
|
-
columnFilterFns
|
|
54
|
-
|
|
36
|
+
export const prepareColumns = <TData extends Record<string, any> = {}>({
|
|
37
|
+
columnDefs,
|
|
38
|
+
columnFilterFns,
|
|
39
|
+
defaultDisplayColumn,
|
|
40
|
+
filterFns,
|
|
41
|
+
sortingFns,
|
|
42
|
+
}: {
|
|
43
|
+
columnDefs: MRT_ColumnDef<TData>[];
|
|
44
|
+
columnFilterFns: { [key: string]: MRT_FilterOption };
|
|
45
|
+
defaultDisplayColumn: Partial<MRT_ColumnDef<TData>>;
|
|
46
|
+
filterFns: typeof MRT_FilterFns & MaterialReactTableProps<TData>['filterFns'];
|
|
55
47
|
sortingFns: typeof MRT_SortingFns &
|
|
56
|
-
MaterialReactTableProps<TData>['sortingFns']
|
|
57
|
-
): MRT_DefinedColumnDef<TData>[] =>
|
|
48
|
+
MaterialReactTableProps<TData>['sortingFns'];
|
|
49
|
+
}): MRT_DefinedColumnDef<TData>[] =>
|
|
58
50
|
columnDefs.map((columnDef) => {
|
|
59
51
|
if (!columnDef.id) columnDef.id = getColumnId(columnDef);
|
|
60
52
|
if (process.env.NODE_ENV !== 'production' && !columnDef.id) {
|
|
@@ -65,12 +57,13 @@ export const prepareColumns = <TData extends Record<string, any> = {}>(
|
|
|
65
57
|
if (!columnDef.columnDefType) columnDef.columnDefType = 'data';
|
|
66
58
|
if (!!columnDef.columns?.length) {
|
|
67
59
|
columnDef.columnDefType = 'group';
|
|
68
|
-
columnDef.columns = prepareColumns(
|
|
69
|
-
columnDef.columns,
|
|
60
|
+
columnDef.columns = prepareColumns({
|
|
61
|
+
columnDefs: columnDef.columns,
|
|
70
62
|
columnFilterFns,
|
|
63
|
+
defaultDisplayColumn,
|
|
71
64
|
filterFns,
|
|
72
65
|
sortingFns,
|
|
73
|
-
);
|
|
66
|
+
});
|
|
74
67
|
} else if (columnDef.columnDefType === 'data') {
|
|
75
68
|
if (Object.keys(filterFns).includes(columnFilterFns[columnDef.id])) {
|
|
76
69
|
columnDef.filterFn =
|
|
@@ -84,7 +77,7 @@ export const prepareColumns = <TData extends Record<string, any> = {}>(
|
|
|
84
77
|
}
|
|
85
78
|
} else if (columnDef.columnDefType === 'display') {
|
|
86
79
|
columnDef = {
|
|
87
|
-
...(
|
|
80
|
+
...(defaultDisplayColumn as MRT_ColumnDef<TData>),
|
|
88
81
|
...columnDef,
|
|
89
82
|
};
|
|
90
83
|
}
|
|
@@ -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
|
);
|
|
@@ -22,7 +22,6 @@ import {
|
|
|
22
22
|
getAllLeafColumnDefs,
|
|
23
23
|
getDefaultColumnOrderIds,
|
|
24
24
|
getDefaultColumnFilterFn,
|
|
25
|
-
defaultDisplayColumnDefOptions,
|
|
26
25
|
showExpandColumn,
|
|
27
26
|
getColumnId,
|
|
28
27
|
} from '../column.utils';
|
|
@@ -125,7 +124,7 @@ export const MRT_TableRoot = <TData extends Record<string, any> = {}>(
|
|
|
125
124
|
columnOrder.includes('mrt-row-drag') && {
|
|
126
125
|
header: props.localization?.move,
|
|
127
126
|
size: 60,
|
|
128
|
-
...
|
|
127
|
+
...props.defaultDisplayColumn,
|
|
129
128
|
...props.displayColumnDefOptions?.['mrt-row-drag'],
|
|
130
129
|
id: 'mrt-row-drag',
|
|
131
130
|
},
|
|
@@ -139,7 +138,7 @@ export const MRT_TableRoot = <TData extends Record<string, any> = {}>(
|
|
|
139
138
|
),
|
|
140
139
|
header: props.localization?.actions,
|
|
141
140
|
size: 70,
|
|
142
|
-
...
|
|
141
|
+
...props.defaultDisplayColumn,
|
|
143
142
|
...props.displayColumnDefOptions?.['mrt-row-actions'],
|
|
144
143
|
id: 'mrt-row-actions',
|
|
145
144
|
},
|
|
@@ -154,7 +153,7 @@ export const MRT_TableRoot = <TData extends Record<string, any> = {}>(
|
|
|
154
153
|
) : null,
|
|
155
154
|
header: props.localization?.expand,
|
|
156
155
|
size: 60,
|
|
157
|
-
...
|
|
156
|
+
...props.defaultDisplayColumn,
|
|
158
157
|
...props.displayColumnDefOptions?.['mrt-row-expand'],
|
|
159
158
|
id: 'mrt-row-expand',
|
|
160
159
|
},
|
|
@@ -168,7 +167,7 @@ export const MRT_TableRoot = <TData extends Record<string, any> = {}>(
|
|
|
168
167
|
) : null,
|
|
169
168
|
header: props.localization?.select,
|
|
170
169
|
size: 60,
|
|
171
|
-
...
|
|
170
|
+
...props.defaultDisplayColumn,
|
|
172
171
|
...props.displayColumnDefOptions?.['mrt-row-select'],
|
|
173
172
|
id: 'mrt-row-select',
|
|
174
173
|
},
|
|
@@ -177,7 +176,7 @@ export const MRT_TableRoot = <TData extends Record<string, any> = {}>(
|
|
|
177
176
|
Header: () => props.localization?.rowNumber,
|
|
178
177
|
header: props.localization?.rowNumbers,
|
|
179
178
|
size: 60,
|
|
180
|
-
...
|
|
179
|
+
...props.defaultDisplayColumn,
|
|
181
180
|
...props.displayColumnDefOptions?.['mrt-row-numbers'],
|
|
182
181
|
id: 'mrt-row-numbers',
|
|
183
182
|
},
|
|
@@ -209,13 +208,19 @@ export const MRT_TableRoot = <TData extends Record<string, any> = {}>(
|
|
|
209
208
|
|
|
210
209
|
const columnDefs = useMemo(
|
|
211
210
|
() =>
|
|
212
|
-
prepareColumns(
|
|
213
|
-
[...displayColumns, ...props.columns],
|
|
214
|
-
columnFilterFns,
|
|
215
|
-
props.
|
|
216
|
-
props.
|
|
217
|
-
|
|
218
|
-
|
|
211
|
+
prepareColumns({
|
|
212
|
+
columnDefs: [...displayColumns, ...props.columns],
|
|
213
|
+
columnFilterFns: props.state?.columnFilterFns ?? columnFilterFns,
|
|
214
|
+
defaultDisplayColumn: props.defaultDisplayColumn ?? {},
|
|
215
|
+
filterFns: props.filterFns as any,
|
|
216
|
+
sortingFns: props.sortingFns as any,
|
|
217
|
+
}),
|
|
218
|
+
[
|
|
219
|
+
columnFilterFns,
|
|
220
|
+
displayColumns,
|
|
221
|
+
props.columns,
|
|
222
|
+
props.state?.columnFilterFns,
|
|
223
|
+
],
|
|
219
224
|
);
|
|
220
225
|
|
|
221
226
|
const data: TData[] = useMemo(
|