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

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 (100) hide show
  1. package/CHANGELOG.md +159 -1
  2. package/DataGrid/DataGrid.d.ts +1 -1
  3. package/DataGrid/DataGrid.js +1 -1
  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.js +7 -5
  8. package/components/GridScrollbarFillerCell.js +0 -3
  9. package/components/base/GridFooterPlaceholder.js +1 -1
  10. package/components/cell/GridActionsCell.js +3 -3
  11. package/components/cell/GridActionsCellItem.d.ts +13 -1
  12. package/components/cell/GridActionsCellItem.js +27 -15
  13. package/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
  14. package/components/columnSelection/GridHeaderCheckbox.d.ts +1 -1
  15. package/components/columnsManagement/utils.d.ts +1 -1
  16. package/components/containers/GridRootStyles.js +10 -2
  17. package/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
  18. package/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -1
  19. package/components/panel/filterPanel/GridFilterPanel.js +1 -1
  20. package/constants/gridClasses.d.ts +5 -0
  21. package/constants/gridClasses.js +1 -1
  22. package/hooks/features/rows/gridRowsUtils.js +1 -1
  23. package/hooks/features/rows/useGridRows.js +2 -2
  24. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +0 -1
  25. package/hooks/features/virtualization/useGridVirtualScroller.js +9 -10
  26. package/index.js +1 -1
  27. package/internals/utils/propValidation.js +1 -1
  28. package/joy/joySlots.js +2 -2
  29. package/legacy/DataGrid/DataGrid.js +1 -1
  30. package/legacy/DataGrid/useDataGridProps.js +3 -1
  31. package/legacy/components/GridPagination.js +10 -2
  32. package/legacy/components/GridRow.js +7 -5
  33. package/legacy/components/GridScrollbarFillerCell.js +1 -3
  34. package/legacy/components/base/GridFooterPlaceholder.js +1 -1
  35. package/legacy/components/cell/GridActionsCell.js +3 -3
  36. package/legacy/components/cell/GridActionsCellItem.js +30 -17
  37. package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
  38. package/legacy/components/containers/GridRootStyles.js +9 -3
  39. package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
  40. package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -1
  41. package/legacy/components/panel/filterPanel/GridFilterPanel.js +1 -1
  42. package/legacy/constants/gridClasses.js +1 -1
  43. package/legacy/hooks/features/rows/gridRowsUtils.js +1 -1
  44. package/legacy/hooks/features/rows/useGridRows.js +2 -2
  45. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +9 -10
  46. package/legacy/index.js +1 -1
  47. package/legacy/internals/utils/propValidation.js +1 -1
  48. package/legacy/joy/joySlots.js +2 -2
  49. package/legacy/locales/daDK.js +12 -12
  50. package/locales/daDK.js +12 -12
  51. package/models/api/gridApiCommon.d.ts +1 -1
  52. package/models/api/gridFilterApi.d.ts +1 -1
  53. package/models/api/gridLocaleTextApi.d.ts +3 -3
  54. package/models/events/gridEventLookup.d.ts +1 -1
  55. package/models/gridSlotsComponent.d.ts +34 -36
  56. package/models/gridSlotsComponentsProps.d.ts +73 -54
  57. package/models/props/DataGridProps.d.ts +2 -2
  58. package/modern/DataGrid/DataGrid.js +1 -1
  59. package/modern/DataGrid/useDataGridProps.js +3 -1
  60. package/modern/components/GridPagination.js +12 -2
  61. package/modern/components/GridRow.js +6 -5
  62. package/modern/components/GridScrollbarFillerCell.js +0 -3
  63. package/modern/components/base/GridFooterPlaceholder.js +1 -1
  64. package/modern/components/cell/GridActionsCell.js +3 -3
  65. package/modern/components/cell/GridActionsCellItem.js +27 -15
  66. package/modern/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
  67. package/modern/components/containers/GridRootStyles.js +10 -2
  68. package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
  69. package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -1
  70. package/modern/components/panel/filterPanel/GridFilterPanel.js +1 -1
  71. package/modern/constants/gridClasses.js +1 -1
  72. package/modern/hooks/features/rows/gridRowsUtils.js +1 -1
  73. package/modern/hooks/features/rows/useGridRows.js +2 -2
  74. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +9 -10
  75. package/modern/index.js +1 -1
  76. package/modern/internals/utils/propValidation.js +1 -1
  77. package/modern/joy/joySlots.js +2 -2
  78. package/modern/locales/daDK.js +12 -12
  79. package/node/DataGrid/DataGrid.js +1 -1
  80. package/node/DataGrid/useDataGridProps.js +3 -1
  81. package/node/components/GridPagination.js +12 -2
  82. package/node/components/GridRow.js +6 -5
  83. package/node/components/GridScrollbarFillerCell.js +0 -3
  84. package/node/components/base/GridFooterPlaceholder.js +1 -1
  85. package/node/components/cell/GridActionsCell.js +3 -3
  86. package/node/components/cell/GridActionsCellItem.js +27 -15
  87. package/node/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
  88. package/node/components/containers/GridRootStyles.js +10 -2
  89. package/node/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
  90. package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -1
  91. package/node/components/panel/filterPanel/GridFilterPanel.js +1 -1
  92. package/node/constants/gridClasses.js +1 -1
  93. package/node/hooks/features/rows/gridRowsUtils.js +2 -2
  94. package/node/hooks/features/rows/useGridRows.js +2 -2
  95. package/node/hooks/features/virtualization/useGridVirtualScroller.js +9 -10
  96. package/node/index.js +1 -1
  97. package/node/internals/utils/propValidation.js +1 -1
  98. package/node/joy/joySlots.js +2 -2
  99. package/node/locales/daDK.js +12 -12
  100. package/package.json +2 -2
