@mui/x-data-grid 5.17.5 → 6.0.0-alpha.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 (215) hide show
  1. package/CHANGELOG.md +297 -19
  2. package/DataGrid/DataGrid.js +1 -11
  3. package/DataGrid/useDataGridProps.js +4 -4
  4. package/colDef/gridStringColDef.js +0 -1
  5. package/components/DataGridVirtualScroller.js +5 -3
  6. package/components/GridRow.js +4 -3
  7. package/components/base/GridBody.js +1 -2
  8. package/components/base/GridOverlays.js +52 -12
  9. package/components/cell/GridActionsCell.js +1 -1
  10. package/components/cell/GridBooleanCell.js +3 -2
  11. package/components/cell/GridEditBooleanCell.js +1 -1
  12. package/components/cell/GridEditDateCell.js +1 -1
  13. package/components/cell/GridEditInputCell.js +1 -1
  14. package/components/cell/GridEditSingleSelectCell.js +1 -1
  15. package/components/columnSelection/GridCellCheckboxRenderer.d.ts +2 -2
  16. package/components/columnSelection/GridCellCheckboxRenderer.js +2 -7
  17. package/components/containers/GridOverlay.js +0 -5
  18. package/components/containers/GridRootStyles.js +2 -0
  19. package/components/panel/GridColumnsPanel.js +4 -18
  20. package/constants/gridClasses.d.ts +8 -0
  21. package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +1 -1
  22. package/hooks/core/strategyProcessing/gridStrategyProcessingApi.d.ts +1 -1
  23. package/hooks/features/columns/gridColumnsInterfaces.d.ts +1 -4
  24. package/hooks/features/columns/gridColumnsUtils.d.ts +3 -4
  25. package/hooks/features/columns/gridColumnsUtils.js +21 -92
  26. package/hooks/features/columns/useGridColumns.d.ts +1 -1
  27. package/hooks/features/columns/useGridColumns.js +28 -61
  28. package/hooks/features/editRows/useGridCellEditing.new.js +2 -2
  29. package/hooks/features/editRows/useGridEditing.new.js +3 -2
  30. package/hooks/features/editRows/useGridEditing.old.js +2 -1
  31. package/hooks/features/editRows/useGridRowEditing.new.js +2 -2
  32. package/hooks/features/export/useGridPrintExport.js +31 -17
  33. package/hooks/features/export/utils.js +1 -5
  34. package/hooks/features/filter/gridFilterSelector.js +2 -2
  35. package/hooks/features/filter/useGridFilter.js +6 -6
  36. package/hooks/features/pagination/gridPaginationSelector.js +2 -2
  37. package/hooks/features/rows/gridRowsInterfaces.d.ts +106 -0
  38. package/hooks/features/rows/{gridRowsState.js → gridRowsInterfaces.js} +0 -0
  39. package/hooks/features/rows/gridRowsSelector.d.ts +17 -7
  40. package/hooks/features/rows/gridRowsSelector.js +38 -6
  41. package/hooks/features/rows/gridRowsUtils.d.ts +16 -4
  42. package/hooks/features/rows/gridRowsUtils.js +222 -39
  43. package/hooks/features/rows/index.d.ts +3 -3
  44. package/hooks/features/rows/index.js +2 -2
  45. package/hooks/features/rows/useGridRows.js +161 -124
  46. package/hooks/features/rows/useGridRowsPreProcessors.js +78 -26
  47. package/hooks/features/selection/useGridSelection.js +3 -3
  48. package/hooks/features/sorting/gridSortingSelector.js +9 -4
  49. package/hooks/features/sorting/gridSortingState.d.ts +2 -2
  50. package/hooks/features/sorting/useGridSorting.js +9 -33
  51. package/hooks/features/virtualization/useGridVirtualScroller.js +4 -10
  52. package/hooks/utils/useGridApiEventHandler.d.ts +2 -2
  53. package/index.js +1 -1
  54. package/internals/index.d.ts +2 -1
  55. package/internals/index.js +1 -0
  56. package/legacy/DataGrid/DataGrid.js +1 -11
  57. package/legacy/DataGrid/useDataGridProps.js +4 -4
  58. package/legacy/colDef/gridStringColDef.js +0 -1
  59. package/legacy/components/DataGridVirtualScroller.js +5 -3
  60. package/legacy/components/GridRow.js +4 -3
  61. package/legacy/components/base/GridBody.js +1 -2
  62. package/legacy/components/base/GridOverlays.js +54 -12
  63. package/legacy/components/cell/GridActionsCell.js +1 -1
  64. package/legacy/components/cell/GridBooleanCell.js +3 -2
  65. package/legacy/components/cell/GridEditBooleanCell.js +1 -1
  66. package/legacy/components/cell/GridEditDateCell.js +1 -1
  67. package/legacy/components/cell/GridEditInputCell.js +1 -1
  68. package/legacy/components/cell/GridEditSingleSelectCell.js +1 -1
  69. package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +2 -7
  70. package/legacy/components/containers/GridOverlay.js +0 -5
  71. package/legacy/components/containers/GridRootStyles.js +2 -1
  72. package/legacy/components/panel/GridColumnsPanel.js +9 -23
  73. package/legacy/hooks/features/columns/gridColumnsUtils.js +22 -94
  74. package/legacy/hooks/features/columns/useGridColumns.js +27 -60
  75. package/legacy/hooks/features/editRows/useGridCellEditing.new.js +2 -2
  76. package/legacy/hooks/features/editRows/useGridEditing.new.js +3 -2
  77. package/legacy/hooks/features/editRows/useGridEditing.old.js +2 -1
  78. package/legacy/hooks/features/editRows/useGridRowEditing.new.js +2 -2
  79. package/legacy/hooks/features/export/useGridPrintExport.js +33 -20
  80. package/legacy/hooks/features/export/utils.js +1 -3
  81. package/legacy/hooks/features/filter/gridFilterSelector.js +2 -2
  82. package/legacy/hooks/features/filter/useGridFilter.js +6 -6
  83. package/legacy/hooks/features/pagination/gridPaginationSelector.js +2 -2
  84. package/legacy/hooks/features/rows/{gridRowsState.js → gridRowsInterfaces.js} +0 -0
  85. package/legacy/hooks/features/rows/gridRowsSelector.js +52 -9
  86. package/legacy/hooks/features/rows/gridRowsUtils.js +238 -46
  87. package/legacy/hooks/features/rows/index.js +2 -2
  88. package/legacy/hooks/features/rows/useGridRows.js +163 -134
  89. package/legacy/hooks/features/rows/useGridRowsPreProcessors.js +81 -26
  90. package/legacy/hooks/features/selection/useGridSelection.js +3 -3
  91. package/legacy/hooks/features/sorting/gridSortingSelector.js +5 -2
  92. package/legacy/hooks/features/sorting/useGridSorting.js +11 -33
  93. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +4 -10
  94. package/legacy/index.js +1 -1
  95. package/legacy/internals/index.js +1 -0
  96. package/legacy/models/events/index.js +1 -2
  97. package/legacy/models/gridFeatureMode.js +1 -4
  98. package/legacy/models/params/index.js +0 -1
  99. package/models/api/gridCoreApi.d.ts +2 -2
  100. package/models/api/gridParamsApi.d.ts +2 -2
  101. package/models/api/gridRowApi.d.ts +7 -5
  102. package/models/colDef/gridColDef.d.ts +0 -12
  103. package/models/events/gridEventListener.d.ts +2 -3
  104. package/models/events/gridEventLookup.d.ts +5 -13
  105. package/models/events/gridEventPublisher.d.ts +9 -10
  106. package/models/events/index.d.ts +0 -1
  107. package/models/events/index.js +1 -2
  108. package/models/gridApiCaches.d.ts +1 -3
  109. package/models/gridFeatureMode.d.ts +0 -4
  110. package/models/gridFeatureMode.js +1 -4
  111. package/models/gridRows.d.ts +100 -30
  112. package/models/gridSortModel.d.ts +2 -2
  113. package/models/params/gridCellParams.d.ts +7 -11
  114. package/models/params/gridEditCellParams.d.ts +2 -2
  115. package/models/params/index.d.ts +0 -1
  116. package/models/params/index.js +0 -1
  117. package/models/props/DataGridProps.d.ts +0 -9
  118. package/modern/DataGrid/DataGrid.js +1 -11
  119. package/modern/DataGrid/useDataGridProps.js +4 -4
  120. package/modern/colDef/gridStringColDef.js +0 -1
  121. package/modern/components/DataGridVirtualScroller.js +5 -3
  122. package/modern/components/GridRow.js +4 -3
  123. package/modern/components/base/GridBody.js +1 -2
  124. package/modern/components/base/GridOverlays.js +52 -12
  125. package/modern/components/cell/GridActionsCell.js +1 -1
  126. package/modern/components/cell/GridBooleanCell.js +3 -2
  127. package/modern/components/cell/GridEditBooleanCell.js +1 -1
  128. package/modern/components/cell/GridEditDateCell.js +1 -1
  129. package/modern/components/cell/GridEditInputCell.js +1 -1
  130. package/modern/components/cell/GridEditSingleSelectCell.js +1 -1
  131. package/modern/components/columnSelection/GridCellCheckboxRenderer.js +2 -7
  132. package/modern/components/containers/GridOverlay.js +0 -5
  133. package/modern/components/containers/GridRootStyles.js +2 -0
  134. package/modern/components/panel/GridColumnsPanel.js +4 -18
  135. package/modern/hooks/features/columns/gridColumnsUtils.js +21 -92
  136. package/modern/hooks/features/columns/useGridColumns.js +21 -54
  137. package/modern/hooks/features/editRows/useGridCellEditing.new.js +2 -2
  138. package/modern/hooks/features/editRows/useGridEditing.new.js +3 -2
  139. package/modern/hooks/features/editRows/useGridEditing.old.js +2 -1
  140. package/modern/hooks/features/editRows/useGridRowEditing.new.js +2 -2
  141. package/modern/hooks/features/export/useGridPrintExport.js +30 -16
  142. package/modern/hooks/features/export/utils.js +1 -1
  143. package/modern/hooks/features/filter/gridFilterSelector.js +2 -2
  144. package/modern/hooks/features/filter/useGridFilter.js +6 -6
  145. package/modern/hooks/features/pagination/gridPaginationSelector.js +2 -2
  146. package/{legacy/models/params/gridColumnVisibilityChangeParams.js → modern/hooks/features/rows/gridRowsInterfaces.js} +0 -0
  147. package/modern/hooks/features/rows/gridRowsSelector.js +28 -6
  148. package/modern/hooks/features/rows/gridRowsUtils.js +220 -37
  149. package/modern/hooks/features/rows/index.js +2 -2
  150. package/modern/hooks/features/rows/useGridRows.js +158 -121
  151. package/modern/hooks/features/rows/useGridRowsPreProcessors.js +78 -26
  152. package/modern/hooks/features/selection/useGridSelection.js +3 -3
  153. package/modern/hooks/features/sorting/gridSortingSelector.js +3 -2
  154. package/modern/hooks/features/sorting/useGridSorting.js +9 -33
  155. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +4 -10
  156. package/modern/index.js +1 -1
  157. package/modern/internals/index.js +1 -0
  158. package/modern/models/events/index.js +1 -2
  159. package/modern/models/gridFeatureMode.js +1 -4
  160. package/modern/models/params/index.js +0 -1
  161. package/node/DataGrid/DataGrid.js +1 -11
  162. package/node/DataGrid/useDataGridProps.js +3 -3
  163. package/node/colDef/gridStringColDef.js +0 -1
  164. package/node/components/DataGridVirtualScroller.js +5 -3
  165. package/node/components/GridRow.js +3 -2
  166. package/node/components/base/GridBody.js +1 -3
  167. package/node/components/base/GridOverlays.js +57 -12
  168. package/node/components/cell/GridActionsCell.js +1 -1
  169. package/node/components/cell/GridBooleanCell.js +4 -2
  170. package/node/components/cell/GridEditBooleanCell.js +1 -1
  171. package/node/components/cell/GridEditDateCell.js +1 -1
  172. package/node/components/cell/GridEditInputCell.js +1 -1
  173. package/node/components/cell/GridEditSingleSelectCell.js +1 -1
  174. package/node/components/columnSelection/GridCellCheckboxRenderer.js +2 -7
  175. package/node/components/containers/GridOverlay.js +0 -5
  176. package/node/components/containers/GridRootStyles.js +2 -0
  177. package/node/components/panel/GridColumnsPanel.js +4 -18
  178. package/node/hooks/features/columns/gridColumnsUtils.js +20 -88
  179. package/node/hooks/features/columns/useGridColumns.js +29 -60
  180. package/node/hooks/features/editRows/useGridCellEditing.new.js +1 -1
  181. package/node/hooks/features/editRows/useGridEditing.new.js +4 -2
  182. package/node/hooks/features/editRows/useGridEditing.old.js +3 -1
  183. package/node/hooks/features/editRows/useGridRowEditing.new.js +1 -1
  184. package/node/hooks/features/export/useGridPrintExport.js +31 -17
  185. package/node/hooks/features/export/utils.js +1 -5
  186. package/node/hooks/features/filter/gridFilterSelector.js +1 -1
  187. package/node/hooks/features/filter/useGridFilter.js +5 -6
  188. package/node/hooks/features/pagination/gridPaginationSelector.js +1 -1
  189. package/node/hooks/features/rows/{gridRowsState.js → gridRowsInterfaces.js} +0 -0
  190. package/node/hooks/features/rows/gridRowsSelector.js +43 -10
  191. package/node/hooks/features/rows/gridRowsUtils.js +239 -40
  192. package/node/hooks/features/rows/index.js +23 -9
  193. package/node/hooks/features/rows/useGridRows.js +161 -122
  194. package/node/hooks/features/rows/useGridRowsPreProcessors.js +81 -26
  195. package/node/hooks/features/selection/useGridSelection.js +3 -3
  196. package/node/hooks/features/sorting/gridSortingSelector.js +9 -4
  197. package/node/hooks/features/sorting/useGridSorting.js +9 -33
  198. package/node/hooks/features/virtualization/useGridVirtualScroller.js +4 -10
  199. package/node/index.js +1 -1
  200. package/node/internals/index.js +14 -2
  201. package/node/models/events/index.js +0 -13
  202. package/node/models/gridFeatureMode.js +1 -7
  203. package/node/models/params/index.js +0 -13
  204. package/package.json +3 -3
  205. package/hooks/features/rows/gridRowsState.d.ts +0 -60
  206. package/legacy/models/events/gridEvents.js +0 -92
  207. package/models/events/gridEvents.d.ts +0 -91
  208. package/models/events/gridEvents.js +0 -92
  209. package/models/params/gridColumnVisibilityChangeParams.d.ts +0 -18
  210. package/models/params/gridColumnVisibilityChangeParams.js +0 -1
  211. package/modern/hooks/features/rows/gridRowsState.js +0 -1
  212. package/modern/models/events/gridEvents.js +0 -92
  213. package/modern/models/params/gridColumnVisibilityChangeParams.js +0 -1
  214. package/node/models/events/gridEvents.js +0 -97
  215. package/node/models/params/gridColumnVisibilityChangeParams.js +0 -5
