From e0812e9fc3b77786bd5a175a22904452a714b826 Mon Sep 17 00:00:00 2001 From: "bai.zixv" Date: Mon, 29 Jul 2024 11:18:23 +0800 Subject: [PATCH] fix(approval): change component register (#1399) Reviewed-on: https://git.daoyoucloud.com/daoyoucloud/tachybase/pulls/1399 --- .../approver-interface/ApprovalUpdateForm.provider.tsx | 4 ++++ .../approver-interface/ApproverBlock.view.tsx | 2 ++ .../client/features/approval/usage/approval-block/plugin.ts | 3 +++ .../usage/approval-block/todos/VC.ViewActionTodosContent.tsx | 2 -- 4 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 packages/plugins/@tachybase/plugin-workflow/src/client/features/approval/configuration/instruction-approval/approver-interface/ApprovalUpdateForm.provider.tsx diff --git a/packages/plugins/@tachybase/plugin-workflow/src/client/features/approval/configuration/instruction-approval/approver-interface/ApprovalUpdateForm.provider.tsx b/packages/plugins/@tachybase/plugin-workflow/src/client/features/approval/configuration/instruction-approval/approver-interface/ApprovalUpdateForm.provider.tsx new file mode 100644 index 000000000..380db7208 --- /dev/null +++ b/packages/plugins/@tachybase/plugin-workflow/src/client/features/approval/configuration/instruction-approval/approver-interface/ApprovalUpdateForm.provider.tsx @@ -0,0 +1,4 @@ +// NOTE: 声明空组件, 便于配置时不受业务逻辑影响 +export const ProviderApprovalUpdateForm = (props) => { + return props.children; +}; diff --git a/packages/plugins/@tachybase/plugin-workflow/src/client/features/approval/configuration/instruction-approval/approver-interface/ApproverBlock.view.tsx b/packages/plugins/@tachybase/plugin-workflow/src/client/features/approval/configuration/instruction-approval/approver-interface/ApproverBlock.view.tsx index cb6b185ba..66f2fe85e 100644 --- a/packages/plugins/@tachybase/plugin-workflow/src/client/features/approval/configuration/instruction-approval/approver-interface/ApproverBlock.view.tsx +++ b/packages/plugins/@tachybase/plugin-workflow/src/client/features/approval/configuration/instruction-approval/approver-interface/ApproverBlock.view.tsx @@ -9,6 +9,7 @@ import { DetailsBlockProvider, SimpleDesigner } from '../../../../../components' import { FormBlockProvider } from '../../../common/FormBlock.provider'; import { flatSchemaArray } from '../../../constants'; import { ContextApproverConfig } from '../ApproverConfig.context'; +import { ProviderApprovalUpdateForm } from './ApprovalUpdateForm.provider'; import { ActionBarProvider } from './Pd.ActionBarProvider'; import { ApprovalActionProvider } from './Pd.ApprovalActionProvider'; import { ContextApproverBlock } from './Pd.SchemaConfigButtonContext'; @@ -87,6 +88,7 @@ export const ApproverBlock = ({ value: srcID, onChange }) => { ApprovalActionProvider, DetailsBlockProvider, SimpleDesigner, + ProviderApprovalUpdateForm, }} // @ts-ignore schema={schemaData} diff --git a/packages/plugins/@tachybase/plugin-workflow/src/client/features/approval/usage/approval-block/plugin.ts b/packages/plugins/@tachybase/plugin-workflow/src/client/features/approval/usage/approval-block/plugin.ts index bb2ffbe7f..0d0064410 100644 --- a/packages/plugins/@tachybase/plugin-workflow/src/client/features/approval/usage/approval-block/plugin.ts +++ b/packages/plugins/@tachybase/plugin-workflow/src/client/features/approval/usage/approval-block/plugin.ts @@ -4,6 +4,7 @@ import { tval } from '../../locale'; import { KitApprovalCommon } from '../approval-common/plugin'; import { ApprovalBlockComponent, SCApprovalBlock } from './ApprovalBlock.schema'; import { ViewActionLaunch } from './launch/VC.ViewActionLaunch'; +import { ProviderApprovalUpdateForm } from './todos/ApprovalUpdateForm.provider'; import { ViewActionTodos } from './todos/VC.ViewActionTodos'; export class KitApprovalBlock extends Plugin { @@ -17,6 +18,8 @@ export class KitApprovalBlock extends Plugin { 'ApprovalBlock.BlockInitializer': ApprovalBlockComponent, 'ApprovalBlock.ViewActionLaunch': ViewActionLaunch, 'ApprovalBlock.ViewActionTodos': ViewActionTodos, + // NOTE: 这里注册在全局, 而不是组件内的作用域, 是为了让手机端共享到 + ProviderApprovalUpdateForm: ProviderApprovalUpdateForm, }); this.app.schemaInitializerManager.get('page:addBlock').add('otherBlocks.approval', { diff --git a/packages/plugins/@tachybase/plugin-workflow/src/client/features/approval/usage/approval-block/todos/VC.ViewActionTodosContent.tsx b/packages/plugins/@tachybase/plugin-workflow/src/client/features/approval/usage/approval-block/todos/VC.ViewActionTodosContent.tsx index 301186bdc..b1d091032 100644 --- a/packages/plugins/@tachybase/plugin-workflow/src/client/features/approval/usage/approval-block/todos/VC.ViewActionTodosContent.tsx +++ b/packages/plugins/@tachybase/plugin-workflow/src/client/features/approval/usage/approval-block/todos/VC.ViewActionTodosContent.tsx @@ -19,7 +19,6 @@ import { ApprovalContext } from '../../approval-common/ApprovalData.provider'; import { ContextWithActionEnabled } from '../../approval-common/WithActionEnabled.provider'; import { ContextApprovalExecution } from '../common/ApprovalExecution.provider'; import { SchemaComponentContextProvider } from '../common/SchemaComponent.provider'; -import { ProviderApprovalUpdateForm } from './ApprovalUpdateForm.provider'; import { ApprovalFormBlockDecorator } from './Dt.ApprovalFormBlock'; import { useApprovalDetailBlockProps } from './hooks/useApprovalDetailBlockProps'; import { useApprovalFormBlockProps } from './hooks/useApprovalFormBlockProps'; @@ -99,7 +98,6 @@ export const ViewActionTodosContent = () => { ApprovalActionProvider, ApprovalFormBlockProvider: ApprovalFormBlockDecorator, DetailsBlockProvider, - ProviderApprovalUpdateForm, }} scope={{ useApprovalDetailBlockProps,