allow decimals in form inputs
This commit is contained in:
@@ -11,6 +11,7 @@ export interface InputFieldProps<T> extends BaseFormBuilderProps<T> {
|
|||||||
properties?: {
|
properties?: {
|
||||||
prefix?: string;
|
prefix?: string;
|
||||||
suffix?: string;
|
suffix?: string;
|
||||||
|
step?: number;
|
||||||
action?: {
|
action?: {
|
||||||
icon: LucideIcon;
|
icon: LucideIcon;
|
||||||
onClick: () => void;
|
onClick: () => void;
|
||||||
@@ -30,11 +31,12 @@ export function GenericInput<T extends FieldValues>({
|
|||||||
render={({ field: { value, onChange, ...rest } }) => (
|
render={({ field: { value, onChange, ...rest } }) => (
|
||||||
<Input
|
<Input
|
||||||
type={field.type}
|
type={field.type}
|
||||||
value={field.type === "number" ? parseInt(value) : value}
|
step={field.properties?.step}
|
||||||
|
value={field.type === "number" ? Number.parseInt(value) : value}
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
onChange(
|
onChange(
|
||||||
field.type === "number"
|
field.type === "number"
|
||||||
? parseInt(e.target.value)
|
? Number.parseInt(e.target.value)
|
||||||
: e.target.value,
|
: e.target.value,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user