From 4333972debf3ee7f739a2b54869860ecc48886c3 Mon Sep 17 00:00:00 2001 From: YANG QIA <2013xile@gmail.com> Date: Wed, 19 Jul 2023 12:00:02 +0800 Subject: [PATCH] fix(client): using component as action title (#2274) --- .../core/client/src/schema-component/antd/action/Action.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/core/client/src/schema-component/antd/action/Action.tsx b/packages/core/client/src/schema-component/antd/action/Action.tsx index 22359c5b9..2f43696dc 100644 --- a/packages/core/client/src/schema-component/antd/action/Action.tsx +++ b/packages/core/client/src/schema-component/antd/action/Action.tsx @@ -21,6 +21,7 @@ import { ActionContextProvider } from './context'; import { useA } from './hooks'; import { ComposedAction } from './types'; import { linkageAction } from './utils'; +import { lodash } from '@nocobase/utils'; export const actionDesignerCss = css` position: relative; @@ -99,6 +100,8 @@ export const Action: ComposedAction = observer( const { designable } = useDesignable(); const tarComponent = useComponent(component) || component; const { modal } = App.useApp(); + let actionTitle = title || compile(fieldSchema.title); + actionTitle = lodash.isString(actionTitle) ? t(actionTitle) : actionTitle; useEffect(() => { field.linkageProperty = {}; @@ -148,7 +151,7 @@ export const Action: ComposedAction = observer( className={classnames(actionDesignerCss, className)} type={props.type === 'danger' ? undefined : props.type} > - {t(title || compile(fieldSchema.title))} + {actionTitle} );