Skip to content

Commit

Permalink
[DataGrid] Remove the onCellFocusOut prop (#6302)
Browse files Browse the repository at this point in the history
Closes #6300
  • Loading branch information
cherniavskii authored Jan 12, 2023
1 parent ca9d721 commit c80c638
Show file tree
Hide file tree
Showing 20 changed files with 17 additions and 57 deletions.
15 changes: 0 additions & 15 deletions docs/data/data-grid/events/events.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,6 @@
"event": "MuiEvent<MuiBaseEvent>",
"componentProp": "onCellEditStop"
},
{
"projects": ["x-data-grid", "x-data-grid-pro", "x-data-grid-premium"],
"name": "cellFocusIn",
"description": "Fired when a cell gains focus.",
"params": "GridCellParams<any>",
"event": "MuiEvent<{}>"
},
{
"projects": ["x-data-grid", "x-data-grid-pro", "x-data-grid-premium"],
"name": "cellFocusOut",
"description": "Fired when a cell loses focus.",
"params": "GridCellParams<any>",
"event": "MuiEvent<MuiBaseEvent>",
"componentProp": "onCellFocusOut"
},
{
"projects": ["x-data-grid", "x-data-grid-pro", "x-data-grid-premium"],
"name": "cellKeyDown",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,20 @@ The minimum supported Node.js version has been changed from 12.0.0 to 14.0.0, si
- The `onColumnVisibilityChange` prop was removed. Use `onColumnVisibilityModelChange` instead.
- The `components.Header` slot was removed. Use `components.Toolbar` slot instead.
- The `columnTypes` prop was removed. For custom column types see [Custom column types](/x/react-data-grid/column-definition/#custom-column-types) docs.
- The `onCellFocusOut` prop was removed. Use `componentsProps.cell.onBlur` instead:
```tsx
<DataGrid
componentsProps={{
cell: {
onBlur: (event) => {
const cellElement = event.currentTarget;
const field = cellElement.getAttribute('data-field');
const rowId = cell.parentElement.getAttribute('data-id');
},
},
}}
/>
```

### State access

Expand Down Expand Up @@ -118,6 +132,7 @@ The minimum supported Node.js version has been changed from 12.0.0 to 14.0.0, si
```

- The `GridCallbackDetails['api']` was removed from event details. Use the `apiRef` returned by `useGridApiContext` or `useGridApiRef` instead.
- The `cellFocusIn` and `cellFocusOut` events are internal now. Use `componentsProps.cell.onFocus` and `componentsProps.cell.onBlur` props instead.

### Columns

Expand Down
1 change: 0 additions & 1 deletion docs/pages/x/api/data-grid/data-grid-premium.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@
"onCellDoubleClick": { "type": { "name": "func" } },
"onCellEditStart": { "type": { "name": "func" } },
"onCellEditStop": { "type": { "name": "func" } },
"onCellFocusOut": { "type": { "name": "func" } },
"onCellKeyDown": { "type": { "name": "func" } },
"onCellModesModelChange": { "type": { "name": "func" } },
"onColumnHeaderClick": { "type": { "name": "func" } },
Expand Down
1 change: 0 additions & 1 deletion docs/pages/x/api/data-grid/data-grid-pro.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@
"onCellDoubleClick": { "type": { "name": "func" } },
"onCellEditStart": { "type": { "name": "func" } },
"onCellEditStop": { "type": { "name": "func" } },
"onCellFocusOut": { "type": { "name": "func" } },
"onCellKeyDown": { "type": { "name": "func" } },
"onCellModesModelChange": { "type": { "name": "func" } },
"onColumnHeaderClick": { "type": { "name": "func" } },
Expand Down
1 change: 0 additions & 1 deletion docs/pages/x/api/data-grid/data-grid.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@
"onCellDoubleClick": { "type": { "name": "func" } },
"onCellEditStart": { "type": { "name": "func" } },
"onCellEditStop": { "type": { "name": "func" } },
"onCellFocusOut": { "type": { "name": "func" } },
"onCellKeyDown": { "type": { "name": "func" } },
"onCellModesModelChange": { "type": { "name": "func" } },
"onColumnHeaderClick": { "type": { "name": "func" } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
"onCellDoubleClick": "Callback fired when a double click event comes from a cell element.<br><br><strong>Signature:</strong><br><code>function(params: GridCellParams, event: MuiEvent&lt;React.MouseEvent&gt;, details: GridCallbackDetails) =&gt; void</code><br><em>params:</em> With all properties from <a href=\"/x/api/data-grid/grid-cell-params/\">GridCellParams</a>.<br><em>event:</em> The event object.<br><em>details:</em> Additional details for this callback.",
"onCellEditStart": "Callback fired when the cell turns to edit mode.<br><br><strong>Signature:</strong><br><code>function(params: GridCellParams, event: MuiEvent&lt;React.KeyboardEvent | React.MouseEvent&gt;) =&gt; void</code><br><em>params:</em> With all properties from <a href=\"/x/api/data-grid/grid-cell-params/\">GridCellParams</a>.<br><em>event:</em> The event that caused this prop to be called.",
"onCellEditStop": "Callback fired when the cell turns to view mode.<br><br><strong>Signature:</strong><br><code>function(params: GridCellParams, event: MuiEvent&lt;MuiBaseEvent&gt;) =&gt; void</code><br><em>params:</em> With all properties from <a href=\"/x/api/data-grid/grid-cell-params/\">GridCellParams</a>.<br><em>event:</em> The event that caused this prop to be called.",
"onCellFocusOut": "Callback fired when a cell loses focus.<br><br><strong>Signature:</strong><br><code>function(params: GridCellParams, event: MuiEvent&lt;MuiBaseEvent&gt;, details: GridCallbackDetails) =&gt; void</code><br><em>params:</em> With all properties from <a href=\"/x/api/data-grid/grid-cell-params/\">GridCellParams</a>.<br><em>event:</em> The event object.<br><em>details:</em> Additional details for this callback.",
"onCellKeyDown": "Callback fired when a keydown event comes from a cell element.<br><br><strong>Signature:</strong><br><code>function(params: GridCellParams, event: MuiEvent&lt;React.KeyboardEvent&gt;, details: GridCallbackDetails) =&gt; void</code><br><em>params:</em> With all properties from <a href=\"/x/api/data-grid/grid-cell-params/\">GridCellParams</a>.<br><em>event:</em> The event object.<br><em>details:</em> Additional details for this callback.",
"onCellModesModelChange": "Callback fired when the <code>cellModesModel</code> prop changes.<br><br><strong>Signature:</strong><br><code>function(cellModesModel: GridCellModesModel, details: GridCallbackDetails) =&gt; void</code><br><em>cellModesModel:</em> Object containig which cells are in &quot;edit&quot; mode.<br><em>details:</em> Additional details for this callback.",
"onColumnHeaderClick": "Callback fired when a click event comes from a column header element.<br><br><strong>Signature:</strong><br><code>function(params: GridColumnHeaderParams, event: MuiEvent&lt;React.MouseEvent&gt;, details: GridCallbackDetails) =&gt; void</code><br><em>params:</em> With all properties from GridColumnHeaderParams.<br><em>event:</em> The event object.<br><em>details:</em> Additional details for this callback.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
"onCellDoubleClick": "Callback fired when a double click event comes from a cell element.<br><br><strong>Signature:</strong><br><code>function(params: GridCellParams, event: MuiEvent&lt;React.MouseEvent&gt;, details: GridCallbackDetails) =&gt; void</code><br><em>params:</em> With all properties from <a href=\"/x/api/data-grid/grid-cell-params/\">GridCellParams</a>.<br><em>event:</em> The event object.<br><em>details:</em> Additional details for this callback.",
"onCellEditStart": "Callback fired when the cell turns to edit mode.<br><br><strong>Signature:</strong><br><code>function(params: GridCellParams, event: MuiEvent&lt;React.KeyboardEvent | React.MouseEvent&gt;) =&gt; void</code><br><em>params:</em> With all properties from <a href=\"/x/api/data-grid/grid-cell-params/\">GridCellParams</a>.<br><em>event:</em> The event that caused this prop to be called.",
"onCellEditStop": "Callback fired when the cell turns to view mode.<br><br><strong>Signature:</strong><br><code>function(params: GridCellParams, event: MuiEvent&lt;MuiBaseEvent&gt;) =&gt; void</code><br><em>params:</em> With all properties from <a href=\"/x/api/data-grid/grid-cell-params/\">GridCellParams</a>.<br><em>event:</em> The event that caused this prop to be called.",
"onCellFocusOut": "Callback fired when a cell loses focus.<br><br><strong>Signature:</strong><br><code>function(params: GridCellParams, event: MuiEvent&lt;MuiBaseEvent&gt;, details: GridCallbackDetails) =&gt; void</code><br><em>params:</em> With all properties from <a href=\"/x/api/data-grid/grid-cell-params/\">GridCellParams</a>.<br><em>event:</em> The event object.<br><em>details:</em> Additional details for this callback.",
"onCellKeyDown": "Callback fired when a keydown event comes from a cell element.<br><br><strong>Signature:</strong><br><code>function(params: GridCellParams, event: MuiEvent&lt;React.KeyboardEvent&gt;, details: GridCallbackDetails) =&gt; void</code><br><em>params:</em> With all properties from <a href=\"/x/api/data-grid/grid-cell-params/\">GridCellParams</a>.<br><em>event:</em> The event object.<br><em>details:</em> Additional details for this callback.",
"onCellModesModelChange": "Callback fired when the <code>cellModesModel</code> prop changes.<br><br><strong>Signature:</strong><br><code>function(cellModesModel: GridCellModesModel, details: GridCallbackDetails) =&gt; void</code><br><em>cellModesModel:</em> Object containig which cells are in &quot;edit&quot; mode.<br><em>details:</em> Additional details for this callback.",
"onColumnHeaderClick": "Callback fired when a click event comes from a column header element.<br><br><strong>Signature:</strong><br><code>function(params: GridColumnHeaderParams, event: MuiEvent&lt;React.MouseEvent&gt;, details: GridCallbackDetails) =&gt; void</code><br><em>params:</em> With all properties from GridColumnHeaderParams.<br><em>event:</em> The event object.<br><em>details:</em> Additional details for this callback.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
"onCellDoubleClick": "Callback fired when a double click event comes from a cell element.<br><br><strong>Signature:</strong><br><code>function(params: GridCellParams, event: MuiEvent&lt;React.MouseEvent&gt;, details: GridCallbackDetails) =&gt; void</code><br><em>params:</em> With all properties from <a href=\"/x/api/data-grid/grid-cell-params/\">GridCellParams</a>.<br><em>event:</em> The event object.<br><em>details:</em> Additional details for this callback.",
"onCellEditStart": "Callback fired when the cell turns to edit mode.<br><br><strong>Signature:</strong><br><code>function(params: GridCellParams, event: MuiEvent&lt;React.KeyboardEvent | React.MouseEvent&gt;) =&gt; void</code><br><em>params:</em> With all properties from <a href=\"/x/api/data-grid/grid-cell-params/\">GridCellParams</a>.<br><em>event:</em> The event that caused this prop to be called.",
"onCellEditStop": "Callback fired when the cell turns to view mode.<br><br><strong>Signature:</strong><br><code>function(params: GridCellParams, event: MuiEvent&lt;MuiBaseEvent&gt;) =&gt; void</code><br><em>params:</em> With all properties from <a href=\"/x/api/data-grid/grid-cell-params/\">GridCellParams</a>.<br><em>event:</em> The event that caused this prop to be called.",
"onCellFocusOut": "Callback fired when a cell loses focus.<br><br><strong>Signature:</strong><br><code>function(params: GridCellParams, event: MuiEvent&lt;MuiBaseEvent&gt;, details: GridCallbackDetails) =&gt; void</code><br><em>params:</em> With all properties from <a href=\"/x/api/data-grid/grid-cell-params/\">GridCellParams</a>.<br><em>event:</em> The event object.<br><em>details:</em> Additional details for this callback.",
"onCellKeyDown": "Callback fired when a keydown event comes from a cell element.<br><br><strong>Signature:</strong><br><code>function(params: GridCellParams, event: MuiEvent&lt;React.KeyboardEvent&gt;, details: GridCallbackDetails) =&gt; void</code><br><em>params:</em> With all properties from <a href=\"/x/api/data-grid/grid-cell-params/\">GridCellParams</a>.<br><em>event:</em> The event object.<br><em>details:</em> Additional details for this callback.",
"onCellModesModelChange": "Callback fired when the <code>cellModesModel</code> prop changes.<br><br><strong>Signature:</strong><br><code>function(cellModesModel: GridCellModesModel, details: GridCallbackDetails) =&gt; void</code><br><em>cellModesModel:</em> Object containig which cells are in &quot;edit&quot; mode.<br><em>details:</em> Additional details for this callback.",
"onColumnHeaderClick": "Callback fired when a click event comes from a column header element.<br><br><strong>Signature:</strong><br><code>function(params: GridColumnHeaderParams, event: MuiEvent&lt;React.MouseEvent&gt;, details: GridCallbackDetails) =&gt; void</code><br><em>params:</em> With all properties from GridColumnHeaderParams.<br><em>event:</em> The event object.<br><em>details:</em> Additional details for this callback.",
Expand Down
1 change: 0 additions & 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 @@ -70,7 +70,6 @@
"onCellDoubleClick": "Callback fired when a double click event comes from a cell element.<br><br><strong>Signature:</strong><br><code>function(params: GridCellParams, event: MuiEvent&lt;React.MouseEvent&gt;, details: GridCallbackDetails) =&gt; void</code><br><em>params:</em> With all properties from <a href=\"/x/api/data-grid/grid-cell-params/\">GridCellParams</a>.<br><em>event:</em> The event object.<br><em>details:</em> Additional details for this callback.",
"onCellEditStart": "Callback fired when the cell turns to edit mode.<br><br><strong>Signature:</strong><br><code>function(params: GridCellParams, event: MuiEvent&lt;React.KeyboardEvent | React.MouseEvent&gt;) =&gt; void</code><br><em>params:</em> With all properties from <a href=\"/x/api/data-grid/grid-cell-params/\">GridCellParams</a>.<br><em>event:</em> The event that caused this prop to be called.",
"onCellEditStop": "Callback fired when the cell turns to view mode.<br><br><strong>Signature:</strong><br><code>function(params: GridCellParams, event: MuiEvent&lt;MuiBaseEvent&gt;) =&gt; void</code><br><em>params:</em> With all properties from <a href=\"/x/api/data-grid/grid-cell-params/\">GridCellParams</a>.<br><em>event:</em> The event that caused this prop to be called.",
"onCellFocusOut": "Callback fired when a cell loses focus.<br><br><strong>Signature:</strong><br><code>function(params: GridCellParams, event: MuiEvent&lt;MuiBaseEvent&gt;, details: GridCallbackDetails) =&gt; void</code><br><em>params:</em> With all properties from <a href=\"/x/api/data-grid/grid-cell-params/\">GridCellParams</a>.<br><em>event:</em> The event object.<br><em>details:</em> Additional details for this callback.",
"onCellKeyDown": "Callback fired when a keydown event comes from a cell element.<br><br><strong>Signature:</strong><br><code>function(params: GridCellParams, event: MuiEvent&lt;React.KeyboardEvent&gt;, details: GridCallbackDetails) =&gt; void</code><br><em>params:</em> With all properties from <a href=\"/x/api/data-grid/grid-cell-params/\">GridCellParams</a>.<br><em>event:</em> The event object.<br><em>details:</em> Additional details for this callback.",
"onCellModesModelChange": "Callback fired when the <code>cellModesModel</code> prop changes.<br><br><strong>Signature:</strong><br><code>function(cellModesModel: GridCellModesModel, details: GridCallbackDetails) =&gt; void</code><br><em>cellModesModel:</em> Object containig which cells are in &quot;edit&quot; mode.<br><em>details:</em> Additional details for this callback.",
"onColumnHeaderClick": "Callback fired when a click event comes from a column header element.<br><br><strong>Signature:</strong><br><code>function(params: GridColumnHeaderParams, event: MuiEvent&lt;React.MouseEvent&gt;, details: GridCallbackDetails) =&gt; void</code><br><em>params:</em> With all properties from GridColumnHeaderParams.<br><em>event:</em> The event object.<br><em>details:</em> Additional details for this callback.",
Expand Down
1 change: 0 additions & 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 @@ -70,7 +70,6 @@
"onCellDoubleClick": "Callback fired when a double click event comes from a cell element.<br><br><strong>Signature:</strong><br><code>function(params: GridCellParams, event: MuiEvent&lt;React.MouseEvent&gt;, details: GridCallbackDetails) =&gt; void</code><br><em>params:</em> With all properties from <a href=\"/x/api/data-grid/grid-cell-params/\">GridCellParams</a>.<br><em>event:</em> The event object.<br><em>details:</em> Additional details for this callback.",
"onCellEditStart": "Callback fired when the cell turns to edit mode.<br><br><strong>Signature:</strong><br><code>function(params: GridCellParams, event: MuiEvent&lt;React.KeyboardEvent | React.MouseEvent&gt;) =&gt; void</code><br><em>params:</em> With all properties from <a href=\"/x/api/data-grid/grid-cell-params/\">GridCellParams</a>.<br><em>event:</em> The event that caused this prop to be called.",
"onCellEditStop": "Callback fired when the cell turns to view mode.<br><br><strong>Signature:</strong><br><code>function(params: GridCellParams, event: MuiEvent&lt;MuiBaseEvent&gt;) =&gt; void</code><br><em>params:</em> With all properties from <a href=\"/x/api/data-grid/grid-cell-params/\">GridCellParams</a>.<br><em>event:</em> The event that caused this prop to be called.",
"onCellFocusOut": "Callback fired when a cell loses focus.<br><br><strong>Signature:</strong><br><code>function(params: GridCellParams, event: MuiEvent&lt;MuiBaseEvent&gt;, details: GridCallbackDetails) =&gt; void</code><br><em>params:</em> With all properties from <a href=\"/x/api/data-grid/grid-cell-params/\">GridCellParams</a>.<br><em>event:</em> The event object.<br><em>details:</em> Additional details for this callback.",
"onCellKeyDown": "Callback fired when a keydown event comes from a cell element.<br><br><strong>Signature:</strong><br><code>function(params: GridCellParams, event: MuiEvent&lt;React.KeyboardEvent&gt;, details: GridCallbackDetails) =&gt; void</code><br><em>params:</em> With all properties from <a href=\"/x/api/data-grid/grid-cell-params/\">GridCellParams</a>.<br><em>event:</em> The event object.<br><em>details:</em> Additional details for this callback.",
"onCellModesModelChange": "Callback fired when the <code>cellModesModel</code> prop changes.<br><br><strong>Signature:</strong><br><code>function(cellModesModel: GridCellModesModel, details: GridCallbackDetails) =&gt; void</code><br><em>cellModesModel:</em> Object containig which cells are in &quot;edit&quot; mode.<br><em>details:</em> Additional details for this callback.",
"onColumnHeaderClick": "Callback fired when a click event comes from a column header element.<br><br><strong>Signature:</strong><br><code>function(params: GridColumnHeaderParams, event: MuiEvent&lt;React.MouseEvent&gt;, details: GridCallbackDetails) =&gt; void</code><br><em>params:</em> With all properties from GridColumnHeaderParams.<br><em>event:</em> The event object.<br><em>details:</em> Additional details for this callback.",
Expand Down
Loading

0 comments on commit c80c638

Please sign in to comment.