Skip to content

Commit

Permalink
[DataGrid] Make more props readonly arrays instead of mutable arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
pcorpet committed May 31, 2024
1 parent ed3472b commit 24a735a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/x-data-grid/src/models/api/gridRowSelectionApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export interface GridRowSelectionApi {
/**
* Updates the selected rows to be those passed to the `rowIds` argument.
* Any row already selected will be unselected.
* @param {GridRowId[]} rowIds The row ids to select.
* @param {readonly GridRowId[]} rowIds The row ids to select.
*/
setRowSelectionModel: (rowIds: GridRowId[]) => void;
setRowSelectionModel: (rowIds: readonly GridRowId[]) => void;
}

export interface GridRowMultiSelectionApi {
Expand Down
8 changes: 4 additions & 4 deletions packages/x-data-grid/src/models/colDef/gridColDef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export interface GridBaseColDef<R extends GridValidRowModel = GridValidRowModel,
/**
* The order of the sorting sequence.
*/
sortingOrder?: GridSortDirection[];
sortingOrder?: readonly GridSortDirection[];
/**
* If `true`, the column is resizable.
* @default true
Expand Down Expand Up @@ -264,7 +264,7 @@ export interface GridBaseColDef<R extends GridValidRowModel = GridValidRowModel,
/**
* Allows setting the filter operators for this column.
*/
filterOperators?: GridFilterOperator<R, V, F>[];
filterOperators?: readonly GridFilterOperator<R, V, F>[];
/**
* The callback that generates a filtering function for a given quick filter value.
* This function can return `null` to skip filtering for this value and column.
Expand Down Expand Up @@ -306,9 +306,9 @@ export interface GridActionsColDef<R extends GridValidRowModel = any, V = any, F
/**
* Function that returns the actions to be shown.
* @param {GridRowParams} params The params for each row.
* @returns {React.ReactElement<GridActionsCellItemProps>[]} An array of [[GridActionsCell]] elements.
* @returns {readonly React.ReactElement<GridActionsCellItemProps>[]} An array of [[GridActionsCell]] elements.
*/
getActions: (params: GridRowParams<R>) => React.ReactElement<GridActionsCellItemProps>[];
getActions: (params: GridRowParams<R>) => readonly React.ReactElement<GridActionsCellItemProps>[];
}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/x-data-grid/src/models/gridRowSelectionModel.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GridRowId } from './gridRows';

export type GridInputRowSelectionModel = GridRowId[] | GridRowId;
export type GridInputRowSelectionModel = readonly GridRowId[] | GridRowId;

export type GridRowSelectionModel = GridRowId[];
export type GridRowSelectionModel = readonly GridRowId[];

0 comments on commit 24a735a

Please sign in to comment.