Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
56 changes: 29 additions & 27 deletions packages/react-table/src/components/Table/ActionsColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,35 +116,37 @@ const ActionsColumnBase: React.FunctionComponent<ActionsColumnProps> = ({
<DropdownList>
{items
.filter((item) => !item.isOutsideDropdown)
.map(({ title, itemKey, onClick, tooltipProps, isSeparator, ...props }, index) => {
if (isSeparator) {
return <Divider key={itemKey || index} data-key={itemKey || index} />;
}
const item = (
<DropdownItem
onClick={(event: any) => {
onActionClick(event, onClick);
onToggle();
}}
{...props}
key={itemKey || index}
data-key={itemKey || index}
ref={index === 0 ? firstActionItemRef : undefined}
>
{title}
</DropdownItem>
);

if (tooltipProps?.content) {
return (
<Tooltip key={itemKey || index} {...tooltipProps}>
{item}
</Tooltip>
.map(
({ title, itemKey, onClick, tooltipProps, isSeparator, shouldCloseOnClick = true, ...props }, index) => {
if (isSeparator) {
return <Divider key={itemKey || index} data-key={itemKey || index} />;
}
const item = (
<DropdownItem
onClick={(event: any) => {
onActionClick(event, onClick);
shouldCloseOnClick && onToggle();
}}
{...props}
key={itemKey || index}
data-key={itemKey || index}
ref={index === 0 ? firstActionItemRef : undefined}
>
{title}
</DropdownItem>
);
} else {
return item;

if (tooltipProps?.content) {
return (
<Tooltip key={itemKey || index} {...tooltipProps}>
{item}
</Tooltip>
);
} else {
return item;
}
}
})}
)}
</DropdownList>
</Dropdown>
</React.Fragment>
Expand Down
2 changes: 2 additions & 0 deletions packages/react-table/src/components/Table/TableTypes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ export interface IAction extends Omit<DropdownItemProps, 'title' | 'onClick'>, P
onClick?: (event: React.MouseEvent, rowIndex: number, rowData: IRowData, extraData: IExtraData) => void;
/** Flag indicating this action should be placed outside the actions menu, beside the toggle */
isOutsideDropdown?: boolean;
/** Flag indicating whether the actions dropdown should close after an item is clicked. */
shouldCloseOnClick?: boolean;
}

export interface ISeparator extends IAction {
Expand Down