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

Added display prop to EuiDataGridColumnSortingDraggable #3574

Merged
merged 4 commits into from
Jun 8, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

**Bug fixes**

- Added `display` prop to `EuiDataGridColumnSortingDraggable` to pass` displayAsText` prop correctly to the column sorting popover.([#3574](https://github.com/elastic/eui/pull/3574))
- Fixed `EuiCodeBlockImpl` testenv mock pass-through of `data-test-subj` attribute ([#3560](https://github.com/elastic/eui/pull/3560))
- Fixed DOM element creation issues in `EuiOverlayMask` by using lifecycle methods ([#3555](https://github.com/elastic/eui/pull/3555))

Expand Down
1 change: 1 addition & 0 deletions src/components/datagrid/column_sorting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ export const useColumnSorting = (
<EuiDataGridColumnSortingDraggable
key={id}
id={id}
display={displayValues[id]}
direction={direction}
index={index}
sorting={sorting}
Expand Down
19 changes: 16 additions & 3 deletions src/components/datagrid/column_sorting_draggable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,24 @@ export interface EuiDataGridColumnSortingDraggableProps {
sorting: EuiDataGridSorting;
schema: EuiDataGridSchema;
schemaDetectors: EuiDataGridSchemaDetector[];
/**
* Value to be shown in column sorting popover.
*/
display: string;
}

export const EuiDataGridColumnSortingDraggable: FunctionComponent<
EuiDataGridColumnSortingDraggableProps
> = ({ id, direction, index, sorting, schema, schemaDetectors, ...rest }) => {
> = ({
id,
display,
direction,
index,
sorting,
schema,
schemaDetectors,
...rest
}) => {
const schemaDetails =
schema.hasOwnProperty(id) && schema[id].columnType != null
? getDetailsForSchema(schemaDetectors, schema[id].columnType)
Expand Down Expand Up @@ -95,7 +108,7 @@ export const EuiDataGridColumnSortingDraggable: FunctionComponent<
default="is sorting this data grid">
{(activeSortLabel: ReactChild) => (
<span>
{id} {activeSortLabel}
{display} {activeSortLabel}
</span>
)}
</EuiI18n>
Expand Down Expand Up @@ -140,7 +153,7 @@ export const EuiDataGridColumnSortingDraggable: FunctionComponent<
</EuiFlexItem>
<EuiFlexItem aria-hidden>
<EuiText size="xs">
<p>{id}</p>
<p>{display}</p>
</EuiText>
</EuiFlexItem>
<EuiFlexItem className="euiDataGridColumnSorting__orderButtons">
Expand Down