@mui/x-data-grid 6.0.3 → 6.1.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 (162) hide show
  1. package/CHANGELOG.md +119 -0
  2. package/components/GridAutoSizer.js +3 -0
  3. package/components/GridPagination.d.ts +6 -6
  4. package/components/GridRow.js +4 -2
  5. package/components/cell/GridActionsCellItem.d.ts +2 -2
  6. package/components/cell/GridEditDateCell.js +37 -16
  7. package/components/columnHeaders/ColumnHeaderMenuIcon.js +20 -16
  8. package/components/columnHeaders/GridColumnHeaderTitle.js +5 -5
  9. package/components/menu/columnMenu/GridColumnHeaderMenu.js +4 -2
  10. package/components/menu/columnMenu/GridColumnMenu.d.ts +5 -5
  11. package/components/menu/columnMenu/GridColumnMenu.js +30 -30
  12. package/components/menu/columnMenu/GridColumnMenuProps.d.ts +1 -1
  13. package/components/panel/GridColumnsPanel.d.ts +8 -0
  14. package/components/panel/GridColumnsPanel.js +18 -6
  15. package/components/panel/GridPanel.d.ts +1 -1
  16. package/components/panel/filterPanel/GridFilterPanel.js +1 -1
  17. package/components/reexportable.d.ts +1 -1
  18. package/components/reexportable.js +1 -1
  19. package/components/toolbar/GridToolbarColumnsButton.d.ts +1 -1
  20. package/components/toolbar/GridToolbarDensitySelector.d.ts +1 -1
  21. package/components/toolbar/GridToolbarExportContainer.d.ts +1 -1
  22. package/hooks/core/useGridApiInitialization.js +3 -3
  23. package/hooks/features/columnMenu/columnMenuInterfaces.d.ts +11 -11
  24. package/hooks/features/columnMenu/{useGridColumnMenuComponents.d.ts → useGridColumnMenuSlots.d.ts} +4 -4
  25. package/hooks/features/columnMenu/{useGridColumnMenuComponents.js → useGridColumnMenuSlots.js} +21 -26
  26. package/hooks/features/columns/gridColumnsSelector.d.ts +3 -3
  27. package/hooks/features/columns/useGridColumns.js +1 -1
  28. package/hooks/features/editing/useGridCellEditing.js +5 -1
  29. package/hooks/features/editing/useGridEditing.js +1 -3
  30. package/hooks/features/editing/useGridRowEditing.js +5 -1
  31. package/hooks/features/filter/gridFilterState.js +6 -1
  32. package/hooks/features/filter/useGridFilter.js +6 -1
  33. package/hooks/features/sorting/useGridSorting.js +1 -1
  34. package/hooks/features/virtualization/useGridVirtualScroller.js +1 -1
  35. package/index.d.ts +1 -1
  36. package/index.js +10 -2
  37. package/legacy/components/GridAutoSizer.js +3 -0
  38. package/legacy/components/GridRow.js +5 -2
  39. package/legacy/components/cell/GridEditBooleanCell.js +19 -21
  40. package/legacy/components/cell/GridEditDateCell.js +69 -39
  41. package/legacy/components/cell/GridEditInputCell.js +25 -27
  42. package/legacy/components/cell/GridEditSingleSelectCell.js +26 -28
  43. package/legacy/components/columnHeaders/ColumnHeaderMenuIcon.js +20 -16
  44. package/legacy/components/columnHeaders/GridColumnHeaderTitle.js +5 -5
  45. package/legacy/components/menu/columnMenu/GridColumnHeaderMenu.js +4 -2
  46. package/legacy/components/menu/columnMenu/GridColumnMenu.js +32 -32
  47. package/legacy/components/panel/GridColumnsPanel.js +19 -6
  48. package/legacy/components/panel/filterPanel/GridFilterPanel.js +1 -1
  49. package/legacy/components/reexportable.js +1 -1
  50. package/legacy/hooks/core/useGridApiInitialization.js +3 -3
  51. package/legacy/hooks/features/columnMenu/{useGridColumnMenuComponents.js → useGridColumnMenuSlots.js} +25 -30
  52. package/legacy/hooks/features/columns/gridColumnsUtils.js +2 -2
  53. package/legacy/hooks/features/columns/useGridColumns.js +1 -1
  54. package/legacy/hooks/features/editing/useGridCellEditing.js +120 -120
  55. package/legacy/hooks/features/editing/useGridEditing.js +17 -21
  56. package/legacy/hooks/features/editing/useGridRowEditing.js +5 -1
  57. package/legacy/hooks/features/export/useGridPrintExport.js +45 -47
  58. package/legacy/hooks/features/filter/gridFilterState.js +6 -1
  59. package/legacy/hooks/features/filter/useGridFilter.js +6 -1
  60. package/legacy/hooks/features/rows/gridRowsUtils.js +2 -2
  61. package/legacy/hooks/features/sorting/useGridSorting.js +1 -1
  62. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +7 -7
  63. package/legacy/index.js +10 -2
  64. package/legacy/locales/coreLocales.js +0 -1
  65. package/legacy/locales/daDK.js +16 -21
  66. package/legacy/locales/esES.js +1 -1
  67. package/legacy/locales/huHU.js +15 -20
  68. package/legacy/locales/jaJP.js +1 -1
  69. package/legacy/locales/nbNO.js +10 -12
  70. package/legacy/locales/nlNL.js +3 -3
  71. package/legacy/locales/ptBR.js +7 -9
  72. package/legacy/locales/ruRU.js +1 -1
  73. package/legacy/locales/svSE.js +2 -2
  74. package/legacy/models/gridColumnGrouping.js +4 -0
  75. package/legacy/models/params/gridRowParams.js +8 -0
  76. package/legacy/utils/createSelector.js +14 -22
  77. package/locales/coreLocales.js +0 -1
  78. package/locales/daDK.js +16 -21
  79. package/locales/esES.js +1 -1
  80. package/locales/huHU.js +15 -20
  81. package/locales/jaJP.js +1 -1
  82. package/locales/nbNO.js +10 -12
  83. package/locales/nlNL.js +3 -3
  84. package/locales/ptBR.js +7 -9
  85. package/locales/ruRU.js +1 -1
  86. package/locales/svSE.js +2 -2
  87. package/models/api/gridCoreApi.d.ts +3 -1
  88. package/models/api/gridEditingApi.d.ts +4 -0
  89. package/models/gridColumnGrouping.js +4 -0
  90. package/models/params/gridRowParams.js +8 -0
  91. package/modern/components/GridAutoSizer.js +3 -0
  92. package/modern/components/GridRow.js +4 -2
  93. package/modern/components/cell/GridEditDateCell.js +37 -16
  94. package/modern/components/columnHeaders/ColumnHeaderMenuIcon.js +19 -15
  95. package/modern/components/columnHeaders/GridColumnHeaderTitle.js +5 -5
  96. package/modern/components/menu/columnMenu/GridColumnHeaderMenu.js +4 -2
  97. package/modern/components/menu/columnMenu/GridColumnMenu.js +30 -30
  98. package/modern/components/panel/GridColumnsPanel.js +18 -6
  99. package/modern/components/panel/filterPanel/GridFilterPanel.js +1 -1
  100. package/modern/components/reexportable.js +1 -1
  101. package/modern/hooks/core/useGridApiInitialization.js +3 -3
  102. package/modern/hooks/features/columnMenu/{useGridColumnMenuComponents.js → useGridColumnMenuSlots.js} +21 -26
  103. package/modern/hooks/features/columns/useGridColumns.js +1 -1
  104. package/modern/hooks/features/editing/useGridCellEditing.js +5 -1
  105. package/modern/hooks/features/editing/useGridEditing.js +1 -3
  106. package/modern/hooks/features/editing/useGridRowEditing.js +5 -1
  107. package/modern/hooks/features/filter/gridFilterState.js +6 -1
  108. package/modern/hooks/features/filter/useGridFilter.js +6 -1
  109. package/modern/hooks/features/sorting/useGridSorting.js +1 -1
  110. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +1 -1
  111. package/modern/index.js +10 -2
  112. package/modern/locales/coreLocales.js +0 -1
  113. package/modern/locales/daDK.js +16 -21
  114. package/modern/locales/esES.js +1 -1
  115. package/modern/locales/huHU.js +15 -20
  116. package/modern/locales/jaJP.js +1 -1
  117. package/modern/locales/nbNO.js +10 -12
  118. package/modern/locales/nlNL.js +3 -3
  119. package/modern/locales/ptBR.js +7 -9
  120. package/modern/locales/ruRU.js +1 -1
  121. package/modern/locales/svSE.js +2 -2
  122. package/modern/models/gridColumnGrouping.js +4 -0
  123. package/modern/models/params/gridRowParams.js +8 -0
  124. package/modern/utils/createSelector.js +12 -22
  125. package/node/components/GridAutoSizer.js +3 -1
  126. package/node/components/GridRow.js +4 -2
  127. package/node/components/cell/GridCell.js +1 -0
  128. package/node/components/cell/GridEditDateCell.js +37 -16
  129. package/node/components/columnHeaders/ColumnHeaderMenuIcon.js +19 -15
  130. package/node/components/columnHeaders/GridColumnHeaderTitle.js +5 -5
  131. package/node/components/menu/columnMenu/GridColumnHeaderMenu.js +4 -2
  132. package/node/components/menu/columnMenu/GridColumnMenu.js +33 -33
  133. package/node/components/panel/GridColumnsPanel.js +18 -6
  134. package/node/components/panel/filterPanel/GridFilterPanel.js +1 -1
  135. package/node/components/reexportable.js +4 -4
  136. package/node/hooks/core/useGridApiInitialization.js +3 -3
  137. package/node/hooks/features/columnMenu/{useGridColumnMenuComponents.js → useGridColumnMenuSlots.js} +22 -27
  138. package/node/hooks/features/columns/useGridColumns.js +1 -1
  139. package/node/hooks/features/editing/useGridCellEditing.js +5 -1
  140. package/node/hooks/features/editing/useGridEditing.js +1 -3
  141. package/node/hooks/features/editing/useGridRowEditing.js +5 -1
  142. package/node/hooks/features/filter/gridFilterState.js +5 -0
  143. package/node/hooks/features/filter/useGridFilter.js +6 -1
  144. package/node/hooks/features/sorting/useGridSorting.js +1 -1
  145. package/node/hooks/features/virtualization/useGridVirtualScroller.js +1 -1
  146. package/node/index.js +7 -7
  147. package/node/locales/daDK.js +16 -21
  148. package/node/locales/esES.js +1 -1
  149. package/node/locales/huHU.js +15 -20
  150. package/node/locales/jaJP.js +1 -1
  151. package/node/locales/nbNO.js +10 -12
  152. package/node/locales/nlNL.js +3 -3
  153. package/node/locales/ptBR.js +7 -9
  154. package/node/locales/ruRU.js +1 -1
  155. package/node/locales/svSE.js +2 -2
  156. package/node/models/gridColumnGrouping.js +4 -0
  157. package/node/models/params/gridEditCellParams.js +1 -0
  158. package/node/models/params/gridRowParams.js +9 -0
  159. package/node/utils/createSelector.js +12 -22
  160. package/package.json +1 -1
  161. package/utils/createSelector.d.ts +4 -4
  162. package/utils/createSelector.js +14 -22