@@ -1,18 +1,18 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
3
  import * as React from 'react';
4
- import { GridFeatureModeConstant } from '../../../models/gridFeatureMode';
5
4
  import { isEnterKey } from '../../../utils/keyboardUtils';
6
5
  import { useGridApiEventHandler } from '../../utils/useGridApiEventHandler';
7
6
  import { useGridApiMethod } from '../../utils/useGridApiMethod';
8
7
  import { useGridLogger } from '../../utils/useGridLogger';
9
8
  import { gridColumnLookupSelector } from '../columns/gridColumnsSelector';
10
9
  import { gridSortedRowEntriesSelector, gridSortedRowIdsSelector, gridSortModelSelector } from './gridSortingSelector';
11
- import { gridRowIdsSelector, gridRowTreeSelector } from '../rows';
10
+ import { GRID_ROOT_GROUP_ID, gridRowTreeSelector } from '../rows';
12
11
  import { useFirstRender } from '../../utils/useFirstRender';
13
12
  import { useGridRegisterStrategyProcessor, GRID_DEFAULT_STRATEGY } from '../../core/strategyProcessing';
14
13
  import { buildAggregatedSortingApplier, mergeStateWithSortModel, getNextGridSortDirection, sanitizeSortModel } from './gridSortingUtils';
