@mui/x-data-grid 5.12.1 → 5.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/CHANGELOG.md +45 -2
  2. package/colDef/gridCheckboxSelectionColDef.d.ts +1 -0
  3. package/colDef/gridCheckboxSelectionColDef.js +2 -1
  4. package/colDef/gridDateOperators.d.ts +1 -1
  5. package/colDef/gridNumericColDef.js +1 -1
  6. package/components/columnHeaders/GridColumnHeaderItem.js +5 -3
  7. package/components/columnSelection/GridCellCheckboxRenderer.js +0 -1
  8. package/components/columnSelection/GridHeaderCheckbox.js +0 -1
  9. package/components/containers/GridRootStyles.js +1 -1
  10. package/components/panel/GridColumnsPanel.js +2 -5
  11. package/components/panel/filterPanel/GridFilterPanel.js +1 -2
  12. package/components/toolbar/GridToolbarColumnsButton.js +0 -1
  13. package/components/toolbar/GridToolbarDensitySelector.js +0 -1
  14. package/components/toolbar/GridToolbarExportContainer.js +0 -1
  15. package/components/toolbar/GridToolbarFilterButton.js +0 -1
  16. package/constants/localeTextConstants.js +1 -0
  17. package/hooks/features/columns/useGridColumnSpanning.d.ts +1 -1
  18. package/hooks/features/columns/useGridColumnSpanning.js +1 -1
  19. package/hooks/features/columns/useGridColumns.d.ts +1 -1
  20. package/hooks/features/dimensions/gridDimensionsApi.d.ts +5 -0
  21. package/hooks/features/dimensions/useGridDimensions.js +9 -8
  22. package/hooks/features/filter/gridFilterState.d.ts +1 -1
  23. package/hooks/features/filter/useGridFilter.d.ts +1 -1
  24. package/hooks/features/rows/useGridRowsMeta.js +79 -77
  25. package/hooks/features/selection/useGridSelectionPreProcessors.js +8 -6
  26. package/hooks/features/sorting/useGridSorting.d.ts +1 -1
  27. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +1 -1
  28. package/hooks/features/virtualization/useGridVirtualScroller.js +42 -8
  29. package/index.js +1 -1
  30. package/legacy/colDef/gridCheckboxSelectionColDef.js +2 -1
  31. package/legacy/colDef/gridNumericColDef.js +1 -1
  32. package/legacy/components/columnHeaders/GridColumnHeaderItem.js +5 -3
  33. package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +0 -1
  34. package/legacy/components/columnSelection/GridHeaderCheckbox.js +0 -1
  35. package/legacy/components/containers/GridRootStyles.js +1 -1
  36. package/legacy/components/panel/GridColumnsPanel.js +2 -5
  37. package/legacy/components/panel/filterPanel/GridFilterPanel.js +1 -2
  38. package/legacy/components/toolbar/GridToolbarColumnsButton.js +0 -1
  39. package/legacy/components/toolbar/GridToolbarDensitySelector.js +0 -1
  40. package/legacy/components/toolbar/GridToolbarExportContainer.js +0 -1
  41. package/legacy/components/toolbar/GridToolbarFilterButton.js +0 -1
  42. package/legacy/constants/localeTextConstants.js +1 -0
  43. package/legacy/hooks/features/columns/useGridColumnSpanning.js +1 -1
  44. package/legacy/hooks/features/dimensions/useGridDimensions.js +9 -8
  45. package/legacy/hooks/features/rows/useGridRowsMeta.js +81 -77
  46. package/legacy/hooks/features/selection/useGridSelectionPreProcessors.js +8 -6
  47. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +42 -8
  48. package/legacy/index.js +1 -1
  49. package/legacy/locales/arSD.js +1 -0
  50. package/legacy/locales/bgBG.js +1 -0
  51. package/legacy/locales/csCZ.js +1 -0
  52. package/legacy/locales/daDK.js +1 -0
  53. package/legacy/locales/deDE.js +1 -0
  54. package/legacy/locales/elGR.js +1 -0
  55. package/legacy/locales/esES.js +1 -0
  56. package/legacy/locales/faIR.js +1 -0
  57. package/legacy/locales/fiFI.js +1 -0
  58. package/legacy/locales/frFR.js +1 -0
  59. package/legacy/locales/heIL.js +1 -0
  60. package/legacy/locales/huHU.js +1 -0
  61. package/legacy/locales/itIT.js +1 -0
  62. package/legacy/locales/jaJP.js +1 -0
  63. package/legacy/locales/koKR.js +1 -0
  64. package/legacy/locales/nbNO.js +1 -0
  65. package/legacy/locales/nlNL.js +1 -0
  66. package/legacy/locales/plPL.js +1 -0
  67. package/legacy/locales/ptBR.js +1 -0
  68. package/legacy/locales/ruRU.js +1 -0
  69. package/legacy/locales/skSK.js +1 -0
  70. package/legacy/locales/trTR.js +1 -0
  71. package/legacy/locales/ukUA.js +1 -0
  72. package/legacy/locales/viVN.js +1 -0
  73. package/legacy/locales/zhCN.js +1 -0
  74. package/locales/arSD.js +1 -0
  75. package/locales/bgBG.js +1 -0
  76. package/locales/csCZ.js +1 -0
  77. package/locales/daDK.js +1 -0
  78. package/locales/deDE.js +1 -0
  79. package/locales/elGR.js +1 -0
  80. package/locales/esES.js +1 -0
  81. package/locales/faIR.js +1 -0
  82. package/locales/fiFI.js +1 -0
  83. package/locales/frFR.js +1 -0
  84. package/locales/heIL.js +1 -0
  85. package/locales/huHU.js +1 -0
  86. package/locales/itIT.js +1 -0
  87. package/locales/jaJP.js +1 -0
  88. package/locales/koKR.js +1 -0
  89. package/locales/nbNO.js +1 -0
  90. package/locales/nlNL.js +1 -0
  91. package/locales/plPL.js +1 -0
  92. package/locales/ptBR.js +1 -0
  93. package/locales/ruRU.js +1 -0
  94. package/locales/skSK.js +1 -0
  95. package/locales/trTR.js +1 -0
  96. package/locales/ukUA.js +1 -0
  97. package/locales/viVN.js +1 -0
  98. package/locales/zhCN.js +1 -0
  99. package/models/api/gridLocaleTextApi.d.ts +1 -0
  100. package/models/colDef/gridColDef.d.ts +1 -1
  101. package/modern/colDef/gridCheckboxSelectionColDef.js +2 -1
  102. package/modern/colDef/gridNumericColDef.js +1 -1
  103. package/modern/components/columnHeaders/GridColumnHeaderItem.js +5 -3
  104. package/modern/components/columnSelection/GridCellCheckboxRenderer.js +0 -1
  105. package/modern/components/columnSelection/GridHeaderCheckbox.js +0 -1
  106. package/modern/components/containers/GridRootStyles.js +1 -1
  107. package/modern/components/panel/GridColumnsPanel.js +2 -5
  108. package/modern/components/panel/filterPanel/GridFilterPanel.js +1 -2
  109. package/modern/components/toolbar/GridToolbarColumnsButton.js +0 -1
  110. package/modern/components/toolbar/GridToolbarDensitySelector.js +0 -1
  111. package/modern/components/toolbar/GridToolbarExportContainer.js +0 -1
  112. package/modern/components/toolbar/GridToolbarFilterButton.js +0 -1
  113. package/modern/constants/localeTextConstants.js +1 -0
  114. package/modern/hooks/features/columns/useGridColumnSpanning.js +1 -1
  115. package/modern/hooks/features/dimensions/useGridDimensions.js +9 -8
  116. package/modern/hooks/features/rows/useGridRowsMeta.js +77 -75
  117. package/modern/hooks/features/selection/useGridSelectionPreProcessors.js +8 -6
  118. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +42 -8
  119. package/modern/index.js +1 -1
  120. package/modern/locales/arSD.js +1 -0
  121. package/modern/locales/bgBG.js +1 -0
  122. package/modern/locales/csCZ.js +1 -0
  123. package/modern/locales/daDK.js +1 -0
  124. package/modern/locales/deDE.js +1 -0
  125. package/modern/locales/elGR.js +1 -0
  126. package/modern/locales/esES.js +1 -0
  127. package/modern/locales/faIR.js +1 -0
  128. package/modern/locales/fiFI.js +1 -0
  129. package/modern/locales/frFR.js +1 -0
  130. package/modern/locales/heIL.js +1 -0
  131. package/modern/locales/huHU.js +1 -0
  132. package/modern/locales/itIT.js +1 -0
  133. package/modern/locales/jaJP.js +1 -0
  134. package/modern/locales/koKR.js +1 -0
  135. package/modern/locales/nbNO.js +1 -0
  136. package/modern/locales/nlNL.js +1 -0
  137. package/modern/locales/plPL.js +1 -0
  138. package/modern/locales/ptBR.js +1 -0
  139. package/modern/locales/ruRU.js +1 -0
  140. package/modern/locales/skSK.js +1 -0
  141. package/modern/locales/trTR.js +1 -0
  142. package/modern/locales/ukUA.js +1 -0
  143. package/modern/locales/viVN.js +1 -0
  144. package/modern/locales/zhCN.js +1 -0
  145. package/node/colDef/gridCheckboxSelectionColDef.js +4 -2
  146. package/node/colDef/gridNumericColDef.js +1 -1
  147. package/node/components/columnHeaders/GridColumnHeaderItem.js +5 -3
  148. package/node/components/columnSelection/GridCellCheckboxRenderer.js +0 -1
  149. package/node/components/columnSelection/GridHeaderCheckbox.js +0 -1
  150. package/node/components/containers/GridRootStyles.js +1 -1
  151. package/node/components/panel/GridColumnsPanel.js +2 -5
  152. package/node/components/panel/filterPanel/GridFilterPanel.js +1 -2
  153. package/node/components/toolbar/GridToolbarColumnsButton.js +0 -1
  154. package/node/components/toolbar/GridToolbarDensitySelector.js +0 -1
  155. package/node/components/toolbar/GridToolbarExportContainer.js +0 -1
  156. package/node/components/toolbar/GridToolbarFilterButton.js +0 -1
  157. package/node/constants/localeTextConstants.js +1 -0
  158. package/node/hooks/features/columns/useGridColumnSpanning.js +11 -16
  159. package/node/hooks/features/dimensions/useGridDimensions.js +9 -8
  160. package/node/hooks/features/rows/useGridRowsMeta.js +80 -77
  161. package/node/hooks/features/selection/useGridSelectionPreProcessors.js +7 -5
  162. package/node/hooks/features/virtualization/useGridVirtualScroller.js +42 -9
  163. package/node/index.js +1 -1
  164. package/node/locales/arSD.js +1 -0
  165. package/node/locales/bgBG.js +1 -0
  166. package/node/locales/csCZ.js +1 -0
  167. package/node/locales/daDK.js +1 -0
  168. package/node/locales/deDE.js +1 -0
  169. package/node/locales/elGR.js +1 -0
  170. package/node/locales/esES.js +1 -0
  171. package/node/locales/faIR.js +1 -0
  172. package/node/locales/fiFI.js +1 -0
  173. package/node/locales/frFR.js +1 -0
  174. package/node/locales/heIL.js +1 -0
  175. package/node/locales/huHU.js +1 -0
  176. package/node/locales/itIT.js +1 -0
  177. package/node/locales/jaJP.js +1 -0
  178. package/node/locales/koKR.js +1 -0
  179. package/node/locales/nbNO.js +1 -0
  180. package/node/locales/nlNL.js +1 -0
  181. package/node/locales/plPL.js +1 -0
  182. package/node/locales/ptBR.js +1 -0
  183. package/node/locales/ruRU.js +1 -0
  184. package/node/locales/skSK.js +1 -0
  185. package/node/locales/trTR.js +1 -0
  186. package/node/locales/ukUA.js +1 -0
  187. package/node/locales/viVN.js +1 -0
  188. package/node/locales/zhCN.js +1 -0
  189. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,49 @@
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
+ ## v5.12.2
7
+
8
+ _Jun 16, 2022_
9
+
10
+ We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🚀 Performance improvement for dynamic row height (#5135) @m4theushw
13
+ - 🕒 Add demo of how to use the data grid with date pickers (#5053) @cherniavskii
14
+ - 📚 Documentation improvements
15
+ - 🐞 Bugfixes
16
+
17
+ ### `@mui/x-data-grid@v5.12.2` / `@mui/x-data-grid-pro@v5.12.2` / `@mui/x-data-grid-premium@v5.12.2`
18
+
19
+ #### Changes
20
+
21
+ - [DataGrid] Fix for cosmetic bug on column filter badge (#5170) @simbahandiane
22
+ - [DataGrid] Hide vertical scrollbar if `autoHeight` is enabled (#5164) @m4theushw
23
+ - [DataGrid] Use exponential search to render non-measured rows (#5135) @m4theushw
24
+ - [DataGridPro] Fix label of the detail panel toggle column (#5191) @m4theushw
25
+ - [DataGridPro] Refresh detail panel caches when props change (#5110) @m4theushw
26
+
27
+ ### Docs
28
+
29
+ - [docs] Add example with custom checkbox column (#5161) @flaviendelangle
30
+ - [docs] Batch small changes (#5177) @oliviertassinari
31
+ - [docs] Fix demo currency format (#5034) @oliviertassinari
32
+ - [docs] Fix outdated license description to match the EULA (#5219) @joserodolfofreitas
33
+ - [docs] Fix redundant headers (#5104) @oliviertassinari
34
+ - [docs] Fix some capitalization to match the guidelines (#5105) @oliviertassinari
35
+ - [docs] Improve the `getRowId` doc section (#5156) @flaviendelangle
36
+ - [docs] Instruction to deal with invalid license message (#5074) @joserodolfofreitas
37
+ - [docs] Use redirection in the code (#5114) @oliviertassinari
38
+ - [docs] Add demo of how to use the data grid with date pickers (#5053) @cherniavskii
39
+
40
+ ### Core
41
+
42
+ - [core] Improve inline code rendering within the details tag (#5166) @Harmouch101
43
+ - [core] Remove unused props from plugin typing (#5185) @flaviendelangle
44
+ - [core] Use the scrollbar size from `useGridDimensions` on `DataGridProColumnHeaders` (#5201) @flaviendelangle
45
+ - [core] Fix `GridColTypeDef` type (#5167) @cherniavskii
46
+ - [core] Fix `GridColTypeDef` usage in demo (#5197) @cherniavskii
47
+ - [test] Add `waitFor` before asserting height (#5203) @m4theushw
48
+
6
49
  ## v5.12.1
7
50
 
8
51
  _Jun 9, 2022_
@@ -4084,9 +4127,9 @@ Big thanks to the 8 contributors who made this release possible. Here are some h
4084
4127
 
4085
4128
  ### Docs
4086
4129
 
4087
- - [docs] Data Grid depends on side effects (#666) @oliviertassinari
4130
+ - [docs] Data grid depends on side effects (#666) @oliviertassinari
4088
4131
  - [docs] Clarify the purpose of x-grid-data-generator (#634) @Elius94
4089
- - [docs] Data Grid is in the lab (#612) @oliviertassinari
4132
+ - [docs] Data grid is in the lab (#612) @oliviertassinari
4090
4133
  - [docs] Fix Demo app, downgrade webpack-cli, known issue in latest version (#647) @dtassone
4091
4134
  - [docs] Fix typo in columns.md @stojy
4092
4135
  - [docs] Reduce confusion on /export page (#646) @SerdarMustafa1
@@ -1,2 +1,3 @@
1
1
  import { GridColDef } from '../models/colDef/gridColDef';
2
+ export declare const GRID_CHECKBOX_SELECTION_FIELD = "__check__";
2
3
  export declare const GRID_CHECKBOX_SELECTION_COL_DEF: GridColDef;
@@ -5,8 +5,9 @@ import { GridHeaderCheckbox } from '../components/columnSelection/GridHeaderChec
5
5
  import { selectedIdsLookupSelector } from '../hooks/features/selection/gridSelectionSelector';
6
6
  import { GRID_BOOLEAN_COL_DEF } from './gridBooleanColDef';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
+ export const GRID_CHECKBOX_SELECTION_FIELD = '__check__';
8
9
  export const GRID_CHECKBOX_SELECTION_COL_DEF = _extends({}, GRID_BOOLEAN_COL_DEF, {
9
- field: '__check__',
10
+ field: GRID_CHECKBOX_SELECTION_FIELD,
10
11
  type: 'checkboxSelection',
11
12
  width: 50,
12
13
  resizable: false,
@@ -1,2 +1,2 @@
1
1
  import { GridFilterOperator } from '../models/gridFilterOperator';
2
- export declare const getGridDateOperators: (showTime?: boolean | undefined) => GridFilterOperator<any, string | number | Date, any>[];
2
+ export declare const getGridDateOperators: (showTime?: boolean | undefined) => GridFilterOperator<any, string | Date, any>[];
@@ -11,7 +11,7 @@ export const GRID_NUMERIC_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
11
11
  valueParser: value => value === '' ? null : Number(value),
12
12
  valueFormatter: ({
13
13
  value
14
- }) => value && isNumber(value) && value.toLocaleString() || value,
14
+ }) => isNumber(value) ? value.toLocaleString() : value || '',
15
15
  filterOperators: getGridNumericOperators(),
16
16
  getApplyQuickFilterFn: getGridNumericQuickFilterFn
17
17
  });
@@ -167,6 +167,7 @@ function GridColumnHeaderItem(props) {
167
167
  field: column.field,
168
168
  colDef: column
169
169
  }) : column.headerClassName;
170
+ const label = (_column$headerName = column.headerName) != null ? _column$headerName : column.field;
170
171
  return /*#__PURE__*/_jsxs("div", _extends({
171
172
  ref: headerCellRef,
172
173
  className: clsx(classes.root, headerClassName),
@@ -179,7 +180,8 @@ function GridColumnHeaderItem(props) {
179
180
  role: "columnheader",
180
181
  tabIndex: tabIndex,
181
182
  "aria-colindex": colIndex + 1,
182
- "aria-sort": ariaSort
183
+ "aria-sort": ariaSort,
184
+ "aria-label": column.renderHeader && headerComponent == null ? label : undefined
183
185
  }, mouseEventsHandlers, {
184
186
  children: [/*#__PURE__*/_jsxs("div", _extends({
185
187
  className: classes.draggableContainer,
@@ -189,8 +191,8 @@ function GridColumnHeaderItem(props) {
189
191
  className: classes.titleContainer,
190
192
  children: [/*#__PURE__*/_jsx("div", {
191
193
  className: classes.titleContainerContent,
192
- children: headerComponent || /*#__PURE__*/_jsx(GridColumnHeaderTitle, {
193
- label: (_column$headerName = column.headerName) != null ? _column$headerName : column.field,
194
+ children: column.renderHeader ? headerComponent : /*#__PURE__*/_jsx(GridColumnHeaderTitle, {
195
+ label: label,
194
196
  description: column.description,
195
197
  columnWidth: width
196
198
  })
@@ -85,7 +85,6 @@ const GridCellCheckboxForwardRef = /*#__PURE__*/React.forwardRef(function GridCe
85
85
  checked: isChecked,
86
86
  onChange: handleChange,
87
87
  className: classes.root,
88
- color: "primary",
89
88
  inputProps: {
90
89
  'aria-label': label
91
90
  },
@@ -111,7 +111,6 @@ const GridHeaderCheckbox = /*#__PURE__*/React.forwardRef(function GridHeaderChec
111
111
  checked: isChecked,
112
112
  onChange: handleChange,
113
113
  className: classes.root,
114
- color: "primary",
115
114
  inputProps: {
116
115
  'aria-label': label
117
116
  },
@@ -165,7 +165,7 @@ export const GridRootStyles = styled('div', {
165
165
  minWidth: 0,
166
166
  flex: 1,
167
167
  whiteSpace: 'nowrap',
168
- overflow: 'hidden'
168
+ overflowX: 'hidden'
169
169
  },
170
170
  [`& .${gridClasses.columnHeaderTitleContainerContent}`]: {
171
171
  overflow: 'hidden',
@@ -135,7 +135,6 @@ export function GridColumnsPanel(props) {
135
135
  checked: columnVisibilityModel[column.field] !== false,
136
136
  onClick: toggleColumn,
137
137
  name: column.field,
138
- color: "primary",
139
138
  size: "small"
140
139
  }, (_rootProps$components2 = rootProps.componentsProps) == null ? void 0 : _rootProps$components2.baseSwitch)),
141
140
  label: column.headerName || column.field
@@ -152,13 +151,11 @@ export function GridColumnsPanel(props) {
152
151
  })
153
152
  }), /*#__PURE__*/_jsxs(GridPanelFooter, {
154
153
  children: [/*#__PURE__*/_jsx(rootProps.components.BaseButton, _extends({
155
- onClick: () => toggleAllColumns(false),
156
- color: "primary"
154
+ onClick: () => toggleAllColumns(false)
157
155
  }, (_rootProps$components3 = rootProps.componentsProps) == null ? void 0 : _rootProps$components3.baseButton, {
158
156
  children: apiRef.current.getLocaleText('columnsPanelHideAllButton')
159
157
  })), /*#__PURE__*/_jsx(rootProps.components.BaseButton, _extends({
160
- onClick: () => toggleAllColumns(true),
161
- color: "primary"
158
+ onClick: () => toggleAllColumns(true)
162
159
  }, (_rootProps$components4 = rootProps.componentsProps) == null ? void 0 : _rootProps$components4.baseButton, {
163
160
  children: apiRef.current.getLocaleText('columnsPanelShowAllButton')
164
161
  }))]
@@ -113,8 +113,7 @@ const GridFilterPanel = /*#__PURE__*/React.forwardRef(function GridFilterPanel(p
113
113
  }), !rootProps.disableMultipleColumnsFiltering && /*#__PURE__*/_jsx(GridPanelFooter, {
114
114
  children: /*#__PURE__*/_jsx(rootProps.components.BaseButton, _extends({
115
115
  onClick: addNewFilter,
116
- startIcon: /*#__PURE__*/_jsx(GridAddIcon, {}),
117
- color: "primary"
116
+ startIcon: /*#__PURE__*/_jsx(GridAddIcon, {})
118
117
  }, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseButton, {
119
118
  children: apiRef.current.getLocaleText('filterPanelAddFilter')
120
119
  }))
@@ -41,7 +41,6 @@ export const GridToolbarColumnsButton = /*#__PURE__*/React.forwardRef(function G
41
41
  return /*#__PURE__*/_jsx(rootProps.components.BaseButton, _extends({
42
42
  ref: ref,
43
43
  size: "small",
44
- color: "primary",
45
44
  "aria-label": apiRef.current.getLocaleText('toolbarColumnsLabel'),
46
45
  startIcon: /*#__PURE__*/_jsx(rootProps.components.ColumnSelectorIcon, {})
47
46
  }, other, {
@@ -95,7 +95,6 @@ export const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function
95
95
  return /*#__PURE__*/_jsxs(React.Fragment, {
96
96
  children: [/*#__PURE__*/_jsx(rootProps.components.BaseButton, _extends({
97
97
  ref: handleRef,
98
- color: "primary",
99
98
  size: "small",
100
99
  startIcon: startIcon,
101
100
  "aria-label": apiRef.current.getLocaleText('toolbarDensityLabel'),
@@ -52,7 +52,6 @@ export const GridToolbarExportContainer = /*#__PURE__*/React.forwardRef(function
52
52
  return /*#__PURE__*/_jsxs(React.Fragment, {
53
53
  children: [/*#__PURE__*/_jsx(rootProps.components.BaseButton, _extends({
54
54
  ref: handleRef,
55
- color: "primary",
56
55
  size: "small",
57
56
  startIcon: /*#__PURE__*/_jsx(rootProps.components.ExportIcon, {}),
58
57
  "aria-expanded": open ? 'true' : undefined,
@@ -108,7 +108,6 @@ const GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolb
108
108
  children: /*#__PURE__*/_jsx(rootProps.components.BaseButton, _extends({
109
109
  ref: ref,
110
110
  size: "small",
111
- color: "primary",
112
111
  "aria-label": apiRef.current.getLocaleText('toolbarFiltersLabel'),
113
112
  startIcon: /*#__PURE__*/_jsx(Badge, {
114
113
  badgeContent: activeFilters.length,
@@ -105,6 +105,7 @@ export const GRID_DEFAULT_LOCALE_TEXT = {
105
105
  groupColumn: name => `Group by ${name}`,
106
106
  unGroupColumn: name => `Stop grouping by ${name}`,
107
107
  // Master/detail
108
+ detailPanelToggle: 'Detail panel toggle',
108
109
  expandDetailPanel: 'Expand',
109
110
  collapseDetailPanel: 'Collapse',
110
111
  // Used core components translation keys
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import * as React from 'react';
2
2
  import { GridApiCommunity } from '../../../models/api/gridApiCommunity';
3
3
  /**
4
4
  * @requires useGridColumns (method, event)
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import * as React from 'react';
2
2
  import { useGridApiMethod } from '../../utils/useGridApiMethod';
3
3
  import { useGridApiEventHandler } from '../../utils/useGridApiEventHandler';
4
4
 
@@ -8,4 +8,4 @@ export declare const columnsStateInitializer: GridStateInitializer<Pick<DataGrid
8
8
  * @requires useGridDimensions (method, event) - can be after
9
9
  * TODO: Impossible priority - useGridParamsApi also needs to be after useGridColumns
10
10
  */
11
- export declare function useGridColumns(apiRef: React.MutableRefObject<GridApiCommunity>, props: Pick<DataGridProcessedProps, 'initialState' | 'columns' | 'onColumnVisibilityChange' | 'columnVisibilityModel' | 'onColumnVisibilityModelChange' | 'columnTypes' | 'classes' | 'components' | 'componentsProps'>): void;
11
+ export declare function useGridColumns(apiRef: React.MutableRefObject<GridApiCommunity>, props: Pick<DataGridProcessedProps, 'columns' | 'onColumnVisibilityChange' | 'columnVisibilityModel' | 'onColumnVisibilityModelChange' | 'columnTypes' | 'components' | 'componentsProps'>): void;
@@ -16,6 +16,11 @@ export interface GridDimensions {
16
16
  * Indicates if a scroll is currently needed to go from the beginning of the first row to the end of the last row.
17
17
  */
18
18
  hasScrollY: boolean;
19
+ /**
20
+ * Size of the scrollbar used to scroll the rows in pixel.
21
+ * It is defined even when the scrollbar is currently not needed.
22
+ */
23
+ scrollBarSize: number;
19
24
  }
20
25
  export interface GridDimensionsApi {
21
26
  /**
@@ -37,7 +37,7 @@ const hasScroll = ({
37
37
 
38
38
  export function useGridDimensions(apiRef, props) {
39
39
  const logger = useGridLogger(apiRef, 'useResizeContainer');
40
- const warningShown = React.useRef(false);
40
+ const errorShown = React.useRef(false);
41
41
  const rootDimensionsRef = React.useRef(null);
42
42
  const fullDimensionsRef = React.useRef(null);
43
43
  const rowsMeta = useGridSelector(apiRef, gridRowsMetaSelector);
@@ -94,7 +94,8 @@ export function useGridDimensions(apiRef, props) {
94
94
  viewportOuterSize,
95
95
  viewportInnerSize,
96
96
  hasScrollX,
97
- hasScrollY
97
+ hasScrollY,
98
+ scrollBarSize
98
99
  };
99
100
  const prevDimensions = fullDimensionsRef.current;
100
101
  fullDimensionsRef.current = newFullDimensions;
@@ -144,14 +145,14 @@ export function useGridDimensions(apiRef, props) {
144
145
 
145
146
  const isJSDOM = /jsdom/.test(window.navigator.userAgent);
146
147
 
147
- if (size.height === 0 && !warningShown.current && !props.autoHeight && !isJSDOM) {
148
- logger.warn(['The parent of the grid has an empty height.', 'You need to make sure the container has an intrinsic height.', 'The grid displays with a height of 0px.', '', 'You can find a solution in the docs:', 'https://mui.com/x/react-data-grid/layout/'].join('\n'));
149
- warningShown.current = true;
148
+ if (size.height === 0 && !errorShown.current && !props.autoHeight && !isJSDOM) {
149
+ logger.error(['The parent DOM element of the data grid has an empty height.', 'Please make sure that this element has an intrinsic height.', 'The grid displays with a height of 0px.', '', 'More details: https://mui.com/r/x-data-grid-no-dimensions.'].join('\n'));
150
+ errorShown.current = true;
150
151
  }
151
152
 
152
- if (size.width === 0 && !warningShown.current && !isJSDOM) {
153
- logger.warn(['The parent of the grid has an empty width.', 'You need to make sure the container has an intrinsic width.', 'The grid displays with a width of 0px.', '', 'You can find a solution in the docs:', 'https://mui.com/x/react-data-grid/layout/'].join('\n'));
154
- warningShown.current = true;
153
+ if (size.width === 0 && !errorShown.current && !isJSDOM) {
154
+ logger.error(['The parent DOM element of the data grid has an empty width.', 'Please make sure that this element has an intrinsic width.', 'The grid displays with a width of 0px.', '', 'More details: https://mui.com/r/x-data-grid-no-dimensions.'].join('\n'));
155
+ errorShown.current = true;
155
156
  }
156
157
 
157
158
  if (isTestEnvironment) {
@@ -19,7 +19,7 @@ export interface GridFilterState {
19
19
  /**
20
20
  * Amount of descendants that are passing the filters.
21
21
  * For the Tree Data, it includes all the intermediate depth levels (= amount of children + amount of grand children + ...).
22
- * For the Row Grouping by Column, it does not include the intermediate depth levels (= amount of descendant of maximum depth).
22
+ * For the Row grouping by column, it does not include the intermediate depth levels (= amount of descendant of maximum depth).
23
23
  * If a row is not registered in this lookup, it is supposed to have no descendant passing the filters.
24
24
  */
25
25
  filteredDescendantCountLookup: Record<GridRowId, number>;
@@ -8,4 +8,4 @@ export declare const filterStateInitializer: GridStateInitializer<Pick<DataGridP
8
8
  * @requires useGridParamsApi (method)
9
9
  * @requires useGridRows (event)
10
10
  */
11
- export declare const useGridFilter: (apiRef: React.MutableRefObject<GridApiCommunity>, props: Pick<DataGridProcessedProps, 'initialState' | 'filterModel' | 'onFilterModelChange' | 'filterMode' | 'disableMultipleColumnsFiltering' | 'components' | 'componentsProps'>) => void;
11
+ export declare const useGridFilter: (apiRef: React.MutableRefObject<GridApiCommunity>, props: Pick<DataGridProcessedProps, 'filterModel' | 'onFilterModelChange' | 'filterMode' | 'disableMultipleColumnsFiltering' | 'components' | 'componentsProps'>) => void;
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
+ import { debounce } from '@mui/material/utils';
3
4
  import { useGridVisibleRows } from '../../utils/useGridVisibleRows';
4
5
  import { useGridApiMethod } from '../../utils/useGridApiMethod';
5
6
  import { useGridSelector } from '../../utils/useGridSelector';
@@ -36,86 +37,86 @@ export const useGridRowsMeta = (apiRef, props) => {
36
37
  const currentPage = useGridVisibleRows(apiRef, props);
37
38
  const hydrateRowsMeta = React.useCallback(() => {
38
39
  hasRowWithAutoHeight.current = false;
39
- apiRef.current.setState(state => {
40
- const densityFactor = gridDensityFactorSelector(state, apiRef.current.instanceId);
41
- const positions = [];
42
- const currentPageTotalHeight = currentPage.rows.reduce((acc, row) => {
43
- positions.push(acc);
44
-
45
- if (!rowsHeightLookup.current[row.id]) {
46
- rowsHeightLookup.current[row.id] = {
47
- sizes: {
48
- base: rowHeightFromDensity
49
- },
50
- isResized: false,
51
- autoHeight: false,
52
- needsFirstMeasurement: true // Assume all rows will need to be measured by default
53
-
54
- };
55
- }
40
+ const densityFactor = gridDensityFactorSelector(apiRef.current.state, apiRef.current.instanceId);
41
+ const positions = [];
42
+ const currentPageTotalHeight = currentPage.rows.reduce((acc, row) => {
43
+ positions.push(acc);
44
+
45
+ if (!rowsHeightLookup.current[row.id]) {
46
+ rowsHeightLookup.current[row.id] = {
47
+ sizes: {
48
+ base: rowHeightFromDensity
49
+ },
50
+ isResized: false,
51
+ autoHeight: false,
52
+ needsFirstMeasurement: true // Assume all rows will need to be measured by default
56
53
 
57
- const {
58
- isResized,
59
- needsFirstMeasurement,
60
- sizes
61
- } = rowsHeightLookup.current[row.id];
62
- let baseRowHeight = rowHeightFromDensity;
63
- const existingBaseRowHeight = sizes.base;
64
-
65
- if (isResized) {
66
- // Do not recalculate resized row height and use the value from the lookup
67
- baseRowHeight = existingBaseRowHeight;
68
- } else if (getRowHeightProp) {
69
- const rowHeightFromUser = getRowHeightProp(_extends({}, row, {
70
- densityFactor
71
- }));
72
-
73
- if (rowHeightFromUser === 'auto') {
74
- if (needsFirstMeasurement) {
75
- const estimatedRowHeight = getEstimatedRowHeight ? getEstimatedRowHeight(_extends({}, row, {
76
- densityFactor
77
- })) : rowHeightFromDensity; // If the row was not measured yet use the estimated row height
78
-
79
- baseRowHeight = estimatedRowHeight != null ? estimatedRowHeight : rowHeightFromDensity;
80
- } else {
81
- baseRowHeight = existingBaseRowHeight;
82
- }
83
-
84
- hasRowWithAutoHeight.current = true;
85
- rowsHeightLookup.current[row.id].autoHeight = true;
54
+ };
55
+ }
56
+
57
+ const {
58
+ isResized,
59
+ needsFirstMeasurement,
60
+ sizes
61
+ } = rowsHeightLookup.current[row.id];
62
+ let baseRowHeight = rowHeightFromDensity;
63
+ const existingBaseRowHeight = sizes.base;
64
+
65
+ if (isResized) {
66
+ // Do not recalculate resized row height and use the value from the lookup
67
+ baseRowHeight = existingBaseRowHeight;
68
+ } else if (getRowHeightProp) {
69
+ const rowHeightFromUser = getRowHeightProp(_extends({}, row, {
70
+ densityFactor
71
+ }));
72
+
73
+ if (rowHeightFromUser === 'auto') {
74
+ if (needsFirstMeasurement) {
75
+ const estimatedRowHeight = getEstimatedRowHeight ? getEstimatedRowHeight(_extends({}, row, {
76
+ densityFactor
77
+ })) : rowHeightFromDensity; // If the row was not measured yet use the estimated row height
78
+
79
+ baseRowHeight = estimatedRowHeight != null ? estimatedRowHeight : rowHeightFromDensity;
86
80
  } else {
87
- // Default back to base rowHeight if getRowHeight returns null or undefined.
88
- baseRowHeight = rowHeightFromUser != null ? rowHeightFromUser : rowHeightFromDensity;
89
- rowsHeightLookup.current[row.id].needsFirstMeasurement = false;
90
- rowsHeightLookup.current[row.id].autoHeight = false;
81
+ baseRowHeight = existingBaseRowHeight;
91
82
  }
83
+
84
+ hasRowWithAutoHeight.current = true;
85
+ rowsHeightLookup.current[row.id].autoHeight = true;
92
86
  } else {
87
+ // Default back to base rowHeight if getRowHeight returns null or undefined.
88
+ baseRowHeight = rowHeightFromUser != null ? rowHeightFromUser : rowHeightFromDensity;
93
89
  rowsHeightLookup.current[row.id].needsFirstMeasurement = false;
94
- } // We use an object to make simple to check if a height is already added or not
95
-
96
-
97
- const initialHeights = {
98
- base: baseRowHeight
99
- };
100
-
101
- if (getRowSpacing) {
102
- var _spacing$top, _spacing$bottom;
103
-
104
- const indexRelativeToCurrentPage = apiRef.current.getRowIndexRelativeToVisibleRows(row.id);
105
- const spacing = getRowSpacing(_extends({}, row, {
106
- isFirstVisible: indexRelativeToCurrentPage === 0,
107
- isLastVisible: indexRelativeToCurrentPage === currentPage.rows.length - 1,
108
- indexRelativeToCurrentPage
109
- }));
110
- initialHeights.spacingTop = (_spacing$top = spacing.top) != null ? _spacing$top : 0;
111
- initialHeights.spacingBottom = (_spacing$bottom = spacing.bottom) != null ? _spacing$bottom : 0;
90
+ rowsHeightLookup.current[row.id].autoHeight = false;
112
91
  }
113
-
114
- const processedSizes = apiRef.current.unstable_applyPipeProcessors('rowHeight', initialHeights, row);
115
- rowsHeightLookup.current[row.id].sizes = processedSizes;
116
- const finalRowHeight = Object.values(processedSizes).reduce((acc2, value) => acc2 + value, 0);
117
- return acc + finalRowHeight;
118
- }, 0);
92
+ } else {
93
+ rowsHeightLookup.current[row.id].needsFirstMeasurement = false;
94
+ } // We use an object to make simple to check if a height is already added or not
95
+
96
+
97
+ const initialHeights = {
98
+ base: baseRowHeight
99
+ };
100
+
101
+ if (getRowSpacing) {
102
+ var _spacing$top, _spacing$bottom;
103
+
104
+ const indexRelativeToCurrentPage = apiRef.current.getRowIndexRelativeToVisibleRows(row.id);
105
+ const spacing = getRowSpacing(_extends({}, row, {
106
+ isFirstVisible: indexRelativeToCurrentPage === 0,
107
+ isLastVisible: indexRelativeToCurrentPage === currentPage.rows.length - 1,
108
+ indexRelativeToCurrentPage
109
+ }));
110
+ initialHeights.spacingTop = (_spacing$top = spacing.top) != null ? _spacing$top : 0;
111
+ initialHeights.spacingBottom = (_spacing$bottom = spacing.bottom) != null ? _spacing$bottom : 0;
112
+ }
113
+
114
+ const processedSizes = apiRef.current.unstable_applyPipeProcessors('rowHeight', initialHeights, row);
115
+ rowsHeightLookup.current[row.id].sizes = processedSizes;
116
+ const finalRowHeight = Object.values(processedSizes).reduce((acc2, value) => acc2 + value, 0);
117
+ return acc + finalRowHeight;
118
+ }, 0);
119
+ apiRef.current.setState(state => {
119
120
  return _extends({}, state, {
120
121
  rowsMeta: {
121
122
  currentPageTotalHeight,
@@ -148,6 +149,7 @@ export const useGridRowsMeta = (apiRef, props) => {
148
149
  rowsHeightLookup.current[id].needsFirstMeasurement = false;
149
150
  hydrateRowsMeta();
150
151
  }, [hydrateRowsMeta]);
152
+ const debouncedHydrateRowsMeta = React.useMemo(() => debounce(hydrateRowsMeta), [hydrateRowsMeta]);
151
153
  const storeMeasuredRowHeight = React.useCallback((id, height) => {
152
154
  if (!rowsHeightLookup.current[id] || !rowsHeightLookup.current[id].autoHeight) {
153
155
  return;
@@ -159,9 +161,9 @@ export const useGridRowsMeta = (apiRef, props) => {
159
161
  rowsHeightLookup.current[id].sizes.base = height;
160
162
 
161
163
  if (needsHydration) {
162
- hydrateRowsMeta();
164
+ debouncedHydrateRowsMeta();
163
165
  }
164
- }, [hydrateRowsMeta]);
166
+ }, [debouncedHydrateRowsMeta]);
165
167
  const rowHasAutoHeight = React.useCallback(id => {
166
168
  var _rowsHeightLookup$cur2;
167
169
 
@@ -171,7 +173,7 @@ export const useGridRowsMeta = (apiRef, props) => {
171
173
  return lastMeasuredRowIndex.current;
172
174
  }, []);
173
175
  const setLastMeasuredRowIndex = React.useCallback(index => {
174
- if (hasRowWithAutoHeight.current) {
176
+ if (hasRowWithAutoHeight.current && index > lastMeasuredRowIndex.current) {
175
177
  lastMeasuredRowIndex.current = index;
176
178
  }
177
179
  }, []); // The effect is used to build the rows meta data - currentPageTotalHeight and positions.
@@ -3,7 +3,7 @@ import * as React from 'react';
3
3
  import { unstable_composeClasses as composeClasses } from '@mui/material';
4
4
  import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
5
5
  import { getDataGridUtilityClass } from '../../../constants';
6
- import { GRID_CHECKBOX_SELECTION_COL_DEF } from '../../../colDef';
6
+ import { GRID_CHECKBOX_SELECTION_COL_DEF, GRID_CHECKBOX_SELECTION_FIELD } from '../../../colDef';
7
7
 
8
8
  const useUtilityClasses = ownerState => {
9
9
  const {
@@ -31,14 +31,16 @@ export const useGridSelectionPreProcessors = (apiRef, props) => {
31
31
  });
32
32
 
33
33
  const shouldHaveSelectionColumn = props.checkboxSelection;
34
- const haveSelectionColumn = columnsState.lookup[selectionColumn.field] != null;
34
+ const haveSelectionColumn = columnsState.lookup[GRID_CHECKBOX_SELECTION_FIELD] != null;
35
35
 
36
36
  if (shouldHaveSelectionColumn && !haveSelectionColumn) {
37
- columnsState.lookup[selectionColumn.field] = selectionColumn;
38
- columnsState.all = [selectionColumn.field, ...columnsState.all];
37
+ columnsState.lookup[GRID_CHECKBOX_SELECTION_FIELD] = selectionColumn;
38
+ columnsState.all = [GRID_CHECKBOX_SELECTION_FIELD, ...columnsState.all];
39
39
  } else if (!shouldHaveSelectionColumn && haveSelectionColumn) {
40
- delete columnsState.lookup[selectionColumn.field];
41
- columnsState.all = columnsState.all.filter(field => field !== selectionColumn.field);
40
+ delete columnsState.lookup[GRID_CHECKBOX_SELECTION_FIELD];
41
+ columnsState.all = columnsState.all.filter(field => field !== GRID_CHECKBOX_SELECTION_FIELD);
42
+ } else if (shouldHaveSelectionColumn && haveSelectionColumn) {
43
+ columnsState.lookup[GRID_CHECKBOX_SELECTION_FIELD] = _extends({}, selectionColumn, columnsState.lookup[GRID_CHECKBOX_SELECTION_FIELD]);
42
44
  }
43
45
 
44
46
  return columnsState;
@@ -7,4 +7,4 @@ export declare const sortingStateInitializer: GridStateInitializer<Pick<DataGrid
7
7
  * @requires useGridRows (event)
8
8
  * @requires useGridColumns (event)
9
9
  */
10
- export declare const useGridSorting: (apiRef: React.MutableRefObject<GridApiCommunity>, props: Pick<DataGridProcessedProps, 'initialState' | 'sortModel' | 'onSortModelChange' | 'sortingOrder' | 'sortingMode' | 'disableMultipleColumnsSorting'>) => void;
10
+ export declare const useGridSorting: (apiRef: React.MutableRefObject<GridApiCommunity>, props: Pick<DataGridProcessedProps, 'sortModel' | 'onSortModelChange' | 'sortingOrder' | 'sortingMode' | 'disableMultipleColumnsSorting'>) => void;
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { GridRenderContext } from '../../../models';
3
3
  import { GridRowId, GridRowModel } from '../../../models/gridRows';
4
- export declare function getIndexFromScroll(offset: number, positions: number[], sliceStart?: number, sliceEnd?: number): number;
4
+ export declare function binarySearch(offset: number, positions: number[], sliceStart?: number, sliceEnd?: number): number;
5
5
  export declare const getRenderableIndexes: ({ firstIndex, lastIndex, buffer, minFirstIndex, maxLastIndex, }: {
6
6
  firstIndex: number;
7
7
  lastIndex: number;