Skip to content

[Docs] Re-organize Data grid docs#5713

Merged
cchaos merged 66 commits intoelastic:mainfrom
cchaos:docs/data_grid
Mar 15, 2022
Merged

[Docs] Re-organize Data grid docs#5713
cchaos merged 66 commits intoelastic:mainfrom
cchaos:docs/data_grid

Conversation

@cchaos
Copy link
Contributor

@cchaos cchaos commented Mar 14, 2022

Don't mind the commit messages, I had started this branch off an old PR

Consolidated props comments & snippets

Under the old structure there was a section called 'Snippet with every feature in use' which contained even more descriptions/comments about use cases either specific to the prop or to the example snippet. I've moved any comments directly related to the prop itself to the data_grid_types.ts file and created an object of snippets.

This way I am now displaying a props "table" of all the high-level props, pulling the props-docs directly from their type and then finding a matching snippet and link out to more docs relevant to that prop.

image

For the snippets, any place that was directly displaying snippets in the example intros has been moved to the snippet tab.

image

New outline

I've shifted the "Tabular content" down a few side nav sections and consolidated the data grid docs into the following outline:

  1. Basic
    • Core concepts
    • Top level props & snippets
    • Sizing
    • Virtualization
  2. Columns & schemas
    • Schemas
    • Column width
    • Column actions
    • Control columns
    • Footer row
  3. Cells & popovers
    • Cell actions
    • Expansion popovers (conditional, custom, disabling)
    • Focus
  4. Toolbar
    • Toolbar visibility
    • Custom controls
    • Props
  5. Style & Display
    • Grid style
    • Row heights
  6. Advanced
    • Refs
    • In-mem 1
    • In-mem 2
    • In-mem 3
    • In-mem 4

Docs utilities

In order to support this PR, I also added a couple docs/props utilies:

  1. Added getPropsFromComponent; And replaced theme docs' getPropsFromThemeValue version
  2. Added getDescription and getDescriptionSmall which returns a MarkdownFormat with bolded #references

Checklist

  • Check against all themes for compatibility in both light and dark modes
  • Checked in mobile
  • Checked in Chrome, Safari, Edge, and Firefox
  • Props have proper autodocs and playground toggles
  • Added documentation
  • Checked Code Sandbox works for any docs examples
  • [ ] Added or updated jest and cypress 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

Constance and others added 30 commits November 10, 2021 14:24
* [Setup] Move toolbar CSS to own file

* [Cleanup] DRY out repeated specific CSS class

- naming was incorrect in the case of the style selector popover

* Reorder toolbar per Caroline's mocks

- Columns & Sort on left, with additionalControls to the right of those (+ update prop types to indicate that)

- Style (TBD naming) and Fullscreen to the right

* Convert display buttons to icons only

+ tweak grid styles icon to match Caroline's mock + popover location

* Convert density UI to a compressed EuiFormRow w/ new text/order per mocks

- refactor densityOptions to const outside hook

* Update test snapshots

* Add changelog entry

* [PR feedback] Revert location of additionalControls + fix props description

* [PR feedback] CSS feedback

* [PR feature request] Change toolbar icon based on grid density

* [PR feedback][extra] Fix missing sort control on styling example

NB: sorting functionality won't actually work/isn't hooked up, but this should at least allow the show/hide UI toggle to work as expected

* updoot snaps

* Fix changelog

* [misc] Reorganize EuiDataGridToolbar utils to bottom of file

- makes it easier for devs to immediately jump to the main component/fn, rather than have to scroll past helper/minutae details

- if it gets complex enough, also worth pulling out to a separate file

* Rename CSS toolbar class to left/right to match API

- Per GH discussion display/data is ambiguous and naming this left/right is likely more helpful

* Add API support for left/right positioning of `additionalControls`

* Update additionalControls documentation + example

