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] Differenciate the pro and community versions of GridState, GridApi and GridApiRef #3648

Merged
merged 73 commits into from
Feb 14, 2022
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
595aed8
[DataGrid] Differenciate the pro and community versions of GridState,…
flaviendelangle Jan 17, 2022
0e08bf9
Work
flaviendelangle Jan 17, 2022
e252740
Gen docs
flaviendelangle Jan 17, 2022
e02f987
Work
flaviendelangle Jan 17, 2022
dad3f3e
Work
flaviendelangle Jan 17, 2022
3e43030
Gen docs
flaviendelangle Jan 17, 2022
9233647
Gen docs
flaviendelangle Jan 17, 2022
2ce5214
Gen docs
flaviendelangle Jan 17, 2022
6c5e8b6
Gen docs
flaviendelangle Jan 17, 2022
84a7091
Gen docs
flaviendelangle Jan 17, 2022
6382544
Merge branch 'master' into state-pro-community
flaviendelangle Jan 18, 2022
5a4306c
Merge
flaviendelangle Jan 18, 2022
b02633a
Merge
flaviendelangle Jan 18, 2022
9e27a6b
Work
flaviendelangle Jan 18, 2022
915f766
Gen docs
flaviendelangle Jan 18, 2022
2da1d6e
Merge branch 'master' into state-pro-community
flaviendelangle Jan 19, 2022
4da768f
[DataGrid] Remove function overloading for useGridApiRef
flaviendelangle Jan 19, 2022
25b74c7
Work
flaviendelangle Jan 19, 2022
1f62ce5
Work
flaviendelangle Jan 19, 2022
f867509
Work
flaviendelangle Jan 19, 2022
5decdc6
Work
flaviendelangle Jan 19, 2022
c8927cc
Merge
flaviendelangle Jan 20, 2022
7035d40
Merge branch 'master' into apiRef-init
flaviendelangle Jan 20, 2022
a3c5d8e
Merge branch 'master' into state-pro-community
flaviendelangle Jan 21, 2022
69d45df
Work
flaviendelangle Jan 24, 2022
fa75075
Work
flaviendelangle Jan 24, 2022
56f5ed2
Work
flaviendelangle Jan 24, 2022
7fc072b
Merge
flaviendelangle Jan 25, 2022
b7ebe1a
Fix
flaviendelangle Jan 25, 2022
a442f74
Fix
flaviendelangle Jan 25, 2022
0cdaf38
Fix
flaviendelangle Jan 25, 2022
8fc3666
Work
flaviendelangle Jan 25, 2022
b4a992c
Merge branch 'master' into state-pro-community
flaviendelangle Jan 26, 2022
13f6e78
Code review: Andrew
flaviendelangle Jan 26, 2022
8a28913
Merge
flaviendelangle Jan 26, 2022
35f2d0e
Work
flaviendelangle Jan 27, 2022
7a7402c
Work
flaviendelangle Jan 27, 2022
b7086f2
Merge
flaviendelangle Jan 28, 2022
3eba08a
Merge
flaviendelangle Jan 31, 2022
7f52894
Work
flaviendelangle Jan 31, 2022
62aa35f
Work
flaviendelangle Jan 31, 2022
3517c3e
Work
flaviendelangle Jan 31, 2022
4e74315
Work
flaviendelangle Jan 31, 2022
98eaee7
Work
flaviendelangle Jan 31, 2022
a10a1ae
Work
flaviendelangle Jan 31, 2022
83ee0fe
Fix
flaviendelangle Jan 31, 2022
da77134
Merge branch 'master' into state-pro-community
flaviendelangle Feb 1, 2022
69cec52
Merge
flaviendelangle Feb 1, 2022
9f6dd01
Merge
flaviendelangle Feb 2, 2022
4b3ccdd
Work
flaviendelangle Feb 2, 2022
10297c1
Merge branch 'master' into state-pro-community
flaviendelangle Feb 2, 2022
d886de0
Work
flaviendelangle Feb 2, 2022
8bf1126
Merge branch 'master' into state-pro-community
flaviendelangle Feb 2, 2022
cb9497e
Work
flaviendelangle Feb 2, 2022
37646e2
Work
flaviendelangle Feb 2, 2022
702b849
Work
flaviendelangle Feb 2, 2022
88286a2
Fix
flaviendelangle Feb 2, 2022
f4d45a0
Work
flaviendelangle Feb 2, 2022
c3a4493
Work
flaviendelangle Feb 2, 2022
41904ba
Work
flaviendelangle Feb 2, 2022
892eb4b
Work
flaviendelangle Feb 2, 2022
96a0a02
Work
flaviendelangle Feb 2, 2022
13840c7
Work
flaviendelangle Feb 3, 2022
a1a8ccf
Merge
flaviendelangle Feb 3, 2022
1be427c
Work
flaviendelangle Feb 3, 2022
27398f8
Merge branch 'master' into state-pro-community
flaviendelangle Feb 7, 2022
23d759b
Merge branch 'master' into state-pro-community
flaviendelangle Feb 8, 2022
ff455b5
Work
flaviendelangle Feb 8, 2022
5fabdaf
work
flaviendelangle Feb 9, 2022
cd5ee8a
Work
flaviendelangle Feb 9, 2022
9b536a1
Merge branch 'master' into state-pro-community
flaviendelangle Feb 10, 2022
176cef5
Merge branch 'master' into state-pro-community
flaviendelangle Feb 11, 2022
694bfdc
Merge branch 'master' into state-pro-community
flaviendelangle Feb 14, 2022
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
7 changes: 7 additions & 0 deletions docs/pages/api-docs/data-grid/grid-api-community.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import * as React from 'react';
import MarkdownDocs from '@mui/monorepo/docs/src/modules/components/MarkdownDocs';
import { demos, docs, demoComponents } from './grid-api-community.md?@mui/markdown';

