material-react-table 1.4.0-beta.0 → 1.4.0-beta.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/README.md +2 -0
- package/dist/cjs/index.js +33 -23
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/MaterialReactTable.d.ts +2 -2
- package/dist/cjs/types/body/MRT_TableBodyCell.d.ts +1 -1
- package/dist/cjs/types/body/MRT_TableBodyRowGrabHandle.d.ts +1 -1
- package/dist/cjs/types/table/MRT_TableRoot.d.ts +1 -1
- package/dist/esm/material-react-table.esm.js +33 -23
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/types/MaterialReactTable.d.ts +2 -2
- package/dist/esm/types/body/MRT_TableBodyCell.d.ts +1 -1
- package/dist/esm/types/body/MRT_TableBodyRowGrabHandle.d.ts +1 -1
- package/dist/esm/types/table/MRT_TableRoot.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/package.json +1 -1
- package/src/MaterialReactTable.tsx +6 -2
- package/src/body/MRT_TableBody.tsx +8 -5
- package/src/body/MRT_TableBodyCell.tsx +1 -3
- package/src/body/MRT_TableBodyRow.tsx +2 -4
- package/src/body/MRT_TableBodyRowGrabHandle.tsx +1 -1
- package/src/body/MRT_TableDetailPanel.tsx +7 -1
- package/src/column.utils.ts +0 -1
- package/src/footer/MRT_TableFooter.tsx +2 -1
- package/src/footer/MRT_TableFooterCell.tsx +3 -1
- package/src/footer/MRT_TableFooterRow.tsx +10 -2
- package/src/head/MRT_TableHead.tsx +3 -3
- package/src/head/MRT_TableHeadCell.tsx +0 -2
- package/src/head/MRT_TableHeadCellFilterLabel.tsx +7 -0
- package/src/head/MRT_TableHeadRow.tsx +2 -3
- package/src/table/MRT_Table.tsx +1 -2
@@ -266,7 +266,7 @@ export type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit<ColumnD
|
|
266
266
|
* @example columnDefType: 'display'
|
267
267
|
*/
|
268
268
|
columnDefType?: 'data' | 'display' | 'group';
|
269
|
-
columnFilterModeOptions?: MRT_FilterOption
|
269
|
+
columnFilterModeOptions?: Array<LiteralUnion<string & MRT_FilterOption>> | null;
|
270
270
|
columns?: MRT_ColumnDef<TData>[];
|
271
271
|
enableClickToCopy?: boolean;
|
272
272
|
enableColumnActions?: boolean;
|
@@ -405,7 +405,7 @@ export type MRT_DisplayColumnIds = 'mrt-row-actions' | 'mrt-row-drag' | 'mrt-row
|
|
405
405
|
* @link https://www.material-react-table.com/docs/api/props
|
406
406
|
*/
|
407
407
|
export type MaterialReactTableProps<TData extends Record<string, any> = {}> = Omit<Partial<TableOptions<TData>>, 'columns' | 'data' | 'defaultColumn' | 'enableRowSelection' | 'expandRowsFn' | 'getRowId' | 'globalFilterFn' | 'initialState' | 'onStateChange' | 'state'> & {
|
408
|
-
columnFilterModeOptions?:
|
408
|
+
columnFilterModeOptions?: Array<LiteralUnion<string & MRT_FilterOption>> | null;
|
409
409
|
/**
|
410
410
|
* The columns to display in the table. `accessorKey`s or `accessorFn`s must match keys in the `data` prop.
|
411
411
|
*
|
@@ -5,7 +5,7 @@ interface Props {
|
|
5
5
|
enableHover?: boolean;
|
6
6
|
numRows: number;
|
7
7
|
rowIndex: number;
|
8
|
-
rowRef: RefObject<
|
8
|
+
rowRef: RefObject<HTMLTableRowElement>;
|
9
9
|
table: MRT_TableInstance;
|
10
10
|
}
|
11
11
|
export declare const MRT_TableBodyCell: FC<Props>;
|
@@ -2,7 +2,7 @@ import { FC, RefObject } from 'react';
|
|
2
2
|
import { MRT_Cell, MRT_TableInstance } from '..';
|
3
3
|
interface Props {
|
4
4
|
cell: MRT_Cell;
|
5
|
-
rowRef: RefObject<
|
5
|
+
rowRef: RefObject<HTMLTableRowElement>;
|
6
6
|
table: MRT_TableInstance;
|
7
7
|
}
|
8
8
|
export declare const MRT_TableBodyRowGrabHandle: FC<Props>;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import type { MRT_Cell, MRT_Column, MRT_ColumnDef, MRT_FilterOption, MRT_Row, MRT_TableInstance, MRT_TableState, MaterialReactTableProps, MRT_Localization } from '..';
|
3
3
|
export declare const MRT_TableRoot: <TData extends Record<string, any> = {}>(props: Omit<Partial<import("@tanstack/react-table").TableOptions<TData>>, "state" | "data" | "onStateChange" | "initialState" | "getRowId" | "columns" | "defaultColumn" | "globalFilterFn" | "enableRowSelection" | "expandRowsFn"> & {
|
4
|
-
columnFilterModeOptions?: (string
|
4
|
+
columnFilterModeOptions?: (string & MRT_FilterOption)[] | null | undefined;
|
5
5
|
columns: MRT_ColumnDef<TData>[];
|
6
6
|
data: TData[];
|
7
7
|
defaultColumn?: Partial<MRT_ColumnDef<TData>> | undefined;
|
@@ -249,7 +249,7 @@ const getCommonCellStyles = ({ column, header, table, tableCellProps, theme, })
|
|
249
249
|
? tableCellProps.sx(theme)
|
250
250
|
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx)), { flex: table.options.layoutMode === 'grid'
|
251
251
|
? `${column.getSize()} 0 auto`
|
252
|
-
: undefined,
|
252
|
+
: undefined, 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() }));
|
253
253
|
};
|
254
254
|
const MRT_DefaultColumn = {
|
255
255
|
minSize: 40,
|
@@ -1699,7 +1699,7 @@ const MRT_TableHeadCellFilterContainer = ({ header, table, }) => {
|
|
1699
1699
|
|
1700
1700
|
const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
|
1701
1701
|
var _a, _b, _c;
|
1702
|
-
const { options: { icons: { FilterAltIcon }, localization, }, } = table;
|
1702
|
+
const { options: { icons: { FilterAltIcon }, localization, }, refs: { filterInputRefs }, setShowFilters, } = table;
|
1703
1703
|
const { column } = header;
|
1704
1704
|
const { columnDef } = column;
|
1705
1705
|
const isRangeFilter = columnDef.filterVariant === 'range' ||
|
@@ -1721,6 +1721,12 @@ const MRT_TableHeadCellFilterLabel = ({ header, table }) => {
|
|
1721
1721
|
React.createElement(Box, { component: "span", sx: { flex: '0 0' } },
|
1722
1722
|
React.createElement(Tooltip, { arrow: true, placement: "top", title: filterTooltip },
|
1723
1723
|
React.createElement(IconButton, { disableRipple: true, onClick: (event) => {
|
1724
|
+
setShowFilters(true);
|
1725
|
+
queueMicrotask(() => {
|
1726
|
+
var _a, _b;
|
1727
|
+
(_a = filterInputRefs.current[`${column.id}-0`]) === null || _a === void 0 ? void 0 : _a.focus();
|
1728
|
+
(_b = filterInputRefs.current[`${column.id}-0`]) === null || _b === void 0 ? void 0 : _b.select();
|
1729
|
+
});
|
1724
1730
|
event.stopPropagation();
|
1725
1731
|
}, size: "small", sx: {
|
1726
1732
|
height: '12px',
|
@@ -1885,11 +1891,11 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
1885
1891
|
table,
|
1886
1892
|
})
|
1887
1893
|
: (_b = columnDef === null || columnDef === void 0 ? void 0 : columnDef.Header) !== null && _b !== void 0 ? _b : columnDef.header;
|
1888
|
-
return (React.createElement(TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left',
|
1894
|
+
return (React.createElement(TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: header.colSpan, onDragEnter: handleDragEnter, ref: (node) => {
|
1889
1895
|
if (node) {
|
1890
1896
|
tableHeadCellRefs.current[column.id] = node;
|
1891
1897
|
}
|
1892
|
-
}
|
1898
|
+
} }, tableCellProps, { sx: (theme) => (Object.assign(Object.assign({ flexDirection: layoutMode === 'grid' ? 'column' : undefined, fontWeight: 'bold', overflow: 'visible', p: density === 'compact'
|
1893
1899
|
? '0.5rem'
|
1894
1900
|
: density === 'comfortable'
|
1895
1901
|
? columnDefType === 'display'
|
@@ -1961,7 +1967,7 @@ const MRT_TableHeadRow = ({ headerGroup, table }) => {
|
|
1961
1967
|
const tableRowProps = muiTableHeadRowProps instanceof Function
|
1962
1968
|
? muiTableHeadRowProps({ headerGroup, table })
|
1963
1969
|
: muiTableHeadRowProps;
|
1964
|
-
return (React.createElement(TableRow, Object.assign({
|
1970
|
+
return (React.createElement(TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ backgroundColor: lighten(theme.palette.background.default, 0.04), boxShadow: `4px 0 8px ${alpha(theme.palette.common.black, 0.1)}`, display: layoutMode === 'grid' ? 'flex' : 'table-row', top: 0 }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
|
1965
1971
|
? tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx(theme)
|
1966
1972
|
: tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))) }), headerGroup.headers.map((header) => (React.createElement(MRT_TableHeadCell, { header: header, key: header.id, table: table })))));
|
1967
1973
|
};
|
@@ -1973,7 +1979,7 @@ const MRT_TableHead = ({ table }) => {
|
|
1973
1979
|
? muiTableHeadProps({ table })
|
1974
1980
|
: muiTableHeadProps;
|
1975
1981
|
const stickyHeader = enableStickyHeader || enableRowVirtualization || isFullScreen;
|
1976
|
-
return (React.createElement(TableHead, Object.assign({
|
1982
|
+
return (React.createElement(TableHead, Object.assign({}, tableHeadProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-row-group', opacity: 0.97, position: stickyHeader ? 'sticky' : 'relative', top: stickyHeader && layoutMode === 'grid' ? 0 : undefined, zIndex: stickyHeader ? 2 : undefined }, ((tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx) instanceof Function
|
1977
1983
|
? tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx(theme)
|
1978
1984
|
: tableHeadProps === null || tableHeadProps === void 0 ? void 0 : tableHeadProps.sx))) }), getHeaderGroups().map((headerGroup) => (React.createElement(MRT_TableHeadRow, { headerGroup: headerGroup, key: headerGroup.id, table: table })))));
|
1979
1985
|
};
|
@@ -2186,7 +2192,7 @@ const MRT_TableBodyCell = ({ cell, enableHover, numRows, rowIndex, rowRef, table
|
|
2186
2192
|
setHoveredColumn(columnDef.enableColumnOrdering !== false ? column : null);
|
2187
2193
|
}
|
2188
2194
|
};
|
2189
|
-
return (React.createElement(TableCell, Object.assign({
|
2195
|
+
return (React.createElement(TableCell, Object.assign({}, tableCellProps, { onDragEnter: handleDragEnter, onDoubleClick: handleDoubleClick, sx: (theme) => (Object.assign(Object.assign({ alignItems: layoutMode === 'grid' ? 'center' : undefined, cursor: isEditable && editingMode === 'cell' ? 'pointer' : 'inherit', overflow: 'hidden', p: density === 'compact'
|
2190
2196
|
? columnDefType === 'display'
|
2191
2197
|
? '0 0.5rem'
|
2192
2198
|
: '0.5rem'
|
@@ -2229,7 +2235,7 @@ const MRT_TableBodyCell = ({ cell, enableHover, numRows, rowIndex, rowRef, table
|
|
2229
2235
|
const Memo_MRT_TableBodyCell = memo(MRT_TableBodyCell, (prev, next) => next.cell === prev.cell);
|
2230
2236
|
|
2231
2237
|
const MRT_TableDetailPanel = ({ row, table }) => {
|
2232
|
-
const { getVisibleLeafColumns, getState, options: { muiTableBodyRowProps, muiTableDetailPanelProps, renderDetailPanel, }, } = table;
|
2238
|
+
const { getVisibleLeafColumns, getState, options: { layoutMode, muiTableBodyRowProps, muiTableDetailPanelProps, renderDetailPanel, }, } = table;
|
2233
2239
|
const { isLoading } = getState();
|
2234
2240
|
const tableRowProps = muiTableBodyRowProps instanceof Function
|
2235
2241
|
? muiTableBodyRowProps({ row, table })
|
@@ -2237,7 +2243,9 @@ const MRT_TableDetailPanel = ({ row, table }) => {
|
|
2237
2243
|
const tableCellProps = muiTableDetailPanelProps instanceof Function
|
2238
2244
|
? muiTableDetailPanelProps({ row, table })
|
2239
2245
|
: muiTableDetailPanelProps;
|
2240
|
-
return (React.createElement(TableRow, Object.assign({
|
2246
|
+
return (React.createElement(TableRow, Object.assign({ sx: {
|
2247
|
+
display: layoutMode === 'grid' ? 'flex' : 'table-row',
|
2248
|
+
} }, tableRowProps),
|
2241
2249
|
React.createElement(TableCell, Object.assign({ colSpan: getVisibleLeafColumns().length }, tableCellProps, { sx: (theme) => (Object.assign({ borderBottom: !row.getIsExpanded() ? 'none' : undefined, pb: row.getIsExpanded() ? '1rem' : 0, pt: row.getIsExpanded() ? '1rem' : 0, transition: 'all 150ms ease-in-out', width: `${table.getTotalSize()}px` }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
|
2242
2250
|
? tableCellProps.sx(theme)
|
2243
2251
|
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx))) }), renderDetailPanel && (React.createElement(Collapse, { in: row.getIsExpanded(), mountOnEnter: true, unmountOnExit: true }, !isLoading && renderDetailPanel({ row, table }))))));
|
@@ -2267,12 +2275,12 @@ const MRT_TableBodyRow = ({ numRows, row, rowIndex, table, virtualRow, }) => {
|
|
2267
2275
|
}
|
2268
2276
|
: undefined;
|
2269
2277
|
return (React.createElement(React.Fragment, null,
|
2270
|
-
React.createElement(TableRow, Object.assign({
|
2278
|
+
React.createElement(TableRow, Object.assign({ hover: true, onDragEnter: handleDragEnter, selected: row.getIsSelected(), ref: (node) => {
|
2271
2279
|
rowRef.current = node;
|
2272
2280
|
if (virtualRow === null || virtualRow === void 0 ? void 0 : virtualRow.measureRef) {
|
2273
2281
|
virtualRow.measureRef = node;
|
2274
2282
|
}
|
2275
|
-
}
|
2283
|
+
} }, tableRowProps, { sx: (theme) => (Object.assign(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, transition: 'all 150ms ease-in-out', '&:hover td': {
|
2276
2284
|
backgroundColor: (tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.hover) !== false && getIsSomeColumnsPinned()
|
2277
2285
|
? theme.palette.mode === 'dark'
|
2278
2286
|
? `${lighten(theme.palette.background.default, 0.12)}`
|
@@ -2302,7 +2310,7 @@ const MRT_TableBodyRow = ({ numRows, row, rowIndex, table, virtualRow, }) => {
|
|
2302
2310
|
const Memo_MRT_TableBodyRow = memo(MRT_TableBodyRow, (prev, next) => prev.row === next.row);
|
2303
2311
|
|
2304
2312
|
const MRT_TableBody = ({ table }) => {
|
2305
|
-
var _a, _b;
|
2313
|
+
var _a, _b, _c;
|
2306
2314
|
const { getRowModel, getPrePaginationRowModel, getState, options: { enableGlobalFilterRankedResults, enablePagination, enableRowVirtualization, layoutMode, localization, manualFiltering, manualSorting, memoMode, muiTableBodyProps, virtualizerInstanceRef, virtualizerProps, }, refs: { tableContainerRef, tablePaperRef }, } = table;
|
2307
2315
|
const { columnFilters, globalFilter, pagination, sorting } = getState();
|
2308
2316
|
const tableBodyProps = muiTableBodyProps instanceof Function
|
@@ -2369,14 +2377,14 @@ const MRT_TableBody = ({ table }) => {
|
|
2369
2377
|
// ? virtualizer.getTotalSize() - virtualRows[virtualRows.length - 1].end
|
2370
2378
|
// : 0;
|
2371
2379
|
// }
|
2372
|
-
return (React.createElement(TableBody, Object.assign({
|
2380
|
+
return (React.createElement(TableBody, Object.assign({}, tableBodyProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-row-group' }, ((tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx) instanceof Function
|
2373
2381
|
? tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx(theme)
|
2374
|
-
: tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx))) }), ((_a = tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.children) !== null && _a !== void 0 ? _a : !rows.length) ? (React.createElement("tr",
|
2375
|
-
React.createElement("td", { colSpan: table.getVisibleLeafColumns().length },
|
2382
|
+
: tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.sx))) }), ((_a = tableBodyProps === null || tableBodyProps === void 0 ? void 0 : tableBodyProps.children) !== null && _a !== void 0 ? _a : !rows.length) ? (React.createElement("tr", { style: { display: layoutMode === 'grid' ? 'grid' : 'table-row' } },
|
2383
|
+
React.createElement("td", { colSpan: table.getVisibleLeafColumns().length, style: { display: layoutMode === 'grid' ? 'grid' : 'table-cell' } },
|
2376
2384
|
React.createElement(Typography, { sx: {
|
2377
2385
|
color: 'text.secondary',
|
2378
2386
|
fontStyle: 'italic',
|
2379
|
-
maxWidth: `min(100vw, ${(_b = tablePaperRef.current) === null || _b === void 0 ? void 0 : _b.clientWidth}px)`,
|
2387
|
+
maxWidth: `min(100vw, ${(_c = (_b = tablePaperRef.current) === null || _b === void 0 ? void 0 : _b.clientWidth) !== null && _c !== void 0 ? _c : 360}px)`,
|
2380
2388
|
py: '2rem',
|
2381
2389
|
textAlign: 'center',
|
2382
2390
|
width: '100%',
|
@@ -2408,7 +2416,7 @@ const Memo_MRT_TableBody = memo(MRT_TableBody, (prev, next) => prev.table.option
|
|
2408
2416
|
|
2409
2417
|
const MRT_TableFooterCell = ({ footer, table }) => {
|
2410
2418
|
var _a, _b, _c;
|
2411
|
-
const { getState, options: { muiTableFooterCellProps }, } = table;
|
2419
|
+
const { getState, options: { layoutMode, muiTableFooterCellProps }, } = table;
|
2412
2420
|
const { density } = getState();
|
2413
2421
|
const { column } = footer;
|
2414
2422
|
const { columnDef } = column;
|
@@ -2420,7 +2428,7 @@ const MRT_TableFooterCell = ({ footer, table }) => {
|
|
2420
2428
|
? columnDef.muiTableFooterCellProps({ column, table })
|
2421
2429
|
: columnDef.muiTableFooterCellProps;
|
2422
2430
|
const tableCellProps = Object.assign(Object.assign({}, mTableFooterCellProps), mcTableFooterCellProps);
|
2423
|
-
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'
|
2431
|
+
return (React.createElement(TableCell, Object.assign({ align: columnDefType === 'group' ? 'center' : 'left', colSpan: footer.colSpan, variant: "head" }, tableCellProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table-cell', fontWeight: 'bold', justifyContent: columnDefType === 'group' ? 'center' : undefined, p: density === 'compact'
|
2424
2432
|
? '0.5rem'
|
2425
2433
|
: density === 'comfortable'
|
2426
2434
|
? '1rem'
|
@@ -2438,7 +2446,7 @@ const MRT_TableFooterCell = ({ footer, table }) => {
|
|
2438
2446
|
|
2439
2447
|
const MRT_TableFooterRow = ({ footerGroup, table }) => {
|
2440
2448
|
var _a;
|
2441
|
-
const { options: { muiTableFooterRowProps }, } = table;
|
2449
|
+
const { options: { layoutMode, muiTableFooterRowProps }, } = table;
|
2442
2450
|
// if no content in row, skip row
|
2443
2451
|
if (!((_a = footerGroup.headers) === null || _a === void 0 ? void 0 : _a.some((header) => (typeof header.column.columnDef.footer === 'string' &&
|
2444
2452
|
!!header.column.columnDef.footer) ||
|
@@ -2447,17 +2455,19 @@ const MRT_TableFooterRow = ({ footerGroup, table }) => {
|
|
2447
2455
|
const tableRowProps = muiTableFooterRowProps instanceof Function
|
2448
2456
|
? muiTableFooterRowProps({ footerGroup, table })
|
2449
2457
|
: muiTableFooterRowProps;
|
2450
|
-
return (React.createElement(TableRow, Object.assign({}, tableRowProps
|
2458
|
+
return (React.createElement(TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'flex' : 'table-row' }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
|
2459
|
+
? tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx(theme)
|
2460
|
+
: tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))) }), footerGroup.headers.map((footer) => (React.createElement(MRT_TableFooterCell, { footer: footer, key: footer.id, table: table })))));
|
2451
2461
|
};
|
2452
2462
|
|
2453
2463
|
const MRT_TableFooter = ({ table }) => {
|
2454
|
-
const { getFooterGroups, getState, options: { enableStickyFooter, muiTableFooterProps }, } = table;
|
2464
|
+
const { getFooterGroups, getState, options: { enableStickyFooter, layoutMode, muiTableFooterProps }, } = table;
|
2455
2465
|
const { isFullScreen } = getState();
|
2456
2466
|
const tableFooterProps = muiTableFooterProps instanceof Function
|
2457
2467
|
? muiTableFooterProps({ table })
|
2458
2468
|
: muiTableFooterProps;
|
2459
2469
|
const stickFooter = (isFullScreen || enableStickyFooter) && enableStickyFooter !== false;
|
2460
|
-
return (React.createElement(TableFooter, Object.assign({}, tableFooterProps, { sx: (theme) => (Object.assign({ backgroundColor: lighten(theme.palette.background.default, 0.06), bottom: stickFooter ? 0 : undefined, opacity: stickFooter ? 0.97 : undefined, outline: stickFooter
|
2470
|
+
return (React.createElement(TableFooter, Object.assign({}, tableFooterProps, { sx: (theme) => (Object.assign({ backgroundColor: lighten(theme.palette.background.default, 0.06), bottom: stickFooter ? 0 : undefined, display: layoutMode === 'grid' ? 'grid' : 'table-row-group', opacity: stickFooter ? 0.97 : undefined, outline: stickFooter
|
2461
2471
|
? theme.palette.mode === 'light'
|
2462
2472
|
? `1px solid ${theme.palette.grey[300]}`
|
2463
2473
|
: `1px solid ${theme.palette.grey[700]}`
|
@@ -2472,7 +2482,7 @@ const MRT_Table = ({ table }) => {
|
|
2472
2482
|
const tableProps = muiTableProps instanceof Function
|
2473
2483
|
? muiTableProps({ table })
|
2474
2484
|
: muiTableProps;
|
2475
|
-
return (React.createElement(Table, Object.assign({
|
2485
|
+
return (React.createElement(Table, Object.assign({ stickyHeader: enableStickyHeader || enableRowVirtualization || isFullScreen }, tableProps, { sx: (theme) => (Object.assign({ display: layoutMode === 'grid' ? 'grid' : 'table', tableLayout: enableColumnResizing || enableRowVirtualization ? 'fixed' : 'auto' }, ((tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx) instanceof Function
|
2476
2486
|
? tableProps.sx(theme)
|
2477
2487
|
: tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx))) }),
|
2478
2488
|
enableTableHead && React.createElement(MRT_TableHead, { table: table }),
|