@mui/x-data-grid-pro 5.13.0 → 5.15.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 (94) hide show
  1. package/CHANGELOG.md +156 -6
  2. package/DataGridPro/DataGridPro.js +15 -0
  3. package/DataGridPro/useDataGridProComponent.js +6 -1
  4. package/components/DataGridProColumnHeaders.js +14 -7
  5. package/components/DataGridProVirtualScroller.js +198 -35
  6. package/components/GridRowReorderCell.d.ts +2 -2
  7. package/components/GridRowReorderCell.js +14 -1
  8. package/hooks/features/columnPinning/useGridColumnPinning.d.ts +1 -1
  9. package/hooks/features/columnPinning/useGridColumnPinning.js +12 -3
  10. package/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +2 -0
  11. package/hooks/features/index.d.ts +1 -0
  12. package/hooks/features/index.js +2 -1
  13. package/hooks/features/rowPinning/gridRowPinningInterface.d.ts +17 -0
  14. package/hooks/features/rowPinning/gridRowPinningInterface.js +1 -0
  15. package/hooks/features/rowPinning/gridRowPinningSelector.d.ts +1 -0
  16. package/hooks/features/rowPinning/gridRowPinningSelector.js +1 -0
  17. package/hooks/features/rowPinning/index.d.ts +1 -0
  18. package/hooks/features/rowPinning/index.js +1 -0
  19. package/hooks/features/rowPinning/useGridRowPinning.d.ts +6 -0
  20. package/hooks/features/rowPinning/useGridRowPinning.js +71 -0
  21. package/hooks/features/rowPinning/useGridRowPinningPreProcessors.d.ts +34 -0
  22. package/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +89 -0
  23. package/hooks/features/rowReorder/gridRowReorderColDef.js +2 -0
  24. package/hooks/features/rowReorder/useGridRowReorder.js +6 -0
  25. package/hooks/features/treeData/gridTreeDataUtils.js +9 -0
  26. package/index.js +1 -1
  27. package/internals/index.d.ts +3 -0
  28. package/internals/index.js +3 -0
  29. package/legacy/DataGridPro/DataGridPro.js +15 -0
  30. package/legacy/DataGridPro/useDataGridProComponent.js +6 -1
  31. package/legacy/components/DataGridProColumnHeaders.js +14 -7
  32. package/legacy/components/DataGridProVirtualScroller.js +187 -25
  33. package/legacy/components/GridRowReorderCell.js +11 -0
  34. package/legacy/hooks/features/columnPinning/useGridColumnPinning.js +12 -3
  35. package/legacy/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +2 -0
  36. package/legacy/hooks/features/index.js +2 -1
  37. package/legacy/hooks/features/rowPinning/gridRowPinningInterface.js +1 -0
  38. package/legacy/hooks/features/rowPinning/gridRowPinningSelector.js +1 -0
  39. package/legacy/hooks/features/rowPinning/index.js +1 -0
  40. package/legacy/hooks/features/rowPinning/useGridRowPinning.js +71 -0
  41. package/legacy/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +89 -0
  42. package/legacy/hooks/features/rowReorder/gridRowReorderColDef.js +2 -0
  43. package/legacy/hooks/features/rowReorder/useGridRowReorder.js +6 -0
  44. package/legacy/hooks/features/treeData/gridTreeDataUtils.js +9 -0
  45. package/legacy/index.js +1 -1
  46. package/legacy/internals/index.js +3 -0
  47. package/legacy/utils/releaseInfo.js +1 -1
  48. package/legacy/utils/tree/sortRowTree.js +27 -14
  49. package/models/dataGridProProps.d.ts +11 -5
  50. package/models/gridApiPro.d.ts +2 -2
  51. package/modern/DataGridPro/DataGridPro.js +15 -0
  52. package/modern/DataGridPro/useDataGridProComponent.js +6 -1
  53. package/modern/components/DataGridProColumnHeaders.js +14 -7
  54. package/modern/components/DataGridProVirtualScroller.js +198 -35
  55. package/modern/components/GridRowReorderCell.js +12 -1
  56. package/modern/hooks/features/columnPinning/useGridColumnPinning.js +8 -3
  57. package/modern/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +2 -0
  58. package/modern/hooks/features/index.js +2 -1
  59. package/modern/hooks/features/rowPinning/gridRowPinningInterface.js +1 -0
  60. package/modern/hooks/features/rowPinning/gridRowPinningSelector.js +1 -0
  61. package/modern/hooks/features/rowPinning/index.js +1 -0
  62. package/modern/hooks/features/rowPinning/useGridRowPinning.js +63 -0
  63. package/modern/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +85 -0
  64. package/modern/hooks/features/rowReorder/gridRowReorderColDef.js +2 -0
  65. package/modern/hooks/features/rowReorder/useGridRowReorder.js +4 -0
  66. package/modern/hooks/features/treeData/gridTreeDataUtils.js +9 -0
  67. package/modern/index.js +1 -1
  68. package/modern/internals/index.js +3 -0
  69. package/modern/utils/releaseInfo.js +1 -1
  70. package/modern/utils/tree/sortRowTree.js +26 -11
  71. package/node/DataGridPro/DataGridPro.js +15 -0
  72. package/node/DataGridPro/useDataGridProComponent.js +8 -1
  73. package/node/components/DataGridProColumnHeaders.js +14 -7
  74. package/node/components/DataGridProVirtualScroller.js +198 -34
  75. package/node/components/GridRowReorderCell.js +14 -1
  76. package/node/hooks/features/columnPinning/useGridColumnPinning.js +12 -3
  77. package/node/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +2 -0
  78. package/node/hooks/features/index.js +13 -0
  79. package/node/hooks/features/rowPinning/gridRowPinningInterface.js +5 -0
  80. package/node/hooks/features/rowPinning/gridRowPinningSelector.js +19 -0
  81. package/node/hooks/features/rowPinning/index.js +18 -0
  82. package/node/hooks/features/rowPinning/useGridRowPinning.js +92 -0
  83. package/node/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +105 -0
  84. package/node/hooks/features/rowReorder/gridRowReorderColDef.js +2 -0
  85. package/node/hooks/features/rowReorder/useGridRowReorder.js +6 -0
  86. package/node/hooks/features/treeData/gridTreeDataUtils.js +9 -0
  87. package/node/index.js +1 -1
  88. package/node/internals/index.js +41 -0
  89. package/node/utils/releaseInfo.js +1 -1
  90. package/node/utils/tree/sortRowTree.js +26 -11
  91. package/package.json +4 -4
  92. package/typeOverloads/modules.d.ts +2 -0
  93. package/utils/releaseInfo.js +1 -1
  94. package/utils/tree/sortRowTree.js +26 -11
