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