15
14
  import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
15
+ import { getTreeNodeDescendants } from '../rows/gridRowsUtils';
16
16
  export var sortingStateInitializer = function sortingStateInitializer(state, props) {
17
17
  var _ref, _props$sortModel, _props$initialState, _props$initialState$s;
18
18
 
@@ -88,11 +88,11 @@ export var useGridSorting = function useGridSorting(apiRef, props) {
88
88
 
89
89
  var applySorting = React.useCallback(function () {
90
90
  apiRef.current.setState(function (state) {
91
- if (props.sortingMode === GridFeatureModeConstant.server) {
91
+ if (props.sortingMode === 'server') {
92
92
  logger.debug('Skipping sorting rows as sortingMode = server');
93
93
  return _extends({}, state, {
94
94
  sorting: _extends({}, state.sorting, {
95
- sortedRows: gridRowIdsSelector(state, apiRef.current.instanceId)
95
+ sortedRows: getTreeNodeDescendants(gridRowTreeSelector(apiRef), GRID_ROOT_GROUP_ID, false)
96
96
  })
97
97
  });
98
98
  }
@@ -206,38 +206,16 @@ export var useGridSorting = function useGridSorting(apiRef, props) {
206
206
  }, [apiRef, props.disableMultipleColumnsSorting]);
207
207
  var flatSortingMethod = React.useCallback(function (params) {
208
208
  var rowTree = gridRowTreeSelector(apiRef);
209
+ var rootGroupNode = rowTree[GRID_ROOT_GROUP_ID];
210
+ var sortedChildren = params.sortRowList ? params.sortRowList(rootGroupNode.children.map(function (childId) {
211
+ return rowTree[childId];
212
+ })) : _toConsumableArray(rootGroupNode.children);
209
213
 
210
- if (!params.sortRowList) {
211
- var bodyRowIds = [];
212
- var _footerRowIds = [];
213
- gridRowIdsSelector(apiRef).forEach(function (rowId) {
214
- if (rowTree[rowId].isPinned) {
215
- return;
216
- }
217
-
218
- if (rowTree[rowId].position === 'footer') {
219
- _footerRowIds.push(rowId);
220
- } else {
221
- bodyRowIds.push(rowId);
222
- }
223
- });
224
- return [].concat(bodyRowIds, _footerRowIds);
214
+ if (rootGroupNode.footerId != null) {
215
+ sortedChildren.push(rootGroupNode.footerId);
225
216
  }
226
217
 
227
- var bodyRows = [];
228
- var footerRowIds = [];
229
- Object.values(rowTree).forEach(function (rowNode) {
230
- if (rowNode.isPinned) {
231
- return;
232
- }
233
-
234
- if (rowNode.position === 'footer') {
235
- footerRowIds.push(rowNode.id);
236
- } else {
237
- bodyRows.push(rowNode);
238
- }
239
- });
240
- return [].concat(_toConsumableArray(params.sortRowList(bodyRows)), footerRowIds);
218
+ return sortedChildren;
241
219
  }, [apiRef]);
242
220
  useGridRegisterPipeProcessor(apiRef, 'exportState', stateExportPreProcessing);
243
221
  useGridRegisterPipeProcessor(apiRef, 'restoreState', stateRestorePreProcessing);
@@ -9,7 +9,6 @@ import { useGridApiContext } from '../../utils/useGridApiContext';
9
9
  import { useGridRootProps } from '../../utils/useGridRootProps';
10
10
  import { useGridSelector } from '../../utils/useGridSelector';
11
11
  import { gridVisibleColumnDefinitionsSelector, gridColumnsTotalWidthSelector, gridColumnPositionsSelector } from '../columns/gridColumnsSelector';
12
- import { gridDensityRowHeightSelector } from '../density/densitySelector';
13
12
  import { gridFocusCellSelector, gridTabIndexCellSelector } from '../focus/gridFocusStateSelector';
14
13
  import { gridEditRowsStateSelector } from '../editRows/gridEditRowsSelector';
15
14
  import { useGridVisibleRows } from '../../utils/useGridVisibleRows';
@@ -17,7 +16,8 @@ import { useGridApiEventHandler } from '../../utils/useGridApiEventHandler';
17
16
  import { clamp } from '../../../utils/utils';
18
17
  import { selectedIdsLookupSelector } from '../selection/gridSelectionSelector';
19
18
  import { gridRowsMetaSelector } from '../rows/gridRowsMetaSelector';
20
- import { getFirstNonSpannedColumnToRender } from '../columns/gridColumnsUtils'; // Uses binary search to avoid looping through all possible positions
19
+ import { getFirstNonSpannedColumnToRender } from '../columns/gridColumnsUtils';
20
+ import { getMinimalContentHeight } from '../rows/gridRowsUtils'; // Uses binary search to avoid looping through all possible positions
21
21
 
22
22
  import { jsx as _jsx } from "react/jsx-runtime";
23
23
  export function binarySearch(offset, positions) {
@@ -72,7 +72,6 @@ export var useGridVirtualScroller = function useGridVirtualScroller(props) {
72
72
  getRowProps = props.getRowProps;
73
73
  var columnPositions = useGridSelector(apiRef, gridColumnPositionsSelector);
74
74
  var columnsTotalWidth = useGridSelector(apiRef, gridColumnsTotalWidthSelector);
75
- var rowHeight = useGridSelector(apiRef, gridDensityRowHeightSelector);
76
75
  var cellFocus = useGridSelector(apiRef, gridFocusCellSelector);
77
76
  var cellTabIndex = useGridSelector(apiRef, gridTabIndexCellSelector);
78
77
  var rowsMeta = useGridSelector(apiRef, gridRowsMetaSelector);
@@ -458,19 +457,14 @@ export var useGridVirtualScroller = function useGridVirtualScroller(props) {
458
457
  height: height,
459
458
  minHeight: shouldExtendContent ? '100%' : 'auto'
460
459
  };
461
-
462
- if (rootProps.autoHeight && currentPage.rows.length === 0) {
463
- size.height = 2 * rowHeight; // Give room to show the overlay when there's no row.
464
- }
465
-
466
460
  return size;
467
- }, [rootRef, columnsTotalWidth, rowsMeta.currentPageTotalHeight, currentPage.rows.length, needsHorizontalScrollbar, rootProps.autoHeight, rowHeight]);
461
+ }, [rootRef, columnsTotalWidth, rowsMeta.currentPageTotalHeight, needsHorizontalScrollbar]);
468
462
  React.useEffect(function () {
469
463
  apiRef.current.publishEvent('virtualScrollerContentSizeChange');
470
464
  }, [apiRef, contentSize]);
471
465
 
472
466
  if (rootProps.autoHeight && currentPage.rows.length === 0) {
473
- contentSize.height = 2 * rowHeight; // Give room to show the overlay when there no rows.
467
+ contentSize.height = getMinimalContentHeight(apiRef); // Give room to show the overlay when there no rows.
474
468
  }
475
469
 
476
470
  var rootStyle = {};
package/legacy/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.17.5
1
+ /** @license MUI v6.0.0-alpha.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.
@@ -26,6 +26,7 @@ export { useGridEditing as useGridEditing_new, editingStateInitializer as editin
26
26
  export { useGridEditing as useGridEditing_old, editingStateInitializer as editingStateInitializer_old } from '../hooks/features/editRows/useGridEditing.old';
27
27
  export { useGridRows, rowsStateInitializer } from '../hooks/features/rows/useGridRows';
28
28
  export { useGridRowsPreProcessors } from '../hooks/features/rows/useGridRowsPreProcessors';
29
+ export { getTreeNodeDescendants, buildRootGroup } from '../hooks/features/rows/gridRowsUtils';
29
30
  export { useGridRowsMeta, rowsMetaStateInitializer } from '../hooks/features/rows/useGridRowsMeta';
30
31
  export { useGridParamsApi } from '../hooks/features/rows/useGridParamsApi';
31
32
  export { getRowIdFromRowModel } from '../hooks/features/rows/gridRowsUtils';
@@ -1,4 +1,3 @@
1
1
  export * from './gridEventListener';
2
2
  export * from './gridEventPublisher';
3
- export * from './gridEventLookup';
4
- export * from './gridEvents';
3
+ export * from './gridEventLookup';
@@ -1,4 +1 @@
1
- export var GridFeatureModeConstant = {
2
- client: 'client',
3
- server: 'server'
4
- };
1
+ export {};
@@ -1,7 +1,6 @@
1
1
  export * from './gridColumnHeaderParams';
2
2
  export * from './gridColumnOrderChangeParams';
3
3
  export * from './gridColumnResizeParams';
4
- export * from './gridColumnVisibilityChangeParams';
5
4
  export * from './gridEditCellParams';
6
5
  export * from './gridRowParams';
7
6
  export * from './gridScrollParams';
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { GridEventPublisher, GridEventListener, GridEventsStr } from '../events';
2
+ import { GridEventPublisher, GridEventListener, GridEvents } from '../events';
3
3
  import { EventManager, EventListenerOptions } from '../../utils/EventManager';
4
4
  import { GridApiCaches } from '../gridApiCaches';
5
5
  /**
@@ -58,7 +58,7 @@ export interface GridCoreApi {
58
58
  * @param {object} options Additional options for this listener.
59
59
  * @returns {function} A function to unsubscribe from this event.
60
60
  */
61
- subscribeEvent: <E extends GridEventsStr>(event: E, handler: GridEventListener<E>, options?: EventListenerOptions) => () => void;
61
+ subscribeEvent: <E extends GridEvents>(event: E, handler: GridEventListener<E>, options?: EventListenerOptions) => () => void;
62
62
  /**
63
63
  * Emits an event.
64
64
  * @param {GridEvents} name The name of the event.
@@ -1,4 +1,4 @@
1
- import { GridValidRowModel, GridRowId } from '../gridRows';
1
+ import { GridValidRowModel, GridRowId, GridTreeNode } from '../gridRows';
2
2
  import { GridCellParams } from '../params/gridCellParams';
3
3
  import { GridColumnHeaderParams } from '../params/gridColumnHeaderParams';
4
4
  import { GridRowParams } from '../params/gridRowParams';
@@ -24,7 +24,7 @@ export interface GridParamsApi {
24
24
  * @param {string} field The column field.
25
25
  * @returns {GridCellParams} The cell params.
26
26
  */
27
- getCellParams: <V = any, R extends GridValidRowModel = any, F = V>(id: GridRowId, field: string) => GridCellParams<V, R, F>;
27
+ getCellParams: <V = any, R extends GridValidRowModel = any, F = V, N extends GridTreeNode = GridTreeNode>(id: GridRowId, field: string) => GridCellParams<V, R, F, N>;
28
28
  /**
29
29
  * Gets the [[GridRowParams]] object that is passed as argument in events.
30
30
  * @param {GridRowId} id The id of the row.
@@ -1,4 +1,4 @@
1
- import { GridRowModel, GridRowId, GridRowModelUpdate, GridRowTreeNodeConfig, GridValidRowModel } from '../gridRows';
1
+ import { GridRowModel, GridRowId, GridRowModelUpdate, GridValidRowModel, GridTreeNode } from '../gridRows';
2
2
  export interface GridRowGroupChildrenGetterParams {
3
3
  /**
4
4
  * The row id of the group
@@ -36,6 +36,7 @@ export interface GridRowApi {
36
36
  getRowsCount: () => number;
37
37
  /**
38
38
  * Gets the list of row ids.
39
+ * TODO rows v6: Rename or remove ?
39
40
  * @returns {GridRowId[]} A list of ids.
40
41
  */
41
42
  getAllRowIds: () => GridRowId[];
@@ -51,7 +52,7 @@ export interface GridRowApi {
51
52
  */
52
53
  setRowIndex: (rowId: GridRowId, targetIndex: number) => void;
53
54
  /**
54
- * Allows to updates, insert and delete rows in a single call.
55
+ * Allows to update, insert and delete rows.
55
56
  * @param {GridRowModelUpdate[]} updates An array of rows with an `action` specifying what to do.
56
57
  */
57
58
  updateRows: (updates: GridRowModelUpdate[]) => void;
@@ -63,10 +64,11 @@ export interface GridRowApi {
63
64
  getRow: <R extends GridValidRowModel = any>(id: GridRowId) => R | null;
64
65
  /**
65
66
  * Gets the row node from the internal tree structure.
67
+ * TODO rows v6: Rename `getTreeNode`
66
68
  * @param {GridRowId} id The id of the row.
67
- * @returns {GridRowTreeNodeConfig} The row data.
69
+ * @returns {GridTreeNode} The tree node.
68
70
  */
69
- getRowNode: (id: GridRowId) => GridRowTreeNodeConfig | null;
71
+ getRowNode: <N extends GridTreeNode>(id: GridRowId) => N | null;
70
72
  /**
71
73
  * Expand or collapse a row children.
72
74
  * @param {GridRowId} id the ID of the row to expand or collapse.
@@ -82,7 +84,7 @@ export interface GridRowApi {
82
84
  /**
83
85
  * Gets the rows of a grouping criteria.
84
86
  * Only contains the rows provided to the grid, not the rows automatically generated by it.
85
- * @param {GridRowGroupChildrenParams} params Object containing parameters for the getter.
87
+ * @param {GridRowGroupChildrenGetterParams} params Object containing parameters for the getter.
86
88
  * @returns {GridRowId[]} The id of each row in the grouping criteria.
87
89
  */
88
90
  getRowGroupChildren: (params: GridRowGroupChildrenGetterParams) => GridRowId[];
@@ -60,18 +60,6 @@ export interface GridColDef<R extends GridValidRowModel = any, V = any, F = V> {
60
60
  * @default Infinity
61
61
  */
62
62
  maxWidth?: number;
63
- /**
64
- * If `true`, hide the column.
65
- * @deprecated Use the `initialState` prop to hide columns:
66
- * ```jsx
67
- * // Hide `id` column, the other columns will remain visible
68
- * <DataGrid initialState={{ columns: { columnVisibilityModel: { id: false } } }} />
69
- * ```
70
- * Or use `columnVisibilityModel` prop to fully control column visibility.
71
- * @link https://mui.com/x/react-data-grid/column-visibility/
72
- * @default false
73
- */
74
- hide?: boolean;
75
63
  /**
76
64
  * If `false`, removes the buttons for hiding this column.
77
65
  * @default true
@@ -1,8 +1,7 @@
1
1
  import { MuiBaseEvent, MuiEvent } from '../muiEvent';
2
2
  import { GridCallbackDetails } from '../api/gridCallbackDetails';
3
- import { GridEventsStr } from './gridEvents';
4
- import { GridEventLookup } from './gridEventLookup';
5
- export declare type GridEventListener<E extends GridEventsStr> = (params: GridEventLookup[E] extends {
3
+ import { GridEventLookup, GridEvents } from './gridEventLookup';
4
+ export declare type GridEventListener<E extends GridEvents> = (params: GridEventLookup[E] extends {
6
5
  params: any;
7
6
  } ? GridEventLookup[E]['params'] : undefined, event: GridEventLookup[E] extends {
8
7
  event: MuiBaseEvent;
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import type { GridCellEditCommitParams, GridColumnHeaderParams, GridColumnOrderChangeParams, GridColumnResizeParams, GridColumnVisibilityChangeParams, GridEditCellPropsParams, GridHeaderSelectionCheckboxParams, GridMenuParams, GridPreferencePanelParams, GridRenderedRowsIntervalChangeParams, GridRowParams, GridRowSelectionCheckboxParams, GridScrollParams } from '../params';
2
+ import type { GridCellEditCommitParams, GridColumnHeaderParams, GridColumnOrderChangeParams, GridColumnResizeParams, GridEditCellPropsParams, GridHeaderSelectionCheckboxParams, GridMenuParams, GridPreferencePanelParams, GridRenderedRowsIntervalChangeParams, GridRowParams, GridRowSelectionCheckboxParams, GridScrollParams } from '../params';
3
3
  import { GridCellEditStartParams, GridCellEditStopParams } from '../params/gridEditCellParams';
4
4
  import { GridCellParams } from '../params/gridCellParams';
5
5
  import type { GridFilterModel } from '../gridFilterModel';
@@ -8,7 +8,7 @@ import type { GridEditRowsModel } from '../gridEditRowModel';
8
8
  import type { GridSelectionModel } from '../gridSelectionModel';
9
9
  import type { ElementSize } from '../elementSize';
10
10
  import type { MuiBaseEvent } from '../muiEvent';
11
- import type { GridRowId, GridRowTreeNodeConfig } from '../gridRows';
11
+ import type { GridGroupNode, GridRowId } from '../gridRows';
12
12
  import type { GridColumnVisibilityModel } from '../../hooks/features/columns';
13
13
  import type { GridStrategyProcessorName } from '../../hooks/core/strategyProcessing';
14
14
  import { GridRowEditStartParams, GridRowEditStopParams } from '../params/gridRowParams';
@@ -359,15 +359,6 @@ export interface GridEventLookup extends GridRowEventLookup, GridColumnHeaderEve
359
359
  params: null;
360
360
  event: MouseEvent;
361
361
  };
362
- /**
363
- * Fired when a column visibility changes.
364
- * It is not fired when the `columnVisibilityModel` is controlled or initialized.
365
- * It is not fired when toggling all column's visibility at once.
366
- * @deprecated Use `'columnVisibilityModelChange'` instead.
367
- */
368
- columnVisibilityChange: {
369
- params: GridColumnVisibilityChangeParams;
370
- };
371
362
  /**
372
363
  * Fired during the resizing of a column.
373
364
  */
@@ -397,11 +388,11 @@ export interface GridEventLookup extends GridRowEventLookup, GridColumnHeaderEve
397
388
  */
398
389
  sortedRowsSet: {};
399
390
  /**
400
- * Fired when the expansion of a row is changed. Called with a [[GridRowTreeNodeConfig]] object.
391
+ * Fired when the expansion of a row is changed. Called with a [[GridGroupNode]] object.
401
392
  * @ignore - do not document.
402
393
  */
403
394
  rowExpansionChange: {
404
- params: GridRowTreeNodeConfig;
395
+ params: GridGroupNode;
405
396
  };
406
397
  /**
407
398
  * Fired when the rendered rows index interval changes. Called with a [[GridRenderedRowsIntervalChangeParams]] object.
@@ -574,3 +565,4 @@ export interface GridEventLookup extends GridRowEventLookup, GridColumnHeaderEve
574
565
  params: GridMenuParams;
575
566
  };
576
567
  }
568
+ export declare type GridEvents = keyof GridEventLookup;
@@ -1,30 +1,29 @@
1
1
  import { MuiBaseEvent } from '../muiEvent';
2
- import { GridEventLookup } from './gridEventLookup';
3
- import { GridEventsStr } from './gridEvents';
4
- declare type PublisherArgsNoEvent<E extends GridEventsStr, T extends {
2
+ import { GridEventLookup, GridEvents } from './gridEventLookup';
3
+ declare type PublisherArgsNoEvent<E extends GridEvents, T extends {
5
4
  params: any;
6
5
  }> = [E, T['params']];
7
- declare type PublisherArgsRequiredEvent<E extends GridEventsStr, T extends {
6
+ declare type PublisherArgsRequiredEvent<E extends GridEvents, T extends {
8
7
  params: any;
9
8
  event: MuiBaseEvent;
10
9
  }> = [E, T['params'], T['event']];
11
- declare type PublisherArgsOptionalEvent<E extends GridEventsStr, T extends {
10
+ declare type PublisherArgsOptionalEvent<E extends GridEvents, T extends {
12
11
  params: any;
13
12
  event: MuiBaseEvent;
14
13
  }> = PublisherArgsRequiredEvent<E, T> | PublisherArgsNoEvent<E, T>;
15
- declare type PublisherArgsEvent<E extends GridEventsStr, T extends {
14
+ declare type PublisherArgsEvent<E extends GridEvents, T extends {
16
15
  params: any;
17
16
  event: MuiBaseEvent;
18
17
  }> = {} extends T['event'] ? PublisherArgsOptionalEvent<E, T> : PublisherArgsRequiredEvent<E, T>;
19
- declare type PublisherArgsParams<E extends GridEventsStr, T extends {
18
+ declare type PublisherArgsParams<E extends GridEvents, T extends {
20
19
  params: any;
21
20
  }> = [E, T['params']];
22
- declare type PublisherArgsNoParams<E extends GridEventsStr> = [E];
23
- declare type GridEventPublisherArg<E extends GridEventsStr, T> = T extends {
21
+ declare type PublisherArgsNoParams<E extends GridEvents> = [E];
22
+ declare type GridEventPublisherArg<E extends GridEvents, T> = T extends {
24
23
  params: any;
25
24
  event: MuiBaseEvent;
26
25
  } ? PublisherArgsEvent<E, T> : T extends {
27
26
  params: any;
28
27
  } ? PublisherArgsParams<E, T> : PublisherArgsNoParams<E>;
29
- export declare type GridEventPublisher = <E extends GridEventsStr>(...params: GridEventPublisherArg<E, GridEventLookup[E]>) => void;
28
+ export declare type GridEventPublisher = <E extends GridEvents>(...params: GridEventPublisherArg<E, GridEventLookup[E]>) => void;
30
29
  export {};
@@ -1,4 +1,3 @@
1
1
  export * from './gridEventListener';
2
2
  export * from './gridEventPublisher';
3
3
  export * from './gridEventLookup';
4
- export * from './gridEvents';
@@ -1,4 +1,3 @@
1
1
  export * from './gridEventListener';
2
2
  export * from './gridEventPublisher';
3
- export * from './gridEventLookup';
4
- export * from './gridEvents';
3
+ export * from './gridEventLookup';
@@ -1,6 +1,4 @@
1
- import { GridRowsInternalCache } from '../hooks/features/rows/gridRowsState';
2
- import { GridColumnsInternalCache } from '../hooks/features/columns/gridColumnsInterfaces';
1
+ import { GridRowsInternalCache } from '../hooks/features/rows/gridRowsInterfaces';
3
2
  export interface GridApiCaches {
4
3
  rows: GridRowsInternalCache;
5
- columns: GridColumnsInternalCache;
6
4
  }
@@ -1,5 +1 @@
1
- export declare const GridFeatureModeConstant: {
2
- client: "client";
3
- server: "server";
4
- };
5
1
  export declare type GridFeatureMode = 'client' | 'server';
@@ -1,4 +1 @@
1
- export const GridFeatureModeConstant = {
2
- client: 'client',
3
- server: 'server'
4
- };
1
+ export {};
@@ -15,33 +15,42 @@ export declare type GridUpdateAction = 'delete';
15
15
  export interface GridRowModelUpdate extends GridRowModel {
16
16
  _action?: GridUpdateAction;
17
17
  }
18
- export interface GridRowTreeNodeConfig {
18
+ /**
19
+ * The grid rows total height and row positions.
20
+ */
21
+ export interface GridRowsMeta {
19
22
  /**
20
- * The grid row id.
23
+ * The sum of all grid rows.
21
24
  */
22
- id: GridRowId;
25
+ totalHeight: number;
23
26
  /**
24
- * The id of the row children.
25
- * @default []
27
+ * The grid rows positions.
26
28
  */
27
- children?: GridRowId[];
29
+ positions: number[];
30
+ }
31
+ export interface GridTreeBasicNode {
28
32
  /**
29
- * The id of the footer
33
+ * The uniq id of this node.
30
34
  */
31
- footerId?: GridRowId | null;
35
+ id: GridRowId;
32
36
  /**
33
- * The row id of the parent (null if this row is a top level row).
37
+ * Depth of this node in the tree.
34
38
  */
35
- parent: GridRowId | null;
39
+ depth: number;
40
+ }
41
+ export interface GridLeafNode extends GridTreeBasicNode {
42
+ type: 'leaf';
36
43
  /**
37
- * Current expansion status of the row.
38
- * @default false
44
+ * The id of the group containing this node.
39
45
  */
40
- childrenExpanded?: boolean;
46
+ parent: GridRowId;
41
47
  /**
42
- * 0-based depth of the row in the tree.
48
+ * The key used to group the children of this row.
43
49
  */
44
- depth: number;
50
+ groupingKey: GridKeyValue | null;
51
+ }
52
+ export interface GridBasicGroupNode extends GridTreeBasicNode {
53
+ type: 'group';
45
54
  /**
46
55
  * The key used to group the children of this row.
47
56
  */
@@ -52,36 +61,96 @@ export interface GridRowTreeNodeConfig {
52
61
  */
53
62
  groupingField: string | null;
54
63
  /**
55
- * If `true`, this node has been automatically added to fill a gap in the tree structure.
64
+ * The id of the body children nodes.
65
+ * Only contains the children of type "group" and "leaf".
66
+ */
67
+ children: GridRowId[];
68
+ /**
69
+ * The id of the footer child node.
70
+ */
71
+ footerId?: GridRowId | null;
72
+ /**
73
+ * The id of the children nodes, grouped by grouping field and grouping key.
74
+ * Only contains the children of type "group" and "leaf".
75
+ * Empty for flat tree.
76
+ */
77
+ childrenFromPath: GridChildrenFromPathLookup;
78
+ /**
79
+ * If `true`, the children of this group are not visible.
56
80
  * @default false
57
81
  */
58
- isAutoGenerated?: boolean;
82
+ childrenExpanded?: boolean;
59
83
  /**
60
- * Position of the row among its sibling.
61
- * @default 'body'
84
+ * The id of the group containing this node (null for the root group).
62
85
  */
63
- position?: 'body' | 'footer';
86
+ parent: GridRowId | null;
64
87
  /**
65
88
  * If `true`, this row is pinned.
66
89
  * @default false
67
90
  */
68
91
  isPinned?: boolean;
69
92
  }
70
- /**
71
- * The grid rows total height and row positions.
72
- */
73
- export interface GridRowsMeta {
93
+ export interface GridAutoGeneratedGroupNode extends GridBasicGroupNode {
74
94
  /**
75
- * The sum of all grid rows.
95
+ * If `true`, this node has been automatically generated by the grid.
96
+ * In the row grouping, all groups are auto-generated
97
+ * In the tree data, some groups can be passed in the rows
76
98
  */
77
- totalHeight: number;
99
+ isAutoGenerated: true;
100
+ }
101
+ export interface GridDataGroupNode extends GridBasicGroupNode {
78
102
  /**
79
- * The grid rows positions.
103
+ * If `true`, this node has been automatically generated by the grid.
104
+ * In the row grouping, all groups are auto-generated
105
+ * In the tree data, some groups can be passed in the rows
80
106
  */
81
- positions: number[];
107
+ isAutoGenerated: false;
108
+ }
109
+ export declare type GridGroupNode = GridDataGroupNode | GridAutoGeneratedGroupNode;
110
+ export declare type GridChildrenFromPathLookup = {
111
+ [groupingField: string]: {
112
+ [groupingKey: string]: GridRowId;
113
+ };
114
+ };
115
+ export interface GridFooterNode extends GridTreeBasicNode {
116
+ type: 'footer';
117
+ /**
118
+ * The id of the group containing this node.
119
+ */
120
+ parent: GridRowId;
121
+ }
122
+ export interface GridSkeletonRowNode extends GridTreeBasicNode {
123
+ type: 'skeletonRow';
124
+ /**
125
+ * The id of the group containing this node.
126
+ * Is always equal to `GRID_ROOT_GROUP_ID`.
127
+ */
128
+ parent: GridRowId;
129
+ }
130
+ interface GridBasicPinnedRowNode extends GridTreeBasicNode {
131
+ type: 'pinnedRow';
132
+ /**
133
+ * The id of the group containing this node.
134
+ * Is always equal to `GRID_ROOT_GROUP_ID`.
135
+ */
136
+ parent: GridRowId;
137
+ }
138
+ export interface GridDataPinnedRowNode extends GridBasicPinnedRowNode {
139
+ /**
140
+ * If `true`, this node has been automatically generated by the grid.
141
+ */
142
+ isAutoGenerated: true;
143
+ }
144
+ export interface GridAutoGeneratedPinnedRowNode extends GridBasicPinnedRowNode {
145
+ /**
146
+ * If `true`, this node has been automatically generated by the grid.
147
+ */
148
+ isAutoGenerated: false;
82
149
  }
83
- export declare type GridRowTreeConfig = Record<GridRowId, GridRowTreeNodeConfig>;
84
- export declare type GridRowsLookup<R extends GridValidRowModel = GridValidRowModel> = Record<GridRowId, R>;
150
+ export declare type GridPinnedRowNode = GridDataPinnedRowNode | GridAutoGeneratedPinnedRowNode;
151
+ export declare type GridTreeNode = GridLeafNode | GridGroupNode | GridFooterNode | GridPinnedRowNode | GridSkeletonRowNode;
152
+ export declare type GridTreeNodeWithRender = GridLeafNode | GridGroupNode | GridFooterNode | GridPinnedRowNode;
153
+ export declare type GridRowTreeConfig = Record<GridRowId, GridTreeNode>;
85
154
  /**
86
155
  * The type of Id supported by the grid.
87
156
  */
@@ -100,3 +169,4 @@ export interface GridRowEntry<R extends GridValidRowModel = GridValidRowModel> {
100
169
  * The function to retrieve the id of a [[GridRowModel]].
101
170
  */
102
171
  export declare type GridRowIdGetter<R extends GridValidRowModel = GridValidRowModel> = (row: R) => GridRowId;
172
+ export {};
@@ -1,10 +1,10 @@
1
- import { GridRowId, GridRowTreeNodeConfig } from './gridRows';
1
+ import { GridRowId, GridTreeNode } from './gridRows';
2
2
  export declare type GridSortDirection = 'asc' | 'desc' | null | undefined;
3
3
  export interface GridSortCellParams<V = any> {
4
4
  id: GridRowId;
5
5
  field: string;
6
6
  value: V;
7
- rowNode: GridRowTreeNodeConfig;
7
+ rowNode: GridTreeNode;
8
8
  /**
9
9
  * @deprecated Use the `apiRef` returned by `useGridApiContext` or `useGridApiRef` (only available in `@mui/x-data-grid-pro`)
10
10
  */