From fe260d037199576f5b43ce31dfe5dfcc86eb5d69 Mon Sep 17 00:00:00 2001 From: katherinehhh Date: Thu, 18 Jan 2024 09:46:27 +0800 Subject: [PATCH] refactor: parent inherited collection support enable child collection in add new action (#3398) * refactor: parent inherited collectionsholud enable child collection in add new * fix: useisDetailBlock * fix: useIsDetailBlock * fix: useIsDetailBlock * fix: useIsDetailBlock --- packages/core/client/src/block-provider/FormBlockProvider.tsx | 3 ++- .../src/schema-component/antd/action/Action.Designer.tsx | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/core/client/src/block-provider/FormBlockProvider.tsx b/packages/core/client/src/block-provider/FormBlockProvider.tsx index b89173114..263fec308 100644 --- a/packages/core/client/src/block-provider/FormBlockProvider.tsx +++ b/packages/core/client/src/block-provider/FormBlockProvider.tsx @@ -86,7 +86,8 @@ export const useFormBlockType = () => { export const useIsDetailBlock = () => { const ctx = useFormBlockContext(); - return ctx.type !== 'create'; + const { fieldSchema } = useActionContext(); + return ctx.type !== 'create' && fieldSchema?.['x-acl-action'] !== 'create' && fieldSchema?.['x-action'] !== 'create'; }; export const FormBlockProvider = (props) => { diff --git a/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx b/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx index 33a9dddb6..836ceebda 100644 --- a/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx +++ b/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx @@ -23,6 +23,7 @@ import { SchemaSettingsModalItem, SchemaSettingsRemove, SchemaSettingsSwitchItem, + SchemaSettingsEnableChildCollections, } from '../../../schema-settings/SchemaSettings'; import { DefaultValueProvider } from '../../../schema-settings/hooks/useIsAllowToSetDefaultValue'; import { useLinkageAction } from './hooks'; @@ -754,7 +755,7 @@ export const actionSettingsItems: SchemaSettingOptions['items'] = [ }, { name: 'enableChildCollections', - Component: SchemaSettingsLinkageRules, + Component: SchemaSettingsEnableChildCollections, useVisible() { const fieldSchema = useFieldSchema(); const { name } = useCollection();