diff --git a/packages/core/client/src/schema-initializer/utils.ts b/packages/core/client/src/schema-initializer/utils.ts index fbba83691..246b12790 100644 --- a/packages/core/client/src/schema-initializer/utils.ts +++ b/packages/core/client/src/schema-initializer/utils.ts @@ -93,6 +93,7 @@ export const useTableColumnInitializerFields = () => { const isSubTable = fieldSchema['x-component'] === 'AssociationField.SubTable'; const form = useForm(); const isReadPretty = isSubTable ? form.readPretty : true; + return currentFields .filter( (field) => field?.interface && field?.interface !== 'subTable' && !field?.isForeignKey && !field?.treeChildren, @@ -203,6 +204,10 @@ export const useAssociatedTableColumnInitializerFields = () => { export const useInheritsTableColumnInitializerFields = () => { const { name } = useCollection(); const { getInterface, getInheritCollections, getCollection, getParentCollectionFields } = useCollectionManager(); + const fieldSchema = useFieldSchema(); + const isSubTable = fieldSchema['x-component'] === 'AssociationField.SubTable'; + const form = useForm(); + const isReadPretty = isSubTable ? form.readPretty : true; const inherits = getInheritCollections(name); return inherits?.map((v) => { const fields = getParentCollectionFields(v, name); @@ -214,12 +219,30 @@ export const useInheritsTableColumnInitializerFields = () => { }) .map((k) => { const interfaceConfig = getInterface(k.interface); + const isFileCollection = k?.target && getCollection(k?.target)?.template === 'file'; const schema = { name: `${k.name}`, 'x-component': 'CollectionField', - 'x-read-pretty': true, + 'x-read-pretty': isReadPretty || k.uiSchema?.['x-read-pretty'], 'x-collection-field': `${name}.${k.name}`, - 'x-component-props': {}, + 'x-component-props': isFileCollection + ? { + fieldNames: { + label: 'preview', + value: 'id', + }, + } + : {}, + 'x-decorator': isSubTable + ? quickEditField.includes(k.interface) || isFileCollection + ? 'QuickEdit' + : 'FormItem' + : null, + 'x-decorator-props': { + labelStyle: { + display: 'none', + }, + }, }; return { type: 'item',