diff --git a/packages/core/client/src/schema-initializer/buttons/CustomFormItemInitializers.tsx b/packages/core/client/src/schema-initializer/buttons/CustomFormItemInitializers.tsx index c9e4550dd..0c3375cdc 100644 --- a/packages/core/client/src/schema-initializer/buttons/CustomFormItemInitializers.tsx +++ b/packages/core/client/src/schema-initializer/buttons/CustomFormItemInitializers.tsx @@ -1,15 +1,15 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; +import { useCompile } from '../../schema-component'; import { SchemaInitializer } from '../SchemaInitializer'; import { gridRowColWrap, useCustomFormItemInitializerFields, useInheritsFormItemInitializerFields } from '../utils'; -import { useCompile } from '../../schema-component'; // 表单里配置字段 export const CustomFormItemInitializers = (props: any) => { const { t } = useTranslation(); const compile = useCompile(); const { insertPosition, component } = props; - const inheritFields = useInheritsFormItemInitializerFields(); + const inheritFields = useInheritsFormItemInitializerFields({ component: 'AssignedField' }); const fieldItems: any[] = [ { type: 'itemGroup', diff --git a/packages/core/client/src/schema-initializer/utils.ts b/packages/core/client/src/schema-initializer/utils.ts index 1911fbbf9..0ec4f6e05 100644 --- a/packages/core/client/src/schema-initializer/utils.ts +++ b/packages/core/client/src/schema-initializer/utils.ts @@ -456,7 +456,7 @@ export const useInheritsFormItemInitializerFields = (options?) => { return inherits?.map((v) => { const fields = getParentCollectionFields(v, name); - const { readPretty = form.readPretty, block = 'Form' } = options || {}; + const { readPretty = form.readPretty, block = 'Form', component = 'CollectionField' } = options || {}; const targetCollection = getCollection(v); return { [targetCollection?.title]: fields @@ -473,7 +473,7 @@ export const useInheritsFormItemInitializerFields = (options?) => { name: field.name, title: field?.uiSchema?.title || field.name, 'x-designer': 'FormItem.Designer', - 'x-component': 'CollectionField', + 'x-component': component, 'x-decorator': 'FormItem', 'x-collection-field': `${name}.${field.name}`, 'x-component-props': {},