@mui/x-data-grid 7.0.0-beta.1 → 7.0.0-beta.3

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 (125) hide show
  1. package/CHANGELOG.md +223 -1
  2. package/DataGrid/DataGrid.d.ts +1 -1
  3. package/DataGrid/DataGrid.js +1 -7
  4. package/DataGrid/useDataGridProps.js +3 -1
  5. package/components/GridPagination.d.ts +1 -1
  6. package/components/GridPagination.js +12 -2
  7. package/components/GridRow.d.ts +3 -1
  8. package/components/GridRow.js +16 -6
  9. package/components/GridScrollbarFillerCell.js +0 -3
  10. package/components/base/GridFooterPlaceholder.js +1 -1
  11. package/components/cell/GridActionsCell.js +3 -3
  12. package/components/cell/GridActionsCellItem.d.ts +13 -1
  13. package/components/cell/GridActionsCellItem.js +27 -15
  14. package/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
  15. package/components/columnSelection/GridHeaderCheckbox.d.ts +1 -1
  16. package/components/columnsManagement/utils.d.ts +1 -1
  17. package/components/containers/GridRootStyles.js +9 -4
  18. package/components/panel/GridPanel.d.ts +1 -1
  19. package/components/panel/filterPanel/GridFilterInputBoolean.js +7 -5
  20. package/components/panel/filterPanel/GridFilterInputSingleSelect.js +7 -5
  21. package/components/panel/filterPanel/GridFilterInputValue.js +4 -3
  22. package/components/panel/filterPanel/GridFilterPanel.js +1 -1
  23. package/components/virtualization/GridVirtualScrollerRenderZone.js +10 -3
  24. package/constants/gridClasses.d.ts +5 -0
  25. package/constants/gridClasses.js +1 -1
  26. package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +5 -5
  27. package/hooks/features/columnHeaders/useGridColumnHeaders.js +46 -48
  28. package/hooks/features/rows/gridRowsUtils.js +1 -1
  29. package/hooks/features/rows/useGridRows.js +2 -2
  30. package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +9 -0
  31. package/hooks/features/virtualization/gridVirtualizationSelectors.js +7 -0
  32. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +0 -1
  33. package/hooks/features/virtualization/useGridVirtualScroller.js +28 -26
  34. package/hooks/features/virtualization/useGridVirtualization.d.ts +8 -0
  35. package/hooks/features/virtualization/useGridVirtualization.js +6 -1
  36. package/index.js +1 -1
  37. package/internals/utils/propValidation.js +1 -1
  38. package/joy/joySlots.js +2 -2
  39. package/legacy/DataGrid/DataGrid.js +1 -7
  40. package/legacy/DataGrid/useDataGridProps.js +3 -1
  41. package/legacy/components/GridPagination.js +10 -2
  42. package/legacy/components/GridRow.js +16 -6
  43. package/legacy/components/GridScrollbarFillerCell.js +1 -3
  44. package/legacy/components/base/GridFooterPlaceholder.js +1 -1
  45. package/legacy/components/cell/GridActionsCell.js +3 -3
  46. package/legacy/components/cell/GridActionsCellItem.js +30 -17
  47. package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
  48. package/legacy/components/containers/GridRootStyles.js +8 -5
  49. package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +7 -4
  50. package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +8 -5
  51. package/legacy/components/panel/filterPanel/GridFilterInputValue.js +4 -2
  52. package/legacy/components/panel/filterPanel/GridFilterPanel.js +1 -1
  53. package/legacy/components/virtualization/GridVirtualScrollerRenderZone.js +10 -3
  54. package/legacy/constants/gridClasses.js +1 -1
  55. package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +60 -63
  56. package/legacy/hooks/features/rows/gridRowsUtils.js +1 -1
  57. package/legacy/hooks/features/rows/useGridRows.js +2 -2
  58. package/legacy/hooks/features/virtualization/gridVirtualizationSelectors.js +9 -0
  59. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +28 -26
  60. package/legacy/hooks/features/virtualization/useGridVirtualization.js +6 -1
  61. package/legacy/index.js +1 -1
  62. package/legacy/internals/utils/propValidation.js +1 -1
  63. package/legacy/joy/joySlots.js +2 -2
  64. package/legacy/locales/daDK.js +12 -12
  65. package/locales/daDK.js +12 -12
  66. package/models/api/gridApiCommon.d.ts +1 -1
  67. package/models/api/gridFilterApi.d.ts +1 -1
  68. package/models/api/gridLocaleTextApi.d.ts +3 -3
  69. package/models/events/gridEventLookup.d.ts +2 -9
  70. package/models/gridSlotsComponent.d.ts +34 -36
  71. package/models/gridSlotsComponentsProps.d.ts +73 -54
  72. package/models/props/DataGridProps.d.ts +2 -8
  73. package/modern/DataGrid/DataGrid.js +1 -7
  74. package/modern/DataGrid/useDataGridProps.js +3 -1
  75. package/modern/components/GridPagination.js +12 -2
  76. package/modern/components/GridRow.js +15 -6
  77. package/modern/components/GridScrollbarFillerCell.js +0 -3
  78. package/modern/components/base/GridFooterPlaceholder.js +1 -1
  79. package/modern/components/cell/GridActionsCell.js +3 -3
  80. package/modern/components/cell/GridActionsCellItem.js +27 -15
  81. package/modern/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
  82. package/modern/components/containers/GridRootStyles.js +9 -4
  83. package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +7 -5
  84. package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +7 -5
  85. package/modern/components/panel/filterPanel/GridFilterInputValue.js +4 -3
  86. package/modern/components/panel/filterPanel/GridFilterPanel.js +1 -1
  87. package/modern/components/virtualization/GridVirtualScrollerRenderZone.js +10 -3
  88. package/modern/constants/gridClasses.js +1 -1
  89. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +46 -48
  90. package/modern/hooks/features/rows/gridRowsUtils.js +1 -1
  91. package/modern/hooks/features/rows/useGridRows.js +2 -2
  92. package/modern/hooks/features/virtualization/gridVirtualizationSelectors.js +7 -0
  93. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +27 -24
  94. package/modern/hooks/features/virtualization/useGridVirtualization.js +6 -1
  95. package/modern/index.js +1 -1
  96. package/modern/internals/utils/propValidation.js +1 -1
  97. package/modern/joy/joySlots.js +2 -2
  98. package/modern/locales/daDK.js +12 -12
  99. package/node/DataGrid/DataGrid.js +1 -7
  100. package/node/DataGrid/useDataGridProps.js +3 -1
  101. package/node/components/GridPagination.js +12 -2
  102. package/node/components/GridRow.js +15 -6
  103. package/node/components/GridScrollbarFillerCell.js +0 -3
  104. package/node/components/base/GridFooterPlaceholder.js +1 -1
  105. package/node/components/cell/GridActionsCell.js +3 -3
  106. package/node/components/cell/GridActionsCellItem.js +27 -15
  107. package/node/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
  108. package/node/components/containers/GridRootStyles.js +9 -4
  109. package/node/components/panel/filterPanel/GridFilterInputBoolean.js +7 -5
  110. package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +7 -5
  111. package/node/components/panel/filterPanel/GridFilterInputValue.js +4 -3
  112. package/node/components/panel/filterPanel/GridFilterPanel.js +1 -1
  113. package/node/components/virtualization/GridVirtualScrollerRenderZone.js +10 -3
  114. package/node/constants/gridClasses.js +1 -1
  115. package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +45 -47
  116. package/node/hooks/features/rows/gridRowsUtils.js +2 -2
  117. package/node/hooks/features/rows/useGridRows.js +2 -2
  118. package/node/hooks/features/virtualization/gridVirtualizationSelectors.js +8 -1
  119. package/node/hooks/features/virtualization/useGridVirtualScroller.js +26 -23
  120. package/node/hooks/features/virtualization/useGridVirtualization.js +7 -2
  121. package/node/index.js +1 -1
  122. package/node/internals/utils/propValidation.js +1 -1
  123. package/node/joy/joySlots.js +2 -2
  124. package/node/locales/daDK.js +12 -12
  125. package/package.json +4 -4
