@@ -30,13 +30,16 @@ import { ThemeContext } from "@lowcoder-ee/comps/utils/themeContext";
30
30
import { AlignCenter } from "lowcoder-design" ;
31
31
import { AlignLeft } from "lowcoder-design" ;
32
32
import { AlignRight } from "lowcoder-design" ;
33
+ import { LayoutActionComp } from "./layoutActionComp" ;
34
+ import { clickEvent , eventHandlerControl } from "@lowcoder-ee/index.sdk" ;
33
35
34
36
const TabBar = React . lazy ( ( ) => import ( "antd-mobile/es/components/tab-bar" ) ) ;
35
37
const TabBarItem = React . lazy ( ( ) =>
36
38
import ( "antd-mobile/es/components/tab-bar/tab-bar" ) . then ( ( module ) => ( {
37
39
default : module . TabBarItem ,
38
40
} ) )
39
41
) ;
42
+ const EventOptions = [ clickEvent ] as const ;
40
43
41
44
const AppViewContainer = styled . div `
42
45
position: absolute;
@@ -171,6 +174,7 @@ type JsonItemNode = {
171
174
}
172
175
173
176
type TabBarProps = {
177
+ onEvent :any ;
174
178
tabs : Array < {
175
179
title : string ;
176
180
icon ?: React . ReactNode ;
@@ -224,6 +228,7 @@ function TabBarView(props: TabBarProps & {
224
228
< StyledTabBar
225
229
onChange = { ( key : string ) => {
226
230
if ( key ) {
231
+ props . onEvent ( 'click' )
227
232
props . onChange ( key ) ;
228
233
}
229
234
} }
@@ -250,6 +255,7 @@ const TabOptionComp = (function () {
250
255
return new MultiCompBuilder (
251
256
{
252
257
app : AppSelectComp ,
258
+ action : LayoutActionComp ,
253
259
label : StringControl ,
254
260
icon : IconControl ,
255
261
hidden : BoolCodeControl ,
@@ -261,12 +267,16 @@ const TabOptionComp = (function () {
261
267
. setPropertyViewFn ( ( children , dispatch ) => {
262
268
return (
263
269
< >
264
- { children . app . propertyView ( { } ) }
270
+ { children . action . propertyView ( {
271
+ onAppChange : ( label :any ) => {
272
+ label && children . label . dispatchChangeValueAction ( label ) ;
273
+ } ,
274
+ } ) }
265
275
{ children . label . propertyView ( { label : trans ( "label" ) } ) }
266
276
{ hiddenPropertyView ( children ) }
267
277
{ children . icon . propertyView ( {
268
- label : trans ( " icon" ) ,
269
- tooltip : trans ( " aggregation.iconTooltip" ) ,
278
+ label : trans ( ' icon' ) ,
279
+ tooltip : trans ( ' aggregation.iconTooltip' ) ,
270
280
} ) }
271
281
</ >
272
282
) ;
@@ -276,8 +286,9 @@ const TabOptionComp = (function () {
276
286
277
287
let MobileTabLayoutTmp = ( function ( ) {
278
288
const childrenMap = {
289
+ onEvent : eventHandlerControl ( EventOptions ) ,
279
290
dataOptionType : dropdownControl ( DataOptionType , DataOption . Manual ) ,
280
- jsonItems : jsonControl < JsonItemNode [ ] > ( convertTreeData , mobileNavJsonMenuItems ) ,
291
+ jsonItems : jsonControl < JsonItemNode [ ] > ( convertTreeData , mobileNavJsonMenuItems ) ,
281
292
tabs : manualOptionsControl ( TabOptionComp , {
282
293
initOptions : [
283
294
{
@@ -328,6 +339,9 @@ let MobileTabLayoutTmp = (function () {
328
339
} )
329
340
}
330
341
</ Section >
342
+ < Section name = { trans ( "eventHandler.eventHandlers" ) } >
343
+ { children . onEvent . getPropertyView ( ) }
344
+ </ Section >
331
345
< Section name = { sectionNames . layout } >
332
346
{ children . backgroundImage . propertyView ( {
333
347
label : `Background Image` ,
@@ -385,6 +399,7 @@ MobileTabLayoutTmp = withViewFn(MobileTabLayoutTmp, (comp) => {
385
399
const verticalAlignment = comp . children . verticalAlignment . getView ( ) ;
386
400
const showSeparator = comp . children . showSeparator . getView ( ) ;
387
401
const bgColor = ( useContext ( ThemeContext ) ?. theme || defaultTheme ) . canvas ;
402
+ const onEvent = comp . children . onEvent . getView ( ) ;
388
403
389
404
useEffect ( ( ) => {
390
405
comp . children . jsonTabs . dispatchChangeValueAction ( {
@@ -428,6 +443,7 @@ MobileTabLayoutTmp = withViewFn(MobileTabLayoutTmp, (comp) => {
428
443
429
444
const tabBarView = (
430
445
< TabBarView
446
+ onEvent = { onEvent }
431
447
tabs = { tabViews . map ( ( tab , index ) => ( {
432
448
key : index ,
433
449
title : tab . children . label . getView ( ) ,
0 commit comments