@mui/x-data-grid 5.6.0 → 5.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/DataGrid/DataGrid.js +18 -3
  3. package/DataGrid/useDataGridComponent.js +19 -15
  4. package/DataGrid/useDataGridProps.js +3 -2
  5. package/colDef/gridNumericOperators.d.ts +1 -1
  6. package/colDef/gridNumericOperators.js +1 -1
  7. package/components/ErrorBoundary.d.ts +2 -2
  8. package/components/GridRow.js +29 -3
  9. package/components/base/GridErrorHandler.d.ts +8 -2
  10. package/components/base/GridErrorHandler.js +13 -2
  11. package/components/cell/GridBooleanCell.d.ts +2 -1
  12. package/components/cell/GridCell.js +4 -2
  13. package/components/cell/GridEditBooleanCell.d.ts +2 -1
  14. package/components/cell/GridEditDateCell.d.ts +2 -1
  15. package/components/cell/GridEditInputCell.d.ts +2 -1
  16. package/components/cell/GridEditSingleSelectCell.d.ts +2 -1
  17. package/components/cell/GridEditSingleSelectCell.js +2 -1
  18. package/components/columnHeaders/GridColumnHeaderItem.js +5 -3
  19. package/components/containers/GridRootStyles.js +1 -1
  20. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +2 -1
  21. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +27 -23
  22. package/components/panel/filterPanel/filterPanelUtils.d.ts +2 -2
  23. package/components/virtualization/GridVirtualScrollerRenderZone.js +4 -1
  24. package/constants/gridClasses.d.ts +5 -1
  25. package/constants/gridClasses.js +1 -1
  26. package/context/GridContextProvider.d.ts +9 -6
  27. package/hooks/features/columnMenu/useGridColumnMenu.d.ts +2 -0
  28. package/hooks/features/columnMenu/useGridColumnMenu.js +6 -7
  29. package/hooks/features/columns/gridColumnsSelector.d.ts +8 -8
  30. package/hooks/features/columns/gridColumnsSelector.js +11 -10
  31. package/hooks/features/columns/gridColumnsUtils.js +7 -5
  32. package/hooks/features/density/useGridDensity.d.ts +2 -0
  33. package/hooks/features/density/useGridDensity.js +3 -4
  34. package/hooks/features/dimensions/useGridDimensions.js +2 -2
  35. package/hooks/features/editRows/useGridEditing.d.ts +2 -0
  36. package/hooks/features/editRows/useGridEditing.js +3 -4
  37. package/hooks/features/export/serializers/csvSerializer.js +4 -4
  38. package/hooks/features/filter/gridFilterSelector.d.ts +1 -0
  39. package/hooks/features/filter/gridFilterSelector.js +1 -0
  40. package/hooks/features/focus/useGridFocus.d.ts +2 -0
  41. package/hooks/features/focus/useGridFocus.js +10 -11
  42. package/hooks/features/keyboard/useGridKeyboardNavigation.js +2 -2
  43. package/hooks/features/pagination/useGridPage.d.ts +1 -2
  44. package/hooks/features/pagination/useGridPage.js +5 -17
  45. package/hooks/features/pagination/useGridPageSize.d.ts +1 -2
  46. package/hooks/features/pagination/useGridPageSize.js +5 -26
  47. package/hooks/features/pagination/useGridPagination.d.ts +2 -0
  48. package/hooks/features/pagination/useGridPagination.js +25 -2
  49. package/hooks/features/preferencesPanel/useGridPreferencesPanel.d.ts +3 -1
  50. package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +10 -11
  51. package/hooks/features/rows/useGridParamsApi.js +3 -10
  52. package/hooks/features/rows/useGridRows.js +14 -6
  53. package/hooks/features/rows/useGridRowsMeta.d.ts +3 -1
  54. package/hooks/features/rows/useGridRowsMeta.js +42 -24
  55. package/hooks/features/selection/gridSelectionSelector.d.ts +1 -1
  56. package/hooks/features/selection/useGridSelection.d.ts +2 -0
  57. package/hooks/features/selection/useGridSelection.js +28 -16
  58. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +8 -3
  59. package/hooks/features/virtualization/useGridVirtualScroller.js +4 -4
  60. package/hooks/utils/useGridApi.js +10 -1
  61. package/hooks/utils/useGridInitializeState.d.ts +2 -1
  62. package/hooks/utils/useGridSelector.js +4 -4
  63. package/hooks/utils/useGridState.js +10 -1
  64. package/hooks/utils/{useCurrentPageRows.d.ts → useGridVisibleRows.d.ts} +7 -6
  65. package/hooks/utils/{useCurrentPageRows.js → useGridVisibleRows.js} +8 -7
  66. package/index.js +1 -1
  67. package/internals/index.d.ts +9 -12
  68. package/internals/index.js +9 -12
  69. package/legacy/DataGrid/DataGrid.js +18 -3
  70. package/legacy/DataGrid/useDataGridComponent.js +19 -15
  71. package/legacy/DataGrid/useDataGridProps.js +8 -2
  72. package/legacy/colDef/gridNumericOperators.js +1 -1
  73. package/legacy/components/GridRow.js +30 -3
  74. package/legacy/components/base/GridErrorHandler.js +13 -2
  75. package/legacy/components/cell/GridCell.js +4 -2
  76. package/legacy/components/cell/GridEditSingleSelectCell.js +10 -9
  77. package/legacy/components/columnHeaders/GridColumnHeaderItem.js +5 -3
  78. package/legacy/components/containers/GridRootStyles.js +1 -1
  79. package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +29 -26
  80. package/legacy/components/virtualization/GridVirtualScrollerRenderZone.js +4 -1
  81. package/legacy/constants/gridClasses.js +1 -1
  82. package/legacy/hooks/features/columnMenu/useGridColumnMenu.js +8 -9
  83. package/legacy/hooks/features/columns/gridColumnsSelector.js +13 -12
  84. package/legacy/hooks/features/columns/gridColumnsUtils.js +7 -5
  85. package/legacy/hooks/features/density/useGridDensity.js +5 -6
  86. package/legacy/hooks/features/dimensions/useGridDimensions.js +2 -2
  87. package/legacy/hooks/features/editRows/useGridEditing.js +5 -6
  88. package/legacy/hooks/features/export/serializers/csvSerializer.js +4 -4
  89. package/legacy/hooks/features/filter/gridFilterSelector.js +1 -0
  90. package/legacy/hooks/features/focus/useGridFocus.js +12 -13
  91. package/legacy/hooks/features/keyboard/useGridKeyboardNavigation.js +2 -2
  92. package/legacy/hooks/features/pagination/useGridPage.js +5 -17
  93. package/legacy/hooks/features/pagination/useGridPageSize.js +5 -26
  94. package/legacy/hooks/features/pagination/useGridPagination.js +25 -2
  95. package/legacy/hooks/features/preferencesPanel/useGridPreferencesPanel.js +10 -11
  96. package/legacy/hooks/features/rows/useGridParamsApi.js +3 -10
  97. package/legacy/hooks/features/rows/useGridRows.js +17 -6
  98. package/legacy/hooks/features/rows/useGridRowsMeta.js +44 -26
  99. package/legacy/hooks/features/selection/useGridSelection.js +29 -19
  100. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +4 -4
  101. package/legacy/hooks/utils/useGridApi.js +7 -0
  102. package/legacy/hooks/utils/useGridSelector.js +4 -4
  103. package/legacy/hooks/utils/useGridState.js +7 -0
  104. package/legacy/hooks/utils/{useCurrentPageRows.js → useGridVisibleRows.js} +8 -7
  105. package/legacy/index.js +1 -1
  106. package/legacy/internals/index.js +9 -12
  107. package/legacy/models/colDef/gridDefaultColumnTypes.js +4 -4
  108. package/legacy/utils/createSelector.js +4 -4
  109. package/legacy/utils/getGridLocalization.js +2 -2
  110. package/lib/lodash/_baseGetAllKeys.d.ts +1 -1
  111. package/lib/lodash/_baseIsEqual.d.ts +1 -1
  112. package/lib/lodash/_baseIsEqualDeep.d.ts +1 -1
  113. package/lib/lodash/_baseKeys.d.ts +1 -1
  114. package/lib/lodash/_cacheHas.d.ts +1 -1
  115. package/lib/lodash/_equalArrays.d.ts +1 -1
  116. package/lib/lodash/_equalByTag.d.ts +1 -1
  117. package/lib/lodash/_equalObjects.d.ts +1 -1
  118. package/lib/lodash/_getAllKeys.d.ts +1 -1
  119. package/lib/lodash/_getMapData.d.ts +1 -1
  120. package/lib/lodash/_getNative.d.ts +1 -1
  121. package/lib/lodash/_getValue.d.ts +1 -1
  122. package/lib/lodash/_hashSet.d.ts +1 -1
  123. package/lib/lodash/_listCacheSet.d.ts +1 -1
  124. package/lib/lodash/_mapCacheSet.d.ts +1 -1
  125. package/lib/lodash/_mapToArray.d.ts +1 -1
  126. package/lib/lodash/_setCacheAdd.d.ts +1 -1
  127. package/lib/lodash/_setToArray.d.ts +1 -1
  128. package/lib/lodash/_stackSet.d.ts +1 -1
  129. package/lib/lodash/keys.d.ts +1 -1
  130. package/models/api/gridRowApi.d.ts +6 -0
  131. package/models/api/gridRowsMetaApi.d.ts +7 -0
  132. package/models/api/gridSortApi.d.ts +1 -0
  133. package/models/colDef/gridColDef.d.ts +1 -2
  134. package/models/colDef/gridDefaultColumnTypes.js +2 -2
  135. package/models/gridRows.d.ts +8 -2
  136. package/models/params/gridRowParams.d.ts +29 -1
  137. package/models/props/DataGridProps.d.ts +20 -4
  138. package/modern/DataGrid/DataGrid.js +18 -3
  139. package/modern/DataGrid/useDataGridComponent.js +19 -15
  140. package/modern/DataGrid/useDataGridProps.js +3 -2
  141. package/modern/colDef/gridNumericOperators.js +1 -1
  142. package/modern/components/GridRow.js +29 -3
  143. package/modern/components/base/GridErrorHandler.js +13 -2
  144. package/modern/components/cell/GridCell.js +2 -2
  145. package/modern/components/cell/GridEditSingleSelectCell.js +2 -1
  146. package/modern/components/columnHeaders/GridColumnHeaderItem.js +5 -3
  147. package/modern/components/containers/GridRootStyles.js +1 -1
  148. package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +27 -23
  149. package/modern/components/virtualization/GridVirtualScrollerRenderZone.js +4 -1
  150. package/modern/constants/gridClasses.js +1 -1
  151. package/modern/hooks/features/columnMenu/useGridColumnMenu.js +6 -7
  152. package/modern/hooks/features/columns/gridColumnsSelector.js +11 -10
  153. package/modern/hooks/features/columns/gridColumnsUtils.js +7 -5
  154. package/modern/hooks/features/density/useGridDensity.js +3 -4
  155. package/modern/hooks/features/dimensions/useGridDimensions.js +2 -2
  156. package/modern/hooks/features/editRows/useGridEditing.js +3 -4
  157. package/modern/hooks/features/export/serializers/csvSerializer.js +4 -4
  158. package/modern/hooks/features/filter/gridFilterSelector.js +1 -0
  159. package/modern/hooks/features/focus/useGridFocus.js +10 -11
  160. package/modern/hooks/features/keyboard/useGridKeyboardNavigation.js +2 -2
  161. package/modern/hooks/features/pagination/useGridPage.js +1 -9
  162. package/modern/hooks/features/pagination/useGridPageSize.js +1 -20
  163. package/modern/hooks/features/pagination/useGridPagination.js +23 -2
  164. package/modern/hooks/features/preferencesPanel/useGridPreferencesPanel.js +6 -7
  165. package/modern/hooks/features/rows/useGridParamsApi.js +3 -10
  166. package/modern/hooks/features/rows/useGridRows.js +14 -6
  167. package/modern/hooks/features/rows/useGridRowsMeta.js +36 -24
  168. package/modern/hooks/features/selection/useGridSelection.js +24 -16
  169. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +4 -4
  170. package/modern/hooks/utils/useGridApi.js +10 -1
  171. package/modern/hooks/utils/useGridSelector.js +4 -4
  172. package/modern/hooks/utils/useGridState.js +10 -1
  173. package/modern/hooks/utils/{useCurrentPageRows.js → useGridVisibleRows.js} +8 -7
  174. package/modern/index.js +1 -1
  175. package/modern/internals/index.js +9 -12
  176. package/modern/models/colDef/gridDefaultColumnTypes.js +2 -2
  177. package/modern/utils/createSelector.js +4 -4
  178. package/modern/utils/getGridLocalization.js +1 -1
  179. package/node/DataGrid/DataGrid.js +18 -3
  180. package/node/DataGrid/useDataGridComponent.js +11 -9
  181. package/node/DataGrid/useDataGridProps.js +3 -2
  182. package/node/colDef/gridNumericOperators.js +1 -1
  183. package/node/components/GridRow.js +28 -3
  184. package/node/components/base/GridErrorHandler.js +11 -1
  185. package/node/components/cell/GridCell.js +4 -2
  186. package/node/components/cell/GridEditSingleSelectCell.js +2 -1
  187. package/node/components/columnHeaders/GridColumnHeaderItem.js +5 -3
  188. package/node/components/containers/GridRootStyles.js +1 -1
  189. package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +27 -23
  190. package/node/components/virtualization/GridVirtualScrollerRenderZone.js +4 -1
  191. package/node/constants/gridClasses.js +1 -1
  192. package/node/hooks/features/columnMenu/useGridColumnMenu.js +10 -8
  193. package/node/hooks/features/columns/gridColumnsSelector.js +11 -9
  194. package/node/hooks/features/columns/gridColumnsUtils.js +7 -5
  195. package/node/hooks/features/density/useGridDensity.js +7 -6
  196. package/node/hooks/features/dimensions/useGridDimensions.js +2 -2
  197. package/node/hooks/features/editRows/useGridEditing.js +8 -5
  198. package/node/hooks/features/export/serializers/csvSerializer.js +5 -4
  199. package/node/hooks/features/filter/gridFilterSelector.js +1 -0
  200. package/node/hooks/features/focus/useGridFocus.js +15 -13
  201. package/node/hooks/features/keyboard/useGridKeyboardNavigation.js +2 -2
  202. package/node/hooks/features/pagination/useGridPage.js +7 -20
  203. package/node/hooks/features/pagination/useGridPageSize.js +6 -26
  204. package/node/hooks/features/pagination/useGridPagination.js +31 -1
  205. package/node/hooks/features/preferencesPanel/useGridPreferencesPanel.js +15 -13
  206. package/node/hooks/features/rows/useGridParamsApi.js +4 -10
  207. package/node/hooks/features/rows/useGridRows.js +15 -6
  208. package/node/hooks/features/rows/useGridRowsMeta.js +47 -26
  209. package/node/hooks/features/selection/useGridSelection.js +32 -18
  210. package/node/hooks/features/virtualization/useGridVirtualScroller.js +4 -4
  211. package/node/hooks/utils/useGridApi.js +11 -1
  212. package/node/hooks/utils/useGridSelector.js +6 -4
  213. package/node/hooks/utils/useGridState.js +11 -1
  214. package/node/hooks/utils/{useCurrentPageRows.js → useGridVisibleRows.js} +11 -10
  215. package/node/index.js +1 -1
  216. package/node/internals/index.js +45 -21
  217. package/node/models/colDef/gridDefaultColumnTypes.js +2 -2
  218. package/node/utils/createSelector.js +5 -4
  219. package/node/utils/getGridLocalization.js +2 -2
  220. package/package.json +2 -2
  221. package/utils/createSelector.js +4 -4
  222. package/utils/getGridLocalization.d.ts +2 -1
  223. package/utils/getGridLocalization.js +2 -2
  224. package/utils/keyboardUtils.d.ts +1 -1
  225. package/utils/warning.d.ts +1 -1
  226. package/hooks/utils/useGridStateInit.d.ts +0 -7
  227. package/hooks/utils/useGridStateInit.js +0 -9
  228. package/legacy/hooks/utils/useGridStateInit.js +0 -9
  229. package/modern/hooks/utils/useGridStateInit.js +0 -9
  230. package/node/hooks/utils/useGridStateInit.js +0 -23
