@mui/x-data-grid 8.18.0 → 8.20.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 (162) hide show
  1. package/CHANGELOG.md +175 -0
  2. package/DataGrid/useDataGridComponent.js +4 -3
  3. package/components/GridRow.js +5 -2
  4. package/components/GridRowDragAndDropOverlay.d.ts +7 -0
  5. package/components/GridRowDragAndDropOverlay.js +73 -0
  6. package/components/cell/GridActionsCell.d.ts +9 -0
  7. package/components/cell/GridActionsCell.js +54 -34
  8. package/components/cell/GridBooleanCell.js +0 -10
  9. package/components/cell/GridCell.js +4 -10
  10. package/components/columnHeaders/GridColumnHeaderItem.js +2 -2
  11. package/components/columnSelection/GridCellCheckboxRenderer.js +37 -22
  12. package/components/containers/GridRootStyles.js +17 -40
  13. package/components/toolbarV8/Toolbar.js +1 -1
  14. package/components/virtualization/GridVirtualScrollbar.d.ts +1 -0
  15. package/components/virtualization/GridVirtualScrollbar.js +13 -8
  16. package/components/virtualization/GridVirtualScroller.js +2 -1
  17. package/components/virtualization/GridVirtualScrollerRenderZone.js +1 -1
  18. package/constants/dataGridPropsDefaultValues.js +2 -1
  19. package/constants/gridClasses.d.ts +0 -8
  20. package/constants/gridClasses.js +1 -1
  21. package/esm/DataGrid/useDataGridComponent.js +5 -4
  22. package/esm/components/GridRow.js +5 -2
  23. package/esm/components/GridRowDragAndDropOverlay.d.ts +7 -0
  24. package/esm/components/GridRowDragAndDropOverlay.js +66 -0
  25. package/esm/components/cell/GridActionsCell.d.ts +9 -0
  26. package/esm/components/cell/GridActionsCell.js +55 -34
  27. package/esm/components/cell/GridBooleanCell.js +0 -10
  28. package/esm/components/cell/GridCell.js +4 -10
  29. package/esm/components/columnHeaders/GridColumnHeaderItem.js +2 -2
  30. package/esm/components/columnSelection/GridCellCheckboxRenderer.js +37 -22
  31. package/esm/components/containers/GridRootStyles.js +17 -40
  32. package/esm/components/toolbarV8/Toolbar.js +1 -1
  33. package/esm/components/virtualization/GridVirtualScrollbar.d.ts +1 -0
  34. package/esm/components/virtualization/GridVirtualScrollbar.js +12 -7
  35. package/esm/components/virtualization/GridVirtualScroller.js +2 -1
  36. package/esm/components/virtualization/GridVirtualScrollerRenderZone.js +1 -1
  37. package/esm/constants/dataGridPropsDefaultValues.js +2 -1
  38. package/esm/constants/gridClasses.d.ts +0 -8
  39. package/esm/constants/gridClasses.js +1 -1
  40. package/esm/hooks/core/gridPropsSelectors.d.ts +2 -1
  41. package/esm/hooks/core/gridPropsSelectors.js +3 -0
  42. package/esm/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +4 -3
  43. package/esm/hooks/core/useGridProps.js +8 -2
  44. package/esm/hooks/core/useGridVirtualizer.d.ts +80 -6
  45. package/esm/hooks/core/useGridVirtualizer.js +27 -12
  46. package/esm/hooks/features/columnGrouping/useGridColumnGrouping.js +6 -1
  47. package/esm/hooks/features/columnMenu/useGridColumnMenu.js +14 -4
  48. package/esm/hooks/features/columns/useGridColumnSpanning.js +9 -4
  49. package/esm/hooks/features/dataSource/useGridDataSourceBase.js +2 -2
  50. package/esm/hooks/features/dimensions/useGridDimensions.js +12 -6
  51. package/esm/hooks/features/editing/useGridCellEditing.js +1 -1
  52. package/esm/hooks/features/editing/useGridRowEditing.js +1 -1
  53. package/esm/hooks/features/export/serializers/csvSerializer.js +2 -4
  54. package/esm/hooks/features/export/useGridPrintExport.js +18 -18
  55. package/esm/hooks/features/filter/gridFilterUtils.js +5 -11
  56. package/esm/hooks/features/filter/index.d.ts +1 -1
  57. package/esm/hooks/features/filter/index.js +1 -1
  58. package/esm/hooks/features/filter/useGridFilter.d.ts +1 -1
  59. package/esm/hooks/features/filter/useGridFilter.js +3 -1
  60. package/esm/hooks/features/focus/useGridFocus.js +0 -1
  61. package/esm/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
  62. package/esm/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +189 -25
  63. package/esm/hooks/features/pagination/useGridPaginationMeta.js +3 -3
  64. package/esm/hooks/features/pagination/useGridPaginationModel.js +7 -4
  65. package/esm/hooks/features/pagination/useGridRowCount.js +31 -15
  66. package/esm/hooks/features/rowReorder/gridRowReorderInterfaces.d.ts +19 -0
  67. package/esm/hooks/features/rowReorder/gridRowReorderSelector.d.ts +20 -1
  68. package/esm/hooks/features/rowReorder/gridRowReorderSelector.js +19 -1
  69. package/esm/hooks/features/rowSelection/useGridRowSelection.js +17 -8
  70. package/esm/hooks/features/rowSelection/utils.d.ts +1 -0
  71. package/esm/hooks/features/rowSelection/utils.js +17 -4
  72. package/esm/hooks/features/rows/useGridRowSpanning.js +23 -60
  73. package/esm/hooks/features/rows/useGridRows.js +3 -1
  74. package/esm/hooks/features/rows/useGridRowsOverridableMethods.d.ts +1 -0
  75. package/esm/hooks/features/rows/useGridRowsOverridableMethods.js +57 -7
  76. package/esm/hooks/features/scroll/useGridScroll.js +2 -3
  77. package/esm/hooks/features/sorting/gridSortingUtils.js +1 -3
  78. package/esm/hooks/features/sorting/useGridSorting.d.ts +1 -1
  79. package/esm/hooks/features/sorting/useGridSorting.js +3 -1
  80. package/esm/hooks/features/virtualization/useGridVirtualization.js +24 -5
  81. package/esm/hooks/utils/useGridEvent.js +6 -2
  82. package/esm/hooks/utils/useGridSelector.js +2 -4
  83. package/esm/hooks/utils/useRunOncePerLoop.d.ts +4 -1
  84. package/esm/hooks/utils/useRunOncePerLoop.js +28 -18
  85. package/esm/index.js +1 -1
  86. package/esm/internals/index.d.ts +5 -4
  87. package/esm/internals/index.js +3 -3
  88. package/esm/material/index.js +1 -4
  89. package/esm/models/api/gridRowApi.d.ts +14 -1
  90. package/esm/models/api/index.d.ts +1 -1
  91. package/esm/models/api/index.js +0 -1
  92. package/esm/models/colDef/gridColDef.d.ts +14 -0
  93. package/esm/models/configuration/gridConfiguration.d.ts +2 -2
  94. package/esm/models/configuration/gridRowConfiguration.d.ts +6 -5
  95. package/esm/models/events/gridEventLookup.d.ts +5 -0
  96. package/esm/models/gridStateCommunity.d.ts +1 -1
  97. package/esm/models/params/gridCellParams.d.ts +0 -10
  98. package/esm/models/props/DataGridProps.d.ts +13 -6
  99. package/esm/utils/keyboardUtils.d.ts +1 -8
  100. package/esm/utils/keyboardUtils.js +0 -7
  101. package/hooks/core/gridPropsSelectors.d.ts +2 -1
  102. package/hooks/core/gridPropsSelectors.js +4 -1
  103. package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +4 -3
  104. package/hooks/core/useGridProps.js +8 -2
  105. package/hooks/core/useGridVirtualizer.d.ts +80 -6
  106. package/hooks/core/useGridVirtualizer.js +26 -11
  107. package/hooks/features/columnGrouping/useGridColumnGrouping.js +6 -1
  108. package/hooks/features/columnMenu/useGridColumnMenu.js +14 -4
  109. package/hooks/features/columns/useGridColumnSpanning.js +9 -4
  110. package/hooks/features/dataSource/useGridDataSourceBase.js +2 -2
  111. package/hooks/features/dimensions/useGridDimensions.js +12 -6
  112. package/hooks/features/editing/useGridCellEditing.js +1 -1
  113. package/hooks/features/editing/useGridRowEditing.js +1 -1
  114. package/hooks/features/export/serializers/csvSerializer.js +2 -4
  115. package/hooks/features/export/useGridPrintExport.js +18 -18
  116. package/hooks/features/filter/gridFilterUtils.js +5 -11
  117. package/hooks/features/filter/index.d.ts +1 -1
  118. package/hooks/features/filter/index.js +6 -0
  119. package/hooks/features/filter/useGridFilter.d.ts +1 -1
  120. package/hooks/features/filter/useGridFilter.js +3 -1
  121. package/hooks/features/focus/useGridFocus.js +0 -1
  122. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
  123. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +189 -25
  124. package/hooks/features/pagination/useGridPaginationMeta.js +2 -2
  125. package/hooks/features/pagination/useGridPaginationModel.js +7 -4
  126. package/hooks/features/pagination/useGridRowCount.js +30 -14
  127. package/hooks/features/rowReorder/gridRowReorderInterfaces.d.ts +19 -0
  128. package/hooks/features/rowReorder/gridRowReorderSelector.d.ts +20 -1
  129. package/hooks/features/rowReorder/gridRowReorderSelector.js +20 -2
  130. package/hooks/features/rowSelection/useGridRowSelection.js +17 -8
  131. package/hooks/features/rowSelection/utils.d.ts +1 -0
  132. package/hooks/features/rowSelection/utils.js +16 -3
  133. package/hooks/features/rows/useGridRowSpanning.js +23 -60
  134. package/hooks/features/rows/useGridRows.js +3 -1
  135. package/hooks/features/rows/useGridRowsOverridableMethods.d.ts +1 -0
  136. package/hooks/features/rows/useGridRowsOverridableMethods.js +57 -7
  137. package/hooks/features/scroll/useGridScroll.js +2 -3
  138. package/hooks/features/sorting/gridSortingUtils.js +1 -3
  139. package/hooks/features/sorting/useGridSorting.d.ts +1 -1
  140. package/hooks/features/sorting/useGridSorting.js +3 -1
  141. package/hooks/features/virtualization/useGridVirtualization.js +24 -5
  142. package/hooks/utils/useGridEvent.js +6 -2
  143. package/hooks/utils/useGridSelector.js +2 -4
  144. package/hooks/utils/useRunOncePerLoop.d.ts +4 -1
  145. package/hooks/utils/useRunOncePerLoop.js +27 -18
  146. package/index.js +1 -1
  147. package/internals/index.d.ts +5 -4
  148. package/internals/index.js +16 -9
  149. package/material/index.js +1 -4
  150. package/models/api/gridRowApi.d.ts +14 -1
  151. package/models/api/index.d.ts +1 -1
  152. package/models/api/index.js +0 -11
  153. package/models/colDef/gridColDef.d.ts +14 -0
  154. package/models/configuration/gridConfiguration.d.ts +2 -2
  155. package/models/configuration/gridRowConfiguration.d.ts +6 -5
  156. package/models/events/gridEventLookup.d.ts +5 -0
  157. package/models/gridStateCommunity.d.ts +1 -1
  158. package/models/params/gridCellParams.d.ts +0 -10
  159. package/models/props/DataGridProps.d.ts +13 -6
  160. package/package.json +3 -3
  161. package/utils/keyboardUtils.d.ts +1 -8
  162. package/utils/keyboardUtils.js +1 -13