@@ -46,7 +46,6 @@ export const useGridVirtualScroller = () => {
46
46
  const gridRootRef = apiRef.current.rootElementRef;
47
47
  const mainRef = apiRef.current.mainElementRef;
48
48
  const scrollerRef = apiRef.current.virtualScrollerRef;
49
- const renderZoneRef = React.useRef(null);
50
49
  const scrollbarVerticalRef = React.useRef(null);
51
50
  const scrollbarHorizontalRef = React.useRef(null);
52
51
  const contentHeight = dimensions.contentSize.height;
@@ -247,6 +246,14 @@ export const useGridVirtualScroller = () => {
247
246
  id,
248
247
  model
249
248
  } = renderedRows[i];
249
+ const rowIndexInPage = ((currentPage == null || (_currentPage$range = currentPage.range) == null ? void 0 : _currentPage$range.firstRowIndex) || 0) + firstRowToRender + i;
250
+ let index = rowIndexOffset + rowIndexInPage;
251
+ if (isRowWithFocusedCellNotInRange && (cellFocus == null ? void 0 : cellFocus.id) === id) {
252
+ index = indexOfRowWithFocusedCell;
253
+ isRowWithFocusedCellRendered = true;
254
+ } else if (isRowWithFocusedCellRendered) {
255
+ index -= 1;
256
+ }
250
257
  const isRowNotVisible = isRowWithFocusedCellNotInRange && cellFocus.id === id;
251
258
  const baseRowHeight = !apiRef.current.rowHasAutoHeight(id) ? apiRef.current.unstable_getRowHeight(id) : 'auto';
252
259
  let isSelected;
@@ -257,7 +264,7 @@ export const useGridVirtualScroller = () => {
257
264
  }
258
265
  let isFirstVisible = false;
259
266
  if (params.position === undefined) {
260
- isFirstVisible = i === 0;
267
+ isFirstVisible = rowIndexInPage === 0;
261
268
  }
262
269
  let isLastVisible = false;
263
270
  if (isLastSection) {
@@ -279,13 +286,6 @@ export const useGridVirtualScroller = () => {
279
286
  const cellParams = apiRef.current.getCellParams(id, cellTabIndex.field);
280
287
  tabbableCell = cellParams.cellMode === 'view' ? cellTabIndex.field : null;
281
288
  }
282
- let index = rowIndexOffset + ((currentPage == null || (_currentPage$range = currentPage.range) == null ? void 0 : _currentPage$range.firstRowIndex) || 0) + firstRowToRender + i;
283
- if (isRowWithFocusedCellNotInRange && (cellFocus == null ? void 0 : cellFocus.id) === id) {
284
- index = indexOfRowWithFocusedCell;
285
- isRowWithFocusedCellRendered = true;
286
- } else if (isRowWithFocusedCellRendered) {
287
- index -= 1;
288
- }
289
289
  rows.push( /*#__PURE__*/_jsx(rootProps.slots.row, _extends({
290
290
  row: model,
291
291
  rowId: id,
@@ -387,7 +387,6 @@ export const useGridVirtualScroller = () => {
387
387
  role: 'presentation'
388
388
  }),
389
389
  getRenderZoneProps: () => ({
390
- ref: renderZoneRef,
391
390
  role: 'rowgroup'
392
391
  }),
393
392
  getScrollbarVerticalProps: () => ({
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v7.0.0-beta.1
2
+ * @mui/x-data-grid v7.0.0-beta.2
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -1,4 +1,4 @@
1
- export const propValidatorsDataGrid = [props => props.autoPageSize && props.autoHeight && ['MUI X: `<DataGrid autoPageSize={true} autoHeight={true} />` are not valid props.', 'You can not use both the `autoPageSize` and `autoHeight` props at the same time because `autoHeight` scales the height of the Data Grid according to the `pageSize`.', '', 'Please remove one of these two props.'].join('\n') || undefined];
1
+ export const propValidatorsDataGrid = [props => props.autoPageSize && props.autoHeight && ['MUI X: `<DataGrid autoPageSize={true} autoHeight={true} />` are not valid props.', 'You cannot use both the `autoPageSize` and `autoHeight` props at the same time because `autoHeight` scales the height of the Data Grid according to the `pageSize`.', '', 'Please remove one of these two props.'].join('\n') || undefined];
2
2
  const warnedOnceMap = new Set();
3
3
  const warnOnce = message => {
4
4
  if (!warnedOnceMap.has(message)) {
package/joy/joySlots.js CHANGED
@@ -404,8 +404,8 @@ const joySlots = _extends({}, joyIconSlots, {
404
404
  baseSelect: Select,
405
405
  baseSelectOption: Option,
406
406
  baseInputLabel: InputLabel,
407
- baseFormControl: JoyFormControl,
408
- baseTooltip: JoyTooltip,
407
+ baseFormControl: JoyFormControl /* FIXME: typing error */,
408
+ baseTooltip: JoyTooltip /* FIXME: typing error */,
409
409
  pagination: Pagination,
410
410
  loadingOverlay: LoadingOverlay
411
411
  });
@@ -310,7 +310,7 @@ DataGridRaw.propTypes = {
310
310
  loading: PropTypes.bool,
311
311
  /**
312
312
  * Set the locale text of the Data Grid.
313
- * You can find all the translation keys supported in [the source](https://github.com/mui/mui-x/blob/HEAD/packages/grid/x-data-grid/src/constants/localeTextConstants.ts) in the GitHub repository.
313
+ * You can find all the translation keys supported in [the source](https://github.com/mui/mui-x/blob/HEAD/packages/x-data-grid/src/constants/localeTextConstants.ts) in the GitHub repository.
314
314
  */
315
315
  localeText: PropTypes.object,
316
316
  /**
@@ -74,7 +74,9 @@ export var DATA_GRID_PROPS_DEFAULT_VALUES = {
74
74
  };
75
75
  var defaultSlots = DATA_GRID_DEFAULT_SLOTS_COMPONENTS;
76
76
  export var useDataGridProps = function useDataGridProps(inProps) {
77
- var themedProps = useProps(useThemeProps({
77
+ var themedProps = useProps(
78
+ // eslint-disable-next-line material-ui/mui-name-matches-component-name
79
+ useThemeProps({
78
80
  props: inProps,
79
81
  name: 'MuiDataGrid'
80
82
  }));
@@ -21,6 +21,9 @@ var GridPaginationRoot = styled(TablePagination)(function (_ref) {
21
21
  display: 'inline-flex'
22
22
  }));
23
23
  });
24
+
25
+ // A mutable version of a readonly array.
26
+
24
27
  export var GridPagination = /*#__PURE__*/React.forwardRef(function GridPagination(props, ref) {
25
28
  var apiRef = useGridApiContext();
26
29
  var rootProps = useGridRootProps();
@@ -31,7 +34,8 @@ export var GridPagination = /*#__PURE__*/React.forwardRef(function GridPaginatio
31
34
  return (_ref3 = (_rootProps$rowCount = rootProps.rowCount) != null ? _rootProps$rowCount : visibleTopLevelRowCount) != null ? _ref3 : 0;
32
35
  }, [rootProps.rowCount, visibleTopLevelRowCount]);
33
36
  var lastPage = React.useMemo(function () {
34
- return Math.floor(rowCount / (paginationModel.pageSize || 1));
37
+ var calculatedValue = Math.ceil(rowCount / (paginationModel.pageSize || 1)) - 1;
38
+ return Math.max(0, calculatedValue);
35
39
  }, [rowCount, paginationModel.pageSize]);
36
40
  var handlePageSizeChange = React.useCallback(function (event) {
37
41
  var pageSize = Number(event.target.value);
@@ -68,7 +72,11 @@ export var GridPagination = /*#__PURE__*/React.forwardRef(function GridPaginatio
68
72
  ref: ref,
69
73
  component: "div",
70
74
  count: rowCount,
71
- page: paginationModel.page <= lastPage ? paginationModel.page : lastPage,
75
+ page: paginationModel.page <= lastPage ? paginationModel.page : lastPage
76
+ // TODO: Remove the cast once the type is fixed in Material UI and that the min Material UI version
77
+ // for x-data-grid is past the fix.
78
+ // Note that Material UI will not mutate the array, so this is safe.
79
+ ,
72
80
  rowsPerPageOptions: pageSizeOptions,
73
81
  rowsPerPage: paginationModel.pageSize,
74
82
  onPageChange: handlePageChange,
@@ -37,9 +37,7 @@ var useUtilityClasses = function useUtilityClasses(ownerState) {
37
37
  rowHeight = ownerState.rowHeight,
38
38
  classes = ownerState.classes;
39
39
  var 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
  };
@@ -273,13 +271,14 @@ var GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
273
271
  break;
274
272
  }
275
273
  if ((rowNode == null ? void 0 : rowNode.type) === 'skeletonRow') {
274
+ var _column$align;
276
275
  var _width = cellColSpanInfo.cellProps.width;
277
276
  var contentWidth = Math.round(randomNumber());
278
277
  return /*#__PURE__*/_jsx(slots.skeletonCell, {
279
278
  width: _width,
280
279
  contentWidth: contentWidth,
281
280
  field: column.field,
282
- align: column.align
281
+ align: (_column$align = column.align) != null ? _column$align : 'left'
283
282
  }, column.field);
284
283
  }
285
284
  var _cellColSpanInfo$cell = cellColSpanInfo.cellProps,
@@ -366,7 +365,10 @@ var GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
366
365
  "aria-selected": selected,
367
366
  style: style
368
367
  }, eventHandlers, other, {
369
- children: [leftCells, cells, emptyCellWidth > 0 && /*#__PURE__*/_jsx(EmptyCell, {
368
+ children: [leftCells, /*#__PURE__*/_jsx("div", {
369
+ className: gridClasses.cellOffsetLeft,
370
+ role: "presentation"
371
+ }), cells, emptyCellWidth > 0 && /*#__PURE__*/_jsx(EmptyCell, {
370
372
  width: emptyCellWidth
371
373
  }), rightCells.length > 0 && /*#__PURE__*/_jsx("div", {
372
374
  role: "presentation",
@@ -10,7 +10,7 @@ var classes = {
10
10
  borderTop: getClassName('scrollbarFiller--borderTop'),
11
11
  pinnedRight: getClassName('scrollbarFiller--pinnedRight')
12
12
  };
13
- var Style = styled('div')(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
13
+ var Style = styled('div')(_defineProperty(_defineProperty(_defineProperty({
14
14
  minWidth: 'calc(var(--DataGrid-hasScrollY) * var(--DataGrid-scrollbarSize))',
15
15
  alignSelf: 'stretch'
16
16
  }, "&.".concat(classes.borderTop), {
@@ -20,8 +20,6 @@ var Style = styled('div')(_defineProperty(_defineProperty(_defineProperty(_defin
20
20
  }), "&.".concat(classes.pinnedRight, ":not(.").concat(classes.header, ")"), {
21
21
  position: 'sticky',
22
22
  right: 0
23
- }), "&:not(.".concat(classes.header, "):not(.").concat(classes.pinnedRight, ")"), {
24
- transform: 'translate3d(var(--DataGrid-offsetLeft), 0, 0)'
25
23
  }));
26
24
  function GridScrollbarFillerCell(_ref) {
27
25
  var header = _ref.header,
@@ -8,5 +8,5 @@ export function GridFooterPlaceholder() {
8
8
  if (rootProps.hideFooter) {
9
9
  return null;
10
10
  }
11
- return /*#__PURE__*/_jsx(rootProps.slots.footer, _extends({}, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.footer));
11
+ return /*#__PURE__*/_jsx(rootProps.slots.footer, _extends({}, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.footer /* FIXME: typing error */));
12
12
  }
@@ -169,7 +169,7 @@ function GridActionsCell(props) {
169
169
  if (event.key === 'Tab') {
170
170
  event.preventDefault();
171
171
  }
172
- if (['Tab', 'Enter', 'Escape'].includes(event.key)) {
172
+ if (['Tab', 'Escape'].includes(event.key)) {
173
173
  hideMenu();
174
174
  }
175
175
  };
@@ -208,7 +208,6 @@ function GridActionsCell(props) {
208
208
  target: buttonRef.current,
209
209
  position: position,
210
210
  onClose: hideMenu,
211
- onClick: hideMenu,
212
211
  children: /*#__PURE__*/_jsx(MenuList, {
213
212
  id: menuId,
214
213
  className: gridClasses.menuList,
@@ -218,7 +217,8 @@ function GridActionsCell(props) {
218
217
  autoFocusItem: true,
219
218
  children: menuButtons.map(function (button, index) {
220
219
  return /*#__PURE__*/React.cloneElement(button, {
221
- key: index
220
+ key: index,
221
+ closeMenu: hideMenu
222
222
  });
223
223
  })
224
224
  })
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["label", "icon", "showInMenu", "onClick"];
3
+ var _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,36 +10,48 @@ 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
  var GridActionsCellItem = /*#__PURE__*/React.forwardRef(function (props, ref) {
12
- var label = props.label,
13
- icon = props.icon,
14
- showInMenu = props.showInMenu,
15
- onClick = props.onClick,
16
- other = _objectWithoutProperties(props, _excluded);
17
13
  var rootProps = useGridRootProps();
18
- var handleClick = function handleClick(event) {
19
- if (onClick) {
20
- onClick(event);
21
- }
22
- };
23
- if (!showInMenu) {
14
+ if (!props.showInMenu) {
24
15
  var _rootProps$slotProps;
16
+ var _label = props.label,
17
+ _icon = props.icon,
18
+ _showInMenu = props.showInMenu,
19
+ _onClick = props.onClick,
20
+ _other = _objectWithoutProperties(props, _excluded);
21
+ var _handleClick = function _handleClick(event) {
22
+ _onClick == null || _onClick(event);
23
+ };
25
24
  return /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
26
25
  ref: ref,
27
26
  size: "small",
28
27
  role: "menuitem",
29
- "aria-label": label
30
- }, other, {
31
- onClick: handleClick
28
+ "aria-label": _label
29
+ }, _other, {
30
+ onClick: _handleClick
32
31
  }, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.baseIconButton, {
33
- children: /*#__PURE__*/React.cloneElement(icon, {
32
+ children: /*#__PURE__*/React.cloneElement(_icon, {
34
33
  fontSize: 'small'
35
34
  })
36
35
  }));
37
36
  }
37
+ var label = props.label,
38
+ icon = props.icon,
39
+ showInMenu = props.showInMenu,
40
+ onClick = props.onClick,
41
+ _props$closeMenuOnCli = props.closeMenuOnClick,
42
+ closeMenuOnClick = _props$closeMenuOnCli === void 0 ? true : _props$closeMenuOnCli,
43
+ closeMenu = props.closeMenu,
44
+ other = _objectWithoutProperties(props, _excluded2);
45
+ var handleClick = function handleClick(event) {
46
+ onClick == null || onClick(event);
47
+ if (closeMenuOnClick) {
48
+ closeMenu == null || closeMenu();
49
+ }
50
+ };
38
51
  return /*#__PURE__*/_jsxs(MenuItem, _extends({
39
52
  ref: ref
40
53
  }, other, {
41
- onClick: onClick,
54
+ onClick: handleClick,
42
55
  children: [icon && /*#__PURE__*/_jsx(ListItemIcon, {
43
56
  children: icon
44
57
  }), label]
@@ -88,7 +88,7 @@ var GridCellCheckboxForwardRef = /*#__PURE__*/React.forwardRef(function GridCell
88
88
  },
89
89
  onKeyDown: handleKeyDown,
90
90
  disabled: !isSelectable,
91
- touchRippleRef: rippleRef
91
+ touchRippleRef: rippleRef /* FIXME: typing error */
92
92
  }, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.baseCheckbox, other));
93
93
  });
94
94
  process.env.NODE_ENV !== "production" ? GridCellCheckboxForwardRef.propTypes = {
@@ -99,11 +99,15 @@ export var GridRootStyles = styled('div', {
99
99
  borderTopRightRadius: 'var(--unstable_DataGrid-radius)'
100
100
  }), "&.".concat(c.autoHeight), {
101
101
  height: 'auto'
102
- }), "&.".concat(c.autosizing), _defineProperty(_defineProperty({}, "& .".concat(c.columnHeaderTitleContainerContent, " > *"), {
102
+ }), "&.".concat(c.autosizing), _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "& .".concat(c.columnHeaderTitleContainerContent, " > *"), {
103
103
  overflow: 'visible !important'
104
104
  }), "& .".concat(c.cell, " > *"), {
105
105
  overflow: 'visible !important',
106
106
  whiteSpace: 'nowrap'
107
+ }), "& .".concat(c.groupingCriteriaCell), {
108
+ width: 'unset'
109
+ }), "& .".concat(c.treeDataGroupingCell), {
110
+ width: 'unset'
107
111
  })), "& .".concat(c.columnHeader, ", & .").concat(c.cell), {
108
112
  WebkitTapHighlightColor: 'transparent',
109
113
  lineHeight: null,
@@ -333,8 +337,10 @@ export var GridRootStyles = styled('div', {
333
337
  backgroundColor: pinnedSelectedBackground
334
338
  }), '&:hover', _defineProperty({}, "& .".concat(c['cell--pinnedLeft'], ", & .").concat(c['cell--pinnedRight']), {
335
339
  backgroundColor: pinnedSelectedHoverBackground
336
- })))), "& .".concat(c.cell, ":not(.").concat(c['cell--pinnedLeft'], "):not(.").concat(c['cell--pinnedRight'], ")"), {
337
- transform: 'translate3d(var(--DataGrid-offsetLeft), 0, 0)'
340
+ })))), "& .".concat(c.cellOffsetLeft), {
341
+ flex: '0 0 auto',
342
+ display: 'inline-block',
343
+ width: 'var(--DataGrid-offsetLeft)'
338
344
  }), "& .".concat(c.columnHeaderDraggableContainer), {
339
345
  display: 'flex',
340
346
  width: '100%',
@@ -71,7 +71,7 @@ function GridFilterInputBoolean(props) {
71
71
  ref: focusElementRef,
72
72
  tabIndex: tabIndex
73
73
  }
74
- }, others, baseSelectProps, {
74
+ }, others /* FIXME: typing error */, baseSelectProps, {
75
75
  children: [/*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
76
76
  native: isSelectNative,
77
77
  value: "",
@@ -107,7 +107,7 @@ function GridFilterInputSingleSelect(props) {
107
107
  placeholder: placeholder != null ? placeholder : apiRef.current.getLocaleText('filterPanelInputPlaceholder')
108
108
  },
109
109
  native: isSelectNative
110
- }, others, (_rootProps$slotProps3 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps3.baseSelect, {
110
+ }, others /* FIXME: typing error */, (_rootProps$slotProps3 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps3.baseSelect, {
111
111
  children: renderSingleSelectOptions({
112
112
  column: resolvedColumn,
113
113
  OptionComponent: rootProps.slots.baseSelectOption,
@@ -142,7 +142,7 @@ var GridFilterPanel = /*#__PURE__*/React.forwardRef(function GridFilterPanel(pro
142
142
  }
143
143
  return apiRef.current.setFilterModel(_extends({}, filterModel, {
144
144
  items: readOnlyFilters
145
- }));
145
+ }), 'removeAllFilterItems');
146
146
  }, [apiRef, readOnlyFilters, filterModel, validFilters]);
147
147
  React.useEffect(function () {
148
148
  if (logicOperators.length > 0 && filterModel.logicOperator && !logicOperators.includes(filterModel.logicOperator)) {
@@ -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 var 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 var 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']);
@@ -1,7 +1,7 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
3
  import { gridPinnedRowsSelector } from './gridRowsSelector';
4
- import { gridDimensionsSelector } from '../dimensions';
4
+ import { gridDimensionsSelector } from '../dimensions/gridDimensionsSelectors';
5
5
  export var GRID_ROOT_GROUP_ID = "auto-generated-group-node-root";
6
6
  export var GRID_ID_AUTOGENERATED = Symbol('mui.id_autogenerated');
7
7
  export var buildRootGroup = function buildRootGroup() {
@@ -124,7 +124,7 @@ export var useGridRows = function useGridRows(apiRef, props) {
124
124
  }, [logger, props.getRowId, props.loading, props.rowCount, throttledRowsChange, apiRef]);
125
125
  var updateRows = React.useCallback(function (updates) {
126
126
  if (props.signature === GridSignature.DataGrid && updates.length > 1) {
127
- 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'));
127
+ 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'));
128
128
  }
129
129
  var nonPinnedRowsUpdates = [];
130
130
  updates.forEach(function (update) {
@@ -263,7 +263,7 @@ export var useGridRows = function useGridRows(apiRef, props) {
263
263
  }, [apiRef, logger]);
264
264
  var replaceRows = React.useCallback(function (firstRowToRender, newRows) {
265
265
  if (props.signature === GridSignature.DataGrid && newRows.length > 1) {
266
- 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'));
266
+ 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'));
267
267
  }
268
268
  if (newRows.length === 0) {
269
269
  return;
@@ -51,7 +51,6 @@ export var useGridVirtualScroller = function useGridVirtualScroller() {
51
51
  var gridRootRef = apiRef.current.rootElementRef;
52
52
  var mainRef = apiRef.current.mainElementRef;
53
53
  var scrollerRef = apiRef.current.virtualScrollerRef;
54
- var renderZoneRef = React.useRef(null);
55
54
  var scrollbarVerticalRef = React.useRef(null);
56
55
  var scrollbarHorizontalRef = React.useRef(null);
57
56
  var contentHeight = dimensions.contentSize.height;
@@ -262,6 +261,14 @@ export var useGridVirtualScroller = function useGridVirtualScroller() {
262
261
  var _renderedRows$i = renderedRows[i],
263
262
  id = _renderedRows$i.id,
264
263
  model = _renderedRows$i.model;
264
+ var rowIndexInPage = ((currentPage == null || (_currentPage$range = currentPage.range) == null ? void 0 : _currentPage$range.firstRowIndex) || 0) + firstRowToRender + i;
265
+ var index = rowIndexOffset + rowIndexInPage;
266
+ if (isRowWithFocusedCellNotInRange && (cellFocus == null ? void 0 : cellFocus.id) === id) {
267
+ index = indexOfRowWithFocusedCell;
268
+ isRowWithFocusedCellRendered = true;
269
+ } else if (isRowWithFocusedCellRendered) {
270
+ index -= 1;
271
+ }
265
272
  var isRowNotVisible = isRowWithFocusedCellNotInRange && cellFocus.id === id;
266
273
  var baseRowHeight = !apiRef.current.rowHasAutoHeight(id) ? apiRef.current.unstable_getRowHeight(id) : 'auto';
267
274
  var isSelected = void 0;
@@ -272,7 +279,7 @@ export var useGridVirtualScroller = function useGridVirtualScroller() {
272
279
  }
273
280
  var isFirstVisible = false;
274
281
  if (params.position === undefined) {
275
- isFirstVisible = i === 0;
282
+ isFirstVisible = rowIndexInPage === 0;
276
283
  }
277
284
  var isLastVisible = false;
278
285
  if (isLastSection) {
@@ -294,13 +301,6 @@ export var useGridVirtualScroller = function useGridVirtualScroller() {
294
301
  var cellParams = apiRef.current.getCellParams(id, cellTabIndex.field);
295
302
  tabbableCell = cellParams.cellMode === 'view' ? cellTabIndex.field : null;
296
303
  }
297
- var index = rowIndexOffset + ((currentPage == null || (_currentPage$range = currentPage.range) == null ? void 0 : _currentPage$range.firstRowIndex) || 0) + firstRowToRender + i;
298
- if (isRowWithFocusedCellNotInRange && (cellFocus == null ? void 0 : cellFocus.id) === id) {
299
- index = indexOfRowWithFocusedCell;
300
- isRowWithFocusedCellRendered = true;
301
- } else if (isRowWithFocusedCellRendered) {
302
- index -= 1;
303
- }
304
304
  rows.push( /*#__PURE__*/_jsx(rootProps.slots.row, _extends({
305
305
  row: model,
306
306
  rowId: id,
@@ -414,7 +414,6 @@ export var useGridVirtualScroller = function useGridVirtualScroller() {
414
414
  },
415
415
  getRenderZoneProps: function getRenderZoneProps() {
416
416
  return {
417
- ref: renderZoneRef,
418
417
  role: 'rowgroup'
419
418
  };
420
419
  },
package/legacy/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v7.0.0-beta.1
2
+ * @mui/x-data-grid v7.0.0-beta.2
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -1,5 +1,5 @@
1
1
  export var propValidatorsDataGrid = [function (props) {
2
- return props.autoPageSize && props.autoHeight && ['MUI X: `<DataGrid autoPageSize={true} autoHeight={true} />` are not valid props.', 'You can not use both the `autoPageSize` and `autoHeight` props at the same time because `autoHeight` scales the height of the Data Grid according to the `pageSize`.', '', 'Please remove one of these two props.'].join('\n') || undefined;
2
+ return props.autoPageSize && props.autoHeight && ['MUI X: `<DataGrid autoPageSize={true} autoHeight={true} />` are not valid props.', 'You cannot use both the `autoPageSize` and `autoHeight` props at the same time because `autoHeight` scales the height of the Data Grid according to the `pageSize`.', '', 'Please remove one of these two props.'].join('\n') || undefined;
3
3
  }];
4
4
  var warnedOnceMap = new Set();
5
5
  var warnOnce = function warnOnce(message) {
@@ -412,8 +412,8 @@ var joySlots = _extends({}, joyIconSlots, {
412
412
  baseSelect: Select,
413
413
  baseSelectOption: Option,
414
414
  baseInputLabel: InputLabel,
415
- baseFormControl: JoyFormControl,
416
- baseTooltip: JoyTooltip,
415
+ baseFormControl: JoyFormControl /* FIXME: typing error */,
416
+ baseTooltip: JoyTooltip /* FIXME: typing error */,
417
417
  pagination: Pagination,
418
418
  loadingOverlay: LoadingOverlay
419
419
  });
@@ -11,8 +11,8 @@ var daDKGrid = {
11
11
  toolbarDensityStandard: 'Standard',
12
12
  toolbarDensityComfortable: 'Luftig',
13
13
  // Columns selector toolbar button text
14
- toolbarColumns: 'Kolonne',
15
- toolbarColumnsLabel: 'Vælg kolonne',
14
+ toolbarColumns: 'Kolonner',
15
+ toolbarColumnsLabel: 'Vælg kolonner',
16
16
  // Filters toolbar button text
17
17
  toolbarFilters: 'Filtre',
18
18
  toolbarFiltersLabel: 'Vis filtre',
@@ -41,12 +41,12 @@ var daDKGrid = {
41
41
  filterPanelRemoveAll: 'Fjern alle',
42
42
  filterPanelDeleteIconLabel: 'Slet',
43
43
  filterPanelLogicOperator: 'Logisk operator',
44
- filterPanelOperator: 'Operatorer',
44
+ filterPanelOperator: 'Operator',
45
45
  filterPanelOperatorAnd: 'Og',
46
46
  filterPanelOperatorOr: 'Eller',
47
- filterPanelColumns: 'Kolonne',
47
+ filterPanelColumns: 'Kolonner',
48
48
  filterPanelInputLabel: 'Værdi',
49
- filterPanelInputPlaceholder: 'Filter værdi',
49
+ filterPanelInputPlaceholder: 'Filterværdi',
50
50
  // Filter operators text
51
51
  filterOperatorContains: 'indeholder',
52
52
  filterOperatorEquals: 'lig med',
@@ -93,10 +93,10 @@ var daDKGrid = {
93
93
  filterValueFalse: 'negativ',
94
94
  // Column menu text
95
95
  columnMenuLabel: 'Menu',
96
- columnMenuShowColumns: 'Vis Kolonner',
96
+ columnMenuShowColumns: 'Vis kolonner',
97
97
  columnMenuManageColumns: 'Administrer kolonner',
98
- columnMenuFilter: 'Filtre',
99
- columnMenuHideColumn: 'Skjul',
98
+ columnMenuFilter: 'Filtrer',
99
+ columnMenuHideColumn: 'Skjul kolonne',
100
100
  columnMenuUnsort: 'Fjern sortering',
101
101
  columnMenuSortAsc: 'Sorter stigende',
102
102
  columnMenuSortDesc: 'Sorter faldende',
@@ -132,16 +132,16 @@ var daDKGrid = {
132
132
  pinToRight: 'Fastgør til højre',
133
133
  unpin: 'Frigiv',
134
134
  // Tree Data
135
- treeDataGroupingHeaderName: 'Gruppering',
135
+ treeDataGroupingHeaderName: 'Gruppe',
136
136
  treeDataExpand: 'Vis underelementer',
137
137
  treeDataCollapse: 'Skjul underelementer',
138
138
  // Grouping columns
139
- groupingColumnHeaderName: 'Gruppér',
139
+ groupingColumnHeaderName: 'Gruppe',
140
140
  groupColumn: function groupColumn(name) {
141
141
  return "Grupp\xE9r efter ".concat(name);
142
142
  },
143
143
  unGroupColumn: function unGroupColumn(name) {
144
- return "Fjern grupp\xE9ring efter ".concat(name);
144
+ return "Fjern gruppering efter ".concat(name);
145
145
  },
146
146
  // Master/detail
147
147
  detailPanelToggle: 'Udvid/kollaps detaljepanel',
@@ -150,7 +150,7 @@ var daDKGrid = {
150
150
  // Row reordering text
151
151
  rowReorderingHeaderName: 'Omarrangering af rækker',
152
152
  // Aggregation
153
- aggregationMenuItemHeader: 'Aggregation',
153
+ aggregationMenuItemHeader: 'Aggregering',
154
154
  aggregationFunctionLabelSum: 'sum',
155
155
  aggregationFunctionLabelAvg: 'gns',
156
156
  aggregationFunctionLabelMin: 'min',