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 +10 -9
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/material-react-table.esm.js +10 -9
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/body/MRT_TableDetailPanel.tsx +4 -2
- package/src/buttons/MRT_ExpandAllButton.tsx +4 -2
- package/src/head/MRT_TableHeadCell.tsx +3 -3
- package/src/inputs/MRT_SelectCheckbox.tsx +2 -1
|
@@ -325,13 +325,13 @@ const rankGlobalFuzzy = (rowA, rowB) => Math.max(...Object.values(rowB.columnFil
|
|
|
325
325
|
const MRT_ExpandAllButton = ({ table }) => {
|
|
326
326
|
var _a;
|
|
327
327
|
const { getIsAllRowsExpanded, getIsSomeRowsExpanded, getCanSomeRowsExpand, getState, options: { icons: { KeyboardDoubleArrowDownIcon }, localization, muiExpandAllButtonProps, renderDetailPanel, }, toggleAllRowsExpanded, } = table;
|
|
328
|
-
const { density } = getState();
|
|
328
|
+
const { density, isLoading } = getState();
|
|
329
329
|
const iconButtonProps = muiExpandAllButtonProps instanceof Function
|
|
330
330
|
? muiExpandAllButtonProps({ table })
|
|
331
331
|
: muiExpandAllButtonProps;
|
|
332
332
|
return (React.createElement(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 },
|
|
333
333
|
React.createElement("span", null,
|
|
334
|
-
React.createElement(IconButton, Object.assign({ "aria-label": localization.expandAll, disabled: !
|
|
334
|
+
React.createElement(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
|
|
335
335
|
? iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx(theme)
|
|
336
336
|
: iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined }),
|
|
337
337
|
React.createElement(KeyboardDoubleArrowDownIcon, { style: {
|
|
@@ -949,7 +949,7 @@ const MRT_ToggleRowActionMenuButton = ({ cell, row, table, }) => {
|
|
|
949
949
|
const MRT_SelectCheckbox = ({ row, selectAll, table }) => {
|
|
950
950
|
var _a;
|
|
951
951
|
const { getState, options: { localization, enableMultiRowSelection, muiSelectCheckboxProps, muiSelectAllCheckboxProps, selectAllMode, }, } = table;
|
|
952
|
-
const { density } = getState();
|
|
952
|
+
const { density, isLoading } = getState();
|
|
953
953
|
const checkboxProps = !row
|
|
954
954
|
? muiSelectAllCheckboxProps instanceof Function
|
|
955
955
|
? muiSelectAllCheckboxProps({ table })
|
|
@@ -961,7 +961,7 @@ const MRT_SelectCheckbox = ({ row, selectAll, table }) => {
|
|
|
961
961
|
? selectAllMode === 'page'
|
|
962
962
|
? table.getIsAllPageRowsSelected()
|
|
963
963
|
: table.getIsAllRowsSelected()
|
|
964
|
-
: row === null || row === void 0 ? void 0 : row.getIsSelected(), inputProps: {
|
|
964
|
+
: row === null || row === void 0 ? void 0 : row.getIsSelected(), disabled: isLoading, inputProps: {
|
|
965
965
|
'aria-label': selectAll
|
|
966
966
|
? localization.toggleSelectAll
|
|
967
967
|
: localization.toggleSelectRow,
|
|
@@ -1851,16 +1851,16 @@ const MRT_TableHeadCell = ({ header, table }) => {
|
|
|
1851
1851
|
: undefined,
|
|
1852
1852
|
display: 'flex',
|
|
1853
1853
|
flexDirection: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'right' ? 'row-reverse' : 'row',
|
|
1854
|
-
overflow: 'hidden',
|
|
1854
|
+
overflow: columnDefType === 'data' ? 'hidden' : undefined,
|
|
1855
1855
|
pl: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) === 'center'
|
|
1856
1856
|
? `${headerPL}rem`
|
|
1857
1857
|
: undefined,
|
|
1858
1858
|
} },
|
|
1859
1859
|
React.createElement(Box, { className: "Mui-TableHeadCell-Content-Wrapper", sx: {
|
|
1860
|
-
overflow: 'hidden',
|
|
1860
|
+
overflow: columnDefType === 'data' ? 'hidden' : undefined,
|
|
1861
1861
|
textOverflow: 'ellipsis',
|
|
1862
1862
|
whiteSpace: ((_d = (_c = columnDef.header) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) < 20 ? 'nowrap' : 'normal',
|
|
1863
|
-
}, title: columnDef.header }, headerElement),
|
|
1863
|
+
}, title: columnDefType === 'data' ? columnDef.header : undefined }, headerElement),
|
|
1864
1864
|
column.getCanSort() && (React.createElement(MRT_TableHeadCellSortLabel, { header: header, table: table, tableCellProps: tableCellProps })),
|
|
1865
1865
|
column.getCanFilter() && (React.createElement(MRT_TableHeadCellFilterLabel, { header: header, table: table }))),
|
|
1866
1866
|
columnDefType !== 'group' && (React.createElement(Box, { className: "Mui-TableHeadCell-Content-Actions", sx: { whiteSpace: 'nowrap' } },
|
|
@@ -2143,7 +2143,8 @@ const MRT_TableBodyCell = ({ cell, enableHover, numRows, rowIndex, rowRef, table
|
|
|
2143
2143
|
const Memo_MRT_TableBodyCell = memo(MRT_TableBodyCell, (prev, next) => next.cell === prev.cell);
|
|
2144
2144
|
|
|
2145
2145
|
const MRT_TableDetailPanel = ({ row, table }) => {
|
|
2146
|
-
const { getVisibleLeafColumns, options: { muiTableBodyRowProps, muiTableDetailPanelProps, renderDetailPanel, }, } = table;
|
|
2146
|
+
const { getVisibleLeafColumns, getState, options: { muiTableBodyRowProps, muiTableDetailPanelProps, renderDetailPanel, }, } = table;
|
|
2147
|
+
const { isLoading } = getState();
|
|
2147
2148
|
const tableRowProps = muiTableBodyRowProps instanceof Function
|
|
2148
2149
|
? muiTableBodyRowProps({ row, table })
|
|
2149
2150
|
: muiTableBodyRowProps;
|
|
@@ -2153,7 +2154,7 @@ const MRT_TableDetailPanel = ({ row, table }) => {
|
|
|
2153
2154
|
return (React.createElement(TableRow, Object.assign({}, tableRowProps),
|
|
2154
2155
|
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
|
|
2155
2156
|
? tableCellProps.sx(theme)
|
|
2156
|
-
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx))) }), renderDetailPanel && (React.createElement(Collapse, { in: row.getIsExpanded() }, renderDetailPanel({ row, table }))))));
|
|
2157
|
+
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx))) }), renderDetailPanel && (React.createElement(Collapse, { in: row.getIsExpanded(), mountOnEnter: true, unmountOnExit: true }, !isLoading && renderDetailPanel({ row, table }))))));
|
|
2157
2158
|
};
|
|
2158
2159
|
|
|
2159
2160
|
const MRT_TableBodyRow = ({ numRows, row, rowIndex, table, virtualRow, }) => {
|