Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5ba4f59

Browse files
check input field validation on customRule's value change
1 parent2100027 commit5ba4f59

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

‎client/packages/lowcoder/src/comps/comps/textInputComp/textInputConstants.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ export const textInputProps = (props: RecordConstructorToView<typeof textInputCh
169169
exportconstuseTextInputProps=(props:RecordConstructorToView<typeoftextInputChildren>)=>{
170170
const[validateState,setValidateState]=useState({});
171171
constchangeRef=useRef(false)
172+
consttouchRef=useRef(false);
172173

173174
constpropsRef=useRef<RecordConstructorToView<typeoftextInputChildren>>(props);
174175
propsRef.current=props;
@@ -195,9 +196,23 @@ export const useTextInputProps = (props: RecordConstructorToView<typeof textInpu
195196
changeRef.current=false;
196197
},[inputValue]);
197198

199+
useEffect(()=>{
200+
if(!touchRef.current)return;
201+
202+
setValidateState(
203+
textInputValidate({
204+
...propsRef.current,
205+
value:{
206+
value:props.value.value,
207+
},
208+
})
209+
);
210+
},[props.customRule])
211+
198212
consthandleChange=(e:ChangeEvent<HTMLInputElement>)=>{
199213
props.value.onChange(e.target.value);
200214
changeRef.current=true;
215+
touchRef.current=true;
201216
};
202217

203218
return[

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp