@@ -40,11 +40,13 @@ import {
40
40
jsonMenuItems ,
41
41
menuItemStyleOptions
42
42
} from "./navLayoutConstants" ;
43
+ import { clickEvent , eventHandlerControl } from "@lowcoder-ee/index.sdk" ;
43
44
44
45
const { Header } = Layout ;
45
46
46
47
const DEFAULT_WIDTH = 240 ;
47
48
type MenuItemStyleOptionValue = "normal" | "hover" | "active" ;
49
+ const EventOptions = [ clickEvent ] as const ;
48
50
49
51
const StyledSide = styled ( LayoutSider ) `
50
52
max-height: calc(100vh - ${ TopHeaderHeight } );
@@ -183,6 +185,7 @@ function convertTreeData(data: any) {
183
185
184
186
let NavTmpLayout = ( function ( ) {
185
187
const childrenMap = {
188
+ onEvent : eventHandlerControl ( EventOptions ) ,
186
189
dataOptionType : dropdownControl ( DataOptionType , DataOption . Manual ) ,
187
190
items : withDefault ( LayoutMenuItemListComp , [
188
191
{
@@ -242,6 +245,9 @@ let NavTmpLayout = (function () {
242
245
< Section name = { trans ( "navLayout.navStyle" ) } >
243
246
{ children . navStyle . getPropertyView ( ) }
244
247
</ Section >
248
+ < Section name = { trans ( "eventHandler.eventHandlers" ) } >
249
+ { children . onEvent . getPropertyView ( ) }
250
+ </ Section >
245
251
< Section name = { trans ( "navLayout.navItemStyle" ) } >
246
252
{ controlItem ( { } , (
247
253
< Segmented
@@ -282,7 +288,8 @@ NavTmpLayout = withViewFn(NavTmpLayout, (comp) => {
282
288
const backgroundImage = comp . children . backgroundImage . getView ( ) ;
283
289
const jsonItems = comp . children . jsonItems . getView ( ) ;
284
290
const dataOptionType = comp . children . dataOptionType . getView ( ) ;
285
-
291
+ const onEvent = comp . children . onEvent . getView ( ) ;
292
+
286
293
// filter out hidden. unauthorised items filtered by server
287
294
const filterItem = useCallback ( ( item : LayoutMenuItemComp ) : boolean => {
288
295
return ! item . children . hidden . getView ( ) ;
@@ -319,7 +326,8 @@ NavTmpLayout = withViewFn(NavTmpLayout, (comp) => {
319
326
return generateItemKeyRecord ( items )
320
327
} , [ dataOptionType , jsonItems , items , generateItemKeyRecord ] ) ;
321
328
322
- const onMenuItemClick = useCallback ( ( { key} : { key : string } ) => {
329
+ const onMenuItemClick = useCallback ( ( { key } : { key : string } ) => {
330
+ onEvent ( 'click' )
323
331
const itemComp = itemKeyRecord [ key ]
324
332
325
333
const url = [
0 commit comments