@mui/x-data-grid-pro 7.12.1 → 7.14.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.
Files changed (58) hide show
  1. package/CHANGELOG.md +162 -1
  2. package/DataGridPro/DataGridPro.js +10 -1
  3. package/components/GridDataSourceTreeDataGroupingCell.js +4 -4
  4. package/components/headerFiltering/GridHeaderFilterCell.js +2 -1
  5. package/esm/DataGridPro/DataGridPro.js +10 -1
  6. package/esm/components/GridDataSourceTreeDataGroupingCell.js +4 -4
  7. package/esm/components/headerFiltering/GridHeaderFilterCell.js +2 -1
  8. package/esm/hooks/features/dataSource/gridDataSourceSelector.js +4 -2
  9. package/esm/hooks/features/rows/index.js +1 -0
  10. package/esm/hooks/features/rows/useGridRowAriaAttributes.js +37 -0
  11. package/esm/hooks/features/serverSideTreeData/useGridDataSourceTreeDataPreProcessors.js +1 -1
  12. package/esm/hooks/features/serverSideTreeData/utils.js +3 -0
  13. package/esm/hooks/features/treeData/gridTreeDataUtils.js +7 -0
  14. package/esm/hooks/utils/useGridAriaAttributes.js +11 -0
  15. package/esm/internals/index.js +7 -1
  16. package/esm/utils/releaseInfo.js +1 -1
  17. package/esm/utils/tree/createRowTree.js +1 -1
  18. package/esm/utils/tree/insertDataRowInTree.js +3 -3
  19. package/esm/utils/tree/updateRowTree.js +4 -4
  20. package/hooks/features/dataSource/gridDataSourceSelector.d.ts +5 -3
  21. package/hooks/features/dataSource/gridDataSourceSelector.js +4 -2
  22. package/hooks/features/rows/index.d.ts +1 -0
  23. package/hooks/features/rows/index.js +16 -0
  24. package/hooks/features/rows/useGridRowAriaAttributes.d.ts +3 -0
  25. package/hooks/features/rows/useGridRowAriaAttributes.js +46 -0
  26. package/hooks/features/serverSideTreeData/useGridDataSourceTreeDataPreProcessors.js +1 -1
  27. package/hooks/features/serverSideTreeData/utils.d.ts +1 -0
  28. package/hooks/features/serverSideTreeData/utils.js +3 -0
  29. package/hooks/features/treeData/gridTreeDataUtils.js +7 -0
  30. package/hooks/utils/useGridAriaAttributes.d.ts +2 -0
  31. package/hooks/utils/useGridAriaAttributes.js +19 -0
  32. package/index.js +1 -1
  33. package/internals/index.d.ts +2 -0
  34. package/internals/index.js +16 -0
  35. package/models/dataGridProProps.d.ts +1 -1
  36. package/modern/DataGridPro/DataGridPro.js +10 -1
  37. package/modern/components/GridDataSourceTreeDataGroupingCell.js +4 -4
  38. package/modern/components/headerFiltering/GridHeaderFilterCell.js +2 -1
  39. package/modern/hooks/features/dataSource/gridDataSourceSelector.js +4 -2
  40. package/modern/hooks/features/rows/index.js +1 -0
  41. package/modern/hooks/features/rows/useGridRowAriaAttributes.js +37 -0
  42. package/modern/hooks/features/serverSideTreeData/useGridDataSourceTreeDataPreProcessors.js +1 -1
  43. package/modern/hooks/features/serverSideTreeData/utils.js +3 -0
  44. package/modern/hooks/features/treeData/gridTreeDataUtils.js +7 -0
  45. package/modern/hooks/utils/useGridAriaAttributes.js +11 -0
  46. package/modern/index.js +1 -1
  47. package/modern/internals/index.js +7 -1
  48. package/modern/utils/releaseInfo.js +1 -1
  49. package/modern/utils/tree/createRowTree.js +1 -1
  50. package/modern/utils/tree/insertDataRowInTree.js +3 -3
  51. package/modern/utils/tree/updateRowTree.js +4 -4
  52. package/package.json +6 -6
  53. package/utils/releaseInfo.js +1 -1
  54. package/utils/tree/createRowTree.js +1 -1
  55. package/utils/tree/insertDataRowInTree.d.ts +2 -2
  56. package/utils/tree/insertDataRowInTree.js +3 -3
  57. package/utils/tree/models.d.ts +1 -1
  58. package/utils/tree/updateRowTree.js +4 -4
