@nocobase/plugin-workflow 0.9.0-alpha.2 → 0.9.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/README.md +9 -0
- package/README.zh-CN.md +9 -0
- package/lib/client/AddButton.d.ts +1 -1
- package/lib/client/AddButton.js +43 -27
- package/lib/client/Branch.d.ts +1 -1
- package/lib/client/ExecutionCanvas.js +5 -10
- package/lib/client/WorkflowCanvas.js +12 -42
- 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 +25 -33
- 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 +18 -18
- package/lib/client/locale/en-US.js +19 -19
- 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 +39 -7
- package/lib/client/nodes/calculation.js +165 -19
- package/lib/client/nodes/condition.d.ts +67 -4
- package/lib/client/nodes/condition.js +283 -31
- package/lib/client/nodes/create.d.ts +10 -10
- package/lib/client/nodes/create.js +28 -42
- package/lib/client/nodes/delay.d.ts +4 -4
- package/lib/client/nodes/delay.js +10 -8
- package/lib/client/nodes/destroy.d.ts +4 -7
- package/lib/client/nodes/destroy.js +4 -5
- package/lib/client/nodes/index.d.ts +10 -2
- package/lib/client/nodes/index.js +217 -110
- package/lib/client/nodes/manual/AssigneesSelect.d.ts +6 -0
- package/lib/client/nodes/manual/AssigneesSelect.js +65 -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 +62 -0
- package/lib/client/nodes/manual/index.js +137 -0
- package/lib/client/nodes/parallel.d.ts +12 -7
- package/lib/client/nodes/parallel.js +32 -39
- package/lib/client/nodes/query.d.ts +11 -19
- package/lib/client/nodes/query.js +40 -47
- package/lib/client/nodes/request.d.ts +77 -42
- package/lib/client/nodes/request.js +123 -69
- package/lib/client/nodes/update.d.ts +33 -29
- package/lib/client/nodes/update.js +14 -7
- package/lib/client/schemas/collection.d.ts +0 -3
- package/lib/client/schemas/collection.js +2 -7
- package/lib/client/schemas/executions.js +1 -1
- package/lib/client/schemas/workflows.js +1 -1
- package/lib/client/style.js +51 -9
- package/lib/client/triggers/collection.d.ts +44 -15
- package/lib/client/triggers/collection.js +104 -82
- package/lib/client/triggers/index.d.ts +6 -3
- package/lib/client/triggers/index.js +167 -74
- package/lib/client/triggers/schedule/DateFieldsSelect.js +1 -3
- package/lib/client/triggers/schedule/ScheduleConfig.js +15 -17
- package/lib/client/triggers/schedule/index.d.ts +7 -6
- package/lib/client/triggers/schedule/index.js +39 -81
- 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 +33 -33
- 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 +5 -4
- package/lib/server/instructions/request.js +60 -79
- 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 +10 -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 = 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,12 @@ 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
|
+
|
|
70
103
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
71
104
|
|
|
72
105
|
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 +108,165 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
75
108
|
|
|
76
109
|
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
110
|
|
|
111
|
+
const calculators = new (_client().Registry)();
|
|
112
|
+
exports.calculators = calculators;
|
|
113
|
+
calculators.register('equal', {
|
|
114
|
+
name: '=',
|
|
115
|
+
type: 'boolean',
|
|
116
|
+
group: 'boolean'
|
|
117
|
+
});
|
|
118
|
+
calculators.register('notEqual', {
|
|
119
|
+
name: '≠',
|
|
120
|
+
type: 'boolean',
|
|
121
|
+
group: 'boolean'
|
|
122
|
+
});
|
|
123
|
+
calculators.register('gt', {
|
|
124
|
+
name: '>',
|
|
125
|
+
type: 'boolean',
|
|
126
|
+
group: 'boolean'
|
|
127
|
+
});
|
|
128
|
+
calculators.register('gte', {
|
|
129
|
+
name: '≥',
|
|
130
|
+
type: 'boolean',
|
|
131
|
+
group: 'boolean'
|
|
132
|
+
});
|
|
133
|
+
calculators.register('lt', {
|
|
134
|
+
name: '<',
|
|
135
|
+
type: 'boolean',
|
|
136
|
+
group: 'boolean'
|
|
137
|
+
});
|
|
138
|
+
calculators.register('lte', {
|
|
139
|
+
name: '≤',
|
|
140
|
+
type: 'boolean',
|
|
141
|
+
group: 'boolean'
|
|
142
|
+
});
|
|
143
|
+
calculators.register('add', {
|
|
144
|
+
name: '+',
|
|
145
|
+
type: 'number',
|
|
146
|
+
group: 'number'
|
|
147
|
+
});
|
|
148
|
+
calculators.register('minus', {
|
|
149
|
+
name: '-',
|
|
150
|
+
type: 'number',
|
|
151
|
+
group: 'number'
|
|
152
|
+
});
|
|
153
|
+
calculators.register('multiple', {
|
|
154
|
+
name: '*',
|
|
155
|
+
type: 'number',
|
|
156
|
+
group: 'number'
|
|
157
|
+
});
|
|
158
|
+
calculators.register('divide', {
|
|
159
|
+
name: '/',
|
|
160
|
+
type: 'number',
|
|
161
|
+
group: 'number'
|
|
162
|
+
});
|
|
163
|
+
calculators.register('mod', {
|
|
164
|
+
name: '%',
|
|
165
|
+
type: 'number',
|
|
166
|
+
group: 'number'
|
|
167
|
+
});
|
|
168
|
+
calculators.register('includes', {
|
|
169
|
+
name: '{{t("contains")}}',
|
|
170
|
+
type: 'boolean',
|
|
171
|
+
group: 'string'
|
|
172
|
+
});
|
|
173
|
+
calculators.register('notIncludes', {
|
|
174
|
+
name: '{{t("does not contain")}}',
|
|
175
|
+
type: 'boolean',
|
|
176
|
+
group: 'string'
|
|
177
|
+
});
|
|
178
|
+
calculators.register('startsWith', {
|
|
179
|
+
name: '{{t("starts with")}}',
|
|
180
|
+
type: 'boolean',
|
|
181
|
+
group: 'string'
|
|
182
|
+
});
|
|
183
|
+
calculators.register('notStartsWith', {
|
|
184
|
+
name: '{{t("not starts with")}}',
|
|
185
|
+
type: 'boolean',
|
|
186
|
+
group: 'string'
|
|
187
|
+
});
|
|
188
|
+
calculators.register('endsWith', {
|
|
189
|
+
name: '{{t("ends with")}}',
|
|
190
|
+
type: 'boolean',
|
|
191
|
+
group: 'string'
|
|
192
|
+
});
|
|
193
|
+
calculators.register('notEndsWith', {
|
|
194
|
+
name: '{{t("not ends with")}}',
|
|
195
|
+
type: 'boolean',
|
|
196
|
+
group: 'string'
|
|
197
|
+
});
|
|
198
|
+
calculators.register('concat', {
|
|
199
|
+
name: `{{t("concat", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
200
|
+
type: 'string',
|
|
201
|
+
group: 'string'
|
|
202
|
+
});
|
|
203
|
+
const calculatorGroups = [{
|
|
204
|
+
value: 'boolean',
|
|
205
|
+
title: '{{t("Comparision")}}'
|
|
206
|
+
}, {
|
|
207
|
+
value: 'number',
|
|
208
|
+
title: `{{t("Arithmetic calculation", { ns: "${_locale.NAMESPACE}" })}}`
|
|
209
|
+
}, {
|
|
210
|
+
value: 'string',
|
|
211
|
+
title: `{{t("String operation", { ns: "${_locale.NAMESPACE}" })}}`
|
|
212
|
+
}, {
|
|
213
|
+
value: 'date',
|
|
214
|
+
title: `{{t("Date", { ns: "${_locale.NAMESPACE}" })}}`
|
|
215
|
+
}];
|
|
216
|
+
|
|
217
|
+
function getGroupCalculators(group) {
|
|
218
|
+
return Array.from(calculators.getEntities()).filter(([key, value]) => value.group === group);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function Calculation({
|
|
222
|
+
calculator,
|
|
223
|
+
operands = [],
|
|
224
|
+
onChange: _onChange
|
|
225
|
+
}) {
|
|
226
|
+
const compile = (0, _client2().useCompile)();
|
|
227
|
+
const options = (0, _variable.useWorkflowVariableOptions)();
|
|
228
|
+
return _react().default.createElement("fieldset", {
|
|
229
|
+
className: (0, _css().css)`
|
|
230
|
+
display: flex;
|
|
231
|
+
gap: .5em;
|
|
232
|
+
align-items: center;
|
|
233
|
+
flex-wrap: wrap;
|
|
234
|
+
`
|
|
235
|
+
}, _react().default.createElement(_client2().Variable.Input, {
|
|
236
|
+
value: operands[0],
|
|
237
|
+
onChange: v => _onChange({
|
|
238
|
+
calculator,
|
|
239
|
+
operands: [v, operands[1]]
|
|
240
|
+
}),
|
|
241
|
+
scope: options
|
|
242
|
+
}), _react().default.createElement(_antd().Select, {
|
|
243
|
+
value: calculator,
|
|
244
|
+
onChange: v => _onChange({
|
|
245
|
+
operands,
|
|
246
|
+
calculator: v
|
|
247
|
+
}),
|
|
248
|
+
placeholder: (0, _locale.lang)('Calculator')
|
|
249
|
+
}, calculatorGroups.filter(group => Boolean(getGroupCalculators(group.value).length)).map(group => _react().default.createElement(_antd().Select.OptGroup, {
|
|
250
|
+
key: group.value,
|
|
251
|
+
label: compile(group.title)
|
|
252
|
+
}, getGroupCalculators(group.value).map(([value, {
|
|
253
|
+
name
|
|
254
|
+
}]) => _react().default.createElement(_antd().Select.Option, {
|
|
255
|
+
key: value,
|
|
256
|
+
value: value
|
|
257
|
+
}, compile(name)))))), _react().default.createElement(_client2().Variable.Input, {
|
|
258
|
+
value: operands[1],
|
|
259
|
+
onChange: v => _onChange({
|
|
260
|
+
calculator,
|
|
261
|
+
operands: [operands[0], v]
|
|
262
|
+
}),
|
|
263
|
+
scope: options
|
|
264
|
+
}));
|
|
265
|
+
}
|
|
266
|
+
|
|
78
267
|
function CalculationItem({
|
|
79
268
|
value,
|
|
80
|
-
onChange:
|
|
269
|
+
onChange: _onChange2,
|
|
81
270
|
onRemove
|
|
82
271
|
}) {
|
|
83
272
|
if (!value) {
|
|
@@ -86,7 +275,7 @@ function CalculationItem({
|
|
|
86
275
|
|
|
87
276
|
const calculator = value.calculator,
|
|
88
277
|
_value$operands = value.operands,
|
|
89
|
-
operands = _value$operands === void 0 ? [
|
|
278
|
+
operands = _value$operands === void 0 ? [] : _value$operands;
|
|
90
279
|
return _react().default.createElement("div", {
|
|
91
280
|
className: (0, _css().css)`
|
|
92
281
|
display: flex;
|
|
@@ -95,13 +284,13 @@ function CalculationItem({
|
|
|
95
284
|
`
|
|
96
285
|
}, value.group ? _react().default.createElement(CalculationGroup, {
|
|
97
286
|
value: value.group,
|
|
98
|
-
onChange: group =>
|
|
287
|
+
onChange: group => _onChange2(_objectSpread(_objectSpread({}, value), {}, {
|
|
99
288
|
group
|
|
100
289
|
}))
|
|
101
|
-
}) : _react().default.createElement(
|
|
290
|
+
}) : _react().default.createElement(Calculation, {
|
|
102
291
|
operands: operands,
|
|
103
292
|
calculator: calculator,
|
|
104
|
-
onChange:
|
|
293
|
+
onChange: _onChange2
|
|
105
294
|
}), _react().default.createElement(_antd().Button, {
|
|
106
295
|
onClick: onRemove,
|
|
107
296
|
type: "link",
|
|
@@ -111,7 +300,7 @@ function CalculationItem({
|
|
|
111
300
|
|
|
112
301
|
function CalculationGroup({
|
|
113
302
|
value,
|
|
114
|
-
onChange:
|
|
303
|
+
onChange: _onChange3
|
|
115
304
|
}) {
|
|
116
305
|
const _useTranslation = (0, _reactI18next().useTranslation)(),
|
|
117
306
|
t = _useTranslation.t;
|
|
@@ -122,7 +311,7 @@ function CalculationGroup({
|
|
|
122
311
|
calculations = _value$calculations === void 0 ? [] : _value$calculations;
|
|
123
312
|
|
|
124
313
|
function onAddSingle() {
|
|
125
|
-
|
|
314
|
+
_onChange3(_objectSpread(_objectSpread({}, value), {}, {
|
|
126
315
|
calculations: [...calculations, {
|
|
127
316
|
not: false,
|
|
128
317
|
calculator: 'equal'
|
|
@@ -131,7 +320,7 @@ function CalculationGroup({
|
|
|
131
320
|
}
|
|
132
321
|
|
|
133
322
|
function onAddGroup() {
|
|
134
|
-
|
|
323
|
+
_onChange3(_objectSpread(_objectSpread({}, value), {}, {
|
|
135
324
|
calculations: [...calculations, {
|
|
136
325
|
not: false,
|
|
137
326
|
group: {
|
|
@@ -145,7 +334,7 @@ function CalculationGroup({
|
|
|
145
334
|
function _onRemove(i) {
|
|
146
335
|
calculations.splice(i, 1);
|
|
147
336
|
|
|
148
|
-
|
|
337
|
+
_onChange3(_objectSpread(_objectSpread({}, value), {}, {
|
|
149
338
|
calculations: [...calculations]
|
|
150
339
|
}));
|
|
151
340
|
}
|
|
@@ -153,7 +342,7 @@ function CalculationGroup({
|
|
|
153
342
|
function onItemChange(i, v) {
|
|
154
343
|
calculations.splice(i, 1, v);
|
|
155
344
|
|
|
156
|
-
|
|
345
|
+
_onChange3(_objectSpread(_objectSpread({}, value), {}, {
|
|
157
346
|
calculations: [...calculations]
|
|
158
347
|
}));
|
|
159
348
|
}
|
|
@@ -162,12 +351,10 @@ function CalculationGroup({
|
|
|
162
351
|
className: (0, _css().cx)('node-type-condition-group', (0, _css().css)`
|
|
163
352
|
position: relative;
|
|
164
353
|
width: 100%;
|
|
165
|
-
|
|
166
354
|
.node-type-condition-group{
|
|
167
355
|
padding: .5em 1em;
|
|
168
356
|
border: 1px dashed #ddd;
|
|
169
357
|
}
|
|
170
|
-
|
|
171
358
|
+ button{
|
|
172
359
|
position: absolute;
|
|
173
360
|
right: 0;
|
|
@@ -178,7 +365,6 @@ function CalculationGroup({
|
|
|
178
365
|
display: flex;
|
|
179
366
|
align-items: center;
|
|
180
367
|
gap: .5em;
|
|
181
|
-
|
|
182
368
|
.ant-select{
|
|
183
369
|
width: auto;
|
|
184
370
|
min-width: 6em;
|
|
@@ -186,7 +372,7 @@ function CalculationGroup({
|
|
|
186
372
|
`
|
|
187
373
|
}, _react().default.createElement(_reactI18next().Trans, null, 'Meet ', _react().default.createElement(_antd().Select, {
|
|
188
374
|
value: type,
|
|
189
|
-
onChange: t =>
|
|
375
|
+
onChange: t => _onChange3(_objectSpread(_objectSpread({}, value), {}, {
|
|
190
376
|
type: t
|
|
191
377
|
}))
|
|
192
378
|
}, _react().default.createElement(_antd().Select.Option, {
|
|
@@ -204,7 +390,6 @@ function CalculationGroup({
|
|
|
204
390
|
className: (0, _css().css)`
|
|
205
391
|
button{
|
|
206
392
|
padding: 0;
|
|
207
|
-
|
|
208
393
|
&:not(:last-child){
|
|
209
394
|
margin-right: 1em;
|
|
210
395
|
}
|
|
@@ -221,7 +406,7 @@ function CalculationGroup({
|
|
|
221
406
|
|
|
222
407
|
function CalculationConfig({
|
|
223
408
|
value,
|
|
224
|
-
onChange:
|
|
409
|
+
onChange: _onChange4
|
|
225
410
|
}) {
|
|
226
411
|
const rule = value && Object.keys(value).length ? value : {
|
|
227
412
|
group: {
|
|
@@ -231,7 +416,7 @@ function CalculationConfig({
|
|
|
231
416
|
};
|
|
232
417
|
return _react().default.createElement(CalculationGroup, {
|
|
233
418
|
value: rule.group,
|
|
234
|
-
onChange: group =>
|
|
419
|
+
onChange: group => _onChange4(_objectSpread(_objectSpread({}, rule), {}, {
|
|
235
420
|
group
|
|
236
421
|
}))
|
|
237
422
|
});
|
|
@@ -242,9 +427,8 @@ var _default = {
|
|
|
242
427
|
type: 'condition',
|
|
243
428
|
group: 'control',
|
|
244
429
|
fieldset: {
|
|
245
|
-
|
|
430
|
+
rejectOnFalse: {
|
|
246
431
|
type: 'boolean',
|
|
247
|
-
name: 'config.rejectOnFalse',
|
|
248
432
|
title: `{{t("Mode", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
249
433
|
'x-decorator': 'FormItem',
|
|
250
434
|
'x-component': 'Radio.Group',
|
|
@@ -253,29 +437,92 @@ var _default = {
|
|
|
253
437
|
},
|
|
254
438
|
enum: [{
|
|
255
439
|
value: true,
|
|
256
|
-
label: (
|
|
440
|
+
label: `{{t('Continue when "Yes"', { ns: "${_locale.NAMESPACE}" })}}`
|
|
257
441
|
}, {
|
|
258
442
|
value: false,
|
|
259
|
-
label: (
|
|
443
|
+
label: `{{t('Branch into "Yes" and "No"', { ns: "${_locale.NAMESPACE}" })}}`
|
|
260
444
|
}]
|
|
261
445
|
},
|
|
262
|
-
|
|
446
|
+
engine: {
|
|
447
|
+
type: 'string',
|
|
448
|
+
title: `{{t("Calculation engine", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
449
|
+
'x-decorator': 'FormItem',
|
|
450
|
+
'x-component': 'RadioWithTooltip',
|
|
451
|
+
'x-component-props': {
|
|
452
|
+
options: [['basic', {
|
|
453
|
+
label: `{{t("Basic", { ns: "${_locale.NAMESPACE}" })}}`
|
|
454
|
+
}], ...Array.from(_client3().evaluators.getEntities())].reduce((result, [value, options]) => result.concat(_objectSpread({
|
|
455
|
+
value
|
|
456
|
+
}, options)), [])
|
|
457
|
+
},
|
|
458
|
+
required: true,
|
|
459
|
+
default: 'basic'
|
|
460
|
+
},
|
|
461
|
+
calculation: {
|
|
462
|
+
type: 'string',
|
|
463
|
+
title: `{{t("Condition", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
464
|
+
'x-decorator': 'FormItem',
|
|
465
|
+
'x-component': 'CalculationConfig',
|
|
466
|
+
'x-reactions': {
|
|
467
|
+
dependencies: ['engine'],
|
|
468
|
+
fulfill: {
|
|
469
|
+
state: {
|
|
470
|
+
visible: '{{$deps[0] === "basic"}}'
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
},
|
|
474
|
+
required: true
|
|
475
|
+
},
|
|
476
|
+
expression: {
|
|
263
477
|
type: 'string',
|
|
264
|
-
|
|
265
|
-
title: `{{t("Conditions", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
478
|
+
title: `{{t("Condition expression", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
266
479
|
'x-decorator': 'FormItem',
|
|
267
|
-
'x-component': '
|
|
480
|
+
'x-component': 'Variable.TextArea',
|
|
481
|
+
'x-component-props': {
|
|
482
|
+
scope: '{{useWorkflowVariableOptions}}'
|
|
483
|
+
},
|
|
484
|
+
|
|
485
|
+
['x-validator'](value, rules, {
|
|
486
|
+
form
|
|
487
|
+
}) {
|
|
488
|
+
const values = form.values;
|
|
489
|
+
|
|
490
|
+
const _evaluators$get = _client3().evaluators.get(values.engine),
|
|
491
|
+
evaluate = _evaluators$get.evaluate;
|
|
492
|
+
|
|
493
|
+
const exp = value.trim().replace(/{{([^{}]+)}}/g, '1');
|
|
494
|
+
|
|
495
|
+
try {
|
|
496
|
+
evaluate(exp);
|
|
497
|
+
return '';
|
|
498
|
+
} catch (e) {
|
|
499
|
+
return (0, _locale.lang)('Expression syntax error');
|
|
500
|
+
}
|
|
501
|
+
},
|
|
502
|
+
|
|
503
|
+
'x-reactions': {
|
|
504
|
+
dependencies: ['engine'],
|
|
505
|
+
fulfill: {
|
|
506
|
+
state: {
|
|
507
|
+
visible: '{{$deps[0] !== "basic"}}'
|
|
508
|
+
},
|
|
509
|
+
schema: {
|
|
510
|
+
description: '{{renderReference($deps[0])}}'
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
},
|
|
514
|
+
required: true
|
|
268
515
|
}
|
|
269
516
|
},
|
|
270
517
|
view: {},
|
|
271
518
|
options: [{
|
|
272
|
-
label: (
|
|
519
|
+
label: `{{t('Continue when "Yes"', { ns: "${_locale.NAMESPACE}" })}}`,
|
|
273
520
|
key: 'rejectOnFalse',
|
|
274
521
|
value: {
|
|
275
522
|
rejectOnFalse: true
|
|
276
523
|
}
|
|
277
524
|
}, {
|
|
278
|
-
label: (
|
|
525
|
+
label: `{{t('Branch into "Yes" and "No"', { ns: "${_locale.NAMESPACE}" })}}`,
|
|
279
526
|
key: 'branch',
|
|
280
527
|
value: {
|
|
281
528
|
rejectOnFalse: false
|
|
@@ -335,8 +582,13 @@ var _default = {
|
|
|
335
582
|
}, t('Yes')))));
|
|
336
583
|
},
|
|
337
584
|
|
|
585
|
+
scope: {
|
|
586
|
+
renderReference: _client3().renderReference,
|
|
587
|
+
useWorkflowVariableOptions: _variable.useWorkflowVariableOptions
|
|
588
|
+
},
|
|
338
589
|
components: {
|
|
339
|
-
CalculationConfig
|
|
590
|
+
CalculationConfig,
|
|
591
|
+
RadioWithTooltip: _RadioWithTooltip.RadioWithTooltip
|
|
340
592
|
}
|
|
341
593
|
};
|
|
342
594
|
exports.default = _default;
|
|
@@ -1,12 +1,11 @@
|
|
|
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;
|
|
6
6
|
group: string;
|
|
7
7
|
fieldset: {
|
|
8
|
-
|
|
9
|
-
name: string;
|
|
8
|
+
collection: {
|
|
10
9
|
type: string;
|
|
11
10
|
title: string;
|
|
12
11
|
required: boolean;
|
|
@@ -17,10 +16,9 @@ declare const _default: {
|
|
|
17
16
|
placeholder: string;
|
|
18
17
|
};
|
|
19
18
|
};
|
|
20
|
-
'
|
|
19
|
+
'params.values': {
|
|
21
20
|
type: string;
|
|
22
21
|
title: string;
|
|
23
|
-
name: string;
|
|
24
22
|
'x-decorator': string;
|
|
25
23
|
'x-decorator-props': {
|
|
26
24
|
labelAlign: string;
|
|
@@ -35,10 +33,12 @@ declare const _default: {
|
|
|
35
33
|
useCollectionDataSource: typeof useCollectionDataSource;
|
|
36
34
|
};
|
|
37
35
|
components: {
|
|
38
|
-
CollectionFieldset:
|
|
36
|
+
CollectionFieldset: import("react").MemoExoticComponent<import("react").FunctionComponent<Pick<any, string | number | symbol>>>;
|
|
37
|
+
};
|
|
38
|
+
getOptions(config: any, types: any): any;
|
|
39
|
+
useInitializers(node: any): SchemaInitializerItemOptions | null;
|
|
40
|
+
initializers: {
|
|
41
|
+
CollectionFieldInitializers: typeof CollectionFieldInitializers;
|
|
39
42
|
};
|
|
40
|
-
getter({ onChange }: {
|
|
41
|
-
onChange: any;
|
|
42
|
-
}): JSX.Element;
|
|
43
43
|
};
|
|
44
44
|
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,32 +17,24 @@ 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
|
|
39
|
-
|
|
40
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
|
+
var _CollectionBlockInitializer = require("../components/CollectionBlockInitializer");
|
|
41
25
|
|
|
42
|
-
|
|
26
|
+
var _CollectionFieldInitializers = require("../components/CollectionFieldInitializers");
|
|
43
27
|
|
|
44
|
-
|
|
28
|
+
var _variable = require("../variable");
|
|
45
29
|
|
|
46
|
-
function
|
|
30
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
47
31
|
|
|
48
32
|
var _default = {
|
|
49
33
|
title: `{{t("Create record", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
50
34
|
type: 'create',
|
|
51
35
|
group: 'collection',
|
|
52
36
|
fieldset: {
|
|
53
|
-
|
|
54
|
-
name: 'config.collection'
|
|
55
|
-
}),
|
|
37
|
+
collection: _collection.collection,
|
|
56
38
|
// multiple: {
|
|
57
39
|
// type: 'boolean',
|
|
58
40
|
// title: '多条数据',
|
|
@@ -63,7 +45,7 @@ var _default = {
|
|
|
63
45
|
// disabled: true
|
|
64
46
|
// }
|
|
65
47
|
// },
|
|
66
|
-
'
|
|
48
|
+
'params.values': _collection.values
|
|
67
49
|
},
|
|
68
50
|
view: {},
|
|
69
51
|
scope: {
|
|
@@ -73,27 +55,31 @@ var _default = {
|
|
|
73
55
|
CollectionFieldset: _CollectionFieldset.default
|
|
74
56
|
},
|
|
75
57
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
58
|
+
getOptions(config, types) {
|
|
59
|
+
return (0, _variable.useCollectionFieldOptions)({
|
|
60
|
+
collection: config.collection,
|
|
61
|
+
types
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
useInitializers(node) {
|
|
66
|
+
var _node$title;
|
|
81
67
|
|
|
82
|
-
|
|
83
|
-
|
|
68
|
+
if (!node.config.collection) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
84
71
|
|
|
85
|
-
|
|
86
|
-
|
|
72
|
+
return {
|
|
73
|
+
type: 'item',
|
|
74
|
+
title: (_node$title = node.title) !== null && _node$title !== void 0 ? _node$title : `#${node.id}`,
|
|
75
|
+
component: _CollectionBlockInitializer.CollectionBlockInitializer,
|
|
76
|
+
collection: node.config.collection,
|
|
77
|
+
dataSource: `{{$jobsMapByNodeId.${node.id}}}`
|
|
78
|
+
};
|
|
79
|
+
},
|
|
87
80
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
collection: config.collection,
|
|
91
|
-
value: value,
|
|
92
|
-
onChange: path => {
|
|
93
|
-
_onChange(`{{$jobsMapByNodeId.${options.nodeId}.${path}}}`);
|
|
94
|
-
}
|
|
95
|
-
});
|
|
81
|
+
initializers: {
|
|
82
|
+
CollectionFieldInitializers: _CollectionFieldInitializers.CollectionFieldInitializers
|
|
96
83
|
}
|
|
97
|
-
|
|
98
84
|
};
|
|
99
85
|
exports.default = _default;
|
|
@@ -4,17 +4,16 @@ declare const _default: {
|
|
|
4
4
|
type: string;
|
|
5
5
|
group: string;
|
|
6
6
|
fieldset: {
|
|
7
|
-
|
|
7
|
+
duration: {
|
|
8
8
|
type: string;
|
|
9
|
-
name: string;
|
|
10
9
|
title: string;
|
|
11
10
|
'x-decorator': string;
|
|
12
11
|
'x-component': string;
|
|
13
12
|
default: number;
|
|
13
|
+
required: boolean;
|
|
14
14
|
};
|
|
15
|
-
|
|
15
|
+
endStatus: {
|
|
16
16
|
type: string;
|
|
17
|
-
name: string;
|
|
18
17
|
title: string;
|
|
19
18
|
'x-decorator': string;
|
|
20
19
|
'x-component': string;
|
|
@@ -25,6 +24,7 @@ declare const _default: {
|
|
|
25
24
|
label: string;
|
|
26
25
|
value: number;
|
|
27
26
|
}[];
|
|
27
|
+
required: boolean;
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
30
|
view: {};
|