@mui/x-data-grid-pro 5.14.0 → 5.15.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 (78) hide show
  1. package/CHANGELOG.md +147 -5
  2. package/DataGridPro/DataGridPro.js +16 -1
  3. package/DataGridPro/useDataGridProComponent.js +5 -0
  4. package/components/DataGridProVirtualScroller.js +198 -35
  5. package/components/GridRowReorderCell.d.ts +1 -1
  6. package/components/GridRowReorderCell.js +7 -1
  7. package/hooks/features/index.d.ts +1 -0
  8. package/hooks/features/index.js +2 -1
  9. package/hooks/features/rowPinning/gridRowPinningInterface.d.ts +17 -0
  10. package/hooks/features/rowPinning/gridRowPinningInterface.js +1 -0
  11. package/hooks/features/rowPinning/gridRowPinningSelector.d.ts +1 -0
  12. package/hooks/features/rowPinning/gridRowPinningSelector.js +1 -0
  13. package/hooks/features/rowPinning/index.d.ts +1 -0
  14. package/hooks/features/rowPinning/index.js +1 -0
  15. package/hooks/features/rowPinning/useGridRowPinning.d.ts +6 -0
  16. package/hooks/features/rowPinning/useGridRowPinning.js +71 -0
  17. package/hooks/features/rowPinning/useGridRowPinningPreProcessors.d.ts +34 -0
  18. package/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +89 -0
  19. package/hooks/features/rowReorder/useGridRowReorder.js +6 -0
  20. package/hooks/features/treeData/gridTreeDataUtils.d.ts +2 -1
  21. package/hooks/features/treeData/gridTreeDataUtils.js +7 -2
  22. package/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -1
  23. package/index.js +1 -1
  24. package/internals/index.d.ts +2 -0
  25. package/internals/index.js +2 -0
  26. package/legacy/DataGridPro/DataGridPro.js +16 -1
  27. package/legacy/DataGridPro/useDataGridProComponent.js +5 -0
  28. package/legacy/components/DataGridProVirtualScroller.js +187 -25
  29. package/legacy/components/GridRowReorderCell.js +4 -0
  30. package/legacy/hooks/features/index.js +2 -1
  31. package/legacy/hooks/features/rowPinning/gridRowPinningInterface.js +1 -0
  32. package/legacy/hooks/features/rowPinning/gridRowPinningSelector.js +1 -0
  33. package/legacy/hooks/features/rowPinning/index.js +1 -0
  34. package/legacy/hooks/features/rowPinning/useGridRowPinning.js +71 -0
  35. package/legacy/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +89 -0
  36. package/legacy/hooks/features/rowReorder/useGridRowReorder.js +6 -0
  37. package/legacy/hooks/features/treeData/gridTreeDataUtils.js +7 -2
  38. package/legacy/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -1
  39. package/legacy/index.js +1 -1
  40. package/legacy/internals/index.js +2 -0
  41. package/legacy/utils/releaseInfo.js +1 -1
  42. package/models/dataGridProProps.d.ts +11 -5
  43. package/models/gridApiPro.d.ts +2 -2
  44. package/modern/DataGridPro/DataGridPro.js +16 -1
  45. package/modern/DataGridPro/useDataGridProComponent.js +5 -0
  46. package/modern/components/DataGridProVirtualScroller.js +198 -35
  47. package/modern/components/GridRowReorderCell.js +7 -1
  48. package/modern/hooks/features/index.js +2 -1
  49. package/modern/hooks/features/rowPinning/gridRowPinningInterface.js +1 -0
  50. package/modern/hooks/features/rowPinning/gridRowPinningSelector.js +1 -0
  51. package/modern/hooks/features/rowPinning/index.js +1 -0
  52. package/modern/hooks/features/rowPinning/useGridRowPinning.js +63 -0
  53. package/modern/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +85 -0
  54. package/modern/hooks/features/rowReorder/useGridRowReorder.js +4 -0
  55. package/modern/hooks/features/treeData/gridTreeDataUtils.js +7 -2
  56. package/modern/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -1
  57. package/modern/index.js +1 -1
  58. package/modern/internals/index.js +2 -0
  59. package/modern/utils/releaseInfo.js +1 -1
  60. package/node/DataGridPro/DataGridPro.js +16 -1
  61. package/node/DataGridPro/useDataGridProComponent.js +7 -0
  62. package/node/components/DataGridProVirtualScroller.js +198 -34
  63. package/node/components/GridRowReorderCell.js +7 -1
  64. package/node/hooks/features/index.js +13 -0
  65. package/node/hooks/features/rowPinning/gridRowPinningInterface.js +5 -0
  66. package/node/hooks/features/rowPinning/gridRowPinningSelector.js +19 -0
  67. package/node/hooks/features/rowPinning/index.js +18 -0
  68. package/node/hooks/features/rowPinning/useGridRowPinning.js +92 -0
  69. package/node/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +105 -0
  70. package/node/hooks/features/rowReorder/useGridRowReorder.js +6 -0
  71. package/node/hooks/features/treeData/gridTreeDataUtils.js +9 -2
  72. package/node/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -1
  73. package/node/index.js +1 -1
  74. package/node/internals/index.js +32 -0
  75. package/node/utils/releaseInfo.js +1 -1
  76. package/package.json +3 -3
  77. package/typeOverloads/modules.d.ts +2 -0
  78. package/utils/releaseInfo.js +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,148 @@
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.2
7
+
8
+ _Aug 11, 2022_
9
+
10
+ We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - ✨ Improve quick filtering with row grouping (#5701) @alexfauquette
13
+ - 📚 Documentation improvements
14
+ - 🐞 Bugfixes
15
+
16
+ ### `@mui/x-data-grid@5.15.2` / `@mui/x-data-grid-pro@5.15.2` / `@mui/x-data-grid-premium@5.15.2`
17
+
18
+ #### Changes
19
+
20
+ - [DataGrid] Catch errors if rows freezing is not supported (#5711) @cherniavskii
21
+ - [DataGrid] Preserve cell mode when entering edit mode while commiting (#5686) @m4theushw
22
+ - [DataGridPremium] Let quick filter search in row grouping children (#5701) @alexfauquette
23
+
24
+ ### `@mui/x-date-pickers@v5.0.0-beta.5` / `@mui/x-date-picker-pro@5.0.0-beta.5`
25
+
26
+ #### Changes
27
+
28
+ - [pickers] Add `react-dom` to peerDependencies (#5752) @cherniavskii
29
+ - [TimePicker] Set clock focus outline to `none` (#5758) @LukasTy
30
+ - [pickers] Fix theme augmentation with TypeScript (#5596) @alexfauquette
31
+ - [pickers] Reset input value when locale is modified (#5310) @alexfauquette
32
+ - [pickers] Support `disableHighlightToday` on `MonthPicker` and `YearPicker` (#5562) @flaviendelangle
33
+ - [pickers] Fallback to desktop mode when `matchMedia` is unavailable (#5684) @LukasTy
34
+ - [pickers] Trigger `onChange` when clearing or accepting `Invalid date` (#5740) @LukasTy
35
+
36
+ ### Docs
37
+
38
+ - [docs] Add RFC GH issue template (#5739) @bytasv
39
+ - [docs] Add description to the `GridExportStateParams` page (#5654) @oliviertassinari
40
+ - [docs] Improve the Events page (#5413) @flaviendelangle
41
+ - [docs] Use new editing API in the introduction demos (#5728) @oliviertassinari
42
+
43
+ ### Core
44
+
45
+ - [core] Remove duplicated `FUNDING.yml` file (#5656) @oliviertassinari
46
+ - [core] Remove outdated Next.js options (#5727) @oliviertassinari
47
+ - [core] Update tooling to run with React 18 (#4155) @m4theushw
48
+ - [test] Fix failing dynamic row height tests on Edge (#5707) @m4theushw
49
+
50
+ ## 5.15.1
51
+
52
+ _Aug 4, 2022_
53
+
54
+ We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
55
+
56
+ - 📚 New [page presenting the `apiRef`](https://mui.com/x/react-data-grid/api-object/) (#5273) @flaviendelangle
57
+ - ✨ Better keyboard support for start editing cells (#5511) @oliviertassinari
58
+ - 🌍 Improvements to different locales
59
+ - 🐞 Bugfixes
60
+
61
+ ### `@mui/x-data-grid@v5.15.1` / `@mui/x-data-grid-pro@v5.15.1` / `@mui/x-data-grid-premium@v5.15.1`
62
+
63
+ #### Changes
64
+
65
+ - [DataGrid] Improve start edit UX (#5511) @oliviertassinari
66
+ - [DataGrid] Add `initialOpen` prop to `GridEditSingleSelectCell` to allow overriding initial open state (#5645) @shapaaa
67
+ - [DataGrid] Forward `ref` to root element in `GridEditInputCell` (#5631) @Zenoo
68
+ - [DataGrid] Toggle open state when clicking on buttons in the `GridToolbar` (#5503) @cherniavskii
69
+ - [DataGrid] Improve German (de-DE) locale (#5586) @sebastianfrey
70
+ - [DataGrid] Improve Korean (ko-KR) locale (#5668) @Einere
71
+ - [DataGrid] Complete Italian (it-IT) locale (#5487) @mamodev
72
+
73
+ ### `@mui/x-date-pickers@v5.0.0-beta.4` / `@mui/x-date-picker-pro@5.0.0-beta.4`
74
+
75
+ #### Changes
76
+
77
+ - [DatePicker] Customize day formatter in the calendar (#5373) @alexfauquette
78
+
79
+ ### Docs
80
+
81
+ - [docs] New location for the legal content (#5595) @oliviertassinari
82
+ - [docs] Update description of `maxDateTime` prop (#5639) @jurecuhalev
83
+ - [docs] Add missing `date-fns` dependency when opening Codesandbox demo (#5692) @cherniavskii
84
+
85
+ ### Core
86
+
87
+ - [core] Drop usage of `GRID_EXPERIMENTAL_ENABLED` env variable (#5669) @ar7casper
88
+ - [core] Isolate asset loading under /x/ (#5594) @oliviertassinari
89
+ - [core] Upgrade node to v14 (#4999) @cherniavskii
90
+
91
+ ## 5.15.0
92
+
93
+ _Jul 29, 2022_
94
+
95
+ We'd like to offer a big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
96
+
97
+ - 🎁 Introduce aggregation (#5592) @flaviendelangle
98
+
99
+ Premium users can now aggregate data in the grid.
100
+ Extract information like sum, average, count, and others with a couple of clicks.
101
+
102
+ https://user-images.githubusercontent.com/45398769/181581503-77cc412e-9d9e-4de1-8bc3-c3bccc54cdaa.mp4
103
+
104
+ To enable this feature, add `experimentalFeatures={{ aggregation: true }}`.
105
+ Aggregation functions are customizable and they combine well with row grouping.
106
+ See the [documentation](https://mui.com/x/react-data-grid/aggregation/) to explore everything it has to offer.
107
+
108
+ - 🚀 Introduce row pinning (#4863) @cherniavskii
109
+
110
+ Pro users can now pin rows on top or bottom of the grid.
111
+
112
+ https://user-images.githubusercontent.com/45398769/181581493-56c733a3-6dd5-4546-bf8d-3f2dff72b14a.mp4
113
+
114
+ To do so, enable the feature with `experimentalFeatures={{ rowPinning: true }}` and provide the pinned rows data to the `pinnedRows` prop.
115
+ For more details, see the [documentation](https://mui.com/x/react-data-grid/row-pinning/).
116
+
117
+ - 🌍 Add simplified Chinese (zh-CN) locale to pickers (#5584) @gamecss
118
+ - 📚 Documentation improvements
119
+
120
+ ### `@mui/x-data-grid@v5.15.0` / `@mui/x-data-grid-pro@v5.15.0` / `@mui/x-data-grid-premium@v5.15.0`
121
+
122
+ #### Changes
123
+
124
+ - [DataGrid] Add prop to keep modifications while processing props (#5309) @m4theushw
125
+ - [DataGrid] Fix container width change on React 18 (#5566) @m4theushw
126
+ - [DataGrid] Fix ellipsis style convention (#5587) @oliviertassinari
127
+ - [DataGridPro] Implement row pinning (#4863) @cherniavskii
128
+ - [DataGridPremium] Make aggregation public (#5592) @cherniavskii
129
+ - [l10n] Improve simplified Chinese (zh-CN) locale (#5584) @gamecss
130
+
131
+ ### `@mui/x-date-pickers@v5.0.0-beta.3` / `@mui/x-date-picker-pro@5.0.0-beta.3`
132
+
133
+ #### Changes
134
+
135
+ - [l10n] Add simplified Chinese (zh-CN) locale (#5584) @gamecss
136
+
137
+ ### Docs
138
+
139
+ - [docs] Split docs page about rows (#5195) @flaviendelangle
140
+ - [docs] Add warning clarifications (#5399) @alexfauquette
141
+ - [docs] Correct slot CSS classes for Pro and Premium components (#5452) @alexfauquette
142
+ - [docs] Fix internal link to `valueParser` (#5450) @alexfauquette
143
+
144
+ ### Core
145
+
146
+ - [core] Upgrade monorepo (#5560) @m4theushw
147
+
6
148
  ## 5.14.0
7
149
 
8
150
  _Jul 21, 2022_
@@ -306,7 +448,7 @@ _May 31, 2022_
306
448
 
307
449
  We'd like to offer a big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
308
450
 
309
- - 🎁 Introduce support for [dynamic row height](https://mui.com/x/react-data-grid/rows/#dynamic-row-height) (#4859) @m4theushw
451
+ - 🎁 Introduce support for [dynamic row height](https://mui.com/x/react-data-grid/row-height/#dynamic-row-height) (#4859) @m4theushw
310
452
 
311
453
  <img src="https://user-images.githubusercontent.com/42154031/171183167-718d7bcd-ec0f-459e-97fe-0f650abb4a99.gif" width="800">
312
454
 
@@ -623,7 +765,7 @@ _Apr 25, 2022_
623
765
 
624
766
  We'd like to offer a big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
625
767
 
626
- - 🎁 Introduce [Row reorder](https://mui.com/x/react-data-grid/rows/#row-reorder) (#4034) @DanailH
768
+ - 🎁 Introduce [Row reorder](https://mui.com/x/react-data-grid/row-ordering/) (#4034) @DanailH
627
769
 
628
770
  <img src="https://user-images.githubusercontent.com/5858539/165091263-23472fbb-a989-44b8-849a-d2185adfe13b.gif" width="800">
629
771
 
@@ -887,7 +1029,7 @@ We'd like to offer a big thanks to the 8 contributors who made this release poss
887
1029
  <DataGrid getRowSpacing={() => ({ top: 10, bottom: 10 })} />
888
1030
  ```
889
1031
 
890
- Check the [documentation](https://mui.com/x/react-data-grid/rows/#row-spacing) for more information.
1032
+ Check the [documentation](https://mui.com/x/react-data-grid/row-height/#row-spacing) for more information.
891
1033
 
892
1034
  ### `@mui/x-data-grid@v5.6.1` / `@mui/x-data-grid-pro@v5.6.1`
893
1035
 
@@ -1141,7 +1283,7 @@ _Jan 28, 2022_
1141
1283
 
1142
1284
  A big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
1143
1285
 
1144
- - 🚣 Introduce [variable row height](https://mui.com/x/react-data-grid/rows/#variable-row-height) (#438) @DanailH
1286
+ - 🚣 Introduce [variable row height](https://mui.com/x/react-data-grid/row-height/#variable-row-height) (#438) @DanailH
1145
1287
 
1146
1288
  Allows for setting a row-specific height.
1147
1289
  By default, all rows have the same height, but now you can set the height on a per-row basis.
@@ -3793,7 +3935,7 @@ Big thanks to the 7 contributors who made this release possible. Here are some h
3793
3935
  - 🎁 Add `onRowsScrollEnd` to support infinite loading (#1199) @DanailH
3794
3936
  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.
3795
3937
 
3796
- See the documentation for [more details](https://mui.com/x/react-data-grid/rows/#infinite-loading).
3938
+ See the documentation for [more details](https://mui.com/x/react-data-grid/row-updates/#infinite-loading).
3797
3939
 
3798
3940
  - 🕹 Provide the ability to sort by multiple columns using Shift+click (#1203) @dtassone
3799
3941
  - 🇵🇱 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
 
@@ -815,7 +822,7 @@ DataGridProRaw.propTypes = {
815
822
  * @param {GridState} state The new state.
816
823
  * @param {MuiEvent<{}>} event The event object.
817
824
  * @param {GridCallbackDetails} details Additional details for this callback.
818
- * @internal
825
+ * @ignore - do not document.
819
826
  */
820
827
  onStateChange: PropTypes.func,
821
828
 
@@ -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);
@@ -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 };
@@ -2,4 +2,4 @@
2
2
  import { GridRenderCellParams } from '@mui/x-data-grid';
3
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;
@@ -76,4 +76,10 @@ const GridRowReorderCell = params => {
76
76
  };
77
77
 
78
78
  export { GridRowReorderCell };
79
- 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
+ };
@@ -4,3 +4,4 @@ export * from './columnResize';
4
4
  export * from './rowReorder';
5
5
  export * from './treeData';
6
6
  export * from './detailPanel';
7
+ export * from './rowPinning';
@@ -4,4 +4,5 @@ export * from './columnReorder';
4
4
  export * from './columnResize';
5
5
  export * from './rowReorder';
6
6
  export * from './treeData';
7
- export * from './detailPanel';
7
+ export * from './detailPanel';
8
+ export * from './rowPinning';
@@ -0,0 +1,17 @@
1
+ import { GridRowId, GridRowsLookup, GridRowsProp } from '@mui/x-data-grid';
2
+ export interface GridPinnedRowsProp<R = any> {
3
+ top?: GridRowsProp<R>;
4
+ bottom?: GridRowsProp<R>;
5
+ }
6
+ export interface GridRowPinningApi {
7
+ /**
8
+ * Changes the pinned rows.
9
+ * @param {GridPinnedRowsProp} pinnedRows An object containing the rows to pin.
10
+ */
11
+ unstable_setPinnedRows: (pinnedRows?: GridPinnedRowsProp) => void;
12
+ }
13
+ export interface GridRowPinningInternalCache {
14
+ topIds: GridRowId[];
15
+ bottomIds: GridRowId[];
16
+ idLookup: GridRowsLookup;
17
+ }
@@ -0,0 +1 @@
1
+ export { gridAdditionalRowGroupsSelector, gridPinnedRowsSelector, } from '@mui/x-data-grid/internals';
@@ -0,0 +1 @@
1
+ export { gridAdditionalRowGroupsSelector, gridPinnedRowsSelector } from '@mui/x-data-grid/internals';
@@ -0,0 +1 @@
1
+ export * from './gridRowPinningInterface';
@@ -0,0 +1 @@
1
+ export * from './gridRowPinningInterface';