@mui/x-data-grid 7.0.0-beta.7 → 7.0.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 +195 -12
- package/DataGrid/DataGrid.js +13 -17
- package/DataGrid/useDataGridProps.js +3 -5
- package/README.md +1 -1
- package/components/GridFooter.js +2 -3
- package/components/GridHeader.js +1 -2
- package/components/GridPagination.d.ts +6 -5
- package/components/GridPagination.js +12 -4
- package/components/GridRow.js +13 -17
- package/components/base/GridFooterPlaceholder.js +1 -2
- package/components/base/GridOverlays.js +3 -6
- package/components/cell/GridActionsCell.js +4 -6
- package/components/cell/GridActionsCellItem.d.ts +8 -25
- package/components/cell/GridActionsCellItem.js +8 -5
- package/components/cell/GridBooleanCell.d.ts +1 -0
- package/components/cell/GridBooleanCell.js +3 -2
- package/components/cell/GridCell.js +7 -8
- package/components/cell/GridEditBooleanCell.js +1 -2
- package/components/cell/GridEditDateCell.js +2 -3
- package/components/cell/GridEditInputCell.js +2 -2
- package/components/cell/GridEditSingleSelectCell.js +5 -8
- package/components/columnHeaders/ColumnHeaderMenuIcon.js +2 -3
- package/components/columnHeaders/GridColumnGroupHeader.js +4 -5
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.js +2 -3
- package/components/columnHeaders/GridColumnHeaderItem.js +5 -6
- package/components/columnHeaders/GridColumnHeaderSortIcon.js +1 -2
- package/components/columnHeaders/GridColumnHeaderTitle.js +2 -3
- package/components/columnHeaders/GridGenericColumnHeaderItem.js +1 -1
- package/components/columnSelection/GridCellCheckboxRenderer.js +3 -5
- package/components/columnSelection/GridHeaderCheckbox.js +1 -2
- package/components/columnsManagement/GridColumnsManagement.js +17 -21
- package/components/containers/GridRoot.js +3 -3
- package/components/menu/GridMenu.js +4 -6
- package/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
- package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +2 -3
- package/components/panel/GridColumnsPanel.js +1 -2
- package/components/panel/GridPanel.d.ts +1 -10
- package/components/panel/GridPanel.js +1 -2
- package/components/panel/GridPreferencesPanel.js +2 -3
- package/components/panel/filterPanel/GridFilterForm.js +24 -27
- package/components/panel/filterPanel/GridFilterInputBoolean.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputBoolean.js +6 -7
- package/components/panel/filterPanel/GridFilterInputDate.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputDate.js +3 -4
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +11 -15
- package/components/panel/filterPanel/GridFilterInputMultipleValue.js +10 -14
- package/components/panel/filterPanel/GridFilterInputSingleSelect.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +10 -11
- package/components/panel/filterPanel/GridFilterInputValue.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputValue.js +5 -7
- package/components/panel/filterPanel/GridFilterPanel.js +5 -9
- package/components/panel/filterPanel/filterPanelUtils.js +1 -1
- package/components/toolbar/GridToolbarColumnsButton.js +3 -5
- package/components/toolbar/GridToolbarDensitySelector.js +8 -10
- package/components/toolbar/GridToolbarExport.js +2 -2
- package/components/toolbar/GridToolbarExportContainer.js +3 -5
- package/components/toolbar/GridToolbarFilterButton.js +3 -5
- package/components/toolbar/GridToolbarQuickFilter.js +4 -5
- package/components/virtualization/GridVirtualScrollerContent.js +1 -2
- package/components/virtualization/GridVirtualScrollerRenderZone.js +1 -2
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.js +1 -2
- package/hooks/core/useGridApiInitialization.js +4 -6
- package/hooks/features/clipboard/useGridClipboard.js +6 -5
- package/hooks/features/columnGrouping/gridColumnGroupsSelector.js +4 -16
- package/hooks/features/columnGrouping/gridColumnGroupsUtils.js +4 -8
- package/hooks/features/columnGrouping/useGridColumnGrouping.js +12 -23
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +6 -8
- package/hooks/features/columnMenu/useGridColumnMenuSlots.js +2 -2
- package/hooks/features/columnResize/useGridColumnResize.js +9 -19
- package/hooks/features/columns/gridColumnsSelector.js +1 -2
- package/hooks/features/columns/gridColumnsUtils.d.ts +0 -9
- package/hooks/features/columns/gridColumnsUtils.js +2 -22
- package/hooks/features/columns/useGridColumnSpanning.js +1 -2
- package/hooks/features/columns/useGridColumns.js +11 -19
- package/hooks/features/density/densitySelector.d.ts +4 -2
- package/hooks/features/density/densitySelector.js +8 -2
- package/hooks/features/density/densityState.d.ts +1 -4
- package/hooks/features/density/useGridDensity.d.ts +2 -4
- package/hooks/features/density/useGridDensity.js +21 -29
- package/hooks/features/dimensions/useGridDimensions.js +3 -5
- package/hooks/features/editing/useGridCellEditing.js +4 -6
- package/hooks/features/editing/useGridEditing.js +1 -2
- package/hooks/features/editing/useGridRowEditing.js +4 -6
- package/hooks/features/export/serializers/csvSerializer.d.ts +2 -0
- package/hooks/features/export/serializers/csvSerializer.js +25 -16
- package/hooks/features/export/useGridCsvExport.js +9 -10
- package/hooks/features/export/useGridPrintExport.js +9 -15
- package/hooks/features/export/utils.js +2 -3
- package/hooks/features/filter/gridFilterSelector.js +15 -22
- package/hooks/features/filter/gridFilterUtils.js +10 -16
- package/hooks/features/filter/useGridFilter.js +9 -15
- package/hooks/features/focus/useGridFocus.js +5 -6
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +1 -4
- package/hooks/features/headerFiltering/useGridHeaderFiltering.js +12 -17
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +1 -2
- package/hooks/features/pagination/gridPaginationSelector.js +1 -2
- package/hooks/features/pagination/useGridPagination.js +2 -3
- package/hooks/features/pagination/useGridPaginationModel.js +6 -11
- package/hooks/features/pagination/useGridRowCount.js +3 -6
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +7 -12
- package/hooks/features/rowSelection/useGridRowSelection.js +11 -16
- package/hooks/features/rows/gridRowsSelector.js +11 -19
- package/hooks/features/rows/gridRowsUtils.js +7 -9
- package/hooks/features/rows/useGridParamsApi.js +1 -1
- package/hooks/features/rows/useGridRows.js +4 -13
- package/hooks/features/rows/useGridRowsMeta.js +7 -13
- package/hooks/features/scroll/useGridScroll.js +2 -3
- package/hooks/features/sorting/gridSortingSelector.js +4 -7
- package/hooks/features/sorting/useGridSorting.js +8 -14
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +220 -71
- package/hooks/utils/useGridApiEventHandler.js +5 -10
- package/hooks/utils/useGridNativeEventListener.js +1 -2
- package/index.js +1 -1
- package/internals/index.d.ts +2 -0
- package/internals/index.js +1 -0
- package/internals/utils/useProps.js +1 -2
- package/joy/joySlots.js +7 -13
- package/models/api/gridRowsMetaApi.d.ts +1 -1
- package/models/api/index.d.ts +1 -1
- package/models/api/index.js +0 -1
- package/models/events/gridEventLookup.d.ts +7 -0
- package/models/gridExport.d.ts +6 -0
- package/models/gridStateCommunity.d.ts +1 -0
- package/models/props/DataGridProps.d.ts +23 -27
- package/modern/DataGrid/DataGrid.js +13 -17
- package/modern/DataGrid/useDataGridProps.js +3 -5
- package/modern/components/GridPagination.js +11 -2
- package/modern/components/cell/GridActionsCell.js +1 -1
- package/modern/components/cell/GridActionsCellItem.js +4 -0
- package/modern/components/cell/GridBooleanCell.js +3 -2
- package/modern/components/containers/GridRoot.js +3 -3
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputDate.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +1 -1
- package/modern/components/toolbar/GridToolbarDensitySelector.js +5 -5
- package/modern/hooks/features/clipboard/useGridClipboard.js +4 -2
- package/modern/hooks/features/columnResize/useGridColumnResize.js +1 -1
- package/modern/hooks/features/columns/gridColumnsUtils.js +0 -19
- package/modern/hooks/features/density/densitySelector.js +8 -2
- package/modern/hooks/features/density/useGridDensity.js +21 -29
- package/modern/hooks/features/editing/useGridCellEditing.js +1 -1
- package/modern/hooks/features/editing/useGridRowEditing.js +1 -1
- package/modern/hooks/features/export/serializers/csvSerializer.js +23 -12
- package/modern/hooks/features/export/useGridCsvExport.js +2 -1
- package/modern/hooks/features/filter/gridFilterUtils.js +1 -1
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +3 -2
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +211 -57
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -0
- package/modern/models/api/index.js +0 -1
- package/modern/utils/createSelector.js +1 -1
- package/modern/utils/domUtils.js +1 -1
- package/modern/utils/keyboardUtils.js +1 -1
- package/node/DataGrid/DataGrid.js +13 -17
- package/node/DataGrid/useDataGridProps.js +3 -5
- package/node/components/GridPagination.js +9 -1
- package/node/components/cell/GridActionsCell.js +1 -1
- package/node/components/cell/GridActionsCellItem.js +4 -0
- package/node/components/cell/GridBooleanCell.js +3 -2
- package/node/components/containers/GridRoot.js +2 -2
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputDate.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputValue.js +1 -1
- package/node/components/toolbar/GridToolbarDensitySelector.js +4 -4
- package/node/hooks/features/clipboard/useGridClipboard.js +4 -2
- package/node/hooks/features/columnResize/useGridColumnResize.js +1 -1
- package/node/hooks/features/columns/gridColumnsUtils.js +0 -20
- package/node/hooks/features/density/densitySelector.js +9 -3
- package/node/hooks/features/density/useGridDensity.js +22 -30
- package/node/hooks/features/editing/useGridCellEditing.js +1 -1
- package/node/hooks/features/editing/useGridRowEditing.js +1 -1
- package/node/hooks/features/export/serializers/csvSerializer.js +23 -12
- package/node/hooks/features/export/useGridCsvExport.js +2 -1
- package/node/hooks/features/filter/gridFilterUtils.js +1 -1
- package/node/hooks/features/rowSelection/useGridRowSelection.js +2 -1
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +211 -57
- package/node/index.js +1 -1
- package/node/internals/index.js +12 -0
- package/node/models/api/index.js +0 -11
- package/node/utils/createSelector.js +1 -1
- package/node/utils/domUtils.js +1 -1
- package/node/utils/keyboardUtils.js +1 -1
- package/package.json +4 -4
- package/utils/createSelector.js +9 -9
- package/utils/domUtils.js +4 -7
- package/utils/getGridLocalization.js +9 -12
- package/utils/keyboardUtils.js +1 -1
|
@@ -14,7 +14,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
14
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
15
|
const hasActions = colDef => typeof colDef.getActions === 'function';
|
|
16
16
|
function GridActionsCell(props) {
|
|
17
|
-
var _rootProps$slotProps;
|
|
18
17
|
const {
|
|
19
18
|
colDef,
|
|
20
19
|
id,
|
|
@@ -45,7 +44,7 @@ function GridActionsCell(props) {
|
|
|
45
44
|
React.useLayoutEffect(() => {
|
|
46
45
|
if (!hasFocus) {
|
|
47
46
|
Object.entries(touchRippleRefs.current).forEach(([index, ref]) => {
|
|
48
|
-
ref
|
|
47
|
+
ref?.stop({}, () => {
|
|
49
48
|
delete touchRippleRefs.current[index];
|
|
50
49
|
});
|
|
51
50
|
});
|
|
@@ -107,7 +106,6 @@ function GridActionsCell(props) {
|
|
|
107
106
|
return;
|
|
108
107
|
}
|
|
109
108
|
const getNewIndex = (index, direction) => {
|
|
110
|
-
var _options;
|
|
111
109
|
if (index < 0 || index > options.length) {
|
|
112
110
|
return index;
|
|
113
111
|
}
|
|
@@ -117,7 +115,7 @@ function GridActionsCell(props) {
|
|
|
117
115
|
const indexMod = (direction === 'left' ? -1 : 1) * rtlMod;
|
|
118
116
|
|
|
119
117
|
// if the button that should receive focus is disabled go one more step
|
|
120
|
-
return
|
|
118
|
+
return options[index + indexMod]?.props.disabled ? getNewIndex(index + indexMod, direction) : index + indexMod;
|
|
121
119
|
};
|
|
122
120
|
let newIndex = focusedButtonIndex;
|
|
123
121
|
if (event.key === 'ArrowRight') {
|
|
@@ -130,7 +128,7 @@ function GridActionsCell(props) {
|
|
|
130
128
|
}
|
|
131
129
|
if (newIndex !== focusedButtonIndex) {
|
|
132
130
|
event.preventDefault(); // Prevent scrolling
|
|
133
|
-
event.stopPropagation(); // Don't stop propagation for other keys,
|
|
131
|
+
event.stopPropagation(); // Don't stop propagation for other keys, for example ArrowUp
|
|
134
132
|
setFocusedButtonIndex(newIndex);
|
|
135
133
|
}
|
|
136
134
|
};
|
|
@@ -166,7 +164,7 @@ function GridActionsCell(props) {
|
|
|
166
164
|
onClick: showMenu,
|
|
167
165
|
touchRippleRef: handleTouchRippleRef(buttonId),
|
|
168
166
|
tabIndex: focusedButtonIndex === iconButtons.length ? tabIndex : -1
|
|
169
|
-
},
|
|
167
|
+
}, rootProps.slotProps?.baseIconButton, {
|
|
170
168
|
children: /*#__PURE__*/_jsx(rootProps.slots.moreActionsIcon, {
|
|
171
169
|
fontSize: "small"
|
|
172
170
|
})
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { IconButtonProps } from '@mui/material/IconButton';
|
|
3
3
|
import { MenuItemProps } from '@mui/material/MenuItem';
|
|
4
|
-
|
|
4
|
+
interface GridActionsCellItemCommonProps {
|
|
5
5
|
label: string;
|
|
6
6
|
icon?: React.ReactElement;
|
|
7
7
|
/** from https://mui.com/material-ui/api/button-base/#ButtonBase-prop-component */
|
|
8
8
|
component?: React.ElementType;
|
|
9
|
-
}
|
|
9
|
+
}
|
|
10
|
+
export type GridActionsCellItemProps = GridActionsCellItemCommonProps & (({
|
|
10
11
|
showInMenu?: false;
|
|
11
12
|
icon: React.ReactElement;
|
|
12
|
-
} & IconButtonProps) | ({
|
|
13
|
+
} & Omit<IconButtonProps, 'component'>) | ({
|
|
13
14
|
showInMenu: true;
|
|
14
15
|
/**
|
|
15
16
|
* If false, the menu will not close when this item is clicked.
|
|
@@ -17,25 +18,11 @@ export type GridActionsCellItemProps = {
|
|
|
17
18
|
*/
|
|
18
19
|
closeMenuOnClick?: boolean;
|
|
19
20
|
closeMenu?: () => void;
|
|
20
|
-
} & MenuItemProps));
|
|
21
|
-
declare const GridActionsCellItem: React.ForwardRefExoticComponent<(Omit<{
|
|
22
|
-
label: string;
|
|
23
|
-
icon?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
24
|
-
/** from https://mui.com/material-ui/api/button-base/#ButtonBase-prop-component */
|
|
25
|
-
component?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
26
|
-
} & {
|
|
21
|
+
} & Omit<MenuItemProps, 'component'>));
|
|
22
|
+
declare const GridActionsCellItem: React.ForwardRefExoticComponent<(Omit<GridActionsCellItemCommonProps & {
|
|
27
23
|
showInMenu?: false | undefined;
|
|
28
24
|
icon: React.ReactElement;
|
|
29
|
-
} &
|
|
30
|
-
ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
|
|
31
|
-
}, "color" | "size" | "style" | "disabled" | "action" | "className" | "tabIndex" | "children" | "sx" | "classes" | "onFocusVisible" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "edge"> & {
|
|
32
|
-
component?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
33
|
-
}, "ref"> | Omit<{
|
|
34
|
-
label: string;
|
|
35
|
-
icon?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
36
|
-
/** from https://mui.com/material-ui/api/button-base/#ButtonBase-prop-component */
|
|
37
|
-
component?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
38
|
-
} & {
|
|
25
|
+
} & Omit<IconButtonProps, "component">, "ref"> | Omit<GridActionsCellItemCommonProps & {
|
|
39
26
|
showInMenu: true;
|
|
40
27
|
/**
|
|
41
28
|
* If false, the menu will not close when this item is clicked.
|
|
@@ -43,9 +30,5 @@ declare const GridActionsCellItem: React.ForwardRefExoticComponent<(Omit<{
|
|
|
43
30
|
*/
|
|
44
31
|
closeMenuOnClick?: boolean | undefined;
|
|
45
32
|
closeMenu?: (() => void) | undefined;
|
|
46
|
-
} &
|
|
47
|
-
ref?: ((instance: HTMLLIElement | null) => void) | React.RefObject<HTMLLIElement> | null | undefined;
|
|
48
|
-
}, "style" | "dense" | "disabled" | "action" | "selected" | "autoFocus" | "className" | "tabIndex" | "children" | "sx" | "classes" | "disableGutters" | "divider" | "onFocusVisible" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "TouchRippleProps" | "touchRippleRef"> & {
|
|
49
|
-
component?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
50
|
-
}, "ref">) & React.RefAttributes<HTMLElement>>;
|
|
33
|
+
} & Omit<MenuItemProps, "component">, "ref">) & React.RefAttributes<HTMLElement>>;
|
|
51
34
|
export { GridActionsCellItem };
|
|
@@ -12,7 +12,6 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
12
12
|
const GridActionsCellItem = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
13
13
|
const rootProps = useGridRootProps();
|
|
14
14
|
if (!props.showInMenu) {
|
|
15
|
-
var _rootProps$slotProps;
|
|
16
15
|
const {
|
|
17
16
|
label,
|
|
18
17
|
icon,
|
|
@@ -20,7 +19,7 @@ const GridActionsCellItem = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
20
19
|
} = props,
|
|
21
20
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
22
21
|
const handleClick = event => {
|
|
23
|
-
onClick
|
|
22
|
+
onClick?.(event);
|
|
24
23
|
};
|
|
25
24
|
return /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
|
|
26
25
|
ref: ref,
|
|
@@ -29,7 +28,7 @@ const GridActionsCellItem = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
29
28
|
"aria-label": label
|
|
30
29
|
}, other, {
|
|
31
30
|
onClick: handleClick
|
|
32
|
-
},
|
|
31
|
+
}, rootProps.slotProps?.baseIconButton, {
|
|
33
32
|
children: /*#__PURE__*/React.cloneElement(icon, {
|
|
34
33
|
fontSize: 'small'
|
|
35
34
|
})
|
|
@@ -44,9 +43,9 @@ const GridActionsCellItem = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
44
43
|
} = props,
|
|
45
44
|
other = _objectWithoutPropertiesLoose(props, _excluded2);
|
|
46
45
|
const handleClick = event => {
|
|
47
|
-
onClick
|
|
46
|
+
onClick?.(event);
|
|
48
47
|
if (closeMenuOnClick) {
|
|
49
|
-
closeMenu
|
|
48
|
+
closeMenu?.();
|
|
50
49
|
}
|
|
51
50
|
};
|
|
52
51
|
return /*#__PURE__*/_jsxs(MenuItem, _extends({
|
|
@@ -63,6 +62,10 @@ process.env.NODE_ENV !== "production" ? GridActionsCellItem.propTypes = {
|
|
|
63
62
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
64
63
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
65
64
|
// ----------------------------------------------------------------------
|
|
65
|
+
/**
|
|
66
|
+
* from https://mui.com/material-ui/api/button-base/#ButtonBase-prop-component
|
|
67
|
+
*/
|
|
68
|
+
component: PropTypes.elementType,
|
|
66
69
|
icon: PropTypes.element,
|
|
67
70
|
label: PropTypes.string.isRequired,
|
|
68
71
|
showInMenu: PropTypes.bool
|
|
@@ -3,6 +3,7 @@ import { SvgIconProps } from '@mui/material/SvgIcon';
|
|
|
3
3
|
import { GridRenderCellParams } from '../../models/params/gridCellParams';
|
|
4
4
|
import { GridColDef } from '../../models/colDef/gridColDef';
|
|
5
5
|
interface GridBooleanCellProps extends GridRenderCellParams, Omit<SvgIconProps, 'tabIndex' | 'id'> {
|
|
6
|
+
hideDescendantCount?: boolean;
|
|
6
7
|
}
|
|
7
8
|
declare function GridBooleanCellRaw(props: GridBooleanCellProps): React.JSX.Element;
|
|
8
9
|
declare namespace GridBooleanCellRaw {
|
|
@@ -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 = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "hasFocus", "tabIndex"];
|
|
3
|
+
const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "hasFocus", "tabIndex", "hideDescendantCount"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
@@ -76,6 +76,7 @@ process.env.NODE_ENV !== "production" ? GridBooleanCellRaw.propTypes = {
|
|
|
76
76
|
* If true, the cell is the active element.
|
|
77
77
|
*/
|
|
78
78
|
hasFocus: PropTypes.bool.isRequired,
|
|
79
|
+
hideDescendantCount: PropTypes.bool,
|
|
79
80
|
/**
|
|
80
81
|
* The grid row id.
|
|
81
82
|
*/
|
|
@@ -105,7 +106,7 @@ process.env.NODE_ENV !== "production" ? GridBooleanCellRaw.propTypes = {
|
|
|
105
106
|
const GridBooleanCell = /*#__PURE__*/React.memo(GridBooleanCellRaw);
|
|
106
107
|
export { GridBooleanCell };
|
|
107
108
|
export const renderBooleanCell = params => {
|
|
108
|
-
if (isAutoGeneratedRow(params.rowNode)) {
|
|
109
|
+
if (params.field !== '__row_group_by_columns_group__' && isAutoGeneratedRow(params.rowNode)) {
|
|
109
110
|
return '';
|
|
110
111
|
}
|
|
111
112
|
return /*#__PURE__*/_jsx(GridBooleanCell, _extends({}, params));
|
|
@@ -76,7 +76,6 @@ let warnedOnce = false;
|
|
|
76
76
|
// TODO(v7): Removing the wrapper will break the docs performance visualization demo.
|
|
77
77
|
|
|
78
78
|
const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
79
|
-
var _getActions, _ref, _rootProps$cellSelect, _rootProps$experiment;
|
|
80
79
|
const {
|
|
81
80
|
column,
|
|
82
81
|
rowId,
|
|
@@ -134,7 +133,7 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
134
133
|
value,
|
|
135
134
|
formattedValue
|
|
136
135
|
} = cellParamsWithAPI;
|
|
137
|
-
const canManageOwnFocus = column.type === 'actions' &&
|
|
136
|
+
const canManageOwnFocus = column.type === 'actions' && column.getActions?.(apiRef.current.getRowParams(rowId)).some(action => !action.props.disabled);
|
|
138
137
|
const tabIndex = (cellMode === 'view' || !isEditable) && !canManageOwnFocus ? cellParamsWithAPI.tabIndex : -1;
|
|
139
138
|
const {
|
|
140
139
|
classes: rootClasses,
|
|
@@ -161,7 +160,7 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
161
160
|
const handleRef = useForkRef(ref, cellRef);
|
|
162
161
|
const focusElementRef = React.useRef(null);
|
|
163
162
|
// @ts-expect-error To access `cellSelection` flag as it's a `premium` feature
|
|
164
|
-
const isSelectionMode =
|
|
163
|
+
const isSelectionMode = rootProps.cellSelection ?? false;
|
|
165
164
|
const position = gridPinnedColumnPositionLookup[pinnedPosition];
|
|
166
165
|
const showLeftBorder = shouldCellShowLeftBorder(position, sectionIndex);
|
|
167
166
|
const showRightBorder = shouldCellShowRightBorder(position, sectionIndex, sectionLength, rootProps.showCellVerticalBorder);
|
|
@@ -244,17 +243,17 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
244
243
|
return null;
|
|
245
244
|
}
|
|
246
245
|
let handleFocus = other.onFocus;
|
|
247
|
-
if (process.env.NODE_ENV === 'test' &&
|
|
246
|
+
if (process.env.NODE_ENV === 'test' && rootProps.experimentalFeatures?.warnIfFocusStateIsNotSynced) {
|
|
248
247
|
handleFocus = event => {
|
|
249
248
|
const focusedCell = gridFocusCellSelector(apiRef);
|
|
250
|
-
if (
|
|
249
|
+
if (focusedCell?.id === rowId && focusedCell.field === field) {
|
|
251
250
|
if (typeof other.onFocus === 'function') {
|
|
252
251
|
other.onFocus(event);
|
|
253
252
|
}
|
|
254
253
|
return;
|
|
255
254
|
}
|
|
256
255
|
if (!warnedOnce) {
|
|
257
|
-
console.warn([`MUI X: The cell with id=${rowId} and field=${field} received focus.`, `According to the state, the focus should be at id=${focusedCell
|
|
256
|
+
console.warn([`MUI X: The cell with id=${rowId} and field=${field} received focus.`, `According to the state, the focus should be at id=${focusedCell?.id}, field=${focusedCell?.field}.`, "Not syncing the state may cause unwanted behaviors since the `cellFocusIn` event won't be fired.", 'Call `fireEvent.mouseUp` before the `fireEvent.click` to sync the focus with the state.'].join('\n'));
|
|
258
257
|
warnedOnce = true;
|
|
259
258
|
}
|
|
260
259
|
};
|
|
@@ -274,10 +273,10 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
274
273
|
}, editCellStateRest);
|
|
275
274
|
children = column.renderEditCell(params);
|
|
276
275
|
classNames.push(gridClasses['cell--editing']);
|
|
277
|
-
classNames.push(rootClasses
|
|
276
|
+
classNames.push(rootClasses?.['cell--editing']);
|
|
278
277
|
}
|
|
279
278
|
if (children === undefined) {
|
|
280
|
-
const valueString = valueToRender
|
|
279
|
+
const valueString = valueToRender?.toString();
|
|
281
280
|
children = valueString;
|
|
282
281
|
title = valueString;
|
|
283
282
|
}
|
|
@@ -19,7 +19,6 @@ const useUtilityClasses = ownerState => {
|
|
|
19
19
|
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
20
20
|
};
|
|
21
21
|
function GridEditBooleanCell(props) {
|
|
22
|
-
var _rootProps$slotProps;
|
|
23
22
|
const {
|
|
24
23
|
id: idProp,
|
|
25
24
|
value,
|
|
@@ -68,7 +67,7 @@ function GridEditBooleanCell(props) {
|
|
|
68
67
|
checked: Boolean(valueState),
|
|
69
68
|
onChange: handleChange,
|
|
70
69
|
size: "small"
|
|
71
|
-
},
|
|
70
|
+
}, rootProps.slotProps?.baseCheckbox))
|
|
72
71
|
}));
|
|
73
72
|
}
|
|
74
73
|
process.env.NODE_ENV !== "production" ? GridEditBooleanCell.propTypes = {
|
|
@@ -43,7 +43,7 @@ function GridEditDateCell(props) {
|
|
|
43
43
|
} else if (valueProp instanceof Date) {
|
|
44
44
|
parsedDate = valueProp;
|
|
45
45
|
} else {
|
|
46
|
-
parsedDate = new Date((valueProp
|
|
46
|
+
parsedDate = new Date((valueProp ?? '').toString());
|
|
47
47
|
}
|
|
48
48
|
let formattedDate;
|
|
49
49
|
if (parsedDate == null || Number.isNaN(parsedDate.getTime())) {
|
|
@@ -96,8 +96,7 @@ function GridEditDateCell(props) {
|
|
|
96
96
|
}, [apiRef, field, id, onValueChange, parseValueToDate]);
|
|
97
97
|
React.useEffect(() => {
|
|
98
98
|
setValueState(state => {
|
|
99
|
-
|
|
100
|
-
if (valueTransformed.parsed !== state.parsed && ((_valueTransformed$par = valueTransformed.parsed) == null ? void 0 : _valueTransformed$par.getTime()) !== ((_state$parsed = state.parsed) == null ? void 0 : _state$parsed.getTime())) {
|
|
99
|
+
if (valueTransformed.parsed !== state.parsed && valueTransformed.parsed?.getTime() !== state.parsed?.getTime()) {
|
|
101
100
|
return valueTransformed;
|
|
102
101
|
}
|
|
103
102
|
return state;
|
|
@@ -70,7 +70,7 @@ const GridEditInputCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
70
70
|
}, [apiRef, debounceMs, field, id, onValueChange]);
|
|
71
71
|
const meta = apiRef.current.unstable_getEditCellMeta(id, field);
|
|
72
72
|
React.useEffect(() => {
|
|
73
|
-
if (
|
|
73
|
+
if (meta?.changeReason !== 'debouncedSetEditCellValue') {
|
|
74
74
|
setValueState(value);
|
|
75
75
|
}
|
|
76
76
|
}, [meta, value]);
|
|
@@ -86,7 +86,7 @@ const GridEditInputCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
86
86
|
ownerState: rootProps,
|
|
87
87
|
fullWidth: true,
|
|
88
88
|
type: colDef.type === 'number' ? colDef.type : 'text',
|
|
89
|
-
value: valueState
|
|
89
|
+
value: valueState ?? '',
|
|
90
90
|
onChange: handleChange,
|
|
91
91
|
endAdornment: isProcessingProps ? /*#__PURE__*/_jsx(rootProps.slots.loadIcon, {
|
|
92
92
|
fontSize: "small",
|
|
@@ -17,7 +17,6 @@ function isKeyboardEvent(event) {
|
|
|
17
17
|
return !!event.key;
|
|
18
18
|
}
|
|
19
19
|
function GridEditSingleSelectCell(props) {
|
|
20
|
-
var _rootProps$slotProps, _baseSelectProps$nati, _rootProps$slotProps2;
|
|
21
20
|
const rootProps = useGridRootProps();
|
|
22
21
|
const {
|
|
23
22
|
id,
|
|
@@ -35,17 +34,16 @@ function GridEditSingleSelectCell(props) {
|
|
|
35
34
|
const ref = React.useRef();
|
|
36
35
|
const inputRef = React.useRef();
|
|
37
36
|
const [open, setOpen] = React.useState(initialOpen);
|
|
38
|
-
const baseSelectProps =
|
|
39
|
-
const isSelectNative =
|
|
40
|
-
const _ref =
|
|
37
|
+
const baseSelectProps = rootProps.slotProps?.baseSelect || {};
|
|
38
|
+
const isSelectNative = baseSelectProps.native ?? false;
|
|
39
|
+
const _ref = rootProps.slotProps?.baseSelect || {},
|
|
41
40
|
{
|
|
42
41
|
MenuProps
|
|
43
42
|
} = _ref,
|
|
44
43
|
otherBaseSelectProps = _objectWithoutPropertiesLoose(_ref, _excluded2);
|
|
45
44
|
useEnhancedEffect(() => {
|
|
46
45
|
if (hasFocus) {
|
|
47
|
-
|
|
48
|
-
(_inputRef$current = inputRef.current) == null || _inputRef$current.focus();
|
|
46
|
+
inputRef.current?.focus();
|
|
49
47
|
}
|
|
50
48
|
}, [hasFocus]);
|
|
51
49
|
if (!isSingleSelectColDef(colDef)) {
|
|
@@ -113,9 +111,8 @@ function GridEditSingleSelectCell(props) {
|
|
|
113
111
|
fullWidth: true
|
|
114
112
|
}, other, otherBaseSelectProps, {
|
|
115
113
|
children: valueOptions.map(valueOption => {
|
|
116
|
-
var _rootProps$slotProps3;
|
|
117
114
|
const value = getOptionValue(valueOption);
|
|
118
|
-
return /*#__PURE__*/_createElement(rootProps.slots.baseSelectOption, _extends({},
|
|
115
|
+
return /*#__PURE__*/_createElement(rootProps.slots.baseSelectOption, _extends({}, rootProps.slotProps?.baseSelectOption || {}, {
|
|
119
116
|
native: isSelectNative,
|
|
120
117
|
key: value,
|
|
121
118
|
value: value
|
|
@@ -17,7 +17,6 @@ const useUtilityClasses = ownerState => {
|
|
|
17
17
|
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
18
18
|
};
|
|
19
19
|
export const ColumnHeaderMenuIcon = /*#__PURE__*/React.memo(props => {
|
|
20
|
-
var _rootProps$slotProps, _rootProps$slotProps2;
|
|
21
20
|
const {
|
|
22
21
|
colDef,
|
|
23
22
|
open,
|
|
@@ -41,7 +40,7 @@ export const ColumnHeaderMenuIcon = /*#__PURE__*/React.memo(props => {
|
|
|
41
40
|
children: /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, _extends({
|
|
42
41
|
title: apiRef.current.getLocaleText('columnMenuLabel'),
|
|
43
42
|
enterDelay: 1000
|
|
44
|
-
},
|
|
43
|
+
}, rootProps.slotProps?.baseTooltip, {
|
|
45
44
|
children: /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
|
|
46
45
|
ref: iconButtonRef,
|
|
47
46
|
tabIndex: -1,
|
|
@@ -53,7 +52,7 @@ export const ColumnHeaderMenuIcon = /*#__PURE__*/React.memo(props => {
|
|
|
53
52
|
"aria-expanded": open,
|
|
54
53
|
"aria-controls": open ? columnMenuId : undefined,
|
|
55
54
|
id: columnMenuButtonId
|
|
56
|
-
},
|
|
55
|
+
}, rootProps.slotProps?.baseIconButton, {
|
|
57
56
|
children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuIcon, {
|
|
58
57
|
fontSize: "small"
|
|
59
58
|
})
|
|
@@ -29,7 +29,6 @@ const useUtilityClasses = ownerState => {
|
|
|
29
29
|
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
30
30
|
};
|
|
31
31
|
function GridColumnGroupHeader(props) {
|
|
32
|
-
var _columnGroupsLookup$g;
|
|
33
32
|
const {
|
|
34
33
|
groupId,
|
|
35
34
|
width,
|
|
@@ -52,12 +51,12 @@ function GridColumnGroupHeader(props) {
|
|
|
52
51
|
const columnGroupsLookup = useGridSelector(apiRef, gridColumnGroupsLookupSelector);
|
|
53
52
|
const group = groupId ? columnGroupsLookup[groupId] : {};
|
|
54
53
|
const {
|
|
55
|
-
headerName = groupId
|
|
54
|
+
headerName = groupId ?? '',
|
|
56
55
|
description = '',
|
|
57
56
|
headerAlign = undefined
|
|
58
57
|
} = group;
|
|
59
58
|
let headerComponent;
|
|
60
|
-
const render = groupId &&
|
|
59
|
+
const render = groupId && columnGroupsLookup[groupId]?.renderHeaderGroup;
|
|
61
60
|
const renderParams = React.useMemo(() => ({
|
|
62
61
|
groupId,
|
|
63
62
|
headerName,
|
|
@@ -81,7 +80,7 @@ function GridColumnGroupHeader(props) {
|
|
|
81
80
|
depth,
|
|
82
81
|
isDragging: false
|
|
83
82
|
});
|
|
84
|
-
const label = headerName
|
|
83
|
+
const label = headerName ?? groupId;
|
|
85
84
|
const id = useId();
|
|
86
85
|
const elementId = groupId === null ? `empty-group-cell-${id}` : groupId;
|
|
87
86
|
const classes = useUtilityClasses(ownerState);
|
|
@@ -89,7 +88,7 @@ function GridColumnGroupHeader(props) {
|
|
|
89
88
|
if (hasFocus) {
|
|
90
89
|
const focusableElement = headerCellRef.current.querySelector('[tabindex="0"]');
|
|
91
90
|
const elementToFocus = focusableElement || headerCellRef.current;
|
|
92
|
-
elementToFocus
|
|
91
|
+
elementToFocus?.focus();
|
|
93
92
|
}
|
|
94
93
|
}, [apiRef, hasFocus]);
|
|
95
94
|
const publish = React.useCallback(eventName => event => {
|
|
@@ -22,7 +22,6 @@ const useUtilityClasses = ownerState => {
|
|
|
22
22
|
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
23
23
|
};
|
|
24
24
|
function GridColumnHeaderFilterIconButton(props) {
|
|
25
|
-
var _rootProps$slotProps, _rootProps$slotProps2;
|
|
26
25
|
const {
|
|
27
26
|
counter,
|
|
28
27
|
field,
|
|
@@ -67,7 +66,7 @@ function GridColumnHeaderFilterIconButton(props) {
|
|
|
67
66
|
"aria-haspopup": "menu",
|
|
68
67
|
"aria-expanded": open,
|
|
69
68
|
"aria-controls": open ? panelId : undefined
|
|
70
|
-
},
|
|
69
|
+
}, rootProps.slotProps?.baseIconButton, {
|
|
71
70
|
children: /*#__PURE__*/_jsx(rootProps.slots.columnFilteredIcon, {
|
|
72
71
|
className: classes.icon,
|
|
73
72
|
fontSize: "small"
|
|
@@ -76,7 +75,7 @@ function GridColumnHeaderFilterIconButton(props) {
|
|
|
76
75
|
return /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, _extends({
|
|
77
76
|
title: apiRef.current.getLocaleText('columnHeaderFiltersTooltipActive')(counter),
|
|
78
77
|
enterDelay: 1000
|
|
79
|
-
},
|
|
78
|
+
}, rootProps.slotProps?.baseTooltip, {
|
|
80
79
|
children: /*#__PURE__*/_jsxs(GridIconButtonContainer, {
|
|
81
80
|
children: [counter > 1 && /*#__PURE__*/_jsx(Badge, {
|
|
82
81
|
badgeContent: counter,
|
|
@@ -38,7 +38,6 @@ const useUtilityClasses = ownerState => {
|
|
|
38
38
|
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
39
39
|
};
|
|
40
40
|
function GridColumnHeaderItem(props) {
|
|
41
|
-
var _rootProps$slotProps, _colDef$sortingOrder, _rootProps$slotProps2, _colDef$headerName;
|
|
42
41
|
const {
|
|
43
42
|
colDef,
|
|
44
43
|
columnMenuOpen,
|
|
@@ -132,16 +131,16 @@ function GridColumnHeaderItem(props) {
|
|
|
132
131
|
open: columnMenuOpen,
|
|
133
132
|
target: iconButtonRef.current,
|
|
134
133
|
ContentComponent: rootProps.slots.columnMenu,
|
|
135
|
-
contentComponentProps:
|
|
134
|
+
contentComponentProps: rootProps.slotProps?.columnMenu,
|
|
136
135
|
onExited: handleExited
|
|
137
136
|
});
|
|
138
|
-
const sortingOrder =
|
|
137
|
+
const sortingOrder = colDef.sortingOrder ?? rootProps.sortingOrder;
|
|
139
138
|
const showSortIcon = (colDef.sortable || sortDirection != null) && !colDef.hideSortIcons && !rootProps.disableColumnSorting;
|
|
140
139
|
const columnTitleIconButtons = /*#__PURE__*/_jsxs(React.Fragment, {
|
|
141
140
|
children: [!rootProps.disableColumnFilter && /*#__PURE__*/_jsx(rootProps.slots.columnHeaderFilterIconButton, _extends({
|
|
142
141
|
field: colDef.field,
|
|
143
142
|
counter: filterItemsCounter
|
|
144
|
-
},
|
|
143
|
+
}, rootProps.slotProps?.columnHeaderFilterIconButton)), showSortIcon && /*#__PURE__*/_jsx(GridColumnHeaderSortIcon, {
|
|
145
144
|
direction: sortDirection,
|
|
146
145
|
index: sortIndex,
|
|
147
146
|
sortingOrder: sortingOrder,
|
|
@@ -153,7 +152,7 @@ function GridColumnHeaderItem(props) {
|
|
|
153
152
|
if (hasFocus && !columnMenuState.open) {
|
|
154
153
|
const focusableElement = headerCellRef.current.querySelector('[tabindex="0"]');
|
|
155
154
|
const elementToFocus = focusableElement || headerCellRef.current;
|
|
156
|
-
elementToFocus
|
|
155
|
+
elementToFocus?.focus();
|
|
157
156
|
apiRef.current.columnHeadersContainerRef.current.scrollLeft = 0;
|
|
158
157
|
}
|
|
159
158
|
}, [apiRef, hasFocus]);
|
|
@@ -161,7 +160,7 @@ function GridColumnHeaderItem(props) {
|
|
|
161
160
|
field: colDef.field,
|
|
162
161
|
colDef
|
|
163
162
|
}) : colDef.headerClassName;
|
|
164
|
-
const label =
|
|
163
|
+
const label = colDef.headerName ?? colDef.field;
|
|
165
164
|
return /*#__PURE__*/_jsx(GridGenericColumnHeaderItem, _extends({
|
|
166
165
|
ref: headerCellRef,
|
|
167
166
|
classes: classes,
|
|
@@ -35,7 +35,6 @@ function getIcon(icons, direction, className, sortingOrder) {
|
|
|
35
35
|
}, iconProps)) : null;
|
|
36
36
|
}
|
|
37
37
|
function GridColumnHeaderSortIconRaw(props) {
|
|
38
|
-
var _rootProps$slotProps;
|
|
39
38
|
const {
|
|
40
39
|
direction,
|
|
41
40
|
index,
|
|
@@ -58,7 +57,7 @@ function GridColumnHeaderSortIconRaw(props) {
|
|
|
58
57
|
title: apiRef.current.getLocaleText('columnHeaderSortIconLabel'),
|
|
59
58
|
size: "small",
|
|
60
59
|
disabled: disabled
|
|
61
|
-
},
|
|
60
|
+
}, rootProps.slotProps?.baseIconButton, {
|
|
62
61
|
children: iconElement
|
|
63
62
|
}));
|
|
64
63
|
return /*#__PURE__*/_jsxs(GridIconButtonContainer, {
|
|
@@ -44,7 +44,6 @@ const ColumnHeaderInnerTitle = /*#__PURE__*/React.forwardRef(function ColumnHead
|
|
|
44
44
|
});
|
|
45
45
|
// No React.memo here as if we display the sort icon, we need to recalculate the isOver
|
|
46
46
|
function GridColumnHeaderTitle(props) {
|
|
47
|
-
var _rootProps$slotProps;
|
|
48
47
|
const {
|
|
49
48
|
label,
|
|
50
49
|
description
|
|
@@ -53,7 +52,7 @@ function GridColumnHeaderTitle(props) {
|
|
|
53
52
|
const titleRef = React.useRef(null);
|
|
54
53
|
const [tooltip, setTooltip] = React.useState('');
|
|
55
54
|
const handleMouseOver = React.useCallback(() => {
|
|
56
|
-
if (!description && titleRef
|
|
55
|
+
if (!description && titleRef?.current) {
|
|
57
56
|
const isOver = isOverflown(titleRef.current);
|
|
58
57
|
if (isOver) {
|
|
59
58
|
setTooltip(label);
|
|
@@ -64,7 +63,7 @@ function GridColumnHeaderTitle(props) {
|
|
|
64
63
|
}, [description, label]);
|
|
65
64
|
return /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, _extends({
|
|
66
65
|
title: description || tooltip
|
|
67
|
-
},
|
|
66
|
+
}, rootProps.slotProps?.baseTooltip, {
|
|
68
67
|
children: /*#__PURE__*/_jsx(ColumnHeaderInnerTitle, {
|
|
69
68
|
onMouseOver: handleMouseOver,
|
|
70
69
|
ref: titleRef,
|
|
@@ -55,7 +55,7 @@ const GridGenericColumnHeaderItem = /*#__PURE__*/React.forwardRef(function GridG
|
|
|
55
55
|
if (hasFocus && !columnMenuState.open) {
|
|
56
56
|
const focusableElement = headerCellRef.current.querySelector('[tabindex="0"]');
|
|
57
57
|
const elementToFocus = focusableElement || headerCellRef.current;
|
|
58
|
-
elementToFocus
|
|
58
|
+
elementToFocus?.focus();
|
|
59
59
|
apiRef.current.columnHeadersContainerRef.current.scrollLeft = 0;
|
|
60
60
|
}
|
|
61
61
|
}, [apiRef, hasFocus]);
|
|
@@ -18,7 +18,6 @@ const useUtilityClasses = ownerState => {
|
|
|
18
18
|
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
19
19
|
};
|
|
20
20
|
const GridCellCheckboxForwardRef = /*#__PURE__*/React.forwardRef(function GridCellCheckboxRenderer(props, ref) {
|
|
21
|
-
var _rootProps$slotProps;
|
|
22
21
|
const {
|
|
23
22
|
field,
|
|
24
23
|
id,
|
|
@@ -54,9 +53,8 @@ const GridCellCheckboxForwardRef = /*#__PURE__*/React.forwardRef(function GridCe
|
|
|
54
53
|
}, [apiRef, tabIndex, id, field]);
|
|
55
54
|
React.useEffect(() => {
|
|
56
55
|
if (hasFocus) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
input == null || input.focus({
|
|
56
|
+
const input = checkboxElement.current?.querySelector('input');
|
|
57
|
+
input?.focus({
|
|
60
58
|
preventScroll: true
|
|
61
59
|
});
|
|
62
60
|
} else if (rippleRef.current) {
|
|
@@ -88,7 +86,7 @@ const GridCellCheckboxForwardRef = /*#__PURE__*/React.forwardRef(function GridCe
|
|
|
88
86
|
onKeyDown: handleKeyDown,
|
|
89
87
|
disabled: !isSelectable,
|
|
90
88
|
touchRippleRef: rippleRef /* FIXME: typing error */
|
|
91
|
-
},
|
|
89
|
+
}, rootProps.slotProps?.baseCheckbox, other));
|
|
92
90
|
});
|
|
93
91
|
process.env.NODE_ENV !== "production" ? GridCellCheckboxForwardRef.propTypes = {
|
|
94
92
|
// ----------------------------- Warning --------------------------------
|
|
@@ -24,7 +24,6 @@ const useUtilityClasses = ownerState => {
|
|
|
24
24
|
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
25
25
|
};
|
|
26
26
|
const GridHeaderCheckbox = /*#__PURE__*/React.forwardRef(function GridHeaderCheckbox(props, ref) {
|
|
27
|
-
var _rootProps$slotProps;
|
|
28
27
|
const other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
29
28
|
const [, forceUpdate] = React.useState(false);
|
|
30
29
|
const apiRef = useGridApiContext();
|
|
@@ -106,7 +105,7 @@ const GridHeaderCheckbox = /*#__PURE__*/React.forwardRef(function GridHeaderChec
|
|
|
106
105
|
tabIndex: tabIndex,
|
|
107
106
|
onKeyDown: handleKeyDown,
|
|
108
107
|
disabled: !isMultipleRowSelectionEnabled(rootProps)
|
|
109
|
-
},
|
|
108
|
+
}, rootProps.slotProps?.baseCheckbox, other));
|
|
110
109
|
});
|
|
111
110
|
process.env.NODE_ENV !== "production" ? GridHeaderCheckbox.propTypes = {
|
|
112
111
|
// ----------------------------- Warning --------------------------------
|