From 17b9a663fea91515b1fa646ddb2003f4e70016a5 Mon Sep 17 00:00:00 2001 From: Roman Sychev <40444580+romachne@users.noreply.github.com> Date: Fri, 27 Sep 2024 20:13:43 +0500 Subject: [PATCH] feat(Table): add dynamic href support for row actions in withTableActions (#1874) --- .../Table/hoc/withTableActions/withTableActions.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/Table/hoc/withTableActions/withTableActions.tsx b/src/components/Table/hoc/withTableActions/withTableActions.tsx index 9cdcad424a..c00219c35c 100644 --- a/src/components/Table/hoc/withTableActions/withTableActions.tsx +++ b/src/components/Table/hoc/withTableActions/withTableActions.tsx @@ -50,7 +50,7 @@ export interface TableAction { index: number, event: React.MouseEvent, ) => void; - href?: string; + href?: ((item: I, index: number) => string) | string; target?: string; rel?: string; disabled?: boolean; @@ -132,7 +132,7 @@ const DefaultRowActions = ({ ); } - const {text, icon, handler, ...restProps} = action; + const {text, icon, handler, href, ...restProps} = action; return ( ({ closePopup(); }} + href={typeof href === 'function' ? href(item, index) : href} iconStart={icon} className={menuItemCn} {...restProps}