fix: table column field failed to be actived (#2309)
This commit is contained in:
parent
68976e0ebe
commit
d068f9b5df
@ -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 <RecursionField basePath={basePath} schema={schema} onlyRenderProperties />;
|
||||
|
Loading…
Reference in New Issue
Block a user