From d068f9b5df826c9bac4615f2db2942e5323d6fdf Mon Sep 17 00:00:00 2001 From: katherinehhh Date: Mon, 24 Jul 2023 23:59:17 +0800 Subject: [PATCH] fix: table column field failed to be actived (#2309) --- .../antd/table-v2/components/ColumnFieldProvider.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/core/client/src/schema-component/antd/table-v2/components/ColumnFieldProvider.tsx b/packages/core/client/src/schema-component/antd/table-v2/components/ColumnFieldProvider.tsx index 5f89461d7..727127112 100644 --- a/packages/core/client/src/schema-component/antd/table-v2/components/ColumnFieldProvider.tsx +++ b/packages/core/client/src/schema-component/antd/table-v2/components/ColumnFieldProvider.tsx @@ -1,17 +1,20 @@ import { observer, RecursionField } from '@formily/react'; import React from 'react'; +import { useCollectionManager } from '../../../../collection-manager'; import { useRecord } from '../../../../record-provider'; export const ColumnFieldProvider = observer( (props: { schema: any; basePath: any; children: any }) => { const { schema, basePath } = props; const record = useRecord(); + const { getCollectionJoinField } = useCollectionManager(); const fieldSchema = schema.reduceProperties((buf, s) => { if (s['x-component'] === 'CollectionField') { return s; } return buf; }, null); - if (fieldSchema && record?.__collection) { + const collectionField = fieldSchema && getCollectionJoinField(fieldSchema['x-collection-field']); + if (fieldSchema && record?.__collection && ['select', 'multipleSelect'].includes(collectionField.interface)) { const fieldName = `${record.__collection}.${fieldSchema.name}`; schema.properties[fieldSchema.name]['x-collection-field'] = fieldName; return ;