material-react-table 1.2.0 → 1.2.2

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 CHANGED
@@ -333,13 +333,13 @@ const rankGlobalFuzzy = (rowA, rowB) => Math.max(...Object.values(rowB.columnFil
333
333
  const MRT_ExpandAllButton = ({ table }) => {
334
334
  var _a;
335
335
  const { getIsAllRowsExpanded, getIsSomeRowsExpanded, getCanSomeRowsExpand, getState, options: { icons: { KeyboardDoubleArrowDownIcon }, localization, muiExpandAllButtonProps, renderDetailPanel, }, toggleAllRowsExpanded, } = table;
336
- const { density } = getState();
336
+ const { density, isLoading } = getState();
337
337
  const iconButtonProps = muiExpandAllButtonProps instanceof Function
338
338
  ? muiExpandAllButtonProps({ table })
339
339
  : muiExpandAllButtonProps;
340
340
  return (React__default["default"].createElement(material.Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : localization.expandAll },
341
341
  React__default["default"].createElement("span", null,
342
- 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
342
+ React__default["default"].createElement(material.IconButton, Object.assign({ "aria-label": localization.expandAll, disabled: isLoading || (!renderDetailPanel && !getCanSomeRowsExpand()), 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
343
343
  ? iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx(theme)
344
344
  : iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined }),
345
345
  React__default["default"].createElement(KeyboardDoubleArrowDownIcon, { style: {
@@ -957,7 +957,7 @@ const MRT_ToggleRowActionMenuButton = ({ cell, row, table, }) => {
957
957
  const MRT_SelectCheckbox = ({ row, selectAll, table }) => {
958
958
  var _a;
959
959
  const { getState, options: { localization, enableMultiRowSelection, muiSelectCheckboxProps, muiSelectAllCheckboxProps, selectAllMode, }, } = table;
960
- const { density } = getState();
960
+ const { density, isLoading } = getState();
961
961
  const checkboxProps = !row
962
962
  ? muiSelectAllCheckboxProps instanceof Function
963
963
  ? muiSelectAllCheckboxProps({ table })
@@ -969,7 +969,7 @@ const MRT_SelectCheckbox = ({ row, selectAll, table }) => {
969
969
  ? selectAllMode === 'page'
970
970
  ? table.getIsAllPageRowsSelected()
971
971
  : table.getIsAllRowsSelected()
972
- : row === null || row === void 0 ? void 0 : row.getIsSelected(), inputProps: {
972
+ : row === null || row === void 0 ? void 0 : row.getIsSelected(), disabled: isLoading, inputProps: {
973
973
  'aria-label': selectAll
974
974
  ? localization.toggleSelectAll
975
975
  : localization.toggleSelectRow,
@@ -1859,16 +1859,16 @@ const MRT_TableHeadCell = ({ header, table }) => {
1859
1859
  : undefined,
1860
1860
  display: 'flex',
1861
1861
  flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
1862
- overflow: 'hidden',
1862
+ overflow: columnDefType === 'data' ? 'hidden' : undefined,
1863
1863
  pl: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center'
1864
1864
  ? `${headerPL}rem`
1865
1865
  : undefined,
1866
1866
  } },
1867
1867
  React__default["default"].createElement(material.Box, { className: "Mui-TableHeadCell-Content-Wrapper", sx: {
1868
- overflow: 'hidden',
1868
+ overflow: columnDefType === 'data' ? 'hidden' : undefined,
1869
1869
  textOverflow: 'ellipsis',
1870
1870
  whiteSpace: ((_d = (_c = columnDef.header) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) < 20 ? 'nowrap' : 'normal',
1871
- }, title: columnDef.header }, headerElement),
1871
+ }, title: columnDefType === 'data' ? columnDef.header : undefined }, headerElement),
1872
1872
  column.getCanSort() && (React__default["default"].createElement(MRT_TableHeadCellSortLabel, { header: header, table: table, tableCellProps: tableCellProps })),
1873
1873
  column.getCanFilter() && (React__default["default"].createElement(MRT_TableHeadCellFilterLabel, { header: header, table: table }))),
1874
1874
  columnDefType !== 'group' && (React__default["default"].createElement(material.Box, { className: "Mui-TableHeadCell-Content-Actions", sx: { whiteSpace: 'nowrap' } },
@@ -2151,7 +2151,8 @@ const MRT_TableBodyCell = ({ cell, enableHover, numRows, rowIndex, rowRef, table
2151
2151
  const Memo_MRT_TableBodyCell = React.memo(MRT_TableBodyCell, (prev, next) => next.cell === prev.cell);
2152
2152
 
2153
2153
  const MRT_TableDetailPanel = ({ row, table }) => {
2154
- const { getVisibleLeafColumns, options: { muiTableBodyRowProps, muiTableDetailPanelProps, renderDetailPanel, }, } = table;
2154
+ const { getVisibleLeafColumns, getState, options: { muiTableBodyRowProps, muiTableDetailPanelProps, renderDetailPanel, }, } = table;
2155
+ const { isLoading } = getState();
2155
2156
  const tableRowProps = muiTableBodyRowProps instanceof Function
2156
2157
  ? muiTableBodyRowProps({ row, table })
2157
2158
  : muiTableBodyRowProps;
@@ -2161,7 +2162,7 @@ const MRT_TableDetailPanel = ({ row, table }) => {
2161
2162
  return (React__default["default"].createElement(material.TableRow, Object.assign({}, tableRowProps),
2162
2163
  React__default["default"].createElement(material.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
2163
2164
  ? tableCellProps.sx(theme)
2164
- : tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx))) }), renderDetailPanel && (React__default["default"].createElement(material.Collapse, { in: row.getIsExpanded() }, renderDetailPanel({ row, table }))))));
2165
+ : tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx))) }), renderDetailPanel && (React__default["default"].createElement(material.Collapse, { in: row.getIsExpanded(), mountOnEnter: true, unmountOnExit: true }, !isLoading && renderDetailPanel({ row, table }))))));
2165
2166
  };
2166
2167
 
2167
2168
  const MRT_TableBodyRow = ({ numRows, row, rowIndex, table, virtualRow, }) => {