package/CHANGELOG.md CHANGED
@@ -3,6 +3,156 @@
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
+ ## 5.15.0
7
+
8
+ _Jul 29, 2022_
9
+
10
+ We'd like to offer a big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🎁 Introduce aggregation (#5592) @flaviendelangle
13
+
14
+ Premium users can now aggregate data in the grid.
15
+ Extract information like sum, average, count, and others with a couple of clicks.
16
+
17
+ https://user-images.githubusercontent.com/45398769/181581503-77cc412e-9d9e-4de1-8bc3-c3bccc54cdaa.mp4
18
+
19
+ To enable this feature, add `experimentalFeatures={{ aggregation: true }}`.
20
+ Aggregation functions are customizable and they combine well with row grouping.
21
+ See the [documentation](https://mui.com/x/react-data-grid/aggregation/) to explore everything it has to offer.
22
+
23
+ - 🚀 Introduce row pinning (#4863) @cherniavskii
24
+
25
+ Pro users can now pin rows on top or bottom of the grid.
26
+
27
+ https://user-images.githubusercontent.com/45398769/181581493-56c733a3-6dd5-4546-bf8d-3f2dff72b14a.mp4
28
+
29
+ To do so, enable the feature with `experimentalFeatures={{ rowPinning: true }}` and provide the pinned rows data to the `pinnedRows` prop.
30
+ For more details, see the [documentation](https://mui.com/x/react-data-grid/row-pinning/).
31
+
32
+ - 🌍 Add simplified Chinese (zh-CN) locale to pickers (#5584) @gamecss
33
+ - 📚 Documentation improvements
34
+
35
+ ### `@mui/x-data-grid@v5.15.0` / `@mui/x-data-grid-pro@v5.15.0` / `@mui/x-data-grid-premium@v5.15.0`
36
+
37
+ #### Changes
38
+
39
+ - [DataGrid] Add prop to keep modifications while processing props (#5309) @m4theushw
40
+ - [DataGrid] Fix container width change on React 18 (#5566) @m4theushw
41
+ - [DataGrid] Fix ellipsis style convention (#5587) @oliviertassinari
42
+ - [DataGridPro] Implement row pinning (#4863) @cherniavskii
43
+ - [DataGridPremium] Make aggregation public (#5592) @cherniavskii
44
+ - [l10n] Improve simplified Chinese (zh-CN) locale (#5584) @gamecss
45
+
46
+ ### `@mui/x-date-pickers@v5.0.0-beta.3` / `@mui/x-date-picker-pro@5.0.0-beta.3`
47
+
48
+ #### Changes
49
+
50
+ - [l10n] Add simplified Chinese (zh-CN) locale (#5584) @gamecss
51
+
52
+ ### Docs
53
+
54
+ - [docs] Split docs page about rows (#5195) @flaviendelangle
55
+ - [docs] Add warning clarifications (#5399) @alexfauquette
56
+ - [docs] Correct slot CSS classes for Pro and Premium components (#5452) @alexfauquette
57
+ - [docs] Fix internal link to `valueParser` (#5450) @alexfauquette
58
+
59
+ ### Core
60
+
61
+ - [core] Upgrade monorepo (#5560) @m4theushw
62
+
63
+ ## 5.14.0
64
+
65
+ _Jul 21, 2022_
66
+
67
+ We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
68
+
69
+ - 🧪 Export `GridBooleanCell` component from data grid (#5537) @cliedeman
70
+ - ⚙️ Improve accessibility of the Export menu (#5486) @nogalpaulina
71
+ - 🌍 Improvements to different locales
72
+ - 📚 Documentation improvements
73
+ - 🐞 Bugfixes
74
+
75
+ ### `@mui/x-data-grid@5.14.0` / `@mui/x-data-grid-pro@5.14.0` / `@mui/x-data-grid-premium@5.14.0`
76
+
77
+ #### Changes
78
+
79
+ - [DataGrid] Add generics to `GridPreProcessEditCellProps` (#5510) @YunosukeY
80
+ - [DataGrid] Avoid inconsistent state export (#5390) @flaviendelangle
81
+ - [DataGrid] Export `GridBooleanCell` component (#5537) @cliedeman
82
+ - [DataGrid] Fix `date`/`dateTime` edit input font size to match view mode (#5304) @cherniavskii
83
+ - [DataGrid] Fix loading overlay position (#5558) @DanailH
84
+ - [DataGrid] Improve accessibility of the Export menu in the toolbar (#5486) @nogalpaulina
85
+ - [DataGridPremium] Implement Aggregation - not publicly released (#4208) @flaviendelangle
86
+ - [DataGridPremium] Fix crash when exporting all columns to Excel (#5425) @cherniavskii
87
+ - [l10n] Add Traditional Chinese (zh-TW) locale (#5498) @happyincent
88
+
89
+ ### `@mui/x-date-pickers@v5.0.0-beta.2` / `@mui/x-date-picker-pro@5.0.0-beta.2`
90
+
91
+ #### Changes
92
+
93
+ - [l10n] Add Norwegian (nb-NO) locale (#5475) @elkebab
94
+
95
+ ### Docs
96
+
97
+ - [docs] New page presenting the `apiRef` (#5273) @flaviendelangle
98
+ - [docs] Remove blank line @oliviertassinari
99
+
100
+ ### Core
101
+
102
+ - [core] Add missing comments on zh-TW translation (#5559) @flaviendelangle
103
+ - [core] Polish on the bug issue template (#5525) @oliviertassinari
104
+ - [test] Add more tests related to `isPrintableKey` (#5458) @mnajdova
105
+
106
+ ## 5.13.1
107
+
108
+ _Jul 15, 2022_
109
+
110
+ We'd like to offer a big thanks to the 13 contributors who made this release possible. Here are some highlights ✨:
111
+
112
+ - ✏️ Enter edit mode when pasting in a cell with Ctrl+V (Cmd+V on macOS) (#5405) @alexfauquette
113
+ - 🌍 Many improvements to the locales
114
+ - 📚 Documentation improvements
115
+ - 🐞 Bugfixes
116
+
117
+ ### `@mui/x-data-grid@v5.13.1` / `@mui/x-data-grid-pro@v5.13.1` / `@mui/x-data-grid-premium@v5.13.1`
118
+
119
+ #### Changes
120
+
121
+ - [DataGrid] Fix blank space when using dynamic row height with pagination (#5315) @m4theushw
122
+ - [DataGrid] Start editing with uppercase letter and Ctrl+V (#5405) @alexfauquette
123
+ - [DataGrid] Fix some filters being removed from filter model on filter panel open (#5403) @cherniavskii
124
+ - [DataGridPro] Improve pinned column headers accessibility (#5370) @cherniavskii
125
+ - [l10n] Improve Dutch (nl-NL) locale (#5464) @developenguin
126
+ - [l10n] Improve French (fr-FR) locale (#3211) (#5420) @Zenoo
127
+ - [l10n] Improve German (de-DE) locale (#5448) @sebastianfrey
128
+ - [l10n] Improve Brazilian Portuguese (pt-BR) locale (#5394) @andrepxa
129
+ - [l10n] Improve Romanian (ro-RO) locale (#5449) @rolule
130
+
131
+ ### `@mui/x-date-pickers@v5.0.0-beta.1` / `@mui/x-date-picker-pro@5.0.0-beta.1`
132
+
133
+ #### Changes
134
+
135
+ - [pickers] Add Italian (it-IT) locale (#5467) @felixh10r
136
+ - [pickers] Add Spanish (es-ES) locale (#5468) @felixh10r
137
+ - [pickers] Improve French (fr-FR) locale (#5446) @Zenoo
138
+ - [pickers] Improve German (de-DE) locale (#5447) @sebastianfrey
139
+
140
+ ### Docs
141
+
142
+ - [docs] Fix typo in the sorting page (#5431) @JosephMarinier
143
+ - [docs] Fix description for "Striped rows" example (#5432) @lindapaiste
144
+ - [docs] Make a clear difference between the license and license key (#5316) @oliviertassinari
145
+ - [docs] Update pickers README files (#5456) @cherniavskii
146
+ - [docs] Clarify the scope of support for MUI X (#5423) @joserodolfofreitas
147
+
148
+ ### Core
149
+
150
+ - [core] Add technical support link to \_redirects (#5428) @joserodolfofreitas
151
+ - [core] Improve GitHub bug reproduction template (#5067) @joserodolfofreitas
152
+ - [core] Include playground pages in tsconfig (#5367) @cherniavskii
153
+ - [core] Sort keys like in material-ui @oliviertassinari
154
+ - [test] Wait for flags to load on regression tests (#5473) @m4theushw
155
+
6
156
  ## 5.13.0
7
157
 
8
158
  _Jul 7, 2022_
@@ -213,7 +363,7 @@ _May 31, 2022_
213
363
 
214
364
  We'd like to offer a big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
215
365
 
216
- - 🎁 Introduce support for [dynamic row height](https://mui.com/x/react-data-grid/rows/#dynamic-row-height) (#4859) @m4theushw
366
+ - 🎁 Introduce support for [dynamic row height](https://mui.com/x/react-data-grid/row-height/#dynamic-row-height) (#4859) @m4theushw
217
367
 
218
368
  <img src="https://user-images.githubusercontent.com/42154031/171183167-718d7bcd-ec0f-459e-97fe-0f650abb4a99.gif" width="800">
219
369
 
@@ -530,7 +680,7 @@ _Apr 25, 2022_
530
680
 
531
681
  We'd like to offer a big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
532
682
 
533
- - 🎁 Introduce [Row reorder](https://mui.com/x/react-data-grid/rows/#row-reorder) (#4034) @DanailH
683
+ - 🎁 Introduce [Row reorder](https://mui.com/x/react-data-grid/row-ordering/) (#4034) @DanailH
534
684
 
535
685
  <img src="https://user-images.githubusercontent.com/5858539/165091263-23472fbb-a989-44b8-849a-d2185adfe13b.gif" width="800">
536
686
 
@@ -794,7 +944,7 @@ We'd like to offer a big thanks to the 8 contributors who made this release poss
794
944
  <DataGrid getRowSpacing={() => ({ top: 10, bottom: 10 })} />
795
945
  ```
796
946
 
797
- Check the [documentation](https://mui.com/x/react-data-grid/rows/#row-spacing) for more information.
947
+ Check the [documentation](https://mui.com/x/react-data-grid/row-height/#row-spacing) for more information.
798
948
 
799
949
  ### `@mui/x-data-grid@v5.6.1` / `@mui/x-data-grid-pro@v5.6.1`
800
950
 
@@ -1048,7 +1198,7 @@ _Jan 28, 2022_
1048
1198
 
1049
1199
  A big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
1050
1200
 
1051
- - 🚣 Introduce [variable row height](https://mui.com/x/react-data-grid/rows/#variable-row-height) (#438) @DanailH
1201
+ - 🚣 Introduce [variable row height](https://mui.com/x/react-data-grid/row-height/#variable-row-height) (#438) @DanailH
1052
1202
 
1053
1203
  Allows for setting a row-specific height.
1054
1204
  By default, all rows have the same height, but now you can set the height on a per-row basis.
@@ -1416,7 +1566,7 @@ A big thanks to the 5 contributors who made this release possible. Here are some
1416
1566
  - [core] Fix `yarn prettier` script (#3292) @oliviertassinari
1417
1567
  - [core] Improve tests for Tree Data (#3366) @flaviendelangle
1418
1568
  - [core] Never import directly from the `__modules__` folder in the `x-data-grid-generator` package (#3379) @flaviendelangle
1419
- - [core] Transition to a new StackOverflow tag (#3308) @oliviertassinari
1569
+ - [core] Transition to a new Stack Overflow tag (#3308) @oliviertassinari
1420
1570
  - [core] Update monorepo (#3370) @flaviendelangle
1421
1571
  - [core] Use pre-processors for sorting and filtering (#3318) @flaviendelangle
1422
1572
  - [test] Replace `useFakeTimers` (#3323) @m4theushw
@@ -3700,7 +3850,7 @@ Big thanks to the 7 contributors who made this release possible. Here are some h
3700
3850
  - 🎁 Add `onRowsScrollEnd` to support infinite loading (#1199) @DanailH
3701
3851
  This is an XGrid feature. Provides the ability to tap into the `onRowsScrollEnd` which is called when the scroll reaches the bottom of the grid viewport allowing developers to load additional data. It can be used with a combination of `scrollBottomThreshold` to control the area in which the `onRowsScrollEnd` is called.
3702
3852
 
3703
- See the documentation for [more details](https://mui.com/x/react-data-grid/rows/#infinite-loading).
3853
+ See the documentation for [more details](https://mui.com/x/react-data-grid/row-updates/#infinite-loading).
3704
3854
 
3705
3855
  - 🕹 Provide the ability to sort by multiple columns using Shift+click (#1203) @dtassone
3706
3856
  - 🇵🇱 Added pl-PL locale (#1117) @LarsKumbier
@@ -217,6 +217,12 @@ DataGridProRaw.propTypes = {
217
217
  */
218
218
  disableExtendRowFullWidth: PropTypes.bool,
219
219
 
220
+ /**
221
+ * If `true`, modification to a cell will not be discarded if the mode is changed from "edit" to "view" while processing props.
222
+ * @default false
223
+ */
224
+ disableIgnoreModificationsIfProcessingProps: PropTypes.bool,
225
+
220
226
  /**
221
227
  * If `true`, filtering with multiple columns is disabled.
222
228
  * @default false
@@ -270,6 +276,7 @@ DataGridProRaw.propTypes = {
270
276
  experimentalFeatures: PropTypes.shape({
271
277
  newEditingApi: PropTypes.bool,
272
278
  preventCommitWhileValidating: PropTypes.bool,
279
+ rowPinning: PropTypes.bool,
273
280
  warnIfFocusStateIsNotSynced: PropTypes.bool
274
281
  }),
275
282
 
@@ -854,6 +861,14 @@ DataGridProRaw.propTypes = {
854
861
  right: PropTypes.arrayOf(PropTypes.string)
855
862
  }),
856
863
 
864
+ /**
865
+ * Rows data to pin on top or bottom.
866
+ */
867
+ pinnedRows: PropTypes.shape({
868
+ bottom: PropTypes.array,
869
+ top: PropTypes.array
870
+ }),
871
+
857
872
  /**
858
873
  * Callback called before updating a row with new values in the row and cell editing.
859
874
  * Only applied if `props.experimentalFeatures.newEditingApi: true`.
@@ -11,6 +11,8 @@ import { useGridDetailPanel, detailPanelStateInitializer } from '../hooks/featur
11
11
  import { useGridDetailPanelPreProcessors } from '../hooks/features/detailPanel/useGridDetailPanelPreProcessors';
12
12
  import { useGridRowReorder } from '../hooks/features/rowReorder/useGridRowReorder';
13
13
  import { useGridRowReorderPreProcessors } from '../hooks/features/rowReorder/useGridRowReorderPreProcessors';
14
+ import { useGridRowPinning, rowPinningStateInitializer } from '../hooks/features/rowPinning/useGridRowPinning';
15
+ import { useGridRowPinningPreProcessors } from '../hooks/features/rowPinning/useGridRowPinningPreProcessors';
14
16
  export const useDataGridProComponent = (inputApiRef, props) => {
15
17
  var _props$experimentalFe, _props$experimentalFe2;
16
18
 
@@ -22,6 +24,7 @@ export const useDataGridProComponent = (inputApiRef, props) => {
22
24
  useGridSelectionPreProcessors(apiRef, props);
23
25
  useGridRowReorderPreProcessors(apiRef, props);
24
26
  useGridTreeDataPreProcessors(apiRef, props);
27
+ useGridRowPinningPreProcessors(apiRef);
25
28
  useGridDetailPanelPreProcessors(apiRef, props); // The column pinning `hydrateColumns` pre-processor must be after every other `hydrateColumns` pre-processors
26
29
  // Because it changes the order of the columns.
27
30
 
@@ -35,6 +38,7 @@ export const useDataGridProComponent = (inputApiRef, props) => {
35
38
  useGridInitializeState(detailPanelStateInitializer, apiRef, props);
36
39
  useGridInitializeState(columnPinningStateInitializer, apiRef, props);
37
40
  useGridInitializeState(columnsStateInitializer, apiRef, props);
41
+ useGridInitializeState(rowPinningStateInitializer, apiRef, props);
38
42
  useGridInitializeState(rowsStateInitializer, apiRef, props);
39
43
  useGridInitializeState((_props$experimentalFe = props.experimentalFeatures) != null && _props$experimentalFe.newEditingApi ? editingStateInitializer_new : editingStateInitializer_old, apiRef, props);
40
44
  useGridInitializeState(focusStateInitializer, apiRef, props);
@@ -51,6 +55,7 @@ export const useDataGridProComponent = (inputApiRef, props) => {
51
55
  useGridKeyboardNavigation(apiRef, props);
52
56
  useGridSelection(apiRef, props);
53
57
  useGridColumnPinning(apiRef, props);
58
+ useGridRowPinning(apiRef, props);
54
59
  useGridColumns(apiRef, props);
55
60
  useGridRows(apiRef, props);
56
61
  useGridParamsApi(apiRef);
@@ -59,7 +64,7 @@ export const useDataGridProComponent = (inputApiRef, props) => {
59
64
  const useGridEditing = (_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.newEditingApi ? useGridEditing_new : useGridEditing_old;
60
65
  useGridEditing(apiRef, props);
61
66
  useGridFocus(apiRef, props);
62
- useGridPreferencesPanel(apiRef);
67
+ useGridPreferencesPanel(apiRef, props);
63
68
  useGridFilter(apiRef, props);
64
69
  useGridSorting(apiRef, props);
65
70
  useGridDensity(apiRef, props);
@@ -117,15 +117,21 @@ export const DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function D
117
117
  firstColumnIndex: visibleColumnFields.length - rightPinnedColumns.length,
118
118
  lastColumnIndex: visibleColumnFields.length
119
119
  }) : null;
120
+ const innerProps = getInnerProps();
121
+ const pinnedColumnHeadersProps = {
122
+ role: innerProps.role,
123
+ 'aria-rowindex': innerProps['aria-rowindex']
124
+ };
120
125
  return /*#__PURE__*/_jsxs(GridColumnHeaders, _extends({
121
126
  ref: ref,
122
127
  className: className
123
128
  }, getRootProps(other), {
124
- children: [leftRenderContext && /*#__PURE__*/_jsx(GridColumnHeadersPinnedColumnHeaders, {
129
+ children: [leftRenderContext && /*#__PURE__*/_jsx(GridColumnHeadersPinnedColumnHeaders, _extends({
125
130
  className: classes.leftPinnedColumns,
126
131
  ownerState: {
127
132
  side: GridPinnedPosition.left
128
- },
133
+ }
134
+ }, pinnedColumnHeadersProps, {
129
135
  children: getColumns({
130
136
  renderContext: leftRenderContext,
131
137
  minFirstColumn: leftRenderContext.firstColumnIndex,
@@ -133,22 +139,23 @@ export const DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function D
133
139
  }, {
134
140
  disableReorder: true
135
141
  })
136
- }), /*#__PURE__*/_jsx(GridColumnHeadersInner, _extends({
142
+ })), /*#__PURE__*/_jsx(GridColumnHeadersInner, _extends({
137
143
  isDragging: isDragging
138
- }, getInnerProps(), {
144
+ }, innerProps, {
139
145
  children: getColumns({
140
146
  renderContext,
141
147
  minFirstColumn: leftPinnedColumns.length,
142
148
  maxLastColumn: visibleColumnFields.length - rightPinnedColumns.length
143
149
  })
144
- })), rightRenderContext && /*#__PURE__*/_jsx(GridColumnHeadersPinnedColumnHeaders, {
150
+ })), rightRenderContext && /*#__PURE__*/_jsx(GridColumnHeadersPinnedColumnHeaders, _extends({
145
151
  ownerState: {
146
152
  side: GridPinnedPosition.right
147
153
  },
148
154
  className: classes.rightPinnedColumns,
149
155
  style: {
150
156
  paddingRight: scrollbarSize
151
- },
157
+ }
158
+ }, pinnedColumnHeadersProps, {
152
159
  children: getColumns({
153
160
  renderContext: rightRenderContext,
154
161
  minFirstColumn: rightRenderContext.firstColumnIndex,
@@ -157,6 +164,6 @@ export const DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function D
157
164
  disableReorder: true,
158
165
  separatorSide: GridColumnHeaderSeparatorSides.Left
159
166
  })
160
- })]
167
+ }))]
161
168
  }));
162
169
  });
@@ -5,12 +5,13 @@ 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
7
  import { useGridSelector, getDataGridUtilityClass, gridClasses, gridVisibleColumnFieldsSelector, gridRowsMetaSelector, useGridApiEventHandler } from '@mui/x-data-grid';
8
- import { GridVirtualScroller, GridVirtualScrollerContent, GridVirtualScrollerRenderZone, useGridVirtualScroller } from '@mui/x-data-grid/internals';
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';
11
11
  import { gridPinnedColumnsSelector, GridPinnedPosition } from '../hooks/features/columnPinning';
12
12
  import { gridDetailPanelExpandedRowsContentCacheSelector, gridDetailPanelExpandedRowsHeightCacheSelector, gridDetailPanelExpandedRowIdsSelector } from '../hooks/features/detailPanel';
13
13
  import { GridDetailPanel } from './GridDetailPanel';
14
+ import { gridPinnedRowsSelector } from '../hooks/features/rowPinning/gridRowPinningSelector';
14
15
  import { jsx as _jsx } from "react/jsx-runtime";
15
16
  import { jsxs as _jsxs } from "react/jsx-runtime";
16
17
  export const filterColumns = (pinnedColumns, columns) => {
@@ -41,13 +42,14 @@ export const filterColumns = (pinnedColumns, columns) => {
41
42
 
42
43
  const useUtilityClasses = ownerState => {
43
44
  const {
44
- classes,
45
- leftPinnedColumns,
46
- rightPinnedColumns
45
+ classes
47
46
  } = ownerState;
48
47
  const slots = {
49
- leftPinnedColumns: ['pinnedColumns', leftPinnedColumns && leftPinnedColumns.length > 0 && 'pinnedColumns--left'],
50
- rightPinnedColumns: ['pinnedColumns', rightPinnedColumns && rightPinnedColumns.length > 0 && 'pinnedColumns--right'],
48
+ leftPinnedColumns: ['pinnedColumns', 'pinnedColumns--left'],
49
+ rightPinnedColumns: ['pinnedColumns', 'pinnedColumns--right'],
50
+ topPinnedRows: ['pinnedRows', 'pinnedRows--top'],
51
+ bottomPinnedRows: ['pinnedRows', 'pinnedRows--bottom'],
52
+ pinnedRowsRenderZone: ['pinnedRowsRenderZone'],
51
53
  detailPanels: ['detailPanels'],
52
54
  detailPanel: ['detailPanel']
53
55
  };
@@ -67,6 +69,10 @@ const getOverlayAlpha = elevation => {
67
69
  return alphaValue / 100;
68
70
  };
69
71
 
72
+ const getBoxShadowColor = theme => {
73
+ return alpha(theme.palette.common.black, 0.21);
74
+ };
75
+
70
76
  const VirtualScrollerDetailPanels = styled('div', {
71
77
  name: 'MuiDataGrid',
72
78
  slot: 'DetailPanels',
@@ -74,6 +80,7 @@ const VirtualScrollerDetailPanels = styled('div', {
74
80
  })({
75
81
  position: 'relative'
76
82
  });
83
+ const darkModeBackgroundImage = `linear-gradient(${alpha('#fff', getOverlayAlpha(2))}, ${alpha('#fff', getOverlayAlpha(2))})`;
77
84
  const VirtualScrollerPinnedColumns = styled('div', {
78
85
  name: 'MuiDataGrid',
79
86
  slot: 'PinnedColumns',
@@ -85,21 +92,56 @@ const VirtualScrollerPinnedColumns = styled('div', {
85
92
  })(({
86
93
  theme,
87
94
  ownerState
88
- }) => _extends({
89
- position: 'sticky',
90
- overflow: 'hidden',
91
- zIndex: 1,
92
- boxShadow: theme.shadows[2],
93
- backgroundColor: theme.palette.background.default
94
- }, theme.palette.mode === 'dark' && {
95
- backgroundImage: `linear-gradient(${alpha('#fff', getOverlayAlpha(2))}, ${alpha('#fff', getOverlayAlpha(2))})`
96
- }, ownerState.side === GridPinnedPosition.left && {
97
- left: 0,
98
- float: 'left'
99
- }, ownerState.side === GridPinnedPosition.right && {
100
- right: 0,
101
- float: 'right'
102
- }));
95
+ }) => {
96
+ const boxShadowColor = getBoxShadowColor(theme);
97
+ return _extends({
98
+ position: 'sticky',
99
+ overflow: 'hidden',
100
+ zIndex: 1,
101
+ backgroundColor: theme.palette.background.default
102
+ }, theme.palette.mode === 'dark' && {
103
+ backgroundImage: darkModeBackgroundImage
104
+ }, ownerState.side === GridPinnedPosition.left && {
105
+ left: 0,
106
+ float: 'left',
107
+ boxShadow: `2px 0px 4px -2px ${boxShadowColor}`
108
+ }, ownerState.side === GridPinnedPosition.right && {
109
+ right: 0,
110
+ float: 'right',
111
+ boxShadow: `-2px 0px 4px -2px ${boxShadowColor}`
112
+ });
113
+ });
114
+ const VirtualScrollerPinnedRows = styled('div', {
115
+ name: 'MuiDataGrid',
116
+ slot: 'PinnedRows',
117
+ overridesResolver: (props, styles) => [{
118
+ [`&.${gridClasses['pinnedRows--top']}`]: styles['pinnedRows--top']
119
+ }, {
120
+ [`&.${gridClasses['pinnedRows--bottom']}`]: styles['pinnedRows--bottom']
121
+ }, styles.pinnedRows]
122
+ })(({
123
+ theme,
124
+ ownerState
125
+ }) => {
126
+ const boxShadowColor = getBoxShadowColor(theme);
127
+ return _extends({
128
+ position: 'sticky',
129
+ // should be above the detail panel
130
+ zIndex: 3,
131
+ backgroundColor: theme.palette.background.default
132
+ }, theme.palette.mode === 'dark' && {
133
+ backgroundImage: darkModeBackgroundImage
134
+ }, ownerState.position === 'top' && {
135
+ top: 0,
136
+ boxShadow: `0px 3px 4px -2px ${boxShadowColor}`
137
+ }, ownerState.position === 'bottom' && {
138
+ boxShadow: `0px -3px 4px -2px ${boxShadowColor}`,
139
+ bottom: 0
140
+ });
141
+ });
142
+ const VirtualScrollerPinnedRowsRenderZone = styled('div')({
143
+ position: 'absolute'
144
+ });
103
145
  const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGridProVirtualScroller(props, ref) {
104
146
  const other = _objectWithoutPropertiesLoose(props, _excluded);
105
147
 
@@ -111,8 +153,11 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
111
153
  const detailPanelsHeights = useGridSelector(apiRef, gridDetailPanelExpandedRowsHeightCacheSelector);
112
154
  const leftColumns = React.useRef(null);
113
155
  const rightColumns = React.useRef(null);
156
+ const topPinnedRowsRenderZoneRef = React.useRef(null);
157
+ const bottomPinnedRowsRenderZoneRef = React.useRef(null);
114
158
  const handleRenderZonePositioning = React.useCallback(({
115
- top
159
+ top,
160
+ left
116
161
  }) => {
117
162
  if (leftColumns.current) {
118
163
  leftColumns.current.style.transform = `translate3d(0px, ${top}px, 0px)`;
@@ -121,6 +166,14 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
121
166
  if (rightColumns.current) {
122
167
  rightColumns.current.style.transform = `translate3d(0px, ${top}px, 0px)`;
123
168
  }
169
+
170
+ if (topPinnedRowsRenderZoneRef.current) {
171
+ topPinnedRowsRenderZoneRef.current.style.transform = `translate3d(${left}px, 0px, 0px)`;
172
+ }
173
+
174
+ if (bottomPinnedRowsRenderZoneRef.current) {
175
+ bottomPinnedRowsRenderZoneRef.current.style.transform = `translate3d(${left}px, 0px, 0px)`;
176
+ }
124
177
  }, []);
125
178
 
126
179
  const getRowProps = id => {
@@ -138,10 +191,15 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
138
191
 
139
192
  const pinnedColumns = useGridSelector(apiRef, gridPinnedColumnsSelector);
140
193
  const [leftPinnedColumns, rightPinnedColumns] = filterColumns(pinnedColumns, visibleColumnFields);
194
+ const pinnedRows = useGridSelector(apiRef, gridPinnedRowsSelector);
195
+ const topPinnedRowsData = React.useMemo(() => (pinnedRows == null ? void 0 : pinnedRows.top) || [], [pinnedRows == null ? void 0 : pinnedRows.top]);
196
+ const bottomPinnedRowsData = React.useMemo(() => (pinnedRows == null ? void 0 : pinnedRows.bottom) || [], [pinnedRows == null ? void 0 : pinnedRows.bottom]);
141
197
  const ownerState = {
142
198
  classes: rootProps.classes,
143
199
  leftPinnedColumns,
144
- rightPinnedColumns
200
+ rightPinnedColumns,
201
+ topPinnedRowsCount: topPinnedRowsData.length,
202
+ bottomPinnedRowsCount: bottomPinnedRowsData.length
145
203
  };
146
204
  const classes = useUtilityClasses(ownerState);
147
205
  const {
@@ -174,10 +232,6 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
174
232
  firstColumnIndex: visibleColumnFields.length - rightPinnedColumns.length,
175
233
  lastColumnIndex: visibleColumnFields.length
176
234
  }) : null;
177
- const contentProps = getContentProps();
178
- const pinnedColumnsStyle = {
179
- minHeight: contentProps.style.minHeight
180
- };
181
235
 
182
236
  const getDetailPanels = () => {
183
237
  const panels = [];
@@ -218,8 +272,73 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
218
272
  };
219
273
 
220
274
  const detailPanels = getDetailPanels();
221
- return /*#__PURE__*/_jsx(GridVirtualScroller, _extends({}, getRootProps(other), {
222
- children: /*#__PURE__*/_jsxs(GridVirtualScrollerContent, _extends({}, contentProps, {
275
+ const topPinnedRows = getRows({
276
+ renderContext,
277
+ rows: topPinnedRowsData
278
+ });
279
+ const pinnedRowsHeight = calculatePinnedRowsHeight(apiRef);
280
+ const mainRows = getRows({
281
+ renderContext,
282
+ rowIndexOffset: topPinnedRowsData.length
283
+ });
284
+ const bottomPinnedRows = getRows({
285
+ renderContext,
286
+ rows: bottomPinnedRowsData,
287
+ rowIndexOffset: topPinnedRowsData.length + (mainRows ? mainRows.length : 0)
288
+ });
289
+ const contentProps = getContentProps();
290
+ const pinnedColumnsStyle = {
291
+ minHeight: contentProps.style.minHeight
292
+ };
293
+
294
+ if (contentProps.style.minHeight && contentProps.style.minHeight === '100%') {
295
+ contentProps.style.minHeight = `calc(100% - ${pinnedRowsHeight.top}px - ${pinnedRowsHeight.bottom}px)`;
296
+ }
297
+
298
+ return /*#__PURE__*/_jsxs(GridVirtualScroller, _extends({}, getRootProps(other), {
299
+ children: [topPinnedRowsData.length > 0 ? /*#__PURE__*/_jsxs(VirtualScrollerPinnedRows, {
300
+ className: classes.topPinnedRows,
301
+ ownerState: {
302
+ position: 'top'
303
+ },
304
+ style: {
305
+ width: contentProps.style.width,
306
+ height: pinnedRowsHeight.top
307
+ },
308
+ role: "rowgroup",
309
+ children: [leftRenderContext && /*#__PURE__*/_jsx(VirtualScrollerPinnedColumns, {
310
+ className: classes.leftPinnedColumns,
311
+ ownerState: {
312
+ side: GridPinnedPosition.left
313
+ },
314
+ children: getRows({
315
+ renderContext: leftRenderContext,
316
+ minFirstColumn: leftRenderContext.firstColumnIndex,
317
+ maxLastColumn: leftRenderContext.lastColumnIndex,
318
+ availableSpace: 0,
319
+ ignoreAutoHeight: true,
320
+ rows: topPinnedRowsData
321
+ })
322
+ }), /*#__PURE__*/_jsx(VirtualScrollerPinnedRowsRenderZone, {
323
+ className: classes.pinnedRowsRenderZone,
324
+ ref: topPinnedRowsRenderZoneRef,
325
+ role: "presentation",
326
+ children: topPinnedRows
327
+ }), rightRenderContext && /*#__PURE__*/_jsx(VirtualScrollerPinnedColumns, {
328
+ className: classes.rightPinnedColumns,
329
+ ownerState: {
330
+ side: GridPinnedPosition.right
331
+ },
332
+ children: getRows({
333
+ renderContext: rightRenderContext,
334
+ minFirstColumn: rightRenderContext.firstColumnIndex,
335
+ maxLastColumn: rightRenderContext.lastColumnIndex,
336
+ ignoreAutoHeight: true,
337
+ availableSpace: 0,
338
+ rows: topPinnedRowsData
339
+ })
340
+ })]
341
+ }) : null, /*#__PURE__*/_jsxs(GridVirtualScrollerContent, _extends({}, contentProps, {
223
342
  children: [leftRenderContext && /*#__PURE__*/_jsx(VirtualScrollerPinnedColumns, {
224
343
  ref: leftColumns,
225
344
  className: classes.leftPinnedColumns,
@@ -232,12 +351,11 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
232
351
  minFirstColumn: leftRenderContext.firstColumnIndex,
233
352
  maxLastColumn: leftRenderContext.lastColumnIndex,
234
353
  availableSpace: 0,
235
- ignoreAutoHeight: true
354
+ ignoreAutoHeight: true,
355
+ rowIndexOffset: topPinnedRowsData.length
236
356
  })
237
357
  }), /*#__PURE__*/_jsx(GridVirtualScrollerRenderZone, _extends({}, getRenderZoneProps(), {
238
- children: getRows({
239
- renderContext
240
- })
358
+ children: mainRows
241
359
  })), rightRenderContext && /*#__PURE__*/_jsx(VirtualScrollerPinnedColumns, {
242
360
  ref: rightColumns,
243
361
  ownerState: {
@@ -250,13 +368,58 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
250
368
  minFirstColumn: rightRenderContext.firstColumnIndex,
251
369
  maxLastColumn: rightRenderContext.lastColumnIndex,
252
370
  availableSpace: 0,
253
- ignoreAutoHeight: true
371
+ ignoreAutoHeight: true,
372
+ rowIndexOffset: topPinnedRowsData.length
254
373
  })
255
374
  }), detailPanels.length > 0 && /*#__PURE__*/_jsx(VirtualScrollerDetailPanels, {
256
375
  className: classes.detailPanels,
257
376
  children: detailPanels
258
377
  })]
259
- }))
378
+ })), bottomPinnedRowsData.length > 0 ? /*#__PURE__*/_jsxs(VirtualScrollerPinnedRows, {
379
+ className: classes.bottomPinnedRows,
380
+ ownerState: {
381
+ position: 'bottom'
382
+ },
383
+ style: {
384
+ width: contentProps.style.width,
385
+ height: pinnedRowsHeight.bottom
386
+ },
387
+ role: "rowgroup",
388
+ children: [leftRenderContext && /*#__PURE__*/_jsx(VirtualScrollerPinnedColumns, {
389
+ className: classes.leftPinnedColumns,
390
+ ownerState: {
391
+ side: GridPinnedPosition.left
392
+ },
393
+ children: getRows({
394
+ renderContext: leftRenderContext,
395
+ minFirstColumn: leftRenderContext.firstColumnIndex,
396
+ maxLastColumn: leftRenderContext.lastColumnIndex,
397
+ availableSpace: 0,
398
+ ignoreAutoHeight: true,
399
+ rows: bottomPinnedRowsData,
400
+ rowIndexOffset: topPinnedRowsData.length + (mainRows ? mainRows.length : 0)
401
+ })
402
+ }), /*#__PURE__*/_jsx(VirtualScrollerPinnedRowsRenderZone, {
403
+ className: classes.pinnedRowsRenderZone,
404
+ ref: bottomPinnedRowsRenderZoneRef,
405
+ role: "presentation",
406
+ children: bottomPinnedRows
407
+ }), rightRenderContext && /*#__PURE__*/_jsx(VirtualScrollerPinnedColumns, {
408
+ className: classes.rightPinnedColumns,
409
+ ownerState: {
410
+ side: GridPinnedPosition.right
411
+ },
412
+ children: getRows({
413
+ renderContext: rightRenderContext,
414
+ minFirstColumn: rightRenderContext.firstColumnIndex,
415
+ maxLastColumn: rightRenderContext.lastColumnIndex,
416
+ availableSpace: 0,
417
+ ignoreAutoHeight: true,
418
+ rows: bottomPinnedRowsData,
419
+ rowIndexOffset: topPinnedRowsData.length + (mainRows ? mainRows.length : 0)
420
+ })
421
+ })]
422
+ }) : null]
260
423
  }));
261
424
  });
262
425
  export { DataGridProVirtualScroller };