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

Add overflow to datagrid toolbar dropdowns #3238

Merged
merged 6 commits into from
Apr 3, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## [`master`](https://github.com/elastic/eui/tree/master)

No public interface changes since `22.3.0`.
- Added overflows to EuiDataGrid toolbar dropdowns in case there are many columns ([#3238](https://github.com/elastic/eui/pull/3238))
snide marked this conversation as resolved.
Show resolved Hide resolved

## [`22.3.0`](https://github.com/elastic/eui/tree/v22.3.0)

Expand All @@ -9,7 +9,7 @@ No public interface changes since `22.3.0`.
- Improved `htmlIdGenerator` when supplying both `prefix` and `suffix` ([#3076](https://github.com/elastic/eui/pull/3076))
- Updated pagination prop descriptions for `EuiInMemoryTable` ([#3142](https://github.com/elastic/eui/pull/3142))
- Added `title` and `aria` attributes to `EuiToken`'s icon element ([#3195](https://github.com/elastic/eui/pull/3195))
- Added new Elasticsearch token types ([58036](https://github.com/elastic/kibana/issues/58036))
- Added new Elasticsearch token types ([#2758](https://github.com/elastic/eui/pull/2758))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Small CL fix unrelated to this PR.


**Bug Fixes**

Expand Down
8 changes: 8 additions & 0 deletions src/components/datagrid/_data_grid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,11 @@
height: 100vh;
overflow: hidden;
}


.euiDataGrid__controlScroll {
@include euiYScrollWithShadows;
max-height: $euiDataGridPopoverMaxHeight;
padding: $euiSizeS;
margin: -$euiSizeS; // Offset against the panel to make the scrollbar flush scrollbars
}
1 change: 0 additions & 1 deletion src/components/datagrid/_data_grid_column_selector.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
.euiDataGridColumnSelector__columnList {
@include euiYScrollWithShadows;
max-height: 400px;
padding: $euiSizeS;
margin: 0 (-$euiSizeS);
}

Expand Down
1 change: 1 addition & 0 deletions src/components/datagrid/_variables.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
$euiDataGridColumnResizerWidth: 3px; // Odd number because it straddles a border
$euiDataGridPopoverMaxHeight: $euiSize * 25;
snide marked this conversation as resolved.
Show resolved Hide resolved

$euiDataGridCellPaddingS: $euiSizeXS;
$euiDataGridCellPaddingM: $euiSizeM / 2;
Expand Down
117 changes: 59 additions & 58 deletions src/components/datagrid/column_selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,65 +157,66 @@ export const useColumnSelector = (
</EuiI18n>
</EuiPopoverTitle>
)}
<EuiDragDropContext onDragEnd={onDragEnd}>
<EuiDroppable
droppableId="columnOrder"
isDropDisabled={!isDragEnabled}
className="euiDataGridColumnSelector">
<Fragment>
{filteredColumns.map((id, index) => (
<EuiDraggable
key={id}
draggableId={id}
index={index}
isDragDisabled={!isDragEnabled}>
{(provided, state) => (
<div
className={`euiDataGridColumnSelector__item ${state.isDragging &&
'euiDataGridColumnSelector__item-isDragging'}`}>
<EuiFlexGroup gutterSize="m" alignItems="center">
<EuiFlexItem>
{allowColumnHiding ? (
<EuiSwitch
name={id}
label={id}
checked={visibleColumnIds.has(id)}
compressed
className="euiSwitch--mini"
onChange={event => {
const {
target: { checked },
} = event;
const nextVisibleColumns = sortedColumns.filter(
columnId =>
checked
? visibleColumnIds.has(columnId) ||
id === columnId
: visibleColumnIds.has(columnId) &&
id !== columnId
);
setVisibleColumns(nextVisibleColumns);
}}
/>
) : (
<span className="euiDataGridColumnSelector__itemLabel">
{id}
</span>
)}
</EuiFlexItem>
{isDragEnabled && (
<EuiFlexItem grow={false}>
<EuiIcon type="grab" color="subdued" />
<div className="euiDataGrid__controlScroll">
<EuiDragDropContext onDragEnd={onDragEnd}>
<EuiDroppable
droppableId="columnOrder"
isDropDisabled={!isDragEnabled}>
<Fragment>
{filteredColumns.map((id, index) => (
<EuiDraggable
key={id}
draggableId={id}
index={index}
isDragDisabled={!isDragEnabled}>
{(provided, state) => (
<div
className={`euiDataGridColumnSelector__item ${state.isDragging &&
'euiDataGridColumnSelector__item-isDragging'}`}>
<EuiFlexGroup gutterSize="m" alignItems="center">
<EuiFlexItem>
{allowColumnHiding ? (
<EuiSwitch
name={id}
label={id}
checked={visibleColumnIds.has(id)}
compressed
className="euiSwitch--mini"
onChange={event => {
const {
target: { checked },
} = event;
const nextVisibleColumns = sortedColumns.filter(
columnId =>
checked
? visibleColumnIds.has(columnId) ||
id === columnId
: visibleColumnIds.has(columnId) &&
id !== columnId
);
setVisibleColumns(nextVisibleColumns);
}}
/>
) : (
<span className="euiDataGridColumnSelector__itemLabel">
{id}
</span>
)}
</EuiFlexItem>
)}
</EuiFlexGroup>
</div>
)}
</EuiDraggable>
))}
</Fragment>
</EuiDroppable>
</EuiDragDropContext>
{isDragEnabled && (
<EuiFlexItem grow={false}>
<EuiIcon type="grab" color="subdued" />
</EuiFlexItem>
)}
</EuiFlexGroup>
</div>
)}
</EuiDraggable>
))}
</Fragment>
</EuiDroppable>
</EuiDragDropContext>
</div>
</div>
{allowColumnHiding && (
<EuiPopoverFooter>
Expand Down
9 changes: 5 additions & 4 deletions src/components/datagrid/column_sorting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,12 @@ export const useColumnSorting = (
</EuiI18n>
}>
{sorting.columns.length > 0 ? (
<div role="region" aria-live="assertive">
<div
role="region"
aria-live="assertive"
className="euiDataGrid__controlScroll">
<EuiDragDropContext onDragEnd={onDragEnd}>
<EuiDroppable
droppableId="columnSorting"
className="euiDataGridColumnSorting">
<EuiDroppable droppableId="columnSorting">
<Fragment>
{sorting.columns.map(({ id, direction }, index) => {
return (
Expand Down