@mui/x-data-grid-pro 5.13.1 → 5.15.1

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 (90) hide show
  1. package/CHANGELOG.md +147 -6
  2. package/DataGridPro/DataGridPro.js +15 -0
  3. package/DataGridPro/useDataGridProComponent.js +6 -1
  4. package/components/DataGridProVirtualScroller.js +198 -35
  5. package/components/GridRowReorderCell.d.ts +2 -2
  6. package/components/GridRowReorderCell.js +14 -1
  7. package/hooks/features/columnPinning/useGridColumnPinning.d.ts +1 -1
  8. package/hooks/features/columnPinning/useGridColumnPinning.js +12 -3
  9. package/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +2 -0
  10. package/hooks/features/index.d.ts +1 -0
  11. package/hooks/features/index.js +2 -1
  12. package/hooks/features/rowPinning/gridRowPinningInterface.d.ts +17 -0
  13. package/hooks/features/rowPinning/gridRowPinningInterface.js +1 -0
  14. package/hooks/features/rowPinning/gridRowPinningSelector.d.ts +1 -0
  15. package/hooks/features/rowPinning/gridRowPinningSelector.js +1 -0
  16. package/hooks/features/rowPinning/index.d.ts +1 -0
  17. package/hooks/features/rowPinning/index.js +1 -0
  18. package/hooks/features/rowPinning/useGridRowPinning.d.ts +6 -0
  19. package/hooks/features/rowPinning/useGridRowPinning.js +71 -0
  20. package/hooks/features/rowPinning/useGridRowPinningPreProcessors.d.ts +34 -0
  21. package/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +89 -0
  22. package/hooks/features/rowReorder/gridRowReorderColDef.js +2 -0
  23. package/hooks/features/rowReorder/useGridRowReorder.js +6 -0
  24. package/hooks/features/treeData/gridTreeDataUtils.js +9 -0
  25. package/index.js +1 -1
  26. package/internals/index.d.ts +3 -0
  27. package/internals/index.js +3 -0
  28. package/legacy/DataGridPro/DataGridPro.js +15 -0
  29. package/legacy/DataGridPro/useDataGridProComponent.js +6 -1
  30. package/legacy/components/DataGridProVirtualScroller.js +187 -25
  31. package/legacy/components/GridRowReorderCell.js +11 -0
  32. package/legacy/hooks/features/columnPinning/useGridColumnPinning.js +12 -3
  33. package/legacy/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +2 -0
  34. package/legacy/hooks/features/index.js +2 -1
  35. package/legacy/hooks/features/rowPinning/gridRowPinningInterface.js +1 -0
  36. package/legacy/hooks/features/rowPinning/gridRowPinningSelector.js +1 -0
  37. package/legacy/hooks/features/rowPinning/index.js +1 -0
  38. package/legacy/hooks/features/rowPinning/useGridRowPinning.js +71 -0
  39. package/legacy/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +89 -0
  40. package/legacy/hooks/features/rowReorder/gridRowReorderColDef.js +2 -0
  41. package/legacy/hooks/features/rowReorder/useGridRowReorder.js +6 -0
  42. package/legacy/hooks/features/treeData/gridTreeDataUtils.js +9 -0
  43. package/legacy/index.js +1 -1
  44. package/legacy/internals/index.js +3 -0
  45. package/legacy/utils/releaseInfo.js +1 -1
  46. package/legacy/utils/tree/sortRowTree.js +27 -14
  47. package/models/dataGridProProps.d.ts +11 -5
  48. package/models/gridApiPro.d.ts +2 -2
  49. package/modern/DataGridPro/DataGridPro.js +15 -0
  50. package/modern/DataGridPro/useDataGridProComponent.js +6 -1
  51. package/modern/components/DataGridProVirtualScroller.js +198 -35
  52. package/modern/components/GridRowReorderCell.js +12 -1
  53. package/modern/hooks/features/columnPinning/useGridColumnPinning.js +8 -3
  54. package/modern/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +2 -0
  55. package/modern/hooks/features/index.js +2 -1
  56. package/modern/hooks/features/rowPinning/gridRowPinningInterface.js +1 -0
  57. package/modern/hooks/features/rowPinning/gridRowPinningSelector.js +1 -0
  58. package/modern/hooks/features/rowPinning/index.js +1 -0
  59. package/modern/hooks/features/rowPinning/useGridRowPinning.js +63 -0
  60. package/modern/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +85 -0
  61. package/modern/hooks/features/rowReorder/gridRowReorderColDef.js +2 -0
  62. package/modern/hooks/features/rowReorder/useGridRowReorder.js +4 -0
  63. package/modern/hooks/features/treeData/gridTreeDataUtils.js +9 -0
  64. package/modern/index.js +1 -1
  65. package/modern/internals/index.js +3 -0
  66. package/modern/utils/releaseInfo.js +1 -1
  67. package/modern/utils/tree/sortRowTree.js +26 -11
  68. package/node/DataGridPro/DataGridPro.js +15 -0
  69. package/node/DataGridPro/useDataGridProComponent.js +8 -1
  70. package/node/components/DataGridProVirtualScroller.js +198 -34
  71. package/node/components/GridRowReorderCell.js +14 -1
  72. package/node/hooks/features/columnPinning/useGridColumnPinning.js +12 -3
  73. package/node/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +2 -0
  74. package/node/hooks/features/index.js +13 -0
  75. package/node/hooks/features/rowPinning/gridRowPinningInterface.js +5 -0
  76. package/node/hooks/features/rowPinning/gridRowPinningSelector.js +19 -0
  77. package/node/hooks/features/rowPinning/index.js +18 -0
  78. package/node/hooks/features/rowPinning/useGridRowPinning.js +92 -0
  79. package/node/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +105 -0
  80. package/node/hooks/features/rowReorder/gridRowReorderColDef.js +2 -0
  81. package/node/hooks/features/rowReorder/useGridRowReorder.js +6 -0
  82. package/node/hooks/features/treeData/gridTreeDataUtils.js +9 -0
  83. package/node/index.js +1 -1
  84. package/node/internals/index.js +41 -0
  85. package/node/utils/releaseInfo.js +1 -1
  86. package/node/utils/tree/sortRowTree.js +26 -11
  87. package/package.json +3 -3
  88. package/typeOverloads/modules.d.ts +2 -0
  89. package/utils/releaseInfo.js +1 -1
  90. package/utils/tree/sortRowTree.js +26 -11
