diff --git a/docs/pages/x/api/data-grid/grid-cell-params.json b/docs/pages/x/api/data-grid/grid-cell-params.json index 2e99ec3bc0fab..7e3b63c85f061 100644 --- a/docs/pages/x/api/data-grid/grid-cell-params.json +++ b/docs/pages/x/api/data-grid/grid-cell-params.json @@ -6,7 +6,7 @@ "import { GridCellParams } from '@mui/x-data-grid'" ], "properties": { - "api": { "type": { "description": "GridApiCommunity" }, "required": true }, + "api": { "type": { "description": "Api" }, "required": true }, "cellMode": { "type": { "description": "GridCellMode" }, "required": true }, "colDef": { "type": { "description": "GridStateColDef" }, "required": true }, "field": { "type": { "description": "string" }, "required": true }, diff --git a/packages/x-data-grid/src/models/api/gridApiCommunity.ts b/packages/x-data-grid/src/models/api/gridApiCommunity.ts index d36a00695bec1..7f5ba804194af 100644 --- a/packages/x-data-grid/src/models/api/gridApiCommunity.ts +++ b/packages/x-data-grid/src/models/api/gridApiCommunity.ts @@ -18,3 +18,5 @@ export interface GridPrivateApiCommunity GridRowMultiSelectionApi, GridColumnReorderApi, GridRowProApi {} + +export type { GridApiCommon }; diff --git a/packages/x-data-grid/src/models/params/gridCellParams.ts b/packages/x-data-grid/src/models/params/gridCellParams.ts index 41a0592aef246..d8bfae8846adc 100644 --- a/packages/x-data-grid/src/models/params/gridCellParams.ts +++ b/packages/x-data-grid/src/models/params/gridCellParams.ts @@ -9,7 +9,7 @@ import { } from '../gridRows'; import type { GridStateColDef } from '../colDef/gridColDef'; import { GridEditCellProps } from '../gridEditRowModel'; -import { GridApiCommunity } from '../api/gridApiCommunity'; +import { GridApiCommunity, GridApiCommon } from '../api/gridApiCommunity'; /** * Object passed as parameter in the column [[GridColDef]] cell renderer. @@ -19,6 +19,7 @@ export interface GridCellParams< V = unknown, F = V, N extends GridTreeNode = GridTreeNode, + Api extends GridApiCommon = GridApiCommunity, > { /** * The grid row id. @@ -68,7 +69,7 @@ export interface GridCellParams< /** * GridApi that let you manipulate the grid. */ - api: GridApiCommunity; + api: Api; } export interface FocusElement { @@ -83,11 +84,8 @@ export interface GridRenderCellParams< V = any, F = V, N extends GridTreeNodeWithRender = GridTreeNodeWithRender, -> extends GridCellParams { - /** - * GridApi that let you manipulate the grid. - */ - api: GridApiCommunity; + Api extends GridApiCommon = GridApiCommunity, +> extends GridCellParams { /** * A ref allowing to set imperative focus. * It can be passed to the element that should receive focus. @@ -104,13 +102,9 @@ export interface GridRenderEditCellParams< V = any, F = V, N extends GridTreeNodeWithRender = GridTreeNodeWithRender, -> extends GridCellParams, - GridEditCellProps { - /** - * GridApi that let you manipulate the grid. - */ - api: GridApiCommunity; -} + Api extends GridApiCommon = GridApiCommunity, +> extends GridCellParams, + GridEditCellProps {} /** * Object passed as parameter in the column [[GridColDef]] edit cell props change callback.