| | |
| | | import * as Common from '@/utils/common'; |
| | | import { useFormContext } from 'react-hook-form'; |
| | | |
| | | const TreeSelectInput = ({ value, onChange, label, isTranslate = false, resource, ...rest }) => { |
| | | const TreeSelectInput = ({ resource, label, source = 'parentId', value, isTranslate = false, ...rest }) => { |
| | | const translate = useTranslate(); |
| | | const { setValue } = useFormContext(); |
| | | const [filter, setFilter] = React.useState(""); |
| | |
| | | const handleChange = (event) => { |
| | | const val = event.target.value; |
| | | setProxyVal(val); |
| | | setValue('parentId', val, { |
| | | setValue(source, val, { |
| | | shouldValidate: true, |
| | | shouldDirty: true, |
| | | }); |