Skip to content
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] Move column resizing to XGrid only #257

Merged
merged 19 commits into from
Sep 11, 2020
Merged

Conversation

dtassone
Copy link
Member

@dtassone dtassone commented Sep 9, 2020

Fix #245

@oliviertassinari oliviertassinari added bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! and removed bug 🐛 Something doesn't work labels Sep 9, 2020
@oliviertassinari oliviertassinari changed the title fix #245, disable col resize on DataGrid [DataGrid] Move column resizing to XGrid only Sep 9, 2020
Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to update the documentation. I think that we should also add a custom prop type for when a developer tries to enable the feature on the DataGrid (see the example with pageSize).

@oliviertassinari
Copy link
Member

I'm working on the DataGrid vs XGrid feature table comparison in #255, I'm going to account for it.

@dtassone
Copy link
Member Author

We need to update the documentation. I think that we should also add a custom prop type for when a developer tries to enable the feature on the DataGrid (see the example with pageSize).

Not sure what you mean

@oliviertassinari
Copy link
Member

oliviertassinari commented Sep 10, 2020

We need to update the documentation.

Probably change this section to talk about how to enable column resizing (XGrid) and how to disable it for one column.

https://deploy-preview-257--material-ui-x.netlify.app/components/data-grid/columns/#column-sizing

(see the example with pageSize)

https://github.com/mui-org/material-ui-x/blob/8651b355b965d9a20b55340bc25e7ca733096048/packages/grid/data-grid/src/DataGrid.tsx#L76-L89

@dtassone
Copy link
Member Author

dtassone commented Sep 10, 2020

We need to update the documentation.

Probably change this section to talk about how to enable column resizing (XGrid) and how to disable it for one column.

https://deploy-preview-257--material-ui-x.netlify.app/components/data-grid/columns/#column-sizing

(see the example with pageSize)

https://github.com/mui-org/material-ui-x/blob/8651b355b965d9a20b55340bc25e7ca733096048/packages/grid/data-grid/src/DataGrid.tsx#L76-L89

I see! So you prefer to assign them to type true and add proptypes than removing the prop of the options, right?

Any particular reason you check pagesize in disableMultipleColumnSorting?
https://github.com/mui-org/material-ui-x/blob/8651b355b965d9a20b55340bc25e7ca733096048/packages/grid/data-grid/src/DataGrid.tsx#L63

@oliviertassinari
Copy link
Member

Any particular reason you check pagesize in disableMultipleColumnSorting?

It's a mistake from my end, a wrong copy and pastes, we need to fix it :)

@oliviertassinari
Copy link
Member

oliviertassinari commented Sep 10, 2020

I see! So you prefer to assign them to type true and add proptypes than removing the prop of the options, right?

I'm not sure to understand your question. I think that developers should be able to swap DataGrid with XGrid with as little effort as possible.

@dtassone
Copy link
Member Author

Any particular reason you check pagesize in disableMultipleColumnSorting?

It's a mistake from my end, a wrong copy and pastes, we need to fix it :)

I fixed it! No worries!

@dtassone
Copy link
Member Author

I see! So you prefer to assign them to type true and add proptypes than removing the prop of the options, right?

I'm not sure to understand your question. I think that developers should be able to swap DataGrid with XGrid with as little effort as possible.

yes but as these properties are overwritten, and are not required. I originally remove them from the DataGrid props.
Now the user can use them but only set them to one value, and they are also overwritten down the line.
My first feeling was to not expose those props in DataGrid, but just in XGrid as they can be used properly.

@oliviertassinari
Copy link
Member

oliviertassinari commented Sep 10, 2020

@dtassone What about somebody using XGrid with <XGrid pagination /> and want to move to the DataGrid: <DataGrid pagination />? Should he need to remove the pagination prop? I was assuming that it's extra work and that it could be avoided.

@dtassone
Copy link
Member Author

@dtassone What about somebody using XGrid with <XGrid pagination /> and want to move to the DataGrid: <DataGrid pagination />? Should he need to remove the pagination prop? I was assuming that it's extra work and that it could be avoided.

Ahhh good point!

Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A fix of the CI and an update of the documentation and we should be good to go.

Comment on lines 20 to 30
'& *::-webkit-scrollbar-track': {
borderRadius: 10,
},
'& *::-webkit-scrollbar': {
width: 8,
height: 8,
},
'& *::-webkit-scrollbar-thumb': {
borderRadius: 10,
backgroundColor: borderColor,
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong pull request? Isn't this one for #260? Could we keep the pull requests isolated :)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, what about we only mess around if the theme is dark? Disturbing the UX as little as necessary. Especially, I don't think that we should change the size of the scrollbar.

@oliviertassinari
Copy link
Member

Regarding the docs, what do you think about adding a new header? We have one to disable column resizing per column but not to enable/disable it entirely.

let render;
let defaultProps;
beforeEach(() => {
render = createClientRender();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createClientRender() is already wrapping
a beforeEach, it should stay at the top level.

).to.throw(
[
`Material-UI: \` column.resizable = true \` is not a valid prop.`,
'Column resizing is not available in the MIT version',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe to.throw accepts a partial match. I think only matching with the first sentence will be enough to make sure the error isn't coming from somewhere else, and at the same time, make the test easier to write and less likely to fail the next time we fix a typo or slightly improve the error message.


const hasResizableColumns = columns.some((c) => c.resizable);
if (hasResizableColumns) {
throw new Error(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about using a custom prop type? This would allow the code to be removed in production (no bundle size implication). This would also be less disruptive to the DX. This would also give a better component error trace

@dtassone
Copy link
Member Author

something wrong in the configuration of tsconfig?

Probably due to all the paths in tsconfig, as the npm pkgs are missing

@oliviertassinari
Copy link
Member

oliviertassinari commented Sep 11, 2020

Probably due to all the paths in tsconfig, as the npm pkgs are missing

So it's a regression from the current state of master? After this change, we do no longer make sure TypeScript passes on the Storybook? Which can then lead to wrong examples?

@dtassone
Copy link
Member Author

Probably due to all the paths in tsconfig, as the npm pkgs are missing

So it's a regression from the current state of master? After this change, we do no longer make sure TypeScript passes on the Storybook? Which can then lead to wrong examples?

well I added the typecript: {check... as TS was not working on the storybook

@oliviertassinari
Copy link
Member

well I added the typecript: {check... as TS was not working on the storybook

Oh right, my bad. So it's one step forward :) https://github.com/storybookjs/storybook/blob/6c0e00522d1ecbeae6f261fc5eb421238480f3fe/lib/core/src/server/config/defaults.js#L2

@dtassone dtassone merged commit 7e4199f into mui:master Sep 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFC] Change mit/x feature split
2 participants