From 97f81d3237f3b62ed559827486cacd113f711e27 Mon Sep 17 00:00:00 2001 From: Katherine Date: Thu, 27 Feb 2025 16:44:33 +0800 Subject: [PATCH] fix: add new button appears on hover in association field read-only mode (#6322) * fix: add new button appears on hover in association field read-only mode * fix: bug --- .../antd/association-field/InternalViewer.tsx | 10 ++++++++-- .../schema-initializer/items/DataBlockInitializer.tsx | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/association-field/InternalViewer.tsx b/packages/core/client/src/schema-component/antd/association-field/InternalViewer.tsx index d58e19c3dd..e09ae7aca2 100644 --- a/packages/core/client/src/schema-component/antd/association-field/InternalViewer.tsx +++ b/packages/core/client/src/schema-component/antd/association-field/InternalViewer.tsx @@ -92,7 +92,6 @@ const RenderRecord = React.memo( const needWaitForFieldSchemaUpdatedRef = useRef(false); const fieldSchemaRef = useRef(fieldSchema); fieldSchemaRef.current = fieldSchema; - const getCustomActionSchema = useCallback(() => { return fieldSchemaRef.current; }, []); @@ -322,7 +321,14 @@ export const ReadPrettyInternalViewer: React.FC = // The recordData here is only provided when the popup is opened, not the current row record - + { + return v['x-component'] !== 'Action'; + }} + /> ); diff --git a/packages/core/client/src/schema-initializer/items/DataBlockInitializer.tsx b/packages/core/client/src/schema-initializer/items/DataBlockInitializer.tsx index 45c8d43ffd..79ba1ac7a7 100644 --- a/packages/core/client/src/schema-initializer/items/DataBlockInitializer.tsx +++ b/packages/core/client/src/schema-initializer/items/DataBlockInitializer.tsx @@ -306,6 +306,7 @@ export interface DataBlockInitializerProps { /** 用于更改 Other records 的文案 */ otherText?: string; children?: React.ReactNode; + alwaysRenderMenu?: boolean; //总是渲染为 SchemaInitializerMenu } export const DataBlockInitializer: FC = (props) => { @@ -328,6 +329,7 @@ export const DataBlockInitializer: FC = (props) => { filterOtherRecordsCollection, currentText, otherText, + alwaysRenderMenu, } = props; const { insert, setVisible } = useSchemaInitializer(); const compile = useCompile(); @@ -398,7 +400,7 @@ export const DataBlockInitializer: FC = (props) => { ]; }, [searchedChildren, hideChildrenIfSingleCollection, name, compile, title, icon, onClick, props]); - if (childItems.length > 1 || (childItems.length === 1 && childItems[0]?.children?.length > 0)) { + if (childItems.length > 1 || (childItems.length === 1 && childItems[0]?.children?.length > 0) || alwaysRenderMenu) { return ( {