material-react-table 0.38.2 → 0.38.3

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.
@@ -288,6 +288,7 @@ export declare type MaterialReactTableProps<TData extends Record<string, any> =
288
288
  enableRowSelection?: boolean | ((row: MRT_Row<TData>) => boolean);
289
289
  enableRowVirtualization?: boolean;
290
290
  enableSelectAll?: boolean;
291
+ enableStickyFooter?: boolean;
291
292
  enableStickyHeader?: boolean;
292
293
  enableTableFooter?: boolean;
293
294
  enableTableHead?: boolean;
package/dist/cjs/index.js CHANGED
@@ -263,7 +263,9 @@ const MRT_ExpandAllButton = ({ table }) => {
263
263
  : muiExpandAllButtonProps;
264
264
  return (React__default["default"].createElement(material.Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.expandAll },
265
265
  React__default["default"].createElement("span", null,
266
- React__default["default"].createElement(material.IconButton, Object.assign({ "aria-label": localization.expandAll, disabled: !getCanSomeRowsExpand() && !renderDetailPanel, onClick: () => toggleAllRowsExpanded(!getIsAllRowsExpanded()) }, iconButtonProps, { sx: Object.assign({ height: density === 'compact' ? '1.75rem' : '2.25rem', width: density === 'compact' ? '1.75rem' : '2.25rem', mt: density !== 'compact' ? '-0.25rem' : undefined }, iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) }),
266
+ React__default["default"].createElement(material.IconButton, Object.assign({ "aria-label": localization.expandAll, disabled: !getCanSomeRowsExpand() && !renderDetailPanel, onClick: () => toggleAllRowsExpanded(!getIsAllRowsExpanded()) }, iconButtonProps, { sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.25rem', width: density === 'compact' ? '1.75rem' : '2.25rem', mt: density !== 'compact' ? '-0.25rem' : undefined }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
267
+ ? iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx(theme)
268
+ : iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))) }),
267
269
  React__default["default"].createElement(KeyboardDoubleArrowDownIcon, { style: {
268
270
  transform: `rotate(${getIsAllRowsExpanded()
269
271
  ? -180
@@ -453,12 +455,14 @@ const MRT_ColumnPinningButtons = ({ column, table, }) => {
453
455
  const MRT_GrabHandleButton = ({ iconButtonProps, onDragEnd, onDragStart, table, }) => {
454
456
  const { options: { icons: { DragHandleIcon }, localization, }, } = table;
455
457
  return (React__default["default"].createElement(material.Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: localization.move },
456
- React__default["default"].createElement(material.IconButton, Object.assign({ disableRipple: true, draggable: "true", onDragStart: onDragStart, onDragEnd: onDragEnd, size: "small" }, iconButtonProps, { sx: Object.assign({ cursor: 'grab', m: 0, opacity: 0.5, p: '2px', transition: 'all 0.2s ease-in-out', '&:hover': {
458
+ React__default["default"].createElement(material.IconButton, Object.assign({ disableRipple: true, draggable: "true", onDragStart: onDragStart, onDragEnd: onDragEnd, size: "small" }, iconButtonProps, { sx: (theme) => (Object.assign({ cursor: 'grab', m: 0, opacity: 0.5, p: '2px', transition: 'all 0.2s ease-in-out', '&:hover': {
457
459
  backgroundColor: 'transparent',
458
460
  opacity: 1,
459
461
  }, '&:active': {
460
462
  cursor: 'grabbing',
461
- } }, iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) }),
463
+ } }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
464
+ ? iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx(theme)
465
+ : iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))) }),
462
466
  React__default["default"].createElement(DragHandleIcon, null))));
463
467
  };
464
468
 
@@ -1751,7 +1755,9 @@ const MRT_TableHeadRow = ({ headerGroup, table }) => {
1751
1755
  const tableRowProps = muiTableHeadRowProps instanceof Function
1752
1756
  ? muiTableHeadRowProps({ headerGroup, table })
1753
1757
  : muiTableHeadRowProps;
1754
- return (React__default["default"].createElement(material.TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ boxShadow: `4px 0 8px ${material.alpha(theme.palette.common.black, 0.1)}`, backgroundColor: material.lighten(theme.palette.background.default, 0.04) }, tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx)) }), headerGroup.headers.map((header, index) => (React__default["default"].createElement(MRT_TableHeadCell, { header: header, key: header.id || index, table: table })))));
1758
+ return (React__default["default"].createElement(material.TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ boxShadow: `4px 0 8px ${material.alpha(theme.palette.common.black, 0.1)}`, backgroundColor: material.lighten(theme.palette.background.default, 0.04) }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
1759
+ ? tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx(theme)
1760
+ : tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))) }), headerGroup.headers.map((header, index) => (React__default["default"].createElement(MRT_TableHeadCell, { header: header, key: header.id || index, table: table })))));
1755
1761
  };
1756
1762
 
1757
1763
  const MRT_TableHead = ({ table }) => {
@@ -2202,11 +2208,19 @@ const MRT_TableFooterRow = ({ footerGroup, table }) => {
2202
2208
  };
2203
2209
 
2204
2210
  const MRT_TableFooter = ({ table }) => {
2205
- const { getFooterGroups, options: { muiTableFooterProps }, } = table;
2211
+ const { getFooterGroups, getState, options: { enableStickyFooter, muiTableFooterProps }, } = table;
2212
+ const { isFullScreen } = getState();
2206
2213
  const tableFooterProps = muiTableFooterProps instanceof Function
2207
2214
  ? muiTableFooterProps({ table })
2208
2215
  : muiTableFooterProps;
2209
- return (React__default["default"].createElement(material.TableFooter, Object.assign({}, tableFooterProps), getFooterGroups().map((footerGroup) => (React__default["default"].createElement(MRT_TableFooterRow, { footerGroup: footerGroup, key: footerGroup.id, table: table })))));
2216
+ const stickFooter = (isFullScreen || enableStickyFooter) && enableStickyFooter !== false;
2217
+ return (React__default["default"].createElement(material.TableFooter, Object.assign({}, tableFooterProps, { sx: (theme) => (Object.assign({ position: stickFooter ? 'sticky' : undefined, bottom: stickFooter ? 0 : undefined, opacity: stickFooter ? 0.95 : undefined, outline: stickFooter
2218
+ ? theme.palette.mode === 'light'
2219
+ ? `1px solid ${theme.palette.grey[300]}`
2220
+ : `1px solid ${theme.palette.grey[700]}`
2221
+ : undefined }, ((tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx) instanceof Function
2222
+ ? tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx(theme)
2223
+ : tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx))) }), getFooterGroups().map((footerGroup) => (React__default["default"].createElement(MRT_TableFooterRow, { footerGroup: footerGroup, key: footerGroup.id, table: table })))));
2210
2224
  };
2211
2225
 
2212
2226
  const MRT_Table = ({ tableContainerRef, table }) => {
@@ -2273,7 +2287,9 @@ const MRT_TablePaper = ({ table }) => {
2273
2287
  const tablePaperProps = muiTablePaperProps instanceof Function
2274
2288
  ? muiTablePaperProps({ table })
2275
2289
  : muiTablePaperProps;
2276
- return (React__default["default"].createElement(material.Paper, Object.assign({ elevation: 2 }, tablePaperProps, { sx: Object.assign({ transition: 'all 0.2s ease-in-out' }, tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx), style: Object.assign(Object.assign({}, tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.style), { height: isFullScreen ? '100vh' : undefined, margin: isFullScreen ? '0' : undefined, maxHeight: isFullScreen ? '100vh' : undefined, maxWidth: isFullScreen ? '100vw' : undefined, padding: isFullScreen ? '0' : undefined, width: isFullScreen ? '100vw' : undefined }) }),
2290
+ return (React__default["default"].createElement(material.Paper, Object.assign({ elevation: 2 }, tablePaperProps, { sx: (theme) => (Object.assign({ transition: 'all 0.2s ease-in-out' }, ((tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx) instanceof Function
2291
+ ? tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx(theme)
2292
+ : tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx))), style: Object.assign(Object.assign({}, tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.style), { height: isFullScreen ? '100vh' : undefined, margin: isFullScreen ? '0' : undefined, maxHeight: isFullScreen ? '100vh' : undefined, maxWidth: isFullScreen ? '100vw' : undefined, padding: isFullScreen ? '0' : undefined, width: isFullScreen ? '100vw' : undefined }) }),
2277
2293
  enableTopToolbar && React__default["default"].createElement(MRT_TopToolbar, { table: table }),
2278
2294
  React__default["default"].createElement(MRT_TableContainer, { table: table }),
2279
2295
  enableBottomToolbar && React__default["default"].createElement(MRT_BottomToolbar, { table: table })));