material-react-table 1.0.0-beta.3 → 1.0.0-beta.4
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/column.utils.d.ts +12 -1
- package/dist/cjs/index.js +96 -109
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/toolbar/MRT_ToolbarAlertBanner.d.ts +1 -1
- package/dist/esm/column.utils.d.ts +12 -1
- package/dist/esm/material-react-table.esm.js +97 -110
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/toolbar/MRT_ToolbarAlertBanner.d.ts +1 -1
- package/package.json +1 -1
- package/src/body/MRT_TableBodyCell.tsx +4 -52
- package/src/column.utils.ts +72 -0
- package/src/footer/MRT_TableFooterCell.tsx +5 -15
- package/src/head/MRT_TableHeadCell.tsx +9 -50
- package/src/toolbar/MRT_BottomToolbar.tsx +5 -2
- package/src/toolbar/MRT_ToolbarAlertBanner.tsx +7 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ColumnOrderState, GroupingState } from '@tanstack/react-table';
|
|
2
|
-
import {
|
|
2
|
+
import { TableCellProps, Theme } from '@mui/material';
|
|
3
|
+
import { MaterialReactTableProps, MRT_Column, MRT_ColumnDef, MRT_DefinedColumnDef, MRT_DisplayColumnIds, MRT_FilterOption, MRT_Header, MRT_TableInstance } from '.';
|
|
3
4
|
import { MRT_FilterFns } from './filterFns';
|
|
4
5
|
import { MRT_SortingFns } from './sortingFns';
|
|
5
6
|
export declare const getColumnId: <TData extends Record<string, any> = {}>(columnDef: MRT_ColumnDef<TData>) => string;
|
|
@@ -92,3 +93,13 @@ export declare const getLeadingDisplayColumnIds: <TData extends Record<string, a
|
|
|
92
93
|
export declare const getTrailingDisplayColumnIds: <TData extends Record<string, any> = {}>(props: MaterialReactTableProps<TData>) => (string | false | undefined)[];
|
|
93
94
|
export declare const getDefaultColumnOrderIds: <TData extends Record<string, any> = {}>(props: MaterialReactTableProps<TData>) => string[];
|
|
94
95
|
export declare const getDefaultColumnFilterFn: <TData extends Record<string, any> = {}>(columnDef: MRT_ColumnDef<TData>) => MRT_FilterOption;
|
|
96
|
+
export declare const getIsLastLeftPinnedColumn: (table: MRT_TableInstance, column: MRT_Column) => boolean;
|
|
97
|
+
export declare const getIsFirstRightPinnedColumn: (column: MRT_Column) => boolean;
|
|
98
|
+
export declare const getTotalRight: (table: MRT_TableInstance, column: MRT_Column) => number;
|
|
99
|
+
export declare const getCommonCellStyles: ({ column, header, table, tableCellProps, theme, }: {
|
|
100
|
+
column: MRT_Column;
|
|
101
|
+
header?: MRT_Header<{}> | undefined;
|
|
102
|
+
table: MRT_TableInstance;
|
|
103
|
+
tableCellProps: TableCellProps;
|
|
104
|
+
theme: Theme;
|
|
105
|
+
}) => any;
|
|
@@ -2,7 +2,7 @@ import React, { useMemo, useRef, useState, useCallback, Fragment, useEffect, mem
|
|
|
2
2
|
import { aggregationFns, filterFns, sortingFns, useReactTable, getCoreRowModel, getExpandedRowModel, getFacetedRowModel, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel } from '@tanstack/react-table';
|
|
3
3
|
import { ArrowRight, Cancel, CheckBox, ClearAll, Close, DensityLarge, DensityMedium, DensitySmall, DragHandle, DynamicFeed, Edit, ExpandLess, ExpandMore, FilterAlt, FilterAltOff, FilterList, FilterListOff, FullscreenExit, Fullscreen, KeyboardDoubleArrowDown, MoreHoriz, MoreVert, PushPin, RestartAlt, Save, Search, SearchOff, Sort, ViewColumn, VisibilityOff } from '@mui/icons-material';
|
|
4
4
|
import { rankItem, rankings, compareItems } from '@tanstack/match-sorter-utils';
|
|
5
|
-
import { Tooltip, IconButton, Menu, MenuItem, Box, FormControlLabel, Switch, Typography, Button, Divider, ListItemIcon, Checkbox, debounce, Collapse, TextField, InputAdornment, LinearProgress, TablePagination, Chip, Alert, AlertTitle, Fade,
|
|
5
|
+
import { Tooltip, IconButton, Menu, MenuItem, Box, alpha, lighten, FormControlLabel, Switch, Typography, Button, Divider, ListItemIcon, Checkbox, debounce, Collapse, TextField, InputAdornment, LinearProgress, TablePagination, Chip, Alert, AlertTitle, Fade, useMediaQuery, Toolbar, Grow, TableSortLabel, useTheme, TableCell, TableRow, TableHead, darken, Skeleton, TableBody, TableFooter, Table, TableContainer, Paper, Dialog, DialogTitle, DialogContent, Stack, DialogActions } from '@mui/material';
|
|
6
6
|
import { useVirtual } from 'react-virtual';
|
|
7
7
|
|
|
8
8
|
/******************************************************************************
|
|
@@ -587,6 +587,37 @@ const getDefaultColumnFilterFn = (columnDef) => {
|
|
|
587
587
|
return 'betweenInclusive';
|
|
588
588
|
return 'fuzzy';
|
|
589
589
|
};
|
|
590
|
+
const getIsLastLeftPinnedColumn = (table, column) => {
|
|
591
|
+
return (column.getIsPinned() === 'left' &&
|
|
592
|
+
table.getLeftLeafHeaders().length - 1 === column.getPinnedIndex());
|
|
593
|
+
};
|
|
594
|
+
const getIsFirstRightPinnedColumn = (column) => {
|
|
595
|
+
return column.getIsPinned() === 'right' && column.getPinnedIndex() === 0;
|
|
596
|
+
};
|
|
597
|
+
const getTotalRight = (table, column) => {
|
|
598
|
+
return ((table.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) * 160);
|
|
599
|
+
};
|
|
600
|
+
const getCommonCellStyles = ({ column, header, table, tableCellProps, theme, }) => {
|
|
601
|
+
var _a, _b, _c, _d;
|
|
602
|
+
return (Object.assign(Object.assign({ backgroundColor: column.getIsPinned() && column.columnDef.columnDefType !== 'group'
|
|
603
|
+
? alpha(lighten(theme.palette.background.default, 0.04), 0.95)
|
|
604
|
+
: 'inherit', backgroundImage: 'inherit', boxShadow: getIsLastLeftPinnedColumn(table, column)
|
|
605
|
+
? `-4px 0 8px -6px ${alpha(theme.palette.common.black, 0.2)} inset`
|
|
606
|
+
: getIsFirstRightPinnedColumn(column)
|
|
607
|
+
? `4px 0 8px -6px ${alpha(theme.palette.common.black, 0.2)} inset`
|
|
608
|
+
: undefined, left: column.getIsPinned() === 'left'
|
|
609
|
+
? `${column.getStart('left')}px`
|
|
610
|
+
: undefined, opacity: ((_a = table.getState().draggingColumn) === null || _a === void 0 ? void 0 : _a.id) === column.id ||
|
|
611
|
+
((_b = table.getState().hoveredColumn) === null || _b === void 0 ? void 0 : _b.id) === column.id
|
|
612
|
+
? 0.5
|
|
613
|
+
: 1, position: column.getIsPinned() && column.columnDef.columnDefType !== 'group'
|
|
614
|
+
? 'sticky'
|
|
615
|
+
: undefined, right: column.getIsPinned() === 'right'
|
|
616
|
+
? `${getTotalRight(table, column)}px`
|
|
617
|
+
: undefined, transition: `all ${column.getIsResizing() ? 0 : '0.2s'} ease-in-out` }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
|
|
618
|
+
? tableCellProps.sx(theme)
|
|
619
|
+
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx)), { maxWidth: `min(${column.getSize()}px, fit-content)`, minWidth: `max(${column.getSize()}px, ${(_c = column.columnDef.minSize) !== null && _c !== void 0 ? _c : 30}px)`, width: (_d = header === null || header === void 0 ? void 0 : header.getSize()) !== null && _d !== void 0 ? _d : column.getSize() }));
|
|
620
|
+
};
|
|
590
621
|
|
|
591
622
|
const MRT_ShowHideColumnsMenuItems = ({ allColumns, hoveredColumn, setHoveredColumn, column, isSubMenu, table, }) => {
|
|
592
623
|
var _a;
|
|
@@ -1082,7 +1113,7 @@ const MRT_TablePagination = ({ table, position }) => {
|
|
|
1082
1113
|
|
|
1083
1114
|
const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
|
|
1084
1115
|
var _a, _b;
|
|
1085
|
-
const { getPrePaginationRowModel, getSelectedRowModel, getState, options: { localization, muiToolbarAlertBannerProps, muiToolbarAlertBannerChipProps, }, } = table;
|
|
1116
|
+
const { getPrePaginationRowModel, getSelectedRowModel, getState, options: { localization, muiToolbarAlertBannerProps, muiToolbarAlertBannerChipProps, positionToolbarAlertBanner, }, } = table;
|
|
1086
1117
|
const { grouping, showAlertBanner } = getState();
|
|
1087
1118
|
const alertProps = muiToolbarAlertBannerProps instanceof Function
|
|
1088
1119
|
? muiToolbarAlertBannerProps({ table })
|
|
@@ -1100,7 +1131,11 @@ const MRT_ToolbarAlertBanner = ({ stackAlertBanner, table, }) => {
|
|
|
1100
1131
|
index > 0 ? localization.thenBy : '',
|
|
1101
1132
|
React.createElement(Chip, Object.assign({ label: table.getColumn(columnId).columnDef.header, onDelete: () => table.getColumn(columnId).toggleGrouping() }, chipProps))))))) : null;
|
|
1102
1133
|
return (React.createElement(Collapse, { in: showAlertBanner || !!selectMessage || !!groupedByMessage, timeout: stackAlertBanner ? 200 : 0 },
|
|
1103
|
-
React.createElement(Alert, Object.assign({ color: "info", icon: false }, alertProps, { sx: (theme) => (Object.assign({ borderRadius: 0, fontSize: '1rem', left: 0, p: 0, position: 'relative',
|
|
1134
|
+
React.createElement(Alert, Object.assign({ color: "info", icon: false }, alertProps, { sx: (theme) => (Object.assign({ borderRadius: 0, fontSize: '1rem', left: 0, p: 0, position: 'relative', mb: stackAlertBanner
|
|
1135
|
+
? 0
|
|
1136
|
+
: positionToolbarAlertBanner === 'bottom'
|
|
1137
|
+
? '-1rem'
|
|
1138
|
+
: undefined, right: 0, top: 0, width: '100%', zIndex: 2 }, ((alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx) instanceof Function
|
|
1104
1139
|
? alertProps.sx(theme)
|
|
1105
1140
|
: alertProps === null || alertProps === void 0 ? void 0 : alertProps.sx))) }),
|
|
1106
1141
|
(alertProps === null || alertProps === void 0 ? void 0 : alertProps.title) && React.createElement(AlertTitle, null, alertProps.title),
|
|
@@ -1294,10 +1329,10 @@ const MRT_BottomToolbar = ({ table }) => {
|
|
|
1294
1329
|
? toolbarProps.sx(theme)
|
|
1295
1330
|
: toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.sx))) }),
|
|
1296
1331
|
React.createElement(MRT_LinearProgressBar, { isTopToolbar: false, table: table }),
|
|
1297
|
-
positionToolbarAlertBanner === 'bottom' && (React.createElement(MRT_ToolbarAlertBanner, { table: table })),
|
|
1332
|
+
positionToolbarAlertBanner === 'bottom' && (React.createElement(MRT_ToolbarAlertBanner, { stackAlertBanner: stackAlertBanner, table: table })),
|
|
1298
1333
|
['both', 'bottom'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (React.createElement(MRT_ToolbarDropZone, { table: table })),
|
|
1299
1334
|
React.createElement(Box, { sx: {
|
|
1300
|
-
alignItems: '
|
|
1335
|
+
alignItems: 'center',
|
|
1301
1336
|
boxSizing: 'border-box',
|
|
1302
1337
|
display: 'flex',
|
|
1303
1338
|
justifyContent: 'space-between',
|
|
@@ -1680,7 +1715,7 @@ const MRT_TableHeadCellSortLabel = ({ header, table }) => {
|
|
|
1680
1715
|
const MRT_TableHeadCell = ({ header, table }) => {
|
|
1681
1716
|
var _a, _b, _c, _d;
|
|
1682
1717
|
const theme = useTheme();
|
|
1683
|
-
const { getState, options: { enableColumnActions, enableColumnDragging, enableColumnOrdering,
|
|
1718
|
+
const { getState, options: { enableColumnActions, enableColumnDragging, enableColumnOrdering, enableGrouping, enableMultiSort, muiTableHeadCellProps, }, setHoveredColumn, } = table;
|
|
1684
1719
|
const { density, draggingColumn, grouping, hoveredColumn, showColumnFilters, } = getState();
|
|
1685
1720
|
const { column } = header;
|
|
1686
1721
|
const { columnDef } = column;
|
|
@@ -1692,16 +1727,6 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
|
1692
1727
|
? columnDef.muiTableHeadCellProps({ column, table })
|
|
1693
1728
|
: columnDef.muiTableHeadCellProps;
|
|
1694
1729
|
const tableCellProps = Object.assign(Object.assign({}, mTableHeadCellProps), mcTableHeadCellProps);
|
|
1695
|
-
const getIsLastLeftPinnedColumn = () => {
|
|
1696
|
-
return (column.getIsPinned() === 'left' &&
|
|
1697
|
-
table.getLeftLeafHeaders().length - 1 === column.getPinnedIndex());
|
|
1698
|
-
};
|
|
1699
|
-
const getIsFirstRightPinnedColumn = () => {
|
|
1700
|
-
return column.getIsPinned() === 'right' && column.getPinnedIndex() === 0;
|
|
1701
|
-
};
|
|
1702
|
-
const getTotalRight = () => {
|
|
1703
|
-
return ((table.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) * 160);
|
|
1704
|
-
};
|
|
1705
1730
|
const handleDragEnter = (_e) => {
|
|
1706
1731
|
if (enableGrouping && (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === 'drop-zone') {
|
|
1707
1732
|
setHoveredColumn(null);
|
|
@@ -1730,44 +1755,33 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
|
1730
1755
|
})
|
|
1731
1756
|
: columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header)) !== null && _b !== void 0 ? _b : columnDef.header);
|
|
1732
1757
|
const tableHeadCellRef = React.useRef(null);
|
|
1733
|
-
return (React.createElement(TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: header.colSpan, onDragEnter: handleDragEnter, ref: tableHeadCellRef }, tableCellProps, { sx: (theme) => {
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
?
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
:
|
|
1740
|
-
?
|
|
1741
|
-
:
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
? 0.
|
|
1745
|
-
:
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
? '0.25rem'
|
|
1761
|
-
: density === 'comfortable'
|
|
1762
|
-
? '.75rem'
|
|
1763
|
-
: '1.25rem', right: column.getIsPinned() === 'right' ? `${getTotalRight()}px` : undefined, transition: `all ${enableColumnResizing ? 0 : '0.2s'} ease-in-out`, userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined, verticalAlign: 'top', zIndex: column.getIsResizing() || (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
|
|
1764
|
-
? 3
|
|
1765
|
-
: column.getIsPinned() && columnDefType !== 'group'
|
|
1766
|
-
? 2
|
|
1767
|
-
: 1 }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
|
|
1768
|
-
? tableCellProps.sx(theme)
|
|
1769
|
-
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx)), draggingBorders), { maxWidth: `min(${column.getSize()}px, fit-content)`, minWidth: `max(${column.getSize()}px, ${(_a = columnDef.minSize) !== null && _a !== void 0 ? _a : 30}px)`, width: header.getSize() }));
|
|
1770
|
-
} }),
|
|
1758
|
+
return (React.createElement(TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: header.colSpan, onDragEnter: handleDragEnter, ref: tableHeadCellRef }, tableCellProps, { sx: (theme) => (Object.assign(Object.assign({ fontWeight: 'bold', overflow: 'visible', p: density === 'compact'
|
|
1759
|
+
? '0.5rem'
|
|
1760
|
+
: density === 'comfortable'
|
|
1761
|
+
? columnDefType === 'display'
|
|
1762
|
+
? '0.75rem'
|
|
1763
|
+
: '1rem'
|
|
1764
|
+
: columnDefType === 'display'
|
|
1765
|
+
? '1rem 1.25rem'
|
|
1766
|
+
: '1.5rem', pb: columnDefType === 'display'
|
|
1767
|
+
? 0
|
|
1768
|
+
: showColumnFilters || density === 'compact'
|
|
1769
|
+
? '0.4rem'
|
|
1770
|
+
: '0.6rem', pt: columnDefType === 'group' || density === 'compact'
|
|
1771
|
+
? '0.25rem'
|
|
1772
|
+
: density === 'comfortable'
|
|
1773
|
+
? '.75rem'
|
|
1774
|
+
: '1.25rem', userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined, verticalAlign: 'top', zIndex: column.getIsResizing() || (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id
|
|
1775
|
+
? 3
|
|
1776
|
+
: column.getIsPinned() && columnDefType !== 'group'
|
|
1777
|
+
? 2
|
|
1778
|
+
: 1 }, getCommonCellStyles({
|
|
1779
|
+
column,
|
|
1780
|
+
header,
|
|
1781
|
+
table,
|
|
1782
|
+
tableCellProps,
|
|
1783
|
+
theme,
|
|
1784
|
+
})), draggingBorders)) }),
|
|
1771
1785
|
header.isPlaceholder ? null : (React.createElement(Box, { sx: {
|
|
1772
1786
|
alignItems: 'flex-start',
|
|
1773
1787
|
display: 'flex',
|
|
@@ -2015,16 +2029,6 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
|
|
|
2015
2029
|
});
|
|
2016
2030
|
}
|
|
2017
2031
|
};
|
|
2018
|
-
const getIsLastLeftPinnedColumn = () => {
|
|
2019
|
-
return (column.getIsPinned() === 'left' &&
|
|
2020
|
-
table.getLeftLeafHeaders().length - 1 === column.getPinnedIndex());
|
|
2021
|
-
};
|
|
2022
|
-
const getIsFirstRightPinnedColumn = () => {
|
|
2023
|
-
return column.getIsPinned() === 'right' && column.getPinnedIndex() === 0;
|
|
2024
|
-
};
|
|
2025
|
-
const getTotalRight = () => {
|
|
2026
|
-
return ((table.getRightLeafHeaders().length - 1 - column.getPinnedIndex()) * 160);
|
|
2027
|
-
};
|
|
2028
2032
|
const handleDragEnter = (e) => {
|
|
2029
2033
|
var _a;
|
|
2030
2034
|
(_a = tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.onDragEnter) === null || _a === void 0 ? void 0 : _a.call(tableCellProps, e);
|
|
@@ -2053,48 +2057,33 @@ const MRT_TableBodyCell = ({ cell, enableHover, rowIndex, rowRef, table, }) => {
|
|
|
2053
2057
|
: undefined,
|
|
2054
2058
|
}
|
|
2055
2059
|
: undefined;
|
|
2056
|
-
return (React.createElement(TableCell, Object.assign({}, tableCellProps, { onDragEnter: handleDragEnter, onDoubleClick: handleDoubleClick, sx: (theme) => {
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
? `-4px 0 8px -6px ${alpha(theme.palette.common.black, 0.2)} inset`
|
|
2062
|
-
: getIsFirstRightPinnedColumn()
|
|
2063
|
-
? `4px 0 8px -6px ${alpha(theme.palette.common.black, 0.2)} inset`
|
|
2064
|
-
: undefined, cursor: isEditable && editingMode === 'cell' ? 'pointer' : 'text', left: column.getIsPinned() === 'left'
|
|
2065
|
-
? `${column.getStart('left')}px`
|
|
2066
|
-
: undefined, opacity: (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id) === column.id || (hoveredColumn === null || hoveredColumn === void 0 ? void 0 : hoveredColumn.id) === column.id
|
|
2067
|
-
? 0.5
|
|
2068
|
-
: 1, overflow: 'hidden', p: density === 'compact'
|
|
2060
|
+
return (React.createElement(TableCell, Object.assign({}, tableCellProps, { onDragEnter: handleDragEnter, onDoubleClick: handleDoubleClick, sx: (theme) => (Object.assign(Object.assign({ cursor: isEditable && editingMode === 'cell' ? 'pointer' : 'text', overflow: 'hidden', p: density === 'compact'
|
|
2061
|
+
? columnDefType === 'display'
|
|
2062
|
+
? '0 0.5rem'
|
|
2063
|
+
: '0.5rem'
|
|
2064
|
+
: density === 'comfortable'
|
|
2069
2065
|
? columnDefType === 'display'
|
|
2070
|
-
? '0 0.
|
|
2071
|
-
: '
|
|
2072
|
-
:
|
|
2073
|
-
?
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
? `${lighten(theme.palette.background.default, 0.2)} !important`
|
|
2092
|
-
: `${darken(theme.palette.background.default, 0.1)} !important`
|
|
2093
|
-
: undefined,
|
|
2094
|
-
} }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
|
|
2095
|
-
? tableCellProps.sx(theme)
|
|
2096
|
-
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx)), draggingBorders), { maxWidth: `min(${column.getSize()}px, fit-content)`, minWidth: `max(${column.getSize()}px, ${(_a = columnDef.minSize) !== null && _a !== void 0 ? _a : 30}px)`, width: column.getSize() }));
|
|
2097
|
-
} }),
|
|
2066
|
+
? '0.5rem 0.75rem'
|
|
2067
|
+
: '1rem'
|
|
2068
|
+
: columnDefType === 'display'
|
|
2069
|
+
? '1rem 1.25rem'
|
|
2070
|
+
: '1.5rem', pl: column.id === 'mrt-row-expand'
|
|
2071
|
+
? `${row.depth +
|
|
2072
|
+
(density === 'compact'
|
|
2073
|
+
? 0.5
|
|
2074
|
+
: density === 'comfortable'
|
|
2075
|
+
? 0.75
|
|
2076
|
+
: 1.25)}rem`
|
|
2077
|
+
: 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': {
|
|
2078
|
+
backgroundColor: enableHover &&
|
|
2079
|
+
enableEditing &&
|
|
2080
|
+
columnDef.enableEditing !== false &&
|
|
2081
|
+
['table', 'cell'].includes(editingMode !== null && editingMode !== void 0 ? editingMode : '')
|
|
2082
|
+
? theme.palette.mode === 'dark'
|
|
2083
|
+
? `${lighten(theme.palette.background.default, 0.2)} !important`
|
|
2084
|
+
: `${darken(theme.palette.background.default, 0.1)} !important`
|
|
2085
|
+
: undefined,
|
|
2086
|
+
} }, getCommonCellStyles({ column, table, theme, tableCellProps })), draggingBorders)) }),
|
|
2098
2087
|
React.createElement(React.Fragment, null, cell.getIsPlaceholder() ? null : isLoading || showSkeletons ? (React.createElement(Skeleton, Object.assign({ animation: "wave", height: 20, width: skeletonWidth }, skeletonProps))) : enableRowNumbers &&
|
|
2099
2088
|
rowNumberMode === 'static' &&
|
|
2100
2089
|
column.id === 'mrt-row-numbers' ? (rowIndex + 1) : column.id === 'mrt-row-drag' ? (React.createElement(MRT_TableBodyRowGrabHandle, { cell: cell, rowRef: rowRef, table: table })) : columnDefType === 'display' &&
|
|
@@ -2247,7 +2236,7 @@ const MRT_TableBody = ({ table }) => {
|
|
|
2247
2236
|
|
|
2248
2237
|
const MRT_TableFooterCell = ({ footer, table }) => {
|
|
2249
2238
|
var _a, _b, _c;
|
|
2250
|
-
const { getState, options: { muiTableFooterCellProps
|
|
2239
|
+
const { getState, options: { muiTableFooterCellProps }, } = table;
|
|
2251
2240
|
const { density } = getState();
|
|
2252
2241
|
const { column } = footer;
|
|
2253
2242
|
const { columnDef } = column;
|
|
@@ -2259,13 +2248,11 @@ const MRT_TableFooterCell = ({ footer, table }) => {
|
|
|
2259
2248
|
? columnDef.muiTableFooterCellProps({ column, table })
|
|
2260
2249
|
: columnDef.muiTableFooterCellProps;
|
|
2261
2250
|
const tableCellProps = Object.assign(Object.assign({}, mTableFooterCellProps), mcTableFooterCellProps);
|
|
2262
|
-
return (React.createElement(TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: footer.colSpan, variant: "head" }, tableCellProps, { sx: (theme) => (Object.assign({
|
|
2251
|
+
return (React.createElement(TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: footer.colSpan, variant: "head" }, tableCellProps, { sx: (theme) => (Object.assign({ fontWeight: 'bold', p: density === 'compact'
|
|
2263
2252
|
? '0.5rem'
|
|
2264
2253
|
: density === 'comfortable'
|
|
2265
2254
|
? '1rem'
|
|
2266
|
-
: '1.5rem',
|
|
2267
|
-
? tableCellProps.sx(theme)
|
|
2268
|
-
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx))) }),
|
|
2255
|
+
: '1.5rem', verticalAlign: 'top' }, getCommonCellStyles({ column, table, theme, tableCellProps }))) }),
|
|
2269
2256
|
React.createElement(React.Fragment, null, footer.isPlaceholder
|
|
2270
2257
|
? null
|
|
2271
2258
|
: (_c = (_b = (columnDef.Footer instanceof Function
|