* PR feedback & cleanup from Caroline (#4)

* Update some props comments and fix popover’s responsiveness

* [Design] Remove a few extraneous style overrides to control buttons

And lower left padding

* Fixed add/remove of fullscreen body class

* Added tooltips around icon buttons with long delay

* Updated examples and snippets with “real world” examples

Removed all the unnecessary manual additions of `className="euiDataGrid__controlBtn”`

* More responsive fixes

* Change class name

* Update CSS class to be more specific

- It isn't necessary for popovers without drag & drop, name becomes verbose but it's hopefully worth it for clearer usage

* closes elastic#5092 - add changelog for fullscreen bugfix in Caroline's work

* [PR feedback] Changelog

* Update snapshots

* PR feedback

* Remove unused CSS class

- Class was removed in a previous commit by Caroline

Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
- so that both the columnSelector and displaySelector can use it
+ update docs:
  - reorder UI to match toolbar layout
  - fix legends

+ add unit tests (& improve some existing unit tests)
NYI: conditional lineCount controls

+ unit tests
+ fix cell height to dynamically on lineCount change
…efined heights but defined rowHeightsOptions objects

e.g. - empty objs, or lineHeight set but nothing else

+ simplify this.props
…ined mode

- Multiline content includes items with `<br>`/`<p>` tags etc that end up incorrectly vertically centered to their increased height
… + density

- by giving it the same setRowHeight logic as line counts with a single line

+ rename recalculateLineCountHeight for clarity now that it's no longer being used for just lineCount
- to make the difference more obvious when switching between single and custom
- expand buttons on single lines should now be more vertically aligned

- The manual button/checkbox changes for control columns is somewhat required for auto height to not be dramatically different for single lines
… rows

- when hovering over rows
- on striped rows

- Not caused by this PR, but this was really annoying me, haha
- Slightly less grody to look at in-code, and allows us to provide more comments for context

The more I look at __expandButton the more I dislike the naming also but it would involve too many changes right now to rename button->actions, so I added a TODO
+ Remove ability to set negative or zero numbers, which causes the grid to flip out
- This should have been done in 79c878d, but I missed it
…ions are disabled

Notes:
- Strongly recommend turning off whitespace changes to reduce indentation noise
- This could have been done at the `data_grid_toolbar` level and could be a microperf optimization to do so, but since this is a relatively unlikely edge case in any case I don't think it's worth the overoptimization when this approach is relatively straightforward to implement
…tion FROM EuiDataGrid type to reduce duplication
@kibanamachine
Copy link

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

@cee-chen cee-chen mentioned this pull request Mar 14, 2022
4 tasks
Comment on lines -14 to -16
`${root}#/tabular-content/data-grid-styling-and-control`,
`${root}#/tabular-content/data-grid-virtualization`,
`${root}#/tabular-content/data-grid-row-heights-options`,
Copy link
Contributor

Choose a reason for hiding this comment

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

🎉 🎉 Excited to get a11y checking in for all our data grid pages! Thank you for this!

- Use react router Link over EuiLink so that URLs work as expected on staging
- Fix control columns hash
@kibanamachine
Copy link

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

…rops

+ move the exported markdown logic to the new `props/` dir, since they fit there better than `playground/`

+ change our playground flyouts to use bold props instead of linked props, since those can never really work correctly (actual props tabs/tables will still use links)
- if only markdown props are changing, we can reuse getDescription with passed markdown props
@kibanamachine
Copy link

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

Co-authored-by: Constance <constancecchen@users.noreply.github.com>
cchaos and others added 3 commits March 15, 2022 14:52
Co-authored-by: Constance <constancecchen@users.noreply.github.com>
- for whatever reason, passing undefined for some props is causing cell height to be NaN. Using default fallbacks for the base code fixes the issue
@cchaos
Copy link
Contributor Author

cchaos commented Mar 15, 2022

I think all the other comments have been addressed.

@cchaos cchaos requested a review from cee-chen March 15, 2022 19:24
Copy link
Contributor

@cee-chen cee-chen left a comment

Choose a reason for hiding this comment

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

OK, that's all my feedback!! 🎉 This is amazing, thanks so much again for all this wonderfulness!!

@cchaos cchaos enabled auto-merge (squash) March 15, 2022 19:33
@kibanamachine
Copy link

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

@cchaos cchaos merged commit d48c06b into elastic:main Mar 15, 2022
@cchaos cchaos deleted the docs/data_grid branch March 15, 2022 21:06
cee-chen added a commit to cee-chen/eui that referenced this pull request Mar 18, 2022
cee-chen pushed a commit that referenced this pull request Mar 18, 2022
…p not correctly triggering grid rerenders (#5712)

* [REVERT] Test rowHeightsOptions props

* Force a rerender whenever rowHeightsOptions (that affect row heights) change

* Misc cleanup

- move rowHeightUtils.setRerenderGridBody to same location as rowHeightUtils.setGrid

- move inline comment to where fn is being invoked

- update useRowHeightUtils hook comment

* Work around failing data_grid.test.tsx tests

- not totally sure why this requestAnimationFrame is causing issues but not others

* Add changelog entry

* changelog

* Add useRowHeightUtils unit tests

* [misc fix] Handle consumers specifically setting `gridStyle.cellPadding` to undefined

- rather than just omitting it

- see #5713 (comment)

* Revert demo example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data grid documentation Issues or PRs that only affect documentation - will not need changelog entries skip-changelog Use on PRs to skip changelog requirement (Don't delete - used for automation)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants