Skip to content

Commit

Permalink
feat(Table): add dynamic href support for row actions in withTableAct…
Browse files Browse the repository at this point in the history
…ions (#1874)
  • Loading branch information
syncroma authored Sep 27, 2024
1 parent 2b5c26e commit 17b9a66
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export interface TableAction<I> {
index: number,
event: React.MouseEvent<HTMLDivElement | HTMLAnchorElement, MouseEvent>,
) => void;
href?: string;
href?: ((item: I, index: number) => string) | string;
target?: string;
rel?: string;
disabled?: boolean;
Expand Down Expand Up @@ -132,7 +132,7 @@ const DefaultRowActions = <I extends TableDataItem>({
);
}

const {text, icon, handler, ...restProps} = action;
const {text, icon, handler, href, ...restProps} = action;

return (
<Menu.Item
Expand All @@ -143,6 +143,7 @@ const DefaultRowActions = <I extends TableDataItem>({

closePopup();
}}
href={typeof href === 'function' ? href(item, index) : href}
iconStart={icon}
className={menuItemCn}
{...restProps}
Expand Down

0 comments on commit 17b9a66

Please sign in to comment.