@mui/x-data-grid 7.1.1 → 7.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/CHANGELOG.md +211 -0
  2. package/DataGrid/DataGrid.js +19 -0
  3. package/components/GridPagination.d.ts +4 -1
  4. package/components/GridPagination.js +60 -9
  5. package/components/GridRow.js +4 -1
  6. package/components/GridScrollArea.js +1 -1
  7. package/components/cell/GridCell.d.ts +1 -0
  8. package/components/cell/GridCell.js +4 -2
  9. package/components/columnHeaders/GridColumnGroupHeader.d.ts +1 -0
  10. package/components/columnHeaders/GridColumnGroupHeader.js +3 -2
  11. package/components/columnHeaders/GridColumnHeaderItem.d.ts +2 -0
  12. package/components/columnHeaders/GridColumnHeaderItem.js +9 -4
  13. package/components/containers/GridRootStyles.js +8 -4
  14. package/components/index.d.ts +1 -1
  15. package/components/index.js +1 -1
  16. package/components/panel/GridPanel.js +3 -1
  17. package/components/panel/filterPanel/GridFilterInputDate.js +5 -1
  18. package/constants/gridClasses.d.ts +11 -2
  19. package/constants/gridClasses.js +1 -1
  20. package/hooks/core/useGridInitialization.js +1 -1
  21. package/hooks/core/useGridStateInitialization.d.ts +1 -2
  22. package/hooks/core/useGridStateInitialization.js +6 -10
  23. package/hooks/features/columnHeaders/useGridColumnHeaders.js +9 -5
  24. package/hooks/features/columnResize/useGridColumnResize.js +75 -61
  25. package/hooks/features/columns/gridColumnsUtils.d.ts +2 -1
  26. package/hooks/features/columns/gridColumnsUtils.js +4 -3
  27. package/hooks/features/density/useGridDensity.d.ts +1 -1
  28. package/hooks/features/density/useGridDensity.js +30 -4
  29. package/hooks/features/dimensions/gridDimensionsApi.d.ts +5 -1
  30. package/hooks/features/dimensions/useGridDimensions.d.ts +1 -1
  31. package/hooks/features/dimensions/useGridDimensions.js +5 -2
  32. package/hooks/features/editing/useGridCellEditing.js +17 -2
  33. package/hooks/features/editing/useGridRowEditing.js +3 -1
  34. package/hooks/features/export/serializers/csvSerializer.js +6 -5
  35. package/hooks/features/export/useGridPrintExport.d.ts +1 -1
  36. package/hooks/features/export/useGridPrintExport.js +2 -2
  37. package/hooks/features/headerFiltering/useGridHeaderFiltering.d.ts +2 -2
  38. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +2 -2
  39. package/hooks/features/pagination/gridPaginationInterfaces.d.ts +14 -2
  40. package/hooks/features/pagination/gridPaginationSelector.d.ts +5 -0
  41. package/hooks/features/pagination/gridPaginationSelector.js +7 -1
  42. package/hooks/features/pagination/gridPaginationUtils.d.ts +1 -2
  43. package/hooks/features/pagination/gridPaginationUtils.js +5 -3
  44. package/hooks/features/pagination/useGridPagination.d.ts +1 -1
  45. package/hooks/features/pagination/useGridPagination.js +5 -1
  46. package/hooks/features/pagination/useGridPaginationMeta.d.ts +4 -0
  47. package/hooks/features/pagination/useGridPaginationMeta.js +77 -0
  48. package/hooks/features/pagination/useGridPaginationModel.js +2 -1
  49. package/hooks/features/pagination/useGridRowCount.d.ts +0 -4
  50. package/hooks/features/pagination/useGridRowCount.js +32 -18
  51. package/hooks/utils/useGridSelector.d.ts +1 -1
  52. package/index.js +1 -1
  53. package/internals/index.d.ts +1 -1
  54. package/internals/utils/propValidation.js +1 -1
  55. package/locales/daDK.js +3 -4
  56. package/locales/deDE.js +3 -4
  57. package/locales/frFR.js +5 -6
  58. package/locales/svSE.js +3 -4
  59. package/models/api/gridApiCommon.d.ts +1 -1
  60. package/models/api/gridCallbackDetails.d.ts +5 -0
  61. package/models/api/gridLocaleTextApi.d.ts +7 -3
  62. package/models/api/index.d.ts +1 -1
  63. package/models/api/index.js +0 -1
  64. package/models/events/gridEventLookup.d.ts +7 -1
  65. package/models/gridPaginationProps.d.ts +3 -0
  66. package/models/props/DataGridProps.d.ts +26 -8
  67. package/modern/DataGrid/DataGrid.js +19 -0
  68. package/modern/components/GridPagination.js +60 -9
  69. package/modern/components/GridRow.js +4 -1
  70. package/modern/components/GridScrollArea.js +1 -1
  71. package/modern/components/cell/GridCell.js +4 -2
  72. package/modern/components/columnHeaders/GridColumnGroupHeader.js +3 -2
  73. package/modern/components/columnHeaders/GridColumnHeaderItem.js +9 -4
  74. package/modern/components/containers/GridRootStyles.js +8 -4
  75. package/modern/components/index.js +1 -1
  76. package/modern/components/panel/GridPanel.js +3 -1
  77. package/modern/components/panel/filterPanel/GridFilterInputDate.js +5 -1
  78. package/modern/constants/gridClasses.js +1 -1
  79. package/modern/hooks/core/useGridInitialization.js +1 -1
  80. package/modern/hooks/core/useGridStateInitialization.js +6 -10
  81. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +9 -5
  82. package/modern/hooks/features/columnResize/useGridColumnResize.js +75 -61
  83. package/modern/hooks/features/columns/gridColumnsUtils.js +4 -3
  84. package/modern/hooks/features/density/useGridDensity.js +30 -4
  85. package/modern/hooks/features/dimensions/useGridDimensions.js +5 -2
  86. package/modern/hooks/features/editing/useGridCellEditing.js +17 -2
  87. package/modern/hooks/features/editing/useGridRowEditing.js +3 -1
  88. package/modern/hooks/features/export/serializers/csvSerializer.js +6 -5
  89. package/modern/hooks/features/export/useGridPrintExport.js +2 -2
  90. package/modern/hooks/features/pagination/gridPaginationSelector.js +7 -1
  91. package/modern/hooks/features/pagination/gridPaginationUtils.js +5 -3
  92. package/modern/hooks/features/pagination/useGridPagination.js +5 -1
  93. package/modern/hooks/features/pagination/useGridPaginationMeta.js +77 -0
  94. package/modern/hooks/features/pagination/useGridPaginationModel.js +2 -1
  95. package/modern/hooks/features/pagination/useGridRowCount.js +32 -18
  96. package/modern/index.js +1 -1
  97. package/modern/internals/utils/propValidation.js +1 -1
  98. package/modern/locales/daDK.js +3 -4
  99. package/modern/locales/deDE.js +3 -4
  100. package/modern/locales/frFR.js +5 -6
  101. package/modern/locales/svSE.js +3 -4
  102. package/modern/models/api/index.js +0 -1
  103. package/modern/utils/cellBorderUtils.js +15 -2
  104. package/node/DataGrid/DataGrid.js +19 -0
  105. package/node/components/GridPagination.js +59 -8
  106. package/node/components/GridRow.js +4 -1
  107. package/node/components/GridScrollArea.js +1 -1
  108. package/node/components/cell/GridCell.js +4 -2
  109. package/node/components/columnHeaders/GridColumnGroupHeader.js +3 -2
  110. package/node/components/columnHeaders/GridColumnHeaderItem.js +8 -3
  111. package/node/components/containers/GridRootStyles.js +8 -4
  112. package/node/components/index.js +27 -10
  113. package/node/components/panel/GridPanel.js +3 -1
  114. package/node/components/panel/filterPanel/GridFilterInputDate.js +5 -1
  115. package/node/constants/gridClasses.js +1 -1
  116. package/node/hooks/core/useGridInitialization.js +1 -1
  117. package/node/hooks/core/useGridStateInitialization.js +6 -10
  118. package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +9 -5
  119. package/node/hooks/features/columnResize/useGridColumnResize.js +76 -62
  120. package/node/hooks/features/columns/gridColumnsUtils.js +4 -3
  121. package/node/hooks/features/density/useGridDensity.js +30 -4
  122. package/node/hooks/features/dimensions/useGridDimensions.js +5 -2
  123. package/node/hooks/features/editing/useGridCellEditing.js +17 -2
  124. package/node/hooks/features/editing/useGridRowEditing.js +3 -1
  125. package/node/hooks/features/export/serializers/csvSerializer.js +6 -5
  126. package/node/hooks/features/export/useGridPrintExport.js +2 -2
  127. package/node/hooks/features/pagination/gridPaginationSelector.js +8 -2
  128. package/node/hooks/features/pagination/gridPaginationUtils.js +6 -4
  129. package/node/hooks/features/pagination/useGridPagination.js +5 -1
  130. package/node/hooks/features/pagination/useGridPaginationMeta.js +87 -0
  131. package/node/hooks/features/pagination/useGridPaginationModel.js +2 -1
  132. package/node/hooks/features/pagination/useGridRowCount.js +30 -15
  133. package/node/index.js +1 -1
  134. package/node/internals/utils/propValidation.js +1 -1
  135. package/node/locales/daDK.js +3 -4
  136. package/node/locales/deDE.js +3 -4
  137. package/node/locales/frFR.js +5 -6
  138. package/node/locales/svSE.js +3 -4
  139. package/node/models/api/index.js +0 -11
  140. package/node/utils/cellBorderUtils.js +15 -2
  141. package/package.json +1 -1
  142. package/themeAugmentation/overrides.d.ts +6 -0
  143. package/utils/cellBorderUtils.d.ts +1 -1
  144. package/utils/cellBorderUtils.js +15 -2
  145. package/utils/getGridLocalization.d.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,167 @@
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
+ ## 7.3.0
7
+
8
+ _Apr 18, 2024_
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
+ - 📄 Support [unknown and estimated row count in server-side pagination](https://mui.com/x/react-data-grid/pagination/#index-based-pagination) (#12490) @MBilalShafi
13
+ - 🎨 Support color scales in Charts (#12490) @alexfauquette
14
+ Add a [`colorMap` configuration](https://mui.com/x/react-charts/styling/#values-color) to an axis, and the chart will use it to select colors.
15
+ Each impacted chart ([bar charts](https://mui.com/x/react-charts/bars/#color-scale), [line charts](https://mui.com/x/react-charts/lines/#color-scale), [scatter charts](https://mui.com/x/react-charts/scatter/#color-scale)) has a dedicated section explaining how this color map is impacting it.
16
+
17
+ <img src="https://github.com/mui/mui-x/assets/45398769/f0066606-3486-4c4e-b3be-7fdd56d763c3" alt="scatter chart with gradient along y-axis" />
18
+
19
+ - 🌍 Improve Danish (da-DK) locale on the Data Grid
20
+ - 🐞 Bugfixes
21
+ - 📚 Documentation improvements
22
+
23
+ ### Data Grid
24
+
25
+ #### `@mui/x-data-grid@7.3.0`
26
+
27
+ - [DataGrid] Fix calling `onCellEditStop` on error (#12747) @sai6855
28
+ - [DataGrid] Fix column resize (#12792) @romgrk
29
+ - [DataGrid] Fix column separators (#12808) @romgrk
30
+ - [DataGrid] Limit panel width to not exceed screen width (#12799) @cherniavskii
31
+ - [DataGrid] Support advanced server-side pagination use cases (#12474) @MBilalShafi
32
+ - [DataGrid] Support state export and restore on grid density (#12671) @MBilalShafi
33
+ - [l10n] Improve Danish (da-DK) locale (#12784) @EmilBahnsen
34
+
35
+ #### `@mui/x-data-grid-pro@7.3.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
36
+
37
+ Same changes as in `@mui/x-data-grid@7.3.0`, plus:
38
+
39
+ - [DataGridPro] Implement header filter height (#12666) @romgrk
40
+
41
+ #### `@mui/x-data-grid-premium@7.3.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
42
+
43
+ Same changes as in `@mui/x-data-grid-pro@7.3.0`.
44
+
45
+ ### Charts
46
+
47
+ #### Breaking change
48
+
49
+ A typo fix:
50
+
51
+ ```diff
52
+ - ContinuouseScaleName
53
+ + ContinuousScaleName
54
+ ```
55
+
56
+ #### `@mui/x-charts@7.3.0`
57
+
58
+ - [charts] Add `dataIndex` to series `valueFormatter` (#12745) @JCQuintas
59
+ - [charts] Add color scale (#12490) @alexfauquette
60
+ - [charts] Do not document the usage of `DEFAULT_X_AXIS_KEY` and `DEFAULT_Y_AXIS_KEY` (#12780) @alexfauquette
61
+ - [charts] Export more utils (#12744) @alexfauquette
62
+ - [charts] Fix passing slot props down to `PieArcLabel` (#12806) @JCQuintas
63
+
64
+ ### Tree View
65
+
66
+ #### `@mui/x-tree-view@7.3.0`
67
+
68
+ - [TreeView] Support `defaultMuiPrevented` on the `onFocus` prop of the root slot (#12813) @flaviendelangle
69
+
70
+ ### Docs
71
+
72
+ - [docs] Add grid cell display example to the migration guide (#12793) @romgrk
73
+ - [docs] Use charts classes objects (#12781) @alexfauquette
74
+ - [docs] Fix layout shift on demos (#12816) @zanivan
75
+ - [test] Increase timeout for test that sometimes fail on `DateTimeRangePicker` (#12786) @LukasTy
76
+
77
+ ### Core
78
+
79
+ - [docs-infra] Prepare infra to document charts interfaces (#12653) @alexfauquette
80
+
81
+ ## 7.2.0
82
+
83
+ _Apr 12, 2024_
84
+
85
+ We'd like to offer a big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:
86
+
87
+ - 🎨 Make grid colors customizable through the MUI themes API
88
+ - 🌍 Improve French (fr-FR), German (de-DE), and Swedish (sv-SE) locales on the Data Grid and Pickers
89
+ - 🐞 Bugfixes
90
+ - 📚 Documentation improvements
91
+
92
+ ### Data Grid
93
+
94
+ #### `@mui/x-data-grid@7.2.0`
95
+
96
+ - [DataGrid] Add missing `api` property to `GridCallbackDetails` (#12742) @sai6855
97
+ - [DataGrid] Do not escape double quotes when copying to clipboard (#12722) @cherniavskii
98
+ - [DataGrid] Fix column vertical border (#12741) @romgrk
99
+ - [DataGrid] Fix invalid date error when filtering `date`/`dateTime` columns (#12709) @cherniavskii
100
+ - [DataGrid] Fix overflow with dynamic row height (#12683) @romgrk
101
+ - [DataGrid] Make colors customizable (#12614) @romgrk
102
+ - [l10n] Improve French (fr-FR) locale (#12755) @derek-0000
103
+ - [l10n] Improve German (de-DE) locale (#12752) @Jens-Schoen
104
+ - [l10n] Improve Swedish (sv-SE) locale (#12731) @pontusdacke
105
+
106
+ #### `@mui/x-data-grid-pro@7.2.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
107
+
108
+ Same changes as in `@mui/x-data-grid@7.2.0`.
109
+
110
+ #### `@mui/x-data-grid-premium@7.2.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
111
+
112
+ Same changes as in `@mui/x-data-grid-pro@7.2.0`, plus:
113
+
114
+ - [DataGridPremium] Fix clipboard paste not working when cell loses focus (#12724) @cherniavskii
115
+
116
+ ### Date and Time Pickers
117
+
118
+ #### `@mui/x-date-pickers@7.2.0`
119
+
120
+ - [fields] Fix field editing after closing the picker (#12675) @LukasTy
121
+ - [l10n] Improve French (fr-FR) locale (#12692) @FaroukBel
122
+ - [l10n] Improve German (de-DE) locale (#12752) @Jens-Schoen
123
+ - [l10n] Improve Swedish (sv-SE) locale (#12731) @pontusdacke
124
+ - [pickers] Fix desktop date time Pickers grid layout (#12748) @LukasTy
125
+
126
+ #### `@mui/x-date-pickers-pro@7.2.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
127
+
128
+ Same changes as in `@mui/x-date-pickers@7.2.0`, plus:
129
+
130
+ - [DateTimeRangePicker] Fix desktop toolbar style (#12760) @LukasTy
131
+
132
+ ### Charts
133
+
134
+ #### `@mui/x-charts@7.2.0`
135
+
136
+ - [charts] Fix Bar chart with empty dataset throwing an error (#12708) @JCQuintas
137
+ - [charts] Fix `tickLabelInterval` not working on `YAxis` (#12746) @JCQuintas
138
+
139
+ ### Tree View
140
+
141
+ #### `@mui/x-tree-view@7.2.0`
142
+
143
+ - [TreeView] Add a new lookup to access an item index without expansive computation (#12729) @flaviendelangle
144
+ - [TreeView] Clean up usage of term "node" in internals (#12655) @noraleonte
145
+ - [TreeView] Improve performance by removing `getNavigableChildrenIds` method (#12713) @flaviendelangle
146
+ - [TreeView] Remove `state.items.itemTree` (#12717) @flaviendelangle
147
+ - [TreeView] Remove remaining occurences of the word "node" in the codebase (#12712) @flaviendelangle
148
+ - [TreeView] Return `instance` and `publicAPI` methods from plugin and populate the main objects inside `useTreeView` (#12650) @flaviendelangle
149
+ - [TreeView] Fix behaviors when the item order changes (#12369) @flaviendelangle
150
+
151
+ ### Docs
152
+
153
+ - [docs] Add `AxisFormatter` documentation for customizing tick/tooltip value formatting (#12700) @JCQuintas
154
+ - [docs] Add file explorer example to rich tree view customization docs (#12707) @noraleonte
155
+ - [docs] Do not use import of depth 3 in the doc (#12716) @flaviendelangle
156
+ - [docs] Explain how to clip plots with composition (#12679) @alexfauquette
157
+ - [docs] Fix typo in Data Grid v7 migration page (#12720) @bfaulk96
158
+ - [docs] Fix typo in Pickers v7 migration page (#12721) @bfaulk96
159
+
160
+ ### Core
161
+
162
+ - [core] Support multiple resolved `l10n` PR packages (#12735) @LukasTy
163
+ - [core] Update Netlify release references in release README (#12687) @LukasTy
164
+ - [core] Use `describeTreeView` for icons tests (#12672) @flaviendelangle
165
+ - [core] Use `describeTreeView` in existing tests for `useTreeViewItems` (#12732) @flaviendelangle
166
+
6
167
  ## 7.1.1
7
168
 
8
169
  _Apr 5, 2024_
@@ -2972,6 +3133,56 @@ Here is an example of the renaming for the `<ChartsTooltip />` component.
2972
3133
  - [core] Update release instructions as per v7 configuration (#10962) @MBilalShafi
2973
3134
  - [license] Correctly throw errors (#10924) @oliviertassinari
2974
3135
 
3136
+ ## 6.19.11
3137
+
3138
+ _Apr 18, 2024_
3139
+
3140
+ We'd like to offer a big thanks to the 1 contributor who made this release possible. Here are some highlights ✨:
3141
+
3142
+ - 🐞 Bugfixes
3143
+
3144
+ ### Data Grid
3145
+
3146
+ #### `@mui/x-data-grid@6.19.11`
3147
+
3148
+ - [DataGrid] Fix virtualization memory leak (#12812) @romgrk
3149
+
3150
+ #### `@mui/x-data-grid-pro@6.19.11` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
3151
+
3152
+ Same changes as in `@mui/x-data-grid@6.19.11`.
3153
+
3154
+ #### `@mui/x-data-grid-premium@6.19.11` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
3155
+
3156
+ Same changes as in `@mui/x-data-grid-pro@6.19.11`.
3157
+
3158
+ ## 6.19.10
3159
+
3160
+ _Apr 12, 2024_
3161
+
3162
+ We'd like to offer a big thanks to the 2 contributors who made this release possible. Here are some highlights ✨:
3163
+
3164
+ - 🐞 Bugfixes
3165
+ - 📚 Documentation improvements
3166
+
3167
+ ### Data Grid
3168
+
3169
+ #### `@mui/x-data-grid@6.19.10`
3170
+
3171
+ - [DataGrid] Do not escape double quotes when copying to clipboard (#12734) @cherniavskii
3172
+ - [DataGrid] Fix bug in suspense (#12754) @cherniavskii
3173
+
3174
+ #### `@mui/x-data-grid-pro@6.19.10` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
3175
+
3176
+ Same changes as in `@mui/x-data-grid@6.19.10`.
3177
+
3178
+ #### `@mui/x-data-grid-premium@6.19.10` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
3179
+
3180
+ Same changes as in `@mui/x-data-grid-pro@6.19.10`.
3181
+
3182
+ ### Core
3183
+
3184
+ - [core] Update the docs release source branch (#12685) @LukasTy
3185
+
2975
3186
  ## 6.19.9
2976
3187
 
2977
3188
  _Apr 5, 2024_
@@ -186,6 +186,12 @@ DataGridRaw.propTypes = {
186
186
  * @default "cell"
187
187
  */
188
188
  editMode: PropTypes.oneOf(['cell', 'row']),
189
+ /**
190
+ * Use if the actual rowCount is not known upfront, but an estimation is available.
191
+ * If some rows have children (for instance in the tree data), this number represents the amount of top level rows.
192
+ * Applicable only with `paginationMode="server"` and when `rowCount="-1"`
193
+ */
194
+ estimatedRowCount: PropTypes.number,
189
195
  /**
190
196
  * Unstable features, breaking changes might be introduced.
191
197
  * 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.
@@ -487,6 +493,11 @@ DataGridRaw.propTypes = {
487
493
  * @param {GridCallbackDetails} details Additional details for this callback.
488
494
  */
489
495
  onMenuOpen: PropTypes.func,
496
+ /**
497
+ * Callback fired when the pagination meta has changed.
498
+ * @param {GridPaginationMeta} paginationMeta Updated pagination meta.
499
+ */
500
+ onPaginationMetaChange: PropTypes.func,
490
501
  /**
491
502
  * Callback fired when the pagination model has changed.
492
503
  * @param {GridPaginationModel} model Updated pagination model.
@@ -586,6 +597,13 @@ DataGridRaw.propTypes = {
586
597
  value: PropTypes.number.isRequired
587
598
  })]).isRequired),
588
599
  pagination: PropTypes.oneOf([true]),
600
+ /**
601
+ * The extra information about the pagination state of the Data Grid.
602
+ * Only applicable with `paginationMode="server"`.
603
+ */
604
+ paginationMeta: PropTypes.shape({
605
+ hasNextPage: PropTypes.bool
606
+ }),
589
607
  /**
590
608
  * Pagination can be processed on the server or client-side.
591
609
  * Set it to 'client' if you would like to handle the pagination on the client-side.
@@ -621,6 +639,7 @@ DataGridRaw.propTypes = {
621
639
  /**
622
640
  * Set the total number of rows, if it is different from the length of the value `rows` prop.
623
641
  * If some rows have children (for instance in the tree data), this number represents the amount of top level rows.
642
+ * Only works with `paginationMode="server"`, ignored when `paginationMode="client"`.
624
643
  */
625
644
  rowCount: PropTypes.number,
626
645
  /**
@@ -1,5 +1,8 @@
1
1
  import * as React from 'react';
2
- import { TablePaginationProps } from '@mui/material/TablePagination';
2
+ import { TablePaginationProps, LabelDisplayedRowsArgs } from '@mui/material/TablePagination';
3
+ export type WrappedLabelDisplayedRows = (args: LabelDisplayedRowsArgs & {
4
+ estimated?: number;
5
+ }) => React.ReactNode;
3
6
  interface GridPaginationOwnProps {
4
7
  component?: React.ElementType;
5
8
  }
@@ -1,12 +1,12 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
+ import { styled } from '@mui/material/styles';
3
4
  import PropTypes from 'prop-types';
4
5
  import TablePagination, { tablePaginationClasses } from '@mui/material/TablePagination';
5
- import { styled } from '@mui/material/styles';
6
6
  import { useGridSelector } from '../hooks/utils/useGridSelector';
7
7
  import { useGridApiContext } from '../hooks/utils/useGridApiContext';
8
8
  import { useGridRootProps } from '../hooks/utils/useGridRootProps';
9
- import { gridPaginationModelSelector, gridPaginationRowCountSelector } from '../hooks/features/pagination/gridPaginationSelector';
9
+ import { gridPaginationModelSelector, gridPaginationRowCountSelector, gridPageCountSelector } from '../hooks/features/pagination/gridPaginationSelector';
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
11
  const GridPaginationRoot = styled(TablePagination)(({
12
12
  theme
@@ -24,6 +24,31 @@ const GridPaginationRoot = styled(TablePagination)(({
24
24
  }
25
25
  }
26
26
  }));
27
+ const wrapLabelDisplayedRows = (labelDisplayedRows, estimated) => {
28
+ return ({
29
+ from,
30
+ to,
31
+ count,
32
+ page
33
+ }) => labelDisplayedRows({
34
+ from,
35
+ to,
36
+ count,
37
+ page,
38
+ estimated
39
+ });
40
+ };
41
+ const defaultLabelDisplayedRows = ({
42
+ from,
43
+ to,
44
+ count,
45
+ estimated
46
+ }) => {
47
+ if (!estimated) {
48
+ return `${from}–${to} of ${count !== -1 ? count : `more than ${to}`}`;
49
+ }
50
+ return `${from}–${to} of ${count !== -1 ? count : `more than ${estimated > to ? estimated : to}`}`;
51
+ };
27
52
 
28
53
  // A mutable version of a readonly array.
29
54
 
@@ -32,10 +57,32 @@ const GridPagination = /*#__PURE__*/React.forwardRef(function GridPagination(pro
32
57
  const rootProps = useGridRootProps();
33
58
  const paginationModel = useGridSelector(apiRef, gridPaginationModelSelector);
34
59
  const rowCount = useGridSelector(apiRef, gridPaginationRowCountSelector);
35
- const lastPage = React.useMemo(() => {
36
- const calculatedValue = Math.ceil(rowCount / (paginationModel.pageSize || 1)) - 1;
37
- return Math.max(0, calculatedValue);
38
- }, [rowCount, paginationModel.pageSize]);
60
+ const pageCount = useGridSelector(apiRef, gridPageCountSelector);
61
+ const {
62
+ paginationMode,
63
+ loading,
64
+ estimatedRowCount
65
+ } = rootProps;
66
+ const computedProps = React.useMemo(() => {
67
+ if (rowCount === -1 && paginationMode === 'server' && loading) {
68
+ return {
69
+ backIconButtonProps: {
70
+ disabled: true
71
+ },
72
+ nextIconButtonProps: {
73
+ disabled: true
74
+ }
75
+ };
76
+ }
77
+ return {};
78
+ }, [loading, paginationMode, rowCount]);
79
+ const lastPage = React.useMemo(() => Math.max(0, pageCount - 1), [pageCount]);
80
+ const computedPage = React.useMemo(() => {
81
+ if (rowCount === -1) {
82
+ return paginationModel.page;
83
+ }
84
+ return paginationModel.page <= lastPage ? paginationModel.page : lastPage;
85
+ }, [lastPage, paginationModel.page, rowCount]);
39
86
  const handlePageSizeChange = React.useCallback(event => {
40
87
  const pageSize = Number(event.target.value);
41
88
  apiRef.current.setPageSize(pageSize);
@@ -61,16 +108,18 @@ const GridPagination = /*#__PURE__*/React.forwardRef(function GridPagination(pro
61
108
  const warnedOnceMissingInPageSizeOptions = React.useRef(false);
62
109
  const pageSize = rootProps.paginationModel?.pageSize ?? paginationModel.pageSize;
63
110
  if (!warnedOnceMissingInPageSizeOptions.current && !rootProps.autoPageSize && !isPageSizeIncludedInPageSizeOptions(pageSize)) {
64
- console.warn([`MUI X: The page size \`${paginationModel.pageSize}\` is not preset in the \`pageSizeOptions\`.`, `Add it to show the pagination select.`].join('\n'));
111
+ console.warn([`MUI X: The page size \`${paginationModel.pageSize}\` is not present in the \`pageSizeOptions\`.`, `Add it to show the pagination select.`].join('\n'));
65
112
  warnedOnceMissingInPageSizeOptions.current = true;
66
113
  }
67
114
  }
68
115
  const pageSizeOptions = isPageSizeIncludedInPageSizeOptions(paginationModel.pageSize) ? rootProps.pageSizeOptions : [];
116
+ const locales = apiRef.current.getLocaleText('MuiTablePagination');
117
+ const wrappedLabelDisplayedRows = wrapLabelDisplayedRows(locales.labelDisplayedRows || defaultLabelDisplayedRows, estimatedRowCount);
69
118
  return /*#__PURE__*/_jsx(GridPaginationRoot, _extends({
70
119
  ref: ref,
71
120
  component: "div",
72
121
  count: rowCount,
73
- page: paginationModel.page <= lastPage ? paginationModel.page : lastPage
122
+ page: computedPage
74
123
  // TODO: Remove the cast once the type is fixed in Material UI and that the min Material UI version
75
124
  // for x-data-grid is past the fix.
76
125
  // Note that Material UI will not mutate the array, so this is safe.
@@ -79,7 +128,9 @@ const GridPagination = /*#__PURE__*/React.forwardRef(function GridPagination(pro
79
128
  rowsPerPage: paginationModel.pageSize,
80
129
  onPageChange: handlePageChange,
81
130
  onRowsPerPageChange: handlePageSizeChange
82
- }, apiRef.current.getLocaleText('MuiTablePagination'), props));
131
+ }, computedProps, locales, {
132
+ labelDisplayedRows: wrappedLabelDisplayedRows
133
+ }, props));
83
134
  });
84
135
  process.env.NODE_ENV !== "production" ? GridPagination.propTypes = {
85
136
  // ----------------------------- Warning --------------------------------
@@ -93,6 +93,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
93
93
  const handleRef = useForkRef(ref, refProp);
94
94
  const rowNode = apiRef.current.getRowNode(rowId);
95
95
  const scrollbarWidth = dimensions.hasScrollY ? dimensions.scrollbarSize : 0;
96
+ const gridHasFiller = dimensions.columnsTotalWidth < dimensions.viewportOuterSize.width;
96
97
  const hasFocusCell = focusedColumnIndex !== undefined;
97
98
  const hasVirtualFocusCellLeft = hasFocusCell && focusedColumnIndex >= pinnedColumns.left.length && focusedColumnIndex < renderContext.firstColumnIndex;
98
99
  const hasVirtualFocusCellRight = hasFocusCell && focusedColumnIndex < visibleColumns.length - pinnedColumns.right.length && focusedColumnIndex >= renderContext.lastColumnIndex;
@@ -284,7 +285,8 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
284
285
  pinnedOffset: pinnedOffset,
285
286
  pinnedPosition: pinnedPosition,
286
287
  sectionIndex: indexInSection,
287
- sectionLength: sectionLength
288
+ sectionLength: sectionLength,
289
+ gridHasFiller: gridHasFiller
288
290
  }, slotProps?.cell), column.field);
289
291
  };
290
292
 
@@ -364,6 +366,7 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
364
366
  }).isRequired,
365
367
  hasScrollX: PropTypes.bool.isRequired,
366
368
  hasScrollY: PropTypes.bool.isRequired,
369
+ headerFilterHeight: PropTypes.number.isRequired,
367
370
  headerHeight: PropTypes.number.isRequired,
368
371
  headersTotalHeight: PropTypes.number.isRequired,
369
372
  isReady: PropTypes.bool.isRequired,
@@ -82,7 +82,7 @@ function GridScrollAreaRaw(props) {
82
82
  scrollDirection
83
83
  });
84
84
  const classes = useUtilityClasses(ownerState);
85
- const totalHeaderHeight = getTotalHeaderHeight(apiRef, rootProps.columnHeaderHeight);
85
+ const totalHeaderHeight = getTotalHeaderHeight(apiRef, rootProps);
86
86
  const headerHeight = Math.floor(rootProps.columnHeaderHeight * densityFactor);
87
87
  const style = {
88
88
  height: headerHeight,
@@ -29,6 +29,7 @@ export type GridCellProps = {
29
29
  pinnedPosition: PinnedPosition;
30
30
  sectionIndex: number;
31
31
  sectionLength: number;
32
+ gridHasFiller: boolean;
32
33
  onClick?: React.MouseEventHandler<HTMLDivElement>;
33
34
  onDoubleClick?: React.MouseEventHandler<HTMLDivElement>;
34
35
  onMouseDown?: React.MouseEventHandler<HTMLDivElement>;
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["column", "rowId", "editCellState", "align", "children", "colIndex", "width", "className", "style", "gridHasScrollX", "colSpan", "disableDragEvents", "isNotVisible", "pinnedOffset", "pinnedPosition", "sectionIndex", "sectionLength", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onMouseOver", "onKeyDown", "onKeyUp", "onDragEnter", "onDragOver"],
3
+ const _excluded = ["column", "rowId", "editCellState", "align", "children", "colIndex", "width", "className", "style", "gridHasScrollX", "colSpan", "disableDragEvents", "isNotVisible", "pinnedOffset", "pinnedPosition", "sectionIndex", "sectionLength", "gridHasFiller", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onMouseOver", "onKeyDown", "onKeyUp", "onDragEnter", "onDragOver"],
4
4
  _excluded2 = ["changeReason", "unstable_updateValueOnRender"];
5
5
  import * as React from 'react';
6
6
  import PropTypes from 'prop-types';
@@ -92,6 +92,7 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
92
92
  pinnedPosition,
93
93
  sectionIndex,
94
94
  sectionLength,
95
+ gridHasFiller,
95
96
  onClick,
96
97
  onDoubleClick,
97
98
  onMouseDown,
@@ -162,7 +163,7 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
162
163
  const isSelectionMode = rootProps.cellSelection ?? false;
163
164
  const position = gridPinnedColumnPositionLookup[pinnedPosition];
164
165
  const showLeftBorder = shouldCellShowLeftBorder(position, sectionIndex);
165
- const showRightBorder = shouldCellShowRightBorder(position, sectionIndex, sectionLength, rootProps.showCellVerticalBorder);
166
+ const showRightBorder = shouldCellShowRightBorder(position, sectionIndex, sectionLength, rootProps.showCellVerticalBorder, gridHasFiller);
166
167
  const ownerState = {
167
168
  align,
168
169
  showLeftBorder,
@@ -328,6 +329,7 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
328
329
  isValidating: PropTypes.bool,
329
330
  value: PropTypes.any
330
331
  }),
332
+ gridHasFiller: PropTypes.bool.isRequired,
331
333
  isNotVisible: PropTypes.bool.isRequired,
332
334
  onClick: PropTypes.func,
333
335
  onDoubleClick: PropTypes.func,
@@ -15,6 +15,7 @@ interface GridColumnGroupHeaderProps {
15
15
  style?: React.CSSProperties;
16
16
  indexInSection: number;
17
17
  sectionLength: number;
18
+ gridHasFiller: boolean;
18
19
  }
19
20
  declare function GridColumnGroupHeader(props: GridColumnGroupHeaderProps): React.JSX.Element;
20
21
  export { GridColumnGroupHeader };
@@ -43,7 +43,8 @@ function GridColumnGroupHeader(props) {
43
43
  pinnedPosition,
44
44
  style,
45
45
  indexInSection,
46
- sectionLength
46
+ sectionLength,
47
+ gridHasFiller
47
48
  } = props;
48
49
  const rootProps = useGridRootProps();
49
50
  const headerCellRef = React.useRef(null);
@@ -71,7 +72,7 @@ function GridColumnGroupHeader(props) {
71
72
  headerComponent = render(renderParams);
72
73
  }
73
74
  const showLeftBorder = shouldCellShowLeftBorder(pinnedPosition, indexInSection);
74
- const showRightBorder = shouldCellShowRightBorder(pinnedPosition, indexInSection, sectionLength, rootProps.showCellVerticalBorder);
75
+ const showRightBorder = shouldCellShowRightBorder(pinnedPosition, indexInSection, sectionLength, rootProps.showCellVerticalBorder, gridHasFiller);
75
76
  const ownerState = _extends({}, props, {
76
77
  classes: rootProps.classes,
77
78
  showLeftBorder,
@@ -10,6 +10,7 @@ interface GridColumnHeaderItemProps {
10
10
  headerHeight: number;
11
11
  isDragging: boolean;
12
12
  isResizing: boolean;
13
+ isLast: boolean;
13
14
  sortDirection: GridSortDirection;
14
15
  sortIndex?: number;
15
16
  filterItemsCounter?: number;
@@ -21,6 +22,7 @@ interface GridColumnHeaderItemProps {
21
22
  style?: React.CSSProperties;
22
23
  indexInSection: number;
23
24
  sectionLength: number;
25
+ gridHasFiller: boolean;
24
26
  }
25
27
  declare function GridColumnHeaderItem(props: GridColumnHeaderItemProps): React.JSX.Element;
26
28
  declare namespace GridColumnHeaderItem {
@@ -1,13 +1,14 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import PropTypes from 'prop-types';
4
+ import clsx from 'clsx';
4
5
  import { unstable_composeClasses as composeClasses, unstable_useId as useId } from '@mui/utils';
5
6
  import { fastMemo } from '../../utils/fastMemo';
6
7
  import { useGridPrivateApiContext } from '../../hooks/utils/useGridPrivateApiContext';
7
8
  import { GridColumnHeaderSortIcon } from './GridColumnHeaderSortIcon';
8
9
  import { ColumnHeaderMenuIcon } from './ColumnHeaderMenuIcon';
9
10
  import { GridColumnHeaderMenu } from '../menu/columnMenu/GridColumnHeaderMenu';
10
- import { getDataGridUtilityClass } from '../../constants/gridClasses';
11
+ import { gridClasses, getDataGridUtilityClass } from '../../constants/gridClasses';
11
12
  import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
12
13
  import { GridGenericColumnHeaderItem } from './GridGenericColumnHeaderItem';
13
14
  import { isEventTargetInPortal } from '../../utils/domUtils';
@@ -44,6 +45,7 @@ function GridColumnHeaderItem(props) {
44
45
  colIndex,
45
46
  headerHeight,
46
47
  isResizing,
48
+ isLast,
47
49
  sortDirection,
48
50
  sortIndex,
49
51
  filterItemsCounter,
@@ -54,7 +56,8 @@ function GridColumnHeaderItem(props) {
54
56
  style,
55
57
  pinnedPosition,
56
58
  indexInSection,
57
- sectionLength
59
+ sectionLength,
60
+ gridHasFiller
58
61
  } = props;
59
62
  const apiRef = useGridPrivateApiContext();
60
63
  const rootProps = useGridRootProps();
@@ -69,7 +72,7 @@ function GridColumnHeaderItem(props) {
69
72
  headerComponent = colDef.renderHeader(apiRef.current.getColumnHeaderParams(colDef.field));
70
73
  }
71
74
  const showLeftBorder = shouldCellShowLeftBorder(pinnedPosition, indexInSection);
72
- const showRightBorder = shouldCellShowRightBorder(pinnedPosition, indexInSection, sectionLength, rootProps.showCellVerticalBorder);
75
+ const showRightBorder = shouldCellShowRightBorder(pinnedPosition, indexInSection, sectionLength, rootProps.showCellVerticalBorder, gridHasFiller);
73
76
  const ownerState = _extends({}, props, {
74
77
  classes: rootProps.classes,
75
78
  showRightBorder,
@@ -181,7 +184,7 @@ function GridColumnHeaderItem(props) {
181
184
  width: colDef.computedWidth,
182
185
  columnMenuIconButton: columnMenuIconButton,
183
186
  columnTitleIconButtons: columnTitleIconButtons,
184
- headerClassName: headerClassName,
187
+ headerClassName: clsx(headerClassName, isLast && gridClasses['columnHeader--last']),
185
188
  label: label,
186
189
  resizable: !rootProps.disableColumnResize && !!colDef.resizable,
187
190
  "data-field": colDef.field,
@@ -201,10 +204,12 @@ process.env.NODE_ENV !== "production" ? GridColumnHeaderItem.propTypes = {
201
204
  columnMenuOpen: PropTypes.bool.isRequired,
202
205
  disableReorder: PropTypes.bool,
203
206
  filterItemsCounter: PropTypes.number,
207
+ gridHasFiller: PropTypes.bool.isRequired,
204
208
  hasFocus: PropTypes.bool,
205
209
  headerHeight: PropTypes.number.isRequired,
206
210
  indexInSection: PropTypes.number.isRequired,
207
211
  isDragging: PropTypes.bool.isRequired,
212
+ isLast: PropTypes.bool.isRequired,
208
213
  isResizing: PropTypes.bool.isRequired,
209
214
  pinnedPosition: PropTypes.oneOf(['left', 'right']),
210
215
  sectionLength: PropTypes.number.isRequired,
@@ -151,8 +151,8 @@ export const GridRootStyles = styled('div', {
151
151
  }) => {
152
152
  const borderColor = getBorderColor(t);
153
153
  const radius = t.shape.borderRadius;
154
- const containerBackground = t.vars ? t.vars.palette.background.default : t.palette.background.default;
155
- const pinnedBackground = containerBackground;
154
+ const containerBackground = t.vars ? t.vars.palette.background.default : t.mixins.MuiDataGrid?.containerBackground ?? t.palette.background.default;
155
+ const pinnedBackground = t.mixins.MuiDataGrid?.pinnedBackground ?? containerBackground;
156
156
  const overlayBackground = t.vars ? `rgba(${t.vars.palette.background.defaultChannel} / ${t.vars.palette.action.disabledOpacity})` : alpha(t.palette.background.default, t.palette.action.disabledOpacity);
157
157
  const hoverOpacity = (t.vars || t).palette.action.hoverOpacity;
158
158
  const hoverColor = (t.vars || t).palette.action.hover;
@@ -274,7 +274,9 @@ export const GridRootStyles = styled('div', {
274
274
  [`& .${c.columnHeader}`]: {
275
275
  position: 'relative',
276
276
  display: 'flex',
277
- alignItems: 'center',
277
+ alignItems: 'center'
278
+ },
279
+ [`& .${c['columnHeader--last']}`]: {
278
280
  overflow: 'hidden'
279
281
  },
280
282
  [`& .${c['columnHeader--sorted']} .${c.iconButtonContainer}, & .${c['columnHeader--filtered']} .${c.iconButtonContainer}`]: {
@@ -450,7 +452,6 @@ export const GridRootStyles = styled('div', {
450
452
  userSelect: 'none'
451
453
  },
452
454
  [`& .${c['row--dynamicHeight']} > .${c.cell}`]: {
453
- overflow: 'initial',
454
455
  whiteSpace: 'initial',
455
456
  lineHeight: 'inherit'
456
457
  },
@@ -632,6 +633,9 @@ export const GridRootStyles = styled('div', {
632
633
  },
633
634
  [`& .${c.filler}`]: {
634
635
  flex: 1
636
+ },
637
+ [`& .${c['filler--borderTop']}`]: {
638
+ borderTop: '1px solid var(--DataGrid-rowBorderColor)'
635
639
  }
636
640
  });
637
641
  return gridStyle;
@@ -13,7 +13,7 @@ export * from './GridFooter';
13
13
  export * from './GridHeader';
14
14
  export * from './GridLoadingOverlay';
15
15
  export * from './GridNoRowsOverlay';
16
- export * from './GridPagination';
16
+ export { GridPagination } from './GridPagination';
17
17
  export * from './GridRowCount';
18
18
  export * from './GridRow';
19
19
  export * from './GridSelectedRowCount';
@@ -13,7 +13,7 @@ export * from './GridFooter';
13
13
  export * from './GridHeader';
14
14
  export * from './GridLoadingOverlay';
15
15
  export * from './GridNoRowsOverlay';
16
- export * from './GridPagination';
16
+ export { GridPagination } from './GridPagination';
17
17
  export * from './GridRowCount';
18
18
  export * from './GridRow';
19
19
  export * from './GridSelectedRowCount';
@@ -33,7 +33,9 @@ const GridPaperRoot = styled(Paper, {
33
33
  backgroundColor: (theme.vars || theme).palette.background.paper,
34
34
  minWidth: 300,
35
35
  maxHeight: 450,
36
- display: 'flex'
36
+ display: 'flex',
37
+ maxWidth: `calc(100vw - ${theme.spacing(0.5)})`,
38
+ overflow: 'auto'
37
39
  }));
38
40
  const GridPanel = /*#__PURE__*/React.forwardRef((props, ref) => {
39
41
  const {