-
Notifications
You must be signed in to change notification settings - Fork 840
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
[EuiDataGrid] Display selector / toolbar control enhancements #8080
Conversation
…n subcomponents - we'll need this in order to pass it back a render prop version of this popover - also feels much cleaner code wise! and lets us not render some extra state if controls have been configured to be off
+ remove unnecessary flex item wrapper + reorder buttonLabel to be closer to displaySelector
- not flagging it in the main docs as it doesn't seem important enough, let me know if you disagree - it is in the snippets and props examples however + fix bad indentation and syntax on some existing snippets
…have been made - requires updating how reset button behaves, and storing initial display settings in refs on mount + reorder/organize code with comment blocks / by concern - modify deep equal to potentially not cost as much / re-run isEqual as often if the object *is* correctly memoized
- works when run alone, not entirely sure what's going on here
...erence/chrome_mobile_Tabular_Content_EuiDataGrid_toolbarVisibility_prop_Display_Selector.png
Outdated
Show resolved
Hide resolved
packages/eui/src/components/datagrid/controls/display_selector.tsx
Outdated
Show resolved
Hide resolved
- indentation nit - fix object equality issue when rowHeightsOptions is initialized with `{ lineCount }`
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.
🚢 🐈⬛ Those are awesome improvements! The fixes/updates work as expected and the code looks good to me. 👍
I left two small recommendations but they're not blocking.
@@ -67,8 +70,68 @@ const convertGridStylesToSelection = (gridStyles: EuiDataGridStyle) => { | |||
return 'expanded'; | |||
return ''; | |||
}; | |||
const DensityControl = ({ |
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.
Considering this file is quite large and since we're creating standalone parts now anyway maybe we could move those sub components to their own files? 🤔
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.
This is definitely subjective / more of an art than a science, but to me in its current state the file would be more annoying to have it broken up than in one (slightly larger) file since I'd have to be referring back and forth to separate files to see how it all works together, particularly with the reset button.
My 2c is that it's not egregious right now since it's still below ~500 lines (especially considering comments etc) and concerns one major UI element (the display settings popover and its contents).
packages/eui/src/components/datagrid/controls/display_selector.tsx
Outdated
Show resolved
Hide resolved
Preview staging links for this PR:
|
💚 Build Succeeded
History
|
`v97.2.0`⏩`v97.3.0` _[Questions? Please see our Kibana upgrade FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)_ --- ## [`v97.3.0`](https://github.com/elastic/eui/releases/v97.3.0) - `EuiDataGrid` now supports a new `toolbarVisibility.showDisplaySelector.customRender` function that allows completely customizing the rendering of the display selector popover ([#8080](elastic/eui#8080)) - `EuiDataGrid`'s row height/lines per row setting has been streamlined in both UI and UX ([#8080](elastic/eui#8080)) - `EuiDataGrid` now accepts consumer-passed display setting updates even after users have changed their display preferences via UI ([#8080](elastic/eui#8080)) - Updated `EuiDataGrid` to vertically center all `toolbarVisibility.additionalControls` nodes ([#8085](elastic/eui#8085)) - Updated `EuiDataGrid` with a beta `rowHeightsOptions.autoBelowLineCount` feature flag ([#8096](elastic/eui#8096)) - Updated `EuiContextMenuPanel` to allow disabling initial focus via `initialFocusedItemIndex={-1}` ([#8101](elastic/eui#8101)) **Bug fixes** - Fixed `EuiComment`'s typing to correctly reflect all accepted props ([#8089](elastic/eui#8089)) - Fixed `EuiSelectableTemplateSitewide`s within dark-themed `EuiHeader`s missing input borders ([#8100](elastic/eui#8100))
`v97.2.0`⏩`v97.3.0` _[Questions? Please see our Kibana upgrade FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)_ --- ## [`v97.3.0`](https://github.com/elastic/eui/releases/v97.3.0) - `EuiDataGrid` now supports a new `toolbarVisibility.showDisplaySelector.customRender` function that allows completely customizing the rendering of the display selector popover ([elastic#8080](elastic/eui#8080)) - `EuiDataGrid`'s row height/lines per row setting has been streamlined in both UI and UX ([elastic#8080](elastic/eui#8080)) - `EuiDataGrid` now accepts consumer-passed display setting updates even after users have changed their display preferences via UI ([elastic#8080](elastic/eui#8080)) - Updated `EuiDataGrid` to vertically center all `toolbarVisibility.additionalControls` nodes ([elastic#8085](elastic/eui#8085)) - Updated `EuiDataGrid` with a beta `rowHeightsOptions.autoBelowLineCount` feature flag ([elastic#8096](elastic/eui#8096)) - Updated `EuiContextMenuPanel` to allow disabling initial focus via `initialFocusedItemIndex={-1}` ([elastic#8101](elastic/eui#8101)) **Bug fixes** - Fixed `EuiComment`'s typing to correctly reflect all accepted props ([elastic#8089](elastic/eui#8089)) - Fixed `EuiSelectableTemplateSitewide`s within dark-themed `EuiHeader`s missing input borders ([elastic#8100](elastic/eui#8100)) (cherry picked from commit 4e7d43a)
Summary
This PR adds 3 separate enhancements (listed with screenshots below). As always, I strongly recommend following along by commit, as I tried to split out several code refactors out to make following the actual new features easier.
Redesigned row height form controls (493e2e0)
Per @MichaelMarcialis's designs in #7835 (comment) (although these changes do not close the issue,
lineCount
Completely custom control over rendering the display selector (92bc73e, 81b5e25) (closes #7951)
Consumers can now pass a
toolbarVisibility.showDisplaySelector.customRender
render prop/function that passes back the default density/row height/reset button as optional nodes to render. This allows consumers to reorder and otherwise completely customize the display selector.gridStyle
updates after users have changed grid styles via the display selector (9cf4a4d) (closes #7962)Previously, EuiDataGrid would always defer to the user's row height/density selection from the display selector controls, and if consumers tried to pass in new
gridStyle
updates after, or control them from an external button, those updates would be ignored.You can reproduce this on production by changing the density in the toolbar display selector and then trying to change
fontSize
orcellPadding
in the Storybook controls - nothing happens at that point.This PR changes this behavior so that new
gridStyle
updates are reflected in the datagrid (see QA steps below).QA
gridStyles
updates should be testable on Storybook:Expanded
fontSize
tos
and confirm that the datagrid correctly updates to this settingGeneral checklist
- [ ] Checked in both light and dark modes- [ ] Checked in mobile- [ ] Added documentation@default
if default values are missing) and playground toggles- [ ] Checked Code Sandbox works for any docs examplesand cypress tests- [ ] If applicable, added the breaking change issue label (and filled out the breaking change checklist)