material-react-table 1.6.2 → 1.6.3
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/cjs/index.js
CHANGED
@@ -2504,8 +2504,8 @@ const Memo_MRT_TableBodyRow = React.memo(MRT_TableBodyRow, (prev, next) => prev.
|
|
2504
2504
|
|
2505
2505
|
const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
|
2506
2506
|
var _a, _b, _c;
|
2507
|
-
const { getRowModel, getPrePaginationRowModel, getState, options: { enableGlobalFilterRankedResults, enablePagination, enableRowVirtualization, layoutMode, localization, manualFiltering, manualPagination, manualSorting, memoMode, muiTableBodyProps, rowVirtualizerInstanceRef, rowVirtualizerProps, virtualizerInstanceRef, virtualizerProps, }, refs: { tableContainerRef, tablePaperRef }, } = table;
|
2508
|
-
const { columnFilters, density, globalFilter, pagination, sorting } = getState();
|
2507
|
+
const { getRowModel, getPrePaginationRowModel, getState, options: { enableGlobalFilterRankedResults, enablePagination, enableRowVirtualization, layoutMode, localization, manualExpanding, manualFiltering, manualGrouping, manualPagination, manualSorting, memoMode, muiTableBodyProps, rowVirtualizerInstanceRef, rowVirtualizerProps, virtualizerInstanceRef, virtualizerProps, }, refs: { tableContainerRef, tablePaperRef }, } = table;
|
2508
|
+
const { columnFilters, density, expanded, globalFilter, globalFilterFn, pagination, sorting, } = getState();
|
2509
2509
|
const tableBodyProps = muiTableBodyProps instanceof Function
|
2510
2510
|
? muiTableBodyProps({ table })
|
2511
2511
|
: muiTableBodyProps;
|
@@ -2515,26 +2515,37 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
|
|
2515
2515
|
const vProps = rowVirtualizerProps instanceof Function
|
2516
2516
|
? rowVirtualizerProps({ table })
|
2517
2517
|
: rowVirtualizerProps;
|
2518
|
+
const shouldRankResults = React.useMemo(() => !manualExpanding &&
|
2519
|
+
!manualFiltering &&
|
2520
|
+
!manualGrouping &&
|
2521
|
+
!manualSorting &&
|
2522
|
+
enableGlobalFilterRankedResults &&
|
2523
|
+
globalFilter &&
|
2524
|
+
globalFilterFn === 'fuzzy' &&
|
2525
|
+
expanded !== true &&
|
2526
|
+
!Object.values(sorting).some(Boolean) &&
|
2527
|
+
!Object.values(expanded).some(Boolean), [
|
2528
|
+
enableGlobalFilterRankedResults,
|
2529
|
+
expanded,
|
2530
|
+
globalFilter,
|
2531
|
+
manualExpanding,
|
2532
|
+
manualFiltering,
|
2533
|
+
manualGrouping,
|
2534
|
+
manualSorting,
|
2535
|
+
sorting,
|
2536
|
+
]);
|
2518
2537
|
const rows = React.useMemo(() => {
|
2519
|
-
if (
|
2520
|
-
|
2521
|
-
|
2522
|
-
|
2523
|
-
|
2524
|
-
|
2525
|
-
if (enablePagination && !manualPagination) {
|
2526
|
-
const start = pagination.pageIndex * pagination.pageSize;
|
2527
|
-
return rankedRows.slice(start, start + pagination.pageSize);
|
2528
|
-
}
|
2529
|
-
return rankedRows;
|
2538
|
+
if (!shouldRankResults)
|
2539
|
+
return getRowModel().rows;
|
2540
|
+
const rankedRows = getPrePaginationRowModel().rows.sort((a, b) => rankGlobalFuzzy(a, b));
|
2541
|
+
if (enablePagination && !manualPagination) {
|
2542
|
+
const start = pagination.pageIndex * pagination.pageSize;
|
2543
|
+
return rankedRows.slice(start, start + pagination.pageSize);
|
2530
2544
|
}
|
2531
|
-
return
|
2545
|
+
return rankedRows;
|
2532
2546
|
}, [
|
2533
|
-
|
2534
|
-
|
2535
|
-
? getPrePaginationRowModel().rows
|
2536
|
-
: getRowModel().rows,
|
2537
|
-
globalFilter,
|
2547
|
+
shouldRankResults,
|
2548
|
+
shouldRankResults ? getPrePaginationRowModel().rows : getRowModel().rows,
|
2538
2549
|
pagination.pageIndex,
|
2539
2550
|
pagination.pageSize,
|
2540
2551
|
]);
|