material-react-table 1.6.1 → 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.
@@ -1048,11 +1048,12 @@ const MRT_SelectCheckbox = ({ row, selectAll, table }) => {
|
|
1048
1048
|
: muiSelectCheckboxProps instanceof Function
|
1049
1049
|
? muiSelectCheckboxProps({ row, table })
|
1050
1050
|
: muiSelectCheckboxProps;
|
1051
|
-
const
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1051
|
+
const allRowsSelected = selectAll
|
1052
|
+
? selectAllMode === 'page'
|
1053
|
+
? table.getIsAllPageRowsSelected()
|
1054
|
+
: table.getIsAllRowsSelected()
|
1055
|
+
: undefined;
|
1056
|
+
const commonProps = Object.assign(Object.assign({ checked: selectAll ? allRowsSelected : row === null || row === void 0 ? void 0 : row.getIsSelected(), disabled: isLoading || (row && !row.getCanSelect()), inputProps: {
|
1056
1057
|
'aria-label': selectAll
|
1057
1058
|
? localization.toggleSelectAll
|
1058
1059
|
: localization.toggleSelectRow,
|
@@ -1070,10 +1071,7 @@ const MRT_SelectCheckbox = ({ row, selectAll, table }) => {
|
|
1070
1071
|
return (React.createElement(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.title) !== null && _a !== void 0 ? _a : (selectAll
|
1071
1072
|
? localization.toggleSelectAll
|
1072
1073
|
: localization.toggleSelectRow) }, enableMultiRowSelection === false ? (React.createElement(Radio, Object.assign({}, commonProps))) : (React.createElement(Checkbox, Object.assign({ indeterminate: selectAll
|
1073
|
-
? table.getIsSomeRowsSelected() &&
|
1074
|
-
!(selectAllMode === 'page'
|
1075
|
-
? table.getIsAllPageRowsSelected()
|
1076
|
-
: table.getIsAllRowsSelected())
|
1074
|
+
? table.getIsSomeRowsSelected() && !allRowsSelected
|
1077
1075
|
: row === null || row === void 0 ? void 0 : row.getIsSomeSelected() }, commonProps)))));
|
1078
1076
|
};
|
1079
1077
|
|
@@ -2428,8 +2426,8 @@ const Memo_MRT_TableBodyRow = memo(MRT_TableBodyRow, (prev, next) => prev.row ==
|
|
2428
2426
|
|
2429
2427
|
const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddingLeft, virtualPaddingRight, }) => {
|
2430
2428
|
var _a, _b, _c;
|
2431
|
-
const { getRowModel, getPrePaginationRowModel, getState, options: { enableGlobalFilterRankedResults, enablePagination, enableRowVirtualization, layoutMode, localization, manualFiltering, manualPagination, manualSorting, memoMode, muiTableBodyProps, rowVirtualizerInstanceRef, rowVirtualizerProps, virtualizerInstanceRef, virtualizerProps, }, refs: { tableContainerRef, tablePaperRef }, } = table;
|
2432
|
-
const { columnFilters, density, globalFilter, pagination, sorting } = getState();
|
2429
|
+
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;
|
2430
|
+
const { columnFilters, density, expanded, globalFilter, globalFilterFn, pagination, sorting, } = getState();
|
2433
2431
|
const tableBodyProps = muiTableBodyProps instanceof Function
|
2434
2432
|
? muiTableBodyProps({ table })
|
2435
2433
|
: muiTableBodyProps;
|
@@ -2439,26 +2437,37 @@ const MRT_TableBody = ({ columnVirtualizer, table, virtualColumns, virtualPaddin
|
|
2439
2437
|
const vProps = rowVirtualizerProps instanceof Function
|
2440
2438
|
? rowVirtualizerProps({ table })
|
2441
2439
|
: rowVirtualizerProps;
|
2440
|
+
const shouldRankResults = useMemo(() => !manualExpanding &&
|
2441
|
+
!manualFiltering &&
|
2442
|
+
!manualGrouping &&
|
2443
|
+
!manualSorting &&
|
2444
|
+
enableGlobalFilterRankedResults &&
|
2445
|
+
globalFilter &&
|
2446
|
+
globalFilterFn === 'fuzzy' &&
|
2447
|
+
expanded !== true &&
|
2448
|
+
!Object.values(sorting).some(Boolean) &&
|
2449
|
+
!Object.values(expanded).some(Boolean), [
|
2450
|
+
enableGlobalFilterRankedResults,
|
2451
|
+
expanded,
|
2452
|
+
globalFilter,
|
2453
|
+
manualExpanding,
|
2454
|
+
manualFiltering,
|
2455
|
+
manualGrouping,
|
2456
|
+
manualSorting,
|
2457
|
+
sorting,
|
2458
|
+
]);
|
2442
2459
|
const rows = useMemo(() => {
|
2443
|
-
if (
|
2444
|
-
|
2445
|
-
|
2446
|
-
|
2447
|
-
|
2448
|
-
|
2449
|
-
if (enablePagination && !manualPagination) {
|
2450
|
-
const start = pagination.pageIndex * pagination.pageSize;
|
2451
|
-
return rankedRows.slice(start, start + pagination.pageSize);
|
2452
|
-
}
|
2453
|
-
return rankedRows;
|
2460
|
+
if (!shouldRankResults)
|
2461
|
+
return getRowModel().rows;
|
2462
|
+
const rankedRows = getPrePaginationRowModel().rows.sort((a, b) => rankGlobalFuzzy(a, b));
|
2463
|
+
if (enablePagination && !manualPagination) {
|
2464
|
+
const start = pagination.pageIndex * pagination.pageSize;
|
2465
|
+
return rankedRows.slice(start, start + pagination.pageSize);
|
2454
2466
|
}
|
2455
|
-
return
|
2467
|
+
return rankedRows;
|
2456
2468
|
}, [
|
2457
|
-
|
2458
|
-
|
2459
|
-
? getPrePaginationRowModel().rows
|
2460
|
-
: getRowModel().rows,
|
2461
|
-
globalFilter,
|
2469
|
+
shouldRankResults,
|
2470
|
+
shouldRankResults ? getPrePaginationRowModel().rows : getRowModel().rows,
|
2462
2471
|
pagination.pageIndex,
|
2463
2472
|
pagination.pageSize,
|
2464
2473
|
]);
|