chore: allow space in backend parameters

This commit is contained in:
jialin
2025-12-01 10:06:00 +08:00
parent 769cc09906
commit 14f0afec08
5 changed files with 32 additions and 12 deletions
+5 -7
View File
@@ -8,13 +8,14 @@ interface HintInputProps {
onChange: (value: string) => void;
onBlur?: (e: any) => void;
placeholder?: string;
trim?: boolean;
sourceOptions?: Global.HintOptions[];
}
const matchReg = /[^=]+=[^=]*$/;
const HintInput: React.FC<HintInputProps> = (props) => {
const { value, label, onChange, onBlur, sourceOptions } = props;
const { value, label, onChange, onBlur, sourceOptions, trim = true } = props;
const cursorPosRef = React.useRef(0);
const contextBeforeCursorRef = React.useRef('');
const [options, setOptions] = React.useState<
@@ -70,11 +71,7 @@ const HintInput: React.FC<HintInputProps> = (props) => {
const handleInput = (e: any) => {
getContextBeforeCursor(e);
onChange(e.target.value?.trim());
};
const handleOnChange = (value: string) => {
onChange(value?.trim());
onChange(e.target.value);
};
const handleOnSelect = (value: string) => {
@@ -93,9 +90,10 @@ const HintInput: React.FC<HintInputProps> = (props) => {
onBlur={onBlur}
label={label}
options={options}
trim={trim}
style={{ width: '100%' }}
/>
);
};
export default React.memo(HintInput);
export default HintInput;