Skip to content

Commit

Permalink
[DataGrid] Remove Header slot (#6999)
Browse files Browse the repository at this point in the history
Closes #6977
  • Loading branch information
cherniavskii authored Dec 2, 2022
1 parent 6e0feb3 commit 626106b
Show file tree
Hide file tree
Showing 17 changed files with 3 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ The minimum supported Node.js version has been changed from 12.0.0 to 14.0.0, si
- The `disableIgnoreModificationsIfProcessingProps` prop was removed and its behavior when `true` was incorporated as the default behavior.
The old behavior can be restored by using `apiRef.current.stopRowEditMode({ ignoreModifications: true })` or `apiRef.current.stopCellEditMode({ ignoreModifications: true })`.
- The `onColumnVisibilityChange` prop was removed. Use `onColumnVisibilityModelChange` instead.
- The `components.Header` slot was removed. Use `components.Toolbar` slot instead.

### State access

Expand Down
1 change: 0 additions & 1 deletion docs/pages/x/api/data-grid/data-grid-premium.json
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@
"default": "GridKeyboardArrowRight",
"type": { "name": "elementType" }
},
"Header": { "default": "GridHeader", "type": { "name": "elementType" } },
"LoadingOverlay": { "default": "GridLoadingOverlay", "type": { "name": "elementType" } },
"MoreActionsIcon": { "default": "GridMoreVertIcon", "type": { "name": "elementType" } },
"NoResultsOverlay": { "default": "GridNoResultsOverlay", "type": { "name": "elementType" } },
Expand Down
1 change: 0 additions & 1 deletion docs/pages/x/api/data-grid/data-grid-pro.json
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@
"default": "GridKeyboardArrowRight",
"type": { "name": "elementType" }
},
"Header": { "default": "GridHeader", "type": { "name": "elementType" } },
"LoadingOverlay": { "default": "GridLoadingOverlay", "type": { "name": "elementType" } },
"MoreActionsIcon": { "default": "GridMoreVertIcon", "type": { "name": "elementType" } },
"NoResultsOverlay": { "default": "GridNoResultsOverlay", "type": { "name": "elementType" } },
Expand Down
1 change: 0 additions & 1 deletion docs/pages/x/api/data-grid/data-grid.json
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@
"default": "GridKeyboardArrowRight",
"type": { "name": "elementType" }
},
"Header": { "default": "GridHeader", "type": { "name": "elementType" } },
"LoadingOverlay": { "default": "GridLoadingOverlay", "type": { "name": "elementType" } },
"MoreActionsIcon": { "default": "GridMoreVertIcon", "type": { "name": "elementType" } },
"NoResultsOverlay": { "default": "GridNoResultsOverlay", "type": { "name": "elementType" } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,6 @@
"ColumnMenu": "Column menu component rendered by clicking on the 3 dots "kebab" icon in column headers.",
"ErrorOverlay": "Error overlay component rendered above the grid when an error is caught.",
"Footer": "Footer component rendered at the bottom of the grid viewport.",
"Header": "Header component rendered above the grid column header bar.\nPrefer using the <code>Toolbar</code> slot. You should never need to use this slot.",
"Toolbar": "Toolbar component rendered inside the Header component.",
"PreferencesPanel": "PreferencesPanel component rendered inside the Header component.",
"LoadingOverlay": "Loading overlay component rendered when the grid is in a loading state.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,6 @@
"ColumnMenu": "Column menu component rendered by clicking on the 3 dots &quot;kebab&quot; icon in column headers.",
"ErrorOverlay": "Error overlay component rendered above the grid when an error is caught.",
"Footer": "Footer component rendered at the bottom of the grid viewport.",
"Header": "Header component rendered above the grid column header bar.\nPrefer using the <code>Toolbar</code> slot. You should never need to use this slot.",
"Toolbar": "Toolbar component rendered inside the Header component.",
"PreferencesPanel": "PreferencesPanel component rendered inside the Header component.",
"LoadingOverlay": "Loading overlay component rendered when the grid is in a loading state.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,6 @@
"ColumnMenu": "Column menu component rendered by clicking on the 3 dots &quot;kebab&quot; icon in column headers.",
"ErrorOverlay": "Error overlay component rendered above the grid when an error is caught.",
"Footer": "Footer component rendered at the bottom of the grid viewport.",
"Header": "Header component rendered above the grid column header bar.\nPrefer using the <code>Toolbar</code> slot. You should never need to use this slot.",
"Toolbar": "Toolbar component rendered inside the Header component.",
"PreferencesPanel": "PreferencesPanel component rendered inside the Header component.",
"LoadingOverlay": "Loading overlay component rendered when the grid is in a loading state.",
Expand Down
1 change: 0 additions & 1 deletion docs/translations/api-docs/data-grid/data-grid-pro-pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,6 @@
"ColumnMenu": "Column menu component rendered by clicking on the 3 dots &quot;kebab&quot; icon in column headers.",
"ErrorOverlay": "Error overlay component rendered above the grid when an error is caught.",
"Footer": "Footer component rendered at the bottom of the grid viewport.",
"Header": "Header component rendered above the grid column header bar.\nPrefer using the <code>Toolbar</code> slot. You should never need to use this slot.",
"Toolbar": "Toolbar component rendered inside the Header component.",
"PreferencesPanel": "PreferencesPanel component rendered inside the Header component.",
"LoadingOverlay": "Loading overlay component rendered when the grid is in a loading state.",
Expand Down
1 change: 0 additions & 1 deletion docs/translations/api-docs/data-grid/data-grid-pro-zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,6 @@
"ColumnMenu": "Column menu component rendered by clicking on the 3 dots &quot;kebab&quot; icon in column headers.",
"ErrorOverlay": "Error overlay component rendered above the grid when an error is caught.",
"Footer": "Footer component rendered at the bottom of the grid viewport.",
"Header": "Header component rendered above the grid column header bar.\nPrefer using the <code>Toolbar</code> slot. You should never need to use this slot.",
"Toolbar": "Toolbar component rendered inside the Header component.",
"PreferencesPanel": "PreferencesPanel component rendered inside the Header component.",
"LoadingOverlay": "Loading overlay component rendered when the grid is in a loading state.",
Expand Down
1 change: 0 additions & 1 deletion docs/translations/api-docs/data-grid/data-grid-pro.json
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,6 @@
"ColumnMenu": "Column menu component rendered by clicking on the 3 dots &quot;kebab&quot; icon in column headers.",
"ErrorOverlay": "Error overlay component rendered above the grid when an error is caught.",
"Footer": "Footer component rendered at the bottom of the grid viewport.",
"Header": "Header component rendered above the grid column header bar.\nPrefer using the <code>Toolbar</code> slot. You should never need to use this slot.",
"Toolbar": "Toolbar component rendered inside the Header component.",
"PreferencesPanel": "PreferencesPanel component rendered inside the Header component.",
"LoadingOverlay": "Loading overlay component rendered when the grid is in a loading state.",
Expand Down
1 change: 0 additions & 1 deletion docs/translations/api-docs/data-grid/data-grid-pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,6 @@
"ColumnMenu": "Column menu component rendered by clicking on the 3 dots &quot;kebab&quot; icon in column headers.",
"ErrorOverlay": "Error overlay component rendered above the grid when an error is caught.",
"Footer": "Footer component rendered at the bottom of the grid viewport.",
"Header": "Header component rendered above the grid column header bar.\nPrefer using the <code>Toolbar</code> slot. You should never need to use this slot.",
"Toolbar": "Toolbar component rendered inside the Header component.",
"PreferencesPanel": "PreferencesPanel component rendered inside the Header component.",
"LoadingOverlay": "Loading overlay component rendered when the grid is in a loading state.",
Expand Down
1 change: 0 additions & 1 deletion docs/translations/api-docs/data-grid/data-grid-zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,6 @@
"ColumnMenu": "Column menu component rendered by clicking on the 3 dots &quot;kebab&quot; icon in column headers.",
"ErrorOverlay": "Error overlay component rendered above the grid when an error is caught.",
"Footer": "Footer component rendered at the bottom of the grid viewport.",
"Header": "Header component rendered above the grid column header bar.\nPrefer using the <code>Toolbar</code> slot. You should never need to use this slot.",
"Toolbar": "Toolbar component rendered inside the Header component.",
"PreferencesPanel": "PreferencesPanel component rendered inside the Header component.",
"LoadingOverlay": "Loading overlay component rendered when the grid is in a loading state.",
Expand Down
1 change: 0 additions & 1 deletion docs/translations/api-docs/data-grid/data-grid.json
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,6 @@
"ColumnMenu": "Column menu component rendered by clicking on the 3 dots &quot;kebab&quot; icon in column headers.",
"ErrorOverlay": "Error overlay component rendered above the grid when an error is caught.",
"Footer": "Footer component rendered at the bottom of the grid viewport.",
"Header": "Header component rendered above the grid column header bar.\nPrefer using the <code>Toolbar</code> slot. You should never need to use this slot.",
"Toolbar": "Toolbar component rendered inside the Header component.",
"PreferencesPanel": "PreferencesPanel component rendered inside the Header component.",
"LoadingOverlay": "Loading overlay component rendered when the grid is in a loading state.",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import * as React from 'react';
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
import { GridHeader } from '../GridHeader';

export function GridHeaderPlaceholder() {
const apiRef = useGridApiContext();
const rootProps = useGridRootProps();
const headerRef = React.useRef<HTMLDivElement>(null);
apiRef.current.headerRef = headerRef;

return (
<div ref={headerRef}>
<rootProps.components.Header {...rootProps.componentsProps?.header} />
<GridHeader />
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
GridFilterListIcon,
GridFilterPanel,
GridFooter,
GridHeader,
GridLoadingOverlay,
GridNoRowsOverlay,
GridPagination,
Expand Down Expand Up @@ -94,7 +93,6 @@ export const DATA_GRID_DEFAULT_SLOTS_COMPONENTS: GridSlotsComponent = {
ColumnMenu: GridColumnMenu,
ErrorOverlay: GridErrorOverlay,
Footer: GridFooter,
Header: GridHeader,
Toolbar: null,
PreferencesPanel: GridPreferencesPanel,
LoadingOverlay: GridLoadingOverlay,
Expand Down
6 changes: 0 additions & 6 deletions packages/grid/x-data-grid/src/models/gridSlotsComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,6 @@ export interface GridSlotsComponent extends GridIconSlotsComponent {
* @default GridFooter
*/
Footer: React.JSXElementConstructor<any>;
/**
* Header component rendered above the grid column header bar.
* Prefer using the `Toolbar` slot. You should never need to use this slot.
* @default GridHeader
*/
Header: React.JSXElementConstructor<any>; // TODO remove.
/**
* Toolbar component rendered inside the Header component.
* @default null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export interface GridSlotsComponentsProps {
errorOverlay?: any;
filterPanel?: any;
footer?: any;
header?: any;
loadingOverlay?: any;
noResultsOverlay?: any;
noRowsOverlay?: any;
Expand Down

0 comments on commit 626106b

Please sign in to comment.