@@ -10,7 +10,6 @@ import { trans } from "i18n";
10
10
import styled from "styled-components" ;
11
11
import { ColumnLink } from "comps/comps/tableComp/column/columnTypeComps/columnLinkComp" ;
12
12
import { LightActiveTextColor , PrimaryColor } from "constants/style" ;
13
- import { clickEvent , eventHandlerControl } from "comps/controls/eventHandlerControl" ;
14
13
15
14
const MenuLinkWrapper = styled . div `
16
15
> a {
@@ -38,26 +37,13 @@ const MenuWrapper = styled.div`
38
37
}
39
38
` ;
40
39
41
- const LinksEventOptions = [ clickEvent ] as const ;
42
-
43
40
// Memoized menu item component
44
- const MenuItem = React . memo ( ( { option, index, onMainEvent } : { option : any ; index : number ; onMainEvent ?: ( eventName : string ) => void } ) => {
41
+ const MenuItem = React . memo ( ( { option, index } : { option : any ; index : number } ) => {
45
42
const handleClick = useCallback ( ( ) => {
46
- if ( ! option . disabled ) {
47
- // Trigger legacy onClick action for backward compatibility
48
- if ( option . onClick ) {
49
- option . onClick ( ) ;
50
- }
51
- // Trigger individual item event handlers
52
- if ( option . onEvent ) {
53
- option . onEvent ( "click" ) ;
54
- }
55
- // Trigger the main column's event handler
56
- if ( onMainEvent ) {
57
- onMainEvent ( "click" ) ;
58
- }
43
+ if ( ! option . disabled && option . onClick ) {
44
+ option . onClick ( ) ;
59
45
}
60
- } , [ option . disabled , option . onClick , option . onEvent , onMainEvent ] ) ;
46
+ } , [ option . disabled , option . onClick ] ) ;
61
47
62
48
return (
63
49
< MenuLinkWrapper >
@@ -72,12 +58,10 @@ const MenuItem = React.memo(({ option, index, onMainEvent }: { option: any; inde
72
58
73
59
MenuItem . displayName = 'MenuItem' ;
74
60
75
- // Update OptionItem to include event handlers
76
61
const OptionItem = new MultiCompBuilder (
77
62
{
78
63
label : StringControl ,
79
64
onClick : ActionSelectorControlInContext ,
80
- onEvent : eventHandlerControl ( LinksEventOptions ) ,
81
65
hidden : BoolCodeControl ,
82
66
disabled : BoolCodeControl ,
83
67
} ,
@@ -86,28 +70,22 @@ const OptionItem = new MultiCompBuilder(
86
70
}
87
71
)
88
72
. setPropertyViewFn ( ( children ) => {
89
- // Check if there's a legacy action configured for this individual item
90
- const hasLegacyAction = children . onClick . getView ( ) &&
91
- typeof children . onClick . getView ( ) === 'function' &&
92
- children . onClick . displayName ( ) !== trans ( "eventHandler.incomplete" ) ;
93
-
94
73
return (
95
74
< >
96
75
{ children . label . propertyView ( { label : trans ( "label" ) } ) }
97
- { hasLegacyAction && children . onClick . propertyView ( {
76
+ { children . onClick . propertyView ( {
98
77
label : trans ( "table.action" ) ,
99
78
placement : "table" ,
100
79
} ) }
101
80
{ hiddenPropertyView ( children ) }
102
81
{ disabledPropertyView ( children ) }
103
- { children . onEvent . propertyView ( ) }
104
82
</ >
105
83
) ;
106
84
} )
107
85
. build ( ) ;
108
86
109
87
// Memoized menu component
110
- const LinksMenu = React . memo ( ( { options, onEvent } : { options : any [ ] ; onEvent ?: ( eventName : string ) => void } ) => {
88
+ const LinksMenu = React . memo ( ( { options } : { options : any [ ] } ) => {
111
89
const mountedRef = useRef ( true ) ;
112
90
113
91
// Cleanup on unmount
@@ -122,9 +100,9 @@ const LinksMenu = React.memo(({ options, onEvent }: { options: any[]; onEvent?:
122
100
. filter ( ( o ) => ! o . hidden )
123
101
. map ( ( option , index ) => ( {
124
102
key : index ,
125
- label : < MenuItem option = { option } index = { index } onMainEvent = { onEvent } />
103
+ label : < MenuItem option = { option } index = { index } />
126
104
} ) ) ,
127
- [ options , onEvent ]
105
+ [ options ]
128
106
) ;
129
107
130
108
return (
@@ -141,12 +119,11 @@ export const ColumnLinksComp = (function () {
141
119
options : manualOptionsControl ( OptionItem , {
142
120
initOptions : [ { label : trans ( "table.option1" ) } ] ,
143
121
} ) ,
144
- onEvent : eventHandlerControl ( LinksEventOptions ) , // Main column level event handlers
145
122
} ;
146
123
return new ColumnTypeCompBuilder (
147
124
childrenMap ,
148
125
( props ) => {
149
- return < LinksMenu options = { props . options } onEvent = { props . onEvent } /> ;
126
+ return < LinksMenu options = { props . options } /> ;
150
127
} ,
151
128
( ) => ""
152
129
)
@@ -156,7 +133,6 @@ export const ColumnLinksComp = (function () {
156
133
newOptionLabel : trans ( "table.option" ) ,
157
134
title : trans ( "table.optionList" ) ,
158
135
} ) }
159
- { children . onEvent . propertyView ( ) }
160
136
</ >
161
137
) )
162
138
. build ( ) ;
0 commit comments