@mui/x-data-grid-pro 6.0.0-alpha.0 → 6.0.0-alpha.2

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 (126) hide show
  1. package/CHANGELOG.md +209 -0
  2. package/DataGridPro/DataGridPro.js +1 -1
  3. package/DataGridPro/useDataGridProProps.js +2 -2
  4. package/components/DataGridProVirtualScroller.js +2 -2
  5. package/components/GridRowReorderCell.js +4 -6
  6. package/components/GridTreeDataGroupingCell.d.ts +2 -2
  7. package/hooks/features/detailPanel/useGridDetailPanel.js +2 -2
  8. package/hooks/features/detailPanel/useGridDetailPanelCache.js +2 -2
  9. package/hooks/features/infiniteLoader/useGridInfiniteLoader.js +2 -2
  10. package/hooks/features/lazyLoader/useGridLazyLoader.js +20 -9
  11. package/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.d.ts +1 -1
  12. package/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +20 -6
  13. package/hooks/features/rowPinning/gridRowPinningInterface.d.ts +2 -2
  14. package/hooks/features/rowPinning/useGridRowPinningPreProcessors.d.ts +16 -16
  15. package/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +62 -25
  16. package/hooks/features/rowReorder/useGridRowReorder.js +5 -5
  17. package/hooks/features/treeData/gridTreeDataGroupColDef.js +1 -1
  18. package/hooks/features/treeData/gridTreeDataUtils.js +14 -12
  19. package/hooks/features/treeData/useGridTreeData.js +2 -6
  20. package/hooks/features/treeData/useGridTreeDataPreProcessors.js +35 -18
  21. package/index.js +1 -1
  22. package/internals/index.d.ts +4 -2
  23. package/internals/index.js +4 -2
  24. package/legacy/DataGridPro/DataGridPro.js +1 -1
  25. package/legacy/DataGridPro/useDataGridProProps.js +2 -2
  26. package/legacy/components/DataGridProVirtualScroller.js +2 -2
  27. package/legacy/components/GridRowReorderCell.js +4 -6
  28. package/legacy/hooks/features/detailPanel/useGridDetailPanel.js +2 -2
  29. package/legacy/hooks/features/detailPanel/useGridDetailPanelCache.js +2 -2
  30. package/legacy/hooks/features/infiniteLoader/useGridInfiniteLoader.js +2 -2
  31. package/legacy/hooks/features/lazyLoader/useGridLazyLoader.js +25 -15
  32. package/legacy/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +21 -7
  33. package/legacy/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +62 -25
  34. package/legacy/hooks/features/rowReorder/useGridRowReorder.js +5 -5
  35. package/legacy/hooks/features/treeData/gridTreeDataGroupColDef.js +1 -1
  36. package/legacy/hooks/features/treeData/gridTreeDataUtils.js +14 -12
  37. package/legacy/hooks/features/treeData/useGridTreeData.js +2 -6
  38. package/legacy/hooks/features/treeData/useGridTreeDataPreProcessors.js +37 -22
  39. package/legacy/index.js +1 -1
  40. package/legacy/internals/index.js +4 -2
  41. package/legacy/utils/releaseInfo.js +1 -1
  42. package/legacy/utils/tree/createRowTree.js +36 -0
  43. package/legacy/utils/tree/index.js +1 -1
  44. package/legacy/utils/tree/insertDataRowInTree.js +127 -0
  45. package/legacy/utils/tree/models.js +1 -0
  46. package/legacy/utils/tree/removeDataRowFromTree.js +97 -0
  47. package/legacy/utils/tree/sortRowTree.js +49 -43
  48. package/legacy/utils/tree/updateRowTree.js +81 -0
  49. package/legacy/utils/tree/utils.js +184 -0
  50. package/models/dataGridProProps.d.ts +4 -4
  51. package/modern/DataGridPro/DataGridPro.js +1 -1
  52. package/modern/DataGridPro/useDataGridProProps.js +2 -2
  53. package/modern/components/DataGridProVirtualScroller.js +2 -2
  54. package/modern/components/GridRowReorderCell.js +4 -4
  55. package/modern/hooks/features/detailPanel/useGridDetailPanel.js +2 -2
  56. package/modern/hooks/features/detailPanel/useGridDetailPanelCache.js +2 -2
  57. package/modern/hooks/features/infiniteLoader/useGridInfiniteLoader.js +2 -2
  58. package/modern/hooks/features/lazyLoader/useGridLazyLoader.js +20 -9
  59. package/modern/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +20 -6
  60. package/modern/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +60 -23
  61. package/modern/hooks/features/rowReorder/useGridRowReorder.js +5 -3
  62. package/modern/hooks/features/treeData/gridTreeDataGroupColDef.js +1 -1
  63. package/modern/hooks/features/treeData/gridTreeDataUtils.js +13 -9
  64. package/modern/hooks/features/treeData/useGridTreeData.js +2 -4
  65. package/modern/hooks/features/treeData/useGridTreeDataPreProcessors.js +35 -18
  66. package/modern/index.js +1 -1
  67. package/modern/internals/index.js +4 -2
  68. package/modern/utils/releaseInfo.js +1 -1
  69. package/modern/utils/tree/createRowTree.js +35 -0
  70. package/modern/utils/tree/index.js +1 -1
  71. package/modern/utils/tree/insertDataRowInTree.js +127 -0
  72. package/modern/utils/tree/models.js +1 -0
  73. package/modern/utils/tree/removeDataRowFromTree.js +100 -0
  74. package/modern/utils/tree/sortRowTree.js +46 -40
  75. package/modern/utils/tree/updateRowTree.js +83 -0
  76. package/modern/utils/tree/utils.js +180 -0
  77. package/node/DataGridPro/DataGridPro.js +1 -1
  78. package/node/DataGridPro/useDataGridProProps.js +1 -1
  79. package/node/components/DataGridProVirtualScroller.js +1 -1
  80. package/node/components/GridRowReorderCell.js +3 -5
  81. package/node/hooks/features/detailPanel/useGridDetailPanel.js +1 -1
  82. package/node/hooks/features/detailPanel/useGridDetailPanelCache.js +1 -1
  83. package/node/hooks/features/infiniteLoader/useGridInfiniteLoader.js +1 -1
  84. package/node/hooks/features/lazyLoader/useGridLazyLoader.js +19 -8
  85. package/node/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +18 -5
  86. package/node/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +63 -26
  87. package/node/hooks/features/rowReorder/useGridRowReorder.js +4 -4
  88. package/node/hooks/features/treeData/gridTreeDataGroupColDef.js +1 -1
  89. package/node/hooks/features/treeData/gridTreeDataUtils.js +14 -12
  90. package/node/hooks/features/treeData/useGridTreeData.js +1 -5
  91. package/node/hooks/features/treeData/useGridTreeDataPreProcessors.js +35 -17
  92. package/node/index.js +1 -1
  93. package/node/internals/index.js +35 -10
  94. package/node/utils/releaseInfo.js +1 -1
  95. package/node/utils/tree/createRowTree.js +46 -0
  96. package/node/utils/tree/index.js +2 -2
  97. package/node/utils/tree/insertDataRowInTree.js +139 -0
  98. package/node/utils/tree/models.js +5 -0
  99. package/node/utils/tree/removeDataRowFromTree.js +110 -0
  100. package/node/utils/tree/sortRowTree.js +50 -43
  101. package/node/utils/tree/updateRowTree.js +98 -0
  102. package/node/utils/tree/utils.js +217 -0
  103. package/package.json +3 -3
  104. package/themeAugmentation/props.d.ts +2 -2
  105. package/utils/releaseInfo.js +1 -1
  106. package/utils/tree/createRowTree.d.ts +15 -0
  107. package/utils/tree/createRowTree.js +35 -0
  108. package/utils/tree/index.d.ts +1 -1
  109. package/utils/tree/index.js +1 -1
  110. package/utils/tree/insertDataRowInTree.d.ts +51 -0
  111. package/utils/tree/insertDataRowInTree.js +129 -0
  112. package/utils/tree/models.d.ts +13 -0
  113. package/utils/tree/models.js +1 -0
  114. package/utils/tree/removeDataRowFromTree.d.ts +40 -0
  115. package/utils/tree/removeDataRowFromTree.js +100 -0
  116. package/utils/tree/sortRowTree.d.ts +6 -1
  117. package/utils/tree/sortRowTree.js +46 -40
  118. package/utils/tree/updateRowTree.d.ts +19 -0
  119. package/utils/tree/updateRowTree.js +83 -0
  120. package/utils/tree/utils.d.ts +66 -0
  121. package/utils/tree/utils.js +186 -0
  122. package/legacy/utils/tree/buildRowTree.js +0 -195
  123. package/modern/utils/tree/buildRowTree.js +0 -174
  124. package/node/utils/tree/buildRowTree.js +0 -195
  125. package/utils/tree/buildRowTree.d.ts +0 -48
  126. package/utils/tree/buildRowTree.js +0 -186
