material-react-table 0.40.0 → 0.40.3
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 +10 -2
- package/dist/cjs/index.js +56 -31
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/menus/MRT_RowActionMenu.d.ts +2 -2
- package/dist/esm/MaterialReactTable.d.ts +10 -2
- package/dist/esm/material-react-table.esm.js +56 -31
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/menus/MRT_RowActionMenu.d.ts +2 -2
- package/dist/index.d.ts +11 -3
- package/package.json +4 -4
- package/src/MaterialReactTable.tsx +10 -5
- package/src/body/MRT_TableBody.tsx +15 -10
- package/src/buttons/MRT_CopyButton.tsx +4 -3
- package/src/buttons/MRT_EditActionButtons.tsx +4 -1
- package/src/buttons/MRT_ExpandButton.tsx +5 -3
- package/src/buttons/MRT_GrabHandleButton.tsx +4 -0
- package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +8 -3
- package/src/head/MRT_TableHeadCell.tsx +21 -13
- package/src/inputs/MRT_EditCellTextField.tsx +4 -2
- package/src/inputs/MRT_SelectCheckbox.tsx +4 -0
- package/src/menus/MRT_RowActionMenu.tsx +2 -2
- package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +1 -1
- package/src/table/MRT_TableRoot.tsx +1 -1
- package/src/toolbar/MRT_ToolbarDropZone.tsx +10 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
1
|
+
import { FC, MouseEvent } from 'react';
|
|
2
2
|
import type { MRT_Row, MRT_TableInstance } from '..';
|
|
3
3
|
interface Props {
|
|
4
4
|
anchorEl: HTMLElement | null;
|
|
5
|
-
handleEdit: () => void;
|
|
5
|
+
handleEdit: (event: MouseEvent) => void;
|
|
6
6
|
row: MRT_Row;
|
|
7
7
|
setAnchorEl: (anchorEl: HTMLElement | null) => void;
|
|
8
8
|
table: MRT_TableInstance;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { MutableRefObject, Dispatch, SetStateAction, ReactNode, DragEvent } from 'react';
|
|
3
3
|
import { ButtonProps, TextFieldProps, TableCellProps, IconButtonProps, ToolbarProps, LinearProgressProps, CheckboxProps, SkeletonProps, TableBodyProps, TableRowProps, TableContainerProps, TableFooterProps, TableHeadProps, TablePaginationProps, PaperProps, TableProps, ChipProps, AlertProps } from '@mui/material';
|
|
4
4
|
import { Row, Table, TableState, ColumnDef, DeepKeys, Column, Header, HeaderGroup, Cell, SortingFn, FilterFn, TableOptions, OnChangeFn } from '@tanstack/react-table';
|
|
5
|
-
import { Options } from 'react-virtual';
|
|
5
|
+
import { Options, VirtualItem } from 'react-virtual';
|
|
6
6
|
import * as _tanstack_table_core from '@tanstack/table-core';
|
|
7
7
|
import { RankingInfo } from '@tanstack/match-sorter-utils';
|
|
8
8
|
|
|
@@ -701,8 +701,16 @@ declare type MaterialReactTableProps<TData extends Record<string, any> = {}> = O
|
|
|
701
701
|
virtualizerProps?: Partial<Options<HTMLDivElement>> | (({ table, }: {
|
|
702
702
|
table: MRT_TableInstance<TData>;
|
|
703
703
|
}) => Partial<Options<HTMLDivElement>>);
|
|
704
|
+
virtualizerInstanceRef?: MutableRefObject<Virtualizer | null>;
|
|
704
705
|
};
|
|
705
|
-
declare
|
|
706
|
+
declare type Virtualizer = {
|
|
707
|
+
virtualItems: VirtualItem[];
|
|
708
|
+
totalSize: number;
|
|
709
|
+
scrollToOffset: (index: number, options?: any | undefined) => void;
|
|
710
|
+
scrollToIndex: (index: number, options?: any | undefined) => void;
|
|
711
|
+
measure: () => void;
|
|
712
|
+
};
|
|
713
|
+
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;
|
|
706
714
|
|
|
707
715
|
interface Props$6<TData extends Record<string, any> = {}> {
|
|
708
716
|
cell: MRT_Cell<TData>;
|
|
@@ -741,4 +749,4 @@ interface Props<TData extends Record<string, any> = {}> extends IconButtonProps
|
|
|
741
749
|
}
|
|
742
750
|
declare const MRT_ToggleGlobalFilterButton: <TData extends Record<string, any> = {}>({ table, ...rest }: Props<TData>) => JSX.Element;
|
|
743
751
|
|
|
744
|
-
export { MRT_Cell, MRT_Column, MRT_ColumnDef, MRT_CopyButton, MRT_DefinedColumnDef, MRT_DisplayColumnIds, MRT_FilterFn, MRT_FilterOption, MRT_FullScreenToggleButton, MRT_GlobalFilterTextField, MRT_Header, MRT_HeaderGroup, MRT_Icons, MRT_InternalFilterOption, MRT_Localization, MRT_Row, MRT_RowModel, MRT_ShowHideColumnsButton, MRT_SortingFn, MRT_SortingOption, MRT_TableInstance, MRT_TableState, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton, MaterialReactTableProps, _default as default };
|
|
752
|
+
export { MRT_Cell, MRT_Column, MRT_ColumnDef, MRT_CopyButton, MRT_DefinedColumnDef, MRT_DisplayColumnIds, MRT_FilterFn, MRT_FilterOption, MRT_FullScreenToggleButton, MRT_GlobalFilterTextField, MRT_Header, MRT_HeaderGroup, MRT_Icons, MRT_InternalFilterOption, MRT_Localization, MRT_Row, MRT_RowModel, MRT_ShowHideColumnsButton, MRT_SortingFn, MRT_SortingOption, MRT_TableInstance, MRT_TableState, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleGlobalFilterButton, MaterialReactTableProps, Virtualizer, _default as default };
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.40.
|
|
2
|
+
"version": "0.40.3",
|
|
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.",
|
|
@@ -49,13 +49,13 @@
|
|
|
49
49
|
"storybook": "start-storybook -p 6006"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@babel/core": "^7.18.
|
|
52
|
+
"@babel/core": "^7.18.13",
|
|
53
53
|
"@babel/preset-react": "^7.18.6",
|
|
54
54
|
"@emotion/react": "^11.10.0",
|
|
55
55
|
"@emotion/styled": "^11.10.0",
|
|
56
56
|
"@faker-js/faker": "^7.4.0",
|
|
57
|
-
"@mui/icons-material": "^5.
|
|
58
|
-
"@mui/material": "^5.10.
|
|
57
|
+
"@mui/icons-material": "^5.10.2",
|
|
58
|
+
"@mui/material": "^5.10.2",
|
|
59
59
|
"@rollup/plugin-babel": "^5.3.1",
|
|
60
60
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
61
61
|
"@rollup/plugin-typescript": "^8.3.4",
|
|
@@ -40,7 +40,7 @@ import type {
|
|
|
40
40
|
TableOptions,
|
|
41
41
|
TableState,
|
|
42
42
|
} from '@tanstack/react-table';
|
|
43
|
-
import type { Options as VirtualizerOptions } from 'react-virtual';
|
|
43
|
+
import type { Options as VirtualizerOptions, VirtualItem } from 'react-virtual';
|
|
44
44
|
// import type { VirtualizerOptions } from '@tanstack/react-virtual';
|
|
45
45
|
import { MRT_AggregationFns } from './aggregationFns';
|
|
46
46
|
import { MRT_Default_Icons, MRT_Icons } from './icons';
|
|
@@ -856,8 +856,17 @@ export type MaterialReactTableProps<TData extends Record<string, any> = {}> =
|
|
|
856
856
|
// }: {
|
|
857
857
|
// table: MRT_TableInstance<TData>;
|
|
858
858
|
// }) => Partial<VirtualizerOptions<HTMLDivElement, HTMLTableRowElement>>);
|
|
859
|
+
virtualizerInstanceRef?: MutableRefObject<Virtualizer | null>;
|
|
859
860
|
};
|
|
860
861
|
|
|
862
|
+
export type Virtualizer = {
|
|
863
|
+
virtualItems: VirtualItem[];
|
|
864
|
+
totalSize: number;
|
|
865
|
+
scrollToOffset: (index: number, options?: any | undefined) => void;
|
|
866
|
+
scrollToIndex: (index: number, options?: any | undefined) => void;
|
|
867
|
+
measure: () => void;
|
|
868
|
+
};
|
|
869
|
+
|
|
861
870
|
export default <TData extends Record<string, any> = {}>({
|
|
862
871
|
aggregationFns,
|
|
863
872
|
autoResetExpanded = false,
|
|
@@ -866,7 +875,6 @@ export default <TData extends Record<string, any> = {}>({
|
|
|
866
875
|
editingMode = 'modal',
|
|
867
876
|
enableBottomToolbar = true,
|
|
868
877
|
enableColumnActions = true,
|
|
869
|
-
enableColumnFilterModes = false,
|
|
870
878
|
enableColumnFilters = true,
|
|
871
879
|
enableColumnOrdering = false,
|
|
872
880
|
enableColumnResizing = false,
|
|
@@ -875,7 +883,6 @@ export default <TData extends Record<string, any> = {}>({
|
|
|
875
883
|
enableFilters = true,
|
|
876
884
|
enableFullScreenToggle = true,
|
|
877
885
|
enableGlobalFilter = true,
|
|
878
|
-
enableGlobalFilterModes = false,
|
|
879
886
|
enableGlobalFilterRankedResults = true,
|
|
880
887
|
enableGrouping = false,
|
|
881
888
|
enableHiding = true,
|
|
@@ -913,7 +920,6 @@ export default <TData extends Record<string, any> = {}>({
|
|
|
913
920
|
editingMode={editingMode}
|
|
914
921
|
enableBottomToolbar={enableBottomToolbar}
|
|
915
922
|
enableColumnActions={enableColumnActions}
|
|
916
|
-
enableColumnFilterModes={enableColumnFilterModes}
|
|
917
923
|
enableColumnFilters={enableColumnFilters}
|
|
918
924
|
enableColumnOrdering={enableColumnOrdering}
|
|
919
925
|
enableColumnResizing={enableColumnResizing}
|
|
@@ -922,7 +928,6 @@ export default <TData extends Record<string, any> = {}>({
|
|
|
922
928
|
enableFilters={enableFilters}
|
|
923
929
|
enableFullScreenToggle={enableFullScreenToggle}
|
|
924
930
|
enableGlobalFilter={enableGlobalFilter}
|
|
925
|
-
enableGlobalFilterModes={enableGlobalFilterModes}
|
|
926
931
|
enableGlobalFilterRankedResults={enableGlobalFilterRankedResults}
|
|
927
932
|
enableGrouping={enableGrouping}
|
|
928
933
|
enableHiding={enableHiding}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { FC, RefObject, useMemo } from 'react';
|
|
2
|
-
import { useVirtual } from 'react-virtual';
|
|
1
|
+
import React, { FC, RefObject, useEffect, useMemo } from 'react';
|
|
2
|
+
import { useVirtual } from 'react-virtual'; //stuck on v2 for now
|
|
3
3
|
// import { useVirtualizer, Virtualizer } from '@tanstack/react-virtual';
|
|
4
4
|
import { TableBody } from '@mui/material';
|
|
5
5
|
import { MRT_TableBodyRow } from './MRT_TableBodyRow';
|
|
@@ -22,6 +22,7 @@ export const MRT_TableBody: FC<Props> = ({ table, tableContainerRef }) => {
|
|
|
22
22
|
enableRowVirtualization,
|
|
23
23
|
muiTableBodyProps,
|
|
24
24
|
virtualizerProps,
|
|
25
|
+
virtualizerInstanceRef,
|
|
25
26
|
},
|
|
26
27
|
} = table;
|
|
27
28
|
const { globalFilter, pagination, sorting } = getState();
|
|
@@ -62,7 +63,7 @@ export const MRT_TableBody: FC<Props> = ({ table, tableContainerRef }) => {
|
|
|
62
63
|
globalFilter,
|
|
63
64
|
]);
|
|
64
65
|
|
|
65
|
-
const
|
|
66
|
+
const virtualizer = enableRowVirtualization
|
|
66
67
|
? useVirtual({
|
|
67
68
|
size: rows.length,
|
|
68
69
|
parentRef: tableContainerRef,
|
|
@@ -71,7 +72,13 @@ export const MRT_TableBody: FC<Props> = ({ table, tableContainerRef }) => {
|
|
|
71
72
|
})
|
|
72
73
|
: ({} as any);
|
|
73
74
|
|
|
74
|
-
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
if (virtualizerInstanceRef) {
|
|
77
|
+
virtualizerInstanceRef.current = virtualizer;
|
|
78
|
+
}
|
|
79
|
+
}, [virtualizer]);
|
|
80
|
+
|
|
81
|
+
// const virtualizer: Virtualizer = enableRowVirtualization
|
|
75
82
|
// ? useVirtualizer({
|
|
76
83
|
// count: rows.length,
|
|
77
84
|
// estimateSize: () => (density === 'compact' ? 25 : 50),
|
|
@@ -81,12 +88,10 @@ export const MRT_TableBody: FC<Props> = ({ table, tableContainerRef }) => {
|
|
|
81
88
|
// })
|
|
82
89
|
// : ({} as any);
|
|
83
90
|
|
|
84
|
-
const virtualRows = enableRowVirtualization
|
|
85
|
-
? rowVirtualizer.virtualItems
|
|
86
|
-
: [];
|
|
91
|
+
const virtualRows = enableRowVirtualization ? virtualizer.virtualItems : [];
|
|
87
92
|
|
|
88
93
|
// const virtualRows = enableRowVirtualization
|
|
89
|
-
// ?
|
|
94
|
+
// ? virtualizer.getVirtualItems()
|
|
90
95
|
// : [];
|
|
91
96
|
|
|
92
97
|
let paddingTop = 0;
|
|
@@ -94,13 +99,13 @@ export const MRT_TableBody: FC<Props> = ({ table, tableContainerRef }) => {
|
|
|
94
99
|
if (enableRowVirtualization) {
|
|
95
100
|
paddingTop = !!virtualRows.length ? virtualRows[0].start : 0;
|
|
96
101
|
paddingBottom = !!virtualRows.length
|
|
97
|
-
?
|
|
102
|
+
? virtualizer.totalSize - virtualRows[virtualRows.length - 1].end
|
|
98
103
|
: 0;
|
|
99
104
|
}
|
|
100
105
|
// if (enableRowVirtualization) {
|
|
101
106
|
// paddingTop = !!virtualRows.length ? virtualRows[0].start : 0;
|
|
102
107
|
// paddingBottom = !!virtualRows.length
|
|
103
|
-
// ?
|
|
108
|
+
// ? virtualizer.getTotalSize() - virtualRows[virtualRows.length - 1].end
|
|
104
109
|
// : 0;
|
|
105
110
|
// }
|
|
106
111
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { ReactNode, useState } from 'react';
|
|
1
|
+
import React, { MouseEvent, ReactNode, useState } from 'react';
|
|
2
2
|
import { Button, Tooltip } from '@mui/material';
|
|
3
3
|
import { MRT_Cell, MRT_TableInstance } from '..';
|
|
4
4
|
|
|
@@ -21,7 +21,8 @@ export const MRT_CopyButton = <TData extends Record<string, any> = {}>({
|
|
|
21
21
|
|
|
22
22
|
const [copied, setCopied] = useState(false);
|
|
23
23
|
|
|
24
|
-
const handleCopy = (text: unknown) => {
|
|
24
|
+
const handleCopy = (event: MouseEvent, text: unknown) => {
|
|
25
|
+
event.stopPropagation();
|
|
25
26
|
navigator.clipboard.writeText(text as string);
|
|
26
27
|
setCopied(true);
|
|
27
28
|
setTimeout(() => setCopied(false), 4000);
|
|
@@ -54,7 +55,7 @@ export const MRT_CopyButton = <TData extends Record<string, any> = {}>({
|
|
|
54
55
|
title={copied ? localization.copiedToClipboard : localization.clickToCopy}
|
|
55
56
|
>
|
|
56
57
|
<Button
|
|
57
|
-
onClick={() => handleCopy(cell.getValue())}
|
|
58
|
+
onClick={(e) => handleCopy(e, cell.getValue())}
|
|
58
59
|
size="small"
|
|
59
60
|
type="button"
|
|
60
61
|
variant="text"
|
|
@@ -47,7 +47,10 @@ export const MRT_EditActionButtons = <TData extends Record<string, any> = {}>({
|
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
return (
|
|
50
|
-
<Box
|
|
50
|
+
<Box
|
|
51
|
+
onClick={(e) => e.stopPropagation()}
|
|
52
|
+
sx={{ display: 'flex', gap: '0.75rem' }}
|
|
53
|
+
>
|
|
51
54
|
{variant === 'icon' ? (
|
|
52
55
|
<>
|
|
53
56
|
<Tooltip arrow title={localization.cancel}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { FC } from 'react';
|
|
1
|
+
import React, { FC, MouseEvent } from 'react';
|
|
2
2
|
import { IconButton, Tooltip } from '@mui/material';
|
|
3
3
|
import type { MRT_Row, MRT_TableInstance } from '..';
|
|
4
4
|
|
|
@@ -24,8 +24,10 @@ export const MRT_ExpandButton: FC<Props> = ({ row, table }) => {
|
|
|
24
24
|
? muiExpandButtonProps({ table, row })
|
|
25
25
|
: muiExpandButtonProps;
|
|
26
26
|
|
|
27
|
-
const handleToggleExpand = () => {
|
|
27
|
+
const handleToggleExpand = (event: MouseEvent<HTMLButtonElement>) => {
|
|
28
|
+
event.stopPropagation();
|
|
28
29
|
row.toggleExpanded();
|
|
30
|
+
iconButtonProps?.onClick?.(event);
|
|
29
31
|
};
|
|
30
32
|
|
|
31
33
|
return (
|
|
@@ -39,8 +41,8 @@ export const MRT_ExpandButton: FC<Props> = ({ row, table }) => {
|
|
|
39
41
|
<IconButton
|
|
40
42
|
aria-label={localization.expand}
|
|
41
43
|
disabled={!row.getCanExpand() && !renderDetailPanel}
|
|
42
|
-
onClick={handleToggleExpand}
|
|
43
44
|
{...iconButtonProps}
|
|
45
|
+
onClick={handleToggleExpand}
|
|
44
46
|
sx={(theme) => ({
|
|
45
47
|
height: density === 'compact' ? '1.75rem' : '2.25rem',
|
|
46
48
|
width: density === 'compact' ? '1.75rem' : '2.25rem',
|
|
@@ -37,6 +37,10 @@ export const MRT_GrabHandleButton = <TData extends Record<string, any> = {}>({
|
|
|
37
37
|
onDragEnd={onDragEnd}
|
|
38
38
|
size="small"
|
|
39
39
|
{...iconButtonProps}
|
|
40
|
+
onClick={(e) => {
|
|
41
|
+
e.stopPropagation();
|
|
42
|
+
iconButtonProps?.onClick?.(e);
|
|
43
|
+
}}
|
|
40
44
|
sx={(theme) => ({
|
|
41
45
|
cursor: 'grab',
|
|
42
46
|
m: 0,
|
|
@@ -16,12 +16,16 @@ const commonIconButtonStyles = {
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
interface Props {
|
|
19
|
-
cell: MRT_Cell
|
|
19
|
+
cell: MRT_Cell;
|
|
20
20
|
row: MRT_Row;
|
|
21
21
|
table: MRT_TableInstance;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export const MRT_ToggleRowActionMenuButton: FC<Props> = ({
|
|
24
|
+
export const MRT_ToggleRowActionMenuButton: FC<Props> = ({
|
|
25
|
+
cell,
|
|
26
|
+
row,
|
|
27
|
+
table,
|
|
28
|
+
}) => {
|
|
25
29
|
const {
|
|
26
30
|
getState,
|
|
27
31
|
options: {
|
|
@@ -45,7 +49,8 @@ export const MRT_ToggleRowActionMenuButton: FC<Props> = ({ cell, row, table }) =
|
|
|
45
49
|
setAnchorEl(event.currentTarget);
|
|
46
50
|
};
|
|
47
51
|
|
|
48
|
-
const handleStartEditMode = () => {
|
|
52
|
+
const handleStartEditMode = (event: MouseEvent) => {
|
|
53
|
+
event.stopPropagation();
|
|
49
54
|
setEditingRow({ ...row });
|
|
50
55
|
setAnchorEl(null);
|
|
51
56
|
};
|
|
@@ -28,8 +28,13 @@ export const MRT_TableHeadCell: FC<Props> = ({ header, table }) => {
|
|
|
28
28
|
},
|
|
29
29
|
setHoveredColumn,
|
|
30
30
|
} = table;
|
|
31
|
-
const {
|
|
32
|
-
|
|
31
|
+
const {
|
|
32
|
+
density,
|
|
33
|
+
draggingColumn,
|
|
34
|
+
grouping,
|
|
35
|
+
hoveredColumn,
|
|
36
|
+
showColumnFilters,
|
|
37
|
+
} = getState();
|
|
33
38
|
const { column } = header;
|
|
34
39
|
const { columnDef } = column;
|
|
35
40
|
const { columnDefType } = columnDef;
|
|
@@ -221,17 +226,20 @@ export const MRT_TableHeadCell: FC<Props> = ({ header, table }) => {
|
|
|
221
226
|
</Box>
|
|
222
227
|
{columnDefType !== 'group' && (
|
|
223
228
|
<Box sx={{ whiteSpace: 'nowrap' }}>
|
|
224
|
-
{
|
|
225
|
-
columnDef.enableColumnDragging !== false
|
|
226
|
-
(
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
229
|
+
{enableColumnDragging !== false &&
|
|
230
|
+
columnDef.enableColumnDragging !== false &&
|
|
231
|
+
(enableColumnDragging ||
|
|
232
|
+
(enableColumnOrdering &&
|
|
233
|
+
columnDef.enableColumnOrdering !== false) ||
|
|
234
|
+
(enableGrouping &&
|
|
235
|
+
columnDef.enableGrouping !== false &&
|
|
236
|
+
!grouping.includes(column.id))) && (
|
|
237
|
+
<MRT_TableHeadCellGrabHandle
|
|
238
|
+
column={column}
|
|
239
|
+
table={table}
|
|
240
|
+
tableHeadCellRef={tableHeadCellRef}
|
|
241
|
+
/>
|
|
242
|
+
)}
|
|
235
243
|
{(enableColumnActions || columnDef.enableColumnActions) &&
|
|
236
244
|
columnDef.enableColumnActions !== false && (
|
|
237
245
|
<MRT_TableHeadCellColumnActionsButton
|
|
@@ -2,7 +2,6 @@ import React, {
|
|
|
2
2
|
ChangeEvent,
|
|
3
3
|
FocusEvent,
|
|
4
4
|
KeyboardEvent,
|
|
5
|
-
MouseEvent,
|
|
6
5
|
useState,
|
|
7
6
|
} from 'react';
|
|
8
7
|
import { TextField, TextFieldProps } from '@mui/material';
|
|
@@ -101,11 +100,14 @@ export const MRT_EditCellTextField = <TData extends Record<string, any> = {}>({
|
|
|
101
100
|
label={showLabel ? column.columnDef.header : undefined}
|
|
102
101
|
margin="none"
|
|
103
102
|
name={column.id}
|
|
104
|
-
onClick={(e: MouseEvent<HTMLInputElement>) => e.stopPropagation()}
|
|
105
103
|
placeholder={columnDef.header}
|
|
106
104
|
value={value}
|
|
107
105
|
variant="standard"
|
|
108
106
|
{...textFieldProps}
|
|
107
|
+
onClick={(e) => {
|
|
108
|
+
e.stopPropagation();
|
|
109
|
+
textFieldProps?.onClick?.(e);
|
|
110
|
+
}}
|
|
109
111
|
onBlur={handleBlur}
|
|
110
112
|
onChange={handleChange}
|
|
111
113
|
onKeyDown={handleEnterKeyDown}
|
|
@@ -58,6 +58,10 @@ export const MRT_SelectCheckbox: FC<Props> = ({ row, selectAll, table }) => {
|
|
|
58
58
|
}
|
|
59
59
|
size={density === 'compact' ? 'small' : 'medium'}
|
|
60
60
|
{...checkboxProps}
|
|
61
|
+
onClick={(e) => {
|
|
62
|
+
e.stopPropagation();
|
|
63
|
+
checkboxProps?.onClick?.(e);
|
|
64
|
+
}}
|
|
61
65
|
sx={(theme) => ({
|
|
62
66
|
height: density === 'compact' ? '1.75rem' : '2.5rem',
|
|
63
67
|
width: density === 'compact' ? '1.75rem' : '2.5rem',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { FC } from 'react';
|
|
1
|
+
import React, { FC, MouseEvent } from 'react';
|
|
2
2
|
import { Box, ListItemIcon, Menu, MenuItem } from '@mui/material';
|
|
3
3
|
import type { MRT_Row, MRT_TableInstance } from '..';
|
|
4
4
|
import {
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
|
|
9
9
|
interface Props {
|
|
10
10
|
anchorEl: HTMLElement | null;
|
|
11
|
-
handleEdit: () => void;
|
|
11
|
+
handleEdit: (event: MouseEvent) => void;
|
|
12
12
|
row: MRT_Row;
|
|
13
13
|
setAnchorEl: (anchorEl: HTMLElement | null) => void;
|
|
14
14
|
table: MRT_TableInstance;
|
|
@@ -13,14 +13,22 @@ export const MRT_ToolbarDropZone: FC<Props> = ({ table }) => {
|
|
|
13
13
|
setHoveredColumn,
|
|
14
14
|
} = table;
|
|
15
15
|
|
|
16
|
-
const { draggingColumn, hoveredColumn } = getState();
|
|
16
|
+
const { draggingColumn, hoveredColumn, grouping } = getState();
|
|
17
17
|
|
|
18
18
|
const handleDragEnter = (_event: DragEvent<HTMLDivElement>) => {
|
|
19
19
|
setHoveredColumn({ id: 'drop-zone' });
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
return (
|
|
23
|
-
<Fade
|
|
23
|
+
<Fade
|
|
24
|
+
unmountOnExit
|
|
25
|
+
mountOnEnter
|
|
26
|
+
in={
|
|
27
|
+
!!enableGrouping &&
|
|
28
|
+
!!draggingColumn &&
|
|
29
|
+
!grouping.includes(draggingColumn.id)
|
|
30
|
+
}
|
|
31
|
+
>
|
|
24
32
|
<Box
|
|
25
33
|
sx={(theme) => ({
|
|
26
34
|
alignItems: 'center',
|