diff --git a/package.json b/package.json index efc9fcfb..f1d6e474 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dassana-io/web-components", - "version": "0.11.14", + "version": "0.11.15", "publishConfig": { "registry": "https://npm.pkg.github.com/dassana-io" }, diff --git a/src/components/Table/types.ts b/src/components/Table/types.ts index a8fe2e24..20188f4a 100644 --- a/src/components/Table/types.ts +++ b/src/components/Table/types.ts @@ -129,7 +129,8 @@ interface ComponentColoredDotType extends PartialComponentType { } interface RenderPropsLink extends Pick { - buildHref: (record?: string) => string + buildHref: (record?: string, data?: Record) => string + isDisabled?: (record?: string, data?: Record) => boolean } interface ComponentLinkType extends PartialComponentType { diff --git a/src/components/Table/utils.tsx b/src/components/Table/utils.tsx index 49e3e552..96654b06 100644 --- a/src/components/Table/utils.tsx +++ b/src/components/Table/utils.tsx @@ -483,20 +483,25 @@ function applyRender( } case link: { - antDColumn.render = (record: string) => { + antDColumn.render = (record: string, data: TableData) => { if (record === undefined) return '' const { - target = '_blank', - buildHref = (r: string) => r + buildHref = (r: string, _data: TableData) => r, + isDisabled = (_r: string, _data: TableData) => + false, + target = '_blank' } = column.renderProps || {} const linkProps: LinkProps = { children: record, - href: buildHref(record), + href: buildHref(record, data), target } + if (isDisabled(record, data)) + return + return } break