1
- import { BoolCodeControl , StringControl } from ' comps/controls/codeControl' ;
2
- import { stringExposingStateControl } from ' comps/controls/codeStateControl' ;
3
- import { ToDataType } from ' comps/generators/multi' ;
1
+ import { BoolCodeControl , StringControl } from " comps/controls/codeControl" ;
2
+ import { stringExposingStateControl } from " comps/controls/codeStateControl" ;
3
+ import { ToDataType } from " comps/generators/multi" ;
4
4
import {
5
5
NameConfigHidden ,
6
6
withExposingConfigs ,
7
- } from ' comps/generators/withExposing' ;
8
- import { NameGenerator } from ' comps/utils/nameGenerator' ;
9
- import { hiddenPropertyView } from ' comps/utils/propertyUtils' ;
10
- import { trans } from ' i18n' ;
11
- import { CompParams } from ' lowcoder-core' ;
12
- import { Section , sectionNames } from ' lowcoder-design' ;
13
- import { oldContainerParamsToNew } from ' ../containerBase' ;
14
- import { toSimpleContainerData } from ' ../containerBase/simpleContainerComp' ;
7
+ } from " comps/generators/withExposing" ;
8
+ import { NameGenerator } from " comps/utils/nameGenerator" ;
9
+ import { hiddenPropertyView } from " comps/utils/propertyUtils" ;
10
+ import { trans } from " i18n" ;
11
+ import { CompParams } from " lowcoder-core" ;
12
+ import { Section , sectionNames } from " lowcoder-design" ;
13
+ import { oldContainerParamsToNew } from " ../containerBase" ;
14
+ import { toSimpleContainerData } from " ../containerBase/simpleContainerComp" ;
15
15
import {
16
16
ContainerChildren ,
17
17
ContainerCompBuilder ,
18
- } from ' ../triContainerComp/triContainerCompBuilder' ;
19
- import { TriContainer } from ' ../triContainerComp/triFloatTextContainer' ;
20
- import { dropdownControl } from ' comps/controls/dropdownControl' ;
21
- import { withDefault } from ' comps/generators/simpleGenerators' ;
22
- import { styleControl } from ' comps/controls/styleControl' ;
23
- import { AnimationStyle , TextStyle } from ' comps/controls/styleControlConstants' ;
24
- import { useContext } from ' react' ;
25
- import { EditorContext } from ' comps/editorState' ;
26
- import { alignWithJustifyControl } from ' comps/controls/alignControl' ;
18
+ } from " ../triContainerComp/triContainerCompBuilder" ;
19
+ import { TriContainer } from " ../triContainerComp/triFloatTextContainer" ;
20
+ import { dropdownControl } from " comps/controls/dropdownControl" ;
21
+ import { withDefault } from " comps/generators/simpleGenerators" ;
22
+ import { styleControl } from " comps/controls/styleControl" ;
23
+ import { AnimationStyle , TextStyle } from " comps/controls/styleControlConstants" ;
24
+ import { useContext } from " react" ;
25
+ import { EditorContext } from " comps/editorState" ;
26
+ import { alignWithJustifyControl } from " comps/controls/alignControl" ;
27
27
28
28
const typeOptions = [
29
29
{
30
- label : ' Markdown' ,
31
- value : ' markdown' ,
30
+ label : " Markdown" ,
31
+ value : " markdown" ,
32
32
} ,
33
33
{
34
- label : trans ( ' text' ) ,
35
- value : ' text' ,
34
+ label : trans ( " text" ) ,
35
+ value : " text" ,
36
36
} ,
37
37
] as const ;
38
38
39
39
const floatOptions = [
40
40
{
41
- label : ' None' ,
42
- value : ' none' ,
41
+ label : " None" ,
42
+ value : " none" ,
43
43
} ,
44
44
{
45
- label : ' Right' ,
46
- value : ' right' ,
45
+ label : " Right" ,
46
+ value : " right" ,
47
47
} ,
48
48
{
49
- label : ' Left' ,
50
- value : ' left' ,
49
+ label : " Left" ,
50
+ value : " left" ,
51
51
} ,
52
52
] as const ;
53
53
54
+
54
55
export const ContainerBaseComp = ( function ( ) {
55
56
const childrenMap = {
56
57
disabled : BoolCodeControl ,
57
58
text : stringExposingStateControl (
58
- 'text' ,
59
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi feugiat faucibus eleifend. Pellentesque eleifend, risus vel sagittis mattis, mauris ipsum tempor sapien, eu lobortis lacus libero a dui. Cras erat felis, rhoncus vestibulum consectetur et, ultrices ut purus. Sed a tortor orci. Vestibulum nec eleifend ante.'
59
+ "text" , "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi feugiat faucibus eleifend. Pellentesque eleifend, risus vel sagittis mattis, mauris ipsum tempor sapien, eu lobortis lacus libero a dui. Cras erat felis, rhoncus vestibulum consectetur et, ultrices ut purus. Sed a tortor orci. Vestibulum nec eleifend ante."
60
60
) ,
61
- type : dropdownControl ( typeOptions , ' markdown' ) ,
62
- float : dropdownControl ( floatOptions , ' left' ) ,
61
+ type : dropdownControl ( typeOptions , " markdown" ) ,
62
+ float : dropdownControl ( floatOptions , " left" ) ,
63
63
horizontalAlignment : alignWithJustifyControl ( ) ,
64
- width : withDefault ( StringControl , '40' ) ,
64
+ width : withDefault ( StringControl , "40" ) ,
65
65
style : styleControl ( TextStyle ) ,
66
66
animationStyle : styleControl ( AnimationStyle ) ,
67
67
} ;
@@ -72,61 +72,49 @@ export const ContainerBaseComp = (function () {
72
72
return (
73
73
< >
74
74
< Section name = { sectionNames . basic } >
75
- { children . type . propertyView ( {
76
- label : trans ( 'value' ) ,
77
- tooltip : trans ( 'textShow.valueTooltip' ) ,
78
- radioButton : true ,
79
- } ) }
75
+ { children . type . propertyView ( { label : trans ( "value" ) , tooltip : trans ( "textShow.valueTooltip" ) , radioButton : true , } ) }
80
76
{ children . text . propertyView ( { } ) }
81
77
</ Section >
82
78
83
- { [ 'logic' , 'both' ] . includes (
84
- useContext ( EditorContext ) . editorModeStatus
85
- ) && (
79
+ { [ "logic" , "both" ] . includes ( useContext ( EditorContext ) . editorModeStatus ) && (
86
80
< Section name = { sectionNames . interaction } >
87
81
{ hiddenPropertyView ( children ) }
88
82
</ Section >
89
83
) }
90
- { [ 'layout' , 'both' ] . includes (
91
- useContext ( EditorContext ) . editorModeStatus
92
- ) && (
84
+ { [ "layout" , "both" ] . includes ( useContext ( EditorContext ) . editorModeStatus ) && (
93
85
< >
94
86
< Section name = { sectionNames . layout } >
95
87
{ children . container . getPropertyView ( ) }
96
- { children . width . propertyView ( {
97
- label : trans ( 'container.flowWidth' ) ,
98
- } ) }
99
- { children . float . propertyView ( {
100
- label : trans ( 'container.floatType' ) ,
101
- radioButton : true ,
88
+ { children . width . propertyView ( { label : trans ( "container.flowWidth" ) } ) }
89
+ { children . float . propertyView ( { label : trans ( "container.floatType" ) , radioButton : true ,
102
90
} ) }
103
91
{ children . horizontalAlignment . propertyView ( {
104
- label : trans ( ' textShow.horizontalAlignment' ) ,
92
+ label : trans ( " textShow.horizontalAlignment" ) ,
105
93
radioButton : true ,
106
94
} ) }
107
95
</ Section >
108
- < Section name = { ' Floating Text Style' } >
96
+ < Section name = { " Floating Text Style" } >
109
97
{ children . style . getPropertyView ( ) }
110
98
</ Section >
111
99
< Section name = { sectionNames . animationStyle } >
112
100
{ children . animationStyle . getPropertyView ( ) }
113
101
</ Section >
114
- < Section name = { ' Container Style' } >
102
+ < Section name = { " Container Style" } >
115
103
{ children . container . stylePropertyView ( ) }
116
104
</ Section >
117
105
{ children . container . children . showHeader . getView ( ) && (
118
- < Section name = { ' Header Style' } >
119
- { children . container . headerStylePropertyView ( ) }
106
+ < Section name = { " Header Style" } >
107
+ { children . container . headerStylePropertyView ( ) }
120
108
</ Section >
121
109
) }
122
110
{ children . container . children . showBody . getView ( ) && (
123
- < Section name = { ' Body Style' } >
124
- { children . container . bodyStylePropertyView ( ) }
111
+ < Section name = { " Body Style" } >
112
+ { children . container . bodyStylePropertyView ( ) }
125
113
</ Section >
126
114
) }
127
115
{ children . container . children . showFooter . getView ( ) && (
128
- < Section name = { ' Footer Style' } >
129
- { children . container . footerStylePropertyView ( ) }
116
+ < Section name = { " Footer Style" } >
117
+ { children . container . footerStylePropertyView ( ) }
130
118
</ Section >
131
119
) }
132
120
</ >
@@ -147,15 +135,15 @@ function convertOldContainerParams(params: CompParams<any>) {
147
135
// old params
148
136
if (
149
137
container &&
150
- ( container . hasOwnProperty ( ' layout' ) || container . hasOwnProperty ( ' items' ) )
138
+ ( container . hasOwnProperty ( " layout" ) || container . hasOwnProperty ( " items" ) )
151
139
) {
152
140
const autoHeight = tempParams . value . autoHeight ;
153
141
return {
154
142
...tempParams ,
155
143
value : {
156
144
container : {
157
145
showHeader : false ,
158
- body : { 0 : { view : container } } ,
146
+ body : { 0 : { view : container } } ,
159
147
showBody : true ,
160
148
showFooter : false ,
161
149
autoHeight : autoHeight ,
@@ -188,21 +176,21 @@ export function defaultContainerData(
188
176
header : toSimpleContainerData ( [
189
177
{
190
178
item : {
191
- compType : ' text' ,
192
- name : nameGenerator . genItemName ( ' containerTitle' ) ,
179
+ compType : " text" ,
180
+ name : nameGenerator . genItemName ( " containerTitle" ) ,
193
181
comp : {
194
- text : ' ### ' + trans ( ' container.title' ) ,
182
+ text : " ### " + trans ( " container.title" ) ,
195
183
} ,
196
184
} ,
197
185
layoutItem : {
198
- i : '' ,
186
+ i : "" ,
199
187
h : 5 ,
200
188
w : 24 ,
201
189
x : 0 ,
202
190
y : 0 ,
203
191
} ,
204
192
} ,
205
- ] ) ,
193
+ ] )
206
194
} ,
207
195
} ;
208
196
}
0 commit comments