material-react-table 2.0.4 → 2.0.6
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 +4 -2
- package/dist/index.esm.js +572 -533
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +571 -532
- package/dist/index.js.map +1 -1
- package/dist/types/MaterialReactTable.d.ts +7 -0
- package/dist/types/aggregationFns.d.ts +11 -0
- package/dist/types/body/MRT_TableBody.d.ts +13 -0
- package/dist/types/body/MRT_TableBodyCell.d.ts +15 -0
- package/dist/types/body/MRT_TableBodyCellValue.d.ts +8 -0
- package/dist/types/body/MRT_TableBodyRow.d.ts +18 -0
- package/dist/types/body/MRT_TableBodyRowGrabHandle.d.ts +10 -0
- package/dist/types/body/MRT_TableBodyRowPinButton.d.ts +8 -0
- package/dist/types/body/MRT_TableDetailPanel.d.ts +13 -0
- package/dist/types/body/index.d.ts +7 -0
- package/dist/types/buttons/MRT_ColumnPinningButtons.d.ts +8 -0
- package/dist/types/buttons/MRT_CopyButton.d.ts +8 -0
- package/dist/types/buttons/MRT_EditActionButtons.d.ts +9 -0
- package/dist/types/buttons/MRT_ExpandAllButton.d.ts +7 -0
- package/dist/types/buttons/MRT_ExpandButton.d.ts +8 -0
- package/dist/types/buttons/MRT_GrabHandleButton.d.ts +12 -0
- package/dist/types/buttons/MRT_RowPinButton.d.ts +10 -0
- package/dist/types/buttons/MRT_ShowHideColumnsButton.d.ts +7 -0
- package/dist/types/buttons/MRT_ToggleDensePaddingButton.d.ts +7 -0
- package/dist/types/buttons/MRT_ToggleFiltersButton.d.ts +7 -0
- package/dist/types/buttons/MRT_ToggleFullScreenButton.d.ts +7 -0
- package/dist/types/buttons/MRT_ToggleGlobalFilterButton.d.ts +7 -0
- package/dist/types/buttons/MRT_ToggleRowActionMenuButton.d.ts +9 -0
- package/dist/types/buttons/index.d.ts +13 -0
- package/dist/types/column.utils.d.ts +127 -0
- package/dist/types/filterFns.d.ts +69 -0
- package/dist/types/footer/MRT_TableFooter.d.ts +11 -0
- package/dist/types/footer/MRT_TableFooterCell.d.ts +8 -0
- package/dist/types/footer/MRT_TableFooterRow.d.ts +12 -0
- package/dist/types/footer/index.d.ts +3 -0
- package/dist/types/head/MRT_TableHead.d.ts +11 -0
- package/dist/types/head/MRT_TableHeadCell.d.ts +8 -0
- package/dist/types/head/MRT_TableHeadCellColumnActionsButton.d.ts +8 -0
- package/dist/types/head/MRT_TableHeadCellFilterContainer.d.ts +8 -0
- package/dist/types/head/MRT_TableHeadCellFilterLabel.d.ts +8 -0
- package/dist/types/head/MRT_TableHeadCellGrabHandle.d.ts +10 -0
- package/dist/types/head/MRT_TableHeadCellResizeHandle.d.ts +8 -0
- package/dist/types/head/MRT_TableHeadCellSortLabel.d.ts +8 -0
- package/dist/types/head/MRT_TableHeadRow.d.ts +12 -0
- package/dist/types/head/index.d.ts +9 -0
- package/dist/types/hooks/index.d.ts +4 -0
- package/dist/types/hooks/useMRT_DisplayColumns.d.ts +9 -0
- package/dist/types/hooks/useMRT_Effects.d.ts +2 -0
- package/dist/types/hooks/useMRT_TableInstance.d.ts +2 -0
- package/dist/types/hooks/useMRT_TableOptions.d.ts +22 -0
- package/dist/types/icons.d.ts +36 -0
- package/dist/types/index.d.ts +18 -0
- package/dist/types/inputs/MRT_EditCellTextField.d.ts +8 -0
- package/dist/types/inputs/MRT_FilterCheckbox.d.ts +8 -0
- package/dist/types/inputs/MRT_FilterRangeFields.d.ts +8 -0
- package/dist/types/inputs/MRT_FilterRangeSlider.d.ts +8 -0
- package/dist/types/inputs/MRT_FilterTextField.d.ts +9 -0
- package/dist/types/inputs/MRT_GlobalFilterTextField.d.ts +7 -0
- package/dist/types/inputs/MRT_SelectCheckbox.d.ts +9 -0
- package/dist/types/inputs/index.d.ts +7 -0
- package/dist/types/locales/am.d.ts +2 -0
- package/dist/types/locales/ar.d.ts +2 -0
- package/dist/types/locales/az.d.ts +2 -0
- package/dist/types/locales/bg.d.ts +2 -0
- package/dist/types/locales/cs.d.ts +2 -0
- package/dist/types/locales/da.d.ts +2 -0
- package/dist/types/locales/de.d.ts +2 -0
- package/dist/types/locales/en.d.ts +2 -0
- package/dist/types/locales/es.d.ts +2 -0
- package/dist/types/locales/et.d.ts +2 -0
- package/dist/types/locales/fa.d.ts +2 -0
- package/dist/types/locales/fi.d.ts +2 -0
- package/dist/types/locales/fr.d.ts +2 -0
- package/dist/types/locales/he.d.ts +2 -0
- package/dist/types/locales/hu.d.ts +2 -0
- package/dist/types/locales/hy.d.ts +2 -0
- package/dist/types/locales/id.d.ts +2 -0
- package/dist/types/locales/it.d.ts +2 -0
- package/dist/types/locales/ja.d.ts +2 -0
- package/dist/types/locales/ko.d.ts +2 -0
- package/dist/types/locales/nl.d.ts +2 -0
- package/dist/types/locales/no.d.ts +2 -0
- package/dist/types/locales/np.d.ts +2 -0
- package/dist/types/locales/pl.d.ts +2 -0
- package/dist/types/locales/pt-BR.d.ts +2 -0
- package/dist/types/locales/pt.d.ts +2 -0
- package/dist/types/locales/ro.d.ts +2 -0
- package/dist/types/locales/ru.d.ts +2 -0
- package/dist/types/locales/sk.d.ts +2 -0
- package/dist/types/locales/sr-Cyrl-RS.d.ts +2 -0
- package/dist/types/locales/sr-Latn-RS.d.ts +2 -0
- package/dist/types/locales/sv.d.ts +2 -0
- package/dist/types/locales/tr.d.ts +2 -0
- package/dist/types/locales/uk.d.ts +2 -0
- package/dist/types/locales/vi.d.ts +2 -0
- package/dist/types/locales/zh-Hans.d.ts +2 -0
- package/dist/types/locales/zh-Hant.d.ts +2 -0
- package/dist/types/menus/MRT_ColumnActionMenu.d.ts +20 -0
- package/dist/types/menus/MRT_FilterOptionMenu.d.ts +13 -0
- package/dist/types/menus/MRT_RowActionMenu.d.ts +12 -0
- package/dist/types/menus/MRT_ShowHideColumnsMenu.d.ts +10 -0
- package/dist/types/menus/MRT_ShowHideColumnsMenuItems.d.ts +12 -0
- package/dist/types/menus/index.d.ts +5 -0
- package/dist/types/modals/MRT_EditRowModal.d.ts +8 -0
- package/dist/types/modals/index.d.ts +1 -0
- package/dist/types/sortingFns.d.ts +12 -0
- package/dist/types/style.utils.d.ts +32 -0
- package/dist/types/table/MRT_Table.d.ts +7 -0
- package/dist/types/table/MRT_TableContainer.d.ts +7 -0
- package/dist/types/table/MRT_TableLoadingOverlay.d.ts +7 -0
- package/dist/types/table/MRT_TablePaper.d.ts +7 -0
- package/dist/types/table/index.d.ts +5 -0
- package/dist/types/toolbar/MRT_BottomToolbar.d.ts +7 -0
- package/dist/types/toolbar/MRT_LinearProgressBar.d.ts +8 -0
- package/dist/types/toolbar/MRT_TablePagination.d.ts +15 -0
- package/dist/types/toolbar/MRT_ToolbarAlertBanner.d.ts +8 -0
- package/dist/types/toolbar/MRT_ToolbarDropZone.d.ts +7 -0
- package/dist/types/toolbar/MRT_ToolbarInternalButtons.d.ts +7 -0
- package/dist/types/toolbar/MRT_TopToolbar.d.ts +6 -0
- package/dist/types/toolbar/index.d.ts +7 -0
- package/dist/types/types.d.ts +854 -0
- package/dist/types/useMaterialReactTable.d.ts +2 -0
- package/package.json +22 -22
- package/src/body/MRT_TableBody.tsx +18 -23
- package/src/body/MRT_TableBodyCell.tsx +17 -15
- package/src/body/MRT_TableBodyCellValue.tsx +10 -10
- package/src/body/MRT_TableBodyRow.tsx +13 -13
- package/src/buttons/MRT_RowPinButton.tsx +2 -2
- package/src/buttons/MRT_ToggleDensePaddingButton.tsx +2 -2
- package/src/footer/MRT_TableFooterCell.tsx +2 -2
- package/src/head/MRT_TableHeadCell.tsx +21 -19
- package/src/head/MRT_TableHeadCellResizeHandle.tsx +4 -3
- package/src/head/MRT_TableHeadCellSortLabel.tsx +15 -9
- package/src/hooks/useMRT_DisplayColumns.tsx +172 -125
- package/src/inputs/MRT_FilterCheckbox.tsx +2 -2
- package/src/inputs/MRT_FilterTextField.tsx +16 -16
- package/src/inputs/MRT_GlobalFilterTextField.tsx +10 -10
- package/src/inputs/MRT_SelectCheckbox.tsx +2 -2
- package/src/locales/he.ts +94 -0
- package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +2 -2
- package/src/style.utils.ts +2 -2
- package/src/toolbar/MRT_TablePagination.tsx +9 -4
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +6 -6
- package/src/types.ts +4 -2
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.0.
|
|
2
|
+
"version": "2.0.6",
|
|
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.",
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"size-limit": [
|
|
36
36
|
{
|
|
37
37
|
"path": "dist/index.js",
|
|
38
|
-
"limit": "
|
|
38
|
+
"limit": "53 KB"
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
"path": "dist/index.esm.js",
|
|
42
|
-
"limit": "
|
|
42
|
+
"limit": "50 KB"
|
|
43
43
|
}
|
|
44
44
|
],
|
|
45
45
|
"engines": {
|
|
@@ -61,16 +61,16 @@
|
|
|
61
61
|
"storybook:dev": "storybook dev -p 6006"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@babel/core": "^7.23.
|
|
65
|
-
"@babel/preset-react": "^7.
|
|
64
|
+
"@babel/core": "^7.23.6",
|
|
65
|
+
"@babel/preset-react": "^7.23.3",
|
|
66
66
|
"@emotion/react": "^11.11.1",
|
|
67
67
|
"@emotion/styled": "^11.11.0",
|
|
68
|
-
"@faker-js/faker": "^8.
|
|
69
|
-
"@mui/icons-material": "^5.
|
|
70
|
-
"@mui/material": "^5.
|
|
71
|
-
"@mui/x-date-pickers": "^6.18.
|
|
68
|
+
"@faker-js/faker": "^8.3.1",
|
|
69
|
+
"@mui/icons-material": "^5.15.0",
|
|
70
|
+
"@mui/material": "^5.15.0",
|
|
71
|
+
"@mui/x-date-pickers": "^6.18.4",
|
|
72
72
|
"@rollup/plugin-typescript": "^11.1.5",
|
|
73
|
-
"@size-limit/preset-small-lib": "^
|
|
73
|
+
"@size-limit/preset-small-lib": "^11.0.1",
|
|
74
74
|
"@storybook/addon-a11y": "^7.5.3",
|
|
75
75
|
"@storybook/addon-essentials": "^7.5.3",
|
|
76
76
|
"@storybook/addon-interactions": "^7.5.3",
|
|
@@ -80,15 +80,15 @@
|
|
|
80
80
|
"@storybook/react": "^7.5.3",
|
|
81
81
|
"@storybook/react-vite": "^7.5.3",
|
|
82
82
|
"@storybook/testing-library": "^0.2.2",
|
|
83
|
-
"@types/node": "^20.
|
|
84
|
-
"@types/react": "^18.2.
|
|
85
|
-
"@types/react-dom": "^18.2.
|
|
86
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
87
|
-
"@typescript-eslint/parser": "^6.
|
|
88
|
-
"@vitejs/plugin-react": "^4.
|
|
89
|
-
"eslint": "^8.
|
|
83
|
+
"@types/node": "^20.10.4",
|
|
84
|
+
"@types/react": "^18.2.45",
|
|
85
|
+
"@types/react-dom": "^18.2.17",
|
|
86
|
+
"@typescript-eslint/eslint-plugin": "^6.14.0",
|
|
87
|
+
"@typescript-eslint/parser": "^6.14.0",
|
|
88
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
89
|
+
"eslint": "^8.55.0",
|
|
90
90
|
"eslint-plugin-mui-path-imports": "^0.0.15",
|
|
91
|
-
"eslint-plugin-perfectionist": "^2.
|
|
91
|
+
"eslint-plugin-perfectionist": "^2.5.0",
|
|
92
92
|
"prop-types": "^15.8.1",
|
|
93
93
|
"react": "^18.2.0",
|
|
94
94
|
"react-dom": "^18.2.0",
|
|
@@ -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": "^
|
|
99
|
+
"size-limit": "^11.0.1",
|
|
100
100
|
"storybook": "^7.5.3",
|
|
101
101
|
"storybook-dark-mode": "^3.0.1",
|
|
102
102
|
"tslib": "^2.6.2",
|
|
103
|
-
"typescript": "^5.
|
|
104
|
-
"vite": "^
|
|
103
|
+
"typescript": "^5.3.3",
|
|
104
|
+
"vite": "^5.0.8"
|
|
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.8.4",
|
|
117
117
|
"@tanstack/react-table": "8.10.7",
|
|
118
|
-
"@tanstack/react-virtual": "3.0.
|
|
118
|
+
"@tanstack/react-virtual": "3.0.1",
|
|
119
119
|
"highlight-words": "1.2.2"
|
|
120
120
|
}
|
|
121
121
|
}
|
|
@@ -186,6 +186,15 @@ export const MRT_TableBody = <TData extends MRT_RowData>({
|
|
|
186
186
|
? rowVirtualizer.getVirtualItems()
|
|
187
187
|
: undefined;
|
|
188
188
|
|
|
189
|
+
const commonRowProps = {
|
|
190
|
+
columnVirtualizer,
|
|
191
|
+
numRows: rows.length,
|
|
192
|
+
table,
|
|
193
|
+
virtualColumns,
|
|
194
|
+
virtualPaddingLeft,
|
|
195
|
+
virtualPaddingRight,
|
|
196
|
+
};
|
|
197
|
+
|
|
189
198
|
return (
|
|
190
199
|
<>
|
|
191
200
|
{!rowPinningDisplayMode?.includes('sticky') &&
|
|
@@ -202,15 +211,9 @@ export const MRT_TableBody = <TData extends MRT_RowData>({
|
|
|
202
211
|
>
|
|
203
212
|
{getTopRows().map((row, rowIndex) => {
|
|
204
213
|
const props = {
|
|
205
|
-
|
|
206
|
-
measureElement: rowVirtualizer?.measureElement,
|
|
207
|
-
numRows: rows.length,
|
|
214
|
+
...commonRowProps,
|
|
208
215
|
row,
|
|
209
216
|
rowIndex,
|
|
210
|
-
table,
|
|
211
|
-
virtualColumns,
|
|
212
|
-
virtualPaddingLeft,
|
|
213
|
-
virtualPaddingRight,
|
|
214
217
|
};
|
|
215
218
|
return memoMode === 'rows' ? (
|
|
216
219
|
<Memo_MRT_TableBodyRow key={row.id} {...props} />
|
|
@@ -275,24 +278,22 @@ export const MRT_TableBody = <TData extends MRT_RowData>({
|
|
|
275
278
|
? rows[rowOrVirtualRow.index]
|
|
276
279
|
: (rowOrVirtualRow as MRT_Row<TData>);
|
|
277
280
|
const props = {
|
|
278
|
-
|
|
281
|
+
...commonRowProps,
|
|
279
282
|
measureElement: rowVirtualizer?.measureElement,
|
|
280
|
-
numRows: rows.length,
|
|
281
283
|
pinnedRowIds,
|
|
282
284
|
row,
|
|
283
285
|
rowIndex: rowVirtualizer ? rowOrVirtualRow.index : rowIndex,
|
|
284
|
-
table,
|
|
285
|
-
virtualColumns,
|
|
286
|
-
virtualPaddingLeft,
|
|
287
|
-
virtualPaddingRight,
|
|
288
286
|
virtualRow: rowVirtualizer
|
|
289
287
|
? (rowOrVirtualRow as VirtualItem)
|
|
290
288
|
: undefined,
|
|
291
289
|
};
|
|
292
290
|
return memoMode === 'rows' ? (
|
|
293
|
-
<Memo_MRT_TableBodyRow
|
|
291
|
+
<Memo_MRT_TableBodyRow
|
|
292
|
+
key={`${row.id}${row.index}`}
|
|
293
|
+
{...props}
|
|
294
|
+
/>
|
|
294
295
|
) : (
|
|
295
|
-
<MRT_TableBodyRow key={row.id} {...props} />
|
|
296
|
+
<MRT_TableBodyRow key={`${row.id}${row.index}`} {...props} />
|
|
296
297
|
);
|
|
297
298
|
})}
|
|
298
299
|
</>
|
|
@@ -312,18 +313,12 @@ export const MRT_TableBody = <TData extends MRT_RowData>({
|
|
|
312
313
|
>
|
|
313
314
|
{getBottomRows().map((row, rowIndex) => {
|
|
314
315
|
const props = {
|
|
315
|
-
|
|
316
|
-
measureElement: rowVirtualizer?.measureElement,
|
|
317
|
-
numRows: rows.length,
|
|
316
|
+
...commonRowProps,
|
|
318
317
|
row,
|
|
319
318
|
rowIndex,
|
|
320
|
-
table,
|
|
321
|
-
virtualColumns,
|
|
322
|
-
virtualPaddingLeft,
|
|
323
|
-
virtualPaddingRight,
|
|
324
319
|
};
|
|
325
320
|
return memoMode === 'rows' ? (
|
|
326
|
-
<Memo_MRT_TableBodyRow key={row.id} {...props} />
|
|
321
|
+
<Memo_MRT_TableBodyRow key={`${row.id}`} {...props} />
|
|
327
322
|
) : (
|
|
328
323
|
<MRT_TableBodyRow key={row.id} {...props} />
|
|
329
324
|
);
|
|
@@ -126,12 +126,12 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
|
|
|
126
126
|
const borderStyle = showResizeBorder
|
|
127
127
|
? `2px solid ${draggingBorderColor} !important`
|
|
128
128
|
: isDraggingColumn || isDraggingRow
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
129
|
+
? `1px dashed ${theme.palette.grey[500]} !important`
|
|
130
|
+
: isHoveredColumn ||
|
|
131
|
+
isHoveredRow ||
|
|
132
|
+
columnSizingInfo.isResizingColumn === column.id
|
|
133
|
+
? `2px dashed ${draggingBorderColor} !important`
|
|
134
|
+
: undefined;
|
|
135
135
|
|
|
136
136
|
if (showResizeBorder) {
|
|
137
137
|
return { borderRight: borderStyle };
|
|
@@ -168,6 +168,7 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
|
|
|
168
168
|
]);
|
|
169
169
|
|
|
170
170
|
const isEditable =
|
|
171
|
+
!cell.getIsPlaceholder() &&
|
|
171
172
|
parseFromValuesOrFunc(enableEditing, row) &&
|
|
172
173
|
parseFromValuesOrFunc(columnDef.enableEditing, row) !== false;
|
|
173
174
|
|
|
@@ -222,7 +223,8 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
|
|
|
222
223
|
sx={(theme) => ({
|
|
223
224
|
'&:hover': {
|
|
224
225
|
outline:
|
|
225
|
-
|
|
226
|
+
(editDisplayMode === 'cell' && isEditable) ||
|
|
227
|
+
(editDisplayMode === 'table' && (isCreating || isEditing))
|
|
226
228
|
? `1px solid ${theme.palette.grey[500]}`
|
|
227
229
|
: undefined,
|
|
228
230
|
outlineOffset: '-1px',
|
|
@@ -241,12 +243,12 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
|
|
|
241
243
|
? '0 0.5rem'
|
|
242
244
|
: '0.5rem'
|
|
243
245
|
: density === 'comfortable'
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
246
|
+
? columnDefType === 'display'
|
|
247
|
+
? '0.5rem 0.75rem'
|
|
248
|
+
: '1rem'
|
|
249
|
+
: columnDefType === 'display'
|
|
250
|
+
? '1rem 1.25rem'
|
|
251
|
+
: '1.5rem',
|
|
250
252
|
textOverflow: columnDefType !== 'display' ? 'ellipsis' : undefined,
|
|
251
253
|
[theme.direction === 'rtl' ? 'pr' : 'pl']:
|
|
252
254
|
column.id === 'mrt-row-expand'
|
|
@@ -255,8 +257,8 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
|
|
|
255
257
|
(density === 'compact'
|
|
256
258
|
? 0.5
|
|
257
259
|
: density === 'comfortable'
|
|
258
|
-
|
|
259
|
-
|
|
260
|
+
? 0.75
|
|
261
|
+
: 1.25)
|
|
260
262
|
}rem`
|
|
261
263
|
: undefined,
|
|
262
264
|
whiteSpace:
|
|
@@ -37,15 +37,15 @@ export const MRT_TableBodyCellValue = <TData extends MRT_RowData>({
|
|
|
37
37
|
table,
|
|
38
38
|
})
|
|
39
39
|
: row.getIsGrouped() && !cell.getIsGrouped()
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
40
|
+
? null
|
|
41
|
+
: cell.getIsGrouped() && columnDef.GroupedCell
|
|
42
|
+
? columnDef.GroupedCell({
|
|
43
|
+
cell,
|
|
44
|
+
column,
|
|
45
|
+
row,
|
|
46
|
+
table,
|
|
47
|
+
})
|
|
48
|
+
: undefined;
|
|
49
49
|
|
|
50
50
|
const isGroupedValue = renderedCellValue !== undefined;
|
|
51
51
|
|
|
@@ -60,7 +60,7 @@ export const MRT_TableBodyCellValue = <TData extends MRT_RowData>({
|
|
|
60
60
|
allowedTypes.includes(typeof renderedCellValue) &&
|
|
61
61
|
((filterValue &&
|
|
62
62
|
allowedTypes.includes(typeof filterValue) &&
|
|
63
|
-
|
|
63
|
+
['autocomplete', 'text'].includes(columnDef.filterVariant!)) ||
|
|
64
64
|
(globalFilter &&
|
|
65
65
|
allowedTypes.includes(typeof globalFilter) &&
|
|
66
66
|
column.getCanGlobalFilter()))
|
|
@@ -153,8 +153,8 @@ export const MRT_TableBodyRow = <TData extends MRT_RowData>({
|
|
|
153
153
|
? row.getIsSelected()
|
|
154
154
|
? `${alpha(selectedRowBackgroundColor, 0.3)}`
|
|
155
155
|
: theme.palette.mode === 'dark'
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
? `${lighten(baseBackgroundColor, 0.05)}`
|
|
157
|
+
: `${darken(baseBackgroundColor, 0.05)}`
|
|
158
158
|
: undefined,
|
|
159
159
|
},
|
|
160
160
|
backgroundColor: `${baseBackgroundColor} !important`,
|
|
@@ -170,28 +170,28 @@ export const MRT_TableBodyRow = <TData extends MRT_RowData>({
|
|
|
170
170
|
opacity: isPinned
|
|
171
171
|
? 0.97
|
|
172
172
|
: draggingRow?.id === row.id || hoveredRow?.id === row.id
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
? 0.5
|
|
174
|
+
: 1,
|
|
175
175
|
position: virtualRow
|
|
176
176
|
? 'absolute'
|
|
177
177
|
: rowPinningDisplayMode?.includes('sticky') && isPinned
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
? 'sticky'
|
|
179
|
+
: undefined,
|
|
180
180
|
td: {
|
|
181
181
|
backgroundColor: row.getIsSelected()
|
|
182
182
|
? selectedRowBackgroundColor
|
|
183
183
|
: isPinned
|
|
184
|
-
|
|
185
|
-
|
|
184
|
+
? pinnedRowBackgroundColor
|
|
185
|
+
: undefined,
|
|
186
186
|
},
|
|
187
187
|
top: virtualRow
|
|
188
188
|
? 0
|
|
189
189
|
: topPinnedIndex !== undefined && isPinned
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
190
|
+
? `${
|
|
191
|
+
topPinnedIndex * rowHeight +
|
|
192
|
+
(enableStickyHeader || isFullScreen ? tableHeadHeight - 1 : 0)
|
|
193
|
+
}px`
|
|
194
|
+
: undefined,
|
|
195
195
|
transition: virtualRow ? 'none' : 'all 150ms ease-in-out',
|
|
196
196
|
width: '100%',
|
|
197
197
|
zIndex:
|
|
@@ -47,8 +47,8 @@ export const MRT_TableFooterCell = <TData extends MRT_RowData>({
|
|
|
47
47
|
density === 'compact'
|
|
48
48
|
? '0.5rem'
|
|
49
49
|
: density === 'comfortable'
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
? '1rem'
|
|
51
|
+
: '1.5rem',
|
|
52
52
|
verticalAlign: 'top',
|
|
53
53
|
zIndex: column.getIsPinned() && columnDefType !== 'group' ? 2 : 1,
|
|
54
54
|
...getCommonMRTCellStyles({
|
|
@@ -97,10 +97,10 @@ export const MRT_TableHeadCell = <TData extends MRT_RowData>({
|
|
|
97
97
|
const borderStyle = showResizeBorder
|
|
98
98
|
? `2px solid ${draggingBorderColor} !important`
|
|
99
99
|
: draggingColumn?.id === column.id
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
? `1px dashed ${theme.palette.grey[500]}`
|
|
101
|
+
: hoveredColumn?.id === column.id
|
|
102
|
+
? `2px dashed ${draggingBorderColor}`
|
|
103
|
+
: undefined;
|
|
104
104
|
|
|
105
105
|
if (showResizeBorder) {
|
|
106
106
|
return { borderRight: borderStyle };
|
|
@@ -158,32 +158,32 @@ export const MRT_TableHeadCell = <TData extends MRT_RowData>({
|
|
|
158
158
|
density === 'compact'
|
|
159
159
|
? '0.5rem'
|
|
160
160
|
: density === 'comfortable'
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
161
|
+
? columnDefType === 'display'
|
|
162
|
+
? '0.75rem'
|
|
163
|
+
: '1rem'
|
|
164
|
+
: columnDefType === 'display'
|
|
165
|
+
? '1rem 1.25rem'
|
|
166
|
+
: '1.5rem',
|
|
167
167
|
pb:
|
|
168
168
|
columnDefType === 'display'
|
|
169
169
|
? 0
|
|
170
170
|
: showColumnFilters || density === 'compact'
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
? '0.4rem'
|
|
172
|
+
: '0.6rem',
|
|
173
173
|
pt:
|
|
174
174
|
columnDefType === 'group' || density === 'compact'
|
|
175
175
|
? '0.25rem'
|
|
176
176
|
: density === 'comfortable'
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
? '.75rem'
|
|
178
|
+
: '1.25rem',
|
|
179
179
|
userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined,
|
|
180
180
|
verticalAlign: 'top',
|
|
181
181
|
zIndex:
|
|
182
182
|
column.getIsResizing() || draggingColumn?.id === column.id
|
|
183
183
|
? 3
|
|
184
184
|
: column.getIsPinned() && columnDefType !== 'group'
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
? 2
|
|
186
|
+
: 1,
|
|
187
187
|
...getCommonMRTCellStyles({
|
|
188
188
|
column,
|
|
189
189
|
header,
|
|
@@ -209,8 +209,8 @@ export const MRT_TableHeadCell = <TData extends MRT_RowData>({
|
|
|
209
209
|
tableCellProps?.align === 'center'
|
|
210
210
|
? 'center'
|
|
211
211
|
: column.getCanResize()
|
|
212
|
-
|
|
213
|
-
|
|
212
|
+
? 'space-between'
|
|
213
|
+
: 'flex-start',
|
|
214
214
|
position: 'relative',
|
|
215
215
|
width: '100%',
|
|
216
216
|
}}
|
|
@@ -264,7 +264,9 @@ export const MRT_TableHeadCell = <TData extends MRT_RowData>({
|
|
|
264
264
|
{columnDefType !== 'group' && (
|
|
265
265
|
<Box
|
|
266
266
|
className="Mui-TableHeadCell-Content-Actions"
|
|
267
|
-
sx={{
|
|
267
|
+
sx={{
|
|
268
|
+
whiteSpace: 'nowrap',
|
|
269
|
+
}}
|
|
268
270
|
>
|
|
269
271
|
{showDragHandle && (
|
|
270
272
|
<MRT_TableHeadCellGrabHandle
|
|
@@ -52,10 +52,10 @@ export const MRT_TableHeadCellResizeHandle = <TData extends MRT_RowData>({
|
|
|
52
52
|
cursor: 'col-resize',
|
|
53
53
|
mr:
|
|
54
54
|
density === 'compact'
|
|
55
|
-
? '-
|
|
55
|
+
? '-8px'
|
|
56
56
|
: density === 'comfortable'
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
? '-16px'
|
|
58
|
+
: '-24px',
|
|
59
59
|
position: 'absolute',
|
|
60
60
|
px: '4px',
|
|
61
61
|
right: column.columnDef.columnDefType === 'display' ? '4px' : '0',
|
|
@@ -70,6 +70,7 @@ export const MRT_TableHeadCellResizeHandle = <TData extends MRT_RowData>({
|
|
|
70
70
|
borderWidth: '2px',
|
|
71
71
|
height: '24px',
|
|
72
72
|
touchAction: 'none',
|
|
73
|
+
transform: 'translateX(4px)',
|
|
73
74
|
transition: column.getIsResizing()
|
|
74
75
|
? undefined
|
|
75
76
|
: 'all 150ms ease-in-out',
|
|
@@ -37,12 +37,19 @@ export const MRT_TableHeadCellSortLabel = <TData extends MRT_RowData>({
|
|
|
37
37
|
isLoading || showSkeletons
|
|
38
38
|
? ''
|
|
39
39
|
: column.getIsSorted()
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
? column.getIsSorted() === 'desc'
|
|
41
|
+
? localization.sortedByColumnDesc.replace(
|
|
42
|
+
'{column}',
|
|
43
|
+
columnDef.header,
|
|
44
|
+
)
|
|
45
|
+
: localization.sortedByColumnAsc.replace('{column}', columnDef.header)
|
|
46
|
+
: column.getNextSortingOrder() === 'desc'
|
|
47
|
+
? localization.sortByColumnDesc.replace('{column}', columnDef.header)
|
|
48
|
+
: localization.sortByColumnAsc.replace('{column}', columnDef.header);
|
|
49
|
+
|
|
50
|
+
const direction = isSorted
|
|
51
|
+
? (column.getIsSorted() as 'asc' | 'desc')
|
|
52
|
+
: undefined;
|
|
46
53
|
|
|
47
54
|
return (
|
|
48
55
|
<Tooltip placement="top" title={sortTooltip}>
|
|
@@ -56,6 +63,7 @@ export const MRT_TableHeadCellSortLabel = <TData extends MRT_RowData>({
|
|
|
56
63
|
? (props) => (
|
|
57
64
|
<SyncAltIcon
|
|
58
65
|
{...props}
|
|
66
|
+
direction={direction}
|
|
59
67
|
style={{
|
|
60
68
|
transform: 'rotate(-90deg) scaleX(0.9) translateX(-1px)',
|
|
61
69
|
}}
|
|
@@ -65,9 +73,7 @@ export const MRT_TableHeadCellSortLabel = <TData extends MRT_RowData>({
|
|
|
65
73
|
}
|
|
66
74
|
active
|
|
67
75
|
aria-label={sortTooltip}
|
|
68
|
-
direction={
|
|
69
|
-
isSorted ? (column.getIsSorted() as 'asc' | 'desc') : undefined
|
|
70
|
-
}
|
|
76
|
+
direction={direction}
|
|
71
77
|
onClick={(e) => {
|
|
72
78
|
e.stopPropagation();
|
|
73
79
|
header.column.getToggleSortingHandler()?.(e);
|