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

[EuiDataGrid] Feature/euidatagrid menu ux #2392

Merged

Conversation

chandlerprall
Copy link
Contributor

Summary

  • Moved sorting UX into the grid header
  • Exposes schema information to sorting UI
  • Updated sorting tests to reflect changes

sorting ui

@chandlerprall chandlerprall changed the base branch from master to feature/euidatagrid October 1, 2019 18:42
@ryankeairns
Copy link
Contributor

ryankeairns commented Oct 3, 2019

@snide this looks great and is a very powerful sorting feature.

For the design, what do you think about using the compressed button group for the sorting direction (e.g., high-low; low-high)?

Screenshot 2019-10-03 09 55 00

@snide
Copy link
Contributor

snide commented Oct 3, 2019

@ryankeairns I started there originally but they were too big and the borders got heavy when there were a lot of the page. I could mimic the coloring though, or make a "mini" version of the button groups?

@ryankeairns
Copy link
Contributor

@snide the coloring approach would be a good quick test. If that doesn't work, then it may negate the mini group button.

@snide
Copy link
Contributor

snide commented Oct 7, 2019

@ryankeairns Toss up to me. I'll go with whichever you feel works the best.

image

image

@ryankeairns
Copy link
Contributor

@snide Thanks! yes, it's a close call. I would like to go with the gray as it looks less button-y (ie. it otherwise looks like a lot of primary buttons which draw too much eye, imo).

@myasonik
Copy link
Contributor

myasonik commented Oct 8, 2019

Somewhere along the way we lost screen reader support for sorting (if we're sorted on one column, setting aria-sort, if we're sorted on more then one, setting up an aria-describedby with the explanation).

All the code to do so is still there but the headers are never getting updated with their sort information. Probably means this could use an automated test around it.

Also I'm taking a note to migrate both the top and bottom control areas for the grid into proper toolbars but it's not super high urgency and I think it'll be easier to when some of the in-flight work settles.

@chandlerprall
Copy link
Contributor Author

@myasonik good catch! I've pushed a fix and a unit test to cover.

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.

Not sure this is related to any changes in this PR, but I see this when toggling column visibility off and on:

Screen Shot 2019-10-08 at 2 26 13 PM

@snide
Copy link
Contributor

snide commented Oct 8, 2019

Refactored this to use EuiButtonGroup, which solved @ryankeairns' request. Unfortunately this broke the tests, which @chandlerprall is going to look at. I have one more commit planned, just to clean up the sorting component into some sub components. The i18n tokenization + screen reader + schema mapping has made this file hard to read. Gonna see if I can break it up a bit (logic and functionality should remain the same). I had a hard time replicating @thompsongl's error. Was it on one of the examples specifically?

@thompsongl
Copy link
Contributor

@snide First example. Click the 'Hide fields' button, and toggle off and back on the 'name' field. Happens every time for me.

It's the An error has occurred while a drag is occurring. that's odd, because the drag handle never gets touched.

@chandlerprall
Copy link
Contributor Author

I can reproduce the react-beautiful-dnd error message, happens for me when toggling a column back on, I'll check it out.

@chandlerprall
Copy link
Contributor Author

Everything in this PR should now be ready and reviewable.

@chandlerprall chandlerprall changed the title [WIP] [EuiDataGrid] Feature/euidatagrid menu ux [EuiDataGrid] Feature/euidatagrid menu ux Oct 9, 2019
@snide snide requested a review from ryankeairns October 9, 2019 19:11
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.

Nice!

I noticed that sorting on the 'email' column doesn't work. Is that another case of the lexical sort issue?

src/components/datagrid/column_sorting.tsx Outdated Show resolved Hide resolved
src/components/datagrid/column_sorting.tsx Outdated Show resolved Hide resolved
@snide
Copy link
Contributor

snide commented Oct 9, 2019

I noticed that sorting on the 'email' column doesn't work. Is that another case of the lexical sort issue?

Yes. Believe it's because they are coming in as nodes. I'll add it to #2399

@chandlerprall has a follow up PR to address the actual schema sorting mechanisms.

@snide
Copy link
Contributor

snide commented Oct 9, 2019

Feedback addressed.

@chandlerprall chandlerprall mentioned this pull request Oct 9, 2019
10 tasks
@ryankeairns
Copy link
Contributor

ryankeairns commented Oct 9, 2019

@snide this looks great, just a few small considerations.

Regarding the sorting menu:

  • Match up field name fonts sizes: 'Hide fields' uses 14 for field names, 'Sort fields' uses 12
  • Add a little spacing between field name and the sort direction button group
  • Match up the 'remove' and 'handle' icons to be the same size (make remove/cross 16)
  • Consider adding a down arrow icon to the 'Pick fields to sort by' button
  • Would it be better to say 'Clear sorting' instead of 'Clear all'?

@snide
Copy link
Contributor

snide commented Oct 9, 2019

