@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
@@ -2,11 +2,10 @@ import * as React from 'react';
2
2
  import { isFunction } from '../../utils/utils';
3
3
  import { useGridLogger } from './useGridLogger';
4
4
  export const useGridNativeEventListener = (apiRef, ref, eventName, handler, options) => {
5
- var _ref$current;
6
5
  const logger = useGridLogger(apiRef, 'useNativeEventListener');
7
6
  const [added, setAdded] = React.useState(false);
8
7
  const handlerRef = React.useRef(handler);
9
- const targetElement = isFunction(ref) ? ref() : (_ref$current = ref == null ? void 0 : ref.current) != null ? _ref$current : null;
8
+ const targetElement = isFunction(ref) ? ref() : ref?.current ?? null;
10
9
  const wrapHandler = React.useCallback(event => {
11
10
  return handlerRef.current && handlerRef.current(event);
12
11
  }, []);
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v7.0.0-beta.7
2
+ * @mui/x-data-grid v7.0.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -76,7 +76,9 @@ export * from '../utils/fastMemo';
76
76
  export { buildWarning } from '../utils/warning';
77
77
  export { exportAs } from '../utils/exportAs';
78
78
  export * from '../utils/getPublicApiRef';
79
+ export * from '../utils/cellBorderUtils';
79
80
  export type { GridPrivateOnlyApiCommon } from '../models/api/gridApiCommon';
81
+ export type { GridInfiniteLoaderPrivateApi } from '../models/api/gridInfiniteLoaderApi';
80
82
  export { useGridPrivateApiContext } from '../hooks/utils/useGridPrivateApiContext';
81
83
  export * from '../hooks/utils';
82
84
  export type { GridApiCommunity } from '../models/api/gridApiCommunity';
@@ -62,6 +62,7 @@ export * from '../utils/fastMemo';
62
62
  export { buildWarning } from '../utils/warning';
63
63
  export { exportAs } from '../utils/exportAs';
64
64
  export * from '../utils/getPublicApiRef';
65
+ export * from '../utils/cellBorderUtils';
65
66
  export { useGridPrivateApiContext } from '../hooks/utils/useGridPrivateApiContext';
66
67
  export * from '../hooks/utils';
67
68
  export { serializeCellValue } from '../hooks/features/export/serializers/csvSerializer';
@@ -4,13 +4,12 @@ import * as React from 'react';
4
4
 
5
5
  /** Gathers props for the root element into a single `.forwardedProps` field */
6
6
  function groupForwardedProps(props) {
7
- var _props$forwardedProps;
8
7
  const keys = Object.keys(props);
9
8
  if (!keys.some(key => key.startsWith('aria-') || key.startsWith('data-'))) {
10
9
  return props;
11
10
  }
12
11
  const newProps = {};
13
- const forwardedProps = (_props$forwardedProps = props.forwardedProps) != null ? _props$forwardedProps : {};
12
+ const forwardedProps = props.forwardedProps ?? {};
14
13
  for (let i = 0; i < keys.length; i += 1) {
15
14
  const key = keys[i];
16
15
  if (key.startsWith('aria-') || key.startsWith('data-')) {
package/joy/joySlots.js CHANGED
@@ -79,7 +79,6 @@ const Checkbox = /*#__PURE__*/React.forwardRef((_ref, ref) => {
79
79
  }));
80
80
  });
81
81
  const TextField = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
82
- var _props$InputProps, _props$inputProps;
83
82
  let {
84
83
  onChange,
85
84
  label,
@@ -91,8 +90,8 @@ const TextField = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
91
90
  variant
92
91
  } = _ref2,
93
92
  props = _objectWithoutPropertiesLoose(_ref2, _excluded2);
94
- const rootRef = useForkRef(ref, (_props$InputProps = props.InputProps) == null ? void 0 : _props$InputProps.ref);
95
- const inputForkRef = useForkRef(inputRef, props == null || (_props$inputProps = props.inputProps) == null ? void 0 : _props$inputProps.ref);
93
+ const rootRef = useForkRef(ref, props.InputProps?.ref);
94
+ const inputForkRef = useForkRef(inputRef, props?.inputProps?.ref);
96
95
  const {
97
96
  startAdornment,
98
97
  endAdornment
@@ -109,7 +108,7 @@ const TextField = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
109
108
  variant: convertVariant(variant, 'outlined'),
110
109
  size: convertSize(size),
111
110
  slotProps: {
112
- input: _extends({}, props == null ? void 0 : props.inputProps, {
111
+ input: _extends({}, props?.inputProps, {
113
112
  ref: inputForkRef
114
113
  })
115
114
  },
@@ -139,7 +138,6 @@ const Button = /*#__PURE__*/React.forwardRef(function Button(_ref3, ref) {
139
138
  }));
140
139
  });
141
140
  const IconButton = /*#__PURE__*/React.forwardRef(function IconButton(_ref4, ref) {
142
- var _convertColor;
143
141
  let {
144
142
  color,
145
143
  size,
@@ -148,7 +146,7 @@ const IconButton = /*#__PURE__*/React.forwardRef(function IconButton(_ref4, ref)
148
146
  props = _objectWithoutPropertiesLoose(_ref4, _excluded4);
149
147
  return /*#__PURE__*/_jsx(JoyIconButton, _extends({}, props, {
150
148
  size: convertSize(size),
151
- color: (_convertColor = convertColor(color)) != null ? _convertColor : 'neutral',
149
+ color: convertColor(color) ?? 'neutral',
152
150
  variant: "plain",
153
151
  ref: ref,
154
152
  sx: sx
@@ -193,10 +191,9 @@ const Select = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
193
191
  listboxOpen: open,
194
192
  onListboxOpenChange: isOpen => {
195
193
  if (isOpen) {
196
- onOpen == null || onOpen({});
194
+ onOpen?.({});
197
195
  } else {
198
- var _MenuProps$onClose;
199
- MenuProps == null || (_MenuProps$onClose = MenuProps.onClose) == null || _MenuProps$onClose.call(MenuProps, {}, undefined);
196
+ MenuProps?.onClose?.({}, undefined);
200
197
  }
201
198
  },
202
199
  size: convertSize(size),
@@ -257,10 +254,7 @@ const Pagination = /*#__PURE__*/React.forwardRef((props, ref) => {
257
254
  const rootProps = useGridRootProps();
258
255
  const paginationModel = gridPaginationModelSelector(apiRef);
259
256
  const visibleTopLevelRowCount = gridFilteredTopLevelRowCountSelector(apiRef);
260
- const rowCount = React.useMemo(() => {
261
- var _ref8, _rootProps$rowCount;
262
- return (_ref8 = (_rootProps$rowCount = rootProps.rowCount) != null ? _rootProps$rowCount : visibleTopLevelRowCount) != null ? _ref8 : 0;
263
- }, [rootProps.rowCount, visibleTopLevelRowCount]);
257
+ const rowCount = React.useMemo(() => rootProps.rowCount ?? visibleTopLevelRowCount ?? 0, [rootProps.rowCount, visibleTopLevelRowCount]);
264
258
  const lastPage = React.useMemo(() => Math.floor(rowCount / (paginationModel.pageSize || 1)), [rowCount, paginationModel.pageSize]);
265
259
  const handlePageChange = React.useCallback(page => {
266
260
  apiRef.current.setPage(page);
@@ -52,7 +52,7 @@ export interface GridRowsMetaPrivateApi {
52
52
  rowHasAutoHeight: (id: GridRowId) => boolean;
53
53
  /**
54
54
  * Returns the index of the last row measured.
55
- * The value considers only the rows reachable by scroll, e.g. first row has index=0 in all pages.
55
+ * The value considers only the rows reachable by scroll, for example first row has index=0 in all pages.
56
56
  * @returns {number} The index of the last measured row.
57
57
  */
58
58
  getLastMeasuredRowIndex: () => number;
@@ -17,7 +17,7 @@ export * from './gridPreferencesPanelApi';
17
17
  export * from './gridPrintExportApi';
18
18
  export * from './gridCallbackDetails';
19
19
  export * from './gridScrollApi';
20
- export * from './gridVirtualizationApi';
20
+ export type { GridVirtualizationApi } from './gridVirtualizationApi';
21
21
  export type { GridApiCommon } from './gridApiCommon';
22
22
  export type { GridEditingApi, GridCellModesModel, GridRowModesModel } from './gridEditingApi';
23
23
  export type GridEditRowApi = GridEditingApi;
@@ -12,5 +12,4 @@ export * from './gridPreferencesPanelApi';
12
12
  export * from './gridPrintExportApi';
13
13
  export * from './gridCallbackDetails';
14
14
  export * from './gridScrollApi';
15
- export * from './gridVirtualizationApi';
16
15
  export {};
@@ -13,6 +13,7 @@ import type { GridStrategyProcessorName } from '../../hooks/core/strategyProcess
13
13
  import { GridRowEditStartParams, GridRowEditStopParams } from '../params/gridRowParams';
14
14
  import { GridCellModesModel, GridRowModesModel } from '../api/gridEditingApi';
15
15
  import { GridPaginationModel } from '../gridPaginationProps';
16
+ import { GridDensity } from '../gridDensity';
16
17
  export interface GridRowEventLookup {
17
18
  /**
18
19
  * Fired when a row is clicked.
@@ -375,6 +376,12 @@ export interface GridControlledStateEventLookup {
375
376
  rowCountChange: {
376
377
  params: number;
377
378
  };
379
+ /**
380
+ * Fired when the density changes.
381
+ */
382
+ densityChange: {
383
+ params: GridDensity;
384
+ };
378
385
  }
379
386
  export interface GridControlledStateReasonLookup {
380
387
  filter: 'upsertFilterItem' | 'upsertFilterItems' | 'deleteFilterItem' | 'changeLogicOperator' | 'restoreState' | 'removeAllFilterItems';
@@ -88,6 +88,12 @@ export interface GridCsvExportOptions extends GridFileExportOptions {
88
88
  * @returns {GridRowId[]} The list of row ids to export.
89
89
  */
90
90
  getRowsToExport?: (params: GridCsvGetRowsToExportParams) => GridRowId[];
91
+ /**
92
+ * @ignore
93
+ * If `false`, the quotes will not be appended to the cell value.
94
+ * @default true
95
+ */
96
+ shouldAppendQuotes?: boolean;
91
97
  }
92
98
  /**
93
99
  * The options to apply on the Print export.
@@ -41,4 +41,5 @@ export interface GridInitialStateCommunity {
41
41
  filter?: GridFilterInitialState;
42
42
  columns?: GridColumnsInitialState;
43
43
  preferencePanel?: GridPreferencePanelInitialState;
44
+ density?: GridDensityState;
44
45
  }
@@ -35,7 +35,7 @@ export interface GridExperimentalFeatures {
35
35
  /**
36
36
  * The props users can give to the `DataGrid` component.
37
37
  */
38
- export type DataGridProps<R extends GridValidRowModel = any> = Omit<Partial<DataGridPropsWithDefaultValues> & DataGridPropsWithComplexDefaultValueBeforeProcessing & DataGridPropsWithoutDefaultValue<R>, DataGridForcedPropsKey> & {
38
+ export type DataGridProps<R extends GridValidRowModel = any> = Omit<Partial<DataGridPropsWithDefaultValues<R>> & DataGridPropsWithComplexDefaultValueBeforeProcessing & DataGridPropsWithoutDefaultValue<R>, DataGridForcedPropsKey> & {
39
39
  pagination?: true;
40
40
  };
41
41
  /**
@@ -75,7 +75,7 @@ export interface DataGridPropsWithComplexDefaultValueBeforeProcessing {
75
75
  * The controlled model do not have a default value at the prop processing level, so they must be defined in `DataGridOtherProps`
76
76
  * TODO: add multiSortKey
77
77
  */
78
- export interface DataGridPropsWithDefaultValues {
78
+ export interface DataGridPropsWithDefaultValues<R extends GridValidRowModel = any> {
79
79
  /**
80
80
  * If `true`, the Data Grid height is dynamic and follow the number of rows in the Data Grid.
81
81
  * @default false
@@ -98,35 +98,20 @@ export interface DataGridPropsWithDefaultValues {
98
98
  */
99
99
  checkboxSelectionVisibleOnly: boolean;
100
100
  /**
101
- * Number of extra columns to be rendered before/after the visible slice.
102
- * @default 3
101
+ * Column region in pixels to render before/after the viewport
102
+ * @default 150
103
103
  */
104
- columnBuffer: number;
104
+ columnBufferPx: number;
105
105
  /**
106
- * Number of extra rows to be rendered before/after the visible slice.
107
- * @default 3
106
+ * Row region in pixels to render before/after the viewport
107
+ * @default 150
108
108
  */
109
- rowBuffer: number;
109
+ rowBufferPx: number;
110
110
  /**
111
111
  * If `false`, the row selection mode is disabled.
112
112
  * @default true
113
113
  */
114
114
  rowSelection: boolean;
115
- /**
116
- * Number of rows from the `rowBuffer` that can be visible before a new slice is rendered.
117
- * @default 3
118
- */
119
- rowThreshold: number;
120
- /**
121
- * Number of rows from the `columnBuffer` that can be visible before a new slice is rendered.
122
- * @default 3
123
- */
124
- columnThreshold: number;
125
- /**
126
- * Set the density of the Data Grid.
127
- * @default "standard"
128
- */
129
- density: GridDensity;
130
115
  /**
131
116
  * If `true`, column filters are disabled.
132
117
  * @default false
@@ -260,6 +245,11 @@ export interface DataGridPropsWithDefaultValues {
260
245
  * @default "client"
261
246
  */
262
247
  paginationMode: GridFeatureMode;
248
+ /**
249
+ * Set of rows of type [[GridRowsProp]].
250
+ * @default []
251
+ */
252
+ rows: GridRowsProp<R>;
263
253
  /**
264
254
  * Sets the height in pixel of a row in the Data Grid.
265
255
  * @default 52
@@ -377,6 +367,11 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
377
367
  * Override or extend the styles applied to the component.
378
368
  */
379
369
  classes?: Partial<GridClasses>;
370
+ /**
371
+ * Set the density of the Data Grid.
372
+ * @default "standard"
373
+ */
374
+ density?: GridDensity;
380
375
  /**
381
376
  * Set the total number of rows, if it is different from the length of the value `rows` prop.
382
377
  * If some rows have children (for instance in the tree data), this number represents the amount of top level rows.
@@ -530,6 +525,11 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
530
525
  * @param {GridCallbackDetails} details Additional details for this callback.
531
526
  */
532
527
  onColumnOrderChange?: GridEventListener<'columnOrderChange'>;
528
+ /**
529
+ * Callback fired when the density changes.
530
+ * @param {GridDensity} density New density value.
531
+ */
532
+ onDensityChange?: (density: GridDensity) => void;
533
533
  /**
534
534
  * Callback fired when a row is clicked.
535
535
  * Not called if the target clicked is an interactive element added by the built-in columns.
@@ -688,10 +688,6 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
688
688
  * Nonce of the inline styles for [Content Security Policy](https://www.w3.org/TR/2016/REC-CSP2-20161215/#script-src-the-nonce-attribute).
689
689
  */
690
690
  nonce?: string;
691
- /**
692
- * Set of rows of type [[GridRowsProp]].
693
- */
694
- rows: GridRowsProp<R>;
695
691
  /**
696
692
  * The initial state of the DataGrid.
697
693
  * The data in it will be set in the state on initialization but will not be controlled.
@@ -101,10 +101,10 @@ DataGridRaw.propTypes = {
101
101
  */
102
102
  clipboardCopyCellDelimiter: PropTypes.string,
103
103
  /**
104
- * Number of extra columns to be rendered before/after the visible slice.
105
- * @default 3
104
+ * Column region in pixels to render before/after the viewport
105
+ * @default 150
106
106
  */
107
- columnBuffer: PropTypes.number,
107
+ columnBufferPx: PropTypes.number,
108
108
  columnGroupingModel: PropTypes.arrayOf(PropTypes.object),
109
109
  /**
110
110
  * Sets the height in pixel of the column headers in the Data Grid.
@@ -115,11 +115,6 @@ DataGridRaw.propTypes = {
115
115
  * Set of columns of type [[GridColDef]][].
116
116
  */
117
117
  columns: PropTypes.arrayOf(PropTypes.object).isRequired,
118
- /**
119
- * Number of rows from the `columnBuffer` that can be visible before a new slice is rendered.
120
- * @default 3
121
- */
122
- columnThreshold: PropTypes.number,
123
118
  /**
124
119
  * Set the column visibility model of the Data Grid.
125
120
  * If defined, the Data Grid will ignore the `hide` property in [[GridColDef]].
@@ -467,6 +462,11 @@ DataGridRaw.propTypes = {
467
462
  * @param {GridCallbackDetails} details Additional details for this callback.
468
463
  */
469
464
  onColumnWidthChange: PropTypes.func,
465
+ /**
466
+ * Callback fired when the density changes.
467
+ * @param {GridDensity} density New density value.
468
+ */
469
+ onDensityChange: PropTypes.func,
470
470
  /**
471
471
  * Callback fired when the Filter model changes before the filters are applied.
472
472
  * @param {GridFilterModel} model With all properties from [[GridFilterModel]].
@@ -609,10 +609,10 @@ DataGridRaw.propTypes = {
609
609
  */
610
610
  processRowUpdate: PropTypes.func,
611
611
  /**
612
- * Number of extra rows to be rendered before/after the visible slice.
613
- * @default 3
612
+ * Row region in pixels to render before/after the viewport
613
+ * @default 150
614
614
  */
615
- rowBuffer: PropTypes.number,
615
+ rowBufferPx: PropTypes.number,
616
616
  /**
617
617
  * Set the total number of rows, if it is different from the length of the value `rows` prop.
618
618
  * If some rows have children (for instance in the tree data), this number represents the amount of top level rows.
@@ -636,8 +636,9 @@ DataGridRaw.propTypes = {
636
636
  rowPositionsDebounceMs: PropTypes.number,
637
637
  /**
638
638
  * Set of rows of type [[GridRowsProp]].
639
+ * @default []
639
640
  */
640
- rows: PropTypes.arrayOf(PropTypes.object).isRequired,
641
+ rows: PropTypes.arrayOf(PropTypes.object),
641
642
  /**
642
643
  * If `false`, the row selection mode is disabled.
643
644
  * @default true
@@ -652,11 +653,6 @@ DataGridRaw.propTypes = {
652
653
  * @default "margin"
653
654
  */
654
655
  rowSpacingType: PropTypes.oneOf(['border', 'margin']),
655
- /**
656
- * Number of rows from the `rowBuffer` that can be visible before a new slice is rendered.
657
- * @default 3
658
- */
659
- rowThreshold: PropTypes.number,
660
656
  /**
661
657
  * Override the height/width of the Data Grid inner scrollbar.
662
658
  */
@@ -25,12 +25,10 @@ export const DATA_GRID_PROPS_DEFAULT_VALUES = {
25
25
  autoPageSize: false,
26
26
  checkboxSelection: false,
27
27
  checkboxSelectionVisibleOnly: false,
28
- columnBuffer: 3,
29
- rowBuffer: 3,
30
- columnThreshold: 3,
31
- rowThreshold: 3,
28
+ columnBufferPx: 150,
29
+ rowBufferPx: 150,
30
+ rows: [],
32
31
  rowSelection: true,
33
- density: 'standard',
34
32
  disableColumnFilter: false,
35
33
  disableColumnMenu: false,
36
34
  disableColumnSelector: false,
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
+ import PropTypes from 'prop-types';
3
4
  import TablePagination, { tablePaginationClasses } from '@mui/material/TablePagination';
4
5
  import { styled } from '@mui/material/styles';
5
6
  import { useGridSelector } from '../hooks/utils/useGridSelector';
@@ -26,7 +27,7 @@ const GridPaginationRoot = styled(TablePagination)(({
26
27
 
27
28
  // A mutable version of a readonly array.
28
29
 
29
- export const GridPagination = /*#__PURE__*/React.forwardRef(function GridPagination(props, ref) {
30
+ const GridPagination = /*#__PURE__*/React.forwardRef(function GridPagination(props, ref) {
30
31
  const apiRef = useGridApiContext();
31
32
  const rootProps = useGridRootProps();
32
33
  const paginationModel = useGridSelector(apiRef, gridPaginationModelSelector);
@@ -79,4 +80,12 @@ export const GridPagination = /*#__PURE__*/React.forwardRef(function GridPaginat
79
80
  onPageChange: handlePageChange,
80
81
  onRowsPerPageChange: handlePageSizeChange
81
82
  }, apiRef.current.getLocaleText('MuiTablePagination'), props));
82
- });
83
+ });
84
+ process.env.NODE_ENV !== "production" ? GridPagination.propTypes = {
85
+ // ----------------------------- Warning --------------------------------
86
+ // | These PropTypes are generated from the TypeScript type definitions |
87
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
88
+ // ----------------------------------------------------------------------
89
+ component: PropTypes.elementType
90
+ } : void 0;
91
+ export { GridPagination };
@@ -128,7 +128,7 @@ function GridActionsCell(props) {
128
128
  }
129
129
  if (newIndex !== focusedButtonIndex) {
130
130
  event.preventDefault(); // Prevent scrolling
131
- event.stopPropagation(); // Don't stop propagation for other keys, e.g. ArrowUp
131
+ event.stopPropagation(); // Don't stop propagation for other keys, for example ArrowUp
132
132
  setFocusedButtonIndex(newIndex);
133
133
  }
134
134
  };
@@ -62,6 +62,10 @@ process.env.NODE_ENV !== "production" ? GridActionsCellItem.propTypes = {
62
62
  // | These PropTypes are generated from the TypeScript type definitions |
63
63
  // | To update them edit the TypeScript types and run "yarn proptypes" |
64
64
  // ----------------------------------------------------------------------
65
+ /**
66
+ * from https://mui.com/material-ui/api/button-base/#ButtonBase-prop-component
67
+ */
68
+ component: PropTypes.elementType,
65
69
  icon: PropTypes.element,
66
70
  label: PropTypes.string.isRequired,
67
71
  showInMenu: PropTypes.bool
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "hasFocus", "tabIndex"];
3
+ const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "hasFocus", "tabIndex", "hideDescendantCount"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { unstable_composeClasses as composeClasses } from '@mui/utils';
@@ -76,6 +76,7 @@ process.env.NODE_ENV !== "production" ? GridBooleanCellRaw.propTypes = {
76
76
  * If true, the cell is the active element.
77
77
  */
78
78
  hasFocus: PropTypes.bool.isRequired,
79
+ hideDescendantCount: PropTypes.bool,
79
80
  /**
80
81
  * The grid row id.
81
82
  */
@@ -105,7 +106,7 @@ process.env.NODE_ENV !== "production" ? GridBooleanCellRaw.propTypes = {
105
106
  const GridBooleanCell = /*#__PURE__*/React.memo(GridBooleanCellRaw);
106
107
  export { GridBooleanCell };
107
108
  export const renderBooleanCell = params => {
108
- if (isAutoGeneratedRow(params.rowNode)) {
109
+ if (params.field !== '__row_group_by_columns_group__' && isAutoGeneratedRow(params.rowNode)) {
109
110
  return '';
110
111
  }
111
112
  return /*#__PURE__*/_jsx(GridBooleanCell, _extends({}, params));
@@ -11,7 +11,7 @@ import { useGridSelector } from '../../hooks/utils/useGridSelector';
11
11
  import { useGridPrivateApiContext } from '../../hooks/utils/useGridPrivateApiContext';
12
12
  import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
13
13
  import { getDataGridUtilityClass } from '../../constants/gridClasses';
14
- import { gridDensityValueSelector } from '../../hooks/features/density/densitySelector';
14
+ import { gridDensitySelector } from '../../hooks/features/density/densitySelector';
15
15
  import { jsx as _jsx } from "react/jsx-runtime";
16
16
  import { jsxs as _jsxs } from "react/jsx-runtime";
17
17
  const useUtilityClasses = ownerState => {
@@ -39,11 +39,11 @@ const GridRoot = /*#__PURE__*/React.forwardRef(function GridRoot(props, ref) {
39
39
  } = props,
40
40
  other = _objectWithoutPropertiesLoose(props, _excluded);
41
41
  const apiRef = useGridPrivateApiContext();
42
- const densityValue = useGridSelector(apiRef, gridDensityValueSelector);
42
+ const density = useGridSelector(apiRef, gridDensitySelector);
43
43
  const rootElementRef = apiRef.current.rootElementRef;
44
44
  const handleRef = useForkRef(rootElementRef, ref);
45
45
  const ownerState = _extends({}, rootProps, {
46
- density: densityValue
46
+ density
47
47
  });
48
48
  const classes = useUtilityClasses(ownerState);
49
49
 
@@ -99,7 +99,7 @@ process.env.NODE_ENV !== "production" ? GridFilterInputBoolean.propTypes = {
99
99
  focusElementRef: refType,
100
100
  /**
101
101
  * It is `true` if the filter either has a value or an operator with no value
102
- * required is selected (e.g. `isEmpty`)
102
+ * required is selected (for example `isEmpty`)
103
103
  */
104
104
  isFilterActive: PropTypes.bool,
105
105
  item: PropTypes.shape({
@@ -99,7 +99,7 @@ process.env.NODE_ENV !== "production" ? GridFilterInputDate.propTypes = {
99
99
  focusElementRef: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.func, PropTypes.object]),
100
100
  /**
101
101
  * It is `true` if the filter either has a value or an operator with no value
102
- * required is selected (e.g. `isEmpty`)
102
+ * required is selected (for example `isEmpty`)
103
103
  */
104
104
  isFilterActive: PropTypes.bool,
105
105
  item: PropTypes.shape({
@@ -134,7 +134,7 @@ process.env.NODE_ENV !== "production" ? GridFilterInputSingleSelect.propTypes =
134
134
  focusElementRef: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.func, PropTypes.object]),
135
135
  /**
136
136
  * It is `true` if the filter either has a value or an operator with no value
137
- * required is selected (e.g. `isEmpty`)
137
+ * required is selected (for example `isEmpty`)
138
138
  */
139
139
  isFilterActive: PropTypes.bool,
140
140
  item: PropTypes.shape({
@@ -86,7 +86,7 @@ process.env.NODE_ENV !== "production" ? GridFilterInputValue.propTypes = {
86
86
  focusElementRef: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.func, PropTypes.object]),
87
87
  /**
88
88
  * It is `true` if the filter either has a value or an operator with no value
89
- * required is selected (e.g. `isEmpty`)
89
+ * required is selected (for example `isEmpty`)
90
90
  */
91
91
  isFilterActive: PropTypes.bool,
92
92
  item: PropTypes.shape({
@@ -5,7 +5,7 @@ import { unstable_useId as useId, unstable_useForkRef as useForkRef } from '@mui
5
5
  import MenuList from '@mui/material/MenuList';
6
6
  import MenuItem from '@mui/material/MenuItem';
7
7
  import ListItemIcon from '@mui/material/ListItemIcon';
8
- import { gridDensityValueSelector } from '../../hooks/features/density/densitySelector';
8
+ import { gridDensitySelector } from '../../hooks/features/density/densitySelector';
9
9
  import { isHideMenuKey, isTabKey } from '../../utils/keyboardUtils';
10
10
  import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
11
11
  import { useGridSelector } from '../../hooks/utils/useGridSelector';
@@ -22,7 +22,7 @@ const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function GridTo
22
22
  const tooltipProps = slotProps.tooltip || {};
23
23
  const apiRef = useGridApiContext();
24
24
  const rootProps = useGridRootProps();
25
- const densityValue = useGridSelector(apiRef, gridDensityValueSelector);
25
+ const density = useGridSelector(apiRef, gridDensitySelector);
26
26
  const densityButtonId = useId();
27
27
  const densityMenuId = useId();
28
28
  const [open, setOpen] = React.useState(false);
@@ -42,7 +42,7 @@ const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function GridTo
42
42
  value: 'comfortable'
43
43
  }];
44
44
  const startIcon = React.useMemo(() => {
45
- switch (densityValue) {
45
+ switch (density) {
46
46
  case 'compact':
47
47
  return /*#__PURE__*/_jsx(rootProps.slots.densityCompactIcon, {});
48
48
  case 'comfortable':
@@ -50,7 +50,7 @@ const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function GridTo
50
50
  default:
51
51
  return /*#__PURE__*/_jsx(rootProps.slots.densityStandardIcon, {});
52
52
  }
53
- }, [densityValue, rootProps]);
53
+ }, [density, rootProps]);
54
54
  const handleDensitySelectorOpen = event => {
55
55
  setOpen(prevOpen => !prevOpen);
56
56
  buttonProps.onClick?.(event);
@@ -77,7 +77,7 @@ const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function GridTo
77
77
  }
78
78
  const densityElements = densityOptions.map((option, index) => /*#__PURE__*/_jsxs(MenuItem, {
79
79
  onClick: () => handleDensityUpdate(option.value),
80
- selected: option.value === densityValue,
80
+ selected: option.value === density,
81
81
  children: [/*#__PURE__*/_jsx(ListItemIcon, {
82
82
  children: option.icon
83
83
  }), option.label]
@@ -67,7 +67,8 @@ export const useGridClipboard = (apiRef, props) => {
67
67
  textToCopy = apiRef.current.getDataAsCsv({
68
68
  includeHeaders: false,
69
69
  // TODO: make it configurable
70
- delimiter: clipboardCopyCellDelimiter
70
+ delimiter: clipboardCopyCellDelimiter,
71
+ shouldAppendQuotes: false
71
72
  });
72
73
  } else {
73
74
  const focusedCell = gridFocusCellSelector(apiRef);
@@ -75,7 +76,8 @@ export const useGridClipboard = (apiRef, props) => {
75
76
  const cellParams = apiRef.current.getCellParams(focusedCell.id, focusedCell.field);
76
77
  textToCopy = serializeCellValue(cellParams, {
77
78
  delimiterCharacter: clipboardCopyCellDelimiter,
78
- ignoreValueFormatter
79
+ ignoreValueFormatter,
80
+ shouldAppendQuotes: false
79
81
  });
80
82
  }
81
83
  }
@@ -126,7 +126,7 @@ function excludeOutliers(inputValues, factor) {
126
126
  const iqr = q3 - q1;
127
127
 
128
128
  // We make a small adjustment if `iqr < 5` for the cases where the IQR is
129
- // very small (e.g. zero) due to very close by values in the input data.
129
+ // very small (for example zero) due to very close by values in the input data.
130
130
  // Otherwise, with an IQR of `0`, anything outside that would be considered
131
131
  // an outlier, but it makes more sense visually to allow for this 5px variance
132
132
  // rather than showing a cropped cell.
@@ -304,25 +304,6 @@ export function getFirstNonSpannedColumnToRender({
304
304
  }
305
305
  return firstNonSpannedColumnToRender;
306
306
  }
307
- export function getFirstColumnIndexToRender({
308
- firstColumnIndex,
309
- minColumnIndex,
310
- columnBuffer,
311
- firstRowToRender,
312
- lastRowToRender,
313
- apiRef,
314
- visibleRows
315
- }) {
316
- const initialFirstColumnToRender = Math.max(firstColumnIndex - columnBuffer, minColumnIndex);
317
- const firstColumnToRender = getFirstNonSpannedColumnToRender({
318
- firstColumnToRender: initialFirstColumnToRender,
319
- apiRef,
320
- firstRowToRender,
321
- lastRowToRender,
322
- visibleRows
323
- });
324
- return firstColumnToRender;
325
- }
326
307
  export function getTotalHeaderHeight(apiRef, headerHeight) {
327
308
  const densityFactor = gridDensityFactorSelector(apiRef);
328
309
  const maxDepth = gridColumnGroupsHeaderMaxDepthSelector(apiRef);