@@ -10,7 +10,7 @@ import { gridVisibleColumnDefinitionsSelector, gridColumnsTotalWidthSelector, gr
10
10
  import { gridDensityRowHeightSelector } from '../density/densitySelector';
11
11
  import { gridFocusCellSelector, gridTabIndexCellSelector } from '../focus/gridFocusStateSelector';
12
12
  import { gridEditRowsStateSelector } from '../editRows/gridEditRowsSelector';
13
- import { useCurrentPageRows } from '../../utils/useCurrentPageRows';
13
+ import { useGridVisibleRows } from '../../utils/useGridVisibleRows';
14
14
  import { GridEvents } from '../../../models/events';
15
15
  import { useGridApiEventHandler } from '../../utils/useGridApiEventHandler';
16
16
  import { clamp } from '../../../utils/utils';
@@ -51,7 +51,7 @@ export const useGridVirtualScroller = props => {
51
51
  const rowsMeta = useGridSelector(apiRef, gridRowsMetaSelector);
52
52
  const editRowsState = useGridSelector(apiRef, gridEditRowsStateSelector);
53
53
  const selectedRowsLookup = useGridSelector(apiRef, selectedIdsLookupSelector);
54
- const currentPage = useCurrentPageRows(apiRef, rootProps);
54
+ const currentPage = useGridVisibleRows(apiRef, rootProps);
55
55
  const renderZoneRef = React.useRef(null);
56
56
  const rootRef = React.useRef(null);
57
57
  const handleRef = useForkRef(ref, rootRef);
@@ -122,7 +122,7 @@ export const useGridVirtualScroller = props => {
122
122
  firstIndex: nextRenderContext.firstRowIndex,
123
123
  lastIndex: nextRenderContext.lastRowIndex,
124
124
  minFirstIndex: 0,
125
- maxLastIndex: currentPage.range?.lastRowIndex,
125
+ maxLastIndex: currentPage.range?.lastRowIndex || 0,
126
126
  buffer: rootProps.rowBuffer
127
127
  });
128
128
  const [firstColumnToRender] = getRenderableIndexes({
@@ -265,7 +265,7 @@ export const useGridVirtualScroller = props => {
265
265
  firstColumnToRender: firstColumnToRender,
266
266
  lastColumnToRender: lastColumnToRender,
267
267
  selected: isSelected,
268
- index: currentPage.range.firstRowIndex + nextRenderContext.firstRowIndex + i,
268
+ index: currentPage.range.firstRowIndex + firstRowToRender + i,
269
269
  containerWidth: availableSpace,
270
270
  isLastVisible: lastVisibleRowIndex
271
271
  }, typeof getRowProps === 'function' ? getRowProps(id, model) : {}, rootProps.componentsProps?.row), id));
@@ -1,4 +1,13 @@
1
+ import { buildWarning } from '../../utils/warning';
2
+ const deprecationWarning = buildWarning(['MUI: The hook useGridApi is deprecated and will be removed in the next major version.', 'Access the ref content with apiRef.current instead']);
1
3
  /**
2
4
  * @deprecated Use `apiRef.current` instead.
3
5
  */
4
- export const useGridApi = apiRef => apiRef.current;
6
+
7
+ export const useGridApi = apiRef => {
8
+ if (process.env.NODE_ENV !== 'production') {
9
+ deprecationWarning();
10
+ }
11
+
12
+ return apiRef.current;
13
+ };
@@ -1,14 +1,14 @@
1
- let warnedOnceStateNotInitialized = false;
1
+ import { buildWarning } from '../../utils/warning';
2
2
 
3
3
  function isOutputSelector(selector) {
4
4
  return selector.cache;
5
5
  }
6
6
 
7
+ const stateNotInitializedWarning = buildWarning(['MUI: `useGridSelector` has been called before the initialization of the state.', 'This hook can only be used inside the context of the grid.']);
7
8
  export const useGridSelector = (apiRef, selector) => {
8
9
  if (process.env.NODE_ENV !== 'production') {
9
- if (!warnedOnceStateNotInitialized && !apiRef.current.state) {
10
- warnedOnceStateNotInitialized = true;
11
- console.warn(['MUI: `useGridSelector` has been called before the initialization of the state.', 'This hook can only be used inside the context of the grid.'].join('\n'));
10
+ if (!apiRef.current.state) {
11
+ stateNotInitializedWarning();
12
12
  }
13
13
  }
14
14
 
@@ -1,4 +1,13 @@
1
+ import { buildWarning } from '../../utils/warning';
2
+ const deprecationWarning = buildWarning(['MUI: The hook useGridState is deprecated and will be removed in the next major version.', 'The two lines below are equivalent', '', 'const [state, setState, forceUpdate] = useGridState(apiRef);', 'const { state, setState, forceUpdate } = apiRef.current']);
1
3
  /**
2
4
  * @deprecated Use `apiRef.current.state`, `apiRef.current.setState` and `apiRef.current.forceUpdate` instead.
3
5
  */
4
- export const useGridState = apiRef => [apiRef.current.state, apiRef.current.setState, apiRef.current.forceUpdate];
6
+
7
+ export const useGridState = apiRef => {
8
+ if (process.env.NODE_ENV !== 'production') {
9
+ deprecationWarning();
10
+ }
11
+
12
+ return [apiRef.current.state, apiRef.current.setState, apiRef.current.forceUpdate];
13
+ };
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { gridPaginationRowRangeSelector, gridPaginatedVisibleSortedGridRowEntriesSelector } from '../features/pagination/gridPaginationSelector';
3
3
  import { gridVisibleSortedRowEntriesSelector } from '../features/filter/gridFilterSelector';
4
- export const getCurrentPageRows = (apiRef, props) => {
4
+ export const getVisibleRows = (apiRef, props) => {
5
5
  let rows;
6
6
  let range;
7
7
 
@@ -27,14 +27,15 @@ export const getCurrentPageRows = (apiRef, props) => {
27
27
  };
28
28
  };
29
29
  /**
30
- * Compute the list of the rows in the current page
31
- * - If the pagination is disabled or in server mode, it equals all the visible rows
32
- * - If the row tree has several layers, it contains up to `state.pageSize` top level rows and all their descendants
33
- * - If the row tree is flat, it only contains up to `state.pageSize` rows
30
+ * Computes the list of rows that are reachable by scroll.
31
+ * Depending on whether pagination is enabled, it will return the rows in the current page.
32
+ * - If the pagination is disabled or in server mode, it equals all the visible rows.
33
+ * - If the row tree has several layers, it contains up to `state.pageSize` top level rows and all their descendants.
34
+ * - If the row tree is flat, it only contains up to `state.pageSize` rows.
34
35
  */
35
36
 
36
- export const useCurrentPageRows = (apiRef, props) => {
37
- const response = getCurrentPageRows(apiRef, props);
37
+ export const useGridVisibleRows = (apiRef, props) => {
38
+ const response = getVisibleRows(apiRef, props);
38
39
  return React.useMemo(() => ({
39
40
  rows: response.rows,
40
41
  range: response.range
package/modern/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.6.0
1
+ /** @license MUI v5.6.1
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -7,25 +7,23 @@ export { useGridRegisterPreProcessor } from '../hooks/core/preProcessing';
7
7
  export { useGridInitialization } from '../hooks/core/useGridInitialization';
8
8
  export { useGridClipboard } from '../hooks/features/clipboard/useGridClipboard';
9
9
  export { useGridColumnHeaders } from '../hooks/features/columnHeaders/useGridColumnHeaders';
10
- export { useGridColumnMenu } from '../hooks/features/columnMenu/useGridColumnMenu';
10
+ export { useGridColumnMenu, columnMenuStateInitializer } from '../hooks/features/columnMenu/useGridColumnMenu';
11
11
  export { useGridColumns, columnsStateInitializer } from '../hooks/features/columns/useGridColumns';
12
- export { useGridDensity } from '../hooks/features/density/useGridDensity';
12
+ export { useGridDensity, densityStateInitializer } from '../hooks/features/density/useGridDensity';
13
13
  export { useGridCsvExport } from '../hooks/features/export/useGridCsvExport';
14
14
  export { useGridPrintExport } from '../hooks/features/export/useGridPrintExport';
15
15
  export { useGridFilter, filterStateInitializer } from '../hooks/features/filter/useGridFilter';
16
16
  export { useGridRegisterFilteringMethod } from '../hooks/features/filter/useGridRegisterFilteringMethod';
17
- export { useGridFocus } from '../hooks/features/focus/useGridFocus';
17
+ export { useGridFocus, focusStateInitializer } from '../hooks/features/focus/useGridFocus';
18
18
  export { useGridKeyboard } from '../hooks/features/keyboard/useGridKeyboard';
19
19
  export { useGridKeyboardNavigation } from '../hooks/features/keyboard/useGridKeyboardNavigation';
20
- export { useGridPagination } from '../hooks/features/pagination/useGridPagination';
21
- export { pageStateInitializer } from '../hooks/features/pagination/useGridPage';
22
- export { pageSizeStateInitializer } from '../hooks/features/pagination/useGridPageSize';
23
- export { useGridPreferencesPanel } from '../hooks/features/preferencesPanel/useGridPreferencesPanel';
24
- export { useGridEditing } from '../hooks/features/editRows/useGridEditing';
20
+ export { useGridPagination, paginationStateInitializer } from '../hooks/features/pagination/useGridPagination';
21
+ export { useGridPreferencesPanel, preferencePanelStateInitializer } from '../hooks/features/preferencesPanel/useGridPreferencesPanel';
22
+ export { useGridEditing, editingStateInitializer } from '../hooks/features/editRows/useGridEditing';
25
23
  export { useGridRows, rowsStateInitializer } from '../hooks/features/rows/useGridRows';
26
- export { useGridRowsMeta } from '../hooks/features/rows/useGridRowsMeta';
24
+ export { useGridRowsMeta, rowsMetaStateInitializer } from '../hooks/features/rows/useGridRowsMeta';
27
25
  export { useGridParamsApi } from '../hooks/features/rows/useGridParamsApi';
28
- export { useGridSelection } from '../hooks/features/selection/useGridSelection';
26
+ export { useGridSelection, selectionStateInitializer } from '../hooks/features/selection/useGridSelection';
29
27
  export { useGridSelectionPreProcessors } from '../hooks/features/selection/useGridSelectionPreProcessors';
30
28
  export { useGridSorting, sortingStateInitializer } from '../hooks/features/sorting/useGridSorting';
31
29
  export { useGridRegisterSortingMethod } from '../hooks/features/sorting/useGridRegisterSortingMethod';
@@ -34,9 +32,8 @@ export { useGridEvents } from '../hooks/features/events/useGridEvents';
34
32
  export { useGridDimensions } from '../hooks/features/dimensions/useGridDimensions';
35
33
  export { useGridStatePersistence } from '../hooks/features/statePersistence/useGridStatePersistence';
36
34
  export { useGridVirtualScroller } from '../hooks/features/virtualization/useGridVirtualScroller';
37
- export { useCurrentPageRows } from '../hooks/utils/useCurrentPageRows';
35
+ export { useGridVisibleRows } from '../hooks/utils/useGridVisibleRows';
38
36
  export { useGridInitializeState } from '../hooks/utils/useGridInitializeState';
39
- export { useGridStateInit } from '../hooks/utils/useGridStateInit';
40
37
  export { createSelector } from '../utils/createSelector';
41
38
  export { findParentElementFromClassName } from '../utils/domUtils';
42
39
  export { isNavigationKey } from '../utils/keyboardUtils';
@@ -13,8 +13,8 @@ export const getGridDefaultColumnTypes = () => {
13
13
  dateTime: GRID_DATETIME_COL_DEF,
14
14
  boolean: GRID_BOOLEAN_COL_DEF,
15
15
  singleSelect: GRID_SINGLE_SELECT_COL_DEF,
16
- [GRID_ACTIONS_COLUMN_TYPE]: GRID_ACTIONS_COL_DEF
16
+ [GRID_ACTIONS_COLUMN_TYPE]: GRID_ACTIONS_COL_DEF,
17
+ [DEFAULT_GRID_COL_TYPE_KEY]: GRID_STRING_COL_DEF
17
18
  };
18
- nativeColumnTypes[DEFAULT_GRID_COL_TYPE_KEY] = GRID_STRING_COL_DEF;
19
19
  return nativeColumnTypes;
20
20
  };
@@ -1,6 +1,7 @@
1
1
  import { createSelector as reselectCreateSelector } from 'reselect';
2
+ import { buildWarning } from './warning';
2
3
  const cache = {};
3
- let warnedOnce = false;
4
+ const missingInstanceIdWarning = buildWarning(['MUI: A selector was called without passing the instance ID, which may impact the performance of the grid.', 'To fix, call it with `apiRef`, e.g. `mySelector(apiRef)`, or pass the instance ID explicitly, e.g `mySelector(state, apiRef.current.instanceId)`.']);
4
5
  export const createSelector = (...args) => {
5
6
  const selector = (...selectorArgs) => {
6
7
  const [stateOrApiRef, instanceId] = selectorArgs;
@@ -9,9 +10,8 @@ export const createSelector = (...args) => {
9
10
  const state = isApiRef ? stateOrApiRef.current.state : stateOrApiRef;
10
11
 
11
12
  if (process.env.NODE_ENV !== 'production') {
12
- if (!warnedOnce && cacheKey === 'default') {
13
- console.warn(['MUI: A selector was called without passing the instance ID, which may impact the performance of the grid.', 'To fix, call it with `apiRef`, e.g. `mySelector(apiRef)`, or pass the instance ID explicitly, e.g `mySelector(state, apiRef.current.instanceId)`.'].join('\n'));
14
- warnedOnce = true;
13
+ if (cacheKey === 'default') {
14
+ missingInstanceIdWarning();
15
15
  }
16
16
  }
17
17
 
@@ -4,7 +4,7 @@ export const getGridLocalization = (gridTranslations, coreTranslations) => ({
4
4
  MuiDataGrid: {
5
5
  defaultProps: {
6
6
  localeText: _extends({}, gridTranslations, {
7
- MuiTablePagination: coreTranslations?.components?.MuiTablePagination.defaultProps || {}
7
+ MuiTablePagination: coreTranslations?.components?.MuiTablePagination?.defaultProps || {}
8
8
  })
9
9
  }
10
10
  }
@@ -102,6 +102,7 @@ DataGridRaw.propTypes = {
102
102
  * Set of columns of type [[GridColumns]].
103
103
  */
104
104
  columns: (0, _utils.chainPropTypes)(_propTypes.default.array.isRequired, props => {
105
+ // @ts-ignore because otherwise `build:api` doesn't work
105
106
  if (props.columns && props.columns.some(column => column.resizable)) {
106
107
  return new Error([`MUI: \`column.resizable = true\` is not a valid prop.`, 'Column resizing is not available in the MIT version.', '', 'You need to upgrade to the DataGridPro component to unlock this feature.'].join('\n'));
107
108
  }
@@ -205,7 +206,8 @@ DataGridRaw.propTypes = {
205
206
  * 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.
206
207
  */
207
208
  experimentalFeatures: _propTypes.default.shape({
208
- preventCommitWhileValidating: _propTypes.default.bool
209
+ preventCommitWhileValidating: _propTypes.default.bool,
210
+ warnIfFocusStateIsNotSynced: _propTypes.default.bool
209
211
  }),
210
212
 
211
213
  /**
@@ -244,7 +246,7 @@ DataGridRaw.propTypes = {
244
246
 
245
247
  /**
246
248
  * Function that applies CSS classes dynamically on rows.
247
- * @param {GridRowParams} params With all properties from [[GridRowParams]].
249
+ * @param {GridRowClassNameParams} params With all properties from [[GridRowClassNameParams]].
248
250
  * @returns {string} The CSS class to apply to the row.
249
251
  */
250
252
  getRowClassName: _propTypes.default.func,
@@ -261,6 +263,13 @@ DataGridRaw.propTypes = {
261
263
  */
262
264
  getRowId: _propTypes.default.func,
263
265
 
266
+ /**
267
+ * Function that allows to specify the spacing between rows.
268
+ * @param {GridRowSpacingParams} params With all properties from [[GridRowSpacingParams]].
269
+ * @returns {GridRowSpacing} The row spacing values.
270
+ */
271
+ getRowSpacing: _propTypes.default.func,
272
+
264
273
  /**
265
274
  * Set the height in pixel of the column headers in the grid.
266
275
  * @default 56
@@ -313,7 +322,7 @@ DataGridRaw.propTypes = {
313
322
 
314
323
  /**
315
324
  * Set the locale text of the grid.
316
- * You can find all the translation keys supported in [the source](https://github.com/mui/mui-x/blob/HEAD/packages/grid/x-data-grid/src/internals/constants/localeTextConstants.ts) in the GitHub repository.
325
+ * You can find all the translation keys supported in [the source](https://github.com/mui/mui-x/blob/HEAD/packages/grid/x-data-grid/src/constants/localeTextConstants.ts) in the GitHub repository.
317
326
  */
318
327
  localeText: _propTypes.default.object,
319
328
 
@@ -637,6 +646,12 @@ DataGridRaw.propTypes = {
637
646
  */
638
647
  rows: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
639
648
 
649
+ /**
650
+ * Sets the type of space between rows added by `getRowSpacing`.
651
+ * @default "margin"
652
+ */
653
+ rowSpacingType: _propTypes.default.oneOf(['border', 'margin']),
654
+
640
655
  /**
641
656
  * Select the pageSize dynamically using the component UI.
642
657
  * @default [25, 50, 100]
@@ -31,10 +31,6 @@ var _useGridKeyboardNavigation = require("../hooks/features/keyboard/useGridKeyb
31
31
 
32
32
  var _useGridPagination = require("../hooks/features/pagination/useGridPagination");
33
33
 
34
- var _useGridPage = require("../hooks/features/pagination/useGridPage");
35
-
36
- var _useGridPageSize = require("../hooks/features/pagination/useGridPageSize");
37
-
38
34
  var _useGridPreferencesPanel = require("../hooks/features/preferencesPanel/useGridPreferencesPanel");
39
35
 
40
36
  var _useGridEditing = require("../hooks/features/editRows/useGridEditing");
@@ -70,12 +66,18 @@ const useDataGridComponent = props => {
70
66
  * Register all state initializers here.
71
67
  */
72
68
 
73
- (0, _useGridInitializeState.useGridInitializeState)(_useGridFilter.filterStateInitializer, apiRef, props);
74
- (0, _useGridInitializeState.useGridInitializeState)(_useGridPageSize.pageSizeStateInitializer, apiRef, props);
75
- (0, _useGridInitializeState.useGridInitializeState)(_useGridPage.pageStateInitializer, apiRef, props);
69
+ (0, _useGridInitializeState.useGridInitializeState)(_useGridSelection.selectionStateInitializer, apiRef, props);
70
+ (0, _useGridInitializeState.useGridInitializeState)(_useGridColumns.columnsStateInitializer, apiRef, props);
76
71
  (0, _useGridInitializeState.useGridInitializeState)(_useGridRows.rowsStateInitializer, apiRef, props);
72
+ (0, _useGridInitializeState.useGridInitializeState)(_useGridEditing.editingStateInitializer, apiRef, props);
73
+ (0, _useGridInitializeState.useGridInitializeState)(_useGridFocus.focusStateInitializer, apiRef, props);
77
74
  (0, _useGridInitializeState.useGridInitializeState)(_useGridSorting.sortingStateInitializer, apiRef, props);
78
- (0, _useGridInitializeState.useGridInitializeState)(_useGridColumns.columnsStateInitializer, apiRef, props);
75
+ (0, _useGridInitializeState.useGridInitializeState)(_useGridPreferencesPanel.preferencePanelStateInitializer, apiRef, props);
76
+ (0, _useGridInitializeState.useGridInitializeState)(_useGridFilter.filterStateInitializer, apiRef, props);
77
+ (0, _useGridInitializeState.useGridInitializeState)(_useGridDensity.densityStateInitializer, apiRef, props);
78
+ (0, _useGridInitializeState.useGridInitializeState)(_useGridPagination.paginationStateInitializer, apiRef, props);
79
+ (0, _useGridInitializeState.useGridInitializeState)(_useGridRowsMeta.rowsMetaStateInitializer, apiRef, props);
80
+ (0, _useGridInitializeState.useGridInitializeState)(_useGridColumnMenu.columnMenuStateInitializer, apiRef, props);
79
81
  (0, _useGridSelection.useGridSelection)(apiRef, props);
80
82
  (0, _useGridColumns.useGridColumns)(apiRef, props);
81
83
  (0, _useGridRows.useGridRows)(apiRef, props);
@@ -83,7 +85,7 @@ const useDataGridComponent = props => {
83
85
  (0, _useGridEditing.useGridEditing)(apiRef, props);
84
86
  (0, _useGridFocus.useGridFocus)(apiRef, props);
85
87
  (0, _useGridSorting.useGridSorting)(apiRef, props);
86
- (0, _useGridPreferencesPanel.useGridPreferencesPanel)(apiRef, props);
88
+ (0, _useGridPreferencesPanel.useGridPreferencesPanel)(apiRef);
87
89
  (0, _useGridFilter.useGridFilter)(apiRef, props);
88
90
  (0, _useGridDensity.useGridDensity)(apiRef, props);
89
91
  (0, _useGridPagination.useGridPagination)(apiRef, props);
@@ -73,6 +73,7 @@ const DATA_GRID_PROPS_DEFAULT_VALUES = {
73
73
  paginationMode: _models.GridFeatureModeConstant.client,
74
74
  rowHeight: 52,
75
75
  rowsPerPageOptions: [25, 50, 100],
76
+ rowSpacingType: 'margin',
76
77
  showCellRightBorder: false,
77
78
  showColumnRightBorder: false,
78
79
  sortingOrder: ['asc', 'desc', null],
@@ -101,8 +102,8 @@ const useDataGridProps = inProps => {
101
102
  }
102
103
 
103
104
  const mergedComponents = {};
104
- Object.keys(_constants.DATA_GRID_DEFAULT_SLOTS_COMPONENTS).forEach(key => {
105
- mergedComponents[key] = overrides[key] === undefined ? _constants.DATA_GRID_DEFAULT_SLOTS_COMPONENTS[key] : overrides[key];
105
+ Object.entries(_constants.DATA_GRID_DEFAULT_SLOTS_COMPONENTS).forEach(([key, defaultComponent]) => {
106
+ mergedComponents[key] = overrides[key] === undefined ? defaultComponent : overrides[key];
106
107
  });
107
108
  return mergedComponents;
108
109
  }, [themedProps.components]);
@@ -185,5 +185,5 @@ const getGridNumericOperators = () => [{
185
185
 
186
186
 
187
187
  exports.getGridNumericOperators = getGridNumericOperators;
188
- const getGridNumericColumnOperators = (0, _warning.wrapWithWarningOnCall)(getGridNumericOperators, 'MUI: Using getGridNumericColumnOperators is deprecated, use getGridNumericOperators instead.');
188
+ const getGridNumericColumnOperators = (0, _warning.wrapWithWarningOnCall)(getGridNumericOperators, ['MUI: The method getGridNumericColumnOperators is deprecated and will be removed in the next major version.', 'Use getGridNumericOperators instead.']);
189
189
  exports.getGridNumericColumnOperators = getGridNumericColumnOperators;
@@ -33,6 +33,8 @@ var _gridColumnsSelector = require("../hooks/features/columns/gridColumnsSelecto
33
33
 
34
34
  var _useGridSelector = require("../hooks/utils/useGridSelector");
35
35
 
36
+ var _useGridVisibleRows = require("../hooks/utils/useGridVisibleRows");
37
+
36
38
  var _domUtils = require("../utils/domUtils");
37
39
 
38
40
  var _gridCheckboxSelectionColDef = require("../colDef/gridCheckboxSelectionColDef");
@@ -107,6 +109,7 @@ function GridRow(props) {
107
109
 
108
110
  const apiRef = (0, _useGridApiContext.useGridApiContext)();
109
111
  const rootProps = (0, _useGridRootProps.useGridRootProps)();
112
+ const currentPage = (0, _useGridVisibleRows.useGridVisibleRows)(apiRef, rootProps);
110
113
  const columnsTotalWidth = (0, _useGridSelector.useGridSelector)(apiRef, _gridColumnsSelector.gridColumnsTotalWidthSelector);
111
114
  const {
112
115
  hasScrollX,
@@ -173,11 +176,33 @@ function GridRow(props) {
173
176
 
174
177
  publish(_events.GridEvents.rowClick, onClick)(event);
175
178
  }, [apiRef, onClick, publish, rowId]);
176
- const style = (0, _extends2.default)({
179
+ const style = (0, _extends2.default)({}, styleProp, {
177
180
  maxHeight: rowHeight,
178
181
  minHeight: rowHeight
179
- }, styleProp);
180
- const rowClassName = typeof rootProps.getRowClassName === 'function' && rootProps.getRowClassName(apiRef.current.getRowParams(rowId));
182
+ });
183
+ const sizes = apiRef.current.unstable_getRowInternalSizes(rowId);
184
+
185
+ if (sizes != null && sizes.spacingTop) {
186
+ const property = rootProps.rowSpacingType === 'border' ? 'borderTopWidth' : 'marginTop';
187
+ style[property] = sizes.spacingTop;
188
+ }
189
+
190
+ if (sizes != null && sizes.spacingBottom) {
191
+ const property = rootProps.rowSpacingType === 'border' ? 'borderBottomWidth' : 'marginBottom';
192
+ style[property] = sizes.spacingBottom;
193
+ }
194
+
195
+ let rowClassName = null;
196
+
197
+ if (typeof rootProps.getRowClassName === 'function') {
198
+ const indexRelativeToCurrentPage = index - currentPage.range.firstRowIndex;
199
+ const rowParams = (0, _extends2.default)({}, apiRef.current.getRowParams(rowId), {
200
+ isFirstVisible: indexRelativeToCurrentPage === 0,
201
+ isLastVisible: indexRelativeToCurrentPage === currentPage.rows.length - 1
202
+ });
203
+ rowClassName = rootProps.getRowClassName(rowParams);
204
+ }
205
+
181
206
  const cells = [];
182
207
 
183
208
  for (let i = 0; i < renderedColumns.length; i += 1) {
@@ -11,6 +11,8 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
11
11
 
12
12
  var React = _interopRequireWildcard(require("react"));
13
13
 
14
+ var _propTypes = _interopRequireDefault(require("prop-types"));
15
+
14
16
  var _styles = require("@mui/material/styles");
15
17
 
16
18
  var _useGridApiContext = require("../../hooks/utils/useGridApiContext");
@@ -72,4 +74,12 @@ function GridErrorHandler(props) {
72
74
  }),
73
75
  children: children
74
76
  });
75
- }
77
+ }
78
+
79
+ process.env.NODE_ENV !== "production" ? GridErrorHandler.propTypes = {
80
+ // ----------------------------- Warning --------------------------------
81
+ // | These PropTypes are generated from the TypeScript type definitions |
82
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
83
+ // ----------------------------------------------------------------------
84
+ children: _propTypes.default.node
85
+ } : void 0;
@@ -73,6 +73,8 @@ const useUtilityClasses = ownerState => {
73
73
  let warnedOnce = false;
74
74
 
75
75
  function GridCell(props) {
76
+ var _rootProps$experiment;
77
+
76
78
  const {
77
79
  align,
78
80
  children,
@@ -165,7 +167,7 @@ function GridCell(props) {
165
167
  }, [hasFocus, cellMode, apiRef]);
166
168
  let handleFocus = other.onFocus;
167
169
 
168
- if (process.env.NODE_ENV === 'test') {
170
+ if (process.env.NODE_ENV === 'test' && (_rootProps$experiment = rootProps.experimentalFeatures) != null && _rootProps$experiment.warnIfFocusStateIsNotSynced) {
169
171
  handleFocus = event => {
170
172
  const focusedCell = (0, _gridFocusStateSelector.gridFocusCellSelector)(apiRef);
171
173
 
@@ -178,7 +180,7 @@ function GridCell(props) {
178
180
  }
179
181
 
180
182
  if (!warnedOnce) {
181
- console.error([`MUI: The cell with id=${rowId} and field=${field} received focus.`, `According to the state, the focus should be at id=${focusedCell == null ? void 0 : focusedCell.id}, field=${focusedCell == null ? void 0 : focusedCell.field}.`, 'In the next render, the focus will be changed to match the state.', 'Call `fireEvent.mouseUp` and `fireEvent.click` before to sync the focus with the state.'].join('\n'));
183
+ console.warn([`MUI: The cell with id=${rowId} and field=${field} received focus.`, `According to the state, the focus should be at id=${focusedCell == null ? void 0 : focusedCell.id}, field=${focusedCell == null ? void 0 : focusedCell.field}.`, "Not syncing the state may cause unwanted behaviors since the `cellFocusIn` event won't be fired.", 'Call `fireEvent.mouseUp` before the `fireEvent.click` to sync the focus with the state.'].join('\n'));
182
184
  warnedOnce = true;
183
185
  }
184
186
  };
@@ -94,10 +94,11 @@ function GridEditSingleSelectCell(props) {
94
94
 
95
95
  const handleChange = async event => {
96
96
  setOpen(false);
97
+ const target = event.target;
97
98
  const isValid = await api.setEditCellValue({
98
99
  id,
99
100
  field,
100
- value: event.target.value
101
+ value: target.value
101
102
  }, event); // We use isValid === false because the default return is undefined which evaluates to true with !isValid
102
103
 
103
104
  if (rootProps.editMode === _gridEditRowModel.GridEditModes.Row || isValid === false) {
@@ -51,13 +51,15 @@ const useUtilityClasses = ownerState => {
51
51
  classes,
52
52
  isDragging,
53
53
  sortDirection,
54
- showRightBorder
54
+ showRightBorder,
55
+ filterItemsCounter
55
56
  } = ownerState;
56
- const isColumnSorted = sortDirection != null; // todo refactor to a prop on col isNumeric or ?? ie: coltype===price wont work
57
+ const isColumnSorted = sortDirection != null;
58
+ const isColumnFiltered = filterItemsCounter != null && filterItemsCounter > 0; // todo refactor to a prop on col isNumeric or ?? ie: coltype===price wont work
57
59
 
58
60
  const isColumnNumeric = column.type === 'number';
59
61
  const slots = {
60
- root: ['columnHeader', column.headerAlign === 'left' && 'columnHeader--alignLeft', column.headerAlign === 'center' && 'columnHeader--alignCenter', column.headerAlign === 'right' && 'columnHeader--alignRight', column.sortable && 'columnHeader--sortable', isDragging && 'columnHeader--moving', isColumnSorted && 'columnHeader--sorted', isColumnNumeric && 'columnHeader--numeric', showRightBorder && 'withBorder'],
62
+ root: ['columnHeader', column.headerAlign === 'left' && 'columnHeader--alignLeft', column.headerAlign === 'center' && 'columnHeader--alignCenter', column.headerAlign === 'right' && 'columnHeader--alignRight', column.sortable && 'columnHeader--sortable', isDragging && 'columnHeader--moving', isColumnSorted && 'columnHeader--sorted', isColumnFiltered && 'columnHeader--filtered', isColumnNumeric && 'columnHeader--numeric', showRightBorder && 'withBorder'],
61
63
  draggableContainer: ['columnHeaderDraggableContainer'],
62
64
  titleContainer: ['columnHeaderTitleContainer'],
63
65
  titleContainerContent: ['columnHeaderTitleContainerContent']
@@ -149,7 +149,7 @@ const GridRootStyles = (0, _styles.styled)('div', {
149
149
  display: 'flex',
150
150
  alignItems: 'center'
151
151
  },
152
- [`& .${_gridClasses.gridClasses['columnHeader--sorted']} .${_gridClasses.gridClasses.iconButtonContainer}`]: {
152
+ [`& .${_gridClasses.gridClasses['columnHeader--sorted']} .${_gridClasses.gridClasses.iconButtonContainer}, & .${_gridClasses.gridClasses['columnHeader--filtered']} .${_gridClasses.gridClasses.iconButtonContainer}`]: {
153
153
  visibility: 'visible',
154
154
  width: 'auto'
155
155
  },
@@ -33,21 +33,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
33
33
 
34
34
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
35
35
 
36
- const getSingleSelectOptionFormatter = ({
37
- valueFormatter,
38
- field
39
- }, api) => option => {
40
- if (typeof option === 'object') {
41
- return option.label;
42
- }
43
-
44
- return valueFormatter && option !== '' ? valueFormatter({
45
- value: option,
46
- field,
47
- api
48
- }) : option;
49
- };
50
-
51
36
  const isOptionEqualToValue = (option, value) => (0, _filterPanelUtils.getValueFromOption)(option) === (0, _filterPanelUtils.getValueFromOption)(value);
52
37
 
53
38
  const filter = (0, _Autocomplete.createFilterOptions)();
@@ -63,15 +48,31 @@ function GridFilterInputMultipleSingleSelect(props) {
63
48
  const id = (0, _utils.unstable_useId)();
64
49
  const resolvedColumn = item.columnField ? apiRef.current.getColumn(item.columnField) : null;
65
50
  const resolvedValueOptions = React.useMemo(() => {
66
- return typeof resolvedColumn.valueOptions === 'function' ? resolvedColumn.valueOptions({
51
+ return typeof (resolvedColumn == null ? void 0 : resolvedColumn.valueOptions) === 'function' ? resolvedColumn.valueOptions({
67
52
  field: resolvedColumn.field
68
- }) : resolvedColumn.valueOptions;
53
+ }) : resolvedColumn == null ? void 0 : resolvedColumn.valueOptions;
69
54
  }, [resolvedColumn]);
70
55
  const resolvedFormattedValueOptions = React.useMemo(() => {
71
- return resolvedValueOptions.map(_filterPanelUtils.getValueFromOption);
56
+ return resolvedValueOptions == null ? void 0 : resolvedValueOptions.map(_filterPanelUtils.getValueFromOption);
72
57
  }, [resolvedValueOptions]);
73
- const filterValueOptionFormatter = getSingleSelectOptionFormatter(apiRef.current.getColumn(item.columnField), apiRef.current); // The value is computed from the item.value and used directly
74
- // If it was done by a useEffect/useSate, the Autocomplete could receive incoherent value and options
58
+ const {
59
+ valueFormatter,
60
+ field
61
+ } = apiRef.current.getColumn(item.columnField);
62
+
63
+ const filterValueOptionFormatter = option => {
64
+ if (typeof option === 'object') {
65
+ return option.label;
66
+ }
67
+
68
+ return valueFormatter && option !== '' ? valueFormatter({
69
+ value: option,
70
+ field,
71
+ api: apiRef.current
72
+ }) : option;
73
+ }; // The value is computed from the item.value and used directly
74
+ // If it was done by a useEffect/useState, the Autocomplete could receive incoherent value and options
75
+
75
76
 
76
77
  const filterValues = React.useMemo(() => {
77
78
  if (!Array.isArray(item.value)) {
@@ -82,7 +83,7 @@ function GridFilterInputMultipleSingleSelect(props) {
82
83
  const itemValueIndexes = item.value.map(element => {
83
84
  // get the index matching between values and valueoptions
84
85
  const formattedElement = (0, _filterPanelUtils.getValueFromOption)(element);
85
- const index = resolvedFormattedValueOptions.findIndex(formatedOption => formatedOption === formattedElement);
86
+ const index = (resolvedFormattedValueOptions == null ? void 0 : resolvedFormattedValueOptions.findIndex(formatedOption => formatedOption === formattedElement)) || 0;
86
87
  return index;
87
88
  });
88
89
  return itemValueIndexes.filter(index => index >= 0).map(index => resolvedValueOptions[index]);
@@ -107,7 +108,8 @@ function GridFilterInputMultipleSingleSelect(props) {
107
108
  multiple: true,
108
109
  freeSolo: false,
109
110
  limitTags: 1,
110
- options: resolvedValueOptions,
111
+ options: resolvedValueOptions // TODO: avoid `any`?
112
+ ,
111
113
  isOptionEqualToValue: isOptionEqualToValue,
112
114
  filterOptions: filter,
113
115
  id: id,
@@ -138,7 +140,9 @@ process.env.NODE_ENV !== "production" ? GridFilterInputMultipleSingleSelect.prop
138
140
  // | These PropTypes are generated from the TypeScript type definitions |
139
141
  // | To update them edit the TypeScript types and run "yarn proptypes" |
140
142
  // ----------------------------------------------------------------------
141
- apiRef: _propTypes.default.any.isRequired,
143
+ apiRef: _propTypes.default.shape({
144
+ current: _propTypes.default.object.isRequired
145
+ }).isRequired,
142
146
  applyValue: _propTypes.default.func.isRequired,
143
147
  focusElementRef: _propTypes.default
144
148
  /* @typescript-to-proptypes-ignore */
@@ -46,7 +46,10 @@ const VirtualScrollerRenderZoneRoot = (0, _styles.styled)('div', {
46
46
  slot: 'VirtualScrollerRenderZone',
47
47
  overridesResolver: (props, styles) => styles.virtualScrollerRenderZone
48
48
  })({
49
- position: 'absolute'
49
+ position: 'absolute',
50
+ display: 'flex',
51
+ // Prevents margin collapsing when using `getRowSpacing`
52
+ flexDirection: 'column'
50
53
  });
51
54
  const GridVirtualScrollerRenderZone = /*#__PURE__*/React.forwardRef(function GridVirtualScrollerRenderZone(props, ref) {
52
55
  const {
@@ -12,5 +12,5 @@ function getDataGridUtilityClass(slot) {
12
12
  return (0, _material.generateUtilityClass)('MuiDataGrid', slot);
13
13
  }
14
14
 
15
- const gridClasses = (0, _material.generateUtilityClasses)('MuiDataGrid', ['actionsCell', 'autoHeight', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--withRenderer', 'cell', 'cellContent', 'cellCheckbox', 'checkboxInput', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderDropZone', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeaders', 'columnHeadersInner', 'columnHeadersInner--scrollable', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsPanel', 'columnsPanelRow', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filterForm', 'filterFormDeleteIcon', 'filterFormLinkOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'iconButtonContainer', 'iconSeparator', 'main', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'root', 'row--editable', 'row--editing', 'row', 'row--lastVisible', 'rowCount', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'pinnedColumns--left', 'pinnedColumns--right', 'pinnedColumnHeaders', 'pinnedColumnHeaders--left', 'pinnedColumnHeaders--right', 'withBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'groupingCriteriaCell', 'groupingCriteriaCellToggle']);
15
+ const gridClasses = (0, _material.generateUtilityClasses)('MuiDataGrid', ['actionsCell', 'autoHeight', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--withRenderer', 'cell', 'cellContent', 'cellCheckbox', 'checkboxInput', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderDropZone', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeaders', 'columnHeadersInner', 'columnHeadersInner--scrollable', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsPanel', 'columnsPanelRow', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filterForm', 'filterFormDeleteIcon', 'filterFormLinkOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'iconButtonContainer', 'iconSeparator', 'main', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'root', 'row--editable', 'row--editing', 'row', 'row--lastVisible', 'rowCount', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'pinnedColumns--left', 'pinnedColumns--right', 'pinnedColumnHeaders', 'pinnedColumnHeaders--left', 'pinnedColumnHeaders--right', 'withBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'groupingCriteriaCell', 'groupingCriteriaCellToggle']);
16
16
  exports.gridClasses = gridClasses;