diff --git a/packages/core/client/src/block-provider/BlockProvider.tsx b/packages/core/client/src/block-provider/BlockProvider.tsx index accdc3e0c..fe0043a2d 100644 --- a/packages/core/client/src/block-provider/BlockProvider.tsx +++ b/packages/core/client/src/block-provider/BlockProvider.tsx @@ -274,7 +274,6 @@ export const RenderChildrenWithAssociationFilter: React.FC = (props) => { }; export const BlockProvider = (props) => { - console.log(props); const { collection, association } = props; const resource = useResource(props); const params = { ...props.params }; diff --git a/packages/core/client/src/collection-manager/Configuration/AddFieldAction.tsx b/packages/core/client/src/collection-manager/Configuration/AddFieldAction.tsx index 0b7664bb4..453365b0d 100644 --- a/packages/core/client/src/collection-manager/Configuration/AddFieldAction.tsx +++ b/packages/core/client/src/collection-manager/Configuration/AddFieldAction.tsx @@ -240,28 +240,47 @@ export const AddFieldAction = (props) => { return optionArr; }, [getTemplate, record]); const items = useMemo(() => { - return getFieldOptions().map((option) => { - if (option.children.length === 0) { - return null; - } - - return { - type: 'group', - label: compile(option.label), - title: compile(option.label), - key: option.label, - children: option.children - .filter((child) => !['o2o', 'subTable', 'linkTo'].includes(child.name)) - .map((child) => { - return { - label: compile(child.title), - title: compile(child.title), - key: child.name, - dataTargetScope: child.targetScope, - }; - }), - }; - }); + return getFieldOptions() + .map((option) => { + if (option.children.length === 0) { + return null; + } + if (record.template === 'view') { + return { + type: 'group', + label: compile(option.label), + title: compile(option.label), + key: option.label, + children: option.children + .filter((child) => ['m2o'].includes(child.name)) + .map((child) => { + return { + label: compile(child.title), + title: compile(child.title), + key: child.name, + dataTargetScope: child.targetScope, + }; + }), + }; + } + return { + type: 'group', + label: compile(option.label), + title: compile(option.label), + key: option.label, + children: option.children + .filter((child) => !['o2o', 'subTable', 'linkTo'].includes(child.name)) + .map((child) => { + return { + label: compile(child.title), + title: compile(child.title), + key: child.name, + dataTargetScope: child.targetScope, + }; + }), + }; + }) + .filter((v) => v.children.length); }, [getFieldOptions]); const menu = useMemo(() => { return { @@ -283,37 +302,35 @@ export const AddFieldAction = (props) => { }; }, [getInterface, items, record]); return ( - record.template !== 'view' && ( - - - - {children || ( - - )} - - - - - ) + + + + {children || ( + + )} + + + + ); };