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] Add rowHeightSwitcher logic + API change #5372

Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
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
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
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
9348b1d
Merge branch 'feat/datagrid/toolbar-reorg-and-row-height-switcher' in…
cee-chen Nov 19, 2021
3dd2d3f
Do not fall back to undefined/single for static heights
cee-chen Nov 23, 2021
0ab5aac
PR changelog feedback
constancecchen Nov 23, 2021
f226ad7
Update grid density to also intelligently detect initial state
cee-chen Nov 23, 2021
be0db10
Merge branch 'feat/datagrid/toolbar-reorg-and-row-height-switcher' in…
cee-chen Nov 23, 2021
fc9f65c
[PR feedback] Improve typing to avoid any usage
cee-chen Nov 24, 2021
4250a73
[PR feedback] Document recommendation for disabling row height switch…
cee-chen Nov 24, 2021
fc4105c
[Pr feedback] Simplify getNestedObjectOptions
cee-chen Nov 24, 2021
0b9ca21
Add workaround for failing Cypress tests
cee-chen Nov 24, 2021
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

- Updated the organization of `EuiDataGrid`'s toolbar/grid controls ([#5334](https://github.com/elastic/eui/pull/5334))
- Added `left.append` and `left.prepend` to `EuiDataGrid`'s `toolbarVisibility.additionalControls` prop [#5394](https://github.com/elastic/eui/pull/5394))
- Added a row height control to `EuiDataGrid`'s toolbar ([#5372](https://github.com/elastic/eui/pull/5372))

**Bug fixes**

- Fixed persistent `EuiDataGrid` full screen `<body>` class ([#5354](https://github.com/elastic/eui/pull/5354))

**Breaking changes**

- Removed `toolbarVisibility`'s `showStyleSelector` prop of `EuiDataGrid` in favor of `showDisplaySelector`, which allows configuration of both grid density and row height ([#5372](https://github.com/elastic/eui/pull/5372))

## END FEATURE BRANCH

**Bug fixes**
Expand Down
23 changes: 18 additions & 5 deletions src-docs/src/views/datagrid/datagrid_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const gridSnippet = `
// The prop also accepts a boolean if you want to toggle the entire toolbar on/off.
toolbarVisibility={{
showColumnSelector: false,
showStyleSelector: false,
showDisplaySelector: false,
showSortSelector: false,
showFullScreenSelector: false,
additionalControls: {
Expand Down Expand Up @@ -248,6 +248,13 @@ const gridConcepts = [
Data grid row heights options
</EuiLink>{' '}
for more details and examples.
<br />
Settings provided may be overwritten or merged with user defined
preferences if{' '}
<EuiCode>
toolbarVisibility.showDisplaySelector.allowRowHeight
</EuiCode>{' '}
is set to true (which is the default).
</span>
),
},
Expand All @@ -256,10 +263,16 @@ const gridConcepts = [
description: (
<span>
Defines the look of the grid. Accepts a partial{' '}
<strong>EuiDataGridStyle</strong> object. Settings provided may be
overwritten or merged with user defined preferences if{' '}
<EuiCode>toolbarVisibility.showStyleSelector</EuiCode> is set to true
(which is the default).
<strong>EuiDataGridStyle</strong> object. See{' '}
<EuiLink href="/#/tabular-content/data-grid-styling-and-control">
Data grid styling and control
</EuiLink>{' '}
for more details and examples.
<br />
Settings provided may be overwritten or merged with user defined
preferences if{' '}
<EuiCode>toolbarVisibility.showDisplaySelector.allowDensity</EuiCode> is
set to true (which is the default).
</span>
),
},
Expand Down
32 changes: 16 additions & 16 deletions src-docs/src/views/datagrid/datagrid_height_options_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,26 +195,26 @@ export const DataGridRowHeightOptionsExample = {
text: (
<Fragment>
<p>
You can change the default height for all rows by passing a line
count or pixel value to the <EuiCode>defaultHeight</EuiCode>{' '}
property, and customize the line height of all cells with the{' '}
<EuiCode>lineHeight</EuiCode> property.
You can change the default height for all rows via the{' '}
<EuiCode>defaultHeight</EuiCode> property. Note that the{' '}
<EuiCode>showDisplaySelector.allowRowHeight</EuiCode> setting in{' '}
<EuiCode>toolbarVisibility</EuiCode> means the user has the ability
to override this default height. Users will be able to toggle
between single rows, a configurable line count, or{' '}
<EuiCode>&quot;auto&quot;</EuiCode>.
</p>
<p>
You can also customize the line height of all cells with the{' '}
<EuiCode>lineHeight</EuiCode> property. However, if you wrap your
cell content with CSS that overrides/sets line-height (e.g. in an{' '}
<EuiCode>EuiText</EuiCode>), your row heights will not be calculated
correctly - make sure to match the passed{' '}
<EuiCode>lineHeight</EuiCode> property to the actual cell content
line height.
</p>
<EuiCodeBlock language="javascript" paddingSize="s" isCopyable>
{lineHeightSnippet}
</EuiCodeBlock>
<EuiCallOut
color="warning"
title="Make sure your line heights match!"
>
<p>
If you wrap your cell content with CSS that overrides/sets
line-height (e.g. in an <EuiCode>EuiText</EuiCode>), your row
heights will not be calculated correctly! Make sure to match or
inherit the passed <EuiCode>lineHeight</EuiCode> property to the
actual cell content line height.
</p>
</EuiCallOut>
</Fragment>
),
components: { DataGridRowLineHeight },
Expand Down
11 changes: 6 additions & 5 deletions src-docs/src/views/datagrid/datagrid_styling_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const gridSnippet = `<EuiDataGrid
]}
// This can work as a shape.
toolbarVisibility={{
showStyleSelector: false,
showDisplaySelector: false,
showSortSelector: false,
showFullScreenSelector: false,
// showColumnSelector also takes an object, check the prop docs.
Expand Down Expand Up @@ -86,7 +86,7 @@ const gridSnippet = `<EuiDataGrid
stripes: true,
rowHover: 'highlight',
header: 'shade',
// If showStyleSelector={true} from toolbarVisibility, these last two will be superceded by what the user decides.
// If showDisplaySelector.allowDensity={true} from toolbarVisibility, fontSize and cellPadding will be superceded by what the user decides.
fontSize: 'm',
cellPadding: 'm',
footer: 'overline'
Expand Down Expand Up @@ -197,9 +197,10 @@ export const DataGridStylingExample = {
individual buttons within.
</p>
<p>
With the default settings, the <EuiCode>showStyleSelector</EuiCode>{' '}
setting in <EuiCode>toolbarVisibility</EuiCode> means the user has
the ability to override the padding and font size passed into{' '}
With the default settings, the{' '}
<EuiCode>showDisplaySelector.allowDensity</EuiCode> setting in{' '}
<EuiCode>toolbarVisibility</EuiCode> means the user has the ability
to override the padding and font size passed into{' '}
<EuiCode>gridStyle</EuiCode> by the engineer. The font size
overriding only works with text or elements that can inherit the
parent font size or elements that use units relative to the parent
Expand Down
Loading