1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
6 import { FloatCommandInputParameter, isRequiredInput } from '~/models/workflow';
7 import { Field } from 'redux-form';
8 import { isNumber } from '~/validators/is-number';
9 import { GenericInputProps, GenericInput } from './generic-input';
10 import { FloatInput as FloatInputComponent } from '~/components/float-input/float-input';
11 export interface FloatInputProps {
12 input: FloatCommandInputParameter;
14 export const FloatInput = ({ input }: FloatInputProps) =>
20 format={value => isNaN(value) ? '' : JSON.stringify(value)}
22 isRequiredInput(input)
24 : () => undefined,]} />;
26 const Input = (props: GenericInputProps) =>
28 component={InputComponent}
31 const InputComponent = ({ input, meta }: GenericInputProps) =>
32 <FloatInputComponent fullWidth {...input} error={meta.touched && !!meta.error} />;