@@ -15,7 +15,7 @@ import { NameGenerator } from "comps/utils";
15
15
import { ScrollBar , Section , sectionNames } from "lowcoder-design" ;
16
16
import { HintPlaceHolder } from "lowcoder-design" ;
17
17
import _ from "lodash" ;
18
- import React , { useCallback , useContext } from "react" ;
18
+ import React , { useCallback , useContext , useEffect } from "react" ;
19
19
import styled , { css } from "styled-components" ;
20
20
import { IContainer } from "../containerBase/iContainer" ;
21
21
import { SimpleContainerComp } from "../containerBase/simpleContainerComp" ;
@@ -35,6 +35,9 @@ import { checkIsMobile } from "util/commonUtils";
35
35
import { messageInstance } from "lowcoder-design/src/components/GlobalInstances" ;
36
36
import { BoolControl } from "comps/controls/boolControl" ;
37
37
import { PositionControl } from "comps/controls/dropdownControl" ;
38
+ import { setInitialCompStyles } from "@lowcoder-ee/comps/utils/themeUtil" ;
39
+ import { ThemeContext } from "@lowcoder-ee/comps/utils/themeContext" ;
40
+ import { CompTypeContext } from "@lowcoder-ee/comps/utils/compTypeContext" ;
38
41
39
42
const EVENT_OPTIONS = [
40
43
{
@@ -57,10 +60,10 @@ const childrenMap = {
57
60
onEvent : eventHandlerControl ( EVENT_OPTIONS ) ,
58
61
disabled : BoolCodeControl ,
59
62
showHeader : withDefault ( BoolControl , true ) ,
60
- style : withDefault ( styleControl ( TabContainerStyle ) , { borderWidth : '1px' } ) ,
61
- headerStyle : styleControl ( ContainerHeaderStyle ) ,
62
- bodyStyle : styleControl ( TabBodyStyle ) ,
63
- animationStyle : styleControl ( AnimationStyle ) ,
63
+ style : styleControl ( TabContainerStyle , 'style' ) ,
64
+ headerStyle : styleControl ( ContainerHeaderStyle , 'headerStyle' ) ,
65
+ bodyStyle : styleControl ( TabBodyStyle , 'bodyStyle' ) ,
66
+ animationStyle : styleControl ( AnimationStyle , 'animationStyle' ) ,
64
67
tabsGutter : withDefault ( NumberControl , 32 ) ,
65
68
tabsCentered : withDefault ( BoolControl , false ) ,
66
69
} ;
@@ -288,6 +291,23 @@ const TabbedContainer = (props: TabbedContainerProps) => {
288
291
289
292
export const TabbedContainerBaseComp = ( function ( ) {
290
293
return new UICompBuilder ( childrenMap , ( props , dispatch ) => {
294
+
295
+ const theme = useContext ( ThemeContext ) ;
296
+ const compType = useContext ( CompTypeContext ) ;
297
+ const compTheme = theme ?. theme ?. components ?. [ compType ] ;
298
+ const styleProps : Record < string , any > = { } ;
299
+ [ 'style' , 'headerStyle' , 'bodyStyle' , 'animationStyle' ] . forEach ( ( key : string ) => {
300
+ styleProps [ key ] = ( props as any ) [ key ] ;
301
+ } ) ;
302
+
303
+ useEffect ( ( ) => {
304
+ setInitialCompStyles ( {
305
+ dispatch,
306
+ compTheme,
307
+ styleProps,
308
+ } ) ;
309
+ } , [ ] ) ;
310
+
291
311
return (
292
312
< DisabledContext . Provider value = { props . disabled } >
293
313
< TabbedContainer { ...props } dispatch = { dispatch } />
0 commit comments