@@ -31,13 +31,15 @@ import { AlignCenter } from "lowcoder-design";
31
31
import { AlignLeft } from "lowcoder-design" ;
32
32
import { AlignRight } from "lowcoder-design" ;
33
33
import { LayoutActionComp } from "./layoutActionComp" ;
34
+ import { clickEvent , eventHandlerControl } from "@lowcoder-ee/index.sdk" ;
34
35
35
36
const TabBar = React . lazy ( ( ) => import ( "antd-mobile/es/components/tab-bar" ) ) ;
36
37
const TabBarItem = React . lazy ( ( ) =>
37
38
import ( "antd-mobile/es/components/tab-bar/tab-bar" ) . then ( ( module ) => ( {
38
39
default : module . TabBarItem ,
39
40
} ) )
40
41
) ;
42
+ const EventOptions = [ clickEvent ] as const ;
41
43
42
44
const AppViewContainer = styled . div `
43
45
position: absolute;
@@ -172,6 +174,7 @@ type JsonItemNode = {
172
174
}
173
175
174
176
type TabBarProps = {
177
+ onEvent :any ;
175
178
tabs : Array < {
176
179
title : string ;
177
180
icon ?: React . ReactNode ;
@@ -225,6 +228,7 @@ function TabBarView(props: TabBarProps & {
225
228
< StyledTabBar
226
229
onChange = { ( key : string ) => {
227
230
if ( key ) {
231
+ props . onEvent ( 'click' )
228
232
props . onChange ( key ) ;
229
233
}
230
234
} }
@@ -282,8 +286,9 @@ const TabOptionComp = (function () {
282
286
283
287
let MobileTabLayoutTmp = ( function ( ) {
284
288
const childrenMap = {
289
+ onEvent : eventHandlerControl ( EventOptions ) ,
285
290
dataOptionType : dropdownControl ( DataOptionType , DataOption . Manual ) ,
286
- jsonItems : jsonControl < JsonItemNode [ ] > ( convertTreeData , mobileNavJsonMenuItems ) ,
291
+ jsonItems : jsonControl < JsonItemNode [ ] > ( convertTreeData , mobileNavJsonMenuItems ) ,
287
292
tabs : manualOptionsControl ( TabOptionComp , {
288
293
initOptions : [
289
294
{
@@ -350,6 +355,9 @@ let MobileTabLayoutTmp = (function () {
350
355
< Section name = { trans ( "navLayout.navStyle" ) } >
351
356
{ children . navStyle . getPropertyView ( ) }
352
357
</ Section >
358
+ < Section name = { trans ( "eventHandler.eventHandlers" ) } >
359
+ { children . onEvent . getPropertyView ( ) }
360
+ </ Section >
353
361
< Section name = { trans ( "navLayout.navItemStyle" ) } >
354
362
{ controlItem ( { } , (
355
363
< Segmented
@@ -391,6 +399,7 @@ MobileTabLayoutTmp = withViewFn(MobileTabLayoutTmp, (comp) => {
391
399
const verticalAlignment = comp . children . verticalAlignment . getView ( ) ;
392
400
const showSeparator = comp . children . showSeparator . getView ( ) ;
393
401
const bgColor = ( useContext ( ThemeContext ) ?. theme || defaultTheme ) . canvas ;
402
+ const onEvent = comp . children . onEvent . getView ( ) ;
394
403
395
404
useEffect ( ( ) => {
396
405
comp . children . jsonTabs . dispatchChangeValueAction ( {
@@ -434,6 +443,7 @@ MobileTabLayoutTmp = withViewFn(MobileTabLayoutTmp, (comp) => {
434
443
435
444
const tabBarView = (
436
445
< TabBarView
446
+ onEvent = { onEvent }
437
447
tabs = { tabViews . map ( ( tab , index ) => ( {
438
448
key : index ,
439
449
title : tab . children . label . getView ( ) ,
0 commit comments