-
Notifications
You must be signed in to change notification settings - Fork 859
[Docs] Re-organize Data grid docs #5713
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
Merged
Merged
Changes from all commits
Commits
Show all changes
66 commits
Select commit
Hold shift + click to select a range
7ca1bc8
[EuiDataGrid] Toolbar UI layout reorganization (#5334)
constancecchen 4a73ad3
Merge branch 'main' into feat/datagrid/toolbar-reorg-and-row-height-s…
cee-chen 916c1c7
Rename styleSelector to displaySelector + update types & docs
cee-chen 79c878d
Refactor out nested object helper
cee-chen 58fe94f
Update displaySelector with conditional density/row height options
cee-chen 37aecd6
Add rowHeightsOptions controls to popover
cee-chen 129b2bb
Add conditional lineCount row and logic
cee-chen 742051d
Fix styles not applying correctly for rowHeightsOptions that have und…
cee-chen be59b08
Fix multiline content not top-aligning correctly when in single/undef…
cee-chen 75e933a
Fix single/undefined row heights to account for passed lineHeight API…
cee-chen 39aa176
Add changelog entry
cee-chen 8580dc8
[PR feedback] Increase default lineCount to 2
cee-chen 513e7c9
Merge branch 'main' into feat/datagrid/toolbar-reorg-and-row-height-s…
cee-chen 0a4eae8
Merge branch 'feat/datagrid/toolbar-reorg-and-row-height-switcher' in…
cee-chen 7e34537
Fix changelog
cee-chen d31a66d
Fix control column appearance by switching them back to vertical cent…
cee-chen 670dc2c
Tweak various height alignments on compressed grid settings
cee-chen c3f237d
Fix expand action button background color mismatch for auto/lineCount…
cee-chen 4dac79e
PR feedback: convert cell actions CSS selectors to mixin
cee-chen cb51f97
Fix sasslint issues
cee-chen b70aa3d
PR feedback: Change line count number to EuiRange
cee-chen 52d70e3
PR feedback - remove height tweaks for compressed auto fit
cee-chen 3891366
[PR feedback] Remove `showStyleSelector`
cee-chen 2d88256
Breaking apart styling grid vs toggles
cab4a06
Remove unused unit tests
cee-chen 571be25
[PR feedback] Intelligently disable toolbar control if all nested opt…
cee-chen b19d0a6
Merge branch 'main' into feat/datagrid/toolbar-reorg-and-row-height-s…
cee-chen 9348b1d
Merge branch 'feat/datagrid/toolbar-reorg-and-row-height-switcher' in…
cee-chen 73abcef
[IA] Re-organizing and re-arranging files/folders/sections/nav
dcaf013
Consolidated the general props with snippets and pulling prop descrip…
4cea03e
Renamed `getPropsFromThemeKey` to `getPropsFromComponent` and moved t…
abcfd4a
Moved `getDescription` and `getDescriptionSmall` to `docs/services` a…
5e48abc
Final cleanup of general props table
ebbfaf4
Merge branch 'datagrid-row-height-control' into docs/datagrid
3bf6514
Fix `getDescription` from overriding props table markdown plugin list
f4d77d4
Updating Toolbar page with props table and simplified example
a4272a4
Fixed up Data / Schema page
352ca86
Fixed up Styling page except for row heights
31cb490
Reusable props table
292cc85
Merge remote-tracking branch 2_upstream/main into docs/datagrid
f711375
More fixes from rebase
0e045eb
More fixes from rebase
56508f9
New "advanced" page and moving in-memory
1185ebc
Fixing up “style & display”
f59846e
Fixing up “columns & cells”
d1ac3ed
Fixing up “toolbar”
5b14a0e
Fixing up “data”
0c860d8
Fixing up ‘basics’
966fe5d
Fixing links
f440a90
Cleaned up top level props table
31e207f
Moved all snippets to snippets tab
347b19d
Cleaned up Toolbar section
92c992c
Cleanup style
52001c5
Cleanup schema/data
7c8df31
Unique aria-labels for grids
e79d02c
New IA
f00dd25
Fixing new urls and a11y
8b6987b
Remove `useMemo` for `gridStyle`
b9bdd6f
Fix various links
cee-chen 921c649
DRY out props markdown processor that outputs either linked or bold p…
cee-chen 6121a15
DRY out getDescriptionSmall
cee-chen 25124e1
Apply suggestions from code review
cchaos bd9a47e
Add `ref` back in
cchaos 9e13c5a
Change to EuiLink
d950043
Fix grid style CodeSandbox
cee-chen a4e447d
Add more `ref` documentation to main page
cee-chen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import React from 'react'; | ||
| import { EuiMarkdownFormat, EuiMarkdownFormatProps } from '../../../../src'; | ||
|
|
||
| import { | ||
| parsingPluginList, | ||
| processingPluginListWithBoldProps, | ||
| // @ts-ignore Importing from JS | ||
| } from './markdown_format'; | ||
|
|
||
| export function getDescriptionSmall( | ||
| type: any, | ||
| markdownProps?: Partial<EuiMarkdownFormatProps> | ||
| ) { | ||
| return getDescription(type, { | ||
| textSize: 'xs', | ||
| color: 'subdued', | ||
| ...markdownProps, | ||
| }); | ||
| } | ||
|
|
||
| export function getDescription( | ||
| type: any, | ||
| markdownProps?: Partial<EuiMarkdownFormatProps> | ||
| ) { | ||
| if (type?.description) { | ||
| return ( | ||
| <EuiMarkdownFormat | ||
| textSize="s" | ||
| parsingPluginList={parsingPluginList} | ||
| processingPluginList={processingPluginListWithBoldProps} | ||
| {...markdownProps} | ||
| > | ||
| {type.description} | ||
| </EuiMarkdownFormat> | ||
| ); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import { useView } from 'react-view'; | ||
|
|
||
| // @ts-ignore NOT TS | ||
| import { propUtilityForPlayground } from '../../services/playground'; | ||
|
|
||
| export function getPropsFromComponent(component: any) { | ||
| const docgenInfo = Array.isArray(component.__docgenInfo) | ||
| ? component.__docgenInfo[0] | ||
| : component.__docgenInfo; | ||
| const { props } = docgenInfo; | ||
| // eslint-disable-next-line react-hooks/rules-of-hooks | ||
| const params = useView({ props: propUtilityForPlayground(props) }); | ||
| return params.knobProps.state; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| export { | ||
| parsingPluginList, | ||
| processingPluginListWithLinkedProps, | ||
| processingPluginListWithBoldProps, | ||
| } from './plugin_list'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| import React, { FunctionComponent, ReactNode } from 'react'; | ||
| import { Link } from 'react-router-dom'; | ||
| import { | ||
| EuiCodeBlock, | ||
| EuiBasicTable, | ||
| EuiBasicTableProps, | ||
| EuiSpacer, | ||
| } from '../../../../src/components'; | ||
|
|
||
| import { getPropsFromComponent } from '../../services/props/get_props'; | ||
| import { getDescription } from '../../services/props/get_description'; | ||
|
|
||
| export interface BasicItem { | ||
| id: string; | ||
| prop: string; | ||
| type?: any; | ||
| sample?: any; | ||
| link?: any; | ||
| } | ||
|
|
||
| export const DataGridPropsTable: FunctionComponent<{ | ||
| component: any; | ||
| exclude?: string[]; | ||
| snippets: any; | ||
| links?: any; | ||
| }> = ({ component, exclude, snippets, links }) => { | ||
| const gridProps = getPropsFromComponent(component); | ||
| const gridPropsKeys = Object.keys(gridProps) | ||
| .filter((i) => !exclude?.includes(i)) | ||
| .sort(); | ||
|
|
||
| const items: BasicItem[] = gridPropsKeys.map((prop) => { | ||
| return { | ||
| id: prop, | ||
| prop: prop, | ||
| type: gridProps[prop], | ||
| sample: snippets[prop], | ||
| link: links && links[prop], | ||
| }; | ||
| }); | ||
|
|
||
| const renderPropDescription = (item: BasicItem) => { | ||
| const description = getDescription(item.type || item, { color: 'subdued' }); | ||
|
|
||
| if (description) { | ||
| return ( | ||
| <> | ||
| <EuiSpacer size="s" /> | ||
| {description} | ||
| </> | ||
| ); | ||
| } | ||
| }; | ||
|
|
||
| const renderProp = (item: BasicItem) => { | ||
| if (item.link) { | ||
| return ( | ||
| <Link to={item.link}> | ||
| <strong>{item.prop}</strong> | ||
| </Link> | ||
| ); | ||
| } else { | ||
| return <strong>{item.prop}</strong>; | ||
| } | ||
| }; | ||
|
|
||
| const renderSample = (sample: BasicItem['sample']) => { | ||
| if (sample) { | ||
| return ( | ||
| <div style={{ flexGrow: 1 }}> | ||
| <EuiSpacer /> | ||
| {typeof sample === 'string' ? ( | ||
| <EuiCodeBlock paddingSize="s" language="js" isCopyable> | ||
| {sample} | ||
| </EuiCodeBlock> | ||
| ) : ( | ||
| sample | ||
| )} | ||
| </div> | ||
| ); | ||
| } | ||
| }; | ||
|
|
||
| const columns: EuiBasicTableProps<BasicItem>['columns'] = [ | ||
| { | ||
| field: 'prop', | ||
| name: 'Prop', | ||
| valign: 'top', | ||
| textOnly: false, | ||
| render: (prop: ReactNode, item) => ( | ||
| <div> | ||
| {renderProp(item)} | ||
| {renderPropDescription(item)} | ||
| </div> | ||
| ), | ||
| mobileOptions: { | ||
| header: false, // Won't show inline header in mobile view | ||
| width: '100%', // Applies a specific width | ||
| }, | ||
| }, | ||
| { | ||
| field: 'sample', | ||
| name: 'Sample snippet', | ||
| align: 'left', | ||
| valign: 'top', | ||
| render: (sample: ReactNode) => renderSample(sample), | ||
| mobileOptions: { | ||
| header: false, // Won't show inline header in mobile view | ||
| width: '100%', // Applies a specific width | ||
| }, | ||
| }, | ||
| ]; | ||
|
|
||
| return <EuiBasicTable items={items} columns={columns} />; | ||
| }; |
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🎉 🎉 Excited to get a11y checking in for all our data grid pages! Thank you for this!