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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.2.0",
2
+ "version": "1.2.2",
3
3
  "license": "MIT",
4
4
  "name": "material-react-table",
5
5
  "description": "A fully featured Material UI V5 implementation of TanStack React Table V8, written from the ground up in TypeScript.",
@@ -93,7 +93,7 @@
93
93
  "@emotion/styled": ">=11",
94
94
  "@mui/icons-material": ">=5",
95
95
  "@mui/material": ">=5",
96
- "react": ">=16.8"
96
+ "react": ">=17.0"
97
97
  },
98
98
  "dependencies": {
99
99
  "@tanstack/match-sorter-utils": "8.1.1",
@@ -10,12 +10,14 @@ interface Props {
10
10
  export const MRT_TableDetailPanel: FC<Props> = ({ row, table }) => {
11
11
  const {
12
12
  getVisibleLeafColumns,
13
+ getState,
13
14
  options: {
14
15
  muiTableBodyRowProps,
15
16
  muiTableDetailPanelProps,
16
17
  renderDetailPanel,
17
18
  },
18
19
  } = table;
20
+ const { isLoading } = getState();
19
21
 
20
22
  const tableRowProps =
21
23
  muiTableBodyRowProps instanceof Function
@@ -44,8 +46,8 @@ export const MRT_TableDetailPanel: FC<Props> = ({ row, table }) => {
44
46
  })}
45
47
  >
46
48
  {renderDetailPanel && (
47
- <Collapse in={row.getIsExpanded()}>
48
- {renderDetailPanel({ row, table })}
49
+ <Collapse in={row.getIsExpanded()} mountOnEnter unmountOnExit>
50
+ {!isLoading && renderDetailPanel({ row, table })}
49
51
  </Collapse>
50
52
  )}
51
53
  </TableCell>
@@ -20,7 +20,7 @@ export const MRT_ExpandAllButton: FC<Props> = ({ table }) => {
20
20
  },
21
21
  toggleAllRowsExpanded,
22
22
  } = table;
23
- const { density } = getState();
23
+ const { density, isLoading } = getState();
24
24
 
25
25
  const iconButtonProps =
26
26
  muiExpandAllButtonProps instanceof Function
@@ -37,7 +37,9 @@ export const MRT_ExpandAllButton: FC<Props> = ({ table }) => {
37
37
  <span>
38
38
  <IconButton
39
39
  aria-label={localization.expandAll}
40
- disabled={!getCanSomeRowsExpand() && !renderDetailPanel}
40
+ disabled={
41
+ isLoading || (!renderDetailPanel && !getCanSomeRowsExpand())
42
+ }
41
43
  onClick={() => toggleAllRowsExpanded(!getIsAllRowsExpanded())}
42
44
  {...iconButtonProps}
43
45
  sx={(theme) => ({
@@ -198,7 +198,7 @@ export const MRT_TableHeadCell: FC<Props> = ({ header, table }) => {
198
198
  display: 'flex',
199
199
  flexDirection:
200
200
  tableCellProps?.align === 'right' ? 'row-reverse' : 'row',
201
- overflow: 'hidden',
201
+ overflow: columnDefType === 'data' ? 'hidden' : undefined,
202
202
  pl:
203
203
  tableCellProps?.align === 'center'
204
204
  ? `${headerPL}rem`
@@ -208,12 +208,12 @@ export const MRT_TableHeadCell: FC<Props> = ({ header, table }) => {
208
208
  <Box
209
209
  className="Mui-TableHeadCell-Content-Wrapper"
210
210
  sx={{
211
- overflow: 'hidden',
211
+ overflow: columnDefType === 'data' ? 'hidden' : undefined,
212
212
  textOverflow: 'ellipsis',
213
213
  whiteSpace:
214
214
  (columnDef.header?.length ?? 0) < 20 ? 'nowrap' : 'normal',
215
215
  }}
216
- title={columnDef.header}
216
+ title={columnDefType === 'data' ? columnDef.header : undefined}
217
217
  >
218
218
  {headerElement}
219
219
  </Box>
@@ -19,7 +19,7 @@ export const MRT_SelectCheckbox: FC<Props> = ({ row, selectAll, table }) => {
19
19
  selectAllMode,
20
20
  },
21
21
  } = table;
22
- const { density } = getState();
22
+ const { density, isLoading } = getState();
23
23
 
24
24
  const checkboxProps = !row
25
25
  ? muiSelectAllCheckboxProps instanceof Function
@@ -35,6 +35,7 @@ export const MRT_SelectCheckbox: FC<Props> = ({ row, selectAll, table }) => {
35
35
  ? table.getIsAllPageRowsSelected()
36
36
  : table.getIsAllRowsSelected()
37
37
  : row?.getIsSelected(),
38
+ disabled: isLoading,
38
39
  inputProps: {
39
40
  'aria-label': selectAll
40
41
  ? localization.toggleSelectAll