@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.
- package/CHANGELOG.md +119 -0
- package/components/GridAutoSizer.js +3 -0
- package/components/GridPagination.d.ts +6 -6
- package/components/GridRow.js +4 -2
- package/components/cell/GridActionsCellItem.d.ts +2 -2
- package/components/cell/GridEditDateCell.js +37 -16
- package/components/columnHeaders/ColumnHeaderMenuIcon.js +20 -16
- package/components/columnHeaders/GridColumnHeaderTitle.js +5 -5
- package/components/menu/columnMenu/GridColumnHeaderMenu.js +4 -2
- package/components/menu/columnMenu/GridColumnMenu.d.ts +5 -5
- package/components/menu/columnMenu/GridColumnMenu.js +30 -30
- package/components/menu/columnMenu/GridColumnMenuProps.d.ts +1 -1
- package/components/panel/GridColumnsPanel.d.ts +8 -0
- package/components/panel/GridColumnsPanel.js +18 -6
- package/components/panel/GridPanel.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterPanel.js +1 -1
- package/components/reexportable.d.ts +1 -1
- package/components/reexportable.js +1 -1
- package/components/toolbar/GridToolbarColumnsButton.d.ts +1 -1
- package/components/toolbar/GridToolbarDensitySelector.d.ts +1 -1
- package/components/toolbar/GridToolbarExportContainer.d.ts +1 -1
- package/hooks/core/useGridApiInitialization.js +3 -3
- package/hooks/features/columnMenu/columnMenuInterfaces.d.ts +11 -11
- package/hooks/features/columnMenu/{useGridColumnMenuComponents.d.ts → useGridColumnMenuSlots.d.ts} +4 -4
- package/hooks/features/columnMenu/{useGridColumnMenuComponents.js → useGridColumnMenuSlots.js} +21 -26
- package/hooks/features/columns/gridColumnsSelector.d.ts +3 -3
- package/hooks/features/columns/useGridColumns.js +1 -1
- package/hooks/features/editing/useGridCellEditing.js +5 -1
- package/hooks/features/editing/useGridEditing.js +1 -3
- package/hooks/features/editing/useGridRowEditing.js +5 -1
- package/hooks/features/filter/gridFilterState.js +6 -1
- package/hooks/features/filter/useGridFilter.js +6 -1
- package/hooks/features/sorting/useGridSorting.js +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +1 -1
- package/index.d.ts +1 -1
- package/index.js +10 -2
- package/legacy/components/GridAutoSizer.js +3 -0
- package/legacy/components/GridRow.js +5 -2
- package/legacy/components/cell/GridEditBooleanCell.js +19 -21
- package/legacy/components/cell/GridEditDateCell.js +69 -39
- package/legacy/components/cell/GridEditInputCell.js +25 -27
- package/legacy/components/cell/GridEditSingleSelectCell.js +26 -28
- package/legacy/components/columnHeaders/ColumnHeaderMenuIcon.js +20 -16
- package/legacy/components/columnHeaders/GridColumnHeaderTitle.js +5 -5
- package/legacy/components/menu/columnMenu/GridColumnHeaderMenu.js +4 -2
- package/legacy/components/menu/columnMenu/GridColumnMenu.js +32 -32
- package/legacy/components/panel/GridColumnsPanel.js +19 -6
- package/legacy/components/panel/filterPanel/GridFilterPanel.js +1 -1
- package/legacy/components/reexportable.js +1 -1
- package/legacy/hooks/core/useGridApiInitialization.js +3 -3
- package/legacy/hooks/features/columnMenu/{useGridColumnMenuComponents.js → useGridColumnMenuSlots.js} +25 -30
- package/legacy/hooks/features/columns/gridColumnsUtils.js +2 -2
- package/legacy/hooks/features/columns/useGridColumns.js +1 -1
- package/legacy/hooks/features/editing/useGridCellEditing.js +120 -120
- package/legacy/hooks/features/editing/useGridEditing.js +17 -21
- package/legacy/hooks/features/editing/useGridRowEditing.js +5 -1
- package/legacy/hooks/features/export/useGridPrintExport.js +45 -47
- package/legacy/hooks/features/filter/gridFilterState.js +6 -1
- package/legacy/hooks/features/filter/useGridFilter.js +6 -1
- package/legacy/hooks/features/rows/gridRowsUtils.js +2 -2
- package/legacy/hooks/features/sorting/useGridSorting.js +1 -1
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +7 -7
- package/legacy/index.js +10 -2
- package/legacy/locales/coreLocales.js +0 -1
- package/legacy/locales/daDK.js +16 -21
- package/legacy/locales/esES.js +1 -1
- package/legacy/locales/huHU.js +15 -20
- package/legacy/locales/jaJP.js +1 -1
- package/legacy/locales/nbNO.js +10 -12
- package/legacy/locales/nlNL.js +3 -3
- package/legacy/locales/ptBR.js +7 -9
- package/legacy/locales/ruRU.js +1 -1
- package/legacy/locales/svSE.js +2 -2
- package/legacy/models/gridColumnGrouping.js +4 -0
- package/legacy/models/params/gridRowParams.js +8 -0
- package/legacy/utils/createSelector.js +14 -22
- package/locales/coreLocales.js +0 -1
- package/locales/daDK.js +16 -21
- package/locales/esES.js +1 -1
- package/locales/huHU.js +15 -20
- package/locales/jaJP.js +1 -1
- package/locales/nbNO.js +10 -12
- package/locales/nlNL.js +3 -3
- package/locales/ptBR.js +7 -9
- package/locales/ruRU.js +1 -1
- package/locales/svSE.js +2 -2
- package/models/api/gridCoreApi.d.ts +3 -1
- package/models/api/gridEditingApi.d.ts +4 -0
- package/models/gridColumnGrouping.js +4 -0
- package/models/params/gridRowParams.js +8 -0
- package/modern/components/GridAutoSizer.js +3 -0
- package/modern/components/GridRow.js +4 -2
- package/modern/components/cell/GridEditDateCell.js +37 -16
- package/modern/components/columnHeaders/ColumnHeaderMenuIcon.js +19 -15
- package/modern/components/columnHeaders/GridColumnHeaderTitle.js +5 -5
- package/modern/components/menu/columnMenu/GridColumnHeaderMenu.js +4 -2
- package/modern/components/menu/columnMenu/GridColumnMenu.js +30 -30
- package/modern/components/panel/GridColumnsPanel.js +18 -6
- package/modern/components/panel/filterPanel/GridFilterPanel.js +1 -1
- package/modern/components/reexportable.js +1 -1
- package/modern/hooks/core/useGridApiInitialization.js +3 -3
- package/modern/hooks/features/columnMenu/{useGridColumnMenuComponents.js → useGridColumnMenuSlots.js} +21 -26
- package/modern/hooks/features/columns/useGridColumns.js +1 -1
- package/modern/hooks/features/editing/useGridCellEditing.js +5 -1
- package/modern/hooks/features/editing/useGridEditing.js +1 -3
- package/modern/hooks/features/editing/useGridRowEditing.js +5 -1
- package/modern/hooks/features/filter/gridFilterState.js +6 -1
- package/modern/hooks/features/filter/useGridFilter.js +6 -1
- package/modern/hooks/features/sorting/useGridSorting.js +1 -1
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +1 -1
- package/modern/index.js +10 -2
- package/modern/locales/coreLocales.js +0 -1
- package/modern/locales/daDK.js +16 -21
- package/modern/locales/esES.js +1 -1
- package/modern/locales/huHU.js +15 -20
- package/modern/locales/jaJP.js +1 -1
- package/modern/locales/nbNO.js +10 -12
- package/modern/locales/nlNL.js +3 -3
- package/modern/locales/ptBR.js +7 -9
- package/modern/locales/ruRU.js +1 -1
- package/modern/locales/svSE.js +2 -2
- package/modern/models/gridColumnGrouping.js +4 -0
- package/modern/models/params/gridRowParams.js +8 -0
- package/modern/utils/createSelector.js +12 -22
- package/node/components/GridAutoSizer.js +3 -1
- package/node/components/GridRow.js +4 -2
- package/node/components/cell/GridCell.js +1 -0
- package/node/components/cell/GridEditDateCell.js +37 -16
- package/node/components/columnHeaders/ColumnHeaderMenuIcon.js +19 -15
- package/node/components/columnHeaders/GridColumnHeaderTitle.js +5 -5
- package/node/components/menu/columnMenu/GridColumnHeaderMenu.js +4 -2
- package/node/components/menu/columnMenu/GridColumnMenu.js +33 -33
- package/node/components/panel/GridColumnsPanel.js +18 -6
- package/node/components/panel/filterPanel/GridFilterPanel.js +1 -1
- package/node/components/reexportable.js +4 -4
- package/node/hooks/core/useGridApiInitialization.js +3 -3
- package/node/hooks/features/columnMenu/{useGridColumnMenuComponents.js → useGridColumnMenuSlots.js} +22 -27
- package/node/hooks/features/columns/useGridColumns.js +1 -1
- package/node/hooks/features/editing/useGridCellEditing.js +5 -1
- package/node/hooks/features/editing/useGridEditing.js +1 -3
- package/node/hooks/features/editing/useGridRowEditing.js +5 -1
- package/node/hooks/features/filter/gridFilterState.js +5 -0
- package/node/hooks/features/filter/useGridFilter.js +6 -1
- package/node/hooks/features/sorting/useGridSorting.js +1 -1
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +1 -1
- package/node/index.js +7 -7
- package/node/locales/daDK.js +16 -21
- package/node/locales/esES.js +1 -1
- package/node/locales/huHU.js +15 -20
- package/node/locales/jaJP.js +1 -1
- package/node/locales/nbNO.js +10 -12
- package/node/locales/nlNL.js +3 -3
- package/node/locales/ptBR.js +7 -9
- package/node/locales/ruRU.js +1 -1
- package/node/locales/svSE.js +2 -2
- package/node/models/gridColumnGrouping.js +4 -0
- package/node/models/params/gridEditCellParams.js +1 -0
- package/node/models/params/gridRowParams.js +9 -0
- package/node/utils/createSelector.js +12 -22
- package/package.json +1 -1
- package/utils/createSelector.d.ts +4 -4
- 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
|
|
119
|
+
return togglableSortedColumns;
|
|
115
120
|
}
|
|
116
|
-
|
|
117
|
-
|
|
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 &&
|
|
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,
|
|
1
|
+
export { GridColumnMenu, GRID_COLUMN_MENU_SLOTS, GRID_COLUMN_MENU_SLOT_PROPS, } from './menu/columnMenu/GridColumnMenu';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { 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
|
|
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
|
|
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
|
|
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:
|
|
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
|
|
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 `
|
|
19
|
+
* Initial `slots` - it is internal, to be overrriden by Pro or Premium packages
|
|
20
20
|
* @ignore - do not document.
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
defaultSlots: {
|
|
23
23
|
[key: string]: React.JSXElementConstructor<any>;
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
|
-
* Initial `
|
|
26
|
+
* Initial `slotProps` - it is internal, to be overrriden by Pro or Premium packages
|
|
27
27
|
* @ignore - do not document.
|
|
28
28
|
*/
|
|
29
|
-
|
|
30
|
-
[key: string]:
|
|
29
|
+
defaultSlotProps: {
|
|
30
|
+
[key: string]: GridColumnMenuSlotProps;
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
33
|
-
* `
|
|
34
|
-
* If you register a nee component you must pass it's `displayOrder` in `
|
|
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
|
-
|
|
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
|
-
|
|
45
|
-
[key: string]:
|
|
44
|
+
slotProps?: {
|
|
45
|
+
[key: string]: GridColumnMenuSlotProps;
|
|
46
46
|
};
|
|
47
47
|
}
|
package/hooks/features/columnMenu/{useGridColumnMenuComponents.d.ts → useGridColumnMenuSlots.d.ts}
RENAMED
|
@@ -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
|
|
4
|
+
interface UseGridColumnMenuSlotsProps extends GridColumnMenuRootProps {
|
|
5
5
|
colDef: GridColDef;
|
|
6
6
|
hideMenu: (event: React.SyntheticEvent) => void;
|
|
7
7
|
addDividers?: boolean;
|
|
8
8
|
}
|
|
9
|
-
type
|
|
9
|
+
type UseGridColumnMenuSlotsResponse = Array<[
|
|
10
10
|
React.JSXElementConstructor<any>,
|
|
11
11
|
{
|
|
12
12
|
[key: string]: any;
|
|
13
13
|
}
|
|
14
14
|
]>;
|
|
15
|
-
declare const
|
|
16
|
-
export {
|
|
15
|
+
declare const useGridColumnMenuSlots: (props: UseGridColumnMenuSlotsProps) => UseGridColumnMenuSlotsResponse;
|
|
16
|
+
export { useGridColumnMenuSlots };
|
package/hooks/features/columnMenu/{useGridColumnMenuComponents.js → useGridColumnMenuSlots.js}
RENAMED
|
@@ -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
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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({},
|
|
24
|
-
const
|
|
25
|
-
if (!
|
|
26
|
-
return
|
|
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({},
|
|
29
|
-
Object.entries(
|
|
30
|
-
mergedProps[key] = _extends({},
|
|
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
|
-
}, [
|
|
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(
|
|
37
|
-
return Object.keys(
|
|
38
|
-
}, [
|
|
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 =
|
|
44
|
-
const rightItemProps =
|
|
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 =
|
|
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,
|
|
56
|
+
}, [addDividers, colDef, defaultItems, hideMenu, processedComponents, processedSlotProps, userItems]);
|
|
62
57
|
};
|
|
63
|
-
export {
|
|
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
|
|
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
|
|
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
|
|
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, '
|
|
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, '
|
|
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, '
|
|
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
|
|
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,
|
|
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
|
|
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,
|
|
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: "
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
}));
|