@@ -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 = ["sort", "searchPredicate", "autoFocusSearchField", "disableHideAllButton", "disableShowAllButton"];
3
+ const _excluded = ["sort", "searchPredicate", "autoFocusSearchField", "disableHideAllButton", "disableShowAllButton", "getTogglableColumns"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { unstable_composeClasses as composeClasses } from '@mui/utils';
@@ -72,7 +72,8 @@ function GridColumnsPanel(props) {
72
72
  searchPredicate = defaultSearchPredicate,
73
73
  autoFocusSearchField = true,
74
74
  disableHideAllButton = false,
75
- disableShowAllButton = false
75
+ disableShowAllButton = false,
76
+ getTogglableColumns
76
77
  } = props,
77
78
  other = _objectWithoutPropertiesLoose(props, _excluded);
78
79
  const sortedColumns = React.useMemo(() => {
@@ -110,12 +111,15 @@ function GridColumnsPanel(props) {
110
111
  setSearchValue(event.target.value);
111
112
  }, []);
112
113
  const currentColumns = React.useMemo(() => {
114
+ const togglableColumns = getTogglableColumns ? getTogglableColumns(sortedColumns) : null;
115
+ const togglableSortedColumns = togglableColumns ? sortedColumns.filter(({
116
+ field
117
+ }) => togglableColumns.includes(field)) : sortedColumns;
113
118
  if (!searchValue) {
114
- return sortedColumns;
119
+ return togglableSortedColumns;
115
120
  }
116
- const searchValueToCheck = searchValue.toLowerCase();
117
- return sortedColumns.filter(column => searchPredicate(column, searchValueToCheck));
118
- }, [sortedColumns, searchValue, searchPredicate]);
121
+ return togglableSortedColumns.filter(column => searchPredicate(column, searchValue.toLowerCase()));
122
+ }, [sortedColumns, searchValue, searchPredicate, getTogglableColumns]);
119
123
  const firstSwitchRef = React.useRef(null);
