@@ -12,6 +12,7 @@ import _pick from 'lodash/pick';
1212import { JSFunction } from './jsFunction' ;
1313import { RemoveBtn } from './form-lazy-obj-remove-btn' ;
1414import { generateClassName } from '../../utils/misc' ;
15+ import { isJSFunction } from '@alilc/lowcode-types' ;
1516
1617const { Item : MenuButtonItem } = MenuButton ;
1718
@@ -22,11 +23,18 @@ export interface FormLazyObjProps {
2223
2324export const FormLazyObj = observer ( ( props : FormLazyObjProps ) => {
2425 const { addText = '添加' } = props ;
26+
2527 const field = useField < VoidField > ( ) ;
26- const [ selectedProperties , setSelectedProperties ] = useState < string [ ] > ( [ ] ) ;
28+
2729 const schema = useFieldSchema ( ) ;
2830
29- useEffect ( ( ) => { } , [ field ] ) ;
31+ const [ selectedProperties , setSelectedProperties ] = useState < string [ ] > ( ( ) => {
32+ // 自动回填数据处理函数
33+ return Object . keys ( schema . properties || { } ) . filter ( property => {
34+ return isJSFunction ( field . form . values [ property ] )
35+ } )
36+ } ) ;
37+
3038 const properties = useMemo ( ( ) => {
3139 return Object . keys ( schema . properties || { } )
3240 . filter ( ( i ) => selectedProperties . indexOf ( i ) === - 1 )
@@ -69,6 +77,7 @@ export const FormLazyObj = observer((props: FormLazyObjProps) => {
6977 } ) ;
7078 const schemaJSON = schema . toJSON ( ) ;
7179 const schemaProperties = _pick ( schemaJSON . properties , selectedProperties ) ;
80+
7281 return (
7382 < SchemaField
7483 schema = { {
0 commit comments