Skip to content

Commit

Permalink
Merge branch 'refactor-typed-grid-slots' of github.com:romgrk/mui-x i…
Browse files Browse the repository at this point in the history
…nto refactor-typed-grid-slots
  • Loading branch information
romgrk committed Feb 5, 2024
2 parents cfcc18e + a4342b6 commit 1b0a11b
Show file tree
Hide file tree
Showing 201 changed files with 3,199 additions and 1,189 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@0b21cf2492b6b02c465a3e5d7c473717ad7721ba # v3.23.1
uses: github/codeql-action/init@b7bf0a3ed3ecfa44160715d7c442788f65f0f923 # v3.23.2
with:
languages: typescript
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -29,4 +29,4 @@ jobs:
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@0b21cf2492b6b02c465a3e5d7c473717ad7721ba # v3.23.1
uses: github/codeql-action/analyze@b7bf0a3ed3ecfa44160715d7c442788f65f0f923 # v3.23.2
2 changes: 1 addition & 1 deletion .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ jobs:

# Upload the results to GitHub's code scanning dashboard.
- name: Upload to code-scanning
uses: github/codeql-action/upload-sarif@0b21cf2492b6b02c465a3e5d7c473717ad7721ba # v3.23.1
uses: github/codeql-action/upload-sarif@b7bf0a3ed3ecfa44160715d7c442788f65f0f923 # v3.23.2
with:
sarif_file: results.sarif
100 changes: 100 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,106 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## 7.0.0-beta.0

_Jan 26, 2024_

We are glad to announce MUI X v7 beta!
This version has several improvements, bug fixes, and exciting features 🎉.
We want to offer a big thanks to the 7 contributors who made this release possible ✨:

- 🚀 Release the [Date Time Range Picker](https://next.mui.com/x/react-date-pickers/date-time-range-picker/) component (#9528) @LukasTy

<img src="https://github.com/mui/mui-x/assets/4941090/122bb7bc-5e72-4e11-a8e5-96f3026de922" width="510" height="652" alt="Date Time Range Picker example" />

- 🎁 New column management panel design for the Data Grid (#11770) @MBilalShafi

<img width="310" alt="image" src="https://github.com/mui/mui-x/assets/12609561/a79dac8b-d54d-4e69-a63a-ef78f3993f37">

- 🐞 Bugfixes
- 📚 Documentation improvements

### Data Grid

#### Breaking changes

- The columns management component has been redesigned and the component was extracted from the `ColumnsPanel` which now only serves as a wrapper to display the component above the headers as a panel. As a result, a new slot `columnsManagement` and the related prop `slotProps.columnsManagement` have been introduced. The props corresponding to the columns management component which were previously passed to the prop `slotProps.columnsPanel` should now be passed to `slotProps.columnsManagement`. `slotProps.columnsPanel` could still be used to override props corresponding to the `Panel` component used in `ColumnsPanel` which uses [`Popper`](https://next.mui.com/material-ui/react-popper/) component under the hood.

```diff
<DataGrid
slotProps={{
- columnsPanel: {
+ columnsManagement: {
sort: 'asc',
autoFocusSearchField: false,
},
}}
/>
```

- `Show all` and `Hide all` buttons in the `ColumnsPanel` have been combined into one `Show/Hide All` toggle in the new columns management component. The related props `disableShowAllButton` and `disableHideAllButton` have been replaced with a new prop `disableShowHideToggle`.

```diff
<DataGrid
- disableShowAllButton
- disableHideAllButton
+ disableShowHideToggle
/>
```

#### `@mui/x-data-grid@7.0.0-beta.0`

- [DataGrid] Export `GridColumnTypes` interface for custom column types (#11742) @cherniavskii
- [DataGrid] Initialize `apiRef` early (#11792) @cherniavskii
- [DataGrid] New column management panel design (#11770) @MBilalShafi
- [DataGrid] Fix support for tree with more than 50,000 children (#11757) @zenazn

#### `@mui/x-data-grid-pro@7.0.0-beta.0` [![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.0.0-beta.0`.

#### `@mui/x-data-grid-premium@7.0.0-beta.0` [![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.0.0-beta.0`.

### Date Pickers

#### `@mui/x-date-pickers@7.0.0-beta.0`

- [pickers] Apply the `layout.tabs` class to `Tabs` slot (#11781) @LukasTy
- [pickers] Avoid deep imports (#11794) @LukasTy
- [pickers] Fields typing optimization (#11779) @LukasTy

#### `@mui/x-date-pickers-pro@7.0.0-beta.0` [![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.0.0-beta.0`, plus:

- [pickers] Add `DateTimeRangePicker` component (#9528) @LukasTy
- [pickers] Add `DateTimeRangePicker` theme augmentation (#11814) @LukasTy
- [DateRangePicker] Remove `calendars` prop on `Mobile` (#11752) @LukasTy

### Tree View / `@mui/x-tree-view@7.0.0-beta.0`

- [TreeView] Remove unused props from prop-types and typing (#11778) @flaviendelangle
- [TreeView] Throw an error when two items have the same id (#11715) @flaviendelangle

### Docs

- [docs] Add `contextValue` to the headless tree view doc (#11705) @flaviendelangle
- [docs] Add section for the `disableSelection` prop (#11821) @flaviendelangle
- [docs] Fix brand name non-breaking space (#11758) @oliviertassinari
- [docs] Fix typo in Data Grid components page (#11775) @flaviendelangle
- [docs] Fix use of quote, should use callout (#11759) @oliviertassinari
- [docs] Improve error message for MUI Vale rule @oliviertassinari
- [docs] Include `DateTimeRangePicker` in relevant demos (#11815) @LukasTy
- [docs] Add recipe for sorting row groups by the number of child rows (#11164) @cherniavskii

### Core

- [core] Cleanup script and alias setup (#11749) @LukasTy
- [core] Polish issue templates @oliviertassinari
- [code-infra] Update prettier and pretty-quick (#11735) @Janpot

## 7.0.0-alpha.9

_Jan 19, 2024_
Expand Down
23 changes: 2 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,28 +86,9 @@ Premium package:

- [`@mui/x-data-grid-premium`](https://www.npmjs.com/package/@mui/x-data-grid-premium)

## Questions and feedback
## Support

### GitHub

We use GitHub issues as a bug and feature request tracker.
If you think you've found a bug, or you have a new feature idea, please start by [making sure it hasn't already been reported or fixed](https://github.com/mui/mui-x/issues?utf8=%E2%9C%93&q=is%3Aopen+is%3Aclosed).
You can search through existing issues and pull requests to see if someone has reported one similar to yours.

[Open an issue](https://github.com/mui/mui-x/issues/new/choose) in the MUI X repo.

### Stack Overflow

Visit Stack Overflow to ask questions and read crowdsourced answers from expert developers in the MUI X community, as well as MUI X maintainers.

[Post a question about MUI X](https://stackoverflow.com/questions/tagged/mui-x) on Stack Overflow using the "mui-x" tag.

### Bugs and feature requests

You can create an [issue](https://github.com/mui/mui-x/issues) on this repository.
Please always provide a reproduction case.
As a starting point, we recommend you [browse the documentation](https://mui.com/x/introduction/), and [select](https://mui.com/static/docs/forking-an-example.png) the closest example to your use case.
Or you can use a [basic template](https://mui.com/r/x-issue-template) to build your reproduction case.
From community guidance to critical business support, we're here to help. Read the [support guide](https://mui.com/x/introduction/support/).

## Contributing

Expand Down
8 changes: 8 additions & 0 deletions docs/data/charts-component-api-pages.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import type { MuiPage } from '@mui/monorepo/docs/src/MuiPage';

const apiPages: MuiPage[] = [
{
pathname: '/x/api/charts/animated-area',
title: 'AnimatedArea',
},
{
pathname: '/x/api/charts/animated-line',
title: 'AnimatedLine',
},
{
pathname: '/x/api/charts/area-element',
title: 'AreaElement',
Expand Down
165 changes: 165 additions & 0 deletions docs/data/charts/areas-demo/AreaChartFillByValue.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
import * as React from 'react';

import { green, red } from '@mui/material/colors';
import Stack from '@mui/material/Stack';
import { useYScale, useDrawingArea } from '@mui/x-charts/hooks';
import { LineChart } from '@mui/x-charts/LineChart';

const data = [4000, 3000, -1000, 500, -2100, -250, 3490];
const xData = ['Page A', 'Page B', 'Page C', 'Page D', 'Page E', 'Page F', 'Page G'];

function ColorSwich({ threshold, color1, color2, id }) {
const { top, height, bottom } = useDrawingArea();
const svgHeight = top + bottom + height;

const scale = useYScale(); // You can provide the axis Id if you have multiple ones
const y0 = scale(threshold); // The coordinate of of the origine
const off = y0 !== undefined ? y0 / svgHeight : 0;

return (
<defs>
<linearGradient
id={id}
x1="0"
x2="0"
y1="0"
y2={`${svgHeight}px`}
gradientUnits="userSpaceOnUse" // Use the SVG coordinate instead of the component ones.
>
<stop offset={off} stopColor={color1} stopOpacity={1} />
<stop offset={off} stopColor={color2} stopOpacity={1} />
</linearGradient>
</defs>
);
}

export default function AreaChartFillByValue() {
return (
<Stack direction="column" width="100%" spacing={1}>
<LineChart
xAxis={[{ data: xData, scaleType: 'point' }]}
yAxis={[{ min: -3000, max: 4000 }]}
series={[{ data, showMark: false, area: true }]}
height={200}
margin={{ top: 20, bottom: 30, left: 75 }}
sx={{
'& .MuiAreaElement-root': {
fill: 'url(#swich-color-id-1)',
},
}}
>
<ColorSwich
color1="#11B678" // green
color2="#FF3143" // red
threshold={0}
id="swich-color-id-1"
/>
<rect x={0} y={0} width={5} height="100%" fill="url(#swich-color-id-1)" />
</LineChart>

<LineChart
xAxis={[{ data: xData, scaleType: 'point' }]}
yAxis={[{ min: -3000, max: 4000 }]}
series={[{ data, showMark: false, area: true }]}
height={200}
margin={{ top: 20, bottom: 30, left: 75 }}
sx={{
'& .MuiAreaElement-root': {
fill: 'url(#swich-color-id-2)',
},
}}
>
<ColorPalette id="swich-color-id-2" />
<rect x={0} y={0} width={5} height="100%" fill="url(#swich-color-id-2)" />
</LineChart>
</Stack>
);
}

function ColorPalette({ id }) {
const { top, height, bottom } = useDrawingArea();
const svgHeight = top + bottom + height;

const scale = useYScale(); // You can provide the axis Id if you have multiple ones

return (
<defs>
<linearGradient
id={id}
x1="0"
x2="0"
y1="0"
y2={`${svgHeight}px`}
gradientUnits="userSpaceOnUse" // Use the SVG coordinate instead of the component ones.
>
<stop
offset={scale(5000) / svgHeight}
stopColor={green[400]}
stopOpacity={1}
/>
<stop
offset={scale(4000) / svgHeight}
stopColor={green[400]}
stopOpacity={1}
/>
<stop
offset={scale(4000) / svgHeight}
stopColor={green[300]}
stopOpacity={1}
/>
<stop
offset={scale(3000) / svgHeight}
stopColor={green[300]}
stopOpacity={1}
/>
<stop
offset={scale(3000) / svgHeight}
stopColor={green[200]}
stopOpacity={1}
/>
<stop
offset={scale(2000) / svgHeight}
stopColor={green[200]}
stopOpacity={1}
/>
<stop
offset={scale(2000) / svgHeight}
stopColor={green[100]}
stopOpacity={1}
/>
<stop
offset={scale(1000) / svgHeight}
stopColor={green[100]}
stopOpacity={1}
/>
<stop
offset={scale(1000) / svgHeight}
stopColor={green[50]}
stopOpacity={1}
/>
<stop offset={scale(0) / svgHeight} stopColor={green[50]} stopOpacity={1} />
<stop offset={scale(0) / svgHeight} stopColor={red[100]} stopOpacity={1} />
<stop
offset={scale(-1000) / svgHeight}
stopColor={red[100]}
stopOpacity={1}
/>
<stop
offset={scale(-1000) / svgHeight}
stopColor={red[200]}
stopOpacity={1}
/>
<stop
offset={scale(-2000) / svgHeight}
stopColor={red[200]}
stopOpacity={1}
/>
<stop
offset={scale(-3000) / svgHeight}
stopColor={red[300]}
stopOpacity={1}
/>
</linearGradient>
</defs>
);
}
Loading

0 comments on commit 1b0a11b

Please sign in to comment.