@mui/x-data-grid 7.0.0-beta.6 → 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 +311 -12
- package/DataGrid/DataGrid.js +57 -17
- package/DataGrid/useDataGridComponent.js +3 -0
- package/DataGrid/useDataGridProps.js +6 -7
- package/README.md +1 -1
- package/components/GridColumnHeaders.d.ts +1 -2
- package/components/GridColumnHeaders.js +6 -17
- package/components/GridFooter.js +2 -3
- package/components/GridHeader.js +1 -2
- package/components/GridHeaders.js +1 -4
- package/components/GridPagination.d.ts +6 -5
- package/components/GridPagination.js +14 -11
- package/components/GridRow.d.ts +1 -1
- package/components/GridRow.js +17 -36
- package/components/GridScrollArea.d.ts +10 -0
- package/components/GridScrollArea.js +150 -0
- 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.d.ts +7 -0
- package/components/cell/GridCell.js +18 -11
- 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/GridBaseColumnHeaders.js +1 -0
- package/components/columnHeaders/GridColumnGroupHeader.d.ts +5 -0
- package/components/columnHeaders/GridColumnGroupHeader.js +22 -13
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.js +2 -3
- package/components/columnHeaders/GridColumnHeaderItem.d.ts +5 -0
- package/components/columnHeaders/GridColumnHeaderItem.js +26 -12
- package/components/columnHeaders/GridColumnHeaderSortIcon.js +1 -2
- package/components/columnHeaders/GridColumnHeaderTitle.js +2 -3
- package/components/columnHeaders/GridGenericColumnHeaderItem.d.ts +1 -0
- package/components/columnHeaders/GridGenericColumnHeaderItem.js +7 -6
- 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/containers/GridRootStyles.js +12 -20
- 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/GridVirtualScrollbar.js +4 -0
- package/components/virtualization/GridVirtualScroller.js +6 -1
- package/components/virtualization/GridVirtualScrollerContent.js +1 -2
- package/components/virtualization/GridVirtualScrollerFiller.js +2 -1
- package/components/virtualization/GridVirtualScrollerRenderZone.js +1 -2
- package/constants/gridClasses.d.ts +6 -32
- package/constants/gridClasses.js +1 -1
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +5 -1
- 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.d.ts +23 -7
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +186 -101
- package/hooks/features/columnMenu/useGridColumnMenuSlots.js +2 -2
- package/hooks/features/columnResize/columnResizeSelector.d.ts +3 -0
- package/hooks/features/columnResize/columnResizeSelector.js +3 -0
- package/hooks/features/columnResize/columnResizeState.d.ts +3 -0
- package/hooks/features/columnResize/columnResizeState.js +1 -0
- package/hooks/features/columnResize/gridColumnResizeApi.d.ts +44 -0
- package/hooks/features/columnResize/gridColumnResizeApi.js +10 -0
- package/hooks/features/columnResize/index.d.ts +3 -0
- package/hooks/features/columnResize/index.js +3 -0
- package/hooks/features/columnResize/useGridColumnResize.d.ts +10 -0
- package/hooks/features/columnResize/useGridColumnResize.js +553 -0
- package/hooks/features/columns/gridColumnsSelector.js +1 -2
- package/hooks/features/columns/gridColumnsUtils.d.ts +0 -9
- package/hooks/features/columns/gridColumnsUtils.js +5 -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 +7 -10
- package/hooks/features/editing/useGridCellEditing.js +25 -8
- 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 +17 -22
- 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.d.ts +1 -0
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +3 -0
- package/hooks/features/headerFiltering/useGridHeaderFiltering.js +23 -5
- package/hooks/features/index.d.ts +1 -0
- package/hooks/features/index.js +1 -0
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +1 -2
- package/hooks/features/pagination/gridPaginationInterfaces.d.ts +19 -2
- package/hooks/features/pagination/gridPaginationSelector.d.ts +5 -0
- package/hooks/features/pagination/gridPaginationSelector.js +9 -4
- package/hooks/features/pagination/useGridPagination.d.ts +1 -6
- package/hooks/features/pagination/useGridPagination.js +9 -158
- package/hooks/features/pagination/useGridPaginationModel.d.ts +11 -0
- package/hooks/features/pagination/useGridPaginationModel.js +165 -0
- package/hooks/features/pagination/useGridRowCount.d.ts +8 -0
- package/hooks/features/pagination/useGridRowCount.js +94 -0
- 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 +3 -4
- package/hooks/features/sorting/gridSortingSelector.js +4 -7
- package/hooks/features/sorting/useGridSorting.js +8 -14
- package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +4 -4
- package/hooks/features/virtualization/gridVirtualizationSelectors.js +0 -2
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +3 -3
- package/hooks/features/virtualization/useGridVirtualScroller.js +220 -71
- package/hooks/utils/useGridApiEventHandler.js +5 -10
- package/hooks/utils/useGridNativeEventListener.js +1 -2
- package/hooks/utils/useLazyRef.d.ts +1 -2
- package/hooks/utils/useLazyRef.js +1 -11
- package/hooks/utils/useOnMount.d.ts +1 -2
- package/hooks/utils/useOnMount.js +1 -7
- package/hooks/utils/useTimeout.d.ts +1 -11
- package/hooks/utils/useTimeout.js +1 -36
- package/index.js +1 -1
- package/internals/index.d.ts +3 -1
- package/internals/index.js +2 -1
- package/internals/utils/getPinnedCellOffset.d.ts +3 -0
- package/internals/utils/getPinnedCellOffset.js +17 -0
- package/internals/utils/useProps.js +1 -2
- package/joy/joySlots.js +18 -63
- package/locales/jaJP.js +3 -4
- package/material/index.js +0 -2
- package/models/api/gridApiCommon.d.ts +3 -3
- package/models/api/gridCoreApi.d.ts +1 -5
- 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 +13 -0
- package/models/gridExport.d.ts +6 -0
- package/models/gridHeaderFilteringModel.d.ts +1 -0
- package/models/gridSlotsComponent.d.ts +0 -5
- package/models/gridStateCommunity.d.ts +3 -0
- package/models/params/gridScrollParams.d.ts +5 -3
- package/models/props/DataGridProps.d.ts +58 -28
- package/modern/DataGrid/DataGrid.js +57 -17
- package/modern/DataGrid/useDataGridComponent.js +3 -0
- package/modern/DataGrid/useDataGridProps.js +6 -7
- package/modern/components/GridColumnHeaders.js +6 -17
- package/modern/components/GridHeaders.js +1 -4
- package/modern/components/GridPagination.js +13 -6
- package/modern/components/GridRow.js +4 -19
- package/modern/components/GridScrollArea.js +150 -0
- 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/cell/GridCell.js +11 -3
- package/modern/components/columnHeaders/GridBaseColumnHeaders.js +1 -0
- package/modern/components/columnHeaders/GridColumnGroupHeader.js +18 -8
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +21 -6
- package/modern/components/columnHeaders/GridGenericColumnHeaderItem.js +6 -5
- package/modern/components/containers/GridRoot.js +3 -3
- package/modern/components/containers/GridRootStyles.js +12 -20
- 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/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/modern/components/virtualization/GridVirtualScroller.js +6 -1
- package/modern/components/virtualization/GridVirtualScrollerFiller.js +2 -1
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/features/clipboard/useGridClipboard.js +4 -2
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +184 -97
- package/modern/hooks/features/columnResize/columnResizeSelector.js +3 -0
- package/modern/hooks/features/columnResize/columnResizeState.js +1 -0
- package/modern/hooks/features/columnResize/gridColumnResizeApi.js +10 -0
- package/modern/hooks/features/columnResize/index.js +3 -0
- package/modern/hooks/features/columnResize/useGridColumnResize.js +553 -0
- package/modern/hooks/features/columns/gridColumnsUtils.js +4 -20
- package/modern/hooks/features/density/densitySelector.js +8 -2
- package/modern/hooks/features/density/useGridDensity.js +21 -29
- package/modern/hooks/features/dimensions/useGridDimensions.js +4 -5
- package/modern/hooks/features/editing/useGridCellEditing.js +22 -3
- 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/export/useGridPrintExport.js +8 -7
- package/modern/hooks/features/filter/gridFilterUtils.js +1 -1
- package/modern/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +3 -0
- package/modern/hooks/features/headerFiltering/useGridHeaderFiltering.js +21 -2
- package/modern/hooks/features/index.js +1 -0
- package/modern/hooks/features/pagination/gridPaginationSelector.js +8 -2
- package/modern/hooks/features/pagination/useGridPagination.js +8 -149
- package/modern/hooks/features/pagination/useGridPaginationModel.js +165 -0
- package/modern/hooks/features/pagination/useGridRowCount.js +94 -0
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +3 -2
- package/modern/hooks/features/scroll/useGridScroll.js +1 -1
- package/modern/hooks/features/virtualization/gridVirtualizationSelectors.js +0 -2
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +211 -57
- package/modern/hooks/utils/useLazyRef.js +1 -11
- package/modern/hooks/utils/useOnMount.js +1 -7
- package/modern/hooks/utils/useTimeout.js +1 -36
- package/modern/index.js +1 -1
- package/modern/internals/index.js +2 -1
- package/modern/internals/utils/getPinnedCellOffset.js +17 -0
- package/modern/joy/joySlots.js +11 -50
- package/modern/locales/jaJP.js +3 -4
- package/modern/material/index.js +0 -2
- package/modern/models/api/index.js +0 -1
- package/modern/utils/cellBorderUtils.js +8 -0
- package/modern/utils/createSelector.js +1 -1
- package/modern/utils/domUtils.js +144 -0
- package/modern/utils/keyboardUtils.js +1 -1
- package/node/DataGrid/DataGrid.js +57 -17
- package/node/DataGrid/useDataGridComponent.js +3 -0
- package/node/DataGrid/useDataGridProps.js +6 -7
- package/node/components/GridColumnHeaders.js +6 -16
- package/node/components/GridHeaders.js +1 -4
- package/node/components/GridPagination.js +10 -4
- package/node/components/GridRow.js +3 -18
- package/node/components/GridScrollArea.js +158 -0
- 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/cell/GridCell.js +12 -4
- package/node/components/columnHeaders/GridBaseColumnHeaders.js +1 -0
- package/node/components/columnHeaders/GridColumnGroupHeader.js +18 -8
- package/node/components/columnHeaders/GridColumnHeaderItem.js +21 -6
- package/node/components/columnHeaders/GridGenericColumnHeaderItem.js +6 -5
- package/node/components/containers/GridRoot.js +2 -2
- package/node/components/containers/GridRootStyles.js +12 -20
- 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/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/node/components/virtualization/GridVirtualScroller.js +6 -1
- package/node/components/virtualization/GridVirtualScrollerFiller.js +2 -1
- package/node/constants/gridClasses.js +1 -1
- package/node/hooks/features/clipboard/useGridClipboard.js +4 -2
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +190 -103
- package/node/hooks/features/columnResize/columnResizeSelector.js +10 -0
- package/node/hooks/features/columnResize/columnResizeState.js +5 -0
- package/node/hooks/features/columnResize/gridColumnResizeApi.js +16 -0
- package/node/hooks/features/columnResize/index.js +38 -0
- package/node/hooks/features/columnResize/useGridColumnResize.js +564 -0
- package/node/hooks/features/columns/gridColumnsUtils.js +4 -21
- package/node/hooks/features/density/densitySelector.js +9 -3
- package/node/hooks/features/density/useGridDensity.js +22 -30
- package/node/hooks/features/dimensions/useGridDimensions.js +4 -5
- package/node/hooks/features/editing/useGridCellEditing.js +22 -3
- 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/export/useGridPrintExport.js +8 -7
- package/node/hooks/features/filter/gridFilterUtils.js +1 -1
- package/node/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +4 -1
- package/node/hooks/features/headerFiltering/useGridHeaderFiltering.js +21 -2
- package/node/hooks/features/index.js +11 -0
- package/node/hooks/features/pagination/gridPaginationSelector.js +8 -2
- package/node/hooks/features/pagination/useGridPagination.js +9 -153
- package/node/hooks/features/pagination/useGridPaginationModel.js +176 -0
- package/node/hooks/features/pagination/useGridRowCount.js +103 -0
- package/node/hooks/features/rowSelection/useGridRowSelection.js +2 -1
- package/node/hooks/features/scroll/useGridScroll.js +1 -1
- package/node/hooks/features/virtualization/gridVirtualizationSelectors.js +0 -2
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +211 -57
- package/node/hooks/utils/useLazyRef.js +7 -13
- package/node/hooks/utils/useOnMount.js +8 -10
- package/node/hooks/utils/useTimeout.js +7 -37
- package/node/index.js +1 -1
- package/node/internals/index.js +27 -8
- package/node/internals/utils/getPinnedCellOffset.js +24 -0
- package/node/joy/joySlots.js +11 -50
- package/node/locales/jaJP.js +3 -4
- package/node/material/index.js +0 -2
- package/node/models/api/index.js +0 -11
- package/node/utils/cellBorderUtils.js +16 -0
- package/node/utils/createSelector.js +1 -1
- package/node/utils/domUtils.js +155 -0
- package/node/utils/keyboardUtils.js +1 -1
- package/package.json +4 -4
- package/utils/cellBorderUtils.d.ts +3 -0
- package/utils/cellBorderUtils.js +8 -0
- package/utils/createSelector.js +9 -9
- package/utils/domUtils.d.ts +14 -1
- package/utils/domUtils.js +144 -0
- package/utils/getGridLocalization.js +9 -12
- package/utils/keyboardUtils.js +1 -1
- package/components/columnHeaders/GridColumnHeadersInner.d.ts +0 -8
- package/components/columnHeaders/GridColumnHeadersInner.js +0 -58
- package/modern/components/columnHeaders/GridColumnHeadersInner.js +0 -58
- package/node/components/columnHeaders/GridColumnHeadersInner.js +0 -67
|
@@ -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));
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridRowId, GridEditCellProps } from '../../models';
|
|
3
3
|
import { GridColDef, GridAlignment } from '../../models/colDef/gridColDef';
|
|
4
|
+
import { GridPinnedColumnPosition } from '../../hooks/features/columns/gridColumnsInterfaces';
|
|
4
5
|
export declare enum PinnedPosition {
|
|
5
6
|
NONE = 0,
|
|
6
7
|
LEFT = 1,
|
|
7
8
|
RIGHT = 2,
|
|
8
9
|
VIRTUAL = 3
|
|
9
10
|
}
|
|
11
|
+
export declare const gridPinnedColumnPositionLookup: {
|
|
12
|
+
1: GridPinnedColumnPosition;
|
|
13
|
+
2: GridPinnedColumnPosition;
|
|
14
|
+
0: undefined;
|
|
15
|
+
3: undefined;
|
|
16
|
+
};
|
|
10
17
|
export type GridCellProps = {
|
|
11
18
|
align: GridAlignment;
|
|
12
19
|
className?: string;
|
|
@@ -15,6 +15,8 @@ import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
|
15
15
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
16
16
|
import { gridFocusCellSelector } from '../../hooks/features/focus/gridFocusStateSelector';
|
|
17
17
|
import { MissingRowIdError } from '../../hooks/features/rows/useGridParamsApi';
|
|
18
|
+
import { shouldCellShowLeftBorder, shouldCellShowRightBorder } from '../../utils/cellBorderUtils';
|
|
19
|
+
import { GridPinnedColumnPosition } from '../../hooks/features/columns/gridColumnsInterfaces';
|
|
18
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
21
|
export let PinnedPosition = /*#__PURE__*/function (PinnedPosition) {
|
|
20
22
|
PinnedPosition[PinnedPosition["NONE"] = 0] = "NONE";
|
|
@@ -23,6 +25,12 @@ export let PinnedPosition = /*#__PURE__*/function (PinnedPosition) {
|
|
|
23
25
|
PinnedPosition[PinnedPosition["VIRTUAL"] = 3] = "VIRTUAL";
|
|
24
26
|
return PinnedPosition;
|
|
25
27
|
}({});
|
|
28
|
+
export const gridPinnedColumnPositionLookup = {
|
|
29
|
+
[PinnedPosition.LEFT]: GridPinnedColumnPosition.LEFT,
|
|
30
|
+
[PinnedPosition.RIGHT]: GridPinnedColumnPosition.RIGHT,
|
|
31
|
+
[PinnedPosition.NONE]: undefined,
|
|
32
|
+
[PinnedPosition.VIRTUAL]: undefined
|
|
33
|
+
};
|
|
26
34
|
const EMPTY_CELL_PARAMS = {
|
|
27
35
|
id: -1,
|
|
28
36
|
field: '__unset__',
|
|
@@ -68,7 +76,6 @@ let warnedOnce = false;
|
|
|
68
76
|
// TODO(v7): Removing the wrapper will break the docs performance visualization demo.
|
|
69
77
|
|
|
70
78
|
const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
71
|
-
var _getActions, _ref, _rootProps$cellSelect, _rootProps$experiment;
|
|
72
79
|
const {
|
|
73
80
|
column,
|
|
74
81
|
rowId,
|
|
@@ -126,7 +133,7 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
126
133
|
value,
|
|
127
134
|
formattedValue
|
|
128
135
|
} = cellParamsWithAPI;
|
|
129
|
-
const canManageOwnFocus = column.type === 'actions' &&
|
|
136
|
+
const canManageOwnFocus = column.type === 'actions' && column.getActions?.(apiRef.current.getRowParams(rowId)).some(action => !action.props.disabled);
|
|
130
137
|
const tabIndex = (cellMode === 'view' || !isEditable) && !canManageOwnFocus ? cellParamsWithAPI.tabIndex : -1;
|
|
131
138
|
const {
|
|
132
139
|
classes: rootClasses,
|
|
@@ -153,10 +160,10 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
153
160
|
const handleRef = useForkRef(ref, cellRef);
|
|
154
161
|
const focusElementRef = React.useRef(null);
|
|
155
162
|
// @ts-expect-error To access `cellSelection` flag as it's a `premium` feature
|
|
156
|
-
const isSelectionMode =
|
|
157
|
-
const
|
|
158
|
-
const showLeftBorder =
|
|
159
|
-
const showRightBorder =
|
|
163
|
+
const isSelectionMode = rootProps.cellSelection ?? false;
|
|
164
|
+
const position = gridPinnedColumnPositionLookup[pinnedPosition];
|
|
165
|
+
const showLeftBorder = shouldCellShowLeftBorder(position, sectionIndex);
|
|
166
|
+
const showRightBorder = shouldCellShowRightBorder(position, sectionIndex, sectionLength, rootProps.showCellVerticalBorder);
|
|
160
167
|
const ownerState = {
|
|
161
168
|
align,
|
|
162
169
|
showLeftBorder,
|
|
@@ -236,17 +243,17 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
236
243
|
return null;
|
|
237
244
|
}
|
|
238
245
|
let handleFocus = other.onFocus;
|
|
239
|
-
if (process.env.NODE_ENV === 'test' &&
|
|
246
|
+
if (process.env.NODE_ENV === 'test' && rootProps.experimentalFeatures?.warnIfFocusStateIsNotSynced) {
|
|
240
247
|
handleFocus = event => {
|
|
241
248
|
const focusedCell = gridFocusCellSelector(apiRef);
|
|
242
|
-
if (
|
|
249
|
+
if (focusedCell?.id === rowId && focusedCell.field === field) {
|
|
243
250
|
if (typeof other.onFocus === 'function') {
|
|
244
251
|
other.onFocus(event);
|
|
245
252
|
}
|
|
246
253
|
return;
|
|
247
254
|
}
|
|
248
255
|
if (!warnedOnce) {
|
|
249
|
-
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'));
|
|
250
257
|
warnedOnce = true;
|
|
251
258
|
}
|
|
252
259
|
};
|
|
@@ -266,10 +273,10 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
266
273
|
}, editCellStateRest);
|
|
267
274
|
children = column.renderEditCell(params);
|
|
268
275
|
classNames.push(gridClasses['cell--editing']);
|
|
269
|
-
classNames.push(rootClasses
|
|
276
|
+
classNames.push(rootClasses?.['cell--editing']);
|
|
270
277
|
}
|
|
271
278
|
if (children === undefined) {
|
|
272
|
-
const valueString = valueToRender
|
|
279
|
+
const valueString = valueToRender?.toString();
|
|
273
280
|
children = valueString;
|
|
274
281
|
title = valueString;
|
|
275
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
|
})
|
|
@@ -23,6 +23,7 @@ const GridColumnHeadersRoot = styled('div', {
|
|
|
23
23
|
overridesResolver: (props, styles) => styles.columnHeaders
|
|
24
24
|
})({
|
|
25
25
|
display: 'flex',
|
|
26
|
+
flexDirection: 'column',
|
|
26
27
|
borderTopLeftRadius: 'var(--unstable_DataGrid-radius)',
|
|
27
28
|
borderTopRightRadius: 'var(--unstable_DataGrid-radius)'
|
|
28
29
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { GridPinnedColumnPosition } from '../../hooks/features/columns/gridColumnsInterfaces';
|
|
2
3
|
interface GridColumnGroupHeaderProps {
|
|
3
4
|
groupId: string | null;
|
|
4
5
|
width: number;
|
|
@@ -10,6 +11,10 @@ interface GridColumnGroupHeaderProps {
|
|
|
10
11
|
height: number;
|
|
11
12
|
hasFocus?: boolean;
|
|
12
13
|
tabIndex: 0 | -1;
|
|
14
|
+
pinnedPosition?: GridPinnedColumnPosition;
|
|
15
|
+
style?: React.CSSProperties;
|
|
16
|
+
indexInSection: number;
|
|
17
|
+
sectionLength: number;
|
|
13
18
|
}
|
|
14
19
|
declare function GridColumnGroupHeader(props: GridColumnGroupHeaderProps): React.JSX.Element;
|
|
15
20
|
export { GridColumnGroupHeader };
|
|
@@ -8,17 +8,20 @@ import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
|
8
8
|
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
9
9
|
import { GridGenericColumnHeaderItem } from './GridGenericColumnHeaderItem';
|
|
10
10
|
import { isEventTargetInPortal } from '../../utils/domUtils';
|
|
11
|
+
import { shouldCellShowLeftBorder, shouldCellShowRightBorder } from '../../utils/cellBorderUtils';
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
const useUtilityClasses = ownerState => {
|
|
13
14
|
const {
|
|
14
15
|
classes,
|
|
15
16
|
headerAlign,
|
|
16
17
|
isDragging,
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
showLeftBorder,
|
|
19
|
+
showRightBorder,
|
|
20
|
+
groupId,
|
|
21
|
+
pinnedPosition
|
|
19
22
|
} = ownerState;
|
|
20
23
|
const slots = {
|
|
21
|
-
root: ['columnHeader', headerAlign === 'left' && 'columnHeader--alignLeft', headerAlign === 'center' && 'columnHeader--alignCenter', headerAlign === 'right' && 'columnHeader--alignRight', isDragging && 'columnHeader--moving',
|
|
24
|
+
root: ['columnHeader', headerAlign === 'left' && 'columnHeader--alignLeft', headerAlign === 'center' && 'columnHeader--alignCenter', headerAlign === 'right' && 'columnHeader--alignRight', isDragging && 'columnHeader--moving', showRightBorder && 'columnHeader--withRightBorder', showLeftBorder && 'columnHeader--withLeftBorder', 'withBorderColor', groupId === null ? 'columnHeader--emptyGroup' : 'columnHeader--filledGroup', pinnedPosition === 'left' && 'columnHeader--pinnedLeft', pinnedPosition === 'right' && 'columnHeader--pinnedRight'],
|
|
22
25
|
draggableContainer: ['columnHeaderDraggableContainer'],
|
|
23
26
|
titleContainer: ['columnHeaderTitleContainer', 'withBorderColor'],
|
|
24
27
|
titleContainerContent: ['columnHeaderTitleContainerContent']
|
|
@@ -26,7 +29,6 @@ const useUtilityClasses = ownerState => {
|
|
|
26
29
|
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
27
30
|
};
|
|
28
31
|
function GridColumnGroupHeader(props) {
|
|
29
|
-
var _columnGroupsLookup$g;
|
|
30
32
|
const {
|
|
31
33
|
groupId,
|
|
32
34
|
width,
|
|
@@ -37,7 +39,11 @@ function GridColumnGroupHeader(props) {
|
|
|
37
39
|
colIndex,
|
|
38
40
|
hasFocus,
|
|
39
41
|
tabIndex,
|
|
40
|
-
isLastColumn
|
|
42
|
+
isLastColumn,
|
|
43
|
+
pinnedPosition,
|
|
44
|
+
style,
|
|
45
|
+
indexInSection,
|
|
46
|
+
sectionLength
|
|
41
47
|
} = props;
|
|
42
48
|
const rootProps = useGridRootProps();
|
|
43
49
|
const headerCellRef = React.useRef(null);
|
|
@@ -45,12 +51,12 @@ function GridColumnGroupHeader(props) {
|
|
|
45
51
|
const columnGroupsLookup = useGridSelector(apiRef, gridColumnGroupsLookupSelector);
|
|
46
52
|
const group = groupId ? columnGroupsLookup[groupId] : {};
|
|
47
53
|
const {
|
|
48
|
-
headerName = groupId
|
|
54
|
+
headerName = groupId ?? '',
|
|
49
55
|
description = '',
|
|
50
56
|
headerAlign = undefined
|
|
51
57
|
} = group;
|
|
52
58
|
let headerComponent;
|
|
53
|
-
const render = groupId &&
|
|
59
|
+
const render = groupId && columnGroupsLookup[groupId]?.renderHeaderGroup;
|
|
54
60
|
const renderParams = React.useMemo(() => ({
|
|
55
61
|
groupId,
|
|
56
62
|
headerName,
|
|
@@ -64,15 +70,17 @@ function GridColumnGroupHeader(props) {
|
|
|
64
70
|
if (groupId && render) {
|
|
65
71
|
headerComponent = render(renderParams);
|
|
66
72
|
}
|
|
67
|
-
const
|
|
73
|
+
const showLeftBorder = shouldCellShowLeftBorder(pinnedPosition, indexInSection);
|
|
74
|
+
const showRightBorder = shouldCellShowRightBorder(pinnedPosition, indexInSection, sectionLength, rootProps.showCellVerticalBorder);
|
|
68
75
|
const ownerState = _extends({}, props, {
|
|
69
76
|
classes: rootProps.classes,
|
|
70
|
-
|
|
77
|
+
showLeftBorder,
|
|
78
|
+
showRightBorder,
|
|
71
79
|
headerAlign,
|
|
72
80
|
depth,
|
|
73
81
|
isDragging: false
|
|
74
82
|
});
|
|
75
|
-
const label = headerName
|
|
83
|
+
const label = headerName ?? groupId;
|
|
76
84
|
const id = useId();
|
|
77
85
|
const elementId = groupId === null ? `empty-group-cell-${id}` : groupId;
|
|
78
86
|
const classes = useUtilityClasses(ownerState);
|
|
@@ -80,7 +88,7 @@ function GridColumnGroupHeader(props) {
|
|
|
80
88
|
if (hasFocus) {
|
|
81
89
|
const focusableElement = headerCellRef.current.querySelector('[tabindex="0"]');
|
|
82
90
|
const elementToFocus = focusableElement || headerCellRef.current;
|
|
83
|
-
elementToFocus
|
|
91
|
+
elementToFocus?.focus();
|
|
84
92
|
}
|
|
85
93
|
}, [apiRef, hasFocus]);
|
|
86
94
|
const publish = React.useCallback(eventName => event => {
|
|
@@ -118,12 +126,13 @@ function GridColumnGroupHeader(props) {
|
|
|
118
126
|
width: width,
|
|
119
127
|
columnMenuIconButton: null,
|
|
120
128
|
columnTitleIconButtons: null,
|
|
121
|
-
resizable:
|
|
129
|
+
resizable: true,
|
|
122
130
|
label: label,
|
|
123
131
|
"aria-colspan": fields.length
|
|
124
132
|
// The fields are wrapped between |-...-| to avoid confusion between fields "id" and "id2" when using selector data-fields~=
|
|
125
133
|
,
|
|
126
|
-
"data-fields": `|-${fields.join('-|-')}
|
|
134
|
+
"data-fields": `|-${fields.join('-|-')}-|`,
|
|
135
|
+
style: style
|
|
127
136
|
}, mouseEventsHandlers));
|
|
128
137
|
}
|
|
129
138
|
export { GridColumnGroupHeader };
|
|
@@ -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,
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { GridStateColDef } from '../../models/colDef/gridColDef';
|
|
3
3
|
import { GridSortDirection } from '../../models/gridSortModel';
|
|
4
4
|
import { GridColumnHeaderSeparatorProps } from './GridColumnHeaderSeparator';
|
|
5
|
+
import { GridPinnedColumnPosition } from '../../hooks/features/columns/gridColumnsInterfaces';
|
|
5
6
|
interface GridColumnHeaderItemProps {
|
|
6
7
|
colIndex: number;
|
|
7
8
|
colDef: GridStateColDef;
|
|
@@ -16,6 +17,10 @@ interface GridColumnHeaderItemProps {
|
|
|
16
17
|
tabIndex: 0 | -1;
|
|
17
18
|
disableReorder?: boolean;
|
|
18
19
|
separatorSide?: GridColumnHeaderSeparatorProps['side'];
|
|
20
|
+
pinnedPosition?: GridPinnedColumnPosition;
|
|
21
|
+
style?: React.CSSProperties;
|
|
22
|
+
indexInSection: number;
|
|
23
|
+
sectionLength: number;
|
|
19
24
|
}
|
|
20
25
|
declare function GridColumnHeaderItem(props: GridColumnHeaderItemProps): React.JSX.Element;
|
|
21
26
|
declare namespace GridColumnHeaderItem {
|