11import { useRef } from 'react' ;
22import { Form } from 'antd' ;
3+ import { cloneDeep } from 'lodash-es' ;
34
45import { transformFieldsData , getSchemaFullPath } from './formCoreUtils' ;
56import { parseBindToValues , parseValuesToBind } from './bindValues' ;
6- import { _isMatch , _set , _get , _has , _cloneDeep , _merge , _mergeWith , isFunction , isObject , isArray , _isUndefined , hasFuncProperty } from '../utils' ;
7+ import { _isMatch , _set , _get , _has , _merge , _mergeWith , isFunction , isObject , isArray , _isUndefined , hasFuncProperty } from '../utils' ;
78import filterValuesUndefined from './filterValuesUndefined' ;
89import filterValuesHidden from '../models/filterValuesHidden' ;
910import { flattenSchema as flatten } from './flattenSchema' ;
@@ -123,7 +124,7 @@ const useForm = () => {
123124 return ;
124125 }
125126
126- const schema = _cloneDeep ( schemaRef . current ) ;
127+ const schema = cloneDeep ( schemaRef . current ) ;
127128 Object . keys ( obj || { } ) . forEach ( path => {
128129 updateSchemaByPath ( path , obj [ path ] , schema ) ;
129130 } ) ;
@@ -138,7 +139,7 @@ const useForm = () => {
138139 return ;
139140 }
140141
141- const schema = _cloneDeep ( schemaRef . current ) ;
142+ const schema = cloneDeep ( schemaRef . current ) ;
142143 updateSchemaByPath ( _path , _newSchema , schema ) ;
143144 handleSchemaUpdate ( schema ) ;
144145 }
@@ -163,7 +164,7 @@ const useForm = () => {
163164
164165 // 获取表单数据
165166 xform . getValues = ( nameList ?: any , filterFunc ?: any ) => {
166- let values = form . getFieldsValue ( getFieldName ( nameList ) , filterFunc ) ;
167+ let values = cloneDeep ( form . getFieldsValue ( getFieldName ( nameList ) , filterFunc ) ) ;
167168 values = filterValuesHidden ( values , flattenSchemaRef . current ) ;
168169 values = filterValuesUndefined ( values ) ;
169170 return parseValuesToBind ( values , flattenSchemaRef . current ) ;
0 commit comments