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

Allow DataGrid's columns popover to optionally not allow hiding and/or reordering #2993

Conversation

chandlerprall
Copy link
Contributor

@chandlerprall chandlerprall commented Mar 5, 2020

Summary

Fixes #2622

example popover

  • changed text of the column popover button from "Hide fields" / "fields hidden" to "Columns" / "columns hidden". Completely open to further changes. Also, the icon doesn't make sense now @snide
  • extended toolbarVisibility.showColumnSelector to allow objects as well. I think this nicely and naturally extends the existing design of the toolbarVisibility value, where false values disable, undefined/true values enable, and an object customizes further
  • created allowHide and allowReorder values on toolbarVisibility.showColumnSelector; this breaks with the existing show* pattern for naming. Do we care?

@snide would you mind doing a design pass?

Checklist

- [ ] Check against all themes for compatibility in both light and dark modes
- [ ] Checked in mobile
- [ ] Checked in IE11 and Firefox

  • Props have proper autodocs
  • Added documentation examples
  • Added or updated jest tests
  • Checked for breaking changes and labeled appropriately
  • Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_2993/

@myasonik
Copy link
Contributor

myasonik commented Mar 9, 2020

Maybe we need a few states for this? What are y'all's thoughts on:

  1. Only sort

    • Icon: a horizontal version of the sort icon
    • Text: "Sort columns" / "𝑛 columns sorted"
  2. Only visibility controls

    • Icon: closed eye (what we have today)
    • Alternate icon proposal: could also abuse the kqlOperand or merge icons to serve this purpose
    • Text: "Hide fields" / "𝑛 fields hidden" (what we have today)
    • Alternate text proposal: use "columns" instead of "fields" to keep this button always saying "columns"
  3. Both options available

    • Icon: controls (horizontal or vertical)
    • Text: "Configure columns" (no "configured" text)
    • Tooltip option: Could show a tooltip on the button with "𝑛 columns sorted" and/or "𝑛 fields hidden" as needed

@myasonik
Copy link
Contributor

myasonik commented Mar 9, 2020

created allowHide and allowReorder values on toolbarVisibility.showColumnSelector; this breaks with the existing show* pattern for naming. Do we care?

I think it's fine. If we decide we do care, I'd propose actually changing all the existing show* props to be allow* props. Just glancing through the docs, it seems like it would work for all of them.

@snide snide added the priority label Mar 10, 2020
@thompsongl
Copy link
Contributor

I'm going to wait for @snide to do his design pass before reviewing. Especially given @myasonik's ideas, which could change the code a bit if implemented.

@snide
Copy link
Contributor

snide commented Mar 10, 2020

Pushed some design changes. Fixed the various states and icons.

Whether or not you can or can not hide columns, we want to keep this button fairly singular in focus. So I kept the "columns" naming and changed the icon to something that works a little more generically. I also fixed the pluralization. Doing a quick docs change, but this should be safe for review now.

I also fixed the styling changes when the label is not used.

@snide
Copy link
Contributor

snide commented Mar 10, 2020

Screens for the lazy

image

image

image

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_2993/

className={controlBtnClasses}
data-test-subj="dataGridColumnSelectorButton"
onClick={() => setIsOpen(!isOpen)}>
{numberOfHiddenFields > 0 ? numberOfHiddenFields : null} {buttonText}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure how EUI's i18n system works (or, how it integrates with Kibana) but should we pass the value into the translation string?

Different languages might put the number in a different position or might add a certain count word somewhere in the string as well so we usually want to keep the number and the phrase together.

@snide
Copy link
Contributor

snide commented Mar 10, 2020

The docs are now updated. I moved the demo for this into the toolbar section, which is where I think it belongs. I have a nested state toggle in the popover.

Copy link
Contributor

@snide snide left a comment

Choose a reason for hiding this comment

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

As far as docs, design and functionality go. This is mergible.

Copy link
Contributor

@thompsongl thompsongl left a comment

Choose a reason for hiding this comment

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

should we pass the value into the translation string?

We've been inconsistent at best on this, but it makes sense.

Otherwise, code LGTM 👍

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_2993/

@chandlerprall
Copy link
Contributor Author

Added another nested toggle to the docs for allowing/disabling column reordering, next to the one Dave added for column show/hide capability.

Updated the I18n stuff to place the # of columns hidden value programatically.

Copy link
Contributor

@snide snide left a comment

Choose a reason for hiding this comment

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

Checked locally. Thanks for the i18n fixes.

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_2993/

Copy link
Contributor

@thompsongl thompsongl left a comment

Choose a reason for hiding this comment

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

Latest commit changes look good 👍

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_2993/

@chandlerprall chandlerprall merged commit 9ce5f85 into elastic:master Mar 12, 2020
@chandlerprall chandlerprall deleted the feature/2622-datagrid-toolbar-popovers branch March 12, 2020 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DataGrid should allow reordering columns without hiding
5 participants