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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ChangeEvent, Dispatch, DragEvent, FC, FocusEvent, ReactNode, SetStateAction } from 'react';
|
|
2
2
|
import type { AlertProps, ButtonProps, CheckboxProps, IconButtonProps, LinearProgressProps, PaperProps, SkeletonProps, TableBodyProps, TableCellProps, TableContainerProps, TableFooterProps, TableHeadProps, TablePaginationProps, TableProps, TableRowProps, TextFieldProps, ToolbarProps } from '@mui/material';
|
|
3
3
|
import type { Cell, Column, ColumnDef, FilterFn, Header, HeaderGroup, OnChangeFn, Row, SortingFn, Table, TableOptions, TableState } from '@tanstack/react-table';
|
|
4
|
-
import type {
|
|
4
|
+
import type { VirtualizerOptions } from '@tanstack/react-virtual';
|
|
5
5
|
import { MRT_Localization } from './localization';
|
|
6
6
|
import { MRT_Icons } from './icons';
|
|
7
7
|
import { MRT_FilterFns } from './filtersFns';
|
|
@@ -463,7 +463,7 @@ export declare type MaterialReactTableProps<TData extends Record<string, any> =
|
|
|
463
463
|
selectAllMode?: 'all' | 'page';
|
|
464
464
|
state?: Partial<MRT_TableState<TData>>;
|
|
465
465
|
tableId?: string;
|
|
466
|
-
virtualizerProps?: Partial<VirtualizerOptions<HTMLDivElement>>;
|
|
466
|
+
virtualizerProps?: Partial<VirtualizerOptions<HTMLDivElement, HTMLTableRowElement>>;
|
|
467
467
|
};
|
|
468
468
|
declare const _default: <TData extends Record<string, any> = {}>({ autoResetExpanded, columnResizeMode, defaultColumn, editingMode, enableColumnActions, enableColumnFilterChangeMode, enableColumnFilters, enableColumnOrdering, enableColumnResizing, enableDensityToggle, enableExpandAll, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableGlobalFilterChangeMode, enableGlobalFilterRankedResults, enableGrouping, enableHiding, enableMultiRowSelection, enableMultiSort, enablePagination, enablePinning, enableRowSelection, enableSelectAll, enableSorting, enableStickyHeader, enableTableFooter, enableTableHead, enableToolbarBottom, enableToolbarInternalActions, enableToolbarTop, icons, localization, positionActionsColumn, positionExpandColumn, positionGlobalFilter, positionPagination, positionToolbarAlertBanner, rowNumberMode, selectAllMode, ...rest }: MaterialReactTableProps<TData>) => JSX.Element;
|
|
469
469
|
export default _default;
|
|
@@ -10,7 +10,7 @@ var iconsMaterial = require('@mui/icons-material');
|
|
|
10
10
|
var reactTable = require('@tanstack/react-table');
|
|
11
11
|
var material = require('@mui/material');
|
|
12
12
|
var matchSorterUtils = require('@tanstack/match-sorter-utils');
|
|
13
|
-
var reactVirtual = require('react-virtual');
|
|
13
|
+
var reactVirtual = require('@tanstack/react-virtual');
|
|
14
14
|
|
|
15
15
|
function _extends() {
|
|
16
16
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -3209,19 +3209,23 @@ var MRT_TableBody = function MRT_TableBody(_ref) {
|
|
|
3209
3209
|
|
|
3210
3210
|
return enablePagination ? getRowModel().rows : getPrePaginationRowModel().rows;
|
|
3211
3211
|
}, [enableGlobalFilterRankedResults, enableGlobalFilterRankedResults && globalFilter || !enablePagination ? getPrePaginationRowModel().rows : getRowModel().rows, globalFilter]);
|
|
3212
|
-
var rowVirtualizer = enableRowVirtualization ? reactVirtual.
|
|
3213
|
-
|
|
3212
|
+
var rowVirtualizer = enableRowVirtualization ? reactVirtual.useVirtualizer(_extends({
|
|
3213
|
+
estimateSize: function estimateSize() {
|
|
3214
|
+
return density === 'compact' ? 25 : 50;
|
|
3215
|
+
},
|
|
3214
3216
|
overscan: density === 'compact' ? 30 : 10,
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
+
getScrollElement: function getScrollElement() {
|
|
3218
|
+
return tableContainerRef.current;
|
|
3219
|
+
},
|
|
3220
|
+
count: rows.length
|
|
3217
3221
|
}, virtualizerProps)) : {};
|
|
3218
|
-
var virtualRows = enableRowVirtualization ? rowVirtualizer.
|
|
3222
|
+
var virtualRows = enableRowVirtualization ? rowVirtualizer.getVirtualItems() : [];
|
|
3219
3223
|
var paddingTop = 0;
|
|
3220
3224
|
var paddingBottom = 0;
|
|
3221
3225
|
|
|
3222
3226
|
if (enableRowVirtualization) {
|
|
3223
|
-
paddingTop = virtualRows.length
|
|
3224
|
-
paddingBottom = virtualRows.length
|
|
3227
|
+
paddingTop = !!virtualRows.length ? virtualRows[0].start : 0;
|
|
3228
|
+
paddingBottom = !!virtualRows.length ? rowVirtualizer.getTotalSize() - virtualRows[virtualRows.length - 1].end : 0;
|
|
3225
3229
|
}
|
|
3226
3230
|
|
|
3227
3231
|
return React__default.createElement(material.TableBody, Object.assign({}, tableBodyProps), enableRowVirtualization && paddingTop > 0 && React__default.createElement("tr", null, React__default.createElement("td", {
|