mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
fix: convert final value
This commit is contained in:
@@ -39,24 +39,27 @@ const NumberInput = React.forwardRef<HTMLInputElement, InputProps>(
|
|||||||
className={cn("text-left", className)}
|
className={cn("text-left", className)}
|
||||||
ref={ref}
|
ref={ref}
|
||||||
{...props}
|
{...props}
|
||||||
onChange={(e) => {
|
value={props.value === undefined ? undefined : String(props.value)}
|
||||||
const value = e.target.value;
|
onChange={(e) => {
|
||||||
if (value === "") {
|
const value = e.target.value;
|
||||||
props.onChange?.(e);
|
if (value === "") {
|
||||||
} else {
|
props.onChange?.(e);
|
||||||
const number = Number.parseInt(value, 10);
|
} else {
|
||||||
if (!Number.isNaN(number)) {
|
const number = Number.parseInt(value, 10);
|
||||||
const syntheticEvent = {
|
if (!Number.isNaN(number)) {
|
||||||
...e,
|
const syntheticEvent = {
|
||||||
target: {
|
...e,
|
||||||
...e.target,
|
target: {
|
||||||
value: number.toString(),
|
...e.target,
|
||||||
},
|
value: number,
|
||||||
};
|
},
|
||||||
props.onChange?.(syntheticEvent as React.ChangeEvent<HTMLInputElement>);
|
};
|
||||||
}
|
props.onChange?.(
|
||||||
}
|
syntheticEvent as unknown as React.ChangeEvent<HTMLInputElement>
|
||||||
}}
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user