-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[DataGrid] Drop v4 support #2515
Conversation
33a7491
to
2e35be3
Compare
2e35be3
to
a382e90
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great
test/regressions/index.js
Outdated
@@ -21,6 +21,7 @@ const blacklist = [ | |||
'docs-components-data-grid-filtering/ColumnTypeFilteringGrid.png', // Needs interaction | |||
'docs-components-data-grid-filtering/CustomRatingOperator.png', // Needs interaction | |||
'docs-components-data-grid-filtering/ExtendNumericOperator.png', // Needs interaction | |||
'docs-components-data-grid-components/CustomFooter.png', // Needs @material-ui/lab v4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you detail the issue here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I upgraded all @material-ui/xxx dependencies in the root's package.json to v5, so this regression test will now run with @material-ui/lab v5. However, the Rating component in v5 is not in the lab anymore, then it throws a "The Rating component was moved from the lab to the core" error in the console. Since no test can output to the console it fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, so maybe we should do
'docs-components-data-grid-components/CustomFooter.png', // Needs @material-ui/lab v4 | |
// TODO import the Rating from @mui/material, not the lab. | |
'docs-components-data-grid-components/CustomFooter.png', |
interface ComponentsPropsList extends DataGridProComponentsPropsList {} | ||
} | ||
|
||
declare module '@material-ui/core/styles/components' { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a private path:
declare module '@material-ui/core/styles/components' { | |
declare module '@material-ui/core/styles' { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Components
interface is not exported. We will be able to remove the private path when @mui/material 5.0.0-rc.0 became the minimum version. The RC includes mui/material-ui#28078.
@mui-org/x should we switch to the release candidate of the core directly on this PR to avoid having this problem ? |
@flaviendelangle No, this PR is only to remove the v4 dependency. To support the new package name we have to rename all files, so it's better to do in another one. |
@flaviendelangle The IconButton in v5 is 28x28 while it's 24x24 in v4. We can increase the column width in the x-data-grid-generator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
@@ -66,7 +66,7 @@ function EditCountry(props: GridRenderEditCellParams) { | |||
open | |||
classes={classes} | |||
disableClearable | |||
renderOption={(option) => ( | |||
renderOption={(liProps, option) => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
liProps
needs to be applied on a DOM node, to replace the React fragment.
test/regressions/index.js
Outdated
@@ -21,6 +21,7 @@ const blacklist = [ | |||
'docs-components-data-grid-filtering/ColumnTypeFilteringGrid.png', // Needs interaction | |||
'docs-components-data-grid-filtering/CustomRatingOperator.png', // Needs interaction | |||
'docs-components-data-grid-filtering/ExtendNumericOperator.png', // Needs interaction | |||
'docs-components-data-grid-components/CustomFooter.png', // Needs @material-ui/lab v4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, so maybe we should do
'docs-components-data-grid-components/CustomFooter.png', // Needs @material-ui/lab v4 | |
// TODO import the Rating from @mui/material, not the lab. | |
'docs-components-data-grid-components/CustomFooter.png', |
OK |
Breaking changes
The module augmentation is not enabled by default. This change was done to prevent conflicts with projects using
DataGrid
andDataGridPro
together. In order to still be able to do overrides at the theme level, add the following imports to your project:+import type {} from '@mui/x-data-grid/themeAugmentation';
+import type {} from '@mui/x-data-grid-pro/themeAugmentation';
One of #1902, Preview: https://deploy-preview-2515--material-ui-x.netlify.app/components/data-grid/
The previous module augmentation was using the
MuiDataGridPro
key for overrides:https://github.com/mui-org/material-ui-x/blob/afb858cb986c7b86494be7261353fde9fe537b90/packages/grid/x-grid/src/themeAugmentation/props.ts#L4
However, this is not right because even in the Pro version the overrides are retrieved from the
MuiDataGrid
key, so I updated the definitions to use the same key. As consequence, we can't export these definitions in the index because if a project uses both versions (e.g.@mui/x-data-grid-generator
) they will conflict and not compile. That's the reason for the breaking change.https://github.com/mui-org/material-ui-x/blob/afb858cb986c7b86494be7261353fde9fe537b90/packages/grid/x-grid/src/useDataGridProProps.ts#L11
I didn't update the build config to generate the
themeAugmentation
folder. I plan to do it in a follow-up.