material-react-table 0.20.0 → 0.21.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 { useVirtualizer } from '@tanstack/react-virtual';
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 ? 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
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.getVirtualItems() : [];
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.getTotalSize() - virtualRows[virtualRows.length - 1].end : 0;
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", {