@@ -7,7 +7,7 @@ import { BooleanStateControl, booleanExposingStateControl, stringExposingStateCo
7
7
import { eventHandlerControl } from "comps/controls/eventHandlerControl" ;
8
8
import { TabsOptionControl } from "comps/controls/optionsControl" ;
9
9
import { styleControl } from "comps/controls/styleControl" ;
10
- import { TabContainerStyle , TabContainerStyleType , heightCalculator , widthCalculator } from "comps/controls/styleControlConstants" ;
10
+ import { ContainerBodyStyle , ContainerBodyStyleType , ContainerHeaderStyle , ContainerHeaderStyleType , TabContainerStyle , TabContainerStyleType , heightCalculator , widthCalculator } from "comps/controls/styleControlConstants" ;
11
11
import { sameTypeMap , UICompBuilder , withDefault } from "comps/generators" ;
12
12
import { addMapChildAction } from "comps/generators/sameTypeMap" ;
13
13
import { NameConfig , NameConfigHidden , withExposingConfigs } from "comps/generators/withExposing" ;
@@ -33,9 +33,6 @@ import { DisabledContext } from "comps/generators/uiCompBuilder";
33
33
import { EditorContext } from "comps/editorState" ;
34
34
import { checkIsMobile } from "util/commonUtils" ;
35
35
import { messageInstance } from "lowcoder-design" ;
36
- import { show } from "antd-mobile/es/components/dialog/show" ;
37
- import { BoolControl } from "@lowcoder-ee/index.sdk" ;
38
- import { Switch } from "antd" ;
39
36
40
37
const EVENT_OPTIONS = [
41
38
{
@@ -57,38 +54,52 @@ const childrenMap = {
57
54
disabled : BoolCodeControl ,
58
55
showHeader : withDefault ( BooleanStateControl , "true" ) ,
59
56
style : styleControl ( TabContainerStyle ) ,
57
+ headerStyle : styleControl ( ContainerHeaderStyle ) ,
58
+ bodyStyle : styleControl ( ContainerBodyStyle ) ,
60
59
} ;
61
60
62
61
type ViewProps = RecordConstructorToView < typeof childrenMap > ;
63
62
type TabbedContainerProps = ViewProps & { dispatch : DispatchType } ;
64
63
65
- const getStyle = ( style : TabContainerStyleType ) => {
64
+ const getStyle = (
65
+ style : TabContainerStyleType ,
66
+ headerStyle : ContainerHeaderStyleType ,
67
+ bodyStyle : ContainerBodyStyleType ,
68
+ ) => {
66
69
return css `
67
70
& .ant-tabs {
71
+ overflow : hidden;
68
72
border : ${ style . borderWidth } solid ${ style . border } ;
69
73
border-radius : ${ style . radius } ;
70
- overflow : hidden;
71
74
padding : ${ style . padding } ;
75
+ background-color : ${ style . background } ;
76
+ background-image : ${ style . backgroundImage } ;
77
+ background-repeat : ${ style . backgroundImageRepeat } ;
78
+ background-size : ${ style . backgroundImageSize } ;
79
+ background-position : ${ style . backgroundImagePosition } ;
80
+ background-origin : ${ style . backgroundImageOrigin } ;
81
+
82
+ > .ant-tabs-content-holder > .ant-tabs-content > .ant-tabs-tabpane {
83
+ height : 100% ;
84
+ .react-grid-layout {
85
+ border-radius : 0 ;
86
+ background-color : ${ bodyStyle . background || 'transparent' } ;
87
+ background-image : ${ bodyStyle . backgroundImage } ;
88
+ background-repeat : ${ bodyStyle . backgroundImageRepeat } ;
89
+ background-size : ${ bodyStyle . backgroundImageSize } ;
90
+ background-position : ${ bodyStyle . backgroundImagePosition } ;
91
+ background-origin : ${ bodyStyle . backgroundImageOrigin } ;
72
92
73
- > .ant-tabs-content-holder > .ant-tabs-content > div > .react-grid-layout {
74
- background-color : ${ style . background } ;
75
- border-radius : 0 ;
76
-
77
- background-image : ${ style . backgroundImage } ;
78
- background-repeat : ${ style . backgroundImageRepeat } ;
79
- background-size : ${ style . backgroundImageSize } ;
80
- background-position : ${ style . backgroundImagePosition } ;
81
- background-origin : ${ style . backgroundImageOrigin } ;
82
-
93
+ }
83
94
}
84
95
85
96
> .ant-tabs-nav {
86
- background-color : ${ style . headerBackground } ;
87
- background-image : ${ style . headerBackgroundImage } ;
88
- background-repeat : ${ style . headerBackgroundImageRepeat } ;
89
- background-size : ${ style . headerBackgroundImageSize } ;
90
- background-position : ${ style . headerBackgroundImagePosition } ;
91
- background-origin : ${ style . headerBackgroundImageOrigin } ;
97
+ background-color : ${ headerStyle . headerBackground || 'transparent' } ;
98
+ background-image : ${ headerStyle . headerBackgroundImage } ;
99
+ background-repeat : ${ headerStyle . headerBackgroundImageRepeat } ;
100
+ background-size : ${ headerStyle . headerBackgroundImageSize } ;
101
+ background-position : ${ headerStyle . headerBackgroundImagePosition } ;
102
+ background-origin : ${ headerStyle . headerBackgroundImageOrigin } ;
92
103
93
104
.ant-tabs-tab {
94
105
div {
@@ -113,7 +124,9 @@ const getStyle = (style: TabContainerStyleType) => {
113
124
} ;
114
125
115
126
const StyledTabs = styled ( Tabs ) < {
116
- $style : TabContainerStyleType ;
127
+ $style : TabContainerStyleType ;
128
+ $headerStyle : ContainerHeaderStyleType ;
129
+ $bodyStyle : ContainerBodyStyleType ;
117
130
$isMobile ?: boolean ;
118
131
$showHeader ?: boolean ;
119
132
} > `
@@ -145,7 +158,11 @@ const StyledTabs = styled(Tabs)<{
145
158
margin-right: -24px;
146
159
}
147
160
148
- ${ ( props ) => props . $style && getStyle ( props . $style ) }
161
+ ${ ( props ) => props . $style && getStyle (
162
+ props . $style ,
163
+ props . $headerStyle ,
164
+ props . $bodyStyle ,
165
+ ) }
149
166
` ;
150
167
151
168
const ContainerInTab = ( props : ContainerBaseProps ) => {
@@ -155,7 +172,14 @@ const ContainerInTab = (props: ContainerBaseProps) => {
155
172
} ;
156
173
157
174
const TabbedContainer = ( props : TabbedContainerProps ) => {
158
- let { tabs, containers, dispatch, style } = props ;
175
+ let {
176
+ tabs,
177
+ containers,
178
+ dispatch,
179
+ style,
180
+ headerStyle,
181
+ bodyStyle,
182
+ } = props ;
159
183
160
184
const visibleTabs = tabs . filter ( ( tab ) => ! tab . hidden ) ;
161
185
const selectedTab = visibleTabs . find ( ( tab ) => tab . key === props . selectedTabKey . value ) ;
@@ -203,7 +227,7 @@ const TabbedContainer = (props: TabbedContainerProps) => {
203
227
key : tab . key ,
204
228
forceRender : true ,
205
229
children : (
206
- < BackgroundColorContext . Provider value = { props . style . background } >
230
+ < BackgroundColorContext . Provider value = { bodyStyle . background } >
207
231
< ContainerInTab
208
232
layout = { containerProps . layout . getView ( ) }
209
233
items = { gridItemCompToGridItems ( containerProps . items . getView ( ) ) }
@@ -222,6 +246,8 @@ const TabbedContainer = (props: TabbedContainerProps) => {
222
246
< StyledTabs
223
247
activeKey = { activeKey }
224
248
$style = { style }
249
+ $headerStyle = { headerStyle }
250
+ $bodyStyle = { bodyStyle }
225
251
$showHeader = { showHeader }
226
252
onChange = { ( key ) => {
227
253
if ( key !== props . selectedTabKey . value ) {
@@ -277,6 +303,14 @@ export const TabbedContainerBaseComp = (function () {
277
303
< Section name = { sectionNames . style } >
278
304
{ children . style . getPropertyView ( ) }
279
305
</ Section >
306
+ { children . showHeader . getView ( ) && (
307
+ < Section name = { "Header Style" } >
308
+ { children . headerStyle . getPropertyView ( ) }
309
+ </ Section >
310
+ ) }
311
+ < Section name = { "Body Style" } >
312
+ { children . bodyStyle . getPropertyView ( ) }
313
+ </ Section >
280
314
</ >
281
315
) }
282
316
</ >
0 commit comments