@mui/x-data-grid 7.22.1 → 8.0.0-alpha.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 (129) hide show
  1. package/CHANGELOG.md +143 -92
  2. package/README.md +2 -2
  3. package/colDef/gridBooleanOperators.js +4 -6
  4. package/components/GridDetailPanels.js +0 -1
  5. package/components/GridPinnedRows.js +0 -1
  6. package/components/GridRow.d.ts +2 -2
  7. package/components/GridRow.js +3 -28
  8. package/components/base/GridOverlays.js +10 -8
  9. package/components/cell/GridActionsCell.js +1 -2
  10. package/components/cell/GridActionsCellItem.js +1 -2
  11. package/components/cell/GridCell.d.ts +41 -3
  12. package/components/cell/GridCell.js +1 -9
  13. package/components/cell/GridEditInputCell.js +0 -67
  14. package/components/containers/GridRootStyles.js +1 -0
  15. package/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.js +1 -2
  16. package/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.js +1 -2
  17. package/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.js +1 -2
  18. package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +3 -4
  19. package/components/panel/GridPanel.d.ts +1 -1
  20. package/components/panel/filterPanel/GridFilterInputBoolean.d.ts +1 -0
  21. package/components/panel/filterPanel/GridFilterInputBoolean.js +14 -5
  22. package/components/toolbar/GridToolbar.d.ts +2 -2
  23. package/components/toolbar/GridToolbar.js +12 -4
  24. package/components/toolbar/GridToolbarColumnsButton.js +1 -1
  25. package/components/toolbar/GridToolbarDensitySelector.js +2 -4
  26. package/components/toolbar/GridToolbarExport.d.ts +2 -2
  27. package/components/toolbar/GridToolbarExport.js +9 -6
  28. package/components/toolbar/GridToolbarExportContainer.js +1 -2
  29. package/components/toolbar/index.d.ts +1 -1
  30. package/components/virtualization/GridVirtualScrollbar.js +6 -0
  31. package/hooks/features/columnResize/useGridColumnResize.js +4 -2
  32. package/hooks/features/editing/useGridCellEditing.js +23 -4
  33. package/hooks/features/editing/useGridRowEditing.js +23 -2
  34. package/hooks/features/export/useGridCsvExport.js +1 -1
  35. package/hooks/features/export/useGridPrintExport.js +1 -1
  36. package/hooks/features/pagination/useGridPaginationModel.js +2 -2
  37. package/hooks/features/rowSelection/useGridRowSelection.d.ts +1 -1
  38. package/hooks/features/rowSelection/useGridRowSelection.js +30 -16
  39. package/hooks/features/rows/gridRowsUtils.d.ts +1 -1
  40. package/hooks/features/rows/gridRowsUtils.js +1 -5
  41. package/hooks/features/virtualization/useGridVirtualScroller.js +4 -4
  42. package/hooks/utils/useGridSelector.d.ts +3 -2
  43. package/hooks/utils/useGridSelector.js +27 -2
  44. package/index.d.ts +0 -1
  45. package/index.js +1 -1
  46. package/locales/plPL.js +25 -28
  47. package/locales/trTR.js +2 -2
  48. package/material/index.js +4 -0
  49. package/models/gridSlotsComponent.d.ts +10 -0
  50. package/models/gridSlotsComponentsProps.d.ts +8 -0
  51. package/models/props/DataGridProps.d.ts +1 -1
  52. package/modern/colDef/gridBooleanOperators.js +4 -6
  53. package/modern/components/GridDetailPanels.js +0 -1
  54. package/modern/components/GridPinnedRows.js +0 -1
  55. package/modern/components/GridRow.js +3 -28
  56. package/modern/components/base/GridOverlays.js +10 -8
  57. package/modern/components/cell/GridActionsCell.js +1 -2
  58. package/modern/components/cell/GridActionsCellItem.js +1 -2
  59. package/modern/components/cell/GridCell.js +1 -9
  60. package/modern/components/cell/GridEditInputCell.js +0 -67
  61. package/modern/components/containers/GridRootStyles.js +1 -0
  62. package/modern/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.js +1 -2
  63. package/modern/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.js +1 -2
  64. package/modern/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.js +1 -2
  65. package/modern/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +3 -4
  66. package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +14 -5
  67. package/modern/components/toolbar/GridToolbar.js +12 -4
  68. package/modern/components/toolbar/GridToolbarColumnsButton.js +1 -1
  69. package/modern/components/toolbar/GridToolbarDensitySelector.js +2 -4
  70. package/modern/components/toolbar/GridToolbarExport.js +9 -6
  71. package/modern/components/toolbar/GridToolbarExportContainer.js +1 -2
  72. package/modern/components/virtualization/GridVirtualScrollbar.js +6 -0
  73. package/modern/hooks/features/columnResize/useGridColumnResize.js +4 -2
  74. package/modern/hooks/features/editing/useGridCellEditing.js +23 -4
  75. package/modern/hooks/features/editing/useGridRowEditing.js +23 -2
  76. package/modern/hooks/features/export/useGridCsvExport.js +1 -1
  77. package/modern/hooks/features/export/useGridPrintExport.js +1 -1
  78. package/modern/hooks/features/pagination/useGridPaginationModel.js +2 -2
  79. package/modern/hooks/features/rowSelection/useGridRowSelection.js +30 -16
  80. package/modern/hooks/features/rows/gridRowsUtils.js +1 -5
  81. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +4 -4
  82. package/modern/hooks/utils/useGridSelector.js +27 -2
  83. package/modern/index.js +1 -1
  84. package/modern/locales/plPL.js +25 -28
  85. package/modern/locales/trTR.js +2 -2
  86. package/modern/material/index.js +4 -0
  87. package/modern/utils/createSelector.js +11 -1
  88. package/modern/utils/utils.js +1 -3
  89. package/node/colDef/gridBooleanOperators.js +3 -5
  90. package/node/components/GridDetailPanels.js +0 -1
  91. package/node/components/GridPinnedRows.js +0 -1
  92. package/node/components/GridRow.js +3 -28
  93. package/node/components/base/GridOverlays.js +10 -8
  94. package/node/components/cell/GridActionsCell.js +1 -2
  95. package/node/components/cell/GridActionsCellItem.js +1 -2
  96. package/node/components/cell/GridCell.js +1 -9
  97. package/node/components/cell/GridEditInputCell.js +0 -67
  98. package/node/components/containers/GridRootStyles.js +1 -0
  99. package/node/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.js +1 -2
  100. package/node/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.js +1 -2
  101. package/node/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.js +1 -2
  102. package/node/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +3 -4
  103. package/node/components/panel/filterPanel/GridFilterInputBoolean.js +16 -5
  104. package/node/components/toolbar/GridToolbar.js +12 -4
  105. package/node/components/toolbar/GridToolbarColumnsButton.js +3 -3
  106. package/node/components/toolbar/GridToolbarDensitySelector.js +2 -4
  107. package/node/components/toolbar/GridToolbarExport.js +9 -6
  108. package/node/components/toolbar/GridToolbarExportContainer.js +1 -2
  109. package/node/components/virtualization/GridVirtualScrollbar.js +6 -0
  110. package/node/hooks/features/columnResize/useGridColumnResize.js +4 -2
  111. package/node/hooks/features/editing/useGridCellEditing.js +23 -4
  112. package/node/hooks/features/editing/useGridRowEditing.js +23 -2
  113. package/node/hooks/features/export/useGridCsvExport.js +2 -2
  114. package/node/hooks/features/export/useGridPrintExport.js +2 -2
  115. package/node/hooks/features/pagination/useGridPaginationModel.js +2 -2
  116. package/node/hooks/features/rowSelection/useGridRowSelection.js +29 -15
  117. package/node/hooks/features/rows/gridRowsUtils.js +2 -8
  118. package/node/hooks/features/virtualization/useGridVirtualScroller.js +4 -4
  119. package/node/hooks/utils/useGridSelector.js +29 -3
  120. package/node/index.js +1 -1
  121. package/node/locales/plPL.js +25 -28
  122. package/node/locales/trTR.js +2 -2
  123. package/node/material/index.js +4 -0
  124. package/node/utils/createSelector.js +11 -1
  125. package/node/utils/utils.js +1 -3
  126. package/package.json +3 -3
  127. package/utils/createSelector.d.ts +1 -1
  128. package/utils/createSelector.js +11 -1
  129. package/utils/utils.js +1 -3