120
124
  React.useEffect(() => {
121
125
  if (autoFocusSearchField) {
@@ -196,6 +200,14 @@ process.env.NODE_ENV !== "production" ? GridColumnsPanel.propTypes = {
196
200
  autoFocusSearchField: PropTypes.bool,
197
201
  disableHideAllButton: PropTypes.bool,
198
202
  disableShowAllButton: PropTypes.bool,
203
+ /**
204
+ * Returns the list of togglable columns.
205
+ * If used, only those columns will be displayed in the panel
206
+ * which are passed as the return value of the function.
207
+ * @param {GridColDef[]} columns The `ColDef` list of all columns.
208
+ * @returns {GridColDef['field'][]} The list of togglable columns' field names.
209
+ */
210
+ getTogglableColumns: PropTypes.func,
199
211
  searchPredicate: PropTypes.func,
200
212
  slotProps: PropTypes.object,
201
213
  sort: PropTypes.oneOf(['asc', 'desc'])
@@ -24,7 +24,7 @@ declare const GridPanelRoot: import("@emotion/styled").StyledComponent<Pick<Omit
24
24
  root?: import("@mui/base").SlotComponentProps<"div", import("@mui/base").PopperUnstyledRootSlotPropsOverrides, import("@mui/base").PopperUnstyledOwnerState> | undefined;
25
25
  } | undefined;
26
26
  sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
27
- } & React.RefAttributes<HTMLDivElement>, "hidden" | "color" | "style" | "open" | "translate" | "transition" | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "component" | "sx" | "ownerState" | "components" | "container" | "placement" | "disablePortal" | "modifiers" | "anchorEl" | "keepMounted" | "popperOptions" | "popperRef" | "slotProps" | "slots" | "componentsProps" | keyof React.RefAttributes<HTMLDivElement>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
27
+ } & React.RefAttributes<HTMLDivElement>, "hidden" | "color" | "style" | "open" | "translate" | "transition" | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "component" | "sx" | "ownerState" | "components" | "container" | "placement" | "disablePortal" | "modifiers" | "anchorEl" | "keepMounted" | "popperOptions" | "popperRef" | "slotProps" | "slots" | "componentsProps" | keyof React.RefAttributes<HTMLDivElement>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
28
28
  ownerState: OwnerState;
29
29
  }, {}, {}>;
