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:
parent
fc95e2ec58
commit
6f001c64be
4 changed files with 8 additions and 8 deletions
|
|
@ -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 ?? ""}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ export function ParameterRenderComponent({
|
|||
id={`int_${id}`}
|
||||
disabled={disabled}
|
||||
editNode={editNode}
|
||||
value={templateValue ?? ""}
|
||||
value={templateValue ?? 0}
|
||||
onChange={onChange}
|
||||
/>
|
||||
) : templateData.type === "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;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue