import React, { RefObject } from 'react'; import { ValidatorForm } from 'react-material-ui-form-validator'; import { Dialog, DialogTitle, DialogContent, DialogActions, Box, Typography, FormHelperText, OutlinedInput, InputAdornment, TextField, MenuItem } from '@material-ui/core'; import { FormButton } from '../components'; import { DeviceValue, DeviceValueUOM, DeviceValueUOM_s } from './EMSESPtypes'; interface ValueFormProps { devicevalue: DeviceValue; onDoneEditing: () => void; onCancelEditing: () => void; handleValueChange: ( data: keyof DeviceValue ) => (event: React.ChangeEvent) => void; } class ValueForm extends React.Component { formRef: RefObject = React.createRef(); submit = () => { this.formRef.current.submit(); }; render() { const { devicevalue, handleValueChange, onDoneEditing, onCancelEditing } = this.props; return ( Change Value {devicevalue.u === DeviceValueUOM.LIST && ( {devicevalue.l.map((val) => ( {val} ))} )} {devicevalue.u !== DeviceValueUOM.BOOLEAN && devicevalue.u !== DeviceValueUOM.LIST && ( {DeviceValueUOM_s[devicevalue.u]} } /> )} {devicevalue.u === DeviceValueUOM.BOOLEAN && ( on off )} {devicevalue.n} Note: it may take a few seconds before the change is registered with the EMS device. Cancel Done ); } } export default ValueForm;