@@ -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", "pinnedColumns", "offsetTop", "offsetLeft", "dimensions", "renderContext", "focusedColumnIndex", "isFirstVisible", "isLastVisible", "isNotVisible", "showBottomBorder", "focusedCell", "tabbableCell", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave", "onMouseOut", "onMouseOver"];
3
+ const _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "pinnedColumns", "offsetTop", "offsetLeft", "dimensions", "renderContext", "focusedColumnIndex", "isFirstVisible", "isLastVisible", "isNotVisible", "showBottomBorder", "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';
@@ -26,27 +26,6 @@ import { getPinnedCellOffset } from "../internals/utils/getPinnedCellOffset.js";
26
26
  import { useGridConfiguration } from "../hooks/utils/useGridConfiguration.js";
27
27
  import { useGridPrivateApiContext } from "../hooks/utils/useGridPrivateApiContext.js";
28
28
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
29
- function EmptyCell({
30
- width
31
- }) {
32
- if (!width) {
33
- return null;
34
- }
35
- return /*#__PURE__*/_jsx("div", {
36
- role: "presentation",
37
- className: clsx(gridClasses.cell, gridClasses.cellEmpty),
38
- style: {
39
- '--width': `${width}px`
40
- }
41
- });
42
- }
43
- process.env.NODE_ENV !== "production" ? EmptyCell.propTypes = {
44
- // ----------------------------- Warning --------------------------------
45
- // | These PropTypes are generated from the TypeScript type definitions |
46
- // | To update them edit the TypeScript types and run "pnpm proptypes" |
47
- // ----------------------------------------------------------------------
48
- width: PropTypes.number.isRequired
49
- } : void 0;
50
29
  const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