@@ -24,6 +24,16 @@ const columnMenuStateInitializer = state => (0, _extends2.default)({}, state, {
24
24
  exports.columnMenuStateInitializer = columnMenuStateInitializer;
25
25
  const useGridColumnMenu = apiRef => {
26
26
  const logger = (0, _utils.useGridLogger)(apiRef, 'useGridColumnMenu');
27
+ const subscriptionRefs = React.useRef({});
28
+ const unsubscribeFromScrollChange = React.useCallback(() => {
29
+ subscriptionRefs.current.wheel?.();
30
+ subscriptionRefs.current.touchMove?.();
31
+ }, []);
32
+ const subscribeToScrollChange = React.useCallback(() => {
33
+ unsubscribeFromScrollChange();
34
+ subscriptionRefs.current.wheel = apiRef.current.subscribeEvent('virtualScrollerWheel', apiRef.current.hideColumnMenu);
35
+ subscriptionRefs.current.touchMove = apiRef.current.subscribeEvent('virtualScrollerTouchMove', apiRef.current.hideColumnMenu);
36
+ }, [apiRef, unsubscribeFromScrollChange]);
27
37
 
28
38
  /**
29
39
  * API METHODS
@@ -41,6 +51,7 @@ const useGridColumnMenu = apiRef => {
41
51
  return state;
42
52
  }
43
53
  logger.debug('Opening Column Menu');
54
+ subscribeToScrollChange();
44
55
  return (0, _extends2.default)({}, state, {
45
56
  columnMenu: {
46
57
  open: true,
@@ -50,7 +61,7 @@ const useGridColumnMenu = apiRef => {
50
61
  });
51
62
  apiRef.current.hidePreferences();
52
63
  }
53
- }, [apiRef, logger]);
64
+ }, [apiRef, logger, subscribeToScrollChange]);
54
65
  const hideColumnMenu = React.useCallback(() => {
55
66
  const columnMenuState = (0, _columnMenuSelector.gridColumnMenuSelector)(apiRef);
56
67
  if (columnMenuState.field) {
@@ -86,12 +97,13 @@ const useGridColumnMenu = apiRef => {
86
97
  if (shouldUpdate) {
87
98
  apiRef.current.setState(state => {
88
99
  logger.debug('Hiding Column Menu');
100
+ unsubscribeFromScrollChange();
89
101
  return (0, _extends2.default)({}, state, {
90
102
  columnMenu: newState
91
103
  });
92
104
  });
93
105
  }
94
- }, [apiRef, logger]);
106
+ }, [apiRef, logger, unsubscribeFromScrollChange]);
95
107
  const toggleColumnMenu = React.useCallback(field => {
96
108
  logger.debug('Toggle Column Menu');
97
109
  const columnMenu = (0, _columnMenuSelector.gridColumnMenuSelector)(apiRef);
@@ -108,7 +120,5 @@ const useGridColumnMenu = apiRef => {
108
120
  };
109
121
  (0, _utils.useGridApiMethod)(apiRef, columnMenuApi, 'public');
110
122
  (0, _utils.useGridEvent)(apiRef, 'columnResizeStart', hideColumnMenu);
111
- (0, _utils.useGridEvent)(apiRef, 'virtualScrollerWheel', apiRef.current.hideColumnMenu);
112
- (0, _utils.useGridEvent)(apiRef, 'virtualScrollerTouchMove', apiRef.current.hideColumnMenu);
113
123
  };
114
124
  exports.useGridColumnMenu = useGridColumnMenu;
@@ -11,10 +11,15 @@ var _useGridEvent = require("../../utils/useGridEvent");
11
11
  * @requires useGridParamsApi (method)
12
12
  */
13
13
  const useGridColumnSpanning = apiRef => {
14
- const virtualizer = apiRef.current.virtualizer;
15
- const resetColSpan = virtualizer.api.resetColSpan;
16
- const getCellColSpanInfo = virtualizer.api.getCellColSpanInfo;
17
- const calculateColSpan = virtualizer.api.calculateColSpan;
14
+ const resetColSpan = () => {
15
+ return apiRef.current.virtualizer.api.resetColSpan();
16
+ };
17
+ const getCellColSpanInfo = (...params) => {
18
+ return apiRef.current.virtualizer.api.getCellColSpanInfo(...params);
19
+ };
20
+ const calculateColSpan = (...params) => {
21
+ apiRef.current.virtualizer.api.calculateColSpan(...params);
22
+ };
18
23
  const columnSpanningPublicApi = {
19
24
  unstable_getCellColSpanInfo: getCellColSpanInfo
20
25
  };
@@ -122,7 +122,7 @@ const useGridDataSourceBase = (apiRef, props, options = {}) => {
122
122
  params: fetchParams,
123
123
  cause: originalError
124
124
  }));
125
- } else if (process.env.NODE_ENV !== 'production') {
125
+ } else {
126
126
  (0, _warning.warnOnce)(['MUI X: A call to `dataSource.getRows()` threw an error which was not handled because `onDataSourceError()` is missing.', 'To handle the error pass a callback to the `onDataSourceError` prop, for example `<DataGrid onDataSourceError={(error) => ...} />`.', 'For more detail, see https://mui.com/x/react-data-grid/server-side-data/#error-handling.'], 'error');
127
127
  }
128
128
  }
