@mui/x-data-grid 7.17.0 → 7.19.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 +208 -5
- package/DataGrid/DataGrid.js +16 -1
- package/DataGrid/useDataGridComponent.js +3 -0
- package/DataGrid/useDataGridProps.js +2 -1
- package/components/GridRow.js +1 -0
- package/components/cell/GridCell.js +33 -9
- package/components/columnHeaders/GridBaseColumnHeaders.js +1 -1
- package/components/columnSelection/GridCellCheckboxRenderer.js +12 -4
- package/components/columnSelection/GridHeaderCheckbox.d.ts +1 -1
- package/components/containers/GridRoot.js +1 -1
- package/components/containers/GridRootStyles.js +32 -23
- package/components/containers/GridToolbarContainer.js +1 -1
- package/components/menu/GridMenu.js +1 -1
- package/components/panel/GridPanel.d.ts +1 -1
- package/components/panel/GridPanel.js +1 -1
- package/components/panel/GridPanelContent.js +1 -1
- package/components/panel/GridPanelFooter.js +1 -1
- package/components/panel/GridPanelHeader.js +1 -1
- package/components/panel/GridPanelWrapper.js +1 -1
- package/components/panel/filterPanel/filterPanelUtils.d.ts +1 -1
- package/components/toolbar/GridToolbarQuickFilter.js +1 -1
- package/components/virtualization/GridBottomContainer.d.ts +1 -1
- package/components/virtualization/GridBottomContainer.js +18 -1
- package/components/virtualization/GridMainContainer.js +3 -1
- package/components/virtualization/GridTopContainer.d.ts +1 -1
- package/components/virtualization/GridTopContainer.js +1 -1
- package/components/virtualization/GridVirtualScrollbar.js +1 -7
- package/components/virtualization/GridVirtualScroller.js +1 -0
- package/components/virtualization/GridVirtualScrollerFiller.js +3 -4
- package/hooks/features/columnGrouping/gridColumnGroupsSelector.d.ts +4 -4
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +1 -2
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +11 -11
- package/hooks/features/columnResize/columnResizeSelector.d.ts +1 -1
- package/hooks/features/columnResize/useGridColumnResize.js +6 -6
- package/hooks/features/columns/gridColumnsSelector.d.ts +12 -12
- package/hooks/features/columns/gridColumnsUtils.js +3 -2
- package/hooks/features/density/densitySelector.d.ts +1 -1
- package/hooks/features/dimensions/gridDimensionsApi.d.ts +4 -0
- package/hooks/features/dimensions/useGridDimensions.d.ts +1 -1
- package/hooks/features/dimensions/useGridDimensions.js +4 -1
- package/hooks/features/editing/useGridCellEditing.js +3 -19
- package/hooks/features/editing/useGridRowEditing.js +7 -2
- package/hooks/features/editing/utils.d.ts +2 -0
- package/hooks/features/editing/utils.js +15 -0
- package/hooks/features/export/useGridPrintExport.js +2 -1
- package/hooks/features/filter/gridFilterSelector.d.ts +17 -17
- package/hooks/features/focus/gridFocusStateSelector.d.ts +8 -8
- package/hooks/features/focus/useGridFocus.js +2 -1
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.d.ts +3 -3
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +10 -46
- package/hooks/features/keyboardNavigation/utils.d.ts +17 -0
- package/hooks/features/keyboardNavigation/utils.js +58 -0
- package/hooks/features/pagination/gridPaginationSelector.d.ts +9 -9
- package/hooks/features/rowSelection/gridRowSelectionSelector.d.ts +3 -3
- package/hooks/features/rowSelection/useGridRowSelection.d.ts +1 -1
- package/hooks/features/rowSelection/useGridRowSelection.js +105 -29
- package/hooks/features/rowSelection/utils.d.ts +10 -0
- package/hooks/features/rowSelection/utils.js +156 -1
- package/hooks/features/rows/gridRowSpanningSelectors.d.ts +4 -0
- package/hooks/features/rows/gridRowSpanningSelectors.js +5 -0
- package/hooks/features/rows/gridRowSpanningUtils.d.ts +10 -0
- package/hooks/features/rows/gridRowSpanningUtils.js +42 -0
- package/hooks/features/rows/gridRowsSelector.d.ts +14 -14
- package/hooks/features/rows/useGridRowSpanning.d.ts +27 -0
- package/hooks/features/rows/useGridRowSpanning.js +257 -0
- package/hooks/features/rows/useGridRows.d.ts +1 -1
- package/hooks/features/rows/useGridRows.js +7 -1
- package/hooks/features/scroll/useGridScroll.js +19 -19
- package/hooks/features/sorting/gridSortingSelector.d.ts +4 -4
- package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +5 -5
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +17 -7
- package/hooks/utils/useGridApiEventHandler.js +0 -1
- package/hooks/utils/useGridVisibleRows.d.ts +2 -2
- package/index.js +1 -1
- package/internals/index.d.ts +2 -0
- package/internals/index.js +2 -0
- package/locales/bgBG.js +8 -9
- package/locales/deDE.js +4 -4
- package/locales/frFR.js +4 -4
- package/locales/hrHR.d.ts +1 -1
- package/locales/hrHR.js +69 -46
- package/locales/jaJP.js +1 -2
- package/locales/ptPT.d.ts +1 -1
- package/locales/ptPT.js +4 -4
- package/locales/viVN.js +20 -20
- package/locales/zhHK.d.ts +1 -1
- package/models/colDef/gridColDef.d.ts +4 -0
- package/models/gridRowSelectionModel.d.ts +4 -0
- package/models/gridStateCommunity.d.ts +2 -0
- package/models/props/DataGridProps.d.ts +30 -1
- package/modern/DataGrid/DataGrid.js +16 -1
- package/modern/DataGrid/useDataGridComponent.js +3 -0
- package/modern/DataGrid/useDataGridProps.js +2 -1
- package/modern/components/GridRow.js +1 -0
- package/modern/components/cell/GridCell.js +33 -9
- package/modern/components/columnHeaders/GridBaseColumnHeaders.js +1 -1
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +12 -4
- package/modern/components/containers/GridRoot.js +1 -1
- package/modern/components/containers/GridRootStyles.js +32 -23
- package/modern/components/containers/GridToolbarContainer.js +1 -1
- package/modern/components/menu/GridMenu.js +1 -1
- package/modern/components/panel/GridPanel.js +1 -1
- package/modern/components/panel/GridPanelContent.js +1 -1
- package/modern/components/panel/GridPanelFooter.js +1 -1
- package/modern/components/panel/GridPanelHeader.js +1 -1
- package/modern/components/panel/GridPanelWrapper.js +1 -1
- package/modern/components/toolbar/GridToolbarQuickFilter.js +1 -1
- package/modern/components/virtualization/GridBottomContainer.js +18 -1
- package/modern/components/virtualization/GridMainContainer.js +3 -1
- package/modern/components/virtualization/GridTopContainer.js +1 -1
- package/modern/components/virtualization/GridVirtualScrollbar.js +1 -7
- package/modern/components/virtualization/GridVirtualScroller.js +1 -0
- package/modern/components/virtualization/GridVirtualScrollerFiller.js +3 -4
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +11 -11
- package/modern/hooks/features/columnResize/useGridColumnResize.js +6 -6
- package/modern/hooks/features/columns/gridColumnsUtils.js +3 -2
- package/modern/hooks/features/dimensions/useGridDimensions.js +4 -1
- package/modern/hooks/features/editing/useGridCellEditing.js +3 -19
- package/modern/hooks/features/editing/useGridRowEditing.js +7 -2
- package/modern/hooks/features/editing/utils.js +15 -0
- package/modern/hooks/features/export/useGridPrintExport.js +2 -1
- package/modern/hooks/features/focus/useGridFocus.js +2 -1
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +10 -46
- package/modern/hooks/features/keyboardNavigation/utils.js +58 -0
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +105 -29
- package/modern/hooks/features/rowSelection/utils.js +156 -1
- package/modern/hooks/features/rows/gridRowSpanningSelectors.js +5 -0
- package/modern/hooks/features/rows/gridRowSpanningUtils.js +42 -0
- package/modern/hooks/features/rows/useGridRowSpanning.js +257 -0
- package/modern/hooks/features/rows/useGridRows.js +7 -1
- package/modern/hooks/features/scroll/useGridScroll.js +19 -19
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +17 -7
- package/modern/hooks/utils/useGridApiEventHandler.js +0 -1
- package/modern/index.js +1 -1
- package/modern/internals/index.js +2 -0
- package/modern/locales/bgBG.js +8 -9
- package/modern/locales/deDE.js +4 -4
- package/modern/locales/frFR.js +4 -4
- package/modern/locales/hrHR.js +69 -46
- package/modern/locales/jaJP.js +1 -2
- package/modern/locales/ptPT.js +4 -4
- package/modern/locales/viVN.js +20 -20
- package/modern/utils/createSelector.js +6 -0
- package/modern/utils/domUtils.js +12 -12
- package/node/DataGrid/DataGrid.js +16 -1
- package/node/DataGrid/useDataGridComponent.js +3 -0
- package/node/DataGrid/useDataGridProps.js +2 -1
- package/node/components/GridRow.js +1 -0
- package/node/components/cell/GridCell.js +33 -9
- package/node/components/columnHeaders/GridBaseColumnHeaders.js +1 -1
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +12 -4
- package/node/components/containers/GridRoot.js +1 -1
- package/node/components/containers/GridRootStyles.js +32 -23
- package/node/components/containers/GridToolbarContainer.js +1 -1
- package/node/components/menu/GridMenu.js +1 -1
- package/node/components/panel/GridPanel.js +1 -1
- package/node/components/panel/GridPanelContent.js +1 -1
- package/node/components/panel/GridPanelFooter.js +1 -1
- package/node/components/panel/GridPanelHeader.js +1 -1
- package/node/components/panel/GridPanelWrapper.js +1 -1
- package/node/components/toolbar/GridToolbarQuickFilter.js +1 -1
- package/node/components/virtualization/GridBottomContainer.js +18 -1
- package/node/components/virtualization/GridMainContainer.js +3 -1
- package/node/components/virtualization/GridTopContainer.js +1 -1
- package/node/components/virtualization/GridVirtualScrollbar.js +1 -7
- package/node/components/virtualization/GridVirtualScroller.js +1 -0
- package/node/components/virtualization/GridVirtualScrollerFiller.js +3 -4
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +11 -11
- package/node/hooks/features/columnResize/useGridColumnResize.js +6 -6
- package/node/hooks/features/columns/gridColumnsUtils.js +3 -2
- package/node/hooks/features/dimensions/useGridDimensions.js +4 -1
- package/node/hooks/features/editing/useGridCellEditing.js +3 -19
- package/node/hooks/features/editing/useGridRowEditing.js +7 -2
- package/node/hooks/features/editing/utils.js +22 -0
- package/node/hooks/features/export/useGridPrintExport.js +2 -1
- package/node/hooks/features/focus/useGridFocus.js +2 -1
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +16 -53
- package/node/hooks/features/keyboardNavigation/utils.js +68 -0
- package/node/hooks/features/rowSelection/useGridRowSelection.js +102 -26
- package/node/hooks/features/rowSelection/utils.js +160 -1
- package/node/hooks/features/rows/gridRowSpanningSelectors.js +11 -0
- package/node/hooks/features/rows/gridRowSpanningUtils.js +52 -0
- package/node/hooks/features/rows/useGridRowSpanning.js +267 -0
- package/node/hooks/features/rows/useGridRows.js +7 -1
- package/node/hooks/features/scroll/useGridScroll.js +19 -19
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +17 -7
- package/node/hooks/utils/useGridApiEventHandler.js +0 -1
- package/node/index.js +1 -1
- package/node/internals/index.js +38 -15
- package/node/locales/bgBG.js +8 -9
- package/node/locales/deDE.js +4 -4
- package/node/locales/frFR.js +4 -4
- package/node/locales/hrHR.js +69 -46
- package/node/locales/jaJP.js +1 -2
- package/node/locales/ptPT.js +4 -4
- package/node/locales/viVN.js +20 -20
- package/node/utils/createSelector.js +6 -0
- package/node/utils/domUtils.js +12 -12
- package/package.json +3 -3
- package/utils/createSelector.js +6 -0
- package/utils/domUtils.d.ts +4 -4
- package/utils/domUtils.js +12 -12
|
@@ -16,7 +16,7 @@ export interface GridPanelProps extends Partial<React.ComponentProps<typeof Grid
|
|
|
16
16
|
open: boolean;
|
|
17
17
|
}
|
|
18
18
|
export declare const gridPanelClasses: Record<keyof GridPanelClasses, string>;
|
|
19
|
-
declare const GridPanelRoot: import("@emotion/styled").StyledComponent<Pick<import("@mui/material
|
|
19
|
+
declare const GridPanelRoot: import("@emotion/styled").StyledComponent<Pick<import("@mui/material").PopperProps & React.RefAttributes<HTMLDivElement>, "hidden" | "color" | "content" | "style" | "open" | "translate" | "container" | "transition" | "slot" | "title" | "ref" | "suppressHydrationWarning" | "className" | "id" | "lang" | "role" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "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-rowindextext" | "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" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "accessKey" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "nonce" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "component" | "sx" | "components" | "componentsProps" | "placement" | "disablePortal" | "modifiers" | "anchorEl" | "keepMounted" | "popperOptions" | "popperRef" | "slotProps" | "slots"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
20
20
|
ownerState: OwnerState;
|
|
21
21
|
}, {}, {}>;
|
|
22
22
|
declare const GridPanel: React.ForwardRefExoticComponent<Omit<GridPanelProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -84,7 +84,7 @@ const GridPanel = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
84
84
|
return /*#__PURE__*/_jsx(GridPanelRoot, _extends({
|
|
85
85
|
ref: ref,
|
|
86
86
|
placement: "bottom-start",
|
|
87
|
-
className: clsx(
|
|
87
|
+
className: clsx(classes.panel, className),
|
|
88
88
|
ownerState: rootProps,
|
|
89
89
|
anchorEl: anchorEl,
|
|
90
90
|
modifiers: modifiers
|
|
@@ -37,7 +37,7 @@ function GridPanelContent(props) {
|
|
|
37
37
|
const rootProps = useGridRootProps();
|
|
38
38
|
const classes = useUtilityClasses(rootProps);
|
|
39
39
|
return /*#__PURE__*/_jsx(GridPanelContentRoot, _extends({
|
|
40
|
-
className: clsx(
|
|
40
|
+
className: clsx(classes.root, className),
|
|
41
41
|
ownerState: rootProps
|
|
42
42
|
}, other));
|
|
43
43
|
}
|
|
@@ -37,7 +37,7 @@ function GridPanelFooter(props) {
|
|
|
37
37
|
const rootProps = useGridRootProps();
|
|
38
38
|
const classes = useUtilityClasses(rootProps);
|
|
39
39
|
return /*#__PURE__*/_jsx(GridPanelFooterRoot, _extends({
|
|
40
|
-
className: clsx(
|
|
40
|
+
className: clsx(classes.root, className),
|
|
41
41
|
ownerState: rootProps
|
|
42
42
|
}, other));
|
|
43
43
|
}
|
|
@@ -35,7 +35,7 @@ function GridPanelHeader(props) {
|
|
|
35
35
|
const rootProps = useGridRootProps();
|
|
36
36
|
const classes = useUtilityClasses(rootProps);
|
|
37
37
|
return /*#__PURE__*/_jsx(GridPanelHeaderRoot, _extends({
|
|
38
|
-
className: clsx(
|
|
38
|
+
className: clsx(classes.root, className),
|
|
39
39
|
ownerState: rootProps
|
|
40
40
|
}, other));
|
|
41
41
|
}
|
|
@@ -48,7 +48,7 @@ const GridPanelWrapper = /*#__PURE__*/React.forwardRef(function GridPanelWrapper
|
|
|
48
48
|
children: /*#__PURE__*/_jsx(GridPanelWrapperRoot, _extends({
|
|
49
49
|
ref: ref,
|
|
50
50
|
tabIndex: -1,
|
|
51
|
-
className: clsx(
|
|
51
|
+
className: clsx(classes.root, className),
|
|
52
52
|
ownerState: rootProps
|
|
53
53
|
}, other))
|
|
54
54
|
}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GridColDef, GridSingleSelectColDef } from '../../../models/colDef/gridColDef';
|
|
2
2
|
import type { GridValueOptionsParams } from '../../../models/params/gridValueOptionsParams';
|
|
3
3
|
export declare function isSingleSelectColDef(colDef: GridColDef | null): colDef is GridSingleSelectColDef;
|
|
4
|
-
export declare function getValueOptions(column: GridSingleSelectColDef, additionalParams?: Omit<GridValueOptionsParams, 'field'>): import("
|
|
4
|
+
export declare function getValueOptions(column: GridSingleSelectColDef, additionalParams?: Omit<GridValueOptionsParams, 'field'>): import("../../..").ValueOptions[] | undefined;
|
|
5
5
|
export declare function getValueFromValueOptions(value: string, valueOptions: any[] | undefined, getOptionValue: NonNullable<GridSingleSelectColDef['getOptionValue']>): any;
|
|
@@ -93,7 +93,7 @@ function GridToolbarQuickFilter(props) {
|
|
|
93
93
|
variant: "standard",
|
|
94
94
|
value: searchValue,
|
|
95
95
|
onChange: handleSearchValueChange,
|
|
96
|
-
className: clsx(
|
|
96
|
+
className: clsx(classes.root, className),
|
|
97
97
|
placeholder: apiRef.current.getLocaleText('toolbarQuickFilterPlaceholder'),
|
|
98
98
|
"aria-label": apiRef.current.getLocaleText('toolbarQuickFilterLabel'),
|
|
99
99
|
type: "search"
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export declare function GridBottomContainer(props: React.
|
|
2
|
+
export declare function GridBottomContainer(props: React.PropsWithChildren): React.JSX.Element;
|
|
@@ -4,6 +4,9 @@ import clsx from 'clsx';
|
|
|
4
4
|
import { styled } from '@mui/system';
|
|
5
5
|
import composeClasses from '@mui/utils/composeClasses';
|
|
6
6
|
import { gridClasses, getDataGridUtilityClass } from "../../constants/gridClasses.js";
|
|
7
|
+
import { gridDimensionsSelector } from "../../hooks/features/dimensions/gridDimensionsSelectors.js";
|
|
8
|
+
import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
|
|
9
|
+
import { useGridSelector } from "../../hooks/utils/useGridSelector.js";
|
|
7
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
11
|
const useUtilityClasses = () => {
|
|
9
12
|
const slots = {
|
|
@@ -18,8 +21,22 @@ const Element = styled('div')({
|
|
|
18
21
|
});
|
|
19
22
|
export function GridBottomContainer(props) {
|
|
20
23
|
const classes = useUtilityClasses();
|
|
24
|
+
const apiRef = useGridApiContext();
|
|
25
|
+
const {
|
|
26
|
+
viewportOuterSize,
|
|
27
|
+
minimumSize,
|
|
28
|
+
hasScrollX,
|
|
29
|
+
scrollbarSize
|
|
30
|
+
} = useGridSelector(apiRef, gridDimensionsSelector);
|
|
31
|
+
const scrollHeight = hasScrollX ? scrollbarSize : 0;
|
|
32
|
+
const offset = Math.max(viewportOuterSize.height - minimumSize.height -
|
|
33
|
+
// Subtract scroll height twice to account for GridVirtualScrollerFiller and horizontal scrollbar
|
|
34
|
+
2 * scrollHeight, 0);
|
|
21
35
|
return /*#__PURE__*/_jsx(Element, _extends({}, props, {
|
|
22
|
-
className: clsx(classes.root,
|
|
36
|
+
className: clsx(classes.root, gridClasses['container--bottom']),
|
|
37
|
+
style: {
|
|
38
|
+
transform: `translateY(${offset}px)`
|
|
39
|
+
},
|
|
23
40
|
role: "presentation"
|
|
24
41
|
}));
|
|
25
42
|
}
|
|
@@ -16,7 +16,9 @@ const Element = styled('div', {
|
|
|
16
16
|
})({
|
|
17
17
|
flexGrow: 1,
|
|
18
18
|
position: 'relative',
|
|
19
|
-
overflow: 'hidden'
|
|
19
|
+
overflow: 'hidden',
|
|
20
|
+
display: 'flex',
|
|
21
|
+
flexDirection: 'column'
|
|
20
22
|
});
|
|
21
23
|
export const GridMainContainer = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
22
24
|
const rootProps = useGridRootProps();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export declare function GridTopContainer(props: React.
|
|
2
|
+
export declare function GridTopContainer(props: React.PropsWithChildren): React.JSX.Element;
|
|
@@ -19,7 +19,7 @@ const Element = styled('div')({
|
|
|
19
19
|
export function GridTopContainer(props) {
|
|
20
20
|
const classes = useUtilityClasses();
|
|
21
21
|
return /*#__PURE__*/_jsx(Element, _extends({}, props, {
|
|
22
|
-
className: clsx(classes.root,
|
|
22
|
+
className: clsx(classes.root, gridClasses['container--top']),
|
|
23
23
|
role: "presentation"
|
|
24
24
|
}));
|
|
25
25
|
}
|
|
@@ -21,9 +21,6 @@ const Scrollbar = styled('div')({
|
|
|
21
21
|
position: 'absolute',
|
|
22
22
|
display: 'inline-block',
|
|
23
23
|
zIndex: 6,
|
|
24
|
-
'& > div': {
|
|
25
|
-
display: 'inline-block'
|
|
26
|
-
},
|
|
27
24
|
// In macOS Safari and Gnome Web, scrollbars are overlaid and don't affect the layout. So we consider
|
|
28
25
|
// their size to be 0px throughout all the calculations, but the floating scrollbar container does need
|
|
29
26
|
// to appear and have a real size. We set it to 14px because it seems like an acceptable value and we
|
|
@@ -55,9 +52,6 @@ const ScrollbarHorizontal = styled(Scrollbar)({
|
|
|
55
52
|
},
|
|
56
53
|
bottom: '0px'
|
|
57
54
|
});
|
|
58
|
-
const Content = styled('div')({
|
|
59
|
-
display: 'inline-block'
|
|
60
|
-
});
|
|
61
55
|
const GridVirtualScrollbar = /*#__PURE__*/React.forwardRef(function GridVirtualScrollbar(props, ref) {
|
|
62
56
|
const apiRef = useGridPrivateApiContext();
|
|
63
57
|
const rootProps = useGridRootProps();
|
|
@@ -127,7 +121,7 @@ const GridVirtualScrollbar = /*#__PURE__*/React.forwardRef(function GridVirtualS
|
|
|
127
121
|
className: classes.root,
|
|
128
122
|
tabIndex: -1,
|
|
129
123
|
"aria-hidden": "true",
|
|
130
|
-
children: /*#__PURE__*/_jsx(
|
|
124
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
131
125
|
ref: contentRef,
|
|
132
126
|
className: classes.content
|
|
133
127
|
})
|
|
@@ -44,10 +44,9 @@ function GridVirtualScrollerFiller({
|
|
|
44
44
|
leftPinnedWidth,
|
|
45
45
|
rightPinnedWidth
|
|
46
46
|
} = useGridSelector(apiRef, gridDimensionsSelector);
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
if (height === 0) {
|
|
47
|
+
const height = hasScrollX ? scrollbarSize : 0;
|
|
48
|
+
const needsLastRowBorder = viewportOuterSize.height - minimumSize.height > 0;
|
|
49
|
+
if (height === 0 && !needsLastRowBorder) {
|
|
51
50
|
return null;
|
|
52
51
|
}
|
|
53
52
|
return /*#__PURE__*/_jsxs(Filler, {
|
|
@@ -4,9 +4,9 @@ import { GridStateCommunity } from '../../../models/gridStateCommunity';
|
|
|
4
4
|
* @ignore - do not document.
|
|
5
5
|
*/
|
|
6
6
|
export declare const gridColumnGroupingSelector: (state: GridStateCommunity) => import("./gridColumnGroupsInterfaces").GridColumnsGroupingState;
|
|
7
|
-
export declare const gridColumnGroupsUnwrappedModelSelector: import("
|
|
7
|
+
export declare const gridColumnGroupsUnwrappedModelSelector: import("../../..").OutputSelector<GridStateCommunity, {
|
|
8
8
|
[columnField: string]: string[];
|
|
9
9
|
}>;
|
|
10
|
-
export declare const gridColumnGroupsLookupSelector: import("
|
|
11
|
-
export declare const gridColumnGroupsHeaderStructureSelector: import("
|
|
12
|
-
export declare const gridColumnGroupsHeaderMaxDepthSelector: import("
|
|
10
|
+
export declare const gridColumnGroupsLookupSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridColumnGroupsInterfaces").GridColumnGroupLookup>;
|
|
11
|
+
export declare const gridColumnGroupsHeaderStructureSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridColumnGroupsInterfaces").GridGroupingStructure[][]>;
|
|
12
|
+
export declare const gridColumnGroupsHeaderMaxDepthSelector: import("../../..").OutputSelector<GridStateCommunity, number>;
|
|
@@ -25,11 +25,10 @@ export interface UseGridColumnHeadersProps {
|
|
|
25
25
|
export interface GetHeadersParams {
|
|
26
26
|
position?: GridPinnedColumnPosition;
|
|
27
27
|
renderContext?: GridColumnsRenderContext;
|
|
28
|
-
minFirstColumn?: number;
|
|
29
28
|
maxLastColumn?: number;
|
|
30
29
|
}
|
|
31
30
|
type OwnerState = DataGridProcessedProps;
|
|
32
|
-
export declare const GridColumnHeaderRow: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material
|
|
31
|
+
export declare const GridColumnHeaderRow: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
33
32
|
ownerState: OwnerState;
|
|
34
33
|
}, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}>;
|
|
35
34
|
export declare const useGridColumnHeaders: (props: UseGridColumnHeadersProps) => {
|
|
@@ -53,7 +53,7 @@ export const useGridColumnHeaders = props => {
|
|
|
53
53
|
const renderContext = useGridSelector(apiRef, gridRenderContextColumnsSelector);
|
|
54
54
|
const pinnedColumns = useGridSelector(apiRef, gridVisiblePinnedColumnDefinitionsSelector);
|
|
55
55
|
const columnsLookup = useGridSelector(apiRef, gridColumnLookupSelector);
|
|
56
|
-
const offsetLeft = computeOffsetLeft(columnPositions, renderContext,
|
|
56
|
+
const offsetLeft = computeOffsetLeft(columnPositions, renderContext, pinnedColumns.left.length);
|
|
57
57
|
const gridHasFiller = dimensions.columnsTotalWidth < dimensions.viewportOuterSize.width;
|
|
58
58
|
React.useEffect(() => {
|
|
59
59
|
apiRef.current.columnHeadersContainerRef.current.scrollLeft = 0;
|
|
@@ -83,7 +83,6 @@ export const useGridColumnHeaders = props => {
|
|
|
83
83
|
const getColumnsToRender = params => {
|
|
84
84
|
const {
|
|
85
85
|
renderContext: currentContext = renderContext,
|
|
86
|
-
// TODO: `minFirstColumn` is not used anymore, could be refactored out.
|
|
87
86
|
maxLastColumn = visibleColumns.length
|
|
88
87
|
} = params || {};
|
|
89
88
|
const firstColumnToRender = currentContext.firstColumnIndex;
|
|
@@ -123,16 +122,22 @@ export const useGridColumnHeaders = props => {
|
|
|
123
122
|
computedWidth
|
|
124
123
|
}) => {
|
|
125
124
|
let style;
|
|
126
|
-
|
|
125
|
+
const isLeftPinned = pinnedPosition === GridPinnedColumnPosition.LEFT;
|
|
126
|
+
const isRightPinned = pinnedPosition === GridPinnedColumnPosition.RIGHT;
|
|
127
|
+
if (isLeftPinned || isRightPinned) {
|
|
127
128
|
const pinnedOffset = getPinnedCellOffset(pinnedPosition, computedWidth, columnIndex, columnPositions, dimensions);
|
|
129
|
+
let side = isLeftPinned ? 'left' : 'right';
|
|
130
|
+
if (isRtl) {
|
|
131
|
+
side = isLeftPinned ? 'right' : 'left';
|
|
132
|
+
}
|
|
128
133
|
if (pinnedPosition === 'left') {
|
|
129
134
|
style = {
|
|
130
|
-
|
|
135
|
+
[side]: pinnedOffset
|
|
131
136
|
};
|
|
132
137
|
}
|
|
133
138
|
if (pinnedPosition === 'right') {
|
|
134
139
|
style = {
|
|
135
|
-
|
|
140
|
+
[side]: pinnedOffset
|
|
136
141
|
};
|
|
137
142
|
}
|
|
138
143
|
}
|
|
@@ -191,18 +196,15 @@ export const useGridColumnHeaders = props => {
|
|
|
191
196
|
children: [leftRenderContext && getColumnHeaders({
|
|
192
197
|
position: GridPinnedColumnPosition.LEFT,
|
|
193
198
|
renderContext: leftRenderContext,
|
|
194
|
-
minFirstColumn: leftRenderContext.firstColumnIndex,
|
|
195
199
|
maxLastColumn: leftRenderContext.lastColumnIndex
|
|
196
200
|
}, {
|
|
197
201
|
disableReorder: true
|
|
198
202
|
}), getColumnHeaders({
|
|
199
203
|
renderContext,
|
|
200
|
-
minFirstColumn: pinnedColumns.left.length,
|
|
201
204
|
maxLastColumn: visibleColumns.length - pinnedColumns.right.length
|
|
202
205
|
}), rightRenderContext && getColumnHeaders({
|
|
203
206
|
position: GridPinnedColumnPosition.RIGHT,
|
|
204
207
|
renderContext: rightRenderContext,
|
|
205
|
-
minFirstColumn: rightRenderContext.firstColumnIndex,
|
|
206
208
|
maxLastColumn: rightRenderContext.lastColumnIndex
|
|
207
209
|
}, {
|
|
208
210
|
disableReorder: true,
|
|
@@ -282,7 +284,7 @@ export const useGridColumnHeaders = props => {
|
|
|
282
284
|
depth: depth,
|
|
283
285
|
isLastColumn: headerInfo.colIndex === visibleColumns.length - headerInfo.fields.length,
|
|
284
286
|
maxDepth: headerGroupingMaxDepth,
|
|
285
|
-
height: dimensions.
|
|
287
|
+
height: dimensions.groupHeaderHeight,
|
|
286
288
|
hasFocus: hasFocus,
|
|
287
289
|
tabIndex: tabIndex,
|
|
288
290
|
pinnedPosition: pinnedPosition,
|
|
@@ -309,7 +311,6 @@ export const useGridColumnHeaders = props => {
|
|
|
309
311
|
params: {
|
|
310
312
|
position: GridPinnedColumnPosition.LEFT,
|
|
311
313
|
renderContext: leftRenderContext,
|
|
312
|
-
minFirstColumn: leftRenderContext.firstColumnIndex,
|
|
313
314
|
maxLastColumn: leftRenderContext.lastColumnIndex
|
|
314
315
|
}
|
|
315
316
|
}), getColumnGroupHeaders({
|
|
@@ -322,7 +323,6 @@ export const useGridColumnHeaders = props => {
|
|
|
322
323
|
params: {
|
|
323
324
|
position: GridPinnedColumnPosition.RIGHT,
|
|
324
325
|
renderContext: rightRenderContext,
|
|
325
|
-
minFirstColumn: rightRenderContext.firstColumnIndex,
|
|
326
326
|
maxLastColumn: rightRenderContext.lastColumnIndex
|
|
327
327
|
}
|
|
328
328
|
})]
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { GridStateCommunity } from '../../../models/gridStateCommunity';
|
|
2
2
|
export declare const gridColumnResizeSelector: (state: GridStateCommunity) => import("./columnResizeState").GridColumnResizeState;
|
|
3
|
-
export declare const gridResizingColumnFieldSelector: import("
|
|
3
|
+
export declare const gridResizingColumnFieldSelector: import("../../..").OutputSelector<GridStateCommunity, string>;
|
|
@@ -302,13 +302,13 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
302
302
|
}
|
|
303
303
|
refs.groupHeaderElements = findGroupHeaderElementsFromField(apiRef.current.columnHeadersContainerRef?.current, colDef.field);
|
|
304
304
|
refs.cellElements = findGridCellElementsFromCol(refs.columnHeaderElement, apiRef.current);
|
|
305
|
-
refs.fillerLeft = findGridElement(apiRef.current, 'filler--pinnedLeft');
|
|
306
|
-
refs.fillerRight = findGridElement(apiRef.current, 'filler--pinnedRight');
|
|
305
|
+
refs.fillerLeft = findGridElement(apiRef.current, isRtl ? 'filler--pinnedRight' : 'filler--pinnedLeft');
|
|
306
|
+
refs.fillerRight = findGridElement(apiRef.current, isRtl ? 'filler--pinnedLeft' : 'filler--pinnedRight');
|
|
307
307
|
const pinnedPosition = apiRef.current.unstable_applyPipeProcessors('isColumnPinned', false, refs.colDef.field);
|
|
308
|
-
refs.leftPinnedCellsAfter = pinnedPosition !== GridPinnedColumnPosition.LEFT ? [] : findLeftPinnedCellsAfterCol(apiRef.current, refs.columnHeaderElement);
|
|
309
|
-
refs.rightPinnedCellsBefore = pinnedPosition !== GridPinnedColumnPosition.RIGHT ? [] : findRightPinnedCellsBeforeCol(apiRef.current, refs.columnHeaderElement);
|
|
310
|
-
refs.leftPinnedHeadersAfter = pinnedPosition !== GridPinnedColumnPosition.LEFT ? [] : findLeftPinnedHeadersAfterCol(apiRef.current, refs.columnHeaderElement);
|
|
311
|
-
refs.rightPinnedHeadersBefore = pinnedPosition !== GridPinnedColumnPosition.RIGHT ? [] : findRightPinnedHeadersBeforeCol(apiRef.current, refs.columnHeaderElement);
|
|
308
|
+
refs.leftPinnedCellsAfter = pinnedPosition !== GridPinnedColumnPosition.LEFT ? [] : findLeftPinnedCellsAfterCol(apiRef.current, refs.columnHeaderElement, isRtl);
|
|
309
|
+
refs.rightPinnedCellsBefore = pinnedPosition !== GridPinnedColumnPosition.RIGHT ? [] : findRightPinnedCellsBeforeCol(apiRef.current, refs.columnHeaderElement, isRtl);
|
|
310
|
+
refs.leftPinnedHeadersAfter = pinnedPosition !== GridPinnedColumnPosition.LEFT ? [] : findLeftPinnedHeadersAfterCol(apiRef.current, refs.columnHeaderElement, isRtl);
|
|
311
|
+
refs.rightPinnedHeadersBefore = pinnedPosition !== GridPinnedColumnPosition.RIGHT ? [] : findRightPinnedHeadersBeforeCol(apiRef.current, refs.columnHeaderElement, isRtl);
|
|
312
312
|
resizeDirection.current = getResizeDirection(separator, isRtl);
|
|
313
313
|
initialOffsetToSeparator.current = computeOffsetToSeparator(xStart, refs.columnHeaderElement.getBoundingClientRect(), resizeDirection.current);
|
|
314
314
|
};
|
|
@@ -9,33 +9,33 @@ export declare const gridColumnsStateSelector: (state: GridStateCommunity) => im
|
|
|
9
9
|
* Get an array of column fields in the order rendered on screen.
|
|
10
10
|
* @category Columns
|
|
11
11
|
*/
|
|
12
|
-
export declare const gridColumnFieldsSelector: import("
|
|
12
|
+
export declare const gridColumnFieldsSelector: import("../../..").OutputSelector<GridStateCommunity, string[]>;
|
|
13
13
|
/**
|
|
14
14
|
* Get the columns as a lookup (an object containing the field for keys and the definition for values).
|
|
15
15
|
* @category Columns
|
|
16
16
|
*/
|
|
17
|
-
export declare const gridColumnLookupSelector: import("
|
|
17
|
+
export declare const gridColumnLookupSelector: import("../../..").OutputSelector<GridStateCommunity, GridColumnLookup>;
|
|
18
18
|
/**
|
|
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("
|
|
22
|
+
export declare const gridColumnDefinitionsSelector: import("../../..").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.
|
|
26
26
|
* @category Visible Columns
|
|
27
27
|
*/
|
|
28
|
-
export declare const gridColumnVisibilityModelSelector: import("
|
|
28
|
+
export declare const gridColumnVisibilityModelSelector: import("../../..").OutputSelector<GridStateCommunity, import("./gridColumnsInterfaces").GridColumnVisibilityModel>;
|
|
29
29
|
/**
|
|
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("
|
|
33
|
+
export declare const gridVisibleColumnDefinitionsSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../../internals").GridStateColDef[]>;
|
|
34
34
|
/**
|
|
35
35
|
* Get the field of each visible column.
|
|
36
36
|
* @category Visible Columns
|
|
37
37
|
*/
|
|
38
|
-
export declare const gridVisibleColumnFieldsSelector: import("
|
|
38
|
+
export declare const gridVisibleColumnFieldsSelector: import("../../..").OutputSelector<GridStateCommunity, string[]>;
|
|
39
39
|
/**
|
|
40
40
|
* Get the visible pinned columns model.
|
|
41
41
|
* @category Visible Columns
|
|
@@ -45,7 +45,7 @@ export declare const gridPinnedColumnsSelector: (state: GridStateCommunity) => G
|
|
|
45
45
|
* Get the visible pinned columns.
|
|
46
46
|
* @category Visible Columns
|
|
47
47
|
*/
|
|
48
|
-
export declare const gridVisiblePinnedColumnDefinitionsSelector: import("
|
|
48
|
+
export declare const gridVisiblePinnedColumnDefinitionsSelector: import("../../..").OutputSelector<GridStateCommunity, {
|
|
49
49
|
left: import("../../../internals").GridStateColDef[];
|
|
50
50
|
right: import("../../../internals").GridStateColDef[];
|
|
51
51
|
}>;
|
|
@@ -53,25 +53,25 @@ export declare const gridVisiblePinnedColumnDefinitionsSelector: import("../../.
|
|
|
53
53
|
* Get the left position in pixel of each visible columns relative to the left of the first column.
|
|
54
54
|
* @category Visible Columns
|
|
55
55
|
*/
|
|
56
|
-
export declare const gridColumnPositionsSelector: import("
|
|
56
|
+
export declare const gridColumnPositionsSelector: import("../../..").OutputSelector<GridStateCommunity, number[]>;
|
|
57
57
|
/**
|
|
58
58
|
* Get the summed width of all the visible columns.
|
|
59
59
|
* @category Visible Columns
|
|
60
60
|
*/
|
|
61
|
-
export declare const gridColumnsTotalWidthSelector: import("
|
|
61
|
+
export declare const gridColumnsTotalWidthSelector: import("../../..").OutputSelector<GridStateCommunity, number>;
|
|
62
62
|
/**
|
|
63
63
|
* Get the filterable columns as an array.
|
|
64
64
|
* @category Columns
|
|
65
65
|
*/
|
|
66
|
-
export declare const gridFilterableColumnDefinitionsSelector: import("
|
|
66
|
+
export declare const gridFilterableColumnDefinitionsSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../../internals").GridStateColDef[]>;
|
|
67
67
|
/**
|
|
68
68
|
* Get the filterable columns as a lookup (an object containing the field for keys and the definition for values).
|
|
69
69
|
* @category Columns
|
|
70
70
|
*/
|
|
71
|
-
export declare const gridFilterableColumnLookupSelector: import("
|
|
71
|
+
export declare const gridFilterableColumnLookupSelector: import("../../..").OutputSelector<GridStateCommunity, GridColumnLookup>;
|
|
72
72
|
/**
|
|
73
73
|
* Checks if some column has a colSpan field.
|
|
74
74
|
* @category Columns
|
|
75
75
|
* @ignore - Do not document
|
|
76
76
|
*/
|
|
77
|
-
export declare const gridHasColSpanSelector: import("
|
|
77
|
+
export declare const gridHasColSpanSelector: import("../../..").OutputSelector<GridStateCommunity, boolean>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import resolveProps from '@mui/utils/resolveProps';
|
|
2
3
|
import { DEFAULT_GRID_COL_TYPE_KEY, GRID_STRING_COL_DEF, getGridDefaultColumnTypes } from "../../../colDef/index.js";
|
|
3
4
|
import { gridColumnsStateSelector, gridColumnVisibilityModelSelector } from "./gridColumnsSelector.js";
|
|
4
5
|
import { clamp } from "../../../utils/utils.js";
|
|
@@ -275,9 +276,9 @@ export const createColumnsState = ({
|
|
|
275
276
|
}
|
|
276
277
|
}
|
|
277
278
|
});
|
|
278
|
-
columnsState.lookup[field] = _extends({},
|
|
279
|
+
columnsState.lookup[field] = resolveProps(existingState, _extends({}, newColumn, {
|
|
279
280
|
hasBeenResized
|
|
280
|
-
});
|
|
281
|
+
}));
|
|
281
282
|
});
|
|
282
283
|
if (keepOnlyColumnsToUpsert && !isInsideStateInitializer) {
|
|
283
284
|
Object.keys(columnsState.lookup).forEach(field => {
|
|
@@ -3,4 +3,4 @@ import { GridDensity } from '../../../models/gridDensity';
|
|
|
3
3
|
export declare const COMPACT_DENSITY_FACTOR = 0.7;
|
|
4
4
|
export declare const COMFORTABLE_DENSITY_FACTOR = 1.3;
|
|
5
5
|
export declare const gridDensitySelector: (state: GridStateCommunity) => GridDensity;
|
|
6
|
-
export declare const gridDensityFactorSelector: import("
|
|
6
|
+
export declare const gridDensityFactorSelector: import("../../..").OutputSelector<GridStateCommunity, number>;
|
|
@@ -3,7 +3,7 @@ import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
|
|
|
3
3
|
import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
|
|
4
4
|
import { GridDimensions } from './gridDimensionsApi';
|
|
5
5
|
import { GridStateInitializer } from '../../utils/useGridInitializeState';
|
|
6
|
-
type RootProps = Pick<DataGridProcessedProps, 'onResize' | 'scrollbarSize' | 'pagination' | 'paginationMode' | 'autoHeight' | 'getRowHeight' | 'rowHeight' | 'resizeThrottleMs' | 'columnHeaderHeight' | 'headerFilterHeight'>;
|
|
6
|
+
type RootProps = Pick<DataGridProcessedProps, 'onResize' | 'scrollbarSize' | 'pagination' | 'paginationMode' | 'autoHeight' | 'getRowHeight' | 'rowHeight' | 'resizeThrottleMs' | 'columnHeaderHeight' | 'columnGroupHeaderHeight' | 'headerFilterHeight'>;
|
|
7
7
|
export type GridDimensionsState = GridDimensions;
|
|
8
8
|
export declare const dimensionsStateInitializer: GridStateInitializer<RootProps>;
|
|
9
9
|
export declare function useGridDimensions(apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: RootProps): void;
|
|
@@ -29,6 +29,7 @@ const EMPTY_DIMENSIONS = {
|
|
|
29
29
|
hasScrollY: false,
|
|
30
30
|
scrollbarSize: 0,
|
|
31
31
|
headerHeight: 0,
|
|
32
|
+
groupHeaderHeight: 0,
|
|
32
33
|
headerFilterHeight: 0,
|
|
33
34
|
rowWidth: 0,
|
|
34
35
|
rowHeight: 0,
|
|
@@ -55,6 +56,7 @@ export function useGridDimensions(apiRef, props) {
|
|
|
55
56
|
const densityFactor = useGridSelector(apiRef, gridDensityFactorSelector);
|
|
56
57
|
const rowHeight = Math.floor(props.rowHeight * densityFactor);
|
|
57
58
|
const headerHeight = Math.floor(props.columnHeaderHeight * densityFactor);
|
|
59
|
+
const groupHeaderHeight = Math.floor((props.columnGroupHeaderHeight ?? props.columnHeaderHeight) * densityFactor);
|
|
58
60
|
const headerFilterHeight = Math.floor((props.headerFilterHeight ?? props.columnHeaderHeight) * densityFactor);
|
|
59
61
|
const columnsTotalWidth = roundToDecimalPlaces(gridColumnsTotalWidthSelector(apiRef), 6);
|
|
60
62
|
const headersTotalHeight = getTotalHeaderHeight(apiRef, props);
|
|
@@ -175,6 +177,7 @@ export function useGridDimensions(apiRef, props) {
|
|
|
175
177
|
hasScrollY,
|
|
176
178
|
scrollbarSize,
|
|
177
179
|
headerHeight,
|
|
180
|
+
groupHeaderHeight,
|
|
178
181
|
headerFilterHeight,
|
|
179
182
|
rowWidth,
|
|
180
183
|
rowHeight,
|
|
@@ -191,7 +194,7 @@ export function useGridDimensions(apiRef, props) {
|
|
|
191
194
|
apiRef.current.publishEvent('viewportInnerSizeChange', newDimensions.viewportInnerSize);
|
|
192
195
|
}
|
|
193
196
|
apiRef.current.updateRenderContext?.();
|
|
194
|
-
}, [apiRef, setDimensions, props.scrollbarSize, props.autoHeight, rowsMeta.currentPageTotalHeight, rowHeight, headerHeight, headerFilterHeight, columnsTotalWidth, headersTotalHeight, leftPinnedWidth, rightPinnedWidth]);
|
|
197
|
+
}, [apiRef, setDimensions, props.scrollbarSize, props.autoHeight, rowsMeta.currentPageTotalHeight, rowHeight, headerHeight, groupHeaderHeight, headerFilterHeight, columnsTotalWidth, headersTotalHeight, leftPinnedWidth, rightPinnedWidth]);
|
|
195
198
|
const apiPublic = {
|
|
196
199
|
resize,
|
|
197
200
|
getRootDimensions
|
|
@@ -14,6 +14,7 @@ import { isPrintableKey, isPasteShortcut } from "../../../utils/keyboardUtils.js
|
|
|
14
14
|
import { gridRowsDataRowIdToIdLookupSelector } from "../rows/gridRowsSelector.js";
|
|
15
15
|
import { deepClone } from "../../../utils/utils.js";
|
|
16
16
|
import { GridCellEditStartReasons, GridCellEditStopReasons } from "../../../models/params/gridEditCellParams.js";
|
|
17
|
+
import { getDefaultCellValue } from "./utils.js";
|
|
17
18
|
export const useGridCellEditing = (apiRef, props) => {
|
|
18
19
|
const [cellModesModel, setCellModesModel] = React.useState({});
|
|
19
20
|
const cellModesModelRef = React.useRef(cellModesModel);
|
|
@@ -67,7 +68,7 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
67
68
|
const handleCellKeyDown = React.useCallback((params, event) => {
|
|
68
69
|
if (params.cellMode === GridCellModes.Edit) {
|
|
69
70
|
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
70
|
-
// TODO:
|
|
71
|
+
// TODO: to replace at one point. See https://github.com/mui/material-ui/pull/39713#discussion_r1381678957.
|
|
71
72
|
if (event.which === 229) {
|
|
72
73
|
return;
|
|
73
74
|
}
|
|
@@ -249,24 +250,7 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
249
250
|
} = params;
|
|
250
251
|
let newValue = apiRef.current.getCellValue(id, field);
|
|
251
252
|
if (deleteValue) {
|
|
252
|
-
|
|
253
|
-
switch (fieldType) {
|
|
254
|
-
case 'boolean':
|
|
255
|
-
newValue = false;
|
|
256
|
-
break;
|
|
257
|
-
case 'date':
|
|
258
|
-
case 'dateTime':
|
|
259
|
-
case 'number':
|
|
260
|
-
newValue = undefined;
|
|
261
|
-
break;
|
|
262
|
-
case 'singleSelect':
|
|
263
|
-
newValue = null;
|
|
264
|
-
break;
|
|
265
|
-
case 'string':
|
|
266
|
-
default:
|
|
267
|
-
newValue = '';
|
|
268
|
-
break;
|
|
269
|
-
}
|
|
253
|
+
newValue = getDefaultCellValue(apiRef.current.getColumn(field));
|
|
270
254
|
} else if (initialValue) {
|
|
271
255
|
newValue = initialValue;
|
|
272
256
|
}
|
|
@@ -16,6 +16,7 @@ import { gridRowsDataRowIdToIdLookupSelector } from "../rows/gridRowsSelector.js
|
|
|
16
16
|
import { deepClone } from "../../../utils/utils.js";
|
|
17
17
|
import { GridRowEditStopReasons, GridRowEditStartReasons } from "../../../models/params/gridRowParams.js";
|
|
18
18
|
import { GRID_ACTIONS_COLUMN_TYPE } from "../../../colDef/index.js";
|
|
19
|
+
import { getDefaultCellValue } from "./utils.js";
|
|
19
20
|
export const useGridRowEditing = (apiRef, props) => {
|
|
20
21
|
const [rowModesModel, setRowModesModel] = React.useState({});
|
|
21
22
|
const rowModesModelRef = React.useRef(rowModesModel);
|
|
@@ -109,7 +110,7 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
109
110
|
const handleCellKeyDown = React.useCallback((params, event) => {
|
|
110
111
|
if (params.cellMode === GridRowModes.Edit) {
|
|
111
112
|
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
112
|
-
// TODO:
|
|
113
|
+
// TODO: to replace at one point. See https://github.com/mui/material-ui/pull/39713#discussion_r1381678957.
|
|
113
114
|
if (event.which === 229) {
|
|
114
115
|
return;
|
|
115
116
|
}
|
|
@@ -319,7 +320,11 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
319
320
|
}
|
|
320
321
|
let newValue = apiRef.current.getCellValue(id, field);
|
|
321
322
|
if (fieldToFocus === field && (deleteValue || initialValue)) {
|
|
322
|
-
|
|
323
|
+
if (deleteValue) {
|
|
324
|
+
newValue = getDefaultCellValue(apiRef.current.getColumn(field));
|
|
325
|
+
} else if (initialValue) {
|
|
326
|
+
newValue = initialValue;
|
|
327
|
+
}
|
|
323
328
|
}
|
|
324
329
|
acc[field] = {
|
|
325
330
|
value: newValue,
|