fix: check form data after blur

This commit is contained in:
jialin
2025-04-02 20:40:57 +08:00
parent 4755cf6a25
commit afacd2a8a0
19 changed files with 339 additions and 250 deletions
+3 -1
View File
@@ -6,6 +6,7 @@ interface HintInputProps {
value: string;
label?: string;
onChange: (value: string) => void;
onBlur?: (e: any) => void;
placeholder?: string;
sourceOptions?: Global.HintOptions[];
}
@@ -13,7 +14,7 @@ interface HintInputProps {
const matchReg = /[^=]+=[^=]*$/;
const HintInput: React.FC<HintInputProps> = (props) => {
const { value, label, onChange, sourceOptions } = props;
const { value, label, onChange, onBlur, sourceOptions } = props;
const cursorPosRef = React.useRef(0);
const contextBeforeCursorRef = React.useRef('');
const [options, setOptions] = React.useState<
@@ -89,6 +90,7 @@ const HintInput: React.FC<HintInputProps> = (props) => {
onInput={handleInput}
onSelect={handleOnSelect}
onFocus={getContextBeforeCursor}
onBlur={onBlur}
label={label}
options={options}
style={{ width: '100%' }}