[EUI Datagrid] Adds rowHeightOptions property#4853
[EUI Datagrid] Adds rowHeightOptions property#4853chandlerprall merged 35 commits intoelastic:masterfrom
Conversation
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4853/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4853/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4853/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4853/ |
There was a problem hiding this comment.
EDIT: comment at #4853 (comment) supersedes this
Looks like a great PoC, thank you for exploring! I'm kinda surprised how straight forward it was to get to even this point. Things we'll need to consider/answer to move forward:
computedStylesForGridCellis called any time EuiDataGrid renders, and outside any lifecyclegetNumberFromPx- we'll likely want to try to support non-px values- Would be great to avoid the extra div in data_grid_cell , and is there a way to extend browser support of this method beyond chrome/webkit?
defaultHeightconflicts with the density setting, though this is probably fine as-is
kertal
left a comment
There was a problem hiding this comment.
think cells should vertically align top, shouldn't they? @chandlerprall

|
Spoke with @elastic/kibana-app, let's change the line height configuration to accept either a pixel value or the desired line count. This should remove the need for computing the style & doing other calculations. We want to support:
For the API, I envision something like: |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4853/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4853/ |
chandlerprall
left a comment
There was a problem hiding this comment.
Cell actions' appearance/creation shifts content
datagrid_height_truncation.mov
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4853/ |
kertal
left a comment
There was a problem hiding this comment.
@chandlerprall
Not 100% sure of it, but shouldn't also the expansion (+ custom cell actions) be vertical aligned top? Would subjectively look better when there's e.g. a single line text displayed next to a multi line cell
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4853/ |
Yep! I didn't call it out as you already had, and it was part of the our discussion last week. |
chandlerprall
left a comment
There was a problem hiding this comment.
- datagrid_example.js needs to include
EuiDataGridRowHeightsOptionsin the Props list:- include
EuiDataGridRowHeightsOptionsin the import on lines 21-35 - pass
EuiDataGridRowHeightsOptionsto the props object on lines 365-382
- include
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4853/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4853/ |
chandlerprall
left a comment
There was a problem hiding this comment.
Taking this out of draft, asking @miukimiu for a review on the SCSS changes
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4853/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4853/ |
elizabetdev
left a comment
There was a problem hiding this comment.
Thanks, @VladLasitsa for helping with this. It looks great! 🎉
I tested in Chrome, Safari, Edge, and Firefox and it works as expected. I just noticed a few things that are not blockers but you can definitely improve the code/examples.
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4853/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4853/ |
chandlerprall
left a comment
There was a problem hiding this comment.
🚀 I pushed a changelog conflict resolution & removed the AtLeastOne utility type from common.ts as it's no longer used. Everything looks good, I'll merge when CI passes.
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4853/ |

Summary
Adds possibility to set default Height for all rows and define initial heights for each row. ALso so that content will be expanded by row height we should provide
rowHeightsOptionsproperty for datagrid.API:
For example here I set default height for each row = 60 and for second row lineCount = 5
Issues which we have:
shouldComponentUpdate(https://github.com/elastic/eui/pull/4853/files#diff-9d40afa057c929171c16c51ab0a6c842bea939f4328129246a2f2e772257c3bbR301-R310)rowMapfor every sort relative to the first position of the elements.