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

View file

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

View file

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

View file

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