@mui/x-data-grid 7.22.2 → 7.23.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 (232) hide show
  1. package/CHANGELOG.md +169 -0
  2. package/DataGrid/DataGrid.js +9 -1
  3. package/README.md +3 -3
  4. package/components/GridDetailPanels.js +0 -1
  5. package/components/GridPinnedRows.js +0 -1
  6. package/components/GridRow.d.ts +2 -2
  7. package/components/GridRow.js +1 -1
  8. package/components/base/GridOverlays.js +5 -6
  9. package/components/cell/GridCell.d.ts +41 -3
  10. package/components/cell/GridCell.js +11 -19
  11. package/components/cell/GridEditInputCell.js +0 -67
  12. package/components/columnsManagement/GridColumnsManagement.d.ts +2 -0
  13. package/components/columnsManagement/GridColumnsManagement.js +53 -6
  14. package/components/panel/GridPanel.d.ts +1 -1
  15. package/components/toolbar/GridToolbar.d.ts +2 -2
  16. package/components/toolbar/GridToolbar.js +12 -4
  17. package/components/toolbar/GridToolbarColumnsButton.js +3 -4
  18. package/components/toolbar/GridToolbarDensitySelector.js +3 -4
  19. package/components/toolbar/GridToolbarExport.d.ts +2 -2
  20. package/components/toolbar/GridToolbarExport.js +4 -3
  21. package/components/toolbar/GridToolbarExportContainer.js +3 -4
  22. package/components/toolbar/GridToolbarFilterButton.d.ts +2 -0
  23. package/components/toolbar/GridToolbarFilterButton.js +7 -6
  24. package/components/toolbar/GridToolbarQuickFilter.js +1 -0
  25. package/components/toolbar/index.d.ts +1 -1
  26. package/constants/dataGridPropsDefaultValues.js +2 -1
  27. package/constants/gridClasses.d.ts +4 -0
  28. package/constants/gridClasses.js +1 -1
  29. package/constants/localeTextConstants.js +1 -0
  30. package/hooks/features/columnHeaders/useGridColumnHeaders.js +2 -2
  31. package/hooks/features/dimensions/useGridDimensions.js +2 -1
  32. package/hooks/features/export/useGridCsvExport.js +1 -1
  33. package/hooks/features/export/useGridPrintExport.js +1 -1
  34. package/hooks/features/index.d.ts +1 -0
  35. package/hooks/features/index.js +1 -0
  36. package/hooks/features/listView/gridListViewSelectors.d.ts +3 -1
  37. package/hooks/features/listView/gridListViewSelectors.js +3 -1
  38. package/hooks/features/listView/index.d.ts +1 -0
  39. package/hooks/features/listView/index.js +1 -0
  40. package/hooks/features/pagination/useGridPaginationModel.js +2 -2
  41. package/hooks/features/rowSelection/useGridRowSelection.js +0 -9
  42. package/hooks/features/rows/gridRowsUtils.d.ts +1 -1
  43. package/hooks/features/rows/gridRowsUtils.js +1 -5
  44. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +1 -1
  45. package/hooks/features/virtualization/useGridVirtualScroller.js +59 -19
  46. package/hooks/utils/useGridSelector.d.ts +3 -2
  47. package/hooks/utils/useGridSelector.js +27 -2
  48. package/index.d.ts +0 -1
  49. package/index.js +1 -1
  50. package/joy/joySlots.js +7 -2
  51. package/locales/arSD.js +1 -0
  52. package/locales/beBY.js +1 -0
  53. package/locales/bgBG.js +2 -0
  54. package/locales/csCZ.js +2 -0
  55. package/locales/daDK.js +2 -0
  56. package/locales/deDE.js +2 -0
  57. package/locales/elGR.js +1 -0
  58. package/locales/esES.js +5 -4
  59. package/locales/faIR.js +2 -0
  60. package/locales/fiFI.js +2 -0
  61. package/locales/frFR.js +2 -0
  62. package/locales/heIL.js +2 -0
  63. package/locales/hrHR.js +2 -0
  64. package/locales/huHU.js +2 -0
  65. package/locales/isIS.js +1 -0
  66. package/locales/itIT.js +2 -0
  67. package/locales/jaJP.js +2 -0
  68. package/locales/koKR.js +1 -0
  69. package/locales/nbNO.js +2 -0
  70. package/locales/nlNL.js +2 -0
  71. package/locales/nnNO.js +2 -0
  72. package/locales/plPL.js +1 -0
  73. package/locales/ptBR.js +1 -0
  74. package/locales/ptPT.js +1 -0
  75. package/locales/roRO.js +1 -0
  76. package/locales/ruRU.js +2 -0
  77. package/locales/skSK.js +1 -0
  78. package/locales/svSE.js +6 -5
  79. package/locales/trTR.js +4 -2
  80. package/locales/ukUA.js +1 -0
  81. package/locales/urPK.js +1 -0
  82. package/locales/viVN.js +2 -0
  83. package/locales/zhCN.js +5 -4
  84. package/locales/zhHK.js +1 -0
  85. package/locales/zhTW.js +1 -0
  86. package/models/api/gridCoreApi.d.ts +1 -1
  87. package/models/api/gridLocaleTextApi.d.ts +1 -0
  88. package/models/colDef/gridColDef.d.ts +24 -24
  89. package/models/gridDataSource.d.ts +12 -12
  90. package/models/props/DataGridProps.d.ts +9 -1
  91. package/modern/DataGrid/DataGrid.js +9 -1
  92. package/modern/components/GridDetailPanels.js +0 -1
  93. package/modern/components/GridPinnedRows.js +0 -1
  94. package/modern/components/GridRow.js +1 -1
  95. package/modern/components/base/GridOverlays.js +5 -6
  96. package/modern/components/cell/GridCell.js +11 -19
  97. package/modern/components/cell/GridEditInputCell.js +0 -67
  98. package/modern/components/columnsManagement/GridColumnsManagement.js +53 -6
  99. package/modern/components/toolbar/GridToolbar.js +12 -4
  100. package/modern/components/toolbar/GridToolbarColumnsButton.js +3 -4
  101. package/modern/components/toolbar/GridToolbarDensitySelector.js +3 -4
  102. package/modern/components/toolbar/GridToolbarExport.js +4 -3
  103. package/modern/components/toolbar/GridToolbarExportContainer.js +3 -4
  104. package/modern/components/toolbar/GridToolbarFilterButton.js +7 -6
  105. package/modern/components/toolbar/GridToolbarQuickFilter.js +1 -0
  106. package/modern/constants/dataGridPropsDefaultValues.js +2 -1
  107. package/modern/constants/gridClasses.js +1 -1
  108. package/modern/constants/localeTextConstants.js +1 -0
  109. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +2 -2
  110. package/modern/hooks/features/dimensions/useGridDimensions.js +2 -1
  111. package/modern/hooks/features/export/useGridCsvExport.js +1 -1
  112. package/modern/hooks/features/export/useGridPrintExport.js +1 -1
  113. package/modern/hooks/features/index.js +1 -0
  114. package/modern/hooks/features/listView/gridListViewSelectors.js +3 -1
  115. package/modern/hooks/features/listView/index.js +1 -0
  116. package/modern/hooks/features/pagination/useGridPaginationModel.js +2 -2
  117. package/modern/hooks/features/rowSelection/useGridRowSelection.js +0 -9
  118. package/modern/hooks/features/rows/gridRowsUtils.js +1 -5
  119. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +59 -19
  120. package/modern/hooks/utils/useGridSelector.js +27 -2
  121. package/modern/index.js +1 -1
  122. package/modern/joy/joySlots.js +7 -2
  123. package/modern/locales/arSD.js +1 -0
  124. package/modern/locales/beBY.js +1 -0
  125. package/modern/locales/bgBG.js +2 -0
  126. package/modern/locales/csCZ.js +2 -0
  127. package/modern/locales/daDK.js +2 -0
  128. package/modern/locales/deDE.js +2 -0
  129. package/modern/locales/elGR.js +1 -0
  130. package/modern/locales/esES.js +5 -4
  131. package/modern/locales/faIR.js +2 -0
  132. package/modern/locales/fiFI.js +2 -0
  133. package/modern/locales/frFR.js +2 -0
  134. package/modern/locales/heIL.js +2 -0
  135. package/modern/locales/hrHR.js +2 -0
  136. package/modern/locales/huHU.js +2 -0
  137. package/modern/locales/isIS.js +1 -0
  138. package/modern/locales/itIT.js +2 -0
  139. package/modern/locales/jaJP.js +2 -0
  140. package/modern/locales/koKR.js +1 -0
  141. package/modern/locales/nbNO.js +2 -0
  142. package/modern/locales/nlNL.js +2 -0
  143. package/modern/locales/nnNO.js +2 -0
  144. package/modern/locales/plPL.js +1 -0
  145. package/modern/locales/ptBR.js +1 -0
  146. package/modern/locales/ptPT.js +1 -0
  147. package/modern/locales/roRO.js +1 -0
  148. package/modern/locales/ruRU.js +2 -0
  149. package/modern/locales/skSK.js +1 -0
  150. package/modern/locales/svSE.js +6 -5
  151. package/modern/locales/trTR.js +4 -2
  152. package/modern/locales/ukUA.js +1 -0
  153. package/modern/locales/urPK.js +1 -0
  154. package/modern/locales/viVN.js +2 -0
  155. package/modern/locales/zhCN.js +5 -4
  156. package/modern/locales/zhHK.js +1 -0
  157. package/modern/locales/zhTW.js +1 -0
  158. package/modern/utils/createSelector.js +11 -1
  159. package/modern/utils/utils.js +1 -3
  160. package/node/DataGrid/DataGrid.js +9 -1
  161. package/node/components/GridDetailPanels.js +0 -1
  162. package/node/components/GridPinnedRows.js +0 -1
  163. package/node/components/GridRow.js +1 -1
  164. package/node/components/base/GridOverlays.js +5 -6
  165. package/node/components/cell/GridCell.js +11 -19
  166. package/node/components/cell/GridEditInputCell.js +0 -67
  167. package/node/components/columnsManagement/GridColumnsManagement.js +53 -6
  168. package/node/components/toolbar/GridToolbar.js +12 -4
  169. package/node/components/toolbar/GridToolbarColumnsButton.js +3 -4
  170. package/node/components/toolbar/GridToolbarDensitySelector.js +3 -4
  171. package/node/components/toolbar/GridToolbarExport.js +4 -3
  172. package/node/components/toolbar/GridToolbarExportContainer.js +3 -4
  173. package/node/components/toolbar/GridToolbarFilterButton.js +7 -6
  174. package/node/components/toolbar/GridToolbarQuickFilter.js +1 -0
  175. package/node/constants/dataGridPropsDefaultValues.js +2 -1
  176. package/node/constants/gridClasses.js +1 -1
  177. package/node/constants/localeTextConstants.js +1 -0
  178. package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +2 -2
  179. package/node/hooks/features/dimensions/useGridDimensions.js +2 -1
  180. package/node/hooks/features/export/useGridCsvExport.js +2 -2
  181. package/node/hooks/features/export/useGridPrintExport.js +2 -2
  182. package/node/hooks/features/index.js +11 -0
  183. package/node/hooks/features/listView/gridListViewSelectors.js +3 -1
  184. package/node/hooks/features/listView/index.js +16 -0
  185. package/node/hooks/features/pagination/useGridPaginationModel.js +2 -2
  186. package/node/hooks/features/rowSelection/useGridRowSelection.js +0 -9
  187. package/node/hooks/features/rows/gridRowsUtils.js +2 -8
  188. package/node/hooks/features/virtualization/useGridVirtualScroller.js +59 -19
  189. package/node/hooks/utils/useGridSelector.js +29 -3
  190. package/node/index.js +1 -1
  191. package/node/joy/joySlots.js +7 -2
  192. package/node/locales/arSD.js +1 -0
  193. package/node/locales/beBY.js +1 -0
  194. package/node/locales/bgBG.js +2 -0
  195. package/node/locales/csCZ.js +2 -0
  196. package/node/locales/daDK.js +2 -0
  197. package/node/locales/deDE.js +2 -0
  198. package/node/locales/elGR.js +1 -0
  199. package/node/locales/esES.js +5 -4
  200. package/node/locales/faIR.js +2 -0
  201. package/node/locales/fiFI.js +2 -0
  202. package/node/locales/frFR.js +2 -0
  203. package/node/locales/heIL.js +2 -0
  204. package/node/locales/hrHR.js +2 -0
  205. package/node/locales/huHU.js +2 -0
  206. package/node/locales/isIS.js +1 -0
  207. package/node/locales/itIT.js +2 -0
  208. package/node/locales/jaJP.js +2 -0
  209. package/node/locales/koKR.js +1 -0
  210. package/node/locales/nbNO.js +2 -0
  211. package/node/locales/nlNL.js +2 -0
  212. package/node/locales/nnNO.js +2 -0
  213. package/node/locales/plPL.js +1 -0
  214. package/node/locales/ptBR.js +1 -0
  215. package/node/locales/ptPT.js +1 -0
  216. package/node/locales/roRO.js +1 -0
  217. package/node/locales/ruRU.js +2 -0
  218. package/node/locales/skSK.js +1 -0
  219. package/node/locales/svSE.js +6 -5
  220. package/node/locales/trTR.js +4 -2
  221. package/node/locales/ukUA.js +1 -0
  222. package/node/locales/urPK.js +1 -0
  223. package/node/locales/viVN.js +2 -0
  224. package/node/locales/zhCN.js +5 -4
  225. package/node/locales/zhHK.js +1 -0
  226. package/node/locales/zhTW.js +1 -0
  227. package/node/utils/createSelector.js +11 -1
  228. package/node/utils/utils.js +1 -3
  229. package/package.json +4 -4
  230. package/utils/createSelector.d.ts +1 -1
  231. package/utils/createSelector.js +11 -1
  232. package/utils/utils.js +1 -3
package/locales/zhCN.js CHANGED
@@ -34,6 +34,7 @@ const zhCNGrid = {
34
34
  columnsManagementNoColumns: '没有列',
35
35
  columnsManagementShowHideAllText: '显示/隐藏所有',
36
36
  columnsManagementReset: '重置',
37
+ columnsManagementDeleteIconLabel: '清除',
37
38
  // Filter panel text
38
39
  filterPanelAddFilter: '添加筛选器',
39
40
  filterPanelRemoveAll: '清除全部',
@@ -47,9 +48,9 @@ const zhCNGrid = {
47
48
  filterPanelInputPlaceholder: '筛选值',
48
49
  // Filter operators text
49
50
  filterOperatorContains: '包含',
50
- // filterOperatorDoesNotContain: 'does not contain',
51
+ filterOperatorDoesNotContain: '不包含',
51
52
  filterOperatorEquals: '等于',
52
- // filterOperatorDoesNotEqual: 'does not equal',
53
+ filterOperatorDoesNotEqual: '不等于',
53
54
  filterOperatorStartsWith: '开始于',
54
55
  filterOperatorEndsWith: '结束于',
55
56
  filterOperatorIs: '是',
@@ -69,9 +70,9 @@ const zhCNGrid = {
69
70
  'filterOperator<=': '<=',
70
71
  // Header filter operators text
71
72
  headerFilterOperatorContains: '包含',
72
- // headerFilterOperatorDoesNotContain: 'Does not contain',
73
+ headerFilterOperatorDoesNotContain: '不包含',
73
74
  headerFilterOperatorEquals: '等于',
74
- // headerFilterOperatorDoesNotEqual: 'Does not equal',
75
+ headerFilterOperatorDoesNotEqual: '不等于',
75
76
  headerFilterOperatorStartsWith: '开始于',
76
77
  headerFilterOperatorEndsWith: '结束于',
77
78
  headerFilterOperatorIs: '是',
package/locales/zhHK.js CHANGED
@@ -34,6 +34,7 @@ const zhHKGrid = {
34
34
  // columnsManagementNoColumns: 'No columns',
35
35
  // columnsManagementShowHideAllText: 'Show/Hide All',
36
36
  // columnsManagementReset: 'Reset',
37
+ // columnsManagementDeleteIconLabel: 'Clear',
37
38
 
38
39
  // Filter panel text
39
40
  filterPanelAddFilter: '新增過濾器',
package/locales/zhTW.js CHANGED
@@ -34,6 +34,7 @@ const zhTWGrid = {
34
34
  // columnsManagementNoColumns: 'No columns',
35
35
  // columnsManagementShowHideAllText: 'Show/Hide All',
36
36
  // columnsManagementReset: 'Reset',
37
+ // columnsManagementDeleteIconLabel: 'Clear',
37
38
 
38
39
  // Filter panel text
39
40
  filterPanelAddFilter: '增加篩選器',
@@ -59,7 +59,7 @@ export interface GridCorePrivateApi<GridPublicApi extends GridApiCommon, GridPri
59
59
  /**
60
60
  * The React ref of the grid main container div element.
61
61
  */
62
- mainElementRef: React.RefObject<HTMLDivElement>;
62
+ mainElementRef: React.MutableRefObject<HTMLDivElement | null>;
63
63
  /**
64
64
  * The React ref of the grid's virtual scroller container element.
65
65
  */
@@ -35,6 +35,7 @@ export interface GridLocaleText {
35
35
  columnsManagementNoColumns: string;
36
36
  columnsManagementShowHideAllText: string;
37
37
  columnsManagementReset: string;
38
+ columnsManagementDeleteIconLabel: string;
38
39
  filterPanelAddFilter: React.ReactNode;
39
40
  filterPanelRemoveAll: React.ReactNode;
40
41
  filterPanelDeleteIconLabel: string;
@@ -36,43 +36,43 @@ export type GridColSpanFn<R extends GridValidRowModel = GridValidRowModel, V = a
36
36
  */
37
37
  export interface GridBaseColDef<R extends GridValidRowModel = GridValidRowModel, V = any, F = V> {
38
38
  /**
39
- * The column identifier. It's used to map with [[GridRowModel]] values.
39
+ * The unique identifier of the column. Used to map with [[GridRowModel]] values.
40
40
  */
41
41
  field: string;
42
42
  /**
43
- * The title of the column rendered in the column header cell.
43
+ * The title displayed in the column header cell.
44
44
  */
45
45
  headerName?: string;
46
46
  /**
47
- * The description of the column rendered as tooltip if the column header name is not fully displayed.
47
+ * The tooltip text shown when the column header name is truncated.
48
48
  */
49
49
  description?: string;
50
50
  /**
51
- * Set the width of the column.
51
+ * The width of the column in pixels.
52
52
  * @default 100
53
53
  */
54
54
  width?: number;
55
55
  /**
56
- * If set, it indicates that a column has fluid width. Range [0, ∞).
56
+ * The flex grow factor of the column. Must be a positive number.
57
57
  */
58
58
  flex?: number;
59
59
  /**
60
- * Sets the minimum width of a column.
60
+ * The minimum width of the column in pixels.
61
61
  * @default 50
62
62
  */
63
63
  minWidth?: number;
64
64
  /**
65
- * Sets the maximum width of a column.
65
+ * The maximum width of the column in pixels.
66
66
  * @default Infinity
67
67
  */
68
68
  maxWidth?: number;
69
69
  /**
70
- * If `false`, removes the buttons for hiding this column.
70
+ * If `false`, removes the option to hide this column.
71
71
  * @default true
72
72
  */
73
73
  hideable?: boolean;
74
74
  /**
75
- * If `true`, the column is sortable.
75
+ * If `false`, disables sorting for this column.
76
76
  * @default true
77
77
  */
78
78
  sortable?: boolean;
@@ -81,7 +81,7 @@ export interface GridBaseColDef<R extends GridValidRowModel = GridValidRowModel,
81
81
  */
82
82
  sortingOrder?: readonly GridSortDirection[];
83
83
  /**
84
- * If `true`, the column is resizable.
84
+ * If `false`, disables resizing for this column.
85
85
  * @default true
86
86
  */
87
87
  resizable?: boolean;
@@ -109,7 +109,7 @@ export interface GridBaseColDef<R extends GridValidRowModel = GridValidRowModel,
109
109
  */
110
110
  sortComparator?: GridComparatorFn<V>;
111
111
  /**
112
- * Allows to use a different comparator function depending on the sort direction.
112
+ * Provide an alternative comparator function for sorting.
113
113
  * Takes precedence over `sortComparator`.
114
114
  * @param {GridSortDirection} sortDirection The direction of the sort.
115
115
  * @returns {GridComparatorFn<V>} The comparator function to use.
@@ -122,25 +122,25 @@ export interface GridBaseColDef<R extends GridValidRowModel = GridValidRowModel,
122
122
  */
123
123
  type?: GridColType;
124
124
  /**
125
- * Allows to align the column values in cells.
125
+ * Align cell content.
126
126
  */
127
127
  align?: GridAlignment;
128
128
  /**
129
- * Function that allows to get a specific data instead of field to render in the cell.
129
+ * Function that returns specific data to render in the cell instead of using the field value.
130
130
  */
131
131
  valueGetter?: GridValueGetter<R, V, F>;
132
132
  /**
133
- * Function that allows to provide a specific value to be used in row spanning.
133
+ * Function that returns a specific value to be used in row spanning.
134
134
  */
135
135
  rowSpanValueGetter?: GridValueGetter<R, V, F>;
136
136
  /**
137
- * Function that allows to customize how the entered value is stored in the row.
138
- * It only works with cell/row editing.
137
+ * Function that customizes how the entered value is stored in the row.
138
+ * Only works with cell/row editing.
139
139
  * @returns {R} The row with the updated field.
140
140
  */
141
141
  valueSetter?: GridValueSetter<R, V, F>;
142
142
  /**
143
- * Function that allows to apply a formatter before rendering its value.
143
+ * Formats the cell value before rendering.
144
144
  */
145
145
  valueFormatter?: GridValueFormatter<R, V, F>;
146
146
  /**
@@ -149,7 +149,7 @@ export interface GridBaseColDef<R extends GridValidRowModel = GridValidRowModel,
149
149
  */
150
150
  valueParser?: GridValueParser<R, V, F>;
151
151
  /**
152
- * Class name that will be added in cells for that column.
152
+ * Class name added to cells in this column.
153
153
  */
154
154
  cellClassName?: GridCellClassNamePropType<R, V>;
155
155
  /**
@@ -159,38 +159,38 @@ export interface GridBaseColDef<R extends GridValidRowModel = GridValidRowModel,
159
159
  */
160
160
  display?: 'text' | 'flex';
161
161
  /**
162
- * Allows to override the component rendered as cell for this column.
162
+ * Override the component rendered as cell for this column.
163
163
  * @template R, V, F
164
164
  * @param {GridRenderCellParams<R, V, F>} params Object containing parameters for the renderer.
165
165
  * @returns {React.ReactNode} The element to be rendered.
166
166
  */
167
167
  renderCell?: (params: GridRenderCellParams<R, V, F>) => React.ReactNode;
168
168
  /**
169
- * Allows to override the component rendered in edit cell mode for this column.
169
+ * Override the component rendered in edit cell mode for this column.
170
170
  * @param {GridRenderEditCellParams} params Object containing parameters for the renderer.
171
171
  * @returns {React.ReactNode} The element to be rendered.
172
172
  */
173
173
  renderEditCell?: (params: GridRenderEditCellParams<R, V, F>) => React.ReactNode;
174
174
  /**
175
175
  * Callback fired when the edit props of the cell changes.
176
- * It allows to process the props that saved into the state.
176
+ * Processes the props before being saved into the state.
177
177
  * @param {GridPreProcessEditCellProps} params Object containing parameters of the cell being edited.
178
178
  * @returns {GridEditCellProps | Promise<GridEditCellProps>} The new edit cell props.
179
179
  */
180
180
  preProcessEditCellProps?: (params: GridPreProcessEditCellProps) => GridEditCellProps | Promise<GridEditCellProps>;
181
181
  /**
182
- * Class name that will be added in the column header cell.
182
+ * Class name added to the column header cell.
183
183
  */
184
184
  headerClassName?: GridColumnHeaderClassNamePropType;
185
185
  /**
186
- * Allows to render a component in the column header cell.
186
+ * Override the component rendered in the column header cell.
187
187
  * @template R, V, F
188
188
  * @param {GridColumnHeaderParams<R, V, F>} params Object containing parameters for the renderer.
189
189
  * @returns {React.ReactNode} The element to be rendered.
190
190
  */
191
191
  renderHeader?: (params: GridColumnHeaderParams<R, V, F>) => React.ReactNode;
192
192
  /**
193
- * Header cell element alignment.
193
+ * Align column header content.
194
194
  */
195
195
  headerAlign?: GridAlignment;
196
196
  /**
@@ -34,7 +34,7 @@ export interface GridGetRowsResponse {
34
34
  rowCount?: number;
35
35
  /**
36
36
  * Additional `pageInfo` for advanced use-cases.
37
- * `hasNextPage`: When row count is unknown/estimated, `hasNextPage` will be used to check if more records are available on server
37
+ * `hasNextPage`: When row count is unknown/estimated, `hasNextPage` will be used to check if more records are available on server.
38
38
  */
39
39
  pageInfo?: {
40
40
  hasNextPage?: boolean;
@@ -44,25 +44,25 @@ export interface GridGetRowsResponse {
44
44
  export interface GridDataSource {
45
45
  /**
46
46
  * This method will be called when the grid needs to fetch some rows.
47
- * @param {GridGetRowsParams} params The parameters required to fetch the rows
48
- * @returns {Promise<GridGetRowsResponse>} A promise that resolves to the data of type [GridGetRowsResponse]
47
+ * @param {GridGetRowsParams} params The parameters required to fetch the rows.
48
+ * @returns {Promise<GridGetRowsResponse>} A promise that resolves to the data of type [GridGetRowsResponse].
49
49
  */
50
50
  getRows(params: GridGetRowsParams): Promise<GridGetRowsResponse>;
51
51
  /**
52
52
  * This method will be called when the user updates a row [Not yet implemented].
53
- * @param {GridRowModel} updatedRow The updated row
54
- * @returns {Promise<any>} If resolved (synced on the backend), the grid will update the row and mutate the cache
53
+ * @param {GridRowModel} updatedRow The updated row.
54
+ * @returns {Promise<any>} If resolved (synced on the backend), the grid will update the row and mutate the cache.
55
55
  */
56
56
  updateRow?(updatedRow: GridRowModel): Promise<any>;
57
57
  /**
58
58
  * Used to group rows by their parent group. Replaces `getTreeDataPath` used in client side tree-data.
59
- * @param {GridRowModel} row The row to get the group key of
60
- * @returns {string} The group key for the row
59
+ * @param {GridRowModel} row The row to get the group key of.
60
+ * @returns {string} The group key for the row.
61
61
  */
62
62
  getGroupKey?: (row: GridRowModel) => string;
63
63
  /**
64
64
  * Used to determine the number of children a row has on server.
65
- * @param {GridRowModel} row The row to check the number of children
65
+ * @param {GridRowModel} row The row to check the number of children.
66
66
  * @returns {number} The number of children the row has.
67
67
  * If the children count is not available for some reason, but there are some children, `getChildrenCount` should return `-1`.
68
68
  */
@@ -71,14 +71,14 @@ export interface GridDataSource {
71
71
  export interface GridDataSourceCache {
72
72
  /**
73
73
  * Set the cache entry for the given key.
74
- * @param {GridGetRowsParams} key The key of type `GridGetRowsParams`
75
- * @param {GridGetRowsResponse} value The value to be stored in the cache
74
+ * @param {GridGetRowsParams} key The key of type `GridGetRowsParams`.
75
+ * @param {GridGetRowsResponse} value The value to be stored in the cache.
76
76
  */
77
77
  set: (key: GridGetRowsParams, value: GridGetRowsResponse) => void;
78
78
  /**
79
79
  * Get the cache entry for the given key.
80
- * @param {GridGetRowsParams} key The key of type `GridGetRowsParams`
81
- * @returns {GridGetRowsResponse} The value stored in the cache
80
+ * @param {GridGetRowsParams} key The key of type `GridGetRowsParams`.
81
+ * @returns {GridGetRowsResponse} The value stored in the cache.
82
82
  */
83
83
  get: (key: GridGetRowsParams) => GridGetRowsResponse | undefined;
84
84
  /**
@@ -369,6 +369,14 @@ export interface DataGridPropsWithDefaultValues<R extends GridValidRowModel = an
369
369
  * @default false
370
370
  */
371
371
  unstable_rowSpanning: boolean;
372
+ /**
373
+ * If `true`, the Data Grid enables column virtualization when `getRowHeight` is set to `() => 'auto'`.
374
+ * By default, column virtualization is disabled when dynamic row height is enabled to measure the row height correctly.
375
+ * For datasets with a large number of columns, this can cause performance issues.
376
+ * The downside of enabling this prop is that the row height will be estimated based the cells that are currently rendered, which can cause row height change when scrolling horizontally.
377
+ * @default false
378
+ */
379
+ virtualizeColumnsWithAutoRowHeight: boolean;
372
380
  }
373
381
  /**
374
382
  * The Data Grid props with no default value.
@@ -613,7 +621,7 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
613
621
  * @param {GridPaginationModel} model Updated pagination model.
614
622
  * @param {GridCallbackDetails} details Additional details for this callback.
615
623
  */
616
- onPaginationModelChange?: (model: GridPaginationModel, details: GridCallbackDetails) => void;
624
+ onPaginationModelChange?: (model: GridPaginationModel, details: GridCallbackDetails<'pagination'>) => void;
617
625
  /**
618
626
  * Callback fired when the row count has changed.
619
627
  * @param {number} count Updated row count.
@@ -766,5 +766,13 @@ DataGridRaw.propTypes = {
766
766
  * If `true`, the Data Grid will auto span the cells over the rows having the same value.
767
767
  * @default false
768
768
  */
769
- unstable_rowSpanning: PropTypes.bool
769
+ unstable_rowSpanning: PropTypes.bool,
770
+ /**
771
+ * If `true`, the Data Grid enables column virtualization when `getRowHeight` is set to `() => 'auto'`.
772
+ * By default, column virtualization is disabled when dynamic row height is enabled to measure the row height correctly.
773
+ * For datasets with a large number of columns, this can cause performance issues.
774
+ * The downside of enabling this prop is that the row height will be estimated based the cells that are currently rendered, which can cause row height change when scrolling horizontally.
775
+ * @default false
776
+ */
777
+ virtualizeColumnsWithAutoRowHeight: PropTypes.bool
770
778
  };
@@ -1,4 +1,3 @@
1
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
1
  export function GridDetailPanels(_) {
3
2
  return null;
4
3
  }
@@ -1,4 +1,3 @@
1
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
1
  export function GridPinnedRows(_) {
3
2
  return null;
4
3
  }
@@ -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 = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "pinnedColumns", "offsetTop", "offsetLeft", "dimensions", "renderContext", "focusedColumnIndex", "isFirstVisible", "isLastVisible", "isNotVisible", "showBottomBorder", "focusedCell", "tabbableCell", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave", "onMouseOut", "onMouseOver"];
3
+ const _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "pinnedColumns", "offsetTop", "offsetLeft", "dimensions", "renderContext", "focusedColumnIndex", "isFirstVisible", "isLastVisible", "isNotVisible", "showBottomBorder", "tabbableCell", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave", "onMouseOut", "onMouseOver"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import clsx from 'clsx';
@@ -4,12 +4,11 @@ import PropTypes from 'prop-types';
4
4
  import { styled } from '@mui/system';
5
5
  import composeClasses from '@mui/utils/composeClasses';
6
6
  import clsx from 'clsx';
7
+ import { minimalContentHeight } from "../../hooks/features/rows/gridRowsUtils.js";
7
8
  import { useGridSelector } from "../../hooks/utils/useGridSelector.js";
8
9
  import { gridDimensionsSelector } from "../../hooks/features/dimensions/index.js";
9
10
  import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
10
11
  import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
11
- import { useGridVisibleRows } from "../../hooks/utils/useGridVisibleRows.js";
12
- import { getMinimalContentHeight } from "../../hooks/features/rows/gridRowsUtils.js";
13
12
  import { getDataGridUtilityClass } from "../../constants/gridClasses.js";
14
13
  import { jsx as _jsx } from "react/jsx-runtime";
15
14
  const GridOverlayWrapperRoot = styled('div', {
@@ -26,6 +25,7 @@ loadingOverlayVariant !== 'skeleton' ? {
26
25
  position: 'sticky',
27
26
  // To stay in place while scrolling
28
27
  top: 'var(--DataGrid-headersTotalHeight)',
28
+ // TODO: take pinned rows into account
29
29
  left: 0,
30
30
  width: 0,
31
31
  // To stay above the content instead of shifting it down
@@ -53,11 +53,10 @@ const useUtilityClasses = ownerState => {
53
53
  function GridOverlayWrapper(props) {
54
54
  const apiRef = useGridApiContext();
55
55
  const rootProps = useGridRootProps();
56
- const currentPage = useGridVisibleRows(apiRef, rootProps);
57
56
  const dimensions = useGridSelector(apiRef, gridDimensionsSelector);
58
- let height = dimensions.viewportOuterSize.height - dimensions.topContainerHeight - dimensions.bottomContainerHeight - (dimensions.hasScrollX ? dimensions.scrollbarSize : 0);
59
- if (rootProps.autoHeight && currentPage.rows.length === 0 || height === 0) {
60
- height = getMinimalContentHeight(apiRef);
57
+ let height = Math.max(dimensions.viewportOuterSize.height - dimensions.topContainerHeight - dimensions.bottomContainerHeight - (dimensions.hasScrollX ? dimensions.scrollbarSize : 0), 0);
58
+ if (height === 0) {
59
+ height = minimalContentHeight;
61
60
  }
62
61
  const classes = useUtilityClasses(_extends({}, props, {
63
62
  classes: rootProps.classes
@@ -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", "gridHasFiller", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onMouseOver", "onKeyDown", "onKeyUp", "onDragEnter", "onDragOver"],
3
+ const _excluded = ["column", "rowId", "editCellState", "align", "children", "colIndex", "width", "className", "style", "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';
@@ -15,7 +15,6 @@ import { useGridSelector, objectShallowCompare } from "../../hooks/utils/useGrid
15
15
  import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
16
16
  import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
17
17
  import { gridFocusCellSelector } from "../../hooks/features/focus/gridFocusStateSelector.js";
18
- import { MissingRowIdError } from "../../hooks/features/rows/useGridParamsApi.js";
19
18
  import { shouldCellShowLeftBorder, shouldCellShowRightBorder } from "../../utils/cellBorderUtils.js";
20
19
  import { GridPinnedColumnPosition } from "../../hooks/features/columns/gridColumnsInterfaces.js";
21
20
  import { gridRowSpanningHiddenCellsSelector, gridRowSpanningSpannedCellsSelector } from "../../hooks/features/rows/gridRowSpanningSelectors.js";
@@ -114,16 +113,13 @@ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
114
113
  // This is required because `.getCellParams` tries to get the `state.rows.tree` entry
115
114
  // associated with `rowId`/`fieldId`, but this selector runs after the state has been
116
115
  // updated, while `rowId`/`fieldId` reference an entry in the old state.
117
- try {
118
- const result = apiRef.current.getCellParams(rowId, field);
119
- result.api = apiRef.current;
120
- return result;
121
- } catch (error) {
122
- if (error instanceof MissingRowIdError) {
123
- return EMPTY_CELL_PARAMS;
124
- }
125
- throw error;
116
+ const row = apiRef.current.getRow(rowId);
117
+ if (!row) {
118
+ return EMPTY_CELL_PARAMS;
126
119
  }
120
+ const result = apiRef.current.getCellParams(rowId, field);
121
+ result.api = apiRef.current;
122
+ return result;
127
123
  }, objectShallowCompare);
128
124
  const isSelected = useGridSelector(apiRef, () => apiRef.current.unstable_applyPipeProcessors('isCellSelected', false, {
129
125
  id: rowId,
@@ -211,6 +207,7 @@ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
211
207
  padding: 0,
212
208
  opacity: 0,
213
209
  width: 0,
210
+ height: 0,
214
211
  border: 0
215
212
  };
216
213
  }
@@ -229,6 +226,9 @@ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
229
226
  if (rowSpan > 1) {
230
227
  cellStyle.height = `calc(var(--height) * ${rowSpan})`;
231
228
  cellStyle.zIndex = 5;
229
+ if (isLeftPinned || isRightPinned) {
230
+ cellStyle.zIndex = 6;
231
+ }
232
232
  }
233
233
  return cellStyle;
234
234
  }, [width, isNotVisible, styleProp, pinnedOffset, pinnedPosition, isRtl, rowSpan]);
@@ -342,7 +342,6 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
342
342
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
343
343
  // ----------------------------------------------------------------------
344
344
  align: PropTypes.oneOf(['center', 'left', 'right']).isRequired,
345
- className: PropTypes.string,
346
345
  colIndex: PropTypes.number.isRequired,
347
346
  colSpan: PropTypes.number,
348
347
  column: PropTypes.object.isRequired,
@@ -355,13 +354,6 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
355
354
  }),
356
355
  gridHasFiller: PropTypes.bool.isRequired,
357
356
  isNotVisible: PropTypes.bool.isRequired,
358
- onClick: PropTypes.func,
359
- onDoubleClick: PropTypes.func,
360
- onDragEnter: PropTypes.func,
361
- onDragOver: PropTypes.func,
362
- onKeyDown: PropTypes.func,
363
- onMouseDown: PropTypes.func,
364
- onMouseUp: PropTypes.func,
365
357
  pinnedOffset: PropTypes.number.isRequired,
366
358
  pinnedPosition: PropTypes.oneOf([0, 1, 2, 3]).isRequired,
367
359
  rowId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
@@ -2,7 +2,6 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
3
  const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "hasFocus", "isValidating", "debounceMs", "isProcessingProps", "onValueChange"];
4
4
  import * as React from 'react';
5
- import PropTypes from 'prop-types';
6
5
  import { unstable_composeClasses as composeClasses, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
7
6
  import { styled } from '@mui/material/styles';
8
7
  import InputBase from '@mui/material/InputBase';
@@ -94,71 +93,5 @@ const GridEditInputCell = /*#__PURE__*/React.forwardRef((props, ref) => {
94
93
  }) : undefined
95
94
  }, other));
96
95
  });
97
- process.env.NODE_ENV !== "production" ? GridEditInputCell.propTypes = {
98
- // ----------------------------- Warning --------------------------------
99
- // | These PropTypes are generated from the TypeScript type definitions |
100
- // | To update them edit the TypeScript types and run "pnpm proptypes" |
101
- // ----------------------------------------------------------------------
102
- /**
103
- * GridApi that let you manipulate the grid.
104
- */
105
- api: PropTypes.object.isRequired,
106
- /**
107
- * The mode of the cell.
108
- */
109
- cellMode: PropTypes.oneOf(['edit', 'view']).isRequired,
110
- changeReason: PropTypes.oneOf(['debouncedSetEditCellValue', 'setEditCellValue']),
111
- /**
112
- * The column of the row that the current cell belongs to.
113
- */
114
- colDef: PropTypes.object.isRequired,
115
- debounceMs: PropTypes.number,
116
- /**
117
- * The column field of the cell that triggered the event.
118
- */
119
- field: PropTypes.string.isRequired,
120
- /**
121
- * The cell value formatted with the column valueFormatter.
122
- */
123
- formattedValue: PropTypes.any,
124
- /**
125
- * If true, the cell is the active element.
126
- */
127
- hasFocus: PropTypes.bool.isRequired,
128
- /**
129
- * The grid row id.
130
- */
131
- id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
132
- /**
133
- * If true, the cell is editable.
134
- */
135
- isEditable: PropTypes.bool,
136
- isProcessingProps: PropTypes.bool,
137
- isValidating: PropTypes.bool,
138
- /**
139
- * Callback called when the value is changed by the user.
140
- * @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
141
- * @param {Date | null} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
142
- * @returns {Promise<void> | void} A promise to be awaited before calling `apiRef.current.setEditCellValue`
143
- */
144
- onValueChange: PropTypes.func,
145
- /**
146
- * The row model of the row that the current cell belongs to.
147
- */
148
- row: PropTypes.any.isRequired,
149
- /**
150
- * The node of the row that the current cell belongs to.
151
- */
152
- rowNode: PropTypes.object.isRequired,
153
- /**
154
- * the tabIndex value.
155
- */
156
- tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
157
- /**
158
- * The cell value.
159
- * If the column has `valueGetter`, use `params.row` to directly access the fields.
160
- */
161
- value: PropTypes.any
162
- } : void 0;
163
96
  export { GridEditInputCell };
164
97
  export const renderEditInputCell = params => /*#__PURE__*/_jsx(GridEditInputCell, _extends({}, params));