package/CHANGELOG.md CHANGED
@@ -3,6 +3,147 @@
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.1
7
+
8
+ _Aug 4, 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
+ - 📚 New [page presenting the `apiRef`](https://mui.com/x/react-data-grid/api-object/) (#5273) @flaviendelangle
13
+ - ✨ Better keyboard support for start editing cells (#5511) @oliviertassinari
14
+ - 🌍 Improvements to different locales
15
+ - 🐞 Bugfixes
16
+
17
+ ### `@mui/x-data-grid@v5.15.1` / `@mui/x-data-grid-pro@v5.15.1` / `@mui/x-data-grid-premium@v5.15.1`
18
+
19
+ #### Changes
20
+
21
+ - [DataGrid] Improve start edit UX (#5511) @oliviertassinari
22
+ - [DataGrid] Add `initialOpen` prop to `GridEditSingleSelectCell` to allow overriding initial open state (#5645) @shapaaa
23
+ - [DataGrid] Forward `ref` to root element in `GridEditInputCell` (#5631) @Zenoo
24
+ - [DataGrid] Toggle open state when clicking on buttons in the `GridToolbar` (#5503) @cherniavskii
25
+ - [DataGrid] Improve German (de-DE) locale (#5586) @sebastianfrey
26
+ - [DataGrid] Improve Korean (ko-KR) locale (#5668) @Einere
27
+ - [DataGrid] Complete Italian (it-IT) locale (#5487) @mamodev
28
+
29
+ ### `@mui/x-date-pickers@v5.0.0-beta.4` / `@mui/x-date-picker-pro@5.0.0-beta.4`
30
+
31
+ #### Changes
32
+
33
+ - [DatePicker] Customize day formatter in the calendar (#5373) @alexfauquette
34
+
35
+ ### Docs
36
+
37
+ - [docs] New location for the legal content (#5595) @oliviertassinari
38
+ - [docs] Update description of `maxDateTime` prop (#5639) @jurecuhalev
39
+ - [docs] Add missing `date-fns` dependency when opening Codesandbox demo (#5692) @cherniavskii
40
+
41
+ ### Core
42
+
43
+ - [core] Drop usage of `GRID_EXPERIMENTAL_ENABLED` env variable (#5669) @ar7casper
44
+ - [core] Isolate asset loading under /x/ (#5594) @oliviertassinari
45
+ - [core] Upgrade node to v14 (#4999) @cherniavskii
46
+
47
+ ## 5.15.0
48
+
49
+ _Jul 29, 2022_
50
+
51
+ We'd like to offer a big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
52
+
53
+ - 🎁 Introduce aggregation (#5592) @flaviendelangle
54
+
55
+ Premium users can now aggregate data in the grid.
56
+ Extract information like sum, average, count, and others with a couple of clicks.
57
+
58
+ https://user-images.githubusercontent.com/45398769/181581503-77cc412e-9d9e-4de1-8bc3-c3bccc54cdaa.mp4
59
+
60
+ To enable this feature, add `experimentalFeatures={{ aggregation: true }}`.
61
+ Aggregation functions are customizable and they combine well with row grouping.
62
+ See the [documentation](https://mui.com/x/react-data-grid/aggregation/) to explore everything it has to offer.
63
+
64
+ - 🚀 Introduce row pinning (#4863) @cherniavskii
65
+
66
+ Pro users can now pin rows on top or bottom of the grid.
67
+
68
+ https://user-images.githubusercontent.com/45398769/181581493-56c733a3-6dd5-4546-bf8d-3f2dff72b14a.mp4
69
+
70
+ To do so, enable the feature with `experimentalFeatures={{ rowPinning: true }}` and provide the pinned rows data to the `pinnedRows` prop.
71
+ For more details, see the [documentation](https://mui.com/x/react-data-grid/row-pinning/).
72
+
73
+ - 🌍 Add simplified Chinese (zh-CN) locale to pickers (#5584) @gamecss
74
+ - 📚 Documentation improvements
75
+
76
+ ### `@mui/x-data-grid@v5.15.0` / `@mui/x-data-grid-pro@v5.15.0` / `@mui/x-data-grid-premium@v5.15.0`
77
+
78
+ #### Changes
79
+
80
+ - [DataGrid] Add prop to keep modifications while processing props (#5309) @m4theushw
81
+ - [DataGrid] Fix container width change on React 18 (#5566) @m4theushw
82
+ - [DataGrid] Fix ellipsis style convention (#5587) @oliviertassinari
83
+ - [DataGridPro] Implement row pinning (#4863) @cherniavskii
84
+ - [DataGridPremium] Make aggregation public (#5592) @cherniavskii
85
+ - [l10n] Improve simplified Chinese (zh-CN) locale (#5584) @gamecss
86
+
87
+ ### `@mui/x-date-pickers@v5.0.0-beta.3` / `@mui/x-date-picker-pro@5.0.0-beta.3`
88
+
89
+ #### Changes
90
+
91
+ - [l10n] Add simplified Chinese (zh-CN) locale (#5584) @gamecss
92
+
93
+ ### Docs
94
+
95
+ - [docs] Split docs page about rows (#5195) @flaviendelangle
96
+ - [docs] Add warning clarifications (#5399) @alexfauquette
97
+ - [docs] Correct slot CSS classes for Pro and Premium components (#5452) @alexfauquette
98
+ - [docs] Fix internal link to `valueParser` (#5450) @alexfauquette
99
+
100
+ ### Core
101
+
102
+ - [core] Upgrade monorepo (#5560) @m4theushw
103
+
104
+ ## 5.14.0
105
+
106
+ _Jul 21, 2022_
107
+
108
+ We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
109
+
110
+ - 🧪 Export `GridBooleanCell` component from data grid (#5537) @cliedeman
111
+ - ⚙️ Improve accessibility of the Export menu (#5486) @nogalpaulina
112
+ - 🌍 Improvements to different locales
113
+ - 📚 Documentation improvements
114
+ - 🐞 Bugfixes
115
+
116
+ ### `@mui/x-data-grid@5.14.0` / `@mui/x-data-grid-pro@5.14.0` / `@mui/x-data-grid-premium@5.14.0`
117
+
118
+ #### Changes
119
+
120
+ - [DataGrid] Add generics to `GridPreProcessEditCellProps` (#5510) @YunosukeY
121
+ - [DataGrid] Avoid inconsistent state export (#5390) @flaviendelangle
122
+ - [DataGrid] Export `GridBooleanCell` component (#5537) @cliedeman
123
+ - [DataGrid] Fix `date`/`dateTime` edit input font size to match view mode (#5304) @cherniavskii
124
+ - [DataGrid] Fix loading overlay position (#5558) @DanailH
125
+ - [DataGrid] Improve accessibility of the Export menu in the toolbar (#5486) @nogalpaulina
126
+ - [DataGridPremium] Implement Aggregation - not publicly released (#4208) @flaviendelangle
127
+ - [DataGridPremium] Fix crash when exporting all columns to Excel (#5425) @cherniavskii
128
+ - [l10n] Add Traditional Chinese (zh-TW) locale (#5498) @happyincent
129
+
130
+ ### `@mui/x-date-pickers@v5.0.0-beta.2` / `@mui/x-date-picker-pro@5.0.0-beta.2`
131
+
132
+ #### Changes
133
+
134
+ - [l10n] Add Norwegian (nb-NO) locale (#5475) @elkebab
135
+
136
+ ### Docs
137
+
138
+ - [docs] New page presenting the `apiRef` (#5273) @flaviendelangle
139
+ - [docs] Remove blank line @oliviertassinari
140
+
141
+ ### Core
142
+
143
+ - [core] Add missing comments on zh-TW translation (#5559) @flaviendelangle
144
+ - [core] Polish on the bug issue template (#5525) @oliviertassinari
145
+ - [test] Add more tests related to `isPrintableKey` (#5458) @mnajdova
146
+
6
147
  ## 5.13.1
7
148
 
8
149
  _Jul 15, 2022_
@@ -263,7 +404,7 @@ _May 31, 2022_
263
404
 
264
405
  We'd like to offer a big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
265
406
 
266
- - 🎁 Introduce support for [dynamic row height](https://mui.com/x/react-data-grid/rows/#dynamic-row-height) (#4859) @m4theushw
407
+ - 🎁 Introduce support for [dynamic row height](https://mui.com/x/react-data-grid/row-height/#dynamic-row-height) (#4859) @m4theushw
267
408
 
268
409
  <img src="https://user-images.githubusercontent.com/42154031/171183167-718d7bcd-ec0f-459e-97fe-0f650abb4a99.gif" width="800">
269
410
 
@@ -580,7 +721,7 @@ _Apr 25, 2022_
580
721
 
581
722
  We'd like to offer a big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
582
723
 
583
- - 🎁 Introduce [Row reorder](https://mui.com/x/react-data-grid/rows/#row-reorder) (#4034) @DanailH
724
+ - 🎁 Introduce [Row reorder](https://mui.com/x/react-data-grid/row-ordering/) (#4034) @DanailH
584
725
 
585
726
  <img src="https://user-images.githubusercontent.com/5858539/165091263-23472fbb-a989-44b8-849a-d2185adfe13b.gif" width="800">
586
727
 
@@ -844,7 +985,7 @@ We'd like to offer a big thanks to the 8 contributors who made this release poss
844
985
  <DataGrid getRowSpacing={() => ({ top: 10, bottom: 10 })} />
845
986
  ```
846
987
 
847
- Check the [documentation](https://mui.com/x/react-data-grid/rows/#row-spacing) for more information.
988
+ Check the [documentation](https://mui.com/x/react-data-grid/row-height/#row-spacing) for more information.
848
989
 
849
990
  ### `@mui/x-data-grid@v5.6.1` / `@mui/x-data-grid-pro@v5.6.1`
850
991
 
@@ -1098,7 +1239,7 @@ _Jan 28, 2022_
1098
1239
 
1099
1240
  A big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
1100
1241
 
1101
- - 🚣 Introduce [variable row height](https://mui.com/x/react-data-grid/rows/#variable-row-height) (#438) @DanailH
1242
+ - 🚣 Introduce [variable row height](https://mui.com/x/react-data-grid/row-height/#variable-row-height) (#438) @DanailH
1102
1243
 
1103
1244
  Allows for setting a row-specific height.
1104
1245
  By default, all rows have the same height, but now you can set the height on a per-row basis.
@@ -1466,7 +1607,7 @@ A big thanks to the 5 contributors who made this release possible. Here are some
1466
1607
  - [core] Fix `yarn prettier` script (#3292) @oliviertassinari
1467
1608
  - [core] Improve tests for Tree Data (#3366) @flaviendelangle
1468
1609
  - [core] Never import directly from the `__modules__` folder in the `x-data-grid-generator` package (#3379) @flaviendelangle
1469
- - [core] Transition to a new StackOverflow tag (#3308) @oliviertassinari
1610
+ - [core] Transition to a new Stack Overflow tag (#3308) @oliviertassinari
1470
1611
  - [core] Update monorepo (#3370) @flaviendelangle
1471
1612
  - [core] Use pre-processors for sorting and filtering (#3318) @flaviendelangle
1472
1613
  - [test] Replace `useFakeTimers` (#3323) @m4theushw
@@ -3750,7 +3891,7 @@ Big thanks to the 7 contributors who made this release possible. Here are some h
3750
3891
  - 🎁 Add `onRowsScrollEnd` to support infinite loading (#1199) @DanailH
3751
3892
  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.
3752
3893
 
3753
- See the documentation for [more details](https://mui.com/x/react-data-grid/rows/#infinite-loading).
3894
+ See the documentation for [more details](https://mui.com/x/react-data-grid/row-updates/#infinite-loading).
3754
3895
 
3755
3896
  - 🕹 Provide the ability to sort by multiple columns using Shift+click (#1203) @dtassone
3756
3897
  - 🇵🇱 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);
@@ -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 };
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { GridRenderCellParams } from '@mui/x-data-grid';
3
- declare const GridRowReorderCell: (params: GridRenderCellParams) => JSX.Element;
3
+ declare const GridRowReorderCell: (params: GridRenderCellParams) => JSX.Element | null;
4
4
  export { GridRowReorderCell };
5
- export declare const renderRowReorderCell: (params: GridRenderCellParams) => JSX.Element;
5
+ export declare const renderRowReorderCell: (params: GridRenderCellParams) => JSX.Element | null;
@@ -19,6 +19,8 @@ const useUtilityClasses = ownerState => {
19
19
  };
20
20
 
21
21
  const GridRowReorderCell = params => {
22
+ var _params$rowNode$posit;
23
+
22
24
  const apiRef = useGridApiContext();
23
25
  const rootProps = useGridRootProps();
24
26
  const sortModel = useGridSelector(apiRef, gridSortModelSelector);
@@ -57,6 +59,11 @@ const GridRowReorderCell = params => {
57
59
  onDragOver: publish('rowDragOver'),
58
60
  onDragEnd: publish('rowDragEnd')
59
61
  } : null;
62
+
63
+ if (((_params$rowNode$posit = params.rowNode.position) != null ? _params$rowNode$posit : 'body') !== 'body') {
64
+ return null;
65
+ }
66
+
60
67
  return /*#__PURE__*/_jsxs("div", _extends({
61
68
  className: classes.root,
62
69
  draggable: isDraggable
@@ -69,4 +76,10 @@ const GridRowReorderCell = params => {
69
76
  };
70
77
 
71
78
  export { GridRowReorderCell };
72
- export const renderRowReorderCell = params => /*#__PURE__*/_jsx(GridRowReorderCell, _extends({}, params));
79
+ export const renderRowReorderCell = params => {
80
+ if (params.rowNode.isPinned) {
81
+ return null;
82
+ }
83
+
84
+ return /*#__PURE__*/_jsx(GridRowReorderCell, _extends({}, params));
85
+ };
@@ -3,4 +3,4 @@ import { GridStateInitializer } from '@mui/x-data-grid/internals';
3
3
  import { GridApiPro } from '../../../models/gridApiPro';
4
4
  import { DataGridProProcessedProps } from '../../../models/dataGridProProps';
5
5
  export declare const columnPinningStateInitializer: GridStateInitializer<Pick<DataGridProProcessedProps, 'pinnedColumns' | 'initialState' | 'disableColumnPinning'>>;
6
- export declare const useGridColumnPinning: (apiRef: React.MutableRefObject<GridApiPro>, props: Pick<DataGridProProcessedProps, 'disableColumnPinning' | 'pinnedColumns' | 'onPinnedColumnsChange'>) => void;
6
+ export declare const useGridColumnPinning: (apiRef: React.MutableRefObject<GridApiPro>, props: Pick<DataGridProProcessedProps, 'disableColumnPinning' | 'initialState' | 'pinnedColumns' | 'onPinnedColumnsChange'>) => void;