material-react-table 0.27.0 → 0.28.0
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/MaterialReactTable.d.ts +2 -2
- package/dist/material-react-table.cjs.development.js +12 -8
- package/dist/material-react-table.cjs.development.js.map +1 -1
- package/dist/material-react-table.cjs.production.min.js +1 -1
- package/dist/material-react-table.cjs.production.min.js.map +1 -1
- package/dist/material-react-table.esm.js +12 -8
- package/dist/material-react-table.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/MaterialReactTable.tsx +4 -2
- package/src/body/MRT_TableBody.tsx +12 -12
|
@@ -3,7 +3,7 @@ import { ArrowRight, Cancel, CheckBox, ClearAll, Close, DensityLarge, DensityMed
|
|
|
3
3
|
import { filterFns, sortingFns, useReactTable, getCoreRowModel, getExpandedRowModel, getFacetedRowModel, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel } from '@tanstack/react-table';
|
|
4
4
|
import { Tooltip, IconButton, Menu, MenuItem, Box, FormControlLabel, Switch, Typography, Button, Divider, ListItemIcon, Checkbox, debounce, Collapse, TextField, InputAdornment, LinearProgress, TablePagination, Chip, Alert, AlertTitle, useMediaQuery, Toolbar, lighten, alpha, Grow, TableSortLabel, useTheme, TableCell, TableRow, TableHead, darken, Skeleton, TableBody, TableFooter, Table, TableContainer, Paper, Dialog } from '@mui/material';
|
|
5
5
|
import { rankItem, rankings, compareItems } from '@tanstack/match-sorter-utils';
|
|
6
|
-
import {
|
|
6
|
+
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
7
7
|
|
|
8
8
|
function _extends() {
|
|
9
9
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -3202,19 +3202,23 @@ var MRT_TableBody = function MRT_TableBody(_ref) {
|
|
|
3202
3202
|
|
|
3203
3203
|
return enablePagination ? getRowModel().rows : getPrePaginationRowModel().rows;
|
|
3204
3204
|
}, [enableGlobalFilterRankedResults, enableGlobalFilterRankedResults && globalFilter || !enablePagination ? getPrePaginationRowModel().rows : getRowModel().rows, globalFilter]);
|
|
3205
|
-
var rowVirtualizer = enableRowVirtualization ?
|
|
3206
|
-
|
|
3205
|
+
var rowVirtualizer = enableRowVirtualization ? useVirtualizer(_extends({
|
|
3206
|
+
estimateSize: function estimateSize() {
|
|
3207
|
+
return density === 'compact' ? 25 : 50;
|
|
3208
|
+
},
|
|
3207
3209
|
overscan: density === 'compact' ? 30 : 10,
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
+
getScrollElement: function getScrollElement() {
|
|
3211
|
+
return tableContainerRef.current;
|
|
3212
|
+
},
|
|
3213
|
+
count: rows.length
|
|
3210
3214
|
}, virtualizerProps)) : {};
|
|
3211
|
-
var virtualRows = enableRowVirtualization ? rowVirtualizer.
|
|
3215
|
+
var virtualRows = enableRowVirtualization ? rowVirtualizer.getVirtualItems() : [];
|
|
3212
3216
|
var paddingTop = 0;
|
|
3213
3217
|
var paddingBottom = 0;
|
|
3214
3218
|
|
|
3215
3219
|
if (enableRowVirtualization) {
|
|
3216
|
-
paddingTop = virtualRows.length
|
|
3217
|
-
paddingBottom = virtualRows.length
|
|
3220
|
+
paddingTop = !!virtualRows.length ? virtualRows[0].start : 0;
|
|
3221
|
+
paddingBottom = !!virtualRows.length ? rowVirtualizer.getTotalSize() - virtualRows[virtualRows.length - 1].end : 0;
|
|
3218
3222
|
}
|
|
3219
3223
|
|
|
3220
3224
|
return React.createElement(TableBody, Object.assign({}, tableBodyProps), enableRowVirtualization && paddingTop > 0 && React.createElement("tr", null, React.createElement("td", {
|