@nocobase/plugin-workflow 0.9.3-alpha.1 → 0.9.4-alpha.1
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/CanvasContent.d.ts +4 -0
- package/lib/client/CanvasContent.js +49 -0
- package/lib/client/ExecutionCanvas.js +110 -44
- package/lib/client/WorkflowCanvas.js +35 -18
- package/lib/client/components/CollectionFieldset.js +2 -2
- package/lib/client/components/NodeDescription.d.ts +2 -0
- package/lib/client/components/NodeDescription.js +59 -0
- package/lib/client/components/ValueBlock.d.ts +5 -0
- package/lib/client/components/ValueBlock.js +110 -0
- package/lib/client/index.d.ts +1 -0
- package/lib/client/index.js +12 -0
- package/lib/client/locale/es-ES.d.ts +130 -0
- package/lib/client/locale/es-ES.js +136 -0
- package/lib/client/locale/zh-CN.d.ts +35 -6
- package/lib/client/locale/zh-CN.js +35 -6
- package/lib/client/nodes/aggregate.d.ts +186 -0
- package/lib/client/nodes/aggregate.js +349 -0
- package/lib/client/nodes/calculation.d.ts +2 -1
- package/lib/client/nodes/calculation.js +28 -53
- package/lib/client/nodes/condition.d.ts +2 -6
- package/lib/client/nodes/condition.js +4 -3
- package/lib/client/nodes/create.d.ts +5 -3
- package/lib/client/nodes/create.js +16 -7
- package/lib/client/nodes/delay.d.ts +1 -0
- package/lib/client/nodes/delay.js +1 -0
- package/lib/client/nodes/destroy.d.ts +2 -2
- package/lib/client/nodes/destroy.js +1 -0
- package/lib/client/nodes/index.d.ts +5 -2
- package/lib/client/nodes/index.js +95 -97
- package/lib/client/nodes/loop.d.ts +29 -0
- package/lib/client/nodes/loop.js +165 -0
- package/lib/client/nodes/manual/AssigneesSelect.js +8 -6
- package/lib/client/nodes/manual/index.d.ts +6 -1
- package/lib/client/nodes/manual/index.js +6 -1
- package/lib/client/nodes/parallel.d.ts +1 -0
- package/lib/client/nodes/parallel.js +2 -1
- package/lib/client/nodes/query.d.ts +12 -3
- package/lib/client/nodes/query.js +24 -17
- package/lib/client/nodes/request.d.ts +1 -0
- package/lib/client/nodes/request.js +1 -0
- package/lib/client/nodes/update.d.ts +2 -2
- package/lib/client/nodes/update.js +1 -0
- package/lib/client/schemas/collection.d.ts +1 -2
- package/lib/client/schemas/collection.js +5 -6
- package/lib/client/style.d.ts +1 -0
- package/lib/client/style.js +40 -26
- package/lib/client/triggers/collection.d.ts +2 -11
- package/lib/client/triggers/collection.js +6 -7
- package/lib/client/triggers/index.d.ts +1 -1
- package/lib/client/triggers/index.js +5 -3
- package/lib/client/triggers/schedule/index.d.ts +3 -1
- package/lib/client/triggers/schedule/index.js +6 -4
- package/lib/client/variable.d.ts +27 -1
- package/lib/client/variable.js +65 -34
- package/lib/server/Plugin.js +2 -14
- package/lib/server/Processor.d.ts +3 -0
- package/lib/server/Processor.js +30 -3
- package/lib/server/actions/workflows.js +2 -2
- package/lib/server/collections/workflows.js +2 -1
- package/lib/server/instructions/aggregate.d.ts +9 -0
- package/lib/server/instructions/aggregate.js +57 -0
- package/lib/server/instructions/calculation.js +1 -1
- package/lib/server/instructions/condition.js +1 -1
- package/lib/server/instructions/create.js +1 -1
- package/lib/server/instructions/destroy.js +1 -1
- package/lib/server/instructions/index.d.ts +1 -0
- package/lib/server/instructions/index.js +1 -1
- package/lib/server/instructions/loop.d.ts +16 -0
- package/lib/server/instructions/loop.js +107 -0
- package/lib/server/instructions/parallel.js +17 -10
- package/lib/server/instructions/query.js +1 -4
- package/lib/server/instructions/request.js +1 -1
- package/lib/server/instructions/update.js +1 -1
- package/package.json +13 -13
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
function _react() {
|
|
8
|
+
const data = _interopRequireDefault(require("react"));
|
|
9
|
+
_react = function _react() {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _icons() {
|
|
15
|
+
const data = require("@ant-design/icons");
|
|
16
|
+
_icons = function _icons() {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _css() {
|
|
22
|
+
const data = require("@emotion/css");
|
|
23
|
+
_css = function _css() {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
function _client() {
|
|
29
|
+
const data = require("@nocobase/client");
|
|
30
|
+
_client = function _client() {
|
|
31
|
+
return data;
|
|
32
|
+
};
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
var _ = require(".");
|
|
36
|
+
var _FlowContext = require("../FlowContext");
|
|
37
|
+
var _locale = require("../locale");
|
|
38
|
+
var _variable = require("../variable");
|
|
39
|
+
var _style = require("../style");
|
|
40
|
+
var _Branch = require("../Branch");
|
|
41
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
42
|
+
function findOption(options, paths) {
|
|
43
|
+
let current = options;
|
|
44
|
+
for (let i = 0; i < paths.length; i++) {
|
|
45
|
+
const path = paths[i];
|
|
46
|
+
const option = current.find(item => item.value === path);
|
|
47
|
+
if (!option) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
if (option.children) {
|
|
51
|
+
current = option.children;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return current;
|
|
55
|
+
}
|
|
56
|
+
var _default = {
|
|
57
|
+
title: `{{t("Loop", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
58
|
+
type: 'loop',
|
|
59
|
+
group: 'control',
|
|
60
|
+
description: `{{t("By using a loop node, you can perform the same operation on multiple sets of data. The source of these sets can be either multiple records from a query node or multiple associated records of a single record. Loop node can also be used for iterating a certain number of times or for looping through each character in a string. However, excessive looping may cause performance issues, so use with caution.", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
61
|
+
fieldset: {
|
|
62
|
+
target: {
|
|
63
|
+
type: 'string',
|
|
64
|
+
title: `{{t("Loop target", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
65
|
+
description: `{{t("A single number will be treated as a loop count, a single string will be treated as an array of characters, and other non-array values will be converted to arrays. The loop node ends when the loop count is reached, or when the array loop is completed. You can also add condition nodes to the loop to terminate it.", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
66
|
+
'x-decorator': 'FormItem',
|
|
67
|
+
'x-component': 'Variable.Input',
|
|
68
|
+
'x-component-props': {
|
|
69
|
+
scope: '{{useWorkflowVariableOptions}}',
|
|
70
|
+
useTypedConstant: ['string', 'number', 'null']
|
|
71
|
+
},
|
|
72
|
+
required: true
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
view: {},
|
|
76
|
+
render: function Renderer(data) {
|
|
77
|
+
var _entry$branchIndex;
|
|
78
|
+
const _useFlowContext = (0, _FlowContext.useFlowContext)(),
|
|
79
|
+
nodes = _useFlowContext.nodes;
|
|
80
|
+
const entry = nodes.find(node => node.upstreamId === data.id && node.branchIndex != null);
|
|
81
|
+
return _react().default.createElement(_.NodeDefaultView, {
|
|
82
|
+
data: data
|
|
83
|
+
}, _react().default.createElement("div", {
|
|
84
|
+
className: (0, _css().cx)(_style.nodeSubtreeClass)
|
|
85
|
+
}, _react().default.createElement("div", {
|
|
86
|
+
className: (0, _css().cx)(_style.branchBlockClass, (0, _css().css)`
|
|
87
|
+
padding-left: 20em;
|
|
88
|
+
`)
|
|
89
|
+
}, _react().default.createElement(_Branch.Branch, {
|
|
90
|
+
from: data,
|
|
91
|
+
entry: entry,
|
|
92
|
+
branchIndex: (_entry$branchIndex = entry === null || entry === void 0 ? void 0 : entry.branchIndex) !== null && _entry$branchIndex !== void 0 ? _entry$branchIndex : 0
|
|
93
|
+
}), _react().default.createElement("div", {
|
|
94
|
+
className: (0, _css().cx)(_style.branchClass)
|
|
95
|
+
}, _react().default.createElement("div", {
|
|
96
|
+
className: "workflow-branch-lines"
|
|
97
|
+
}), _react().default.createElement("div", {
|
|
98
|
+
className: (0, _css().cx)(_style.addButtonClass, (0, _css().css)`
|
|
99
|
+
display: flex;
|
|
100
|
+
justify-content: center;
|
|
101
|
+
align-items: center;
|
|
102
|
+
position: absolute;
|
|
103
|
+
top: 50%;
|
|
104
|
+
transform: translateY(-50%);
|
|
105
|
+
width: 2em;
|
|
106
|
+
height: 6em;
|
|
107
|
+
`)
|
|
108
|
+
}, _react().default.createElement(_icons().ArrowUpOutlined, {
|
|
109
|
+
className: (0, _css().css)`
|
|
110
|
+
background-color: #f0f2f5;
|
|
111
|
+
`
|
|
112
|
+
})))), _react().default.createElement("div", {
|
|
113
|
+
className: (0, _css().css)`
|
|
114
|
+
position: relative;
|
|
115
|
+
height: 2em;
|
|
116
|
+
`
|
|
117
|
+
})));
|
|
118
|
+
},
|
|
119
|
+
scope: {
|
|
120
|
+
useWorkflowVariableOptions: _variable.useWorkflowVariableOptions
|
|
121
|
+
},
|
|
122
|
+
components: {},
|
|
123
|
+
useScopeVariables(node, options) {
|
|
124
|
+
const compile = (0, _client().useCompile)();
|
|
125
|
+
const target = node.config.target;
|
|
126
|
+
if (!target) {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
// const { workflow } = useFlowContext();
|
|
130
|
+
// const current = useNodeContext();
|
|
131
|
+
// const upstreams = useAvailableUpstreams(current);
|
|
132
|
+
// find target data model by path described in `config.target`
|
|
133
|
+
// 1. get options from $context/$jobsMapByNodeId
|
|
134
|
+
// 2. route to sub-options and use as loop target options
|
|
135
|
+
const targetOption = {
|
|
136
|
+
key: 'item',
|
|
137
|
+
value: 'item',
|
|
138
|
+
label: (0, _locale.lang)('Loop target')
|
|
139
|
+
};
|
|
140
|
+
if (typeof target === 'string' && target.startsWith('{{') && target.endsWith('}}')) {
|
|
141
|
+
const paths = target.slice(2, -2).split('.').map(path => path.trim());
|
|
142
|
+
const targetOptions = [_variable.nodesOptions, _variable.triggerOptions].map(item => {
|
|
143
|
+
const opts = typeof item.useOptions === 'function' ? item.useOptions(options).filter(Boolean) : null;
|
|
144
|
+
return {
|
|
145
|
+
label: compile(item.title),
|
|
146
|
+
value: item.value,
|
|
147
|
+
key: item.value,
|
|
148
|
+
children: compile(opts),
|
|
149
|
+
disabled: opts && !opts.length
|
|
150
|
+
};
|
|
151
|
+
});
|
|
152
|
+
targetOption.children = findOption(targetOptions, paths);
|
|
153
|
+
}
|
|
154
|
+
return [targetOption, {
|
|
155
|
+
key: 'index',
|
|
156
|
+
value: 'index',
|
|
157
|
+
label: (0, _locale.lang)('Loop index')
|
|
158
|
+
}, {
|
|
159
|
+
key: 'length',
|
|
160
|
+
value: 'length',
|
|
161
|
+
label: (0, _locale.lang)('Loop length')
|
|
162
|
+
}];
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
exports.default = _default;
|
|
@@ -25,12 +25,14 @@ function AssigneesSelect({
|
|
|
25
25
|
value = [],
|
|
26
26
|
onChange: _onChange
|
|
27
27
|
}) {
|
|
28
|
-
const scope = (0, _variable.useWorkflowVariableOptions)(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
const scope = (0, _variable.useWorkflowVariableOptions)({
|
|
29
|
+
types: [{
|
|
30
|
+
type: 'reference',
|
|
31
|
+
options: {
|
|
32
|
+
collection: 'users'
|
|
33
|
+
}
|
|
34
|
+
}]
|
|
35
|
+
});
|
|
34
36
|
return _react().default.createElement(_client().Variable.Input, {
|
|
35
37
|
scope: scope,
|
|
36
38
|
value: value[0],
|
|
@@ -7,6 +7,7 @@ declare const _default: {
|
|
|
7
7
|
title: string;
|
|
8
8
|
type: string;
|
|
9
9
|
group: string;
|
|
10
|
+
description: string;
|
|
10
11
|
fieldset: {
|
|
11
12
|
assignees: {
|
|
12
13
|
type: string;
|
|
@@ -58,7 +59,11 @@ declare const _default: {
|
|
|
58
59
|
ModeConfig: typeof ModeConfig;
|
|
59
60
|
AssigneesSelect: typeof AssigneesSelect;
|
|
60
61
|
};
|
|
61
|
-
|
|
62
|
+
useVariables({ config }: {
|
|
63
|
+
config: any;
|
|
64
|
+
}, { types }: {
|
|
65
|
+
types: any;
|
|
66
|
+
}): {
|
|
62
67
|
key: string;
|
|
63
68
|
value: string;
|
|
64
69
|
label: any;
|
|
@@ -40,6 +40,7 @@ var _default = {
|
|
|
40
40
|
title: `{{t("Manual", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
41
41
|
type: 'manual',
|
|
42
42
|
group: 'manual',
|
|
43
|
+
description: `{{t("Could be used for manually submitting data, and determine whether to continue or exit. Workflow will generate a todo item for assigned user when it reaches a manual node, and continue processing after user submits the form.", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
43
44
|
fieldset: {
|
|
44
45
|
assignees: {
|
|
45
46
|
type: 'array',
|
|
@@ -93,7 +94,11 @@ var _default = {
|
|
|
93
94
|
ModeConfig: _ModeConfig.ModeConfig,
|
|
94
95
|
AssigneesSelect: _AssigneesSelect.AssigneesSelect
|
|
95
96
|
},
|
|
96
|
-
|
|
97
|
+
useVariables({
|
|
98
|
+
config
|
|
99
|
+
}, {
|
|
100
|
+
types
|
|
101
|
+
}) {
|
|
97
102
|
var _config$forms;
|
|
98
103
|
const formKeys = Object.keys((_config$forms = config.forms) !== null && _config$forms !== void 0 ? _config$forms : {});
|
|
99
104
|
if (!formKeys.length) {
|
|
@@ -50,6 +50,7 @@ var _default = {
|
|
|
50
50
|
title: `{{t("Parallel branch", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
51
51
|
type: 'parallel',
|
|
52
52
|
group: 'control',
|
|
53
|
+
description: `{{t("Run multiple branch processes in parallel.", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
53
54
|
fieldset: {
|
|
54
55
|
mode: {
|
|
55
56
|
type: 'string',
|
|
@@ -68,7 +69,7 @@ var _default = {
|
|
|
68
69
|
}, {
|
|
69
70
|
value: 'race',
|
|
70
71
|
label: `{{t('Any succeeded or failed', { ns: "${_locale.NAMESPACE}" })}}`,
|
|
71
|
-
tooltip: `{{t('Continue after any branch succeeded, or exit after any branch failed', { ns: "${_locale.NAMESPACE}" })}}`
|
|
72
|
+
tooltip: `{{t('Continue after any branch succeeded, or exit after any branch failed.', { ns: "${_locale.NAMESPACE}" })}}`
|
|
72
73
|
}]
|
|
73
74
|
},
|
|
74
75
|
default: 'all'
|
|
@@ -5,19 +5,26 @@ declare const _default: {
|
|
|
5
5
|
title: string;
|
|
6
6
|
type: string;
|
|
7
7
|
group: string;
|
|
8
|
+
description: string;
|
|
8
9
|
fieldset: {
|
|
9
10
|
collection: {
|
|
10
11
|
type: string;
|
|
11
12
|
title: string;
|
|
12
13
|
required: boolean;
|
|
13
|
-
'x-reactions':
|
|
14
|
+
'x-reactions': any[];
|
|
14
15
|
'x-decorator': string;
|
|
15
16
|
'x-component': string;
|
|
16
17
|
'x-component-props': {
|
|
17
18
|
dropdownMatchSelectWidth: boolean;
|
|
18
|
-
placeholder: string;
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
|
+
multiple: {
|
|
22
|
+
type: string;
|
|
23
|
+
title: string;
|
|
24
|
+
'x-decorator': string;
|
|
25
|
+
'x-component': string;
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
21
28
|
params: {
|
|
22
29
|
type: string;
|
|
23
30
|
properties: {
|
|
@@ -71,7 +78,9 @@ declare const _default: {
|
|
|
71
78
|
FilterDynamicComponent: typeof FilterDynamicComponent;
|
|
72
79
|
FieldsSelect: import("react").MemoExoticComponent<import("react").FunctionComponent<Pick<any, string | number | symbol>>>;
|
|
73
80
|
};
|
|
74
|
-
|
|
81
|
+
useVariables({ config }: {
|
|
82
|
+
config: any;
|
|
83
|
+
}, options: any): import("../variable").VariableOption[];
|
|
75
84
|
useInitializers(node: any): SchemaInitializerItemOptions | null;
|
|
76
85
|
initializers: {
|
|
77
86
|
CollectionFieldInitializers: typeof CollectionFieldInitializers;
|
|
@@ -18,21 +18,25 @@ var _CollectionFieldInitializers = require("../components/CollectionFieldInitial
|
|
|
18
18
|
var _FilterDynamicComponent = require("../components/FilterDynamicComponent");
|
|
19
19
|
var _variable = require("../variable");
|
|
20
20
|
var _FieldsSelect = require("../components/FieldsSelect");
|
|
21
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
22
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
23
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
24
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
25
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
21
26
|
var _default = {
|
|
22
27
|
title: `{{t("Query record", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
23
28
|
type: 'query',
|
|
24
29
|
group: 'collection',
|
|
30
|
+
description: `{{t("Query records from a collection. You can use variables from upstream nodes as query conditions.", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
25
31
|
fieldset: {
|
|
26
32
|
collection: _collection.collection,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
// }
|
|
35
|
-
// },
|
|
33
|
+
multiple: {
|
|
34
|
+
type: 'boolean',
|
|
35
|
+
title: `{{t("Allow multiple records as result", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
36
|
+
'x-decorator': 'FormItem',
|
|
37
|
+
'x-component': 'Checkbox',
|
|
38
|
+
description: `{{t("If checked, when there are multiple records in the query result, an array will be returned as the result, which can be operated on one by one using a loop node. Otherwise, only one record will be returned.", { ns: "${_locale.NAMESPACE}" })}}`
|
|
39
|
+
},
|
|
36
40
|
params: {
|
|
37
41
|
type: 'object',
|
|
38
42
|
properties: {
|
|
@@ -42,7 +46,7 @@ var _default = {
|
|
|
42
46
|
},
|
|
43
47
|
failOnEmpty: {
|
|
44
48
|
type: 'boolean',
|
|
45
|
-
title: `{{t("
|
|
49
|
+
title: `{{t("Exit when query result is null", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
46
50
|
'x-decorator': 'FormItem',
|
|
47
51
|
'x-component': 'Checkbox'
|
|
48
52
|
}
|
|
@@ -55,13 +59,16 @@ var _default = {
|
|
|
55
59
|
FilterDynamicComponent: _FilterDynamicComponent.FilterDynamicComponent,
|
|
56
60
|
FieldsSelect: _FieldsSelect.FieldsSelect
|
|
57
61
|
},
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
})
|
|
62
|
+
useVariables({
|
|
63
|
+
config
|
|
64
|
+
}, options) {
|
|
65
|
+
var _options$depth, _config$params, _config$params$append;
|
|
66
|
+
const result = (0, _variable.useCollectionFieldOptions)(_objectSpread(_objectSpread({
|
|
67
|
+
collection: config === null || config === void 0 ? void 0 : config.collection
|
|
68
|
+
}, options), {}, {
|
|
69
|
+
depth: ((_options$depth = options === null || options === void 0 ? void 0 : options.depth) !== null && _options$depth !== void 0 ? _options$depth : config === null || config === void 0 ? void 0 : (_config$params = config.params) === null || _config$params === void 0 ? void 0 : (_config$params$append = _config$params.appends) === null || _config$params$append === void 0 ? void 0 : _config$params$append.length) ? 1 : 0
|
|
70
|
+
}));
|
|
71
|
+
return (result === null || result === void 0 ? void 0 : result.length) ? result : null;
|
|
65
72
|
},
|
|
66
73
|
useInitializers(node) {
|
|
67
74
|
var _node$title;
|
|
@@ -24,6 +24,7 @@ var _default = {
|
|
|
24
24
|
title: `{{t("HTTP request", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
25
25
|
type: 'request',
|
|
26
26
|
group: 'extended',
|
|
27
|
+
description: `{{t("Send HTTP request to a URL. You can use the variables in the upstream nodes as request headers, parameters and request body.", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
27
28
|
fieldset: {
|
|
28
29
|
method: {
|
|
29
30
|
type: 'string',
|
|
@@ -4,17 +4,17 @@ declare const _default: {
|
|
|
4
4
|
title: string;
|
|
5
5
|
type: string;
|
|
6
6
|
group: string;
|
|
7
|
+
description: string;
|
|
7
8
|
fieldset: {
|
|
8
9
|
collection: {
|
|
9
10
|
type: string;
|
|
10
11
|
title: string;
|
|
11
12
|
required: boolean;
|
|
12
|
-
'x-reactions':
|
|
13
|
+
'x-reactions': any[];
|
|
13
14
|
'x-decorator': string;
|
|
14
15
|
'x-component': string;
|
|
15
16
|
'x-component-props': {
|
|
16
17
|
dropdownMatchSelectWidth: boolean;
|
|
17
|
-
placeholder: string;
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
params: {
|
|
@@ -26,6 +26,7 @@ var _default = {
|
|
|
26
26
|
title: `{{t("Update record", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
27
27
|
type: 'update',
|
|
28
28
|
group: 'collection',
|
|
29
|
+
description: `{{t("Update records of a collection. You can use variables from upstream nodes as query conditions and field values.", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
29
30
|
fieldset: {
|
|
30
31
|
collection: _collection.collection,
|
|
31
32
|
params: {
|
|
@@ -2,12 +2,11 @@ export declare const collection: {
|
|
|
2
2
|
type: string;
|
|
3
3
|
title: string;
|
|
4
4
|
required: boolean;
|
|
5
|
-
'x-reactions':
|
|
5
|
+
'x-reactions': any[];
|
|
6
6
|
'x-decorator': string;
|
|
7
7
|
'x-component': string;
|
|
8
8
|
'x-component-props': {
|
|
9
9
|
dropdownMatchSelectWidth: boolean;
|
|
10
|
-
placeholder: string;
|
|
11
10
|
};
|
|
12
11
|
};
|
|
13
12
|
export declare const values: {
|
|
@@ -30,12 +30,11 @@ const collection = {
|
|
|
30
30
|
type: 'string',
|
|
31
31
|
title: '{{t("Collection")}}',
|
|
32
32
|
required: true,
|
|
33
|
-
'x-reactions': [
|
|
33
|
+
'x-reactions': [],
|
|
34
34
|
'x-decorator': 'FormItem',
|
|
35
|
-
'x-component': '
|
|
35
|
+
'x-component': 'CollectionSelect',
|
|
36
36
|
'x-component-props': {
|
|
37
|
-
dropdownMatchSelectWidth: false
|
|
38
|
-
placeholder: '{{t("Select collection")}}'
|
|
37
|
+
dropdownMatchSelectWidth: false
|
|
39
38
|
}
|
|
40
39
|
};
|
|
41
40
|
exports.collection = collection;
|
|
@@ -50,7 +49,7 @@ const values = {
|
|
|
50
49
|
`
|
|
51
50
|
},
|
|
52
51
|
'x-component': 'CollectionFieldset',
|
|
53
|
-
description: `{{t("
|
|
52
|
+
description: `{{t("Unassigned fields will be set to default values, and those without default values will be set to null.", { ns: "${_locale.NAMESPACE}" })}}`
|
|
54
53
|
};
|
|
55
54
|
exports.values = values;
|
|
56
55
|
const filter = {
|
|
@@ -78,7 +77,7 @@ exports.filter = filter;
|
|
|
78
77
|
const appends = {
|
|
79
78
|
type: 'array',
|
|
80
79
|
title: `{{t("Preload associations", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
81
|
-
description: `{{t("
|
|
80
|
+
description: `{{t("Please select the associated fields that need to be accessed in subsequent nodes", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
82
81
|
'x-decorator': 'FormItem',
|
|
83
82
|
'x-component': 'FieldsSelect',
|
|
84
83
|
'x-component-props': {
|
package/lib/client/style.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare const branchClass: string;
|
|
|
5
5
|
export declare const nodeBlockClass: string;
|
|
6
6
|
export declare const nodeClass: string;
|
|
7
7
|
export declare const nodeCardClass: string;
|
|
8
|
+
export declare const nodeJobButtonClass: string;
|
|
8
9
|
export declare const nodeHeaderClass: string;
|
|
9
10
|
export declare const nodeMetaClass: string;
|
|
10
11
|
export declare const nodeTitleClass: string;
|
package/lib/client/style.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.workflowVersionDropdownClass = exports.workflowPageClass = exports.nodeTitleClass = exports.nodeSubtreeClass = exports.nodeMetaClass = exports.nodeHeaderClass = exports.nodeClass = exports.nodeCardClass = exports.nodeBlockClass = exports.branchClass = exports.branchBlockClass = exports.addButtonClass = void 0;
|
|
6
|
+
exports.workflowVersionDropdownClass = exports.workflowPageClass = exports.nodeTitleClass = exports.nodeSubtreeClass = exports.nodeMetaClass = exports.nodeJobButtonClass = exports.nodeHeaderClass = exports.nodeClass = exports.nodeCardClass = exports.nodeBlockClass = exports.branchClass = exports.branchBlockClass = exports.addButtonClass = void 0;
|
|
7
7
|
function _css() {
|
|
8
8
|
const data = require("@emotion/css");
|
|
9
9
|
_css = function _css() {
|
|
@@ -12,12 +12,19 @@ function _css() {
|
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
14
|
const workflowPageClass = (0, _css().css)`
|
|
15
|
+
flex-grow: 1;
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
|
|
15
20
|
.workflow-toolbar {
|
|
16
21
|
display: flex;
|
|
17
22
|
align-items: center;
|
|
18
23
|
justify-content: space-between;
|
|
24
|
+
position: relative;
|
|
19
25
|
padding: 0.5rem 1rem;
|
|
20
26
|
background: #fff;
|
|
27
|
+
border-bottom: 1px solid #e7e7e7;
|
|
21
28
|
|
|
22
29
|
header {
|
|
23
30
|
display: flex;
|
|
@@ -39,8 +46,9 @@ const workflowPageClass = (0, _css().css)`
|
|
|
39
46
|
}
|
|
40
47
|
|
|
41
48
|
.workflow-canvas {
|
|
42
|
-
|
|
43
|
-
|
|
49
|
+
flex-grow: 1;
|
|
50
|
+
overflow: auto;
|
|
51
|
+
width: 100%;
|
|
44
52
|
display: flex;
|
|
45
53
|
flex-direction: column;
|
|
46
54
|
align-items: center;
|
|
@@ -106,11 +114,11 @@ const branchClass = (0, _css().css)`
|
|
|
106
114
|
flex-direction: column;
|
|
107
115
|
align-items: center;
|
|
108
116
|
position: relative;
|
|
117
|
+
min-width: 20em;
|
|
109
118
|
padding: 0 2em;
|
|
110
119
|
|
|
111
120
|
.workflow-node-list {
|
|
112
121
|
flex-grow: 1;
|
|
113
|
-
min-width: 20em;
|
|
114
122
|
}
|
|
115
123
|
|
|
116
124
|
.workflow-branch-lines {
|
|
@@ -192,12 +200,8 @@ const nodeCardClass = (0, _css().css)`
|
|
|
192
200
|
box-shadow: 0 0.25em 1em rgba(0, 100, 200, 0.25);
|
|
193
201
|
}
|
|
194
202
|
|
|
195
|
-
.workflow-node-remove-button,
|
|
196
|
-
.workflow-node-job-button {
|
|
197
|
-
position: absolute;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
203
|
.workflow-node-remove-button {
|
|
204
|
+
position: absolute;
|
|
201
205
|
right: 0.5em;
|
|
202
206
|
top: 0.5em;
|
|
203
207
|
color: #999;
|
|
@@ -213,23 +217,6 @@ const nodeCardClass = (0, _css().css)`
|
|
|
213
217
|
}
|
|
214
218
|
}
|
|
215
219
|
|
|
216
|
-
.workflow-node-job-button {
|
|
217
|
-
display: flex;
|
|
218
|
-
top: 1em;
|
|
219
|
-
right: 1em;
|
|
220
|
-
width: 1.25rem;
|
|
221
|
-
height: 1.25rem;
|
|
222
|
-
min-width: 1.25rem;
|
|
223
|
-
justify-content: center;
|
|
224
|
-
align-items: center;
|
|
225
|
-
font-size: 0.8em;
|
|
226
|
-
color: #fff;
|
|
227
|
-
|
|
228
|
-
&[type='button'] {
|
|
229
|
-
border: none;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
220
|
.ant-input {
|
|
234
221
|
font-weight: bold;
|
|
235
222
|
|
|
@@ -262,6 +249,33 @@ const nodeCardClass = (0, _css().css)`
|
|
|
262
249
|
}
|
|
263
250
|
`;
|
|
264
251
|
exports.nodeCardClass = nodeCardClass;
|
|
252
|
+
const nodeJobButtonClass = (0, _css().css)`
|
|
253
|
+
display: flex;
|
|
254
|
+
position: absolute;
|
|
255
|
+
top: 1.25em;
|
|
256
|
+
right: 1.25em;
|
|
257
|
+
width: 1.25rem;
|
|
258
|
+
height: 1.25rem;
|
|
259
|
+
min-width: 1.25rem;
|
|
260
|
+
justify-content: center;
|
|
261
|
+
align-items: center;
|
|
262
|
+
font-size: 0.8em;
|
|
263
|
+
color: #fff;
|
|
264
|
+
|
|
265
|
+
&[type='button'] {
|
|
266
|
+
border: none;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.ant-tag {
|
|
270
|
+
padding: 0;
|
|
271
|
+
width: 100%;
|
|
272
|
+
line-height: 18px;
|
|
273
|
+
margin-right: 0;
|
|
274
|
+
border-radius: 50%;
|
|
275
|
+
text-align: center;
|
|
276
|
+
}
|
|
277
|
+
`;
|
|
278
|
+
exports.nodeJobButtonClass = nodeJobButtonClass;
|
|
265
279
|
const nodeHeaderClass = (0, _css().css)`
|
|
266
280
|
position: relative;
|
|
267
281
|
`;
|
|
@@ -5,15 +5,7 @@ declare const _default: {
|
|
|
5
5
|
type: string;
|
|
6
6
|
fieldset: {
|
|
7
7
|
collection: {
|
|
8
|
-
"x-reactions":
|
|
9
|
-
target: string;
|
|
10
|
-
effects: string[];
|
|
11
|
-
fulfill: {
|
|
12
|
-
state: {
|
|
13
|
-
value: any[];
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
})[];
|
|
8
|
+
"x-reactions": any[];
|
|
17
9
|
type: string;
|
|
18
10
|
title: string;
|
|
19
11
|
required: boolean;
|
|
@@ -21,7 +13,6 @@ declare const _default: {
|
|
|
21
13
|
'x-component': string;
|
|
22
14
|
'x-component-props': {
|
|
23
15
|
dropdownMatchSelectWidth: boolean;
|
|
24
|
-
placeholder: string;
|
|
25
16
|
};
|
|
26
17
|
};
|
|
27
18
|
mode: {
|
|
@@ -115,7 +106,7 @@ declare const _default: {
|
|
|
115
106
|
components: {
|
|
116
107
|
FieldsSelect: import("react").MemoExoticComponent<import("react").FunctionComponent<Pick<any, string | number | symbol>>>;
|
|
117
108
|
};
|
|
118
|
-
|
|
109
|
+
useVariables(config: any, options: any): import("../variable").VariableOption[];
|
|
119
110
|
useInitializers(config: any): SchemaInitializerItemOptions | null;
|
|
120
111
|
initializers: {
|
|
121
112
|
CollectionFieldInitializers: typeof CollectionFieldInitializers;
|
|
@@ -134,8 +134,8 @@ var _default = {
|
|
|
134
134
|
components: {
|
|
135
135
|
FieldsSelect: _FieldsSelect.FieldsSelect
|
|
136
136
|
},
|
|
137
|
-
|
|
138
|
-
var _config$appends;
|
|
137
|
+
useVariables(config, options) {
|
|
138
|
+
var _options$depth, _config$appends;
|
|
139
139
|
const _useWorkflowTranslati = (0, _locale.useWorkflowTranslation)(),
|
|
140
140
|
t = _useWorkflowTranslati.t;
|
|
141
141
|
const rootFields = [{
|
|
@@ -147,12 +147,11 @@ var _default = {
|
|
|
147
147
|
title: t('Trigger data')
|
|
148
148
|
}
|
|
149
149
|
}];
|
|
150
|
-
const
|
|
150
|
+
const result = (0, _variable.useCollectionFieldOptions)(_objectSpread(_objectSpread({}, options), {}, {
|
|
151
151
|
fields: rootFields,
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
return options;
|
|
152
|
+
depth: (_options$depth = options === null || options === void 0 ? void 0 : options.depth) !== null && _options$depth !== void 0 ? _options$depth : ((_config$appends = config.appends) === null || _config$appends === void 0 ? void 0 : _config$appends.length) ? 2 : 1
|
|
153
|
+
}));
|
|
154
|
+
return result;
|
|
156
155
|
},
|
|
157
156
|
useInitializers(config) {
|
|
158
157
|
if (!config.collection) {
|
|
@@ -6,7 +6,7 @@ import { VariableOptions } from '../variable';
|
|
|
6
6
|
export interface Trigger {
|
|
7
7
|
title: string;
|
|
8
8
|
type: string;
|
|
9
|
-
|
|
9
|
+
useVariables?(config: any, options?: any): VariableOptions;
|
|
10
10
|
fieldset: {
|
|
11
11
|
[key: string]: ISchema;
|
|
12
12
|
};
|