@nocobase/plugin-workflow 0.9.1-alpha.1 → 0.9.2-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/AddButton.js +50 -86
- package/lib/client/Branch.js +0 -13
- package/lib/client/ExecutionCanvas.js +16 -63
- package/lib/client/ExecutionLink.js +3 -21
- package/lib/client/ExecutionPage.js +1 -19
- package/lib/client/ExecutionResourceProvider.js +6 -23
- package/lib/client/FlowContext.js +0 -8
- package/lib/client/WorkflowCanvas.js +57 -129
- package/lib/client/WorkflowLink.js +3 -21
- package/lib/client/WorkflowPage.js +1 -19
- package/lib/client/WorkflowProvider.js +24 -47
- package/lib/client/WorkflowShortcut.js +0 -16
- package/lib/client/components/CollectionBlockInitializer.js +12 -22
- package/lib/client/components/CollectionFieldInitializers.js +5 -24
- package/lib/client/components/CollectionFieldset.js +33 -85
- package/lib/client/components/Duration.js +0 -14
- package/lib/client/components/DynamicExpression.d.ts +4 -0
- package/lib/client/components/DynamicExpression.js +102 -0
- package/lib/client/components/FieldsSelect.d.ts +2 -0
- package/lib/client/components/FieldsSelect.js +66 -0
- package/lib/client/components/FilterDynamicComponent.js +1 -10
- package/lib/client/components/NullRender.js +0 -1
- package/lib/client/components/OpenDrawer.js +10 -35
- package/lib/client/components/RadioWithTooltip.js +5 -27
- package/lib/client/components/renderEngineReference.d.ts +1 -0
- package/lib/client/components/renderEngineReference.js +55 -0
- package/lib/client/constants.js +0 -9
- package/lib/client/index.js +0 -6
- package/lib/client/interfaces/expression.d.ts +3 -0
- package/lib/client/interfaces/expression.js +37 -0
- package/lib/client/locale/index.js +5 -15
- package/lib/client/locale/pt-BR.d.ts +130 -0
- package/lib/client/locale/pt-BR.js +136 -0
- package/lib/client/locale/zh-CN.d.ts +16 -1
- package/lib/client/locale/zh-CN.js +17 -2
- package/lib/client/nodes/calculation.d.ts +56 -7
- package/lib/client/nodes/calculation.js +141 -74
- package/lib/client/nodes/condition.d.ts +5 -9
- package/lib/client/nodes/condition.js +30 -93
- package/lib/client/nodes/create.d.ts +36 -12
- package/lib/client/nodes/create.js +14 -28
- package/lib/client/nodes/delay.d.ts +3 -7
- package/lib/client/nodes/delay.js +5 -14
- package/lib/client/nodes/destroy.d.ts +3 -11
- package/lib/client/nodes/destroy.js +14 -12
- package/lib/client/nodes/index.d.ts +2 -2
- package/lib/client/nodes/index.js +181 -222
- package/lib/client/nodes/manual/AssigneesSelect.js +8 -18
- package/lib/client/nodes/manual/ModeConfig.js +0 -27
- package/lib/client/nodes/manual/SchemaConfig.js +87 -449
- package/lib/client/nodes/manual/WorkflowTodo.js +99 -163
- package/lib/client/nodes/manual/WorkflowTodoBlockInitializer.js +4 -20
- package/lib/client/nodes/manual/forms/customForm.d.ts +40 -0
- package/lib/client/nodes/manual/forms/customForm.js +411 -0
- package/lib/client/nodes/manual/index.d.ts +15 -6
- package/lib/client/nodes/manual/index.js +58 -54
- package/lib/client/nodes/parallel.d.ts +1 -2
- package/lib/client/nodes/parallel.js +16 -45
- package/lib/client/nodes/query.d.ts +30 -12
- package/lib/client/nodes/query.js +17 -25
- package/lib/client/nodes/request.d.ts +9 -17
- package/lib/client/nodes/request.js +13 -37
- package/lib/client/nodes/update.d.ts +27 -28
- package/lib/client/nodes/update.js +17 -18
- package/lib/client/schemas/collection.d.ts +20 -7
- package/lib/client/schemas/collection.js +27 -28
- package/lib/client/schemas/executions.js +3 -18
- package/lib/client/schemas/workflows.js +10 -33
- package/lib/client/style.js +75 -26
- package/lib/client/triggers/collection.d.ts +47 -18
- package/lib/client/triggers/collection.js +65 -123
- package/lib/client/triggers/index.d.ts +3 -6
- package/lib/client/triggers/index.js +146 -146
- package/lib/client/triggers/schedule/DateFieldsSelect.js +7 -32
- package/lib/client/triggers/schedule/EndsByField.js +1 -18
- package/lib/client/triggers/schedule/OnField.js +10 -38
- package/lib/client/triggers/schedule/RepeatField.js +4 -32
- package/lib/client/triggers/schedule/ScheduleConfig.js +25 -68
- package/lib/client/triggers/schedule/index.d.ts +21 -1
- package/lib/client/triggers/schedule/index.js +22 -24
- package/lib/client/triggers/schedule/locale/Cron.zh-CN.js +8 -4
- package/lib/client/utils.d.ts +1 -0
- package/lib/client/utils.js +31 -10
- package/lib/client/variable.d.ts +7 -6
- package/lib/client/variable.js +132 -71
- package/lib/index.js +0 -2
- package/lib/server/Plugin.d.ts +7 -7
- package/lib/server/Plugin.js +76 -111
- package/lib/server/Processor.d.ts +2 -0
- package/lib/server/Processor.js +62 -125
- package/lib/server/actions/index.js +3 -10
- package/lib/server/actions/nodes.js +34 -87
- package/lib/server/actions/workflows.js +46 -96
- package/lib/server/collections/executions.js +1 -1
- package/lib/server/collections/flow_nodes.js +7 -4
- package/lib/server/collections/jobs.js +1 -1
- package/lib/server/collections/workflows.js +3 -4
- package/lib/server/fields/expression-field.d.ts +8 -0
- package/lib/server/fields/expression-field.js +26 -0
- package/lib/server/fields/index.d.ts +1 -0
- package/lib/server/fields/index.js +12 -0
- package/lib/server/functions/index.js +3 -14
- package/lib/server/index.js +0 -6
- package/lib/server/instructions/calculation.js +22 -17
- package/lib/server/instructions/condition.js +8 -52
- package/lib/server/instructions/create.js +31 -15
- package/lib/server/instructions/delay.js +4 -32
- package/lib/server/instructions/destroy.js +6 -12
- package/lib/server/instructions/index.js +6 -23
- package/lib/server/instructions/manual/actions.js +22 -31
- package/lib/server/instructions/manual/collecions/users_jobs.js +1 -1
- package/lib/server/instructions/manual/index.d.ts +13 -12
- package/lib/server/instructions/manual/index.js +9 -47
- package/lib/server/instructions/parallel.js +9 -36
- package/lib/server/instructions/query.js +17 -15
- package/lib/server/instructions/request.js +7 -30
- package/lib/server/instructions/update.js +8 -14
- package/lib/server/migrations/20221129153547-calculation-variables.js +3 -27
- package/lib/server/migrations/20230221032941-change-request-body-type.js +3 -26
- package/lib/server/migrations/20230221071831-calculation-expression.js +1 -33
- package/lib/server/migrations/20230221121203-condition-calculation.js +5 -28
- package/lib/server/migrations/20230221162902-jsonb-to-json.js +3 -18
- package/lib/server/migrations/20230411034722-manual-multi-form.d.ts +4 -0
- package/lib/server/migrations/20230411034722-manual-multi-form.js +303 -0
- package/lib/server/models/Execution.js +0 -5
- package/lib/server/models/FlowNode.js +0 -5
- package/lib/server/models/Job.js +0 -5
- package/lib/server/models/Workflow.js +0 -5
- package/lib/server/triggers/collection.js +39 -61
- package/lib/server/triggers/index.js +3 -22
- package/lib/server/triggers/schedule.js +72 -194
- package/package.json +14 -11
|
@@ -4,104 +4,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
function _react() {
|
|
9
|
-
const data = _interopRequireDefault(require("react"));
|
|
10
|
-
|
|
11
|
-
_react = function _react() {
|
|
12
|
-
return data;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
return data;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function _antd() {
|
|
19
|
-
const data = require("antd");
|
|
20
|
-
|
|
21
|
-
_antd = function _antd() {
|
|
22
|
-
return data;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
return data;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function _core() {
|
|
29
|
-
const data = require("@formily/core");
|
|
30
|
-
|
|
31
|
-
_core = function _core() {
|
|
32
|
-
return data;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
return data;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function _react2() {
|
|
39
|
-
const data = require("@formily/react");
|
|
40
|
-
|
|
41
|
-
_react2 = function _react2() {
|
|
42
|
-
return data;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
return data;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
7
|
function _client() {
|
|
49
8
|
const data = require("@nocobase/client");
|
|
50
|
-
|
|
51
9
|
_client = function _client() {
|
|
52
10
|
return data;
|
|
53
11
|
};
|
|
54
|
-
|
|
55
12
|
return data;
|
|
56
13
|
}
|
|
57
|
-
|
|
58
14
|
var _collection = require("../schemas/collection");
|
|
59
|
-
|
|
60
15
|
var _variable = require("../variable");
|
|
61
|
-
|
|
62
16
|
var _CollectionBlockInitializer = require("../components/CollectionBlockInitializer");
|
|
63
|
-
|
|
64
17
|
var _CollectionFieldInitializers = require("../components/CollectionFieldInitializers");
|
|
65
|
-
|
|
66
18
|
var _locale = require("../locale");
|
|
67
|
-
|
|
68
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
69
|
-
|
|
19
|
+
var _FieldsSelect = require("../components/FieldsSelect");
|
|
70
20
|
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; }
|
|
71
|
-
|
|
72
21
|
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; }
|
|
73
|
-
|
|
74
|
-
function
|
|
75
|
-
|
|
76
|
-
const FieldsSelect = (0, _react2().observer)(props => {
|
|
77
|
-
var _values$config;
|
|
78
|
-
|
|
79
|
-
const compile = (0, _client().useCompile)();
|
|
80
|
-
|
|
81
|
-
const _useCollectionManager = (0, _client().useCollectionManager)(),
|
|
82
|
-
getCollectionFields = _useCollectionManager.getCollectionFields;
|
|
83
|
-
|
|
84
|
-
const _useForm = (0, _react2().useForm)(),
|
|
85
|
-
values = _useForm.values,
|
|
86
|
-
clearFormGraph = _useForm.clearFormGraph,
|
|
87
|
-
setValuesIn = _useForm.setValuesIn;
|
|
88
|
-
|
|
89
|
-
const fields = getCollectionFields(values === null || values === void 0 ? void 0 : (_values$config = values.config) === null || _values$config === void 0 ? void 0 : _values$config.collection);
|
|
90
|
-
(0, _react2().useFormEffects)(() => {
|
|
91
|
-
(0, _core().onFieldValueChange)('config.collection', field => {
|
|
92
|
-
clearFormGraph('config.changed');
|
|
93
|
-
setValuesIn('config.condition', null);
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
return _react().default.createElement(_antd().Select, _objectSpread({}, props), fields.filter(field => !field.hidden && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : true) && !['linkTo', 'hasOne', 'hasMany', 'belongsToMany'].includes(field.type)).map(field => {
|
|
97
|
-
var _field$uiSchema;
|
|
98
|
-
|
|
99
|
-
return _react().default.createElement(_antd().Select.Option, {
|
|
100
|
-
key: field.name,
|
|
101
|
-
value: field.name
|
|
102
|
-
}, compile((_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema.title));
|
|
103
|
-
}));
|
|
104
|
-
});
|
|
22
|
+
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; }
|
|
23
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
24
|
+
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); }
|
|
105
25
|
const COLLECTION_TRIGGER_MODE = {
|
|
106
26
|
CREATED: 1,
|
|
107
27
|
UPDATED: 2,
|
|
@@ -125,34 +45,28 @@ var _default = {
|
|
|
125
45
|
title: `{{t("Collection event", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
126
46
|
type: 'collection',
|
|
127
47
|
fieldset: {
|
|
128
|
-
|
|
48
|
+
collection: _objectSpread(_objectSpread({}, _collection.collection), {}, {
|
|
129
49
|
['x-reactions']: [..._collection.collection['x-reactions'], {
|
|
130
|
-
target: '
|
|
131
|
-
|
|
132
|
-
state: {
|
|
133
|
-
visible: '{{!!$self.value}}'
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}, {
|
|
137
|
-
target: 'config.changed',
|
|
50
|
+
target: 'changed',
|
|
51
|
+
effects: ['onFieldValueChange'],
|
|
138
52
|
fulfill: {
|
|
139
53
|
state: {
|
|
140
|
-
|
|
54
|
+
value: []
|
|
141
55
|
}
|
|
142
56
|
}
|
|
143
57
|
}, {
|
|
144
|
-
target: '
|
|
58
|
+
target: 'condition',
|
|
59
|
+
effects: ['onFieldValueChange'],
|
|
145
60
|
fulfill: {
|
|
146
61
|
state: {
|
|
147
|
-
|
|
62
|
+
value: null
|
|
148
63
|
}
|
|
149
64
|
}
|
|
150
65
|
}]
|
|
151
66
|
}),
|
|
152
|
-
|
|
67
|
+
mode: {
|
|
153
68
|
type: 'number',
|
|
154
69
|
title: `{{t("Trigger on", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
155
|
-
name: 'config.mode',
|
|
156
70
|
'x-decorator': 'FormItem',
|
|
157
71
|
'x-component': 'Select',
|
|
158
72
|
'x-component-props': {
|
|
@@ -161,69 +75,97 @@ var _default = {
|
|
|
161
75
|
},
|
|
162
76
|
required: true,
|
|
163
77
|
'x-reactions': [{
|
|
164
|
-
|
|
78
|
+
dependencies: ['collection'],
|
|
165
79
|
fulfill: {
|
|
166
80
|
state: {
|
|
167
|
-
|
|
81
|
+
visible: '{{!!$deps[0]}}'
|
|
168
82
|
}
|
|
169
83
|
}
|
|
170
84
|
}]
|
|
171
85
|
},
|
|
172
|
-
|
|
86
|
+
changed: {
|
|
173
87
|
type: 'array',
|
|
174
|
-
name: 'changed',
|
|
175
88
|
title: `{{t("Changed fields", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
176
89
|
description: `{{t("Triggered only if one of the selected fields changes. If unselected, it means that it will be triggered when any field changes. When record is added or deleted, any field is considered to have been changed.", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
177
90
|
'x-decorator': 'FormItem',
|
|
178
91
|
'x-component': 'FieldsSelect',
|
|
179
92
|
'x-component-props': {
|
|
180
93
|
mode: 'multiple',
|
|
181
|
-
placeholder: '{{t("Select Field")}}'
|
|
182
|
-
|
|
94
|
+
placeholder: '{{t("Select Field")}}',
|
|
95
|
+
filter(field) {
|
|
96
|
+
return !field.hidden && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : true) && !['linkTo', 'hasOne', 'hasMany', 'belongsToMany'].includes(field.type);
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
'x-reactions': [{
|
|
100
|
+
dependencies: ['collection', 'mode'],
|
|
101
|
+
fulfill: {
|
|
102
|
+
state: {
|
|
103
|
+
visible: `{{!!$deps[0] && ($deps[1] & ${COLLECTION_TRIGGER_MODE.UPDATED})}}`
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}]
|
|
183
107
|
},
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
108
|
+
condition: _objectSpread(_objectSpread({}, _collection.filter), {}, {
|
|
109
|
+
title: `{{t("Only triggers when match conditions", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
110
|
+
'x-reactions': [{
|
|
111
|
+
dependencies: ['collection'],
|
|
112
|
+
fulfill: {
|
|
113
|
+
state: {
|
|
114
|
+
visible: '{{!!$deps[0]}}'
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}]
|
|
118
|
+
}),
|
|
119
|
+
appends: _objectSpread(_objectSpread({}, _collection.appends), {}, {
|
|
120
|
+
'x-reactions': [..._collection.appends['x-reactions'], {
|
|
121
|
+
dependencies: ['mode'],
|
|
122
|
+
fulfill: {
|
|
123
|
+
state: {
|
|
124
|
+
visible: `{{!($deps[0] & ${COLLECTION_TRIGGER_MODE.DELETED})}}`
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}]
|
|
187
128
|
})
|
|
188
129
|
},
|
|
189
130
|
scope: {
|
|
190
131
|
useCollectionDataSource: _client().useCollectionDataSource
|
|
191
132
|
},
|
|
192
133
|
components: {
|
|
193
|
-
FieldsSelect
|
|
134
|
+
FieldsSelect: _FieldsSelect.FieldsSelect
|
|
194
135
|
},
|
|
195
|
-
|
|
196
136
|
getOptions(config, types) {
|
|
137
|
+
var _config$appends;
|
|
197
138
|
const _useWorkflowTranslati = (0, _locale.useWorkflowTranslation)(),
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
139
|
+
t = _useWorkflowTranslati.t;
|
|
140
|
+
const rootFields = [{
|
|
141
|
+
collectionName: config.collection,
|
|
142
|
+
name: 'data',
|
|
143
|
+
type: 'hasOne',
|
|
144
|
+
target: config.collection,
|
|
145
|
+
uiSchema: {
|
|
146
|
+
title: t('Trigger data')
|
|
147
|
+
}
|
|
148
|
+
}];
|
|
149
|
+
const options = (0, _variable.useCollectionFieldOptions)({
|
|
150
|
+
fields: rootFields,
|
|
151
|
+
types,
|
|
152
|
+
depth: ((_config$appends = config.appends) === null || _config$appends === void 0 ? void 0 : _config$appends.length) ? 2 : 1
|
|
203
153
|
});
|
|
204
|
-
const options = [...((fieldOptions === null || fieldOptions === void 0 ? void 0 : fieldOptions.length) ? [{
|
|
205
|
-
label: t('Trigger data'),
|
|
206
|
-
key: 'data',
|
|
207
|
-
value: 'data',
|
|
208
|
-
children: fieldOptions
|
|
209
|
-
}] : [])];
|
|
210
154
|
return options;
|
|
211
155
|
},
|
|
212
|
-
|
|
213
156
|
useInitializers(config) {
|
|
214
157
|
if (!config.collection) {
|
|
215
158
|
return null;
|
|
216
159
|
}
|
|
217
|
-
|
|
218
160
|
return {
|
|
219
161
|
type: 'item',
|
|
162
|
+
key: 'triggerData',
|
|
220
163
|
title: `{{t("Trigger data", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
221
164
|
component: _CollectionBlockInitializer.CollectionBlockInitializer,
|
|
222
165
|
collection: config.collection,
|
|
223
166
|
dataSource: '{{$context.data}}'
|
|
224
167
|
};
|
|
225
168
|
},
|
|
226
|
-
|
|
227
169
|
initializers: {
|
|
228
170
|
CollectionFieldInitializers: _CollectionFieldInitializers.CollectionFieldInitializers
|
|
229
171
|
}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { ISchema } from "@formily/react";
|
|
2
3
|
import { Registry } from "@nocobase/utils/client";
|
|
3
|
-
import React from "react";
|
|
4
4
|
import { SchemaInitializerItemOptions } from '@nocobase/client';
|
|
5
|
+
import { VariableOptions } from "../variable";
|
|
5
6
|
export interface Trigger {
|
|
6
7
|
title: string;
|
|
7
8
|
type: string;
|
|
8
|
-
getOptions?(config: any, types: any[]):
|
|
9
|
-
label: string;
|
|
10
|
-
value: any;
|
|
11
|
-
key: string;
|
|
12
|
-
}[];
|
|
9
|
+
getOptions?(config: any, types: any[]): VariableOptions;
|
|
13
10
|
fieldset: {
|
|
14
11
|
[key: string]: ISchema;
|
|
15
12
|
};
|