@@ -3,7 +3,7 @@ import { JSONObject, JSONValue } from "util/jsonTypes";
3
3
import { CompAction , CompActionTypes , deleteCompAction , wrapChildAction } from "lowcoder-core" ;
4
4
import { DispatchType , RecordConstructorToView , wrapDispatch } from "lowcoder-core" ;
5
5
import { AutoHeightControl } from "comps/controls/autoHeightControl" ;
6
- import { stringExposingStateControl } from "comps/controls/codeStateControl" ;
6
+ import { BooleanStateControl , booleanExposingStateControl , stringExposingStateControl } from "comps/controls/codeStateControl" ;
7
7
import { eventHandlerControl } from "comps/controls/eventHandlerControl" ;
8
8
import { TabsOptionControl } from "comps/controls/optionsControl" ;
9
9
import { styleControl } from "comps/controls/styleControl" ;
@@ -12,7 +12,7 @@ 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" ;
14
14
import { NameGenerator } from "comps/utils" ;
15
- import { Section , sectionNames } from "lowcoder-design" ;
15
+ import { ControlNode , Section , sectionNames } from "lowcoder-design" ;
16
16
import { HintPlaceHolder } from "lowcoder-design" ;
17
17
import _ from "lodash" ;
18
18
import React , { useCallback , useContext } from "react" ;
@@ -33,6 +33,9 @@ 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" ;
36
39
37
40
const EVENT_OPTIONS = [
38
41
{
@@ -52,27 +55,40 @@ const childrenMap = {
52
55
autoHeight : AutoHeightControl ,
53
56
onEvent : eventHandlerControl ( EVENT_OPTIONS ) ,
54
57
disabled : BoolCodeControl ,
58
+ showHeader : BooleanStateControl ,
55
59
style : styleControl ( TabContainerStyle ) ,
56
60
} ;
57
61
58
62
type ViewProps = RecordConstructorToView < typeof childrenMap > ;
59
63
type TabbedContainerProps = ViewProps & { dispatch : DispatchType } ;
60
-
64
+
61
65
const getStyle = ( style : TabContainerStyleType ) => {
62
66
return css `
63
67
& .ant-tabs {
64
- border : 1 px solid ${ style . border } ;
68
+ border : ${ style . borderWidth } solid ${ style . border } ;
65
69
border-radius : ${ style . radius } ;
66
70
overflow : hidden;
67
- padding : ${ style . padding } ;
71
+ padding : ${ style . padding } ;
68
72
69
73
> .ant-tabs-content-holder > .ant-tabs-content > div > .react-grid-layout {
70
74
background-color : ${ style . background } ;
71
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
+
72
83
}
73
84
74
85
> .ant-tabs-nav {
75
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 } ;
76
92
77
93
.ant-tabs-tab {
78
94
div {
@@ -96,7 +112,11 @@ const getStyle = (style: TabContainerStyleType) => {
96
112
` ;
97
113
} ;
98
114
99
- const StyledTabs = styled ( Tabs ) < { $style : TabContainerStyleType ; $isMobile ?: boolean } > `
115
+ const StyledTabs = styled ( Tabs ) < {
116
+ $style : TabContainerStyleType ;
117
+ $isMobile ?: boolean ;
118
+ $showHeader ?: boolean ;
119
+ } > `
100
120
&.ant-tabs {
101
121
height: 100%;
102
122
}
@@ -111,6 +131,7 @@ const StyledTabs = styled(Tabs)<{ $style: TabContainerStyleType; $isMobile?: boo
111
131
}
112
132
113
133
.ant-tabs-nav {
134
+ display: ${ ( props ) => ( props . $showHeader ? "block" : "none" ) } ;
114
135
padding: 0 ${ ( props ) => ( props . $isMobile ? 16 : 24 ) } px;
115
136
background: white;
116
137
margin: 0px;
@@ -158,12 +179,10 @@ const TabbedContainer = (props: TabbedContainerProps) => {
158
179
const editorState = useContext ( EditorContext ) ;
159
180
const maxWidth = editorState . getAppSettings ( ) . maxWidth ;
160
181
const isMobile = checkIsMobile ( maxWidth ) ;
161
- const paddingWidth = isMobile ? 8 : 20 ;
162
-
163
- // log.debug("TabbedContainer. props: ", props);
182
+ const showHeader = props . showHeader . value ;
183
+ const paddingWidth = isMobile ? 8 : 0 ;
164
184
165
185
const tabItems = visibleTabs . map ( ( tab ) => {
166
- // log.debug("Tab. tab: ", tab, " containers: ", containers);
167
186
const id = String ( tab . id ) ;
168
187
const childDispatch = wrapDispatch ( wrapDispatch ( dispatch , "containers" ) , id ) ;
169
188
const containerProps = containers [ id ] . children ;
@@ -203,6 +222,7 @@ const TabbedContainer = (props: TabbedContainerProps) => {
203
222
< StyledTabs
204
223
activeKey = { activeKey }
205
224
$style = { style }
225
+ $showHeader = { showHeader }
206
226
onChange = { ( key ) => {
207
227
if ( key !== props . selectedTabKey . value ) {
208
228
props . selectedTabKey . onChange ( key ) ;
@@ -220,6 +240,7 @@ const TabbedContainer = (props: TabbedContainerProps) => {
220
240
) ;
221
241
} ;
222
242
243
+
223
244
export const TabbedContainerBaseComp = ( function ( ) {
224
245
return new UICompBuilder ( childrenMap , ( props , dispatch ) => {
225
246
return (
@@ -238,11 +259,12 @@ export const TabbedContainerBaseComp = (function () {
238
259
} ) }
239
260
{ children . selectedTabKey . propertyView ( { label : trans ( "prop.defaultValue" ) } ) }
240
261
</ Section >
241
-
262
+
242
263
{ [ "logic" , "both" ] . includes ( useContext ( EditorContext ) . editorModeStatus ) && (
243
264
< Section name = { sectionNames . interaction } >
244
265
{ children . onEvent . getPropertyView ( ) }
245
266
{ disabledPropertyView ( children ) }
267
+ { children . showHeader . propertyView ( { label : trans ( "prop.showHeader" ) } ) }
246
268
{ hiddenPropertyView ( children ) }
247
269
</ Section >
248
270
) }
@@ -364,6 +386,8 @@ class TabbedContainerImplComp extends TabbedContainerBaseComp implements IContai
364
386
override autoHeight ( ) : boolean {
365
387
return this . children . autoHeight . getView ( ) ;
366
388
}
389
+
390
+
367
391
}
368
392
369
393
export const TabbedContainerComp = withExposingConfigs ( TabbedContainerImplComp , [
0 commit comments