@mui/x-data-grid 8.0.0-alpha.10 → 8.0.0-alpha.11
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/CHANGELOG.md +107 -2
- package/DataGrid/useDataGridComponent.js +2 -2
- package/components/GridRow.js +6 -2
- package/components/GridScrollArea.d.ts +5 -2
- package/components/GridScrollArea.js +31 -24
- package/components/GridSkeletonLoadingOverlay.js +2 -1
- package/components/containers/GridRoot.js +11 -9
- package/components/containers/GridRootStyles.js +3 -3
- package/components/menu/columnMenu/GridColumnMenuContainer.js +5 -2
- package/components/virtualization/GridMainContainer.d.ts +2 -2
- package/components/virtualization/GridMainContainer.js +1 -1
- package/components/virtualization/GridVirtualScroller.js +21 -14
- package/constants/index.d.ts +1 -0
- package/constants/index.js +2 -1
- package/constants/signature.d.ts +9 -0
- package/constants/signature.js +10 -0
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +1 -1
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +6 -4
- package/hooks/core/useGridApiInitialization.js +1 -1
- package/hooks/core/useGridStateInitialization.js +3 -2
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -14
- package/hooks/features/columns/gridColumnsSelector.d.ts +0 -5
- package/hooks/features/columns/gridColumnsSelector.js +0 -12
- package/hooks/features/columns/useGridColumns.js +2 -1
- package/hooks/features/dimensions/gridDimensionsSelectors.d.ts +16 -0
- package/hooks/features/dimensions/gridDimensionsSelectors.js +26 -1
- package/hooks/features/dimensions/index.d.ts +1 -1
- package/hooks/features/dimensions/index.js +1 -2
- package/hooks/features/dimensions/useGridDimensions.js +97 -70
- package/hooks/features/editing/gridEditingSelectors.d.ts +5 -1
- package/hooks/features/editing/gridEditingSelectors.js +6 -1
- package/hooks/features/editing/useGridRowEditing.js +4 -4
- package/hooks/features/filter/gridFilterSelector.d.ts +2 -2
- package/hooks/features/filter/gridFilterSelector.js +4 -3
- package/hooks/features/filter/gridFilterState.d.ts +8 -3
- package/hooks/features/filter/gridFilterState.js +5 -0
- package/hooks/features/filter/useGridFilter.js +9 -14
- package/hooks/features/overlays/useGridOverlays.js +1 -1
- package/hooks/features/pagination/gridPaginationUtils.js +1 -1
- package/hooks/features/pagination/useGridPagination.js +1 -1
- package/hooks/features/rowSelection/useGridRowSelection.js +3 -2
- package/hooks/features/rowSelection/utils.js +2 -2
- package/hooks/features/rows/gridRowsMetaState.d.ts +8 -0
- package/hooks/features/rows/gridRowsUtils.d.ts +0 -4
- package/hooks/features/rows/gridRowsUtils.js +0 -16
- package/hooks/features/rows/useGridRows.js +4 -2
- package/hooks/features/rows/useGridRowsMeta.js +33 -17
- package/hooks/features/sorting/gridSortingSelector.js +10 -9
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +6 -0
- package/hooks/features/virtualization/useGridVirtualScroller.js +43 -27
- package/hooks/utils/index.d.ts +1 -1
- package/hooks/utils/index.js +1 -1
- package/hooks/utils/useGridApiEventHandler.d.ts +7 -17
- package/hooks/utils/useGridApiEventHandler.js +68 -75
- package/hooks/utils/useGridSelector.js +23 -5
- package/hooks/utils/useIsSSR.d.ts +1 -0
- package/hooks/utils/useIsSSR.js +5 -0
- package/index.js +1 -1
- package/internals/index.d.ts +3 -1
- package/internals/index.js +3 -1
- package/internals/utils/propValidation.js +1 -1
- package/models/api/gridStateApi.d.ts +1 -0
- package/models/events/gridEventLookup.d.ts +6 -0
- package/modern/DataGrid/useDataGridComponent.js +2 -2
- package/modern/components/GridRow.js +6 -2
- package/modern/components/GridScrollArea.js +31 -24
- package/modern/components/GridSkeletonLoadingOverlay.js +2 -1
- package/modern/components/containers/GridRoot.js +11 -9
- package/modern/components/containers/GridRootStyles.js +3 -3
- package/modern/components/menu/columnMenu/GridColumnMenuContainer.js +5 -2
- package/modern/components/virtualization/GridMainContainer.js +1 -1
- package/modern/components/virtualization/GridVirtualScroller.js +21 -14
- package/modern/constants/index.js +2 -1
- package/modern/constants/signature.js +10 -0
- package/modern/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +6 -4
- package/modern/hooks/core/useGridApiInitialization.js +1 -1
- package/modern/hooks/core/useGridStateInitialization.js +3 -2
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -14
- package/modern/hooks/features/columns/gridColumnsSelector.js +0 -12
- package/modern/hooks/features/columns/useGridColumns.js +2 -1
- package/modern/hooks/features/dimensions/gridDimensionsSelectors.js +26 -1
- package/modern/hooks/features/dimensions/index.js +1 -2
- package/modern/hooks/features/dimensions/useGridDimensions.js +97 -70
- package/modern/hooks/features/editing/gridEditingSelectors.js +6 -1
- package/modern/hooks/features/editing/useGridRowEditing.js +4 -4
- package/modern/hooks/features/filter/gridFilterSelector.js +4 -3
- package/modern/hooks/features/filter/gridFilterState.js +5 -0
- package/modern/hooks/features/filter/useGridFilter.js +9 -14
- package/modern/hooks/features/overlays/useGridOverlays.js +1 -1
- package/modern/hooks/features/pagination/gridPaginationUtils.js +1 -1
- package/modern/hooks/features/pagination/useGridPagination.js +1 -1
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +3 -2
- package/modern/hooks/features/rowSelection/utils.js +2 -2
- package/modern/hooks/features/rows/gridRowsUtils.js +0 -16
- package/modern/hooks/features/rows/useGridRows.js +4 -2
- package/modern/hooks/features/rows/useGridRowsMeta.js +33 -17
- package/modern/hooks/features/sorting/gridSortingSelector.js +10 -9
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +43 -27
- package/modern/hooks/utils/index.js +1 -1
- package/modern/hooks/utils/useGridApiEventHandler.js +68 -75
- package/modern/hooks/utils/useGridSelector.js +23 -5
- package/modern/hooks/utils/useIsSSR.js +5 -0
- package/modern/index.js +1 -1
- package/modern/internals/index.js +3 -1
- package/modern/internals/utils/propValidation.js +1 -1
- package/node/DataGrid/useDataGridComponent.js +2 -2
- package/node/components/GridRow.js +6 -2
- package/node/components/GridScrollArea.js +31 -24
- package/node/components/GridSkeletonLoadingOverlay.js +2 -1
- package/node/components/containers/GridRoot.js +10 -8
- package/node/components/containers/GridRootStyles.js +3 -3
- package/node/components/menu/columnMenu/GridColumnMenuContainer.js +5 -2
- package/node/components/virtualization/GridMainContainer.js +1 -1
- package/node/components/virtualization/GridVirtualScroller.js +21 -14
- package/node/constants/index.js +11 -0
- package/node/constants/signature.js +16 -0
- package/node/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +6 -4
- package/node/hooks/core/useGridApiInitialization.js +2 -2
- package/node/hooks/core/useGridStateInitialization.js +3 -2
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -14
- package/node/hooks/features/columns/gridColumnsSelector.js +1 -13
- package/node/hooks/features/columns/useGridColumns.js +2 -1
- package/node/hooks/features/dimensions/gridDimensionsSelectors.js +38 -2
- package/node/hooks/features/dimensions/index.js +13 -11
- package/node/hooks/features/dimensions/useGridDimensions.js +94 -67
- package/node/hooks/features/editing/gridEditingSelectors.js +5 -1
- package/node/hooks/features/editing/useGridRowEditing.js +4 -4
- package/node/hooks/features/filter/gridFilterSelector.js +4 -3
- package/node/hooks/features/filter/gridFilterState.js +6 -1
- package/node/hooks/features/filter/useGridFilter.js +8 -13
- package/node/hooks/features/overlays/useGridOverlays.js +1 -1
- package/node/hooks/features/pagination/gridPaginationUtils.js +2 -2
- package/node/hooks/features/pagination/useGridPagination.js +1 -1
- package/node/hooks/features/rowSelection/useGridRowSelection.js +5 -4
- package/node/hooks/features/rowSelection/utils.js +3 -3
- package/node/hooks/features/rows/gridRowsUtils.js +0 -17
- package/node/hooks/features/rows/useGridRows.js +6 -4
- package/node/hooks/features/rows/useGridRowsMeta.js +31 -15
- package/node/hooks/features/sorting/gridSortingSelector.js +10 -9
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +42 -26
- package/node/hooks/utils/index.js +21 -11
- package/node/hooks/utils/useGridApiEventHandler.js +71 -78
- package/node/hooks/utils/useGridSelector.js +23 -5
- package/node/hooks/utils/useIsSSR.js +12 -0
- package/node/index.js +1 -1
- package/node/internals/index.js +32 -7
- package/node/internals/utils/propValidation.js +2 -2
- package/package.json +3 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isObjectEmpty } from '@mui/x-internals/isObjectEmpty';
|
|
1
2
|
import { createSelector, createSelectorMemoized } from "../../../utils/createSelector.js";
|
|
2
3
|
import { gridSortedRowEntriesSelector } from "../sorting/gridSortingSelector.js";
|
|
3
4
|
import { gridColumnLookupSelector } from "../columns/gridColumnsSelector.js";
|
|
@@ -49,8 +50,8 @@ export const gridFilteredDescendantCountLookupSelector = createSelector(gridFilt
|
|
|
49
50
|
* Does not contain the collapsed children.
|
|
50
51
|
* @category Filtering
|
|
51
52
|
*/
|
|
52
|
-
export const gridExpandedSortedRowEntriesSelector = createSelectorMemoized(gridVisibleRowsLookupSelector, gridSortedRowEntriesSelector,
|
|
53
|
-
if (
|
|
53
|
+
export const gridExpandedSortedRowEntriesSelector = createSelectorMemoized(gridVisibleRowsLookupSelector, gridSortedRowEntriesSelector, (visibleRowsLookup, sortedRows) => {
|
|
54
|
+
if (isObjectEmpty(visibleRowsLookup)) {
|
|
54
55
|
return sortedRows;
|
|
55
56
|
}
|
|
56
57
|
return sortedRows.filter(row => visibleRowsLookup[row.id] !== false);
|
|
@@ -68,7 +69,7 @@ export const gridExpandedSortedRowIdsSelector = createSelectorMemoized(gridExpan
|
|
|
68
69
|
* Contains the collapsed children.
|
|
69
70
|
* @category Filtering
|
|
70
71
|
*/
|
|
71
|
-
export const gridFilteredSortedRowEntriesSelector = createSelectorMemoized(gridFilteredRowsLookupSelector, gridSortedRowEntriesSelector, (filteredRowsLookup, sortedRows) => sortedRows.filter(row => filteredRowsLookup[row.id] !== false));
|
|
72
|
+
export const gridFilteredSortedRowEntriesSelector = createSelectorMemoized(gridFilteredRowsLookupSelector, gridSortedRowEntriesSelector, (filteredRowsLookup, sortedRows) => isObjectEmpty(filteredRowsLookup) ? sortedRows : sortedRows.filter(row => filteredRowsLookup[row.id] !== false));
|
|
72
73
|
|
|
73
74
|
/**
|
|
74
75
|
* Get the id of the rows accessible after the filtering process.
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { GridLogicOperator } from "../../../models/gridFilterItem.js";
|
|
2
|
+
export const defaultGridFilterLookup = {
|
|
3
|
+
filteredRowsLookup: {},
|
|
4
|
+
filteredChildrenCountLookup: {},
|
|
5
|
+
filteredDescendantCountLookup: {}
|
|
6
|
+
};
|
|
2
7
|
export const getDefaultGridFilterModel = () => ({
|
|
3
8
|
items: [],
|
|
4
9
|
logicOperator: GridLogicOperator.And,
|
|
@@ -8,7 +8,7 @@ import { useGridApiMethod } from "../../utils/useGridApiMethod.js";
|
|
|
8
8
|
import { useGridLogger } from "../../utils/useGridLogger.js";
|
|
9
9
|
import { gridColumnLookupSelector } from "../columns/gridColumnsSelector.js";
|
|
10
10
|
import { GridPreferencePanelsValue } from "../preferencesPanel/gridPreferencePanelsValue.js";
|
|
11
|
-
import { getDefaultGridFilterModel } from "./gridFilterState.js";
|
|
11
|
+
import { defaultGridFilterLookup, getDefaultGridFilterModel } from "./gridFilterState.js";
|
|
12
12
|
import { gridFilterModelSelector } from "./gridFilterSelector.js";
|
|
13
13
|
import { useFirstRender } from "../../utils/useFirstRender.js";
|
|
14
14
|
import { gridRowsLookupSelector } from "../rows/index.js";
|
|
@@ -20,12 +20,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
20
20
|
export const filterStateInitializer = (state, props, apiRef) => {
|
|
21
21
|
const filterModel = props.filterModel ?? props.initialState?.filter?.filterModel ?? getDefaultGridFilterModel();
|
|
22
22
|
return _extends({}, state, {
|
|
23
|
-
filter: {
|
|
24
|
-
filterModel: sanitizeFilterModel(filterModel, props.disableMultipleColumnsFiltering, apiRef)
|
|
25
|
-
|
|
26
|
-
filteredChildrenCountLookup: {},
|
|
27
|
-
filteredDescendantCountLookup: {}
|
|
28
|
-
},
|
|
23
|
+
filter: _extends({
|
|
24
|
+
filterModel: sanitizeFilterModel(filterModel, props.disableMultipleColumnsFiltering, apiRef)
|
|
25
|
+
}, defaultGridFilterLookup),
|
|
29
26
|
visibleRowsLookup: {}
|
|
30
27
|
});
|
|
31
28
|
};
|
|
@@ -271,12 +268,8 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
271
268
|
} = props;
|
|
272
269
|
const getRowsRef = useLazyRef(createMemoizedValues);
|
|
273
270
|
const flatFilteringMethod = React.useCallback(params => {
|
|
274
|
-
if (props.filterMode !== 'client' || !params.isRowMatchingFilters) {
|
|
275
|
-
return
|
|
276
|
-
filteredRowsLookup: {},
|
|
277
|
-
filteredChildrenCountLookup: {},
|
|
278
|
-
filteredDescendantCountLookup: {}
|
|
279
|
-
};
|
|
271
|
+
if (props.filterMode !== 'client' || !params.isRowMatchingFilters || !params.filterModel.items.length && !params.filterModel.quickFilterValues?.length) {
|
|
272
|
+
return defaultGridFilterLookup;
|
|
280
273
|
}
|
|
281
274
|
const dataRowIdToModelLookup = gridRowsLookupSelector(apiRef);
|
|
282
275
|
const filteredRowsLookup = {};
|
|
@@ -294,7 +287,9 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
294
287
|
const id = getRowId ? getRowId(row) : row.id;
|
|
295
288
|
isRowMatchingFilters(row, undefined, result);
|
|
296
289
|
const isRowPassing = passFilterLogic([result.passingFilterItems], [result.passingQuickFilterValues], params.filterModel, apiRef, filterCache);
|
|
297
|
-
|
|
290
|
+
if (!isRowPassing) {
|
|
291
|
+
filteredRowsLookup[id] = isRowPassing;
|
|
292
|
+
}
|
|
298
293
|
}
|
|
299
294
|
const footerId = 'auto-generated-group-footer-root';
|
|
300
295
|
const footer = dataRowIdToModelLookup[footerId];
|
|
@@ -32,7 +32,7 @@ export const useGridOverlays = () => {
|
|
|
32
32
|
}
|
|
33
33
|
if (loading) {
|
|
34
34
|
overlayType = 'loadingOverlay';
|
|
35
|
-
loadingOverlayVariant = rootProps.slotProps?.loadingOverlay?.[noRows ? 'noRowsVariant' : 'variant']
|
|
35
|
+
loadingOverlayVariant = rootProps.slotProps?.loadingOverlay?.[noRows ? 'noRowsVariant' : 'variant'] ?? (noRows ? 'skeleton' : 'linear-progress');
|
|
36
36
|
}
|
|
37
37
|
const overlaysProps = {
|
|
38
38
|
overlayType,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GridSignature } from "
|
|
1
|
+
import { GridSignature } from "../../../constants/signature.js";
|
|
2
2
|
const MAX_PAGE_SIZE = 100;
|
|
3
3
|
export const defaultPageSize = autoPageSize => autoPageSize ? 0 : 100;
|
|
4
4
|
export const getPageCount = (rowCount, pageSize, page) => {
|
|
@@ -6,7 +6,7 @@ import { useGridPaginationMeta } from "./useGridPaginationMeta.js";
|
|
|
6
6
|
export const paginationStateInitializer = (state, props) => {
|
|
7
7
|
const paginationModel = _extends({}, getDefaultGridPaginationModel(props.autoPageSize), props.paginationModel ?? props.initialState?.pagination?.paginationModel);
|
|
8
8
|
throwIfPageSizeExceedsTheLimit(paginationModel.pageSize, props.signature);
|
|
9
|
-
const rowCount = props.rowCount ?? props.initialState?.pagination?.rowCount;
|
|
9
|
+
const rowCount = props.rowCount ?? props.initialState?.pagination?.rowCount ?? (props.paginationMode === 'client' ? state.rows?.totalRowCount : undefined);
|
|
10
10
|
const meta = props.paginationMeta ?? props.initialState?.pagination?.meta ?? {};
|
|
11
11
|
return _extends({}, state, {
|
|
12
12
|
pagination: _extends({}, state.pagination, {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { GridSignature
|
|
3
|
+
import { GridSignature } from "../../../constants/signature.js";
|
|
4
|
+
import { useGridApiEventHandler } from "../../utils/useGridApiEventHandler.js";
|
|
4
5
|
import { useGridApiMethod } from "../../utils/useGridApiMethod.js";
|
|
5
6
|
import { useGridLogger } from "../../utils/useGridLogger.js";
|
|
6
7
|
import { useGridSelector } from "../../utils/useGridSelector.js";
|
|
@@ -258,7 +259,7 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
258
259
|
if (props.filterMode === 'server') {
|
|
259
260
|
return !rowsLookup[id];
|
|
260
261
|
}
|
|
261
|
-
return filteredRowsLookup[id]
|
|
262
|
+
return !rowsLookup[id] || filteredRowsLookup[id] === false;
|
|
262
263
|
};
|
|
263
264
|
let hasChanged = false;
|
|
264
265
|
currentSelection.forEach(id => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GridSignature } from "
|
|
1
|
+
import { GridSignature } from "../../../constants/signature.js";
|
|
2
2
|
import { GRID_ROOT_GROUP_ID } from "../rows/gridRowsUtils.js";
|
|
3
3
|
import { gridFilteredRowsLookupSelector } from "../filter/gridFilterSelector.js";
|
|
4
4
|
import { gridSortedRowIdsSelector } from "../sorting/gridSortingSelector.js";
|
|
@@ -92,7 +92,7 @@ const getFilteredRowNodeSiblings = (tree, filteredRows, id) => {
|
|
|
92
92
|
return [];
|
|
93
93
|
}
|
|
94
94
|
const parentNode = tree[parent];
|
|
95
|
-
return parentNode.children.filter(childId => childId !== id && filteredRows[childId]);
|
|
95
|
+
return parentNode.children.filter(childId => childId !== id && filteredRows[childId] !== false);
|
|
96
96
|
};
|
|
97
97
|
export const findRowsToSelect = (apiRef, tree, selectedRow, autoSelectDescendants, autoSelectParents, addRow) => {
|
|
98
98
|
const filteredRows = gridFilteredRowsLookupSelector(apiRef);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { gridPinnedRowsSelector } from "./gridRowsSelector.js";
|
|
3
2
|
export const GRID_ROOT_GROUP_ID = `auto-generated-group-node-root`;
|
|
4
3
|
export const GRID_ID_AUTOGENERATED = Symbol('mui.id_autogenerated');
|
|
5
4
|
export const buildRootGroup = () => ({
|
|
@@ -260,21 +259,6 @@ export const updateCacheWithNewRows = ({
|
|
|
260
259
|
rowCountPropBeforePartialUpdates: previousCache.rowCountPropBeforePartialUpdates
|
|
261
260
|
};
|
|
262
261
|
};
|
|
263
|
-
export function calculatePinnedRowsHeight(apiRef) {
|
|
264
|
-
const pinnedRows = gridPinnedRowsSelector(apiRef);
|
|
265
|
-
const topPinnedRowsHeight = pinnedRows?.top?.reduce((acc, value) => {
|
|
266
|
-
acc += apiRef.current.unstable_getRowHeight(value.id);
|
|
267
|
-
return acc;
|
|
268
|
-
}, 0) || 0;
|
|
269
|
-
const bottomPinnedRowsHeight = pinnedRows?.bottom?.reduce((acc, value) => {
|
|
270
|
-
acc += apiRef.current.unstable_getRowHeight(value.id);
|
|
271
|
-
return acc;
|
|
272
|
-
}, 0) || 0;
|
|
273
|
-
return {
|
|
274
|
-
top: topPinnedRowsHeight,
|
|
275
|
-
bottom: bottomPinnedRowsHeight
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
262
|
export const minimalContentHeight = 'var(--DataGrid-overlayHeight, calc(var(--height) * 2))';
|
|
279
263
|
export function computeRowsUpdates(apiRef, updates, getRowId) {
|
|
280
264
|
const nonPinnedRowsUpdates = [];
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import useLazyRef from '@mui/utils/useLazyRef';
|
|
4
|
+
import { isObjectEmpty } from '@mui/x-internals/isObjectEmpty';
|
|
4
5
|
import { useGridApiMethod } from "../../utils/useGridApiMethod.js";
|
|
5
6
|
import { useGridLogger } from "../../utils/useGridLogger.js";
|
|
6
7
|
import { gridRowCountSelector, gridRowsLookupSelector, gridRowTreeSelector, gridRowGroupingNameSelector, gridRowTreeDepthsSelector, gridDataRowIdsSelector, gridRowMaximumTreeDepthSelector, gridRowGroupsToFetchSelector } from "./gridRowsSelector.js";
|
|
7
8
|
import { useTimeout } from "../../utils/useTimeout.js";
|
|
8
|
-
import { GridSignature
|
|
9
|
+
import { GridSignature } from "../../../constants/signature.js";
|
|
10
|
+
import { useGridApiEventHandler } from "../../utils/useGridApiEventHandler.js";
|
|
9
11
|
import { getVisibleRows } from "../../utils/useGridVisibleRows.js";
|
|
10
12
|
import { gridSortedRowIdsSelector } from "../sorting/gridSortingSelector.js";
|
|
11
13
|
import { gridFilteredRowsLookupSelector } from "../filter/gridFilterSelector.js";
|
|
@@ -221,7 +223,7 @@ export const useGridRows = (apiRef, props) => {
|
|
|
221
223
|
}
|
|
222
224
|
if (applyFiltering) {
|
|
223
225
|
const filteredRowsLookup = gridFilteredRowsLookupSelector(apiRef);
|
|
224
|
-
children = children.filter(childId => filteredRowsLookup[childId] !== false);
|
|
226
|
+
children = isObjectEmpty(filteredRowsLookup) ? children : children.filter(childId => filteredRowsLookup[childId] !== false);
|
|
225
227
|
}
|
|
226
228
|
return children;
|
|
227
229
|
}, [apiRef]);
|
|
@@ -8,12 +8,10 @@ import { eslintUseValue } from "../../../utils/utils.js";
|
|
|
8
8
|
import { useGridApiMethod } from "../../utils/useGridApiMethod.js";
|
|
9
9
|
import { useGridSelector } from "../../utils/useGridSelector.js";
|
|
10
10
|
import { gridDensityFactorSelector } from "../density/densitySelector.js";
|
|
11
|
-
import { gridFilterModelSelector } from "../filter/gridFilterSelector.js";
|
|
12
11
|
import { gridPaginationSelector } from "../pagination/gridPaginationSelector.js";
|
|
13
|
-
import { gridSortModelSelector } from "../sorting/gridSortingSelector.js";
|
|
14
12
|
import { useGridRegisterPipeApplier } from "../../core/pipeProcessing/index.js";
|
|
15
|
-
import { gridPinnedRowsSelector } from "./gridRowsSelector.js";
|
|
16
|
-
import { gridDimensionsSelector } from "../dimensions/gridDimensionsSelectors.js";
|
|
13
|
+
import { gridPinnedRowsSelector, gridRowCountSelector } from "./gridRowsSelector.js";
|
|
14
|
+
import { gridDimensionsSelector, gridRowHeightSelector } from "../dimensions/gridDimensionsSelectors.js";
|
|
17
15
|
import { getValidRowHeight, getRowHeightWarning } from "./gridRowsUtils.js";
|
|
18
16
|
/* eslint-disable no-underscore-dangle */
|
|
19
17
|
|
|
@@ -21,10 +19,18 @@ export const rowsMetaStateInitializer = (state, props, apiRef) => {
|
|
|
21
19
|
apiRef.current.caches.rowsMeta = {
|
|
22
20
|
heights: new Map()
|
|
23
21
|
};
|
|
22
|
+
const baseRowHeight = gridRowHeightSelector(apiRef.current.state);
|
|
23
|
+
const dataRowCount = gridRowCountSelector(apiRef.current.state);
|
|
24
|
+
const pagination = gridPaginationSelector(apiRef.current.state);
|
|
25
|
+
const rowCount = Math.min(pagination.enabled ? pagination.paginationModel.pageSize : dataRowCount, dataRowCount);
|
|
24
26
|
return _extends({}, state, {
|
|
25
27
|
rowsMeta: {
|
|
26
|
-
currentPageTotalHeight:
|
|
27
|
-
positions:
|
|
28
|
+
currentPageTotalHeight: rowCount * baseRowHeight,
|
|
29
|
+
positions: Array.from({
|
|
30
|
+
length: rowCount
|
|
31
|
+
}, (_, i) => i * baseRowHeight),
|
|
32
|
+
pinnedTopRowsTotalHeight: 0,
|
|
33
|
+
pinnedBottomRowsTotalHeight: 0
|
|
28
34
|
}
|
|
29
35
|
});
|
|
30
36
|
};
|
|
@@ -44,12 +50,9 @@ export const useGridRowsMeta = (apiRef, props) => {
|
|
|
44
50
|
const hasRowWithAutoHeight = React.useRef(false);
|
|
45
51
|
const isHeightMetaValid = React.useRef(false);
|
|
46
52
|
const densityFactor = useGridSelector(apiRef, gridDensityFactorSelector);
|
|
47
|
-
const filterModel = useGridSelector(apiRef, gridFilterModelSelector);
|
|
48
|
-
const paginationState = useGridSelector(apiRef, gridPaginationSelector);
|
|
49
|
-
const sortModel = useGridSelector(apiRef, gridSortModelSelector);
|
|
50
53
|
const currentPage = useGridVisibleRows(apiRef, props);
|
|
51
54
|
const pinnedRows = useGridSelector(apiRef, gridPinnedRowsSelector);
|
|
52
|
-
const rowHeight = useGridSelector(apiRef,
|
|
55
|
+
const rowHeight = useGridSelector(apiRef, gridRowHeightSelector);
|
|
53
56
|
const getRowHeightEntry = rowId => {
|
|
54
57
|
let entry = heightCache.get(rowId);
|
|
55
58
|
if (entry === undefined) {
|
|
@@ -114,8 +117,14 @@ export const useGridRowsMeta = (apiRef, props) => {
|
|
|
114
117
|
}, [apiRef, currentPage.rows, getRowHeightProp, getEstimatedRowHeight, rowHeight, getRowSpacing, densityFactor]);
|
|
115
118
|
const hydrateRowsMeta = React.useCallback(() => {
|
|
116
119
|
hasRowWithAutoHeight.current = false;
|
|
117
|
-
pinnedRows.top.
|
|
118
|
-
|
|
120
|
+
const pinnedTopRowsTotalHeight = pinnedRows.top.reduce((acc, row) => {
|
|
121
|
+
const entry = processHeightEntry(row);
|
|
122
|
+
return acc + entry.content + entry.spacingTop + entry.spacingBottom + entry.detail;
|
|
123
|
+
}, 0);
|
|
124
|
+
const pinnedBottomRowsTotalHeight = pinnedRows.bottom.reduce((acc, row) => {
|
|
125
|
+
const entry = processHeightEntry(row);
|
|
126
|
+
return acc + entry.content + entry.spacingTop + entry.spacingBottom + entry.detail;
|
|
127
|
+
}, 0);
|
|
119
128
|
const positions = [];
|
|
120
129
|
const currentPageTotalHeight = currentPage.rows.reduce((acc, row) => {
|
|
121
130
|
positions.push(acc);
|
|
@@ -127,14 +136,21 @@ export const useGridRowsMeta = (apiRef, props) => {
|
|
|
127
136
|
// No row has height=auto, so all rows are already measured
|
|
128
137
|
lastMeasuredRowIndex.current = Infinity;
|
|
129
138
|
}
|
|
139
|
+
const didHeightsChange = pinnedTopRowsTotalHeight !== apiRef.current.state.rowsMeta.pinnedTopRowsTotalHeight || pinnedBottomRowsTotalHeight !== apiRef.current.state.rowsMeta.pinnedBottomRowsTotalHeight || currentPageTotalHeight !== apiRef.current.state.rowsMeta.currentPageTotalHeight;
|
|
140
|
+
const rowsMeta = {
|
|
141
|
+
currentPageTotalHeight,
|
|
142
|
+
positions,
|
|
143
|
+
pinnedTopRowsTotalHeight,
|
|
144
|
+
pinnedBottomRowsTotalHeight
|
|
145
|
+
};
|
|
130
146
|
apiRef.current.setState(state => {
|
|
131
147
|
return _extends({}, state, {
|
|
132
|
-
rowsMeta
|
|
133
|
-
currentPageTotalHeight,
|
|
134
|
-
positions
|
|
135
|
-
}
|
|
148
|
+
rowsMeta
|
|
136
149
|
});
|
|
137
150
|
});
|
|
151
|
+
if (didHeightsChange) {
|
|
152
|
+
apiRef.current.updateDimensions();
|
|
153
|
+
}
|
|
138
154
|
isHeightMetaValid.current = true;
|
|
139
155
|
}, [apiRef, pinnedRows, currentPage.rows, processHeightEntry]);
|
|
140
156
|
const getRowHeight = rowId => {
|
|
@@ -184,7 +200,7 @@ export const useGridRowsMeta = (apiRef, props) => {
|
|
|
184
200
|
// Because of variable row height this is needed for the virtualization
|
|
185
201
|
useEnhancedEffect(() => {
|
|
186
202
|
hydrateRowsMeta();
|
|
187
|
-
}, [
|
|
203
|
+
}, [hydrateRowsMeta]);
|
|
188
204
|
const rowsMetaApi = {
|
|
189
205
|
unstable_getRowHeight: getRowHeight,
|
|
190
206
|
unstable_setLastMeasuredRowIndex: setLastMeasuredRowIndex,
|
|
@@ -24,15 +24,16 @@ export const gridSortedRowEntriesSelector = createSelectorMemoized(gridSortedRow
|
|
|
24
24
|
id,
|
|
25
25
|
model
|
|
26
26
|
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
} else {
|
|
28
|
+
const rowNode = rowTree[id];
|
|
29
|
+
if (rowNode && isAutogeneratedRowNode(rowNode)) {
|
|
30
|
+
acc.push({
|
|
31
|
+
id,
|
|
32
|
+
model: {
|
|
33
|
+
[GRID_ID_AUTOGENERATED]: id
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
36
37
|
}
|
|
37
38
|
return acc;
|
|
38
39
|
}, []));
|
|
@@ -6,15 +6,15 @@ import useLazyRef from '@mui/utils/useLazyRef';
|
|
|
6
6
|
import useTimeout from '@mui/utils/useTimeout';
|
|
7
7
|
import { useRtl } from '@mui/system/RtlProvider';
|
|
8
8
|
import reactMajor from '@mui/x-internals/reactMajor';
|
|
9
|
+
import { gridDimensionsSelector, gridColumnsTotalWidthSelector, gridContentHeightSelector, gridHasFillerSelector, gridRowHeightSelector, gridVerticalScrollbarWidthSelector } from "../dimensions/gridDimensionsSelectors.js";
|
|
9
10
|
import { useGridPrivateApiContext } from "../../utils/useGridPrivateApiContext.js";
|
|
10
11
|
import { useGridRootProps } from "../../utils/useGridRootProps.js";
|
|
11
12
|
import { useGridSelector } from "../../utils/useGridSelector.js";
|
|
12
13
|
import { useRunOnce } from "../../utils/useRunOnce.js";
|
|
13
14
|
import { gridVisibleColumnDefinitionsSelector, gridVisiblePinnedColumnDefinitionsSelector, gridColumnPositionsSelector, gridHasColSpanSelector } from "../columns/gridColumnsSelector.js";
|
|
14
|
-
import { gridDimensionsSelector } from "../dimensions/gridDimensionsSelectors.js";
|
|
15
15
|
import { gridPinnedRowsSelector } from "../rows/gridRowsSelector.js";
|
|
16
16
|
import { useGridVisibleRows, getVisibleRows } from "../../utils/useGridVisibleRows.js";
|
|
17
|
-
import {
|
|
17
|
+
import { useGridApiOptionHandler } from "../../utils/index.js";
|
|
18
18
|
import * as platform from "../../../utils/platform.js";
|
|
19
19
|
import { clamp, range } from "../../../utils/utils.js";
|
|
20
20
|
import { selectedIdsLookupSelector } from "../rowSelection/gridRowSelectionSelector.js";
|
|
@@ -57,8 +57,6 @@ export const useGridVirtualScroller = () => {
|
|
|
57
57
|
const visibleColumns = useGridSelector(apiRef, () => listView ? [gridListColumnSelector(apiRef.current.state)] : gridVisibleColumnDefinitionsSelector(apiRef));
|
|
58
58
|
const enabledForRows = useGridSelector(apiRef, gridVirtualizationRowEnabledSelector) && !isJSDOM;
|
|
59
59
|
const enabledForColumns = useGridSelector(apiRef, gridVirtualizationColumnEnabledSelector) && !isJSDOM;
|
|
60
|
-
const dimensions = useGridSelector(apiRef, gridDimensionsSelector);
|
|
61
|
-
const outerSize = dimensions.viewportOuterSize;
|
|
62
60
|
const pinnedRows = useGridSelector(apiRef, gridPinnedRowsSelector);
|
|
63
61
|
const pinnedColumnDefinitions = gridVisiblePinnedColumnDefinitionsSelector(apiRef);
|
|
64
62
|
const pinnedColumns = listView ? EMPTY_PINNED_COLUMN_FIELDS : pinnedColumnDefinitions;
|
|
@@ -71,10 +69,14 @@ export const useGridVirtualScroller = () => {
|
|
|
71
69
|
const scrollerRef = apiRef.current.virtualScrollerRef;
|
|
72
70
|
const scrollbarVerticalRef = apiRef.current.virtualScrollbarVerticalRef;
|
|
73
71
|
const scrollbarHorizontalRef = apiRef.current.virtualScrollbarHorizontalRef;
|
|
74
|
-
const contentHeight = dimensions.contentSize.height;
|
|
75
|
-
const columnsTotalWidth = dimensions.columnsTotalWidth;
|
|
76
72
|
const hasColSpan = useGridSelector(apiRef, gridHasColSpanSelector);
|
|
77
73
|
const isRenderContextReady = React.useRef(false);
|
|
74
|
+
const rowHeight = useGridSelector(apiRef, gridRowHeightSelector);
|
|
75
|
+
const contentHeight = useGridSelector(apiRef, gridContentHeightSelector);
|
|
76
|
+
const columnsTotalWidth = useGridSelector(apiRef, gridColumnsTotalWidthSelector);
|
|
77
|
+
const needsHorizontalScrollbar = useGridSelector(apiRef, needsHorizontalScrollbarSelector);
|
|
78
|
+
const verticalScrollbarWidth = useGridSelector(apiRef, gridVerticalScrollbarWidthSelector);
|
|
79
|
+
const gridHasFiller = useGridSelector(apiRef, gridHasFillerSelector);
|
|
78
80
|
const previousSize = React.useRef(null);
|
|
79
81
|
const mainRefCallback = React.useCallback(node => {
|
|
80
82
|
mainRef.current = node;
|
|
@@ -141,7 +143,7 @@ export const useGridVirtualScroller = () => {
|
|
|
141
143
|
const focusedVirtualCell = useGridSelector(apiRef, gridFocusedVirtualCellSelector);
|
|
142
144
|
const scrollTimeout = useTimeout();
|
|
143
145
|
const frozenContext = React.useRef(undefined);
|
|
144
|
-
const scrollCache = useLazyRef(() => createScrollCache(isRtl, rootProps.rowBufferPx, rootProps.columnBufferPx,
|
|
146
|
+
const scrollCache = useLazyRef(() => createScrollCache(isRtl, rootProps.rowBufferPx, rootProps.columnBufferPx, rowHeight * 15, MINIMUM_COLUMN_WIDTH * 6)).current;
|
|
145
147
|
const updateRenderContext = React.useCallback(nextRenderContext => {
|
|
146
148
|
if (areRenderContextsEqual(nextRenderContext, apiRef.current.state.virtualization.renderContext)) {
|
|
147
149
|
return;
|
|
@@ -156,19 +158,21 @@ export const useGridVirtualScroller = () => {
|
|
|
156
158
|
});
|
|
157
159
|
|
|
158
160
|
// The lazy-loading hook is listening to `renderedRowsIntervalChange`,
|
|
159
|
-
// but only does something if
|
|
160
|
-
//
|
|
161
|
-
|
|
161
|
+
// but only does something if we already have a render context, because
|
|
162
|
+
// otherwise we would call an update directly on mount
|
|
163
|
+
const isReady = gridDimensionsSelector(apiRef.current.state).isReady;
|
|
164
|
+
if (isReady && didRowsIntervalChange) {
|
|
162
165
|
previousRowContext.current = nextRenderContext;
|
|
163
166
|
apiRef.current.publishEvent('renderedRowsIntervalChange', nextRenderContext);
|
|
164
167
|
}
|
|
165
168
|
previousContextScrollPosition.current = scrollPosition.current;
|
|
166
|
-
}, [apiRef
|
|
169
|
+
}, [apiRef]);
|
|
167
170
|
const triggerUpdateRenderContext = useEventCallback(() => {
|
|
168
171
|
const scroller = scrollerRef.current;
|
|
169
172
|
if (!scroller) {
|
|
170
173
|
return undefined;
|
|
171
174
|
}
|
|
175
|
+
const dimensions = gridDimensionsSelector(apiRef.current.state);
|
|
172
176
|
const maxScrollTop = Math.ceil(dimensions.minimumSize.height - dimensions.viewportOuterSize.height);
|
|
173
177
|
const maxScrollLeft = Math.ceil(dimensions.minimumSize.width - dimensions.viewportInnerSize.width);
|
|
174
178
|
|
|
@@ -188,7 +192,7 @@ export const useGridVirtualScroller = () => {
|
|
|
188
192
|
const columnScroll = Math.abs(scrollPosition.current.left - previousContextScrollPosition.current.left);
|
|
189
193
|
|
|
190
194
|
// PERF: use the computed minimum column width instead of a static one
|
|
191
|
-
const didCrossThreshold = rowScroll >=
|
|
195
|
+
const didCrossThreshold = rowScroll >= rowHeight || columnScroll >= MINIMUM_COLUMN_WIDTH;
|
|
192
196
|
const didChangeDirection = scrollCache.direction !== direction;
|
|
193
197
|
const shouldUpdate = didCrossThreshold || didChangeDirection;
|
|
194
198
|
if (!shouldUpdate) {
|
|
@@ -210,7 +214,7 @@ export const useGridVirtualScroller = () => {
|
|
|
210
214
|
}
|
|
211
215
|
}
|
|
212
216
|
scrollCache.direction = direction;
|
|
213
|
-
scrollCache.buffer = bufferForDirection(isRtl, direction, rootProps.rowBufferPx, rootProps.columnBufferPx,
|
|
217
|
+
scrollCache.buffer = bufferForDirection(isRtl, direction, rootProps.rowBufferPx, rootProps.columnBufferPx, rowHeight * 15, MINIMUM_COLUMN_WIDTH * 6);
|
|
214
218
|
const inputs = inputsSelector(apiRef, rootProps, enabledForRows, enabledForColumns);
|
|
215
219
|
const nextRenderContext = computeRenderContext(inputs, scrollPosition.current, scrollCache);
|
|
216
220
|
|
|
@@ -222,6 +226,10 @@ export const useGridVirtualScroller = () => {
|
|
|
222
226
|
return nextRenderContext;
|
|
223
227
|
});
|
|
224
228
|
const forceUpdateRenderContext = () => {
|
|
229
|
+
// skip update if dimensions are not ready and virtualization is enabled
|
|
230
|
+
if (!gridDimensionsSelector(apiRef.current.state).isReady && (enabledForRows || enabledForColumns)) {
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
225
233
|
const inputs = inputsSelector(apiRef, rootProps, enabledForRows, enabledForColumns);
|
|
226
234
|
const nextRenderContext = computeRenderContext(inputs, scrollPosition.current, scrollCache);
|
|
227
235
|
// Reset the frozen context when the render context changes, see the illustration in https://github.com/mui/mui-x/pull/12353
|
|
@@ -250,7 +258,12 @@ export const useGridVirtualScroller = () => {
|
|
|
250
258
|
if (!params.rows && !currentPage.range) {
|
|
251
259
|
return [];
|
|
252
260
|
}
|
|
253
|
-
|
|
261
|
+
let baseRenderContext = renderContext;
|
|
262
|
+
if (params.renderContext) {
|
|
263
|
+
baseRenderContext = params.renderContext;
|
|
264
|
+
baseRenderContext.firstColumnIndex = renderContext.firstColumnIndex;
|
|
265
|
+
baseRenderContext.lastColumnIndex = renderContext.lastColumnIndex;
|
|
266
|
+
}
|
|
254
267
|
const isLastSection = !hasBottomPinnedRows && params.position === undefined || hasBottomPinnedRows && params.position === 'bottom';
|
|
255
268
|
const isPinnedSection = params.position !== undefined;
|
|
256
269
|
let rowIndexOffset;
|
|
@@ -344,7 +357,7 @@ export const useGridVirtualScroller = () => {
|
|
|
344
357
|
}
|
|
345
358
|
}
|
|
346
359
|
let currentRenderContext = baseRenderContext;
|
|
347
|
-
if (
|
|
360
|
+
if (frozenContext.current && rowIndexInPage >= frozenContext.current.firstRowIndex && rowIndexInPage < frozenContext.current.lastRowIndex) {
|
|
348
361
|
currentRenderContext = frozenContext.current;
|
|
349
362
|
}
|
|
350
363
|
const isVirtualFocusRow = rowIndexInPage === virtualRowIndex;
|
|
@@ -359,7 +372,7 @@ export const useGridVirtualScroller = () => {
|
|
|
359
372
|
index: rowIndex,
|
|
360
373
|
selected: isSelected,
|
|
361
374
|
offsetLeft: offsetLeft,
|
|
362
|
-
columnsTotalWidth:
|
|
375
|
+
columnsTotalWidth: columnsTotalWidth,
|
|
363
376
|
rowHeight: baseRowHeight,
|
|
364
377
|
pinnedColumns: pinnedColumns,
|
|
365
378
|
visibleColumns: visibleColumns,
|
|
@@ -370,8 +383,8 @@ export const useGridVirtualScroller = () => {
|
|
|
370
383
|
isLastVisible: isLastVisible,
|
|
371
384
|
isNotVisible: isVirtualFocusRow,
|
|
372
385
|
showBottomBorder: showBottomBorder,
|
|
373
|
-
scrollbarWidth:
|
|
374
|
-
gridHasFiller:
|
|
386
|
+
scrollbarWidth: verticalScrollbarWidth,
|
|
387
|
+
gridHasFiller: gridHasFiller
|
|
375
388
|
}, rowProps), id));
|
|
376
389
|
if (isVirtualFocusRow) {
|
|
377
390
|
return;
|
|
@@ -388,7 +401,6 @@ export const useGridVirtualScroller = () => {
|
|
|
388
401
|
});
|
|
389
402
|
return rows;
|
|
390
403
|
};
|
|
391
|
-
const needsHorizontalScrollbar = outerSize.width && columnsTotalWidth > outerSize.width;
|
|
392
404
|
const scrollerStyle = React.useMemo(() => ({
|
|
393
405
|
overflowX: !needsHorizontalScrollbar || listView ? 'hidden' : undefined,
|
|
394
406
|
overflowY: rootProps.autoHeight ? 'hidden' : undefined
|
|
@@ -424,14 +436,11 @@ export const useGridVirtualScroller = () => {
|
|
|
424
436
|
scrollerRef.current.scrollLeft = 0;
|
|
425
437
|
}
|
|
426
438
|
}, [listView, scrollerRef]);
|
|
427
|
-
useRunOnce(
|
|
428
|
-
const inputs = inputsSelector(apiRef, rootProps, enabledForRows, enabledForColumns);
|
|
429
|
-
const initialRenderContext = computeRenderContext(inputs, scrollPosition.current, scrollCache);
|
|
430
|
-
updateRenderContext(initialRenderContext);
|
|
439
|
+
useRunOnce(renderContext !== EMPTY_RENDER_CONTEXT, () => {
|
|
431
440
|
apiRef.current.publishEvent('scrollPositionChange', {
|
|
432
441
|
top: scrollPosition.current.top,
|
|
433
442
|
left: scrollPosition.current.left,
|
|
434
|
-
renderContext
|
|
443
|
+
renderContext
|
|
435
444
|
});
|
|
436
445
|
isRenderContextReady.current = true;
|
|
437
446
|
if (rootProps.initialState?.scroll && scrollerRef.current) {
|
|
@@ -484,9 +493,9 @@ export const useGridVirtualScroller = () => {
|
|
|
484
493
|
apiRef.current.register('private', {
|
|
485
494
|
updateRenderContext: forceUpdateRenderContext
|
|
486
495
|
});
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
496
|
+
useGridApiOptionHandler(apiRef, 'sortedRowsSet', forceUpdateRenderContext);
|
|
497
|
+
useGridApiOptionHandler(apiRef, 'paginationModelChange', forceUpdateRenderContext);
|
|
498
|
+
useGridApiOptionHandler(apiRef, 'columnsChange', forceUpdateRenderContext);
|
|
490
499
|
return {
|
|
491
500
|
renderContext,
|
|
492
501
|
setPanels,
|
|
@@ -522,9 +531,16 @@ export const useGridVirtualScroller = () => {
|
|
|
522
531
|
ref: scrollbarHorizontalRef,
|
|
523
532
|
role: 'presentation',
|
|
524
533
|
scrollPosition
|
|
534
|
+
}),
|
|
535
|
+
getScrollAreaProps: () => ({
|
|
536
|
+
scrollPosition
|
|
525
537
|
})
|
|
526
538
|
};
|
|
527
539
|
};
|
|
540
|
+
// dimension selectors
|
|
541
|
+
function needsHorizontalScrollbarSelector(state) {
|
|
542
|
+
return state.dimensions.viewportOuterSize.width > 0 && state.dimensions.columnsTotalWidth > state.dimensions.viewportOuterSize.width;
|
|
543
|
+
}
|
|
528
544
|
function inputsSelector(apiRef, rootProps, enabledForRows, enabledForColumns) {
|
|
529
545
|
const dimensions = gridDimensionsSelector(apiRef.current.state);
|
|
530
546
|
const currentPage = getVisibleRows(apiRef, rootProps);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { useGridApiEventHandler, useGridApiOptionHandler, unstable_resetCleanupTracking } from "./useGridApiEventHandler.js";
|
|
2
2
|
export * from "./useGridApiMethod.js";
|
|
3
3
|
export * from "./useGridLogger.js";
|
|
4
4
|
export { useGridSelector } from "./useGridSelector.js";
|