@@ -4,19 +4,23 @@ import {
44 ColumnTypeCompBuilder ,
55 ColumnTypeViewFn ,
66} from "comps/comps/tableComp/column/columnTypeCompBuilder" ;
7- import { ActionSelectorControlInContext } from "comps/controls/actionSelector/actionSelectorControl" ;
87import { BoolCodeControl , StringControl } from "comps/controls/codeControl" ;
98import { trans } from "i18n" ;
109import { disabledPropertyView } from "comps/utils/propertyUtils" ;
1110import styled , { css } from "styled-components" ;
1211import { styleControl } from "comps/controls/styleControl" ;
1312import { TableColumnLinkStyle } from "comps/controls/styleControlConstants" ;
13+ import { clickEvent , eventHandlerControl } from "comps/controls/eventHandlerControl" ;
14+ import { migrateOldData } from "@lowcoder-ee/comps/generators/simpleGenerators" ;
15+ import { fixOldActionData } from "comps/comps/tableComp/column/simpleColumnTypeComps" ;
1416
1517export const ColumnValueTooltip = trans ( "table.columnValueTooltip" ) ;
1618
19+ const LinkEventOptions = [ clickEvent ] as const ;
20+
1721const childrenMap = {
1822 text : StringControl ,
19- onClick : ActionSelectorControlInContext ,
23+ onClick : eventHandlerControl ( LinkEventOptions ) ,
2024 disabled : BoolCodeControl ,
2125 style : styleControl ( TableColumnLinkStyle ) ,
2226} ;
@@ -34,11 +38,10 @@ const StyledLink = styled.a<{ $disabled: boolean }>`
3438` ;
3539
3640// Memoized link component
37- export const ColumnLink = React . memo ( ( { disabled, label, onClick } : { disabled : boolean ; label : string ; onClick ?: ( ) => void } ) => {
41+ export const ColumnLink = React . memo ( ( { disabled, label, onClick } : { disabled : boolean ; label : string ; onClick ?: ( eventName : string ) => void } ) => {
3842 const handleClick = useCallback ( ( ) => {
39- if ( ! disabled && onClick ) {
40- onClick ( ) ;
41- }
43+ if ( disabled ) return ;
44+ onClick ?.( "click" ) ;
4245 } , [ disabled , onClick ] ) ;
4346
4447 return (
@@ -101,7 +104,7 @@ LinkEdit.displayName = 'LinkEdit';
101104
102105const getBaseValue : ColumnTypeViewFn < typeof childrenMap , string , string > = ( props ) => props . text ;
103106
104- export const LinkComp = ( function ( ) {
107+ const LinkCompTmp = ( function ( ) {
105108 return new ColumnTypeCompBuilder (
106109 childrenMap ,
107110 ( props , dispatch ) => {
@@ -125,10 +128,7 @@ export const LinkComp = (function () {
125128 tooltip : ColumnValueTooltip ,
126129 } ) }
127130 { disabledPropertyView ( children ) }
128- { children . onClick . propertyView ( {
129- label : trans ( "table.action" ) ,
130- placement : "table" ,
131- } ) }
131+ { children . onClick . propertyView ( ) }
132132 </ >
133133 ) )
134134 . setStylePropertyViewFn ( ( children ) => (
@@ -138,3 +138,5 @@ export const LinkComp = (function () {
138138 ) )
139139 . build ( ) ;
140140} ) ( ) ;
141+
142+ export const LinkComp = migrateOldData ( LinkCompTmp , fixOldActionData ) ;
0 commit comments