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;
@@ -255,7 +255,9 @@ const MRT_ExpandAllButton = ({ table }) => {
255
255
  : muiExpandAllButtonProps;
256
256
  return (React.createElement(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.expandAll },
257
257
  React.createElement("span", null,
258
- React.createElement(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) }),
258
+ React.createElement(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
259
+ ? iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx(theme)
260
+ : iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))) }),
259
261
  React.createElement(KeyboardDoubleArrowDownIcon, { style: {
260
262
  transform: `rotate(${getIsAllRowsExpanded()
261
263
  ? -180
@@ -445,12 +447,14 @@ const MRT_ColumnPinningButtons = ({ column, table, }) => {
445
447
  const MRT_GrabHandleButton = ({ iconButtonProps, onDragEnd, onDragStart, table, }) => {
446
448
  const { options: { icons: { DragHandleIcon }, localization, }, } = table;
447
449
  return (React.createElement(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: localization.move },
448
- React.createElement(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': {
450
+ React.createElement(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': {
449
451
  backgroundColor: 'transparent',
450
452
  opacity: 1,
451
453
  }, '&:active': {
452
454
  cursor: 'grabbing',
453
- } }, iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) }),
455
+ } }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
456
+ ? iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx(theme)
457
+ : iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))) }),
454
458
  React.createElement(DragHandleIcon, null))));
455
459
  };
456
460
 
@@ -1743,7 +1747,9 @@ const MRT_TableHeadRow = ({ headerGroup, table }) => {
1743
1747
  const tableRowProps = muiTableHeadRowProps instanceof Function
1744
1748
  ? muiTableHeadRowProps({ headerGroup, table })
1745
1749
  : muiTableHeadRowProps;
1746
- return (React.createElement(TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ boxShadow: `4px 0 8px ${alpha(theme.palette.common.black, 0.1)}`, backgroundColor: lighten(theme.palette.background.default, 0.04) }, tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx)) }), headerGroup.headers.map((header, index) => (React.createElement(MRT_TableHeadCell, { header: header, key: header.id || index, table: table })))));
1750
+ return (React.createElement(TableRow, Object.assign({}, tableRowProps, { sx: (theme) => (Object.assign({ boxShadow: `4px 0 8px ${alpha(theme.palette.common.black, 0.1)}`, backgroundColor: lighten(theme.palette.background.default, 0.04) }, ((tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx) instanceof Function
1751
+ ? tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx(theme)
1752
+ : tableRowProps === null || tableRowProps === void 0 ? void 0 : tableRowProps.sx))) }), headerGroup.headers.map((header, index) => (React.createElement(MRT_TableHeadCell, { header: header, key: header.id || index, table: table })))));
1747
1753
  };
1748
1754
 
1749
1755
  const MRT_TableHead = ({ table }) => {
@@ -2194,11 +2200,19 @@ const MRT_TableFooterRow = ({ footerGroup, table }) => {
2194
2200
  };
2195
2201
 
2196
2202
  const MRT_TableFooter = ({ table }) => {
2197
- const { getFooterGroups, options: { muiTableFooterProps }, } = table;
2203
+ const { getFooterGroups, getState, options: { enableStickyFooter, muiTableFooterProps }, } = table;
2204
+ const { isFullScreen } = getState();
2198
2205
  const tableFooterProps = muiTableFooterProps instanceof Function
2199
2206
  ? muiTableFooterProps({ table })
2200
2207
  : muiTableFooterProps;
2201
- return (React.createElement(TableFooter, Object.assign({}, tableFooterProps), getFooterGroups().map((footerGroup) => (React.createElement(MRT_TableFooterRow, { footerGroup: footerGroup, key: footerGroup.id, table: table })))));
2208
+ const stickFooter = (isFullScreen || enableStickyFooter) && enableStickyFooter !== false;
2209
+ return (React.createElement(TableFooter, Object.assign({}, tableFooterProps, { sx: (theme) => (Object.assign({ position: stickFooter ? 'sticky' : undefined, bottom: stickFooter ? 0 : undefined, opacity: stickFooter ? 0.95 : undefined, outline: stickFooter
2210
+ ? theme.palette.mode === 'light'
2211
+ ? `1px solid ${theme.palette.grey[300]}`
2212
+ : `1px solid ${theme.palette.grey[700]}`
2213
+ : undefined }, ((tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx) instanceof Function
2214
+ ? tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx(theme)
2215
+ : tableFooterProps === null || tableFooterProps === void 0 ? void 0 : tableFooterProps.sx))) }), getFooterGroups().map((footerGroup) => (React.createElement(MRT_TableFooterRow, { footerGroup: footerGroup, key: footerGroup.id, table: table })))));
2202
2216
  };
2203
2217
 
2204
2218
  const MRT_Table = ({ tableContainerRef, table }) => {
@@ -2265,7 +2279,9 @@ const MRT_TablePaper = ({ table }) => {
2265
2279
  const tablePaperProps = muiTablePaperProps instanceof Function
2266
2280
  ? muiTablePaperProps({ table })
2267
2281
  : muiTablePaperProps;
2268
- return (React.createElement(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 }) }),
2282
+ return (React.createElement(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
2283
+ ? tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx(theme)
2284
+ : 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 }) }),
2269
2285
  enableTopToolbar && React.createElement(MRT_TopToolbar, { table: table }),
2270
2286
  React.createElement(MRT_TableContainer, { table: table }),
2271
2287
  enableBottomToolbar && React.createElement(MRT_BottomToolbar, { table: table })));