1
- import { dropdownControl } from 'comps/controls/dropdownControl' ;
2
- import { stringExposingStateControl } from 'comps/controls/codeStateControl' ;
3
- import { AutoHeightControl } from 'comps/controls/autoHeightControl' ;
4
- import { Section , sectionNames } from 'lowcoder-design' ;
5
- import styled , { css } from 'styled-components' ;
6
- import { AlignCenter } from 'lowcoder-design' ;
7
- import { AlignLeft } from 'lowcoder-design' ;
8
- import { AlignRight } from 'lowcoder-design' ;
9
- import { UICompBuilder } from '../generators' ;
10
- import {
11
- NameConfig ,
12
- NameConfigHidden ,
13
- withExposingConfigs ,
14
- } from '../generators/withExposing' ;
15
- import { markdownCompCss , TacoMarkDown } from 'lowcoder-design' ;
16
- import { styleControl } from 'comps/controls/styleControl' ;
17
- import {
18
- AnimationStyle ,
19
- AnimationStyleType ,
20
- TextStyle ,
21
- TextStyleType ,
22
- heightCalculator ,
23
- widthCalculator ,
24
- } from 'comps/controls/styleControlConstants' ;
25
- import { hiddenPropertyView } from 'comps/utils/propertyUtils' ;
26
- import { trans } from 'i18n' ;
27
- import { alignWithJustifyControl } from 'comps/controls/alignControl' ;
1
+ import { dropdownControl } from "comps/controls/dropdownControl" ;
2
+ import { stringExposingStateControl } from "comps/controls/codeStateControl" ;
3
+ import { AutoHeightControl } from "comps/controls/autoHeightControl" ;
4
+ import { Section , sectionNames } from "lowcoder-design" ;
5
+ import styled , { css } from "styled-components" ;
6
+ import { AlignCenter } from "lowcoder-design" ;
7
+ import { AlignLeft } from "lowcoder-design" ;
8
+ import { AlignRight } from "lowcoder-design" ;
9
+ import { UICompBuilder } from "../generators" ;
10
+ import { NameConfig , NameConfigHidden , withExposingConfigs } from "../generators/withExposing" ;
11
+ import { markdownCompCss , TacoMarkDown } from "lowcoder-design" ;
12
+ import { styleControl } from "comps/controls/styleControl" ;
13
+ import { AnimationStyle , AnimationStyleType , TextStyle , TextStyleType , heightCalculator , widthCalculator } from "comps/controls/styleControlConstants" ;
14
+ import { hiddenPropertyView } from "comps/utils/propertyUtils" ;
15
+ import { trans } from "i18n" ;
16
+ import { alignWithJustifyControl } from "comps/controls/alignControl" ;
28
17
29
- import { MarginControl } from ' ../controls/marginControl' ;
30
- import { PaddingControl } from ' ../controls/paddingControl' ;
18
+ import { MarginControl } from " ../controls/marginControl" ;
19
+ import { PaddingControl } from " ../controls/paddingControl" ;
31
20
32
- import React , { useContext } from ' react' ;
33
- import { EditorContext } from ' comps/editorState' ;
21
+ import React , { useContext } from " react" ;
22
+ import { EditorContext } from " comps/editorState" ;
34
23
35
24
const getStyle = ( style : TextStyleType ) => {
36
25
return css `
37
- border-radius : ${ style . radius ? style . radius : '4px' } ;
38
- border : ${ style . borderWidth ? style . borderWidth : '0px' } solid
39
- ${ style . border } ;
26
+ border-radius : ${ ( style . radius ? style . radius : "4px" ) } ;
27
+ border : ${ ( style . borderWidth ? style . borderWidth : "0px" ) } solid ${ style . border } ;
40
28
color : ${ style . text } ;
41
29
font-size : ${ style . textSize } !important ;
42
30
font-weight : ${ style . textWeight } !important ;
43
31
font-family : ${ style . fontFamily } !important ;
44
- font-style : ${ style . fontStyle } !important ;
45
- text-transform : ${ style . textTransform } !important ;
46
- text-decoration : ${ style . textDecoration } !important ;
32
+ font-style : ${ style . fontStyle } !important ;
33
+ text-transform : ${ style . textTransform } !important ;
34
+ text-decoration : ${ style . textDecoration } !important ;
47
35
background-color : ${ style . background } ;
48
36
.markdown-body a {
49
37
color : ${ style . links } ;
50
38
}
51
39
.markdown-body {
52
- margin : ${ style . margin } !important ;
53
- padding : ${ style . padding } ;
54
- width : ${ widthCalculator ( style . margin ) } ;
40
+ margin : ${ style . margin } !important ;
41
+ padding : ${ style . padding } ;
42
+ width : ${ widthCalculator ( style . margin ) } ;
55
43
// height: ${ heightCalculator ( style . margin ) } ;
56
44
h1 {
57
45
line-height : 1.5 ;
@@ -87,12 +75,12 @@ const getStyle = (style: TextStyleType) => {
87
75
const TextContainer = styled . div < {
88
76
$type : string ;
89
77
$styleConfig : TextStyleType ;
90
- $animationStyle : AnimationStyleType ;
78
+ $animationStyle :AnimationStyleType ;
91
79
} > `
92
80
height: 100%;
93
81
overflow: auto;
94
82
margin: 0;
95
- ${ ( props ) => props . $animationStyle }
83
+ ${ props => props . $animationStyle }
96
84
${ ( props ) =>
97
85
props . $type === 'text' && 'white-space:break-spaces;line-height: 1.9;' } ;
98
86
${ ( props ) => props . $styleConfig && getStyle ( props . $styleConfig ) }
@@ -116,21 +104,23 @@ const AlignVerticalCenter = styled(AlignCenter)`
116
104
117
105
const typeOptions = [
118
106
{
119
- label : ' Markdown' ,
120
- value : ' markdown' ,
107
+ label : " Markdown" ,
108
+ value : " markdown" ,
121
109
} ,
122
110
{
123
- label : trans ( ' text' ) ,
124
- value : ' text' ,
111
+ label : trans ( " text" ) ,
112
+ value : " text" ,
125
113
} ,
126
114
] as const ;
127
115
const VerticalAlignmentOptions = [
128
- { label : < AlignTop /> , value : ' flex-start' } ,
129
- { label : < AlignVerticalCenter /> , value : ' center' } ,
130
- { label : < AlignBottom /> , value : ' flex-end' } ,
116
+ { label : < AlignTop /> , value : " flex-start" } ,
117
+ { label : < AlignVerticalCenter /> , value : " center" } ,
118
+ { label : < AlignBottom /> , value : " flex-end" } ,
131
119
] as const ;
132
120
121
+
133
122
let TextTmpComp = ( function ( ) {
123
+
134
124
const childrenMap = {
135
125
text : stringExposingStateControl (
136
126
'text' ,
@@ -171,34 +161,30 @@ let TextTmpComp = (function () {
171
161
< >
172
162
< Section name = { sectionNames . basic } >
173
163
{ children . type . propertyView ( {
174
- label : trans ( ' value' ) ,
175
- tooltip : trans ( ' textShow.valueTooltip' ) ,
164
+ label : trans ( " value" ) ,
165
+ tooltip : trans ( " textShow.valueTooltip" ) ,
176
166
radioButton : true ,
177
167
} ) }
178
168
{ children . text . propertyView ( { } ) }
179
169
</ Section >
180
170
181
- { [ 'logic' , 'both' ] . includes (
182
- useContext ( EditorContext ) . editorModeStatus
183
- ) && (
171
+ { [ "logic" , "both" ] . includes ( useContext ( EditorContext ) . editorModeStatus ) && (
184
172
< Section name = { sectionNames . interaction } >
185
173
{ hiddenPropertyView ( children ) }
186
174
</ Section >
187
175
) }
188
176
189
- { [ 'layout' , 'both' ] . includes (
190
- useContext ( EditorContext ) . editorModeStatus
191
- ) && (
177
+ { [ "layout" , "both" ] . includes ( useContext ( EditorContext ) . editorModeStatus ) && (
192
178
< >
193
179
< Section name = { sectionNames . layout } >
194
180
{ children . autoHeight . getPropertyView ( ) }
195
181
{ ! children . autoHeight . getView ( ) &&
196
182
children . verticalAlignment . propertyView ( {
197
- label : trans ( ' textShow.verticalAlignment' ) ,
183
+ label : trans ( " textShow.verticalAlignment" ) ,
198
184
radioButton : true ,
199
185
} ) }
200
186
{ children . horizontalAlignment . propertyView ( {
201
- label : trans ( ' textShow.horizontalAlignment' ) ,
187
+ label : trans ( " textShow.horizontalAlignment" ) ,
202
188
radioButton : true ,
203
189
} ) }
204
190
</ Section >
@@ -223,6 +209,6 @@ TextTmpComp = class extends TextTmpComp {
223
209
} ;
224
210
225
211
export const TextComp = withExposingConfigs ( TextTmpComp , [
226
- new NameConfig ( ' text' , trans ( ' textShow.textDesc' ) ) ,
212
+ new NameConfig ( " text" , trans ( " textShow.textDesc" ) ) ,
227
213
NameConfigHidden ,
228
214
] ) ;
0 commit comments