fix: Corrected Changed the data type of number field from string to number (#3363)

* Changed the data type of number field from string to number

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Anand Dev Singh 2024-08-16 02:45:12 +05:30 • committed by GitHub
commit 6f001c64be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 8 additions and 8 deletions

View file

@ -21,8 +21,8 @@ export default function IntComponent({
const min = -Infinity; const min = -Infinity;
// Clear component state // Clear component state
useEffect(() => { useEffect(() => {
if (disabled && value !== "") { if (disabled && value !== 0) {
onChange("", undefined, true); onChange(0, undefined, true);
} }
}, [disabled, onChange]); }, [disabled, onChange]);
@ -35,7 +35,7 @@ export default function IntComponent({
const handleChangeInput = (e: React.ChangeEvent<HTMLInputElement>) => { const handleChangeInput = (e: React.ChangeEvent<HTMLInputElement>) => {
setCursor(e.target.selectionStart); setCursor(e.target.selectionStart);
onChange(e.target.value); onChange(Number(e.target.value));
}; };
return ( return (
@ -46,7 +46,7 @@ export default function IntComponent({
min={rangeSpec?.min ?? min} min={rangeSpec?.min ?? min}
max={rangeSpec?.max ?? undefined} max={rangeSpec?.max ?? undefined}
onChange={(value) => { onChange={(value) => {
onChange(value); onChange(Number(value));
}} }}
value={value ?? ""} value={value ?? ""}
> >

View file

@ -108,7 +108,7 @@ export function ParameterRenderComponent({
id={`int_${id}`} id={`int_${id}`}
disabled={disabled} disabled={disabled}
editNode={editNode} editNode={editNode}
value={templateValue ?? ""} value={templateValue ?? 0}
onChange={onChange} onChange={onChange}
/> />
) : templateData.type === "file" ? ( ) : templateData.type === "file" ? (

View file

@ -269,10 +269,10 @@ export type RangeSpecType = {
}; };
export type IntComponentType = { export type IntComponentType = {
value: string; value: number;
disabled?: boolean; disabled?: boolean;
rangeSpec: RangeSpecType; rangeSpec: RangeSpecType;
onChange: (value: string, dbValue?: boolean, skipSnapshot?: boolean) => void; onChange: (value: number, dbValue?: boolean, skipSnapshot?: boolean) => void;
editNode?: boolean; editNode?: boolean;
id?: string; id?: string;
}; };

View file

@ -636,7 +636,7 @@ export function handleKeyDown(
e: e:
| React.KeyboardEvent<HTMLInputElement> | React.KeyboardEvent<HTMLInputElement>
| React.KeyboardEvent<HTMLTextAreaElement>, | React.KeyboardEvent<HTMLTextAreaElement>,
inputValue: string | string[] | null | undefined, inputValue: string | number | string[] | null | undefined,
block: string, block: string,
) { ) {
//condition to fix bug control+backspace on Windows/Linux //condition to fix bug control+backspace on Windows/Linux