@@ -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 = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "renderedColumns", "pinnedColumns", "dimensions", "firstColumnToRender", "lastColumnToRender", "isFirstVisible", "isLastVisible", "focusedCellColumnIndexNotInRange", "isNotVisible", "focusedCell", "tabbableCell", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave", "onMouseOut", "onMouseOver"];
3
+ const _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "renderedColumns", "pinnedColumns", "offsets", "dimensions", "firstColumnToRender", "lastColumnToRender", "isFirstVisible", "isLastVisible", "focusedCellColumnIndexNotInRange", "isNotVisible", "focusedCell", "tabbableCell", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave", "onMouseOut", "onMouseOver"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import clsx from 'clsx';
@@ -37,9 +37,7 @@ const useUtilityClasses = ownerState => {
37
37
  classes
38
38
  } = ownerState;
39
39
  const slots = {
40
- root: ['row', selected && 'selected', editable && 'row--editable', editing && 'row--editing', isFirstVisible && 'row--firstVisible', isLastVisible && 'row--lastVisible', rowHeight === 'auto' && 'row--dynamicHeight'],
41
- pinnedLeft: ['pinnedLeft'],
42
- pinnedRight: ['pinnedRight']
40
+ root: ['row', selected && 'selected', editable && 'row--editable', editing && 'row--editing', isFirstVisible && 'row--firstVisible', isLastVisible && 'row--lastVisible', rowHeight === 'auto' && 'row--dynamicHeight']
43
41
  };
44
42
  return composeClasses(slots, getDataGridUtilityClass, classes);
45
43
  };
