1
- import React , { useEffect , useState } from ' react' ;
2
- import { Input , Section , sectionNames } from ' lowcoder-design' ;
3
- import { BoolControl } from ' comps/controls/boolControl' ;
4
- import { styleControl } from ' comps/controls/styleControl' ;
1
+ import React , { useEffect , useState } from " react" ;
2
+ import { Input , Section , sectionNames } from " lowcoder-design" ;
3
+ import { BoolControl } from " comps/controls/boolControl" ;
4
+ import { styleControl } from " comps/controls/styleControl" ;
5
5
import {
6
6
AnimationStyle ,
7
7
InputFieldStyle ,
@@ -14,12 +14,12 @@ import {
14
14
NameConfigPlaceHolder ,
15
15
NameConfigRequired ,
16
16
withExposingConfigs ,
17
- } from ' comps/generators/withExposing' ;
18
- import styled , { css } from ' styled-components' ;
19
- import { UICompBuilder } from ' ../../generators' ;
20
- import { FormDataPropertyView } from ' ../formComp/formDataConstants' ;
21
- import { jsonControl } from ' comps/controls/codeControl' ;
22
- import { dropdownControl } from ' comps/controls/dropdownControl' ;
17
+ } from " comps/generators/withExposing" ;
18
+ import styled , { css } from " styled-components" ;
19
+ import { UICompBuilder } from " ../../generators" ;
20
+ import { FormDataPropertyView } from " ../formComp/formDataConstants" ;
21
+ import { jsonControl } from " comps/controls/codeControl" ;
22
+ import { dropdownControl } from " comps/controls/dropdownControl" ;
23
23
import {
24
24
getStyle ,
25
25
TextInputBasicSection ,
@@ -28,21 +28,23 @@ import {
28
28
TextInputInteractionSection ,
29
29
textInputValidate ,
30
30
TextInputValidationSection ,
31
- } from ' ../textInputComp/textInputConstants' ;
31
+ } from " ../textInputComp/textInputConstants" ;
32
32
import {
33
33
allowClearPropertyView ,
34
34
hiddenPropertyView ,
35
- } from 'comps/utils/propertyUtils' ;
36
- import { trans } from 'i18n' ;
37
- import { IconControl } from 'comps/controls/iconControl' ;
38
- import { hasIcon } from 'comps/utils' ;
39
- import { InputRef } from 'antd/es/input' ;
40
- import { default as ConfigProvider } from 'antd/es/config-provider' ;
41
- import { default as AutoComplete } from 'antd/es/auto-complete' ;
42
- import { RefControl } from 'comps/controls/refControl' ;
43
- import { booleanExposingStateControl } from 'comps/controls/codeStateControl' ;
35
+ } from "comps/utils/propertyUtils" ;
36
+ import { trans } from "i18n" ;
37
+ import { IconControl } from "comps/controls/iconControl" ;
38
+ import { hasIcon } from "comps/utils" ;
39
+ import { InputRef } from "antd/es/input" ;
40
+ import { default as ConfigProvider } from "antd/es/config-provider" ;
41
+ import { default as AutoComplete } from "antd/es/auto-complete" ;
42
+ import { RefControl } from "comps/controls/refControl" ;
43
+ import {
44
+ booleanExposingStateControl ,
45
+ } from "comps/controls/codeStateControl" ;
44
46
45
- import { getDayJSLocale } from ' i18n/dayjsLocale' ;
47
+ import { getDayJSLocale } from " i18n/dayjsLocale" ;
46
48
import {
47
49
autoCompleteDate ,
48
50
itemsDataTooltip ,
@@ -52,23 +54,24 @@ import {
52
54
autoCompleteType ,
53
55
autocompleteIconColor ,
54
56
componentSize ,
55
- } from './autoCompleteConstants' ;
57
+ } from "./autoCompleteConstants" ;
58
+
59
+
56
60
57
61
const InputStyle = styled ( Input ) < { $style : InputLikeStyleType } > `
58
- ${ ( props ) => {
59
- return css `
60
- ${ getStyle ( props . $style ) }
61
- input {
62
- padding : ${ props . style ?. padding } ;
63
- rotate : ${ props ?. $style ?. rotation } ;
64
- }
65
- .ant-select-single {
66
- width : 100% !important ;
67
- }
68
- ` ;
69
- } }
62
+ ${ ( props ) => css `
63
+ ${ getStyle ( props . $style ) }
64
+ input {
65
+ padding : ${ props . style ?. padding } ;
66
+ rotate : ${ props ?. $style ?. rotation } ;
67
+ }
68
+ .ant-select-single {
69
+ width : 100% !important ;
70
+ }
71
+ ` }
70
72
` ;
71
73
74
+
72
75
const childrenMap = {
73
76
...textInputChildren ,
74
77
viewRef : RefControl < InputRef > ,
@@ -91,13 +94,13 @@ const childrenMap = {
91
94
animationStyle : styleControl ( AnimationStyle ) ,
92
95
} ;
93
96
94
- const getValidate = ( value : any ) : '' | ' warning' | ' error' | undefined => {
97
+ const getValidate = ( value : any ) : "" | " warning" | " error" | undefined => {
95
98
if (
96
- value . hasOwnProperty ( ' validateStatus' ) &&
97
- value [ ' validateStatus' ] === ' error'
99
+ value . hasOwnProperty ( " validateStatus" ) &&
100
+ value [ " validateStatus" ] === " error"
98
101
)
99
- return ' error' ;
100
- return '' ;
102
+ return " error" ;
103
+ return "" ;
101
104
} ;
102
105
103
106
let AutoCompleteCompBase = ( function ( ) {
@@ -115,10 +118,11 @@ let AutoCompleteCompBase = (function () {
115
118
autocompleteIconColor,
116
119
componentSize,
117
120
} = props ;
121
+
118
122
119
123
const getTextInputValidate = ( ) => {
120
124
return {
121
- value : { value : props . value . value } ,
125
+ value : { value : props . value . value } ,
122
126
required : props . required ,
123
127
minLength : props ?. minLength ?? 0 ,
124
128
maxLength : props ?. maxLength ?? 0 ,
@@ -133,7 +137,7 @@ let AutoCompleteCompBase = (function () {
133
137
const [ validateState , setvalidateState ] = useState ( { } ) ;
134
138
135
139
// 是否中文环境
136
- const [ chineseEnv , setChineseEnv ] = useState ( getDayJSLocale ( ) === ' zh-cn' ) ;
140
+ const [ chineseEnv , setChineseEnv ] = useState ( getDayJSLocale ( ) === " zh-cn" ) ;
137
141
138
142
useEffect ( ( ) => {
139
143
setsearchtext ( props . value . value ) ;
@@ -355,8 +359,8 @@ let AutoCompleteCompBase = (function () {
355
359
} )
356
360
. setExposeMethodConfigs ( autoCompleteRefMethods )
357
361
. setExposeStateConfigs ( [
358
- new NameConfig ( ' value' , trans ( ' export.inputValueDesc' ) ) ,
359
- new NameConfig ( ' valueInItems' , trans ( ' autoComplete.valueInItems' ) ) ,
362
+ new NameConfig ( " value" , trans ( " export.inputValueDesc" ) ) ,
363
+ new NameConfig ( " valueInItems" , trans ( " autoComplete.valueInItems" ) ) ,
360
364
NameConfigPlaceHolder ,
361
365
NameConfigRequired ,
362
366
...TextInputConfigs ,
@@ -371,9 +375,9 @@ AutoCompleteCompBase = class extends AutoCompleteCompBase {
371
375
} ;
372
376
373
377
export const AutoCompleteComp = withExposingConfigs ( AutoCompleteCompBase , [
374
- new NameConfig ( ' value' , trans ( ' export.inputValueDesc' ) ) ,
375
- new NameConfig ( ' valueInItems' , trans ( ' autoComplete.valueInItems' ) ) ,
378
+ new NameConfig ( " value" , trans ( " export.inputValueDesc" ) ) ,
379
+ new NameConfig ( " valueInItems" , trans ( " autoComplete.valueInItems" ) ) ,
376
380
NameConfigPlaceHolder ,
377
- NameConfigRequired ,
381
+ NameConfigRequired ,
378
382
...TextInputConfigs ,
379
383
] ) ;
0 commit comments