material-react-table 2.6.1 → 2.8.0
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/index.d.ts +390 -260
- package/dist/index.esm.js +1977 -1921
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2372 -2318
- package/dist/index.js.map +1 -1
- package/package.json +20 -20
- package/src/{MaterialReactTable.tsx → components/MaterialReactTable.tsx} +3 -3
- package/src/{body → components/body}/MRT_TableBody.tsx +6 -28
- package/src/{body → components/body}/MRT_TableBodyCell.tsx +6 -23
- package/src/{body → components/body}/MRT_TableBodyCellValue.tsx +2 -2
- package/src/{body → components/body}/MRT_TableBodyRow.tsx +7 -5
- package/src/{body → components/body}/MRT_TableBodyRowGrabHandle.tsx +3 -3
- package/src/{body → components/body}/MRT_TableBodyRowPinButton.tsx +3 -3
- package/src/{body → components/body}/MRT_TableDetailPanel.tsx +6 -6
- package/src/{buttons → components/buttons}/MRT_ColumnPinningButtons.tsx +2 -2
- package/src/{buttons → components/buttons}/MRT_CopyButton.tsx +4 -5
- package/src/{buttons → components/buttons}/MRT_EditActionButtons.tsx +2 -2
- package/src/{buttons → components/buttons}/MRT_ExpandAllButton.tsx +4 -4
- package/src/{buttons → components/buttons}/MRT_ExpandButton.tsx +10 -4
- package/src/{buttons → components/buttons}/MRT_GrabHandleButton.tsx +4 -5
- package/src/{buttons → components/buttons}/MRT_RowPinButton.tsx +4 -4
- package/src/{buttons → components/buttons}/MRT_ShowHideColumnsButton.tsx +1 -1
- package/src/{buttons → components/buttons}/MRT_ToggleDensePaddingButton.tsx +1 -1
- package/src/{buttons → components/buttons}/MRT_ToggleFiltersButton.tsx +1 -1
- package/src/{buttons → components/buttons}/MRT_ToggleFullScreenButton.tsx +1 -1
- package/src/{buttons → components/buttons}/MRT_ToggleGlobalFilterButton.tsx +1 -1
- package/src/{buttons → components/buttons}/MRT_ToggleRowActionMenuButton.tsx +9 -9
- package/src/{footer → components/footer}/MRT_TableFooter.tsx +2 -2
- package/src/{footer → components/footer}/MRT_TableFooterCell.tsx +3 -3
- package/src/{footer → components/footer}/MRT_TableFooterRow.tsx +3 -3
- package/src/{head → components/head}/MRT_TableHead.tsx +3 -3
- package/src/{head → components/head}/MRT_TableHeadCell.tsx +3 -3
- package/src/{head → components/head}/MRT_TableHeadCellColumnActionsButton.tsx +5 -6
- package/src/{head → components/head}/MRT_TableHeadCellFilterContainer.tsx +5 -5
- package/src/{head → components/head}/MRT_TableHeadCellFilterLabel.tsx +2 -2
- package/src/{head → components/head}/MRT_TableHeadCellGrabHandle.tsx +4 -3
- package/src/{head → components/head}/MRT_TableHeadCellResizeHandle.tsx +2 -2
- package/src/{head → components/head}/MRT_TableHeadCellSortLabel.tsx +2 -2
- package/src/{head → components/head}/MRT_TableHeadRow.tsx +3 -3
- package/src/{inputs → components/inputs}/MRT_EditCellTextField.tsx +12 -4
- package/src/{inputs → components/inputs}/MRT_FilterCheckbox.tsx +4 -4
- package/src/{inputs → components/inputs}/MRT_FilterRangeFields.tsx +2 -2
- package/src/{inputs → components/inputs}/MRT_FilterRangeSlider.tsx +2 -2
- package/src/{inputs → components/inputs}/MRT_FilterTextField.tsx +3 -3
- package/src/{inputs → components/inputs}/MRT_GlobalFilterTextField.tsx +2 -2
- package/src/{inputs → components/inputs}/MRT_SelectCheckbox.tsx +4 -4
- package/src/{menus → components/menus}/MRT_ColumnActionMenu.tsx +9 -1
- package/src/{menus → components/menus}/MRT_FilterOptionMenu.tsx +9 -1
- package/src/{menus → components/menus}/MRT_RowActionMenu.tsx +13 -2
- package/src/{menus → components/menus}/MRT_ShowHideColumnsMenu.tsx +11 -5
- package/src/{menus → components/menus}/MRT_ShowHideColumnsMenuItems.tsx +7 -7
- package/src/{modals → components/modals}/MRT_EditRowModal.tsx +4 -4
- package/src/{table → components/table}/MRT_Table.tsx +4 -4
- package/src/{table → components/table}/MRT_TableContainer.tsx +3 -3
- package/src/{table → components/table}/MRT_TableLoadingOverlay.tsx +3 -3
- package/src/{table → components/table}/MRT_TablePaper.tsx +3 -3
- package/src/{toolbar → components/toolbar}/MRT_BottomToolbar.tsx +3 -3
- package/src/{toolbar → components/toolbar}/MRT_LinearProgressBar.tsx +2 -2
- package/src/{toolbar → components/toolbar}/MRT_TablePagination.tsx +9 -7
- package/src/{toolbar → components/toolbar}/MRT_ToolbarAlertBanner.tsx +3 -3
- package/src/{toolbar → components/toolbar}/MRT_ToolbarDropZone.tsx +2 -2
- package/src/{toolbar → components/toolbar}/MRT_ToolbarInternalButtons.tsx +2 -2
- package/src/{toolbar → components/toolbar}/MRT_TopToolbar.tsx +3 -3
- package/src/{filterFns.ts → fns/filterFns.ts} +1 -1
- package/src/{sortingFns.ts → fns/sortingFns.ts} +1 -1
- package/src/hooks/display-columns/getMRT_DisplayColumns.tsx +26 -0
- package/src/hooks/display-columns/getMRT_RowActionsColumnDef.tsx +34 -0
- package/src/hooks/display-columns/getMRT_RowDragColumnDef.tsx +35 -0
- package/src/hooks/display-columns/getMRT_RowExpandColumnDef.tsx +96 -0
- package/src/hooks/display-columns/getMRT_RowNumbersColumnDef.tsx +36 -0
- package/src/hooks/display-columns/getMRT_RowPinningColumnDef.tsx +30 -0
- package/src/hooks/display-columns/getMRT_RowSelectColumnDef.tsx +40 -0
- package/src/hooks/display-columns/getMRT_RowSpacerColumnDef.tsx +40 -0
- package/src/hooks/useMRT_ColumnVirtualizer.ts +2 -4
- package/src/hooks/useMRT_Effects.ts +7 -6
- package/src/hooks/useMRT_RowVirtualizer.ts +2 -4
- package/src/hooks/useMRT_Rows.ts +32 -6
- package/src/hooks/useMRT_TableInstance.ts +91 -87
- package/src/hooks/useMRT_TableOptions.ts +5 -3
- package/src/{useMaterialReactTable.ts → hooks/useMaterialReactTable.ts} +3 -3
- package/src/icons.ts +4 -38
- package/src/index.ts +88 -17
- package/src/types.ts +59 -26
- package/src/utils/column.utils.ts +173 -0
- package/src/utils/displayColumn.utils.ts +134 -0
- package/src/utils/row.utils.ts +26 -0
- package/src/{style.utils.ts → utils/style.utils.ts} +50 -28
- package/src/utils/tanstack.helpers.ts +64 -0
- package/src/utils/utils.ts +23 -0
- package/src/utils/virtualization.utils.ts +19 -0
- package/src/utils.ts +0 -0
- package/src/body/index.ts +0 -7
- package/src/buttons/index.ts +0 -13
- package/src/column.utils.ts +0 -368
- package/src/footer/index.ts +0 -3
- package/src/head/index.ts +0 -9
- package/src/hooks/index.ts +0 -7
- package/src/hooks/useMRT_DisplayColumns.tsx +0 -299
- package/src/inputs/index.ts +0 -7
- package/src/menus/index.ts +0 -5
- package/src/modals/index.ts +0 -1
- package/src/table/index.ts +0 -5
- package/src/toolbar/index.ts +0 -7
- /package/src/{aggregationFns.ts → fns/aggregationFns.ts} +0 -0
package/package.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"version": "2.
|
2
|
+
"version": "2.8.0",
|
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.",
|
@@ -66,25 +66,25 @@
|
|
66
66
|
"@emotion/react": "^11.11.3",
|
67
67
|
"@emotion/styled": "^11.11.0",
|
68
68
|
"@faker-js/faker": "^8.3.1",
|
69
|
-
"@mui/icons-material": "^5.15.
|
70
|
-
"@mui/material": "^5.15.
|
69
|
+
"@mui/icons-material": "^5.15.5",
|
70
|
+
"@mui/material": "^5.15.5",
|
71
71
|
"@mui/x-date-pickers": "^6.19.0",
|
72
72
|
"@rollup/plugin-typescript": "^11.1.6",
|
73
|
-
"@size-limit/preset-small-lib": "^11.0.
|
74
|
-
"@storybook/addon-a11y": "^7.6.
|
75
|
-
"@storybook/addon-essentials": "^7.6.
|
76
|
-
"@storybook/addon-interactions": "^7.6.
|
77
|
-
"@storybook/addon-links": "^7.6.
|
78
|
-
"@storybook/addon-storysource": "^7.6.
|
79
|
-
"@storybook/blocks": "^7.6.
|
80
|
-
"@storybook/react": "^7.6.
|
81
|
-
"@storybook/react-vite": "^7.6.
|
73
|
+
"@size-limit/preset-small-lib": "^11.0.2",
|
74
|
+
"@storybook/addon-a11y": "^7.6.10",
|
75
|
+
"@storybook/addon-essentials": "^7.6.10",
|
76
|
+
"@storybook/addon-interactions": "^7.6.10",
|
77
|
+
"@storybook/addon-links": "^7.6.10",
|
78
|
+
"@storybook/addon-storysource": "^7.6.10",
|
79
|
+
"@storybook/blocks": "^7.6.10",
|
80
|
+
"@storybook/react": "^7.6.10",
|
81
|
+
"@storybook/react-vite": "^7.6.10",
|
82
82
|
"@storybook/testing-library": "^0.2.2",
|
83
|
-
"@types/node": "^20.11.
|
84
|
-
"@types/react": "^18.2.
|
83
|
+
"@types/node": "^20.11.5",
|
84
|
+
"@types/react": "^18.2.48",
|
85
85
|
"@types/react-dom": "^18.2.18",
|
86
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
87
|
-
"@typescript-eslint/parser": "^6.
|
86
|
+
"@typescript-eslint/eslint-plugin": "^6.19.0",
|
87
|
+
"@typescript-eslint/parser": "^6.19.0",
|
88
88
|
"@vitejs/plugin-react": "^4.2.1",
|
89
89
|
"eslint": "^8.56.0",
|
90
90
|
"eslint-plugin-mui-path-imports": "^0.0.15",
|
@@ -96,12 +96,12 @@
|
|
96
96
|
"rollup": "^2.79.1",
|
97
97
|
"rollup-plugin-dts": "^6.1.0",
|
98
98
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
99
|
-
"size-limit": "^11.0.
|
100
|
-
"storybook": "^7.6.
|
99
|
+
"size-limit": "^11.0.2",
|
100
|
+
"storybook": "^7.6.10",
|
101
101
|
"storybook-dark-mode": "^3.0.3",
|
102
102
|
"tslib": "^2.6.2",
|
103
103
|
"typescript": "^5.3.3",
|
104
|
-
"vite": "^5.0.
|
104
|
+
"vite": "^5.0.12"
|
105
105
|
},
|
106
106
|
"peerDependencies": {
|
107
107
|
"@emotion/react": ">=11.11",
|
@@ -115,7 +115,7 @@
|
|
115
115
|
"dependencies": {
|
116
116
|
"@tanstack/match-sorter-utils": "8.11.3",
|
117
117
|
"@tanstack/react-table": "8.11.6",
|
118
|
-
"@tanstack/react-virtual": "3.0.
|
118
|
+
"@tanstack/react-virtual": "3.0.2",
|
119
119
|
"highlight-words": "1.2.2"
|
120
120
|
}
|
121
121
|
}
|
@@ -1,11 +1,11 @@
|
|
1
|
-
import {
|
1
|
+
import { useMaterialReactTable } from '../hooks/useMaterialReactTable';
|
2
2
|
import {
|
3
3
|
type MRT_RowData,
|
4
4
|
type MRT_TableInstance,
|
5
5
|
type MRT_TableOptions,
|
6
6
|
type Xor,
|
7
|
-
} from '
|
8
|
-
import {
|
7
|
+
} from '../types';
|
8
|
+
import { MRT_TablePaper } from './table/MRT_TablePaper';
|
9
9
|
|
10
10
|
type TableInstanceProp<TData extends MRT_RowData> = {
|
11
11
|
table: MRT_TableInstance<TData>;
|
@@ -3,15 +3,15 @@ import { type VirtualItem } from '@tanstack/react-virtual';
|
|
3
3
|
import TableBody, { type TableBodyProps } from '@mui/material/TableBody';
|
4
4
|
import Typography from '@mui/material/Typography';
|
5
5
|
import { MRT_TableBodyRow, Memo_MRT_TableBodyRow } from './MRT_TableBodyRow';
|
6
|
-
import {
|
7
|
-
import {
|
8
|
-
import { useMRT_Rows } from '../hooks/useMRT_Rows';
|
6
|
+
import { useMRT_RowVirtualizer } from '../../hooks/useMRT_RowVirtualizer';
|
7
|
+
import { useMRT_Rows } from '../../hooks/useMRT_Rows';
|
9
8
|
import {
|
10
9
|
type MRT_ColumnVirtualizer,
|
11
10
|
type MRT_Row,
|
12
11
|
type MRT_RowData,
|
13
12
|
type MRT_TableInstance,
|
14
|
-
} from '
|
13
|
+
} from '../../types';
|
14
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
15
15
|
|
16
16
|
interface Props<TData extends MRT_RowData> extends TableBodyProps {
|
17
17
|
columnVirtualizer?: MRT_ColumnVirtualizer;
|
@@ -30,7 +30,6 @@ export const MRT_TableBody = <TData extends MRT_RowData>({
|
|
30
30
|
getState,
|
31
31
|
getTopRows,
|
32
32
|
options: {
|
33
|
-
createDisplayMode,
|
34
33
|
enableStickyFooter,
|
35
34
|
enableStickyHeader,
|
36
35
|
layoutMode,
|
@@ -43,8 +42,7 @@ export const MRT_TableBody = <TData extends MRT_RowData>({
|
|
43
42
|
},
|
44
43
|
refs: { tableFooterRef, tableHeadRef, tablePaperRef },
|
45
44
|
} = table;
|
46
|
-
const { columnFilters,
|
47
|
-
getState();
|
45
|
+
const { columnFilters, globalFilter, isFullScreen, rowPinning } = getState();
|
48
46
|
|
49
47
|
const tableBodyProps = {
|
50
48
|
...parseFromValuesOrFunc(muiTableBodyProps, { table }),
|
@@ -77,14 +75,6 @@ export const MRT_TableBody = <TData extends MRT_RowData>({
|
|
77
75
|
table,
|
78
76
|
};
|
79
77
|
|
80
|
-
const CreatingRow = creatingRow && createDisplayMode === 'row' && (
|
81
|
-
<MRT_TableBodyRow
|
82
|
-
{...commonRowProps}
|
83
|
-
row={creatingRow}
|
84
|
-
staticRowIndex={-1}
|
85
|
-
/>
|
86
|
-
);
|
87
|
-
|
88
78
|
return (
|
89
79
|
<>
|
90
80
|
{!rowPinningDisplayMode?.includes('sticky') &&
|
@@ -113,17 +103,6 @@ export const MRT_TableBody = <TData extends MRT_RowData>({
|
|
113
103
|
})}
|
114
104
|
</TableBody>
|
115
105
|
)}
|
116
|
-
{rowVirtualizer && CreatingRow && (
|
117
|
-
<TableBody
|
118
|
-
{...tableBodyProps}
|
119
|
-
sx={(theme) => ({
|
120
|
-
display: layoutMode?.startsWith('grid') ? 'grid' : undefined,
|
121
|
-
...(parseFromValuesOrFunc(tableBodyProps?.sx, theme) as any),
|
122
|
-
})}
|
123
|
-
>
|
124
|
-
{CreatingRow}
|
125
|
-
</TableBody>
|
126
|
-
)}
|
127
106
|
<TableBody
|
128
107
|
{...tableBodyProps}
|
129
108
|
sx={(theme) => ({
|
@@ -136,9 +115,8 @@ export const MRT_TableBody = <TData extends MRT_RowData>({
|
|
136
115
|
...(parseFromValuesOrFunc(tableBodyProps?.sx, theme) as any),
|
137
116
|
})}
|
138
117
|
>
|
139
|
-
{!rowVirtualizer && CreatingRow}
|
140
118
|
{tableBodyProps?.children ??
|
141
|
-
(!rows.length
|
119
|
+
(!rows.length ? (
|
142
120
|
<tr
|
143
121
|
style={{
|
144
122
|
display: layoutMode?.startsWith('grid') ? 'grid' : undefined,
|
@@ -11,19 +11,16 @@ import Skeleton from '@mui/material/Skeleton';
|
|
11
11
|
import TableCell, { type TableCellProps } from '@mui/material/TableCell';
|
12
12
|
import { useTheme } from '@mui/material/styles';
|
13
13
|
import { MRT_TableBodyCellValue } from './MRT_TableBodyCellValue';
|
14
|
-
import { MRT_CopyButton } from '../buttons/MRT_CopyButton';
|
15
|
-
import {
|
16
|
-
getIsFirstColumn,
|
17
|
-
getIsLastColumn,
|
18
|
-
parseFromValuesOrFunc,
|
19
|
-
} from '../column.utils';
|
20
|
-
import { MRT_EditCellTextField } from '../inputs/MRT_EditCellTextField';
|
21
|
-
import { getCommonMRTCellStyles, getMRTTheme } from '../style.utils';
|
22
14
|
import {
|
23
15
|
type MRT_Cell,
|
24
16
|
type MRT_RowData,
|
25
17
|
type MRT_TableInstance,
|
26
|
-
} from '
|
18
|
+
} from '../../types';
|
19
|
+
import { getIsFirstColumn, getIsLastColumn } from '../../utils/column.utils';
|
20
|
+
import { getCommonMRTCellStyles, getMRTTheme } from '../../utils/style.utils';
|
21
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
22
|
+
import { MRT_CopyButton } from '../buttons/MRT_CopyButton';
|
23
|
+
import { MRT_EditCellTextField } from '../inputs/MRT_EditCellTextField';
|
27
24
|
|
28
25
|
interface Props<TData extends MRT_RowData> extends TableCellProps {
|
29
26
|
cell: MRT_Cell<TData>;
|
@@ -60,7 +57,6 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
|
|
60
57
|
layoutMode,
|
61
58
|
muiSkeletonProps,
|
62
59
|
muiTableBodyCellProps,
|
63
|
-
positionExpandColumn,
|
64
60
|
},
|
65
61
|
refs: { editInputRefs },
|
66
62
|
setEditingCell,
|
@@ -255,19 +251,6 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
|
|
255
251
|
? '1rem 1.25rem'
|
256
252
|
: '1.5rem',
|
257
253
|
textOverflow: columnDefType !== 'display' ? 'ellipsis' : undefined,
|
258
|
-
[theme.direction === 'rtl' || positionExpandColumn === 'last'
|
259
|
-
? 'pr'
|
260
|
-
: 'pl']:
|
261
|
-
column.id === 'mrt-row-expand'
|
262
|
-
? `${
|
263
|
-
row.depth +
|
264
|
-
(density === 'compact'
|
265
|
-
? 0.5
|
266
|
-
: density === 'comfortable'
|
267
|
-
? 0.75
|
268
|
-
: 1.25)
|
269
|
-
}rem`
|
270
|
-
: undefined,
|
271
254
|
whiteSpace:
|
272
255
|
row.getIsPinned() || density === 'compact' ? 'nowrap' : 'normal',
|
273
256
|
zIndex:
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import { type ReactNode, type RefObject } from 'react';
|
2
2
|
import Box from '@mui/material/Box';
|
3
|
-
import { getMRTTheme } from '../style.utils';
|
4
3
|
import {
|
5
4
|
type MRT_Cell,
|
6
5
|
type MRT_RowData,
|
7
6
|
type MRT_TableInstance,
|
8
|
-
} from '
|
7
|
+
} from '../../types';
|
8
|
+
import { getMRTTheme } from '../../utils/style.utils';
|
9
9
|
import highlightWords from 'highlight-words';
|
10
10
|
|
11
11
|
const allowedTypes = ['string', 'number'];
|
@@ -10,8 +10,6 @@ import {
|
|
10
10
|
} from '@mui/material/styles';
|
11
11
|
import { MRT_TableBodyCell, Memo_MRT_TableBodyCell } from './MRT_TableBodyCell';
|
12
12
|
import { MRT_TableDetailPanel } from './MRT_TableDetailPanel';
|
13
|
-
import { parseFromValuesOrFunc } from '../column.utils';
|
14
|
-
import { getMRTTheme } from '../style.utils';
|
15
13
|
import {
|
16
14
|
type MRT_Cell,
|
17
15
|
type MRT_ColumnVirtualizer,
|
@@ -19,7 +17,9 @@ import {
|
|
19
17
|
type MRT_RowData,
|
20
18
|
type MRT_RowVirtualizer,
|
21
19
|
type MRT_TableInstance,
|
22
|
-
} from '
|
20
|
+
} from '../../types';
|
21
|
+
import { getMRTTheme } from '../../utils/style.utils';
|
22
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
23
23
|
|
24
24
|
interface Props<TData extends MRT_RowData> {
|
25
25
|
columnVirtualizer?: MRT_ColumnVirtualizer;
|
@@ -136,13 +136,15 @@ export const MRT_TableBodyRow = <TData extends MRT_RowData>({
|
|
136
136
|
data-index={renderDetailPanel ? staticRowIndex * 2 : staticRowIndex}
|
137
137
|
data-pinned={!!isPinned || undefined}
|
138
138
|
data-selected={
|
139
|
-
row
|
139
|
+
row?.getIsSelected() ||
|
140
|
+
(row?.getIsAllSubRowsSelected() && row.getCanSelectSubRows()) ||
|
141
|
+
undefined
|
140
142
|
}
|
141
143
|
onDragEnter={handleDragEnter}
|
142
144
|
ref={(node: HTMLTableRowElement) => {
|
143
145
|
if (node) {
|
144
146
|
rowRef.current = node;
|
145
|
-
rowVirtualizer?.measureElement
|
147
|
+
rowVirtualizer?.measureElement(node);
|
146
148
|
}
|
147
149
|
}}
|
148
150
|
selected={row.getIsSelected()}
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import { type DragEvent, type RefObject } from 'react';
|
2
2
|
import { type IconButtonProps } from '@mui/material/IconButton';
|
3
|
-
import { MRT_GrabHandleButton } from '../buttons/MRT_GrabHandleButton';
|
4
|
-
import { parseFromValuesOrFunc } from '../column.utils';
|
5
3
|
import {
|
6
4
|
type MRT_Row,
|
7
5
|
type MRT_RowData,
|
8
6
|
type MRT_TableInstance,
|
9
|
-
} from '
|
7
|
+
} from '../../types';
|
8
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
9
|
+
import { MRT_GrabHandleButton } from '../buttons/MRT_GrabHandleButton';
|
10
10
|
|
11
11
|
interface Props<TData extends MRT_RowData> extends IconButtonProps {
|
12
12
|
row: MRT_Row<TData>;
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import Box from '@mui/material/Box';
|
2
2
|
import { type IconButtonProps } from '@mui/material/IconButton';
|
3
|
-
import { MRT_RowPinButton } from '../buttons/MRT_RowPinButton';
|
4
|
-
import { parseFromValuesOrFunc } from '../column.utils';
|
5
3
|
import {
|
6
4
|
type MRT_Row,
|
7
5
|
type MRT_RowData,
|
8
6
|
type MRT_TableInstance,
|
9
|
-
} from '
|
7
|
+
} from '../../types';
|
8
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
9
|
+
import { MRT_RowPinButton } from '../buttons/MRT_RowPinButton';
|
10
10
|
|
11
11
|
interface Props<TData extends MRT_RowData> extends IconButtonProps {
|
12
12
|
row: MRT_Row<TData>;
|
@@ -1,16 +1,16 @@
|
|
1
1
|
import { type RefObject } from 'react';
|
2
|
-
import { type VirtualItem } from '@tanstack/react-virtual';
|
3
2
|
import Collapse from '@mui/material/Collapse';
|
4
3
|
import TableCell, { type TableCellProps } from '@mui/material/TableCell';
|
5
4
|
import TableRow from '@mui/material/TableRow';
|
6
|
-
import { parseFromValuesOrFunc } from '../column.utils';
|
7
|
-
import { getMRTTheme } from '../style.utils';
|
8
5
|
import {
|
9
6
|
type MRT_Row,
|
10
7
|
type MRT_RowData,
|
11
8
|
type MRT_RowVirtualizer,
|
12
9
|
type MRT_TableInstance,
|
13
|
-
|
10
|
+
type MRT_VirtualItem,
|
11
|
+
} from '../../types';
|
12
|
+
import { getMRTTheme } from '../../utils/style.utils';
|
13
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
14
14
|
|
15
15
|
interface Props<TData extends MRT_RowData> extends TableCellProps {
|
16
16
|
parentRowRef: RefObject<HTMLTableRowElement>;
|
@@ -18,7 +18,7 @@ interface Props<TData extends MRT_RowData> extends TableCellProps {
|
|
18
18
|
rowVirtualizer?: MRT_RowVirtualizer;
|
19
19
|
staticRowIndex: number;
|
20
20
|
table: MRT_TableInstance<TData>;
|
21
|
-
virtualRow?:
|
21
|
+
virtualRow?: MRT_VirtualItem;
|
22
22
|
}
|
23
23
|
|
24
24
|
export const MRT_TableDetailPanel = <TData extends MRT_RowData>({
|
@@ -104,7 +104,7 @@ export const MRT_TableDetailPanel = <TData extends MRT_RowData>({
|
|
104
104
|
{enableRowVirtualization ? (
|
105
105
|
row.getIsExpanded() && DetailPanel
|
106
106
|
) : (
|
107
|
-
<Collapse in={
|
107
|
+
<Collapse in={row.getIsExpanded()} mountOnEnter unmountOnExit>
|
108
108
|
{DetailPanel}
|
109
109
|
</Collapse>
|
110
110
|
)}
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import Box, { type BoxProps } from '@mui/material/Box';
|
2
2
|
import IconButton from '@mui/material/IconButton';
|
3
3
|
import Tooltip from '@mui/material/Tooltip';
|
4
|
-
import { parseFromValuesOrFunc } from '../column.utils';
|
5
4
|
import {
|
6
5
|
type MRT_Column,
|
7
6
|
type MRT_RowData,
|
8
7
|
type MRT_TableInstance,
|
9
|
-
} from '
|
8
|
+
} from '../../types';
|
9
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
10
10
|
|
11
11
|
interface Props<TData extends MRT_RowData> extends BoxProps {
|
12
12
|
column: MRT_Column<TData>;
|
@@ -1,12 +1,13 @@
|
|
1
1
|
import { type MouseEvent, useState } from 'react';
|
2
2
|
import Button, { type ButtonProps } from '@mui/material/Button';
|
3
3
|
import Tooltip from '@mui/material/Tooltip';
|
4
|
-
import { parseFromValuesOrFunc } from '../column.utils';
|
5
4
|
import {
|
6
5
|
type MRT_Cell,
|
7
6
|
type MRT_RowData,
|
8
7
|
type MRT_TableInstance,
|
9
|
-
} from '
|
8
|
+
} from '../../types';
|
9
|
+
import { getCommonTooltipProps } from '../../utils/style.utils';
|
10
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
10
11
|
|
11
12
|
interface Props<TData extends MRT_RowData> extends ButtonProps {
|
12
13
|
cell: MRT_Cell<TData>;
|
@@ -51,9 +52,7 @@ export const MRT_CopyButton = <TData extends MRT_RowData>({
|
|
51
52
|
|
52
53
|
return (
|
53
54
|
<Tooltip
|
54
|
-
|
55
|
-
enterNextDelay={1000}
|
56
|
-
placement="top"
|
55
|
+
{...getCommonTooltipProps('top')}
|
57
56
|
title={
|
58
57
|
buttonProps?.title ??
|
59
58
|
(copied ? localization.copiedToClipboard : localization.clickToCopy)
|
@@ -3,12 +3,12 @@ import Button from '@mui/material/Button';
|
|
3
3
|
import CircularProgress from '@mui/material/CircularProgress';
|
4
4
|
import IconButton from '@mui/material/IconButton';
|
5
5
|
import Tooltip from '@mui/material/Tooltip';
|
6
|
-
import { parseFromValuesOrFunc } from '../column.utils';
|
7
6
|
import {
|
8
7
|
type MRT_Row,
|
9
8
|
type MRT_RowData,
|
10
9
|
type MRT_TableInstance,
|
11
|
-
} from '
|
10
|
+
} from '../../types';
|
11
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
12
12
|
|
13
13
|
interface Props<TData extends MRT_RowData> extends BoxProps {
|
14
14
|
row: MRT_Row<TData>;
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import IconButton, { type IconButtonProps } from '@mui/material/IconButton';
|
2
2
|
import Tooltip from '@mui/material/Tooltip';
|
3
|
-
import {
|
4
|
-
import {
|
3
|
+
import { type MRT_RowData, type MRT_TableInstance } from '../../types';
|
4
|
+
import { getCommonTooltipProps } from '../../utils/style.utils';
|
5
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
5
6
|
|
6
7
|
interface Props<TData extends MRT_RowData> extends IconButtonProps {
|
7
8
|
table: MRT_TableInstance<TData>;
|
@@ -37,8 +38,7 @@ export const MRT_ExpandAllButton = <TData extends MRT_RowData>({
|
|
37
38
|
|
38
39
|
return (
|
39
40
|
<Tooltip
|
40
|
-
|
41
|
-
enterNextDelay={1000}
|
41
|
+
{...getCommonTooltipProps()}
|
42
42
|
title={
|
43
43
|
iconButtonProps?.title ??
|
44
44
|
(isAllRowsExpanded ? localization.collapseAll : localization.expandAll)
|
@@ -2,20 +2,23 @@ import { type MouseEvent } from 'react';
|
|
2
2
|
import IconButton, { type IconButtonProps } from '@mui/material/IconButton';
|
3
3
|
import Tooltip from '@mui/material/Tooltip';
|
4
4
|
import { useTheme } from '@mui/material/styles';
|
5
|
-
import { parseFromValuesOrFunc } from '../column.utils';
|
6
5
|
import {
|
7
6
|
type MRT_Row,
|
8
7
|
type MRT_RowData,
|
9
8
|
type MRT_TableInstance,
|
10
|
-
} from '
|
9
|
+
} from '../../types';
|
10
|
+
import { getCommonTooltipProps } from '../../utils/style.utils';
|
11
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
11
12
|
|
12
13
|
interface Props<TData extends MRT_RowData> extends IconButtonProps {
|
13
14
|
row: MRT_Row<TData>;
|
15
|
+
staticRowIndex?: number;
|
14
16
|
table: MRT_TableInstance<TData>;
|
15
17
|
}
|
16
18
|
|
17
19
|
export const MRT_ExpandButton = <TData extends MRT_RowData>({
|
18
20
|
row,
|
21
|
+
staticRowIndex,
|
19
22
|
table,
|
20
23
|
}: Props<TData>) => {
|
21
24
|
const theme = useTheme();
|
@@ -33,6 +36,7 @@ export const MRT_ExpandButton = <TData extends MRT_RowData>({
|
|
33
36
|
|
34
37
|
const iconButtonProps = parseFromValuesOrFunc(muiExpandButtonProps, {
|
35
38
|
row,
|
39
|
+
staticRowIndex,
|
36
40
|
table,
|
37
41
|
});
|
38
42
|
|
@@ -50,8 +54,7 @@ export const MRT_ExpandButton = <TData extends MRT_RowData>({
|
|
50
54
|
return (
|
51
55
|
<Tooltip
|
52
56
|
disableHoverListener={!canExpand && !detailPanel}
|
53
|
-
|
54
|
-
enterNextDelay={1000}
|
57
|
+
{...getCommonTooltipProps()}
|
55
58
|
title={
|
56
59
|
iconButtonProps?.title ??
|
57
60
|
(isExpanded ? localization.collapse : localization.expand)
|
@@ -66,6 +69,9 @@ export const MRT_ExpandButton = <TData extends MRT_RowData>({
|
|
66
69
|
sx={(theme) => ({
|
67
70
|
height: density === 'compact' ? '1.75rem' : '2.25rem',
|
68
71
|
opacity: !canExpand && !detailPanel ? 0.3 : 1,
|
72
|
+
[theme.direction === 'rtl' || positionExpandColumn === 'last'
|
73
|
+
? 'mr'
|
74
|
+
: 'ml']: `${row.depth * 16}px`,
|
69
75
|
width: density === 'compact' ? '1.75rem' : '2.25rem',
|
70
76
|
...(parseFromValuesOrFunc(iconButtonProps?.sx, theme) as any),
|
71
77
|
})}
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import { type DragEventHandler } from 'react';
|
2
2
|
import IconButton, { type IconButtonProps } from '@mui/material/IconButton';
|
3
3
|
import Tooltip from '@mui/material/Tooltip';
|
4
|
-
import {
|
5
|
-
import {
|
4
|
+
import { type MRT_RowData, type MRT_TableInstance } from '../../types';
|
5
|
+
import { getCommonTooltipProps } from '../../utils/style.utils';
|
6
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
6
7
|
|
7
8
|
interface Props<TData extends MRT_RowData> extends IconButtonProps {
|
8
9
|
iconButtonProps?: IconButtonProps;
|
@@ -31,9 +32,7 @@ export const MRT_GrabHandleButton = <TData extends MRT_RowData>({
|
|
31
32
|
|
32
33
|
return (
|
33
34
|
<Tooltip
|
34
|
-
|
35
|
-
enterNextDelay={1000}
|
36
|
-
placement="top"
|
35
|
+
{...getCommonTooltipProps('top')}
|
37
36
|
title={_iconButtonProps?.title ?? localization.move}
|
38
37
|
>
|
39
38
|
<IconButton
|
@@ -2,12 +2,13 @@ import { type MouseEvent, useState } from 'react';
|
|
2
2
|
import { type RowPinningPosition } from '@tanstack/react-table';
|
3
3
|
import IconButton, { type IconButtonProps } from '@mui/material/IconButton';
|
4
4
|
import Tooltip from '@mui/material/Tooltip';
|
5
|
-
import { parseFromValuesOrFunc } from '../column.utils';
|
6
5
|
import {
|
7
6
|
type MRT_Row,
|
8
7
|
type MRT_RowData,
|
9
8
|
type MRT_TableInstance,
|
10
|
-
} from '
|
9
|
+
} from '../../types';
|
10
|
+
import { getCommonTooltipProps } from '../../utils/style.utils';
|
11
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
11
12
|
|
12
13
|
interface Props<TData extends MRT_RowData> extends IconButtonProps {
|
13
14
|
pinningPosition: RowPinningPosition;
|
@@ -41,8 +42,7 @@ export const MRT_RowPinButton = <TData extends MRT_RowData>({
|
|
41
42
|
|
42
43
|
return (
|
43
44
|
<Tooltip
|
44
|
-
|
45
|
-
enterNextDelay={1000}
|
45
|
+
{...getCommonTooltipProps()}
|
46
46
|
open={tooltipOpened}
|
47
47
|
title={isPinned ? localization.unpin : localization.pin}
|
48
48
|
>
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { type MouseEvent, useState } from 'react';
|
2
2
|
import IconButton, { type IconButtonProps } from '@mui/material/IconButton';
|
3
3
|
import Tooltip from '@mui/material/Tooltip';
|
4
|
+
import { type MRT_RowData, type MRT_TableInstance } from '../../types';
|
4
5
|
import { MRT_ShowHideColumnsMenu } from '../menus/MRT_ShowHideColumnsMenu';
|
5
|
-
import { type MRT_RowData, type MRT_TableInstance } from '../types';
|
6
6
|
|
7
7
|
interface Props<TData extends MRT_RowData> extends IconButtonProps {
|
8
8
|
table: MRT_TableInstance<TData>;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import IconButton, { type IconButtonProps } from '@mui/material/IconButton';
|
2
2
|
import Tooltip from '@mui/material/Tooltip';
|
3
|
-
import { type MRT_RowData, type MRT_TableInstance } from '
|
3
|
+
import { type MRT_RowData, type MRT_TableInstance } from '../../types';
|
4
4
|
|
5
5
|
interface Props<TData extends MRT_RowData> extends IconButtonProps {
|
6
6
|
table: MRT_TableInstance<TData>;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import IconButton, { type IconButtonProps } from '@mui/material/IconButton';
|
2
2
|
import Tooltip from '@mui/material/Tooltip';
|
3
|
-
import { type MRT_RowData, type MRT_TableInstance } from '
|
3
|
+
import { type MRT_RowData, type MRT_TableInstance } from '../../types';
|
4
4
|
|
5
5
|
interface Props<TData extends MRT_RowData> extends IconButtonProps {
|
6
6
|
table: MRT_TableInstance<TData>;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { useState } from 'react';
|
2
2
|
import IconButton, { type IconButtonProps } from '@mui/material/IconButton';
|
3
3
|
import Tooltip from '@mui/material/Tooltip';
|
4
|
-
import { type MRT_RowData, type MRT_TableInstance } from '
|
4
|
+
import { type MRT_RowData, type MRT_TableInstance } from '../../types';
|
5
5
|
|
6
6
|
interface Props<TData extends MRT_RowData> extends IconButtonProps {
|
7
7
|
table: MRT_TableInstance<TData>;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import IconButton, { type IconButtonProps } from '@mui/material/IconButton';
|
2
2
|
import Tooltip from '@mui/material/Tooltip';
|
3
|
-
import { type MRT_RowData, type MRT_TableInstance } from '
|
3
|
+
import { type MRT_RowData, type MRT_TableInstance } from '../../types';
|
4
4
|
|
5
5
|
interface Props<TData extends MRT_RowData> extends IconButtonProps {
|
6
6
|
table: MRT_TableInstance<TData>;
|
@@ -2,14 +2,15 @@ import { type MouseEvent, useState } from 'react';
|
|
2
2
|
import IconButton, { type IconButtonProps } from '@mui/material/IconButton';
|
3
3
|
import Tooltip from '@mui/material/Tooltip';
|
4
4
|
import { MRT_EditActionButtons } from './MRT_EditActionButtons';
|
5
|
-
import { parseFromValuesOrFunc } from '../column.utils';
|
6
|
-
import { MRT_RowActionMenu } from '../menus/MRT_RowActionMenu';
|
7
5
|
import {
|
8
6
|
type MRT_Cell,
|
9
7
|
type MRT_Row,
|
10
8
|
type MRT_RowData,
|
11
9
|
type MRT_TableInstance,
|
12
|
-
} from '
|
10
|
+
} from '../../types';
|
11
|
+
import { getCommonTooltipProps } from '../../utils/style.utils';
|
12
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
13
|
+
import { MRT_RowActionMenu } from '../menus/MRT_RowActionMenu';
|
13
14
|
|
14
15
|
const commonIconButtonStyles = {
|
15
16
|
'&:hover': {
|
@@ -25,12 +26,14 @@ const commonIconButtonStyles = {
|
|
25
26
|
interface Props<TData extends MRT_RowData> extends IconButtonProps {
|
26
27
|
cell: MRT_Cell<TData>;
|
27
28
|
row: MRT_Row<TData>;
|
29
|
+
staticRowIndex?: number;
|
28
30
|
table: MRT_TableInstance<TData>;
|
29
31
|
}
|
30
32
|
|
31
33
|
export const MRT_ToggleRowActionMenuButton = <TData extends MRT_RowData>({
|
32
34
|
cell,
|
33
35
|
row,
|
36
|
+
staticRowIndex,
|
34
37
|
table,
|
35
38
|
...rest
|
36
39
|
}: Props<TData>) => {
|
@@ -74,7 +77,7 @@ export const MRT_ToggleRowActionMenuButton = <TData extends MRT_RowData>({
|
|
74
77
|
return (
|
75
78
|
<>
|
76
79
|
{renderRowActions && !showEditActionButtons ? (
|
77
|
-
renderRowActions({ cell, row, table })
|
80
|
+
renderRowActions({ cell, row, staticRowIndex, table })
|
78
81
|
) : showEditActionButtons ? (
|
79
82
|
<MRT_EditActionButtons row={row} table={table} />
|
80
83
|
) : !renderRowActionMenuItems &&
|
@@ -92,11 +95,7 @@ export const MRT_ToggleRowActionMenuButton = <TData extends MRT_RowData>({
|
|
92
95
|
</Tooltip>
|
93
96
|
) : renderRowActionMenuItems ? (
|
94
97
|
<>
|
95
|
-
<Tooltip
|
96
|
-
enterDelay={1000}
|
97
|
-
enterNextDelay={1000}
|
98
|
-
title={localization.rowActions}
|
99
|
-
>
|
98
|
+
<Tooltip {...getCommonTooltipProps()} title={localization.rowActions}>
|
100
99
|
<IconButton
|
101
100
|
aria-label={localization.rowActions}
|
102
101
|
onClick={handleOpenRowActionMenu}
|
@@ -112,6 +111,7 @@ export const MRT_ToggleRowActionMenuButton = <TData extends MRT_RowData>({
|
|
112
111
|
handleEdit={handleStartEditMode}
|
113
112
|
row={row}
|
114
113
|
setAnchorEl={setAnchorEl}
|
114
|
+
staticRowIndex={staticRowIndex}
|
115
115
|
table={table}
|
116
116
|
/>
|
117
117
|
</>
|