@nocobase/plugin-workflow 0.9.0-alpha.1 → 0.9.1-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/README.md +9 -0
- package/README.zh-CN.md +9 -0
- package/lib/client/AddButton.d.ts +1 -1
- package/lib/client/AddButton.js +7 -2
- package/lib/client/Branch.d.ts +1 -1
- package/lib/client/ExecutionCanvas.js +5 -10
- package/lib/client/WorkflowCanvas.js +11 -40
- package/lib/client/WorkflowProvider.js +10 -1
- package/lib/client/components/CollectionBlockInitializer.d.ts +7 -0
- package/lib/client/components/CollectionBlockInitializer.js +81 -0
- package/lib/client/components/CollectionFieldInitializers.d.ts +2 -0
- package/lib/client/components/CollectionFieldInitializers.js +89 -0
- package/lib/client/components/CollectionFieldset.js +21 -25
- package/lib/client/components/FilterDynamicComponent.d.ts +6 -0
- package/lib/client/components/FilterDynamicComponent.js +43 -0
- package/lib/client/components/NullRender.d.ts +1 -0
- package/lib/client/components/NullRender.js +10 -0
- package/lib/client/components/RadioWithTooltip.d.ts +7 -0
- package/lib/client/components/RadioWithTooltip.js +94 -0
- package/lib/client/constants.d.ts +10 -8
- package/lib/client/constants.js +52 -14
- package/lib/client/index.d.ts +0 -1
- package/lib/client/index.js +1 -10
- package/lib/client/locale/en-US.d.ts +38 -13
- package/lib/client/locale/en-US.js +39 -14
- package/lib/client/locale/index.js +12 -29
- package/lib/client/locale/zh-CN.d.ts +47 -20
- package/lib/client/locale/zh-CN.js +48 -21
- package/lib/client/nodes/calculation.d.ts +40 -6
- package/lib/client/nodes/calculation.js +171 -19
- package/lib/client/nodes/condition.d.ts +67 -0
- package/lib/client/nodes/condition.js +287 -27
- package/lib/client/nodes/create.d.ts +8 -6
- package/lib/client/nodes/create.js +27 -33
- package/lib/client/nodes/delay.d.ts +2 -0
- package/lib/client/nodes/delay.js +8 -4
- package/lib/client/nodes/destroy.d.ts +2 -2
- package/lib/client/nodes/destroy.js +2 -2
- package/lib/client/nodes/index.d.ts +10 -2
- package/lib/client/nodes/index.js +73 -27
- package/lib/client/nodes/manual/AssigneesSelect.d.ts +6 -0
- package/lib/client/nodes/manual/AssigneesSelect.js +64 -0
- package/lib/client/nodes/manual/ModeConfig.d.ts +5 -0
- package/lib/client/nodes/manual/ModeConfig.js +160 -0
- package/lib/client/nodes/manual/SchemaConfig.d.ts +6 -0
- package/lib/client/nodes/manual/SchemaConfig.js +715 -0
- package/lib/client/nodes/manual/WorkflowTodo.d.ts +8 -0
- package/lib/client/nodes/manual/WorkflowTodo.js +691 -0
- package/lib/client/nodes/manual/WorkflowTodoBlockInitializer.d.ts +5 -0
- package/lib/client/nodes/manual/WorkflowTodoBlockInitializer.js +75 -0
- package/lib/client/nodes/manual/index.d.ts +64 -0
- package/lib/client/nodes/manual/index.js +146 -0
- package/lib/client/nodes/parallel.d.ts +11 -5
- package/lib/client/nodes/parallel.js +22 -34
- package/lib/client/nodes/query.d.ts +9 -14
- package/lib/client/nodes/query.js +38 -44
- package/lib/client/nodes/request.d.ts +75 -33
- package/lib/client/nodes/request.js +124 -63
- package/lib/client/nodes/update.d.ts +2 -2
- package/lib/client/nodes/update.js +2 -2
- package/lib/client/schemas/collection.js +1 -1
- package/lib/client/schemas/executions.js +1 -1
- package/lib/client/schemas/workflows.js +1 -1
- package/lib/client/style.js +0 -4
- package/lib/client/triggers/collection.d.ts +7 -3
- package/lib/client/triggers/collection.js +39 -48
- package/lib/client/triggers/index.d.ts +5 -2
- package/lib/client/triggers/index.js +34 -12
- package/lib/client/triggers/schedule/index.d.ts +7 -5
- package/lib/client/triggers/schedule/index.js +38 -79
- package/lib/client/utils.d.ts +1 -0
- package/lib/client/utils.js +38 -0
- package/lib/client/variable.d.ts +21 -0
- package/lib/client/variable.js +147 -0
- package/lib/server/Plugin.d.ts +3 -3
- package/lib/server/Plugin.js +12 -21
- package/lib/server/Processor.d.ts +9 -2
- package/lib/server/Processor.js +39 -43
- package/lib/server/actions/index.js +2 -4
- package/lib/server/actions/workflows.d.ts +1 -0
- package/lib/server/actions/workflows.js +80 -23
- package/lib/server/collections/executions.js +5 -7
- package/lib/server/collections/flow_nodes.js +6 -18
- package/lib/server/collections/jobs.js +3 -1
- package/lib/server/collections/workflows.js +8 -4
- package/lib/server/constants.d.ts +9 -3
- package/lib/server/constants.js +11 -5
- package/lib/server/functions/index.d.ts +4 -0
- package/lib/server/functions/index.js +38 -0
- package/lib/server/index.d.ts +0 -1
- package/lib/server/index.js +0 -14
- package/lib/server/instructions/calculation.d.ts +2 -7
- package/lib/server/instructions/calculation.js +32 -37
- package/lib/server/instructions/condition.d.ts +4 -4
- package/lib/server/instructions/condition.js +126 -54
- package/lib/server/instructions/index.js +1 -1
- package/lib/server/instructions/manual/actions.js +101 -0
- package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/jobs.d.ts +2 -0
- package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/jobs.js +2 -1
- package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/users_jobs.js +10 -10
- package/lib/server/instructions/manual/index.d.ts +25 -0
- package/lib/server/instructions/manual/index.js +200 -0
- package/lib/server/instructions/parallel.js +11 -7
- package/lib/server/instructions/request.d.ts +8 -4
- package/lib/server/instructions/request.js +60 -94
- package/lib/server/migrations/20230221032941-change-request-body-type.d.ts +5 -0
- package/lib/server/migrations/20230221032941-change-request-body-type.js +113 -0
- package/lib/server/migrations/20230221071831-calculation-expression.d.ts +4 -0
- package/lib/server/migrations/20230221071831-calculation-expression.js +143 -0
- package/lib/server/migrations/20230221121203-condition-calculation.d.ts +4 -0
- package/lib/server/migrations/20230221121203-condition-calculation.js +126 -0
- package/lib/server/migrations/20230221162902-jsonb-to-json.d.ts +4 -0
- package/lib/server/migrations/20230221162902-jsonb-to-json.js +81 -0
- package/lib/server/triggers/schedule.js +11 -3
- package/package.json +11 -10
- package/lib/client/calculators.d.ts +0 -89
- package/lib/client/calculators.js +0 -668
- package/lib/client/components/CollectionFieldSelect.d.ts +0 -2
- package/lib/client/components/CollectionFieldSelect.js +0 -106
- package/lib/client/components/EjsTextArea.d.ts +0 -2
- package/lib/client/components/EjsTextArea.js +0 -232
- package/lib/server/actions/jobs.d.ts +0 -2
- package/lib/server/actions/jobs.js +0 -39
- package/lib/server/calculators/index.d.ts +0 -40
- package/lib/server/calculators/index.js +0 -187
- package/lib/server/extensions/assignees/actions.js +0 -75
- package/lib/server/extensions/assignees/index.d.ts +0 -2
- package/lib/server/extensions/assignees/index.js +0 -273
- package/lib/server/extensions/index.d.ts +0 -3
- package/lib/server/extensions/index.js +0 -13
- package/lib/server/instructions/prompt.d.ts +0 -19
- package/lib/server/instructions/prompt.js +0 -131
- /package/lib/server/{extensions/assignees → instructions/manual}/actions.d.ts +0 -0
- /package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/users.d.ts +0 -0
- /package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/users.js +0 -0
- /package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/users_jobs.d.ts +0 -0
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.Calculation = Calculation;
|
|
7
|
+
exports.default = exports.calculators = void 0;
|
|
7
8
|
|
|
8
9
|
function _react() {
|
|
9
10
|
const data = _interopRequireDefault(require("react"));
|
|
@@ -55,6 +56,36 @@ function _reactI18next() {
|
|
|
55
56
|
return data;
|
|
56
57
|
}
|
|
57
58
|
|
|
59
|
+
function _client() {
|
|
60
|
+
const data = require("@nocobase/utils/client");
|
|
61
|
+
|
|
62
|
+
_client = function _client() {
|
|
63
|
+
return data;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
return data;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function _client2() {
|
|
70
|
+
const data = require("@nocobase/client");
|
|
71
|
+
|
|
72
|
+
_client2 = function _client2() {
|
|
73
|
+
return data;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
return data;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function _client3() {
|
|
80
|
+
const data = _interopRequireWildcard(require("@nocobase/evaluators/client"));
|
|
81
|
+
|
|
82
|
+
_client3 = function _client3() {
|
|
83
|
+
return data;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
return data;
|
|
87
|
+
}
|
|
88
|
+
|
|
58
89
|
var _ = require(".");
|
|
59
90
|
|
|
60
91
|
var _Branch = require("../Branch");
|
|
@@ -63,10 +94,16 @@ var _FlowContext = require("../FlowContext");
|
|
|
63
94
|
|
|
64
95
|
var _style = require("../style");
|
|
65
96
|
|
|
66
|
-
var _calculators = require("../calculators");
|
|
67
|
-
|
|
68
97
|
var _locale = require("../locale");
|
|
69
98
|
|
|
99
|
+
var _variable = require("../variable");
|
|
100
|
+
|
|
101
|
+
var _RadioWithTooltip = require("../components/RadioWithTooltip");
|
|
102
|
+
|
|
103
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
104
|
+
|
|
105
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
106
|
+
|
|
70
107
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
71
108
|
|
|
72
109
|
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; }
|
|
@@ -75,9 +112,165 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
75
112
|
|
|
76
113
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
77
114
|
|
|
115
|
+
const calculators = new (_client().Registry)();
|
|
116
|
+
exports.calculators = calculators;
|
|
117
|
+
calculators.register('equal', {
|
|
118
|
+
name: '=',
|
|
119
|
+
type: 'boolean',
|
|
120
|
+
group: 'boolean'
|
|
121
|
+
});
|
|
122
|
+
calculators.register('notEqual', {
|
|
123
|
+
name: '≠',
|
|
124
|
+
type: 'boolean',
|
|
125
|
+
group: 'boolean'
|
|
126
|
+
});
|
|
127
|
+
calculators.register('gt', {
|
|
128
|
+
name: '>',
|
|
129
|
+
type: 'boolean',
|
|
130
|
+
group: 'boolean'
|
|
131
|
+
});
|
|
132
|
+
calculators.register('gte', {
|
|
133
|
+
name: '≥',
|
|
134
|
+
type: 'boolean',
|
|
135
|
+
group: 'boolean'
|
|
136
|
+
});
|
|
137
|
+
calculators.register('lt', {
|
|
138
|
+
name: '<',
|
|
139
|
+
type: 'boolean',
|
|
140
|
+
group: 'boolean'
|
|
141
|
+
});
|
|
142
|
+
calculators.register('lte', {
|
|
143
|
+
name: '≤',
|
|
144
|
+
type: 'boolean',
|
|
145
|
+
group: 'boolean'
|
|
146
|
+
});
|
|
147
|
+
calculators.register('add', {
|
|
148
|
+
name: '+',
|
|
149
|
+
type: 'number',
|
|
150
|
+
group: 'number'
|
|
151
|
+
});
|
|
152
|
+
calculators.register('minus', {
|
|
153
|
+
name: '-',
|
|
154
|
+
type: 'number',
|
|
155
|
+
group: 'number'
|
|
156
|
+
});
|
|
157
|
+
calculators.register('multiple', {
|
|
158
|
+
name: '*',
|
|
159
|
+
type: 'number',
|
|
160
|
+
group: 'number'
|
|
161
|
+
});
|
|
162
|
+
calculators.register('divide', {
|
|
163
|
+
name: '/',
|
|
164
|
+
type: 'number',
|
|
165
|
+
group: 'number'
|
|
166
|
+
});
|
|
167
|
+
calculators.register('mod', {
|
|
168
|
+
name: '%',
|
|
169
|
+
type: 'number',
|
|
170
|
+
group: 'number'
|
|
171
|
+
});
|
|
172
|
+
calculators.register('includes', {
|
|
173
|
+
name: '{{t("contains")}}',
|
|
174
|
+
type: 'boolean',
|
|
175
|
+
group: 'string'
|
|
176
|
+
});
|
|
177
|
+
calculators.register('notIncludes', {
|
|
178
|
+
name: '{{t("does not contain")}}',
|
|
179
|
+
type: 'boolean',
|
|
180
|
+
group: 'string'
|
|
181
|
+
});
|
|
182
|
+
calculators.register('startsWith', {
|
|
183
|
+
name: '{{t("starts with")}}',
|
|
184
|
+
type: 'boolean',
|
|
185
|
+
group: 'string'
|
|
186
|
+
});
|
|
187
|
+
calculators.register('notStartsWith', {
|
|
188
|
+
name: '{{t("not starts with")}}',
|
|
189
|
+
type: 'boolean',
|
|
190
|
+
group: 'string'
|
|
191
|
+
});
|
|
192
|
+
calculators.register('endsWith', {
|
|
193
|
+
name: '{{t("ends with")}}',
|
|
194
|
+
type: 'boolean',
|
|
195
|
+
group: 'string'
|
|
196
|
+
});
|
|
197
|
+
calculators.register('notEndsWith', {
|
|
198
|
+
name: '{{t("not ends with")}}',
|
|
199
|
+
type: 'boolean',
|
|
200
|
+
group: 'string'
|
|
201
|
+
});
|
|
202
|
+
calculators.register('concat', {
|
|
203
|
+
name: `{{t("concat", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
204
|
+
type: 'string',
|
|
205
|
+
group: 'string'
|
|
206
|
+
});
|
|
207
|
+
const calculatorGroups = [{
|
|
208
|
+
value: 'boolean',
|
|
209
|
+
title: '{{t("Comparision")}}'
|
|
210
|
+
}, {
|
|
211
|
+
value: 'number',
|
|
212
|
+
title: `{{t("Arithmetic calculation", { ns: "${_locale.NAMESPACE}" })}}`
|
|
213
|
+
}, {
|
|
214
|
+
value: 'string',
|
|
215
|
+
title: `{{t("String operation", { ns: "${_locale.NAMESPACE}" })}}`
|
|
216
|
+
}, {
|
|
217
|
+
value: 'date',
|
|
218
|
+
title: `{{t("Date", { ns: "${_locale.NAMESPACE}" })}}`
|
|
219
|
+
}];
|
|
220
|
+
|
|
221
|
+
function getGroupCalculators(group) {
|
|
222
|
+
return Array.from(calculators.getEntities()).filter(([key, value]) => value.group === group);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
function Calculation({
|
|
226
|
+
calculator,
|
|
227
|
+
operands = [],
|
|
228
|
+
onChange: _onChange
|
|
229
|
+
}) {
|
|
230
|
+
const compile = (0, _client2().useCompile)();
|
|
231
|
+
const options = (0, _variable.useWorkflowVariableOptions)();
|
|
232
|
+
return _react().default.createElement("fieldset", {
|
|
233
|
+
className: (0, _css().css)`
|
|
234
|
+
display: flex;
|
|
235
|
+
gap: .5em;
|
|
236
|
+
align-items: center;
|
|
237
|
+
flex-wrap: wrap;
|
|
238
|
+
`
|
|
239
|
+
}, _react().default.createElement(_client2().Variable.Input, {
|
|
240
|
+
value: operands[0],
|
|
241
|
+
onChange: v => _onChange({
|
|
242
|
+
calculator,
|
|
243
|
+
operands: [v, operands[1]]
|
|
244
|
+
}),
|
|
245
|
+
scope: options
|
|
246
|
+
}), _react().default.createElement(_antd().Select, {
|
|
247
|
+
value: calculator,
|
|
248
|
+
onChange: v => _onChange({
|
|
249
|
+
operands,
|
|
250
|
+
calculator: v
|
|
251
|
+
}),
|
|
252
|
+
placeholder: (0, _locale.lang)('Calculator')
|
|
253
|
+
}, calculatorGroups.filter(group => Boolean(getGroupCalculators(group.value).length)).map(group => _react().default.createElement(_antd().Select.OptGroup, {
|
|
254
|
+
key: group.value,
|
|
255
|
+
label: compile(group.title)
|
|
256
|
+
}, getGroupCalculators(group.value).map(([value, {
|
|
257
|
+
name
|
|
258
|
+
}]) => _react().default.createElement(_antd().Select.Option, {
|
|
259
|
+
key: value,
|
|
260
|
+
value: value
|
|
261
|
+
}, compile(name)))))), _react().default.createElement(_client2().Variable.Input, {
|
|
262
|
+
value: operands[1],
|
|
263
|
+
onChange: v => _onChange({
|
|
264
|
+
calculator,
|
|
265
|
+
operands: [operands[0], v]
|
|
266
|
+
}),
|
|
267
|
+
scope: options
|
|
268
|
+
}));
|
|
269
|
+
}
|
|
270
|
+
|
|
78
271
|
function CalculationItem({
|
|
79
272
|
value,
|
|
80
|
-
onChange:
|
|
273
|
+
onChange: _onChange2,
|
|
81
274
|
onRemove
|
|
82
275
|
}) {
|
|
83
276
|
if (!value) {
|
|
@@ -86,7 +279,7 @@ function CalculationItem({
|
|
|
86
279
|
|
|
87
280
|
const calculator = value.calculator,
|
|
88
281
|
_value$operands = value.operands,
|
|
89
|
-
operands = _value$operands === void 0 ? [
|
|
282
|
+
operands = _value$operands === void 0 ? [] : _value$operands;
|
|
90
283
|
return _react().default.createElement("div", {
|
|
91
284
|
className: (0, _css().css)`
|
|
92
285
|
display: flex;
|
|
@@ -95,13 +288,13 @@ function CalculationItem({
|
|
|
95
288
|
`
|
|
96
289
|
}, value.group ? _react().default.createElement(CalculationGroup, {
|
|
97
290
|
value: value.group,
|
|
98
|
-
onChange: group =>
|
|
291
|
+
onChange: group => _onChange2(_objectSpread(_objectSpread({}, value), {}, {
|
|
99
292
|
group
|
|
100
293
|
}))
|
|
101
|
-
}) : _react().default.createElement(
|
|
294
|
+
}) : _react().default.createElement(Calculation, {
|
|
102
295
|
operands: operands,
|
|
103
296
|
calculator: calculator,
|
|
104
|
-
onChange:
|
|
297
|
+
onChange: _onChange2
|
|
105
298
|
}), _react().default.createElement(_antd().Button, {
|
|
106
299
|
onClick: onRemove,
|
|
107
300
|
type: "link",
|
|
@@ -111,7 +304,7 @@ function CalculationItem({
|
|
|
111
304
|
|
|
112
305
|
function CalculationGroup({
|
|
113
306
|
value,
|
|
114
|
-
onChange:
|
|
307
|
+
onChange: _onChange3
|
|
115
308
|
}) {
|
|
116
309
|
const _useTranslation = (0, _reactI18next().useTranslation)(),
|
|
117
310
|
t = _useTranslation.t;
|
|
@@ -122,7 +315,7 @@ function CalculationGroup({
|
|
|
122
315
|
calculations = _value$calculations === void 0 ? [] : _value$calculations;
|
|
123
316
|
|
|
124
317
|
function onAddSingle() {
|
|
125
|
-
|
|
318
|
+
_onChange3(_objectSpread(_objectSpread({}, value), {}, {
|
|
126
319
|
calculations: [...calculations, {
|
|
127
320
|
not: false,
|
|
128
321
|
calculator: 'equal'
|
|
@@ -131,7 +324,7 @@ function CalculationGroup({
|
|
|
131
324
|
}
|
|
132
325
|
|
|
133
326
|
function onAddGroup() {
|
|
134
|
-
|
|
327
|
+
_onChange3(_objectSpread(_objectSpread({}, value), {}, {
|
|
135
328
|
calculations: [...calculations, {
|
|
136
329
|
not: false,
|
|
137
330
|
group: {
|
|
@@ -145,7 +338,7 @@ function CalculationGroup({
|
|
|
145
338
|
function _onRemove(i) {
|
|
146
339
|
calculations.splice(i, 1);
|
|
147
340
|
|
|
148
|
-
|
|
341
|
+
_onChange3(_objectSpread(_objectSpread({}, value), {}, {
|
|
149
342
|
calculations: [...calculations]
|
|
150
343
|
}));
|
|
151
344
|
}
|
|
@@ -153,7 +346,7 @@ function CalculationGroup({
|
|
|
153
346
|
function onItemChange(i, v) {
|
|
154
347
|
calculations.splice(i, 1, v);
|
|
155
348
|
|
|
156
|
-
|
|
349
|
+
_onChange3(_objectSpread(_objectSpread({}, value), {}, {
|
|
157
350
|
calculations: [...calculations]
|
|
158
351
|
}));
|
|
159
352
|
}
|
|
@@ -162,12 +355,10 @@ function CalculationGroup({
|
|
|
162
355
|
className: (0, _css().cx)('node-type-condition-group', (0, _css().css)`
|
|
163
356
|
position: relative;
|
|
164
357
|
width: 100%;
|
|
165
|
-
|
|
166
358
|
.node-type-condition-group{
|
|
167
359
|
padding: .5em 1em;
|
|
168
360
|
border: 1px dashed #ddd;
|
|
169
361
|
}
|
|
170
|
-
|
|
171
362
|
+ button{
|
|
172
363
|
position: absolute;
|
|
173
364
|
right: 0;
|
|
@@ -178,7 +369,6 @@ function CalculationGroup({
|
|
|
178
369
|
display: flex;
|
|
179
370
|
align-items: center;
|
|
180
371
|
gap: .5em;
|
|
181
|
-
|
|
182
372
|
.ant-select{
|
|
183
373
|
width: auto;
|
|
184
374
|
min-width: 6em;
|
|
@@ -186,7 +376,7 @@ function CalculationGroup({
|
|
|
186
376
|
`
|
|
187
377
|
}, _react().default.createElement(_reactI18next().Trans, null, 'Meet ', _react().default.createElement(_antd().Select, {
|
|
188
378
|
value: type,
|
|
189
|
-
onChange: t =>
|
|
379
|
+
onChange: t => _onChange3(_objectSpread(_objectSpread({}, value), {}, {
|
|
190
380
|
type: t
|
|
191
381
|
}))
|
|
192
382
|
}, _react().default.createElement(_antd().Select.Option, {
|
|
@@ -204,7 +394,6 @@ function CalculationGroup({
|
|
|
204
394
|
className: (0, _css().css)`
|
|
205
395
|
button{
|
|
206
396
|
padding: 0;
|
|
207
|
-
|
|
208
397
|
&:not(:last-child){
|
|
209
398
|
margin-right: 1em;
|
|
210
399
|
}
|
|
@@ -221,7 +410,7 @@ function CalculationGroup({
|
|
|
221
410
|
|
|
222
411
|
function CalculationConfig({
|
|
223
412
|
value,
|
|
224
|
-
onChange:
|
|
413
|
+
onChange: _onChange4
|
|
225
414
|
}) {
|
|
226
415
|
const rule = value && Object.keys(value).length ? value : {
|
|
227
416
|
group: {
|
|
@@ -231,7 +420,7 @@ function CalculationConfig({
|
|
|
231
420
|
};
|
|
232
421
|
return _react().default.createElement(CalculationGroup, {
|
|
233
422
|
value: rule.group,
|
|
234
|
-
onChange: group =>
|
|
423
|
+
onChange: group => _onChange4(_objectSpread(_objectSpread({}, rule), {}, {
|
|
235
424
|
group
|
|
236
425
|
}))
|
|
237
426
|
});
|
|
@@ -253,29 +442,95 @@ var _default = {
|
|
|
253
442
|
},
|
|
254
443
|
enum: [{
|
|
255
444
|
value: true,
|
|
256
|
-
label: (
|
|
445
|
+
label: `{{t('Continue when "Yes"', { ns: "${_locale.NAMESPACE}" })}}`
|
|
257
446
|
}, {
|
|
258
447
|
value: false,
|
|
259
|
-
label: (
|
|
448
|
+
label: `{{t('Branch into "Yes" and "No"', { ns: "${_locale.NAMESPACE}" })}}`
|
|
260
449
|
}]
|
|
261
450
|
},
|
|
451
|
+
'config.engine': {
|
|
452
|
+
type: 'string',
|
|
453
|
+
title: `{{t("Calculation engine", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
454
|
+
name: 'config.engine',
|
|
455
|
+
'x-decorator': 'FormItem',
|
|
456
|
+
'x-component': 'RadioWithTooltip',
|
|
457
|
+
'x-component-props': {
|
|
458
|
+
options: [['basic', {
|
|
459
|
+
label: `{{t("Basic", { ns: "${_locale.NAMESPACE}" })}}`
|
|
460
|
+
}], ...Array.from(_client3().default.getEntities())].reduce((result, [value, options]) => result.concat(_objectSpread({
|
|
461
|
+
value
|
|
462
|
+
}, options)), [])
|
|
463
|
+
},
|
|
464
|
+
required: true,
|
|
465
|
+
default: 'basic'
|
|
466
|
+
},
|
|
262
467
|
'config.calculation': {
|
|
263
468
|
type: 'string',
|
|
264
469
|
name: 'config.calculation',
|
|
265
|
-
title: `{{t("
|
|
470
|
+
title: `{{t("Condition", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
471
|
+
'x-decorator': 'FormItem',
|
|
472
|
+
'x-component': 'CalculationConfig',
|
|
473
|
+
'x-reactions': {
|
|
474
|
+
dependencies: ['config.engine'],
|
|
475
|
+
fulfill: {
|
|
476
|
+
state: {
|
|
477
|
+
visible: '{{$deps[0] === "basic"}}'
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
},
|
|
481
|
+
required: true
|
|
482
|
+
},
|
|
483
|
+
'config.expression': {
|
|
484
|
+
type: 'string',
|
|
485
|
+
title: `{{t("Condition expression", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
486
|
+
name: 'config.expression',
|
|
266
487
|
'x-decorator': 'FormItem',
|
|
267
|
-
'x-component': '
|
|
488
|
+
'x-component': 'Variable.TextArea',
|
|
489
|
+
'x-component-props': {
|
|
490
|
+
scope: '{{useWorkflowVariableOptions}}'
|
|
491
|
+
},
|
|
492
|
+
|
|
493
|
+
['x-validator'](value, rules, {
|
|
494
|
+
form
|
|
495
|
+
}) {
|
|
496
|
+
const values = form.values;
|
|
497
|
+
|
|
498
|
+
const _evaluators$get = _client3().default.get(values.config.engine),
|
|
499
|
+
evaluate = _evaluators$get.evaluate;
|
|
500
|
+
|
|
501
|
+
const exp = value.trim().replace(/{{([^{}]+)}}/g, '1');
|
|
502
|
+
|
|
503
|
+
try {
|
|
504
|
+
evaluate(exp);
|
|
505
|
+
return '';
|
|
506
|
+
} catch (e) {
|
|
507
|
+
return (0, _locale.lang)('Expression syntax error');
|
|
508
|
+
}
|
|
509
|
+
},
|
|
510
|
+
|
|
511
|
+
'x-reactions': {
|
|
512
|
+
dependencies: ['config.engine'],
|
|
513
|
+
fulfill: {
|
|
514
|
+
state: {
|
|
515
|
+
visible: '{{$deps[0] !== "basic"}}'
|
|
516
|
+
},
|
|
517
|
+
schema: {
|
|
518
|
+
description: '{{renderReference($deps[0])}}'
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
},
|
|
522
|
+
required: true
|
|
268
523
|
}
|
|
269
524
|
},
|
|
270
525
|
view: {},
|
|
271
526
|
options: [{
|
|
272
|
-
label: (
|
|
527
|
+
label: `{{t('Continue when "Yes"', { ns: "${_locale.NAMESPACE}" })}}`,
|
|
273
528
|
key: 'rejectOnFalse',
|
|
274
529
|
value: {
|
|
275
530
|
rejectOnFalse: true
|
|
276
531
|
}
|
|
277
532
|
}, {
|
|
278
|
-
label: (
|
|
533
|
+
label: `{{t('Branch into "Yes" and "No"', { ns: "${_locale.NAMESPACE}" })}}`,
|
|
279
534
|
key: 'branch',
|
|
280
535
|
value: {
|
|
281
536
|
rejectOnFalse: false
|
|
@@ -335,8 +590,13 @@ var _default = {
|
|
|
335
590
|
}, t('Yes')))));
|
|
336
591
|
},
|
|
337
592
|
|
|
593
|
+
scope: {
|
|
594
|
+
renderReference: _client3().renderReference,
|
|
595
|
+
useWorkflowVariableOptions: _variable.useWorkflowVariableOptions
|
|
596
|
+
},
|
|
338
597
|
components: {
|
|
339
|
-
CalculationConfig
|
|
598
|
+
CalculationConfig,
|
|
599
|
+
RadioWithTooltip: _RadioWithTooltip.RadioWithTooltip
|
|
340
600
|
}
|
|
341
601
|
};
|
|
342
602
|
exports.default = _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { SchemaInitializerItemOptions, useCollectionDataSource } from '@nocobase/client';
|
|
2
|
+
import { CollectionFieldInitializers } from '../components/CollectionFieldInitializers';
|
|
3
3
|
declare const _default: {
|
|
4
4
|
title: string;
|
|
5
5
|
type: string;
|
|
@@ -35,10 +35,12 @@ declare const _default: {
|
|
|
35
35
|
useCollectionDataSource: typeof useCollectionDataSource;
|
|
36
36
|
};
|
|
37
37
|
components: {
|
|
38
|
-
CollectionFieldset:
|
|
38
|
+
CollectionFieldset: import("react").MemoExoticComponent<import("react").FunctionComponent<Pick<any, string | number | symbol>>>;
|
|
39
|
+
};
|
|
40
|
+
getOptions(config: any, types: any): any;
|
|
41
|
+
useInitializers(node: any): SchemaInitializerItemOptions | null;
|
|
42
|
+
initializers: {
|
|
43
|
+
CollectionFieldInitializers: typeof CollectionFieldInitializers;
|
|
39
44
|
};
|
|
40
|
-
getter({ onChange }: {
|
|
41
|
-
onChange: any;
|
|
42
|
-
}): JSX.Element;
|
|
43
45
|
};
|
|
44
46
|
export default _default;
|
|
@@ -5,16 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
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
8
|
function _client() {
|
|
19
9
|
const data = require("@nocobase/client");
|
|
20
10
|
|
|
@@ -27,15 +17,15 @@ function _client() {
|
|
|
27
17
|
|
|
28
18
|
var _collection = require("../schemas/collection");
|
|
29
19
|
|
|
30
|
-
var _FlowContext = require("../FlowContext");
|
|
31
|
-
|
|
32
|
-
var _CollectionFieldSelect = _interopRequireDefault(require("../components/CollectionFieldSelect"));
|
|
33
|
-
|
|
34
20
|
var _CollectionFieldset = _interopRequireDefault(require("../components/CollectionFieldset"));
|
|
35
21
|
|
|
36
22
|
var _locale = require("../locale");
|
|
37
23
|
|
|
38
|
-
var
|
|
24
|
+
var _CollectionBlockInitializer = require("../components/CollectionBlockInitializer");
|
|
25
|
+
|
|
26
|
+
var _CollectionFieldInitializers = require("../components/CollectionFieldInitializers");
|
|
27
|
+
|
|
28
|
+
var _variable = require("../variable");
|
|
39
29
|
|
|
40
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
41
31
|
|
|
@@ -73,27 +63,31 @@ var _default = {
|
|
|
73
63
|
CollectionFieldset: _CollectionFieldset.default
|
|
74
64
|
},
|
|
75
65
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
66
|
+
getOptions(config, types) {
|
|
67
|
+
return (0, _variable.useCollectionFieldOptions)({
|
|
68
|
+
collection: config.collection,
|
|
69
|
+
types
|
|
70
|
+
});
|
|
71
|
+
},
|
|
81
72
|
|
|
82
|
-
|
|
83
|
-
|
|
73
|
+
useInitializers(node) {
|
|
74
|
+
var _node$title;
|
|
84
75
|
|
|
85
|
-
|
|
86
|
-
|
|
76
|
+
if (!node.config.collection) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
87
79
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
80
|
+
return {
|
|
81
|
+
type: 'item',
|
|
82
|
+
title: (_node$title = node.title) !== null && _node$title !== void 0 ? _node$title : `#${node.id}`,
|
|
83
|
+
component: _CollectionBlockInitializer.CollectionBlockInitializer,
|
|
84
|
+
collection: node.config.collection,
|
|
85
|
+
dataSource: `{{$jobsMapByNodeId.${node.id}}}`
|
|
86
|
+
};
|
|
87
|
+
},
|
|
97
88
|
|
|
89
|
+
initializers: {
|
|
90
|
+
CollectionFieldInitializers: _CollectionFieldInitializers.CollectionFieldInitializers
|
|
91
|
+
}
|
|
98
92
|
};
|
|
99
93
|
exports.default = _default;
|
|
@@ -11,6 +11,7 @@ declare const _default: {
|
|
|
11
11
|
'x-decorator': string;
|
|
12
12
|
'x-component': string;
|
|
13
13
|
default: number;
|
|
14
|
+
required: boolean;
|
|
14
15
|
};
|
|
15
16
|
'config.endStatus': {
|
|
16
17
|
type: string;
|
|
@@ -25,6 +26,7 @@ declare const _default: {
|
|
|
25
26
|
label: string;
|
|
26
27
|
value: number;
|
|
27
28
|
}[];
|
|
29
|
+
required: boolean;
|
|
28
30
|
};
|
|
29
31
|
};
|
|
30
32
|
view: {};
|
|
@@ -7,6 +7,8 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _Duration = _interopRequireDefault(require("../components/Duration"));
|
|
9
9
|
|
|
10
|
+
var _constants = require("../constants");
|
|
11
|
+
|
|
10
12
|
var _locale = require("../locale");
|
|
11
13
|
|
|
12
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -22,7 +24,8 @@ var _default = {
|
|
|
22
24
|
title: `{{t("Duration", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
23
25
|
'x-decorator': 'FormItem',
|
|
24
26
|
'x-component': 'Duration',
|
|
25
|
-
default: 60000
|
|
27
|
+
default: 60000,
|
|
28
|
+
required: true
|
|
26
29
|
},
|
|
27
30
|
'config.endStatus': {
|
|
28
31
|
type: 'number',
|
|
@@ -35,11 +38,12 @@ var _default = {
|
|
|
35
38
|
},
|
|
36
39
|
enum: [{
|
|
37
40
|
label: `{{t("Succeed and continue", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
38
|
-
value:
|
|
41
|
+
value: _constants.JOB_STATUS.RESOLVED
|
|
39
42
|
}, {
|
|
40
43
|
label: `{{t("Fail and exit", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
41
|
-
value:
|
|
42
|
-
}]
|
|
44
|
+
value: _constants.JOB_STATUS.FAILED
|
|
45
|
+
}],
|
|
46
|
+
required: true
|
|
43
47
|
}
|
|
44
48
|
},
|
|
45
49
|
view: {},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCollectionDataSource } from '@nocobase/client';
|
|
2
|
-
import {
|
|
2
|
+
import { FilterDynamicComponent } from '../components/FilterDynamicComponent';
|
|
3
3
|
declare const _default: {
|
|
4
4
|
title: string;
|
|
5
5
|
type: string;
|
|
@@ -49,7 +49,7 @@ declare const _default: {
|
|
|
49
49
|
useCollectionDataSource: typeof useCollectionDataSource;
|
|
50
50
|
};
|
|
51
51
|
components: {
|
|
52
|
-
|
|
52
|
+
FilterDynamicComponent: typeof FilterDynamicComponent;
|
|
53
53
|
};
|
|
54
54
|
};
|
|
55
55
|
export default _default;
|
|
@@ -15,7 +15,7 @@ function _client() {
|
|
|
15
15
|
return data;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _FilterDynamicComponent = require("../components/FilterDynamicComponent");
|
|
19
19
|
|
|
20
20
|
var _collection = require("../schemas/collection");
|
|
21
21
|
|
|
@@ -40,7 +40,7 @@ var _default = {
|
|
|
40
40
|
useCollectionDataSource: _client().useCollectionDataSource
|
|
41
41
|
},
|
|
42
42
|
components: {
|
|
43
|
-
|
|
43
|
+
FilterDynamicComponent: _FilterDynamicComponent.FilterDynamicComponent
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
46
|
exports.default = _default;
|