@nocobase/plugin-workflow 0.11.0-alpha.1 → 0.11.1-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client/AddButton.js +13 -4
- package/lib/client/Branch.js +4 -2
- package/lib/client/CanvasContent.js +6 -4
- package/lib/client/ExecutionCanvas.js +18 -7
- package/lib/client/ExecutionPage.js +4 -2
- package/lib/client/WorkflowCanvas.js +16 -6
- package/lib/client/WorkflowPage.js +4 -2
- package/lib/client/WorkflowProvider.js +2 -2
- package/lib/client/components/CollectionBlockInitializer.js +3 -3
- package/lib/client/components/CollectionFieldset.js +7 -1
- package/lib/client/components/FieldsSelect.js +4 -1
- package/lib/client/components/NodeDescription.js +36 -22
- package/lib/client/index.js +3 -3
- package/lib/client/locale/zh-CN.d.ts +5 -1
- package/lib/client/locale/zh-CN.js +6 -2
- package/lib/client/nodes/aggregate.d.ts +6 -1
- package/lib/client/nodes/aggregate.js +4 -3
- package/lib/client/nodes/calculation.d.ts +5 -3
- package/lib/client/nodes/calculation.js +6 -5
- package/lib/client/nodes/condition.d.ts +1 -7
- package/lib/client/nodes/condition.js +12 -23
- package/lib/client/nodes/create.d.ts +2 -4
- package/lib/client/nodes/create.js +1 -3
- package/lib/client/nodes/index.d.ts +1 -2
- package/lib/client/nodes/index.js +24 -24
- package/lib/client/nodes/loop.js +19 -28
- package/lib/client/nodes/manual/FormBlockInitializer.js +6 -5
- package/lib/client/nodes/manual/SchemaConfig.d.ts +1 -2
- package/lib/client/nodes/manual/SchemaConfig.js +175 -21
- package/lib/client/nodes/manual/WorkflowTodo.js +39 -46
- package/lib/client/nodes/manual/forms/create.js +8 -1
- package/lib/client/nodes/manual/forms/custom.js +11 -4
- package/lib/client/nodes/manual/forms/update.js +8 -1
- package/lib/client/nodes/manual/index.d.ts +6 -1
- package/lib/client/nodes/manual/index.js +5 -4
- package/lib/client/nodes/parallel.js +7 -4
- package/lib/client/nodes/query.d.ts +2 -5
- package/lib/client/nodes/query.js +1 -3
- package/lib/client/nodes/sql.d.ts +26 -0
- package/lib/client/{triggers/schedule/DateFieldsSelect.js → nodes/sql.js} +37 -46
- package/lib/client/schemas/collection.d.ts +2 -3
- package/lib/client/schemas/collection.js +8 -7
- package/lib/client/style.d.ts +18 -13
- package/lib/client/style.js +312 -289
- package/lib/client/triggers/collection.d.ts +9 -10
- package/lib/client/triggers/collection.js +4 -0
- package/lib/client/triggers/index.d.ts +2 -3
- package/lib/client/triggers/index.js +10 -5
- package/lib/client/triggers/schedule/OnField.js +35 -23
- package/lib/client/triggers/schedule/ScheduleConfig.js +7 -7
- package/lib/client/triggers/schedule/index.d.ts +0 -1
- package/lib/client/triggers/schedule/index.js +31 -19
- package/lib/client/variable.d.ts +29 -11
- package/lib/client/variable.js +39 -24
- package/lib/server/Plugin.d.ts +1 -3
- package/lib/server/Plugin.js +10 -6
- package/lib/server/Processor.d.ts +1 -1
- package/lib/server/Processor.js +2 -2
- package/lib/server/instructions/create.d.ts +1 -1
- package/lib/server/instructions/create.js +13 -13
- package/lib/server/instructions/index.js +1 -1
- package/lib/server/instructions/manual/actions.js +19 -7
- package/lib/server/instructions/manual/forms/create.js +7 -1
- package/lib/server/instructions/manual/forms/update.js +7 -1
- package/lib/server/instructions/query.js +8 -1
- package/lib/server/instructions/request.d.ts +1 -1
- package/lib/server/instructions/request.js +4 -2
- package/lib/server/instructions/sql.d.ts +12 -0
- package/lib/server/instructions/sql.js +34 -0
- package/lib/server/migrations/20230710115902-manual-action-values.d.ts +4 -0
- package/lib/server/migrations/20230710115902-manual-action-values.js +97 -0
- package/lib/server/triggers/collection.js +13 -11
- package/lib/server/utils.d.ts +2 -0
- package/lib/server/utils.js +21 -0
- package/package.json +12 -11
- package/src/client/AddButton.tsx +17 -5
- package/src/client/Branch.tsx +4 -2
- package/src/client/CanvasContent.tsx +6 -4
- package/src/client/ExecutionCanvas.tsx +11 -13
- package/src/client/ExecutionPage.tsx +3 -2
- package/src/client/WorkflowCanvas.tsx +14 -13
- package/src/client/WorkflowPage.tsx +3 -2
- package/src/client/WorkflowProvider.tsx +2 -2
- package/src/client/components/CollectionBlockInitializer.tsx +3 -3
- package/src/client/components/CollectionFieldset.tsx +5 -3
- package/src/client/components/FieldsSelect.tsx +5 -1
- package/src/client/components/NodeDescription.tsx +30 -23
- package/src/client/index.tsx +3 -3
- package/src/client/locale/zh-CN.ts +8 -2
- package/src/client/nodes/aggregate.tsx +4 -4
- package/src/client/nodes/calculation.tsx +4 -5
- package/src/client/nodes/condition.tsx +7 -34
- package/src/client/nodes/create.tsx +0 -1
- package/src/client/nodes/index.tsx +21 -25
- package/src/client/nodes/loop.tsx +16 -31
- package/src/client/nodes/manual/FormBlockInitializer.tsx +6 -5
- package/src/client/nodes/manual/SchemaConfig.tsx +162 -18
- package/src/client/nodes/manual/WorkflowTodo.tsx +43 -47
- package/src/client/nodes/manual/forms/create.tsx +5 -1
- package/src/client/nodes/manual/forms/custom.tsx +7 -3
- package/src/client/nodes/manual/forms/update.tsx +5 -1
- package/src/client/nodes/manual/index.tsx +5 -5
- package/src/client/nodes/parallel.tsx +6 -5
- package/src/client/nodes/query.tsx +0 -1
- package/src/client/nodes/sql.tsx +37 -0
- package/src/client/schemas/collection.ts +6 -6
- package/src/client/style.tsx +324 -289
- package/src/client/triggers/collection.tsx +4 -0
- package/src/client/triggers/index.tsx +14 -10
- package/src/client/triggers/schedule/OnField.tsx +29 -15
- package/src/client/triggers/schedule/ScheduleConfig.tsx +21 -19
- package/src/client/triggers/schedule/index.tsx +25 -19
- package/src/client/variable.tsx +48 -26
- package/src/server/Plugin.ts +13 -9
- package/src/server/Processor.ts +2 -2
- package/src/server/__tests__/collections/categories.ts +4 -0
- package/src/server/__tests__/instructions/manual.test.ts +391 -72
- package/src/server/__tests__/instructions/request.test.ts +30 -0
- package/src/server/__tests__/instructions/sql.test.ts +162 -0
- package/src/server/__tests__/triggers/collection.test.ts +35 -0
- package/src/server/instructions/create.ts +13 -11
- package/src/server/instructions/index.ts +1 -0
- package/src/server/instructions/manual/actions.ts +16 -4
- package/src/server/instructions/manual/forms/create.ts +2 -1
- package/src/server/instructions/manual/forms/update.ts +3 -2
- package/src/server/instructions/query.ts +12 -1
- package/src/server/instructions/request.ts +2 -1
- package/src/server/instructions/sql.ts +25 -0
- package/src/server/migrations/20230710115902-manual-action-values.ts +78 -0
- package/src/server/triggers/collection.ts +15 -11
- package/src/server/utils.ts +17 -0
- package/lib/client/triggers/schedule/DateFieldsSelect.d.ts +0 -2
- package/src/client/triggers/schedule/DateFieldsSelect.tsx +0 -28
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BlockInitializers, SchemaInitializerItemOptions, useCollectionManager, useCompile } from '@nocobase/client';
|
|
2
2
|
|
|
3
3
|
import { CollectionBlockInitializer } from '../../components/CollectionBlockInitializer';
|
|
4
|
-
import { getCollectionFieldOptions } from '../../variable';
|
|
4
|
+
import { defaultFieldNames, getCollectionFieldOptions } from '../../variable';
|
|
5
5
|
import { NAMESPACE } from '../../locale';
|
|
6
6
|
import { SchemaConfig, SchemaConfigButton } from './SchemaConfig';
|
|
7
7
|
import { ModeConfig } from './ModeConfig';
|
|
@@ -85,7 +85,7 @@ export default {
|
|
|
85
85
|
ModeConfig,
|
|
86
86
|
AssigneesSelect,
|
|
87
87
|
},
|
|
88
|
-
useVariables({ id, title, config }, { types }) {
|
|
88
|
+
useVariables({ id, title, config }, { types, fieldNames = defaultFieldNames }) {
|
|
89
89
|
const compile = useCompile();
|
|
90
90
|
const { getCollectionFields } = useCollectionManager();
|
|
91
91
|
const formKeys = Object.keys(config.forms ?? {});
|
|
@@ -119,9 +119,9 @@ export default {
|
|
|
119
119
|
|
|
120
120
|
return options.length
|
|
121
121
|
? {
|
|
122
|
-
value: `${id}`,
|
|
123
|
-
label: title,
|
|
124
|
-
children: options,
|
|
122
|
+
[fieldNames.value]: `${id}`,
|
|
123
|
+
[fieldNames.label]: title,
|
|
124
|
+
[fieldNames.children]: options,
|
|
125
125
|
}
|
|
126
126
|
: null;
|
|
127
127
|
},
|
|
@@ -4,10 +4,10 @@ import { Button, Tooltip } from 'antd';
|
|
|
4
4
|
import React, { useState } from 'react';
|
|
5
5
|
import { NodeDefaultView } from '.';
|
|
6
6
|
import { Branch } from '../Branch';
|
|
7
|
-
import { RadioWithTooltip } from '../components/RadioWithTooltip';
|
|
8
7
|
import { useFlowContext } from '../FlowContext';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { RadioWithTooltip } from '../components/RadioWithTooltip';
|
|
9
|
+
import { NAMESPACE, lang } from '../locale';
|
|
10
|
+
import useStyles from '../style';
|
|
11
11
|
|
|
12
12
|
export default {
|
|
13
13
|
title: `{{t("Parallel branch", { ns: "${NAMESPACE}" })}}`,
|
|
@@ -44,6 +44,7 @@ export default {
|
|
|
44
44
|
},
|
|
45
45
|
view: {},
|
|
46
46
|
component: function Component({ data }) {
|
|
47
|
+
const { styles } = useStyles();
|
|
47
48
|
const {
|
|
48
49
|
id,
|
|
49
50
|
config: { mode },
|
|
@@ -64,8 +65,8 @@ export default {
|
|
|
64
65
|
|
|
65
66
|
return (
|
|
66
67
|
<NodeDefaultView data={data}>
|
|
67
|
-
<div className={cx(nodeSubtreeClass)}>
|
|
68
|
-
<div className={cx(branchBlockClass)}>
|
|
68
|
+
<div className={cx(styles.nodeSubtreeClass)}>
|
|
69
|
+
<div className={cx(styles.branchBlockClass)}>
|
|
69
70
|
{branches.map((branch) => (
|
|
70
71
|
<Branch key={branch.id} from={data} entry={branch} branchIndex={branch.branchIndex} />
|
|
71
72
|
))}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Variable, css } from '@nocobase/client';
|
|
4
|
+
|
|
5
|
+
import { NAMESPACE } from '../locale';
|
|
6
|
+
import { useWorkflowVariableOptions } from '../variable';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: `{{t("SQL action", { ns: "${NAMESPACE}" })}}`,
|
|
10
|
+
type: 'sql',
|
|
11
|
+
group: 'extended',
|
|
12
|
+
description: `{{t("Execute a SQL statement in database.", { ns: "${NAMESPACE}" })}}`,
|
|
13
|
+
fieldset: {
|
|
14
|
+
sql: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
required: true,
|
|
17
|
+
title: 'SQL',
|
|
18
|
+
description: `{{t("Usage of SQL query result is not supported yet.", { ns: "${NAMESPACE}" })}}`,
|
|
19
|
+
'x-decorator': 'FormItem',
|
|
20
|
+
'x-component': 'SQLInput',
|
|
21
|
+
'x-component-props': {
|
|
22
|
+
rows: 20,
|
|
23
|
+
className: css`
|
|
24
|
+
font-size: 80%;
|
|
25
|
+
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
|
|
26
|
+
`,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
scope: {},
|
|
31
|
+
components: {
|
|
32
|
+
SQLInput(props) {
|
|
33
|
+
const scope = useWorkflowVariableOptions();
|
|
34
|
+
return <Variable.RawTextArea scope={scope} {...props} />;
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -52,15 +52,15 @@ export const filter = {
|
|
|
52
52
|
export const appends = {
|
|
53
53
|
type: 'array',
|
|
54
54
|
title: `{{t("Preload associations", { ns: "${NAMESPACE}" })}}`,
|
|
55
|
-
description: `{{t("Please select the associated fields that need to be accessed in subsequent nodes", { ns: "${NAMESPACE}" })}}`,
|
|
55
|
+
description: `{{t("Please select the associated fields that need to be accessed in subsequent nodes. With more than two levels of to-many associations may cause performance issue, please use with caution.", { ns: "${NAMESPACE}" })}}`,
|
|
56
56
|
'x-decorator': 'FormItem',
|
|
57
|
-
'x-component': '
|
|
57
|
+
'x-component': 'AppendsTreeSelect',
|
|
58
58
|
'x-component-props': {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return ['linkTo', 'belongsTo', 'hasOne', 'hasMany', 'belongsToMany'].includes(field.type);
|
|
59
|
+
useCollection() {
|
|
60
|
+
const { values } = useForm();
|
|
61
|
+
return values?.collection;
|
|
63
62
|
},
|
|
63
|
+
className: 'full-width',
|
|
64
64
|
},
|
|
65
65
|
'x-reactions': [
|
|
66
66
|
{
|