@@ -177,7 +177,7 @@ const useGridDataSourceBase = (apiRef, props, options = {}) => {
177
177
  params,
178
178
  cause: errorThrown
179
179
  }));
180
- } else if (process.env.NODE_ENV !== 'production') {
180
+ } else {
181
181
  (0, _warning.warnOnce)(['MUI X: A call to `dataSource.updateRow()` threw an error which was not handled because `onDataSourceError()` is missing.', 'To handle the error pass a callback to the `onDataSourceError` prop, for example `<DataGrid onDataSourceError={(error) => ...} />`.', 'For more detail, see https://mui.com/x/react-data-grid/server-side-data/#error-handling.'], 'error');
182
182
  }
183
183
  throw errorThrown; // Let the caller handle the error further
@@ -52,8 +52,10 @@ const EMPTY_DIMENSIONS = {
52
52
  const dimensionsStateInitializer = (state, props, apiRef) => {
53
53
  const dimensions = EMPTY_DIMENSIONS;
54
54
  const density = (0, _density.gridDensityFactorSelector)(apiRef);
55
+ const dimensionsWithStatic = (0, _extends2.default)({}, dimensions, getStaticDimensions(props, apiRef, density, (0, _columns.gridVisiblePinnedColumnDefinitionsSelector)(apiRef)));
56
+ apiRef.current.store.state.dimensions = dimensionsWithStatic;
55
57
  return (0, _extends2.default)({}, state, {
56
- dimensions: (0, _extends2.default)({}, dimensions, getStaticDimensions(props, apiRef, density, (0, _columns.gridVisiblePinnedColumnDefinitionsSelector)(apiRef)))
58
+ dimensions: dimensionsWithStatic
57
59
  });
58
60
  };
59
61
  exports.dimensionsStateInitializer = dimensionsStateInitializer;
@@ -65,16 +67,17 @@ const columnsTotalWidthSelector = (0, _createSelector.createSelector)(_columns.g
65
67
  return (0, _roundToDecimalPlaces.roundToDecimalPlaces)(positions[colCount - 1] + visibleColumns[colCount - 1].computedWidth, 1);
66
68
  });