export default function Page() {
return <MarkdownDocs demos={demos} docs={docs} demoComponents={demoComponents} />;
}
97 changes: 97 additions & 0 deletions docs/pages/api-docs/data-grid/grid-api-community.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import MarkdownDocs from '@mui/monorepo/docs/src/modules/components/MarkdownDocs';
import { demos, docs, demoComponents } from './grid-api.md?@mui/markdown';
import { demos, docs, demoComponents } from './grid-api-pro.md?@mui/markdown';

export default function Page() {
return <MarkdownDocs demos={demos} docs={docs} demoComponents={demoComponents} />;
Expand Down
106 changes: 106 additions & 0 deletions docs/pages/api-docs/data-grid/grid-api-pro.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/pages/api-docs/data-grid/grid-col-def.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import { GridColDef } from '@mui/x-data-grid';
| <span class="prop-name optional">renderHeader<sup><abbr title="optional">?</abbr></sup></span> | <span class="prop-type">(params: GridColumnHeaderParams) =&gt; React.ReactNode</span> | | Allows to render a component in the column header cell. |
| <span class="prop-name optional">resizable<sup><abbr title="optional">?</abbr></sup></span> | <span class="prop-type">boolean</span> | <span class="prop-default">true</span> | If `true`, the column is resizable. |
| <span class="prop-name optional">sortable<sup><abbr title="optional">?</abbr></sup></span> | <span class="prop-type">boolean</span> | <span class="prop-default">true</span> | If `true`, the column is sortable. |
| <span class="prop-name optional">sortComparator<sup><abbr title="optional">?</abbr></sup></span> | <span class="prop-type">GridComparatorFn</span> | | A comparator function used to sort rows. |
| <span class="prop-name optional">sortComparator<sup><abbr title="optional">?</abbr></sup></span> | <span class="prop-type">GridComparatorFn&lt;GridApi&gt;</span> | | A comparator function used to sort rows. |
| <span class="prop-name optional">sortingOrder<sup><abbr title="optional">?</abbr></sup></span> | <span class="prop-type">GridSortDirection[]</span> | | The order of the sorting sequence. |
| <span class="prop-name optional">type<sup><abbr title="optional">?</abbr></sup></span> | <span class="prop-type">GridColType</span> | <span class="prop-default">'string'</span> | Type allows to merge this object with a default definition [GridColDef](/api/data-grid/grid-col-def/). |
| <span class="prop-name optional">valueFormatter<sup><abbr title="optional">?</abbr></sup></span> | <span class="prop-type">(params: GridValueFormatterParams) =&gt; GridCellValue</span> | | Function that allows to apply a formatter before rendering its value. |
Expand Down
3 changes: 2 additions & 1 deletion docs/pages/api-docs/data-grid/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

## Interfaces

- [GridApi](/api/data-grid/grid-api/)
- [GridApiCommunity](/api/data-grid/grid-api-community/)
- [GridApiPro](/api/data-grid/grid-api-pro/)
- [GridCellParams](/api/data-grid/grid-cell-params/)
- [GridColDef](/api/data-grid/grid-col-def/)
- [GridRowParams](/api/data-grid/grid-row-params/)
Expand Down
32 changes: 16 additions & 16 deletions docs/scripts/api/buildInterfacesDocumentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ interface ParsedProperty {
typeStr: string;
}

const INTERFACES_WITH_DEDICATED_PAGES = [
// apiRef
'GridApi',
flaviendelangle marked this conversation as resolved.
Show resolved Hide resolved
const GRID_API_INTERFACES_WITH_DEDICATED_PAGES = [
'GridSelectionApi',
'GridFilterApi',
'GridSortApi',
Expand All @@ -47,6 +45,12 @@ const INTERFACES_WITH_DEDICATED_PAGES = [
'GridColumnPinningApi',
'GridPrintExportApi',
'GridDisableVirtualizationApi',
];

const OTHER_GRID_INTERFACES_WITH_DEDICATED_PAGES = [
// apiRef
'GridApiCommunity',
'GridApiPro',

// Params
'GridCellParams',
Expand Down Expand Up @@ -164,7 +168,10 @@ function generateImportStatement(objects: ParsedObject[], projects: Projects) {
.map((project) => {
const objectsInProject = objects.filter((object) => {
// TODO: Remove after opening the apiRef on the community plan
if (object.name === 'GridApi' && project.name === 'x-data-grid') {
if (
['GridApiCommunity', 'GridApiPro'].includes(object.name) &&
project.name === 'x-data-grid'
) {
return false;
}

Expand Down Expand Up @@ -221,7 +228,10 @@ export default function buildInterfacesDocumentation(options: BuildInterfacesDoc
const allProjectsName = Array.from(projects.keys());

const documentedInterfaces: DocumentedInterfaces = new Map();
INTERFACES_WITH_DEDICATED_PAGES.forEach((interfaceName) => {
[
...OTHER_GRID_INTERFACES_WITH_DEDICATED_PAGES,
...GRID_API_INTERFACES_WITH_DEDICATED_PAGES,
].forEach((interfaceName) => {
const packagesWithThisInterface = allProjectsName.filter(
(projectName) => !!projects.get(projectName)!.exports[interfaceName],
);
Expand All @@ -233,16 +243,6 @@ export default function buildInterfacesDocumentation(options: BuildInterfacesDoc
documentedInterfaces.set(interfaceName, packagesWithThisInterface);
});

const gridApiExtendsFrom: string[] = (
(projects.get('x-data-grid-pro')!.exports.GridApi.declarations![0] as ts.InterfaceDeclaration)
.heritageClauses ?? []
).flatMap((clause) =>
clause.types
.map((type) => type.expression)
.filter(ts.isIdentifier)
.map((expression) => expression.escapedText),
);

documentedInterfaces.forEach((packagesWithThisInterface, interfaceName) => {
const project = projects.get(packagesWithThisInterface[0])!;
const symbol = project.exports[interfaceName];
Expand All @@ -254,7 +254,7 @@ export default function buildInterfacesDocumentation(options: BuildInterfacesDoc

const slug = kebabCase(parsedInterface.name);

if (gridApiExtendsFrom.includes(parsedInterface.name)) {
if (GRID_API_INTERFACES_WITH_DEDICATED_PAGES.includes(parsedInterface.name)) {
const json = {
name: parsedInterface.name,
description: linkify(parsedInterface.description, documentedInterfaces, 'html'),
Expand Down
12 changes: 6 additions & 6 deletions docs/scripts/api/buildSelectorsDocumentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ export default function buildSelectorsDocumentation(options: BuildSelectorsDocum

let isSelector = false;

if (
project.checker.getTypeOfSymbolAtLocation(
parameterSymbol,
parameterSymbol.valueDeclaration!,
).symbol?.name === 'GridState'
) {
const firstParamName = project.checker.getTypeOfSymbolAtLocation(
parameterSymbol,
parameterSymbol.valueDeclaration!,
).symbol?.name;

if (['GridStatePro', 'GridStateCommunity'].includes(firstParamName)) {
// Selector not wrapped in `createSelector`
isSelector = true;
} else if (
Expand Down
3 changes: 2 additions & 1 deletion docs/scripts/api/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export type DocumentedInterfaces = Map<string, ProjectNames[]>;
export const getSymbolDescription = (symbol: ts.Symbol, project: Project) =>
symbol
.getDocumentationComment(project.checker)
.map((comment) => comment.text)
.flatMap((comment) => comment.text.split('\n'))
.filter((line) => !line.startsWith('TODO'))
.join('\n');

export const getSymbolJSDocTags = (symbol: ts.Symbol) =>
Expand Down
3 changes: 2 additions & 1 deletion docs/src/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ dataGridComponentAPI.children = [
{ pathname: '/api-docs/data-grid', title: 'API Reference' },
{ pathname: '/api-docs/data-grid/data-grid', title: 'DataGrid' },
{ pathname: '/api-docs/data-grid/data-grid-pro', title: 'DataGridPro' },
{ pathname: '/api-docs/data-grid/grid-api', title: 'GridApi' },
{ pathname: '/api-docs/data-grid/grid-api-pro', title: 'GridApiPro' },
{ pathname: '/api-docs/data-grid/grid-api-community', title: 'GridApiCommunity' },
{ pathname: '/api-docs/data-grid/grid-col-def', title: 'GridColDef' },
{ pathname: '/api-docs/data-grid/grid-cell-params', title: 'GridCellParams' },
{ pathname: '/api-docs/data-grid/grid-row-params', title: 'GridRowParams' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import {
GridRowsProp,
useGridApiRef,
DataGridPro,
GridApiRef,
GridColumns,
GridRowParams,
MuiEvent,
GridToolbarContainer,
GridActionsCellItem,
GridEventListener,
GridEvents,
GridApiRefPro,
flaviendelangle marked this conversation as resolved.
Show resolved Hide resolved
} from '@mui/x-data-grid-pro';
import {
randomCreatedDate,
Expand Down Expand Up @@ -65,7 +65,7 @@ const rows: GridRowsProp = [
];

interface EditToolbarProps {
apiRef: GridApiRef;
apiRef: GridApiRefPro;
}

function EditToolbar(props: EditToolbarProps) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
GridRowsProp,
useGridApiRef,
DataGridPro,
GridApiRef,
GridCellParams,
GridApiRefPro,
} from '@mui/x-data-grid-pro';
import {
randomCreatedDate,
Expand All @@ -16,7 +16,7 @@ import {
} from '@mui/x-data-grid-generator';

interface EditToolbarProps {
apiRef: GridApiRef;
apiRef: GridApiRefPro;
selectedCellParams?: any;
setSelectedCellParams: (value: any) => void;
}
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/data-grid/events/events.json
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@
{
"name": "stateChange",
"description": "Fired when the state of the grid is updated.",
"params": "GridState",
"params": "GridStatePro | GridStateCommunity",
"event": "MuiEvent<{}>"
},
{
Expand Down
2 changes: 1 addition & 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 @@ -51,7 +51,7 @@
"hideFooterPagination": "If <code>true</code>, the pagination component in the footer is hidden.",
"hideFooterRowCount": "If <code>true</code>, the row count in the footer is hidden. It has no effect if the pagination is enabled.",
"hideFooterSelectedRowCount": "If <code>true</code>, the selected row count in the footer is hidden.",
"initialState": "The initial state of the DataGrid. The data in it will be set in the state on initialization but will not be controlled. If one of the data in <code>initialState</code> is also being controlled, then the control state wins.",
"initialState": "The initial state of the DataGridPro. The data in it will be set in the state on initialization but will not be controlled. If one of the data in <code>initialState</code> is also being controlled, then the control state wins.",
"isCellEditable": "Callback fired when a cell is rendered, returns true if the cell is editable.<br><br><strong>Signature:</strong><br><code>function(params: GridCellParams) =&gt; boolean</code><br><em>params:</em> With all properties from <a href=\"/api/data-grid/grid-cell-params/\">GridCellParams</a>.<br> <em>returns</em> (boolean): A boolean indicating if the cell is editable.",
"isGroupExpandedByDefault": "Determines if a group should be expanded after its creation. This prop takes priority over the <code>defaultGroupingExpansionDepth</code> prop.<br><br><strong>Signature:</strong><br><code>function(node: GridRowTreeNodeConfig) =&gt; boolean</code><br><em>node:</em> The node of the group to test.<br> <em>returns</em> (boolean): A boolean indicating if the group is expanded.",
"isRowSelectable": "Determines if a row can be selected.<br><br><strong>Signature:</strong><br><code>function(params: GridRowParams) =&gt; boolean</code><br><em>params:</em> With all properties from <a href=\"/api/data-grid/grid-row-params/\">GridRowParams</a>.<br> <em>returns</em> (boolean): A boolean indicating if the cell is selectable.",
Expand Down
2 changes: 1 addition & 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 @@ -51,7 +51,7 @@
"hideFooterPagination": "If <code>true</code>, the pagination component in the footer is hidden.",
"hideFooterRowCount": "If <code>true</code>, the row count in the footer is hidden. It has no effect if the pagination is enabled.",
"hideFooterSelectedRowCount": "If <code>true</code>, the selected row count in the footer is hidden.",
"initialState": "The initial state of the DataGrid. The data in it will be set in the state on initialization but will not be controlled. If one of the data in <code>initialState</code> is also being controlled, then the control state wins.",
"initialState": "The initial state of the DataGridPro. The data in it will be set in the state on initialization but will not be controlled. If one of the data in <code>initialState</code> is also being controlled, then the control state wins.",
"isCellEditable": "Callback fired when a cell is rendered, returns true if the cell is editable.<br><br><strong>Signature:</strong><br><code>function(params: GridCellParams) =&gt; boolean</code><br><em>params:</em> With all properties from <a href=\"/api/data-grid/grid-cell-params/\">GridCellParams</a>.<br> <em>returns</em> (boolean): A boolean indicating if the cell is editable.",
"isGroupExpandedByDefault": "Determines if a group should be expanded after its creation. This prop takes priority over the <code>defaultGroupingExpansionDepth</code> prop.<br><br><strong>Signature:</strong><br><code>function(node: GridRowTreeNodeConfig) =&gt; boolean</code><br><em>node:</em> The node of the group to test.<br> <em>returns</em> (boolean): A boolean indicating if the group is expanded.",
"isRowSelectable": "Determines if a row can be selected.<br><br><strong>Signature:</strong><br><code>function(params: GridRowParams) =&gt; boolean</code><br><em>params:</em> With all properties from <a href=\"/api/data-grid/grid-row-params/\">GridRowParams</a>.<br> <em>returns</em> (boolean): A boolean indicating if the cell is selectable.",
Expand Down
2 changes: 1 addition & 1 deletion docs/translations/api-docs/data-grid/data-grid-pro.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"hideFooterPagination": "If <code>true</code>, the pagination component in the footer is hidden.",
"hideFooterRowCount": "If <code>true</code>, the row count in the footer is hidden. It has no effect if the pagination is enabled.",
"hideFooterSelectedRowCount": "If <code>true</code>, the selected row count in the footer is hidden.",
"initialState": "The initial state of the DataGrid. The data in it will be set in the state on initialization but will not be controlled. If one of the data in <code>initialState</code> is also being controlled, then the control state wins.",
"initialState": "The initial state of the DataGridPro. The data in it will be set in the state on initialization but will not be controlled. If one of the data in <code>initialState</code> is also being controlled, then the control state wins.",
"isCellEditable": "Callback fired when a cell is rendered, returns true if the cell is editable.<br><br><strong>Signature:</strong><br><code>function(params: GridCellParams) =&gt; boolean</code><br><em>params:</em> With all properties from <a href=\"/api/data-grid/grid-cell-params/\">GridCellParams</a>.<br> <em>returns</em> (boolean): A boolean indicating if the cell is editable.",
"isGroupExpandedByDefault": "Determines if a group should be expanded after its creation. This prop takes priority over the <code>defaultGroupingExpansionDepth</code> prop.<br><br><strong>Signature:</strong><br><code>function(node: GridRowTreeNodeConfig) =&gt; boolean</code><br><em>node:</em> The node of the group to test.<br> <em>returns</em> (boolean): A boolean indicating if the group is expanded.",
"isRowSelectable": "Determines if a row can be selected.<br><br><strong>Signature:</strong><br><code>function(params: GridRowParams) =&gt; boolean</code><br><em>params:</em> With all properties from <a href=\"/api/data-grid/grid-row-params/\">GridRowParams</a>.<br> <em>returns</em> (boolean): A boolean indicating if the cell is selectable.",
Expand Down
4 changes: 2 additions & 2 deletions packages/grid/_modules_/grid/components/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as React from 'react';
import { ErrorInfo } from 'react';
import { GridApiRef } from '../models/api';
import { GridApiRefCommunity } from '../models/api';
import { Logger } from '../models/logger';

export interface ErrorBoundaryProps {
logger: Logger;
render: ({ error }: any) => React.ReactNode;
api: GridApiRef;
api: GridApiRefCommunity;
hasError: boolean;
componentProps?: any[];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { isNavigationKey, isSpaceKey } from '../../utils/keyboardUtils';
import { GridEvents } from '../../models/events';
import { getDataGridUtilityClass } from '../../gridClasses';
import { DataGridProProcessedProps } from '../../models/props/DataGridProProps';
import { GridApiPro } from '../../models/api/gridApi';

type OwnerState = { classes: DataGridProProcessedProps['classes'] };

Expand All @@ -34,7 +35,7 @@ const GridTreeDataGroupingCell = (props: GridTreeDataGroupingCellProps) => {
const { id, field, rowNode, hideDescendantCount } = props;

const rootProps = useGridRootProps();
const apiRef = useGridApiContext();
const apiRef = useGridApiContext<GridApiPro>();
const ownerState: OwnerState = { classes: rootProps.classes };
const classes = useUtilityClasses(ownerState);
const filteredDescendantCountLookup = useGridSelector(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import MenuItem from '@mui/material/MenuItem';
import { useGridApiContext } from '../../../hooks/utils/useGridApiContext';
import { GridColDef } from '../../../models/colDef/gridColDef';
import { GridPinnedPosition } from '../../../models/api/gridColumnPinningApi';
import { GridApiPro } from '../../../models/api/gridApi';

interface GridColumnPinningMenuItemsProps {
column?: GridColDef;
Expand All @@ -12,7 +13,7 @@ interface GridColumnPinningMenuItemsProps {

const GridColumnPinningMenuItems = (props: GridColumnPinningMenuItemsProps) => {
const { column, onClick } = props;
const apiRef = useGridApiContext();
const apiRef = useGridApiContext<GridApiPro>();

const pinColumn = (side: GridPinnedPosition) => (event: React.MouseEvent<HTMLElement>) => {
apiRef.current.pinColumn(column!.field, side);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { GridColDef } from '../../../models/colDef/gridColDef';
import { useGridSelector } from '../../../hooks/utils/useGridSelector';
import { gridRowGroupingSanitizedModelSelector } from '../../../hooks/features/rowGrouping/gridRowGroupingSelector';
import { gridColumnLookupSelector } from '../../../hooks/features/columns/gridColumnsSelector';
import { GridApiPro } from '../../../models/api/gridApi';

interface GridRowGroupableColumnMenuItemsProps {
column?: GridColDef;
Expand All @@ -14,7 +15,7 @@ interface GridRowGroupableColumnMenuItemsProps {

const GridRowGroupableColumnMenuItems = (props: GridRowGroupableColumnMenuItemsProps) => {
const { column, onClick } = props;
const apiRef = useGridApiContext();
const apiRef = useGridApiContext<GridApiPro>();
const rowGroupingModel = useGridSelector(apiRef, gridRowGroupingSanitizedModelSelector);
const columnsLookup = useGridSelector(apiRef, gridColumnLookupSelector);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
isGroupingColumn,
} from '../../../hooks/features/rowGrouping/gridRowGroupingUtils';
import { gridColumnLookupSelector } from '../../../hooks/features/columns/gridColumnsSelector';
import { GridApiPro } from '../../../models';

interface GridRowGroupingColumnMenuItemsProps {
column?: GridColDef;
Expand All @@ -19,7 +20,7 @@ interface GridRowGroupingColumnMenuItemsProps {

const GridRowGroupingColumnMenuItems = (props: GridRowGroupingColumnMenuItemsProps) => {
const { column, onClick } = props;
const apiRef = useGridApiContext();
const apiRef = useGridApiContext<GridApiPro>();
const rowGroupingModel = useGridSelector(apiRef, gridRowGroupingSanitizedModelSelector);
const columnsLookup = useGridSelector(apiRef, gridColumnLookupSelector);

Expand Down
Loading