@mui/x-data-grid 7.0.0-beta.4 → 7.0.0-beta.5
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 +138 -14
- package/DataGrid/DataGrid.js +2 -0
- package/colDef/gridBooleanOperators.js +1 -1
- package/components/GridRow.d.ts +7 -9
- package/components/GridRow.js +36 -47
- package/components/cell/GridCell.d.ts +2 -1
- package/components/cell/GridCell.js +7 -3
- package/components/cell/GridSkeletonCell.d.ts +3 -2
- package/components/cell/GridSkeletonCell.js +14 -6
- package/components/columnSelection/GridCellCheckboxRenderer.js +6 -4
- package/components/columnsManagement/GridColumnsManagement.js +1 -1
- package/components/containers/GridRootStyles.js +9 -2
- package/components/virtualization/GridBottomContainer.js +1 -1
- package/components/virtualization/GridTopContainer.js +1 -1
- package/components/virtualization/GridVirtualScroller.js +2 -2
- package/components/virtualization/GridVirtualScrollerRenderZone.js +9 -3
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +11 -8
- package/hooks/features/columns/gridColumnsSelector.d.ts +6 -0
- package/hooks/features/columns/gridColumnsSelector.js +8 -1
- package/hooks/features/columns/useGridColumns.js +4 -0
- package/hooks/features/editing/useGridRowEditing.js +1 -2
- package/hooks/features/filter/useGridFilter.js +2 -2
- package/hooks/features/rows/useGridRows.js +8 -4
- package/hooks/features/rows/useGridRowsMeta.js +5 -13
- package/hooks/features/sorting/gridSortingUtils.js +9 -1
- package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +0 -9
- package/hooks/features/virtualization/gridVirtualizationSelectors.js +0 -7
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +3 -0
- package/hooks/features/virtualization/useGridVirtualScroller.js +82 -138
- package/hooks/features/virtualization/useGridVirtualization.d.ts +0 -8
- package/hooks/features/virtualization/useGridVirtualization.js +1 -6
- package/hooks/utils/useTimeout.d.ts +5 -3
- package/hooks/utils/useTimeout.js +13 -5
- package/index.js +1 -1
- package/models/colDef/gridColDef.d.ts +7 -0
- package/modern/DataGrid/DataGrid.js +2 -0
- package/modern/colDef/gridBooleanOperators.js +1 -1
- package/modern/components/GridRow.js +35 -46
- package/modern/components/cell/GridCell.js +7 -3
- package/modern/components/cell/GridSkeletonCell.js +14 -6
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +6 -4
- package/modern/components/columnsManagement/GridColumnsManagement.js +1 -1
- package/modern/components/containers/GridRootStyles.js +9 -2
- package/modern/components/virtualization/GridBottomContainer.js +1 -1
- package/modern/components/virtualization/GridTopContainer.js +1 -1
- package/modern/components/virtualization/GridVirtualScroller.js +2 -2
- package/modern/components/virtualization/GridVirtualScrollerRenderZone.js +8 -3
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +11 -8
- package/modern/hooks/features/columns/gridColumnsSelector.js +8 -1
- package/modern/hooks/features/columns/useGridColumns.js +2 -0
- package/modern/hooks/features/editing/useGridRowEditing.js +1 -2
- package/modern/hooks/features/filter/useGridFilter.js +2 -2
- package/modern/hooks/features/rows/useGridRows.js +8 -4
- package/modern/hooks/features/rows/useGridRowsMeta.js +5 -13
- package/modern/hooks/features/sorting/gridSortingUtils.js +9 -1
- package/modern/hooks/features/virtualization/gridVirtualizationSelectors.js +0 -7
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +80 -136
- package/modern/hooks/features/virtualization/useGridVirtualization.js +1 -6
- package/modern/hooks/utils/useTimeout.js +13 -5
- package/modern/index.js +1 -1
- package/modern/utils/utils.js +9 -0
- package/node/DataGrid/DataGrid.js +1 -0
- package/node/colDef/gridBooleanOperators.js +1 -1
- package/node/components/GridRow.js +35 -46
- package/node/components/cell/GridCell.js +7 -3
- package/node/components/cell/GridSkeletonCell.js +15 -7
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +6 -4
- package/node/components/columnsManagement/GridColumnsManagement.js +1 -1
- package/node/components/containers/GridRootStyles.js +9 -2
- package/node/components/virtualization/GridBottomContainer.js +1 -1
- package/node/components/virtualization/GridTopContainer.js +1 -1
- package/node/components/virtualization/GridVirtualScroller.js +2 -2
- package/node/components/virtualization/GridVirtualScrollerRenderZone.js +7 -2
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +8 -5
- package/node/hooks/features/columns/gridColumnsSelector.js +9 -2
- package/node/hooks/features/columns/useGridColumns.js +2 -0
- package/node/hooks/features/editing/useGridRowEditing.js +1 -2
- package/node/hooks/features/filter/useGridFilter.js +2 -2
- package/node/hooks/features/rows/useGridRows.js +8 -4
- package/node/hooks/features/rows/useGridRowsMeta.js +5 -13
- package/node/hooks/features/sorting/gridSortingUtils.js +9 -1
- package/node/hooks/features/virtualization/gridVirtualizationSelectors.js +1 -8
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +81 -136
- package/node/hooks/features/virtualization/useGridVirtualization.js +2 -7
- package/node/hooks/utils/useTimeout.js +13 -4
- package/node/index.js +1 -1
- package/node/utils/utils.js +12 -1
- package/package.json +1 -1
- package/utils/utils.d.ts +4 -0
- package/utils/utils.js +9 -0
|
@@ -341,7 +341,7 @@ export const GridRootStyles = styled('div', {
|
|
|
341
341
|
[`& .${c.columnSeparator}`]: {
|
|
342
342
|
visibility: 'hidden',
|
|
343
343
|
position: 'absolute',
|
|
344
|
-
zIndex:
|
|
344
|
+
zIndex: 3,
|
|
345
345
|
display: 'flex',
|
|
346
346
|
flexDirection: 'column',
|
|
347
347
|
justifyContent: 'center',
|
|
@@ -462,7 +462,8 @@ export const GridRootStyles = styled('div', {
|
|
|
462
462
|
lineHeight: 'inherit'
|
|
463
463
|
},
|
|
464
464
|
[`& .${c.cellEmpty}`]: {
|
|
465
|
-
padding: 0
|
|
465
|
+
padding: 0,
|
|
466
|
+
height: 'unset'
|
|
466
467
|
},
|
|
467
468
|
[`& .${c.cell}.${c['cell--selectionMode']}`]: {
|
|
468
469
|
cursor: 'default'
|
|
@@ -578,6 +579,12 @@ export const GridRootStyles = styled('div', {
|
|
|
578
579
|
flex: '0 0 auto',
|
|
579
580
|
display: 'inline-block'
|
|
580
581
|
},
|
|
582
|
+
[`& .${c.cellSkeleton}`]: {
|
|
583
|
+
flex: '0 0 auto',
|
|
584
|
+
height: '100%',
|
|
585
|
+
display: 'inline-flex',
|
|
586
|
+
alignItems: 'center'
|
|
587
|
+
},
|
|
581
588
|
[`& .${c.columnHeaderDraggableContainer}`]: {
|
|
582
589
|
display: 'flex',
|
|
583
590
|
width: '100%',
|
|
@@ -85,9 +85,9 @@ function GridVirtualScroller(props) {
|
|
|
85
85
|
virtualScroller: virtualScroller
|
|
86
86
|
})
|
|
87
87
|
})]
|
|
88
|
-
})), /*#__PURE__*/_jsx(Scrollbar, _extends({
|
|
88
|
+
})), dimensions.hasScrollY && /*#__PURE__*/_jsx(Scrollbar, _extends({
|
|
89
89
|
position: "vertical"
|
|
90
|
-
}, getScrollbarVerticalProps())), /*#__PURE__*/_jsx(Scrollbar, _extends({
|
|
90
|
+
}, getScrollbarVerticalProps())), dimensions.hasScrollX && /*#__PURE__*/_jsx(Scrollbar, _extends({
|
|
91
91
|
position: "horizontal"
|
|
92
92
|
}, getScrollbarHorizontalProps())), props.children]
|
|
93
93
|
}));
|
|
@@ -7,7 +7,8 @@ import { styled } from '@mui/system';
|
|
|
7
7
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
8
8
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
9
9
|
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
10
|
-
import {
|
|
10
|
+
import { gridRowsMetaSelector } from '../../hooks/features/rows';
|
|
11
|
+
import { gridRenderContextSelector } from '../../hooks/features/virtualization';
|
|
11
12
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
12
13
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -38,13 +39,18 @@ const GridVirtualScrollerRenderZone = /*#__PURE__*/React.forwardRef(function Gri
|
|
|
38
39
|
const apiRef = useGridApiContext();
|
|
39
40
|
const rootProps = useGridRootProps();
|
|
40
41
|
const classes = useUtilityClasses(rootProps);
|
|
41
|
-
const
|
|
42
|
+
const offsetTop = useGridSelector(apiRef, () => {
|
|
43
|
+
var _rowsMeta$positions$r;
|
|
44
|
+
const renderContext = gridRenderContextSelector(apiRef);
|
|
45
|
+
const rowsMeta = gridRowsMetaSelector(apiRef.current.state);
|
|
46
|
+
return (_rowsMeta$positions$r = rowsMeta.positions[renderContext.firstRowIndex]) != null ? _rowsMeta$positions$r : 0;
|
|
47
|
+
});
|
|
42
48
|
return /*#__PURE__*/_jsx(VirtualScrollerRenderZoneRoot, _extends({
|
|
43
49
|
ref: ref,
|
|
44
50
|
className: clsx(classes.root, className),
|
|
45
51
|
ownerState: rootProps,
|
|
46
52
|
style: {
|
|
47
|
-
transform: `translate3d(0, ${
|
|
53
|
+
transform: `translate3d(0, ${offsetTop}px, 0)`
|
|
48
54
|
}
|
|
49
55
|
}, other));
|
|
50
56
|
});
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { unstable_useForkRef as useForkRef } from '@mui/utils';
|
|
4
|
-
import { styled } from '@mui/material/styles';
|
|
4
|
+
import { styled, useTheme } from '@mui/material/styles';
|
|
5
5
|
import { useGridSelector } from '../../utils';
|
|
6
6
|
import { useGridRootProps } from '../../utils/useGridRootProps';
|
|
7
7
|
import { useGridPrivateApiContext } from '../../utils/useGridPrivateApiContext';
|
|
8
8
|
import { useGridApiEventHandler } from '../../utils/useGridApiEventHandler';
|
|
9
9
|
import { GridColumnHeaderItem } from '../../../components/columnHeaders/GridColumnHeaderItem';
|
|
10
10
|
import { gridDimensionsSelector } from '../dimensions';
|
|
11
|
-
import {
|
|
11
|
+
import { gridRenderContextColumnsSelector, gridVirtualizationColumnEnabledSelector } from '../virtualization';
|
|
12
|
+
import { computeOffsetLeft } from '../virtualization/useGridVirtualScroller';
|
|
12
13
|
import { GridColumnGroupHeader } from '../../../components/columnHeaders/GridColumnGroupHeader';
|
|
13
|
-
import { GridPinnedColumnPosition, gridVisiblePinnedColumnDefinitionsSelector } from '../columns';
|
|
14
|
+
import { GridPinnedColumnPosition, gridColumnPositionsSelector, gridVisiblePinnedColumnDefinitionsSelector } from '../columns';
|
|
14
15
|
import { GridScrollbarFillerCell as ScrollbarFiller } from '../../../components/GridScrollbarFillerCell';
|
|
15
16
|
import { gridClasses } from '../../../constants/gridClasses';
|
|
16
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
18
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
19
|
const SpaceFiller = styled('div')({
|
|
19
20
|
/* GridRootStyles conflict */
|
|
20
|
-
'
|
|
21
|
+
'&&&': {
|
|
21
22
|
padding: 0,
|
|
22
23
|
width: 'calc(var(--DataGrid-width) - var(--DataGrid-columnsTotalWidth))'
|
|
23
24
|
}
|
|
@@ -49,14 +50,16 @@ export const useGridColumnHeaders = props => {
|
|
|
49
50
|
const [dragCol, setDragCol] = React.useState('');
|
|
50
51
|
const [resizeCol, setResizeCol] = React.useState('');
|
|
51
52
|
const apiRef = useGridPrivateApiContext();
|
|
53
|
+
const theme = useTheme();
|
|
52
54
|
const rootProps = useGridRootProps();
|
|
53
55
|
const hasVirtualization = useGridSelector(apiRef, gridVirtualizationColumnEnabledSelector);
|
|
54
56
|
const innerRef = React.useRef(null);
|
|
55
57
|
const handleInnerRef = useForkRef(innerRefProp, innerRef);
|
|
56
58
|
const dimensions = useGridSelector(apiRef, gridDimensionsSelector);
|
|
57
|
-
const
|
|
59
|
+
const columnPositions = useGridSelector(apiRef, gridColumnPositionsSelector);
|
|
58
60
|
const renderContext = useGridSelector(apiRef, gridRenderContextColumnsSelector);
|
|
59
|
-
const
|
|
61
|
+
const pinnedColumns = useGridSelector(apiRef, gridVisiblePinnedColumnDefinitionsSelector);
|
|
62
|
+
const offsetLeft = computeOffsetLeft(columnPositions, renderContext, theme.direction, pinnedColumns.left.length);
|
|
60
63
|
React.useEffect(() => {
|
|
61
64
|
apiRef.current.columnHeadersContainerElementRef.current.scrollLeft = 0;
|
|
62
65
|
}, [apiRef]);
|
|
@@ -88,8 +91,8 @@ export const useGridColumnHeaders = props => {
|
|
|
88
91
|
const getFillers = (params, children, leftOverflow, borderTop = false) => {
|
|
89
92
|
const isPinnedRight = (params == null ? void 0 : params.position) === GridPinnedColumnPosition.RIGHT;
|
|
90
93
|
const isNotPinned = (params == null ? void 0 : params.position) === undefined;
|
|
91
|
-
const hasScrollbarFiller =
|
|
92
|
-
const leftOffsetWidth =
|
|
94
|
+
const hasScrollbarFiller = pinnedColumns.right.length > 0 && isPinnedRight || pinnedColumns.right.length === 0 && isNotPinned;
|
|
95
|
+
const leftOffsetWidth = offsetLeft - leftOverflow;
|
|
93
96
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
94
97
|
children: [isNotPinned && /*#__PURE__*/_jsx("div", {
|
|
95
98
|
role: "presentation",
|
|
@@ -69,3 +69,9 @@ export declare const gridFilterableColumnDefinitionsSelector: import("../../../u
|
|
|
69
69
|
* @category Columns
|
|
70
70
|
*/
|
|
71
71
|
export declare const gridFilterableColumnLookupSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, GridColumnLookup>;
|
|
72
|
+
/**
|
|
73
|
+
* Checks if some column has a colSpan field.
|
|
74
|
+
* @category Columns
|
|
75
|
+
* @ignore - Do not document
|
|
76
|
+
*/
|
|
77
|
+
export declare const gridHasColSpanSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, boolean>;
|
|
@@ -135,4 +135,11 @@ export const gridFilterableColumnLookupSelector = createSelectorMemoized(gridCol
|
|
|
135
135
|
acc[col.field] = col;
|
|
136
136
|
}
|
|
137
137
|
return acc;
|
|
138
|
-
}, {}));
|
|
138
|
+
}, {}));
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Checks if some column has a colSpan field.
|
|
142
|
+
* @category Columns
|
|
143
|
+
* @ignore - Do not document
|
|
144
|
+
*/
|
|
145
|
+
export const gridHasColSpanSelector = createSelectorMemoized(gridColumnDefinitionsSelector, columns => columns.some(column => column.colSpan !== undefined));
|
|
@@ -43,9 +43,11 @@ export function useGridColumns(apiRef, props) {
|
|
|
43
43
|
changeEvent: 'columnVisibilityModelChange'
|
|
44
44
|
});
|
|
45
45
|
const setGridColumnsState = React.useCallback(columnsState => {
|
|
46
|
+
var _apiRef$current$updat, _apiRef$current;
|
|
46
47
|
logger.debug('Updating columns state.');
|
|
47
48
|
apiRef.current.setState(mergeColumnsState(columnsState));
|
|
48
49
|
apiRef.current.publishEvent('columnsChange', columnsState.orderedFields);
|
|
50
|
+
(_apiRef$current$updat = (_apiRef$current = apiRef.current).updateRenderContext) == null || _apiRef$current$updat.call(_apiRef$current);
|
|
49
51
|
apiRef.current.forceUpdate();
|
|
50
52
|
}, [logger, apiRef]);
|
|
51
53
|
|
|
@@ -66,6 +68,7 @@ export function useGridColumns(apiRef, props) {
|
|
|
66
68
|
const setColumnVisibilityModel = React.useCallback(model => {
|
|
67
69
|
const currentModel = gridColumnVisibilityModelSelector(apiRef);
|
|
68
70
|
if (currentModel !== model) {
|
|
71
|
+
var _apiRef$current$updat2, _apiRef$current2;
|
|
69
72
|
apiRef.current.setState(state => _extends({}, state, {
|
|
70
73
|
columns: createColumnsState({
|
|
71
74
|
apiRef,
|
|
@@ -75,6 +78,7 @@ export function useGridColumns(apiRef, props) {
|
|
|
75
78
|
keepOnlyColumnsToUpsert: false
|
|
76
79
|
})
|
|
77
80
|
}));
|
|
81
|
+
(_apiRef$current$updat2 = (_apiRef$current2 = apiRef.current).updateRenderContext) == null || _apiRef$current$updat2.call(_apiRef$current2);
|
|
78
82
|
apiRef.current.forceUpdate();
|
|
79
83
|
}
|
|
80
84
|
}, [apiRef]);
|
|
@@ -21,7 +21,7 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
21
21
|
const [rowModesModel, setRowModesModel] = React.useState({});
|
|
22
22
|
const rowModesModelRef = React.useRef(rowModesModel);
|
|
23
23
|
const prevRowModesModel = React.useRef({});
|
|
24
|
-
const focusTimeout = React.useRef(
|
|
24
|
+
const focusTimeout = React.useRef();
|
|
25
25
|
const nextFocusedCell = React.useRef(null);
|
|
26
26
|
const {
|
|
27
27
|
processRowUpdate,
|
|
@@ -77,7 +77,6 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
77
77
|
nextFocusedCell.current = null;
|
|
78
78
|
focusTimeout.current = setTimeout(() => {
|
|
79
79
|
var _nextFocusedCell$curr;
|
|
80
|
-
focusTimeout.current = null;
|
|
81
80
|
if (((_nextFocusedCell$curr = nextFocusedCell.current) == null ? void 0 : _nextFocusedCell$curr.id) !== params.id) {
|
|
82
81
|
// The row might have been deleted during the click
|
|
83
82
|
if (!apiRef.current.getRow(params.id)) {
|
|
@@ -107,7 +107,7 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
107
107
|
const filterModel = gridFilterModelSelector(apiRef);
|
|
108
108
|
const existingItems = [...filterModel.items];
|
|
109
109
|
items.forEach(item => {
|
|
110
|
-
const itemIndex =
|
|
110
|
+
const itemIndex = existingItems.findIndex(filterItem => filterItem.id === item.id);
|
|
111
111
|
if (itemIndex === -1) {
|
|
112
112
|
existingItems.push(item);
|
|
113
113
|
} else {
|
|
@@ -115,7 +115,7 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
117
|
apiRef.current.setFilterModel(_extends({}, filterModel, {
|
|
118
|
-
items
|
|
118
|
+
items: existingItems
|
|
119
119
|
}), 'upsertFilterItems');
|
|
120
120
|
}, [apiRef]);
|
|
121
121
|
const deleteFilterItem = React.useCallback(itemToDelete => {
|
|
@@ -266,13 +266,16 @@ export const useGridRows = (apiRef, props) => {
|
|
|
266
266
|
const dataRowIdToIdLookup = _extends({}, gridRowsDataRowIdToIdLookupSelector(apiRef));
|
|
267
267
|
const rootGroup = tree[GRID_ROOT_GROUP_ID];
|
|
268
268
|
const rootGroupChildren = [...rootGroup.children];
|
|
269
|
+
const seenIds = new Set();
|
|
269
270
|
for (let i = 0; i < newRows.length; i += 1) {
|
|
270
271
|
const rowModel = newRows[i];
|
|
271
272
|
const rowId = getRowIdFromRowModel(rowModel, props.getRowId, 'A row was provided without id when calling replaceRows().');
|
|
272
|
-
const [
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
273
|
+
const [removedRowId] = rootGroupChildren.splice(firstRowToRender + i, 1, rowId);
|
|
274
|
+
if (!seenIds.has(removedRowId)) {
|
|
275
|
+
delete dataRowIdToModelLookup[removedRowId];
|
|
276
|
+
delete dataRowIdToIdLookup[removedRowId];
|
|
277
|
+
delete tree[removedRowId];
|
|
278
|
+
}
|
|
276
279
|
const rowTreeNodeConfig = {
|
|
277
280
|
id: rowId,
|
|
278
281
|
depth: 0,
|
|
@@ -283,6 +286,7 @@ export const useGridRows = (apiRef, props) => {
|
|
|
283
286
|
dataRowIdToModelLookup[rowId] = rowModel;
|
|
284
287
|
dataRowIdToIdLookup[rowId] = rowId;
|
|
285
288
|
tree[rowId] = rowTreeNodeConfig;
|
|
289
|
+
seenIds.add(rowId);
|
|
286
290
|
}
|
|
287
291
|
tree[GRID_ROOT_GROUP_ID] = _extends({}, rootGroup, {
|
|
288
292
|
children: rootGroupChildren
|
|
@@ -107,14 +107,9 @@ export const useGridRowsMeta = (apiRef, props) => {
|
|
|
107
107
|
} else {
|
|
108
108
|
rowsHeightLookup.current[row.id].needsFirstMeasurement = false;
|
|
109
109
|
}
|
|
110
|
-
const initialHeights = {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if (/^base[A-Z]/.test(key)) {
|
|
114
|
-
initialHeights[key] = sizes[key];
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
initialHeights.baseCenter = baseRowHeight;
|
|
110
|
+
const initialHeights = {
|
|
111
|
+
baseCenter: baseRowHeight
|
|
112
|
+
};
|
|
118
113
|
if (getRowSpacing) {
|
|
119
114
|
var _spacing$top, _spacing$bottom;
|
|
120
115
|
const indexRelativeToCurrentPage = apiRef.current.getRowIndexRelativeToVisibleRows(row.id);
|
|
@@ -133,19 +128,16 @@ export const useGridRowsMeta = (apiRef, props) => {
|
|
|
133
128
|
const positions = [];
|
|
134
129
|
const currentPageTotalHeight = currentPage.rows.reduce((acc, row) => {
|
|
135
130
|
positions.push(acc);
|
|
136
|
-
let maximumBaseSize = 0;
|
|
137
131
|
let otherSizes = 0;
|
|
138
132
|
const processedSizes = calculateRowProcessedSizes(row);
|
|
139
133
|
/* eslint-disable-next-line no-restricted-syntax, guard-for-in */
|
|
140
134
|
for (const key in processedSizes) {
|
|
141
135
|
const value = processedSizes[key];
|
|
142
|
-
if (
|
|
143
|
-
maximumBaseSize = value > maximumBaseSize ? value : maximumBaseSize;
|
|
144
|
-
} else {
|
|
136
|
+
if (key !== 'baseCenter') {
|
|
145
137
|
otherSizes += value;
|
|
146
138
|
}
|
|
147
139
|
}
|
|
148
|
-
return acc +
|
|
140
|
+
return acc + processedSizes.baseCenter + otherSizes;
|
|
149
141
|
}, 0);
|
|
150
142
|
pinnedRows == null || (_pinnedRows$top = pinnedRows.top) == null || _pinnedRows$top.forEach(row => {
|
|
151
143
|
calculateRowProcessedSizes(row);
|
|
@@ -28,7 +28,15 @@ const parseSortItem = (sortItem, apiRef) => {
|
|
|
28
28
|
if (!column || sortItem.sort === null) {
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
let comparator;
|
|
32
|
+
if (column.getSortComparator) {
|
|
33
|
+
comparator = column.getSortComparator(sortItem.sort);
|
|
34
|
+
} else {
|
|
35
|
+
comparator = isDesc(sortItem.sort) ? (...args) => -1 * column.sortComparator(...args) : column.sortComparator;
|
|
36
|
+
}
|
|
37
|
+
if (!comparator) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
32
40
|
const getSortCellParams = id => ({
|
|
33
41
|
id,
|
|
34
42
|
field: column.field,
|
|
@@ -21,15 +21,6 @@ export declare const gridVirtualizationColumnEnabledSelector: import("../../../u
|
|
|
21
21
|
* @ignore - do not document.
|
|
22
22
|
*/
|
|
23
23
|
export declare const gridRenderContextSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, GridRenderContext>;
|
|
24
|
-
/**
|
|
25
|
-
* Get the offsets
|
|
26
|
-
* @category Virtualization
|
|
27
|
-
* @ignore - do not document.
|
|
28
|
-
*/
|
|
29
|
-
export declare const gridOffsetsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, {
|
|
30
|
-
top: number;
|
|
31
|
-
left: number;
|
|
32
|
-
}>;
|
|
33
24
|
/**
|
|
34
25
|
* Get the render context, with only columns filled in.
|
|
35
26
|
* This is cached, so it can be used to only re-render when the column interval changes.
|
|
@@ -24,13 +24,6 @@ export const gridVirtualizationColumnEnabledSelector = createSelector(gridVirtua
|
|
|
24
24
|
*/
|
|
25
25
|
export const gridRenderContextSelector = createSelector(gridVirtualizationSelector, state => state.renderContext);
|
|
26
26
|
|
|
27
|
-
/**
|
|
28
|
-
* Get the offsets
|
|
29
|
-
* @category Virtualization
|
|
30
|
-
* @ignore - do not document.
|
|
31
|
-
*/
|
|
32
|
-
export const gridOffsetsSelector = createSelector(gridVirtualizationSelector, state => state.offsets);
|
|
33
|
-
|
|
34
27
|
/**
|
|
35
28
|
* Get the render context, with only columns filled in.
|
|
36
29
|
* This is cached, so it can be used to only re-render when the column interval changes.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { Theme } from '@mui/material/styles';
|
|
2
3
|
import { GridPinnedRowsPosition } from '../rows/gridRowsInterfaces';
|
|
3
4
|
import { GridRenderContext, GridRowEntry, GridRowId } from '../../../models';
|
|
4
5
|
export declare const EMPTY_DETAIL_PANELS: Readonly<Map<GridRowId, React.ReactNode>>;
|
|
@@ -9,6 +10,7 @@ export declare const useGridVirtualScroller: () => {
|
|
|
9
10
|
getRows: (params?: {
|
|
10
11
|
rows?: GridRowEntry<import("../../../models").GridValidRowModel>[] | undefined;
|
|
11
12
|
position?: keyof import("../rows/gridRowsInterfaces").GridPinnedRowsState | undefined;
|
|
13
|
+
renderContext?: GridRenderContext | undefined;
|
|
12
14
|
}) => React.ReactNode[];
|
|
13
15
|
getContainerProps: () => {
|
|
14
16
|
ref: React.RefObject<HTMLDivElement>;
|
|
@@ -39,3 +41,4 @@ export declare const useGridVirtualScroller: () => {
|
|
|
39
41
|
};
|
|
40
42
|
};
|
|
41
43
|
export declare function areRenderContextsEqual(context1: GridRenderContext, context2: GridRenderContext): boolean;
|
|
44
|
+
export declare function computeOffsetLeft(columnPositions: number[], renderContext: GridRenderContext, direction: Theme['direction'], pinnedLeftLength: number): number;
|