material-react-table 1.15.0 → 1.15.1
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/README.md +2 -2
- package/dist/cjs/index.js +15 -18
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/material-react-table.esm.js +15 -18
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/package.json +27 -27
- package/src/body/MRT_TableBodyCell.tsx +1 -1
- package/src/body/MRT_TableBodyRow.tsx +7 -5
- package/src/buttons/MRT_ExpandAllButton.tsx +2 -3
- package/src/buttons/MRT_ExpandButton.tsx +2 -3
- package/src/buttons/MRT_FullScreenToggleButton.tsx +1 -1
- package/src/footer/MRT_TableFooterRow.tsx +2 -2
- package/src/head/MRT_TableHeadCellSortLabel.tsx +8 -9
- package/src/head/MRT_TableHeadRow.tsx +2 -2
@@ -541,9 +541,7 @@ const MRT_ExpandAllButton = ({ table }) => {
|
|
541
541
|
? muiExpandAllButtonProps({ table })
|
542
542
|
: muiExpandAllButtonProps;
|
543
543
|
const isAllRowsExpanded = getIsAllRowsExpanded();
|
544
|
-
return (jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (
|
545
|
-
? localization.collapseAll
|
546
|
-
: localization.expandAll, children: jsx("span", { children: jsx(IconButton, Object.assign({ "aria-label": localization.expandAll, disabled: isLoading || (!renderDetailPanel && !getCanSomeRowsExpand()), onClick: () => toggleAllRowsExpanded(!isAllRowsExpanded) }, 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
|
544
|
+
return (jsx(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : (isAllRowsExpanded ? localization.collapseAll : localization.expandAll), children: jsx("span", { children: jsx(IconButton, Object.assign({ "aria-label": localization.expandAll, disabled: isLoading || (!renderDetailPanel && !getCanSomeRowsExpand()), onClick: () => toggleAllRowsExpanded(!isAllRowsExpanded) }, 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
|
547
545
|
? iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx(theme)
|
548
546
|
: iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined, children: (_b = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.children) !== null && _b !== void 0 ? _b : (jsx(KeyboardDoubleArrowDownIcon, { style: {
|
549
547
|
transform: `rotate(${isAllRowsExpanded ? -180 : getIsSomeRowsExpanded() ? -90 : 0}deg)`,
|
@@ -566,9 +564,7 @@ const MRT_ExpandButton = ({ row, table, }) => {
|
|
566
564
|
row.toggleExpanded();
|
567
565
|
(_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
|
568
566
|
};
|
569
|
-
return (jsx(Tooltip, { arrow: true, disableHoverListener: !canExpand && !renderDetailPanel, enterDelay: 1000, enterNextDelay: 1000, title: (
|
570
|
-
? localization.collapse
|
571
|
-
: localization.expand, children: jsx("span", { children: jsx(IconButton, Object.assign({ "aria-label": localization.expand, disabled: !canExpand && !renderDetailPanel }, iconButtonProps, { onClick: handleToggleExpand, sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.25rem', width: density === 'compact' ? '1.75rem' : '2.25rem' }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
|
567
|
+
return (jsx(Tooltip, { arrow: true, disableHoverListener: !canExpand && !renderDetailPanel, enterDelay: 1000, enterNextDelay: 1000, title: (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.title) !== null && _a !== void 0 ? _a : (isExpanded ? localization.collapse : localization.expand), children: jsx("span", { children: jsx(IconButton, Object.assign({ "aria-label": localization.expand, disabled: !canExpand && !renderDetailPanel }, iconButtonProps, { onClick: handleToggleExpand, sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.25rem', width: density === 'compact' ? '1.75rem' : '2.25rem' }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
|
572
568
|
? iconButtonProps.sx(theme)
|
573
569
|
: iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))), title: undefined, children: (_b = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.children) !== null && _b !== void 0 ? _b : (jsx(ExpandMoreIcon, { style: {
|
574
570
|
transform: `rotate(${!canExpand && !renderDetailPanel ? -90 : isExpanded ? -180 : 0}deg)`,
|
@@ -1144,7 +1140,7 @@ const MRT_FullScreenToggleButton = (_a) => {
|
|
1144
1140
|
const handleToggleFullScreen = () => {
|
1145
1141
|
setIsFullScreen(!isFullScreen);
|
1146
1142
|
};
|
1147
|
-
return (jsx(Tooltip, { arrow: true, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.toggleFullScreen, children: jsx(IconButton, Object.assign({ "aria-label": localization.
|
1143
|
+
return (jsx(Tooltip, { arrow: true, title: (_b = rest === null || rest === void 0 ? void 0 : rest.title) !== null && _b !== void 0 ? _b : localization.toggleFullScreen, children: jsx(IconButton, Object.assign({ "aria-label": localization.toggleFullScreen, onClick: handleToggleFullScreen }, rest, { title: undefined, children: isFullScreen ? jsx(FullscreenExitIcon, {}) : jsx(FullscreenIcon, {}) })) }));
|
1148
1144
|
};
|
1149
1145
|
|
1150
1146
|
const MRT_ColumnPinningButtons = ({ column, table, }) => {
|
@@ -1944,14 +1940,15 @@ const MRT_TableHeadCellSortLabel = ({ header, table, tableCellProps, }) => {
|
|
1944
1940
|
const { column } = header;
|
1945
1941
|
const { columnDef } = column;
|
1946
1942
|
const { sorting } = getState();
|
1947
|
-
const
|
1948
|
-
|
1943
|
+
const sorted = column.getIsSorted();
|
1944
|
+
const sortTooltip = sorted
|
1945
|
+
? sorted === 'desc'
|
1949
1946
|
? localization.sortedByColumnDesc.replace('{column}', columnDef.header)
|
1950
1947
|
: localization.sortedByColumnAsc.replace('{column}', columnDef.header)
|
1951
|
-
:
|
1952
|
-
|
1953
|
-
|
1954
|
-
|
1948
|
+
: column.getNextSortingOrder() === 'desc'
|
1949
|
+
? localization.sortByColumnDesc.replace('{column}', columnDef.header)
|
1950
|
+
: localization.sortByColumnAsc.replace('{column}', columnDef.header);
|
1951
|
+
return (jsx(Tooltip, { arrow: true, placement: "top", title: sortTooltip, children: jsx(Badge, { badgeContent: sorting.length > 1 ? column.getSortIndex() + 1 : 0, overlap: "circular", children: jsx(TableSortLabel, { "aria-label": sortTooltip, active: !!sorted, direction: sorted ? sorted : undefined, sx: {
|
1955
1952
|
flex: '0 0',
|
1956
1953
|
width: '2.4ch',
|
1957
1954
|
transform: (tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.align) !== 'right'
|
@@ -2101,7 +2098,7 @@ const MRT_TableHeadRow = ({ headerGroup, table, virtualColumns, virtualPaddingLe
|
|
2101
2098
|
const header = virtualColumns
|
2102
2099
|
? headerGroup.headers[headerOrVirtualHeader.index]
|
2103
2100
|
: headerOrVirtualHeader;
|
2104
|
-
return (jsx(MRT_TableHeadCell, { header: header, table: table }, header.id));
|
2101
|
+
return header ? (jsx(MRT_TableHeadCell, { header: header, table: table }, header.id)) : null;
|
2105
2102
|
}), virtualPaddingRight ? (jsx("th", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })));
|
2106
2103
|
};
|
2107
2104
|
|
@@ -2442,7 +2439,7 @@ const MRT_TableBodyCell = ({ cell, measureElement, numRows, rowIndex, rowRef, ta
|
|
2442
2439
|
table,
|
2443
2440
|
theme,
|
2444
2441
|
tableCellProps,
|
2445
|
-
})), draggingBorders)), children: jsxs(Fragment, { children: [cell.getIsPlaceholder() ? ((_b = (_a = columnDef.PlaceholderCell) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table })) !== null && _b !== void 0 ? _b : null) :
|
2442
|
+
})), draggingBorders)), children: jsxs(Fragment, { children: [cell.getIsPlaceholder() ? ((_b = (_a = columnDef.PlaceholderCell) === null || _a === void 0 ? void 0 : _a.call(columnDef, { cell, column, row, table })) !== null && _b !== void 0 ? _b : null) : isLoading || showSkeletons ? (jsx(Skeleton, Object.assign({ animation: "wave", height: 20, width: skeletonWidth }, skeletonProps))) : enableRowNumbers &&
|
2446
2443
|
rowNumberMode === 'static' &&
|
2447
2444
|
column.id === 'mrt-row-numbers' ? (rowIndex + 1) : column.id === 'mrt-row-drag' ? (jsx(MRT_TableBodyRowGrabHandle, { cell: cell, rowRef: rowRef, table: table })) : columnDefType === 'display' &&
|
2448
2445
|
(column.id === 'mrt-row-select' ||
|
@@ -2532,12 +2529,12 @@ const MRT_TableBodyRow = ({ columnVirtualizer, measureElement, numRows, row, row
|
|
2532
2529
|
? cellOrVirtualCell
|
2533
2530
|
: undefined,
|
2534
2531
|
};
|
2535
|
-
return memoMode === 'cells' &&
|
2532
|
+
return cell ? (memoMode === 'cells' &&
|
2536
2533
|
cell.column.columnDef.columnDefType === 'data' &&
|
2537
2534
|
!draggingColumn &&
|
2538
2535
|
!draggingRow &&
|
2539
2536
|
(editingCell === null || editingCell === void 0 ? void 0 : editingCell.id) !== cell.id &&
|
2540
|
-
(editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) !== row.id ? (jsx(Memo_MRT_TableBodyCell, Object.assign({}, props), cell.id)) : (jsx(MRT_TableBodyCell, Object.assign({}, props), cell.id));
|
2537
|
+
(editingRow === null || editingRow === void 0 ? void 0 : editingRow.id) !== row.id ? (jsx(Memo_MRT_TableBodyCell, Object.assign({}, props), cell.id)) : (jsx(MRT_TableBodyCell, Object.assign({}, props), cell.id))) : null;
|
2541
2538
|
}), virtualPaddingRight ? (jsx("td", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })), renderDetailPanel && !row.getIsGrouped() && (jsx(MRT_TableDetailPanel, { parentRowRef: rowRef, row: row, rowIndex: rowIndex, table: table, virtualRow: virtualRow }))] }));
|
2542
2539
|
};
|
2543
2540
|
const Memo_MRT_TableBodyRow = memo(MRT_TableBodyRow, (prev, next) => prev.row === next.row && prev.rowIndex === next.rowIndex);
|
@@ -2694,7 +2691,7 @@ const MRT_TableFooterRow = ({ footerGroup, table, virtualColumns, virtualPadding
|
|
2694
2691
|
const footer = virtualColumns
|
2695
2692
|
? footerGroup.headers[footerOrVirtualFooter.index]
|
2696
2693
|
: footerOrVirtualFooter;
|
2697
|
-
return (jsx(MRT_TableFooterCell, { footer: footer, table: table }, footer.id));
|
2694
|
+
return footer ? (jsx(MRT_TableFooterCell, { footer: footer, table: table }, footer.id)) : null;
|
2698
2695
|
}), virtualPaddingRight ? (jsx("th", { style: { display: 'flex', width: virtualPaddingRight } })) : null] })));
|
2699
2696
|
};
|
2700
2697
|
|