package/CHANGELOG.md CHANGED
@@ -3,6 +3,215 @@
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
+ ## v6.0.0-alpha.2
7
+
8
+ _Oct 7, 2022_
9
+
10
+ We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🚀 Further progress on stabilizing new date field components
13
+ - 🎁 Improve support for theme augmentation in the DataGrid (#6269) @cherniavskii
14
+ - 🌍 Add Japanese (ja-JP) locale to pickers (#6365) @sho918
15
+ - 📚 Documentation improvements
16
+ - 🐞 Bugfixes
17
+
18
+ ### `@mui/x-data-grid@v6.0.0-alpha.2` / `@mui/x-data-grid-pro@v6.0.0-alpha.2` / `@mui/x-data-grid-premium@v6.0.0-alpha.2`
19
+
20
+ #### Breaking changes
21
+
22
+ - 🎁 The aggregation is no longer experimental.
23
+
24
+ You can now use the aggregation without the `experimentalFeatures.aggregation` flag enabled.
25
+
26
+ ```diff
27
+ <DataGridPremium
28
+ - experimentalFeatures={{ aggregation: true }}
29
+ />
30
+ ```
31
+
32
+ The aggregation of the columns through the column menu is now enabled by default on `DataGridPremium`. You can set `disableAggregation={true}` to disable it.
33
+
34
+ #### Changes
35
+
36
+ - [DataGrid] Add filter item ID to `.MuiDataGrid-filterForm` (#6313) @m4theushw
37
+ - [DataGrid] Add missing `valueOptions` (#6401) @DanailH
38
+ - [DataGrid] Don't start edit mode when pressing Shift + Space (#6228) @m4theushw
39
+ - [DataGrid] Fix error when using column grouping with all columns hidden (#6405) @alexfauquette
40
+ - [DataGrid] Pass generics to the components in the theme augmentation (#6269) @cherniavskii
41
+ - [DataGridPremium] Remove the aggregation from the experimental features (#6372) @flaviendelangle
42
+
43
+ ### `@mui/x-date-pickers@v6.0.0-alpha.2` / `@mui/x-date-pickers-pro@v6.0.0-alpha.2`
44
+
45
+ #### Breaking changes
46
+
47
+ - The `renderDay` prop has been replaced by a `Day` component slot.
48
+ You can find more information about this pattern in the [MUI Base documentation](https://mui.com/base/getting-started/usage/#shared-props).
49
+
50
+ ```diff
51
+ // Same for any other date, date time or date range picker.
52
+ <DatePicker
53
+ - renderDay={(_, dayProps) => <CustomDay {...dayProps} />}
54
+ + components={{ Day: CustomDay }}
55
+ />
56
+ ```
57
+
58
+ #### Changes
59
+
60
+ - [DateRangePicker] Fix the shape of the first selected day when the start date has an hour set (#6403) @flaviendelangle
61
+ - [l10n] Add Japanese (ja-JP) locale to pickers (#6365) @sho918
62
+ - [DateRangePicker] Force focus to stay on inputs (#6324) @alexfauquette
63
+ - [pickers] Improve edition on field components (#6339) @flaviendelangle
64
+ - [pickers] Improve field selection behaviors (#6317) @flaviendelangle
65
+ - [pickers] Replace the `renderDay` prop with a `Day` component slot (#6293) @flaviendelangle
66
+
67
+ ### Docs
68
+
69
+ - [docs] Apply style guide to Data Grid Aggregation page (#5781) @samuelsycamore
70
+ - [docs] Fix code examples of editing cells (#6004) @TiagoPortfolio
71
+ - [docs] Fix customized day rendering demo style (#6342) (#6399) @Ambrish-git
72
+ - [docs] Implement Style Guide on "Advanced" Data Grid doc pages (#6331) @samuelsycamore
73
+ - [docs] Use components instead of demos for `SelectorsDocs` (#6103) @flaviendelangle
74
+ - [license] Add new license status 'Out of scope' (#5260) @flaviendelangle
75
+
76
+ ### Core
77
+
78
+ - [core] Speedup of yarn install in the CI (#6395) @oliviertassinari
79
+ - [test] Remove redundant test clean-ups (#6377) @oliviertassinari
80
+ - [test] Replace `React.render` with `React.createRoot` in e2e tests (#6393) @m4theushw
81
+
82
+ ## 6.0.0-alpha.1
83
+
84
+ _Sep 29, 2022_
85
+
86
+ We'd like to offer a big thanks to the 8 contributors who made this release possible. Here are some highlights ✨:
87
+
88
+ - 🚀 Better support for custom overlays (#5808) @cherniavskii
89
+ - 🖨️ Improve print export (#6273) @oliviertassinari
90
+ - 🎁 Reduce confusion when initializing pickers with a date value (#6170) @flaviendelangle
91
+ - 📚 Documentation improvements
92
+ - 🐞 Bugfixes
93
+
94
+ ### `@mui/x-data-grid@v6.0.0-alpha.1` / `@mui/x-data-grid-pro@v6.0.0-alpha.1` / `@mui/x-data-grid-premium@v6.0.0-alpha.1`
95
+
96
+ #### Breaking changes
97
+
98
+ - New internal rows structure for v6 (#4927) @flaviendelangle
99
+
100
+ Some selectors related to the rows have been renamed to better describe the type of rows they are returning:
101
+
102
+ ```diff
103
+ -const result = gridRowsIdToIdLookupSelector(apiRef);
104
+ +const result = gridRowsDataRowIdToIdLookupSelector(apiRef);
105
+ ```
106
+
107
+ ```diff
108
+ -const result = gridRowTreeDepthSelector(apiRef);
109
+ +const result = gridRowMaximumTreeDepthSelector(apiRef);
110
+ ```
111
+
112
+ The format of the tree nodes (the element accessible in `params.node` or with the `apiRef.current.getRowNode` method) have changed.
113
+ You have a new `type` property, which can be useful, for example, to apply custom behavior on groups.
114
+ Here is an example of the old and new approach showing how to apply a custom value formatter in groups for the grouping column:
115
+
116
+ ```diff
117
+ <DataGridPremium
118
+ groupingColDef={() => ({
119
+ valueFormatter: (params) => {
120
+ if (params.id == null) {
121
+ return params.value;
122
+ }
123
+
124
+ const rowNode = apiRef.current.getRowNode(params.id!)!;
125
+ - if (rowNode.children?.length) {
126
+ + if (rowNode.type === 'group') {
127
+ return `by ${rowNode.groupingKey ?? ''}`;
128
+ }
129
+
130
+ return params.value;
131
+ }
132
+ })}
133
+ />
134
+ ```
135
+
136
+ - The `GridFeatureModeConstant` constant no longer exists (#6077) @DanailH
137
+
138
+ ```diff
139
+ -import { GridFeatureModeConstant } from '@mui/x-data-grid';
140
+ ```
141
+
142
+ #### Changes
143
+
144
+ - [DataGrid] Fix `GridPagination` props typing (#6238) @cherniavskii
145
+ - [DataGrid] Fix `GridRow` not forwarding `ref` to the root element (#6274) @cherniavskii
146
+ - [DataGrid] Fix `undefined` value being showed in filter button tooltip text (#6259) @cherniavskii
147
+ - [DataGrid] Fix blank space when changing page with dynamic row height (#6049) @m4theushw
148
+ - [DataGrid] New internal rows structure for v6 (#4927) @flaviendelangle
149
+ - [DataGrid] Revert cell/row mode if `processRowUpdate` fails (#6185) @m4theushw
150
+ - [DataGrid] Rework overlays layout (#5808) @cherniavskii
151
+ - [DataGrid] Improve print support (#6273) @oliviertassinari
152
+ - [DataGridPremium] Add missing `themeAugmentation` module (#6270) @cherniavskii
153
+
154
+ ### `@mui/x-date-pickers@v6.0.0-alpha.1` / `@mui/x-date-pickers-pro@v6.0.0-alpha.1`
155
+
156
+ #### Breaking changes
157
+
158
+ - [pickers] Do not support unparsed date formats anymore (#6170) @flaviendelangle
159
+
160
+ The `value` prop of the pickers now expects a parsed value.
161
+ Until now, it was possible to provide any format that your date management library was able to parse.
162
+ For instance, you could pass `value={new Date()}` when using `AdapterDayjs`.
163
+
164
+ This brought a lot of confusion so we decided to remove this behavior.
165
+ The format expected by the `value` prop is now the same as for any other prop holding a date.
166
+ Here is the syntax to initialize a date picker at the current date for each adapter:
167
+
168
+ ```tsx
169
+ // Date-fns
170
+ <DatePicker value={new Date()} />
171
+
172
+ // Dayjs
173
+ import dayjs from 'dayjs'
174
+ <DatePicker value={dayjs()} />
175
+
176
+ // Moment
177
+ import moment from 'moment'
178
+ <DatePicker value={moment()} />
179
+
180
+ // Luxon
181
+ import { DateTime } from 'luxon'
182
+ <DatePicker value={DateTime.now()} />
183
+ ```
184
+
185
+ #### Changes
186
+
187
+ - [DatePicker] Respect `minDate` and `maxDate` when opening a `DatePicker` or `DateTimePicker` (#6309) @alexfauquette
188
+ - [DateTimePicker] Fix validation with `shouldDisableMonth` and `shouldDisableYear` (#6266) @flaviendelangle
189
+ - [TimePicker] Add support for `disablePast` and `disableFuture` validation props (#6226) @LukasTy
190
+ - [CalendarPicker] Prevent getting focus when `autoFocus=false` (#6304) @alexfauquette
191
+ - [DateField] Extend moment adapter to support `expandFormat` and `formatTokenMap` (#6215) @alexfauquette
192
+ - [pickers] Allow to control the selected sections (#6209, #6307) @flaviendelangle
193
+ - [pickers] Do not loose the value of date sections not present in the format in the new field components (#6141) @flaviendelangle
194
+ - [pickers] Do not support unparsed date formats anymore (#6170) @flaviendelangle
195
+ - [pickers] Support slots on the `DateField` component (#6048) @flaviendelangle
196
+ - [pickers] Support Luxon v3 in `AdapterLuxon` (#6069) @alexfauquette
197
+ - [pickers] New components `TimeField` and `DateTimeField` (#6312) @flaviendelangle
198
+ - [pickers] Support basic mobile edition on new field components (#5958) @flaviendelangle
199
+
200
+ ### Docs
201
+
202
+ - [docs] Fix issue in DataGrid/DataGridPro row styling demo (#6264) @MBilalShafi
203
+ - [docs] Improve pickers Getting Started examples (#6292) @flaviendelangle
204
+ - [docs] Pass model change callbacks in controlled grid editing demos (#6296) @cherniavskii
205
+ - [docs] Update the CodeSandbox to use the `next` branch (#6275) @oliviertassinari
206
+
207
+ ### Core
208
+
209
+ - [core] Fix typing error (#6291) @flaviendelangle
210
+ - [core] Fix typo in the state updater of `useField` (#6311) @flaviendelangle
211
+ - [core] Remove `GridFeatureModeConstant` (#6077) @DanailH
212
+ - [core] Simplify testing architecture (#6043) @flaviendelangle
213
+ - [test] Skip test in Chrome non-headless and Edge (#6318) @m4theushw
214
+
6
215
  ## 6.0.0-alpha.0
7
216
 
8
217
  _Sep 22, 2022_
@@ -437,7 +437,7 @@ DataGridProRaw.propTypes = {
437
437
  /**
438
438
  * Determines if a group should be expanded after its creation.
439
439
  * This prop takes priority over the `defaultGroupingExpansionDepth` prop.
440
- * @param {GridRowTreeNodeConfig} node The node of the group to test.
440
+ * @param {GridGroupNode} node The node of the group to test.
441
441
  * @returns {boolean} A boolean indicating if the group is expanded.
442
442
  */
443
443
  isGroupExpandedByDefault: PropTypes.func,
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { useThemeProps } from '@mui/material/styles';
4
- import { DATA_GRID_DEFAULT_SLOTS_COMPONENTS, GRID_DEFAULT_LOCALE_TEXT, DATA_GRID_PROPS_DEFAULT_VALUES, GridFeatureModeConstant } from '@mui/x-data-grid';
4
+ import { DATA_GRID_DEFAULT_SLOTS_COMPONENTS, GRID_DEFAULT_LOCALE_TEXT, DATA_GRID_PROPS_DEFAULT_VALUES } from '@mui/x-data-grid';
5
5
 
6
6
  /**
7
7
  * The default values of `DataGridProPropsWithDefaultValue` to inject in the props of DataGridPro.
@@ -14,7 +14,7 @@ export const DATA_GRID_PRO_PROPS_DEFAULT_VALUES = _extends({}, DATA_GRID_PROPS_D
14
14
  disableChildrenFiltering: false,
15
15
  disableChildrenSorting: false,
16
16
  rowReordering: false,
17
- rowsLoadingMode: GridFeatureModeConstant.client,
17
+ rowsLoadingMode: 'client',
18
18
  getDetailPanelHeight: () => 500
19
19
  });
20
20
  export const useDataGridProProps = inProps => {
@@ -4,7 +4,7 @@ const _excluded = ["className", "disableVirtualization"];
4
4
  import * as React from 'react';
5
5
  import { styled, alpha } from '@mui/material/styles';
6
6
  import { unstable_composeClasses as composeClasses } from '@mui/material';
7
- import { useGridSelector, getDataGridUtilityClass, gridClasses, gridVisibleColumnFieldsSelector, gridRowsMetaSelector, useGridApiEventHandler } from '@mui/x-data-grid';
7
+ import { useGridSelector, getDataGridUtilityClass, gridClasses, gridVisibleColumnFieldsSelector, gridRowsMetaSelector, useGridApiEventHandler, GridOverlays } from '@mui/x-data-grid';
8
8
  import { GridVirtualScroller, GridVirtualScrollerContent, GridVirtualScrollerRenderZone, useGridVirtualScroller, calculatePinnedRowsHeight } from '@mui/x-data-grid/internals';
9
9
  import { useGridApiContext } from '../hooks/utils/useGridApiContext';
10
10
  import { useGridRootProps } from '../hooks/utils/useGridRootProps';
@@ -299,7 +299,7 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
299
299
  }
300
300
 
301
301
  return /*#__PURE__*/_jsxs(GridVirtualScroller, _extends({}, getRootProps(other), {
302
- children: [topPinnedRowsData.length > 0 ? /*#__PURE__*/_jsxs(VirtualScrollerPinnedRows, {
302
+ children: [/*#__PURE__*/_jsx(GridOverlays, {}), topPinnedRowsData.length > 0 ? /*#__PURE__*/_jsxs(VirtualScrollerPinnedRows, {
303
303
  className: classes.topPinnedRows,
304
304
  ownerState: {
305
305
  position: 'top'
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { unstable_composeClasses as composeClasses } from '@mui/material';
4
- import { gridRowTreeDepthSelector, gridSortModelSelector, useGridApiContext, useGridSelector, getDataGridUtilityClass, gridEditRowsStateSelector } from '@mui/x-data-grid';
4
+ import { gridRowMaximumTreeDepthSelector, gridSortModelSelector, useGridApiContext, useGridSelector, getDataGridUtilityClass, gridEditRowsStateSelector } from '@mui/x-data-grid';
5
5
  import { useGridRootProps } from '../hooks/utils/useGridRootProps';
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
7
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -19,12 +19,10 @@ const useUtilityClasses = ownerState => {
19
19
  };
20
20
 
21
21
  const GridRowReorderCell = params => {
22
- var _params$rowNode$posit;
23
-
24
22
  const apiRef = useGridApiContext();
25
23
  const rootProps = useGridRootProps();
26
24
  const sortModel = useGridSelector(apiRef, gridSortModelSelector);
27
- const treeDepth = useGridSelector(apiRef, gridRowTreeDepthSelector);
25
+ const treeDepth = useGridSelector(apiRef, gridRowMaximumTreeDepthSelector);
28
26
  const editRowsState = useGridSelector(apiRef, gridEditRowsStateSelector); // eslint-disable-next-line no-underscore-dangle
29
27
 
30
28
  const cellValue = params.row.__reorder__ || params.id; // TODO: remove sortModel and treeDepth checks once row reorder is compatible
@@ -60,7 +58,7 @@ const GridRowReorderCell = params => {
60
58
  onDragEnd: publish('rowDragEnd')
61
59
  } : null;
62
60
 
63
- if (((_params$rowNode$posit = params.rowNode.position) != null ? _params$rowNode$posit : 'body') !== 'body') {
61
+ if (params.rowNode.type === 'footer') {
64
62
  return null;
65
63
  }
66
64
 
@@ -77,7 +75,7 @@ const GridRowReorderCell = params => {
77
75
 
78
76
  export { GridRowReorderCell };
79
77
  export const renderRowReorderCell = params => {
80
- if (params.rowNode.isPinned) {
78
+ if (params.rowNode.type === 'footer' || params.rowNode.type === 'pinnedRow') {
81
79
  return null;
82
80
  }
83
81
 
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { GridRenderCellParams } from '@mui/x-data-grid';
3
- interface GridTreeDataGroupingCellProps extends GridRenderCellParams {
2
+ import { GridRenderCellParams, GridGroupNode } from '@mui/x-data-grid';
3
+ interface GridTreeDataGroupingCellProps extends GridRenderCellParams<any, any, any, GridGroupNode> {
4
4
  hideDescendantCount?: boolean;
5
5
  }
6
6
  declare const GridTreeDataGroupingCell: {
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
- import { useGridSelector, useGridApiEventHandler, useGridApiMethod, gridRowIdsSelector } from '@mui/x-data-grid';
3
+ import { useGridSelector, useGridApiEventHandler, useGridApiMethod, gridDataRowIdsSelector } from '@mui/x-data-grid';
4
4
  import { useGridRegisterPipeProcessor } from '@mui/x-data-grid/internals';
5
5
  import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from './gridDetailPanelToggleColDef';
6
6
  import { gridDetailPanelExpandedRowIdsSelector, gridDetailPanelExpandedRowsContentCacheSelector, gridDetailPanelExpandedRowsHeightCacheSelector, gridDetailPanelRawHeightCacheSelector } from './gridDetailPanelSelector';
@@ -22,7 +22,7 @@ function cacheContentAndHeight(apiRef, getDetailPanelContent, getDetailPanelHeig
22
22
  // only call getDetailPanelContent when asked for an id
23
23
 
24
24
 
25
- const rowIds = gridRowIdsSelector(apiRef);
25
+ const rowIds = gridDataRowIdsSelector(apiRef);
26
26
  const contentCache = rowIds.reduce((acc, id) => {
27
27
  const params = apiRef.current.getRowParams(id);
28
28
  acc[id] = getDetailPanelContent(params);
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
- import { useGridApiEventHandler, gridRowIdsSelector } from '@mui/x-data-grid';
3
+ import { useGridApiEventHandler, gridDataRowIdsSelector } from '@mui/x-data-grid';
4
4
 
5
5
  function cacheContentAndHeight(apiRef, getDetailPanelContent, getDetailPanelHeight, previousHeightCache) {
6
6
  if (typeof getDetailPanelContent !== 'function') {
@@ -9,7 +9,7 @@ function cacheContentAndHeight(apiRef, getDetailPanelContent, getDetailPanelHeig
9
9
  // only call getDetailPanelContent when asked for an id
10
10
 
11
11
 
12
- const rowIds = gridRowIdsSelector(apiRef);
12
+ const rowIds = gridDataRowIdsSelector(apiRef);
13
13
  const contentCache = rowIds.reduce((acc, id) => {
14
14
  const params = apiRef.current.getRowParams(id);
15
15
  acc[id] = getDetailPanelContent(params);
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { useGridSelector, useGridApiEventHandler, useGridApiOptionHandler, gridVisibleColumnDefinitionsSelector, gridRowsMetaSelector, GridFeatureModeConstant } from '@mui/x-data-grid';
2
+ import { useGridSelector, useGridApiEventHandler, useGridApiOptionHandler, gridVisibleColumnDefinitionsSelector, gridRowsMetaSelector } from '@mui/x-data-grid';
3
3
  import { useGridVisibleRows } from '@mui/x-data-grid/internals';
4
4
 
5
5
  /**
@@ -16,7 +16,7 @@ export const useGridInfiniteLoader = (apiRef, props) => {
16
16
  const handleRowsScrollEnd = React.useCallback(scrollPosition => {
17
17
  const dimensions = apiRef.current.getRootDimensions(); // Prevent the infite loading working in combination with lazy loading
18
18
 
19
- if (!dimensions || props.rowsLoadingMode !== GridFeatureModeConstant.client) {
19
+ if (!dimensions || props.rowsLoadingMode !== 'client') {
20
20
  return;
21
21
  }
22
22
 
@@ -1,8 +1,12 @@
1
1
  import * as React from 'react';
2
- import { useGridApiEventHandler, GridFeatureModeConstant, useGridSelector, gridSortModelSelector, gridFilterModelSelector, useGridApiOptionHandler } from '@mui/x-data-grid';
2
+ import { useGridApiEventHandler, useGridSelector, gridSortModelSelector, gridFilterModelSelector, useGridApiOptionHandler } from '@mui/x-data-grid';
3
3
  import { useGridVisibleRows, getRenderableIndexes } from '@mui/x-data-grid/internals';
4
4
 
5
- function findSkeletonRowsSection(visibleRows, range) {
5
+ function findSkeletonRowsSection({
6
+ apiRef,
7
+ visibleRows,
8
+ range
9
+ }) {
6
10
  let {
7
11
  firstRowIndex,
8
12
  lastRowIndex
@@ -13,16 +17,19 @@ function findSkeletonRowsSection(visibleRows, range) {
13
17
  let isSkeletonSectionFound = false;
14
18
 
15
19
  while (!isSkeletonSectionFound && firstRowIndex < lastRowIndex) {
16
- if (!visibleRowsSection[startIndex].model && !visibleRowsSection[endIndex].model) {
20
+ const isStartingWithASkeletonRow = apiRef.current.getRowNode(visibleRowsSection[startIndex].id).type === 'skeletonRow';
21
+ const isEndingWithASkeletonRow = apiRef.current.getRowNode(visibleRowsSection[endIndex].id).type === 'skeletonRow';
22
+
23
+ if (isStartingWithASkeletonRow && isEndingWithASkeletonRow) {
17
24
  isSkeletonSectionFound = true;
18
25
  }
19
26
 
20
- if (visibleRowsSection[startIndex].model) {
27
+ if (!isStartingWithASkeletonRow) {
21
28
  startIndex += 1;
22
29
  firstRowIndex += 1;
23
30
  }
24
31
 
25
- if (visibleRowsSection[endIndex].model) {
32
+ if (!isEndingWithASkeletonRow) {
26
33
  endIndex -= 1;
27
34
  lastRowIndex -= 1;
28
35
  }
@@ -43,7 +50,7 @@ function isLazyLoadingDisabled({
43
50
  return true;
44
51
  }
45
52
 
46
- if (rowsLoadingMode !== GridFeatureModeConstant.server) {
53
+ if (rowsLoadingMode !== 'server') {
47
54
  return true;
48
55
  }
49
56
 
@@ -107,9 +114,13 @@ export const useGridLazyLoader = (apiRef, props) => {
107
114
  }
108
115
 
109
116
  if (sortModel.length === 0 && filterModel.items.length === 0) {
110
- const skeletonRowsSection = findSkeletonRowsSection(visibleRows.rows, {
111
- firstRowIndex: params.firstRowToRender,
112
- lastRowIndex: params.lastRowToRender
117
+ const skeletonRowsSection = findSkeletonRowsSection({
118
+ apiRef,
119
+ visibleRows: visibleRows.rows,
120
+ range: {
121
+ firstRowIndex: params.firstRowToRender,
122
+ lastRowIndex: params.lastRowToRender
123
+ }
113
124
  });
114
125
 
115
126
  if (!skeletonRowsSection) {
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { DataGridProProcessedProps } from '../../../models/dataGridProProps';
3
2
  import { GridApiPro } from '../../../models/gridApiPro';
3
+ import { DataGridProProcessedProps } from '../../../models/dataGridProProps';
4
4
  export declare const GRID_SKELETON_ROW_ROOT_ID = "auto-generated-skeleton-row-root";
5
5
  export declare const useGridLazyLoaderPreProcessors: (apiRef: React.MutableRefObject<GridApiPro>, props: Pick<DataGridProProcessedProps, 'rowCount' | 'rowsLoadingMode' | 'experimentalFeatures'>) => void;
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { useGridRegisterPipeProcessor } from '@mui/x-data-grid/internals';
4
- import { GridFeatureModeConstant } from '@mui/x-data-grid';
4
+ import { GRID_ROOT_GROUP_ID } from '@mui/x-data-grid';
5
5
  export const GRID_SKELETON_ROW_ROOT_ID = 'auto-generated-skeleton-row-root';
6
6
 
7
7
  const getSkeletonRowId = index => `${GRID_SKELETON_ROW_ROOT_ID}-${index}`;
@@ -13,19 +13,33 @@ export const useGridLazyLoaderPreProcessors = (apiRef, props) => {
13
13
  lazyLoading
14
14
  } = (_props$experimentalFe = props.experimentalFeatures) != null ? _props$experimentalFe : {};
15
15
  const addSkeletonRows = React.useCallback(groupingParams => {
16
- if (!lazyLoading || props.rowsLoadingMode !== GridFeatureModeConstant.server || !props.rowCount || groupingParams.ids.length >= props.rowCount) {
16
+ const tree = _extends({}, groupingParams.tree);
17
+
18
+ const rootGroup = tree[GRID_ROOT_GROUP_ID];
19
+
20
+ if (!lazyLoading || props.rowsLoadingMode !== 'server' || !props.rowCount || rootGroup.children.length >= props.rowCount) {
17
21
  return groupingParams;
18
22
  }
19
23
 
20
- const newRowsIds = [...groupingParams.ids];
24
+ const rootGroupChildren = [...rootGroup.children];
21
25
 
22
- for (let i = 0; i < props.rowCount - groupingParams.ids.length; i += 1) {
26
+ for (let i = 0; i < props.rowCount - rootGroup.children.length; i += 1) {
23
27
  const skeletonId = getSkeletonRowId(i);
24
- newRowsIds.push(skeletonId);
28
+ rootGroupChildren.push(skeletonId);
29
+ const skeletonRowNode = {
30
+ type: 'skeletonRow',
31
+ id: skeletonId,
32
+ parent: GRID_ROOT_GROUP_ID,
33
+ depth: 0
34
+ };
35
+ tree[skeletonId] = skeletonRowNode;
25
36
  }
26
37
 
38
+ tree[GRID_ROOT_GROUP_ID] = _extends({}, rootGroup, {
39
+ children: rootGroupChildren
40
+ });
27
41
  return _extends({}, groupingParams, {
28
- ids: newRowsIds
42
+ tree
29
43
  });
30
44
  }, [props.rowCount, props.rowsLoadingMode, lazyLoading]);
31
45
  useGridRegisterPipeProcessor(apiRef, 'hydrateRows', addSkeletonRows);
@@ -1,4 +1,4 @@
1
- import { GridRowId, GridRowsLookup, GridRowsProp, GridValidRowModel } from '@mui/x-data-grid';
1
+ import { GridRowId, GridRowIdToModelLookup, GridRowsProp, GridValidRowModel } from '@mui/x-data-grid';
2
2
  export interface GridPinnedRowsProp<R extends GridValidRowModel = GridValidRowModel> {
3
3
  top?: GridRowsProp<R>;
4
4
  bottom?: GridRowsProp<R>;
@@ -13,5 +13,5 @@ export interface GridRowPinningApi {
13
13
  export interface GridRowPinningInternalCache {
14
14
  topIds: GridRowId[];
15
15
  bottomIds: GridRowId[];
16
- idLookup: GridRowsLookup;
16
+ idLookup: GridRowIdToModelLookup;
17
17
  }
@@ -1,34 +1,34 @@
1
1
  import * as React from 'react';
2
2
  import { GridHydrateRowsValue } from '@mui/x-data-grid/internals';
3
- import { GridRowEntry, GridRowId, GridRowModel } from '@mui/x-data-grid';
3
+ import { GridRowId, GridRowModel } from '@mui/x-data-grid';
4
4
  import { GridApiPro } from '../../../models/gridApiPro';
5
5
  import { GridPinnedRowsProp } from './gridRowPinningInterface';
6
6
  declare type GridPinnedRowPosition = keyof GridPinnedRowsProp;
7
- export declare function addPinnedRow({ groupingParams, rowModel, rowId, position, apiRef, }: {
7
+ export declare function addPinnedRow({ groupingParams, rowModel, rowId, position, apiRef, isAutoGenerated, }: {
8
8
  groupingParams: GridHydrateRowsValue;
9
- rowModel: GridRowModel;
9
+ rowModel: GridRowModel | undefined;
10
10
  rowId: GridRowId;
11
11
  position: GridPinnedRowPosition;
12
12
  apiRef: React.MutableRefObject<GridApiPro>;
13
+ isAutoGenerated: boolean;
13
14
  }): {
14
- idRowsLookup: {
15
+ dataRowIdToModelLookup: {
15
16
  [x: string]: import("@mui/x-data-grid").GridValidRowModel;
16
- [x: number]: import("@mui/x-data-grid").GridValidRowModel;
17
+ };
18
+ dataRowIdToIdLookup: {
19
+ [x: string]: GridRowId;
17
20
  };
18
21
  tree: {
19
- [x: string]: import("@mui/x-data-grid").GridRowTreeNodeConfig;
20
- [x: number]: import("@mui/x-data-grid").GridRowTreeNodeConfig;
22
+ [x: string]: import("@mui/x-data-grid").GridTreeNode;
23
+ [x: number]: import("@mui/x-data-grid").GridTreeNode;
21
24
  };
22
- additionalRowGroups: {
23
- pinnedRows: {
24
- top?: GridRowEntry<import("@mui/x-data-grid").GridValidRowModel>[] | undefined;
25
- bottom?: GridRowEntry<import("@mui/x-data-grid").GridValidRowModel>[] | undefined;
26
- };
25
+ treeDepths: {
26
+ [x: number]: number;
27
27
  };
28
- groupingName: string;
29
- treeDepth: number;
30
- ids: GridRowId[];
31
- idToIdLookup: Record<string, GridRowId>;
28
+ dataRowIds: GridRowId[];
29
+ additionalRowGroups?: {
30
+ pinnedRows?: import("@mui/x-data-grid/internals").GridPinnedRowsState | undefined;
31
+ } | undefined;
32
32
  };
33
33
  export declare const useGridRowPinningPreProcessors: (apiRef: React.MutableRefObject<GridApiPro>) => void;
34
34
  export {};