51
30
  const {
52
31
  selected,
@@ -289,8 +268,6 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
289
268
  onMouseOut: publish('rowMouseOut', onMouseOut),
290
269
  onMouseOver: publish('rowMouseOver', onMouseOver)
291
270
  } : null;
292
- const expandedWidth = dimensions.viewportOuterSize.width - dimensions.columnsTotalWidth - scrollbarWidth;
293
- const emptyCellWidth = Math.max(0, expandedWidth);
294
271
  return /*#__PURE__*/_jsxs("div", _extends({
295
272
  ref: handleRef,
296
273
  "data-id": rowId,
@@ -305,11 +282,9 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
305
282
  style: {
306
283
  width: offsetLeft
307
284
  }
308
- }), cells, emptyCellWidth > 0 && /*#__PURE__*/_jsx(EmptyCell, {
309
- width: emptyCellWidth
310
- }), rightCells.length > 0 && /*#__PURE__*/_jsx("div", {
285
+ }), cells, /*#__PURE__*/_jsx("div", {
311
286
  role: "presentation",
312
- className: gridClasses.filler
287
+ className: clsx(gridClasses.cell, gridClasses.cellEmpty)
313
288
  }), rightCells, scrollbarWidth !== 0 && /*#__PURE__*/_jsx(ScrollbarFiller, {
314
289
  pinnedRight: pinnedColumns.right.length > 0
315
290
  })]
@@ -4,29 +4,31 @@ import PropTypes from 'prop-types';
4
4
  import { styled } from '@mui/system';
5
5
  import composeClasses from '@mui/utils/composeClasses';
6
6
  import clsx from 'clsx';
7
+ import { minimalContentHeight } from "../../hooks/features/rows/gridRowsUtils.js";
7
8
  import { useGridSelector } from "../../hooks/utils/useGridSelector.js";
8
9
  import { gridDimensionsSelector } from "../../hooks/features/dimensions/index.js";
9
10
  import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
10
11
  import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
11
- import { useGridVisibleRows } from "../../hooks/utils/useGridVisibleRows.js";
12
- import { getMinimalContentHeight } from "../../hooks/features/rows/gridRowsUtils.js";
13
12
  import { getDataGridUtilityClass } from "../../constants/gridClasses.js";
14
13
  import { jsx as _jsx } from "react/jsx-runtime";
