@mui/x-data-grid 6.7.0 → 6.8.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 (153) hide show
  1. package/CHANGELOG.md +77 -15
  2. package/components/GridColumnHeaders.d.ts +2 -2
  3. package/components/GridColumnHeaders.js +3 -1
  4. package/components/GridRow.d.ts +2 -2
  5. package/components/GridRow.js +23 -69
  6. package/components/cell/GridCell.d.ts +24 -15
  7. package/components/cell/GridCell.js +422 -45
  8. package/components/cell/index.d.ts +2 -1
  9. package/components/cell/index.js +1 -1
  10. package/components/containers/GridRootStyles.js +30 -16
  11. package/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
  12. package/components/toolbar/GridToolbar.js +2 -2
  13. package/components/virtualization/GridVirtualScroller.js +4 -9
  14. package/components/virtualization/GridVirtualScrollerContent.js +11 -20
  15. package/constants/defaultGridSlotsComponents.js +6 -2
  16. package/hooks/core/useGridApiInitialization.js +4 -1
  17. package/hooks/core/useGridStateInitialization.js +2 -9
  18. package/hooks/features/clipboard/useGridClipboard.js +1 -4
  19. package/hooks/features/columnHeaders/useGridColumnHeaders.js +9 -3
  20. package/hooks/features/editing/useGridCellEditing.js +5 -3
  21. package/hooks/features/editing/useGridRowEditing.js +14 -6
  22. package/hooks/features/filter/gridFilterUtils.d.ts +4 -1
  23. package/hooks/features/filter/gridFilterUtils.js +19 -13
  24. package/hooks/features/filter/useGridFilter.js +2 -1
  25. package/hooks/features/focus/useGridFocus.js +9 -4
  26. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -3
  27. package/hooks/features/rows/useGridParamsApi.d.ts +2 -0
  28. package/hooks/features/rows/useGridParamsApi.js +7 -15
  29. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +8 -816
  30. package/hooks/features/virtualization/useGridVirtualScroller.js +40 -38
  31. package/hooks/utils/index.d.ts +1 -1
  32. package/hooks/utils/index.js +1 -1
  33. package/hooks/utils/useGridSelector.d.ts +3 -1
  34. package/hooks/utils/useGridSelector.js +37 -6
  35. package/hooks/utils/useLazyRef.d.ts +2 -0
  36. package/hooks/utils/useLazyRef.js +9 -0
  37. package/hooks/utils/useOnMount.d.ts +2 -0
  38. package/hooks/utils/useOnMount.js +7 -0
  39. package/index.js +1 -1
  40. package/legacy/components/GridColumnHeaders.js +3 -1
  41. package/legacy/components/GridRow.js +25 -69
  42. package/legacy/components/cell/GridCell.js +425 -46
  43. package/legacy/components/cell/index.js +1 -1
  44. package/legacy/components/containers/GridRootStyles.js +20 -17
  45. package/legacy/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
  46. package/legacy/components/toolbar/GridToolbar.js +2 -2
  47. package/legacy/components/virtualization/GridVirtualScroller.js +4 -7
  48. package/legacy/components/virtualization/GridVirtualScrollerContent.js +10 -17
  49. package/legacy/constants/defaultGridSlotsComponents.js +6 -2
  50. package/legacy/hooks/core/useGridApiInitialization.js +4 -1
  51. package/legacy/hooks/core/useGridStateInitialization.js +2 -7
  52. package/legacy/hooks/features/clipboard/useGridClipboard.js +1 -4
  53. package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +9 -3
  54. package/legacy/hooks/features/editing/useGridCellEditing.js +5 -3
  55. package/legacy/hooks/features/editing/useGridRowEditing.js +15 -7
  56. package/legacy/hooks/features/filter/gridFilterUtils.js +23 -19
  57. package/legacy/hooks/features/filter/useGridFilter.js +2 -1
  58. package/legacy/hooks/features/focus/useGridFocus.js +9 -4
  59. package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -3
  60. package/legacy/hooks/features/rows/useGridParamsApi.js +23 -15
  61. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +38 -34
  62. package/legacy/hooks/utils/index.js +1 -1
  63. package/legacy/hooks/utils/useGridSelector.js +43 -5
  64. package/legacy/hooks/utils/useLazyRef.js +9 -0
  65. package/legacy/hooks/utils/useOnMount.js +7 -0
  66. package/legacy/index.js +1 -1
  67. package/legacy/locales/elGR.js +70 -79
  68. package/legacy/utils/Store.js +34 -0
  69. package/legacy/utils/doesSupportPreventScroll.js +13 -0
  70. package/legacy/utils/fastMemo.js +5 -0
  71. package/legacy/utils/fastObjectShallowCompare.js +32 -0
  72. package/legacy/utils/keyboardUtils.js +4 -2
  73. package/locales/elGR.js +66 -79
  74. package/models/api/gridCoreApi.d.ts +6 -0
  75. package/models/colDef/gridColDef.d.ts +4 -3
  76. package/models/colDef/gridColType.d.ts +3 -1
  77. package/models/events/gridEventLookup.d.ts +3 -3
  78. package/modern/components/GridColumnHeaders.js +3 -1
  79. package/modern/components/GridRow.js +22 -69
  80. package/modern/components/cell/GridCell.js +421 -45
  81. package/modern/components/cell/index.js +1 -1
  82. package/modern/components/containers/GridRootStyles.js +30 -16
  83. package/modern/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
  84. package/modern/components/toolbar/GridToolbar.js +2 -2
  85. package/modern/components/virtualization/GridVirtualScroller.js +4 -9
  86. package/modern/components/virtualization/GridVirtualScrollerContent.js +10 -20
  87. package/modern/constants/defaultGridSlotsComponents.js +6 -2
  88. package/modern/hooks/core/useGridApiInitialization.js +4 -1
  89. package/modern/hooks/core/useGridStateInitialization.js +2 -9
  90. package/modern/hooks/features/clipboard/useGridClipboard.js +1 -4
  91. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +9 -3
  92. package/modern/hooks/features/editing/useGridCellEditing.js +5 -3
  93. package/modern/hooks/features/editing/useGridRowEditing.js +14 -6
  94. package/modern/hooks/features/filter/gridFilterUtils.js +17 -12
  95. package/modern/hooks/features/filter/useGridFilter.js +2 -1
  96. package/modern/hooks/features/focus/useGridFocus.js +8 -4
  97. package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -3
  98. package/modern/hooks/features/rows/useGridParamsApi.js +7 -15
  99. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +40 -38
  100. package/modern/hooks/utils/index.js +1 -1
  101. package/modern/hooks/utils/useGridSelector.js +37 -6
  102. package/modern/hooks/utils/useLazyRef.js +9 -0
  103. package/modern/hooks/utils/useOnMount.js +7 -0
  104. package/modern/index.js +1 -1
  105. package/modern/locales/elGR.js +66 -79
  106. package/modern/utils/Store.js +24 -0
  107. package/modern/utils/doesSupportPreventScroll.js +13 -0
  108. package/modern/utils/fastMemo.js +5 -0
  109. package/modern/utils/fastObjectShallowCompare.js +32 -0
  110. package/modern/utils/keyboardUtils.js +4 -2
  111. package/node/components/GridColumnHeaders.js +4 -2
  112. package/node/components/GridRow.js +22 -69
  113. package/node/components/cell/GridCell.js +424 -47
  114. package/node/components/cell/index.js +17 -10
  115. package/node/components/containers/GridRootStyles.js +30 -16
  116. package/node/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
  117. package/node/components/toolbar/GridToolbar.js +2 -2
  118. package/node/components/virtualization/GridVirtualScroller.js +4 -9
  119. package/node/components/virtualization/GridVirtualScrollerContent.js +10 -20
  120. package/node/constants/defaultGridSlotsComponents.js +4 -1
  121. package/node/hooks/core/useGridApiInitialization.js +4 -1
  122. package/node/hooks/core/useGridStateInitialization.js +2 -9
  123. package/node/hooks/features/clipboard/useGridClipboard.js +1 -4
  124. package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +8 -2
  125. package/node/hooks/features/editing/useGridCellEditing.js +5 -3
  126. package/node/hooks/features/editing/useGridRowEditing.js +14 -6
  127. package/node/hooks/features/filter/gridFilterUtils.js +17 -12
  128. package/node/hooks/features/filter/useGridFilter.js +2 -1
  129. package/node/hooks/features/focus/useGridFocus.js +8 -4
  130. package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -3
  131. package/node/hooks/features/rows/useGridParamsApi.js +9 -15
  132. package/node/hooks/features/virtualization/useGridVirtualScroller.js +40 -36
  133. package/node/hooks/utils/index.js +14 -10
  134. package/node/hooks/utils/useGridSelector.js +41 -7
  135. package/node/hooks/utils/useLazyRef.js +17 -0
  136. package/node/hooks/utils/useOnMount.js +15 -0
  137. package/node/index.js +1 -1
  138. package/node/locales/elGR.js +66 -79
  139. package/node/utils/Store.js +31 -0
  140. package/node/utils/doesSupportPreventScroll.js +19 -0
  141. package/node/utils/fastMemo.js +13 -0
  142. package/node/utils/fastObjectShallowCompare.js +38 -0
  143. package/node/utils/keyboardUtils.js +4 -2
  144. package/package.json +1 -1
  145. package/utils/Store.d.ts +11 -0
  146. package/utils/Store.js +24 -0
  147. package/utils/doesSupportPreventScroll.d.ts +1 -0
  148. package/utils/doesSupportPreventScroll.js +13 -0
  149. package/utils/fastMemo.d.ts +1 -0
  150. package/utils/fastMemo.js +5 -0
  151. package/utils/fastObjectShallowCompare.d.ts +1 -0
  152. package/utils/fastObjectShallowCompare.js +32 -0
  153. package/utils/keyboardUtils.js +4 -2