@@ -69,6 +67,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
69
67
  visibleColumns,
70
68
  renderedColumns,
71
69
  pinnedColumns,
70
+ offsets,
72
71
  dimensions,
73
72
  firstColumnToRender,
74
73
  isFirstVisible,
@@ -273,7 +272,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
273
272
  width: width,
274
273
  contentWidth: contentWidth,
275
274
  field: column.field,
276
- align: column.align
275
+ align: column.align ?? 'left'
277
276
  }, column.field);
278
277
  }
279
278
  const {
@@ -361,7 +360,13 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
361
360
  "aria-selected": selected,
362
361
  style: style
363
362
  }, eventHandlers, other, {
364
- children: [leftCells, cells, emptyCellWidth > 0 && /*#__PURE__*/_jsx(EmptyCell, {
363
+ children: [leftCells, /*#__PURE__*/_jsx("div", {
364
+ role: "presentation",
365
+ className: gridClasses.cellOffsetLeft,
366
+ style: {
367
+ width: offsets.left
368
+ }
369
+ }), cells, emptyCellWidth > 0 && /*#__PURE__*/_jsx(EmptyCell, {
365
370
  width: emptyCellWidth
366
371
  }), rightCells.length > 0 && /*#__PURE__*/_jsx("div", {
367
372
  role: "presentation",
@@ -429,6 +434,10 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
429
434
  isLastVisible: PropTypes.bool.isRequired,
430
435
  isNotVisible: PropTypes.bool,
431
436
  lastColumnToRender: PropTypes.number.isRequired,
437
+ offsets: PropTypes.shape({
438
+ left: PropTypes.number.isRequired,
439
+ top: PropTypes.number.isRequired
440
+ }).isRequired,
432
441
  onClick: PropTypes.func,
433
442
  onDoubleClick: PropTypes.func,
434
443
  onMouseEnter: PropTypes.func,
@@ -21,9 +21,6 @@ const Style = styled('div')({
21
21
  [`&.${classes.pinnedRight}:not(.${classes.header})`]: {
22
22
  position: 'sticky',
23
23
  right: 0
24
- },
25
- [`&:not(.${classes.header}):not(.${classes.pinnedRight})`]: {
26
- transform: 'translate3d(var(--DataGrid-offsetLeft), 0, 0)'
27
24
  }
28
25
  });
29
26
  function GridScrollbarFillerCell({
@@ -7,5 +7,5 @@ export function GridFooterPlaceholder() {
7
7
  if (rootProps.hideFooter) {
8
8
  return null;
9
9
  }
10
- return /*#__PURE__*/_jsx(rootProps.slots.footer, _extends({}, rootProps.slotProps?.footer));
10
+ return /*#__PURE__*/_jsx(rootProps.slots.footer, _extends({}, rootProps.slotProps?.footer /* FIXME: typing error */));
11
11
  }
@@ -136,7 +136,7 @@ function GridActionsCell(props) {
136
136
  if (event.key === 'Tab') {
137
137
  event.preventDefault();
138
138
  }
139
- if (['Tab', 'Enter', 'Escape'].includes(event.key)) {
139
+ if (['Tab', 'Escape'].includes(event.key)) {
140
140
  hideMenu();
141
141
  }
142
142
  };
@@ -173,7 +173,6 @@ function GridActionsCell(props) {
173
173
  target: buttonRef.current,
174
174
  position: position,
175
175
  onClose: hideMenu,
176
- onClick: hideMenu,
177
176
  children: /*#__PURE__*/_jsx(MenuList, {
178
177
  id: menuId,
179
178
  className: gridClasses.menuList,
@@ -182,7 +181,8 @@ function GridActionsCell(props) {
182
181
  variant: "menu",
183
182
  autoFocusItem: true,
184
183
  children: menuButtons.map((button, index) => /*#__PURE__*/React.cloneElement(button, {
185
- key: index
184
+ key: index,
185
+ closeMenu: hideMenu
186
186
  }))
187
187
  })
188
188
  })]
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["label", "icon", "showInMenu", "onClick"];
3
+ const _excluded = ["label", "icon", "showInMenu", "onClick"],
4
+ _excluded2 = ["label", "icon", "showInMenu", "onClick", "closeMenuOnClick", "closeMenu"];
4
5
  import * as React from 'react';
5
6
  import PropTypes from 'prop-types';
6
7
  import MenuItem from '@mui/material/MenuItem';
@@ -9,20 +10,17 @@ import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
9
10
  import { jsx as _jsx } from "react/jsx-runtime";
10
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
11
12
  const GridActionsCellItem = /*#__PURE__*/React.forwardRef((props, ref) => {
12
- const {
13
- label,
14
- icon,
15
- showInMenu,
16
- onClick
17
- } = props,
18
- other = _objectWithoutPropertiesLoose(props, _excluded);
19
13
  const rootProps = useGridRootProps();
20
- const handleClick = event => {
21
- if (onClick) {
22
- onClick(event);
23
- }
24
- };
25
- if (!showInMenu) {
14
+ if (!props.showInMenu) {
15
+ const {
16
+ label,
17
+ icon,
18
+ onClick
19
+ } = props,
20
+ other = _objectWithoutPropertiesLoose(props, _excluded);
21
+ const handleClick = event => {
22
+ onClick?.(event);
23
+ };
26
24
  return /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
27
25
  ref: ref,
28
26
  size: "small",
@@ -36,10 +34,24 @@ const GridActionsCellItem = /*#__PURE__*/React.forwardRef((props, ref) => {
36
34
  })
37
35
  }));
38
36
  }
37
+ const {
38
+ label,
39
+ icon,
40
+ onClick,
41
+ closeMenuOnClick = true,
42
+ closeMenu
43
+ } = props,
44
+ other = _objectWithoutPropertiesLoose(props, _excluded2);
45
+ const handleClick = event => {
46
+ onClick?.(event);
47
+ if (closeMenuOnClick) {
48
+ closeMenu?.();
49
+ }
50
+ };
39
51
  return /*#__PURE__*/_jsxs(MenuItem, _extends({
40
52
  ref: ref
41
53
  }, other, {
42
- onClick: onClick,
54
+ onClick: handleClick,
43
55
  children: [icon && /*#__PURE__*/_jsx(ListItemIcon, {
44
56
  children: icon
45
57
  }), label]
@@ -84,7 +84,7 @@ const GridCellCheckboxForwardRef = /*#__PURE__*/React.forwardRef(function GridCe
84
84
  },
85
85
  onKeyDown: handleKeyDown,
86
86
  disabled: !isSelectable,
87
- touchRippleRef: rippleRef
87
+ touchRippleRef: rippleRef /* FIXME: typing error */
88
88
  }, rootProps.slotProps?.baseCheckbox, other));
89
89
  });
90
90
  process.env.NODE_ENV !== "production" ? GridCellCheckboxForwardRef.propTypes = {
@@ -192,8 +192,6 @@ export const GridRootStyles = styled('div', {
192
192
  '--DataGrid-width': '0px',
193
193
  '--DataGrid-hasScrollX': '0',
194
194
  '--DataGrid-hasScrollY': '0',
195
- '--DataGrid-offsetTop': '0px',
196
- '--DataGrid-offsetLeft': '0px',
197
195
  '--DataGrid-scrollbarSize': '10px',
198
196
  '--DataGrid-rowWidth': '0px',
199
197
  '--DataGrid-columnsTotalWidth': '0px',
@@ -240,6 +238,12 @@ export const GridRootStyles = styled('div', {
240
238
  [`& .${c.cell} > *`]: {
241
239
  overflow: 'visible !important',
242
240
  whiteSpace: 'nowrap'
241
+ },
242
+ [`& .${c.groupingCriteriaCell}`]: {
243
+ width: 'unset'
244
+ },
245
+ [`& .${c.treeDataGroupingCell}`]: {
246
+ width: 'unset'
243
247
  }
244
248
  },
245
249
  [`& .${c.columnHeader}, & .${c.cell}`]: {
@@ -554,8 +558,9 @@ export const GridRootStyles = styled('div', {
554
558
  }
555
559
  }
556
560
  },
557
- [`& .${c.cell}:not(.${c['cell--pinnedLeft']}):not(.${c['cell--pinnedRight']})`]: {
558
- transform: 'translate3d(var(--DataGrid-offsetLeft), 0, 0)'
561
+ [`& .${c.cellOffsetLeft}`]: {
562
+ flex: '0 0 auto',
563
+ display: 'inline-block'
559
564
  },
560
565
  [`& .${c.columnHeaderDraggableContainer}`]: {
561
566
  display: 'flex',
@@ -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 = ["item", "applyValue", "apiRef", "focusElementRef", "isFilterActive", "clearButton", "tabIndex", "label", "InputLabelProps"];
3
+ const _excluded = ["item", "applyValue", "apiRef", "focusElementRef", "isFilterActive", "clearButton", "tabIndex", "label", "variant", "InputLabelProps"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { refType, unstable_useId as useId } from '@mui/utils';
@@ -24,7 +24,8 @@ function GridFilterInputBoolean(props) {
24
24
  focusElementRef,
25
25
  clearButton,
26
26
  tabIndex,
27
- label: labelProp
27
+ label: labelProp,
28
+ variant = 'standard'
28
29
  } = props,
29
30
  others = _objectWithoutPropertiesLoose(props, _excluded);
30
31
  const [filterValueState, setFilterValueState] = React.useState(item.value || '');
@@ -51,7 +52,7 @@ function GridFilterInputBoolean(props) {
51
52
  children: [/*#__PURE__*/_jsx(rootProps.slots.baseInputLabel, _extends({}, rootProps.slotProps?.baseInputLabel, {
52
53
  id: labelId,
53
54
  shrink: true,
54
- variant: "standard",
55
+ variant: variant,
55
56
  children: label
56
57
  })), /*#__PURE__*/_jsxs(rootProps.slots.baseSelect, _extends({
57
58
  labelId: labelId,
@@ -59,14 +60,15 @@ function GridFilterInputBoolean(props) {
59
60
  label: label,
60
61
  value: filterValueState,
61
62
  onChange: onFilterChange,
62
- variant: "standard",
63
+ variant: variant,
64
+ notched: variant === 'outlined' ? true : undefined,
63
65
  native: isSelectNative,
64
66
  displayEmpty: true,
65
67
  inputProps: {
66
68
  ref: focusElementRef,
67
69
  tabIndex
68
70
  }
69
- }, others, baseSelectProps, {
71
+ }, others /* FIXME: typing error */, baseSelectProps, {
70
72
  children: [/*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
71
73
  native: isSelectNative,
72
74
  value: "",
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "placeholder", "tabIndex", "label", "isFilterActive", "clearButton", "InputLabelProps"];
3
+ const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "placeholder", "tabIndex", "label", "variant", "isFilterActive", "clearButton", "InputLabelProps"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { unstable_useId as useId } from '@mui/utils';
@@ -50,6 +50,7 @@ function GridFilterInputSingleSelect(props) {
50
50
  placeholder,
51
51
  tabIndex,
52
52
  label: labelProp,
53
+ variant = 'standard',
53
54
  clearButton
54
55
  } = props,
55
56
  others = _objectWithoutPropertiesLoose(props, _excluded);
@@ -90,7 +91,7 @@ function GridFilterInputSingleSelect(props) {
90
91
  id: labelId,
91
92
  htmlFor: id,
92
93
  shrink: true,
93
- variant: "standard",
94
+ variant: variant,
94
95
  children: label
95
96
  })), /*#__PURE__*/_jsx(rootProps.slots.baseSelect, _extends({
96
97
  id: id,
@@ -98,15 +99,16 @@ function GridFilterInputSingleSelect(props) {
98
99
  labelId: labelId,
99
100
  value: filterValue,
100
101
  onChange: onFilterChange,
101
- variant: "standard",
102
+ variant: variant,
102
103
  type: type || 'text',
103
104
  inputProps: {
104
105
  tabIndex,
105
106
  ref: focusElementRef,
106
107
  placeholder: placeholder ?? apiRef.current.getLocaleText('filterPanelInputPlaceholder')
107
108
  },
108
- native: isSelectNative
109
- }, others, rootProps.slotProps?.baseSelect, {
109
+ native: isSelectNative,
110
+ notched: variant === 'outlined' ? true : undefined
111
+ }, others /* FIXME: typing error */, rootProps.slotProps?.baseSelect, {
110
112
  children: renderSingleSelectOptions({
111
113
  column: resolvedColumn,
112
114
  OptionComponent: rootProps.slots.baseSelectOption,
@@ -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 = ["item", "applyValue", "type", "apiRef", "focusElementRef", "tabIndex", "disabled", "isFilterActive", "clearButton", "InputProps"];
3
+ const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "tabIndex", "disabled", "isFilterActive", "clearButton", "InputProps", "variant"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { unstable_useId as useId } from '@mui/utils';
@@ -17,7 +17,8 @@ function GridFilterInputValue(props) {
17
17
  tabIndex,
18
18
  disabled,
19
19
  clearButton,
20
- InputProps
20
+ InputProps,
21
+ variant = 'standard'
21
22
  } = props,
22
23
  others = _objectWithoutPropertiesLoose(props, _excluded);
23
24
  const filterTimeout = useTimeout();
@@ -52,7 +53,7 @@ function GridFilterInputValue(props) {
52
53
  placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
53
54
  value: filterValueState,
54
55
  onChange: onFilterChange,
55
- variant: "standard",
56
+ variant: variant,
56
57
  type: type || 'text',
57
58
  InputProps: _extends({}, applying || clearButton ? {
58
59
  endAdornment: applying ? /*#__PURE__*/_jsx(rootProps.slots.loadIcon, {
@@ -130,7 +130,7 @@ const GridFilterPanel = /*#__PURE__*/React.forwardRef(function GridFilterPanel(p
130
130
  }
131
131
  return apiRef.current.setFilterModel(_extends({}, filterModel, {
132
132
  items: readOnlyFilters
133
- }));
133
+ }), 'removeAllFilterItems');
134
134
  }, [apiRef, readOnlyFilters, filterModel, validFilters]);
135
135
  React.useEffect(() => {
136
136
  if (logicOperators.length > 0 && filterModel.logicOperator && !logicOperators.includes(filterModel.logicOperator)) {
@@ -5,6 +5,9 @@ import * as React from 'react';
5
5
  import clsx from 'clsx';
6
6
  import { styled } from '@mui/system';
7
7
  import { unstable_composeClasses as composeClasses } from '@mui/utils';
8
+ import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
9
+ import { useGridSelector } from '../../hooks/utils/useGridSelector';
10
+ import { gridOffsetsSelector } from '../../hooks/features/virtualization';
8
11
  import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
9
12
  import { getDataGridUtilityClass } from '../../constants/gridClasses';
10
13
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -25,20 +28,24 @@ const VirtualScrollerRenderZoneRoot = styled('div', {
25
28
  position: 'absolute',
26
29
  display: 'flex',
27
30
  // Prevents margin collapsing when using `getRowSpacing`
28
- flexDirection: 'column',
29
- transform: 'translate3d(0, var(--DataGrid-offsetTop), 0)'
31
+ flexDirection: 'column'
30
32
  });
31
33
  const GridVirtualScrollerRenderZone = /*#__PURE__*/React.forwardRef(function GridVirtualScrollerRenderZone(props, ref) {
32
34
  const {
33
35
  className
34
36
  } = props,
35
37
  other = _objectWithoutPropertiesLoose(props, _excluded);
38
+ const apiRef = useGridApiContext();
36
39
  const rootProps = useGridRootProps();
37
40
  const classes = useUtilityClasses(rootProps);
41
+ const offsets = useGridSelector(apiRef, gridOffsetsSelector);
38
42
  return /*#__PURE__*/_jsx(VirtualScrollerRenderZoneRoot, _extends({
39
43
  ref: ref,
40
44
  className: clsx(classes.root, className),
41
- ownerState: rootProps
45
+ ownerState: rootProps,
46
+ style: {
47
+ transform: `translate3d(0, ${offsets.top}px, 0)`
48
+ }
42
49
  }, other));
43
50
  });
44
51
  export { GridVirtualScrollerRenderZone };
@@ -2,4 +2,4 @@ import { unstable_generateUtilityClasses as generateUtilityClasses, unstable_gen
2
2
  export function getDataGridUtilityClass(slot) {
3
3
  return generateUtilityClass('MuiDataGrid', slot);
4
4
  }
5
- export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'autoHeight', 'autosizing', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--withRenderer', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell--pinnedLeft', 'cell--pinnedRight', 'cell--selectionMode', 'cell', 'cellContent', 'cellCheckbox', 'cellEmpty', 'cellSkeleton', 'checkboxInput', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderDropZone', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnGroupHeader', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeader--showColumnBorder', 'columnHeaders', 'columnHeadersInner', 'columnHeadersInner--scrollable', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementFooter', 'container--top', 'container--bottom', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filler', 'filler--pinnedLeft', 'filler--pinnedRight', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'headerFilterRow', 'iconButtonContainer', 'iconSeparator', 'main', 'main--hasPinnedRight', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'row', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'pinnedColumnHeaders', 'pinnedColumnHeaders--left', 'pinnedColumnHeaders--right', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pinnedRowsRenderZone']);
5
+ export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'autoHeight', 'autosizing', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--withRenderer', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell--pinnedLeft', 'cell--pinnedRight', 'cell--selectionMode', 'cell', 'cellContent', 'cellCheckbox', 'cellEmpty', 'cellSkeleton', 'cellOffsetLeft', 'checkboxInput', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderDropZone', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnGroupHeader', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeader--showColumnBorder', 'columnHeaders', 'columnHeadersInner', 'columnHeadersInner--scrollable', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementFooter', 'container--top', 'container--bottom', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filler', 'filler--pinnedLeft', 'filler--pinnedRight', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'headerFilterRow', 'iconButtonContainer', 'iconSeparator', 'main', 'main--hasPinnedRight', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'row', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'pinnedColumnHeaders', 'pinnedColumnHeaders--left', 'pinnedColumnHeaders--right', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pinnedRowsRenderZone']);
@@ -3,11 +3,12 @@ import * as React from 'react';
3
3
  import { unstable_useForkRef as useForkRef } from '@mui/utils';
4
4
  import { styled } from '@mui/material/styles';
5
5
  import { useGridSelector } from '../../utils';
6
+ import { useGridRootProps } from '../../utils/useGridRootProps';
6
7
  import { useGridPrivateApiContext } from '../../utils/useGridPrivateApiContext';
7
8
  import { useGridApiEventHandler } from '../../utils/useGridApiEventHandler';
8
9
  import { GridColumnHeaderItem } from '../../../components/columnHeaders/GridColumnHeaderItem';
9
10
  import { gridDimensionsSelector } from '../dimensions';
10
- import { gridRenderContextColumnsSelector, gridVirtualizationColumnEnabledSelector } from '../virtualization';
11
+ import { gridOffsetsSelector, gridRenderContextColumnsSelector, gridVirtualizationColumnEnabledSelector } from '../virtualization';
11
12
  import { GridColumnGroupHeader } from '../../../components/columnHeaders/GridColumnGroupHeader';
12
13
  import { GridPinnedColumnPosition, gridVisiblePinnedColumnDefinitionsSelector } from '../columns';
13
14
  import { GridScrollbarFillerCell as ScrollbarFiller } from '../../../components/GridScrollbarFillerCell';
@@ -24,19 +25,11 @@ const SpaceFiller = styled('div')({
24
25
  export const GridColumnHeaderRow = styled('div', {
25
26
  name: 'MuiDataGrid',
26
27
  slot: 'ColumnHeaderRow',
27
- overridesResolver: (props, styles) => styles.columnHeaderRow
28
- })(({
29
- ownerState: {
30
- params: {
31
- position
32
- } = {},
33
- leftOverflow = 0
34
- }
35
- }) => ({
28
+ overridesResolver: (_, styles) => styles.columnHeaderRow
29
+ })({
36
30
  display: 'flex',
37
- height: 'var(--DataGrid-headerHeight)',
38
- transform: position === undefined ? `translate3d(${leftOverflow !== 0 ? `calc(var(--DataGrid-offsetLeft) - ${leftOverflow}px)` : 'var(--DataGrid-offsetLeft)'}, 0, 0)` : undefined
39
- }));
31
+ height: 'var(--DataGrid-headerHeight)'
32
+ });
40
33
  export const useGridColumnHeaders = props => {
41
34
  const {
42
35
  innerRef: innerRefProp,
@@ -56,10 +49,12 @@ export const useGridColumnHeaders = props => {
56
49
  const [dragCol, setDragCol] = React.useState('');
57
50
  const [resizeCol, setResizeCol] = React.useState('');
58
51
  const apiRef = useGridPrivateApiContext();
52
+ const rootProps = useGridRootProps();
59
53
  const hasVirtualization = useGridSelector(apiRef, gridVirtualizationColumnEnabledSelector);
60
54
  const innerRef = React.useRef(null);
61
55
  const handleInnerRef = useForkRef(innerRefProp, innerRef);
62
56
  const dimensions = useGridSelector(apiRef, gridDimensionsSelector);
57
+ const offsets = useGridSelector(apiRef, gridOffsetsSelector);
63
58
  const renderContext = useGridSelector(apiRef, gridRenderContextColumnsSelector);
64
59
  const visiblePinnedColumns = useGridSelector(apiRef, gridVisiblePinnedColumnDefinitionsSelector);
65
60
  React.useEffect(() => {
@@ -90,11 +85,18 @@ export const useGridColumnHeaders = props => {
90
85
  lastColumnToRender
91
86
  };
92
87
  };
93
- const getFiller = (params, borderTop = false) => {
88
+ const getFillers = (params, children, leftOverflow, borderTop = false) => {
94
89
  const isPinnedRight = params?.position === GridPinnedColumnPosition.RIGHT;
95
- const hasScrollbarFiller = visiblePinnedColumns.right.length > 0 && isPinnedRight || visiblePinnedColumns.right.length === 0 && params?.position === undefined;
90
+ const isNotPinned = params?.position === undefined;
91
+ const hasScrollbarFiller = visiblePinnedColumns.right.length > 0 && isPinnedRight || visiblePinnedColumns.right.length === 0 && isNotPinned;
92
+ const leftOffsetWidth = offsets.left - leftOverflow;
96
93
  return /*#__PURE__*/_jsxs(React.Fragment, {
97
- children: [params?.position === undefined && /*#__PURE__*/_jsx(SpaceFiller, {
94
+ children: [isNotPinned && /*#__PURE__*/_jsx("div", {
95
+ role: "presentation",
96
+ style: {
97
+ width: leftOffsetWidth
98
+ }
99
+ }), children, isNotPinned && /*#__PURE__*/_jsx(SpaceFiller, {
98
100
  className: gridClasses.columnHeader
99
101
  }), hasScrollbarFiller && /*#__PURE__*/_jsx(ScrollbarFiller, {
100
102
  header: true,
@@ -128,13 +130,11 @@ export const useGridColumnHeaders = props => {
128
130
  tabIndex: tabIndex
129
131
  }, other), colDef.field));
130
132
  }
131
- return /*#__PURE__*/_jsxs(GridColumnHeaderRow, {
133
+ return /*#__PURE__*/_jsx(GridColumnHeaderRow, {
132
134
  role: "row",
133
135
  "aria-rowindex": headerGroupingMaxDepth + 1,
134
- ownerState: {
135
- params
136
- },
137
- children: [columns, getFiller(params)]
136
+ ownerState: rootProps,
137
+ children: getFillers(params, columns, 0)
138
138
  });
139
139
  };
140
140
  const getColumnGroupHeaders = params => {
@@ -200,41 +200,39 @@ export const useGridColumnHeaders = props => {
200
200
  });
201
201
  }
202
202
  headerToRender.forEach((depthInfo, depthIndex) => {
203
- columns.push( /*#__PURE__*/_jsxs(GridColumnHeaderRow, {
203
+ const children = depthInfo.elements.map(({
204
+ groupId,
205
+ width,
206
+ fields,
207
+ colIndex,
208
+ hasFocus,
209
+ tabIndex
210
+ }, groupIndex) => {
211
+ return /*#__PURE__*/_jsx(GridColumnGroupHeader, {
212
+ groupId: groupId,
213
+ width: width,
214
+ fields: fields,
215
+ colIndex: colIndex,
216
+ depth: depthIndex,
217
+ isLastColumn: colIndex === visibleColumns.length - fields.length,
218
+ maxDepth: headerToRender.length,
219
+ height: dimensions.headerHeight,
220
+ hasFocus: hasFocus,
221
+ tabIndex: tabIndex
222
+ }, groupIndex);
223
+ });
224
+ columns.push( /*#__PURE__*/_jsx(GridColumnHeaderRow, {
204
225
  role: "row",
205
226
  "aria-rowindex": depthIndex + 1,
206
- ownerState: {
207
- params,
208
- leftOverflow: depthInfo.leftOverflow
209
- },
210
- children: [depthInfo.elements.map(({
211
- groupId,
212
- width,
213
- fields,
214
- colIndex,
215
- hasFocus,
216
- tabIndex
217
- }, groupIndex) => {
218
- return /*#__PURE__*/_jsx(GridColumnGroupHeader, {
219
- groupId: groupId,
220
- width: width,
221
- fields: fields,
222
- colIndex: colIndex,
223
- depth: depthIndex,
224
- isLastColumn: colIndex === visibleColumns.length - fields.length,
225
- maxDepth: headerToRender.length,
226
- height: dimensions.headerHeight,
227
- hasFocus: hasFocus,
228
- tabIndex: tabIndex
229
- }, groupIndex);
230
- }), getFiller(params)]
227
+ ownerState: rootProps,
228
+ children: getFillers(params, children, depthInfo.leftOverflow)
231
229
  }, depthIndex));
232
230
  });
233
231
  return columns;
234
232
  };
235
233
  return {
236
234
  renderContext,
237
- getFiller,
235
+ getFillers,
238
236
  getColumnHeaders,
239
237
  getColumnsToRender,
240
238
  getColumnGroupHeaders,
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import { gridPinnedRowsSelector } from './gridRowsSelector';
3
- import { gridDimensionsSelector } from '../dimensions';
3
+ import { gridDimensionsSelector } from '../dimensions/gridDimensionsSelectors';
4
4
  export const GRID_ROOT_GROUP_ID = `auto-generated-group-node-root`;
5
5
  export const GRID_ID_AUTOGENERATED = Symbol('mui.id_autogenerated');
6
6
  export const buildRootGroup = () => ({
@@ -121,7 +121,7 @@ export const useGridRows = (apiRef, props) => {
121
121
  }, [logger, props.getRowId, props.loading, props.rowCount, throttledRowsChange, apiRef]);
122
122
  const updateRows = React.useCallback(updates => {
123
123
  if (props.signature === GridSignature.DataGrid && updates.length > 1) {
124
- throw new Error(["MUI X: You can't update several rows at once in `apiRef.current.updateRows` on the DataGrid.", 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
124
+ throw new Error(['MUI X: You cannot update several rows at once in `apiRef.current.updateRows` on the DataGrid.', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
125
125
  }
126
126
  const nonPinnedRowsUpdates = [];
127
127
  updates.forEach(update => {
@@ -246,7 +246,7 @@ export const useGridRows = (apiRef, props) => {
246
246
  }, [apiRef, logger]);
247
247
  const replaceRows = React.useCallback((firstRowToRender, newRows) => {
248
248
  if (props.signature === GridSignature.DataGrid && newRows.length > 1) {
249
- throw new Error(["MUI X: You can't replace rows using `apiRef.current.unstable_replaceRows` on the DataGrid.", 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
249
+ throw new Error(['MUI X: You cannot replace rows using `apiRef.current.unstable_replaceRows` on the DataGrid.', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
250
250
  }
251
251
  if (newRows.length === 0) {
252
252
  return;
@@ -24,6 +24,13 @@ export const gridVirtualizationColumnEnabledSelector = createSelector(gridVirtua
24
24
  */
25
25
  export const gridRenderContextSelector = createSelector(gridVirtualizationSelector, state => state.renderContext);
26
26
 
27
+ /**
28
+ * Get the offsets
29
+ * @category Virtualization
30
+ * @ignore - do not document.
31
+ */
32
+ export const gridOffsetsSelector = createSelector(gridVirtualizationSelector, state => state.offsets);
33
+
27
34
  /**
28
35
  * Get the render context, with only columns filled in.
29
36
  * This is cached, so it can be used to only re-render when the column interval changes.