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
This commit is contained in:
katherinehhh 2024-01-18 09:46:27 +08:00 committed by GitHub
parent 8217ebfb1b
commit fe260d0371
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -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) => {

View File

@ -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();