Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DataGrid] Remove the preferencesPanel slot #11228

Merged
merged 5 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ Below are described the steps you need to make to migrate from v6 to v7.
### Removed props

- The deprecated props `components` and `componentsProps` have been removed. Use `slots` and `slotProps` instead. See [components section](/x/react-data-grid/components/) for more details.
- The `slots.preferencesPanel` slot and the `slotProps.preferencesPanel` prop were removed. Use `slots.panel` and `slotProps.panel` instead.

<!-- ### State access

Expand Down Expand Up @@ -156,9 +157,9 @@ Below are described the steps you need to make to migrate from v6 to v7.

- -->

<!-- ### Other exports
### Other exports

- -->
- The `GridPreferencesPanel` component is not exported anymore as it wasn't meant to be used outside of the Data Grid.

<!-- ### CSS classes

Expand Down
6 changes: 0 additions & 6 deletions docs/pages/x/api/data-grid/data-grid-premium.json
Original file line number Diff line number Diff line change
Expand Up @@ -993,12 +993,6 @@
"description": "Panel component wrapping the filters and columns panels.",
"default": "GridPanel"
},
{
"class": null,
"name": "preferencesPanel",
"description": "PreferencesPanel component rendered inside the Header component.",
"default": "GridPreferencesPanel"
},
{
"class": null,
"name": "quickFilterClearIcon",
Expand Down
6 changes: 0 additions & 6 deletions docs/pages/x/api/data-grid/data-grid-pro.json
Original file line number Diff line number Diff line change
Expand Up @@ -913,12 +913,6 @@
"description": "Panel component wrapping the filters and columns panels.",
"default": "GridPanel"
},
{
"class": null,
"name": "preferencesPanel",
"description": "PreferencesPanel component rendered inside the Header component.",
"default": "GridPreferencesPanel"
},
{
"class": null,
"name": "quickFilterClearIcon",
Expand Down
6 changes: 0 additions & 6 deletions docs/pages/x/api/data-grid/data-grid.json
Original file line number Diff line number Diff line change
Expand Up @@ -761,12 +761,6 @@
"description": "Panel component wrapping the filters and columns panels.",
"default": "GridPanel"
},
{
"class": null,
"name": "preferencesPanel",
"description": "PreferencesPanel component rendered inside the Header component.",
"default": "GridPreferencesPanel"
},
{
"class": null,
"name": "quickFilterClearIcon",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1570,7 +1570,6 @@
"openFilterButtonIcon": "Icon displayed on the open filter button present in the toolbar by default.",
"pagination": "Pagination component rendered in the grid footer by default.",
"panel": "Panel component wrapping the filters and columns panels.",
"preferencesPanel": "PreferencesPanel component rendered inside the Header component.",
"quickFilterClearIcon": "Icon displayed on the quick filter reset input.",
"quickFilterIcon": "Icon displayed on the quick filter input.",
"row": "Component rendered for each row.",
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 @@ -1465,7 +1465,6 @@
"openFilterButtonIcon": "Icon displayed on the open filter button present in the toolbar by default.",
"pagination": "Pagination component rendered in the grid footer by default.",
"panel": "Panel component wrapping the filters and columns panels.",
"preferencesPanel": "PreferencesPanel component rendered inside the Header component.",
"quickFilterClearIcon": "Icon displayed on the quick filter reset input.",
"quickFilterIcon": "Icon displayed on the quick filter input.",
"row": "Component rendered for each row.",
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 @@ -1246,7 +1246,6 @@
"openFilterButtonIcon": "Icon displayed on the open filter button present in the toolbar by default.",
"pagination": "Pagination component rendered in the grid footer by default.",
"panel": "Panel component wrapping the filters and columns panels.",
"preferencesPanel": "PreferencesPanel component rendered inside the Header component.",
"quickFilterClearIcon": "Icon displayed on the quick filter reset input.",
"quickFilterIcon": "Icon displayed on the quick filter input.",
"row": "Component rendered for each row.",
Expand Down
3 changes: 2 additions & 1 deletion packages/grid/x-data-grid/src/components/GridHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import * as React from 'react';
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
import { GridPreferencesPanel } from './panel/GridPreferencesPanel';

export function GridHeader() {
const rootProps = useGridRootProps();

return (
<React.Fragment>
<rootProps.slots.preferencesPanel {...rootProps.slotProps?.preferencesPanel} />
<GridPreferencesPanel />
{rootProps.slots.toolbar && <rootProps.slots.toolbar {...rootProps.slotProps?.toolbar} />}
</React.Fragment>
);
Expand Down
1 change: 0 additions & 1 deletion packages/grid/x-data-grid/src/components/panel/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ export * from './GridPanelContent';
export * from './GridPanelFooter';
export * from './GridPanelHeader';
export * from './GridPanelWrapper';
export * from './GridPreferencesPanel';
export * from './filterPanel';
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
GridNoRowsOverlay,
GridPagination,
GridPanel,
GridPreferencesPanel,
GridRow,
GridColumnHeaderFilterIconButton,
GridRowCount,
Expand All @@ -31,7 +30,6 @@ export const DATA_GRID_DEFAULT_SLOTS_COMPONENTS: GridSlotsComponent = {
footer: GridFooter,
footerRowCount: GridRowCount,
toolbar: null,
preferencesPanel: GridPreferencesPanel,
loadingOverlay: GridLoadingOverlay,
noResultsOverlay: GridNoResultsOverlay,
noRowsOverlay: GridNoRowsOverlay,
Expand Down
5 changes: 0 additions & 5 deletions packages/grid/x-data-grid/src/models/gridSlotsComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,6 @@ export interface GridSlotsComponent extends GridBaseSlots, GridIconSlotsComponen
* @default null
*/
toolbar: React.JSXElementConstructor<any> | null;
/**
* PreferencesPanel component rendered inside the Header component.
* @default GridPreferencesPanel
*/
preferencesPanel: React.JSXElementConstructor<any>;
/**
* Loading overlay component rendered when the grid is in a loading state.
* @default GridLoadingOverlay
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export interface LoadingOverlayPropsOverrides {}
export interface NoResultsOverlayPropsOverrides {}
export interface NoRowsOverlayPropsOverrides {}
export interface PanelPropsOverrides {}
export interface PreferencesPanelPropsOverrides {}
export interface RowPropsOverrides {}

type SlotProps<Props, Overrides> = Partial<Props & Overrides>;
Expand Down Expand Up @@ -88,10 +87,6 @@ export interface GridSlotsComponentsProps {
noRowsOverlay?: SlotProps<GridOverlayProps, NoRowsOverlayPropsOverrides>;
pagination?: SlotProps<TablePaginationProps, PaginationPropsOverrides>;
panel?: SlotProps<GridPanelProps, PanelPropsOverrides>;
preferencesPanel?: SlotProps<
React.HTMLAttributes<HTMLDivElement>,
PreferencesPanelPropsOverrides
>;
row?: SlotProps<GridRowProps, RowPropsOverrides>;
toolbar?: SlotProps<GridToolbarProps, ToolbarPropsOverrides>;
}
2 changes: 0 additions & 2 deletions scripts/x-data-grid-premium.exports.json
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,6 @@
{ "name": "GridPreferencePanelState", "kind": "Interface" },
{ "name": "gridPreferencePanelStateSelector", "kind": "Variable" },
{ "name": "GridPreferencePanelsValue", "kind": "Enum" },
{ "name": "GridPreferencesPanel", "kind": "Variable" },
{ "name": "GridPreferencesPanelApi", "kind": "Interface" },
{ "name": "GridPremiumIconSlotsComponent", "kind": "Interface" },
{ "name": "GridPremiumSlotsComponent", "kind": "Interface" },
Expand Down Expand Up @@ -606,7 +605,6 @@
{ "name": "PaginationPropsOverrides", "kind": "Interface" },
{ "name": "PanelPropsOverrides", "kind": "Interface" },
{ "name": "plPL", "kind": "Variable" },
{ "name": "PreferencesPanelPropsOverrides", "kind": "Interface" },
{ "name": "ptBR", "kind": "Variable" },
{ "name": "renderActionsCell", "kind": "Variable" },
{ "name": "renderBooleanCell", "kind": "Variable" },
Expand Down
2 changes: 0 additions & 2 deletions scripts/x-data-grid-pro.exports.json
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,6 @@
{ "name": "GridPreferencePanelState", "kind": "Interface" },
{ "name": "gridPreferencePanelStateSelector", "kind": "Variable" },
{ "name": "GridPreferencePanelsValue", "kind": "Enum" },
{ "name": "GridPreferencesPanel", "kind": "Variable" },
{ "name": "GridPreferencesPanelApi", "kind": "Interface" },
{ "name": "GridPreProcessEditCellProps", "kind": "Interface" },
{ "name": "GridPrintExportApi", "kind": "Interface" },
Expand Down Expand Up @@ -559,7 +558,6 @@
{ "name": "PaginationPropsOverrides", "kind": "Interface" },
{ "name": "PanelPropsOverrides", "kind": "Interface" },
{ "name": "plPL", "kind": "Variable" },
{ "name": "PreferencesPanelPropsOverrides", "kind": "Interface" },
{ "name": "ptBR", "kind": "Variable" },
{ "name": "renderActionsCell", "kind": "Variable" },
{ "name": "renderBooleanCell", "kind": "Variable" },
Expand Down
2 changes: 0 additions & 2 deletions scripts/x-data-grid.exports.json
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@
{ "name": "GridPreferencePanelState", "kind": "Interface" },
{ "name": "gridPreferencePanelStateSelector", "kind": "Variable" },
{ "name": "GridPreferencePanelsValue", "kind": "Enum" },
{ "name": "GridPreferencesPanel", "kind": "Variable" },
{ "name": "GridPreferencesPanelApi", "kind": "Interface" },
{ "name": "GridPreProcessEditCellProps", "kind": "Interface" },
{ "name": "GridPrintExportApi", "kind": "Interface" },
Expand Down Expand Up @@ -508,7 +507,6 @@
{ "name": "PaginationPropsOverrides", "kind": "Interface" },
{ "name": "PanelPropsOverrides", "kind": "Interface" },
{ "name": "plPL", "kind": "Variable" },
{ "name": "PreferencesPanelPropsOverrides", "kind": "Interface" },
{ "name": "ptBR", "kind": "Variable" },
{ "name": "renderActionsCell", "kind": "Variable" },
{ "name": "renderBooleanCell", "kind": "Variable" },
Expand Down