67
69
  function useGridDimensions(apiRef, props) {
68
- const virtualizer = apiRef.current.virtualizer;
69
- const updateDimensions = virtualizer.api.updateDimensions;
70
- const getViewportPageSize = virtualizer.api.getViewportPageSize;
71
70
  const getRootDimensions = React.useCallback(() => (0, _gridDimensionsSelectors.gridDimensionsSelector)(apiRef), [apiRef]);
72
71
  const apiPublic = {
73
72
  getRootDimensions
74
73
  };
75
74
  const apiPrivate = {
76
- updateDimensions,
77
- getViewportPageSize
75
+ updateDimensions: () => {
76
+ return apiRef.current.virtualizer.api.updateDimensions();
77
+ },
78
+ getViewportPageSize: () => {
79
+ return apiRef.current.virtualizer.api.getViewportPageSize();
80
+ }
78
81
  };
79
82
  (0, _useGridApiMethod.useGridApiMethod)(apiRef, apiPublic, 'public');
80
83
  (0, _useGridApiMethod.useGridApiMethod)(apiRef, apiPrivate, 'private');
@@ -103,6 +106,9 @@ function useGridDimensions(apiRef, props) {
103
106
  /* eslint-enable react-hooks/rules-of-hooks */
104
107
  }
105
108
  (0, _store.useStoreEffect)(apiRef.current.store, s => s.dimensions, (previous, next) => {
109
+ if (!next.isReady) {
110
+ return;
111
+ }
106
112
  if (apiRef.current.rootElementRef.current) {
107
113
  setCSSVariables(apiRef.current.rootElementRef.current, next);
108
114
  }
@@ -371,7 +371,7 @@ const useGridCellEditing = (apiRef, props) => {
371
371
  });
372
372
  if (onProcessRowUpdateError) {
373
373
  onProcessRowUpdateError(errorThrown);
374
- } else if (process.env.NODE_ENV !== 'production') {
374
+ } else {
375
375
  (0, _warning.warnOnce)(['MUI X: A call to `processRowUpdate()` threw an error which was not handled because `onProcessRowUpdateError()` is missing.', 'To handle the error pass a callback to the `onProcessRowUpdateError()` prop, for example `<DataGrid onProcessRowUpdateError={(error) => ...} />`.', 'For more detail, see https://mui.com/x/react-data-grid/editing/persistence/.'], 'error');
376
376
  }
377
377
  };
@@ -455,7 +455,7 @@ const useGridRowEditing = (apiRef, props) => {
455
455
  }
456
456
  if (onProcessRowUpdateError) {
457
457
  onProcessRowUpdateError(errorThrown);
458
- } else if (process.env.NODE_ENV !== 'production') {
458
+ } else {
459
459
  (0, _warning.warnOnce)(['MUI X: A call to `processRowUpdate()` threw an error which was not handled because `onProcessRowUpdateError()` is missing.', 'To handle the error pass a callback to the `onProcessRowUpdateError()` prop, for example `<DataGrid onProcessRowUpdateError={(error) => ...} />`.', 'For more detail, see https://mui.com/x/react-data-grid/editing/persistence/.'], 'error');
460
460
  }
461
461
  };
