@mui/x-data-grid 7.0.0-beta.7 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/CHANGELOG.md +195 -12
  2. package/DataGrid/DataGrid.js +13 -17
  3. package/DataGrid/useDataGridProps.js +3 -5
  4. package/README.md +1 -1
  5. package/components/GridFooter.js +2 -3
  6. package/components/GridHeader.js +1 -2
  7. package/components/GridPagination.d.ts +6 -5
  8. package/components/GridPagination.js +12 -4
  9. package/components/GridRow.js +13 -17
  10. package/components/base/GridFooterPlaceholder.js +1 -2
  11. package/components/base/GridOverlays.js +3 -6
  12. package/components/cell/GridActionsCell.js +4 -6
  13. package/components/cell/GridActionsCellItem.d.ts +8 -25
  14. package/components/cell/GridActionsCellItem.js +8 -5
  15. package/components/cell/GridBooleanCell.d.ts +1 -0
  16. package/components/cell/GridBooleanCell.js +3 -2
  17. package/components/cell/GridCell.js +7 -8
  18. package/components/cell/GridEditBooleanCell.js +1 -2
  19. package/components/cell/GridEditDateCell.js +2 -3
  20. package/components/cell/GridEditInputCell.js +2 -2
  21. package/components/cell/GridEditSingleSelectCell.js +5 -8
  22. package/components/columnHeaders/ColumnHeaderMenuIcon.js +2 -3
  23. package/components/columnHeaders/GridColumnGroupHeader.js +4 -5
  24. package/components/columnHeaders/GridColumnHeaderFilterIconButton.js +2 -3
  25. package/components/columnHeaders/GridColumnHeaderItem.js +5 -6
  26. package/components/columnHeaders/GridColumnHeaderSortIcon.js +1 -2
  27. package/components/columnHeaders/GridColumnHeaderTitle.js +2 -3
  28. package/components/columnHeaders/GridGenericColumnHeaderItem.js +1 -1
  29. package/components/columnSelection/GridCellCheckboxRenderer.js +3 -5
  30. package/components/columnSelection/GridHeaderCheckbox.js +1 -2
  31. package/components/columnsManagement/GridColumnsManagement.js +17 -21
  32. package/components/containers/GridRoot.js +3 -3
  33. package/components/menu/GridMenu.js +4 -6
  34. package/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
  35. package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +2 -3
  36. package/components/panel/GridColumnsPanel.js +1 -2
  37. package/components/panel/GridPanel.d.ts +1 -10
  38. package/components/panel/GridPanel.js +1 -2
  39. package/components/panel/GridPreferencesPanel.js +2 -3
  40. package/components/panel/filterPanel/GridFilterForm.js +24 -27
  41. package/components/panel/filterPanel/GridFilterInputBoolean.d.ts +1 -1
  42. package/components/panel/filterPanel/GridFilterInputBoolean.js +6 -7
  43. package/components/panel/filterPanel/GridFilterInputDate.d.ts +1 -1
  44. package/components/panel/filterPanel/GridFilterInputDate.js +3 -4
  45. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +11 -15
  46. package/components/panel/filterPanel/GridFilterInputMultipleValue.js +10 -14
  47. package/components/panel/filterPanel/GridFilterInputSingleSelect.d.ts +1 -1
  48. package/components/panel/filterPanel/GridFilterInputSingleSelect.js +10 -11
  49. package/components/panel/filterPanel/GridFilterInputValue.d.ts +1 -1
  50. package/components/panel/filterPanel/GridFilterInputValue.js +5 -7
  51. package/components/panel/filterPanel/GridFilterPanel.js +5 -9
  52. package/components/panel/filterPanel/filterPanelUtils.js +1 -1
  53. package/components/toolbar/GridToolbarColumnsButton.js +3 -5
  54. package/components/toolbar/GridToolbarDensitySelector.js +8 -10
  55. package/components/toolbar/GridToolbarExport.js +2 -2
  56. package/components/toolbar/GridToolbarExportContainer.js +3 -5
  57. package/components/toolbar/GridToolbarFilterButton.js +3 -5
  58. package/components/toolbar/GridToolbarQuickFilter.js +4 -5
  59. package/components/virtualization/GridVirtualScrollerContent.js +1 -2
  60. package/components/virtualization/GridVirtualScrollerRenderZone.js +1 -2
  61. package/hooks/core/strategyProcessing/useGridStrategyProcessing.js +1 -2
  62. package/hooks/core/useGridApiInitialization.js +4 -6
  63. package/hooks/features/clipboard/useGridClipboard.js +6 -5
  64. package/hooks/features/columnGrouping/gridColumnGroupsSelector.js +4 -16
  65. package/hooks/features/columnGrouping/gridColumnGroupsUtils.js +4 -8
  66. package/hooks/features/columnGrouping/useGridColumnGrouping.js +12 -23
  67. package/hooks/features/columnHeaders/useGridColumnHeaders.js +6 -8
  68. package/hooks/features/columnMenu/useGridColumnMenuSlots.js +2 -2
  69. package/hooks/features/columnResize/useGridColumnResize.js +9 -19
  70. package/hooks/features/columns/gridColumnsSelector.js +1 -2
  71. package/hooks/features/columns/gridColumnsUtils.d.ts +0 -9
  72. package/hooks/features/columns/gridColumnsUtils.js +2 -22
  73. package/hooks/features/columns/useGridColumnSpanning.js +1 -2
  74. package/hooks/features/columns/useGridColumns.js +11 -19
  75. package/hooks/features/density/densitySelector.d.ts +4 -2
  76. package/hooks/features/density/densitySelector.js +8 -2
  77. package/hooks/features/density/densityState.d.ts +1 -4
  78. package/hooks/features/density/useGridDensity.d.ts +2 -4
  79. package/hooks/features/density/useGridDensity.js +21 -29
  80. package/hooks/features/dimensions/useGridDimensions.js +3 -5
  81. package/hooks/features/editing/useGridCellEditing.js +4 -6
  82. package/hooks/features/editing/useGridEditing.js +1 -2
  83. package/hooks/features/editing/useGridRowEditing.js +4 -6
  84. package/hooks/features/export/serializers/csvSerializer.d.ts +2 -0
  85. package/hooks/features/export/serializers/csvSerializer.js +25 -16
  86. package/hooks/features/export/useGridCsvExport.js +9 -10
  87. package/hooks/features/export/useGridPrintExport.js +9 -15
  88. package/hooks/features/export/utils.js +2 -3
  89. package/hooks/features/filter/gridFilterSelector.js +15 -22
  90. package/hooks/features/filter/gridFilterUtils.js +10 -16
  91. package/hooks/features/filter/useGridFilter.js +9 -15
  92. package/hooks/features/focus/useGridFocus.js +5 -6
  93. package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +1 -4
  94. package/hooks/features/headerFiltering/useGridHeaderFiltering.js +12 -17
  95. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +1 -2
  96. package/hooks/features/pagination/gridPaginationSelector.js +1 -2
  97. package/hooks/features/pagination/useGridPagination.js +2 -3
  98. package/hooks/features/pagination/useGridPaginationModel.js +6 -11
  99. package/hooks/features/pagination/useGridRowCount.js +3 -6
  100. package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +7 -12
  101. package/hooks/features/rowSelection/useGridRowSelection.js +11 -16
  102. package/hooks/features/rows/gridRowsSelector.js +11 -19
  103. package/hooks/features/rows/gridRowsUtils.js +7 -9
  104. package/hooks/features/rows/useGridParamsApi.js +1 -1
  105. package/hooks/features/rows/useGridRows.js +4 -13
  106. package/hooks/features/rows/useGridRowsMeta.js +7 -13
  107. package/hooks/features/scroll/useGridScroll.js +2 -3
  108. package/hooks/features/sorting/gridSortingSelector.js +4 -7
  109. package/hooks/features/sorting/useGridSorting.js +8 -14
  110. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +1 -1
  111. package/hooks/features/virtualization/useGridVirtualScroller.js +220 -71
  112. package/hooks/utils/useGridApiEventHandler.js +5 -10
  113. package/hooks/utils/useGridNativeEventListener.js +1 -2
  114. package/index.js +1 -1
  115. package/internals/index.d.ts +2 -0
  116. package/internals/index.js +1 -0
  117. package/internals/utils/useProps.js +1 -2
  118. package/joy/joySlots.js +7 -13
  119. package/models/api/gridRowsMetaApi.d.ts +1 -1
  120. package/models/api/index.d.ts +1 -1
  121. package/models/api/index.js +0 -1
  122. package/models/events/gridEventLookup.d.ts +7 -0
  123. package/models/gridExport.d.ts +6 -0
  124. package/models/gridStateCommunity.d.ts +1 -0
  125. package/models/props/DataGridProps.d.ts +23 -27
  126. package/modern/DataGrid/DataGrid.js +13 -17
  127. package/modern/DataGrid/useDataGridProps.js +3 -5
  128. package/modern/components/GridPagination.js +11 -2
  129. package/modern/components/cell/GridActionsCell.js +1 -1
  130. package/modern/components/cell/GridActionsCellItem.js +4 -0
  131. package/modern/components/cell/GridBooleanCell.js +3 -2
  132. package/modern/components/containers/GridRoot.js +3 -3
  133. package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
  134. package/modern/components/panel/filterPanel/GridFilterInputDate.js +1 -1
  135. package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -1
  136. package/modern/components/panel/filterPanel/GridFilterInputValue.js +1 -1
  137. package/modern/components/toolbar/GridToolbarDensitySelector.js +5 -5
  138. package/modern/hooks/features/clipboard/useGridClipboard.js +4 -2
  139. package/modern/hooks/features/columnResize/useGridColumnResize.js +1 -1
  140. package/modern/hooks/features/columns/gridColumnsUtils.js +0 -19
  141. package/modern/hooks/features/density/densitySelector.js +8 -2
  142. package/modern/hooks/features/density/useGridDensity.js +21 -29
  143. package/modern/hooks/features/editing/useGridCellEditing.js +1 -1
  144. package/modern/hooks/features/editing/useGridRowEditing.js +1 -1
  145. package/modern/hooks/features/export/serializers/csvSerializer.js +23 -12
  146. package/modern/hooks/features/export/useGridCsvExport.js +2 -1
  147. package/modern/hooks/features/filter/gridFilterUtils.js +1 -1
  148. package/modern/hooks/features/rowSelection/useGridRowSelection.js +3 -2
  149. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +211 -57
  150. package/modern/index.js +1 -1
  151. package/modern/internals/index.js +1 -0
  152. package/modern/models/api/index.js +0 -1
  153. package/modern/utils/createSelector.js +1 -1
  154. package/modern/utils/domUtils.js +1 -1
  155. package/modern/utils/keyboardUtils.js +1 -1
  156. package/node/DataGrid/DataGrid.js +13 -17
  157. package/node/DataGrid/useDataGridProps.js +3 -5
  158. package/node/components/GridPagination.js +9 -1
  159. package/node/components/cell/GridActionsCell.js +1 -1
  160. package/node/components/cell/GridActionsCellItem.js +4 -0
  161. package/node/components/cell/GridBooleanCell.js +3 -2
  162. package/node/components/containers/GridRoot.js +2 -2
  163. package/node/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
  164. package/node/components/panel/filterPanel/GridFilterInputDate.js +1 -1
  165. package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -1
  166. package/node/components/panel/filterPanel/GridFilterInputValue.js +1 -1
  167. package/node/components/toolbar/GridToolbarDensitySelector.js +4 -4
  168. package/node/hooks/features/clipboard/useGridClipboard.js +4 -2
  169. package/node/hooks/features/columnResize/useGridColumnResize.js +1 -1
  170. package/node/hooks/features/columns/gridColumnsUtils.js +0 -20
  171. package/node/hooks/features/density/densitySelector.js +9 -3
  172. package/node/hooks/features/density/useGridDensity.js +22 -30
  173. package/node/hooks/features/editing/useGridCellEditing.js +1 -1
  174. package/node/hooks/features/editing/useGridRowEditing.js +1 -1
  175. package/node/hooks/features/export/serializers/csvSerializer.js +23 -12
  176. package/node/hooks/features/export/useGridCsvExport.js +2 -1
  177. package/node/hooks/features/filter/gridFilterUtils.js +1 -1
  178. package/node/hooks/features/rowSelection/useGridRowSelection.js +2 -1
  179. package/node/hooks/features/virtualization/useGridVirtualScroller.js +211 -57
  180. package/node/index.js +1 -1
  181. package/node/internals/index.js +12 -0
  182. package/node/models/api/index.js +0 -11
  183. package/node/utils/createSelector.js +1 -1
  184. package/node/utils/domUtils.js +1 -1
  185. package/node/utils/keyboardUtils.js +1 -1
  186. package/package.json +4 -4
  187. package/utils/createSelector.js +9 -9
  188. package/utils/domUtils.js +4 -7
  189. package/utils/getGridLocalization.js +9 -12
  190. package/utils/keyboardUtils.js +1 -1