@@ -1,30 +1,48 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["align", "children", "colIndex", "colDef", "cellMode", "field", "formattedValue", "hasFocus", "height", "isEditable", "isSelected", "rowId", "tabIndex", "value", "width", "className", "showRightBorder", "extendRowFullWidth", "row", "colSpan", "disableDragEvents", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onMouseOver", "onKeyDown", "onKeyUp", "onDragEnter", "onDragOver"];
3
+ var _excluded = ["changeReason", "unstable_updateValueOnRender"],
4
+ _excluded2 = ["align", "children", "colIndex", "column", "cellMode", "field", "formattedValue", "hasFocus", "height", "isEditable", "isSelected", "rowId", "tabIndex", "value", "width", "className", "showRightBorder", "extendRowFullWidth", "row", "colSpan", "disableDragEvents", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onMouseOver", "onKeyDown", "onKeyUp", "onDragEnter", "onDragOver"],
5
+ _excluded3 = ["column", "rowId", "editCellState", "align", "children", "colIndex", "height", "width", "className", "showRightBorder", "extendRowFullWidth", "row", "colSpan", "disableDragEvents", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onMouseOver", "onKeyDown", "onKeyUp", "onDragEnter", "onDragOver"],
6
+ _excluded4 = ["changeReason", "unstable_updateValueOnRender"];
4
7
  /* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
5
8
  import * as React from 'react';
6
9
  import PropTypes from 'prop-types';
7
10
  import clsx from 'clsx';
8
11
  import { unstable_useForkRef as useForkRef, unstable_composeClasses as composeClasses, unstable_ownerDocument as ownerDocument, unstable_capitalize as capitalize } from '@mui/utils';
9
- import { getDataGridUtilityClass } from '../../constants/gridClasses';
12
+ import { fastMemo } from '../../utils/fastMemo';
13
+ import { doesSupportPreventScroll } from '../../utils/doesSupportPreventScroll';
14
+ import { getDataGridUtilityClass, gridClasses } from '../../constants/gridClasses';
10
15
  import { GridCellModes } from '../../models';
16
+ import { useGridSelector, objectShallowCompare } from '../../hooks/utils/useGridSelector';
11
17
  import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
12
18
  import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
13
19
  import { gridFocusCellSelector } from '../../hooks/features/focus/gridFocusStateSelector';
20
+ import { MissingRowIdError } from '../../hooks/features/rows/useGridParamsApi';
14
21
  import { jsx as _jsx } from "react/jsx-runtime";
15
- // Based on https://stackoverflow.com/a/59518678
16
- var cachedSupportsPreventScroll;
17
- function doesSupportPreventScroll() {
18
- if (cachedSupportsPreventScroll === undefined) {
19
- document.createElement('div').focus({
20
- get preventScroll() {
21
- cachedSupportsPreventScroll = true;
22
- return false;
23
- }
24
- });
25
- }
26
- return cachedSupportsPreventScroll;
27
- }
22
+ var EMPTY_CELL_PARAMS = {
23
+ id: -1,
24
+ field: '__unset__',
25
+ row: {},
26
+ rowNode: {
27
+ id: -1,
28
+ depth: 0,
29
+ type: 'leaf',
30
+ parent: -1,
31
+ groupingKey: null
32
+ },
33
+ colDef: {
34
+ type: 'string',
35
+ field: '__unset__',
36
+ computedWidth: 0
37
+ },
38
+ cellMode: GridCellModes.View,
39
+ hasFocus: false,
40
+ tabIndex: -1,
41
+ value: null,
42
+ formattedValue: '__unset__',
43
+ isEditable: false,
44
+ api: {}
45
+ };
28
46
  var useUtilityClasses = function useUtilityClasses(ownerState) {
29
47
  var align = ownerState.align,
30
48
  showRightBorder = ownerState.showRightBorder,
@@ -38,12 +56,105 @@ var useUtilityClasses = function useUtilityClasses(ownerState) {
38
56
  return composeClasses(slots, getDataGridUtilityClass, classes);
39
57
  };
40
58
  var warnedOnce = false;
59
+
60
+ // GridCellWrapper is a compatibility layer for the V6 cell slot. If we can use the more efficient
61
+ // `GridCellV7`, we should. That component is a merge of `GridCellWrapper` and `GridCell`.
62
+ // TODO(v7): Remove the wrapper & cellV6 and use the cellV7 exclusively.
63
+ // TODO(v7): Removing the wrapper will break the docs performance visualization demo.
64
+ var GridCellWrapper = /*#__PURE__*/React.forwardRef(function (props, ref) {
65
+ var column = props.column,
66
+ rowId = props.rowId,
67
+ editCellState = props.editCellState;
68
+ var apiRef = useGridApiContext();
69
+ var rootProps = useGridRootProps();
70
+ var field = column.field;
71
+ var cellParamsWithAPI = useGridSelector(apiRef, function () {
72
+ // This is required because `.getCellParams` tries to get the `state.rows.tree` entry
73
+ // associated with `rowId`/`fieldId`, but this selector runs after the state has been
74
+ // updated, while `rowId`/`fieldId` reference an entry in the old state.
75
+ try {
76
+ var cellParams = apiRef.current.getCellParams(rowId, field);
77
+ var result = cellParams;
78
+ result.api = apiRef.current;
79
+ return result;
80
+ } catch (e) {
81
+ if (e instanceof MissingRowIdError) {
82
+ return EMPTY_CELL_PARAMS;
83
+ }
84
+ throw e;
85
+ }
86
+ }, objectShallowCompare);
87
+ var isSelected = useGridSelector(apiRef, function () {
88
+ return apiRef.current.unstable_applyPipeProcessors('isCellSelected', false, {
89
+ id: rowId,
90
+ field: field
91
+ });
92
+ });
93
+ if (cellParamsWithAPI === EMPTY_CELL_PARAMS) {
94
+ return null;
95
+ }
96
+ var cellMode = cellParamsWithAPI.cellMode,
97
+ hasFocus = cellParamsWithAPI.hasFocus,
98
+ isEditable = cellParamsWithAPI.isEditable,
99
+ value = cellParamsWithAPI.value,
100
+ formattedValue = cellParamsWithAPI.formattedValue;
101
+ var managesOwnFocus = column.type === 'actions';
102
+ var tabIndex = (cellMode === 'view' || !isEditable) && !managesOwnFocus ? cellParamsWithAPI.tabIndex : -1;
103
+ var rootClasses = rootProps.classes,
104
+ getCellClassName = rootProps.getCellClassName;
105
+ var classNames = apiRef.current.unstable_applyPipeProcessors('cellClassName', [], {
106
+ id: rowId,
107
+ field: field
108
+ });
109
+ if (column.cellClassName) {
110
+ classNames.push(typeof column.cellClassName === 'function' ? column.cellClassName(cellParamsWithAPI) : column.cellClassName);
111
+ }
112
+ if (getCellClassName) {
113
+ classNames.push(getCellClassName(cellParamsWithAPI));
114
+ }
115
+ var children;
116
+ if (editCellState == null && column.renderCell) {
117
+ children = column.renderCell(cellParamsWithAPI);
118
+ classNames.push(gridClasses['cell--withRenderer']);
119
+ classNames.push(rootClasses == null ? void 0 : rootClasses['cell--withRenderer']);
120
+ }
121
+ if (editCellState != null && column.renderEditCell) {
122
+ var updatedRow = apiRef.current.getRowWithUpdatedValues(rowId, column.field);
123
+
124
+ // eslint-disable-next-line @typescript-eslint/naming-convention
125
+ var changeReason = editCellState.changeReason,
126
+ unstable_updateValueOnRender = editCellState.unstable_updateValueOnRender,
127
+ editCellStateRest = _objectWithoutProperties(editCellState, _excluded);
128
+ var params = _extends({}, cellParamsWithAPI, {
129
+ row: updatedRow
130
+ }, editCellStateRest);
131
+ children = column.renderEditCell(params);
132
+ classNames.push(gridClasses['cell--editing']);
133
+ classNames.push(rootClasses == null ? void 0 : rootClasses['cell--editing']);
134
+ }
135
+ var slots = rootProps.slots;
136
+ var CellComponent = slots.cell;
137
+ var cellProps = _extends({}, props, {
138
+ ref: ref,
139
+ field: field,
140
+ formattedValue: formattedValue,
141
+ hasFocus: hasFocus,
142
+ isEditable: isEditable,
143
+ isSelected: isSelected,
144
+ value: value,
145
+ cellMode: cellMode,
146
+ children: children,
147
+ tabIndex: tabIndex,
148
+ className: clsx(classNames)
149
+ });
150
+ return /*#__PURE__*/React.createElement(CellComponent, cellProps);
151
+ });
41
152
  var GridCell = /*#__PURE__*/React.forwardRef(function (props, ref) {
42
153
  var _rootProps$experiment;
43
154
  var align = props.align,
44
- children = props.children,
155
+ childrenProp = props.children,
45
156
  colIndex = props.colIndex,
46
- colDef = props.colDef,
157
+ column = props.column,
47
158
  cellMode = props.cellMode,
48
159
  field = props.field,
49
160
  formattedValue = props.formattedValue,
@@ -70,7 +181,7 @@ var GridCell = /*#__PURE__*/React.forwardRef(function (props, ref) {
70
181
  onKeyUp = props.onKeyUp,
71
182
  onDragEnter = props.onDragEnter,
72
183
  onDragOver = props.onDragOver,
73
- other = _objectWithoutProperties(props, _excluded);
184
+ other = _objectWithoutProperties(props, _excluded2);
74
185
  var valueToRender = formattedValue == null ? value : formattedValue;
75
186
  var cellRef = React.useRef(null);
76
187
  var handleRef = useForkRef(ref, cellRef);
@@ -158,24 +269,21 @@ var GridCell = /*#__PURE__*/React.forwardRef(function (props, ref) {
158
269
  }
159
270
  };
160
271
  }
161
- var column = apiRef.current.getColumn(field);
162
272
  var managesOwnFocus = column.type === 'actions';
163
- var renderChildren = function renderChildren() {
164
- if (children === undefined) {
165
- var valueString = valueToRender == null ? void 0 : valueToRender.toString();
166
- return /*#__PURE__*/_jsx("div", {
167
- className: classes.content,
168
- title: valueString,
169
- children: valueString
170
- });
171
- }
172
- if ( /*#__PURE__*/React.isValidElement(children) && managesOwnFocus) {
173
- return /*#__PURE__*/React.cloneElement(children, {
174
- focusElementRef: focusElementRef
175
- });
176
- }
177
- return children;
178
- };
273
+ var children = childrenProp;
274
+ if (children === undefined) {
275
+ var valueString = valueToRender == null ? void 0 : valueToRender.toString();
276
+ children = /*#__PURE__*/_jsx("div", {
277
+ className: classes.content,
278
+ title: valueString,
279
+ children: valueString
280
+ });
281
+ }
282
+ if ( /*#__PURE__*/React.isValidElement(children) && managesOwnFocus) {
283
+ children = /*#__PURE__*/React.cloneElement(children, {
284
+ focusElementRef: focusElementRef
285
+ });
286
+ }
179
287
  var draggableEventHandlers = disableDragEvents ? null : {
180
288
  onDragEnter: publish('cellDragEnter', onDragEnter),
181
289
  onDragOver: publish('cellDragOver', onDragOver)
@@ -189,7 +297,7 @@ var GridCell = /*#__PURE__*/React.forwardRef(function (props, ref) {
189
297
  "aria-colindex": colIndex + 1,
190
298
  "aria-colspan": colSpan,
191
299
  style: style,
192
- tabIndex: (cellMode === 'view' || !isEditable) && !managesOwnFocus ? tabIndex : -1,
300
+ tabIndex: tabIndex,
193
301
  onClick: publish('cellClick', onClick),
194
302
  onDoubleClick: publish('cellDoubleClick', onDoubleClick),
195
303
  onMouseOver: publish('cellMouseOver', onMouseOver),
@@ -199,10 +307,33 @@ var GridCell = /*#__PURE__*/React.forwardRef(function (props, ref) {
199
307
  onKeyUp: publish('cellKeyUp', onKeyUp)
200
308
  }, draggableEventHandlers, other, {
201
309
  onFocus: handleFocus,
202
- children: renderChildren()
310
+ children: children
203
311
  }));
204
312
  });
205
- var MemoizedCell = /*#__PURE__*/React.memo(GridCell);
313
+ var MemoizedCellWrapper = fastMemo(GridCellWrapper);
314
+ process.env.NODE_ENV !== "production" ? GridCellWrapper.propTypes = {
315
+ // ----------------------------- Warning --------------------------------
316
+ // | These PropTypes are generated from the TypeScript type definitions |
317
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
318
+ // ----------------------------------------------------------------------
319
+ align: PropTypes.oneOf(['center', 'left', 'right']),
320
+ className: PropTypes.string,
321
+ colIndex: PropTypes.number,
322
+ colSpan: PropTypes.number,
323
+ column: PropTypes.object,
324
+ disableDragEvents: PropTypes.bool,
325
+ height: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
326
+ onClick: PropTypes.func,
327
+ onDoubleClick: PropTypes.func,
328
+ onDragEnter: PropTypes.func,
329
+ onDragOver: PropTypes.func,
330
+ onKeyDown: PropTypes.func,
331
+ onMouseDown: PropTypes.func,
332
+ onMouseUp: PropTypes.func,
333
+ rowId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
334
+ showRightBorder: PropTypes.bool,
335
+ width: PropTypes.number
336
+ } : void 0;
206
337
  process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
207
338
  // ----------------------------- Warning --------------------------------
208
339
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -214,13 +345,262 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
214
345
  className: PropTypes.string,
215
346
  colIndex: PropTypes.number,
216
347
  colSpan: PropTypes.number,
348
+ column: PropTypes.object,
349
+ disableDragEvents: PropTypes.bool,
350
+ editCellState: PropTypes.shape({
351
+ changeReason: PropTypes.oneOf(['debouncedSetEditCellValue', 'setEditCellValue']),
352
+ isProcessingProps: PropTypes.bool,
353
+ isValidating: PropTypes.bool,
354
+ value: PropTypes.any
355
+ }),
356
+ height: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
357
+ onClick: PropTypes.func,
358
+ onDoubleClick: PropTypes.func,
359
+ onDragEnter: PropTypes.func,
360
+ onDragOver: PropTypes.func,
361
+ onKeyDown: PropTypes.func,
362
+ onMouseDown: PropTypes.func,
363
+ onMouseUp: PropTypes.func,
364
+ rowId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
365
+ showRightBorder: PropTypes.bool,
366
+ width: PropTypes.number
367
+ } : void 0;
368
+ export { MemoizedCellWrapper as GridCellWrapper, GridCell };
369
+ var GridCellV7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
370
+ var _rootProps$experiment2;
371
+ var column = props.column,
372
+ rowId = props.rowId,
373
+ editCellState = props.editCellState,
374
+ align = props.align,
375
+ childrenProp = props.children,
376
+ colIndex = props.colIndex,
377
+ height = props.height,
378
+ width = props.width,
379
+ className = props.className,
380
+ showRightBorder = props.showRightBorder,
381
+ extendRowFullWidth = props.extendRowFullWidth,
382
+ row = props.row,
383
+ colSpan = props.colSpan,
384
+ disableDragEvents = props.disableDragEvents,
385
+ onClick = props.onClick,
386
+ onDoubleClick = props.onDoubleClick,
387
+ onMouseDown = props.onMouseDown,
388
+ onMouseUp = props.onMouseUp,
389
+ onMouseOver = props.onMouseOver,
390
+ onKeyDown = props.onKeyDown,
391
+ onKeyUp = props.onKeyUp,
392
+ onDragEnter = props.onDragEnter,
393
+ onDragOver = props.onDragOver,
394
+ other = _objectWithoutProperties(props, _excluded3);
395
+ var apiRef = useGridApiContext();
396
+ var rootProps = useGridRootProps();
397
+ var field = column.field;
398
+ var cellParamsWithAPI = useGridSelector(apiRef, function () {
399
+ // This is required because `.getCellParams` tries to get the `state.rows.tree` entry
400
+ // associated with `rowId`/`fieldId`, but this selector runs after the state has been
401
+ // updated, while `rowId`/`fieldId` reference an entry in the old state.
402
+ try {
403
+ var cellParams = apiRef.current.getCellParams(rowId, field);
404
+ var result = cellParams;
405
+ result.api = apiRef.current;
406
+ return result;
407
+ } catch (e) {
408
+ if (e instanceof MissingRowIdError) {
409
+ return EMPTY_CELL_PARAMS;
410
+ }
411
+ throw e;
412
+ }
413
+ }, objectShallowCompare);
414
+ var isSelected = useGridSelector(apiRef, function () {
415
+ return apiRef.current.unstable_applyPipeProcessors('isCellSelected', false, {
416
+ id: rowId,
417
+ field: field
418
+ });
419
+ });
420
+ var cellMode = cellParamsWithAPI.cellMode,
421
+ hasFocus = cellParamsWithAPI.hasFocus,
422
+ isEditable = cellParamsWithAPI.isEditable,
423
+ value = cellParamsWithAPI.value,
424
+ formattedValue = cellParamsWithAPI.formattedValue;
425
+ var managesOwnFocus = column.type === 'actions';
426
+ var tabIndex = (cellMode === 'view' || !isEditable) && !managesOwnFocus ? cellParamsWithAPI.tabIndex : -1;
427
+ var rootClasses = rootProps.classes,
428
+ getCellClassName = rootProps.getCellClassName;
429
+ var classNames = apiRef.current.unstable_applyPipeProcessors('cellClassName', [], {
430
+ id: rowId,
431
+ field: field
432
+ });
433
+ if (column.cellClassName) {
434
+ classNames.push(typeof column.cellClassName === 'function' ? column.cellClassName(cellParamsWithAPI) : column.cellClassName);
435
+ }
436
+ if (getCellClassName) {
437
+ classNames.push(getCellClassName(cellParamsWithAPI));
438
+ }
439
+ var valueToRender = formattedValue == null ? value : formattedValue;
440
+ var cellRef = React.useRef(null);
441
+ var handleRef = useForkRef(ref, cellRef);
442
+ var focusElementRef = React.useRef(null);
443
+ var ownerState = {
444
+ align: align,
445
+ showRightBorder: showRightBorder,
446
+ isEditable: isEditable,
447
+ classes: rootProps.classes,
448
+ isSelected: isSelected
449
+ };
450
+ var classes = useUtilityClasses(ownerState);
451
+ var publishMouseUp = React.useCallback(function (eventName) {
452
+ return function (event) {
453
+ var params = apiRef.current.getCellParams(rowId, field || '');
454
+ apiRef.current.publishEvent(eventName, params, event);
455
+ if (onMouseUp) {
456
+ onMouseUp(event);
457
+ }
458
+ };
459
+ }, [apiRef, field, onMouseUp, rowId]);
460
+ var publishMouseDown = React.useCallback(function (eventName) {
461
+ return function (event) {
462
+ var params = apiRef.current.getCellParams(rowId, field || '');
463
+ apiRef.current.publishEvent(eventName, params, event);
464
+ if (onMouseDown) {
465
+ onMouseDown(event);
466
+ }
467
+ };
468
+ }, [apiRef, field, onMouseDown, rowId]);
469
+ var publish = React.useCallback(function (eventName, propHandler) {
470
+ return function (event) {
471
+ // The row might have been deleted during the click
472
+ if (!apiRef.current.getRow(rowId)) {
473
+ return;
474
+ }
475
+ var params = apiRef.current.getCellParams(rowId, field || '');
476
+ apiRef.current.publishEvent(eventName, params, event);
477
+ if (propHandler) {
478
+ propHandler(event);
479
+ }
480
+ };
481
+ }, [apiRef, field, rowId]);
482
+ var style = {
483
+ minWidth: width,
484
+ maxWidth: width,
485
+ minHeight: height,
486
+ maxHeight: height === 'auto' ? 'none' : height // max-height doesn't support "auto"
487
+ };
488
+
489
+ React.useEffect(function () {
490
+ if (!hasFocus || cellMode === GridCellModes.Edit) {
491
+ return;
492
+ }
493
+ var doc = ownerDocument(apiRef.current.rootElementRef.current);
494
+ if (cellRef.current && !cellRef.current.contains(doc.activeElement)) {
495
+ var focusableElement = cellRef.current.querySelector('[tabindex="0"]');
496
+ var elementToFocus = focusElementRef.current || focusableElement || cellRef.current;
497
+ if (doesSupportPreventScroll()) {
498
+ elementToFocus.focus({
499
+ preventScroll: true
500
+ });
501
+ } else {
502
+ var scrollPosition = apiRef.current.getScrollPosition();
503
+ elementToFocus.focus();
504
+ apiRef.current.scroll(scrollPosition);
505
+ }
506
+ }
507
+ }, [hasFocus, cellMode, apiRef]);
508
+ if (cellParamsWithAPI === EMPTY_CELL_PARAMS) {
509
+ return null;
510
+ }
511
+ var handleFocus = other.onFocus;
512
+ if (process.env.NODE_ENV === 'test' && (_rootProps$experiment2 = rootProps.experimentalFeatures) != null && _rootProps$experiment2.warnIfFocusStateIsNotSynced) {
513
+ handleFocus = function handleFocus(event) {
514
+ var focusedCell = gridFocusCellSelector(apiRef);
515
+ if ((focusedCell == null ? void 0 : focusedCell.id) === rowId && focusedCell.field === field) {
516
+ if (typeof other.onFocus === 'function') {
517
+ other.onFocus(event);
518
+ }
519
+ return;
520
+ }
521
+ if (!warnedOnce) {
522
+ console.warn(["MUI: The cell with id=".concat(rowId, " and field=").concat(field, " received focus."), "According to the state, the focus should be at id=".concat(focusedCell == null ? void 0 : focusedCell.id, ", field=").concat(focusedCell == null ? void 0 : focusedCell.field, "."), "Not syncing the state may cause unwanted behaviors since the `cellFocusIn` event won't be fired.", 'Call `fireEvent.mouseUp` before the `fireEvent.click` to sync the focus with the state.'].join('\n'));
523
+ warnedOnce = true;
524
+ }
525
+ };
526
+ }
527
+ var children;
528
+ if (editCellState == null && column.renderCell) {
529
+ children = column.renderCell(cellParamsWithAPI);
530
+ classNames.push(gridClasses['cell--withRenderer']);
531
+ classNames.push(rootClasses == null ? void 0 : rootClasses['cell--withRenderer']);
532
+ }
533
+ if (editCellState != null && column.renderEditCell) {
534
+ var updatedRow = apiRef.current.getRowWithUpdatedValues(rowId, column.field);
535
+
536
+ // eslint-disable-next-line @typescript-eslint/naming-convention
537
+ var changeReason = editCellState.changeReason,
538
+ unstable_updateValueOnRender = editCellState.unstable_updateValueOnRender,
539
+ editCellStateRest = _objectWithoutProperties(editCellState, _excluded4);
540
+ var params = _extends({}, cellParamsWithAPI, {
541
+ row: updatedRow
542
+ }, editCellStateRest);
543
+ children = column.renderEditCell(params);
544
+ classNames.push(gridClasses['cell--editing']);
545
+ classNames.push(rootClasses == null ? void 0 : rootClasses['cell--editing']);
546
+ }
547
+ if (children === undefined) {
548
+ var valueString = valueToRender == null ? void 0 : valueToRender.toString();
549
+ children = /*#__PURE__*/_jsx("div", {
550
+ className: classes.content,
551
+ title: valueString,
552
+ children: valueString
553
+ });
554
+ }
555
+ if ( /*#__PURE__*/React.isValidElement(children) && managesOwnFocus) {
556
+ children = /*#__PURE__*/React.cloneElement(children, {
557
+ focusElementRef: focusElementRef
558
+ });
559
+ }
560
+ var draggableEventHandlers = disableDragEvents ? null : {
561
+ onDragEnter: publish('cellDragEnter', onDragEnter),
562
+ onDragOver: publish('cellDragOver', onDragOver)
563
+ };
564
+ return /*#__PURE__*/_jsx("div", _extends({
565
+ ref: handleRef,
566
+ className: clsx(className, classNames, classes.root),
567
+ role: "cell",
568
+ "data-field": field,
569
+ "data-colindex": colIndex,
570
+ "aria-colindex": colIndex + 1,
571
+ "aria-colspan": colSpan,
572
+ style: style,
573
+ tabIndex: tabIndex,
574
+ onClick: publish('cellClick', onClick),
575
+ onDoubleClick: publish('cellDoubleClick', onDoubleClick),
576
+ onMouseOver: publish('cellMouseOver', onMouseOver),
577
+ onMouseDown: publishMouseDown('cellMouseDown'),
578
+ onMouseUp: publishMouseUp('cellMouseUp'),
579
+ onKeyDown: publish('cellKeyDown', onKeyDown),
580
+ onKeyUp: publish('cellKeyUp', onKeyUp)
581
+ }, draggableEventHandlers, other, {
582
+ onFocus: handleFocus,
583
+ children: children
584
+ }));
585
+ });
586
+ process.env.NODE_ENV !== "production" ? GridCellV7.propTypes = {
587
+ // ----------------------------- Warning --------------------------------
588
+ // | These PropTypes are generated from the TypeScript type definitions |
589
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
590
+ // ----------------------------------------------------------------------
591
+ align: PropTypes.oneOf(['center', 'left', 'right']),
592
+ className: PropTypes.string,
593
+ colIndex: PropTypes.number,
594
+ colSpan: PropTypes.number,
595
+ column: PropTypes.object,
217
596
  disableDragEvents: PropTypes.bool,
218
- field: PropTypes.string,
219
- formattedValue: PropTypes.any,
220
- hasFocus: PropTypes.bool,
597
+ editCellState: PropTypes.shape({
598
+ changeReason: PropTypes.oneOf(['debouncedSetEditCellValue', 'setEditCellValue']),
599
+ isProcessingProps: PropTypes.bool,
600
+ isValidating: PropTypes.bool,
601
+ value: PropTypes.any
602
+ }),
221
603
  height: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
222
- isEditable: PropTypes.bool,
223
- isSelected: PropTypes.bool,
224
604
  onClick: PropTypes.func,
225
605
  onDoubleClick: PropTypes.func,
226
606
  onDragEnter: PropTypes.func,
@@ -230,8 +610,7 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
230
610
  onMouseUp: PropTypes.func,
231
611
  rowId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
232
612
  showRightBorder: PropTypes.bool,
233
- tabIndex: PropTypes.oneOf([-1, 0]),
234
- value: PropTypes.any,
235
613
  width: PropTypes.number
236
614
  } : void 0;
237
- export { MemoizedCell as GridCell };
615
+ var MemoizedGridCellV7 = fastMemo(GridCellV7);
616
+ export { MemoizedGridCellV7 as GridCellV7 };
@@ -1,4 +1,4 @@
1
- export * from './GridCell';
1
+ export { GridCell } from './GridCell';
2
2
  export * from './GridBooleanCell';
3
3
  export * from './GridEditBooleanCell';
4
4
  export * from './GridEditDateCell';
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
+ var _columnHeaderStyles;
3
4
  import { alpha, styled, darken, lighten } from '@mui/material/styles';
4
5
  import { gridClasses } from '../../constants/gridClasses';
5
6
  function getBorderColor(theme) {
@@ -11,16 +12,27 @@ function getBorderColor(theme) {
11
12
  }
12
13
  return darken(alpha(theme.palette.divider, 1), 0.68);
13
14
  }
15
+ var columnHeadersStyles = _defineProperty({}, ".".concat(gridClasses.columnSeparator, ", .").concat(gridClasses['columnSeparator--resizing']), {
16
+ visibility: 'visible',
17
+ width: 'auto'
18
+ });
19
+ var columnHeaderStyles = (_columnHeaderStyles = {}, _defineProperty(_columnHeaderStyles, "& .".concat(gridClasses.iconButtonContainer), {
20
+ visibility: 'visible',
21
+ width: 'auto'
22
+ }), _defineProperty(_columnHeaderStyles, "& .".concat(gridClasses.menuIcon), {
23
+ width: 'auto',
24
+ visibility: 'visible'
25
+ }), _columnHeaderStyles);
14
26
  export var GridRootStyles = styled('div', {
15
27
  name: 'MuiDataGrid',
16
28
  slot: 'Root',
17
29
  overridesResolver: function overridesResolver(props, styles) {
18
30
  return [_defineProperty({}, "&.".concat(gridClasses.autoHeight), styles.autoHeight), _defineProperty({}, "&.".concat(gridClasses.aggregationColumnHeader), styles.aggregationColumnHeader), _defineProperty({}, "&.".concat(gridClasses['aggregationColumnHeader--alignLeft']), styles['aggregationColumnHeader--alignLeft']), _defineProperty({}, "&.".concat(gridClasses['aggregationColumnHeader--alignCenter']), styles['aggregationColumnHeader--alignCenter']), _defineProperty({}, "&.".concat(gridClasses['aggregationColumnHeader--alignRight']), styles['aggregationColumnHeader--alignRight']), _defineProperty({}, "&.".concat(gridClasses.aggregationColumnHeaderLabel), styles.aggregationColumnHeaderLabel), _defineProperty({}, "&.".concat(gridClasses['root--disableUserSelection'], " .").concat(gridClasses.cell), styles['root--disableUserSelection']), _defineProperty({}, "& .".concat(gridClasses.editBooleanCell), styles.editBooleanCell), _defineProperty({}, "& .".concat(gridClasses['cell--editing']), styles['cell--editing']), _defineProperty({}, "& .".concat(gridClasses['cell--textCenter']), styles['cell--textCenter']), _defineProperty({}, "& .".concat(gridClasses['cell--textLeft']), styles['cell--textLeft']), _defineProperty({}, "& .".concat(gridClasses['cell--textRight']), styles['cell--textRight']), // TODO v6: Remove
19
- _defineProperty({}, "& .".concat(gridClasses['cell--withRenderer']), styles['cell--withRenderer']), _defineProperty({}, "& .".concat(gridClasses.cell), styles.cell), _defineProperty({}, "& .".concat(gridClasses['cell--rangeTop']), styles['cell--rangeTop']), _defineProperty({}, "& .".concat(gridClasses['cell--rangeBottom']), styles['cell--rangeBottom']), _defineProperty({}, "& .".concat(gridClasses['cell--rangeLeft']), styles['cell--rangeLeft']), _defineProperty({}, "& .".concat(gridClasses['cell--rangeRight']), styles['cell--rangeRight']), _defineProperty({}, "& .".concat(gridClasses.cellContent), styles.cellContent), _defineProperty({}, "& .".concat(gridClasses.cellCheckbox), styles.cellCheckbox), _defineProperty({}, "& .".concat(gridClasses.cellSkeleton), styles.cellSkeleton), _defineProperty({}, "& .".concat(gridClasses.checkboxInput), styles.checkboxInput), _defineProperty({}, "& .".concat(gridClasses['columnHeader--alignCenter']), styles['columnHeader--alignCenter']), _defineProperty({}, "& .".concat(gridClasses['columnHeader--alignLeft']), styles['columnHeader--alignLeft']), _defineProperty({}, "& .".concat(gridClasses['columnHeader--alignRight']), styles['columnHeader--alignRight']), _defineProperty({}, "& .".concat(gridClasses['columnHeader--dragging']), styles['columnHeader--dragging']), _defineProperty({}, "& .".concat(gridClasses['columnHeader--moving']), styles['columnHeader--moving']), _defineProperty({}, "& .".concat(gridClasses['columnHeader--numeric']), styles['columnHeader--numeric']), _defineProperty({}, "& .".concat(gridClasses['columnHeader--sortable']), styles['columnHeader--sortable']), _defineProperty({}, "& .".concat(gridClasses['columnHeader--sorted']), styles['columnHeader--sorted']), _defineProperty({}, "& .".concat(gridClasses.columnHeader), styles.columnHeader), _defineProperty({}, "& .".concat(gridClasses.headerFilterRow), styles.headerFilterRow), _defineProperty({}, "& .".concat(gridClasses.columnHeaderCheckbox), styles.columnHeaderCheckbox), _defineProperty({}, "& .".concat(gridClasses.columnHeaderDraggableContainer), styles.columnHeaderDraggableContainer), _defineProperty({}, "& .".concat(gridClasses.columnHeaderTitleContainer), styles.columnHeaderTitleContainer), _defineProperty({}, "& .".concat(gridClasses['columnSeparator--resizable']), styles['columnSeparator--resizable']), _defineProperty({}, "& .".concat(gridClasses['columnSeparator--resizing']), styles['columnSeparator--resizing']), _defineProperty({}, "& .".concat(gridClasses.columnSeparator), styles.columnSeparator), _defineProperty({}, "& .".concat(gridClasses.filterIcon), styles.filterIcon), _defineProperty({}, "& .".concat(gridClasses.iconSeparator), styles.iconSeparator), _defineProperty({}, "& .".concat(gridClasses.menuIcon), styles.menuIcon), _defineProperty({}, "& .".concat(gridClasses.menuIconButton), styles.menuIconButton), _defineProperty({}, "& .".concat(gridClasses.menuOpen), styles.menuOpen), _defineProperty({}, "& .".concat(gridClasses.menuList), styles.menuList), _defineProperty({}, "& .".concat(gridClasses['row--editable']), styles['row--editable']), _defineProperty({}, "& .".concat(gridClasses['row--editing']), styles['row--editing']), _defineProperty({}, "& .".concat(gridClasses['row--dragging']), styles['row--dragging']), _defineProperty({}, "& .".concat(gridClasses.row), styles.row), _defineProperty({}, "& .".concat(gridClasses.rowReorderCellPlaceholder), styles.rowReorderCellPlaceholder), _defineProperty({}, "& .".concat(gridClasses.rowReorderCell), styles.rowReorderCell), _defineProperty({}, "& .".concat(gridClasses['rowReorderCell--draggable']), styles['rowReorderCell--draggable']), _defineProperty({}, "& .".concat(gridClasses.sortIcon), styles.sortIcon), _defineProperty({}, "& .".concat(gridClasses.withBorderColor), styles.withBorderColor), _defineProperty({}, "& .".concat(gridClasses.treeDataGroupingCell), styles.treeDataGroupingCell), _defineProperty({}, "& .".concat(gridClasses.treeDataGroupingCellToggle), styles.treeDataGroupingCellToggle), _defineProperty({}, "& .".concat(gridClasses.detailPanelToggleCell), styles.detailPanelToggleCell), _defineProperty({}, "& .".concat(gridClasses['detailPanelToggleCell--expanded']), styles['detailPanelToggleCell--expanded']), styles.root];
31
+ _defineProperty({}, "& .".concat(gridClasses['cell--withRenderer']), styles['cell--withRenderer']), _defineProperty({}, "& .".concat(gridClasses.cell), styles.cell), _defineProperty({}, "& .".concat(gridClasses['cell--rangeTop']), styles['cell--rangeTop']), _defineProperty({}, "& .".concat(gridClasses['cell--rangeBottom']), styles['cell--rangeBottom']), _defineProperty({}, "& .".concat(gridClasses['cell--rangeLeft']), styles['cell--rangeLeft']), _defineProperty({}, "& .".concat(gridClasses['cell--rangeRight']), styles['cell--rangeRight']), _defineProperty({}, "& .".concat(gridClasses['cell--withRightBorder']), styles['cell--withRightBorder']), _defineProperty({}, "& .".concat(gridClasses.cellContent), styles.cellContent), _defineProperty({}, "& .".concat(gridClasses.cellCheckbox), styles.cellCheckbox), _defineProperty({}, "& .".concat(gridClasses.cellSkeleton), styles.cellSkeleton), _defineProperty({}, "& .".concat(gridClasses.checkboxInput), styles.checkboxInput), _defineProperty({}, "& .".concat(gridClasses['columnHeader--alignCenter']), styles['columnHeader--alignCenter']), _defineProperty({}, "& .".concat(gridClasses['columnHeader--alignLeft']), styles['columnHeader--alignLeft']), _defineProperty({}, "& .".concat(gridClasses['columnHeader--alignRight']), styles['columnHeader--alignRight']), _defineProperty({}, "& .".concat(gridClasses['columnHeader--dragging']), styles['columnHeader--dragging']), _defineProperty({}, "& .".concat(gridClasses['columnHeader--moving']), styles['columnHeader--moving']), _defineProperty({}, "& .".concat(gridClasses['columnHeader--numeric']), styles['columnHeader--numeric']), _defineProperty({}, "& .".concat(gridClasses['columnHeader--sortable']), styles['columnHeader--sortable']), _defineProperty({}, "& .".concat(gridClasses['columnHeader--sorted']), styles['columnHeader--sorted']), _defineProperty({}, "& .".concat(gridClasses['columnHeader--withRightBorder']), styles['columnHeader--withRightBorder']), _defineProperty({}, "& .".concat(gridClasses.columnHeader), styles.columnHeader), _defineProperty({}, "& .".concat(gridClasses.headerFilterRow), styles.headerFilterRow), _defineProperty({}, "& .".concat(gridClasses.columnHeaderCheckbox), styles.columnHeaderCheckbox), _defineProperty({}, "& .".concat(gridClasses.columnHeaderDraggableContainer), styles.columnHeaderDraggableContainer), _defineProperty({}, "& .".concat(gridClasses.columnHeaderTitleContainer), styles.columnHeaderTitleContainer), _defineProperty({}, "& .".concat(gridClasses['columnSeparator--resizable']), styles['columnSeparator--resizable']), _defineProperty({}, "& .".concat(gridClasses['columnSeparator--resizing']), styles['columnSeparator--resizing']), _defineProperty({}, "& .".concat(gridClasses.columnSeparator), styles.columnSeparator), _defineProperty({}, "& .".concat(gridClasses.filterIcon), styles.filterIcon), _defineProperty({}, "& .".concat(gridClasses.iconSeparator), styles.iconSeparator), _defineProperty({}, "& .".concat(gridClasses.menuIcon), styles.menuIcon), _defineProperty({}, "& .".concat(gridClasses.menuIconButton), styles.menuIconButton), _defineProperty({}, "& .".concat(gridClasses.menuOpen), styles.menuOpen), _defineProperty({}, "& .".concat(gridClasses.menuList), styles.menuList), _defineProperty({}, "& .".concat(gridClasses['row--editable']), styles['row--editable']), _defineProperty({}, "& .".concat(gridClasses['row--editing']), styles['row--editing']), _defineProperty({}, "& .".concat(gridClasses['row--dragging']), styles['row--dragging']), _defineProperty({}, "& .".concat(gridClasses.row), styles.row), _defineProperty({}, "& .".concat(gridClasses.rowReorderCellPlaceholder), styles.rowReorderCellPlaceholder), _defineProperty({}, "& .".concat(gridClasses.rowReorderCell), styles.rowReorderCell), _defineProperty({}, "& .".concat(gridClasses['rowReorderCell--draggable']), styles['rowReorderCell--draggable']), _defineProperty({}, "& .".concat(gridClasses.sortIcon), styles.sortIcon), _defineProperty({}, "& .".concat(gridClasses.withBorderColor), styles.withBorderColor), _defineProperty({}, "& .".concat(gridClasses.treeDataGroupingCell), styles.treeDataGroupingCell), _defineProperty({}, "& .".concat(gridClasses.treeDataGroupingCellToggle), styles.treeDataGroupingCellToggle), _defineProperty({}, "& .".concat(gridClasses.detailPanelToggleCell), styles.detailPanelToggleCell), _defineProperty({}, "& .".concat(gridClasses['detailPanelToggleCell--expanded']), styles['detailPanelToggleCell--expanded']), styles.root];
20
32
  }
21
- })(function (_ref58) {
22
- var _$concat2, _$concat3, _extends2;
23
- var theme = _ref58.theme;
33
+ })(function (_ref60) {
34
+ var _mediaHoverHover, _mediaHoverNone, _$concat2, _extends2;
35
+ var theme = _ref60.theme;
24
36
  var borderColor = getBorderColor(theme);
25
37
  var radius = theme.shape.borderRadius;
26
38
  var gridStyle = _extends({
@@ -77,8 +89,6 @@ export var GridRootStyles = styled('div', {
77
89
  transition: theme.transitions.create(['opacity'], {
78
90
  duration: theme.transitions.duration.shorter
79
91
  })
80
- }), _defineProperty(_extends2, "& .".concat(gridClasses.columnHeader, ":not(.").concat(gridClasses['columnHeader--sorted'], "):hover .").concat(gridClasses.sortIcon), {
81
- opacity: 0.5
82
92
  }), _defineProperty(_extends2, "& .".concat(gridClasses.columnHeaderTitleContainer), {
83
93
  display: 'flex',
84
94
  alignItems: 'center',
@@ -128,10 +138,9 @@ export var GridRootStyles = styled('div', {
128
138
  flexDirection: 'column',
129
139
  justifyContent: 'center',
130
140
  color: borderColor
131
- }), _defineProperty(_extends2, "& .".concat(gridClasses.columnHeaders, ":hover .").concat(gridClasses.columnSeparator, ", .").concat(gridClasses['columnSeparator--resizing']), {
132
- visibility: 'visible',
133
- width: 'auto'
134
- }), _defineProperty(_extends2, "& .".concat(gridClasses['columnSeparator--sideLeft']), {
141
+ }), _defineProperty(_extends2, '@media (hover: hover)', (_mediaHoverHover = {}, _defineProperty(_mediaHoverHover, "& .".concat(gridClasses.columnHeaders, ":hover"), columnHeadersStyles), _defineProperty(_mediaHoverHover, "& .".concat(gridClasses.columnHeader, ":hover"), columnHeaderStyles), _defineProperty(_mediaHoverHover, "& .".concat(gridClasses.columnHeader, ":not(.").concat(gridClasses['columnHeader--sorted'], "):hover .").concat(gridClasses.sortIcon), {
142
+ opacity: 0.5
143
+ }), _mediaHoverHover)), _defineProperty(_extends2, '@media (hover: none)', (_mediaHoverNone = {}, _defineProperty(_mediaHoverNone, "& .".concat(gridClasses.columnHeaders), columnHeadersStyles), _defineProperty(_mediaHoverNone, "& .".concat(gridClasses.columnHeader), columnHeaderStyles), _mediaHoverNone)), _defineProperty(_extends2, "& .".concat(gridClasses['columnSeparator--sideLeft']), {
135
144
  left: -12
136
145
  }), _defineProperty(_extends2, "& .".concat(gridClasses['columnSeparator--sideRight']), {
137
146
  right: -12
@@ -158,13 +167,7 @@ export var GridRootStyles = styled('div', {
158
167
  marginRight: -10,
159
168
  display: 'flex',
160
169
  alignItems: 'center'
161
- }), _defineProperty(_extends2, "& .".concat(gridClasses.columnHeader, ":hover"), (_$concat3 = {}, _defineProperty(_$concat3, "& .".concat(gridClasses.iconButtonContainer), {
162
- visibility: 'visible',
163
- width: 'auto'
164
- }), _defineProperty(_$concat3, "& .".concat(gridClasses.menuIcon), {
165
- width: 'auto',
166
- visibility: 'visible'
167
- }), _$concat3)), _defineProperty(_extends2, ".".concat(gridClasses.menuOpen), {
170
+ }), _defineProperty(_extends2, ".".concat(gridClasses.menuOpen), {
168
171
  visibility: 'visible',
169
172
  width: 'auto'
170
173
  }), _defineProperty(_extends2, "& .".concat(gridClasses.row), {
@@ -23,7 +23,7 @@ function GridColumnHeaderMenu(_ref) {
23
23
  apiRef.current.hideColumnMenu();
24
24
  }
25
25
  }, [apiRef, target]);
26
- if (!target) {
26
+ if (!target || !colDef) {
27
27
  return null;
28
28
  }
29
29
  return /*#__PURE__*/_jsx(GridMenu, {