@@ -84,10 +84,8 @@ const serializeRow = ({
84
84
  });
85
85
  columns.forEach(column => {
86
86
  const cellParams = getCellParams(id, column.field);
87
- if (process.env.NODE_ENV !== 'production') {
88
- if (String(cellParams.formattedValue) === '[object Object]') {
89
- (0, _warning.warnOnce)(['MUI X: When the value of a field is an object or a `renderCell` is provided, the CSV export might not display the value correctly.', 'You can provide a `valueFormatter` with a string representation to be used.']);
90
- }
87
+ if (String(cellParams.formattedValue) === '[object Object]') {
88
+ (0, _warning.warnOnce)(['MUI X: When the value of a field is an object or a `renderCell` is provided, the CSV export might not display the value correctly.', 'You can provide a `valueFormatter` with a string representation to be used.']);
91
89
  }
92
90
  row.addValue(serializeCellValue(cellParams, {
93
91
  ignoreValueFormatter,
@@ -16,15 +16,15 @@ var _gridFilterSelector = require("../filter/gridFilterSelector");
16
16
  var _gridColumnsSelector = require("../columns/gridColumnsSelector");
17
17
  var _gridClasses = require("../../../constants/gridClasses");
18
18
  var _useGridApiMethod = require("../../utils/useGridApiMethod");
19
- var _gridRowsMetaSelector = require("../rows/gridRowsMetaSelector");
20
19
  var _gridRowsUtils = require("../rows/gridRowsUtils");
21
20
  var _utils = require("./utils");
22
21
  var _useGridPaginationModel = require("../pagination/useGridPaginationModel");
23
22
  var _pipeProcessing = require("../../core/pipeProcessing");
24
23
  var _toolbar = require("../../../components/toolbar");
25
- var _gridColumnsUtils = require("../columns/gridColumnsUtils");
26
24
  var _gridCheckboxSelectionColDef = require("../../../colDef/gridCheckboxSelectionColDef");
25
+ var _GridVirtualScrollbar = require("../../../components/virtualization/GridVirtualScrollbar");
27
26
  var _jsxRuntime = require("react/jsx-runtime");
27
+ const DEBUG_MODE = false;
28
28
  function raf() {
29
29
  return new Promise(resolve => {
30
30
  requestAnimationFrame(() => {
@@ -37,6 +37,10 @@ function buildPrintWindow(title) {
37
37
  iframeEl.style.position = 'absolute';
38
38
  iframeEl.style.width = '0px';
39
39
  iframeEl.style.height = '0px';
40
+ if (DEBUG_MODE) {
41
+ iframeEl.style.width = '100%';
42
+ iframeEl.style.height = '10000px';
43
+ }
40
44
  iframeEl.title = title || document.title;
41
45
  return iframeEl;
42
46
  }
@@ -104,40 +108,36 @@ const useGridPrintExport = (apiRef, props) => {
104
108
  if (!printDoc) {
105
109
  return;
106
110
  }
107
- const rowsMeta = (0, _gridRowsMetaSelector.gridRowsMetaSelector)(apiRef);
108
111
  const gridRootElement = apiRef.current.rootElementRef.current;
109
112
  const gridClone = gridRootElement.cloneNode(true);
113
+ const virtualScrollerContent = gridClone.querySelector(`.${_gridClasses.gridClasses.virtualScrollerContent}`);
110
114
 
111
115
  // Allow to overflow to not hide the border of the last row
112
116
  const gridMain = gridClone.querySelector(`.${_gridClasses.gridClasses.main}`);
113
117
  gridMain.style.overflow = 'visible';
114
-
115
- // See https://support.google.com/chrome/thread/191619088?hl=en&msgid=193009642
116
- gridClone.style.contain = 'size';
117
- let gridToolbarElementHeight = gridRootElement.querySelector(`.${_gridClasses.gridClasses.toolbar}`)?.offsetHeight || 0;
118
- let gridFooterElementHeight = gridRootElement.querySelector(`.${_gridClasses.gridClasses.footerContainer}`)?.offsetHeight || 0;
118
+ gridClone.querySelector(`.${_gridClasses.gridClasses.virtualScrollerRenderZone}`).style.position = 'static';
119
+ virtualScrollerContent.style.flexBasis = 'auto';
120
+ gridClone.querySelector(`.${_gridClasses.gridClasses['scrollbar--vertical']}`)?.remove();
121
+ if (!(virtualScrollerContent.nextSibling instanceof HTMLElement && virtualScrollerContent.nextSibling.classList.contains(_gridClasses.gridClasses.filler))) {
122
+ const filler = document.createElement('div');
123
+ filler.style.height = _GridVirtualScrollbar.scrollbarSizeCssExpression;
124
+ virtualScrollerContent.insertAdjacentElement('afterend', filler);
125
+ }
119
126
  const gridFooterElement = gridClone.querySelector(`.${_gridClasses.gridClasses.footerContainer}`);
120
127
  if (normalizeOptions.hideToolbar) {
121
128
  gridClone.querySelector(`.${_gridClasses.gridClasses.toolbar}`)?.remove();
122
- gridToolbarElementHeight = 0;
123
129
  }
124
130
  if (normalizeOptions.hideFooter && gridFooterElement) {
125
131
  gridFooterElement.remove();
126
- gridFooterElementHeight = 0;
127
132
  }
128
-
129
- // Expand container height to accommodate all rows
130
- const computedTotalHeight = rowsMeta.currentPageTotalHeight + (0, _gridColumnsUtils.getTotalHeaderHeight)(apiRef, props) + gridToolbarElementHeight + gridFooterElementHeight;
131
- gridClone.style.height = `${computedTotalHeight}px`;
133
+ gridClone.style.height = 'auto';
132
134
  // The height above does not include grid border width, so we need to exclude it
133
135
  gridClone.style.boxSizing = 'content-box';
134
136
  if (!normalizeOptions.hideFooter && gridFooterElement) {
135
137
  // the footer is always being placed at the bottom of the page as if all rows are exported
136
138
  // so if getRowsToExport is being used to only export a subset of rows then we need to
137
139
  // adjust the footer position to be correctly placed at the bottom of the grid
138
- gridFooterElement.style.position = 'absolute';
139
140
  gridFooterElement.style.width = '100%';
140
- gridFooterElement.style.top = `${computedTotalHeight - gridFooterElementHeight}px`;
141
141
  }
142
142
 
143
143
  // printDoc.body.appendChild(gridClone); should be enough but a clone isolation bug in Safari
@@ -165,13 +165,13 @@ const useGridPrintExport = (apiRef, props) => {
165
165
  }
166
166
 
167
167
  // Trigger print
168
- if (process.env.NODE_ENV !== 'test') {
168
+ if (process.env.NODE_ENV !== 'test' && !DEBUG_MODE) {
169
169
  // wait for remote stylesheets to load
170
170
  Promise.all(stylesheetLoadPromises).then(() => {
171
171
  printWindow.contentWindow.print();
172
172
  });
173
173
  }
174
- }, [apiRef, doc, props]);
174
+ }, [apiRef, doc]);
175
175
  const handlePrintWindowAfterPrint = React.useCallback(printWindow => {
176
176
  // Remove the print iframe
177
177
  doc.current.body.removeChild(printWindow);
@@ -49,24 +49,18 @@ const sanitizeFilterModel = (model, disableMultipleColumnsFiltering, apiRef) =>
49
49
  const hasSeveralItems = model.items.length > 1;
50
50
  let items;
51
51
  if (hasSeveralItems && disableMultipleColumnsFiltering) {
52
- if (process.env.NODE_ENV !== 'production') {
53
- (0, _warning.warnOnce)(['MUI X: The `filterModel` can only contain a single item when the `disableMultipleColumnsFiltering` prop is set to `true`.', 'If you are using the community version of the Data Grid, this prop is always `true`.'], 'error');
54
- }
52
+ (0, _warning.warnOnce)(['MUI X: The `filterModel` can only contain a single item when the `disableMultipleColumnsFiltering` prop is set to `true`.', 'If you are using the community version of the Data Grid, this prop is always `true`.'], 'error');
55
53
  items = [model.items[0]];
56
54
  } else {
57
55
  items = model.items;
58
56
  }
59
57
  const hasItemsWithoutIds = hasSeveralItems && items.some(item => item.id == null);
60
58
  const hasItemWithoutOperator = items.some(item => item.operator == null);
61
- if (process.env.NODE_ENV !== 'production') {
62
- if (hasItemsWithoutIds) {
63
- (0, _warning.warnOnce)('MUI X: The `id` field is required on `filterModel.items` when you use multiple filters.', 'error');
64
- }
59
+ if (hasItemsWithoutIds) {
60
+ (0, _warning.warnOnce)('MUI X: The `id` field is required on `filterModel.items` when you use multiple filters.', 'error');
65
61
  }
66
- if (process.env.NODE_ENV !== 'production') {
67
- if (hasItemWithoutOperator) {
68
- (0, _warning.warnOnce)('MUI X: The `operator` field is required on `filterModel.items`, one or more of your filtering item has no `operator` provided.', 'error');
69
- }
62
+ if (hasItemWithoutOperator) {
63
+ (0, _warning.warnOnce)('MUI X: The `operator` field is required on `filterModel.items`, one or more of your filtering item has no `operator` provided.', 'error');
70
64
  }
71
65
  if (hasItemWithoutOperator || hasItemsWithoutIds) {
72
66
  return (0, _extends2.default)({}, model, {
@@ -1,4 +1,4 @@
1
1
  export type { GridFilterState, GridFilterInitialState } from "./gridFilterState.js";
2
2
  export { getDefaultGridFilterModel } from "./gridFilterState.js";
3
- export { gridFilterModelSelector, gridQuickFilterValuesSelector, gridVisibleRowsLookupSelector, gridFilteredRowsLookupSelector, gridFilteredDescendantCountLookupSelector, gridExpandedSortedRowEntriesSelector, gridExpandedSortedRowIdsSelector, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector, gridFilteredSortedTopLevelRowEntriesSelector, gridExpandedRowCountSelector, gridFilteredTopLevelRowCountSelector, gridFilteredRowCountSelector, gridFilteredDescendantRowCountSelector, gridFilterActiveItemsSelector, gridFilterActiveItemsLookupSelector } from "./gridFilterSelector.js";
3
+ export { gridFilterModelSelector, gridQuickFilterValuesSelector, gridVisibleRowsLookupSelector, gridFilteredRowsLookupSelector, gridFilteredDescendantCountLookupSelector, gridExpandedSortedRowEntriesSelector, gridExpandedSortedRowIdsSelector, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector, gridFilteredSortedTopLevelRowEntriesSelector, gridExpandedRowCountSelector, gridFilteredTopLevelRowCountSelector, gridFilteredRowCountSelector, gridFilteredDescendantRowCountSelector, gridFilterActiveItemsSelector, gridFilterActiveItemsLookupSelector, gridExpandedSortedRowIndexLookupSelector } from "./gridFilterSelector.js";
4
4
  export type { GridFilterActiveItemsLookup } from "./gridFilterSelector.js";
@@ -27,6 +27,12 @@ Object.defineProperty(exports, "gridExpandedSortedRowIdsSelector", {
27
27
  return _gridFilterSelector.gridExpandedSortedRowIdsSelector;
28
28
  }
29
29
  });
30
+ Object.defineProperty(exports, "gridExpandedSortedRowIndexLookupSelector", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _gridFilterSelector.gridExpandedSortedRowIndexLookupSelector;
34
+ }
35
+ });
30
36
  Object.defineProperty(exports, "gridFilterActiveItemsLookupSelector", {
31
37
  enumerable: true,
32
38
  get: function () {
@@ -9,4 +9,4 @@ export declare const filterStateInitializer: GridStateInitializer<Pick<DataGridP
9
9
  * @requires useGridParamsApi (method)
10
10
  * @requires useGridRows (event)
11
11
  */
12
- export declare const useGridFilter: (apiRef: RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "rows" | "initialState" | "filterModel" | "getRowId" | "onFilterModelChange" | "filterMode" | "disableMultipleColumnsFiltering" | "slots" | "slotProps" | "disableColumnFilter" | "disableEval" | "ignoreDiacritics">, configuration: GridConfiguration) => void;
12
+ export declare const useGridFilter: (apiRef: RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "rows" | "initialState" | "filterModel" | "getRowId" | "onFilterModelChange" | "filterMode" | "disableMultipleColumnsFiltering" | "slots" | "slotProps" | "disableColumnFilter" | "disableEval" | "ignoreDiacritics" | "signature">, configuration: GridConfiguration) => void;
@@ -363,7 +363,9 @@ const useGridFilter = (apiRef, props, configuration) => {
363
363
  * 1ST RENDER
364
364
  */
365
365
  (0, _useFirstRender.useFirstRender)(() => {
366
- updateFilteredRows();
366
+ if (props.signature === 'DataGrid') {
367
+ updateFilteredRows();
368
+ }
367
369
  });
368
370
 
369
371
  /**
@@ -232,7 +232,6 @@ const useGridFocus = (apiRef, props) => {
232
232
  apiRef.current.setCellFocus(id, field);
233
233
  }, [apiRef]);
234
234
  const handleCellKeyDown = React.useCallback((params, event) => {
235
- // GRID_CELL_NAVIGATION_KEY_DOWN handles the focus on Enter, Tab and navigation keys
236
235
  if (event.key === 'Enter' || event.key === 'Tab' || event.key === 'Shift' || (0, _keyboardUtils.isNavigationKey)(event.key)) {
237
236
  return;
238
237
  }
@@ -10,4 +10,4 @@ import { DataGridProcessedProps } from "../../../models/props/DataGridProps.js";
10
10
  * @requires useGridScroll (method) - can be after
11
11
  * @requires useGridColumnSpanning (method) - can be after
12
12
  */
13
- export declare const useGridKeyboardNavigation: (apiRef: RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "pagination" | "paginationMode" | "getRowId" | "signature" | "headerFilters">) => void;
13
+ export declare const useGridKeyboardNavigation: (apiRef: RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "pagination" | "paginationMode" | "getRowId" | "signature" | "headerFilters" | "tabNavigation">) => void;