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

[docs] Update GridCellParams value description #5849

Merged
merged 7 commits into from
Aug 26, 2022
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
3 changes: 2 additions & 1 deletion docs/data/data-grid/column-definition/RenderCellGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ RenderDate.propTypes = {
*/
hasFocus: PropTypes.bool.isRequired,
/**
* The cell value, but if the column has valueGetter, use getValue.
* The cell value.
* If the column has `valueGetter`, use `params.row` to directly access the fields.
*/
value: PropTypes.instanceOf(Date),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ renderCellExpand.propTypes = {
*/
colDef: PropTypes.object.isRequired,
/**
* The cell value, but if the column has valueGetter, use getValue.
* The cell value.
* If the column has `valueGetter`, use `params.row` to directly access the fields.
*/
value: PropTypes.string,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ function renderRating(params) {

renderRating.propTypes = {
/**
* The cell value, but if the column has valueGetter, use getValue.
* The cell value.
* If the column has `valueGetter`, use `params.row` to directly access the fields.
*/
value: PropTypes.number,
};
Expand Down Expand Up @@ -65,7 +66,8 @@ RatingEditInputCell.propTypes = {
*/
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
/**
* The cell value, but if the column has valueGetter, use getValue.
* The cell value.
* If the column has `valueGetter`, use `params.row` to directly access the fields.
*/
value: PropTypes.number,
};
Expand Down
3 changes: 2 additions & 1 deletion docs/data/data-grid/editing/AutoStopEditComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ SelectEditInputCell.propTypes = {
*/
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
/**
* The cell value, but if the column has valueGetter, use getValue.
* The cell value.
* If the column has `valueGetter`, use `params.row` to directly access the fields.
*/
value: PropTypes.any,
};
Expand Down
6 changes: 4 additions & 2 deletions docs/data/data-grid/editing/CustomEditComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ function renderRating(params) {

renderRating.propTypes = {
/**
* The cell value, but if the column has valueGetter, use getValue.
* The cell value.
* If the column has `valueGetter`, use `params.row` to directly access the fields.
*/
value: PropTypes.number,
};
Expand Down Expand Up @@ -54,7 +55,8 @@ RatingEditInputCell.propTypes = {
*/
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
/**
* The cell value, but if the column has valueGetter, use getValue.
* The cell value.
* If the column has `valueGetter`, use `params.row` to directly access the fields.
*/
value: PropTypes.number,
};
Expand Down
3 changes: 2 additions & 1 deletion docs/data/data-grid/editing/EditingWithDatePickers.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ GridEditDateCell.propTypes = {
*/
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
/**
* The cell value, but if the column has valueGetter, use getValue.
* The cell value.
* If the column has `valueGetter`, use `params.row` to directly access the fields.
*/
value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string]),
};
Expand Down
3 changes: 2 additions & 1 deletion docs/data/data-grid/row-height/ExpandableCells.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ const ExpandableCell = ({ value }) => {

ExpandableCell.propTypes = {
/**
* The cell value, but if the column has valueGetter, use getValue.
* The cell value.
* If the column has `valueGetter`, use `params.row` to directly access the fields.
*/
value: PropTypes.any,
};
Expand Down
28 changes: 14 additions & 14 deletions docs/pages/x/api/data-grid/grid-cell-params.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ import { GridCellParams } from '@mui/x-data-grid';

## Properties

| Name | Type | Description |
| :----------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------- | :--------------------------------------------------------------- |
| <span class="prop-name">cellMode</span> | <span class="prop-type">GridCellMode</span> | The mode of the cell. |
| <span class="prop-name">colDef</span> | <span class="prop-type">GridStateColDef</span> | The column of the row that the current cell belongs to. |
| <span class="prop-name">field</span> | <span class="prop-type">string</span> | The column field of the cell that triggered the event. |
| <span class="prop-name optional">formattedValue<sup><abbr title="optional">?</abbr></sup></span> | <span class="prop-type">F \| undefined</span> | The cell value formatted with the column valueFormatter. |
| <span class="prop-name">getValue</span> | <span class="prop-type">(id: GridRowId, field: string) =&gt; any</span> | Get the cell value of a row and field. |
| <span class="prop-name">hasFocus</span> | <span class="prop-type">boolean</span> | If true, the cell is the active element. |
| <span class="prop-name">id</span> | <span class="prop-type">GridRowId</span> | The grid row id. |
| <span class="prop-name optional">isEditable<sup><abbr title="optional">?</abbr></sup></span> | <span class="prop-type">boolean</span> | If true, the cell is editable. |
| <span class="prop-name">row</span> | <span class="prop-type">GridRowModel&lt;R&gt;</span> | The row model of the row that the current cell belongs to. |
| <span class="prop-name">rowNode</span> | <span class="prop-type">GridRowTreeNodeConfig</span> | The node of the row that the current cell belongs to. |
| <span class="prop-name">tabIndex</span> | <span class="prop-type">0 \| -1</span> | the tabIndex value. |
| <span class="prop-name optional">value<sup><abbr title="optional">?</abbr></sup></span> | <span class="prop-type">V \| undefined</span> | The cell value, but if the column has valueGetter, use getValue. |
| Name | Type | Description |
| :----------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------- |
| <span class="prop-name">cellMode</span> | <span class="prop-type">GridCellMode</span> | The mode of the cell. |
| <span class="prop-name">colDef</span> | <span class="prop-type">GridStateColDef</span> | The column of the row that the current cell belongs to. |
| <span class="prop-name">field</span> | <span class="prop-type">string</span> | The column field of the cell that triggered the event. |
| <span class="prop-name optional">formattedValue<sup><abbr title="optional">?</abbr></sup></span> | <span class="prop-type">F \| undefined</span> | The cell value formatted with the column valueFormatter. |
| <span class="prop-name">getValue</span> | <span class="prop-type">(id: GridRowId, field: string) =&gt; any</span> | Get the cell value of a row and field. |
| <span class="prop-name">hasFocus</span> | <span class="prop-type">boolean</span> | If true, the cell is the active element. |
| <span class="prop-name">id</span> | <span class="prop-type">GridRowId</span> | The grid row id. |
| <span class="prop-name optional">isEditable<sup><abbr title="optional">?</abbr></sup></span> | <span class="prop-type">boolean</span> | If true, the cell is editable. |
| <span class="prop-name">row</span> | <span class="prop-type">GridRowModel&lt;R&gt;</span> | The row model of the row that the current cell belongs to. |
| <span class="prop-name">rowNode</span> | <span class="prop-type">GridRowTreeNodeConfig</span> | The node of the row that the current cell belongs to. |
| <span class="prop-name">tabIndex</span> | <span class="prop-type">0 \| -1</span> | the tabIndex value. |
| <span class="prop-name optional">value<sup><abbr title="optional">?</abbr></sup></span> | <span class="prop-type">V \| undefined</span> | The cell value.<br />If the column has `valueGetter`, use `params.row` to directly access the fields. |
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ GridDetailPanelToggleCell.propTypes = {
*/
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
/**
* The cell value, but if the column has valueGetter, use getValue.
* The cell value.
* If the column has `valueGetter`, use `params.row` to directly access the fields.
*/
value: PropTypes.any,
} as any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ GridTreeDataGroupingCell.propTypes = {
*/
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
/**
* The cell value, but if the column has valueGetter, use getValue.
* The cell value.
* If the column has `valueGetter`, use `params.row` to directly access the fields.
*/
value: PropTypes.any,
} as any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ GridBooleanCellRaw.propTypes = {
*/
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
/**
* The cell value, but if the column has valueGetter, use getValue.
* The cell value.
* If the column has `valueGetter`, use `params.row` to directly access the fields.
*/
value: PropTypes.any,
} as any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ GridEditBooleanCell.propTypes = {
*/
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
/**
* The cell value, but if the column has valueGetter, use getValue.
* The cell value.
* If the column has `valueGetter`, use `params.row` to directly access the fields.
*/
value: PropTypes.any,
} as any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ GridEditDateCell.propTypes = {
*/
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
/**
* The cell value, but if the column has valueGetter, use getValue.
* The cell value.
* If the column has `valueGetter`, use `params.row` to directly access the fields.
*/
value: PropTypes.any,
} as any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ GridEditInputCell.propTypes = {
*/
tabIndex: PropTypes.oneOf([-1, 0]),
/**
* The cell value, but if the column has valueGetter, use getValue.
* The cell value.
* If the column has `valueGetter`, use `params.row` to directly access the fields.
*/
value: PropTypes.any,
} as any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@ GridEditSingleSelectCell.propTypes = {
*/
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
/**
* The cell value, but if the column has valueGetter, use getValue.
* The cell value.
* If the column has `valueGetter`, use `params.row` to directly access the fields.
*/
value: PropTypes.any,
} as any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ GridCellCheckboxForwardRef.propTypes = {
*/
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
/**
* The cell value, but if the column has valueGetter, use getValue.
* The cell value.
* If the column has `valueGetter`, use `params.row` to directly access the fields.
*/
value: PropTypes.any,
} as any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export interface GridCellParams<V = any, R extends GridValidRowModel = any, F =
*/
field: string;
/**
* The cell value, but if the column has valueGetter, use getValue.
* The cell value.
* If the column has `valueGetter`, use `params.row` to directly access the fields.
*/
value?: V | undefined;
/**
Expand Down Expand Up @@ -106,6 +107,10 @@ export interface GridValueGetterParams<V = any, R = any>
* @deprecated Use the `apiRef` returned by `useGridApiContext` or `useGridApiRef` (only available in `@mui/x-data-grid-pro`)
*/
api: any;
/**
* The default value for the cell that the `valueGetter` is overriding.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To override GridCellParams['value'] description for valueGetter, since it doesn't make sense in that case (see #5823 (comment))

*/
value: GridCellParams<V, R, any>['value'];
}

/**
Expand Down