refactor: from hera-core to @tachybase/plugin-workflow (#1156)

Co-authored-by: sealday <sealday@gmail.com>
Reviewed-on: daoyoucloud/tachybase#1156
This commit is contained in:
sealday 2024-06-11 21:17:42 +08:00
parent 848b99df0b
commit bc4c975a4d
162 changed files with 726 additions and 930 deletions

View File

@ -1,142 +0,0 @@
import { useCollectionDataSource, useCollectionManager_deprecated, useCompile } from '@tachybase/client';
import {
CheckboxGroupWithTooltip,
CollectionBlockInitializer,
FieldsSelect,
getCollectionFieldOptions,
RadioWithTooltip,
Trigger,
} from '@tachybase/plugin-workflow/client';
import { lang, tval } from '../../locale';
const enum ACTION_TYPES {
CREATE = 'create',
UPDATE = 'update',
UPSERT = 'updateOrCreate',
DESTROY = 'destroy',
}
function useItems(item, options) {
const compile = useCompile();
const { getCollectionFields } = useCollectionManager_deprecated();
return [
{ label: lang('ID'), value: 'filterByTk' },
...(item.action !== ACTION_TYPES.DESTROY
? [
{
label: lang('Values submitted'),
value: 'values',
children: getCollectionFieldOptions({
...options,
appends: null,
depth: 3,
collection: item.collection,
compile,
getCollectionFields,
}),
},
]
: []),
];
}
export class ApiTrigger extends Trigger {
title = lang('API event');
description = lang('api trigger');
fieldset = {
collection: {
type: 'string',
title: tval('Collection'),
required: true,
'x-decorator': 'FormItem',
'x-component': 'DataSourceCollectionCascader',
'x-reactions': [{ target: 'changed', effects: ['onFieldValueChange'], fulfill: { state: { value: [] } } }],
},
global: {
type: 'boolean',
title: tval('Trigger mode'),
'x-decorator': 'FormItem',
'x-component': 'RadioWithTooltip',
'x-component-props': {
direction: 'vertical',
options: [
{
label: tval('Local mode, triggered before executing the actions bound to this workflow'),
value: false,
},
{
label: tval('Global mode, triggered before executing the following actions'),
value: true,
},
],
},
default: false,
},
actions: {
type: 'number',
title: tval('Select actions'),
'x-decorator': 'FormItem',
'x-component': 'CheckboxGroupWithTooltip',
'x-component-props': {
direction: 'vertical',
options: [
{ label: tval('Create record action'), value: ACTION_TYPES.CREATE },
{ label: tval('Update record action'), value: ACTION_TYPES.UPDATE },
{ label: tval('Delete record action'), value: ACTION_TYPES.DESTROY },
],
},
required: true,
'x-reactions': [
{ dependencies: ['collection', 'global'], fulfill: { state: { visible: '{{!!$deps[0] && !!$deps[1]}}' } } },
],
},
};
scope = { useCollectionDataSource };
components = {
FieldsSelect: FieldsSelect,
RadioWithTooltip: RadioWithTooltip,
CheckboxGroupWithTooltip: CheckboxGroupWithTooltip,
};
isActionTriggerable = (a, u) => {
const { global: m } = a;
return !m && !u.direct;
};
useVariables(config, options) {
// eslint-disable-next-line react-hooks/rules-of-hooks
const compile = useCompile();
// eslint-disable-next-line react-hooks/rules-of-hooks
const { getCollectionFields } = useCollectionManager_deprecated();
const result = getCollectionFieldOptions({
appends: ['user'],
...options,
fields: [
{
collectionName: 'users',
name: 'user',
type: 'hasOne',
target: 'users',
uiSchema: { title: tval('User acted') },
},
],
compile,
getCollectionFields,
});
// eslint-disable-next-line react-hooks/rules-of-hooks
const parametersSchema = [{ label: lang('Parameters'), value: 'params', children: useItems(config, options) }];
return [...result, { label: lang('Role of user acted'), value: 'roleName' }, ...parametersSchema];
}
useInitializers(item) {
return item.collection
? {
name: 'triggerData',
type: 'item',
key: 'triggerData',
title: tval('Trigger data'),
Component: CollectionBlockInitializer,
collection: item.collection,
dataPath: '$context.params.values',
}
: null;
}
}

View File

@ -1,105 +0,0 @@
import {
ActionDesigner,
SchemaSettings,
SchemaSettingsItemType,
useDesignable,
useRequest,
useSchemaToolbar,
} from '@tachybase/client';
import { useFieldSchema } from '@tachybase/schema';
import { useTranslation } from 'react-i18next';
const schemaSettingsItems: SchemaSettingsItemType[] = [
{
name: 'editButton',
Component: ActionDesigner.ButtonEditor,
useComponentProps() {
const { buttonEditorProps } = useSchemaToolbar();
return buttonEditorProps;
},
},
{
name: 'Date',
type: 'select',
useComponentProps() {
const { dn } = useDesignable();
const { t } = useTranslation();
const fieldSchema = useFieldSchema();
return {
title: t('Data will be updated'),
options: [
{ label: t('Selected'), value: 'selected' },
{ label: t('All'), value: 'all' },
],
value: fieldSchema['x-action-settings']?.['updateMode'],
onChange: (value) => {
fieldSchema['x-action-settings']['updateMode'] = value;
dn.emit('patch', {
schema: {
'x-uid': fieldSchema['x-uid'],
'x-action-settings': fieldSchema['x-action-settings'],
},
});
},
};
},
},
{
name: 'Bind workflow',
type: 'select',
useComponentProps() {
const { dn } = useDesignable();
const { t } = useTranslation();
const fieldSchema = useFieldSchema();
const { data } = useRequest<any>({
resource: 'workflows',
action: 'list',
params: {
filter: {
type: 'api',
},
},
});
// FIXME 不会实时生效
const options =
data?.data?.map((workflow) => ({
label: workflow.title,
value: workflow.id,
})) ?? [];
return {
title: t('Bind workflow'),
value: fieldSchema['x-action-settings'].bindWorkflow,
options: options.concat({
label: t('disabled'),
value: false,
}),
onChange(value) {
fieldSchema['x-action-settings'].bindWorkflow = value;
dn.emit('patch', {
schema: {
'x-uid': fieldSchema['x-uid'],
'x-action-settings': fieldSchema['x-action-settings'],
},
});
},
};
},
},
{
name: 'remove',
sort: 100,
Component: ActionDesigner.RemoveButton as any,
useComponentProps() {
const { removeButtonProps } = useSchemaToolbar();
return removeButtonProps;
},
},
];
const bulkWorkflowActionSettings = new SchemaSettings({
name: 'actionSettings:bulkWorkflow',
items: schemaSettingsItems,
});
export { bulkWorkflowActionSettings };

View File

@ -1,31 +0,0 @@
import React from 'react';
import { BlockInitializer, useSchemaInitializerItem } from '@tachybase/client';
import { tval } from '../../locale';
export const BulkWorkflowActionInitializer = () => {
const itemConfig = useSchemaInitializerItem();
const schema = {
type: 'void',
title: tval('Bulk workflow'),
'x-component': 'Action',
'x-use-component-props': 'useCustomizeBulkWorkflowActionProps',
'x-align': 'right',
'x-acl-action': 'update',
'x-decorator': 'ACLActionProvider',
'x-acl-action-props': {
skipScopeCheck: true,
},
'x-action': 'customize:bulkWorkflow',
'x-toolbar': 'ActionSchemaToolbar',
'x-settings': 'actionSettings:bulkWorkflow',
'x-action-settings': {
bindWorkflow: false,
updateMode: 'selected',
},
'x-component-props': {
icon: 'CarryOutOutlined',
},
};
return <BlockInitializer {...itemConfig} schema={schema} item={itemConfig} />;
};

View File

@ -1,37 +0,0 @@
import { Plugin, useCollection } from '@tachybase/client';
import PluginWorkflow from '@tachybase/plugin-workflow/client';
import { tval } from '../../locale';
import { ApiTrigger } from './ApiTrigger';
import { bulkWorkflowActionSettings } from './BulkUpdateAction.Settings';
import { BulkWorkflowActionInitializer } from './BulkUpdateActionInitializer';
import { useCustomizeBulkWorkflowActionProps } from './utils';
export class PluginWorkflowBulk extends Plugin {
async load() {
this.app.addComponents({ BulkWorkflowActionInitializer });
this.app.addScopes({ useCustomizeBulkWorkflowActionProps });
this.app.schemaSettingsManager.add(bulkWorkflowActionSettings);
const initializerData = {
title: tval('Bulk workflow'),
Component: 'BulkWorkflowActionInitializer',
name: 'bulkWorkflow',
useVisible() {
const collection = useCollection();
return (
(collection.template !== 'view' || collection?.writableView) &&
collection.template !== 'file' &&
collection.template !== 'sql'
);
},
};
['table', 'details'].forEach((block) => {
this.app.schemaInitializerManager.addItem(block + ':configureActions', 'customize.bulkWorkflow', initializerData);
});
const plugin = this.app.pm.get(PluginWorkflow) as PluginWorkflow;
plugin.registerTrigger('api', ApiTrigger);
}
}

View File

@ -1,104 +0,0 @@
import { useContext } from 'react';
import {
isVariable,
transformVariableValue,
useBlockRequestContext,
useCollection_deprecated,
useCompile,
useLocalVariables,
useRecord,
useRequest,
useTableBlockContext,
useVariables,
} from '@tachybase/client';
import { SchemaExpressionScopeContext, useField, useFieldSchema } from '@tachybase/schema';
import { App } from 'antd';
import { useNavigate } from 'react-router-dom';
import { useTranslation } from '../../locale';
export const useCustomizeBulkWorkflowActionProps = () => {
const { field, resource, __parent, service } = useBlockRequestContext();
const expressionScope = useContext(SchemaExpressionScopeContext);
const actionSchema = useFieldSchema();
const tableBlockContext = useTableBlockContext();
const { rowKey } = tableBlockContext;
const selectedRecordKeys =
tableBlockContext.field?.data?.selectedRowKeys ?? expressionScope?.selectedRecordKeys ?? {};
const navigate = useNavigate();
const compile = useCompile();
const { t } = useTranslation();
const actionField: any = useField();
const { modal } = App.useApp();
const variables = useVariables();
const record = useRecord();
const { name, getField } = useCollection_deprecated();
const localVariables = useLocalVariables();
const { run } = useRequest(
{
resource: 'workflows',
action: 'trigger',
},
{
manual: true,
},
);
return {
async onClick() {
const {
bindWorkflow = false,
assignedValues: originalAssignedValues = {},
updateMode,
} = actionSchema?.['x-action-settings'] ?? {};
actionField.data = field.data || {};
actionField.data.loading = true;
if (!bindWorkflow) {
return modal.info({
title: t('Not bind workflow!'),
});
}
const assignedValues = {};
const waitList = Object.keys(originalAssignedValues).map(async (key) => {
const value = originalAssignedValues[key];
const collectionField = getField(key);
if (process.env.NODE_ENV !== 'production') {
if (!collectionField) {
throw new Error(`useCustomizeBulkUpdateActionProps: field "${key}" not found in collection "${name}"`);
}
}
if (isVariable(value)) {
const result = await variables?.parseVariable(value, localVariables);
if (result) {
assignedValues[key] = transformVariableValue(result, { targetCollectionField: collectionField });
}
} else if (value != null && value !== '') {
assignedValues[key] = value;
}
});
await Promise.all(waitList);
modal.confirm({
title: t('Bulk update', { ns: 'client' }),
content:
updateMode === 'selected'
? t('Update selected data?', { ns: 'client' })
: t('Update all data?', { ns: 'client' }),
async onOk() {
run({
filterByTk: bindWorkflow,
});
actionField.data.loading = false;
},
async onCancel() {
actionField.data.loading = false;
},
});
},
};
};

View File

@ -25,8 +25,6 @@ import { PluginHeraVersion } from './features/hera-version';
import { PluginOutbound } from './features/outbound'; import { PluginOutbound } from './features/outbound';
import { PluginPageStyle } from './features/page-style'; import { PluginPageStyle } from './features/page-style';
import { PluginPDF } from './features/pdf'; import { PluginPDF } from './features/pdf';
import { PluginWorkflowBulk } from './features/workflow-bulk';
import { PluginWorkflowInterceptor } from './features/workflow-interceptor';
import { useGetCustomAssociatedComponents } from './hooks/useGetCustomAssociatedComponents'; import { useGetCustomAssociatedComponents } from './hooks/useGetCustomAssociatedComponents';
import { useGetCustomComponents } from './hooks/useGetCustomComponents'; import { useGetCustomComponents } from './hooks/useGetCustomComponents';
import { import {
@ -82,8 +80,6 @@ export class PluginCoreClient extends Plugin {
await this.app.pm.add(PluginHeraVersion); await this.app.pm.add(PluginHeraVersion);
await this.app.pm.add(PluginContextMenu); await this.app.pm.add(PluginContextMenu);
await this.app.pm.add(PluginAssistant); await this.app.pm.add(PluginAssistant);
await this.app.pm.add(PluginWorkflowBulk);
await this.app.pm.add(PluginWorkflowInterceptor);
await this.app.pm.add(PluginPDF); await this.app.pm.add(PluginPDF);
await this.app.pm.add(PluginExtendedFilterForm); await this.app.pm.add(PluginExtendedFilterForm);
await this.app.pm.add(PluginOutbound); await this.app.pm.add(PluginOutbound);

View File

@ -1,7 +0,0 @@
import { Trigger } from '@tachybase/plugin-workflow';
export class ApiTrigger extends Trigger {
static TYPE = 'api';
on() {}
off() {}
}

View File

@ -5,7 +5,6 @@ import Application, { InstallOptions, NoticeLevel, Plugin, type PluginOptions }
import { Container } from '@tachybase/utils'; import { Container } from '@tachybase/utils';
import { DepartmentsPlugin } from './features/departments'; import { DepartmentsPlugin } from './features/departments';
import { PluginInterception } from './features/interception';
import CalcField from './fields/calc'; import CalcField from './fields/calc';
import TstzrangeField from './fields/tstzrange'; import TstzrangeField from './fields/tstzrange';
import { ConnectionManager } from './services/connection-manager'; import { ConnectionManager } from './services/connection-manager';
@ -15,11 +14,9 @@ import { WebControllerService as WebService } from './services/web-service';
export class PluginCoreServer extends Plugin { export class PluginCoreServer extends Plugin {
pluginDepartments: DepartmentsPlugin; pluginDepartments: DepartmentsPlugin;
pluginInterception: PluginInterception;
constructor(app: Application, options?: PluginOptions) { constructor(app: Application, options?: PluginOptions) {
super(app, options); super(app, options);
this.pluginDepartments = new DepartmentsPlugin(app, options); this.pluginDepartments = new DepartmentsPlugin(app, options);
this.pluginInterception = new PluginInterception(app, options);
} }
async afterAdd() { async afterAdd() {
this.db.registerFieldTypes({ this.db.registerFieldTypes({
@ -32,7 +29,6 @@ export class PluginCoreServer extends Plugin {
} }
async load() { async load() {
await this.pluginDepartments.load(); await this.pluginDepartments.load();
await this.pluginInterception.load();
try { try {
await Container.get(ConnectionManager).load(); await Container.get(ConnectionManager).load();
const fontManger = Container.get(FontManager); const fontManger = Container.get(FontManager);

View File

@ -1,9 +1,9 @@
import React, { useCallback, useMemo } from 'react'; import React, { useCallback, useMemo } from 'react';
import { Button, Dropdown, MenuProps } from 'antd';
import { PlusOutlined } from '@ant-design/icons';
import { css, useAPIClient, useCompile, usePlugin } from '@tachybase/client'; import { css, useAPIClient, useCompile, usePlugin } from '@tachybase/client';
import { PlusOutlined } from '@ant-design/icons';
import { Button, Dropdown, MenuProps } from 'antd';
import WorkflowPlugin from '.'; import WorkflowPlugin from '.';
import { useFlowContext } from './FlowContext'; import { useFlowContext } from './FlowContext';
import { NAMESPACE } from './locale'; import { NAMESPACE } from './locale';

View File

@ -1,8 +1,8 @@
import React from 'react'; import React from 'react';
import { CloseOutlined } from '@ant-design/icons';
import { css, cx } from '@tachybase/client'; import { css, cx } from '@tachybase/client';
import { CloseOutlined } from '@ant-design/icons';
import { AddButton } from './AddButton'; import { AddButton } from './AddButton';
import { useGetAriaLabelOfAddButton } from './hooks/useGetAriaLabelOfAddButton'; import { useGetAriaLabelOfAddButton } from './hooks/useGetAriaLabelOfAddButton';
import { Node } from './nodes'; import { Node } from './nodes';

View File

@ -1,7 +1,4 @@
import React, { useCallback, useEffect, useState } from 'react'; import React, { useCallback, useEffect, useState } from 'react';
import { Link, useNavigate } from 'react-router-dom';
import { Breadcrumb, Button, Dropdown, message, Modal, Result, Space, Spin, Tag, Tooltip } from 'antd';
import { import {
ActionContextProvider, ActionContextProvider,
cx, cx,
@ -15,16 +12,19 @@ import {
} from '@tachybase/client'; } from '@tachybase/client';
import { str2moment } from '@tachybase/utils/client'; import { str2moment } from '@tachybase/utils/client';
import { DownOutlined, ExclamationCircleFilled, StopOutlined } from '@ant-design/icons';
import { Breadcrumb, Button, Dropdown, message, Modal, Result, Space, Spin, Tag, Tooltip } from 'antd';
import { useTranslation } from 'react-i18next';
import { Link, useNavigate } from 'react-router-dom';
import WorkflowPlugin from '.'; import WorkflowPlugin from '.';
import { CanvasContent } from './CanvasContent'; import { CanvasContent } from './CanvasContent';
import { StatusButton } from './components/StatusButton';
import { ExecutionStatusOptionsMap, JobStatusOptions } from './constants'; import { ExecutionStatusOptionsMap, JobStatusOptions } from './constants';
import { FlowContext, useFlowContext } from './FlowContext'; import { FlowContext, useFlowContext } from './FlowContext';
import { lang, NAMESPACE } from './locale'; import { lang, NAMESPACE } from './locale';
import useStyles from './style'; import useStyles from './style';
import { linkNodes, getWorkflowDetailPath, getWorkflowExecutionsPath } from './utils'; import { getWorkflowDetailPath, getWorkflowExecutionsPath, linkNodes } from './utils';
import { DownOutlined, ExclamationCircleFilled, StopOutlined } from '@ant-design/icons';
import { StatusButton } from './components/StatusButton';
import { useTranslation } from 'react-i18next';
function attachJobs(nodes, jobs: any[] = []): void { function attachJobs(nodes, jobs: any[] = []): void {
const nodesMap = new Map(); const nodesMap = new Map();

View File

@ -1,5 +1,4 @@
import React from 'react'; import React from 'react';
import { SchemaComponentOptions, usePlugin } from '@tachybase/client'; import { SchemaComponentOptions, usePlugin } from '@tachybase/client';
import PluginWorkflowClient, { FlowContext } from '.'; import PluginWorkflowClient, { FlowContext } from '.';

View File

@ -1,9 +1,9 @@
import React from 'react'; import React from 'react';
import { useActionContext, useRecord } from '@tachybase/client';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { useActionContext, useRecord } from '@tachybase/client';
import { getWorkflowExecutionsPath } from './utils'; import { getWorkflowExecutionsPath } from './utils';
export const ExecutionLink = () => { export const ExecutionLink = () => {

View File

@ -1,6 +1,8 @@
import { cx, SchemaComponent } from '@tachybase/client';
import React from 'react'; import React from 'react';
import { cx, SchemaComponent } from '@tachybase/client';
import { useParams } from 'react-router-dom'; import { useParams } from 'react-router-dom';
import { ExecutionCanvas } from './ExecutionCanvas'; import { ExecutionCanvas } from './ExecutionCanvas';
import useStyles from './style'; import useStyles from './style';

View File

@ -0,0 +1,146 @@
import React from 'react';
import { Plugin } from '@tachybase/client';
import { Registry } from '@tachybase/utils/client';
import { ExecutionPage } from './ExecutionPage';
import { PluginActionTrigger } from './features/action-trigger';
import { PluginAggregate } from './features/aggregate';
import { PluginAPIRegularClient } from './features/api-regular';
import { PluginDelay } from './features/delay';
import { PluginDaynamicCalculation } from './features/dynamic-calculation';
import { PluginWorkflowInterceptor } from './features/interceptor';
import PluginWorkflowJSParseClient from './features/js-parse';
import PluginWorkflowJsonParseClient from './features/json-parse';
import { PluginLoop } from './features/loop';
import { PluginManual } from './features/manual';
import { PluginParallel } from './features/parallel';
import { PluginRequest } from './features/request';
import { PluginSql } from './features/sql';
import { PluginVariables } from './features/variables';
import { NAMESPACE } from './locale';
import { Instruction } from './nodes';
import CalculationInstruction from './nodes/calculation';
import ConditionInstruction from './nodes/condition';
import CreateInstruction from './nodes/create';
import DestroyInstruction from './nodes/destroy';
import EndInstruction from './nodes/end';
import QueryInstruction from './nodes/query';
import UpdateInstruction from './nodes/update';
import { customizeSubmitToWorkflowActionSettings } from './settings/customizeSubmitToWorkflowActionSettings';
import { Trigger } from './triggers';
import CollectionTrigger from './triggers/collection';
import ScheduleTrigger from './triggers/schedule';
import { getWorkflowDetailPath, getWorkflowExecutionsPath } from './utils';
import { WorkflowPage } from './WorkflowPage';
import { WorkflowPane } from './WorkflowPane';
export class PluginWorkflow extends Plugin {
triggers = new Registry<Trigger>();
instructions = new Registry<Instruction>();
getTriggersOptions = () => {
return Array.from(this.triggers.getEntities()).map(([value, { title, ...options }]) => ({
value,
label: title,
color: 'gold',
options,
}));
};
isWorkflowSync(workflow) {
return this.triggers.get(workflow.type).sync ?? workflow.sync;
}
registerTrigger(type: string, trigger: Trigger | { new (): Trigger }) {
if (typeof trigger === 'function') {
this.triggers.register(type, new trigger());
} else if (trigger) {
this.triggers.register(type, trigger);
} else {
throw new TypeError('invalid trigger type to register');
}
}
registerInstruction(type: string, instruction: Instruction | { new (): Instruction }) {
if (typeof instruction === 'function') {
this.instructions.register(type, new instruction());
} else if (instruction instanceof Instruction) {
this.instructions.register(type, instruction);
} else {
throw new TypeError('invalid instruction type to register');
}
}
async afterAdd() {
await this.pm.add(PluginSql);
await this.pm.add(PluginRequest);
await this.pm.add(PluginParallel);
await this.pm.add(PluginManual);
await this.pm.add(PluginLoop);
await this.pm.add(PluginDaynamicCalculation);
await this.pm.add(PluginDelay);
await this.pm.add(PluginAggregate);
await this.pm.add(PluginActionTrigger);
await this.pm.add(PluginWorkflowJsonParseClient);
await this.pm.add(PluginWorkflowJSParseClient);
await this.pm.add(PluginAPIRegularClient);
await this.pm.add(PluginWorkflowInterceptor);
await this.pm.add(PluginVariables);
}
async load() {
this.addRoutes();
this.addComponents();
this.app.pluginSettingsManager.add(NAMESPACE, {
icon: 'PartitionOutlined',
title: `{{t("Workflow", { ns: "${NAMESPACE}" })}}`,
Component: WorkflowPane,
aclSnippet: 'pm.workflow.workflows',
});
this.app.schemaSettingsManager.add(customizeSubmitToWorkflowActionSettings);
this.registerTrigger('collection', CollectionTrigger);
this.registerTrigger('schedule', ScheduleTrigger);
this.registerInstruction('calculation', CalculationInstruction);
this.registerInstruction('condition', ConditionInstruction);
this.registerInstruction('end', EndInstruction);
this.registerInstruction('query', QueryInstruction);
this.registerInstruction('create', CreateInstruction);
this.registerInstruction('update', UpdateInstruction);
this.registerInstruction('destroy', DestroyInstruction);
}
addComponents() {
this.app.addComponents({
WorkflowPage,
ExecutionPage,
});
}
addRoutes() {
this.app.router.add('admin.workflow.workflows.id', {
path: getWorkflowDetailPath(':id'),
element: <WorkflowPage />,
});
this.app.router.add('admin.workflow.executions.id', {
path: getWorkflowExecutionsPath(':id'),
element: <ExecutionPage />,
});
}
}
export * from './Branch';
export * from './FlowContext';
export * from './constants';
export * from './nodes';
export { Trigger, useTrigger } from './triggers';
export * from './variable';
export * from './components';
export * from './utils';
export * from './hooks';
export { default as useStyles } from './style';
export * from './variable';
export * from './ExecutionContextProvider';

View File

@ -1,9 +1,9 @@
import React from 'react'; import React from 'react';
import { useActionContext, useGetAriaLabelOfAction, useRecord } from '@tachybase/client';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { useActionContext, useGetAriaLabelOfAction, useRecord } from '@tachybase/client';
import { getWorkflowDetailPath } from './utils'; import { getWorkflowDetailPath } from './utils';
export const WorkflowLink = () => { export const WorkflowLink = () => {

View File

@ -1,6 +1,8 @@
import { cx, SchemaComponent } from '@tachybase/client';
import React from 'react'; import React from 'react';
import { cx, SchemaComponent } from '@tachybase/client';
import { useParams } from 'react-router-dom'; import { useParams } from 'react-router-dom';
import useStyles from './style'; import useStyles from './style';
import { WorkflowCanvas } from './WorkflowCanvas'; import { WorkflowCanvas } from './WorkflowCanvas';

View File

@ -1,17 +1,18 @@
import { faker } from '@faker-js/faker';
import { import {
ScheduleTriggerNode,
WorkflowListRecords,
apiCreateWorkflow, apiCreateWorkflow,
apiDeleteWorkflow, apiDeleteWorkflow,
apiGetWorkflow, apiGetWorkflow,
apiUpdateWorkflowTrigger, apiUpdateWorkflowTrigger,
appendJsonCollectionName, appendJsonCollectionName,
generalWithNoRelationalFields, generalWithNoRelationalFields,
ScheduleTriggerNode,
WorkflowListRecords,
} from '@tachybase/plugin-workflow-test/e2e'; } from '@tachybase/plugin-workflow-test/e2e';
import { expect, test } from '@tachybase/test/e2e'; import { expect, test } from '@tachybase/test/e2e';
import { dayjs } from '@tachybase/utils'; import { dayjs } from '@tachybase/utils';
import { faker } from '@faker-js/faker';
test.describe('Configuration page to configure the Trigger node', () => { test.describe('Configuration page to configure the Trigger node', () => {
test('Triggered one minute after the current time of the customized time', async ({ test('Triggered one minute after the current time of the customized time', async ({
page, page,

View File

@ -1,12 +1,13 @@
import { faker } from '@faker-js/faker';
import { import {
CreateWorkFlow,
EditWorkFlow,
apiCreateWorkflow, apiCreateWorkflow,
apiDeleteWorkflow, apiDeleteWorkflow,
CreateWorkFlow,
EditWorkFlow,
} from '@tachybase/plugin-workflow-test/e2e'; } from '@tachybase/plugin-workflow-test/e2e';
import { expect, test } from '@tachybase/test/e2e'; import { expect, test } from '@tachybase/test/e2e';
import { faker } from '@faker-js/faker';
test.describe('Filter', () => { test.describe('Filter', () => {
test('filter workflow name', async ({ page }) => { test('filter workflow name', async ({ page }) => {
//添加工作流 //添加工作流

View File

@ -1,10 +1,5 @@
import { faker } from '@faker-js/faker';
import { import {
AggregateNode, AggregateNode,
ClculationNode,
CollectionTriggerNode,
CreateRecordNode,
QueryRecordNode,
apiCreateWorkflow, apiCreateWorkflow,
apiCreateWorkflowNode, apiCreateWorkflowNode,
apiDeleteWorkflow, apiDeleteWorkflow,
@ -14,11 +9,17 @@ import {
apiUpdateWorkflowNode, apiUpdateWorkflowNode,
apiUpdateWorkflowTrigger, apiUpdateWorkflowTrigger,
appendJsonCollectionName, appendJsonCollectionName,
ClculationNode,
CollectionTriggerNode,
CreateRecordNode,
generalWithNoRelationalFields, generalWithNoRelationalFields,
QueryRecordNode,
} from '@tachybase/plugin-workflow-test/e2e'; } from '@tachybase/plugin-workflow-test/e2e';
import { expect, test } from '@tachybase/test/e2e'; import { expect, test } from '@tachybase/test/e2e';
import { dayjs } from '@tachybase/utils'; import { dayjs } from '@tachybase/utils';
import { faker } from '@faker-js/faker';
test('Collection event add data trigger, get trigger node single line text variable', async ({ test('Collection event add data trigger, get trigger node single line text variable', async ({
page, page,
mockCollections, mockCollections,

View File

@ -1,10 +1,5 @@
import { faker } from '@faker-js/faker';
import { import {
AggregateNode, AggregateNode,
ClculationNode,
CollectionTriggerNode,
CreateRecordNode,
QueryRecordNode,
apiCreateWorkflow, apiCreateWorkflow,
apiCreateWorkflowNode, apiCreateWorkflowNode,
apiDeleteWorkflow, apiDeleteWorkflow,
@ -14,11 +9,17 @@ import {
apiUpdateWorkflowNode, apiUpdateWorkflowNode,
apiUpdateWorkflowTrigger, apiUpdateWorkflowTrigger,
appendJsonCollectionName, appendJsonCollectionName,
ClculationNode,
CollectionTriggerNode,
CreateRecordNode,
generalWithNoRelationalFields, generalWithNoRelationalFields,
QueryRecordNode,
} from '@tachybase/plugin-workflow-test/e2e'; } from '@tachybase/plugin-workflow-test/e2e';
import { expect, test } from '@tachybase/test/e2e'; import { expect, test } from '@tachybase/test/e2e';
import { dayjs } from '@tachybase/utils'; import { dayjs } from '@tachybase/utils';
import { faker } from '@faker-js/faker';
test('Collection event add data trigger, get trigger node single line text variable', async ({ test('Collection event add data trigger, get trigger node single line text variable', async ({
page, page,
mockCollections, mockCollections,

View File

@ -1,19 +1,20 @@
import { faker } from '@faker-js/faker';
import { import {
CollectionTriggerNode,
CreateWorkFlow,
EditWorkFlow,
WorkflowListRecords,
apiCreateWorkflow, apiCreateWorkflow,
apiDeleteWorkflow, apiDeleteWorkflow,
apiGetWorkflow, apiGetWorkflow,
apiUpdateRecord, apiUpdateRecord,
apiUpdateWorkflowTrigger, apiUpdateWorkflowTrigger,
appendJsonCollectionName, appendJsonCollectionName,
CollectionTriggerNode,
CreateWorkFlow,
EditWorkFlow,
generalWithNoRelationalFields, generalWithNoRelationalFields,
WorkflowListRecords,
} from '@tachybase/plugin-workflow-test/e2e'; } from '@tachybase/plugin-workflow-test/e2e';
import { expect, test } from '@tachybase/test/e2e'; import { expect, test } from '@tachybase/test/e2e';
import { faker } from '@faker-js/faker';
test.describe('Configuration page to configure the Trigger node', () => { test.describe('Configuration page to configure the Trigger node', () => {
test('Add Data Trigger with No Filter', async ({ page, mockCollections, mockRecords }) => { test('Add Data Trigger with No Filter', async ({ page, mockCollections, mockRecords }) => {
//数据表后缀标识 //数据表后缀标识

View File

@ -1,19 +1,20 @@
import { faker } from '@faker-js/faker';
import { import {
CollectionTriggerNode,
CreateWorkFlow,
EditWorkFlow,
WorkflowListRecords,
apiCreateWorkflow, apiCreateWorkflow,
apiDeleteWorkflow, apiDeleteWorkflow,
apiGetWorkflow, apiGetWorkflow,
apiUpdateRecord, apiUpdateRecord,
apiUpdateWorkflowTrigger, apiUpdateWorkflowTrigger,
appendJsonCollectionName, appendJsonCollectionName,
CollectionTriggerNode,
CreateWorkFlow,
EditWorkFlow,
generalWithNoRelationalFields, generalWithNoRelationalFields,
WorkflowListRecords,
} from '@tachybase/plugin-workflow-test/e2e'; } from '@tachybase/plugin-workflow-test/e2e';
import { expect, test } from '@tachybase/test/e2e'; import { expect, test } from '@tachybase/test/e2e';
import { faker } from '@faker-js/faker';
test.describe('Filter', () => { test.describe('Filter', () => {
test('filter workflow name', async ({ page }) => { test('filter workflow name', async ({ page }) => {
//添加工作流 //添加工作流

View File

@ -1,9 +1,4 @@
import { faker } from '@faker-js/faker';
import { import {
ClculationNode,
CollectionTriggerNode,
ConditionBranchNode,
QueryRecordNode,
apiCreateWorkflow, apiCreateWorkflow,
apiCreateWorkflowNode, apiCreateWorkflowNode,
apiDeleteWorkflow, apiDeleteWorkflow,
@ -12,11 +7,17 @@ import {
apiGetWorkflowNodeExecutions, apiGetWorkflowNodeExecutions,
apiUpdateWorkflowTrigger, apiUpdateWorkflowTrigger,
appendJsonCollectionName, appendJsonCollectionName,
ClculationNode,
CollectionTriggerNode,
ConditionBranchNode,
generalWithNoRelationalFields, generalWithNoRelationalFields,
QueryRecordNode,
} from '@tachybase/plugin-workflow-test/e2e'; } from '@tachybase/plugin-workflow-test/e2e';
import { expect, test } from '@tachybase/test/e2e'; import { expect, test } from '@tachybase/test/e2e';
import { dayjs } from '@tachybase/utils'; import { dayjs } from '@tachybase/utils';
import { faker } from '@faker-js/faker';
test('Collection event add data trigger, determines that the trigger node single line text field variable is equal to an equal constant, passes.', async ({ test('Collection event add data trigger, determines that the trigger node single line text field variable is equal to an equal constant, passes.', async ({
page, page,
mockCollections, mockCollections,

View File

@ -1,9 +1,4 @@
import { faker } from '@faker-js/faker';
import { import {
ClculationNode,
CollectionTriggerNode,
ConditionBranchNode,
QueryRecordNode,
apiCreateWorkflow, apiCreateWorkflow,
apiCreateWorkflowNode, apiCreateWorkflowNode,
apiDeleteWorkflow, apiDeleteWorkflow,
@ -12,11 +7,17 @@ import {
apiGetWorkflowNodeExecutions, apiGetWorkflowNodeExecutions,
apiUpdateWorkflowTrigger, apiUpdateWorkflowTrigger,
appendJsonCollectionName, appendJsonCollectionName,
ClculationNode,
CollectionTriggerNode,
ConditionBranchNode,
generalWithNoRelationalFields, generalWithNoRelationalFields,
QueryRecordNode,
} from '@tachybase/plugin-workflow-test/e2e'; } from '@tachybase/plugin-workflow-test/e2e';
import { expect, test } from '@tachybase/test/e2e'; import { expect, test } from '@tachybase/test/e2e';
import { dayjs } from '@tachybase/utils'; import { dayjs } from '@tachybase/utils';
import { faker } from '@faker-js/faker';
test('Collection event Add Data Trigger, determines that the trigger node single line text field variable is equal to an equal constant, passes.', async ({ test('Collection event Add Data Trigger, determines that the trigger node single line text field variable is equal to an equal constant, passes.', async ({
page, page,
mockCollections, mockCollections,

View File

@ -1,10 +1,4 @@
import { faker } from '@faker-js/faker';
import { import {
ClculationNode,
CollectionTriggerNode,
ConditionBranchNode,
ConditionYesNode,
QueryRecordNode,
apiCreateWorkflow, apiCreateWorkflow,
apiCreateWorkflowNode, apiCreateWorkflowNode,
apiDeleteWorkflow, apiDeleteWorkflow,
@ -13,11 +7,18 @@ import {
apiGetWorkflowNodeExecutions, apiGetWorkflowNodeExecutions,
apiUpdateWorkflowTrigger, apiUpdateWorkflowTrigger,
appendJsonCollectionName, appendJsonCollectionName,
ClculationNode,
CollectionTriggerNode,
ConditionBranchNode,
ConditionYesNode,
generalWithNoRelationalFields, generalWithNoRelationalFields,
QueryRecordNode,
} from '@tachybase/plugin-workflow-test/e2e'; } from '@tachybase/plugin-workflow-test/e2e';
import { expect, test } from '@tachybase/test/e2e'; import { expect, test } from '@tachybase/test/e2e';
import { dayjs } from '@tachybase/utils'; import { dayjs } from '@tachybase/utils';
import { faker } from '@faker-js/faker';
test('Collection event add data trigger, determine trigger node integer field variable is equal to an equal constant, pass.', async ({ test('Collection event add data trigger, determine trigger node integer field variable is equal to an equal constant, pass.', async ({
page, page,
mockCollections, mockCollections,

View File

@ -1,10 +1,4 @@
import { faker } from '@faker-js/faker';
import { import {
ClculationNode,
CollectionTriggerNode,
ConditionBranchNode,
ConditionYesNode,
QueryRecordNode,
apiCreateWorkflow, apiCreateWorkflow,
apiCreateWorkflowNode, apiCreateWorkflowNode,
apiDeleteWorkflow, apiDeleteWorkflow,
@ -13,11 +7,18 @@ import {
apiGetWorkflowNodeExecutions, apiGetWorkflowNodeExecutions,
apiUpdateWorkflowTrigger, apiUpdateWorkflowTrigger,
appendJsonCollectionName, appendJsonCollectionName,
ClculationNode,
CollectionTriggerNode,
ConditionBranchNode,
ConditionYesNode,
generalWithNoRelationalFields, generalWithNoRelationalFields,
QueryRecordNode,
} from '@tachybase/plugin-workflow-test/e2e'; } from '@tachybase/plugin-workflow-test/e2e';
import { expect, test } from '@tachybase/test/e2e'; import { expect, test } from '@tachybase/test/e2e';
import { dayjs } from '@tachybase/utils'; import { dayjs } from '@tachybase/utils';
import { faker } from '@faker-js/faker';
test('Collection event add data trigger, determines that the trigger node single line text field variable is equal to an equal constant, passes.', async ({ test('Collection event add data trigger, determines that the trigger node single line text field variable is equal to an equal constant, passes.', async ({
page, page,
mockCollections, mockCollections,

View File

@ -1,10 +1,4 @@
import { faker } from '@faker-js/faker';
import { import {
ClculationNode,
CollectionTriggerNode,
ConditionBranchNode,
ConditionYesNode,
QueryRecordNode,
apiCreateWorkflow, apiCreateWorkflow,
apiCreateWorkflowNode, apiCreateWorkflowNode,
apiDeleteWorkflow, apiDeleteWorkflow,
@ -13,11 +7,18 @@ import {
apiGetWorkflowNodeExecutions, apiGetWorkflowNodeExecutions,
apiUpdateWorkflowTrigger, apiUpdateWorkflowTrigger,
appendJsonCollectionName, appendJsonCollectionName,
ClculationNode,
CollectionTriggerNode,
ConditionBranchNode,
ConditionYesNode,
generalWithNoRelationalFields, generalWithNoRelationalFields,
QueryRecordNode,
} from '@tachybase/plugin-workflow-test/e2e'; } from '@tachybase/plugin-workflow-test/e2e';
import { expect, test } from '@tachybase/test/e2e'; import { expect, test } from '@tachybase/test/e2e';
import { dayjs } from '@tachybase/utils'; import { dayjs } from '@tachybase/utils';
import { faker } from '@faker-js/faker';
test('Collection event Add Data Trigger, Formula engine, determines that the trigger node single line text field variable is equal to an equal constant, passes.', async ({ test('Collection event Add Data Trigger, Formula engine, determines that the trigger node single line text field variable is equal to an equal constant, passes.', async ({
page, page,
mockCollections, mockCollections,

View File

@ -1,10 +1,4 @@
import { faker } from '@faker-js/faker';
import { import {
ClculationNode,
CollectionTriggerNode,
ConditionBranchNode,
ConditionYesNode,
QueryRecordNode,
apiCreateWorkflow, apiCreateWorkflow,
apiCreateWorkflowNode, apiCreateWorkflowNode,
apiDeleteWorkflow, apiDeleteWorkflow,
@ -13,11 +7,18 @@ import {
apiGetWorkflowNodeExecutions, apiGetWorkflowNodeExecutions,
apiUpdateWorkflowTrigger, apiUpdateWorkflowTrigger,
appendJsonCollectionName, appendJsonCollectionName,
ClculationNode,
CollectionTriggerNode,
ConditionBranchNode,
ConditionYesNode,
generalWithNoRelationalFields, generalWithNoRelationalFields,
QueryRecordNode,
} from '@tachybase/plugin-workflow-test/e2e'; } from '@tachybase/plugin-workflow-test/e2e';
import { expect, test } from '@tachybase/test/e2e'; import { expect, test } from '@tachybase/test/e2e';
import { dayjs } from '@tachybase/utils'; import { dayjs } from '@tachybase/utils';
import { faker } from '@faker-js/faker';
test('Collection event add data trigger, Math engine, determine trigger node integer field variable is equal to an equal constant, pass.', async ({ test('Collection event add data trigger, Math engine, determine trigger node integer field variable is equal to an equal constant, pass.', async ({
page, page,
mockCollections, mockCollections,

View File

@ -1,7 +1,4 @@
import { faker } from '@faker-js/faker';
import { import {
CollectionTriggerNode,
CreateRecordNode,
apiCreateWorkflow, apiCreateWorkflow,
apiDeleteWorkflow, apiDeleteWorkflow,
apiGetRecord, apiGetRecord,
@ -9,11 +6,15 @@ import {
apiGetWorkflowNodeExecutions, apiGetWorkflowNodeExecutions,
apiUpdateWorkflowTrigger, apiUpdateWorkflowTrigger,
appendJsonCollectionName, appendJsonCollectionName,
CollectionTriggerNode,
CreateRecordNode,
generalWithNoRelationalFields, generalWithNoRelationalFields,
} from '@tachybase/plugin-workflow-test/e2e'; } from '@tachybase/plugin-workflow-test/e2e';
import { expect, test } from '@tachybase/test/e2e'; import { expect, test } from '@tachybase/test/e2e';
import { dayjs } from '@tachybase/utils'; import { dayjs } from '@tachybase/utils';
import { faker } from '@faker-js/faker';
test('Collection event add data trigger, single row text fields for common tables, set constant data', async ({ test('Collection event add data trigger, single row text fields for common tables, set constant data', async ({
page, page,
mockCollections, mockCollections,

View File

@ -1,17 +1,18 @@
import { faker } from '@faker-js/faker';
import { import {
CollectionTriggerNode,
DeleteRecordNode,
apiCreateWorkflow, apiCreateWorkflow,
apiDeleteWorkflow, apiDeleteWorkflow,
apiGetList, apiGetList,
apiUpdateWorkflowTrigger, apiUpdateWorkflowTrigger,
appendJsonCollectionName, appendJsonCollectionName,
CollectionTriggerNode,
DeleteRecordNode,
generalWithNoRelationalFields, generalWithNoRelationalFields,
} from '@tachybase/plugin-workflow-test/e2e'; } from '@tachybase/plugin-workflow-test/e2e';
import { expect, test } from '@tachybase/test/e2e'; import { expect, test } from '@tachybase/test/e2e';
import { dayjs } from '@tachybase/utils'; import { dayjs } from '@tachybase/utils';
import { faker } from '@faker-js/faker';
test('Collection event add data trigger, filter single line text field not null, delete common table data', async ({ test('Collection event add data trigger, filter single line text field not null, delete common table data', async ({
page, page,
mockCollections, mockCollections,

View File

@ -1,18 +1,19 @@
import { faker } from '@faker-js/faker';
import { import {
CollectionTriggerNode,
QueryRecordNode,
apiCreateWorkflow, apiCreateWorkflow,
apiDeleteWorkflow, apiDeleteWorkflow,
apiGetWorkflow, apiGetWorkflow,
apiGetWorkflowNodeExecutions, apiGetWorkflowNodeExecutions,
apiUpdateWorkflowTrigger, apiUpdateWorkflowTrigger,
appendJsonCollectionName, appendJsonCollectionName,
CollectionTriggerNode,
generalWithNoRelationalFields, generalWithNoRelationalFields,
QueryRecordNode,
} from '@tachybase/plugin-workflow-test/e2e'; } from '@tachybase/plugin-workflow-test/e2e';
import { expect, test } from '@tachybase/test/e2e'; import { expect, test } from '@tachybase/test/e2e';
import { dayjs } from '@tachybase/utils'; import { dayjs } from '@tachybase/utils';
import { faker } from '@faker-js/faker';
test('Collection event add data trigger, no filter no sort query common table 1 record', async ({ test('Collection event add data trigger, no filter no sort query common table 1 record', async ({
page, page,
mockCollections, mockCollections,

View File

@ -1,7 +1,4 @@
import { faker } from '@faker-js/faker';
import { import {
CollectionTriggerNode,
UpdateRecordNode,
apiCreateWorkflow, apiCreateWorkflow,
apiDeleteWorkflow, apiDeleteWorkflow,
apiGetList, apiGetList,
@ -9,11 +6,15 @@ import {
apiGetWorkflowNodeExecutions, apiGetWorkflowNodeExecutions,
apiUpdateWorkflowTrigger, apiUpdateWorkflowTrigger,
appendJsonCollectionName, appendJsonCollectionName,
CollectionTriggerNode,
generalWithNoRelationalFields, generalWithNoRelationalFields,
UpdateRecordNode,
} from '@tachybase/plugin-workflow-test/e2e'; } from '@tachybase/plugin-workflow-test/e2e';
import { expect, test } from '@tachybase/test/e2e'; import { expect, test } from '@tachybase/test/e2e';
import { dayjs } from '@tachybase/utils'; import { dayjs } from '@tachybase/utils';
import { faker } from '@faker-js/faker';
test('Collection event add data trigger, filter single line text field not empty, common table single line text field data, set single line text field constant data', async ({ test('Collection event add data trigger, filter single line text field not empty, common table single line text field data, set single line text field constant data', async ({
page, page,
mockCollections, mockCollections,

View File

@ -1,7 +1,4 @@
import { faker } from '@faker-js/faker';
import { import {
CollectionTriggerNode,
UpdateRecordNode,
apiCreateWorkflow, apiCreateWorkflow,
apiDeleteWorkflow, apiDeleteWorkflow,
apiGetList, apiGetList,
@ -9,11 +6,15 @@ import {
apiGetWorkflowNodeExecutions, apiGetWorkflowNodeExecutions,
apiUpdateWorkflowTrigger, apiUpdateWorkflowTrigger,
appendJsonCollectionName, appendJsonCollectionName,
CollectionTriggerNode,
generalWithNoRelationalFields, generalWithNoRelationalFields,
UpdateRecordNode,
} from '@tachybase/plugin-workflow-test/e2e'; } from '@tachybase/plugin-workflow-test/e2e';
import { expect, test } from '@tachybase/test/e2e'; import { expect, test } from '@tachybase/test/e2e';
import { dayjs } from '@tachybase/utils'; import { dayjs } from '@tachybase/utils';
import { faker } from '@faker-js/faker';
test('Collection event add data trigger, filter single line text field not empty, common table single line text field data, set single line text field constant data', async ({ test('Collection event add data trigger, filter single line text field not empty, common table single line text field data, set single line text field constant data', async ({
page, page,
mockCollections, mockCollections,

View File

@ -1,7 +1,8 @@
import { QuestionCircleOutlined } from '@ant-design/icons';
import { css, useCompile } from '@tachybase/client';
import { Checkbox, Space, Tooltip } from 'antd';
import React from 'react'; import React from 'react';
import { css, useCompile } from '@tachybase/client';
import { QuestionCircleOutlined } from '@ant-design/icons';
import { Checkbox, Space, Tooltip } from 'antd';
export interface CheckboxGroupWithTooltipOption { export interface CheckboxGroupWithTooltipOption {
value: any; value: any;

View File

@ -1,17 +1,16 @@
import React from 'react'; import React from 'react';
import { uid } from '@tachybase/schema';
import { import {
CollectionProvider_deprecated, CollectionProvider_deprecated,
parseCollectionName,
SchemaInitializerItem, SchemaInitializerItem,
SchemaInitializerItemType, SchemaInitializerItemType,
parseCollectionName,
useCollectionManager_deprecated, useCollectionManager_deprecated,
useRecordCollectionDataSourceItems, useRecordCollectionDataSourceItems,
useSchemaInitializer, useSchemaInitializer,
useSchemaInitializerItem, useSchemaInitializerItem,
useSchemaTemplateManager, useSchemaTemplateManager,
} from '@tachybase/client'; } from '@tachybase/client';
import { uid } from '@tachybase/schema';
import { traverseSchema } from '../utils'; import { traverseSchema } from '../utils';

View File

@ -1,19 +1,21 @@
import { CloseCircleOutlined, PlusOutlined } from '@ant-design/icons'; import React, { useMemo } from 'react';
import { observer, useField, useForm } from '@tachybase/schema';
import { import {
CollectionField, CollectionField,
CollectionProvider_deprecated, CollectionProvider_deprecated,
SchemaComponent,
Variable,
css, css,
parseCollectionName, parseCollectionName,
SchemaComponent,
useCollectionManager_deprecated, useCollectionManager_deprecated,
useCompile, useCompile,
useToken, useToken,
Variable,
} from '@tachybase/client'; } from '@tachybase/client';
import { observer, useField, useForm } from '@tachybase/schema';
import { CloseCircleOutlined, PlusOutlined } from '@ant-design/icons';
import { Button, Dropdown, Form, Input, MenuProps } from 'antd'; import { Button, Dropdown, Form, Input, MenuProps } from 'antd';
import React, { useMemo } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { lang } from '../locale'; import { lang } from '../locale';
import { useWorkflowVariableOptions } from '../variable'; import { useWorkflowVariableOptions } from '../variable';

View File

@ -1,17 +1,17 @@
import React, { useMemo, useRef } from 'react'; import React, { useMemo, useRef } from 'react';
import { createForm } from '@tachybase/schema';
import { useField } from '@tachybase/schema';
import { get } from 'lodash';
import { import {
BlockRequestContext_deprecated, BlockRequestContext_deprecated,
CollectionProvider_deprecated, CollectionProvider_deprecated,
FormBlockContext, FormBlockContext,
RecordProvider,
parseCollectionName, parseCollectionName,
RecordProvider,
useAPIClient, useAPIClient,
useAssociationNames, useAssociationNames,
useBlockRequestContext, useBlockRequestContext,
} from '@tachybase/client'; } from '@tachybase/client';
import { createForm, useField } from '@tachybase/schema';
import { get } from 'lodash';
import { useFlowContext } from '../FlowContext'; import { useFlowContext } from '../FlowContext';

View File

@ -1,6 +1,7 @@
import { createStyles, cx } from '@tachybase/client';
import { Tag } from 'antd';
import React from 'react'; import React from 'react';
import { createStyles, cx } from '@tachybase/client';
import { Tag } from 'antd';
const useStyles = createStyles(({ css, token }) => { const useStyles = createStyles(({ css, token }) => {
return { return {

View File

@ -1,9 +1,8 @@
import React, { useCallback, useMemo, useState } from 'react'; import React, { useCallback, useMemo, useState } from 'react';
import { cloneDeep } from 'lodash';
import { createForm } from '@tachybase/schema';
import { useForm } from '@tachybase/schema';
import { ActionContextProvider, FormProvider } from '@tachybase/client'; import { ActionContextProvider, FormProvider } from '@tachybase/client';
import { createForm, useForm } from '@tachybase/schema';
import { cloneDeep } from 'lodash';
export function useFormProviderProps() { export function useFormProviderProps() {
return { form: useForm() }; return { form: useForm() };

View File

@ -1,10 +1,10 @@
import React, { useCallback } from 'react'; import React, { useCallback } from 'react';
import { Button, Modal, Select, Tag, Tooltip, message } from 'antd';
import { ExclamationCircleFilled, StopOutlined } from '@ant-design/icons';
import { useTranslation } from 'react-i18next';
import { Action, css, useCompile, useRecord, useResourceActionContext, useResourceContext } from '@tachybase/client'; import { Action, css, useCompile, useRecord, useResourceActionContext, useResourceContext } from '@tachybase/client';
import { ExclamationCircleFilled, StopOutlined } from '@ant-design/icons';
import { Button, message, Modal, Select, Tag, Tooltip } from 'antd';
import { useTranslation } from 'react-i18next';
import { EXECUTION_STATUS, ExecutionStatusOptions, ExecutionStatusOptionsMap } from '../constants'; import { EXECUTION_STATUS, ExecutionStatusOptions, ExecutionStatusOptionsMap } from '../constants';
import { lang } from '../locale'; import { lang } from '../locale';

View File

@ -1,8 +1,8 @@
import { observer, useForm } from '@tachybase/schema';
import { Select } from 'antd';
import React from 'react'; import React from 'react';
import { parseCollectionName, useCollectionManager_deprecated, useCompile } from '@tachybase/client'; import { parseCollectionName, useCollectionManager_deprecated, useCompile } from '@tachybase/client';
import { observer, useForm } from '@tachybase/schema';
import { Select } from 'antd';
function defaultFilter() { function defaultFilter() {
return true; return true;

View File

@ -1,5 +1,4 @@
import React from 'react'; import React from 'react';
import { Variable } from '@tachybase/client'; import { Variable } from '@tachybase/client';
import { useWorkflowVariableOptions } from '../variable'; import { useWorkflowVariableOptions } from '../variable';

View File

@ -1,7 +1,6 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { useFieldSchema } from '@tachybase/schema';
import { ActionContextProvider, SchemaComponent } from '@tachybase/client'; import { ActionContextProvider, SchemaComponent } from '@tachybase/client';
import { useFieldSchema } from '@tachybase/schema';
export default function ({ component = 'div', children, ...props }) { export default function ({ component = 'div', children, ...props }) {
const [visible, setVisible] = useState(false); const [visible, setVisible] = useState(false);

View File

@ -1,6 +1,4 @@
import React from 'react'; import React from 'react';
import { useFieldSchema } from '@tachybase/schema';
import { import {
GeneralSchemaDesigner, GeneralSchemaDesigner,
SchemaSettingsBlockTitleItem, SchemaSettingsBlockTitleItem,
@ -8,6 +6,7 @@ import {
SchemaSettingsRemove, SchemaSettingsRemove,
useCompile, useCompile,
} from '@tachybase/client'; } from '@tachybase/client';
import { useFieldSchema } from '@tachybase/schema';
export function SimpleDesigner() { export function SimpleDesigner() {
const schema = useFieldSchema(); const schema = useFieldSchema();

View File

@ -1,7 +1,8 @@
import { useFieldSchema } from '@tachybase/schema';
import { css, SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '@tachybase/client';
import { parse } from '@tachybase/utils/client';
import React from 'react'; import React from 'react';
import { css, SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '@tachybase/client';
import { useFieldSchema } from '@tachybase/schema';
import { parse } from '@tachybase/utils/client';
import { useFlowContext } from '../FlowContext'; import { useFlowContext } from '../FlowContext';
import { SimpleDesigner } from './SimpleDesigner'; import { SimpleDesigner } from './SimpleDesigner';

View File

@ -1,14 +1,16 @@
import React from 'react'; import React from 'react';
import { import {
CloseOutlined,
ClockCircleOutlined,
CheckOutlined, CheckOutlined,
MinusOutlined, ClockCircleOutlined,
CloseOutlined,
ExclamationOutlined, ExclamationOutlined,
HourglassOutlined, HourglassOutlined,
LoadingOutlined, LoadingOutlined,
MinusOutlined,
RedoOutlined, RedoOutlined,
} from '@ant-design/icons'; } from '@ant-design/icons';
import { NAMESPACE } from './locale'; import { NAMESPACE } from './locale';
export const EXECUTION_STATUS = { export const EXECUTION_STATUS = {

View File

@ -1,16 +1,16 @@
import { useForm } from '@tachybase/schema';
import { import {
SchemaInitializerItemType, SchemaInitializerItemType,
useCollectionDataSource, useCollectionDataSource,
useCollectionManager_deprecated, useCollectionManager_deprecated,
useCompile, useCompile,
} from '@tachybase/client'; } from '@tachybase/client';
import { NAMESPACE, lang } from '../../locale'; import { useForm } from '@tachybase/schema';
import { Trigger } from '../../triggers';
import { CollectionBlockInitializer } from '../../components'; import { CollectionBlockInitializer } from '../../components';
import { getCollectionFieldOptions } from '../../variable';
import { useWorkflowAnyExecuted } from '../../hooks'; import { useWorkflowAnyExecuted } from '../../hooks';
import { lang, NAMESPACE } from '../../locale';
import { Trigger } from '../../triggers';
import { getCollectionFieldOptions } from '../../variable';
export class ActionTrigger extends Trigger { export class ActionTrigger extends Trigger {
title = `{{t("Action event", { ns: "${NAMESPACE}" })}}`; title = `{{t("Action event", { ns: "${NAMESPACE}" })}}`;

View File

@ -1,19 +1,20 @@
import { faker } from '@faker-js/faker';
import { import {
FormEventTriggerNode,
WorkflowListRecords,
apiCreateRecordTriggerFormEvent, apiCreateRecordTriggerFormEvent,
apiCreateWorkflow, apiCreateWorkflow,
apiDeleteWorkflow, apiDeleteWorkflow,
apiGetDataSourceCount,
apiGetWorkflow, apiGetWorkflow,
apiUpdateWorkflowTrigger, apiUpdateWorkflowTrigger,
appendJsonCollectionName, appendJsonCollectionName,
FormEventTriggerNode,
generalWithNoRelationalFields, generalWithNoRelationalFields,
apiGetDataSourceCount, WorkflowListRecords,
} from '@tachybase/plugin-workflow-test/e2e'; } from '@tachybase/plugin-workflow-test/e2e';
import { expect, test } from '@tachybase/test/e2e'; import { expect, test } from '@tachybase/test/e2e';
import { dayjs } from '@tachybase/utils'; import { dayjs } from '@tachybase/utils';
import { faker } from '@faker-js/faker';
test.describe('Configuration page to configure the Trigger node', () => { test.describe('Configuration page to configure the Trigger node', () => {
test('Form Submit Button Binding Workflow Add Data Trigger', async ({ test('Form Submit Button Binding Workflow Add Data Trigger', async ({
page, page,

View File

@ -1,20 +1,21 @@
import { faker } from '@faker-js/faker';
import { import {
CreateWorkFlow,
EditWorkFlow,
FormEventTriggerNode,
WorkflowListRecords,
apiCreateRecordTriggerFormEvent, apiCreateRecordTriggerFormEvent,
apiCreateWorkflow, apiCreateWorkflow,
apiDeleteWorkflow, apiDeleteWorkflow,
apiGetWorkflow, apiGetWorkflow,
apiUpdateWorkflowTrigger, apiUpdateWorkflowTrigger,
appendJsonCollectionName, appendJsonCollectionName,
CreateWorkFlow,
EditWorkFlow,
FormEventTriggerNode,
generalWithNoRelationalFields, generalWithNoRelationalFields,
WorkflowListRecords,
} from '@tachybase/plugin-workflow-test/e2e'; } from '@tachybase/plugin-workflow-test/e2e';
import { expect, test } from '@tachybase/test/e2e'; import { expect, test } from '@tachybase/test/e2e';
import { dayjs } from '@tachybase/utils'; import { dayjs } from '@tachybase/utils';
import { faker } from '@faker-js/faker';
test.describe('Filter', () => { test.describe('Filter', () => {
test('filter workflow name', async ({ page }) => { test('filter workflow name', async ({ page }) => {
//添加工作流 //添加工作流

View File

@ -1,6 +1,6 @@
import { Plugin, SchemaInitializerItemType } from '@tachybase/client'; import { Plugin, SchemaInitializerItemType } from '@tachybase/client';
import WorkflowPlugin, { useRecordTriggerWorkflowsActionProps, useTriggerWorkflowsActionProps } from '../..';
import WorkflowPlugin, { useRecordTriggerWorkflowsActionProps, useTriggerWorkflowsActionProps } from '../..';
import { ActionTrigger } from './ActionTrigger'; import { ActionTrigger } from './ActionTrigger';
const submitToWorkflowActionInitializer: SchemaInitializerItemType = { const submitToWorkflowActionInitializer: SchemaInitializerItemType = {

View File

@ -1,17 +1,19 @@
import { faker } from '@faker-js/faker';
import { import {
AggregateNode, AggregateNode,
CollectionTriggerNode,
apiCreateWorkflow, apiCreateWorkflow,
apiDeleteWorkflow, apiDeleteWorkflow,
apiGetWorkflow, apiGetWorkflow,
apiGetWorkflowNodeExecutions, apiGetWorkflowNodeExecutions,
apiUpdateWorkflowTrigger, apiUpdateWorkflowTrigger,
appendJsonCollectionName, appendJsonCollectionName,
CollectionTriggerNode,
generalWithNoRelationalFields, generalWithNoRelationalFields,
} from '@tachybase/plugin-workflow-test/e2e'; } from '@tachybase/plugin-workflow-test/e2e';
import { expect, test } from '@tachybase/test/e2e'; import { expect, test } from '@tachybase/test/e2e';
import { dayjs } from '@tachybase/utils'; import { dayjs } from '@tachybase/utils';
import { faker } from '@faker-js/faker';
test.describe('no filter', () => { test.describe('no filter', () => {
test('Collection event add data trigger, normal table integer fields not de-emphasised COUNT', async ({ test('Collection event add data trigger, normal table integer fields not de-emphasised COUNT', async ({
page, page,

View File

@ -1,6 +1,6 @@
import { Plugin } from '@tachybase/client'; import { Plugin } from '@tachybase/client';
import WorkflowPlugin from '../..';
import WorkflowPlugin from '../..';
import AggregateInstruction from './AggregateInstruction'; import AggregateInstruction from './AggregateInstruction';
export class PluginAggregate extends Plugin { export class PluginAggregate extends Plugin {

View File

@ -1,6 +1,6 @@
import { Plugin } from '@tachybase/client'; import { Plugin } from '@tachybase/client';
import WorkflowPlugin from '../..';
import WorkflowPlugin from '../..';
import DelayInstruction from './DelayInstruction'; import DelayInstruction from './DelayInstruction';
export class PluginDelay extends Plugin { export class PluginDelay extends Plugin {

View File

@ -1,12 +1,20 @@
import { onFieldInputValueChange, onFormInitialValuesChange } from '@tachybase/schema';
import { connect, mapReadPretty, observer, useField, useForm, useFormEffects } from '@tachybase/schema';
import { Tag } from 'antd';
import React, { useMemo, useState } from 'react'; import React, { useMemo, useState } from 'react';
import { useCollectionManager_deprecated, useCompile, useRecord, Variable } from '@tachybase/client';
import {
connect,
mapReadPretty,
observer,
onFieldInputValueChange,
onFormInitialValuesChange,
useField,
useForm,
useFormEffects,
} from '@tachybase/schema';
import { Tag } from 'antd';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useCollectionManager_deprecated, useCompile, useRecord, Variable } from '@tachybase/client';
import { getCollectionFieldOptions } from '../..'; import { getCollectionFieldOptions } from '../..';
import { NAMESPACE } from '../../locale'; import { NAMESPACE } from '../../locale';
const InternalExpression = observer( const InternalExpression = observer(

View File

@ -1,6 +1,6 @@
import { Plugin } from '@tachybase/client'; import { Plugin } from '@tachybase/client';
import WorkflowPlugin from '../..';
import WorkflowPlugin from '../..';
import DynamicCalculation from './DynamicCalculation'; import DynamicCalculation from './DynamicCalculation';
import { DynamicExpression } from './DynamicExpression'; import { DynamicExpression } from './DynamicExpression';
import { ExpressionFieldInterface } from './expression'; import { ExpressionFieldInterface } from './expression';

View File

@ -1,14 +1,9 @@
import { useCollectionDataSource, useCollectionManager_deprecated, useCompile } from '@tachybase/client'; import { useCollectionDataSource, useCollectionManager_deprecated, useCompile } from '@tachybase/client';
import {
CheckboxGroupWithTooltip,
CollectionBlockInitializer,
FieldsSelect,
getCollectionFieldOptions,
RadioWithTooltip,
Trigger,
} from '@tachybase/plugin-workflow/client';
import { CheckboxGroupWithTooltip, CollectionBlockInitializer, FieldsSelect, RadioWithTooltip } from '../../components';
import { lang, tval } from '../../locale'; import { lang, tval } from '../../locale';
import { Trigger } from '../../triggers';
import { getCollectionFieldOptions } from '../../variable';
const enum ACTION_TYPES { const enum ACTION_TYPES {
CREATE = 'create', CREATE = 'create',
@ -96,9 +91,9 @@ export class WorkflowTriggerInterceptor extends Trigger {
}; };
scope = { useCollectionDataSource }; scope = { useCollectionDataSource };
components = { components = {
FieldsSelect: FieldsSelect, FieldsSelect,
RadioWithTooltip: RadioWithTooltip, RadioWithTooltip,
CheckboxGroupWithTooltip: CheckboxGroupWithTooltip, CheckboxGroupWithTooltip,
}; };
isActionTriggerable = (a, u) => { isActionTriggerable = (a, u) => {
const { global: m } = a; const { global: m } = a;

View File

@ -1,6 +1,6 @@
import { Plugin } from '@tachybase/client'; import { Plugin } from '@tachybase/client';
import PluginWorkflow from '@tachybase/plugin-workflow/client';
import PluginWorkflow from '../..';
import { WorkflowTriggerInterceptor } from './WorkflowTriggerInterceptor'; import { WorkflowTriggerInterceptor } from './WorkflowTriggerInterceptor';
export class PluginWorkflowInterceptor extends Plugin { export class PluginWorkflowInterceptor extends Plugin {

View File

@ -1,6 +1,6 @@
import { Plugin } from '@tachybase/client'; import { Plugin } from '@tachybase/client';
import WorkflowPlugin from '../..';
import WorkflowPlugin from '../..';
import LoopInstruction from './LoopInstruction'; import LoopInstruction from './LoopInstruction';
export class PluginLoop extends Plugin { export class PluginLoop extends Plugin {

View File

@ -1,32 +1,33 @@
import { observer, useField, useFieldSchema, useForm } from '@tachybase/schema';
import { Space, Spin, Tag } from 'antd';
import { dayjs } from '@tachybase/utils/client';
import React, { createContext, useContext, useEffect, useState } from 'react'; import React, { createContext, useContext, useEffect, useState } from 'react';
import { css, useCompile, usePlugin } from '@tachybase/client';
import { import {
css,
ExtendCollectionsProvider,
SchemaComponent, SchemaComponent,
SchemaComponentContext, SchemaComponentContext,
TableBlockProvider, TableBlockProvider,
useAPIClient,
useActionContext, useActionContext,
useAPIClient,
useCompile,
useCurrentUserContext, useCurrentUserContext,
useFormBlockContext, useFormBlockContext,
usePlugin,
useRecord, useRecord,
useTableBlockContext, useTableBlockContext,
ExtendCollectionsProvider,
} from '@tachybase/client'; } from '@tachybase/client';
import { observer, useField, useFieldSchema, useForm } from '@tachybase/schema';
import { dayjs } from '@tachybase/utils/client';
import { Space, Spin, Tag } from 'antd';
import WorkflowPlugin, { import WorkflowPlugin, {
DetailsBlockProvider,
FlowContext, FlowContext,
linkNodes, linkNodes,
useAvailableUpstreams, useAvailableUpstreams,
useFlowContext, useFlowContext,
DetailsBlockProvider,
} from '../..'; } from '../..';
import { JobStatusOptions, JobStatusOptionsMap } from '../../constants'; import { JobStatusOptions, JobStatusOptionsMap } from '../../constants';
import { lang, NAMESPACE } from '../../locale';
import { NAMESPACE, lang } from '../../locale';
import { FormBlockProvider } from './instruction/FormBlockProvider'; import { FormBlockProvider } from './instruction/FormBlockProvider';
import { ManualFormType, manualFormTypes } from './instruction/SchemaConfig'; import { ManualFormType, manualFormTypes } from './instruction/SchemaConfig';

View File

@ -1,8 +1,8 @@
import { TableOutlined } from '@ant-design/icons';
import React, { FC } from 'react'; import React, { FC } from 'react';
import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '@tachybase/client'; import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '@tachybase/client';
import { TableOutlined } from '@ant-design/icons';
export const WorkflowTodoBlockInitializer: FC<any> = () => { export const WorkflowTodoBlockInitializer: FC<any> = () => {
const itemConfig = useSchemaInitializerItem(); const itemConfig = useSchemaInitializerItem();
const { insert } = useSchemaInitializer(); const { insert } = useSchemaInitializer();

View File

@ -1,20 +1,21 @@
import { faker } from '@faker-js/faker';
import { import {
CollectionTriggerNode,
ManualNode,
apiCreateWorkflow, apiCreateWorkflow,
apiDeleteWorkflow, apiDeleteWorkflow,
apiGetDataSourceCount,
apiGetRecord, apiGetRecord,
apiGetWorkflow, apiGetWorkflow,
apiGetWorkflowNodeExecutions, apiGetWorkflowNodeExecutions,
apiUpdateWorkflowTrigger, apiUpdateWorkflowTrigger,
appendJsonCollectionName, appendJsonCollectionName,
CollectionTriggerNode,
generalWithNoRelationalFields, generalWithNoRelationalFields,
apiGetDataSourceCount, ManualNode,
} from '@tachybase/plugin-workflow-test/e2e'; } from '@tachybase/plugin-workflow-test/e2e';
import { expect, test } from '@tachybase/test/e2e'; import { expect, test } from '@tachybase/test/e2e';
import { dayjs } from '@tachybase/utils'; import { dayjs } from '@tachybase/utils';
import { faker } from '@faker-js/faker';
test.describe('block configuration', () => {}); test.describe('block configuration', () => {});
test.describe('field configuration', () => {}); test.describe('field configuration', () => {});

View File

@ -1,18 +1,19 @@
import { faker } from '@faker-js/faker';
import { import {
CollectionTriggerNode,
ManualNode,
apiCreateWorkflow, apiCreateWorkflow,
apiDeleteWorkflow, apiDeleteWorkflow,
apiGetWorkflow, apiGetWorkflow,
apiGetWorkflowNodeExecutions, apiGetWorkflowNodeExecutions,
apiUpdateWorkflowTrigger, apiUpdateWorkflowTrigger,
appendJsonCollectionName, appendJsonCollectionName,
CollectionTriggerNode,
generalWithNoRelationalFields, generalWithNoRelationalFields,
ManualNode,
} from '@tachybase/plugin-workflow-test/e2e'; } from '@tachybase/plugin-workflow-test/e2e';
import { expect, test } from '@tachybase/test/e2e'; import { expect, test } from '@tachybase/test/e2e';
import { dayjs } from '@tachybase/utils'; import { dayjs } from '@tachybase/utils';
import { faker } from '@faker-js/faker';
test.describe('block configuration', () => {}); test.describe('block configuration', () => {});
test.describe('field configuration', () => {}); test.describe('field configuration', () => {});

View File

@ -1,11 +1,5 @@
import { faker } from '@faker-js/faker';
import { import {
AggregateNode, AggregateNode,
ClculationNode,
CollectionTriggerNode,
CreateRecordNode,
ManualNode,
QueryRecordNode,
apiCreateWorkflow, apiCreateWorkflow,
apiCreateWorkflowNode, apiCreateWorkflowNode,
apiDeleteWorkflow, apiDeleteWorkflow,
@ -15,11 +9,18 @@ import {
apiGetWorkflowNode, apiGetWorkflowNode,
apiUpdateWorkflowTrigger, apiUpdateWorkflowTrigger,
appendJsonCollectionName, appendJsonCollectionName,
ClculationNode,
CollectionTriggerNode,
CreateRecordNode,
generalWithNoRelationalFields, generalWithNoRelationalFields,
ManualNode,
QueryRecordNode,
} from '@tachybase/plugin-workflow-test/e2e'; } from '@tachybase/plugin-workflow-test/e2e';
import { expect, test } from '@tachybase/test/e2e'; import { expect, test } from '@tachybase/test/e2e';
import { dayjs } from '@tachybase/utils'; import { dayjs } from '@tachybase/utils';
import { faker } from '@faker-js/faker';
test.describe('field data', () => { test.describe('field data', () => {
test('Collection event to add a data trigger, get a single line of text data for the trigger node', async ({ test('Collection event to add a data trigger, get a single line of text data for the trigger node', async ({
page, page,

View File

@ -1,20 +1,21 @@
import { faker } from '@faker-js/faker';
import { import {
CollectionTriggerNode,
ManualNode,
apiCreateWorkflow, apiCreateWorkflow,
apiDeleteWorkflow, apiDeleteWorkflow,
apiFilterList, apiFilterList,
apiGetDataSourceCount,
apiGetWorkflow, apiGetWorkflow,
apiGetWorkflowNodeExecutions, apiGetWorkflowNodeExecutions,
apiUpdateWorkflowTrigger, apiUpdateWorkflowTrigger,
appendJsonCollectionName, appendJsonCollectionName,
CollectionTriggerNode,
generalWithNoRelationalFields, generalWithNoRelationalFields,
apiGetDataSourceCount, ManualNode,
} from '@tachybase/plugin-workflow-test/e2e'; } from '@tachybase/plugin-workflow-test/e2e';
import { expect, test } from '@tachybase/test/e2e'; import { expect, test } from '@tachybase/test/e2e';
import { dayjs } from '@tachybase/utils'; import { dayjs } from '@tachybase/utils';
import { faker } from '@faker-js/faker';
test.describe('block configuration', () => {}); test.describe('block configuration', () => {});
test.describe('field configuration', () => {}); test.describe('field configuration', () => {});

View File

@ -1,18 +1,19 @@
import { faker } from '@faker-js/faker';
import { import {
CollectionTriggerNode,
ManualNode,
apiCreateWorkflow, apiCreateWorkflow,
apiDeleteWorkflow, apiDeleteWorkflow,
apiGetDataSourceCount,
apiGetWorkflow, apiGetWorkflow,
apiUpdateWorkflowTrigger, apiUpdateWorkflowTrigger,
appendJsonCollectionName, appendJsonCollectionName,
CollectionTriggerNode,
generalWithNoRelationalFields, generalWithNoRelationalFields,
apiGetDataSourceCount, ManualNode,
} from '@tachybase/plugin-workflow-test/e2e'; } from '@tachybase/plugin-workflow-test/e2e';
import { expect, test } from '@tachybase/test/e2e'; import { expect, test } from '@tachybase/test/e2e';
import { dayjs } from '@tachybase/utils'; import { dayjs } from '@tachybase/utils';
import { faker } from '@faker-js/faker';
test('filter task node', async ({ page, mockPage, mockCollections, mockRecords }) => { test('filter task node', async ({ page, mockPage, mockCollections, mockRecords }) => {
//数据表后缀标识 //数据表后缀标识
const triggerNodeAppendText = 'a' + faker.string.alphanumeric(4); const triggerNodeAppendText = 'a' + faker.string.alphanumeric(4);

View File

@ -1,18 +1,17 @@
import { Plugin } from '@tachybase/client'; import { Plugin } from '@tachybase/client';
import WorkflowPlugin from '../..'; import WorkflowPlugin from '../..';
import Manual from './instruction';
import { NAMESPACE } from '../../locale'; import { NAMESPACE } from '../../locale';
import { WorkflowTodo } from './WorkflowTodo'; import Manual from './instruction';
import { WorkflowTodoBlockInitializer } from './WorkflowTodoBlockInitializer'; import { addCustomFormField, addCustomFormField_deprecated } from './instruction/forms/custom';
import { import {
addActionButton, addActionButton,
addActionButton_deprecated, addActionButton_deprecated,
addBlockButton, addBlockButton,
addBlockButton_deprecated, addBlockButton_deprecated,
} from './instruction/SchemaConfig'; } from './instruction/SchemaConfig';
import { addCustomFormField, addCustomFormField_deprecated } from './instruction/forms/custom'; import { WorkflowTodo } from './WorkflowTodo';
import { WorkflowTodoBlockInitializer } from './WorkflowTodoBlockInitializer';
export class PluginManual extends Plugin { export class PluginManual extends Plugin {
async load() { async load() {

View File

@ -1,5 +1,6 @@
import React from 'react'; import React from 'react';
import { RemoteSelect, Variable } from '@tachybase/client'; import { RemoteSelect, Variable } from '@tachybase/client';
import { useWorkflowVariableOptions } from '../../..'; import { useWorkflowVariableOptions } from '../../..';
function isUserKeyField(field) { function isUserKeyField(field) {

View File

@ -1,5 +1,4 @@
import React from 'react'; import React from 'react';
import { import {
CollectionProvider_deprecated, CollectionProvider_deprecated,
SchemaInitializerItem, SchemaInitializerItem,
@ -11,7 +10,6 @@ import {
} from '@tachybase/client'; } from '@tachybase/client';
import { JOB_STATUS, traverseSchema } from '../../..'; import { JOB_STATUS, traverseSchema } from '../../..';
import { NAMESPACE } from '../../../locale'; import { NAMESPACE } from '../../../locale';
import { createManualFormBlockUISchema } from './createManualFormBlockUISchema'; import { createManualFormBlockUISchema } from './createManualFormBlockUISchema';

View File

@ -1,5 +1,4 @@
import { createForm } from '@tachybase/schema'; import React, { useMemo, useRef } from 'react';
import { RecursionField, useField, useFieldSchema } from '@tachybase/schema';
import { import {
BlockRequestContext_deprecated, BlockRequestContext_deprecated,
CollectionManagerProvider, CollectionManagerProvider,
@ -16,7 +15,7 @@ import {
useDesignable, useDesignable,
useRecord, useRecord,
} from '@tachybase/client'; } from '@tachybase/client';
import React, { useMemo, useRef } from 'react'; import { createForm, RecursionField, useField, useFieldSchema } from '@tachybase/schema';
export function FormBlockProvider(props) { export function FormBlockProvider(props) {
const userJob = useRecord(); const userJob = useRecord();

View File

@ -1,9 +1,10 @@
import { QuestionCircleOutlined } from '@ant-design/icons';
import { FormLayout } from '@tachybase/components';
import { Form, Radio, Tooltip } from 'antd';
import React from 'react'; import React from 'react';
import { css, FormItem } from '@tachybase/client'; import { css, FormItem } from '@tachybase/client';
import { FormLayout } from '@tachybase/components';
import { QuestionCircleOutlined } from '@ant-design/icons';
import { Form, Radio, Tooltip } from 'antd';
import { lang } from '../../../locale'; import { lang } from '../../../locale';
function parseMode(v) { function parseMode(v) {

View File

@ -1,5 +1,4 @@
import React, { useMemo, useState } from 'react'; import React, { useMemo, useState } from 'react';
import { import {
GeneralSchemaDesigner, GeneralSchemaDesigner,
SchemaSettingsBlockTitleItem, SchemaSettingsBlockTitleItem,
@ -13,6 +12,7 @@ import {
} from '@tachybase/client'; } from '@tachybase/client';
import _ from 'lodash'; import _ from 'lodash';
import { NAMESPACE } from '../../../../locale'; import { NAMESPACE } from '../../../../locale';
import { FormBlockInitializer } from '../FormBlockInitializer'; import { FormBlockInitializer } from '../FormBlockInitializer';
import { ManualFormType } from '../SchemaConfig'; import { ManualFormType } from '../SchemaConfig';

View File

@ -1,31 +1,29 @@
import React, { useContext, useMemo, useState } from 'react'; import React, { useContext, useMemo, useState } from 'react';
import { ArrayTable } from '@tachybase/components';
import { Field, createForm } from '@tachybase/schema';
import { useField, useFieldSchema, useForm } from '@tachybase/schema';
import { cloneDeep, pick, set } from 'lodash';
import { import {
ActionContextProvider, ActionContextProvider,
CollectionProvider_deprecated, CollectionProvider_deprecated,
CompatibleSchemaInitializer, CompatibleSchemaInitializer,
FormBlockContext, FormBlockContext,
gridRowColWrap,
RecordProvider, RecordProvider,
SchemaComponent, SchemaComponent,
SchemaInitializerItem, SchemaInitializerItem,
SchemaInitializerItemType,
SchemaInitializerItems, SchemaInitializerItems,
gridRowColWrap, SchemaInitializerItemType,
useCollectionManager_deprecated,
useCollection_deprecated, useCollection_deprecated,
useCollectionManager_deprecated,
useRecord, useRecord,
useSchemaInitializer, useSchemaInitializer,
useSchemaInitializerItem, useSchemaInitializerItem,
} from '@tachybase/client'; } from '@tachybase/client';
import { JOB_STATUS } from '../../../..'; import { ArrayTable } from '@tachybase/components';
import { createForm, Field, useField, useFieldSchema, useForm } from '@tachybase/schema';
import { merge, uid } from '@tachybase/utils/client'; import { merge, uid } from '@tachybase/utils/client';
import { NAMESPACE, lang } from '../../../../locale'; import { cloneDeep, pick, set } from 'lodash';
import { JOB_STATUS } from '../../../..';
import { lang, NAMESPACE } from '../../../../locale';
import { ManualFormType } from '../SchemaConfig'; import { ManualFormType } from '../SchemaConfig';
import { findSchema } from '../utils'; import { findSchema } from '../utils';

View File

@ -1,8 +1,4 @@
import { useFieldSchema } from '@tachybase/schema';
import React, { useMemo, useState } from 'react'; import React, { useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import _ from 'lodash';
import { import {
GeneralSchemaDesigner, GeneralSchemaDesigner,
SchemaSettingsActionModalItem, SchemaSettingsActionModalItem,
@ -15,12 +11,16 @@ import {
useDesignable, useDesignable,
useMenuSearch, useMenuSearch,
} from '@tachybase/client'; } from '@tachybase/client';
import { useFieldSchema } from '@tachybase/schema';
import _ from 'lodash';
import { useTranslation } from 'react-i18next';
import { FilterDynamicComponent } from '../../../../components';
import { NAMESPACE } from '../../../../locale'; import { NAMESPACE } from '../../../../locale';
import { FormBlockInitializer } from '../FormBlockInitializer'; import { FormBlockInitializer } from '../FormBlockInitializer';
import { ManualFormType } from '../SchemaConfig'; import { ManualFormType } from '../SchemaConfig';
import { findSchema } from '../utils'; import { findSchema } from '../utils';
import { FilterDynamicComponent } from '../../../../components';
function UpdateFormDesigner() { function UpdateFormDesigner() {
const { name, title } = useCollection_deprecated(); const { name, title } = useCollection_deprecated();

View File

@ -1,20 +1,21 @@
import { faker } from '@faker-js/faker';
import { import {
CollectionTriggerNode,
apiCreateWorkflow, apiCreateWorkflow,
apiDeleteWorkflow, apiDeleteWorkflow,
apiGetWorkflow, apiGetWorkflow,
apiGetWorkflowNodeExecutions,
apiUpdateWorkflowTrigger, apiUpdateWorkflowTrigger,
appendJsonCollectionName, appendJsonCollectionName,
ClculationNode,
CollectionTriggerNode,
ConditionYesNode,
generalWithNoRelationalFields, generalWithNoRelationalFields,
ParallelBranchNode, ParallelBranchNode,
ConditionYesNode,
ClculationNode,
apiGetWorkflowNodeExecutions,
} from '@tachybase/plugin-workflow-test/e2e'; } from '@tachybase/plugin-workflow-test/e2e';
import { expect, test } from '@tachybase/test/e2e'; import { expect, test } from '@tachybase/test/e2e';
import { dayjs } from '@tachybase/utils'; import { dayjs } from '@tachybase/utils';
import { faker } from '@faker-js/faker';
test.describe('All succeeded', () => { test.describe('All succeeded', () => {
test('All 3 branches were successful', async ({ page, mockCollections, mockRecords }) => { test('All 3 branches were successful', async ({ page, mockCollections, mockRecords }) => {
//数据表后缀标识 //数据表后缀标识

View File

@ -1,6 +1,6 @@
import { Plugin } from '@tachybase/client'; import { Plugin } from '@tachybase/client';
import WorkflowPlugin from '../..';
import WorkflowPlugin from '../..';
import ParallelInstruction from './ParallelInstruction'; import ParallelInstruction from './ParallelInstruction';
export class PluginParallel extends Plugin { export class PluginParallel extends Plugin {

View File

@ -1,6 +1,6 @@
import { Plugin } from '@tachybase/client'; import { Plugin } from '@tachybase/client';
import WorkflowPlugin from '../..';
import WorkflowPlugin from '../..';
import RequestInstruction from './RequestInstruction'; import RequestInstruction from './RequestInstruction';
export class PluginRequest extends Plugin { export class PluginRequest extends Plugin {

View File

@ -1,24 +1,25 @@
import { faker } from '@faker-js/faker';
import { import {
apiCreateWorkflow,
apiDeleteWorkflow,
apiGetRecord,
apiGetWorkflow,
apiGetWorkflowNodeExecutions,
apiUpdateRecord,
apiUpdateWorkflowTrigger,
appendJsonCollectionName,
CollectionTriggerNode, CollectionTriggerNode,
CreateWorkFlow, CreateWorkFlow,
EditWorkFlow, EditWorkFlow,
WorkflowListRecords,
apiCreateWorkflow,
apiDeleteWorkflow,
apiGetWorkflow,
apiUpdateRecord,
apiGetWorkflowNodeExecutions,
apiUpdateWorkflowTrigger,
appendJsonCollectionName,
generalWithNoRelationalFields, generalWithNoRelationalFields,
QueryRecordNode, QueryRecordNode,
SQLNode, SQLNode,
apiGetRecord, WorkflowListRecords,
} from '@tachybase/plugin-workflow-test/e2e'; } from '@tachybase/plugin-workflow-test/e2e';
import { expect, test } from '@tachybase/test/e2e'; import { expect, test } from '@tachybase/test/e2e';
import { dayjs } from '@tachybase/utils'; import { dayjs } from '@tachybase/utils';
import { faker } from '@faker-js/faker';
test.describe('select data', () => { test.describe('select data', () => {
test('No variable SQL, select 1 record', async ({ page, mockCollections, mockRecords }) => { test('No variable SQL, select 1 record', async ({ page, mockCollections, mockRecords }) => {
//数据表后缀标识 //数据表后缀标识

View File

@ -1,6 +1,6 @@
import { Plugin } from '@tachybase/client'; import { Plugin } from '@tachybase/client';
import WorkflowPlugin from '../..';
import WorkflowPlugin from '../..';
import SQLInstruction from './SQLInstruction'; import SQLInstruction from './SQLInstruction';
export class PluginSql extends Plugin { export class PluginSql extends Plugin {

View File

@ -0,0 +1,56 @@
import React, { useCallback } from 'react';
import { Space } from '@tachybase/client';
import { Radio, Select } from 'antd';
import { lang } from '../../locale';
import { useAvailableUpstreams, useNodeContext } from '../../nodes';
import { useStyles } from './useStyles';
export function VariableTargetSelect({ value, onChange }) {
const isNull = value == null;
const node = useNodeContext();
const nodes = useAvailableUpstreams(node, (n) => n.type === 'variable' && !n.config.target);
const { styles } = useStyles();
const onTargetChange = useCallback(
({ target }) => {
if (target.value) return onChange(null);
nodes.length && onChange(nodes[0].key);
},
[onChange, nodes],
);
const filterOption = useCallback(
(t, v) => v.label.toLowerCase().indexOf(t.toLowerCase()) >= 0 || `#${v.data.id}`.indexOf(t) >= 0,
[],
);
return (
<fieldset>
<Radio.Group value={isNull} onChange={onTargetChange}>
<Space direction="vertical">
<Radio value={true}>{lang('Declare a new variable')}</Radio>
<Space>
<Radio value={false} disabled={!nodes.length}>
{lang('Assign value to an existing variable')}
</Radio>
{!isNull && (
<Select
options={nodes.map((node) => ({ label: node.title, value: node.key, data: node }))}
value={value}
onChange={onChange}
allowClear
showSearch
filterOption={filterOption}
optionRender={({ label, data }) => (
<Space>
<span>{label}</span>
<span className={styles.nodeIdClass}>{data.data.id}</span>
</Space>
)}
/>
)}
</Space>
</Space>
</Radio.Group>
</fieldset>
);
}

View File

@ -0,0 +1,34 @@
import { useCollectionDataSource } from '@tachybase/client';
import { tval } from '../../locale';
import { Instruction } from '../../nodes';
import { defaultFieldNames, WorkflowVariableInput } from '../../variable';
import { VariableTargetSelect } from './VariableTargetSelect';
export class VariablesInstruction extends Instruction {
title = tval('Variable');
type = 'variable';
group = 'control';
description = tval('Assign value to a variable, for later use.');
fieldset = {
target: {
type: 'string',
title: tval('Mode'),
'x-decorator': 'FormItem',
'x-component': 'VariableTargetSelect',
},
value: {
type: 'string',
title: tval('Value'),
'x-decorator': 'FormItem',
'x-component': 'WorkflowVariableInput',
'x-component-props': { useTypedConstant: true },
default: '',
},
};
scope = { useCollectionDataSource };
components = { WorkflowVariableInput, VariableTargetSelect };
useVariables({ key, title, config }, { types, fieldNames = defaultFieldNames }) {
return config.target ? null : { [fieldNames.value]: key, [fieldNames.label]: title };
}
}

View File

@ -0,0 +1,10 @@
import { Plugin } from '@tachybase/client';
import { PluginWorkflow } from '../../Plugin';
import { VariablesInstruction } from './VariablesInstruction';
export class PluginVariables extends Plugin {
async load() {
(this.app.pm.get('workflow') as PluginWorkflow).registerInstruction('variable', VariablesInstruction);
}
}

View File

@ -0,0 +1,11 @@
import { createStyles } from '@tachybase/client';
export const useStyles = createStyles(({ css, token }) => ({
nodeIdClass: css`
color: ${token.colorTextDescription};
&:before {
content: '#';
}
`,
}));

View File

@ -1,17 +1,17 @@
import { useNavigate } from 'react-router-dom';
import { App, message } from 'antd';
import { useField, useFieldSchema, useForm } from '@tachybase/schema';
import { import {
useAPIClient,
useActionContext, useActionContext,
useAPIClient,
useBlockRequestContext, useBlockRequestContext,
useCollectValuesToSubmit, useCollectValuesToSubmit,
useCompile, useCompile,
useRecord, useRecord,
} from '@tachybase/client'; } from '@tachybase/client';
import { useField, useFieldSchema, useForm } from '@tachybase/schema';
import { isURL } from '@tachybase/utils/client'; import { isURL } from '@tachybase/utils/client';
import { App, message } from 'antd';
import { useNavigate } from 'react-router-dom';
export function useTriggerWorkflowsActionProps() { export function useTriggerWorkflowsActionProps() {
const api = useAPIClient(); const api = useAPIClient();
const form = useForm(); const form = useForm();

View File

@ -1,132 +1,6 @@
import React from 'react'; import { PluginWorkflow } from './Plugin';
import { Plugin } from '@tachybase/client';
import { Registry } from '@tachybase/utils/client';
import { ExecutionPage } from './ExecutionPage'; export default PluginWorkflow;
import { PluginActionTrigger } from './features/action-trigger';
import { PluginAggregate } from './features/aggregate';
import { PluginAPIRegularClient } from './features/api-regular';
import { PluginDelay } from './features/delay';
import { PluginDaynamicCalculation } from './features/dynamic-calculation';
import PluginWorkflowJSParseClient from './features/js-parse';
import PluginWorkflowJsonParseClient from './features/json-parse';
import { PluginLoop } from './features/loop';
import { PluginManual } from './features/manual';
import { PluginParallel } from './features/parallel';
import { PluginRequest } from './features/request';
import { PluginSql } from './features/sql';
import { NAMESPACE } from './locale';
import { Instruction } from './nodes';
import CalculationInstruction from './nodes/calculation';
import ConditionInstruction from './nodes/condition';
import CreateInstruction from './nodes/create';
import DestroyInstruction from './nodes/destroy';
import EndInstruction from './nodes/end';
import QueryInstruction from './nodes/query';
import UpdateInstruction from './nodes/update';
import { customizeSubmitToWorkflowActionSettings } from './settings/customizeSubmitToWorkflowActionSettings';
import { Trigger } from './triggers';
import CollectionTrigger from './triggers/collection';
import ScheduleTrigger from './triggers/schedule';
import { getWorkflowDetailPath, getWorkflowExecutionsPath } from './utils';
import { WorkflowPage } from './WorkflowPage';
import { WorkflowPane } from './WorkflowPane';
export default class PluginWorkflowClient extends Plugin {
triggers = new Registry<Trigger>();
instructions = new Registry<Instruction>();
getTriggersOptions = () => {
return Array.from(this.triggers.getEntities()).map(([value, { title, ...options }]) => ({
value,
label: title,
color: 'gold',
options,
}));
};
isWorkflowSync(workflow) {
return this.triggers.get(workflow.type).sync ?? workflow.sync;
}
registerTrigger(type: string, trigger: Trigger | { new (): Trigger }) {
if (typeof trigger === 'function') {
this.triggers.register(type, new trigger());
} else if (trigger) {
this.triggers.register(type, trigger);
} else {
throw new TypeError('invalid trigger type to register');
}
}
registerInstruction(type: string, instruction: Instruction | { new (): Instruction }) {
if (typeof instruction === 'function') {
this.instructions.register(type, new instruction());
} else if (instruction instanceof Instruction) {
this.instructions.register(type, instruction);
} else {
throw new TypeError('invalid instruction type to register');
}
}
async afterAdd() {
await this.pm.add(PluginSql);
await this.pm.add(PluginRequest);
await this.pm.add(PluginParallel);
await this.pm.add(PluginManual);
await this.pm.add(PluginLoop);
await this.pm.add(PluginDaynamicCalculation);
await this.pm.add(PluginDelay);
await this.pm.add(PluginAggregate);
await this.pm.add(PluginActionTrigger);
await this.pm.add(PluginWorkflowJsonParseClient);
await this.pm.add(PluginWorkflowJSParseClient);
await this.pm.add(PluginAPIRegularClient);
}
async load() {
this.addRoutes();
this.addComponents();
this.app.pluginSettingsManager.add(NAMESPACE, {
icon: 'PartitionOutlined',
title: `{{t("Workflow", { ns: "${NAMESPACE}" })}}`,
Component: WorkflowPane,
aclSnippet: 'pm.workflow.workflows',
});
this.app.schemaSettingsManager.add(customizeSubmitToWorkflowActionSettings);
this.registerTrigger('collection', CollectionTrigger);
this.registerTrigger('schedule', ScheduleTrigger);
this.registerInstruction('calculation', CalculationInstruction);
this.registerInstruction('condition', ConditionInstruction);
this.registerInstruction('end', EndInstruction);
this.registerInstruction('query', QueryInstruction);
this.registerInstruction('create', CreateInstruction);
this.registerInstruction('update', UpdateInstruction);
this.registerInstruction('destroy', DestroyInstruction);
}
addComponents() {
this.app.addComponents({
WorkflowPage,
ExecutionPage,
});
}
addRoutes() {
this.app.router.add('admin.workflow.workflows.id', {
path: getWorkflowDetailPath(':id'),
element: <WorkflowPage />,
});
this.app.router.add('admin.workflow.executions.id', {
path: getWorkflowExecutionsPath(':id'),
element: <ExecutionPage />,
});
}
}
export * from './Branch'; export * from './Branch';
export * from './FlowContext'; export * from './FlowContext';

View File

@ -5,12 +5,12 @@ import {
useCompile, useCompile,
} from '@tachybase/client'; } from '@tachybase/client';
import { Instruction } from '.';
import { CollectionBlockInitializer } from '../components/CollectionBlockInitializer'; import { CollectionBlockInitializer } from '../components/CollectionBlockInitializer';
import CollectionFieldset from '../components/CollectionFieldset'; import CollectionFieldset from '../components/CollectionFieldset';
import { NAMESPACE } from '../locale'; import { NAMESPACE } from '../locale';
import { appends, collection, values } from '../schemas/collection'; import { appends, collection, values } from '../schemas/collection';
import { getCollectionFieldOptions } from '../variable'; import { getCollectionFieldOptions } from '../variable';
import { Instruction } from '.';
export default class extends Instruction { export default class extends Instruction {
title = `{{t("Create record", { ns: "${NAMESPACE}" })}}`; title = `{{t("Create record", { ns: "${NAMESPACE}" })}}`;

View File

@ -1,10 +1,10 @@
import { useCollectionDataSource } from '@tachybase/client'; import { useCollectionDataSource } from '@tachybase/client';
import { Instruction } from '.';
import { FilterDynamicComponent } from '../components/FilterDynamicComponent'; import { FilterDynamicComponent } from '../components/FilterDynamicComponent';
import { lang, NAMESPACE } from '../locale';
import { collection, filter } from '../schemas/collection'; import { collection, filter } from '../schemas/collection';
import { isValidFilter } from '../utils'; import { isValidFilter } from '../utils';
import { Instruction } from '.';
import { NAMESPACE, lang } from '../locale';
export default class extends Instruction { export default class extends Instruction {
title = '{{t("Delete record")}}'; title = '{{t("Delete record")}}';

View File

@ -1,6 +1,6 @@
import { Instruction } from '.'; import { Instruction } from '.';
import { NAMESPACE } from '../locale';
import { JOB_STATUS } from '../constants'; import { JOB_STATUS } from '../constants';
import { NAMESPACE } from '../locale';
export default class extends Instruction { export default class extends Instruction {
title = `{{t("End process", { ns: "${NAMESPACE}" })}}`; title = `{{t("End process", { ns: "${NAMESPACE}" })}}`;

View File

@ -1,5 +1,3 @@
import { ArrayItems } from '@tachybase/components';
import { import {
SchemaComponentContext, SchemaComponentContext,
SchemaInitializerItemType, SchemaInitializerItemType,
@ -7,14 +5,15 @@ import {
useCollectionManager_deprecated, useCollectionManager_deprecated,
useCompile, useCompile,
} from '@tachybase/client'; } from '@tachybase/client';
import { ArrayItems } from '@tachybase/components';
import { useForm } from '@tachybase/schema'; import { useForm } from '@tachybase/schema';
import { Instruction } from '.';
import { CollectionBlockInitializer } from '../components/CollectionBlockInitializer'; import { CollectionBlockInitializer } from '../components/CollectionBlockInitializer';
import { FilterDynamicComponent } from '../components/FilterDynamicComponent'; import { FilterDynamicComponent } from '../components/FilterDynamicComponent';
import { NAMESPACE } from '../locale'; import { NAMESPACE } from '../locale';
import { appends, collection, filter, pagination, sort } from '../schemas/collection'; import { appends, collection, filter, pagination, sort } from '../schemas/collection';
import { WorkflowVariableInput, getCollectionFieldOptions } from '../variable'; import { getCollectionFieldOptions, WorkflowVariableInput } from '../variable';
import { Instruction } from '.';
export default class extends Instruction { export default class extends Instruction {
title = `{{t("Query record", { ns: "${NAMESPACE}" })}}`; title = `{{t("Query record", { ns: "${NAMESPACE}" })}}`;

View File

@ -1,5 +1,6 @@
import { useForm } from '@tachybase/schema';
import { css, parseCollectionName, useCollectionFilterOptions } from '@tachybase/client'; import { css, parseCollectionName, useCollectionFilterOptions } from '@tachybase/client';
import { useForm } from '@tachybase/schema';
import { NAMESPACE } from '../locale'; import { NAMESPACE } from '../locale';
export const collection = { export const collection = {

View File

@ -1,5 +1,3 @@
import { useFieldSchema } from '@tachybase/schema';
import { isValid } from '@tachybase/schema';
import { import {
AfterSuccess, AfterSuccess,
AssignedFieldValues, AssignedFieldValues,
@ -8,9 +6,10 @@ import {
SchemaSettings, SchemaSettings,
SecondConFirm, SecondConFirm,
SkipValidation, SkipValidation,
WorkflowConfig,
useSchemaToolbar, useSchemaToolbar,
WorkflowConfig,
} from '@tachybase/client'; } from '@tachybase/client';
import { isValid, useFieldSchema } from '@tachybase/schema';
export const customizeSubmitToWorkflowActionSettings = new SchemaSettings({ export const customizeSubmitToWorkflowActionSettings = new SchemaSettings({
name: 'actionSettings:submitToWorkflow', name: 'actionSettings:submitToWorkflow',

View File

@ -4,13 +4,14 @@ import {
useCollectionManager_deprecated, useCollectionManager_deprecated,
useCompile, useCompile,
} from '@tachybase/client'; } from '@tachybase/client';
import { Trigger } from '.';
import { CollectionBlockInitializer } from '../components/CollectionBlockInitializer'; import { CollectionBlockInitializer } from '../components/CollectionBlockInitializer';
import { FieldsSelect } from '../components/FieldsSelect'; import { FieldsSelect } from '../components/FieldsSelect';
import { NAMESPACE, lang } from '../locale'; import { useWorkflowAnyExecuted } from '../hooks';
import { lang, NAMESPACE } from '../locale';
import { appends, collection, filter } from '../schemas/collection'; import { appends, collection, filter } from '../schemas/collection';
import { getCollectionFieldOptions } from '../variable'; import { getCollectionFieldOptions } from '../variable';
import { useWorkflowAnyExecuted } from '../hooks';
import { Trigger } from '.';
const COLLECTION_TRIGGER_MODE = { const COLLECTION_TRIGGER_MODE = {
CREATED: 1, CREATED: 1,

View File

@ -1,7 +1,9 @@
import { css } from '@tachybase/client';
import { DatePicker, Select } from 'antd';
import { dayjs } from '@tachybase/utils/client';
import React from 'react'; import React from 'react';
import { css } from '@tachybase/client';
import { dayjs } from '@tachybase/utils/client';
import { DatePicker, Select } from 'antd';
import { useWorkflowTranslation } from '../../locale'; import { useWorkflowTranslation } from '../../locale';
import { OnField } from './OnField'; import { OnField } from './OnField';

View File

@ -1,6 +1,7 @@
import { css } from '@tachybase/client';
import { InputNumber, Select } from 'antd';
import React, { useState } from 'react'; import React, { useState } from 'react';
import { css } from '@tachybase/client';
import { InputNumber, Select } from 'antd';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { FieldsSelect } from '../../components/FieldsSelect'; import { FieldsSelect } from '../../components/FieldsSelect';

View File

@ -1,7 +1,7 @@
import { onFieldValueChange } from '@tachybase/schema';
import { useForm, useFormEffects, ISchema } from '@tachybase/schema';
import { css, SchemaComponent } from '@tachybase/client';
import React, { useState } from 'react'; import React, { useState } from 'react';
import { css, SchemaComponent } from '@tachybase/client';
import { ISchema, onFieldValueChange, useForm, useFormEffects } from '@tachybase/schema';
import { NAMESPACE } from '../../locale'; import { NAMESPACE } from '../../locale';
import { appends, collection } from '../../schemas/collection'; import { appends, collection } from '../../schemas/collection';
import { SCHEDULE_MODE } from './constants'; import { SCHEDULE_MODE } from './constants';

View File

@ -5,12 +5,12 @@ import {
useCompile, useCompile,
} from '@tachybase/client'; } from '@tachybase/client';
import { CollectionBlockInitializer } from '../../components/CollectionBlockInitializer';
import { NAMESPACE, lang } from '../../locale';
import { getCollectionFieldOptions } from '../../variable';
import { Trigger } from '..'; import { Trigger } from '..';
import { ScheduleConfig } from './ScheduleConfig'; import { CollectionBlockInitializer } from '../../components/CollectionBlockInitializer';
import { lang, NAMESPACE } from '../../locale';
import { getCollectionFieldOptions } from '../../variable';
import { SCHEDULE_MODE } from './constants'; import { SCHEDULE_MODE } from './constants';
import { ScheduleConfig } from './ScheduleConfig';
export default class extends Trigger { export default class extends Trigger {
sync = false; sync = false;

View File

@ -1,11 +1,10 @@
import React from 'react'; import React from 'react';
import { parseCollectionName, useCompile, usePlugin, Variable } from '@tachybase/client';
import { Variable, parseCollectionName, useCompile, usePlugin } from '@tachybase/client';
import { useFlowContext } from './FlowContext';
import { NAMESPACE, lang } from './locale';
import { useAvailableUpstreams, useNodeContext, useUpstreamScopes } from './nodes';
import WorkflowPlugin from '.'; import WorkflowPlugin from '.';
import { useFlowContext } from './FlowContext';
import { lang, NAMESPACE } from './locale';
import { useAvailableUpstreams, useNodeContext, useUpstreamScopes } from './nodes';
export type VariableOption = { export type VariableOption = {
key?: string; key?: string;

View File

@ -13,6 +13,7 @@ import { PluginAggregate } from './features/aggregate/Plugin';
import PluginWorkflowAPIRegularServer from './features/api-regular/plugin'; import PluginWorkflowAPIRegularServer from './features/api-regular/plugin';
import { PluginDelay } from './features/delay/Plugin'; import { PluginDelay } from './features/delay/Plugin';
import { PluginDynamicCalculation } from './features/dynamic-calculation/Plugin'; import { PluginDynamicCalculation } from './features/dynamic-calculation/Plugin';
import { PluginInterception } from './features/interception';
import PluginWorkflowJSParseServer from './features/js-parse/plugin'; import PluginWorkflowJSParseServer from './features/js-parse/plugin';
import PluginWorkflowJSONParseServer from './features/json-parse/plugin'; import PluginWorkflowJSONParseServer from './features/json-parse/plugin';
import { PluginLoop } from './features/loop/Plugin'; import { PluginLoop } from './features/loop/Plugin';
@ -20,6 +21,7 @@ import { PluginManual } from './features/manual/Plugin';
import { PluginParallel } from './features/parallel/Plugin'; import { PluginParallel } from './features/parallel/Plugin';
import { PluginRequest } from './features/request/Plugin'; import { PluginRequest } from './features/request/Plugin';
import { PluginSql } from './features/sql/Plugin'; import { PluginSql } from './features/sql/Plugin';
import { PluginVariables } from './features/variables';
import initFunctions, { CustomFunction } from './functions'; import initFunctions, { CustomFunction } from './functions';
import { Instruction, InstructionInterface } from './instructions'; import { Instruction, InstructionInterface } from './instructions';
import CalculationInstruction from './instructions/CalculationInstruction'; import CalculationInstruction from './instructions/CalculationInstruction';
@ -68,6 +70,8 @@ export default class PluginWorkflowServer extends Plugin {
pluginJSONParse: PluginWorkflowJSONParseServer; pluginJSONParse: PluginWorkflowJSONParseServer;
pluginJSParse: PluginWorkflowJSParseServer; pluginJSParse: PluginWorkflowJSParseServer;
pluginAPIRegular: PluginWorkflowAPIRegularServer; pluginAPIRegular: PluginWorkflowAPIRegularServer;
pluginInterception: PluginInterception;
pluginVariables: PluginVariables;
constructor(app: Application, options?: PluginOptions) { constructor(app: Application, options?: PluginOptions) {
super(app, options); super(app, options);
@ -83,6 +87,8 @@ export default class PluginWorkflowServer extends Plugin {
this.pluginJSONParse = new PluginWorkflowJSONParseServer(app, options); this.pluginJSONParse = new PluginWorkflowJSONParseServer(app, options);
this.pluginJSParse = new PluginWorkflowJSParseServer(app, options); this.pluginJSParse = new PluginWorkflowJSParseServer(app, options);
this.pluginAPIRegular = new PluginWorkflowAPIRegularServer(app, options); this.pluginAPIRegular = new PluginWorkflowAPIRegularServer(app, options);
this.pluginInterception = new PluginInterception(app, options);
this.pluginVariables = new PluginVariables(app, options);
} }
getLogger(workflowId: ID): Logger { getLogger(workflowId: ID): Logger {
@ -309,6 +315,8 @@ export default class PluginWorkflowServer extends Plugin {
await this.pluginJSONParse.load(); await this.pluginJSONParse.load();
await this.pluginJSParse.load(); await this.pluginJSParse.load();
await this.pluginAPIRegular.load(); await this.pluginAPIRegular.load();
await this.pluginInterception.load();
await this.pluginVariables.load();
} }
toggle(workflow: WorkflowModel, enable?: boolean) { toggle(workflow: WorkflowModel, enable?: boolean) {

View File

@ -2,9 +2,10 @@ import { Model, Transaction, Transactionable } from '@tachybase/database';
import { appendArrayColumn } from '@tachybase/evaluators'; import { appendArrayColumn } from '@tachybase/evaluators';
import { Logger } from '@tachybase/logger'; import { Logger } from '@tachybase/logger';
import { parse } from '@tachybase/utils'; import { parse } from '@tachybase/utils';
import type Plugin from './Plugin';
import { EXECUTION_STATUS, JOB_STATUS } from './constants'; import { EXECUTION_STATUS, JOB_STATUS } from './constants';
import { Runner } from './instructions'; import { Runner } from './instructions';
import type Plugin from './Plugin';
import type { ExecutionModel, FlowNodeModel, JobModel } from './types'; import type { ExecutionModel, FlowNodeModel, JobModel } from './types';
export interface ProcessorOptions extends Transactionable { export interface ProcessorOptions extends Transactionable {

View File

@ -1,6 +1,6 @@
import { MockServer } from '@tachybase/test';
import Database from '@tachybase/database'; import Database from '@tachybase/database';
import { getApp, sleep } from '@tachybase/plugin-workflow-test'; import { getApp, sleep } from '@tachybase/plugin-workflow-test';
import { MockServer } from '@tachybase/test';
import Plugin from '..'; import Plugin from '..';
import { EXECUTION_STATUS } from '../constants'; import { EXECUTION_STATUS } from '../constants';

Some files were not shown because too many files have changed in this diff Show More