-
-
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] Fix flex columns and resize #2110
Conversation
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.
- We miss a test case
- There is a CSS regression, see argos once it has finish running
export function FlexLayoutGrid() { | ||
const { data } = useDemoData({ | ||
dataSet: 'Commodity', | ||
rowLength: 15, | ||
maxColumns: 6, | ||
}); | ||
|
||
const tmpData = JSON.parse(JSON.stringify(data)); | ||
tmpData.columns.forEach((item) => { | ||
item.flex = 1; | ||
}); | ||
return ( | ||
<div style={{ height: '400px', width: '400px' }}> | ||
<div style={{ display: 'flex', height: '100%' }}> | ||
<div style={{ flexGrow: 1 }}> | ||
<XGrid | ||
autoHeight | ||
showCellRightBorder | ||
showColumnRightBorder | ||
disableExtendRowFullWidth | ||
rows={tmpData.rows} | ||
columns={tmpData.columns} | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
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.
We can already reproduce the issue in the docs. What's the use case for the story?
export function FlexLayoutGrid() { | |
const { data } = useDemoData({ | |
dataSet: 'Commodity', | |
rowLength: 15, | |
maxColumns: 6, | |
}); | |
const tmpData = JSON.parse(JSON.stringify(data)); | |
tmpData.columns.forEach((item) => { | |
item.flex = 1; | |
}); | |
return ( | |
<div style={{ height: '400px', width: '400px' }}> | |
<div style={{ display: 'flex', height: '100%' }}> | |
<div style={{ flexGrow: 1 }}> | |
<XGrid | |
autoHeight | |
showCellRightBorder | |
showColumnRightBorder | |
disableExtendRowFullWidth | |
rows={tmpData.rows} | |
columns={tmpData.columns} | |
/> | |
</div> | |
</div> | |
</div> | |
); | |
} |
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.
working on flex columns, and see if it works. Where is #2011 in the doc?
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, could we make it a Snap story in this case? This could complement the function test to make sure the rendering with sub-pixels is still correct
@@ -22,6 +22,7 @@ export const GridEmptyCell = React.memo(function GridEmptyCell({ | |||
lineHeight: `${height - 1}px`, | |||
minHeight: height, | |||
maxHeight: height, | |||
padding: 0, |
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.
Do we need?
padding: 0, |
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 issue is that the cell always have a padding of 10px
But we do not want it on the GridEmptyCell.
Maybe we should add a class to this cell and set the padding to 0 in the rootStyle instead of 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.
yes
Yes I moved the separator to avoid negative margin that creates issue on resize |
About #2011, the double border is still there. The separator is being displayed when |
A separate issue that can be fixed in another PR. We need to keep PR small |
I'm confused, we have this PR and #2104 both trying to fix #2103. About the solution proposed to fix it here, it's still trying to scroll, but since we removed the padding from the empty cell it can't. We're not fixing the root cause #2103 (comment). To reproduce, use fixed size columns. siTztA0h5p.mp4 |
@m4theushw for me this PR is a follow up on #2104 because there are several issues to be fixed around the column width. The scroll event should be fixed here #2104 (comment) |
the separator creates an extra 10px on the columns header due to its positioning. The problem is the icon shape that is a square 24x24 instead of just a bar 24x2 which would be easier to position |
I managed to fix the icon and put the bar on the right side of the icon so we can position it properly without using negative margin. let me know what you think |
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.
export function FlexLayoutGrid() { | ||
const { data } = useDemoData({ | ||
dataSet: 'Commodity', | ||
rowLength: 15, | ||
maxColumns: 6, | ||
}); | ||
|
||
const tmpData = JSON.parse(JSON.stringify(data)); | ||
tmpData.columns.forEach((item) => { | ||
item.flex = 1; | ||
}); | ||
return ( | ||
<div style={{ height: '400px', width: '400px' }}> | ||
<div style={{ display: 'flex', height: '100%' }}> | ||
<div style={{ flexGrow: 1 }}> | ||
<XGrid | ||
autoHeight | ||
showCellRightBorder | ||
showColumnRightBorder | ||
disableExtendRowFullWidth | ||
rows={tmpData.rows} | ||
columns={tmpData.columns} | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
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, could we make it a Snap story in this case? This could complement the function test to make sure the rendering with sub-pixels is still correct
We can resume the effort later on |
follow up from #2104
fix #2011
fix #2103
Preview: https://deploy-preview-2110--material-ui-x.netlify.app/components/data-grid/columns/#fluid-width