@@ -3,25 +3,20 @@ import * as React from 'react';
3
3
  import { useGridApiMethod } from '../../utils/useGridApiMethod';
4
4
  import { useGridLogger } from '../../utils';
5
5
  import { gridColumnLookupSelector, gridColumnVisibilityModelSelector, gridColumnFieldsSelector } from '../columns/gridColumnsSelector';
6
- export const headerFilteringStateInitializer = (state, props) => {
7
- var _props$headerFilters;
8
- return _extends({}, state, {
9
- // @ts-expect-error Access `Pro` prop in MIT
10
- headerFiltering: {
11
- enabled: (_props$headerFilters = props.headerFilters) != null ? _props$headerFilters : false,
12
- editing: null,
13
- menuOpen: null
14
- }
15
- });
16
- };
6
+ export const headerFilteringStateInitializer = (state, props) => _extends({}, state, {
7
+ // @ts-expect-error Access `Pro` prop in MIT
8
+ headerFiltering: {
9
+ enabled: props.headerFilters ?? false,
10
+ editing: null,
11
+ menuOpen: null
12
+ }
13
+ });
17
14
  export const useGridHeaderFiltering = (apiRef, props) => {
18
- var _props$headerFilters2;
19
15
  const logger = useGridLogger(apiRef, 'useGridHeaderFiltering');
20
16
  // @ts-expect-error Access `Pro` prop in MIT
21
- const isHeaderFilteringEnabled = (_props$headerFilters2 = props.headerFilters) != null ? _props$headerFilters2 : false;
17
+ const isHeaderFilteringEnabled = props.headerFilters ?? false;
22
18
  const setHeaderFilterState = React.useCallback(headerFilterState => {
23
19
  apiRef.current.setState(state => {
24
- var _headerFilterState$ed, _headerFilterState$me;
25
20
  // Safety check to avoid MIT users from using it
26
21
  // This hook should ultimately be moved to the Pro package
27
22
  if (props.signature === 'DataGrid') {
@@ -29,9 +24,9 @@ export const useGridHeaderFiltering = (apiRef, props) => {
29
24
  }
30
25
  return _extends({}, state, {
31
26
  headerFiltering: {
32
- enabled: isHeaderFilteringEnabled != null ? isHeaderFilteringEnabled : false,
33
- editing: (_headerFilterState$ed = headerFilterState.editing) != null ? _headerFilterState$ed : null,
34
- menuOpen: (_headerFilterState$me = headerFilterState.menuOpen) != null ? _headerFilterState$me : null
27
+ enabled: isHeaderFilteringEnabled ?? false,
28
+ editing: headerFilterState.editing ?? null,
29
+ menuOpen: headerFilterState.menuOpen ?? null
35
30
  }
36
31
  });
37
32
  });
@@ -127,8 +127,7 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
127
127
  apiRef.current.setColumnGroupHeaderFocus(field, depth, event);
128
128
  }, [apiRef, logger]);
129
129
  const getRowIdFromIndex = React.useCallback(rowIndex => {
130
- var _currentPageRows$rowI;
131
- return (_currentPageRows$rowI = currentPageRows[rowIndex]) == null ? void 0 : _currentPageRows$rowI.id;
130
+ return currentPageRows[rowIndex]?.id;
132
131
  }, [currentPageRows]);
133
132
  const handleColumnHeaderKeyDown = React.useCallback((params, event) => {
134
133
  const headerTitleNode = event.currentTarget.querySelector(`.${gridClasses.columnHeaderTitleContainerContent}`);
@@ -66,9 +66,8 @@ export const gridPaginationRowRangeSelector = createSelectorMemoized(gridPaginat
66
66
  let lastRowIndex = firstRowIndex;
67
67
  let topLevelRowAdded = 0;
68
68
  while (lastRowIndex < visibleSortedRowEntries.length && topLevelRowAdded <= topLevelRowsInCurrentPageCount) {
69
- var _rowTree$row$id;
70
69
  const row = visibleSortedRowEntries[lastRowIndex];
71
- const depth = (_rowTree$row$id = rowTree[row.id]) == null ? void 0 : _rowTree$row$id.depth;
70
+ const depth = rowTree[row.id]?.depth;
72
71
  if (depth === undefined) {
73
72
  lastRowIndex += 1;
74
73
  } else {
@@ -3,10 +3,9 @@ import { throwIfPageSizeExceedsTheLimit, getDefaultGridPaginationModel } from '.
3
3
  import { useGridPaginationModel } from './useGridPaginationModel';
4
4
  import { useGridRowCount } from './useGridRowCount';
5
5
  export const paginationStateInitializer = (state, props) => {
6
- var _props$paginationMode, _props$initialState, _props$rowCount, _props$initialState2;
7
- const paginationModel = _extends({}, getDefaultGridPaginationModel(props.autoPageSize), (_props$paginationMode = props.paginationModel) != null ? _props$paginationMode : (_props$initialState = props.initialState) == null || (_props$initialState = _props$initialState.pagination) == null ? void 0 : _props$initialState.paginationModel);
6
+ const paginationModel = _extends({}, getDefaultGridPaginationModel(props.autoPageSize), props.paginationModel ?? props.initialState?.pagination?.paginationModel);
8
7
  throwIfPageSizeExceedsTheLimit(paginationModel.pageSize, props.signature);
9
- const rowCount = (_props$rowCount = props.rowCount) != null ? _props$rowCount : (_props$initialState2 = props.initialState) == null || (_props$initialState2 = _props$initialState2.pagination) == null ? void 0 : _props$initialState2.rowCount;
8
+ const rowCount = props.rowCount ?? props.initialState?.pagination?.rowCount;
10
9
  return _extends({}, state, {
11
10
  pagination: {
12
11
  paginationModel,
@@ -6,12 +6,11 @@ import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
6
6
  import { gridPageCountSelector, gridPaginationModelSelector } from './gridPaginationSelector';
7
7
  import { getPageCount, defaultPageSize, throwIfPageSizeExceedsTheLimit, getDefaultGridPaginationModel, getValidPage } from './gridPaginationUtils';
8
8
  export const getDerivedPaginationModel = (paginationState, signature, paginationModelProp) => {
9
- var _paginationModelProp$;
10
9
  let paginationModel = paginationState.paginationModel;
11
10
  const rowCount = paginationState.rowCount;
12
- const pageSize = (_paginationModelProp$ = paginationModelProp == null ? void 0 : paginationModelProp.pageSize) != null ? _paginationModelProp$ : paginationModel.pageSize;
11
+ const pageSize = paginationModelProp?.pageSize ?? paginationModel.pageSize;
13
12
  const pageCount = getPageCount(rowCount, pageSize);
14
- if (paginationModelProp && ((paginationModelProp == null ? void 0 : paginationModelProp.page) !== paginationModel.page || (paginationModelProp == null ? void 0 : paginationModelProp.pageSize) !== paginationModel.pageSize)) {
13
+ if (paginationModelProp && (paginationModelProp?.page !== paginationModel.page || paginationModelProp?.pageSize !== paginationModel.pageSize)) {
15
14
  paginationModel = paginationModelProp;
16
15
  }
17
16
  const validPage = getValidPage(paginationModel.page, pageCount);
@@ -29,7 +28,6 @@ export const getDerivedPaginationModel = (paginationState, signature, pagination
29
28
  * @requires useGridDimensions (event) - can be after
30
29
  */
31
30
  export const useGridPaginationModel = (apiRef, props) => {
32
- var _props$initialState2;
33
31
  const logger = useGridLogger(apiRef, 'useGridPaginationModel');
34
32
  const densityFactor = useGridSelector(apiRef, gridDensityFactorSelector);
35
33
  const rowHeight = Math.floor(props.rowHeight * densityFactor);
@@ -89,7 +87,6 @@ export const useGridPaginationModel = (apiRef, props) => {
89
87
  * PRE-PROCESSING
90
88
  */
91
89
  const stateExportPreProcessing = React.useCallback((prevState, context) => {
92
- var _props$initialState;
93
90
  const paginationModel = gridPaginationModelSelector(apiRef);
94
91
  const shouldExportPaginationModel =
95
92
  // Always export if the `exportOnlyDirtyModels` property is not activated
@@ -97,7 +94,7 @@ export const useGridPaginationModel = (apiRef, props) => {
97
94
  // Always export if the `paginationModel` is controlled
98
95
  props.paginationModel != null ||
99
96
  // Always export if the `paginationModel` has been initialized
100
- ((_props$initialState = props.initialState) == null || (_props$initialState = _props$initialState.pagination) == null ? void 0 : _props$initialState.paginationModel) != null ||
97
+ props.initialState?.pagination?.paginationModel != null ||
101
98
  // Export if `page` or `pageSize` is not equal to the default value
102
99
  paginationModel.page !== 0 && paginationModel.pageSize !== defaultPageSize(props.autoPageSize);
103
100
  if (!shouldExportPaginationModel) {
@@ -108,10 +105,9 @@ export const useGridPaginationModel = (apiRef, props) => {
108
105
  paginationModel
109
106
  })
110
107
  });
111
- }, [apiRef, props.paginationModel, (_props$initialState2 = props.initialState) == null || (_props$initialState2 = _props$initialState2.pagination) == null ? void 0 : _props$initialState2.paginationModel, props.autoPageSize]);
108
+ }, [apiRef, props.paginationModel, props.initialState?.pagination?.paginationModel, props.autoPageSize]);
112
109
  const stateRestorePreProcessing = React.useCallback((params, context) => {
113
- var _context$stateToResto, _context$stateToResto2;
114
- const paginationModel = (_context$stateToResto = context.stateToRestore.pagination) != null && _context$stateToResto.paginationModel ? _extends({}, getDefaultGridPaginationModel(props.autoPageSize), (_context$stateToResto2 = context.stateToRestore.pagination) == null ? void 0 : _context$stateToResto2.paginationModel) : gridPaginationModelSelector(apiRef);
110
+ const paginationModel = context.stateToRestore.pagination?.paginationModel ? _extends({}, getDefaultGridPaginationModel(props.autoPageSize), context.stateToRestore.pagination?.paginationModel) : gridPaginationModelSelector(apiRef);
115
111
  apiRef.current.setState(state => _extends({}, state, {
116
112
  pagination: _extends({}, state.pagination, {
117
113
  paginationModel: getDerivedPaginationModel(state.pagination, props.signature, paginationModel)
@@ -126,9 +122,8 @@ export const useGridPaginationModel = (apiRef, props) => {
126
122
  * EVENTS
127
123
  */
128
124
  const handlePaginationModelChange = () => {
129
- var _apiRef$current$virtu;
130
125
  const paginationModel = gridPaginationModelSelector(apiRef);
131
- if ((_apiRef$current$virtu = apiRef.current.virtualScrollerRef) != null && _apiRef$current$virtu.current) {
126
+ if (apiRef.current.virtualScrollerRef?.current) {
132
127
  apiRef.current.scrollToIndexes({
133
128
  rowIndex: paginationModel.page * paginationModel.pageSize
134
129
  });
@@ -11,7 +11,6 @@ import { noRowCountInServerMode } from './gridPaginationUtils';
11
11
  * @requires useGridDimensions (event) - can be after
12
12
  */
13
13
  export const useGridRowCount = (apiRef, props) => {
14
- var _props$initialState2;
15
14
  const logger = useGridLogger(apiRef, 'useGridRowCount');
16
15
  const visibleTopLevelRowCount = useGridSelector(apiRef, gridFilteredTopLevelRowCountSelector);
17
16
  const rowCount = useGridSelector(apiRef, gridPaginationRowCountSelector);
@@ -46,7 +45,6 @@ export const useGridRowCount = (apiRef, props) => {
46
45
  * PRE-PROCESSING
47
46
  */
48
47
  const stateExportPreProcessing = React.useCallback((prevState, context) => {
49
- var _props$initialState;
50
48
  const exportedRowCount = gridPaginationRowCountSelector(apiRef);
51
49
  const shouldExportRowCount =
52
50
  // Always export if the `exportOnlyDirtyModels` property is not activated
@@ -54,7 +52,7 @@ export const useGridRowCount = (apiRef, props) => {
54
52
  // Always export if the `rowCount` is controlled
55
53
  props.rowCount != null ||
56
54
  // Always export if the `rowCount` has been initialized
57
- ((_props$initialState = props.initialState) == null || (_props$initialState = _props$initialState.pagination) == null ? void 0 : _props$initialState.rowCount) != null;
55
+ props.initialState?.pagination?.rowCount != null;
58
56
  if (!shouldExportRowCount) {
59
57
  return prevState;
60
58
  }
@@ -63,10 +61,9 @@ export const useGridRowCount = (apiRef, props) => {
63
61
  rowCount: exportedRowCount
64
62
  })
65
63
  });
66
- }, [apiRef, props.rowCount, (_props$initialState2 = props.initialState) == null || (_props$initialState2 = _props$initialState2.pagination) == null ? void 0 : _props$initialState2.rowCount]);
64
+ }, [apiRef, props.rowCount, props.initialState?.pagination?.rowCount]);
67
65
  const stateRestorePreProcessing = React.useCallback((params, context) => {
68
- var _context$stateToResto;
69
- const restoredRowCount = (_context$stateToResto = context.stateToRestore.pagination) != null && _context$stateToResto.rowCount ? context.stateToRestore.pagination.rowCount : gridPaginationRowCountSelector(apiRef);
66
+ const restoredRowCount = context.stateToRestore.pagination?.rowCount ? context.stateToRestore.pagination.rowCount : gridPaginationRowCountSelector(apiRef);
70
67
  apiRef.current.setState(state => _extends({}, state, {
71
68
  pagination: _extends({}, state.pagination, {
72
69
  rowCount: restoredRowCount
@@ -4,20 +4,16 @@ import { useGridApiMethod } from '../../utils/useGridApiMethod';
4
4
  import { useGridLogger } from '../../utils/useGridLogger';
5
5
  import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
6
6
  import { gridPreferencePanelStateSelector } from './gridPreferencePanelSelector';
7
- export const preferencePanelStateInitializer = (state, props) => {
8
- var _props$initialState$p, _props$initialState;
9
- return _extends({}, state, {
10
- preferencePanel: (_props$initialState$p = (_props$initialState = props.initialState) == null ? void 0 : _props$initialState.preferencePanel) != null ? _props$initialState$p : {
11
- open: false
12
- }
13
- });
14
- };
7
+ export const preferencePanelStateInitializer = (state, props) => _extends({}, state, {
8
+ preferencePanel: props.initialState?.preferencePanel ?? {
9
+ open: false
10
+ }
11
+ });
15
12
 
16
13
  /**
17
14
  * TODO: Add a single `setPreferencePanel` method to avoid multiple `setState`
18
15
  */
19
16
  export const useGridPreferencesPanel = (apiRef, props) => {
20
- var _props$initialState3;
21
17
  const logger = useGridLogger(apiRef, 'useGridPreferencesPanel');
22
18
  const hideTimeout = React.useRef();
23
19
  const immediateTimeout = React.useRef();
@@ -77,13 +73,12 @@ export const useGridPreferencesPanel = (apiRef, props) => {
77
73
  * PRE-PROCESSING
78
74
  */
79
75
  const stateExportPreProcessing = React.useCallback((prevState, context) => {
80
- var _props$initialState2;
81
76
  const preferencePanelToExport = gridPreferencePanelStateSelector(apiRef.current.state);
82
77
  const shouldExportPreferencePanel =
83
78
  // Always export if the `exportOnlyDirtyModels` property is not activated
84
79
  !context.exportOnlyDirtyModels ||
85
80
  // Always export if the panel was initialized
86
- ((_props$initialState2 = props.initialState) == null ? void 0 : _props$initialState2.preferencePanel) != null ||
81
+ props.initialState?.preferencePanel != null ||
87
82
  // Always export if the panel is opened
88
83
  preferencePanelToExport.open;
89
84
  if (!shouldExportPreferencePanel) {
@@ -92,7 +87,7 @@ export const useGridPreferencesPanel = (apiRef, props) => {
92
87
  return _extends({}, prevState, {
93
88
  preferencePanel: preferencePanelToExport
94
89
  });
95
- }, [apiRef, (_props$initialState3 = props.initialState) == null ? void 0 : _props$initialState3.preferencePanel]);
90
+ }, [apiRef, props.initialState?.preferencePanel]);
96
91
  const stateRestorePreProcessing = React.useCallback((params, context) => {
97
92
  const preferencePanel = context.stateToRestore.preferencePanel;
98
93
  if (preferencePanel != null) {
@@ -7,7 +7,7 @@ import { gridRowsLookupSelector } from '../rows/gridRowsSelector';
7
7
  import { gridRowSelectionStateSelector, selectedGridRowsSelector, selectedIdsLookupSelector } from './gridRowSelectionSelector';
8
8
  import { gridPaginatedVisibleSortedGridRowIdsSelector } from '../pagination';
9
9
  import { gridFocusCellSelector } from '../focus/gridFocusStateSelector';
10
- import { gridExpandedSortedRowIdsSelector } from '../filter/gridFilterSelector';
10
+ import { gridExpandedSortedRowIdsSelector, gridFilterModelSelector } from '../filter/gridFilterSelector';
11
11
  import { GRID_CHECKBOX_SELECTION_COL_DEF, GRID_ACTIONS_COLUMN_TYPE } from '../../../colDef';
12
12
  import { GridCellModes } from '../../../models/gridEditRowModel';
13
13
  import { isKeyboardEvent, isNavigationKey } from '../../../utils/keyboardUtils';
@@ -28,12 +28,9 @@ const getSelectionModelPropValue = (selectionModelProp, prevSelectionModel) => {
28
28
  }
29
29
  return [selectionModelProp];
30
30
  };
31
- export const rowSelectionStateInitializer = (state, props) => {
32
- var _getSelectionModelPro;
33
- return _extends({}, state, {
34
- rowSelection: props.rowSelection ? (_getSelectionModelPro = getSelectionModelPropValue(props.rowSelectionModel)) != null ? _getSelectionModelPro : [] : []
35
- });
36
- };
31
+ export const rowSelectionStateInitializer = (state, props) => _extends({}, state, {
32
+ rowSelection: props.rowSelection ? getSelectionModelPropValue(props.rowSelectionModel) ?? [] : []
33
+ });
37
34
 
38
35
  /**
39
36
  * @requires useGridRows (state, method) - can be after
@@ -67,9 +64,8 @@ export const useGridRowSelection = (apiRef, props) => {
67
64
  const canHaveMultipleSelection = isMultipleRowSelectionEnabled(props);
68
65
  const visibleRows = useGridVisibleRows(apiRef, props);
69
66
  const expandMouseRowRangeSelection = React.useCallback(id => {
70
- var _lastRowToggled$curre;
71
67
  let endId = id;
72
- const startId = (_lastRowToggled$curre = lastRowToggled.current) != null ? _lastRowToggled$curre : id;
68
+ const startId = lastRowToggled.current ?? id;
73
69
  const isSelected = apiRef.current.isRowSelected(id);
74
70
  if (isSelected) {
75
71
  const visibleRowIds = gridExpandedSortedRowIdsSelector(apiRef);
@@ -113,7 +109,7 @@ export const useGridRowSelection = (apiRef, props) => {
113
109
  return false;
114
110
  }
115
111
  const rowNode = apiRef.current.getRowNode(id);
116
- if ((rowNode == null ? void 0 : rowNode.type) === 'footer' || (rowNode == null ? void 0 : rowNode.type) === 'pinnedRow') {
112
+ if (rowNode?.type === 'footer' || rowNode?.type === 'pinnedRow') {
117
113
  return false;
118
114
  }
119
115
  return true;
@@ -235,11 +231,10 @@ export const useGridRowSelection = (apiRef, props) => {
235
231
  }
236
232
  }, [apiRef, canHaveMultipleSelection, checkboxSelection]);
237
233
  const handleRowClick = React.useCallback((params, event) => {
238
- var _closest;
239
234
  if (disableRowSelectionOnClick) {
240
235
  return;
241
236
  }
242
- const field = (_closest = event.target.closest(`.${gridClasses.cell}`)) == null ? void 0 : _closest.getAttribute('data-field');
237
+ const field = event.target.closest(`.${gridClasses.cell}`)?.getAttribute('data-field');
243
238
  if (field === GRID_CHECKBOX_SELECTION_COL_DEF.field) {
244
239
  // click on checkbox should not trigger row selection
245
240
  return;
@@ -250,7 +245,7 @@ export const useGridRowSelection = (apiRef, props) => {
250
245
  }
251
246
  if (field) {
252
247
  const column = apiRef.current.getColumn(field);
253
- if ((column == null ? void 0 : column.type) === GRID_ACTIONS_COLUMN_TYPE) {
248
+ if (column?.type === GRID_ACTIONS_COLUMN_TYPE) {
254
249
  return;
255
250
  }
256
251
  }
@@ -266,8 +261,7 @@ export const useGridRowSelection = (apiRef, props) => {
266
261
  }, [disableRowSelectionOnClick, canHaveMultipleSelection, apiRef, expandMouseRowRangeSelection, handleSingleRowSelection]);
267
262
  const preventSelectionOnShift = React.useCallback((params, event) => {
268
263
  if (canHaveMultipleSelection && event.shiftKey) {
269
- var _window$getSelection;
270
- (_window$getSelection = window.getSelection()) == null || _window$getSelection.removeAllRanges();
264
+ window.getSelection()?.removeAllRanges();
271
265
  }
272
266
  }, [canHaveMultipleSelection]);
273
267
  const handleRowSelectionCheckboxChange = React.useCallback((params, event) => {
@@ -280,7 +274,8 @@ export const useGridRowSelection = (apiRef, props) => {
280
274
  const handleHeaderSelectionCheckboxChange = React.useCallback(params => {
281
275
  const shouldLimitSelectionToCurrentPage = props.checkboxSelectionVisibleOnly && props.pagination;
282
276
  const rowsToBeSelected = shouldLimitSelectionToCurrentPage ? gridPaginatedVisibleSortedGridRowIdsSelector(apiRef) : gridExpandedSortedRowIdsSelector(apiRef);
283
- apiRef.current.selectRows(rowsToBeSelected, params.value);
277
+ const filterModel = gridFilterModelSelector(apiRef);
278
+ apiRef.current.selectRows(rowsToBeSelected, params.value, filterModel?.items.length > 0);
284
279
  }, [apiRef, props.checkboxSelectionVisibleOnly, props.pagination]);
285
280
  const handleCellKeyDown = React.useCallback((params, event) => {
286
281
  // Get the most recent cell mode because it may have been changed by another listener
@@ -22,29 +22,22 @@ export const gridDataRowIdsSelector = createSelector(gridRowsStateSelector, rows
22
22
  /**
23
23
  * @ignore - do not document.
24
24
  */
25
- export const gridAdditionalRowGroupsSelector = createSelector(gridRowsStateSelector, rows => rows == null ? void 0 : rows.additionalRowGroups);
25
+ export const gridAdditionalRowGroupsSelector = createSelector(gridRowsStateSelector, rows => rows?.additionalRowGroups);
26
26
 
27
27
  /**
28
28
  * @ignore - do not document.
29
29
  */
30
30
  export const gridPinnedRowsSelector = createSelectorMemoized(gridAdditionalRowGroupsSelector, additionalRowGroups => {
31
- var _rawPinnedRows$bottom, _rawPinnedRows$bottom2, _rawPinnedRows$top$ma, _rawPinnedRows$top;
32
- const rawPinnedRows = additionalRowGroups == null ? void 0 : additionalRowGroups.pinnedRows;
31
+ const rawPinnedRows = additionalRowGroups?.pinnedRows;
33
32
  return {
34
- bottom: (_rawPinnedRows$bottom = rawPinnedRows == null || (_rawPinnedRows$bottom2 = rawPinnedRows.bottom) == null ? void 0 : _rawPinnedRows$bottom2.map(rowEntry => {
35
- var _rowEntry$model;
36
- return {
37
- id: rowEntry.id,
38
- model: (_rowEntry$model = rowEntry.model) != null ? _rowEntry$model : {}
39
- };
40
- })) != null ? _rawPinnedRows$bottom : [],
41
- top: (_rawPinnedRows$top$ma = rawPinnedRows == null || (_rawPinnedRows$top = rawPinnedRows.top) == null ? void 0 : _rawPinnedRows$top.map(rowEntry => {
42
- var _rowEntry$model2;
43
- return {
44
- id: rowEntry.id,
45
- model: (_rowEntry$model2 = rowEntry.model) != null ? _rowEntry$model2 : {}
46
- };
47
- })) != null ? _rawPinnedRows$top$ma : []
33
+ bottom: rawPinnedRows?.bottom?.map(rowEntry => ({
34
+ id: rowEntry.id,
35
+ model: rowEntry.model ?? {}
36
+ })) ?? [],
37
+ top: rawPinnedRows?.top?.map(rowEntry => ({
38
+ id: rowEntry.id,
39
+ model: rowEntry.model ?? {}
40
+ })) ?? []
48
41
  };
49
42
  });
50
43
 
@@ -52,6 +45,5 @@ export const gridPinnedRowsSelector = createSelectorMemoized(gridAdditionalRowGr
52
45
  * @ignore - do not document.
53
46
  */
54
47
  export const gridPinnedRowsCountSelector = createSelector(gridPinnedRowsSelector, pinnedRows => {
55
- var _pinnedRows$top, _pinnedRows$bottom;
56
- return ((pinnedRows == null || (_pinnedRows$top = pinnedRows.top) == null ? void 0 : _pinnedRows$top.length) || 0) + ((pinnedRows == null || (_pinnedRows$bottom = pinnedRows.bottom) == null ? void 0 : _pinnedRows$bottom.length) || 0);
48
+ return (pinnedRows?.top?.length || 0) + (pinnedRows?.bottom?.length || 0);
57
49
  });
@@ -146,7 +146,6 @@ export const updateCacheWithNewRows = ({
146
146
  getRowId,
147
147
  updates
148
148
  }) => {
149
- var _previousCache$update, _previousCache$update2, _previousCache$update3;
150
149
  if (previousCache.updates.type === 'full') {
151
150
  throw new Error('MUI X: Unable to prepare a partial update if a full update is not applied yet.');
152
151
  }
@@ -165,9 +164,9 @@ export const updateCacheWithNewRows = ({
165
164
  const partialUpdates = {
166
165
  type: 'partial',
167
166
  actions: {
168
- insert: [...((_previousCache$update = previousCache.updates.actions.insert) != null ? _previousCache$update : [])],
169
- modify: [...((_previousCache$update2 = previousCache.updates.actions.modify) != null ? _previousCache$update2 : [])],
170
- remove: [...((_previousCache$update3 = previousCache.updates.actions.remove) != null ? _previousCache$update3 : [])]
167
+ insert: [...(previousCache.updates.actions.insert ?? [])],
168
+ modify: [...(previousCache.updates.actions.modify ?? [])],
169
+ remove: [...(previousCache.updates.actions.remove ?? [])]
171
170
  },
172
171
  idToActionLookup: _extends({}, previousCache.updates.idToActionLookup)
173
172
  };
@@ -265,16 +264,15 @@ export const updateCacheWithNewRows = ({
265
264
  };
266
265
  };
267
266
  export function calculatePinnedRowsHeight(apiRef) {
268
- var _pinnedRows$top, _pinnedRows$bottom;
269
267
  const pinnedRows = gridPinnedRowsSelector(apiRef);
270
- const topPinnedRowsHeight = (pinnedRows == null || (_pinnedRows$top = pinnedRows.top) == null ? void 0 : _pinnedRows$top.reduce((acc, value) => {
268
+ const topPinnedRowsHeight = pinnedRows?.top?.reduce((acc, value) => {
271
269
  acc += apiRef.current.unstable_getRowHeight(value.id);
272
270
  return acc;
273
- }, 0)) || 0;
274
- const bottomPinnedRowsHeight = (pinnedRows == null || (_pinnedRows$bottom = pinnedRows.bottom) == null ? void 0 : _pinnedRows$bottom.reduce((acc, value) => {
271
+ }, 0) || 0;
272
+ const bottomPinnedRowsHeight = pinnedRows?.bottom?.reduce((acc, value) => {
275
273
  acc += apiRef.current.unstable_getRowHeight(value.id);
276
274
  return acc;
277
- }, 0)) || 0;
275
+ }, 0) || 0;
278
276
  return {
279
277
  top: topPinnedRowsHeight,
280
278
  bottom: bottomPinnedRowsHeight
@@ -37,7 +37,7 @@ export function useGridParamsApi(apiRef) {
37
37
  throw new MissingRowIdError(`No row with id #${id} found`);
38
38
  }
39
39
  const rawValue = row[field];
40
- const value = colDef != null && colDef.valueGetter ? colDef.valueGetter(rawValue, row, colDef, apiRef) : rawValue;
40
+ const value = colDef?.valueGetter ? colDef.valueGetter(rawValue, row, colDef, apiRef) : rawValue;
41
41
  const cellFocus = gridFocusCellSelector(apiRef);
42
42
  const cellTabIndex = gridTabIndexCellSelector(apiRef);
43
43
  const params = {
@@ -127,7 +127,7 @@ export const useGridRows = (apiRef, props) => {
127
127
  updates.forEach(update => {
128
128
  const id = getRowIdFromRowModel(update, props.getRowId, 'A row was provided without id when calling updateRows():');
129
129
  const rowNode = apiRef.current.getRowNode(id);
130
- if ((rowNode == null ? void 0 : rowNode.type) === 'pinnedRow') {
130
+ if (rowNode?.type === 'pinnedRow') {
131
131
  // @ts-ignore because otherwise `release:build` doesn't work
132
132
  const pinnedRowsCache = apiRef.current.caches.pinnedRows;
133
133
  const prevModel = pinnedRowsCache.idLookup[id];
@@ -151,10 +151,7 @@ export const useGridRows = (apiRef, props) => {
151
151
  const getRowModels = React.useCallback(() => {
152
152
  const dataRows = gridDataRowIdsSelector(apiRef);
153
153
  const idRowsLookup = gridRowsLookupSelector(apiRef);
154
- return new Map(dataRows.map(id => {
155
- var _idRowsLookup$id;
156
- return [id, (_idRowsLookup$id = idRowsLookup[id]) != null ? _idRowsLookup$id : {}];
157
- }));
154
+ return new Map(dataRows.map(id => [id, idRowsLookup[id] ?? {}]));
158
155
  }, [apiRef]);
159
156
  const getRowsCount = React.useCallback(() => gridRowCountSelector(apiRef), [apiRef]);
160
157
  const getAllRowIds = React.useCallback(() => gridDataRowIdsSelector(apiRef), [apiRef]);
@@ -182,10 +179,7 @@ export const useGridRows = (apiRef, props) => {
182
179
  apiRef.current.forceUpdate();
183
180
  apiRef.current.publishEvent('rowExpansionChange', newNode);
184
181
  }, [apiRef]);
185
- const getRowNode = React.useCallback(id => {
186
- var _ref;
187
- return (_ref = gridRowTreeSelector(apiRef)[id]) != null ? _ref : null;
188
- }, [apiRef]);
182
+ const getRowNode = React.useCallback(id => gridRowTreeSelector(apiRef)[id] ?? null, [apiRef]);
189
183
  const getRowGroupChildren = React.useCallback(({
190
184
  skipAutoGeneratedRows = true,
191
185
  groupId,
@@ -293,10 +287,7 @@ export const useGridRows = (apiRef, props) => {
293
287
  });
294
288
 
295
289
  // Removes potential remaining skeleton rows from the dataRowIds.
296
- const dataRowIds = rootGroupChildren.filter(childId => {
297
- var _tree$childId;
298
- return ((_tree$childId = tree[childId]) == null ? void 0 : _tree$childId.type) === 'leaf';
299
- });
290
+ const dataRowIds = rootGroupChildren.filter(childId => tree[childId]?.type === 'leaf');
300
291
  apiRef.current.caches.rows.dataRowIdToModelLookup = dataRowIdToModelLookup;
301
292
  apiRef.current.caches.rows.dataRowIdToIdLookup = dataRowIdToIdLookup;
302
293
  apiRef.current.setState(state => _extends({}, state, {
@@ -58,7 +58,6 @@ export const useGridRowsMeta = (apiRef, props) => {
58
58
  const validRowHeight = getValidRowHeight(props.rowHeight, DATA_GRID_PROPS_DEFAULT_VALUES.rowHeight, rowHeightWarning);
59
59
  const rowHeight = Math.floor(validRowHeight * densityFactor);
60
60
  const hydrateRowsMeta = React.useCallback(() => {
61
- var _pinnedRows$top, _pinnedRows$bottom;
62
61
  hasRowWithAutoHeight.current = false;
63
62
  const calculateRowProcessedSizes = row => {
64
63
  if (!rowsHeightLookup.current[row.id]) {
@@ -92,7 +91,7 @@ export const useGridRowsMeta = (apiRef, props) => {
92
91
  })) : rowHeight;
93
92
 
94
93
  // If the row was not measured yet use the estimated row height
95
- baseRowHeight = estimatedRowHeight != null ? estimatedRowHeight : rowHeight;
94
+ baseRowHeight = estimatedRowHeight ?? rowHeight;
96
95
  } else {
97
96
  baseRowHeight = existingBaseRowHeight;
98
97
  }
@@ -111,15 +110,14 @@ export const useGridRowsMeta = (apiRef, props) => {
111
110
  baseCenter: baseRowHeight
112
111
  };
113
112
  if (getRowSpacing) {
114
- var _spacing$top, _spacing$bottom;
115
113
  const indexRelativeToCurrentPage = apiRef.current.getRowIndexRelativeToVisibleRows(row.id);
116
114
  const spacing = getRowSpacing(_extends({}, row, {
117
115
  isFirstVisible: indexRelativeToCurrentPage === 0,
118
116
  isLastVisible: indexRelativeToCurrentPage === currentPage.rows.length - 1,
119
117
  indexRelativeToCurrentPage
120
118
  }));
121
- initialHeights.spacingTop = (_spacing$top = spacing.top) != null ? _spacing$top : 0;
122
- initialHeights.spacingBottom = (_spacing$bottom = spacing.bottom) != null ? _spacing$bottom : 0;
119
+ initialHeights.spacingTop = spacing.top ?? 0;
120
+ initialHeights.spacingBottom = spacing.bottom ?? 0;
123
121
  }
124
122
  const processedSizes = apiRef.current.unstable_applyPipeProcessors('rowHeight', initialHeights, row);
125
123
  rowsHeightLookup.current[row.id].sizes = processedSizes;
@@ -139,10 +137,10 @@ export const useGridRowsMeta = (apiRef, props) => {
139
137
  }
140
138
  return acc + processedSizes.baseCenter + otherSizes;
141
139
  }, 0);
142
- pinnedRows == null || (_pinnedRows$top = pinnedRows.top) == null || _pinnedRows$top.forEach(row => {
140
+ pinnedRows?.top?.forEach(row => {
143
141
  calculateRowProcessedSizes(row);
144
142
  });
145
- pinnedRows == null || (_pinnedRows$bottom = pinnedRows.bottom) == null || _pinnedRows$bottom.forEach(row => {
143
+ pinnedRows?.bottom?.forEach(row => {
146
144
  calculateRowProcessedSizes(row);
147
145
  });
148
146
  apiRef.current.setState(state => {
@@ -163,10 +161,7 @@ export const useGridRowsMeta = (apiRef, props) => {
163
161
  const height = rowsHeightLookup.current[rowId];
164
162
  return height ? height.sizes.baseCenter : rowHeight;
165
163
  }, [rowHeight]);
166
- const getRowInternalSizes = rowId => {
167
- var _rowsHeightLookup$cur;
168
- return (_rowsHeightLookup$cur = rowsHeightLookup.current[rowId]) == null ? void 0 : _rowsHeightLookup$cur.sizes;
169
- };
164
+ const getRowInternalSizes = rowId => rowsHeightLookup.current[rowId]?.sizes;
170
165
  const setRowHeight = React.useCallback((id, height) => {
171
166
  rowsHeightLookup.current[id].sizes.baseCenter = height;
172
167
  rowsHeightLookup.current[id].isResized = true;
@@ -188,8 +183,7 @@ export const useGridRowsMeta = (apiRef, props) => {
188
183
  }
189
184
  }, [debouncedHydrateRowsMeta]);
190
185
  const rowHasAutoHeight = React.useCallback(id => {
191
- var _rowsHeightLookup$cur2;
192
- return ((_rowsHeightLookup$cur2 = rowsHeightLookup.current[id]) == null ? void 0 : _rowsHeightLookup$cur2.autoHeight) || false;
186
+ return rowsHeightLookup.current[id]?.autoHeight || false;
193
187
  }, []);
194
188
  const getLastMeasuredRowIndex = React.useCallback(() => {
195
189
  return lastMeasuredRowIndex.current;
@@ -62,8 +62,7 @@ export const useGridScroll = (apiRef, props) => {
62
62
  const columnPositions = gridColumnPositionsSelector(apiRef);
63
63
  let cellWidth;
64
64
  if (typeof params.rowIndex !== 'undefined') {
65
- var _visibleSortedRows$pa;
66
- const rowId = (_visibleSortedRows$pa = visibleSortedRows[params.rowIndex]) == null ? void 0 : _visibleSortedRows$pa.id;
65
+ const rowId = visibleSortedRows[params.rowIndex]?.id;
67
66
  const cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, params.colIndex);
68
67
  if (cellColSpanInfo && !cellColSpanInfo.spannedByColSpan) {
69
68
  cellWidth = cellColSpanInfo.cellProps.width;
@@ -114,7 +113,7 @@ export const useGridScroll = (apiRef, props) => {
114
113
  logger.debug(`Scrolling, updating container, and viewport`);
115
114
  }, [virtualScrollerRef, theme.direction, colRef, logger]);
116
115
  const getScrollPosition = React.useCallback(() => {
117
- if (!(virtualScrollerRef != null && virtualScrollerRef.current)) {
116
+ if (!virtualScrollerRef?.current) {
118
117
  return {
119
118
  top: 0,
120
119
  left: 0
@@ -19,13 +19,10 @@ export const gridSortedRowIdsSelector = createSelector(gridSortingStateSelector,
19
19
  */
20
20
  export const gridSortedRowEntriesSelector = createSelectorMemoized(gridSortedRowIdsSelector, gridRowsLookupSelector,
21
21
  // TODO rows v6: Is this the best approach ?
22
- (sortedIds, idRowsLookup) => sortedIds.map(id => {
23
- var _idRowsLookup$id;
24
- return {
25
- id,
26
- model: (_idRowsLookup$id = idRowsLookup[id]) != null ? _idRowsLookup$id : {}
27
- };
28
- }));
22
+ (sortedIds, idRowsLookup) => sortedIds.map(id => ({
23
+ id,
24
+ model: idRowsLookup[id] ?? {}
25
+ })));
29
26
 
30
27
  /**
31
28
  * Get the current sorting model.