fix(sub-table): allows configuration of "Display association fields" (#2073)

This commit is contained in:
katherinehhh 2023-06-23 00:10:39 +08:00 committed by GitHub
parent ccfc9b8625
commit 87e37757b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,12 +8,13 @@ import {
useInheritsTableColumnInitializerFields, useInheritsTableColumnInitializerFields,
} from '../utils'; } from '../utils';
import { useCompile } from '../../schema-component'; import { useCompile } from '../../schema-component';
import { useFieldSchema } from '@formily/react'; import { useField, useFieldSchema } from '@formily/react';
// 表格列配置 // 表格列配置
export const TableColumnInitializers = (props: any) => { export const TableColumnInitializers = (props: any) => {
const { items = [], action = true } = props; const { items = [], action = true } = props;
const { t } = useTranslation(); const { t } = useTranslation();
const field = useField();
const fieldSchema = useFieldSchema(); const fieldSchema = useFieldSchema();
const associatedFields = useAssociatedTableColumnInitializerFields(); const associatedFields = useAssociatedTableColumnInitializerFields();
const inheritFields = useInheritsTableColumnInitializerFields(); const inheritFields = useInheritsTableColumnInitializerFields();
@ -41,7 +42,7 @@ export const TableColumnInitializers = (props: any) => {
); );
}); });
} }
if (associatedFields?.length > 0 && !isSubTable) { if (associatedFields?.length > 0 && field.readPretty) {
fieldItems.push( fieldItems.push(
{ {
type: 'divider', type: 'divider',