From ab49b6821377a11cd281d14cdc86de50ddaa1c64 Mon Sep 17 00:00:00 2001 From: sealday Date: Fri, 31 May 2024 18:53:11 +0800 Subject: [PATCH] fix: workflow plugins (#1094) Reviewed-on: https://git.daoyoucloud.com/daoyoucloud/tachybase/pulls/1094 --- .../aggregate/AggregateInstruction.tsx | 21 +++++++++---------- .../features/delay/DelayInstruction.tsx | 3 ++- .../DynamicCalculation.tsx | 14 ++++--------- .../src/client/nodes/index.tsx | 21 +++++++++---------- 4 files changed, 26 insertions(+), 33 deletions(-) diff --git a/packages/plugins/@tachybase/plugin-workflow/src/client/features/aggregate/AggregateInstruction.tsx b/packages/plugins/@tachybase/plugin-workflow/src/client/features/aggregate/AggregateInstruction.tsx index cd3698394..32af6d515 100644 --- a/packages/plugins/@tachybase/plugin-workflow/src/client/features/aggregate/AggregateInstruction.tsx +++ b/packages/plugins/@tachybase/plugin-workflow/src/client/features/aggregate/AggregateInstruction.tsx @@ -1,31 +1,30 @@ -import { useForm } from '@tachybase/schema'; -import { Cascader } from 'antd'; import React, { useCallback, useEffect, useState } from 'react'; - import { - SchemaComponentContext, - SchemaInitializerItemType, css, joinCollectionName, parseCollectionName, + SchemaComponentContext, + SchemaInitializerItemType, useCollectionDataSource, useCollectionFilterOptions, useCollectionManager_deprecated, useCompile, } from '@tachybase/client'; +import { useForm } from '@tachybase/schema'; + +import { Cascader } from 'antd'; import { - FieldsSelect, - FilterDynamicComponent, - ValueBlock, BaseTypeSets, defaultFieldNames, + FieldsSelect, + FilterDynamicComponent, nodesOptions, triggerOptions, - Instruction, + ValueBlock, } from '../..'; - -import { NAMESPACE, lang } from '../../locale'; +import { lang, NAMESPACE } from '../../locale'; +import { Instruction } from '../../nodes'; function matchToManyField(field): boolean { // const fieldPrefix = `${field.name}.`; diff --git a/packages/plugins/@tachybase/plugin-workflow/src/client/features/delay/DelayInstruction.tsx b/packages/plugins/@tachybase/plugin-workflow/src/client/features/delay/DelayInstruction.tsx index 4a78e4257..e0a58c5b0 100644 --- a/packages/plugins/@tachybase/plugin-workflow/src/client/features/delay/DelayInstruction.tsx +++ b/packages/plugins/@tachybase/plugin-workflow/src/client/features/delay/DelayInstruction.tsx @@ -3,8 +3,9 @@ import { useCompile } from '@tachybase/client'; import { InputNumber, Select } from 'antd'; -import { Instruction, JOB_STATUS } from '../..'; +import { JOB_STATUS } from '../..'; import { NAMESPACE } from '../../locale'; +import { Instruction } from '../../nodes'; const UnitOptions = [ { value: 1_000, label: `{{t('Seconds', { ns: "workflow" })}}` }, diff --git a/packages/plugins/@tachybase/plugin-workflow/src/client/features/dynamic-calculation/DynamicCalculation.tsx b/packages/plugins/@tachybase/plugin-workflow/src/client/features/dynamic-calculation/DynamicCalculation.tsx index d24701427..93f87c41a 100644 --- a/packages/plugins/@tachybase/plugin-workflow/src/client/features/dynamic-calculation/DynamicCalculation.tsx +++ b/packages/plugins/@tachybase/plugin-workflow/src/client/features/dynamic-calculation/DynamicCalculation.tsx @@ -1,15 +1,9 @@ import React from 'react'; +import { SchemaInitializerItemType, useCollectionManager_deprecated, Variable } from '@tachybase/client'; -import { SchemaInitializerItemType, Variable, useCollectionManager_deprecated } from '@tachybase/client'; -import { - BaseTypeSets, - Instruction, - ValueBlock, - WorkflowVariableInput, - defaultFieldNames, - useWorkflowVariableOptions, -} from '../..'; -import { NAMESPACE, lang } from '../../locale'; +import { BaseTypeSets, defaultFieldNames, useWorkflowVariableOptions, ValueBlock, WorkflowVariableInput } from '../..'; +import { lang, NAMESPACE } from '../../locale'; +import { Instruction } from '../../nodes'; function useDynamicExpressionCollectionFieldMatcher(field): boolean { if (!['belongsTo', 'hasOne'].includes(field.type)) { diff --git a/packages/plugins/@tachybase/plugin-workflow/src/client/nodes/index.tsx b/packages/plugins/@tachybase/plugin-workflow/src/client/nodes/index.tsx index 090f6be4d..764719763 100644 --- a/packages/plugins/@tachybase/plugin-workflow/src/client/nodes/index.tsx +++ b/packages/plugins/@tachybase/plugin-workflow/src/client/nodes/index.tsx @@ -1,32 +1,31 @@ -import { CloseOutlined, DeleteOutlined } from '@ant-design/icons'; -import { createForm } from '@tachybase/schema'; -import { ISchema, useForm } from '@tachybase/schema'; -import { App, Button, Dropdown, Input, Tag, Tooltip, message } from 'antd'; -import { cloneDeep } from 'lodash'; import React, { useCallback, useContext, useMemo, useState } from 'react'; -import { useTranslation } from 'react-i18next'; - import { ActionContextProvider, + css, + cx, FormProvider, SchemaComponent, SchemaInitializerItemType, - css, - cx, - useAPIClient, useActionContext, + useAPIClient, useCompile, usePlugin, useResourceActionContext, } from '@tachybase/client'; +import { createForm, ISchema, useForm } from '@tachybase/schema'; import { parse, str2moment } from '@tachybase/utils/client'; +import { CloseOutlined, DeleteOutlined } from '@ant-design/icons'; +import { App, Button, Dropdown, Input, message, Tag, Tooltip } from 'antd'; +import { cloneDeep } from 'lodash'; +import { useTranslation } from 'react-i18next'; + import WorkflowPlugin from '..'; import { AddButton } from '../AddButton'; -import { useFlowContext } from '../FlowContext'; import { DrawerDescription } from '../components/DrawerDescription'; import { StatusButton } from '../components/StatusButton'; import { JobStatusOptionsMap } from '../constants'; +import { useFlowContext } from '../FlowContext'; import { useGetAriaLabelOfAddButton } from '../hooks/useGetAriaLabelOfAddButton'; import { lang } from '../locale'; import useStyles from '../style';