diff --git a/src-docs/src/views/datagrid/cells_popovers/datagrid_cells_example.js b/src-docs/src/views/datagrid/cells_popovers/datagrid_cells_example.js index 718d2106093..24a812a4237 100644 --- a/src-docs/src/views/datagrid/cells_popovers/datagrid_cells_example.js +++ b/src-docs/src/views/datagrid/cells_popovers/datagrid_cells_example.js @@ -84,13 +84,18 @@ export const DataGridCellsExample = { your cell actions to switch correctly between button icons and buttons.

+

+ To close a cell's expansion popover upon clicking an action, + use the{' '} + + closeCellPopover + {' '} + API available via the ref prop. +

In the below example, the email and city columns provide 1{' '} cellAction each, while the country column provides 2 cellActions. -
- The email column cell action closes the popover if it's - expanded through the closePopover prop.

), diff --git a/src/components/datagrid/body/data_grid_cell.test.tsx b/src/components/datagrid/body/data_grid_cell.test.tsx index 31ca2e5e20e..2b33f201eea 100644 --- a/src/components/datagrid/body/data_grid_cell.test.tsx +++ b/src/components/datagrid/body/data_grid_cell.test.tsx @@ -75,8 +75,6 @@ describe('EuiDataGridCell', () => { }); (getCellActions().prop('onExpandClick') as Function)(); expect(mockPopoverContext.closeCellPopover).toHaveBeenCalledTimes(1); - (getCellActions().prop('closePopover') as Function)(); - expect(mockPopoverContext.closeCellPopover).toHaveBeenCalledTimes(2); }); describe('shouldComponentUpdate', () => { diff --git a/src/components/datagrid/body/data_grid_cell.tsx b/src/components/datagrid/body/data_grid_cell.tsx index 78c6ced31c3..8ef6c1ba32a 100644 --- a/src/components/datagrid/body/data_grid_cell.tsx +++ b/src/components/datagrid/body/data_grid_cell.tsx @@ -666,7 +666,6 @@ export class EuiDataGridCell extends Component< rowIndex={rowIndex} colIndex={colIndex} column={column} - closePopover={closeCellPopover} onExpandClick={() => { if (popoverIsOpen) { closeCellPopover(); diff --git a/src/components/datagrid/body/data_grid_cell_actions.test.tsx b/src/components/datagrid/body/data_grid_cell_actions.test.tsx index ef8e7e47f9b..e14f235f60c 100644 --- a/src/components/datagrid/body/data_grid_cell_actions.test.tsx +++ b/src/components/datagrid/body/data_grid_cell_actions.test.tsx @@ -21,7 +21,6 @@ const MockAction: EuiDataGridColumnCellAction = ({ Component }) => ( describe('EuiDataGridCellActions', () => { const requiredProps = { - closePopover: jest.fn(), onExpandClick: jest.fn(), rowIndex: 0, colIndex: 0, @@ -93,7 +92,6 @@ describe('EuiDataGridCellActions', () => { > void; onExpandClick: () => void; column?: EuiDataGridColumn; rowIndex: number; @@ -88,12 +86,11 @@ export const EuiDataGridCellActions = ({ columnId={column.id} Component={ButtonComponent} isExpanded={false} - closePopover={closePopover} /> ); } ); - }, [column, colIndex, rowIndex, closePopover]); + }, [column, colIndex, rowIndex]); return (
diff --git a/src/components/datagrid/data_grid_types.ts b/src/components/datagrid/data_grid_types.ts index 3c0a2e7413d..9405bfacd67 100644 --- a/src/components/datagrid/data_grid_types.ts +++ b/src/components/datagrid/data_grid_types.ts @@ -637,11 +637,6 @@ export interface EuiDataGridColumnCellActionProps { * Determines whether the cell's action is displayed expanded (in the Popover) */ isExpanded: boolean; - /** - * Closes the popover if a cell is expanded. - * The prop is provided for an expanded cell only. - */ - closePopover?: () => void; } export interface EuiDataGridColumnVisibility { diff --git a/upcoming_changelogs/5734.md b/upcoming_changelogs/5734.md new file mode 100644 index 00000000000..09aeacd95dc --- /dev/null +++ b/upcoming_changelogs/5734.md @@ -0,0 +1,3 @@ +**Breaking changes** + +- Removed the `closePopover()` callback passed to `EuiDataGrid`'s `cellActions` render functions. Use `closeCellPopover()` passed by `EuiDataGrid`'s `ref` prop instead.