@mui/x-data-grid 7.12.1 → 7.13.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/CHANGELOG.md +81 -0
- package/DataGrid/DataGrid.js +10 -1
- package/components/GridColumnHeaders.js +1 -1
- package/components/GridConfigurationContext.d.ts +2 -0
- package/components/GridConfigurationContext.js +5 -0
- package/components/GridHeaders.js +1 -1
- package/components/GridRow.js +6 -8
- package/components/GridScrollArea.js +1 -1
- package/components/GridSkeletonLoadingOverlay.js +1 -1
- package/components/cell/GridCell.js +1 -1
- package/components/cell/GridSkeletonCell.js +2 -2
- package/components/columnHeaders/GridColumnHeaderItem.js +1 -1
- package/components/containers/GridRootStyles.js +9 -2
- package/components/virtualization/GridMainContainer.js +3 -2
- package/components/virtualization/GridVirtualScrollerFiller.js +1 -1
- package/context/GridContextProvider.d.ts +3 -1
- package/context/GridContextProvider.js +12 -7
- package/hooks/core/useGridStateInitialization.js +1 -3
- package/hooks/features/dimensions/useGridDimensions.js +1 -1
- package/hooks/features/export/serializers/csvSerializer.js +4 -3
- package/hooks/features/filter/gridFilterSelector.d.ts +20 -7
- package/hooks/features/filter/gridFilterSelector.js +34 -0
- package/hooks/features/filter/gridFilterState.d.ts +6 -0
- package/hooks/features/filter/index.d.ts +2 -1
- package/hooks/features/filter/index.js +1 -1
- package/hooks/features/filter/useGridFilter.js +3 -0
- package/hooks/features/rowSelection/useGridRowSelection.js +4 -1
- package/hooks/features/rows/useGridRowAriaAttributes.d.ts +2 -0
- package/hooks/features/rows/useGridRowAriaAttributes.js +19 -0
- package/hooks/utils/useGridAriaAttributes.d.ts +2 -6
- package/hooks/utils/useGridAriaAttributes.js +5 -8
- package/hooks/utils/useGridConfiguration.d.ts +2 -0
- package/hooks/utils/useGridConfiguration.js +9 -0
- package/hooks/utils/useGridSelector.d.ts +1 -1
- package/hooks/utils/useGridSelector.js +1 -1
- package/index.js +1 -1
- package/internals/index.d.ts +3 -1
- package/internals/index.js +3 -1
- package/locales/viVN.js +4 -5
- package/models/configuration/gridConfiguration.d.ts +10 -0
- package/models/configuration/gridConfiguration.js +1 -0
- package/models/configuration/gridRowConfiguration.d.ts +12 -0
- package/models/configuration/gridRowConfiguration.js +1 -0
- package/models/gridDataSource.d.ts +2 -1
- package/models/gridRows.d.ts +2 -2
- package/models/props/DataGridProps.d.ts +1 -1
- package/modern/DataGrid/DataGrid.js +10 -1
- package/modern/components/GridColumnHeaders.js +1 -1
- package/modern/components/GridConfigurationContext.js +5 -0
- package/modern/components/GridHeaders.js +1 -1
- package/modern/components/GridRow.js +6 -8
- package/modern/components/GridScrollArea.js +1 -1
- package/modern/components/GridSkeletonLoadingOverlay.js +1 -1
- package/modern/components/cell/GridCell.js +1 -1
- package/modern/components/cell/GridSkeletonCell.js +2 -2
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +1 -1
- package/modern/components/containers/GridRootStyles.js +9 -2
- package/modern/components/virtualization/GridMainContainer.js +3 -2
- package/modern/components/virtualization/GridVirtualScrollerFiller.js +1 -1
- package/modern/context/GridContextProvider.js +12 -7
- package/modern/hooks/core/useGridStateInitialization.js +1 -3
- package/modern/hooks/features/dimensions/useGridDimensions.js +1 -1
- package/modern/hooks/features/export/serializers/csvSerializer.js +4 -3
- package/modern/hooks/features/filter/gridFilterSelector.js +34 -0
- package/modern/hooks/features/filter/index.js +1 -1
- package/modern/hooks/features/filter/useGridFilter.js +3 -0
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +4 -1
- package/modern/hooks/features/rows/useGridRowAriaAttributes.js +19 -0
- package/modern/hooks/utils/useGridAriaAttributes.js +5 -8
- package/modern/hooks/utils/useGridConfiguration.js +9 -0
- package/modern/hooks/utils/useGridSelector.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/index.js +3 -1
- package/modern/locales/viVN.js +4 -5
- package/modern/models/configuration/gridConfiguration.js +1 -0
- package/modern/models/configuration/gridRowConfiguration.js +1 -0
- package/node/DataGrid/DataGrid.js +10 -1
- package/node/components/GridColumnHeaders.js +1 -1
- package/node/{utils/fastMemo.js → components/GridConfigurationContext.js} +4 -4
- package/node/components/GridHeaders.js +1 -1
- package/node/components/GridRow.js +6 -8
- package/node/components/GridScrollArea.js +1 -1
- package/node/components/GridSkeletonLoadingOverlay.js +1 -1
- package/node/components/cell/GridCell.js +1 -1
- package/node/components/cell/GridSkeletonCell.js +2 -2
- package/node/components/columnHeaders/GridColumnHeaderItem.js +1 -1
- package/node/components/containers/GridRootStyles.js +9 -2
- package/node/components/virtualization/GridMainContainer.js +3 -2
- package/node/components/virtualization/GridVirtualScrollerFiller.js +1 -1
- package/node/context/GridContextProvider.js +12 -7
- package/node/hooks/core/useGridStateInitialization.js +1 -3
- package/node/hooks/features/dimensions/useGridDimensions.js +1 -1
- package/node/hooks/features/export/serializers/csvSerializer.js +4 -3
- package/node/hooks/features/filter/gridFilterSelector.js +35 -1
- package/node/hooks/features/filter/index.js +97 -15
- package/node/hooks/features/filter/useGridFilter.js +3 -0
- package/node/hooks/features/rowSelection/useGridRowSelection.js +4 -1
- package/node/hooks/features/rows/useGridRowAriaAttributes.js +28 -0
- package/node/hooks/utils/useGridAriaAttributes.js +4 -7
- package/node/hooks/utils/useGridConfiguration.js +18 -0
- package/node/hooks/utils/useGridSelector.js +1 -1
- package/node/index.js +1 -1
- package/node/internals/index.js +31 -12
- package/node/locales/viVN.js +4 -5
- package/node/models/configuration/gridConfiguration.js +5 -0
- package/node/models/configuration/gridRowConfiguration.js +5 -0
- package/package.json +2 -2
- package/modern/utils/fastMemo.js +0 -5
- package/modern/utils/fastObjectShallowCompare.js +0 -28
- package/modern/utils/throttle.js +0 -19
- package/node/utils/fastObjectShallowCompare.js +0 -34
- package/node/utils/throttle.js +0 -25
- package/utils/fastMemo.d.ts +0 -1
- package/utils/fastMemo.js +0 -5
- package/utils/fastObjectShallowCompare.d.ts +0 -1
- package/utils/fastObjectShallowCompare.js +0 -28
- package/utils/throttle.d.ts +0 -4
- package/utils/throttle.js +0 -19
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,87 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 7.13.0
|
|
7
|
+
|
|
8
|
+
_Aug 16, 2024_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 💫 Allow to [edit the label](https://mui.com/x/react-tree-view/rich-tree-view/editing/) of Tree View's items.
|
|
13
|
+
|
|
14
|
+
<img width="344" src="https://github.com/user-attachments/assets/1a6cf765-2dc8-4906-bd93-139086eed148" alt="Item label editing" />
|
|
15
|
+
|
|
16
|
+
- 🔧 Improve rows accessibility on the Data Grid features "Tree Data" and "Row Grouping". Certain "Row Grouping" accessibility updates will only be applied if experimental feature flag is enabled. See the [documentation](https://mui.com/x/react-data-grid/row-grouping/#accessibility-changes-in-v8) for more information.
|
|
17
|
+
- 🌍 Improve Vietnamese (vi-VN) locale on the Data Grid
|
|
18
|
+
- 🐞 Bugfixes
|
|
19
|
+
|
|
20
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
21
|
+
|
|
22
|
+
### Data Grid
|
|
23
|
+
|
|
24
|
+
#### `@mui/x-data-grid@7.13.0`
|
|
25
|
+
|
|
26
|
+
- [DataGrid] Fix CSV export for `null` and `undefined` values (#14166) @k-rajat19
|
|
27
|
+
- [DataGrid] Fix error logged during skeleton loading with nested data grid (#14186) @KenanYusuf
|
|
28
|
+
- [DataGrid] Remove needless check in `useGridStateInitialization` (#14181) @k-rajat19
|
|
29
|
+
- [DataGrid] Add recipe for persisting filters in local storage (#14208) @cherniavskii
|
|
30
|
+
- [l10n] Improve Vietnamese (vi-VN) locale (#14216) @hungnd-casso
|
|
31
|
+
|
|
32
|
+
#### `@mui/x-data-grid-pro@7.13.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
33
|
+
|
|
34
|
+
Same changes as in `@mui/x-data-grid@7.13.0`, plus:
|
|
35
|
+
|
|
36
|
+
- [DataGridPro] Fix Tree Data and Row Grouping rows accessibility (#13623) @arminmeh
|
|
37
|
+
|
|
38
|
+
#### `@mui/x-data-grid-premium@7.13.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
39
|
+
|
|
40
|
+
Same changes as in `@mui/x-data-grid-pro@7.13.0`.
|
|
41
|
+
|
|
42
|
+
### Date and Time Pickers
|
|
43
|
+
|
|
44
|
+
#### `@mui/x-date-pickers@7.13.0`
|
|
45
|
+
|
|
46
|
+
- [pickers] Fix date and time merging to retain milliseconds (#14173) @LukasTy
|
|
47
|
+
|
|
48
|
+
#### `@mui/x-date-pickers-pro@7.13.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
49
|
+
|
|
50
|
+
Same changes as in `@mui/x-date-pickers@7.13.0`.
|
|
51
|
+
|
|
52
|
+
### Charts
|
|
53
|
+
|
|
54
|
+
#### `@mui/x-charts@7.13.0`
|
|
55
|
+
|
|
56
|
+
- [charts] Add `baseline` property to the `LineChart` `series` (#14153) @JCQuintas
|
|
57
|
+
- [charts] Fix issue where tooltip would disappear on mouse click (#14187) @alexfauquette
|
|
58
|
+
- [charts] Rename `CartesianContextProvider` to `CartesianProvider` (#14102) @JCQuintas
|
|
59
|
+
- [charts] Support axis with the same value for all data points (#14191) @alexfauquette
|
|
60
|
+
|
|
61
|
+
#### `@mui/x-date-charts-pro@7.0.0-alpha.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
62
|
+
|
|
63
|
+
Same changes as in `@mui/x-charts@7.13.0`.
|
|
64
|
+
|
|
65
|
+
### Tree View
|
|
66
|
+
|
|
67
|
+
#### `@mui/x-tree-view@7.13.0`
|
|
68
|
+
|
|
69
|
+
- [TreeView] Add label editing feature (#13388) @noraleonte
|
|
70
|
+
- [TreeView] Fix the parameters passed for the `canMoveItemToNewPosition` prop (#14176) @flaviendelangle
|
|
71
|
+
|
|
72
|
+
### Docs
|
|
73
|
+
|
|
74
|
+
- [docs] Extract dataset in the Line chart docs (#14034) @alexfauquette
|
|
75
|
+
- [docs] Remove redundant encoding in the mock data source server (#14185) @MBilalShafi
|
|
76
|
+
- [docs] Use Netflix financial results to document bar charts (#13991) @alexfauquette
|
|
77
|
+
- [docs] Remove relience of abbreviations (#14226) @oliviertassinari
|
|
78
|
+
|
|
79
|
+
### Core
|
|
80
|
+
|
|
81
|
+
- [core] Bump monorepo (#14141) @Janpot
|
|
82
|
+
- [core] Fix ESLint issue (#14207) @LukasTy
|
|
83
|
+
- [core] Fix Netlify build cache issue (#14182) @cherniavskii
|
|
84
|
+
- [code-infra] Refactor Netlify `cache-docs` plugin setup (#14105) @LukasTy
|
|
85
|
+
- [internals] Move utils needed for tree view virtualization to shared package (#14202) @flaviendelangle
|
|
86
|
+
|
|
6
87
|
## 7.12.1
|
|
7
88
|
|
|
8
89
|
_Aug 8, 2024_
|
package/DataGrid/DataGrid.js
CHANGED
|
@@ -4,11 +4,19 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { GridBody, GridFooterPlaceholder, GridHeader, GridRoot } from '../components';
|
|
7
|
+
import { useGridAriaAttributes } from '../hooks/utils/useGridAriaAttributes';
|
|
8
|
+
import { useGridRowAriaAttributes } from '../hooks/features/rows/useGridRowAriaAttributes';
|
|
7
9
|
import { GridContextProvider } from '../context/GridContextProvider';
|
|
8
10
|
import { useDataGridComponent } from './useDataGridComponent';
|
|
9
11
|
import { useDataGridProps } from './useDataGridProps';
|
|
10
12
|
import { propValidatorsDataGrid, validateProps } from '../internals/utils/propValidation';
|
|
11
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
const configuration = {
|
|
15
|
+
hooks: {
|
|
16
|
+
useGridAriaAttributes,
|
|
17
|
+
useGridRowAriaAttributes
|
|
18
|
+
}
|
|
19
|
+
};
|
|
12
20
|
let propValidators;
|
|
13
21
|
if (process.env.NODE_ENV !== 'production') {
|
|
14
22
|
propValidators = [...propValidatorsDataGrid,
|
|
@@ -23,6 +31,7 @@ const DataGridRaw = /*#__PURE__*/React.forwardRef(function DataGrid(inProps, ref
|
|
|
23
31
|
}
|
|
24
32
|
return /*#__PURE__*/_jsx(GridContextProvider, {
|
|
25
33
|
privateApiRef: privateApiRef,
|
|
34
|
+
configuration: configuration,
|
|
26
35
|
props: props,
|
|
27
36
|
children: /*#__PURE__*/_jsxs(GridRoot, _extends({
|
|
28
37
|
className: props.className,
|
|
@@ -321,7 +330,7 @@ DataGridRaw.propTypes = {
|
|
|
321
330
|
/**
|
|
322
331
|
* Determines if a row can be selected.
|
|
323
332
|
* @param {GridRowParams} params With all properties from [[GridRowParams]].
|
|
324
|
-
* @returns {boolean} A boolean indicating if the
|
|
333
|
+
* @returns {boolean} A boolean indicating if the row is selectable.
|
|
325
334
|
*/
|
|
326
335
|
isRowSelectable: PropTypes.func,
|
|
327
336
|
/**
|
|
@@ -3,7 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
3
3
|
const _excluded = ["className", "visibleColumns", "sortColumnLookup", "filterColumnLookup", "columnHeaderTabIndexState", "columnGroupHeaderTabIndexState", "columnHeaderFocus", "columnGroupHeaderFocus", "headerGroupingMaxDepth", "columnMenuState", "columnVisibility", "columnGroupsHeaderStructure", "hasOtherElementInTabSequence"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { fastMemo } from '
|
|
6
|
+
import { fastMemo } from '@mui/x-internals/fastMemo';
|
|
7
7
|
import { useGridColumnHeaders } from '../hooks/features/columnHeaders/useGridColumnHeaders';
|
|
8
8
|
import { GridBaseColumnHeaders } from './columnHeaders/GridBaseColumnHeaders';
|
|
9
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { fastMemo } from '
|
|
3
|
+
import { fastMemo } from '@mui/x-internals/fastMemo';
|
|
4
4
|
import { useGridPrivateApiContext } from '../hooks/utils/useGridPrivateApiContext';
|
|
5
5
|
import { useGridSelector } from '../hooks/utils/useGridSelector';
|
|
6
6
|
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
package/components/GridRow.js
CHANGED
|
@@ -5,7 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import { unstable_useForkRef as useForkRef } from '@mui/utils';
|
|
8
|
-
import { fastMemo } from '
|
|
8
|
+
import { fastMemo } from '@mui/x-internals/fastMemo';
|
|
9
9
|
import { GridEditModes, GridRowModes, GridCellModes } from '../models/gridEditRowModel';
|
|
10
10
|
import { useGridApiContext } from '../hooks/utils/useGridApiContext';
|
|
11
11
|
import { gridClasses } from '../constants/gridClasses';
|
|
@@ -20,11 +20,11 @@ import { GRID_ACTIONS_COLUMN_TYPE } from '../colDef/gridActionsColDef';
|
|
|
20
20
|
import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '../constants/gridDetailPanelToggleField';
|
|
21
21
|
import { gridSortModelSelector } from '../hooks/features/sorting/gridSortingSelector';
|
|
22
22
|
import { gridRowMaximumTreeDepthSelector } from '../hooks/features/rows/gridRowsSelector';
|
|
23
|
-
import { gridColumnGroupsHeaderMaxDepthSelector } from '../hooks/features/columnGrouping/gridColumnGroupsSelector';
|
|
24
23
|
import { gridEditRowsStateSelector } from '../hooks/features/editing/gridEditingSelectors';
|
|
25
24
|
import { PinnedPosition, gridPinnedColumnPositionLookup } from './cell/GridCell';
|
|
26
25
|
import { GridScrollbarFillerCell as ScrollbarFiller } from './GridScrollbarFillerCell';
|
|
27
26
|
import { getPinnedCellOffset } from '../internals/utils/getPinnedCellOffset';
|
|
27
|
+
import { useGridConfiguration } from '../hooks/utils/useGridConfiguration';
|
|
28
28
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
29
29
|
function EmptyCell({
|
|
30
30
|
width
|
|
@@ -68,12 +68,12 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
68
68
|
} = props,
|
|
69
69
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
70
70
|
const apiRef = useGridApiContext();
|
|
71
|
+
const configuration = useGridConfiguration();
|
|
71
72
|
const ref = React.useRef(null);
|
|
72
73
|
const rootProps = useGridRootProps();
|
|
73
74
|
const currentPage = useGridVisibleRows(apiRef, rootProps);
|
|
74
75
|
const sortModel = useGridSelector(apiRef, gridSortModelSelector);
|
|
75
76
|
const treeDepth = useGridSelector(apiRef, gridRowMaximumTreeDepthSelector);
|
|
76
|
-
const headerGroupingMaxDepth = useGridSelector(apiRef, gridColumnGroupsHeaderMaxDepthSelector);
|
|
77
77
|
const columnPositions = useGridSelector(apiRef, gridColumnPositionsSelector);
|
|
78
78
|
const editRowsState = useGridSelector(apiRef, gridEditRowsStateSelector);
|
|
79
79
|
const handleRef = useForkRef(ref, refProp);
|
|
@@ -85,11 +85,10 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
85
85
|
const hasFocusCell = focusedColumnIndex !== undefined;
|
|
86
86
|
const hasVirtualFocusCellLeft = hasFocusCell && focusedColumnIndex >= pinnedColumns.left.length && focusedColumnIndex < renderContext.firstColumnIndex;
|
|
87
87
|
const hasVirtualFocusCellRight = hasFocusCell && focusedColumnIndex < visibleColumns.length - pinnedColumns.right.length && focusedColumnIndex >= renderContext.lastColumnIndex;
|
|
88
|
-
const ariaRowIndex = index + headerGroupingMaxDepth + 2; // 1 for the header row and 1 as it's 1-based
|
|
89
|
-
|
|
90
88
|
const classes = composeGridClasses(rootProps.classes, {
|
|
91
89
|
root: ['row', selected && 'selected', editable && 'row--editable', editing && 'row--editing', isFirstVisible && 'row--firstVisible', isLastVisible && 'row--lastVisible', showBottomBorder && 'row--borderBottom', rowHeight === 'auto' && 'row--dynamicHeight']
|
|
92
90
|
});
|
|
91
|
+
const getRowAriaAttributes = configuration.hooks.useGridRowAriaAttributes();
|
|
93
92
|
React.useLayoutEffect(() => {
|
|
94
93
|
if (currentPage.range) {
|
|
95
94
|
// The index prop is relative to the rows from all pages. As example, the index prop of the
|
|
@@ -212,6 +211,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
212
211
|
return rowStyle;
|
|
213
212
|
}, [isNotVisible, rowHeight, styleProp, minHeight, sizes, rootProps.rowSpacingType]);
|
|
214
213
|
const rowClassNames = apiRef.current.unstable_applyPipeProcessors('rowClassName', [], rowId);
|
|
214
|
+
const ariaAttributes = rowNode ? getRowAriaAttributes(rowNode, index) : undefined;
|
|
215
215
|
if (typeof rootProps.getRowClassName === 'function') {
|
|
216
216
|
const indexRelativeToCurrentPage = index - (currentPage.range?.firstRowIndex || 0);
|
|
217
217
|
const rowParams = _extends({}, apiRef.current.getRowParams(rowId), {
|
|
@@ -308,10 +308,8 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
308
308
|
"data-rowindex": index,
|
|
309
309
|
role: "row",
|
|
310
310
|
className: clsx(...rowClassNames, classes.root, className),
|
|
311
|
-
"aria-rowindex": ariaRowIndex,
|
|
312
|
-
"aria-selected": selected,
|
|
313
311
|
style: style
|
|
314
|
-
}, eventHandlers, other, {
|
|
312
|
+
}, ariaAttributes, eventHandlers, other, {
|
|
315
313
|
children: [leftCells, /*#__PURE__*/_jsx("div", {
|
|
316
314
|
role: "presentation",
|
|
317
315
|
className: gridClasses.cellOffsetLeft,
|
|
@@ -3,6 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { unstable_composeClasses as composeClasses, unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
5
5
|
import { styled } from '@mui/system';
|
|
6
|
+
import { fastMemo } from '@mui/x-internals/fastMemo';
|
|
6
7
|
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
7
8
|
import { getDataGridUtilityClass, gridClasses } from '../constants';
|
|
8
9
|
import { useGridApiContext } from '../hooks/utils/useGridApiContext';
|
|
@@ -13,7 +14,6 @@ import { gridDensityFactorSelector } from '../hooks/features/density/densitySele
|
|
|
13
14
|
import { gridColumnsTotalWidthSelector } from '../hooks/features/columns/gridColumnsSelector';
|
|
14
15
|
import { useTimeout } from '../hooks/utils/useTimeout';
|
|
15
16
|
import { getTotalHeaderHeight } from '../hooks/features/columns/gridColumnsUtils';
|
|
16
|
-
import { fastMemo } from '../utils/fastMemo';
|
|
17
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
18
|
const CLIFF = 1;
|
|
19
19
|
const SLOP = 1.5;
|
|
@@ -119,7 +119,7 @@ const GridSkeletonLoadingOverlay = /*#__PURE__*/React.forwardRef(function GridSk
|
|
|
119
119
|
if (hasScrollbarFiller) {
|
|
120
120
|
rowCells.push( /*#__PURE__*/_jsx(GridScrollbarFillerCell, {
|
|
121
121
|
pinnedRight: pinnedColumns.right.length > 0
|
|
122
|
-
}));
|
|
122
|
+
}, `skeleton-scrollbar-filler-${i}`));
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
array.push( /*#__PURE__*/_jsx("div", {
|
|
@@ -6,7 +6,7 @@ import * as React from 'react';
|
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import clsx from 'clsx';
|
|
8
8
|
import { unstable_useForkRef as useForkRef, unstable_composeClasses as composeClasses, unstable_ownerDocument as ownerDocument, unstable_capitalize as capitalize } from '@mui/utils';
|
|
9
|
-
import { fastMemo } from '
|
|
9
|
+
import { fastMemo } from '@mui/x-internals/fastMemo';
|
|
10
10
|
import { doesSupportPreventScroll } from '../../utils/doesSupportPreventScroll';
|
|
11
11
|
import { getDataGridUtilityClass, gridClasses } from '../../constants/gridClasses';
|
|
12
12
|
import { GridCellModes } from '../../models';
|
|
@@ -3,10 +3,10 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
3
3
|
const _excluded = ["field", "type", "align", "width", "height", "empty", "style", "className"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
+
import clsx from 'clsx';
|
|
6
7
|
import Skeleton from '@mui/material/Skeleton';
|
|
7
8
|
import { unstable_composeClasses as composeClasses, unstable_capitalize as capitalize } from '@mui/utils';
|
|
8
|
-
import
|
|
9
|
-
import { fastMemo } from '../../utils/fastMemo';
|
|
9
|
+
import { fastMemo } from '@mui/x-internals/fastMemo';
|
|
10
10
|
import { createRandomNumberGenerator } from '../../utils/utils';
|
|
11
11
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
12
12
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { unstable_composeClasses as composeClasses, unstable_useId as useId } from '@mui/utils';
|
|
6
|
-
import { fastMemo } from '
|
|
6
|
+
import { fastMemo } from '@mui/x-internals/fastMemo';
|
|
7
7
|
import { useGridPrivateApiContext } from '../../hooks/utils/useGridPrivateApiContext';
|
|
8
8
|
import { ColumnHeaderMenuIcon } from './ColumnHeaderMenuIcon';
|
|
9
9
|
import { GridColumnHeaderMenu } from '../menu/columnMenu/GridColumnHeaderMenu';
|
|
@@ -668,9 +668,16 @@ export const GridRootStyles = styled('div', {
|
|
|
668
668
|
[`& .${c['filler--borderTop']}`]: {
|
|
669
669
|
borderTop: '1px solid var(--DataGrid-rowBorderColor)'
|
|
670
670
|
},
|
|
671
|
-
/* Hide grid rows and vertical scrollbar when skeleton overlay is visible */
|
|
671
|
+
/* Hide grid rows, row filler, and vertical scrollbar when skeleton overlay is visible */
|
|
672
672
|
[`& .${c['main--hasSkeletonLoadingOverlay']}`]: {
|
|
673
|
-
[`& .${c.virtualScrollerContent}
|
|
673
|
+
[`& .${c.virtualScrollerContent}`]: {
|
|
674
|
+
// We use visibility hidden so that the virtual scroller content retains its height.
|
|
675
|
+
// Position fixed is used to remove the virtual scroller content from the flow.
|
|
676
|
+
// https://github.com/mui/mui-x/issues/14061
|
|
677
|
+
position: 'fixed',
|
|
678
|
+
visibility: 'hidden'
|
|
679
|
+
},
|
|
680
|
+
[`& .${c['scrollbar--vertical']}, & .${c.pinnedRows}, & .${c.virtualScroller} > .${c.filler}`]: {
|
|
674
681
|
display: 'none'
|
|
675
682
|
}
|
|
676
683
|
}
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { styled } from '@mui/system';
|
|
4
4
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
5
|
-
import {
|
|
5
|
+
import { useGridConfiguration } from '../../hooks/utils/useGridConfiguration';
|
|
6
6
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
7
|
const GridPanelAnchor = styled('div')({
|
|
8
8
|
position: 'absolute',
|
|
@@ -19,8 +19,9 @@ const Element = styled('div', {
|
|
|
19
19
|
overflow: 'hidden'
|
|
20
20
|
});
|
|
21
21
|
export const GridMainContainer = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
22
|
-
const ariaAttributes = useGridAriaAttributes();
|
|
23
22
|
const rootProps = useGridRootProps();
|
|
23
|
+
const configuration = useGridConfiguration();
|
|
24
|
+
const ariaAttributes = configuration.hooks.useGridAriaAttributes();
|
|
24
25
|
return /*#__PURE__*/_jsxs(Element, _extends({
|
|
25
26
|
ref: ref,
|
|
26
27
|
ownerState: rootProps,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { styled } from '@mui/system';
|
|
3
|
-
import { fastMemo } from '
|
|
3
|
+
import { fastMemo } from '@mui/x-internals/fastMemo';
|
|
4
4
|
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
5
5
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
6
6
|
import { gridDimensionsSelector } from '../../hooks/features/dimensions';
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridPrivateApiCommunity } from '../models/api/gridApiCommunity';
|
|
3
|
+
import { GridConfiguration } from '../models/configuration/gridConfiguration';
|
|
3
4
|
type GridContextProviderProps = {
|
|
4
5
|
privateApiRef: React.MutableRefObject<GridPrivateApiCommunity>;
|
|
6
|
+
configuration: GridConfiguration;
|
|
5
7
|
props: {};
|
|
6
8
|
children: React.ReactNode;
|
|
7
9
|
};
|
|
8
|
-
export declare function GridContextProvider({ privateApiRef, props, children }: GridContextProviderProps): React.JSX.Element;
|
|
10
|
+
export declare function GridContextProvider({ privateApiRef, configuration, props, children, }: GridContextProviderProps): React.JSX.Element;
|
|
9
11
|
export {};
|
|
@@ -2,20 +2,25 @@ import * as React from 'react';
|
|
|
2
2
|
import { GridApiContext } from '../components/GridApiContext';
|
|
3
3
|
import { GridPrivateApiContext } from '../hooks/utils/useGridPrivateApiContext';
|
|
4
4
|
import { GridRootPropsContext } from './GridRootPropsContext';
|
|
5
|
+
import { GridConfigurationContext } from '../components/GridConfigurationContext';
|
|
5
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
7
|
export function GridContextProvider({
|
|
7
8
|
privateApiRef,
|
|
9
|
+
configuration,
|
|
8
10
|
props,
|
|
9
11
|
children
|
|
10
12
|
}) {
|
|
11
13
|
const apiRef = React.useRef(privateApiRef.current.getPublicApi());
|
|
12
|
-
return /*#__PURE__*/_jsx(
|
|
13
|
-
value:
|
|
14
|
-
children: /*#__PURE__*/_jsx(
|
|
15
|
-
value:
|
|
16
|
-
children: /*#__PURE__*/_jsx(
|
|
17
|
-
value:
|
|
18
|
-
children:
|
|
14
|
+
return /*#__PURE__*/_jsx(GridConfigurationContext.Provider, {
|
|
15
|
+
value: configuration,
|
|
16
|
+
children: /*#__PURE__*/_jsx(GridRootPropsContext.Provider, {
|
|
17
|
+
value: props,
|
|
18
|
+
children: /*#__PURE__*/_jsx(GridPrivateApiContext.Provider, {
|
|
19
|
+
value: privateApiRef,
|
|
20
|
+
children: /*#__PURE__*/_jsx(GridApiContext.Provider, {
|
|
21
|
+
value: apiRef,
|
|
22
|
+
children: children
|
|
23
|
+
})
|
|
19
24
|
})
|
|
20
25
|
})
|
|
21
26
|
});
|
|
@@ -48,9 +48,7 @@ export const useGridStateInitialization = apiRef => {
|
|
|
48
48
|
if (!ignoreSetState) {
|
|
49
49
|
// We always assign it as we mutate rows for perf reason.
|
|
50
50
|
apiRef.current.state = newState;
|
|
51
|
-
|
|
52
|
-
apiRef.current.publishEvent('stateChange', newState);
|
|
53
|
-
}
|
|
51
|
+
apiRef.current.publishEvent('stateChange', newState);
|
|
54
52
|
apiRef.current.store.update(newState);
|
|
55
53
|
}
|
|
56
54
|
if (updatedControlStateIds.length === 1) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { unstable_ownerDocument as ownerDocument, unstable_useEnhancedEffect as useEnhancedEffect, unstable_useEventCallback as useEventCallback, unstable_ownerWindow as ownerWindow } from '@mui/utils';
|
|
4
|
+
import { throttle } from '@mui/x-internals/throttle';
|
|
4
5
|
import { useGridApiEventHandler, useGridApiOptionHandler } from '../../utils/useGridApiEventHandler';
|
|
5
6
|
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
6
|
-
import { throttle } from '../../../utils/throttle';
|
|
7
7
|
import { useGridLogger } from '../../utils/useGridLogger';
|
|
8
8
|
import { gridColumnsTotalWidthSelector, gridVisiblePinnedColumnDefinitionsSelector } from '../columns';
|
|
9
9
|
import { gridDimensionsSelector } from './gridDimensionsSelectors';
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { GRID_CHECKBOX_SELECTION_COL_DEF } from '../../../../colDef';
|
|
2
2
|
import { warnOnce } from '../../../../internals/utils/warning';
|
|
3
3
|
function sanitizeCellValue(value, csvOptions) {
|
|
4
|
+
if (value === null || value === undefined) {
|
|
5
|
+
return '';
|
|
6
|
+
}
|
|
4
7
|
const valueStr = typeof value === 'string' ? value : `${value}`;
|
|
5
8
|
if (csvOptions.shouldAppendQuotes || csvOptions.escapeFormulas) {
|
|
6
9
|
const escapedValue = valueStr.replace(/"/g, '""');
|
|
@@ -51,9 +54,7 @@ class CSVRow {
|
|
|
51
54
|
if (!this.isEmpty) {
|
|
52
55
|
this.rowString += this.options.csvOptions.delimiter;
|
|
53
56
|
}
|
|
54
|
-
if (
|
|
55
|
-
this.rowString += '';
|
|
56
|
-
} else if (typeof this.options.sanitizeCellValue === 'function') {
|
|
57
|
+
if (typeof this.options.sanitizeCellValue === 'function') {
|
|
57
58
|
this.rowString += this.options.sanitizeCellValue(value, this.options.csvOptions);
|
|
58
59
|
} else {
|
|
59
60
|
this.rowString += value;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { GridRowId } from '../../../models/gridRows';
|
|
1
2
|
import { GridFilterItem } from '../../../models/gridFilterItem';
|
|
2
3
|
import { GridStateCommunity } from '../../../models/gridStateCommunity';
|
|
3
4
|
/**
|
|
@@ -19,41 +20,53 @@ export declare const gridVisibleRowsLookupSelector: (state: GridStateCommunity)
|
|
|
19
20
|
* @category Filtering
|
|
20
21
|
* @ignore - do not document.
|
|
21
22
|
*/
|
|
22
|
-
export declare const gridFilteredRowsLookupSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, Record<
|
|
23
|
+
export declare const gridFilteredRowsLookupSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, Record<GridRowId, boolean>>;
|
|
23
24
|
/**
|
|
24
25
|
* @category Filtering
|
|
25
26
|
* @ignore - do not document.
|
|
26
27
|
*/
|
|
27
|
-
export declare const
|
|
28
|
+
export declare const gridFilteredChildrenCountLookupSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, Record<GridRowId, number>>;
|
|
29
|
+
/**
|
|
30
|
+
* @category Filtering
|
|
31
|
+
* @ignore - do not document.
|
|
32
|
+
*/
|
|
33
|
+
export declare const gridFilteredDescendantCountLookupSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, Record<GridRowId, number>>;
|
|
28
34
|
/**
|
|
29
35
|
* Get the id and the model of the rows accessible after the filtering process.
|
|
30
36
|
* Does not contain the collapsed children.
|
|
31
37
|
* @category Filtering
|
|
32
38
|
*/
|
|
33
|
-
export declare const gridExpandedSortedRowEntriesSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("
|
|
39
|
+
export declare const gridExpandedSortedRowEntriesSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../../models/gridRows").GridRowEntry<import("../../../models/gridRows").GridValidRowModel>[]>;
|
|
34
40
|
/**
|
|
35
41
|
* Get the id of the rows accessible after the filtering process.
|
|
36
42
|
* Does not contain the collapsed children.
|
|
37
43
|
* @category Filtering
|
|
38
44
|
*/
|
|
39
|
-
export declare const gridExpandedSortedRowIdsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity,
|
|
45
|
+
export declare const gridExpandedSortedRowIdsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, GridRowId[]>;
|
|
40
46
|
/**
|
|
41
47
|
* Get the id and the model of the rows accessible after the filtering process.
|
|
42
48
|
* Contains the collapsed children.
|
|
43
49
|
* @category Filtering
|
|
44
50
|
*/
|
|
45
|
-
export declare const gridFilteredSortedRowEntriesSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("
|
|
51
|
+
export declare const gridFilteredSortedRowEntriesSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../../models/gridRows").GridRowEntry<import("../../../models/gridRows").GridValidRowModel>[]>;
|
|
46
52
|
/**
|
|
47
53
|
* Get the id of the rows accessible after the filtering process.
|
|
48
54
|
* Contains the collapsed children.
|
|
49
55
|
* @category Filtering
|
|
50
56
|
*/
|
|
51
|
-
export declare const gridFilteredSortedRowIdsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity,
|
|
57
|
+
export declare const gridFilteredSortedRowIdsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, GridRowId[]>;
|
|
58
|
+
/**
|
|
59
|
+
* Get the ids to position in the current tree level lookup of the rows accessible after the filtering process.
|
|
60
|
+
* Does not contain the collapsed children.
|
|
61
|
+
* @category Filtering
|
|
62
|
+
* @ignore - do not document.
|
|
63
|
+
*/
|
|
64
|
+
export declare const gridExpandedSortedRowTreeLevelPositionLookupSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, Record<GridRowId, number>>;
|
|
52
65
|
/**
|
|
53
66
|
* Get the id and the model of the top level rows accessible after the filtering process.
|
|
54
67
|
* @category Filtering
|
|
55
68
|
*/
|
|
56
|
-
export declare const gridFilteredSortedTopLevelRowEntriesSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("
|
|
69
|
+
export declare const gridFilteredSortedTopLevelRowEntriesSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../../models/gridRows").GridRowEntry<import("../../../models/gridRows").GridValidRowModel>[]>;
|
|
57
70
|
/**
|
|
58
71
|
* Get the amount of rows accessible after the filtering process.
|
|
59
72
|
* @category Filtering
|
|
@@ -32,6 +32,12 @@ export const gridVisibleRowsLookupSelector = state => state.visibleRowsLookup;
|
|
|
32
32
|
*/
|
|
33
33
|
export const gridFilteredRowsLookupSelector = createSelector(gridFilterStateSelector, filterState => filterState.filteredRowsLookup);
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* @category Filtering
|
|
37
|
+
* @ignore - do not document.
|
|
38
|
+
*/
|
|
39
|
+
export const gridFilteredChildrenCountLookupSelector = createSelector(gridFilterStateSelector, filterState => filterState.filteredChildrenCountLookup);
|
|
40
|
+
|
|
35
41
|
/**
|
|
36
42
|
* @category Filtering
|
|
37
43
|
* @ignore - do not document.
|
|
@@ -66,6 +72,34 @@ export const gridFilteredSortedRowEntriesSelector = createSelectorMemoized(gridF
|
|
|
66
72
|
*/
|
|
67
73
|
export const gridFilteredSortedRowIdsSelector = createSelectorMemoized(gridFilteredSortedRowEntriesSelector, filteredSortedRowEntries => filteredSortedRowEntries.map(row => row.id));
|
|
68
74
|
|
|
75
|
+
/**
|
|
76
|
+
* Get the ids to position in the current tree level lookup of the rows accessible after the filtering process.
|
|
77
|
+
* Does not contain the collapsed children.
|
|
78
|
+
* @category Filtering
|
|
79
|
+
* @ignore - do not document.
|
|
80
|
+
*/
|
|
81
|
+
export const gridExpandedSortedRowTreeLevelPositionLookupSelector = createSelectorMemoized(gridExpandedSortedRowIdsSelector, gridRowTreeSelector, (visibleSortedRowIds, rowTree) => {
|
|
82
|
+
const depthPositionCounter = {};
|
|
83
|
+
let lastDepth = 0;
|
|
84
|
+
return visibleSortedRowIds.reduce((acc, rowId) => {
|
|
85
|
+
const rowNode = rowTree[rowId];
|
|
86
|
+
if (!depthPositionCounter[rowNode.depth]) {
|
|
87
|
+
depthPositionCounter[rowNode.depth] = 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// going deeper in the tree should reset the counter
|
|
91
|
+
// since it might have been used in some other branch at the same level, up in the tree
|
|
92
|
+
// going back up should keep the counter and continue where it left off
|
|
93
|
+
if (rowNode.depth > lastDepth) {
|
|
94
|
+
depthPositionCounter[rowNode.depth] = 0;
|
|
95
|
+
}
|
|
96
|
+
lastDepth = rowNode.depth;
|
|
97
|
+
depthPositionCounter[rowNode.depth] += 1;
|
|
98
|
+
acc[rowId] = depthPositionCounter[rowNode.depth];
|
|
99
|
+
return acc;
|
|
100
|
+
}, {});
|
|
101
|
+
});
|
|
102
|
+
|
|
69
103
|
/**
|
|
70
104
|
* Get the id and the model of the top level rows accessible after the filtering process.
|
|
71
105
|
* @category Filtering
|
|
@@ -17,6 +17,12 @@ export interface GridFilterState {
|
|
|
17
17
|
* This is the equivalent of the `visibleRowsLookup` if all the groups were expanded.
|
|
18
18
|
*/
|
|
19
19
|
filteredRowsLookup: Record<GridRowId, boolean>;
|
|
20
|
+
/**
|
|
21
|
+
* Amount of children that are passing the filters or have children that are passing the filter (does not count grand children).
|
|
22
|
+
* If a row is not registered in this lookup, it is supposed to have no descendant passing the filters.
|
|
23
|
+
* If `GridDataSource` is being used to load the data, the value is `-1` if there are some children but the count is unknown.
|
|
24
|
+
*/
|
|
25
|
+
filteredChildrenCountLookup: Record<GridRowId, number>;
|
|
20
26
|
/**
|
|
21
27
|
* Amount of descendants that are passing the filters.
|
|
22
28
|
* For the Tree Data, it includes all the intermediate depth levels (= amount of children + amount of grand children + ...).
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export type { GridFilterState, GridFilterInitialState } from './gridFilterState';
|
|
2
2
|
export { getDefaultGridFilterModel } from './gridFilterState';
|
|
3
|
-
export
|
|
3
|
+
export { gridFilterModelSelector, gridQuickFilterValuesSelector, gridVisibleRowsLookupSelector, gridFilteredRowsLookupSelector, gridFilteredDescendantCountLookupSelector, gridExpandedSortedRowEntriesSelector, gridExpandedSortedRowIdsSelector, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector, gridFilteredSortedTopLevelRowEntriesSelector, gridExpandedRowCountSelector, gridFilteredTopLevelRowCountSelector, gridFilteredRowCountSelector, gridFilteredDescendantRowCountSelector, gridFilterActiveItemsSelector, gridFilterActiveItemsLookupSelector, } from './gridFilterSelector';
|
|
4
|
+
export type { GridFilterActiveItemsLookup } from './gridFilterSelector';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { getDefaultGridFilterModel } from './gridFilterState';
|
|
2
|
-
export
|
|
2
|
+
export { gridFilterModelSelector, gridQuickFilterValuesSelector, gridVisibleRowsLookupSelector, gridFilteredRowsLookupSelector, gridFilteredDescendantCountLookupSelector, gridExpandedSortedRowEntriesSelector, gridExpandedSortedRowIdsSelector, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector, gridFilteredSortedTopLevelRowEntriesSelector, gridExpandedRowCountSelector, gridFilteredTopLevelRowCountSelector, gridFilteredRowCountSelector, gridFilteredDescendantRowCountSelector, gridFilterActiveItemsSelector, gridFilterActiveItemsLookupSelector } from './gridFilterSelector';
|
|
@@ -23,6 +23,7 @@ export const filterStateInitializer = (state, props, apiRef) => {
|
|
|
23
23
|
filter: {
|
|
24
24
|
filterModel: sanitizeFilterModel(filterModel, props.disableMultipleColumnsFiltering, apiRef),
|
|
25
25
|
filteredRowsLookup: {},
|
|
26
|
+
filteredChildrenCountLookup: {},
|
|
26
27
|
filteredDescendantCountLookup: {}
|
|
27
28
|
},
|
|
28
29
|
visibleRowsLookup: {}
|
|
@@ -273,6 +274,7 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
273
274
|
if (props.filterMode !== 'client' || !params.isRowMatchingFilters) {
|
|
274
275
|
return {
|
|
275
276
|
filteredRowsLookup: {},
|
|
277
|
+
filteredChildrenCountLookup: {},
|
|
276
278
|
filteredDescendantCountLookup: {}
|
|
277
279
|
};
|
|
278
280
|
}
|
|
@@ -301,6 +303,7 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
301
303
|
}
|
|
302
304
|
return {
|
|
303
305
|
filteredRowsLookup,
|
|
306
|
+
filteredChildrenCountLookup: {},
|
|
304
307
|
filteredDescendantCountLookup: {}
|
|
305
308
|
};
|
|
306
309
|
}, [apiRef, props.filterMode, getRowId, getRowsRef]);
|
|
@@ -105,6 +105,9 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
105
105
|
}, [apiRef, logger, props.rowSelection, props.signature, canHaveMultipleSelection]);
|
|
106
106
|
const isRowSelected = React.useCallback(id => gridRowSelectionStateSelector(apiRef.current.state).includes(id), [apiRef]);
|
|
107
107
|
const isRowSelectable = React.useCallback(id => {
|
|
108
|
+
if (props.rowSelection === false) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
108
111
|
if (propIsRowSelectable && !propIsRowSelectable(apiRef.current.getRowParams(id))) {
|
|
109
112
|
return false;
|
|
110
113
|
}
|
|
@@ -113,7 +116,7 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
113
116
|
return false;
|
|
114
117
|
}
|
|
115
118
|
return true;
|
|
116
|
-
}, [apiRef, propIsRowSelectable]);
|
|
119
|
+
}, [apiRef, props.rowSelection, propIsRowSelectable]);
|
|
117
120
|
const getSelectedRows = React.useCallback(() => selectedGridRowsSelector(apiRef), [apiRef]);
|
|
118
121
|
const selectRow = React.useCallback((id, isSelected = true, resetSelection = false) => {
|
|
119
122
|
if (!apiRef.current.isRowSelectable(id)) {
|