7
7
import { BoolControl } from "../../controls/boolControl" ;
8
8
import { LabelControl } from "../../controls/labelControl" ;
9
9
import { BoolCodeControl , StringControl } from "../../controls/codeControl" ;
10
- import { PaddingControl } from "../../controls/paddingControl" ;
10
+ import { PaddingControl } from "../../controls/paddingControl" ;
11
11
import { MarginControl } from "../../controls/marginControl" ;
12
12
import {
13
13
ControlNode ,
@@ -27,14 +27,17 @@ import {
27
27
SelectInputValidationChildren ,
28
28
SelectInputValidationSection ,
29
29
} from "./selectInputConstants" ;
30
- import { formDataChildren , FormDataPropertyView } from "../formComp/formDataConstants" ;
30
+ import {
31
+ formDataChildren ,
32
+ FormDataPropertyView ,
33
+ } from "../formComp/formDataConstants" ;
31
34
import {
32
35
CascaderStyleType ,
33
36
MultiSelectStyleType ,
34
37
SelectStyleType ,
35
38
TreeSelectStyleType ,
36
39
widthCalculator ,
37
- heightCalculator
40
+ heightCalculator ,
38
41
} from "comps/controls/styleControlConstants" ;
39
42
import { stateComp , withDefault } from "../../generators" ;
40
43
import {
@@ -55,34 +58,39 @@ import { useContext } from "react";
55
58
import { EditorContext } from "comps/editorState" ;
56
59
57
60
export const getStyle = (
58
- style : SelectStyleType | MultiSelectStyleType | CascaderStyleType | TreeSelectStyleType
61
+ style :
62
+ | SelectStyleType
63
+ | MultiSelectStyleType
64
+ | CascaderStyleType
65
+ | TreeSelectStyleType
59
66
) => {
60
67
return css `
61
68
&.ant-select .ant-select-selector,
62
69
&.ant-select-multiple .ant-select-selection-item {
63
70
border-radius: ${ style . radius } ;
64
- padding: ${ style . padding } ;
65
- height: auto;
66
- }
67
- .ant-select-selection-search {
68
- padding: ${ style . padding } ;
69
- }
70
- .ant-select-selector::after,
71
- .ant-select-selection-placeholder,
72
- .ant-select-selection-item {
71
+ padding: ${ style . padding } ;
72
+ height: auto;
73
+ }
74
+ .ant-select-selection-search {
75
+ padding: ${ style . padding } ;
76
+ }
77
+ .ant-select-selector::after,
78
+ .ant-select-selection-placeholder,
79
+ .ant-select-selection-item {
73
80
line-height: 1.5715 !important;
74
81
}
75
82
76
83
&.ant-select:not(.ant-select-disabled) {
77
84
color: ${ style . text } ;
78
- .ant-select-selection-placeholder,
79
- .ant-select-selection-item {
80
- line-height: 1.5715 !important;
85
+ .ant-select-selection-placeholder,
86
+ .ant-select-selection-item {
87
+ line-height: 1.5715 !important;
81
88
}
82
89
.ant-select-selection-placeholder,
83
90
&.ant-select-single.ant-select-open .ant-select-selection-item {
84
91
color: ${ style . text } ;
85
92
opacity: 0.4;
93
+ width: 100%;
86
94
}
87
95
88
96
.ant-select-selector {
@@ -103,16 +111,16 @@ export const getStyle = (
103
111
color: ${ style . text === "#222222"
104
112
? "#8B8FA3"
105
113
: isDarkColor ( style . text )
106
- ? lightenColor ( style . text , 0.2 )
107
- : style . text } ;
114
+ ? lightenColor ( style . text , 0.2 )
115
+ : style . text } ;
108
116
}
109
117
110
118
.ant-select-clear:hover {
111
119
color: ${ style . text === "#222222"
112
120
? "#8B8FA3"
113
121
: isDarkColor ( style . text )
114
- ? lightenColor ( style . text , 0.1 )
115
- : style . text } ;
122
+ ? lightenColor ( style . text , 0.1 )
123
+ : style . text } ;
116
124
}
117
125
118
126
&.ant-select-multiple .ant-select-selection-item {
@@ -160,7 +168,9 @@ const getDropdownStyle = (style: MultiSelectStyleType) => {
160
168
` ;
161
169
} ;
162
170
163
- const Select = styled ( AntdSelect ) < { $style : SelectStyleType & MultiSelectStyleType } > `
171
+ const Select = styled ( AntdSelect ) < {
172
+ $style : SelectStyleType & MultiSelectStyleType ;
173
+ } > `
164
174
width: 100%;
165
175
166
176
${ ( props ) => props . $style && getStyle ( props . $style ) }
@@ -169,7 +179,7 @@ const Select = styled(AntdSelect)<{ $style: SelectStyleType & MultiSelectStyleTy
169
179
const DropdownStyled = styled . div < { $style : MultiSelectStyleType } > `
170
180
${ ( props ) => props . $style && getDropdownStyle ( props . $style ) }
171
181
.ant-select-item-option-content {
172
- ${ ( props ) => `padding: ${ props . $style . padding } ` } ;
182
+ ${ ( props ) => `padding: ${ props . $style . padding } ` } ;
173
183
}
174
184
.option-label img {
175
185
min-width: 14px;
@@ -197,7 +207,7 @@ export const SelectChildrenMap = {
197
207
inputValue : stateComp < string > ( "" ) , // user's input value when search
198
208
showSearch : BoolControl . DEFAULT_TRUE ,
199
209
viewRef : RefControl < BaseSelectRef > ,
200
- margin : MarginControl ,
210
+ margin : MarginControl ,
201
211
padding : PaddingControl ,
202
212
...SelectInputValidationChildren ,
203
213
...formDataChildren ,
@@ -221,9 +231,13 @@ export const SelectUIView = (
221
231
placeholder = { props . placeholder }
222
232
value = { props . value }
223
233
showSearch = { props . showSearch }
224
- filterOption = { ( input , option ) => option ?. label . toLowerCase ( ) . includes ( input . toLowerCase ( ) ) }
234
+ filterOption = { ( input , option ) =>
235
+ option ?. label . toLowerCase ( ) . includes ( input . toLowerCase ( ) )
236
+ }
225
237
dropdownRender = { ( originNode : ReactNode ) => (
226
- < DropdownStyled $style = { props . style as MultiSelectStyleType } > { originNode } </ DropdownStyled >
238
+ < DropdownStyled $style = { props . style as MultiSelectStyleType } >
239
+ { originNode }
240
+ </ DropdownStyled >
227
241
) }
228
242
dropdownStyle = { {
229
243
padding : 0 ,
@@ -250,8 +264,8 @@ export const SelectUIView = (
250
264
key = { option . value }
251
265
>
252
266
< Wrapper className = "option-label" >
253
- { props . options . findIndex ( ( option ) => hasIcon ( option . prefixIcon ) ) > - 1 &&
254
- option . prefixIcon }
267
+ { props . options . findIndex ( ( option ) => hasIcon ( option . prefixIcon ) ) >
268
+ - 1 && option . prefixIcon }
255
269
{ < span > { option . label } </ span > }
256
270
</ Wrapper >
257
271
</ Select . Option >
@@ -273,24 +287,28 @@ export const SelectPropertyView = (
273
287
< >
274
288
< Section name = { sectionNames . basic } >
275
289
{ children . options . propertyView ( { } ) }
276
- { children . defaultValue . propertyView ( { label : trans ( "prop.defaultValue" ) } ) }
290
+ { children . defaultValue . propertyView ( {
291
+ label : trans ( "prop.defaultValue" ) ,
292
+ } ) }
277
293
{ placeholderPropertyView ( children ) }
278
294
</ Section >
279
295
280
296
{ [ "logic" , "both" ] . includes ( useContext ( EditorContext ) . editorModeStatus ) && (
281
- < > < >
282
- < SelectInputValidationSection { ...children } />
283
- < FormDataPropertyView { ...children } />
284
- </ > < Section name = { sectionNames . interaction } >
297
+ < >
298
+ < >
299
+ < SelectInputValidationSection { ...children } />
300
+ < FormDataPropertyView { ...children } />
301
+ </ >
302
+ < Section name = { sectionNames . interaction } >
285
303
{ children . onEvent . getPropertyView ( ) }
286
304
{ disabledPropertyView ( children ) }
287
305
{ hiddenPropertyView ( children ) }
288
- </ Section > </ >
306
+ </ Section >
307
+ </ >
289
308
) }
290
309
291
- { [ "layout" , "both" ] . includes ( useContext ( EditorContext ) . editorModeStatus ) && (
292
- children . label . getPropertyView ( )
293
- ) }
310
+ { [ "layout" , "both" ] . includes ( useContext ( EditorContext ) . editorModeStatus ) &&
311
+ children . label . getPropertyView ( ) }
294
312
295
313
{ [ "logic" , "both" ] . includes ( useContext ( EditorContext ) . editorModeStatus ) && (
296
314
< Section name = { sectionNames . advanced } >
@@ -299,12 +317,17 @@ export const SelectPropertyView = (
299
317
</ Section >
300
318
) }
301
319
302
- { [ "layout" , "both" ] . includes ( useContext ( EditorContext ) . editorModeStatus ) && (
320
+ { [ "layout" , "both" ] . includes (
321
+ useContext ( EditorContext ) . editorModeStatus
322
+ ) && (
303
323
< Section name = { sectionNames . style } >
304
324
{ children . style . getPropertyView ( ) }
305
325
</ Section >
306
326
) }
307
327
</ >
308
328
) ;
309
329
310
- export const baseSelectRefMethods = refMethods < BaseSelectRef > ( [ focusMethod , blurMethod ] ) ;
330
+ export const baseSelectRefMethods = refMethods < BaseSelectRef > ( [
331
+ focusMethod ,
332
+ blurMethod ,
333
+ ] ) ;
0 commit comments