Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
flaviendelangle committed Jun 10, 2024
2 parents c74d72b + 29614a4 commit f2b634e
Show file tree
Hide file tree
Showing 87 changed files with 1,141 additions and 550 deletions.
14 changes: 14 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,5 +237,19 @@ module.exports = {
['x-tree-view', 'x-tree-view-pro'],
ENABLE_REACT_COMPILER_PLUGIN_TREE_VIEW,
),

...addReactCompilerRule(['x-charts', 'x-charts-pro'], ENABLE_REACT_COMPILER_PLUGIN_CHARTS),
...addReactCompilerRule(
['x-data-grid', 'x-data-grid-pro', 'x-data-grid-premium', 'x-data-grid-generator'],
ENABLE_REACT_COMPILER_PLUGIN_DATA_GRID,
),
...addReactCompilerRule(
['x-date-pickers', 'x-date-pickers-pro'],
ENABLE_REACT_COMPILER_PLUGIN_DATE_PICKERS,
),
...addReactCompilerRule(
['x-tree-view', 'x-tree-view-pro'],
ENABLE_REACT_COMPILER_PLUGIN_TREE_VIEW,
),
],
};
66 changes: 66 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,72 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## 7.6.2

_Jun 6, 2024_

We'd like to offer a big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:

- 📚 Adds Date and Time Pickers accessibility page
- 🐞 Bugfixes
- 📚 Documentation improvements

<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->

### Data Grid

#### `@mui/x-data-grid@7.6.2`