30
30
  declare const GridPanel: React.ForwardRefExoticComponent<Omit<GridPanelProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
@@ -147,7 +147,7 @@ const GridFilterPanel = /*#__PURE__*/React.forwardRef(function GridFilterPanel(p
147
147
  logicOperators: logicOperators,
148
148
  columnsSort: columnsSort
149
149
  }, filterFormProps), item.id == null ? index : item.id))
150
- }), !rootProps.disableMultipleColumnsFiltering && !disableAddFilterButton && !disableRemoveAllButton ? /*#__PURE__*/_jsxs(GridPanelFooter, {
150
+ }), !rootProps.disableMultipleColumnsFiltering && !(disableAddFilterButton && disableRemoveAllButton) ? /*#__PURE__*/_jsxs(GridPanelFooter, {
151
151
  children: [!disableAddFilterButton ? /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
152
152
  onClick: addNewFilter,
153
153
  startIcon: /*#__PURE__*/_jsx(rootProps.slots.filterPanelAddIcon, {})
@@ -1 +1 @@
1
- export { GridColumnMenu, GRID_COLUMN_MENU_COMPONENTS, GRID_COLUMN_MENU_COMPONENTS_PROPS, } from './menu/columnMenu/GridColumnMenu';
1
+ export { GridColumnMenu, GRID_COLUMN_MENU_SLOTS, GRID_COLUMN_MENU_SLOT_PROPS, } from './menu/columnMenu/GridColumnMenu';
@@ -1 +1 @@
1
- export { GridColumnMenu, GRID_COLUMN_MENU_COMPONENTS, GRID_COLUMN_MENU_COMPONENTS_PROPS } from './menu/columnMenu/GridColumnMenu';
1
+ export { GridColumnMenu, GRID_COLUMN_MENU_SLOTS, GRID_COLUMN_MENU_SLOT_PROPS } from './menu/columnMenu/GridColumnMenu';
@@ -1,3 +1,3 @@
1
1
  import * as React from 'react';
2
2
  import { ButtonProps } from '@mui/material/Button';
3
- export declare const GridToolbarColumnsButton: React.ForwardRefExoticComponent<Omit<ButtonProps<"button", {}>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
3
+ export declare const GridToolbarColumnsButton: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
@@ -1,3 +1,3 @@
1
1
  import * as React from 'react';
2
2
  import { ButtonProps } from '@mui/material/Button';
3
- export declare const GridToolbarDensitySelector: React.ForwardRefExoticComponent<Omit<ButtonProps<"button", {}>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
3
+ export declare const GridToolbarDensitySelector: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
@@ -1,3 +1,3 @@
1
1
  import * as React from 'react';
2
2
  import { ButtonProps } from '@mui/material/Button';
3
- export declare const GridToolbarExportContainer: React.ForwardRefExoticComponent<Omit<ButtonProps<"button", {}>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
3
+ export declare const GridToolbarExportContainer: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
@@ -2,7 +2,6 @@ import * as React from 'react';
2
2
  import { useGridApiMethod } from '../utils/useGridApiMethod';
3
3
  import { GridSignature } from '../utils/useGridApiEventHandler';
4
4
  import { EventManager } from '../../utils/EventManager';
5
- import { unstable_resetCreateSelectorCache } from '../../utils/createSelector';
6
5
  const isSyntheticEvent = event => {
7
6
  return event.isPropagationStopped !== undefined;
8
7
  };
@@ -38,7 +37,9 @@ export function useGridApiInitialization(inputApiRef, props) {
38
37
  if (!publicApiRef.current) {
39
38
  publicApiRef.current = {
40
39
  state: {},
41
- instanceId: globalId
40
+ instanceId: {
41
+ id: globalId
42
+ }
42
43
  };
43
44
  globalId += 1;
44
45
  }
@@ -76,7 +77,6 @@ export function useGridApiInitialization(inputApiRef, props) {
76
77
  React.useEffect(() => {
77
78
  const api = privateApiRef.current;
78
79
  return () => {
79
- unstable_resetCreateSelectorCache(api.instanceId);
80
80
  api.publishEvent('unmount');
81
81
  };
82
82
  }, [privateApiRef]);
@@ -3,7 +3,7 @@ export interface GridColumnMenuState {
3
3
  open: boolean;
4
4
  field?: string;
5
5
  }
6
- export interface GridColumnMenuComponentProps {
6
+ export interface GridColumnMenuSlotProps {
7
7
  /**
8
8
  * Every item has a `displayOrder` based which it will be placed before or after other
9
9
  * items in the column menu, `array.prototype.sort` is applied to sort the items.
@@ -16,32 +16,32 @@ export interface GridColumnMenuComponentProps {
16
16
  }
17
17
  export interface GridColumnMenuRootProps {
18
18
  /**
19
- * Initial `components` - it is internal, to be overridden by Pro or Premium packages
19
+ * Initial `slots` - it is internal, to be overrriden by Pro or Premium packages
20
20
  * @ignore - do not document.
21
21
  */
22
- defaultComponents: {
22
+ defaultSlots: {
23
23
  [key: string]: React.JSXElementConstructor<any>;
24
24
  };
25
25
  /**
26
- * Initial `componentsProps` - it is internal, to be overridden by Pro or Premium packages
26
+ * Initial `slotProps` - it is internal, to be overrriden by Pro or Premium packages
27
27
  * @ignore - do not document.
28
28
  */
29
- defaultComponentsProps: {
30
- [key: string]: GridColumnMenuComponentProps;
29
+ defaultSlotProps: {
30
+ [key: string]: GridColumnMenuSlotProps;
31
31
  };
32
32
  /**
33
- * `components` could be used to add new and (or) override default column menu items
34
- * If you register a nee component you must pass it's `displayOrder` in `componentsProps`
33
+ * `slots` could be used to add new and (or) override default column menu items
34
+ * If you register a nee component you must pass it's `displayOrder` in `slotProps`
35
35
  * or it will be placed in the end of the list
36
36
  */
37
- components?: {
37
+ slots?: {
38
38
  [key: string]: React.JSXElementConstructor<any> | null;
39
39
  };
40
40
  /**
41
41
  * Could be used to pass new props or override props specific to a column menu component
42
42
  * e.g. `displayOrder`
43
43
  */
44
- componentsProps?: {
45
- [key: string]: GridColumnMenuComponentProps;
44
+ slotProps?: {
45
+ [key: string]: GridColumnMenuSlotProps;
46
46
  };
47
47
  }
@@ -1,16 +1,16 @@
1
1
  import * as React from 'react';
2
2
  import { GridColumnMenuRootProps } from './columnMenuInterfaces';
3
3
  import { GridColDef } from '../../../models/colDef/gridColDef';
4
- interface UseGridColumnMenuComponentsProps extends GridColumnMenuRootProps {
4
+ interface UseGridColumnMenuSlotsProps extends GridColumnMenuRootProps {
5
5
  colDef: GridColDef;
6
6
  hideMenu: (event: React.SyntheticEvent) => void;
7
7
  addDividers?: boolean;
8
8
  }
9
- type UseGridColumnMenuComponentsResponse = Array<[
9
+ type UseGridColumnMenuSlotsResponse = Array<[
10
10
  React.JSXElementConstructor<any>,
11
11
  {
12
12
  [key: string]: any;
13
13
  }
14
14
  ]>;
15
- declare const useGridColumnMenuComponents: (props: UseGridColumnMenuComponentsProps) => UseGridColumnMenuComponentsResponse;
16
- export { useGridColumnMenuComponents };
15
+ declare const useGridColumnMenuSlots: (props: UseGridColumnMenuSlotsProps) => UseGridColumnMenuSlotsResponse;
16
+ export { useGridColumnMenuSlots };
@@ -4,44 +4,39 @@ const _excluded = ["displayOrder"];
4
4
  import * as React from 'react';
5
5
  import Divider from '@mui/material/Divider';
6
6
  import { useGridPrivateApiContext } from '../../utils/useGridPrivateApiContext';
7
- const camelize = pascalCase => {
8
- const camelCase = pascalCase.split('');
9
- camelCase[0] = camelCase[0].toLowerCase();
10
- return camelCase.join('');
11
- };
12
- const useGridColumnMenuComponents = props => {
7
+ const useGridColumnMenuSlots = props => {
13
8
  const apiRef = useGridPrivateApiContext();
14
9
  const {
15
- defaultComponents,
16
- defaultComponentsProps,
17
- components = {},
18
- componentsProps = {},
10
+ defaultSlots,
11
+ defaultSlotProps,
12
+ slots = {},
13
+ slotProps = {},
19
14
  hideMenu,
20
15
  colDef,
21
16
  addDividers = true
22
17
  } = props;
23
- const processedComponents = React.useMemo(() => _extends({}, defaultComponents, components), [defaultComponents, components]);
24
- const processedComponentsProps = React.useMemo(() => {
25
- if (!componentsProps || Object.keys(componentsProps).length === 0) {
26
- return defaultComponentsProps;
18
+ const processedComponents = React.useMemo(() => _extends({}, defaultSlots, slots), [defaultSlots, slots]);
19
+ const processedSlotProps = React.useMemo(() => {
20
+ if (!slotProps || Object.keys(slotProps).length === 0) {
21
+ return defaultSlotProps;
27
22
  }
28
- const mergedProps = _extends({}, componentsProps);
29
- Object.entries(defaultComponentsProps).forEach(([key, currentComponentProps]) => {
30
- mergedProps[key] = _extends({}, currentComponentProps, componentsProps[key] || {});
23
+ const mergedProps = _extends({}, slotProps);
24
+ Object.entries(defaultSlotProps).forEach(([key, currentSlotProps]) => {
25
+ mergedProps[key] = _extends({}, currentSlotProps, slotProps[key] || {});
31
26
  });
32
27
  return mergedProps;
33
- }, [defaultComponentsProps, componentsProps]);
28
+ }, [defaultSlotProps, slotProps]);
34
29
  const defaultItems = apiRef.current.unstable_applyPipeProcessors('columnMenu', [], props.colDef);
35
30
  const userItems = React.useMemo(() => {
36
- const defaultComponentKeys = Object.keys(defaultComponents);
37
- return Object.keys(components).filter(key => !defaultComponentKeys.includes(key));
38
- }, [components, defaultComponents]);
31
+ const defaultComponentKeys = Object.keys(defaultSlots);
32
+ return Object.keys(slots).filter(key => !defaultComponentKeys.includes(key));
33
+ }, [slots, defaultSlots]);
39
34
  return React.useMemo(() => {
40
35
  const uniqueItems = Array.from(new Set([...defaultItems, ...userItems]));
41
36
  const cleansedItems = uniqueItems.filter(key => processedComponents[key] != null);
42
37
  const sorted = cleansedItems.sort((a, b) => {
43
- const leftItemProps = processedComponentsProps[camelize(a)];
44
- const rightItemProps = processedComponentsProps[camelize(b)];
38
+ const leftItemProps = processedSlotProps[a];
39
+ const rightItemProps = processedSlotProps[b];
45
40
  const leftDisplayOrder = Number.isFinite(leftItemProps == null ? void 0 : leftItemProps.displayOrder) ? leftItemProps.displayOrder : 100;
46
41
  const rightDisplayOrder = Number.isFinite(rightItemProps == null ? void 0 : rightItemProps.displayOrder) ? rightItemProps.displayOrder : 100;
47
42
  return leftDisplayOrder - rightDisplayOrder;
@@ -51,13 +46,13 @@ const useGridColumnMenuComponents = props => {
51
46
  colDef,
52
47
  onClick: hideMenu
53
48
  };
54
- const processedComponentProps = processedComponentsProps[camelize(key)];
49
+ const processedComponentProps = processedSlotProps[key];
55
50
  if (processedComponentProps) {
56
51
  const customProps = _objectWithoutPropertiesLoose(processedComponentProps, _excluded);
57
52
  itemProps = _extends({}, itemProps, customProps);
58
53
  }
59
54
  return addDividers && index !== sorted.length - 1 ? [...acc, [processedComponents[key], itemProps], [Divider, {}]] : [...acc, [processedComponents[key], itemProps]];
60
55
  }, []);
61
- }, [addDividers, colDef, defaultItems, hideMenu, processedComponents, processedComponentsProps, userItems]);
56
+ }, [addDividers, colDef, defaultItems, hideMenu, processedComponents, processedSlotProps, userItems]);
62
57
  };
63
- export { useGridColumnMenuComponents };
58
+ export { useGridColumnMenuSlots };
@@ -19,7 +19,7 @@ export declare const gridColumnLookupSelector: import("../../../utils/createSele
19
19
  * Get an array of column definitions in the order rendered on screen..
20
20
  * @category Columns
21
21
  */
22
- export declare const gridColumnDefinitionsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../../internals").GridStateColDef<any, any, any>[]>;
22
+ export declare const gridColumnDefinitionsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../../internals").GridStateColDef[]>;
23
23
  /**
24
24
  * Get the column visibility model, containing the visibility status of each column.
25
25
  * If a column is not registered in the model, it is visible.
@@ -30,7 +30,7 @@ export declare const gridColumnVisibilityModelSelector: import("../../../utils/c
30
30
  * Get the visible columns as a lookup (an object containing the field for keys and the definition for values).
31
31
  * @category Visible Columns
32
32
  */
33
- export declare const gridVisibleColumnDefinitionsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../../internals").GridStateColDef<any, any, any>[]>;
33
+ export declare const gridVisibleColumnDefinitionsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../../internals").GridStateColDef[]>;
34
34
  /**
35
35
  * Get the field of each visible column.
36
36
  * @category Visible Columns
@@ -50,7 +50,7 @@ export declare const gridColumnsTotalWidthSelector: import("../../../utils/creat
50
50
  * Get the filterable columns as an array.
51
51
  * @category Columns
52
52
  */
53
- export declare const gridFilterableColumnDefinitionsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../../internals").GridStateColDef<any, any, any>[]>;
53
+ export declare const gridFilterableColumnDefinitionsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../../internals").GridStateColDef[]>;
54
54
  /**
55
55
  * Get the filterable columns as a lookup (an object containing the field for keys and the definition for values).
56
56
  * @category Columns
@@ -232,7 +232,7 @@ export function useGridColumns(apiRef, props) {
232
232
  if (props.disableColumnSelector) {
233
233
  return columnMenuItems;
234
234
  }
235
- return [...columnMenuItems, 'ColumnMenuColumnsItem'];
235
+ return [...columnMenuItems, 'columnMenuColumnsItem'];
236
236
  }, [props.disableColumnSelector]);
237
237
  useGridRegisterPipeProcessor(apiRef, 'columnMenu', addColumnMenuItems);
238
238
  useGridRegisterPipeProcessor(apiRef, 'exportState', stateExportPreProcessing);
@@ -242,13 +242,17 @@ export const useGridCellEditing = (apiRef, props) => {
242
242
  initialValue
243
243
  } = params;
244
244
  let newValue = apiRef.current.getCellValue(id, field);
245
+ // eslint-disable-next-line @typescript-eslint/naming-convention
246
+ let unstable_updateValueOnRender = false;
245
247
  if (deleteValue || initialValue) {
246
248
  newValue = deleteValue ? '' : initialValue;
249
+ unstable_updateValueOnRender = true;
247
250
  }
248
251
  const newProps = {
249
252
  value: newValue,
250
253
  error: false,
251
- isProcessingProps: false
254
+ isProcessingProps: false,
255
+ unstable_updateValueOnRender
252
256
  };
253
257
  updateOrDeleteFieldState(id, field, newProps);
254
258
  apiRef.current.setCellFocus(id, field);
@@ -110,9 +110,7 @@ export const useGridEditing = (apiRef, props) => {
110
110
  }, [apiRef, props.editMode]);
111
111
  const getEditCellMeta = React.useCallback((id, field) => {
112
112
  const editingState = gridEditRowsStateSelector(apiRef.current.state);
113
- return {
114
- changeReason: editingState[id][field].changeReason
115
- };
113
+ return editingState[id][field];
116
114
  }, [apiRef]);
117
115
  const editingSharedApi = {
118
116
  isCellEditable,
@@ -311,13 +311,17 @@ export const useGridRowEditing = (apiRef, props) => {
311
311
  return acc;
312
312
  }
313
313
  let newValue = apiRef.current.getCellValue(id, field);
314
+ // eslint-disable-next-line @typescript-eslint/naming-convention
315
+ let unstable_updateValueOnRender = false;
314
316
  if (fieldToFocus === field && (deleteValue || initialValue)) {
315
317
  newValue = deleteValue ? '' : initialValue;
318
+ unstable_updateValueOnRender = true;
316
319
  }
317
320
  acc[field] = {
318
321
  value: newValue,
319
322
  error: false,
320
- isProcessingProps: false
323
+ isProcessingProps: false,
324
+ unstable_updateValueOnRender
321
325
  };
322
326
  return acc;
323
327
  }, {});
@@ -4,4 +4,9 @@ export const getDefaultGridFilterModel = () => ({
4
4
  logicOperator: GridLogicOperator.And,
5
5
  quickFilterValues: [],
6
6
  quickFilterLogicOperator: GridLogicOperator.And
7
- });
7
+ });
8
+
9
+ /**
10
+ * @param {GridRowId} rowId The id of the row we want to filter.
11
+ * @param {(filterItem: GridFilterItem) => boolean} shouldApplyItem An optional callback to allow the filtering engine to only apply some items.
12
+ */
@@ -59,7 +59,7 @@ export const useGridFilter = (apiRef, props) => {
59
59
  if (colDef == null || colDef.filterable === false || props.disableColumnFilter) {
60
60
  return columnMenuItems;
61
61
  }
62
- return [...columnMenuItems, 'ColumnMenuFilterItem'];
62
+ return [...columnMenuItems, 'columnMenuFilterItem'];
63
63
  }, [props.disableColumnFilter]);
64
64
 
65
65
  /**
@@ -114,6 +114,11 @@ export const useGridFilter = (apiRef, props) => {
114
114
  const filterItemsWithValue = filterModel.items.filter(item => {
115
115
  var _column$filterOperato;
116
116
  if (item.value !== undefined) {
117
+ // Some filters like `isAnyOf` support array as `item.value`.
118
+ // If array is empty, we want to remove it from the filter model.
119
+ if (Array.isArray(item.value) && item.value.length === 0) {
120
+ return false;
121
+ }
117
122
  return true;
118
123
  }
119
124
  const column = apiRef.current.getColumn(item.field);
@@ -74,7 +74,7 @@ export const useGridSorting = (apiRef, props) => {
74
74
  }
75
75
  const sortingOrder = colDef.sortingOrder || props.sortingOrder;
76
76
  if (sortingOrder.some(item => !!item)) {
77
- return [...columnMenuItems, 'ColumnMenuSortItem'];
77
+ return [...columnMenuItems, 'columnMenuSortItem'];
78
78
  }
79
79
  return columnMenuItems;
80
80
  }, [props.sortingOrder]);
@@ -429,7 +429,7 @@ export const useGridVirtualScroller = props => {
429
429
  prevRootRowStyle.current = rootRowStyle;
430
430
  return rows;
431
431
  };
432
- const needsHorizontalScrollbar = containerDimensions.width && columnsTotalWidth > containerDimensions.width;
432
+ const needsHorizontalScrollbar = containerDimensions.width && columnsTotalWidth >= containerDimensions.width;
433
433
  const contentSize = React.useMemo(() => {
434
434
  // In cases where the columns exceed the available width,
435
435
  // the horizontal scrollbar should be shown even when there're no rows.
package/index.d.ts CHANGED
@@ -19,7 +19,7 @@ export { GridColumnHeaders } from './components/GridColumnHeaders';
19
19
  /**
20
20
  * Reexportable components.
21
21
  */
22
- export { GridColumnMenu, GRID_COLUMN_MENU_COMPONENTS, GRID_COLUMN_MENU_COMPONENTS_PROPS, } from './components/reexportable';
22
+ export { GridColumnMenu, GRID_COLUMN_MENU_SLOTS, GRID_COLUMN_MENU_SLOT_PROPS, } from './components/reexportable';
23
23
  /**
24
24
  * The full grid API.
25
25
  * @demos
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v6.0.3
2
+ * @mui/x-data-grid v6.1.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -22,10 +22,18 @@ export { GridColumnHeaders } from './components/GridColumnHeaders';
22
22
  /**
23
23
  * Reexportable components.
24
24
  */
25
- export { GridColumnMenu, GRID_COLUMN_MENU_COMPONENTS, GRID_COLUMN_MENU_COMPONENTS_PROPS } from './components/reexportable';
25
+ export { GridColumnMenu, GRID_COLUMN_MENU_SLOTS, GRID_COLUMN_MENU_SLOT_PROPS } from './components/reexportable';
26
26
 
27
27
  /**
28
28
  * The full grid API.
29
29
  * @demos
30
30
  * - [API object](/x/react-data-grid/api-object/)
31
+ */
32
+
33
+ /**
34
+ * The state of `DataGrid`.
35
+ */
36
+
37
+ /**
38
+ * The initial state of `DataGrid`.
31
39
  */
@@ -7,6 +7,9 @@ import PropTypes from 'prop-types';
7
7
  import { unstable_useForkRef as useForkRef, unstable_ownerWindow as ownerWindow, unstable_useEventCallback as useEventCallback, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
8
8
  import createDetectElementResize from '../lib/createDetectElementResize';
9
9
  // TODO replace with https://caniuse.com/resizeobserver.
10
+
11
+ // Credit to https://github.com/bvaughn/react-virtualized/blob/master/source/AutoSizer/AutoSizer.js
12
+ // for the sources.
10
13
  import { jsx as _jsx } from "react/jsx-runtime";
11
14
  var GridAutoSizer = /*#__PURE__*/React.forwardRef(function AutoSizer(props, ref) {
12
15
  var children = props.children,
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
3
3
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
5
  var _excluded = ["selected", "rowId", "row", "index", "style", "position", "rowHeight", "className", "visibleColumns", "renderedColumns", "containerWidth", "firstColumnToRender", "lastColumnToRender", "isLastVisible", "focusedCell", "tabbableCell", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave"],
6
- _excluded2 = ["changeReason"];
6
+ _excluded2 = ["changeReason", "unstable_updateValueOnRender"];
7
7
  import * as React from 'react';
8
8
  import PropTypes from 'prop-types';
9
9
  import clsx from 'clsx';
@@ -47,7 +47,7 @@ function EmptyCell(_ref) {
47
47
  width: width
48
48
  };
49
49
  return /*#__PURE__*/_jsx("div", {
50
- className: "MuiDataGrid-cell MuiDataGrid-withBorderColor",
50
+ className: "".concat(gridClasses.cell, " ").concat(gridClasses.withBorderColor),
51
51
  style: style
52
52
  }); // TODO change to .MuiDataGrid-emptyCell or .MuiDataGrid-rowFiller
53
53
  }
@@ -213,7 +213,10 @@ var GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
213
213
  }
214
214
  if (editCellState != null && column.renderEditCell) {
215
215
  var updatedRow = apiRef.current.getRowWithUpdatedValues(rowId, column.field);
216
+
217
+ // eslint-disable-next-line @typescript-eslint/naming-convention
216
218
  var changeReason = editCellState.changeReason,
219
+ unstable_updateValueOnRender = editCellState.unstable_updateValueOnRender,
217
220
  editCellStateRest = _objectWithoutProperties(editCellState, _excluded2);
218
221
  var params = _extends({}, cellParams, {
219
222
  row: updatedRow
@@ -55,28 +55,26 @@ function GridEditBooleanCell(props) {
55
55
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(event) {
56
56
  var newValue;
57
57
  return _regeneratorRuntime.wrap(function _callee$(_context) {
58
- while (1) {
59
- switch (_context.prev = _context.next) {
60
- case 0:
61
- newValue = event.target.checked;
62
- if (!onValueChange) {
63
- _context.next = 4;
64
- break;
65
- }
58
+ while (1) switch (_context.prev = _context.next) {
59
+ case 0:
60
+ newValue = event.target.checked;
61
+ if (!onValueChange) {
66
62
  _context.next = 4;
67
- return onValueChange(event, newValue);
68
- case 4:
69
- setValueState(newValue);
70
- _context.next = 7;
71
- return apiRef.current.setEditCellValue({
72
- id: idProp,
73
- field: field,
74
- value: newValue
75
- }, event);
76
- case 7:
77
- case "end":
78
- return _context.stop();
79
- }
63
+ break;
64
+ }
65
+ _context.next = 4;
66
+ return onValueChange(event, newValue);
67
+ case 4:
68
+ setValueState(newValue);
69
+ _context.next = 7;
70
+ return apiRef.current.setEditCellValue({
71
+ id: idProp,
72
+ field: field,
73
+ value: newValue
74
+ }, event);
75
+ case 7:
76
+ case "end":
77
+ return _context.stop();
80
78
  }
81
79
  }, _callee);
82
80
  }));