@ryankeairns

Feedback addressed. Only one I couldn't do was adjust the cross/drag handle. The icons themselves are the correct size, it's just the hitzones are a little different. The drag handle one comes as part of that component, and because there's not visual difference I'm ok leaving them as is.

I also went ahead and made sure not to show "clear sorting" if no sorts had been applied yet. GIF below includes all the changes.

@myasonik
Copy link
Contributor

Anyone else think that the mini switches have a near invisible focus state?

Copy link
Contributor

@ryankeairns ryankeairns left a comment

Choose a reason for hiding this comment

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

Thanks for the changes, looks good!

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.

Anyone else think that the mini switches have a near invisible focus state?

Now that you mention it, yeah, it's not very noticeable. I'd be ok with looking into it independent of this PR, though

@snide
Copy link
Contributor

snide commented Oct 10, 2019

Gonna merge this one since I'm building docs off it. Thanks for the review folks.

@snide snide merged commit ac30871 into elastic:feature/euidatagrid Oct 10, 2019
snide pushed a commit to snide/eui that referenced this pull request Oct 10, 2019
Moved the sorting mechanism to the top toolbar.
chandlerprall added a commit that referenced this pull request Oct 24, 2019
* initial datagrid

* protect against re-rendering content on column width change

* Added unit initial tests for EuiDataGrid