- [DataGrid] Add the `areElementSizesEqual` utility to improve code readability (#13254) @layerok
- [DataGrid] Clean up IE remnants from the codebase (#13390) @MBilalShafi

#### `@mui/x-data-grid-pro@7.6.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')

Same changes as in `@mui/x-data-grid@7.6.2`.

#### `@mui/x-data-grid-premium@7.6.2` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')

Same changes as in `@mui/x-data-grid-pro@7.6.2`.

### Date and Time Pickers

#### `@mui/x-date-pickers@7.6.2`

- [fields] Fix `PageUp` and `PageDown` editing on letter sections (#13310) @arthurbalduini
- [pickers] Fix `AdapterDayjs` timezone behavior (#13362) @LukasTy
- [pickers] Use `useRtl` instead of `useTheme` to access direction (#13363) @flaviendelangle

#### `@mui/x-date-pickers-pro@7.6.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')

Same changes as in `@mui/x-date-pickers@7.6.2`.

### Charts

#### `@mui/x-charts@7.6.2`

- [charts] Add `Initializable` type and behaviour to allow checking if a complex context has been initialized. (#13365) @JCQuintas
- [charts] Fix some props not working in `xAxis` and `yAxis` (#13372) @Valyok26
- [charts] Harmonize charts types (#13366) @alexfauquette
- [charts] Introduce plugins system (#13367) @alexfauquette
- [charts] Simplify plugin types (#13396) @JCQuintas

### Docs

- [docs] Add badges like in Material UI @oliviertassinari
- [docs] Update twitter.com to x.com @oliviertassinari
- [docs] Fix the description of `tickInterval` (#13355) @alexfauquette
- [docs] Adjust the code example for `quickFilterValues` (#12919) @michelengelen
- [docs] Create Pickers accessibility page (#13274) @arthurbalduini

### Core

- [core] Comment on `CSS.escape` for the future @oliviertassinari
- [core] Fix `l10n` action setup (#13382) @LukasTy
- [core] Fixes in preparation for React 18.3 (#13378) @LukasTy
- [core] Remove explicit `marked` dependency (#13383) @LukasTy
- [core] Remove unused `@types/prettier` dependency (#13389) @LukasTy
- [core] Add `docs/.env.local` to `.gitignore` (#13377) @KenanYusuf

## 7.6.1

_May 31, 2024_
Expand Down
26 changes: 26 additions & 0 deletions docs/data/data-grid/master-detail/master-detail.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,31 @@ This approach can also be used to change the location of the toggle column, as s
As any ordinary cell renderer, the `value` prop is also available, and it corresponds to the state of the row: `true` when expanded and `false` when collapsed.
:::

## Custom header for detail panel column

To render a custom header for the detail panel column, use the [`renderHeader`](/x/react-data-grid/column-header/#custom-header-renderer) property in the column definition.
This property receives a `GridRenderHeaderParams` object that contains `colDef` (the column definition) and `field`.
The following example demonstrates how to render a custom header for the detail panel column:

```tsx
const columns = [
{
...GRID_DETAIL_PANEL_TOGGLE_COL_DEF,
renderHeader: (params) => (
<div>
<span>{params.colDef.headerName}</span>
<button onClick={() => console.log('Custom action')}>Custom action</button>
</div>
),
},
//... other columns
];
```

:::info
For a more advanced example check out the [Expand or collapse all detail panels](/x/react-data-grid/row-recipes/#expand-or-collapse-all-detail-panels) recipe.
:::

## Disable detail panel content scroll

By default, the detail panel has a width that is the sum of the widths of all columns.
Expand All @@ -153,6 +178,7 @@ Notice that the toggle column is pinned to make sure that it will always be visi
More examples of how to customize the detail panel:

- [One expanded detail panel at a time](/x/react-data-grid/row-recipes/#one-expanded-detail-panel-at-a-time)
- [Expand or collapse all detail panels](/x/react-data-grid/row-recipes/#expand-or-collapse-all-detail-panels)

## apiRef

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<DataGridPro
rows={rows}
columns={columns}
getDetailPanelContent={getDetailPanelContent}
getDetailPanelHeight={getDetailPanelHeight}
/>
134 changes: 134 additions & 0 deletions docs/data/data-grid/row-recipes/DetailPanelExpandCollapseAll.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
import * as React from 'react';
import Box from '@mui/material/Box';
import IconButton from '@mui/material/IconButton';
import UnfoldLessIcon from '@mui/icons-material/UnfoldLess';
import UnfoldMoreIcon from '@mui/icons-material/UnfoldMore';
import {
DataGridPro,
useGridApiContext,
useGridSelector,
gridRowsLookupSelector,
gridDetailPanelExpandedRowIdsSelector,
gridDetailPanelExpandedRowsContentCacheSelector,
GRID_DETAIL_PANEL_TOGGLE_COL_DEF,
} from '@mui/x-data-grid-pro';
import {
randomCreatedDate,
randomCurrency,
randomEmail,
randomPrice,
} from '@mui/x-data-grid-generator';

export default function DetailPanelExpandCollapseAll() {
const getDetailPanelContent = React.useCallback(
({ row }) => <Box sx={{ p: 2 }}>{`Order #${row.id}`}</Box>,
[],
);

const getDetailPanelHeight = React.useCallback(() => 50, []);

return (
<div style={{ height: 400, width: '100%' }}>
<DataGridPro
rows={rows}
columns={columns}
getDetailPanelContent={getDetailPanelContent}
getDetailPanelHeight={getDetailPanelHeight}
/>
</div>
);
}

function CustomDetailPanelHeader() {
const apiRef = useGridApiContext();

const expandedRowIds = useGridSelector(
apiRef,
gridDetailPanelExpandedRowIdsSelector,
);
const rowsWithDetailPanels = useGridSelector(
apiRef,
gridDetailPanelExpandedRowsContentCacheSelector,
);

const noDetailPanelsOpen = expandedRowIds.length === 0;

const expandOrCollapseAll = () => {
const dataRowIdToModelLookup = gridRowsLookupSelector(apiRef);
const allRowIdsWithDetailPanels = Object.keys(rowsWithDetailPanels).map((key) =>
apiRef.current.getRowId(dataRowIdToModelLookup[key]),
);

apiRef.current.setExpandedDetailPanels(
noDetailPanelsOpen ? allRowIdsWithDetailPanels : [],
);
};

const Icon = noDetailPanelsOpen ? UnfoldMoreIcon : UnfoldLessIcon;

return (
<IconButton
size="small"
tabIndex={-1}
onClick={expandOrCollapseAll}
aria-label={noDetailPanelsOpen ? 'Expand All' : 'Collapse All'}
>
<Icon fontSize="inherit" />
</IconButton>
);
}

const columns = [
{
...GRID_DETAIL_PANEL_TOGGLE_COL_DEF,
renderHeader: () => <CustomDetailPanelHeader />,
},
{ field: 'id', headerName: 'Order ID' },
{ field: 'customer', headerName: 'Customer', width: 200 },
{ field: 'date', type: 'date', headerName: 'Placed at' },
{ field: 'currency', headerName: 'Currency' },
{ field: 'total', type: 'number', headerName: 'Total' },
];

const rows = [
{
id: 1,
customer: 'Matheus',
email: randomEmail(),
date: randomCreatedDate(),
currency: randomCurrency(),
total: randomPrice(1, 1000),
},
{
id: 2,
customer: 'Olivier',
email: randomEmail(),
date: randomCreatedDate(),
currency: randomCurrency(),
total: randomPrice(1, 1000),
},
{
id: 3,
customer: 'Flavien',
email: randomEmail(),
date: randomCreatedDate(),
currency: randomCurrency(),
total: randomPrice(1, 1000),
},
{
id: 4,
customer: 'Danail',
email: randomEmail(),
date: randomCreatedDate(),
currency: randomCurrency(),
total: randomPrice(1, 1000),
},
{
id: 5,
customer: 'Alexandre',
email: randomEmail(),
date: randomCreatedDate(),
currency: randomCurrency(),
total: randomPrice(1, 1000),
},
];
Loading

0 comments on commit f2b634e

Please sign in to comment.