material-react-table 1.8.5 → 1.9.1
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/index.js +96 -60
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/_locales/sr-Cyrl-RS.d.ts +2 -0
- package/dist/cjs/types/_locales/sr-Latn-RS.d.ts +2 -0
- package/dist/cjs/types/body/MRT_TableBody.d.ts +1 -1
- package/dist/cjs/types/body/MRT_TableBodyCell.d.ts +2 -3
- package/dist/cjs/types/column.utils.d.ts +1 -1
- package/dist/cjs/types/filterFns.d.ts +1 -1
- package/dist/cjs/types/footer/MRT_TableFooterRow.d.ts +1 -1
- package/dist/cjs/types/sortingFns.d.ts +2 -2
- package/dist/esm/material-react-table.esm.js +95 -60
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/types/_locales/sr-Cyrl-RS.d.ts +2 -0
- package/dist/esm/types/_locales/sr-Latn-RS.d.ts +2 -0
- package/dist/esm/types/body/MRT_TableBody.d.ts +1 -1
- package/dist/esm/types/body/MRT_TableBodyCell.d.ts +2 -3
- package/dist/esm/types/column.utils.d.ts +1 -1
- package/dist/esm/types/filterFns.d.ts +1 -1
- package/dist/esm/types/footer/MRT_TableFooterRow.d.ts +1 -1
- package/dist/esm/types/sortingFns.d.ts +2 -2
- package/locales/sr-Cyrl-RS.d.ts +2 -0
- package/locales/sr-Cyrl-RS.esm.d.ts +2 -0
- package/locales/sr-Cyrl-RS.esm.js +94 -0
- package/locales/sr-Cyrl-RS.esm.js.map +1 -0
- package/locales/sr-Cyrl-RS.js +98 -0
- package/locales/sr-Cyrl-RS.js.map +1 -0
- package/locales/sr-Latn-RS.d.ts +2 -0
- package/locales/sr-Latn-RS.esm.d.ts +2 -0
- package/locales/sr-Latn-RS.esm.js +94 -0
- package/locales/sr-Latn-RS.esm.js.map +1 -0
- package/locales/sr-Latn-RS.js +98 -0
- package/locales/sr-Latn-RS.js.map +1 -0
- package/package.json +1 -1
- package/src/MaterialReactTable.tsx +1 -1
- package/src/_locales/sr-Cyrl-RS.ts +94 -0
- package/src/_locales/sr-Latn-RS.ts +94 -0
- package/src/body/MRT_TableBody.tsx +2 -2
- package/src/body/MRT_TableBodyCell.tsx +9 -14
- package/src/body/MRT_TableBodyRow.tsx +5 -6
- package/src/column.utils.ts +1 -1
- package/src/filterFns.ts +1 -1
- package/src/footer/MRT_TableFooterRow.tsx +1 -1
- package/src/head/MRT_TableHeadCell.tsx +4 -0
- package/src/head/MRT_TableHeadCellResizeHandle.tsx +1 -1
- package/src/head/MRT_TableHeadCellSortLabel.tsx +30 -22
- package/src/inputs/MRT_FilterTextField.tsx +1 -1
- package/src/menus/MRT_FilterOptionMenu.tsx +37 -15
- package/src/menus/MRT_RowActionMenu.tsx +1 -0
- package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +2 -1
- package/src/sortingFns.ts +3 -3
- package/src/table/MRT_Table.tsx +2 -2
- package/src/table/MRT_TableRoot.tsx +1 -1
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { VirtualItem, Virtualizer } from '@tanstack/react-virtual';
|
2
|
+
import { type VirtualItem, type Virtualizer } from '@tanstack/react-virtual';
|
3
3
|
import type { MRT_TableInstance } from '..';
|
4
4
|
interface Props {
|
5
5
|
columnVirtualizer?: Virtualizer<HTMLDivElement, HTMLTableCellElement>;
|
@@ -3,7 +3,6 @@ import type { VirtualItem } from '@tanstack/react-virtual';
|
|
3
3
|
import type { MRT_Cell, MRT_TableInstance } from '..';
|
4
4
|
interface Props {
|
5
5
|
cell: MRT_Cell;
|
6
|
-
enableHover?: boolean;
|
7
6
|
measureElement?: (element: HTMLTableCellElement) => void;
|
8
7
|
numRows: number;
|
9
8
|
rowIndex: number;
|
@@ -11,6 +10,6 @@ interface Props {
|
|
11
10
|
table: MRT_TableInstance;
|
12
11
|
virtualCell?: VirtualItem;
|
13
12
|
}
|
14
|
-
export declare const MRT_TableBodyCell: ({ cell,
|
15
|
-
export declare const Memo_MRT_TableBodyCell: React.MemoExoticComponent<({ cell,
|
13
|
+
export declare const MRT_TableBodyCell: ({ cell, measureElement, numRows, rowIndex, rowRef, table, virtualCell, }: Props) => JSX.Element;
|
14
|
+
export declare const Memo_MRT_TableBodyCell: React.MemoExoticComponent<({ cell, measureElement, numRows, rowIndex, rowRef, table, virtualCell, }: Props) => JSX.Element>;
|
16
15
|
export {};
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import type { Row } from '@tanstack/react-table';
|
2
1
|
import { MRT_AggregationFns } from './aggregationFns';
|
3
2
|
import { MRT_FilterFns } from './filterFns';
|
4
3
|
import { MRT_SortingFns } from './sortingFns';
|
4
|
+
import type { Row } from '@tanstack/react-table';
|
5
5
|
import type { TableCellProps } from '@mui/material/TableCell';
|
6
6
|
import type { Theme } from '@mui/material/styles';
|
7
7
|
import type { MaterialReactTableProps, MRT_Column, MRT_ColumnDef, MRT_ColumnOrderState, MRT_DefinedColumnDef, MRT_DisplayColumnIds, MRT_FilterOption, MRT_GroupingState, MRT_Header, MRT_TableInstance } from '.';
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { RankingInfo } from '@tanstack/match-sorter-utils';
|
2
|
-
import { Row } from '@tanstack/react-table';
|
2
|
+
import { type Row } from '@tanstack/react-table';
|
3
3
|
export declare const MRT_FilterFns: {
|
4
4
|
between: {
|
5
5
|
<TData extends Record<string, any> = {}>(row: Row<TData>, id: string, filterValues: [string | number, string | number]): boolean;
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { Row } from '@tanstack/react-table';
|
2
|
-
import { MRT_Row } from '.';
|
1
|
+
import { type Row } from '@tanstack/react-table';
|
2
|
+
import type { MRT_Row } from '.';
|
3
3
|
export declare const MRT_SortingFns: {
|
4
4
|
fuzzy: <TData extends Record<string, any> = {}>(rowA: Row<TData>, rowB: Row<TData>, columnId: string) => number;
|
5
5
|
alphanumeric: import("@tanstack/react-table").SortingFn<any>;
|
@@ -64,6 +64,7 @@ import Table from '@mui/material/Table';
|
|
64
64
|
import TableHead from '@mui/material/TableHead';
|
65
65
|
import TableRow from '@mui/material/TableRow';
|
66
66
|
import TableCell from '@mui/material/TableCell';
|
67
|
+
import Badge from '@mui/material/Badge';
|
67
68
|
import TableSortLabel from '@mui/material/TableSortLabel';
|
68
69
|
import TableBody from '@mui/material/TableBody';
|
69
70
|
import Skeleton from '@mui/material/Skeleton';
|
@@ -552,6 +553,9 @@ const mrtFilterOptions = (localization) => [
|
|
552
553
|
divider: false,
|
553
554
|
},
|
554
555
|
];
|
556
|
+
const rangeModes = ['between', 'betweenInclusive', 'inNumberRange'];
|
557
|
+
const emptyModes = ['empty', 'notEmpty'];
|
558
|
+
const arrModes = ['arrIncludesSome', 'arrIncludesAll', 'arrIncludes'];
|
555
559
|
const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, setFilterValue, table, }) => {
|
556
560
|
var _a, _b, _c, _d;
|
557
561
|
const { getState, options: { columnFilterModeOptions, globalFilterModeOptions, localization, renderColumnFilterModeMenuItems, renderGlobalFilterModeMenuItems, }, setColumnFilterFns, setGlobalFilterFn, } = table;
|
@@ -567,38 +571,62 @@ const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, setFilt
|
|
567
571
|
globalFilterModeOptions.includes(filterOption.option)) &&
|
568
572
|
['fuzzy', 'contains', 'startsWith'].includes(filterOption.option)), []);
|
569
573
|
const handleSelectFilterMode = (option) => {
|
570
|
-
|
574
|
+
var _a;
|
575
|
+
const prevFilterMode = (_a = columnDef === null || columnDef === void 0 ? void 0 : columnDef._filterFn) !== null && _a !== void 0 ? _a : '';
|
576
|
+
if (!header || !column) {
|
577
|
+
// global filter mode
|
578
|
+
setGlobalFilterFn(option);
|
579
|
+
}
|
580
|
+
else if (option !== prevFilterMode) {
|
581
|
+
// column filter mode
|
571
582
|
setColumnFilterFns((prev) => (Object.assign(Object.assign({}, prev), { [header.id]: option })));
|
572
|
-
|
573
|
-
|
583
|
+
// reset filter value and/or perform new filter render
|
584
|
+
if (emptyModes.includes(option)) {
|
585
|
+
// will now be empty/notEmpty filter mode
|
586
|
+
if (currentFilterValue !== ' ' &&
|
587
|
+
!emptyModes.includes(prevFilterMode)) {
|
574
588
|
column.setFilterValue(' ');
|
575
589
|
}
|
590
|
+
else if (currentFilterValue) {
|
591
|
+
column.setFilterValue(currentFilterValue); // perform new filter render
|
592
|
+
}
|
576
593
|
}
|
577
594
|
else if ((columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant) === 'multi-select' ||
|
578
|
-
|
595
|
+
arrModes.includes(option)) {
|
596
|
+
// will now be array filter mode
|
579
597
|
if (currentFilterValue instanceof String ||
|
580
598
|
(currentFilterValue === null || currentFilterValue === void 0 ? void 0 : currentFilterValue.length)) {
|
581
599
|
column.setFilterValue([]);
|
582
600
|
setFilterValue === null || setFilterValue === void 0 ? void 0 : setFilterValue([]);
|
583
601
|
}
|
602
|
+
else if (currentFilterValue) {
|
603
|
+
column.setFilterValue(currentFilterValue); // perform new filter render
|
604
|
+
}
|
584
605
|
}
|
585
606
|
else if ((columnDef === null || columnDef === void 0 ? void 0 : columnDef.filterVariant) === 'range' ||
|
586
|
-
|
587
|
-
|
607
|
+
rangeModes.includes(option)) {
|
608
|
+
// will now be range filter mode
|
609
|
+
if (!Array.isArray(currentFilterValue) ||
|
610
|
+
(!(currentFilterValue === null || currentFilterValue === void 0 ? void 0 : currentFilterValue.every((v) => v === '')) &&
|
611
|
+
!rangeModes.includes(prevFilterMode))) {
|
588
612
|
column.setFilterValue(['', '']);
|
589
613
|
setFilterValue === null || setFilterValue === void 0 ? void 0 : setFilterValue('');
|
590
614
|
}
|
615
|
+
else {
|
616
|
+
column.setFilterValue(currentFilterValue); // perform new filter render
|
617
|
+
}
|
591
618
|
}
|
592
619
|
else {
|
593
|
-
|
620
|
+
// will now be single value filter mode
|
621
|
+
if (Array.isArray(currentFilterValue)) {
|
594
622
|
column.setFilterValue('');
|
595
623
|
setFilterValue === null || setFilterValue === void 0 ? void 0 : setFilterValue('');
|
596
624
|
}
|
625
|
+
else {
|
626
|
+
column.setFilterValue(currentFilterValue); // perform new filter render
|
627
|
+
}
|
597
628
|
}
|
598
629
|
}
|
599
|
-
else {
|
600
|
-
setGlobalFilterFn(option);
|
601
|
-
}
|
602
630
|
setAnchorEl(null);
|
603
631
|
onSelect === null || onSelect === void 0 ? void 0 : onSelect();
|
604
632
|
};
|
@@ -715,8 +743,9 @@ const MRT_ShowHideColumnsMenuItems = ({ allColumns, hoveredColumn, setHoveredCol
|
|
715
743
|
justifyContent: 'flex-start',
|
716
744
|
my: 0,
|
717
745
|
opacity: isDragging ? 0.5 : 1,
|
746
|
+
outlineOffset: '-2px',
|
718
747
|
outline: isDragging
|
719
|
-
? `
|
748
|
+
? `2px dashed ${theme.palette.divider}`
|
720
749
|
: (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
|
721
750
|
? `2px dashed ${theme.palette.primary.main}`
|
722
751
|
: 'none',
|
@@ -969,7 +998,7 @@ const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
|
|
969
998
|
const MRT_RowActionMenu = ({ anchorEl, handleEdit, row, setAnchorEl, table, }) => {
|
970
999
|
const { getState, options: { icons: { EditIcon }, enableEditing, localization, renderRowActionMenuItems, }, } = table;
|
971
1000
|
const { density } = getState();
|
972
|
-
return (React.createElement(Menu, { anchorEl: anchorEl, open: !!anchorEl, onClose: () => setAnchorEl(null), MenuListProps: {
|
1001
|
+
return (React.createElement(Menu, { anchorEl: anchorEl, open: !!anchorEl, onClick: (event) => event.stopPropagation(), onClose: () => setAnchorEl(null), MenuListProps: {
|
973
1002
|
dense: density === 'compact',
|
974
1003
|
} },
|
975
1004
|
enableEditing instanceof Function
|
@@ -1566,7 +1595,7 @@ const MRT_FilterTextField = ({ header, rangeFilterIndex, table, }) => {
|
|
1566
1595
|
else if (isRangeFilter) {
|
1567
1596
|
setFilterValue('');
|
1568
1597
|
column.setFilterValue((old) => {
|
1569
|
-
const newFilterValues = old
|
1598
|
+
const newFilterValues = (Array.isArray(old) && old) || ['', ''];
|
1570
1599
|
newFilterValues[rangeFilterIndex] = undefined;
|
1571
1600
|
return newFilterValues;
|
1572
1601
|
});
|
@@ -1832,7 +1861,7 @@ const MRT_TableHeadCellResizeHandle = ({ header, table }) => {
|
|
1832
1861
|
column.resetSize();
|
1833
1862
|
}, onMouseDown: header.getResizeHandler(), onTouchStart: header.getResizeHandler(), sx: (theme) => ({
|
1834
1863
|
cursor: 'col-resize',
|
1835
|
-
mr: density === 'compact' ? '-0.
|
1864
|
+
mr: density === 'compact' ? '-0.75rem' : '-1rem',
|
1836
1865
|
position: 'absolute',
|
1837
1866
|
right: '1px',
|
1838
1867
|
px: '4px',
|
@@ -1859,28 +1888,30 @@ const MRT_TableHeadCellResizeHandle = ({ header, table }) => {
|
|
1859
1888
|
};
|
1860
1889
|
|
1861
1890
|
const MRT_TableHeadCellSortLabel = ({ header, table, tableCellProps, }) => {
|
1862
|
-
const { options: { icons: { ArrowDownwardIcon }, localization, }, } = table;
|
1891
|
+
const { getState, options: { icons: { ArrowDownwardIcon }, localization, }, } = table;
|
1863
1892
|
const { column } = header;
|
1864
1893
|
const { columnDef } = column;
|
1894
|
+
const { sorting } = getState();
|
1865
1895
|
const sortTooltip = column.getIsSorted()
|
1866
1896
|
? column.getIsSorted() === 'desc'
|
1867
1897
|
? localization.sortedByColumnDesc.replace('{column}', columnDef.header)
|
1868
1898
|
: localization.sortedByColumnAsc.replace('{column}', columnDef.header)
|
1869
1899
|
: localization.unsorted;
|
1870
1900
|
return (React.createElement(Tooltip, { arrow: true, placement: "top", title: sortTooltip },
|
1871
|
-
React.createElement(
|
1872
|
-
|
1873
|
-
|
1874
|
-
|
1875
|
-
|
1876
|
-
|
1877
|
-
|
1878
|
-
|
1879
|
-
|
1880
|
-
|
1881
|
-
|
1882
|
-
|
1883
|
-
|
1901
|
+
React.createElement(Badge, { badgeContent: sorting.length > 1 ? column.getSortIndex() + 1 : 0, overlap: "circular" },
|
1902
|
+
React.createElement(TableSortLabel, { "aria-label": sortTooltip, active: !!column.getIsSorted(), direction: column.getIsSorted()
|
1903
|
+
? column.getIsSorted()
|
1904
|
+
: undefined, sx: {
|
1905
|
+
flex: '0 0',
|
1906
|
+
width: '2.4ch',
|
1907
|
+
transform: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) !== 'right'
|
1908
|
+
? 'translateX(-0.5ch)'
|
1909
|
+
: undefined,
|
1910
|
+
}, IconComponent: ArrowDownwardIcon, onClick: (e) => {
|
1911
|
+
var _a;
|
1912
|
+
e.stopPropagation();
|
1913
|
+
(_a = header.column.getToggleSortingHandler()) === null || _a === void 0 ? void 0 : _a(e);
|
1914
|
+
} }))));
|
1884
1915
|
};
|
1885
1916
|
|
1886
1917
|
const MRT_TableHeadCell = ({ header, table }) => {
|
@@ -2000,9 +2031,13 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
2000
2031
|
: undefined,
|
2001
2032
|
} },
|
2002
2033
|
React.createElement(Box, { className: "Mui-TableHeadCell-Content-Wrapper", sx: {
|
2034
|
+
minWidth: '5ch',
|
2003
2035
|
overflow: columnDefType === 'data' ? 'hidden' : undefined,
|
2004
2036
|
textOverflow: 'ellipsis',
|
2005
2037
|
whiteSpace: ((_d = (_c = columnDef.header) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) < 20 ? 'nowrap' : 'normal',
|
2038
|
+
'&:hover': {
|
2039
|
+
textOverflow: 'clip',
|
2040
|
+
},
|
2006
2041
|
}, title: columnDefType === 'data' ? columnDef.header : undefined }, headerElement),
|
2007
2042
|
column.getCanSort() && (React.createElement(MRT_TableHeadCellSortLabel, { header: header, table: table, tableCellProps: tableCellProps })),
|
2008
2043
|
column.getCanFilter() && (React.createElement(MRT_TableHeadCellFilterLabel, { header: header, table: table }))),
|
@@ -2244,7 +2279,7 @@ const MRT_TableBodyCellValue = ({ cell, table }) => {
|
|
2244
2279
|
return React.createElement(React.Fragment, null, renderedCellValue);
|
2245
2280
|
};
|
2246
2281
|
|
2247
|
-
const MRT_TableBodyCell = ({ cell,
|
2282
|
+
const MRT_TableBodyCell = ({ cell, measureElement, numRows, rowIndex, rowRef, table, virtualCell, }) => {
|
2248
2283
|
var _a, _b, _c, _d;
|
2249
2284
|
const theme = useTheme();
|
2250
2285
|
const { getState, options: { editingMode, enableClickToCopy, enableColumnOrdering, enableEditing, enableGrouping, enableRowNumbers, layoutMode, muiTableBodyCellProps, muiTableBodyCellSkeletonProps, rowNumberMode, }, refs: { editInputRefs }, setEditingCell, setHoveredColumn, } = table;
|
@@ -2358,37 +2393,36 @@ const MRT_TableBodyCell = ({ cell, enableHover, measureElement, numRows, rowInde
|
|
2358
2393
|
? 0.75
|
2359
2394
|
: 1.25)}rem`
|
2360
2395
|
: undefined, textOverflow: columnDefType !== 'display' ? 'ellipsis' : undefined, whiteSpace: density === 'compact' ? 'nowrap' : 'normal', zIndex: (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id ? 2 : column.getIsPinned() ? 1 : 0, '&:hover': {
|
2361
|
-
|
2362
|
-
|
2363
|
-
['table', 'cell'].includes(editingMode !== null && editingMode !== void 0 ? editingMode : '')
|
2364
|
-
? theme.palette.mode === 'dark'
|
2365
|
-
? `${lighten(theme.palette.background.default, 0.2)} !important`
|
2366
|
-
: `${darken(theme.palette.background.default, 0.1)} !important`
|
2396
|
+
outline: ['table', 'cell'].includes(editingMode !== null && editingMode !== void 0 ? editingMode : '')
|
2397
|
+
? `1px solid ${theme.palette.text.secondary}`
|
2367
2398
|
: undefined,
|
2399
|
+
outlineOffset: '-1px',
|
2400
|
+
textOverflow: 'clip',
|
2368
2401
|
} }, getCommonCellStyles({
|
2369
2402
|
column,
|
2370
2403
|
table,
|
2371
2404
|
theme,
|
2372
2405
|
tableCellProps,
|
2373
2406
|
})), draggingBorders)) }),
|
2374
|
-
React.createElement(React.Fragment, null,
|
2375
|
-
|
2376
|
-
|
2377
|
-
|
2378
|
-
column.id === 'mrt-row-
|
2379
|
-
|
2380
|
-
|
2381
|
-
|
2382
|
-
|
2383
|
-
|
2384
|
-
|
2385
|
-
|
2386
|
-
|
2387
|
-
|
2388
|
-
|
2389
|
-
|
2390
|
-
|
2391
|
-
|
2407
|
+
React.createElement(React.Fragment, null,
|
2408
|
+
cell.getIsPlaceholder() ? ((_b = (_a = columnDef.PlaceholderCell) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table })) !== null && _b !== void 0 ? _b : null) : isLoading || showSkeletons ? (React.createElement(Skeleton, Object.assign({ animation: "wave", height: 20, width: skeletonWidth }, skeletonProps))) : enableRowNumbers &&
|
2409
|
+
rowNumberMode === 'static' &&
|
2410
|
+
column.id === 'mrt-row-numbers' ? (rowIndex + 1) : column.id === 'mrt-row-drag' ? (React.createElement(MRT_TableBodyRowGrabHandle, { cell: cell, rowRef: rowRef, table: table })) : columnDefType === 'display' &&
|
2411
|
+
(column.id === 'mrt-row-select' ||
|
2412
|
+
column.id === 'mrt-row-expand' ||
|
2413
|
+
!row.getIsGrouped()) ? ((_c = columnDef.Cell) === null || _c === void 0 ? void 0 : _c.call(columnDef, {
|
2414
|
+
cell,
|
2415
|
+
renderedCellValue: cell.renderValue(),
|
2416
|
+
column,
|
2417
|
+
row,
|
2418
|
+
table,
|
2419
|
+
})) : isEditing ? (React.createElement(MRT_EditCellTextField, { cell: cell, table: table })) : (enableClickToCopy || columnDef.enableClickToCopy) &&
|
2420
|
+
columnDef.enableClickToCopy !== false ? (React.createElement(MRT_CopyButton, { cell: cell, table: table },
|
2421
|
+
React.createElement(MRT_TableBodyCellValue, { cell: cell, table: table }))) : (React.createElement(MRT_TableBodyCellValue, { cell: cell, table: table })),
|
2422
|
+
cell.getIsGrouped() && !columnDef.GroupedCell && (React.createElement(React.Fragment, null,
|
2423
|
+
" (", (_d = row.subRows) === null || _d === void 0 ? void 0 :
|
2424
|
+
_d.length,
|
2425
|
+
")")))));
|
2392
2426
|
};
|
2393
2427
|
const Memo_MRT_TableBodyCell = memo(MRT_TableBodyCell, (prev, next) => next.cell === prev.cell);
|
2394
2428
|
|
@@ -2419,7 +2453,7 @@ const MRT_TableDetailPanel = ({ parentRowRef, row, table, virtualRow, }) => {
|
|
2419
2453
|
};
|
2420
2454
|
|
2421
2455
|
const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, row, rowIndex, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, virtualRow, }) => {
|
2422
|
-
const {
|
2456
|
+
const { getState, options: { enableRowOrdering, layoutMode, memoMode, muiTableBodyRowProps, renderDetailPanel, }, setHoveredRow, } = table;
|
2423
2457
|
const { draggingColumn, draggingRow, editingCell, editingRow, hoveredRow } = getState();
|
2424
2458
|
const tableRowProps = muiTableBodyRowProps instanceof Function
|
2425
2459
|
? muiTableBodyRowProps({ row, table })
|
@@ -2431,7 +2465,7 @@ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, row, row
|
|
2431
2465
|
};
|
2432
2466
|
const rowRef = useRef(null);
|
2433
2467
|
return (React.createElement(React.Fragment, null,
|
2434
|
-
React.createElement(TableRow, Object.assign({ "data-index": virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.index,
|
2468
|
+
React.createElement(TableRow, Object.assign({ "data-index": virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.index, onDragEnter: handleDragEnter, selected: row.getIsSelected(), ref: (node) => {
|
2435
2469
|
if (node) {
|
2436
2470
|
rowRef.current = node;
|
2437
2471
|
measureElement === null || measureElement === void 0 ? void 0 : measureElement(node);
|
@@ -2439,10 +2473,12 @@ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, row, row
|
|
2439
2473
|
} }, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: lighten(theme.palette.background.default, 0.06), display: layoutMode === 'grid' ? 'flex' : 'table-row', opacity: (draggingRow === null || draggingRow === void 0 ? void 0 : draggingRow.id) === row.id || (hoveredRow === null || hoveredRow === void 0 ? void 0 : hoveredRow.id) === row.id ? 0.5 : 1, position: virtualRow ? 'absolute' : undefined, top: virtualRow ? 0 : undefined, transform: virtualRow
|
2440
2474
|
? `translateY(${virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.start}px)`
|
2441
2475
|
: undefined, transition: virtualRow ? 'none' : 'all 150ms ease-in-out', width: '100%', '&:hover td': {
|
2442
|
-
backgroundColor: (tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.hover) !== false
|
2443
|
-
?
|
2444
|
-
? `${
|
2445
|
-
:
|
2476
|
+
backgroundColor: (tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.hover) !== false
|
2477
|
+
? row.getIsSelected()
|
2478
|
+
? `${alpha(theme.palette.primary.main, 0.2)}`
|
2479
|
+
: theme.palette.mode === 'dark'
|
2480
|
+
? `${lighten(theme.palette.background.default, 0.12)}`
|
2481
|
+
: `${darken(theme.palette.background.default, 0.05)}`
|
2446
2482
|
: undefined,
|
2447
2483
|
} }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
|
2448
2484
|
? tableRowProps.sx(theme)
|
@@ -2454,7 +2490,6 @@ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, row, row
|
|
2454
2490
|
: cellOrVirtualCell;
|
2455
2491
|
const props = {
|
2456
2492
|
cell,
|
2457
|
-
enableHover: (tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.hover) !== false,
|
2458
2493
|
key: cell.id,
|
2459
2494
|
measureElement: columnVirtualizer === null || columnVirtualizer === void 0 ? void 0 : columnVirtualizer.measureElement,
|
2460
2495
|
numRows,
|