@@ -3,42 +3,39 @@ import {
3
3
ContainerStyleType ,
4
4
heightCalculator ,
5
5
widthCalculator ,
6
- ContainerHeaderStyleType ,
7
- ContainerBodyStyleType ,
8
6
AnimationStyleType ,
9
- } from ' comps/controls/styleControlConstants' ;
10
- import { EditorContext } from ' comps/editorState' ;
11
- import { BackgroundColorContext } from ' comps/utils/backgroundColorContext' ;
12
- import { HintPlaceHolder , TacoMarkDown } from ' lowcoder-design' ;
13
- import { ReactNode , useContext } from ' react' ;
14
- import styled , { css } from ' styled-components' ;
15
- import { checkIsMobile } from ' util/commonUtils' ;
7
+ } from " comps/controls/styleControlConstants" ;
8
+ import { EditorContext } from " comps/editorState" ;
9
+ import { BackgroundColorContext } from " comps/utils/backgroundColorContext" ;
10
+ import { HintPlaceHolder , TacoMarkDown } from " lowcoder-design" ;
11
+ import { ReactNode , useContext } from " react" ;
12
+ import styled , { css } from " styled-components" ;
13
+ import { checkIsMobile } from " util/commonUtils" ;
16
14
import {
17
15
gridItemCompToGridItems ,
18
16
InnerGrid ,
19
- } from ' ../containerComp/containerView' ;
20
- import { TriContainerViewProps } from ' ../triContainerComp/triContainerCompBuilder' ;
17
+ } from " ../containerComp/containerView" ;
18
+ import { TriContainerViewProps } from " ../triContainerComp/triContainerCompBuilder" ;
21
19
22
20
const getStyle = ( style : TextStyleType ) => {
23
21
return css `
24
- border-radius : ${ style . radius ? style . radius : '4px' } ;
25
- border : ${ style . borderWidth ? style . borderWidth : '0px' } solid
26
- ${ style . border } ;
22
+ border-radius : ${ ( style . radius ? style . radius : "4px" ) } ;
23
+ border : ${ ( style . borderWidth ? style . borderWidth : "0px" ) } solid ${ style . border } ;
27
24
color : ${ style . text } ;
28
25
font-size : ${ style . textSize } !important ;
29
26
font-weight : ${ style . textWeight } !important ;
30
27
font-family : ${ style . fontFamily } !important ;
31
- font-style : ${ style . fontStyle } !important ;
32
- text-transform : ${ style . textTransform } !important ;
33
- text-decoration : ${ style . textDecoration } !important ;
28
+ font-style : ${ style . fontStyle } !important ;
29
+ text-transform : ${ style . textTransform } !important ;
30
+ text-decoration : ${ style . textDecoration } !important ;
34
31
background-color : ${ style . background } ;
35
32
.markdown-body a {
36
33
color : ${ style . links } ;
37
34
}
38
35
.markdown-body {
39
- margin : ${ style . margin } !important ;
40
- padding : ${ style . padding } ;
41
- width : ${ widthCalculator ( style . margin ) } ;
36
+ margin : ${ style . margin } !important ;
37
+ padding : ${ style . padding } ;
38
+ width : ${ widthCalculator ( style . margin ) } ;
42
39
// height: ${ heightCalculator ( style . margin ) } ;
43
40
h1 {
44
41
line-height : 1.5 ;
@@ -69,23 +66,22 @@ const getStyle = (style: TextStyleType) => {
69
66
}
70
67
}
71
68
` ;
72
- } ;
69
+ }
73
70
74
71
const Wrapper = styled . div < {
75
72
$style : ContainerStyleType ;
76
- $animationStyle : AnimationStyleType ;
73
+ $animationStyle ? : AnimationStyleType ;
77
74
} > `
75
+ ${ props => props . $animationStyle && props . $animationStyle }
78
76
display: flex;
79
77
flex-flow: column;
80
78
height: 100%;
81
- ${ ( props ) => props . $animationStyle }
82
79
border: ${ ( props ) => props . $style . borderWidth } solid
83
80
${ ( props ) => props . $style . border } ;
84
81
border-radius: ${ ( props ) => props . $style . radius } ;
85
82
background-color: ${ ( props ) => props . $style . background } ;
86
83
padding: ${ ( props ) => props . $style . padding } ;
87
84
margin: ${ ( props ) => props . $style . margin } ;
88
- rotate: ${ ( props ) => props . $style . rotation } ;
89
85
${ ( props ) =>
90
86
props . $style . backgroundImage &&
91
87
`background-image: url(${ props . $style . backgroundImage } );` }
@@ -114,15 +110,10 @@ const FloatTextWrapper = styled.div<{
114
110
` ;
115
111
116
112
const HeaderInnerGrid = styled ( InnerGrid ) < {
117
- $backgroundColor : string ;
118
- $headerStyle : ContainerHeaderStyleType ;
119
- } > `
113
+ $backgroundColor : string
114
+ } > `
120
115
overflow: visible;
121
- rotate:${ ( props ) => {
122
- return `${ props . $headerStyle . rotation } ;` ;
123
- } }
124
- ${ ( props ) =>
125
- props . $backgroundColor && `background-color: ${ props . $backgroundColor } ;` }
116
+ ${ ( props ) => props . $backgroundColor && `background-color: ${ props . $backgroundColor } ;` }
126
117
border-radius: 0;
127
118
` ;
128
119
@@ -131,16 +122,10 @@ const BodyInnerGrid = styled(InnerGrid)<{
131
122
$backgroundColor : string ;
132
123
$borderColor : string ;
133
124
$borderWidth : string ;
134
- $bodyStyle : ContainerBodyStyleType ;
135
125
} > `
136
- rotate: ${ ( props ) => {
137
- return `${ props . $bodyStyle . rotation } ` ;
138
- } } ;
139
- border-top: ${ ( props ) =>
140
- `${ props . $showBorder ? props . $borderWidth : 0 } solid ${ props . $borderColor } ` } ;
126
+ border-top: ${ ( props ) => `${ props . $showBorder ? props . $borderWidth : 0 } solid ${ props . $borderColor } ` } ;
141
127
flex: 1;
142
- ${ ( props ) =>
143
- props . $backgroundColor && `background-color: ${ props . $backgroundColor } ;` }
128
+ ${ ( props ) => props . $backgroundColor && `background-color: ${ props . $backgroundColor } ;` }
144
129
border-radius: 0;
145
130
` ;
146
131
@@ -155,27 +140,15 @@ const FooterInnerGrid = styled(InnerGrid)<{
155
140
$footerBackgroundImagePosition : string ;
156
141
$footerBackgroundImageOrigin : string ;
157
142
} > `
158
- border-top: ${ ( props ) =>
159
- `${ props . $showBorder ? props . $borderWidth : 0 } solid ${ props . $borderColor } ` } ;
143
+ border-top: ${ ( props ) => `${ props . $showBorder ? props . $borderWidth : 0 } solid ${ props . $borderColor } ` } ;
160
144
overflow: visible;
161
- ${ ( props ) =>
162
- props . $backgroundColor && `background-color: ${ props . $backgroundColor } ;` }
145
+ ${ ( props ) => props . $backgroundColor && `background-color: ${ props . $backgroundColor } ;` }
163
146
border-radius: 0;
164
- ${ ( props ) =>
165
- props . $footerBackgroundImage &&
166
- `background-image: url(${ props . $footerBackgroundImage } );` }
167
- ${ ( props ) =>
168
- props . $footerBackgroundImageRepeat &&
169
- `background-repeat: ${ props . $footerBackgroundImageRepeat } ;` }
170
- ${ ( props ) =>
171
- props . $footerBackgroundImageSize &&
172
- `background-size: ${ props . $footerBackgroundImageSize } ;` }
173
- ${ ( props ) =>
174
- props . $footerBackgroundImagePosition &&
175
- `background-position: ${ props . $footerBackgroundImagePosition } ;` }
176
- ${ ( props ) =>
177
- props . $footerBackgroundImageOrigin &&
178
- `background-origin: ${ props . $footerBackgroundImageOrigin } ;` }
147
+ ${ ( props ) => props . $footerBackgroundImage && `background-image: url(${ props . $footerBackgroundImage } );` }
148
+ ${ ( props ) => props . $footerBackgroundImageRepeat && `background-repeat: ${ props . $footerBackgroundImageRepeat } ;` }
149
+ ${ ( props ) => props . $footerBackgroundImageSize && `background-size: ${ props . $footerBackgroundImageSize } ;` }
150
+ ${ ( props ) => props . $footerBackgroundImagePosition && `background-position: ${ props . $footerBackgroundImagePosition } ;` }
151
+ ${ ( props ) => props . $footerBackgroundImageOrigin && `background-origin: ${ props . $footerBackgroundImageOrigin } ;` }
179
152
` ;
180
153
181
154
export type TriContainerProps = TriContainerViewProps & {
@@ -188,26 +161,31 @@ export type TriContainerProps = TriContainerViewProps & {
188
161
width : string ;
189
162
style : TextStyleType ;
190
163
horizontalAlignment : string ;
191
- animationStyle : AnimationStyleType ;
164
+ animationStyle ? : AnimationStyleType ;
192
165
} ;
193
166
194
167
export function TriContainer ( props : TriContainerProps ) {
195
168
const { container, text, animationStyle} = props ;
196
- const { showHeader, showFooter} = container ;
169
+ const { showHeader, showFooter } = container ;
197
170
// When the header and footer are not displayed, the body must be displayed
198
171
const showBody = container . showBody || ( ! showHeader && ! showFooter ) ;
199
172
200
- const { items : headerItems , ...otherHeaderProps } = container . header ;
201
- const { items : bodyItems , ...otherBodyProps } =
202
- container . body [ '0' ] . children . view . getView ( ) ;
203
- const { items : footerItems , ...otherFooterProps } = container . footer ;
173
+ const { items : headerItems , ...otherHeaderProps } = container . header ;
174
+ const { items : bodyItems , ...otherBodyProps } =
175
+ container . body [ "0" ] . children . view . getView ( ) ;
176
+ const { items : footerItems , ...otherFooterProps } = container . footer ;
204
177
205
178
const editorState = useContext ( EditorContext ) ;
206
179
const maxWidth = editorState . getAppSettings ( ) . maxWidth ;
207
180
const isMobile = checkIsMobile ( maxWidth ) ;
208
181
const paddingWidth = isMobile ? 7 : 19 ;
209
182
210
- const { style, headerStyle, bodyStyle, footerStyle} = container ;
183
+ const {
184
+ style,
185
+ headerStyle,
186
+ bodyStyle,
187
+ footerStyle,
188
+ } = container ;
211
189
212
190
return (
213
191
< Wrapper $style = { style } $animationStyle = { animationStyle } >
@@ -221,7 +199,6 @@ export function TriContainer(props: TriContainerProps) {
221
199
minHeight = "46px"
222
200
containerPadding = { [ 0 , 0 ] }
223
201
showName = { { bottom : showFooter ? 20 : 0 } }
224
- $headerStyle = { headerStyle }
225
202
$backgroundColor = { headerStyle ?. headerBackground || 'transparent' }
226
203
style = { { padding : headerStyle . containerHeaderPadding } }
227
204
/>
@@ -236,7 +213,6 @@ export function TriContainer(props: TriContainerProps) {
236
213
} }
237
214
>
238
215
< BodyInnerGrid
239
- $bodyStyle = { bodyStyle }
240
216
$showBorder = { false }
241
217
{ ...otherBodyProps }
242
218
items = { gridItemCompToGridItems ( bodyItems ) }
0 commit comments