Skip to content
Merged
Show file tree
Hide file tree
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 Nov 10, 2021
4a73ad3
Merge branch 'main' into feat/datagrid/toolbar-reorg-and-row-height-s…
cee-chen Nov 10, 2021
916c1c7
Rename styleSelector to displaySelector + update types & docs
cee-chen Nov 9, 2021
79c878d
Refactor out nested object helper
cee-chen Nov 9, 2021
58fe94f
Update displaySelector with conditional density/row height options
cee-chen Nov 9, 2021
37aecd6
Add rowHeightsOptions controls to popover
cee-chen Nov 10, 2021
129b2bb
Add conditional lineCount row and logic
cee-chen Nov 10, 2021
742051d
Fix styles not applying correctly for rowHeightsOptions that have und…
cee-chen Nov 11, 2021
be59b08
Fix multiline content not top-aligning correctly when in single/undef…
cee-chen Nov 10, 2021
75e933a
Fix single/undefined row heights to account for passed lineHeight API…
cee-chen Nov 11, 2021
39aa176
Add changelog entry
cee-chen Nov 11, 2021
8580dc8
[PR feedback] Increase default lineCount to 2
cee-chen Nov 16, 2021
513e7c9
Merge branch 'main' into feat/datagrid/toolbar-reorg-and-row-height-s…
cee-chen Nov 17, 2021
0a4eae8
Merge branch 'feat/datagrid/toolbar-reorg-and-row-height-switcher' in…
cee-chen Nov 17, 2021
7e34537
Fix changelog
cee-chen Nov 17, 2021
d31a66d
Fix control column appearance by switching them back to vertical cent…
cee-chen Nov 17, 2021
670dc2c
Tweak various height alignments on compressed grid settings
cee-chen Nov 17, 2021
c3f237d
Fix expand action button background color mismatch for auto/lineCount…
cee-chen Nov 17, 2021
4dac79e
PR feedback: convert cell actions CSS selectors to mixin
cee-chen Nov 18, 2021
cb51f97
Fix sasslint issues
cee-chen Nov 18, 2021
b70aa3d
PR feedback: Change line count number to EuiRange
cee-chen Nov 18, 2021
52d70e3
PR feedback - remove height tweaks for compressed auto fit
cee-chen Nov 18, 2021
3891366
[PR feedback] Remove `showStyleSelector`
cee-chen Nov 18, 2021
2d88256
Breaking apart styling grid vs toggles
Nov 18, 2021
cab4a06
Remove unused unit tests
cee-chen Nov 18, 2021
571be25
[PR feedback] Intelligently disable toolbar control if all nested opt…
cee-chen Nov 18, 2021
b19d0a6
Merge branch 'main' into feat/datagrid/toolbar-reorg-and-row-height-s…
cee-chen Nov 19, 2021
9348b1d
Merge branch 'feat/datagrid/toolbar-reorg-and-row-height-switcher' in…
cee-chen Nov 19, 2021
73abcef
[IA] Re-organizing and re-arranging files/folders/sections/nav
Nov 18, 2021
dcaf013
Consolidated the general props with snippets and pulling prop descrip…
Nov 20, 2021
4cea03e
Renamed `getPropsFromThemeKey` to `getPropsFromComponent` and moved t…
Nov 20, 2021
abcfd4a
Moved `getDescription` and `getDescriptionSmall` to `docs/services` a…
Nov 20, 2021
5e48abc
Final cleanup of general props table
Nov 20, 2021
ebbfaf4
Merge branch 'datagrid-row-height-control' into docs/datagrid
Nov 20, 2021
3bf6514
Fix `getDescription` from overriding props table markdown plugin list
Nov 21, 2021
f4d77d4
Updating Toolbar page with props table and simplified example
Nov 21, 2021
a4272a4
Fixed up Data / Schema page
Nov 21, 2021
352ca86
Fixed up Styling page except for row heights
Nov 21, 2021
31cb490
Reusable props table
Nov 22, 2021
292cc85
Merge remote-tracking branch 2_upstream/main into docs/datagrid
Mar 11, 2022
f711375
More fixes from rebase
Mar 11, 2022
0e045eb
More fixes from rebase
Mar 12, 2022
56508f9
New "advanced" page and moving in-memory
Mar 12, 2022
1185ebc
Fixing up “style & display”
Mar 12, 2022
f59846e
Fixing up “columns & cells”
Mar 12, 2022
d1ac3ed
Fixing up “toolbar”
Mar 12, 2022
5b14a0e
Fixing up “data”
Mar 12, 2022
0c860d8
Fixing up ‘basics’
Mar 12, 2022
966fe5d
Fixing links
Mar 13, 2022
f440a90
Cleaned up top level props table
Mar 13, 2022
31e207f
Moved all snippets to snippets tab
Mar 13, 2022
347b19d
Cleaned up Toolbar section
Mar 14, 2022
92c992c
Cleanup style
Mar 14, 2022
52001c5
Cleanup schema/data
Mar 14, 2022
7c8df31
Unique aria-labels for grids
Mar 14, 2022
e79d02c
New IA
Mar 14, 2022
f00dd25
Fixing new urls and a11y
Mar 14, 2022
8b6987b
Remove `useMemo` for `gridStyle`
Mar 14, 2022
b9bdd6f
Fix various links
cee-chen Mar 15, 2022
921c649
DRY out props markdown processor that outputs either linked or bold p…
cee-chen Mar 15, 2022
6121a15
DRY out getDescriptionSmall
cee-chen Mar 15, 2022
25124e1
Apply suggestions from code review
cchaos Mar 15, 2022
bd9a47e
Add `ref` back in
cchaos Mar 15, 2022
9e13c5a
Change to EuiLink
Mar 15, 2022
d950043
Fix grid style CodeSandbox
cee-chen Mar 15, 2022
a4e447d
Add more `ref` documentation to main page
cee-chen Mar 15, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions scripts/a11y-testing.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ const docsPages = async (root, page) => {
`${root}#/forms/color-selection`,
`${root}#/forms/date-picker`,
`${root}#/forms/super-date-picker`,
`${root}#/tabular-content/data-grid-styling-and-control`,
`${root}#/tabular-content/data-grid-virtualization`,
`${root}#/tabular-content/data-grid-row-heights-options`,
Comment on lines -14 to -16
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!

];

return [
Expand Down
48 changes: 19 additions & 29 deletions src-docs/src/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,12 @@ import { ControlBarExample } from './views/control_bar/control_bar_example';

import { CopyExample } from './views/copy/copy_example';

import { DataGridExample } from './views/datagrid/datagrid_example';
import { DataGridMemoryExample } from './views/datagrid/datagrid_memory_example';
import { DataGridSchemaExample } from './views/datagrid/datagrid_schema_example';
import { DataGridCellPopoverExample } from './views/datagrid/datagrid_cell_popover_example';
import { DataGridFocusExample } from './views/datagrid/datagrid_focus_example';
import { DataGridStylingExample } from './views/datagrid/datagrid_styling_example';
import { DataGridControlColumnsExample } from './views/datagrid/datagrid_controlcolumns_example';
import { DataGridFooterRowExample } from './views/datagrid/datagrid_footer_row_example';
import { DataGridVirtualizationExample } from './views/datagrid/datagrid_virtualization_example';
import { DataGridRowHeightOptionsExample } from './views/datagrid/datagrid_height_options_example';
import { DataGridRefExample } from './views/datagrid/datagrid_ref_example';
import { DataGridExample } from './views/datagrid/basics/datagrid_example';
import { DataGridCellsExample } from './views/datagrid/cells_popovers/datagrid_cells_example';
import { DataGridToolbarExample } from './views/datagrid/toolbar/datagrid_toolbar_example';
import { DataGridColumnsExample } from './views/datagrid/schema_columns/datagrid_columns_example';
import { DataGridStylingExample } from './views/datagrid/styling/datagrid_styling_example';
import { DataGridAdvancedExample } from './views/datagrid/advanced/datagrid_advanced_example';

import { DatePickerExample } from './views/date_picker/date_picker_example';

Expand Down Expand Up @@ -480,24 +475,6 @@ const navigation = [
TreeViewExample,
].map((example) => createExample(example)),
},
{
name: 'Tabular content',
items: [
DataGridExample,
DataGridMemoryExample,
DataGridSchemaExample,
DataGridCellPopoverExample,
DataGridFocusExample,
DataGridStylingExample,
DataGridControlColumnsExample,
DataGridFooterRowExample,
DataGridVirtualizationExample,
DataGridRowHeightOptionsExample,
DataGridRefExample,
TableExample,
TableInMemoryExample,
].map((example) => createExample(example)),
},
{
name: 'Display',
items: [
Expand Down Expand Up @@ -547,6 +524,19 @@ const navigation = [
SuperSelectExample,
].map((example) => createExample(example)),
},
{
name: 'Tabular content',
items: [
DataGridExample,
DataGridColumnsExample,
DataGridCellsExample,
DataGridToolbarExample,
DataGridStylingExample,
DataGridAdvancedExample,
TableExample,
TableInMemoryExample,
].map((example) => createExample(example)),
},
{
name: 'Editors & syntax',
items: [
Expand Down
2 changes: 2 additions & 0 deletions src-docs/src/services/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export {
listExtraDeps,
} from './string/clean_imports';

export { getPropsFromComponent } from './props/get_props';

export { registerTheme, applyTheme } from './theme/theme';

export { ExampleContext, useExitPath } from './routing/routing';
16 changes: 12 additions & 4 deletions src-docs/src/services/playground/knobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,23 @@ import {
EuiPanel,
EuiMarkdownFormat,
} from '../../../../src/components/';
import { parsingPluginList, processingPluginList } from './markdown_format';
import {
parsingPluginList,
processingPluginListWithLinkedProps,
processingPluginListWithBoldProps,
} from '../props/markdown_format';

export const markup = (text) => {
export const markup = (text, isPlayground) => {
return (
<EuiMarkdownFormat
textSize="xs"
color="subdued"
parsingPluginList={parsingPluginList}
processingPluginList={processingPluginList}
processingPluginList={
isPlayground
? processingPluginListWithBoldProps
: processingPluginListWithLinkedProps
}
>
{text}
</EuiMarkdownFormat>
Expand Down Expand Up @@ -449,7 +457,7 @@ const KnobColumn = ({ state, knobNames, error, set, isPlayground }) => {
<>
<EuiSpacer size="xs" />

{markup(state[name].description)}
{markup(state[name].description, isPlayground)}
</>
)}
</div>
Expand Down

This file was deleted.

37 changes: 37 additions & 0 deletions src-docs/src/services/props/get_description.tsx
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>
);
}
}
14 changes: 14 additions & 0 deletions src-docs/src/services/props/get_props.tsx
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;
}
5 changes: 5 additions & 0 deletions src-docs/src/services/props/markdown_format/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export {
parsingPluginList,
processingPluginListWithLinkedProps,
processingPluginListWithBoldProps,
} from './plugin_list';
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { getDefaultEuiMarkdownProcessingPlugins } from '../../../../../src/compo

import {
PropsLinkMarkdownParser,
PropsLinkMarkdownRenderer,
PropsLinkRenderer,
PropsBoldRenderer,
} from './props_link_plugin';

export const parsingPluginList = [
Expand All @@ -15,5 +16,8 @@ export const parsingPluginList = [
[PropsLinkMarkdownParser, {}],
];

export const processingPluginList = getDefaultEuiMarkdownProcessingPlugins();
processingPluginList[1][1].components.propsLinkPlugin = PropsLinkMarkdownRenderer;
export const processingPluginListWithLinkedProps = getDefaultEuiMarkdownProcessingPlugins();
processingPluginListWithLinkedProps[1][1].components.propsLinkPlugin = PropsLinkRenderer;

export const processingPluginListWithBoldProps = getDefaultEuiMarkdownProcessingPlugins();
processingPluginListWithBoldProps[1][1].components.propsLinkPlugin = PropsBoldRenderer;
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,15 @@ export function PropsLinkMarkdownParser() {
methods.splice(methods.indexOf('text'), 0, 'propsLink');
}

export const PropsLinkMarkdownRenderer = ({ propId }) => {
export const PropsLinkRenderer = ({ propId }) => {
const onClick = () => {
document.getElementById(propId).scrollIntoView();
window.scrollBy(0, -48); // Account for sticky header height
};

return <EuiLink onClick={onClick}>{propId}</EuiLink>;
};

export const PropsBoldRenderer = ({ propId }) => {
return <strong>{propId}</strong>;
};
115 changes: 115 additions & 0 deletions src-docs/src/views/datagrid/_props_table.tsx
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} />;
};
Loading