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

Pass itemIdToExpandedRowMap prop from EuiInMemoryTable to EuiBasicTable #759

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -10,6 +10,7 @@

- Fixed `EuiTableRowCell` from overwriting its child element's `className` [#709](https://github.com/elastic/eui/pull/709)
- Allow `EuiContextMenuPanel`s to update when their `children` changes ([#710](https://github.com/elastic/eui/pull/710))
- `EuiInMemoryTable` now passes `itemIdToExpandedRowMap` prop to `EuiBasicTable` ([#759](https://github.com/elastic/eui/pull/759))

## [`0.0.44`](https://github.com/elastic/eui/tree/v0.0.44)

Expand Down
Expand Up @@ -96,6 +96,46 @@ exports[`EuiInMemoryTable with items 1`] = `
/>
`;

exports[`EuiInMemoryTable with items and expanded item 1`] = `
<EuiBasicTable
columns={
Array [
Object {
"description": "description",
"field": "name",
"name": "Name",
},
]
}
itemIdToExpandedRowMap={
Object {
"1": <div>
expanded row content
</div>,
}
}
items={
Array [
Object {
"id": "1",
"name": "name1",
},
Object {
"id": "2",
"name": "name2",
},
Object {
"id": "3",
"name": "name3",
},
]
}
noItemsMessage="No items found"
onChange={[Function]}
responsive={true}
/>
`;

exports[`EuiInMemoryTable with items and message - expecting to show the items 1`] = `
<EuiBasicTable
columns={
Expand Down
2 changes: 2 additions & 0 deletions src/components/basic_table/in_memory_table.js
Expand Up @@ -259,6 +259,7 @@ export class EuiInMemoryTable extends Component {
compressed,
pagination: hasPagination,
sorting: hasSorting,
itemIdToExpandedRowMap,
} = this.props;

const {
Expand Down Expand Up @@ -305,6 +306,7 @@ export class EuiInMemoryTable extends Component {
loading={loading}
noItemsMessage={message}
compressed={compressed}
itemIdToExpandedRowMap={itemIdToExpandedRowMap}
/>
);

Expand Down
27 changes: 27 additions & 0 deletions src/components/basic_table/in_memory_table.test.js
Expand Up @@ -93,6 +93,33 @@ describe('EuiInMemoryTable', () => {
expect(component).toMatchSnapshot();
});

test('with items and expanded item', () => {

const props = {
...requiredProps,
items: [
{ id: '1', name: 'name1' },
{ id: '2', name: 'name2' },
{ id: '3', name: 'name3' }
],
columns: [
{
field: 'name',
name: 'Name',
description: 'description'
}
],
itemIdToExpandedRowMap: {
'1': <div>expanded row content</div>
}
};
const component = shallow(
<EuiInMemoryTable {...props} />
);

expect(component).toMatchSnapshot();
});

test('with items and message - expecting to show the items', () => {

const props = {
Expand Down