material-react-table 0.20.0 → 0.21.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 -1
- package/dist/material-react-table.cjs.development.js +348 -398
- 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 +8 -12
- package/dist/material-react-table.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/MaterialReactTable.tsx +2 -2
- package/src/body/MRT_TableBody.tsx +9 -10
@@ -5,7 +5,7 @@ import { Tooltip, IconButton, Menu, MenuItem, Box, FormControlLabel, Switch, Typ
|
|
5
5
|
import { useDrop, useDrag, DndProvider } from 'react-dnd';
|
6
6
|
import { rankItem, rankings, compareItems } from '@tanstack/match-sorter-utils';
|
7
7
|
import { HTML5Backend } from 'react-dnd-html5-backend';
|
8
|
-
import {
|
8
|
+
import { useVirtual } from 'react-virtual';
|
9
9
|
|
10
10
|
function _extends() {
|
11
11
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
@@ -3018,23 +3018,19 @@ var MRT_TableBody = function MRT_TableBody(_ref) {
|
|
3018
3018
|
|
3019
3019
|
return enablePagination ? getRowModel().rows : getPrePaginationRowModel().rows;
|
3020
3020
|
}, [enableGlobalFilterRankedResults, enableGlobalFilterRankedResults && globalFilter || !enablePagination ? getPrePaginationRowModel().rows : getRowModel().rows, globalFilter]);
|
3021
|
-
var rowVirtualizer = enableRowVirtualization ?
|
3022
|
-
|
3023
|
-
|
3024
|
-
|
3025
|
-
|
3026
|
-
getScrollElement: function getScrollElement() {
|
3027
|
-
return tableContainerRef.current;
|
3028
|
-
},
|
3029
|
-
overscan: density === 'compact' ? 30 : 10
|
3021
|
+
var rowVirtualizer = enableRowVirtualization ? useVirtual(_extends({
|
3022
|
+
// estimateSize: () => (density === 'compact' ? 25 : 50),
|
3023
|
+
overscan: density === 'compact' ? 30 : 10,
|
3024
|
+
parentRef: tableContainerRef,
|
3025
|
+
size: rows.length
|
3030
3026
|
}, virtualizerProps)) : {};
|
3031
|
-
var virtualRows = enableRowVirtualization ? rowVirtualizer.
|
3027
|
+
var virtualRows = enableRowVirtualization ? rowVirtualizer.virtualItems : [];
|
3032
3028
|
var paddingTop = 0;
|
3033
3029
|
var paddingBottom = 0;
|
3034
3030
|
|
3035
3031
|
if (enableRowVirtualization) {
|
3036
3032
|
paddingTop = virtualRows.length > 0 ? virtualRows[0].start : 0;
|
3037
|
-
paddingBottom = virtualRows.length > 0 ? rowVirtualizer.
|
3033
|
+
paddingBottom = virtualRows.length > 0 ? rowVirtualizer.totalSize - virtualRows[virtualRows.length - 1].end : 0;
|
3038
3034
|
}
|
3039
3035
|
|
3040
3036
|
return React.createElement(TableBody, Object.assign({}, tableBodyProps), enableRowVirtualization && paddingTop > 0 && React.createElement("tr", null, React.createElement("td", {
|