material-react-table 2.0.0-alpha.1 → 2.0.0-alpha.2
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 +2 -2
- package/dist/cjs/index.js +2400 -2365
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/MaterialReactTable.d.ts +1 -1
- package/dist/cjs/types/buttons/MRT_GrabHandleButton.d.ts +1 -1
- package/dist/cjs/types/buttons/MRT_RowPinButton.d.ts +2 -2
- package/dist/cjs/types/column.utils.d.ts +6 -6
- package/dist/cjs/types/filterFns.d.ts +14 -14
- package/dist/cjs/types/head/MRT_TableHeadCellFilterLabel.d.ts +1 -1
- package/dist/cjs/types/head/MRT_TableHeadCellSortLabel.d.ts +1 -1
- package/dist/cjs/types/hooks/useMRT_DisplayColumns.d.ts +3 -3
- package/dist/cjs/types/icons.d.ts +1 -1
- package/dist/cjs/types/inputs/MRT_FilterRangeSlider.d.ts +1 -1
- package/dist/cjs/types/menus/MRT_ColumnActionMenu.d.ts +4 -4
- package/dist/cjs/types/menus/MRT_ShowHideColumnsMenuItems.d.ts +1 -1
- package/dist/cjs/types/toolbar/MRT_TablePagination.d.ts +2 -2
- package/dist/cjs/types/toolbar/MRT_TopToolbar.d.ts +1 -1
- package/dist/cjs/types/types.d.ts +198 -198
- package/dist/esm/material-react-table.esm.js +2027 -1993
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/types/MaterialReactTable.d.ts +1 -1
- package/dist/esm/types/buttons/MRT_GrabHandleButton.d.ts +1 -1
- package/dist/esm/types/buttons/MRT_RowPinButton.d.ts +2 -2
- package/dist/esm/types/column.utils.d.ts +6 -6
- package/dist/esm/types/filterFns.d.ts +14 -14
- package/dist/esm/types/head/MRT_TableHeadCellFilterLabel.d.ts +1 -1
- package/dist/esm/types/head/MRT_TableHeadCellSortLabel.d.ts +1 -1
- package/dist/esm/types/hooks/useMRT_DisplayColumns.d.ts +3 -3
- package/dist/esm/types/icons.d.ts +1 -1
- package/dist/esm/types/inputs/MRT_FilterRangeSlider.d.ts +1 -1
- package/dist/esm/types/menus/MRT_ColumnActionMenu.d.ts +4 -4
- package/dist/esm/types/menus/MRT_ShowHideColumnsMenuItems.d.ts +1 -1
- package/dist/esm/types/toolbar/MRT_TablePagination.d.ts +2 -2
- package/dist/esm/types/toolbar/MRT_TopToolbar.d.ts +1 -1
- package/dist/esm/types/types.d.ts +198 -198
- package/dist/index.d.ts +239 -239
- package/locales/fr.esm.js +1 -1
- package/locales/fr.esm.js.map +1 -1
- package/locales/fr.js +1 -1
- package/locales/fr.js.map +1 -1
- package/locales/tr.d.ts +2 -0
- package/locales/tr.esm.d.ts +2 -0
- package/locales/tr.esm.js +93 -0
- package/locales/tr.esm.js.map +1 -0
- package/locales/tr.js +97 -0
- package/locales/tr.js.map +1 -0
- package/locales/uk.d.ts +2 -0
- package/locales/uk.esm.d.ts +2 -0
- package/locales/uk.esm.js +93 -0
- package/locales/uk.esm.js.map +1 -0
- package/locales/uk.js +97 -0
- package/locales/uk.js.map +1 -0
- package/locales/vi.d.ts +2 -0
- package/locales/vi.esm.d.ts +2 -0
- package/locales/vi.esm.js +93 -0
- package/locales/vi.esm.js.map +1 -0
- package/locales/vi.js +97 -0
- package/locales/vi.js.map +1 -0
- package/locales/zh-Hans.d.ts +2 -0
- package/locales/zh-Hans.esm.d.ts +2 -0
- package/locales/zh-Hans.esm.js +93 -0
- package/locales/zh-Hans.esm.js.map +1 -0
- package/locales/zh-Hans.js +97 -0
- package/locales/zh-Hans.js.map +1 -0
- package/locales/zh-Hant.d.ts +2 -0
- package/locales/zh-Hant.esm.d.ts +2 -0
- package/locales/zh-Hant.esm.js +93 -0
- package/locales/zh-Hant.esm.js.map +1 -0
- package/locales/zh-Hant.js +97 -0
- package/locales/zh-Hant.js.map +1 -0
- package/package.json +2 -1
- package/src/MaterialReactTable.tsx +2 -2
- package/src/body/MRT_TableBody.tsx +9 -9
- package/src/body/MRT_TableBodyCell.tsx +22 -22
- package/src/body/MRT_TableBodyCellValue.tsx +5 -5
- package/src/body/MRT_TableBodyRow.tsx +32 -32
- package/src/body/MRT_TableBodyRowGrabHandle.tsx +2 -2
- package/src/body/MRT_TableBodyRowPinButton.tsx +3 -3
- package/src/body/MRT_TableDetailPanel.tsx +3 -3
- package/src/buttons/MRT_CopyButton.tsx +1 -1
- package/src/buttons/MRT_EditActionButtons.tsx +4 -4
- package/src/buttons/MRT_ExpandAllButton.tsx +3 -3
- package/src/buttons/MRT_ExpandButton.tsx +1 -1
- package/src/buttons/MRT_GrabHandleButton.tsx +10 -10
- package/src/buttons/MRT_RowPinButton.tsx +5 -5
- package/src/buttons/MRT_ShowHideColumnsButton.tsx +1 -1
- package/src/buttons/MRT_ToggleFullScreenButton.tsx +2 -2
- package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +8 -8
- package/src/column.utils.ts +23 -17
- package/src/filterFns.ts +29 -29
- package/src/footer/MRT_TableFooter.tsx +9 -9
- package/src/footer/MRT_TableFooterCell.tsx +1 -1
- package/src/footer/MRT_TableFooterRow.tsx +2 -2
- package/src/head/MRT_TableHead.tsx +9 -9
- package/src/head/MRT_TableHeadCell.tsx +10 -6
- package/src/head/MRT_TableHeadCellColumnActionsButton.tsx +9 -6
- package/src/head/MRT_TableHeadCellFilterContainer.tsx +11 -4
- package/src/head/MRT_TableHeadCellFilterLabel.tsx +106 -61
- package/src/head/MRT_TableHeadCellGrabHandle.tsx +2 -2
- package/src/head/MRT_TableHeadCellResizeHandle.tsx +11 -11
- package/src/head/MRT_TableHeadCellSortLabel.tsx +8 -8
- package/src/head/MRT_TableHeadRow.tsx +2 -2
- package/src/hooks/useMRT_DisplayColumns.tsx +5 -5
- package/src/hooks/useMRT_Effects.ts +3 -3
- package/src/hooks/useMRT_TableInstance.ts +15 -14
- package/src/hooks/useMRT_TableOptions.ts +3 -3
- package/src/icons.ts +2 -2
- package/src/inputs/MRT_EditCellTextField.tsx +9 -9
- package/src/inputs/MRT_FilterCheckbox.tsx +7 -7
- package/src/inputs/MRT_FilterRangeFields.tsx +1 -1
- package/src/inputs/MRT_FilterRangeSlider.tsx +6 -6
- package/src/inputs/MRT_FilterTextField.tsx +75 -75
- package/src/inputs/MRT_GlobalFilterTextField.tsx +26 -26
- package/src/inputs/MRT_SelectCheckbox.tsx +7 -7
- package/src/locales/fr.ts +1 -1
- package/src/menus/MRT_ColumnActionMenu.tsx +14 -14
- package/src/menus/MRT_FilterOptionMenu.tsx +35 -35
- package/src/menus/MRT_RowActionMenu.tsx +7 -7
- package/src/menus/MRT_ShowHideColumnsMenu.tsx +6 -6
- package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +5 -5
- package/src/modals/MRT_EditRowModal.tsx +8 -8
- package/src/sortingFns.ts +1 -1
- package/src/table/MRT_Table.tsx +7 -7
- package/src/table/MRT_TableContainer.tsx +10 -10
- package/src/table/MRT_TablePaper.tsx +9 -9
- package/src/toolbar/MRT_BottomToolbar.tsx +5 -5
- package/src/toolbar/MRT_LinearProgressBar.tsx +4 -4
- package/src/toolbar/MRT_TablePagination.tsx +19 -19
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +4 -4
- package/src/toolbar/MRT_ToolbarDropZone.tsx +6 -6
- package/src/toolbar/MRT_ToolbarInternalButtons.tsx +8 -5
- package/src/toolbar/MRT_TopToolbar.tsx +7 -7
- package/src/types.ts +263 -263
- package/src/useMaterialReactTable.ts +1 -1
@@ -1,26 +1,26 @@
|
|
1
1
|
import {
|
2
|
-
memo,
|
3
2
|
type DragEvent,
|
4
3
|
type MouseEvent,
|
5
4
|
type RefObject,
|
5
|
+
memo,
|
6
6
|
useEffect,
|
7
7
|
useMemo,
|
8
8
|
useState,
|
9
9
|
} from 'react';
|
10
|
+
import { type VirtualItem } from '@tanstack/react-virtual';
|
10
11
|
import Skeleton from '@mui/material/Skeleton';
|
11
12
|
import TableCell from '@mui/material/TableCell';
|
12
13
|
import { useTheme } from '@mui/material/styles';
|
13
|
-
import { MRT_EditCellTextField } from '../inputs/MRT_EditCellTextField';
|
14
|
-
import { MRT_CopyButton } from '../buttons/MRT_CopyButton';
|
15
|
-
import { MRT_TableBodyRowGrabHandle } from './MRT_TableBodyRowGrabHandle';
|
16
14
|
import { MRT_TableBodyCellValue } from './MRT_TableBodyCellValue';
|
15
|
+
import { MRT_TableBodyRowGrabHandle } from './MRT_TableBodyRowGrabHandle';
|
16
|
+
import { MRT_CopyButton } from '../buttons/MRT_CopyButton';
|
17
17
|
import {
|
18
18
|
getCommonCellStyles,
|
19
19
|
getIsFirstColumn,
|
20
20
|
getIsLastColumn,
|
21
21
|
parseFromValuesOrFunc,
|
22
22
|
} from '../column.utils';
|
23
|
-
import {
|
23
|
+
import { MRT_EditCellTextField } from '../inputs/MRT_EditCellTextField';
|
24
24
|
import { type MRT_Cell, type MRT_TableInstance } from '../types';
|
25
25
|
|
26
26
|
interface Props<TData extends Record<string, any>> {
|
@@ -54,8 +54,8 @@ export const MRT_TableBodyCell = <TData extends Record<string, any>>({
|
|
54
54
|
enableGrouping,
|
55
55
|
enableRowNumbers,
|
56
56
|
layoutMode,
|
57
|
-
muiTableBodyCellProps,
|
58
57
|
muiSkeletonProps,
|
58
|
+
muiTableBodyCellProps,
|
59
59
|
rowNumberMode,
|
60
60
|
},
|
61
61
|
refs: { editInputRefs },
|
@@ -64,13 +64,13 @@ export const MRT_TableBodyCell = <TData extends Record<string, any>>({
|
|
64
64
|
} = table;
|
65
65
|
const {
|
66
66
|
creatingRow,
|
67
|
+
density,
|
67
68
|
draggingColumn,
|
68
69
|
draggingRow,
|
69
70
|
editingCell,
|
70
71
|
editingRow,
|
71
72
|
hoveredColumn,
|
72
73
|
hoveredRow,
|
73
|
-
density,
|
74
74
|
isLoading,
|
75
75
|
showSkeletons,
|
76
76
|
} = getState();
|
@@ -129,6 +129,10 @@ export const MRT_TableBodyCell = <TData extends Record<string, any>>({
|
|
129
129
|
|
130
130
|
return borderStyle
|
131
131
|
? {
|
132
|
+
borderBottom:
|
133
|
+
isDraggingRow || isHoveredRow || isLastRow
|
134
|
+
? borderStyle
|
135
|
+
: undefined,
|
132
136
|
borderLeft:
|
133
137
|
isDraggingColumn ||
|
134
138
|
isHoveredColumn ||
|
@@ -141,10 +145,6 @@ export const MRT_TableBodyCell = <TData extends Record<string, any>>({
|
|
141
145
|
((isDraggingRow || isHoveredRow) && isLastColumn)
|
142
146
|
? borderStyle
|
143
147
|
: undefined,
|
144
|
-
borderBottom:
|
145
|
-
isDraggingRow || isHoveredRow || isLastRow
|
146
|
-
? borderStyle
|
147
|
-
: undefined,
|
148
148
|
borderTop: isDraggingRow || isHoveredRow ? borderStyle : undefined,
|
149
149
|
}
|
150
150
|
: undefined;
|
@@ -156,7 +156,7 @@ export const MRT_TableBodyCell = <TData extends Record<string, any>>({
|
|
156
156
|
|
157
157
|
const isEditing =
|
158
158
|
isEditable &&
|
159
|
-
!['
|
159
|
+
!['custom', 'modal'].includes(editDisplayMode as string) &&
|
160
160
|
(editDisplayMode === 'table' ||
|
161
161
|
editingRow?.id === row.id ||
|
162
162
|
editingCell?.id === cell.id) &&
|
@@ -200,9 +200,16 @@ export const MRT_TableBodyCell = <TData extends Record<string, any>>({
|
|
200
200
|
}
|
201
201
|
}}
|
202
202
|
{...tableCellProps}
|
203
|
-
onDragEnter={handleDragEnter}
|
204
203
|
onDoubleClick={handleDoubleClick}
|
204
|
+
onDragEnter={handleDragEnter}
|
205
205
|
sx={(theme) => ({
|
206
|
+
'&:hover': {
|
207
|
+
outline: ['cell', 'table'].includes(editDisplayMode ?? '')
|
208
|
+
? `1px solid ${theme.palette.text.secondary}`
|
209
|
+
: undefined,
|
210
|
+
outlineOffset: '-1px',
|
211
|
+
textOverflow: 'clip',
|
212
|
+
},
|
206
213
|
alignItems: layoutMode === 'grid' ? 'center' : undefined,
|
207
214
|
cursor:
|
208
215
|
isEditable && editDisplayMode === 'cell' ? 'pointer' : 'inherit',
|
@@ -237,18 +244,11 @@ export const MRT_TableBodyCell = <TData extends Record<string, any>>({
|
|
237
244
|
row.getIsPinned() || density === 'compact' ? 'nowrap' : 'normal',
|
238
245
|
zIndex:
|
239
246
|
draggingColumn?.id === column.id ? 2 : column.getIsPinned() ? 1 : 0,
|
240
|
-
'&:hover': {
|
241
|
-
outline: ['table', 'cell'].includes(editDisplayMode ?? '')
|
242
|
-
? `1px solid ${theme.palette.text.secondary}`
|
243
|
-
: undefined,
|
244
|
-
outlineOffset: '-1px',
|
245
|
-
textOverflow: 'clip',
|
246
|
-
},
|
247
247
|
...getCommonCellStyles({
|
248
248
|
column,
|
249
249
|
table,
|
250
|
-
theme,
|
251
250
|
tableCellProps,
|
251
|
+
theme,
|
252
252
|
}),
|
253
253
|
...draggingBorders,
|
254
254
|
})}
|
@@ -275,8 +275,8 @@ export const MRT_TableBodyCell = <TData extends Record<string, any>>({
|
|
275
275
|
!row.getIsGrouped()) ? (
|
276
276
|
columnDef.Cell?.({
|
277
277
|
cell,
|
278
|
-
renderedCellValue: cell.renderValue() as any,
|
279
278
|
column,
|
279
|
+
renderedCellValue: cell.renderValue() as any,
|
280
280
|
row,
|
281
281
|
table,
|
282
282
|
})
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { type ReactNode } from 'react';
|
2
2
|
import Box from '@mui/material/Box';
|
3
3
|
import { darken, lighten } from '@mui/material/styles';
|
4
|
-
import highlightWords from 'highlight-words';
|
5
4
|
import { type MRT_Cell, type MRT_TableInstance } from '../types';
|
5
|
+
import highlightWords from 'highlight-words';
|
6
6
|
|
7
7
|
const allowedTypes = ['string', 'number'];
|
8
8
|
|
@@ -46,7 +46,7 @@ export const MRT_TableBodyCellValue = <TData extends Record<string, any>>({
|
|
46
46
|
const isGroupedValue = renderedCellValue !== undefined;
|
47
47
|
|
48
48
|
if (!isGroupedValue) {
|
49
|
-
renderedCellValue = cell.renderValue() as
|
49
|
+
renderedCellValue = cell.renderValue() as ReactNode | number | string;
|
50
50
|
}
|
51
51
|
|
52
52
|
if (
|
@@ -62,10 +62,10 @@ export const MRT_TableBodyCellValue = <TData extends Record<string, any>>({
|
|
62
62
|
column.getCanGlobalFilter()))
|
63
63
|
) {
|
64
64
|
const chunks = highlightWords?.({
|
65
|
-
text: renderedCellValue?.toString() as string,
|
66
|
-
query: (filterValue ?? globalFilter ?? '').toString(),
|
67
65
|
matchExactly:
|
68
66
|
(filterValue ? columnDef._filterFn : globalFilterFn) !== 'fuzzy',
|
67
|
+
query: (filterValue ?? globalFilter ?? '').toString(),
|
68
|
+
text: renderedCellValue?.toString() as string,
|
69
69
|
});
|
70
70
|
if (chunks?.length > 1 || chunks?.[0]?.match) {
|
71
71
|
renderedCellValue = (
|
@@ -101,8 +101,8 @@ export const MRT_TableBodyCellValue = <TData extends Record<string, any>>({
|
|
101
101
|
if (columnDef.Cell && !isGroupedValue) {
|
102
102
|
renderedCellValue = columnDef.Cell({
|
103
103
|
cell,
|
104
|
-
renderedCellValue,
|
105
104
|
column,
|
105
|
+
renderedCellValue,
|
106
106
|
row,
|
107
107
|
table,
|
108
108
|
});
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import { type DragEvent, memo,
|
1
|
+
import { type DragEvent, memo, useMemo, useRef } from 'react';
|
2
|
+
import { type VirtualItem, type Virtualizer } from '@tanstack/react-virtual';
|
2
3
|
import TableRow from '@mui/material/TableRow';
|
3
4
|
import {
|
4
5
|
type Theme,
|
@@ -7,9 +8,8 @@ import {
|
|
7
8
|
lighten,
|
8
9
|
useTheme,
|
9
10
|
} from '@mui/material/styles';
|
10
|
-
import {
|
11
|
+
import { MRT_TableBodyCell, Memo_MRT_TableBodyCell } from './MRT_TableBodyCell';
|
11
12
|
import { MRT_TableDetailPanel } from './MRT_TableDetailPanel';
|
12
|
-
import { type VirtualItem, type Virtualizer } from '@tanstack/react-virtual';
|
13
13
|
import { parseFromValuesOrFunc } from '../column.utils';
|
14
14
|
import { type MRT_Cell, type MRT_Row, type MRT_TableInstance } from '../types';
|
15
15
|
|
@@ -50,12 +50,12 @@ export const MRT_TableBodyRow = <TData extends Record<string, any>>({
|
|
50
50
|
enableStickyFooter,
|
51
51
|
enableStickyHeader,
|
52
52
|
layoutMode,
|
53
|
-
rowPinningDisplayMode,
|
54
53
|
memoMode,
|
55
54
|
muiTableBodyRowProps,
|
56
55
|
renderDetailPanel,
|
56
|
+
rowPinningDisplayMode,
|
57
57
|
},
|
58
|
-
refs: {
|
58
|
+
refs: { tableFooterRef, tableHeadRef },
|
59
59
|
setHoveredRow,
|
60
60
|
} = table;
|
61
61
|
const {
|
@@ -118,27 +118,43 @@ export const MRT_TableBodyRow = <TData extends Record<string, any>>({
|
|
118
118
|
<TableRow
|
119
119
|
data-index={virtualRow?.index}
|
120
120
|
onDragEnter={handleDragEnter}
|
121
|
-
selected={row.getIsSelected()}
|
122
121
|
ref={(node: HTMLTableRowElement) => {
|
123
122
|
if (node) {
|
124
123
|
rowRef.current = node;
|
125
124
|
measureElement?.(node);
|
126
125
|
}
|
127
126
|
}}
|
127
|
+
selected={row.getIsSelected()}
|
128
128
|
{...tableRowProps}
|
129
|
+
style={{
|
130
|
+
transform: virtualRow
|
131
|
+
? `translateY(${virtualRow?.start}px)`
|
132
|
+
: undefined,
|
133
|
+
...tableRowProps?.style,
|
134
|
+
}}
|
129
135
|
sx={(theme: Theme) => ({
|
136
|
+
'&:hover td': {
|
137
|
+
backgroundColor:
|
138
|
+
tableRowProps?.hover !== false
|
139
|
+
? row.getIsSelected()
|
140
|
+
? `${alpha(theme.palette.primary.main, 0.2)}`
|
141
|
+
: theme.palette.mode === 'dark'
|
142
|
+
? `${lighten(theme.palette.background.default, 0.12)}`
|
143
|
+
: `${darken(theme.palette.background.default, 0.05)}`
|
144
|
+
: undefined,
|
145
|
+
},
|
130
146
|
backgroundColor: `${lighten(
|
131
147
|
theme.palette.background.default,
|
132
148
|
0.06,
|
133
149
|
)} !important`,
|
134
|
-
boxSizing: 'border-box',
|
135
150
|
bottom:
|
136
|
-
bottomPinnedIndex !== undefined && isPinned
|
151
|
+
!virtualRow && bottomPinnedIndex !== undefined && isPinned
|
137
152
|
? `${
|
138
153
|
bottomPinnedIndex * rowHeight +
|
139
154
|
(enableStickyFooter ? tableFooterHeight - 1 : 0)
|
140
155
|
}px`
|
141
156
|
: undefined,
|
157
|
+
boxSizing: 'border-box',
|
142
158
|
display: layoutMode === 'grid' ? 'flex' : 'table-row',
|
143
159
|
opacity: isPinned
|
144
160
|
? 0.98
|
@@ -150,7 +166,13 @@ export const MRT_TableBodyRow = <TData extends Record<string, any>>({
|
|
150
166
|
: rowPinningDisplayMode?.includes('sticky') && isPinned
|
151
167
|
? 'sticky'
|
152
168
|
: undefined,
|
153
|
-
|
169
|
+
td: {
|
170
|
+
backgroundColor: row.getIsSelected()
|
171
|
+
? alpha(theme.palette.primary.main, 0.2)
|
172
|
+
: isPinned
|
173
|
+
? alpha(theme.palette.primary.main, 0.1)
|
174
|
+
: undefined,
|
175
|
+
},
|
154
176
|
top: virtualRow
|
155
177
|
? 0
|
156
178
|
: topPinnedIndex !== undefined && isPinned
|
@@ -159,36 +181,14 @@ export const MRT_TableBodyRow = <TData extends Record<string, any>>({
|
|
159
181
|
(enableStickyHeader || isFullScreen ? tableHeadHeight - 1 : 0)
|
160
182
|
}px`
|
161
183
|
: undefined,
|
184
|
+
transition: virtualRow ? 'none' : 'all 150ms ease-in-out',
|
162
185
|
width: '100%',
|
163
186
|
zIndex:
|
164
187
|
rowPinningDisplayMode?.includes('sticky') && isPinned
|
165
188
|
? 1
|
166
189
|
: undefined,
|
167
|
-
td: {
|
168
|
-
backgroundColor: row.getIsSelected()
|
169
|
-
? alpha(theme.palette.primary.main, 0.2)
|
170
|
-
: isPinned
|
171
|
-
? alpha(theme.palette.primary.main, 0.1)
|
172
|
-
: undefined,
|
173
|
-
},
|
174
|
-
'&:hover td': {
|
175
|
-
backgroundColor:
|
176
|
-
tableRowProps?.hover !== false
|
177
|
-
? row.getIsSelected()
|
178
|
-
? `${alpha(theme.palette.primary.main, 0.2)}`
|
179
|
-
: theme.palette.mode === 'dark'
|
180
|
-
? `${lighten(theme.palette.background.default, 0.12)}`
|
181
|
-
: `${darken(theme.palette.background.default, 0.05)}`
|
182
|
-
: undefined,
|
183
|
-
},
|
184
190
|
...(sx as any),
|
185
191
|
})}
|
186
|
-
style={{
|
187
|
-
transform: virtualRow
|
188
|
-
? `translateY(${virtualRow?.start}px)`
|
189
|
-
: undefined,
|
190
|
-
...tableRowProps?.style,
|
191
|
-
}}
|
192
192
|
>
|
193
193
|
{virtualPaddingLeft ? (
|
194
194
|
<td style={{ display: 'flex', width: virtualPaddingLeft }} />
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { type DragEvent, type RefObject } from 'react';
|
2
2
|
import { MRT_GrabHandleButton } from '../buttons/MRT_GrabHandleButton';
|
3
|
-
import { type MRT_Row, type MRT_TableInstance } from '../types';
|
4
3
|
import { parseFromValuesOrFunc } from '../column.utils';
|
4
|
+
import { type MRT_Row, type MRT_TableInstance } from '../types';
|
5
5
|
|
6
6
|
interface Props<TData extends Record<string, any>> {
|
7
7
|
row: MRT_Row<TData>;
|
@@ -38,8 +38,8 @@ export const MRT_TableBodyRowGrabHandle = <TData extends Record<string, any>>({
|
|
38
38
|
return (
|
39
39
|
<MRT_GrabHandleButton
|
40
40
|
iconButtonProps={iconButtonProps}
|
41
|
-
onDragStart={handleDragStart}
|
42
41
|
onDragEnd={handleDragEnd}
|
42
|
+
onDragStart={handleDragStart}
|
43
43
|
table={table}
|
44
44
|
/>
|
45
45
|
);
|
@@ -30,17 +30,17 @@ export const MRT_TableBodyRowPinButton = <TData extends Record<string, any>>({
|
|
30
30
|
flexDirection: density === 'compact' ? 'row' : 'column',
|
31
31
|
}}
|
32
32
|
>
|
33
|
-
<MRT_RowPinButton row={row} table={table}
|
34
|
-
<MRT_RowPinButton row={row} table={table}
|
33
|
+
<MRT_RowPinButton pinningPosition="top" row={row} table={table} />
|
34
|
+
<MRT_RowPinButton pinningPosition="bottom" row={row} table={table} />
|
35
35
|
</Box>
|
36
36
|
);
|
37
37
|
}
|
38
38
|
|
39
39
|
return (
|
40
40
|
<MRT_RowPinButton
|
41
|
+
pinningPosition={rowPinningDisplayMode === 'bottom' ? 'bottom' : 'top'}
|
41
42
|
row={row}
|
42
43
|
table={table}
|
43
|
-
pinningPosition={rowPinningDisplayMode === 'bottom' ? 'bottom' : 'top'}
|
44
44
|
/>
|
45
45
|
);
|
46
46
|
};
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { type RefObject } from 'react';
|
2
|
+
import { type VirtualItem } from '@tanstack/react-virtual';
|
2
3
|
import Collapse from '@mui/material/Collapse';
|
3
4
|
import TableCell from '@mui/material/TableCell';
|
4
5
|
import TableRow from '@mui/material/TableRow';
|
5
6
|
import { lighten } from '@mui/material/styles';
|
6
|
-
import { type VirtualItem } from '@tanstack/react-virtual';
|
7
7
|
import { parseFromValuesOrFunc } from '../column.utils';
|
8
8
|
import { type MRT_Row, type MRT_TableInstance } from '../types';
|
9
9
|
|
@@ -23,12 +23,12 @@ export const MRT_TableDetailPanel = <TData extends Record<string, any>>({
|
|
23
23
|
virtualRow,
|
24
24
|
}: Props<TData>) => {
|
25
25
|
const {
|
26
|
-
getVisibleLeafColumns,
|
27
26
|
getState,
|
27
|
+
getVisibleLeafColumns,
|
28
28
|
options: {
|
29
29
|
layoutMode,
|
30
|
-
muiTableBodyRowProps,
|
31
30
|
muiDetailPanelProps,
|
31
|
+
muiTableBodyRowProps,
|
32
32
|
renderDetailPanel,
|
33
33
|
},
|
34
34
|
} = table;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { type MouseEvent, type ReactNode, useState } from 'react';
|
2
2
|
import Button from '@mui/material/Button';
|
3
3
|
import Tooltip from '@mui/material/Tooltip';
|
4
|
-
import { type MRT_Cell, type MRT_TableInstance } from '../types';
|
5
4
|
import { parseFromValuesOrFunc } from '../column.utils';
|
5
|
+
import { type MRT_Cell, type MRT_TableInstance } from '../types';
|
6
6
|
|
7
7
|
interface Props<TData extends Record<string, any>> {
|
8
8
|
cell: MRT_Cell<TData>;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import Box from '@mui/material/Box';
|
2
2
|
import Button from '@mui/material/Button';
|
3
|
+
import CircularProgress from '@mui/material/CircularProgress';
|
3
4
|
import IconButton from '@mui/material/IconButton';
|
4
5
|
import Tooltip from '@mui/material/Tooltip';
|
5
|
-
import CircularProgress from '@mui/material/CircularProgress';
|
6
6
|
import { type MRT_Row, type MRT_TableInstance } from '../types';
|
7
7
|
|
8
8
|
interface Props<TData extends Record<string, any>> {
|
@@ -23,8 +23,8 @@ export const MRT_EditActionButtons = <TData extends Record<string, any>>({
|
|
23
23
|
localization,
|
24
24
|
onCreatingRowCancel,
|
25
25
|
onCreatingRowSave,
|
26
|
-
onEditingRowSave,
|
27
26
|
onEditingRowCancel,
|
27
|
+
onEditingRowSave,
|
28
28
|
},
|
29
29
|
refs: { editInputRefs },
|
30
30
|
setCreatingRow,
|
@@ -100,12 +100,12 @@ export const MRT_EditActionButtons = <TData extends Record<string, any>>({
|
|
100
100
|
</>
|
101
101
|
) : (
|
102
102
|
<>
|
103
|
-
<Button sx={{ minWidth: '100px' }}
|
103
|
+
<Button onClick={handleCancel} sx={{ minWidth: '100px' }}>
|
104
104
|
{localization.cancel}
|
105
105
|
</Button>
|
106
106
|
<Button
|
107
|
-
sx={{ minWidth: '100px' }}
|
108
107
|
onClick={handleSubmitRow}
|
108
|
+
sx={{ minWidth: '100px' }}
|
109
109
|
variant="contained"
|
110
110
|
>
|
111
111
|
{isSaving && <CircularProgress color="inherit" size={18} />}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import IconButton from '@mui/material/IconButton';
|
2
2
|
import Tooltip from '@mui/material/Tooltip';
|
3
|
-
import { type MRT_TableInstance } from '../types';
|
4
3
|
import { parseFromValuesOrFunc } from '../column.utils';
|
4
|
+
import { type MRT_TableInstance } from '../types';
|
5
5
|
|
6
6
|
interface Props<TData extends Record<string, any>> {
|
7
7
|
table: MRT_TableInstance<TData>;
|
@@ -11,9 +11,9 @@ export const MRT_ExpandAllButton = <TData extends Record<string, any>>({
|
|
11
11
|
table,
|
12
12
|
}: Props<TData>) => {
|
13
13
|
const {
|
14
|
+
getCanSomeRowsExpand,
|
14
15
|
getIsAllRowsExpanded,
|
15
16
|
getIsSomeRowsExpanded,
|
16
|
-
getCanSomeRowsExpand,
|
17
17
|
getState,
|
18
18
|
options: {
|
19
19
|
icons: { KeyboardDoubleArrowDownIcon },
|
@@ -52,8 +52,8 @@ export const MRT_ExpandAllButton = <TData extends Record<string, any>>({
|
|
52
52
|
{...iconButtonProps}
|
53
53
|
sx={(theme) => ({
|
54
54
|
height: density === 'compact' ? '1.75rem' : '2.25rem',
|
55
|
-
width: density === 'compact' ? '1.75rem' : '2.25rem',
|
56
55
|
mt: density !== 'compact' ? '-0.25rem' : undefined,
|
56
|
+
width: density === 'compact' ? '1.75rem' : '2.25rem',
|
57
57
|
...(parseFromValuesOrFunc(iconButtonProps?.sx, theme) as any),
|
58
58
|
})}
|
59
59
|
title={undefined}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { type MouseEvent } from 'react';
|
2
2
|
import IconButton from '@mui/material/IconButton';
|
3
3
|
import Tooltip from '@mui/material/Tooltip';
|
4
|
-
import { type MRT_Row, type MRT_TableInstance } from '../types';
|
5
4
|
import { parseFromValuesOrFunc } from '../column.utils';
|
5
|
+
import { type MRT_Row, type MRT_TableInstance } from '../types';
|
6
6
|
|
7
7
|
interface Props<TData extends Record<string, any>> {
|
8
8
|
row: MRT_Row<TData>;
|
@@ -1,14 +1,14 @@
|
|
1
1
|
import { type DragEventHandler } from 'react';
|
2
2
|
import IconButton from '@mui/material/IconButton';
|
3
|
-
import Tooltip from '@mui/material/Tooltip';
|
4
3
|
import { type IconButtonProps } from '@mui/material/IconButton';
|
4
|
+
import Tooltip from '@mui/material/Tooltip';
|
5
5
|
import { parseFromValuesOrFunc } from '../column.utils';
|
6
6
|
import { type MRT_TableInstance } from '../types';
|
7
7
|
|
8
8
|
interface Props<TData extends Record<string, any>> {
|
9
9
|
iconButtonProps?: IconButtonProps;
|
10
|
-
onDragStart: DragEventHandler<HTMLButtonElement>;
|
11
10
|
onDragEnd: DragEventHandler<HTMLButtonElement>;
|
11
|
+
onDragStart: DragEventHandler<HTMLButtonElement>;
|
12
12
|
table: MRT_TableInstance<TData>;
|
13
13
|
}
|
14
14
|
|
@@ -42,21 +42,21 @@ export const MRT_GrabHandleButton = <TData extends Record<string, any>>({
|
|
42
42
|
e.stopPropagation();
|
43
43
|
iconButtonProps?.onClick?.(e);
|
44
44
|
}}
|
45
|
-
onDragStart={onDragStart}
|
46
45
|
onDragEnd={onDragEnd}
|
46
|
+
onDragStart={onDragStart}
|
47
47
|
sx={(theme) => ({
|
48
|
+
'&:active': {
|
49
|
+
cursor: 'grabbing',
|
50
|
+
},
|
51
|
+
'&:hover': {
|
52
|
+
backgroundColor: 'transparent',
|
53
|
+
opacity: 1,
|
54
|
+
},
|
48
55
|
cursor: 'grab',
|
49
56
|
m: '0 -0.1rem',
|
50
57
|
opacity: 0.5,
|
51
58
|
p: '2px',
|
52
59
|
transition: 'all 150ms ease-in-out',
|
53
|
-
'&:hover': {
|
54
|
-
backgroundColor: 'transparent',
|
55
|
-
opacity: 1,
|
56
|
-
},
|
57
|
-
'&:active': {
|
58
|
-
cursor: 'grabbing',
|
59
|
-
},
|
60
60
|
...(parseFromValuesOrFunc(iconButtonProps?.sx, theme) as any),
|
61
61
|
})}
|
62
62
|
title={undefined}
|
@@ -1,23 +1,23 @@
|
|
1
|
-
import {
|
1
|
+
import { type MouseEvent, useState } from 'react';
|
2
2
|
import { type RowPinningPosition } from '@tanstack/react-table';
|
3
3
|
import IconButton from '@mui/material/IconButton';
|
4
4
|
import Tooltip from '@mui/material/Tooltip';
|
5
5
|
import { type MRT_Row, type MRT_TableInstance } from '../types';
|
6
6
|
|
7
7
|
interface Props<TData extends Record<string, any>> {
|
8
|
+
pinningPosition: RowPinningPosition;
|
8
9
|
row: MRT_Row<TData>;
|
9
10
|
table: MRT_TableInstance<TData>;
|
10
|
-
pinningPosition: RowPinningPosition;
|
11
11
|
}
|
12
12
|
|
13
13
|
export const MRT_RowPinButton = <TData extends Record<string, any>>({
|
14
|
+
pinningPosition,
|
14
15
|
row,
|
15
16
|
table,
|
16
|
-
pinningPosition,
|
17
17
|
}: Props<TData>) => {
|
18
18
|
const {
|
19
19
|
options: {
|
20
|
-
icons: {
|
20
|
+
icons: { CloseIcon, PushPinIcon },
|
21
21
|
localization,
|
22
22
|
rowPinningDisplayMode,
|
23
23
|
},
|
@@ -36,9 +36,9 @@ export const MRT_RowPinButton = <TData extends Record<string, any>>({
|
|
36
36
|
return (
|
37
37
|
<Tooltip
|
38
38
|
arrow
|
39
|
-
open={tooltipOpened}
|
40
39
|
enterDelay={1000}
|
41
40
|
enterNextDelay={1000}
|
41
|
+
open={tooltipOpened}
|
42
42
|
title={isPinned ? localization.unpin : localization.pin}
|
43
43
|
>
|
44
44
|
<IconButton
|
@@ -20,7 +20,7 @@ export const MRT_ShowHideColumnsButton = <TData extends Record<string, any>>({
|
|
20
20
|
},
|
21
21
|
} = table;
|
22
22
|
|
23
|
-
const [anchorEl, setAnchorEl] = useState<
|
23
|
+
const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);
|
24
24
|
|
25
25
|
const handleClick = (event: MouseEvent<HTMLElement>) => {
|
26
26
|
setAnchorEl(event.currentTarget);
|
@@ -1,8 +1,8 @@
|
|
1
|
+
import { useState } from 'react';
|
1
2
|
import IconButton from '@mui/material/IconButton';
|
2
3
|
import { type IconButtonProps } from '@mui/material/IconButton';
|
3
4
|
import Tooltip from '@mui/material/Tooltip';
|
4
5
|
import { type MRT_TableInstance } from '../types';
|
5
|
-
import { useState } from 'react';
|
6
6
|
|
7
7
|
interface Props<TData extends Record<string, any>> extends IconButtonProps {
|
8
8
|
table: MRT_TableInstance<TData>;
|
@@ -31,8 +31,8 @@ export const MRT_ToggleFullScreenButton = <TData extends Record<string, any>>({
|
|
31
31
|
|
32
32
|
return (
|
33
33
|
<Tooltip
|
34
|
-
open={tooltipOpened}
|
35
34
|
arrow
|
35
|
+
open={tooltipOpened}
|
36
36
|
title={rest?.title ?? localization.toggleFullScreen}
|
37
37
|
>
|
38
38
|
<IconButton
|
@@ -1,20 +1,20 @@
|
|
1
1
|
import { type MouseEvent, useState } from 'react';
|
2
2
|
import IconButton from '@mui/material/IconButton';
|
3
3
|
import Tooltip from '@mui/material/Tooltip';
|
4
|
-
import { MRT_RowActionMenu } from '../menus/MRT_RowActionMenu';
|
5
4
|
import { MRT_EditActionButtons } from './MRT_EditActionButtons';
|
6
|
-
import { type MRT_Cell, type MRT_Row, type MRT_TableInstance } from '../types';
|
7
5
|
import { parseFromValuesOrFunc } from '../column.utils';
|
6
|
+
import { MRT_RowActionMenu } from '../menus/MRT_RowActionMenu';
|
7
|
+
import { type MRT_Cell, type MRT_Row, type MRT_TableInstance } from '../types';
|
8
8
|
|
9
9
|
const commonIconButtonStyles = {
|
10
|
+
'&:hover': {
|
11
|
+
opacity: 1,
|
12
|
+
},
|
10
13
|
height: '2rem',
|
11
14
|
ml: '10px',
|
12
15
|
opacity: 0.5,
|
13
16
|
transition: 'opacity 150ms',
|
14
17
|
width: '2rem',
|
15
|
-
'&:hover': {
|
16
|
-
opacity: 1,
|
17
|
-
},
|
18
18
|
};
|
19
19
|
|
20
20
|
interface Props<TData extends Record<string, any>> {
|
@@ -53,7 +53,7 @@ export const MRT_ToggleRowActionMenuButton = <
|
|
53
53
|
(isCreating && createDisplayMode === 'row') ||
|
54
54
|
(isEditing && editDisplayMode === 'row');
|
55
55
|
|
56
|
-
const [anchorEl, setAnchorEl] = useState<
|
56
|
+
const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);
|
57
57
|
|
58
58
|
const handleOpenRowActionMenu = (event: MouseEvent<HTMLElement>) => {
|
59
59
|
event.stopPropagation();
|
@@ -75,11 +75,11 @@ export const MRT_ToggleRowActionMenuButton = <
|
|
75
75
|
<MRT_EditActionButtons row={row} table={table} />
|
76
76
|
) : !renderRowActionMenuItems &&
|
77
77
|
parseFromValuesOrFunc(enableEditing, row) ? (
|
78
|
-
<Tooltip placement="right"
|
78
|
+
<Tooltip arrow placement="right" title={localization.edit}>
|
79
79
|
<IconButton
|
80
80
|
aria-label={localization.edit}
|
81
|
-
sx={commonIconButtonStyles}
|
82
81
|
onClick={handleStartEditMode}
|
82
|
+
sx={commonIconButtonStyles}
|
83
83
|
>
|
84
84
|
<EditIcon />
|
85
85
|
</IconButton>
|