* [EuiDataGrid] Base layer Sass (#2171)

* Initial css fixes

* works in IE, addresses feedback

* remove user select

* Adds basic aria roles and grid navigation (#2187)

* Adds basic aria roles and grid navigation

Co-Authored-By: Chandler Prall <[email protected]>

* [Data Grid] Grid style options (#2176)

Adds basic styling to the data grid.

* Add pagination to EuiDataGrid (#2188)

* Added pagination to to EuiDataGrid

* Move EuiDataGrid row rendering to a sub-component to clean up state management

* EuiDataGrid pagination unit tests

* fix data grid pagination

* revert colors

* EuiDataGrid column visibility & ordering (#2207)

* Show/hide and re-order datagrid columns

* Column visability & ordering tests

* column styling

* column sizing and bars

* blergh

* tests

* feedback

* Fix linting

* Adds more complex focus control for DataGrid (#2222)

* [Data Grid] - Styling built into data grid, full screen mode (#2230)

Styling built into data grid, full screen mode

* EuiDataGrid add column sorting (#2278)

* API interface for providing column sort order, callback to allow external data sorting

* EuiDataGrid renders content into memory, sorts on it

* Added tests for EuiDataGrid sorting

* Added aria-sort value to a singly-sorted column header

* small cleanup

* add tests back in, though they are still broken

* Clean up some keyboard navigation issues

* Fix column sorting & update snapshots

* EuiDataGrid hooks cleanup (#2331)

* Refactored EuiDataGrid's hooks

* Fix datagrid to react to gridStyle changes

* [EuiDataGrid] Automatic column schema detection (#2351)

* Automatically detect data schema for in-memory datagrid

* Merge in described schema for field formatting

* Better column type detection

* Tests for euidatagrid schema / column type

* refactor datagrid schema code, add datetime type detection

* some comments

* Allow extra type detectors for EuiDataGrid

* cleanup of docs and type formatting

* Fix datagrid unit test

* Update currency detector

* Allow EuiDataGrid's inMemory prop to be {true}

* Added ability to provide extra props for the containing cell div

* Added test for cell props

* [EuiDataGrid] InMemory Performance (#2374)

* Automatically detect data schema for in-memory datagrid

* Merge in described schema for field formatting

* Better column type detection

* Tests for euidatagrid schema / column type

* refactor datagrid schema code, add datetime type detection

* some comments

* Allow extra type detectors for EuiDataGrid

* cleanup of docs and type formatting

* Fix datagrid unit test

* Update currency detector

* Allow EuiDataGrid's inMemory prop to be {true}

* Added ability to provide extra props for the containing cell div

* Added test for cell props

* Performance cleanups

* Clean up datagrid doc's inMemory selection

* Merged in feature branch

* EuiDataGrid in-memory options

* Performance refactor for in-memory values

* added a comment

* Fix sorting on in-memory and schema datagrid docs

* [EuiDataGrid] Feature/euidatagrid menu ux (#2392)

Moved the sorting mechanism to the top toolbar.

* Export useRenderToText to top-level package (#2412)

* [DATA GRID] Expand cells (#2418)

Data grid cells now can expand and can render individually based upon their schema.

* [EuiDataGrid] use schema information when sorting (#2419)

* cell expansion working mostly

* fix double import

* add search to field selector

* euitext

* cell epansion is now optional through a config

* keydown event for cells

* remove tabbables

* Clean up some code & tests

* Remove unused line of code

* Center popover against cell

* Update euidatagridcell popover placement, trigger, dom structure, and auto focusing

* Restore focus to grid cell when popover was in response to mouse click

* Allow grid column selection to be searchable

* Refactor expansion popover formatting, allow custom ones

* schema-based sort comparators

* reverse boolean sort to be true-false

* adds json schema sorting, fixes issue with popover

* Weaken the currency type detector when values have a period in their first few characters, and fix test

* Move column order and visibility to be managed externally (#2422)

* fix tests

* [EuiDataGrid] Custom column headers (#2421)

* Allow custom ReactNode for column header display

* Allow navigation into grid headers if any are interactive

* Properly wrap cell focus and use [enter], [f2] to interact

* Corrected header cell focus-state on blurring, [escape]. and single interactives

* Corrected header cell focus-state on blurring, [escape]. and single interactives

* When datagrid header is interactive, default its tabstop to the first header cell

* EuiDataGridHeaderCell warns about multiple interactive elements

* fix focus, example and screenreader stuffs, looks like tests pass

* simplifying screen reader read out

* [DATA GRID] EuiGridToolBar toolbar is now configurable through props (#2443)

* EuiGridToolBar toolbar is now configurable through props

* better tests

* small test typp

* Update src/components/datagrid/data_grid_types.ts

Co-Authored-By: Greg Thompson <[email protected]>

* feedback

* [EuiDataGrid] Docs and autodocs (#2449)

* Render out EuiDataGrid proptypes

* Add pagination props to docs

* Fill out all datagrid autodoc sections

* remove debugger statement

* Update src/components/datagrid/data_grid_types.ts

Co-Authored-By: Greg Thompson <[email protected]>

* words

* docs start

* datatype renamed to schema, update docs

* docs, fix typo for fullscreen buton

* core concepts

* better in memory explanation

* custom schema example

* provide a nice, documented snippet

* typos

* don't show pagination when only one page

* clean up styling, better docs for formatters

* more docs cleanup

* IE fix

* IE fix again

* small cleanup of docs

* describe how to disable expansion popovers

* dark mode tweaks

* Fix custom datatype sorting

* Update src-docs/src/views/datagrid/datagrid_example.js

Co-Authored-By: Michail Yasonik <[email protected]>

* Update src-docs/src/views/datagrid/datagrid_example.js

Co-Authored-By: Michail Yasonik <[email protected]>

* Update src-docs/src/views/datagrid/datagrid_example.js

Co-Authored-By: Michail Yasonik <[email protected]>

* Update src-docs/src/views/datagrid/datagrid_example.js

Co-Authored-By: Michail Yasonik <[email protected]>

* Update src-docs/src/views/datagrid/datagrid_example.js

Co-Authored-By: Michail Yasonik <[email protected]>

* Update src-docs/src/views/datagrid/datagrid_example.js

Co-Authored-By: Michail Yasonik <[email protected]>

* Update src-docs/src/views/datagrid/datagrid_example.js

Co-Authored-By: Michail Yasonik <[email protected]>

* Update src-docs/src/views/datagrid/datagrid_example.js

Co-Authored-By: Michail Yasonik <[email protected]>

* PR feedback

* typo

* feedback to break up docs

* better cross linking and summary

* fix custom schema display

* Update src-docs/src/views/datagrid/datagrid_memory_example.js

Co-Authored-By: Greg Thompson <[email protected]>

* Update src-docs/src/views/datagrid/datagrid_memory_example.js

Co-Authored-By: Greg Thompson <[email protected]>

* Update src-docs/src/views/datagrid/datagrid_memory_example.js

Co-Authored-By: Greg Thompson <[email protected]>

* Update src-docs/src/views/datagrid/datagrid_schema_example.js

Co-Authored-By: Greg Thompson <[email protected]>

* Update src-docs/src/views/datagrid/datagrid_memory_example.js

Co-Authored-By: Greg Thompson <[email protected]>

* Update src-docs/src/views/datagrid/datagrid_memory_example.js

Co-Authored-By: Greg Thompson <[email protected]>

* Update src-docs/src/views/datagrid/datagrid_memory_example.js

Co-Authored-By: Greg Thompson <[email protected]>

* Updated some datagrid docs

* main dg example page feedback

* Eui prefix all the things to be consistant. Adjust the data grid docs to match

* rewrite intro based on feedback

* more tweaking of words

* rename toolbarDisplay->toolbarVisibility

* in memory docs reworked to four examples

* clean up core example

* data grid styling snippets

* fix prop list

* Minor grammar edits

* Added isDetails prop to renderCellValue, reducing the use case for expansionFormatters. Speaking of those, expansionFormatter(s) has been renamed to popoverContent(s) and now recieve the rendered cell div in addition to the renderCellValue ReactElement

* fix docs renaming, fix css

* last docs edit seems fitting

* somewhat decent attempt at putting classnames on schemas

* Revert "somewhat decent attempt at putting classnames on schemas"

This reverts commit 26542d7.

* changelog
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.

5 participants