material-react-table 0.19.0 → 0.20.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.
@@ -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 { useVirtual } from 'react-virtual';
8
+ import { useVirtualizer } from '@tanstack/react-virtual';
9
9
 
10
10
  function _extends() {
11
11
  _extends = Object.assign ? Object.assign.bind() : function (target) {
@@ -3018,14 +3018,25 @@ 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 ? useVirtual(_extends({
3022
- overscan: density === 'compact' ? 20 : 10,
3023
- size: rows.length,
3024
- parentRef: tableContainerRef
3021
+ var rowVirtualizer = enableRowVirtualization ? useVirtualizer(_extends({
3022
+ count: rows.length,
3023
+ estimateSize: function estimateSize() {
3024
+ return density === 'compact' ? 25 : 50;
3025
+ },
3026
+ getScrollElement: function getScrollElement() {
3027
+ return tableContainerRef.current;
3028
+ },
3029
+ overscan: density === 'compact' ? 30 : 10
3025
3030
  }, virtualizerProps)) : {};
3026
- var virtualRows = rowVirtualizer.virtualItems;
3027
- var paddingTop = (virtualRows == null ? void 0 : virtualRows.length) > 0 ? virtualRows[0].start : 0;
3028
- var paddingBottom = (virtualRows == null ? void 0 : virtualRows.length) > 0 ? rowVirtualizer.totalSize - virtualRows[virtualRows.length - 1].end : 0;
3031
+ var virtualRows = enableRowVirtualization ? rowVirtualizer.getVirtualItems() : [];
3032
+ var paddingTop = 0;
3033
+ var paddingBottom = 0;
3034
+
3035
+ if (enableRowVirtualization) {
3036
+ paddingTop = virtualRows.length > 0 ? virtualRows[0].start : 0;
3037
+ paddingBottom = virtualRows.length > 0 ? rowVirtualizer.getTotalSize() - virtualRows[virtualRows.length - 1].end : 0;
3038
+ }
3039
+
3029
3040
  return React.createElement(TableBody, Object.assign({}, tableBodyProps), enableRowVirtualization && paddingTop > 0 && React.createElement("tr", null, React.createElement("td", {
3030
3041
  style: {
3031
3042
  height: paddingTop + "px"