15
14
  const GridOverlayWrapperRoot = styled('div', {
16
15
  name: 'MuiDataGrid',
17
16
  slot: 'OverlayWrapper',
18
- shouldForwardProp: prop => prop !== 'overlayType' && prop !== 'loadingOverlayVariant',
17
+ shouldForwardProp: prop => prop !== 'overlayType' && prop !== 'loadingOverlayVariant' && prop !== 'right',
19
18
  overridesResolver: (props, styles) => styles.overlayWrapper
20
19
  })(({
21
20
  overlayType,
22
- loadingOverlayVariant
21
+ loadingOverlayVariant,
22
+ right
23
23
  }) =>
24
24
  // Skeleton overlay should flow with the scroll container and not be sticky
25
25
  loadingOverlayVariant !== 'skeleton' ? {
26
26
  position: 'sticky',
27
27
  // To stay in place while scrolling
28
28
  top: 'var(--DataGrid-headersTotalHeight)',
29
+ // TODO: take pinned rows into account
29
30
  left: 0,
31
+ right: `${right}px`,
30
32
  width: 0,
31
33
  // To stay above the content instead of shifting it down
32
34
  height: 0,
@@ -53,11 +55,10 @@ const useUtilityClasses = ownerState => {
53
55
  function GridOverlayWrapper(props) {
54
56
  const apiRef = useGridApiContext();
55
57
  const rootProps = useGridRootProps();
56
- const currentPage = useGridVisibleRows(apiRef, rootProps);
57
58
  const dimensions = useGridSelector(apiRef, gridDimensionsSelector);
58
- let height = dimensions.viewportOuterSize.height - dimensions.topContainerHeight - dimensions.bottomContainerHeight - (dimensions.hasScrollX ? dimensions.scrollbarSize : 0);
59
- if (rootProps.autoHeight && currentPage.rows.length === 0 || height === 0) {
60
- height = getMinimalContentHeight(apiRef);
59
+ let height = Math.max(dimensions.viewportOuterSize.height - dimensions.topContainerHeight - dimensions.bottomContainerHeight - (dimensions.hasScrollX ? dimensions.scrollbarSize : 0), 0);
60
+ if (height === 0) {
61
+ height = minimalContentHeight;
61
62
  }
62
63
  const classes = useUtilityClasses(_extends({}, props, {
63
64
  classes: rootProps.classes
@@ -65,6 +66,7 @@ function GridOverlayWrapper(props) {
65
66
  return /*#__PURE__*/_jsx(GridOverlayWrapperRoot, _extends({
66
67
  className: clsx(classes.root)
67
68
  }, props, {
69
+ right: dimensions.columnsTotalWidth - dimensions.viewportOuterSize.width,
68
70
  children: /*#__PURE__*/_jsx(GridOverlayWrapperInner, _extends({
69
71
  className: clsx(classes.inner),
70
72
  style: {
@@ -3,7 +3,6 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
3
3
  const _excluded = ["api", "colDef", "id", "hasFocus", "isEditable", "field", "value", "formattedValue", "row", "rowNode", "cellMode", "tabIndex", "position", "focusElementRef"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
- import MenuList from '@mui/material/MenuList';
7
6
  import { useRtl } from '@mui/system/RtlProvider';
8
7
  import { unstable_useId as useId } from '@mui/utils';
9
8
  import { gridClasses } from "../../constants/gridClasses.js";
@@ -172,7 +171,7 @@ function GridActionsCell(props) {
172
171
  target: buttonRef.current,
173
172
  position: position,
174
173
  onClose: hideMenu,
175
- children: /*#__PURE__*/_jsx(MenuList, {
174
+ children: /*#__PURE__*/_jsx(rootProps.slots.baseMenuList, {
176
175
  id: menuId,
177
176
  className: gridClasses.menuList,
178
177
  onKeyDown: handleListKeyDown,
@@ -4,7 +4,6 @@ const _excluded = ["label", "icon", "showInMenu", "onClick"],
4
4
  _excluded2 = ["label", "icon", "showInMenu", "onClick", "closeMenuOnClick", "closeMenu"];
5
5
  import * as React from 'react';
6
6
  import PropTypes from 'prop-types';
7
- import MenuItem from '@mui/material/MenuItem';
8
7
  import ListItemIcon from '@mui/material/ListItemIcon';
9
8
  import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
10
9
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -47,7 +46,7 @@ const GridActionsCellItem = /*#__PURE__*/React.forwardRef((props, ref) => {
47
46
  closeMenu?.();
48
47
  }
49
48
  };
50
- return /*#__PURE__*/_jsxs(MenuItem, _extends({
49
+ return /*#__PURE__*/_jsxs(rootProps.slots.baseMenuItem, _extends({
51
50
  ref: ref
52
51
  }, other, {
53
52
  onClick: handleClick,
@@ -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 = ["column", "rowId", "editCellState", "align", "children", "colIndex", "width", "className", "style", "gridHasScrollX", "colSpan", "disableDragEvents", "isNotVisible", "pinnedOffset", "pinnedPosition", "sectionIndex", "sectionLength", "gridHasFiller", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onMouseOver", "onKeyDown", "onKeyUp", "onDragEnter", "onDragOver"],
3
+ const _excluded = ["column", "rowId", "editCellState", "align", "children", "colIndex", "width", "className", "style", "colSpan", "disableDragEvents", "isNotVisible", "pinnedOffset", "pinnedPosition", "sectionIndex", "sectionLength", "gridHasFiller", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onMouseOver", "onKeyDown", "onKeyUp", "onDragEnter", "onDragOver"],
4
4
  _excluded2 = ["changeReason", "unstable_updateValueOnRender"];
5
5
  import * as React from 'react';
6
6
  import PropTypes from 'prop-types';
@@ -342,7 +342,6 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
342
342
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
343
343
  // ----------------------------------------------------------------------
344
344
  align: PropTypes.oneOf(['center', 'left', 'right']).isRequired,
345
- className: PropTypes.string,
346
345
  colIndex: PropTypes.number.isRequired,
347
346
  colSpan: PropTypes.number,
348
347
  column: PropTypes.object.isRequired,
@@ -355,13 +354,6 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
355
354
  }),
356
355
  gridHasFiller: PropTypes.bool.isRequired,
357
356
  isNotVisible: PropTypes.bool.isRequired,
358
- onClick: PropTypes.func,
359
- onDoubleClick: PropTypes.func,
360
- onDragEnter: PropTypes.func,
361
- onDragOver: PropTypes.func,
362
- onKeyDown: PropTypes.func,
363
- onMouseDown: PropTypes.func,
364
- onMouseUp: PropTypes.func,
365
357
  pinnedOffset: PropTypes.number.isRequired,
366
358
  pinnedPosition: PropTypes.oneOf([0, 1, 2, 3]).isRequired,
367
359
  rowId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
@@ -2,7 +2,6 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
3
  const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "hasFocus", "isValidating", "debounceMs", "isProcessingProps", "onValueChange"];
4
4
  import * as React from 'react';
5
- import PropTypes from 'prop-types';
6
5
  import { unstable_composeClasses as composeClasses, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
7
6
  import { styled } from '@mui/material/styles';
8
7
  import InputBase from '@mui/material/InputBase';
@@ -94,71 +93,5 @@ const GridEditInputCell = /*#__PURE__*/React.forwardRef((props, ref) => {
94
93
  }) : undefined
95
94
  }, other));
96
95
  });
97
- process.env.NODE_ENV !== "production" ? GridEditInputCell.propTypes = {
98
- // ----------------------------- Warning --------------------------------
99
- // | These PropTypes are generated from the TypeScript type definitions |
100
- // | To update them edit the TypeScript types and run "pnpm proptypes" |
101
- // ----------------------------------------------------------------------
102
- /**
103
- * GridApi that let you manipulate the grid.
104
- */
105
- api: PropTypes.object.isRequired,
106
- /**
107
- * The mode of the cell.
108
- */
109
- cellMode: PropTypes.oneOf(['edit', 'view']).isRequired,
110
- changeReason: PropTypes.oneOf(['debouncedSetEditCellValue', 'setEditCellValue']),
111
- /**
112
- * The column of the row that the current cell belongs to.
113
- */
114
- colDef: PropTypes.object.isRequired,
115
- debounceMs: PropTypes.number,
116
- /**
117
- * The column field of the cell that triggered the event.
118
- */
119
- field: PropTypes.string.isRequired,
120
- /**
121
- * The cell value formatted with the column valueFormatter.
122
- */
123
- formattedValue: PropTypes.any,
124
- /**
125
- * If true, the cell is the active element.
126
- */
127
- hasFocus: PropTypes.bool.isRequired,
128
- /**
129
- * The grid row id.
130
- */
131
- id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
132
- /**
133
- * If true, the cell is editable.
134
- */
135
- isEditable: PropTypes.bool,
136
- isProcessingProps: PropTypes.bool,
137
- isValidating: PropTypes.bool,
138
- /**
139
- * Callback called when the value is changed by the user.
140
- * @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
141
- * @param {Date | null} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
142
- * @returns {Promise<void> | void} A promise to be awaited before calling `apiRef.current.setEditCellValue`
143
- */
144
- onValueChange: PropTypes.func,
145
- /**
146
- * The row model of the row that the current cell belongs to.
147
- */
148
- row: PropTypes.any.isRequired,
149
- /**
150
- * The node of the row that the current cell belongs to.
151
- */
152
- rowNode: PropTypes.object.isRequired,
153
- /**
154
- * the tabIndex value.
155
- */
156
- tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
157
- /**
158
- * The cell value.
159
- * If the column has `valueGetter`, use `params.row` to directly access the fields.
160
- */
161
- value: PropTypes.any
162
- } : void 0;
163
96
  export { GridEditInputCell };
164
97
  export const renderEditInputCell = params => /*#__PURE__*/_jsx(GridEditInputCell, _extends({}, params));
@@ -544,6 +544,7 @@ export const GridRootStyles = styled('div', {
544
544
  lineHeight: 'inherit'
545
545
  },
546
546
  [`& .${c.cellEmpty}`]: {
547
+ flex: 1,
547
548
  padding: 0,
548
549
  height: 'unset'
549
550
  },
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import MenuItem from '@mui/material/MenuItem';
4
3
  import ListItemIcon from '@mui/material/ListItemIcon';
5
4
  import ListItemText from '@mui/material/ListItemText';
6
5
  import { useGridApiContext } from "../../../../hooks/utils/useGridApiContext.js";
@@ -20,7 +19,7 @@ function GridColumnMenuFilterItem(props) {
20
19
  if (rootProps.disableColumnFilter || !colDef.filterable) {
21
20
  return null;
22
21
  }
23
- return /*#__PURE__*/_jsxs(MenuItem, {
22
+ return /*#__PURE__*/_jsxs(rootProps.slots.baseMenuItem, {
24
23
  onClick: showFilter,
25
24
  children: [/*#__PURE__*/_jsx(ListItemIcon, {
26
25
  children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuFilterIcon, {
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import MenuItem from '@mui/material/MenuItem';
4
3
  import ListItemIcon from '@mui/material/ListItemIcon';
5
4
  import ListItemText from '@mui/material/ListItemText';
6
5
  import { useGridApiContext } from "../../../../hooks/utils/useGridApiContext.js";
@@ -36,7 +35,7 @@ function GridColumnMenuHideItem(props) {
36
35
  if (colDef.hideable === false) {
37
36
  return null;
38
37
  }
39
- return /*#__PURE__*/_jsxs(MenuItem, {
38
+ return /*#__PURE__*/_jsxs(rootProps.slots.baseMenuItem, {
40
39
  onClick: toggleColumn,
41
40
  disabled: disabled,
42
41
  children: [/*#__PURE__*/_jsx(ListItemIcon, {
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import MenuItem from '@mui/material/MenuItem';
4
3
  import ListItemIcon from '@mui/material/ListItemIcon';
5
4
  import ListItemText from '@mui/material/ListItemText';
6
5
  import { GridPreferencePanelsValue } from "../../../../hooks/features/preferencesPanel/gridPreferencePanelsValue.js";
@@ -20,7 +19,7 @@ function GridColumnMenuManageItem(props) {
20
19
  if (rootProps.disableColumnSelector) {
21
20
  return null;
22
21
  }
23
- return /*#__PURE__*/_jsxs(MenuItem, {
22
+ return /*#__PURE__*/_jsxs(rootProps.slots.baseMenuItem, {
24
23
  onClick: showColumns,
25
24
  children: [/*#__PURE__*/_jsx(ListItemIcon, {
26
25
  children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuManageColumnsIcon, {
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import MenuItem from '@mui/material/MenuItem';
4
3
  import ListItemIcon from '@mui/material/ListItemIcon';
5
4
  import ListItemText from '@mui/material/ListItemText';
6
5
  import { useGridSelector } from "../../../../hooks/utils/useGridSelector.js";
@@ -37,7 +36,7 @@ function GridColumnMenuSortItem(props) {
37
36
  return typeof label === 'function' ? label(colDef) : label;
38
37
  };
39
38
  return /*#__PURE__*/_jsxs(React.Fragment, {
40
- children: [sortingOrder.includes('asc') && sortDirection !== 'asc' ? /*#__PURE__*/_jsxs(MenuItem, {
39
+ children: [sortingOrder.includes('asc') && sortDirection !== 'asc' ? /*#__PURE__*/_jsxs(rootProps.slots.baseMenuItem, {
41
40
  onClick: onSortMenuItemClick,
42
41
  "data-value": "asc",
43
42
  children: [/*#__PURE__*/_jsx(ListItemIcon, {
@@ -47,7 +46,7 @@ function GridColumnMenuSortItem(props) {
47
46
  }), /*#__PURE__*/_jsx(ListItemText, {
48
47
  children: getLabel('columnMenuSortAsc')
49
48
  })]
50
- }) : null, sortingOrder.includes('desc') && sortDirection !== 'desc' ? /*#__PURE__*/_jsxs(MenuItem, {
49
+ }) : null, sortingOrder.includes('desc') && sortDirection !== 'desc' ? /*#__PURE__*/_jsxs(rootProps.slots.baseMenuItem, {
51
50
  onClick: onSortMenuItemClick,
52
51
  "data-value": "desc",
53
52
  children: [/*#__PURE__*/_jsx(ListItemIcon, {
@@ -57,7 +56,7 @@ function GridColumnMenuSortItem(props) {
57
56
  }), /*#__PURE__*/_jsx(ListItemText, {
58
57
  children: getLabel('columnMenuSortDesc')
59
58
  })]
60
- }) : null, sortingOrder.includes(null) && sortDirection != null ? /*#__PURE__*/_jsxs(MenuItem, {
59
+ }) : null, sortingOrder.includes(null) && sortDirection != null ? /*#__PURE__*/_jsxs(rootProps.slots.baseMenuItem, {
61
60
  onClick: onSortMenuItemClick,
62
61
  children: [/*#__PURE__*/_jsx(ListItemIcon, {}), /*#__PURE__*/_jsx(ListItemText, {
63
62
  children: apiRef.current.getLocaleText('columnMenuUnsort')
@@ -7,6 +7,15 @@ import { refType, unstable_useId as useId } from '@mui/utils';
7
7
  import { styled } from '@mui/material/styles';
8
8
  import { useGridRootProps } from "../../../hooks/utils/useGridRootProps.js";
9
9
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
+ export const sanitizeFilterItemValue = value => {
11
+ if (String(value).toLowerCase() === 'true') {
12
+ return true;
13
+ }
14
+ if (String(value).toLowerCase() === 'false') {
15
+ return false;
16
+ }
17
+ return undefined;
18
+ };
10
19
  const BooleanOperatorContainer = styled('div')({
11
20
  display: 'flex',
12
21
  alignItems: 'center',
@@ -27,7 +36,7 @@ function GridFilterInputBoolean(props) {
27
36
  variant = 'standard'
28
37
  } = props,
29
38
  others = _objectWithoutPropertiesLoose(props, _excluded);
30
- const [filterValueState, setFilterValueState] = React.useState(item.value || '');
39
+ const [filterValueState, setFilterValueState] = React.useState(sanitizeFilterItemValue(item.value));
31
40
  const rootProps = useGridRootProps();
32
41
  const labelId = useId();
33
42
  const selectId = useId();
@@ -35,14 +44,14 @@ function GridFilterInputBoolean(props) {
35
44
  const isSelectNative = baseSelectProps.native ?? false;
36
45
  const baseSelectOptionProps = rootProps.slotProps?.baseSelectOption || {};
37
46
  const onFilterChange = React.useCallback(event => {
38
- const value = event.target.value;
47
+ const value = sanitizeFilterItemValue(event.target.value);
39
48
  setFilterValueState(value);
40
49
  applyValue(_extends({}, item, {
41
- value: Boolean(value)
50
+ value
42
51
  }));
43
52
  }, [applyValue, item]);
44
53
  React.useEffect(() => {
45
- setFilterValueState(item.value || '');
54
+ setFilterValueState(sanitizeFilterItemValue(item.value));
46
55
  }, [item.value]);
47
56
  const label = labelProp ?? apiRef.current.getLocaleText('filterPanelInputLabel');
48
57
  return /*#__PURE__*/_jsxs(BooleanOperatorContainer, {
@@ -57,7 +66,7 @@ function GridFilterInputBoolean(props) {
57
66
  labelId: labelId,
58
67
  id: selectId,
59
68
  label: label,
60
- value: filterValueState,
69
+ value: filterValueState === undefined ? '' : String(filterValueState),
61
70
  onChange: onFilterChange,
62
71
  variant: variant,
63
72
  notched: variant === 'outlined' ? true : undefined,
@@ -14,14 +14,15 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  const GridToolbar = /*#__PURE__*/React.forwardRef(function GridToolbar(props, ref) {
15
15
  // TODO v7: think about where export option should be passed.
16
16
  // from slotProps={{ toolbarExport: { ...exportOption } }} seems to be more appropriate
17
- const {
17
+ const _ref = props,
18
+ {
18
19
  csvOptions,
19
20
  printOptions,
20
21
  excelOptions,
21
22
  showQuickFilter = false,
22
23
  quickFilterProps = {}
23
- } = props,
24
- other = _objectWithoutPropertiesLoose(props, _excluded);
24
+ } = _ref,
25
+ other = _objectWithoutPropertiesLoose(_ref, _excluded);
25
26
  const rootProps = useGridRootProps();
26
27
  if (rootProps.disableColumnFilter && rootProps.disableColumnSelector && rootProps.disableDensitySelector && !showQuickFilter) {
27
28
  return null;
@@ -32,7 +33,7 @@ const GridToolbar = /*#__PURE__*/React.forwardRef(function GridToolbar(props, re
32
33
  children: [/*#__PURE__*/_jsx(GridToolbarColumnsButton, {}), /*#__PURE__*/_jsx(GridToolbarFilterButton, {}), /*#__PURE__*/_jsx(GridToolbarDensitySelector, {}), /*#__PURE__*/_jsx(GridToolbarExport, {
33
34
  csvOptions: csvOptions,
34
35
  printOptions: printOptions
35
- // TODO: remove the reference to excelOptions in community package
36
+ // @ts-ignore
36
37
  ,
37
38
  excelOptions: excelOptions
38
39
  }), /*#__PURE__*/_jsx("div", {
@@ -47,6 +48,8 @@ process.env.NODE_ENV !== "production" ? GridToolbar.propTypes = {
47
48
  // | These PropTypes are generated from the TypeScript type definitions |
48
49
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
49
50
  // ----------------------------------------------------------------------
51
+ csvOptions: PropTypes.object,
52
+ printOptions: PropTypes.object,
50
53
  /**
51
54
  * Props passed to the quick filter component.
52
55
  */
@@ -56,6 +59,11 @@ process.env.NODE_ENV !== "production" ? GridToolbar.propTypes = {
56
59
  * @default false
57
60
  */
58
61
  showQuickFilter: PropTypes.bool,
62
+ /**
63
+ * The props used for each slot inside.
64
+ * @default {}
65
+ */
66
+ slotProps: PropTypes.object,
59
67
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
60
68
  } : void 0;
61
69
  export { GridToolbar };
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import PropTypes from 'prop-types';
4
- import { unstable_useId as useId } from '@mui/material/utils';
4
+ import useId from '@mui/utils/useId';
5
5
  import { useGridSelector } from "../../hooks/utils/useGridSelector.js";
6
6
  import { gridPreferencePanelStateSelector } from "../../hooks/features/preferencesPanel/gridPreferencePanelSelector.js";
7
7
  import { GridPreferencePanelsValue } from "../../hooks/features/preferencesPanel/gridPreferencePanelsValue.js";
@@ -2,8 +2,6 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { unstable_useId as useId, unstable_useForkRef as useForkRef } from '@mui/utils';
5
- import MenuList from '@mui/material/MenuList';
6
- import MenuItem from '@mui/material/MenuItem';
7
5
  import ListItemIcon from '@mui/material/ListItemIcon';
8
6
  import { gridDensitySelector } from "../../hooks/features/density/densitySelector.js";
9
7
  import { isHideMenuKey } from "../../utils/keyboardUtils.js";
@@ -74,7 +72,7 @@ const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function GridTo
74
72
  if (rootProps.disableDensitySelector) {
75
73
  return null;
76
74
  }
77
- const densityElements = densityOptions.map((option, index) => /*#__PURE__*/_jsxs(MenuItem, {
75
+ const densityElements = densityOptions.map((option, index) => /*#__PURE__*/_jsxs(rootProps.slots.baseMenuItem, {
78
76
  onClick: () => handleDensityUpdate(option.value),
79
77
  selected: option.value === density,
80
78
  children: [/*#__PURE__*/_jsx(ListItemIcon, {
@@ -105,7 +103,7 @@ const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function GridTo
105
103
  target: buttonRef.current,
106
104
  onClose: handleDensitySelectorClose,
107
105
  position: "bottom-start",
108
- children: /*#__PURE__*/_jsx(MenuList, {
106
+ children: /*#__PURE__*/_jsx(rootProps.slots.baseMenuList, {
109
107
  id: densityMenuId,
110
108
  className: gridClasses.menuList,
111
109
  "aria-labelledby": densityButtonId,
@@ -5,18 +5,19 @@ const _excluded = ["hideMenu", "options"],
5
5
  _excluded3 = ["csvOptions", "printOptions", "excelOptions"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
- import MenuItem from '@mui/material/MenuItem';
8
+ import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
9
9
  import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
10
10
  import { GridToolbarExportContainer } from "./GridToolbarExportContainer.js";
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
12
  function GridCsvExportMenuItem(props) {
13
13
  const apiRef = useGridApiContext();
14
+ const rootProps = useGridRootProps();
14
15
  const {
15
16
  hideMenu,
16
17
  options
17
18
  } = props,
18
19
  other = _objectWithoutPropertiesLoose(props, _excluded);
19
- return /*#__PURE__*/_jsx(MenuItem, _extends({
20
+ return /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, _extends({
20
21
  onClick: () => {
21
22
  apiRef.current.exportDataAsCsv(options);
22
23
  hideMenu?.();
@@ -47,12 +48,13 @@ process.env.NODE_ENV !== "production" ? GridCsvExportMenuItem.propTypes = {
47
48
  } : void 0;
48
49
  function GridPrintExportMenuItem(props) {
49
50
  const apiRef = useGridApiContext();
51
+ const rootProps = useGridRootProps();
50
52
  const {
51
53
  hideMenu,
52
54
  options
53
55
  } = props,
54
56
  other = _objectWithoutPropertiesLoose(props, _excluded2);
55
- return /*#__PURE__*/_jsx(MenuItem, _extends({
57
+ return /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, _extends({
56
58
  onClick: () => {
57
59
  apiRef.current.exportDataAsPrint(options);
58
60
  hideMenu?.();
@@ -82,12 +84,13 @@ process.env.NODE_ENV !== "production" ? GridPrintExportMenuItem.propTypes = {
82
84
  })
83
85
  } : void 0;
84
86
  const GridToolbarExport = /*#__PURE__*/React.forwardRef(function GridToolbarExport(props, ref) {
85
- const {
87
+ const _ref = props,
88
+ {
86
89
  csvOptions = {},
87
90
  printOptions = {},
88
91
  excelOptions
89
- } = props,
90
- other = _objectWithoutPropertiesLoose(props, _excluded3);
92
+ } = _ref,
93
+ other = _objectWithoutPropertiesLoose(_ref, _excluded3);
91
94
  const apiRef = useGridApiContext();
92
95
  const preProcessedButtons = apiRef.current.unstable_applyPipeProcessors('exportMenu', [], {
93
96
  excelOptions,
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { unstable_useId as useId, unstable_useForkRef as useForkRef } from '@mui/utils';
5
- import MenuList from '@mui/material/MenuList';
6
5
  import { isHideMenuKey } from "../../utils/keyboardUtils.js";
7
6
  import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
8
7
  import { GridMenu } from "../menu/GridMenu.js";
@@ -63,7 +62,7 @@ const GridToolbarExportContainer = /*#__PURE__*/React.forwardRef(function GridTo
63
62
  target: buttonRef.current,
64
63
  onClose: handleMenuClose,
65
64
  position: "bottom-start",
66
- children: /*#__PURE__*/_jsx(MenuList, {
65
+ children: /*#__PURE__*/_jsx(rootProps.slots.baseMenuList, {
67
66
  id: exportMenuId,
68
67
  className: gridClasses.menuList,
69
68
  "aria-labelledby": exportButtonId,
@@ -70,6 +70,9 @@ const GridVirtualScrollbar = /*#__PURE__*/React.forwardRef(function GridVirtualS
70
70
  const onScrollerScroll = useEventCallback(() => {
71
71
  const scroller = apiRef.current.virtualScrollerRef.current;
72
72
  const scrollbar = scrollbarRef.current;
73
+ if (!scrollbar) {
74
+ return;
75
+ }
73
76
  if (scroller[propertyScroll] === lastPosition.current) {
74
77
  return;
75
78
  }
@@ -85,6 +88,9 @@ const GridVirtualScrollbar = /*#__PURE__*/React.forwardRef(function GridVirtualS
85
88
  const onScrollbarScroll = useEventCallback(() => {
86
89
  const scroller = apiRef.current.virtualScrollerRef.current;
87
90
  const scrollbar = scrollbarRef.current;
91
+ if (!scrollbar) {
92
+ return;
93
+ }
88
94
  if (isLocked.current) {
89
95
  isLocked.current = false;
90
96
  return;
@@ -193,8 +193,10 @@ export const useGridColumnResize = (apiRef, props) => {
193
193
  const prevWidth = refs.columnHeaderElement.offsetWidth;
194
194
  const widthDiff = newWidth - prevWidth;
195
195
  const columnWidthDiff = newWidth - refs.initialColWidth;
196
- const newTotalWidth = refs.initialTotalWidth + columnWidthDiff;
197
- apiRef.current.rootElementRef?.current?.style.setProperty('--DataGrid-rowWidth', `${newTotalWidth}px`);
196
+ if (columnWidthDiff > 0) {
197
+ const newTotalWidth = refs.initialTotalWidth + columnWidthDiff;
198
+ apiRef.current.rootElementRef?.current?.style.setProperty('--DataGrid-rowWidth', `${newTotalWidth}px`);
199
+ }
198
200
  refs.colDef.computedWidth = newWidth;
199
201
  refs.colDef.width = newWidth;
200
202
  refs.colDef.flex = 0;