@mui/x-data-grid-pro 5.15.3 → 5.17.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 (92) hide show
  1. package/CHANGELOG.md +150 -1
  2. package/DataGridPro/DataGridPro.js +19 -0
  3. package/DataGridPro/useDataGridProComponent.js +8 -1
  4. package/DataGridPro/useDataGridProProps.js +2 -1
  5. package/components/DataGridProColumnHeaders.js +25 -13
  6. package/components/DataGridProVirtualScroller.js +18 -15
  7. package/components/GridDetailPanelToggleCell.js +2 -1
  8. package/components/GridTreeDataGroupingCell.js +2 -1
  9. package/hooks/features/columnReorder/useGridColumnReorder.js +95 -3
  10. package/hooks/features/columnResize/useGridColumnResize.js +10 -7
  11. package/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +15 -0
  12. package/hooks/features/infiniteLoader/useGridInfiniteLoader.d.ts +1 -1
  13. package/hooks/features/infiniteLoader/useGridInfiniteLoader.js +4 -4
  14. package/hooks/features/lazyLoader/useGridLazyLoader.d.ts +10 -0
  15. package/hooks/features/lazyLoader/useGridLazyLoader.js +178 -0
  16. package/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.d.ts +5 -0
  17. package/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +32 -0
  18. package/hooks/features/rowPinning/useGridRowPinningPreProcessors.d.ts +4 -4
  19. package/hooks/features/treeData/gridTreeDataUtils.d.ts +3 -1
  20. package/hooks/features/treeData/gridTreeDataUtils.js +1 -1
  21. package/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -1
  22. package/index.js +1 -1
  23. package/legacy/DataGridPro/DataGridPro.js +19 -0
  24. package/legacy/DataGridPro/useDataGridProComponent.js +8 -1
  25. package/legacy/DataGridPro/useDataGridProProps.js +2 -1
  26. package/legacy/components/DataGridProColumnHeaders.js +25 -13
  27. package/legacy/components/DataGridProVirtualScroller.js +18 -15
  28. package/legacy/components/GridDetailPanelToggleCell.js +2 -1
  29. package/legacy/components/GridTreeDataGroupingCell.js +2 -1
  30. package/legacy/hooks/features/columnReorder/useGridColumnReorder.js +99 -3
  31. package/legacy/hooks/features/columnResize/useGridColumnResize.js +11 -7
  32. package/legacy/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +15 -0
  33. package/legacy/hooks/features/infiniteLoader/useGridInfiniteLoader.js +4 -4
  34. package/legacy/hooks/features/lazyLoader/useGridLazyLoader.js +185 -0
  35. package/legacy/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +35 -0
  36. package/legacy/hooks/features/treeData/gridTreeDataUtils.js +1 -1
  37. package/legacy/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -1
  38. package/legacy/index.js +1 -1
  39. package/legacy/models/gridFetchRowsParams.js +1 -0
  40. package/legacy/models/index.js +2 -1
  41. package/legacy/utils/domUtils.js +5 -0
  42. package/legacy/utils/releaseInfo.js +1 -1
  43. package/models/dataGridProProps.d.ts +22 -1
  44. package/models/gridFetchRowsParams.d.ts +22 -0
  45. package/models/gridFetchRowsParams.js +1 -0
  46. package/models/index.d.ts +1 -0
  47. package/models/index.js +2 -1
  48. package/modern/DataGridPro/DataGridPro.js +19 -0
  49. package/modern/DataGridPro/useDataGridProComponent.js +8 -1
  50. package/modern/DataGridPro/useDataGridProProps.js +2 -1
  51. package/modern/components/DataGridProColumnHeaders.js +25 -13
  52. package/modern/components/DataGridProVirtualScroller.js +18 -15
  53. package/modern/components/GridDetailPanelToggleCell.js +2 -1
  54. package/modern/components/GridTreeDataGroupingCell.js +2 -1
  55. package/modern/hooks/features/columnReorder/useGridColumnReorder.js +83 -3
  56. package/modern/hooks/features/columnResize/useGridColumnResize.js +5 -2
  57. package/modern/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +15 -0
  58. package/modern/hooks/features/infiniteLoader/useGridInfiniteLoader.js +4 -4
  59. package/modern/hooks/features/lazyLoader/useGridLazyLoader.js +176 -0
  60. package/modern/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +30 -0
  61. package/modern/hooks/features/treeData/gridTreeDataUtils.js +1 -1
  62. package/modern/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -1
  63. package/modern/index.js +1 -1
  64. package/modern/models/gridFetchRowsParams.js +1 -0
  65. package/modern/models/index.js +2 -1
  66. package/modern/utils/domUtils.js +3 -0
  67. package/modern/utils/releaseInfo.js +1 -1
  68. package/node/DataGridPro/DataGridPro.js +19 -0
  69. package/node/DataGridPro/useDataGridProComponent.js +9 -0
  70. package/node/DataGridPro/useDataGridProProps.js +1 -0
  71. package/node/components/DataGridProColumnHeaders.js +25 -12
  72. package/node/components/DataGridProVirtualScroller.js +18 -15
  73. package/node/components/GridDetailPanelToggleCell.js +2 -1
  74. package/node/components/GridTreeDataGroupingCell.js +2 -1
  75. package/node/hooks/features/columnReorder/useGridColumnReorder.js +95 -3
  76. package/node/hooks/features/columnResize/useGridColumnResize.js +9 -6
  77. package/node/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +16 -0
  78. package/node/hooks/features/infiniteLoader/useGridInfiniteLoader.js +3 -3
  79. package/node/hooks/features/lazyLoader/useGridLazyLoader.js +193 -0
  80. package/node/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +52 -0
  81. package/node/hooks/features/treeData/gridTreeDataUtils.js +1 -1
  82. package/node/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -1
  83. package/node/index.js +1 -1
  84. package/node/models/gridFetchRowsParams.js +5 -0
  85. package/node/models/index.js +13 -0
  86. package/node/utils/domUtils.js +7 -0
  87. package/node/utils/releaseInfo.js +1 -1
  88. package/package.json +5 -5
  89. package/typeOverloads/modules.d.ts +7 -1
  90. package/utils/domUtils.d.ts +1 -0
  91. package/utils/domUtils.js +5 -0
  92. package/utils/releaseInfo.js +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,155 @@
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.17.1
7
+
8
+ _Sep 5, 2022_
9
+
10
+ We'd like to offer a big thanks to the 3 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🐞 Bugfixes
13
+
14
+ ### `@mui/x-data-grid@v5.17.1` / `@mui/x-data-grid-pro@v5.17.1` / `@mui/x-data-grid-premium@v5.17.1`
15
+
16
+ #### Changes
17
+
18
+ - [DataGrid] Fix cells being focused on mouseUp (#5980) @cherniavskii
19
+ - [DataGrid] Fix focused cell if column is spanned and new editing API is used (#5962) @m4theushw
20
+ - [DataGridPro] Fix import in lazy-loading causing a bundling error (#6031) @flaviendelangle
21
+
22
+ ## 5.17.0
23
+
24
+ _Sep 2, 2022_
25
+
26
+ 🎉 We are excited to finally introduce a stable release (v5.0.0) for the `@mui/x-date-pickers` and `@mui/x-date-pickers-pro` packages!
27
+
28
+ If you are still using picker components from the `lab`, take a look at the [migration guide](https://mui.com/x/react-date-pickers/migration-lab/).
29
+
30
+ We'd like to offer a big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
31
+
32
+ - 🎁 Implement Lazy loading (#5214) @DanailH
33
+
34
+ Pro users now can try the experimental lazy loading feature.
35
+ In a few steps, you can load your data on demand, as the rows are displayed.
36
+
37
+ To enable this feature, add `experimentalFeatures={{ lazyLoading: true }}`.
38
+ Lazy Loading requires a few other settings.
39
+ See the [documentation](https://mui.com/x/react-data-grid/row-updates/#lazy-loading) to explore the example in detail.
40
+
41
+ - 🚀 Improve `pickers` focus management (#5820) @alexfauquette
42
+ - 🎉 Enable disabling `day` on date range picker depending on `position` (#5773) @alexfauquette
43
+ - ✨ Various improvements
44
+ - 📚 Documentation improvements
45
+ - 🐞 Bugfixes
46
+
47
+ ### `@mui/x-data-grid@v5.17.0` / `@mui/x-data-grid-pro@v5.17.0` / `@mui/x-data-grid-premium@v5.17.0`
48
+
49
+ #### Changes
50
+
51
+ - [DataGrid] Add `sort` prop to columns panel slot (#5888) @gavbrennan
52
+ - [DataGrid] Do not throw if `fieldToFocus` cannot be found (#5871) @cherniavskii
53
+ - [DataGrid] Support `getRowId` in the `replaceRows` method (#5988) @flaviendelangle
54
+ - [DataGridPro] Add class name to row with open detail panel (#5924) @m4theushw
55
+ - [DataGridPro] Fix crash when using `pinnedRows` + `getRowClassName` props and `rows=[]` (#5851) @cherniavskii
56
+ - [DataGridPro] Fix filtering with inactive filter items (#5993) @alexfauquette
57
+ - [DataGridPro] Implement Lazy loading (#5214) @DanailH
58
+ - [DataGridPro] Support pinned columns and dynamic row height (#5782) @m4theushw
59
+ - [DataGridPremium] Add state initializer for column groups (#5963) @alexfauquette
60
+ - [DataGridPremium] Update grouping when `groupingValueGetter` changes (#5919) @flaviendelangle
61
+ - [DataGridPremium] Use the aggregated value on tree data real groups (#5953) @flaviendelangle
62
+
63
+ ### `@mui/x-date-pickers@v5.0.0` / `@mui/x-date-pickers-pro@v5.0.0`
64
+
65
+ #### Changes
66
+
67
+ - [DatePicker] Improve focus management (#5820) @alexfauquette
68
+ - [DateRangePicker] Enable disabling `day` depending on `position` (#5773) @alexfauquette
69
+ - [DateTimePicker] Create a new `tabs` component slot (#5972) @LukasTy
70
+ - [pickers] Do not forward validation props to the DOM on field components (#5971) @flaviendelangle
71
+ - [pickers] Do not hardcode `date-fns` elements in field components (#5975) @flaviendelangle
72
+ - [pickers] Do not require `date-fns` in `@mui/x-date-pickers-pro` (#5941) @flaviendelangle
73
+ - [pickers] Fix mobile picker not opening on label click (#5651) @LukasTy
74
+ - [pickers] Improve DOM event management on `useField` (#5901) @flaviendelangle
75
+ - [pickers] Include `community` package `themeAugmentation` in `pro` package types (#5969) @LukasTy
76
+ - [pickers] Rename `DateRangeField` into `SingleInputDateRangeField` (#5961) @flaviendelangle
77
+ - [pickers] Support `isSameError` on field components (#5984) @flaviendelangle
78
+
79
+ ### Docs
80
+
81
+ - [docs] Add `description` and `default` to pickers slots (#5893) @alexfauquette
82
+ - [docs] Fix typo (#5945) @wettopa
83
+ - [docs] Fix typo `onYearPicker` to `onYearChange` (#5954) @alexfauquette
84
+ - [docs] Update `GridCellParams`'s `value` description (#5849) @cherniavskii
85
+ - [docs] Update `README.md` to match Introduction section of the docs (#5754) @samuelsycamore
86
+
87
+ ### Core
88
+
89
+ - [core] Fix typo (#5990) @flaviendelangle
90
+ - [core] Remove old babel resolve rule (#5939) @oliviertassinari
91
+ - [core] Remove outdated TODO (#5956) @flaviendelangle
92
+ - [core] Upgrade monorepo (#5960) @cherniavskii
93
+ - [core] Fix statics (#5986) @DanailH
94
+ - [core] Remove unused dependencies (#5937) @oliviertassinari
95
+ - [license] Remove CLI (#5757) @flaviendelangle
96
+ - [test] Fix time zone sensitive test (#5955) @LukasTy
97
+ - [test] Use `userEvent.mousePress` instead of `fireClickEvent` (#5920) @cherniavskii
98
+
99
+ ## 5.16.0
100
+
101
+ _Aug 25, 2022_
102
+
103
+ We'd like to offer a big thanks to the 11 contributors who made this release possible. Here are some highlights ✨:
104
+
105
+ - 🎁 Introduce column grouping for data grid (#5133) @alexfauquette
106
+
107
+ You can now group columns using the `columnGroupingModel` prop. This lets you to display more structured data.
108
+
109
+ <img src="https://user-images.githubusercontent.com/45398769/186178366-4fba66b2-bf90-4c7a-9d83-940a7fc78704.png" width="800" />
110
+
111
+ To enable this feature, add `experimentalFeatures={{ columnGrouping: true }}`.
112
+ The grouping header can be fully customized.
113
+ See the [documentation](https://mui.com/x/react-data-grid/column-groups/) to explore everything it has to offer.
114
+
115
+ - 🐞 Bugfixes
116
+ - 🌏 New locales for pickers thanks to @tesseractjh and @drastus
117
+
118
+ ### `@mui/x-data-grid@v5.16.0` / `@mui/x-data-grid-pro@v5.16.0` / `@mui/x-data-grid-premium@v5.16.0`
119
+
120
+ #### Changes
121
+
122
+ - [DataGrid] Implement column grouping (#5133) @alexfauquette
123
+ - [DataGrid] Handle `disableVirtualization` prop change (#5889) @cherniavskii
124
+ - [DataGrid] Improve `GridRowModel` typing (#5734) @cherniavskii
125
+ - [DataGrid] Update deprecation note for `GridColDef` `hide` property (#5886) @cherniavskii
126
+
127
+ ### `@mui/x-date-pickers@v5.0.0-beta.7` / `@mui/x-date-pickers-pro@v5.0.0-beta.7`
128
+
129
+ #### Changes
130
+
131
+ - [DatePicker] Fix to pass down `className` prop provided on DatePicker to `renderInput` (#5471) @CruseCtrl
132
+ - [DatePicker] Improve `a11y` support (#5809) @LukasTy
133
+ - [pickers] Add `PaperContent` component slot (#5801) @LukasTy
134
+ - [pickers] Add a breaking change section in the migration guide (#5805) @alexfauquette
135
+ - [pickers] Add new translations to `localeText` (#5143) @alexfauquette
136
+ - [pickers] Document components slots (#4657) @flaviendelangle
137
+ - [pickers] Add new unstable field components (#5504) @flaviendelangle
138
+ - [pickers] Fallback to default `minDate` / `maxDate` when `null` value is passed (#5397) @flaviendelangle
139
+ - [l10n] Add Korean (ko-KR) locale (#5854) @tesseractjh
140
+ - [l10n] Add Polish (pl-PL) locale (#5833) @drastus
141
+
142
+ ### Docs
143
+
144
+ - [docs] Fix typo in `migration from lab` (#5277) @chuckwired
145
+ - [docs] Use `dayjs` instead of `date-fns` in doc examples (#5481) @flaviendelangle
146
+
147
+ ### Core
148
+
149
+ - [core] Clarify the scope of the license key used for tests and documentation (#5824) @oliviertassinari
150
+ - [core] Fix Typescript error on field hooks (#5892) @flaviendelangle
151
+ - [core] Memoize `columns` in `useDemoData` hook (#5848) @cherniavskii
152
+ - [core] Remove Firefox from the BrowserStack list (#5874) @DanailH
153
+ - [core] Small changes to the release script (#5840) @m4theushw
154
+
6
155
  ## 5.15.3
7
156
 
8
157
  _Aug 18, 2022_
@@ -529,7 +678,7 @@ We'd like to offer a big thanks to the 15 contributors who made this release pos
529
678
 
530
679
  **MonthPicker**: The prop `onMonthChange` has been removed, you can use `onChange` instead since every change is a month change
531
680
 
532
- **YearPicker**: The prop `onYearPicker` has been removed, you can use `onChange` instead since every change is a year change
681
+ **YearPicker**: The prop `onYearChange` has been removed, you can use `onChange` instead since every change is a year change
533
682
 
534
683
  **DayPicker**: The prop `isDateDisabled` has been removed, you can now use the same validation props as for the other components (`maxDate`, `minDate`, `shouldDisableDate`, `disableFuture` and `disablePast`)
535
684
 
@@ -106,6 +106,7 @@ DataGridProRaw.propTypes = {
106
106
  * @default 3
107
107
  */
108
108
  columnBuffer: PropTypes.number,
109
+ columnGroupingModel: PropTypes.arrayOf(PropTypes.object),
109
110
 
110
111
  /**
111
112
  * Set of columns of type [[GridColumns]].
@@ -274,6 +275,8 @@ DataGridProRaw.propTypes = {
274
275
  * For each feature, if the flag is not explicitly set to `true`, the feature will be fully disabled and any property / method call will not have any effect.
275
276
  */
276
277
  experimentalFeatures: PropTypes.shape({
278
+ columnGrouping: PropTypes.bool,
279
+ lazyLoading: PropTypes.bool,
277
280
  newEditingApi: PropTypes.bool,
278
281
  preventCommitWhileValidating: PropTypes.bool,
279
282
  rowPinning: PropTypes.bool,
@@ -668,6 +671,14 @@ DataGridProRaw.propTypes = {
668
671
  */
669
672
  onError: PropTypes.func,
670
673
 
674
+ /**
675
+ * Callback fired when rowCount is set and the next batch of virtualized rows is rendered.
676
+ * @param {GridFetchRowsParams} params With all properties from [[GridFetchRowsParams]].
677
+ * @param {MuiEvent<{}>} event The event object.
678
+ * @param {GridCallbackDetails} details Additional details for this callback.
679
+ */
680
+ onFetchRows: PropTypes.func,
681
+
671
682
  /**
672
683
  * Callback fired when the Filter model changes before the filters are applied.
673
684
  * @param {GridFilterModel} model With all properties from [[GridFilterModel]].
@@ -913,6 +924,14 @@ DataGridProRaw.propTypes = {
913
924
  */
914
925
  rows: PropTypes.array.isRequired,
915
926
 
927
+ /**
928
+ * Loading rows can be processed on the server or client-side.
929
+ * Set it to 'client' if you would like enable infnite loading.
930
+ * Set it to 'server' if you would like to enable lazy loading.
931
+ * * @default "client"
932
+ */
933
+ rowsLoadingMode: PropTypes.oneOf(['client', 'server']),
934
+
916
935
  /**
917
936
  * Sets the type of space between rows added by `getRowSpacing`.
918
937
  * @default "margin"
@@ -1,4 +1,4 @@
1
- import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing_new, useGridEditing_old, editingStateInitializer_old, editingStateInitializer_new, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, useGridDimensions, useGridStatePersistence, useGridSelectionPreProcessors, useGridColumnSpanning, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, selectionStateInitializer } from '@mui/x-data-grid/internals';
1
+ import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing_new, useGridEditing_old, editingStateInitializer_old, editingStateInitializer_new, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, useGridDimensions, useGridStatePersistence, useGridSelectionPreProcessors, useGridColumnSpanning, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, selectionStateInitializer, useGridColumnGrouping, columnGroupsStateInitializer, useGridColumnGroupingPreProcessors } from '@mui/x-data-grid/internals';
2
2
  // Pro-only features
3
3
  import { useGridInfiniteLoader } from '../hooks/features/infiniteLoader/useGridInfiniteLoader';
4
4
  import { useGridColumnReorder, columnReorderStateInitializer } from '../hooks/features/columnReorder/useGridColumnReorder';
@@ -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 { useGridLazyLoader } from '../hooks/features/lazyLoader/useGridLazyLoader';
15
+ import { useGridLazyLoaderPreProcessors } from '../hooks/features/lazyLoader/useGridLazyLoaderPreProcessors';
14
16
  import { useGridRowPinning, rowPinningStateInitializer } from '../hooks/features/rowPinning/useGridRowPinning';
15
17
  import { useGridRowPinningPreProcessors } from '../hooks/features/rowPinning/useGridRowPinningPreProcessors';
16
18
  export const useDataGridProComponent = (inputApiRef, props) => {
@@ -21,9 +23,11 @@ export const useDataGridProComponent = (inputApiRef, props) => {
21
23
  * Register all pre-processors called during state initialization here.
22
24
  */
23
25
 
26
+ useGridColumnGroupingPreProcessors(apiRef, props);
24
27
  useGridSelectionPreProcessors(apiRef, props);
25
28
  useGridRowReorderPreProcessors(apiRef, props);
26
29
  useGridTreeDataPreProcessors(apiRef, props);
30
+ useGridLazyLoaderPreProcessors(apiRef, props);
27
31
  useGridRowPinningPreProcessors(apiRef);
28
32
  useGridDetailPanelPreProcessors(apiRef, props); // The column pinning `hydrateColumns` pre-processor must be after every other `hydrateColumns` pre-processors
29
33
  // Because it changes the order of the columns.
@@ -51,6 +55,7 @@ export const useDataGridProComponent = (inputApiRef, props) => {
51
55
  useGridInitializeState(paginationStateInitializer, apiRef, props);
52
56
  useGridInitializeState(rowsMetaStateInitializer, apiRef, props);
53
57
  useGridInitializeState(columnMenuStateInitializer, apiRef, props);
58
+ useGridInitializeState(columnGroupsStateInitializer, apiRef, props);
54
59
  useGridTreeData(apiRef);
55
60
  useGridKeyboardNavigation(apiRef, props);
56
61
  useGridSelection(apiRef, props);
@@ -61,6 +66,7 @@ export const useDataGridProComponent = (inputApiRef, props) => {
61
66
  useGridParamsApi(apiRef);
62
67
  useGridDetailPanel(apiRef, props);
63
68
  useGridColumnSpanning(apiRef);
69
+ useGridColumnGrouping(apiRef, props);
64
70
  const useGridEditing = (_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.newEditingApi ? useGridEditing_new : useGridEditing_old;
65
71
  useGridEditing(apiRef, props);
66
72
  useGridFocus(apiRef, props);
@@ -75,6 +81,7 @@ export const useDataGridProComponent = (inputApiRef, props) => {
75
81
  useGridRowReorder(apiRef, props);
76
82
  useGridScroll(apiRef, props);
77
83
  useGridInfiniteLoader(apiRef, props);
84
+ useGridLazyLoader(apiRef, props);
78
85
  useGridColumnMenu(apiRef);
79
86
  useGridCsvExport(apiRef);
80
87
  useGridPrintExport(apiRef, props);
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { useThemeProps } from '@mui/material/styles';
4
- import { DATA_GRID_DEFAULT_SLOTS_COMPONENTS, GRID_DEFAULT_LOCALE_TEXT, DATA_GRID_PROPS_DEFAULT_VALUES } from '@mui/x-data-grid';
4
+ import { DATA_GRID_DEFAULT_SLOTS_COMPONENTS, GRID_DEFAULT_LOCALE_TEXT, DATA_GRID_PROPS_DEFAULT_VALUES, GridFeatureModeConstant } from '@mui/x-data-grid';
5
5
 
6
6
  /**
7
7
  * The default values of `DataGridProPropsWithDefaultValue` to inject in the props of DataGridPro.
@@ -14,6 +14,7 @@ export const DATA_GRID_PRO_PROPS_DEFAULT_VALUES = _extends({}, DATA_GRID_PROPS_D
14
14
  disableChildrenFiltering: false,
15
15
  disableChildrenSorting: false,
16
16
  rowReordering: false,
17
+ rowsLoadingMode: GridFeatureModeConstant.client,
17
18
  getDetailPanelHeight: () => 500
18
19
  });
19
20
  export const useDataGridProProps = inProps => {
@@ -11,7 +11,6 @@ import { useGridRootProps } from '../hooks/utils/useGridRootProps';
11
11
  import { useGridApiContext } from '../hooks/utils/useGridApiContext';
12
12
  import { gridPinnedColumnsSelector, GridPinnedPosition } from '../hooks/features/columnPinning';
13
13
  import { filterColumns } from './DataGridProVirtualScroller';
14
- import { jsx as _jsx } from "react/jsx-runtime";
15
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
16
15
 
17
16
  const useUtilityClasses = ownerState => {
@@ -57,6 +56,7 @@ const GridColumnHeadersPinnedColumnHeaders = styled('div', {
57
56
  height: '100%',
58
57
  zIndex: 1,
59
58
  display: 'flex',
59
+ flexDirection: 'column',
60
60
  boxShadow: theme.shadows[2],
61
61
  backgroundColor: theme.palette.background.default
62
62
  }, theme.palette.mode === 'dark' && {
@@ -98,7 +98,8 @@ export const DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function D
98
98
  renderContext,
99
99
  getRootProps,
100
100
  getInnerProps,
101
- getColumns
101
+ getColumnHeaders,
102
+ getColumnGroupHeaders
102
103
  } = useGridColumnHeaders({
103
104
  innerRef,
104
105
  minColumnIndex: leftPinnedColumns.length
@@ -119,35 +120,42 @@ export const DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function D
119
120
  }) : null;
120
121
  const innerProps = getInnerProps();
121
122
  const pinnedColumnHeadersProps = {
122
- role: innerProps.role,
123
- 'aria-rowindex': innerProps['aria-rowindex']
123
+ role: innerProps.role
124
124
  };
125
125
  return /*#__PURE__*/_jsxs(GridColumnHeaders, _extends({
126
126
  ref: ref,
127
127
  className: className
128
128
  }, getRootProps(other), {
129
- children: [leftRenderContext && /*#__PURE__*/_jsx(GridColumnHeadersPinnedColumnHeaders, _extends({
129
+ children: [leftRenderContext && /*#__PURE__*/_jsxs(GridColumnHeadersPinnedColumnHeaders, _extends({
130
130
  className: classes.leftPinnedColumns,
131
131
  ownerState: {
132
132
  side: GridPinnedPosition.left
133
133
  }
134
134
  }, pinnedColumnHeadersProps, {
135
- children: getColumns({
135
+ children: [getColumnGroupHeaders({
136
+ renderContext: leftRenderContext,
137
+ minFirstColumn: leftRenderContext.firstColumnIndex,
138
+ maxLastColumn: leftRenderContext.lastColumnIndex
139
+ }), getColumnHeaders({
136
140
  renderContext: leftRenderContext,
137
141
  minFirstColumn: leftRenderContext.firstColumnIndex,
138
142
  maxLastColumn: leftRenderContext.lastColumnIndex
139
143
  }, {
140
144
  disableReorder: true
141
- })
142
- })), /*#__PURE__*/_jsx(GridColumnHeadersInner, _extends({
145
+ })]
146
+ })), /*#__PURE__*/_jsxs(GridColumnHeadersInner, _extends({
143
147
  isDragging: isDragging
144
148
  }, innerProps, {
145
- children: getColumns({
149
+ children: [getColumnGroupHeaders({
146
150
  renderContext,
147
151
  minFirstColumn: leftPinnedColumns.length,
148
152
  maxLastColumn: visibleColumnFields.length - rightPinnedColumns.length
149
- })
150
- })), rightRenderContext && /*#__PURE__*/_jsx(GridColumnHeadersPinnedColumnHeaders, _extends({
153
+ }), getColumnHeaders({
154
+ renderContext,
155
+ minFirstColumn: leftPinnedColumns.length,
156
+ maxLastColumn: visibleColumnFields.length - rightPinnedColumns.length
157
+ })]
158
+ })), rightRenderContext && /*#__PURE__*/_jsxs(GridColumnHeadersPinnedColumnHeaders, _extends({
151
159
  ownerState: {
152
160
  side: GridPinnedPosition.right
153
161
  },
@@ -156,14 +164,18 @@ export const DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function D
156
164
  paddingRight: scrollbarSize
157
165
  }
158
166
  }, pinnedColumnHeadersProps, {
159
- children: getColumns({
167
+ children: [getColumnGroupHeaders({
168
+ renderContext: rightRenderContext,
169
+ minFirstColumn: rightRenderContext.firstColumnIndex,
170
+ maxLastColumn: rightRenderContext.lastColumnIndex
171
+ }), getColumnHeaders({
160
172
  renderContext: rightRenderContext,
161
173
  minFirstColumn: rightRenderContext.firstColumnIndex,
162
174
  maxLastColumn: rightRenderContext.lastColumnIndex
163
175
  }, {
164
176
  disableReorder: true,
165
177
  separatorSide: GridColumnHeaderSeparatorSides.Left
166
- })
178
+ })]
167
179
  }))]
168
180
  }));
169
181
  });
@@ -274,17 +274,20 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
274
274
  const detailPanels = getDetailPanels();
275
275
  const topPinnedRows = getRows({
276
276
  renderContext,
277
- rows: topPinnedRowsData
277
+ rows: topPinnedRowsData,
278
+ position: 'center'
278
279
  });
279
280
  const pinnedRowsHeight = calculatePinnedRowsHeight(apiRef);
280
281
  const mainRows = getRows({
281
282
  renderContext,
282
- rowIndexOffset: topPinnedRowsData.length
283
+ rowIndexOffset: topPinnedRowsData.length,
284
+ position: 'center'
283
285
  });
284
286
  const bottomPinnedRows = getRows({
285
287
  renderContext,
286
288
  rows: bottomPinnedRowsData,
287
- rowIndexOffset: topPinnedRowsData.length + (mainRows ? mainRows.length : 0)
289
+ rowIndexOffset: topPinnedRowsData.length + (mainRows ? mainRows.length : 0),
290
+ position: 'center'
288
291
  });
289
292
  const contentProps = getContentProps();
290
293
  const pinnedColumnsStyle = {
@@ -316,8 +319,8 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
316
319
  minFirstColumn: leftRenderContext.firstColumnIndex,
317
320
  maxLastColumn: leftRenderContext.lastColumnIndex,
318
321
  availableSpace: 0,
319
- ignoreAutoHeight: true,
320
- rows: topPinnedRowsData
322
+ rows: topPinnedRowsData,
323
+ position: 'left'
321
324
  })
322
325
  }), /*#__PURE__*/_jsx(VirtualScrollerPinnedRowsRenderZone, {
323
326
  className: classes.pinnedRowsRenderZone,
@@ -333,9 +336,9 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
333
336
  renderContext: rightRenderContext,
334
337
  minFirstColumn: rightRenderContext.firstColumnIndex,
335
338
  maxLastColumn: rightRenderContext.lastColumnIndex,
336
- ignoreAutoHeight: true,
337
339
  availableSpace: 0,
338
- rows: topPinnedRowsData
340
+ rows: topPinnedRowsData,
341
+ position: 'right'
339
342
  })
340
343
  })]
341
344
  }) : null, /*#__PURE__*/_jsxs(GridVirtualScrollerContent, _extends({}, contentProps, {
@@ -351,8 +354,8 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
351
354
  minFirstColumn: leftRenderContext.firstColumnIndex,
352
355
  maxLastColumn: leftRenderContext.lastColumnIndex,
353
356
  availableSpace: 0,
354
- ignoreAutoHeight: true,
355
- rowIndexOffset: topPinnedRowsData.length
357
+ rowIndexOffset: topPinnedRowsData.length,
358
+ position: 'left'
356
359
  })
357
360
  }), /*#__PURE__*/_jsx(GridVirtualScrollerRenderZone, _extends({}, getRenderZoneProps(), {
358
361
  children: mainRows
@@ -368,8 +371,8 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
368
371
  minFirstColumn: rightRenderContext.firstColumnIndex,
369
372
  maxLastColumn: rightRenderContext.lastColumnIndex,
370
373
  availableSpace: 0,
371
- ignoreAutoHeight: true,
372
- rowIndexOffset: topPinnedRowsData.length
374
+ rowIndexOffset: topPinnedRowsData.length,
375
+ position: 'right'
373
376
  })
374
377
  }), detailPanels.length > 0 && /*#__PURE__*/_jsx(VirtualScrollerDetailPanels, {
375
378
  className: classes.detailPanels,
@@ -395,9 +398,9 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
395
398
  minFirstColumn: leftRenderContext.firstColumnIndex,
396
399
  maxLastColumn: leftRenderContext.lastColumnIndex,
397
400
  availableSpace: 0,
398
- ignoreAutoHeight: true,
399
401
  rows: bottomPinnedRowsData,
400
- rowIndexOffset: topPinnedRowsData.length + (mainRows ? mainRows.length : 0)
402
+ rowIndexOffset: topPinnedRowsData.length + (mainRows ? mainRows.length : 0),
403
+ position: 'left'
401
404
  })
402
405
  }), /*#__PURE__*/_jsx(VirtualScrollerPinnedRowsRenderZone, {
403
406
  className: classes.pinnedRowsRenderZone,
@@ -414,9 +417,9 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
414
417
  minFirstColumn: rightRenderContext.firstColumnIndex,
415
418
  maxLastColumn: rightRenderContext.lastColumnIndex,
416
419
  availableSpace: 0,
417
- ignoreAutoHeight: true,
418
420
  rows: bottomPinnedRowsData,
419
- rowIndexOffset: topPinnedRowsData.length + (mainRows ? mainRows.length : 0)
421
+ rowIndexOffset: topPinnedRowsData.length + (mainRows ? mainRows.length : 0),
422
+ position: 'right'
420
423
  })
421
424
  })]
422
425
  }) : null]
@@ -129,7 +129,8 @@ process.env.NODE_ENV !== "production" ? GridDetailPanelToggleCell.propTypes = {
129
129
  tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
130
130
 
131
131
  /**
132
- * The cell value, but if the column has valueGetter, use getValue.
132
+ * The cell value.
133
+ * If the column has `valueGetter`, use `params.row` to directly access the fields.
133
134
  */
134
135
  value: PropTypes.any
135
136
  } : void 0;
@@ -164,7 +164,8 @@ process.env.NODE_ENV !== "production" ? GridTreeDataGroupingCell.propTypes = {
164
164
  tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
165
165
 
166
166
  /**
167
- * The cell value, but if the column has valueGetter, use getValue.
167
+ * The cell value.
168
+ * If the column has `valueGetter`, use `params.row` to directly access the fields.
168
169
  */
169
170
  value: PropTypes.any
170
171
  } : void 0;
@@ -39,6 +39,7 @@ export const useGridColumnReorder = (apiRef, props) => {
39
39
  y: 0
40
40
  });
41
41
  const originColumnIndex = React.useRef(null);
42
+ const forbiddenIndexes = React.useRef({});
42
43
  const removeDnDStylesTimeout = React.useRef();
43
44
  const ownerState = {
44
45
  classes: props.classes
@@ -70,6 +71,69 @@ export const useGridColumnReorder = (apiRef, props) => {
70
71
  dragColNode.current.classList.remove(classes.columnHeaderDragging);
71
72
  });
72
73
  originColumnIndex.current = apiRef.current.getColumnIndex(params.field, false);
74
+ const draggingColumnGroupPath = apiRef.current.unstable_getColumnGroupPath(params.field);
75
+ const columnIndex = originColumnIndex.current;
76
+ const allColumns = apiRef.current.getAllColumns();
77
+ const groupsLookup = apiRef.current.unstable_getAllGroupDetails(); // The limitingGroupId is the id of the group from which the dragged column should not escape
78
+
79
+ let limitingGroupId = null;
80
+ draggingColumnGroupPath.forEach(groupId => {
81
+ var _groupsLookup$groupId;
82
+
83
+ if (!((_groupsLookup$groupId = groupsLookup[groupId]) != null && _groupsLookup$groupId.freeReordering)) {
84
+ var _allColumns$groupPath, _allColumns$groupPath2;
85
+
86
+ // Only consider group that are made of more than one column
87
+ if (columnIndex > 0 && (_allColumns$groupPath = allColumns[columnIndex - 1].groupPath) != null && _allColumns$groupPath.includes(groupId)) {
88
+ limitingGroupId = groupId;
89
+ } else if (columnIndex + 1 < allColumns.length && (_allColumns$groupPath2 = allColumns[columnIndex + 1].groupPath) != null && _allColumns$groupPath2.includes(groupId)) {
90
+ limitingGroupId = groupId;
91
+ }
92
+ }
93
+ });
94
+ forbiddenIndexes.current = {};
95
+
96
+ for (let indexToForbid = 0; indexToForbid < allColumns.length; indexToForbid += 1) {
97
+ const leftIndex = indexToForbid <= columnIndex ? indexToForbid - 1 : indexToForbid;
98
+ const rightIndex = indexToForbid < columnIndex ? indexToForbid : indexToForbid + 1;
99
+
100
+ if (limitingGroupId !== null) {
101
+ var _allColumns$leftIndex, _allColumns$rightInde;
102
+
103
+ // verify this indexToForbid will be linked to the limiting group. Otherwise forbid it
104
+ let allowIndex = false;
105
+
106
+ if (leftIndex >= 0 && (_allColumns$leftIndex = allColumns[leftIndex].groupPath) != null && _allColumns$leftIndex.includes(limitingGroupId)) {
107
+ allowIndex = true;
108
+ } else if (rightIndex < allColumns.length && (_allColumns$rightInde = allColumns[rightIndex].groupPath) != null && _allColumns$rightInde.includes(limitingGroupId)) {
109
+ allowIndex = true;
110
+ }
111
+
112
+ if (!allowIndex) {
113
+ forbiddenIndexes.current[indexToForbid] = true;
114
+ }
115
+ } // Verify we are not splitting another group
116
+
117
+
118
+ if (leftIndex >= 0 && rightIndex < allColumns.length) {
119
+ var _allColumns$rightInde2, _allColumns$rightInde3;
120
+
121
+ (_allColumns$rightInde2 = allColumns[rightIndex]) == null ? void 0 : (_allColumns$rightInde3 = _allColumns$rightInde2.groupPath) == null ? void 0 : _allColumns$rightInde3.forEach(groupId => {
122
+ var _allColumns$leftIndex2;
123
+
124
+ if ((_allColumns$leftIndex2 = allColumns[leftIndex].groupPath) != null && _allColumns$leftIndex2.includes(groupId)) {
125
+ if (!draggingColumnGroupPath.includes(groupId)) {
126
+ var _groupsLookup$groupId2;
127
+
128
+ // moving here split the group groupId in two distincts chunks
129
+ if (!((_groupsLookup$groupId2 = groupsLookup[groupId]) != null && _groupsLookup$groupId2.freeReordering)) {
130
+ forbiddenIndexes.current[indexToForbid] = true;
131
+ }
132
+ }
133
+ }
134
+ });
135
+ }
136
+ }
73
137
  }, [props.disableColumnReorder, classes.columnHeaderDragging, logger, apiRef]);
74
138
  const handleDragEnter = React.useCallback((params, event) => {
75
139
  event.preventDefault(); // Prevent drag events propagation.
@@ -100,19 +164,47 @@ export const useGridColumnReorder = (apiRef, props) => {
100
164
  const targetCol = apiRef.current.getColumn(params.field);
101
165
  const dragColIndex = apiRef.current.getColumnIndex(dragColField, false);
102
166
  const visibleColumns = apiRef.current.getVisibleColumns();
167
+ const allColumns = apiRef.current.getAllColumns();
103
168
  const cursorMoveDirectionX = getCursorMoveDirectionX(cursorPosition.current, coordinates);
104
169
  const hasMovedLeft = cursorMoveDirectionX === CURSOR_MOVE_DIRECTION_LEFT && targetColIndex < dragColIndex;
105
170
  const hasMovedRight = cursorMoveDirectionX === CURSOR_MOVE_DIRECTION_RIGHT && dragColIndex < targetColIndex;
106
171
 
107
172
  if (hasMovedLeft || hasMovedRight) {
108
173
  let canBeReordered;
174
+ let indexOffsetInHiddenColumns = 0;
109
175
 
110
176
  if (!targetCol.disableReorder) {
111
177
  canBeReordered = true;
112
178
  } else if (hasMovedLeft) {
113
- canBeReordered = targetColIndex > 0 && !visibleColumns[targetColIndex - 1].disableReorder;
179
+ canBeReordered = targetColVisibleIndex > 0 && !visibleColumns[targetColVisibleIndex - 1].disableReorder;
114
180
  } else {
115
- canBeReordered = targetColIndex < visibleColumns.length - 1 && !visibleColumns[targetColIndex + 1].disableReorder;
181
+ canBeReordered = targetColVisibleIndex < visibleColumns.length - 1 && !visibleColumns[targetColVisibleIndex + 1].disableReorder;
182
+ }
183
+
184
+ if (forbiddenIndexes.current[targetColIndex]) {
185
+ let nextVisibleColumnField;
186
+ let indexWithOffset = targetColIndex + indexOffsetInHiddenColumns;
187
+
188
+ if (hasMovedLeft) {
189
+ nextVisibleColumnField = targetColVisibleIndex > 0 ? visibleColumns[targetColVisibleIndex - 1].field : null;
190
+
191
+ while (indexWithOffset > 0 && allColumns[indexWithOffset].field !== nextVisibleColumnField && forbiddenIndexes.current[indexWithOffset]) {
192
+ indexOffsetInHiddenColumns -= 1;
193
+ indexWithOffset = targetColIndex + indexOffsetInHiddenColumns;
194
+ }
195
+ } else {
196
+ nextVisibleColumnField = targetColVisibleIndex + 1 < visibleColumns.length ? visibleColumns[targetColVisibleIndex + 1].field : null;
197
+
198
+ while (indexWithOffset < allColumns.length - 1 && allColumns[indexWithOffset].field !== nextVisibleColumnField && forbiddenIndexes.current[indexWithOffset]) {
199
+ indexOffsetInHiddenColumns += 1;
200
+ indexWithOffset = targetColIndex + indexOffsetInHiddenColumns;
201
+ }
202
+ }
203
+
204
+ if (forbiddenIndexes.current[indexWithOffset] || allColumns[indexWithOffset].field === nextVisibleColumnField) {
205
+ // If we ended up on a visible column, or a forbidden one, we can not do the reorder
206
+ canBeReordered = false;
207
+ }
116
208
  }
117
209
 
118
210
  const canBeReorderedProcessed = apiRef.current.unstable_applyPipeProcessors('canBeReordered', canBeReordered, {
@@ -120,7 +212,7 @@ export const useGridColumnReorder = (apiRef, props) => {
120
212
  });
121
213
 
122
214
  if (canBeReorderedProcessed) {
123
- apiRef.current.setColumnIndex(dragColField, targetColIndex);
215
+ apiRef.current.setColumnIndex(dragColField, targetColIndex + indexOffsetInHiddenColumns);
124
216
  }
125
217
  }
126
218