-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into improve-plPL-locale
- Loading branch information
Showing
122 changed files
with
2,059 additions
and
1,300 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
Broken links found by `docs:link-check` that exist: | ||
|
||
- https://mui.com/x/react-data-grid/#premium-plan | ||
- https://mui.com/x/react-data-grid/getting-started/#feature-comparison | ||
- https://mui.com/x/react-date-pickers/fields/#accessible-dom-structure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import * as React from 'react'; | ||
import { LineChart } from '@mui/x-charts/LineChart'; | ||
|
||
const uData = [4000, 3000, 2000, 2780, 1890, 2390, 3490]; | ||
const pData = [2400, 1398, 9800, 3908, 4800, 3800, 4300]; | ||
const xLabels = [ | ||
'Page A', | ||
'Page B', | ||
'Page C', | ||
'Page D', | ||
'Page E', | ||
'Page F', | ||
'Page G', | ||
]; | ||
|
||
export default function CustomLineMarks() { | ||
return ( | ||
<LineChart | ||
width={500} | ||
height={300} | ||
series={[ | ||
{ | ||
data: pData, | ||
label: 'pv', | ||
shape: 'cross', | ||
showMark: ({ index }) => index % 2 === 0, | ||
}, | ||
{ | ||
data: uData, | ||
label: 'uv', | ||
shape: 'diamond', | ||
showMark: ({ index }) => index % 2 === 0, | ||
}, | ||
]} | ||
xAxis={[{ scaleType: 'point', data: xLabels }]} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import * as React from 'react'; | ||
import { LineChart } from '@mui/x-charts/LineChart'; | ||
|
||
const uData = [4000, 3000, 2000, 2780, 1890, 2390, 3490]; | ||
const pData = [2400, 1398, 9800, 3908, 4800, 3800, 4300]; | ||
const xLabels = [ | ||
'Page A', | ||
'Page B', | ||
'Page C', | ||
'Page D', | ||
'Page E', | ||
'Page F', | ||
'Page G', | ||
]; | ||
|
||
export default function CustomLineMarks() { | ||
return ( | ||
<LineChart | ||
width={500} | ||
height={300} | ||
series={[ | ||
{ | ||
data: pData, | ||
label: 'pv', | ||
shape: 'cross', | ||
showMark: ({ index }) => index % 2 === 0, | ||
}, | ||
{ | ||
data: uData, | ||
label: 'uv', | ||
shape: 'diamond', | ||
showMark: ({ index }) => index % 2 === 0, | ||
}, | ||
]} | ||
xAxis={[{ scaleType: 'point', data: xLabels }]} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Data Grid - Cells | ||
|
||
<p class="description">Learn how to customize the rendered elements and values of a cell.</p> | ||
|
||
## Customizing cells | ||
|
||
The Data Grid provides several methods for customizing the rendered elements and values of a cell, including `renderCell()`, `valueGetter()`, and `valueFormatter()`. | ||
This document describes the key differences and specific use cases for each. | ||
|
||
### renderCell() | ||
|
||
Use the `renderCell()` function to render any element inside of a cell. | ||
This is the only way to render a React component inside a cell, and also the only way to customize a cell's behavior—for example, by adding a click handler. | ||
|
||
Though powerful, it's also expensive in terms of performance, so it should only be used as a last resort when there are no other means for implementing a specific use case. | ||
|
||
Here's an example of a cell that uses `renderCell()` to render a button: | ||
|
||
```tsx | ||
const columns: GridColDef[] = [ | ||
{ | ||
field: 'date', | ||
headerName: 'Year', | ||
renderCell: (params: GridRenderCellParams<any, Date>) => ( | ||
<strong> | ||
{params.value.getFullYear()} | ||
<Button | ||
variant="contained" | ||
size="small" | ||
style={{ marginLeft: 16 }} | ||
tabIndex={params.hasFocus ? 0 : -1} | ||
> | ||
Open | ||
</Button> | ||
</strong> | ||
), | ||
}, | ||
]; | ||
``` | ||
|
||
See [Column definition—Rendering cells](/x/react-data-grid/column-definition/#rendering-cells) for more details. | ||
|
||
### valueGetter() | ||
|
||
Use the `valueGetter()` function to derive a cell's value from the row data. | ||
This is the the most performant way to customize the contents of a cell, and it does so without altering the row data itself. | ||
|
||
Common use cases include: | ||
|
||
- Transforming a value (for example, converting a decimal value to a percentage value) | ||
- Deriving a value from multiple fields (for example, concatenating first name and last name) | ||
- Deriving a value from a nested field (for example, `user.address.city`) | ||
|
||
This function is also used internally in the Data Grid to filter, sort, and render (if `renderCell()` or `valueFormatter()` are not provided). | ||
|
||
See [Column definition—Value getter](/x/react-data-grid/column-definition/#value-getter) for more details. | ||
|
||
### valueFormatter() | ||
|
||
Use the `valueFormatter()` function to format a cell's value (without changing the underlying row data). | ||
|
||
Common use cases include: | ||
|
||
- Formatting a date to a custom display format | ||
- Formatting a decimal value to a percentage and appending a `%` sign | ||
- Formatting a boolean value to `Yes` or `No` | ||
|
||
Unlike `valueGetter()`, this function only impacts rendering—_not_ internal calculations like filtering or sorting. | ||
|
||
See [Column definition—value formatter](/x/react-data-grid/column-definition/#value-formatter) for more details. |
Oops, something went wrong.