package/CHANGELOG.md CHANGED
@@ -3,6 +3,167 @@
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.14.0
7
+
8
+ _Aug 23, 2024_
9
+
10
+ We'd like to offer a big thanks to the 14 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 💫 Allow [filtering the axis on zoom](https://mui.com/x/react-charts/zoom-and-pan/#zoom-filtering), making the axis adapt by removing values outside the view.
13
+
14
+ <img width="600" src="https://github.com/user-attachments/assets/e65bbd00-d2a8-4136-81cd-3598f1373c16" alt="filtering the axis on zoom" />
15
+
16
+ - 📊 Improve bar chart performances
17
+ - 🌍 Improve Czech (cs-CZ) and Hebrew (he-IL) locales on the Data Grid
18
+ - 🌍 Improve Chinese (zh-HK), Hebrew (he-IL), and Vietnamese (vi-VN) locales on the Date and Time Pickers
19
+ - 🐞 Bugfixes
20
+
21
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
22
+
23
+ ### Data Grid
24
+
25
+ #### `@mui/x-data-grid@7.14.0`
26
+
27
+ - [DataGrid] Use readonly array result for `getTreeDataPath` (#11743) @pcorpet
28
+ - [DataGrid] Use `event.key` for `Tab` and `Escape` keys (#14170) @k-rajat19
29
+ - [DataGrid] Introduce selectors with arguments (#14236) @MBilalShafi
30
+ - [DataGrid] include `api` in `gridCellParams` interface (#14201) @k-rajat19
31
+ - [l10n] Improve Czech (cs-CZ) locale (#14135) @chirimiri22
32
+ - [l10n] Improve Hebrew (he-IL) locale (#14287) @rotembarsela
33
+
34
+ #### `@mui/x-data-grid-pro@7.14.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
35
+
36
+ Same changes as in `@mui/x-data-grid@7.14.0`.
37
+
38
+ #### `@mui/x-data-grid-premium@7.14.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
39
+
40
+ Same changes as in `@mui/x-data-grid-pro@7.14.0`, plus:
41
+
42
+ - [DataGridPremium] Fix clipboard paste not working for a single cell on non-first page (#14261) @arminmeh
43
+ - [DataGridPremium] Fix `onCellSelectionModelChange` not triggered when additional cell range is selected (#14199) @arminmeh
44
+
45
+ ### Date and Time Pickers
46
+
47
+ #### `@mui/x-date-pickers@7.14.0`
48
+
49
+ - [l10n] Improve Chinese (zh-HK) locale (#13289) @yeeharn
50
+ - [l10n] Improve Hebrew (he-IL) locale (#14287) @rotembarsela
51
+ - [l10n] Improve Vietnamese (vi-VN) locale (#14238) @locnbk2002
52
+ - [TimePicker] Handle `Space` and `Enter` on the `TimeClock` component @arthurbalduini
53
+
54
+ #### `@mui/x-date-pickers-pro@7.14.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
55
+
56
+ Same changes as in `@mui/x-date-pickers@7.14.0`.
57
+
58
+ ### Charts
59
+
60
+ #### `@mui/x-charts@7.14.0`
61
+
62
+ - [charts] Fix grid overflow with zooming (#14280) @alexfauquette
63
+ - [charts] Improve bar chart performances (#14278) @alexfauquette
64
+ - [charts] Test pointer events (#14042) @alexfauquette
65
+ - [charts] Use `isPointInside` function for both graphs and axis (#14222) @JCQuintas
66
+
67
+ #### `@mui/x-charts-pro@7.0.0-alpha.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
68
+
69
+ Same changes as in `@mui/x-charts@7.14.0`, plus:
70
+
71
+ - [charts-pro] Zoom axis filtering (#14121) @JCQuintas
72
+
73
+ ### Docs
74
+
75
+ - [docs] Consistent use of UTC and timezones (#14250) @oliviertassinari
76
+ - [docs] Fix missing leading slashes in URLs (#14249) @oliviertassinari
77
+ - [docs] Dash usage revision on pickers pages (#14260) @arthurbalduini
78
+
79
+ ### Core
80
+
81
+ - [core] Follow JSDocs convention @oliviertassinari
82
+ - [core] Prepare for material v6 (#14143) @LukasTy
83
+ - [code-infra] Set up `eslint-plugin-testing-library` (#14232) @LukasTy
84
+ - [infra] Updated mui-x roadmap links with new project URL (#14271) @michelengelen
85
+
86
+ ## 7.13.0
87
+
88
+ _Aug 16, 2024_
89
+
90
+ We'd like to offer a big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:
91
+
92
+ - 💫 Allow to [edit the label](https://mui.com/x/react-tree-view/rich-tree-view/editing/) of Tree View's items.
93
+
94
+ <img width="344" src="https://github.com/user-attachments/assets/1a6cf765-2dc8-4906-bd93-139086eed148" alt="Item label editing" />
95
+
96
+ - 🔧 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.
97
+ - 🌍 Improve Vietnamese (vi-VN) locale on the Data Grid
98
+ - 🐞 Bugfixes
99
+
100
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
101
+
102
+ ### Data Grid
103
+
104
+ #### `@mui/x-data-grid@7.13.0`
105
+
106
+ - [DataGrid] Fix CSV export for `null` and `undefined` values (#14166) @k-rajat19
107
+ - [DataGrid] Fix error logged during skeleton loading with nested data grid (#14186) @KenanYusuf
108
+ - [DataGrid] Remove needless check in `useGridStateInitialization` (#14181) @k-rajat19
109
+ - [DataGrid] Add recipe for persisting filters in local storage (#14208) @cherniavskii
110
+ - [l10n] Improve Vietnamese (vi-VN) locale (#14216) @hungnd-casso
111
+
112
+ #### `@mui/x-data-grid-pro@7.13.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
113
+
114
+ Same changes as in `@mui/x-data-grid@7.13.0`, plus:
115
+
116
+ - [DataGridPro] Fix Tree Data and Row Grouping rows accessibility (#13623) @arminmeh
117
+
118
+ #### `@mui/x-data-grid-premium@7.13.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
119
+
120
+ Same changes as in `@mui/x-data-grid-pro@7.13.0`.
121
+
122
+ ### Date and Time Pickers
123
+
124
+ #### `@mui/x-date-pickers@7.13.0`
125
+
126
+ - [pickers] Fix date and time merging to retain milliseconds (#14173) @LukasTy
127
+
128
+ #### `@mui/x-date-pickers-pro@7.13.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
129
+
130
+ Same changes as in `@mui/x-date-pickers@7.13.0`.
131
+
132
+ ### Charts
133
+
134
+ #### `@mui/x-charts@7.13.0`
135
+
136
+ - [charts] Add `baseline` property to the `LineChart` `series` (#14153) @JCQuintas
137
+ - [charts] Fix issue where tooltip would disappear on mouse click (#14187) @alexfauquette
138
+ - [charts] Rename `CartesianContextProvider` to `CartesianProvider` (#14102) @JCQuintas
139
+ - [charts] Support axis with the same value for all data points (#14191) @alexfauquette
140
+
141
+ #### `@mui/x-charts-pro@7.0.0-alpha.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
142
+
143
+ Same changes as in `@mui/x-charts@7.13.0`.
144
+
145
+ ### Tree View
146
+
147
+ #### `@mui/x-tree-view@7.13.0`
148
+
149
+ - [TreeView] Add label editing feature (#13388) @noraleonte
150
+ - [TreeView] Fix the parameters passed for the `canMoveItemToNewPosition` prop (#14176) @flaviendelangle
151
+
152
+ ### Docs
153
+
154
+ - [docs] Extract dataset in the Line chart docs (#14034) @alexfauquette
155
+ - [docs] Remove redundant encoding in the mock data source server (#14185) @MBilalShafi
156
+ - [docs] Use Netflix financial results to document bar charts (#13991) @alexfauquette
157
+ - [docs] Remove relience of abbreviations (#14226) @oliviertassinari
158
+
159
+ ### Core
160
+
161
+ - [core] Bump monorepo (#14141) @Janpot
162
+ - [core] Fix ESLint issue (#14207) @LukasTy
163
+ - [core] Fix Netlify build cache issue (#14182) @cherniavskii
164
+ - [code-infra] Refactor Netlify `cache-docs` plugin setup (#14105) @LukasTy
165
+ - [internals] Move utils needed for tree view virtualization to shared package (#14202) @flaviendelangle
166
+
6
167
  ## 7.12.1
7
168
 
8
169
  _Aug 8, 2024_
@@ -51,7 +212,7 @@ Same changes as in `@mui/x-date-pickers@7.12.1`.
51
212
  - [charts] Fix charts vendor publish config (#14073) @JCQuintas
52
213
  - [charts] Move `plugins` to `PluginProvider` (#14056) @JCQuintas
53
214
 
54
- #### `@mui/x-date-charts-pro@7.0.0-alpha.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
215
+ #### `@mui/x-charts-pro@7.0.0-alpha.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
55
216
 
56
217
  Same changes as in `@mui/x-charts@7.12.1`, plus:
57
218
 
@@ -16,9 +16,17 @@ var _useDataGridProComponent = require("./useDataGridProComponent");
16
16
  var _useDataGridProProps = require("./useDataGridProProps");
17
17
  var _releaseInfo = require("../utils/releaseInfo");
18
18
  var _propValidation = require("../internals/propValidation");
19
+ var _useGridAriaAttributes = require("../hooks/utils/useGridAriaAttributes");
20
+ var _useGridRowAriaAttributes = require("../hooks/features/rows/useGridRowAriaAttributes");
19
21
  var _jsxRuntime = require("react/jsx-runtime");
20
22
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
21
23
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
24
+ const configuration = {
25
+ hooks: {
26
+ useGridAriaAttributes: _useGridAriaAttributes.useGridAriaAttributes,
27
+ useGridRowAriaAttributes: _useGridRowAriaAttributes.useGridRowAriaAttributes
28
+ }
29
+ };
22
30
  const releaseInfo = (0, _releaseInfo.getReleaseInfo)();
23
31
  const DataGridProRaw = /*#__PURE__*/React.forwardRef(function DataGridPro(inProps, ref) {
24
32
  const props = (0, _useDataGridProProps.useDataGridProProps)(inProps);
@@ -29,6 +37,7 @@ const DataGridProRaw = /*#__PURE__*/React.forwardRef(function DataGridPro(inProp
29
37
  }
30
38
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_xDataGrid.GridContextProvider, {
31
39
  privateApiRef: privateApiRef,
40
+ configuration: configuration,
32
41
  props: props,
33
42
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_xDataGrid.GridRoot, (0, _extends2.default)({
34
43
  className: props.className,
@@ -420,7 +429,7 @@ DataGridProRaw.propTypes = {
420
429
  /**
421
430
  * Determines if a row can be selected.
422
431
  * @param {GridRowParams} params With all properties from [[GridRowParams]].
423
- * @returns {boolean} A boolean indicating if the cell is selectable.
432
+ * @returns {boolean} A boolean indicating if the row is selectable.
424
433
  */
425
434
  isRowSelectable: _propTypes.default.func,
426
435
  /**
@@ -11,9 +11,11 @@ var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"
11
11
  var _Box = _interopRequireDefault(require("@mui/material/Box"));
12
12
  var _Badge = _interopRequireDefault(require("@mui/material/Badge"));
13
13
  var _xDataGrid = require("@mui/x-data-grid");
14
+ var _internals = require("@mui/x-data-grid/internals");
14
15
  var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
15
16
  var _useGridRootProps = require("../hooks/utils/useGridRootProps");
16
17
  var _useGridPrivateApiContext = require("../hooks/utils/useGridPrivateApiContext");
18
+ var _gridDataSourceSelector = require("../hooks/features/dataSource/gridDataSourceSelector");
17
19
  var _jsxRuntime = require("react/jsx-runtime");
18
20
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
19
21
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -38,10 +40,8 @@ function GridTreeDataGroupingCellIcon(props) {
38
40
  field,
39
41
  descendantCount
40
42
  } = props;
41
- const loadingSelector = state => state.dataSource.loading[id] ?? false;
42
- const errorSelector = state => state.dataSource.errors[id];
43
- const isDataLoading = (0, _xDataGrid.useGridSelector)(apiRef, loadingSelector);
44
- const error = (0, _xDataGrid.useGridSelector)(apiRef, errorSelector);
43
+ const isDataLoading = (0, _internals.useGridSelectorV8)(apiRef, _gridDataSourceSelector.gridDataSourceLoadingIdSelector, id);
44
+ const error = (0, _internals.useGridSelectorV8)(apiRef, _gridDataSourceSelector.gridDataSourceErrorSelector, id);
45
45
  const handleClick = event => {
46
46
  if (!rowNode.childrenExpanded) {
47
47
  // always fetch/get from cache the children when the node is expanded
@@ -11,6 +11,7 @@ var React = _interopRequireWildcard(require("react"));
11
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
12
12
  var _clsx = _interopRequireDefault(require("clsx"));
13
13
  var _utils = require("@mui/utils");
14
+ var _fastMemo = require("@mui/x-internals/fastMemo");
14
15
  var _xDataGrid = require("@mui/x-data-grid");
15
16
  var _internals = require("@mui/x-data-grid/internals");
16
17
  var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
@@ -282,4 +283,4 @@ process.env.NODE_ENV !== "production" ? GridHeaderFilterCell.propTypes = {
282
283
  tabIndex: _propTypes.default.oneOf([-1, 0]).isRequired,
283
284
  width: _propTypes.default.number.isRequired
284
285
  } : void 0;
285
- const Memoized = exports.GridHeaderFilterCell = (0, _internals.fastMemo)(GridHeaderFilterCell);
286
+ const Memoized = exports.GridHeaderFilterCell = (0, _fastMemo.fastMemo)(GridHeaderFilterCell);
@@ -10,7 +10,15 @@ import { useDataGridProComponent } from './useDataGridProComponent';
10
10
  import { useDataGridProProps } from './useDataGridProProps';
11
11
  import { getReleaseInfo } from '../utils/releaseInfo';
12
12
  import { propValidatorsDataGridPro } from '../internals/propValidation';
13
+ import { useGridAriaAttributes } from '../hooks/utils/useGridAriaAttributes';
14
+ import { useGridRowAriaAttributes } from '../hooks/features/rows/useGridRowAriaAttributes';
13
15
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
+ const configuration = {
17
+ hooks: {
18
+ useGridAriaAttributes,
19
+ useGridRowAriaAttributes
20
+ }
21
+ };
14
22
  const releaseInfo = getReleaseInfo();
15
23
  const DataGridProRaw = /*#__PURE__*/React.forwardRef(function DataGridPro(inProps, ref) {
16
24
  const props = useDataGridProProps(inProps);
@@ -21,6 +29,7 @@ const DataGridProRaw = /*#__PURE__*/React.forwardRef(function DataGridPro(inProp
21
29
  }
22
30
  return /*#__PURE__*/_jsx(GridContextProvider, {
23
31
  privateApiRef: privateApiRef,
32
+ configuration: configuration,
24
33
  props: props,
25
34
  children: /*#__PURE__*/_jsxs(GridRoot, _extends({
26
35
  className: props.className,
@@ -412,7 +421,7 @@ DataGridProRaw.propTypes = {
412
421
  /**
413
422
  * Determines if a row can be selected.
414
423
  * @param {GridRowParams} params With all properties from [[GridRowParams]].
415
- * @returns {boolean} A boolean indicating if the cell is selectable.
424
+ * @returns {boolean} A boolean indicating if the row is selectable.
416
425
  */
417
426
  isRowSelectable: PropTypes.func,
418
427
  /**
@@ -4,9 +4,11 @@ import composeClasses from '@mui/utils/composeClasses';
4
4
  import Box from '@mui/material/Box';
5
5
  import Badge from '@mui/material/Badge';
6
6
  import { getDataGridUtilityClass, useGridSelector } from '@mui/x-data-grid';
7
+ import { useGridSelectorV8 } from '@mui/x-data-grid/internals';
7
8
  import CircularProgress from '@mui/material/CircularProgress';
8
9
  import { useGridRootProps } from '../hooks/utils/useGridRootProps';
9
10
  import { useGridPrivateApiContext } from '../hooks/utils/useGridPrivateApiContext';
11
+ import { gridDataSourceErrorSelector, gridDataSourceLoadingIdSelector } from '../hooks/features/dataSource/gridDataSourceSelector';
10
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
13
  const useUtilityClasses = ownerState => {
12
14
  const {
@@ -29,10 +31,8 @@ function GridTreeDataGroupingCellIcon(props) {
29
31
  field,
30
32
  descendantCount
31
33
  } = props;
32
- const loadingSelector = state => state.dataSource.loading[id] ?? false;
33
- const errorSelector = state => state.dataSource.errors[id];
34
- const isDataLoading = useGridSelector(apiRef, loadingSelector);
35
- const error = useGridSelector(apiRef, errorSelector);
34
+ const isDataLoading = useGridSelectorV8(apiRef, gridDataSourceLoadingIdSelector, id);
35
+ const error = useGridSelectorV8(apiRef, gridDataSourceErrorSelector, id);
36
36
  const handleClick = event => {
37
37
  if (!rowNode.childrenExpanded) {
38
38
  // always fetch/get from cache the children when the node is expanded
@@ -5,8 +5,9 @@ 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, unstable_composeClasses as composeClasses, unstable_capitalize as capitalize } from '@mui/utils';
8
+ import { fastMemo } from '@mui/x-internals/fastMemo';
8
9
  import { gridVisibleColumnFieldsSelector, getDataGridUtilityClass, useGridSelector, gridFilterModelSelector, gridFilterableColumnLookupSelector } from '@mui/x-data-grid';
9
- import { fastMemo, useGridPrivateApiContext, gridHeaderFilteringEditFieldSelector, gridHeaderFilteringMenuSelector, isNavigationKey, shouldCellShowLeftBorder, shouldCellShowRightBorder } from '@mui/x-data-grid/internals';
10
+ import { useGridPrivateApiContext, gridHeaderFilteringEditFieldSelector, gridHeaderFilteringMenuSelector, isNavigationKey, shouldCellShowLeftBorder, shouldCellShowRightBorder } from '@mui/x-data-grid/internals';
10
11
  import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
11
12
  import { GridHeaderFilterMenuContainer } from './GridHeaderFilterMenuContainer';
12
13
  import { GridHeaderFilterClearButton } from './GridHeaderFilterClearButton';
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import { gridFilterModelSelector, gridSortModelSelector, gridPaginationModelSelector } from '@mui/x-data-grid';
3
- import { createSelector } from '@mui/x-data-grid/internals';
3
+ import { createSelector, createSelectorV8 } from '@mui/x-data-grid/internals';
4
4
  const computeStartEnd = paginationModel => {
5
5
  const start = paginationModel.page * paginationModel.pageSize;
6
6
  const end = start + paginationModel.pageSize - 1;
@@ -21,4 +21,6 @@ export const gridGetRowsParamsSelector = createSelector(gridFilterModelSelector,
21
21
  });
22
22
  export const gridDataSourceStateSelector = state => state.dataSource;
23
23
  export const gridDataSourceLoadingSelector = createSelector(gridDataSourceStateSelector, dataSource => dataSource.loading);
24
- export const gridDataSourceErrorsSelector = createSelector(gridDataSourceStateSelector, dataSource => dataSource.errors);
24
+ export const gridDataSourceLoadingIdSelector = createSelectorV8(gridDataSourceStateSelector, (dataSource, id) => dataSource.loading[id] ?? false);
25
+ export const gridDataSourceErrorsSelector = createSelector(gridDataSourceStateSelector, dataSource => dataSource.errors);
26
+ export const gridDataSourceErrorSelector = createSelectorV8(gridDataSourceStateSelector, (dataSource, id) => dataSource.errors[id]);
@@ -0,0 +1 @@
1
+ export * from './useGridRowAriaAttributes';
@@ -0,0 +1,37 @@
1
+ import * as React from 'react';
2
+ import { useGridSelector, gridFilteredTopLevelRowCountSelector, GRID_ROOT_GROUP_ID } from '@mui/x-data-grid';
3
+ import { useGridRowAriaAttributes as useGridRowAriaAttributesCommunity, gridFilteredChildrenCountLookupSelector, gridExpandedSortedRowTreeLevelPositionLookupSelector } from '@mui/x-data-grid/internals';
4
+ import { useGridPrivateApiContext } from '../../utils/useGridPrivateApiContext';
5
+ import { useGridRootProps } from '../../utils/useGridRootProps';
6
+ export const useGridRowAriaAttributes = addTreeDataAttributes => {
7
+ const apiRef = useGridPrivateApiContext();
8
+ const props = useGridRootProps();
9
+ const getRowAriaAttributesCommunity = useGridRowAriaAttributesCommunity();
10
+ const filteredTopLevelRowCount = useGridSelector(apiRef, gridFilteredTopLevelRowCountSelector);
11
+ const filteredChildrenCountLookup = useGridSelector(apiRef, gridFilteredChildrenCountLookupSelector);
12
+ const sortedVisibleRowPositionsLookup = useGridSelector(apiRef, gridExpandedSortedRowTreeLevelPositionLookupSelector);
13
+ return React.useCallback((rowNode, index) => {
14
+ const ariaAttributes = getRowAriaAttributesCommunity(rowNode, index);
15
+ if (rowNode === null || !(props.treeData || addTreeDataAttributes)) {
16
+ return ariaAttributes;
17
+ }
18
+
19
+ // pinned and footer rows are not part of the rowgroup and should not get the set specific aria attributes
20
+ if (rowNode.type === 'footer' || rowNode.type === 'pinnedRow') {
21
+ return ariaAttributes;
22
+ }
23
+ ariaAttributes['aria-level'] = rowNode.depth + 1;
24
+ const filteredChildrenCount = filteredChildrenCountLookup[rowNode.id] ?? 0;
25
+ // aria-expanded should only be added to the rows that contain children
26
+ if (rowNode.type === 'group' && filteredChildrenCount > 0) {
27
+ ariaAttributes['aria-expanded'] = Boolean(rowNode.childrenExpanded);
28
+ }
29
+
30
+ // if the parent is null, set size and position cannot be determined
31
+ if (rowNode.parent !== null) {
32
+ ariaAttributes['aria-setsize'] = rowNode.parent === GRID_ROOT_GROUP_ID ? filteredTopLevelRowCount : filteredChildrenCountLookup[rowNode.parent];
33
+ ariaAttributes['aria-posinset'] = sortedVisibleRowPositionsLookup[rowNode.id];
34
+ }
35
+ return ariaAttributes;
36
+ }, [props.treeData, addTreeDataAttributes, filteredTopLevelRowCount, filteredChildrenCountLookup, sortedVisibleRowPositionsLookup, getRowAriaAttributesCommunity]);
37
+ };
@@ -83,7 +83,7 @@ export const useGridDataSourceTreeDataPreProcessors = (privateApiRef, props) =>
83
83
  key,
84
84
  field: null
85
85
  })),
86
- hasServerChildren: !!count && count !== 0
86
+ serverChildrenCount: count
87
87
  };
88
88
  };
89
89
  const onDuplicatePath = (firstId, secondId, path) => {
@@ -2,14 +2,17 @@ import { GRID_ROOT_GROUP_ID } from '@mui/x-data-grid';
2
2
  import { getTreeNodeDescendants } from '@mui/x-data-grid/internals';
3
3
  export function skipFiltering(rowTree) {
4
4
  const filteredRowsLookup = {};
5
+ const filteredChildrenCountLookup = {};
5
6
  const filteredDescendantCountLookup = {};
6
7
  const nodes = Object.values(rowTree);
7
8
  for (let i = 0; i < nodes.length; i += 1) {
8
9
  const node = nodes[i];
9
10
  filteredRowsLookup[node.id] = true;
11
+ filteredChildrenCountLookup[node.id] = node.serverChildrenCount ?? 0;
10
12
  }
11
13
  return {
12
14
  filteredRowsLookup,
15
+ filteredChildrenCountLookup,
13
16
  filteredDescendantCountLookup
14
17
  };
15
18
  }
@@ -14,6 +14,7 @@ export const filterRowTreeFromTreeData = params => {
14
14
  isRowMatchingFilters
15
15
  } = params;
16
16
  const filteredRowsLookup = {};
17
+ const filteredChildrenCountLookup = {};
17
18
  const filteredDescendantCountLookup = {};
18
19
  const filterCache = {};
19
20
  const filterResults = {
@@ -32,12 +33,16 @@ export const filterRowTreeFromTreeData = params => {
32
33
  isRowMatchingFilters(row, undefined, filterResults);
33
34
  isMatchingFilters = passFilterLogic([filterResults.passingFilterItems], [filterResults.passingQuickFilterValues], params.filterModel, params.apiRef, filterCache);
34
35
  }
36
+ let filteredChildrenCount = 0;
35
37
  let filteredDescendantCount = 0;
36
38
  if (node.type === 'group') {
37
39
  node.children.forEach(childId => {
38
40
  const childNode = rowTree[childId];
39
41
  const childSubTreeSize = filterTreeNode(childNode, isMatchingFilters ?? isParentMatchingFilters, areAncestorsExpanded && !!node.childrenExpanded);
40
42
  filteredDescendantCount += childSubTreeSize;
43
+ if (childSubTreeSize > 0) {
44
+ filteredChildrenCount += 1;
45
+ }
41
46
  });
42
47
  }
43
48
  let shouldPassFilters;
@@ -62,6 +67,7 @@ export const filterRowTreeFromTreeData = params => {
62
67
  if (!shouldPassFilters) {
63
68
  return 0;
64
69
  }
70
+ filteredChildrenCountLookup[node.id] = filteredChildrenCount;
65
71
  filteredDescendantCountLookup[node.id] = filteredDescendantCount;
66
72
  if (node.type === 'footer') {
67
73
  return filteredDescendantCount;
@@ -77,6 +83,7 @@ export const filterRowTreeFromTreeData = params => {
77
83
  }
78
84
  return {
79
85
  filteredRowsLookup,
86
+ filteredChildrenCountLookup,
80
87
  filteredDescendantCountLookup
81
88
  };
82
89
  };
@@ -0,0 +1,11 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import { useGridAriaAttributes as useGridAriaAttributesCommunity } from '@mui/x-data-grid/internals';
3
+ import { useGridRootProps } from './useGridRootProps';
4
+ export const useGridAriaAttributes = () => {
5
+ const ariaAttributesCommunity = useGridAriaAttributesCommunity();
6
+ const rootProps = useGridRootProps();
7
+ const ariaAttributesPro = rootProps.treeData ? {
8
+ role: 'treegrid'
9
+ } : {};
10
+ return _extends({}, ariaAttributesCommunity, ariaAttributesPro);
11
+ };
@@ -3,8 +3,14 @@ export * from '@mui/x-data-grid/internals';
3
3
  export { GridColumnHeaders } from '../components/GridColumnHeaders';
4
4
  export { DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS } from '../constants/dataGridProDefaultSlotsComponents';
5
5
 
6
- // eslint-disable-next-line import/export
6
+ /* eslint-disable import/export --
7
+ * x-data-grid-pro internals that are overriding the x-data-grid internals
8
+ */
7
9
  export { useGridColumnHeaders } from '../hooks/features/columnHeaders/useGridColumnHeaders';
10
+ export { useGridAriaAttributes } from '../hooks/utils/useGridAriaAttributes';
11
+ export { useGridRowAriaAttributes } from '../hooks/features/rows/useGridRowAriaAttributes';
12
+ // eslint-enable import/export
13
+
8
14
  export { useGridColumnPinning, columnPinningStateInitializer } from '../hooks/features/columnPinning/useGridColumnPinning';
9
15
  export { useGridColumnPinningPreProcessors } from '../hooks/features/columnPinning/useGridColumnPinningPreProcessors';
10
16
  export { useGridColumnReorder, columnReorderStateInitializer } from '../hooks/features/columnReorder/useGridColumnReorder';
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTcyMzE1NDQwMDAwMA==";
3
+ const releaseInfo = "MTcyNDM2MDQwMDAwMA==";
4
4
  if (process.env.NODE_ENV !== 'production') {
5
5
  // A simple hack to set the value in the test environment (has no build step).
6
6
  // eslint-disable-next-line no-useless-concat
@@ -19,7 +19,7 @@ export const createRowTree = params => {
19
19
  previousTree: params.previousTree,
20
20
  id: node.id,
21
21
  path: node.path,
22
- hasServerChildren: node.hasServerChildren,
22
+ serverChildrenCount: node.serverChildrenCount,
23
23
  onDuplicatePath: params.onDuplicatePath,
24
24
  treeDepths,
25
25
  isGroupExpandedByDefault: params.isGroupExpandedByDefault,
@@ -16,7 +16,7 @@ export const insertDataRowInTree = ({
16
16
  onDuplicatePath,
17
17
  isGroupExpandedByDefault,
18
18
  defaultGroupingExpansionDepth,
19
- hasServerChildren,
19
+ serverChildrenCount,
20
20
  groupsToFetch
21
21
  }) => {
22
22
  let parentNodeId = GRID_ROOT_GROUP_ID;
@@ -36,7 +36,7 @@ export const insertDataRowInTree = ({
36
36
  // We create a leaf node for the data row.
37
37
  if (existingNodeIdWithPartialPath == null) {
38
38
  let node;
39
- if (hasServerChildren) {
39
+ if (serverChildrenCount !== undefined && serverChildrenCount !== 0) {
40
40
  node = {
41
41
  type: 'group',
42
42
  id,
@@ -49,7 +49,7 @@ export const insertDataRowInTree = ({
49
49
  children: [],
50
50
  childrenFromPath: {},
51
51
  childrenExpanded: false,
52
- hasServerChildren: true
52
+ serverChildrenCount
53
53
  };
54
54
  const shouldFetchChildren = checkGroupChildrenExpansion(node, defaultGroupingExpansionDepth, isGroupExpandedByDefault);
55
55
  if (shouldFetchChildren) {
@@ -13,7 +13,7 @@ export const updateRowTree = params => {
13
13
  const {
14
14
  id,
15
15
  path,
16
- hasServerChildren
16
+ serverChildrenCount
17
17
  } = params.nodes.inserted[i];
18
18
  insertDataRowInTree({
19
19
  previousTree: params.previousTree,
@@ -22,7 +22,7 @@ export const updateRowTree = params => {
22
22
  updatedGroupsManager,
23
23
  id,
24
24
  path,
25
- hasServerChildren,
25
+ serverChildrenCount,
26
26
  onDuplicatePath: params.onDuplicatePath,
27
27
  isGroupExpandedByDefault: params.isGroupExpandedByDefault,
28
28
  defaultGroupingExpansionDepth: params.defaultGroupingExpansionDepth,
@@ -42,7 +42,7 @@ export const updateRowTree = params => {
42
42
  const {
43
43
  id,
44
44
  path,
45
- hasServerChildren
45
+ serverChildrenCount
46
46
  } = params.nodes.modified[i];
47
47
  const pathInPreviousTree = getNodePathInTree({
48
48
  tree,
@@ -63,7 +63,7 @@ export const updateRowTree = params => {
63
63
  updatedGroupsManager,
64
64
  id,
65
65
  path,
66
- hasServerChildren,
66
+ serverChildrenCount,
67
67
  onDuplicatePath: params.onDuplicatePath,
68
68
  isGroupExpandedByDefault: params.isGroupExpandedByDefault,
69
69
  defaultGroupingExpansionDepth: params.defaultGroupingExpansionDepth,
@@ -1,4 +1,4 @@
1
- import { GridPaginationModel } from '@mui/x-data-grid';
1
+ import { GridPaginationModel, GridRowId } from '@mui/x-data-grid';
2
2
  import { GridStatePro } from '../../../models/gridStatePro';
3
3
  export declare const gridGetRowsParamsSelector: import("@mui/x-data-grid").OutputSelector<import("@mui/x-data-grid/models/gridStateCommunity").GridStateCommunity, {
4
4
  start: number;
@@ -10,5 +10,7 @@ export declare const gridGetRowsParamsSelector: import("@mui/x-data-grid").Outpu
10
10
  filterModel: import("@mui/x-data-grid").GridFilterModel;
11
11
  }>;
12
12
  export declare const gridDataSourceStateSelector: (state: GridStatePro) => import("./interfaces").GridDataSourceState;
13
- export declare const gridDataSourceLoadingSelector: import("@mui/x-data-grid").OutputSelector<GridStatePro, Record<import("@mui/x-data-grid").GridRowId, boolean>>;
14
- export declare const gridDataSourceErrorsSelector: import("@mui/x-data-grid").OutputSelector<GridStatePro, Record<import("@mui/x-data-grid").GridRowId, any>>;
13
+ export declare const gridDataSourceLoadingSelector: import("@mui/x-data-grid").OutputSelector<GridStatePro, Record<GridRowId, boolean>>;
14
+ export declare const gridDataSourceLoadingIdSelector: import("@mui/x-data-grid/utils/createSelector").OutputSelectorV8<GridStatePro, GridRowId, boolean>;
15
+ export declare const gridDataSourceErrorsSelector: import("@mui/x-data-grid").OutputSelector<GridStatePro, Record<GridRowId, any>>;
16
+ export declare const gridDataSourceErrorSelector: import("@mui/x-data-grid/utils/createSelector").OutputSelectorV8<GridStatePro, GridRowId, any>;
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.gridGetRowsParamsSelector = exports.gridDataSourceStateSelector = exports.gridDataSourceLoadingSelector = exports.gridDataSourceErrorsSelector = void 0;
7
+ exports.gridGetRowsParamsSelector = exports.gridDataSourceStateSelector = exports.gridDataSourceLoadingSelector = exports.gridDataSourceLoadingIdSelector = exports.gridDataSourceErrorsSelector = exports.gridDataSourceErrorSelector = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var _xDataGrid = require("@mui/x-data-grid");
10
10
  var _internals = require("@mui/x-data-grid/internals");
@@ -29,4 +29,6 @@ const gridGetRowsParamsSelector = exports.gridGetRowsParamsSelector = (0, _inter
29
29
  const gridDataSourceStateSelector = state => state.dataSource;
30
30
  exports.gridDataSourceStateSelector = gridDataSourceStateSelector;
31
31
  const gridDataSourceLoadingSelector = exports.gridDataSourceLoadingSelector = (0, _internals.createSelector)(gridDataSourceStateSelector, dataSource => dataSource.loading);
32
- const gridDataSourceErrorsSelector = exports.gridDataSourceErrorsSelector = (0, _internals.createSelector)(gridDataSourceStateSelector, dataSource => dataSource.errors);
32
+ const gridDataSourceLoadingIdSelector = exports.gridDataSourceLoadingIdSelector = (0, _internals.createSelectorV8)(gridDataSourceStateSelector, (dataSource, id) => dataSource.loading[id] ?? false);
33
+ const gridDataSourceErrorsSelector = exports.gridDataSourceErrorsSelector = (0, _internals.createSelector)(gridDataSourceStateSelector, dataSource => dataSource.errors);
34
+ const gridDataSourceErrorSelector = exports.gridDataSourceErrorSelector = (0, _internals.createSelectorV8)(gridDataSourceStateSelector, (dataSource, id) => dataSource.errors[id]);
@@ -0,0 +1 @@
1
+ export * from './useGridRowAriaAttributes';
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _useGridRowAriaAttributes = require("./useGridRowAriaAttributes");
7
+ Object.keys(_useGridRowAriaAttributes).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _useGridRowAriaAttributes[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _useGridRowAriaAttributes[key];
14
+ }
15
+ });
16
+ });
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import { GridTreeNode } from '@mui/x-data-grid';
3
+ export declare const useGridRowAriaAttributes: (addTreeDataAttributes?: boolean) => (rowNode: GridTreeNode, index: number) => React.HTMLAttributes<HTMLElement>;