From cfa252bfb046a3c7f0c0dd776283de3719926f66 Mon Sep 17 00:00:00 2001 From: katherinehhh Date: Tue, 1 Aug 2023 21:20:34 +0800 Subject: [PATCH] fix: modal will automatically close when configing fields to association field details in sub-table (#2371) --- .../association-field/InternalSubTable.tsx | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/association-field/InternalSubTable.tsx b/packages/core/client/src/schema-component/antd/association-field/InternalSubTable.tsx index b11f8aea55..7775f27b57 100644 --- a/packages/core/client/src/schema-component/antd/association-field/InternalSubTable.tsx +++ b/packages/core/client/src/schema-component/antd/association-field/InternalSubTable.tsx @@ -1,9 +1,9 @@ import { css } from '@emotion/css'; import { FormItem, FormLayout } from '@formily/antd-v5'; -import { RecursionField, observer, useField, useFieldSchema } from '@formily/react'; +import { RecursionField, observer, useField, useFieldSchema, SchemaOptionsContext } from '@formily/react'; import React, { useEffect } from 'react'; import { CollectionProvider } from '../../../collection-manager'; -import { SchemaComponentOptions } from '../../../schema-component'; +import { useSchemaOptionsContext } from '../../../schema-component'; import Select from '../select/Select'; import { useAssociationFieldContext, useInsertSchema } from './hooks'; import schema from './schema'; @@ -18,6 +18,14 @@ export const InternalSubTable = observer( insert(schema.SubTable); field.required = fieldSchema['required']; }, []); + + const option = useSchemaOptionsContext(); + const components = { + ...option.components, + FormItem: (props) => , + 'Radio.Group': Select, + 'Checkbox.Group': (props) => , + - + );