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] Docs and autodocs #2449

Conversation

chandlerprall
Copy link
Contributor

@chandlerprall chandlerprall commented Oct 17, 2019

Summary

Adds docs and props autodocs for EuiDataGrid.

Autodocs changes

  • typescript->proptypes modifications
    • resolve Omit<X, Y> syntax
    • added support for JSXElementConstructor (maps to func instead of elementType for backwards-compatibility)
    • added support for indexed property access e.g. MyType['someKey']
  • made all props sections linkable via #SomeTitle markdown syntax; previously only custom react-docgen sections could be linkable

Small EuiDataGrid changes made during docs creation

  • EuiDataGridColumn renamed dataTypes to schema to better match the mapping / concepts around that term
  • CellValueRenderProps renamed to EuiDataGridCellValueRenderProps to better match the rest of the component
  • toolbarDisplay prop on EuiDataGrid renamed to toolbarVisibility
  • showFullScreenSelector had a typo that was corrected
  • Pagination no longer shows if there is only one page of rows
  • Cleanup up the look and feel of the toolbar so it looks better with all the border options
  • Dark mode cleanup

TODO: Bugs noticed when writing docs

  • Custom schemas break sorting because getDetailsForSchema only checks against the built in schemas.
  • Need an example of how expansionFormatters works
  • How to provide multiple expansionFormatters? Likely should accept an array? Apparently you can pass multiple objects.
  • There is a memory link somewhere in the sorting dropdown. I think it's on the onChange for EuiButtonGroup?

Checklist

  • Checked in dark mode
  • 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

@chandlerprall chandlerprall changed the base branch from master to feature/euidatagrid October 17, 2019 17:51
@snide
Copy link
Contributor

snide commented Oct 18, 2019

Gonna commit to this directly. Mostly just fixing language.

@snide
Copy link
Contributor

snide commented Oct 18, 2019

#SomeTitle markdown syntax; previously only custom react-docgen sections could be linkable

As far as I can tell this doesn't work?

image

@snide
Copy link
Contributor

snide commented Oct 18, 2019

Another weird one I noticed.

image

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.

Nothing like a Friday afternoon AST review 😆 My brain tells me callee is a typo every single time.

Strange, but both of @snide's comments don't apply for me. EuiDataGrid prop table is present and the named links are functional


Update:

Uncaught TypeError: Cannot read property 'scrollIntoView' of null

sometimes occurs when clicking type def links (e.g., DataGridColumnVisibility)

src/components/datagrid/data_grid_types.ts Outdated Show resolved Hide resolved
Co-Authored-By: Greg Thompson <thompsongl@users.noreply.github.com>
@snide
Copy link
Contributor

snide commented Oct 18, 2019

The issues i mentioned before were due to cache. I'm working on a commit now to make the language more clear and provide some better examples.

@snide
Copy link
Contributor

snide commented Oct 18, 2019

Will handle merging in the toolbarDisplay stuff now and writing docs for it.

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.

Adjusted language, added docs and merge up from the feature branch. Outside of the default values not showing in the columns (@chandlerprall is working on it) LGTM.

@snide
Copy link
Contributor

snide commented Oct 18, 2019

jenkins test this

useInnerText › handles updated content failed, but passed locally.

@snide
Copy link
Contributor

snide commented Oct 20, 2019

Hey, I'm pushing the docs rework into this branch even though it will ballon it. It got too hard for me to make changes to the autodocs and the written docs at the same time. I also noticed some typos and small propname inconsistencies that i needed to fix along the way. I'll document those changes within the PR description so they're easier to review.

@snide snide changed the title [EuiDataGrid] typescript/proptypes autodocs [EuiDataGrid] Docs and autodocs Oct 20, 2019
@snide
Copy link
Contributor

snide commented Oct 20, 2019

OK. Outside of the getDetailsForSchema issue mentioned in the description I think I have good docs and examples for everything EuiDataGrid can do now.

chandlerprall and others added 2 commits October 22, 2019 09:44
Co-Authored-By: Greg Thompson <thompsongl@users.noreply.github.com>
Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

I am reading through the docs as someone mostly unfamiliar with the component.

src-docs/src/views/datagrid/datagrid_example.js Outdated Show resolved Hide resolved
src-docs/src/views/datagrid/datagrid_example.js Outdated Show resolved Hide resolved
src-docs/src/views/datagrid/datagrid_example.js Outdated Show resolved Hide resolved
src-docs/src/views/datagrid/datagrid_example.js Outdated Show resolved Hide resolved
src-docs/src/views/datagrid/datagrid_example.js Outdated Show resolved Hide resolved
src-docs/src/views/datagrid/datagrid_styling_example.js Outdated Show resolved Hide resolved
src-docs/src/views/datagrid/datagrid_styling_example.js Outdated Show resolved Hide resolved
src-docs/src/views/datagrid/datagrid_styling_example.js Outdated Show resolved Hide resolved
src-docs/src/views/datagrid/styling.js Show resolved Hide resolved
Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

I am reading through the docs as someone mostly unfamiliar with the component.

@snide
Copy link
Contributor

snide commented Oct 22, 2019

Just FYI I'm gonna resolve stuff as I fix it locally just so I can keep track. They won't render here till I push.

@snide
Copy link
Contributor

snide commented Oct 23, 2019

OK. I got to everything I think. I reworked the in memory page completely and am pretty happy with how all this feels now. @chandlerprall and I have a small todo in the morning to do some renaming around expansionFormatters. We're gonna be a little more direct and call them popoverContents. There's also some small tweaks we noticed we'd need to make there to account for the discover scenario.

🛌 🌤 🏃

@cchaos
Copy link
Contributor

cchaos commented Oct 23, 2019

I just saw some super minor grammar issues and though it easier to just create a PR to fix those instead of commenting each of them. So here's the PR: chandlerprall#13

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

Looks great! Good job!!!

@chandlerprall chandlerprall merged commit 01ae4b9 into elastic:feature/euidatagrid Oct 23, 2019
@chandlerprall chandlerprall deleted the feature/euidatagrid-proptypes branch October 23, 2019 20:31
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 <chandler.prall@gmail.com>

* [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 <thompsongl@users.noreply.github.com>

* 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 <thompsongl@users.noreply.github.com>

* 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 <michail@yasonik.com>

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

Co-Authored-By: Michail Yasonik <michail@yasonik.com>

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

Co-Authored-By: Michail Yasonik <michail@yasonik.com>

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

Co-Authored-By: Michail Yasonik <michail@yasonik.com>

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

Co-Authored-By: Michail Yasonik <michail@yasonik.com>

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

Co-Authored-By: Michail Yasonik <michail@yasonik.com>

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

Co-Authored-By: Michail Yasonik <michail@yasonik.com>

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

Co-Authored-By: Michail Yasonik <michail@yasonik.com>

* 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 <thompsongl@users.noreply.github.com>

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

Co-Authored-By: Greg Thompson <thompsongl@users.noreply.github.com>

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

Co-Authored-By: Greg Thompson <thompsongl@users.noreply.github.com>

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

Co-Authored-By: Greg Thompson <thompsongl@users.noreply.github.com>

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

Co-Authored-By: Greg Thompson <thompsongl@users.noreply.github.com>

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

Co-Authored-By: Greg Thompson <thompsongl@users.noreply.github.com>

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

Co-Authored-By: Greg Thompson <thompsongl@users.noreply.github.com>

* 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants