components.form.fields.InputTextField.js Maven / Gradle / Ivy
import { validateField, workaroundFieldLabelOverlap } from "components/form/utils/validate-utils";
import { TextField } from "@mui/material";
import InputError from "components/form/fields/InputError";
import { useFieldInfo } from "hooks/field";
import { useFormInfo } from "hooks/form";
import { useAutoSubmitSignal } from "hooks/autosubmit";
import { TraitHelper } from "helpers/traits";
import { useConfig } from "hooks/config";
import { fieldMinWidthStyle } from "components/form/utils/field-utils";
const InputTextFieldContent = (props) => {
const { setFocus, multiline } = props
const { augProps, fieldProps, info } = useFieldInfo()
const formInfo = useFormInfo()
const {signal} = useAutoSubmitSignal()
const {props: {taskRendering}} = useConfig()
function handleValidate(e) {
const error = validateField("text", fieldProps.required, e)
augProps.setError(error)
}
function handleChange (e) {
fieldProps.onChange(e)
handleValidate(e)
}
function handleBlur (e) {
setFocus(false)
fieldProps.onBlur(e)
handleValidate(e)
signal()
}
function handleFocus(e) {
setFocus(true)
fieldProps.onFocus(e)
}
const workaround = workaroundFieldLabelOverlap(info.rpath)
return (
)
}
const InputTextField = (props) => (
)
export default InputTextField