@@ -11,7 +11,7 @@ import { stringExposingStateControl } from "comps/controls/codeStateControl";
11
11
import { LabelControl } from "comps/controls/labelControl" ;
12
12
import { InputLikeStyleType , LabelStyleType , heightCalculator , widthCalculator } from "comps/controls/styleControlConstants" ;
13
13
import { Section , sectionNames , ValueFromOption } from "lowcoder-design" ;
14
- import _ from "lodash" ;
14
+ import _ , { debounce } from "lodash" ;
15
15
import { css } from "styled-components" ;
16
16
import { EMAIL_PATTERN , URL_PATTERN } from "util/stringUtils" ;
17
17
import { MultiBaseComp , RecordConstructorToComp , RecordConstructorToView } from "lowcoder-core" ;
@@ -209,10 +209,17 @@ export const useTextInputProps = (props: RecordConstructorToView<typeof textInpu
209
209
) ;
210
210
} , [ props . customRule ] )
211
211
212
+ const debouncedOnChangeRef = useRef (
213
+ debounce ( ( value : string ) => {
214
+ props . value . onChange ( value ) ;
215
+ changeRef . current = true ;
216
+ touchRef . current = true ;
217
+ } , 1000 )
218
+ ) ;
219
+
212
220
const handleChange = ( e : ChangeEvent < HTMLInputElement > ) => {
213
- props . value . onChange ( e . target . value ) ;
214
- changeRef . current = true ;
215
- touchRef . current = true ;
221
+ const value = e . target . value ;
222
+ debouncedOnChangeRef . current ?.( value ) ;
216
223
} ;
217
224
218
225
return [
0 commit comments