@nocobase/plugin-workflow 0.9.1-alpha.2 → 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 +17 -64
- 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 +56 -127
- 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 +31 -79
- 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 +54 -3
- package/lib/client/nodes/calculation.js +136 -63
- package/lib/client/nodes/condition.d.ts +1 -1
- package/lib/client/nodes/condition.js +21 -76
- package/lib/client/nodes/create.d.ts +35 -9
- package/lib/client/nodes/create.js +13 -19
- package/lib/client/nodes/delay.d.ts +1 -3
- package/lib/client/nodes/delay.js +3 -10
- package/lib/client/nodes/destroy.d.ts +1 -6
- package/lib/client/nodes/destroy.js +12 -9
- package/lib/client/nodes/index.d.ts +2 -2
- package/lib/client/nodes/index.js +45 -147
- package/lib/client/nodes/manual/AssigneesSelect.js +6 -17
- 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 +12 -1
- package/lib/client/nodes/manual/index.js +54 -41
- package/lib/client/nodes/parallel.js +7 -41
- package/lib/client/nodes/query.d.ts +28 -7
- package/lib/client/nodes/query.js +15 -22
- package/lib/client/nodes/request.d.ts +2 -3
- package/lib/client/nodes/request.js +5 -22
- package/lib/client/nodes/update.d.ts +1 -6
- package/lib/client/nodes/update.js +8 -16
- package/lib/client/schemas/collection.d.ts +20 -4
- package/lib/client/schemas/collection.js +26 -22
- package/lib/client/schemas/executions.js +3 -18
- package/lib/client/schemas/workflows.js +10 -33
- package/lib/client/style.js +24 -21
- package/lib/client/triggers/collection.d.ts +24 -20
- package/lib/client/triggers/collection.js +34 -123
- package/lib/client/triggers/index.d.ts +2 -5
- package/lib/client/triggers/index.js +34 -105
- package/lib/client/triggers/schedule/DateFieldsSelect.js +6 -29
- 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 +10 -51
- package/lib/client/triggers/schedule/index.d.ts +21 -0
- package/lib/client/triggers/schedule/index.js +21 -22
- 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,143 +4,88 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.WorkflowTodo = WorkflowTodo;
|
|
7
|
-
|
|
8
7
|
function _react() {
|
|
9
8
|
const data = _interopRequireWildcard(require("react"));
|
|
10
|
-
|
|
11
9
|
_react = function _react() {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
|
-
return data;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function _core() {
|
|
19
|
-
const data = require("@formily/core");
|
|
20
|
-
|
|
21
|
-
_core = function _core() {
|
|
22
|
-
return data;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
12
|
return data;
|
|
26
13
|
}
|
|
27
|
-
|
|
28
14
|
function _react2() {
|
|
29
15
|
const data = require("@formily/react");
|
|
30
|
-
|
|
31
16
|
_react2 = function _react2() {
|
|
32
17
|
return data;
|
|
33
18
|
};
|
|
34
|
-
|
|
35
19
|
return data;
|
|
36
20
|
}
|
|
37
|
-
|
|
38
21
|
function _antd() {
|
|
39
22
|
const data = require("antd");
|
|
40
|
-
|
|
41
23
|
_antd = function _antd() {
|
|
42
24
|
return data;
|
|
43
25
|
};
|
|
44
|
-
|
|
45
26
|
return data;
|
|
46
27
|
}
|
|
47
|
-
|
|
48
28
|
function _jsonTemplates() {
|
|
49
29
|
const data = _interopRequireDefault(require("json-templates"));
|
|
50
|
-
|
|
51
30
|
_jsonTemplates = function _jsonTemplates() {
|
|
52
31
|
return data;
|
|
53
32
|
};
|
|
54
|
-
|
|
55
33
|
return data;
|
|
56
34
|
}
|
|
57
|
-
|
|
58
35
|
function _css() {
|
|
59
36
|
const data = require("@emotion/css");
|
|
60
|
-
|
|
61
37
|
_css = function _css() {
|
|
62
38
|
return data;
|
|
63
39
|
};
|
|
64
|
-
|
|
65
40
|
return data;
|
|
66
41
|
}
|
|
67
|
-
|
|
68
42
|
function _moment() {
|
|
69
43
|
const data = _interopRequireDefault(require("moment"));
|
|
70
|
-
|
|
71
44
|
_moment = function _moment() {
|
|
72
45
|
return data;
|
|
73
46
|
};
|
|
74
|
-
|
|
75
47
|
return data;
|
|
76
48
|
}
|
|
77
|
-
|
|
78
49
|
function _client() {
|
|
79
50
|
const data = require("@nocobase/client");
|
|
80
|
-
|
|
81
51
|
_client = function _client() {
|
|
82
52
|
return data;
|
|
83
53
|
};
|
|
84
|
-
|
|
85
54
|
return data;
|
|
86
55
|
}
|
|
87
|
-
|
|
88
56
|
function _client2() {
|
|
89
57
|
const data = require("@nocobase/utils/client");
|
|
90
|
-
|
|
91
58
|
_client2 = function _client2() {
|
|
92
59
|
return data;
|
|
93
60
|
};
|
|
94
|
-
|
|
95
61
|
return data;
|
|
96
62
|
}
|
|
97
|
-
|
|
98
63
|
var _constants = require("../../constants");
|
|
99
|
-
|
|
100
64
|
var _locale = require("../../locale");
|
|
101
|
-
|
|
102
65
|
var _FlowContext = require("../../FlowContext");
|
|
103
|
-
|
|
104
66
|
var _ = require("..");
|
|
105
|
-
|
|
106
67
|
var _utils = require("../../utils");
|
|
107
|
-
|
|
68
|
+
var _customForm = _interopRequireDefault(require("./forms/customForm"));
|
|
108
69
|
const _excluded = ["nodes"],
|
|
109
|
-
|
|
110
|
-
_excluded3 = ["collections"];
|
|
111
|
-
|
|
70
|
+
_excluded2 = ["collections"];
|
|
112
71
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
113
|
-
|
|
114
72
|
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); }
|
|
115
|
-
|
|
116
73
|
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; }
|
|
117
|
-
|
|
118
74
|
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; }
|
|
119
|
-
|
|
120
75
|
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; }
|
|
121
|
-
|
|
122
|
-
function
|
|
123
|
-
|
|
76
|
+
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; }
|
|
77
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
78
|
+
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); }
|
|
124
79
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
125
|
-
|
|
126
80
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
127
|
-
|
|
128
81
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
129
|
-
|
|
130
82
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
131
|
-
|
|
132
83
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
133
|
-
|
|
134
84
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
135
|
-
|
|
136
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
137
|
-
|
|
85
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
138
86
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
139
|
-
|
|
140
87
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
141
|
-
|
|
142
88
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
143
|
-
|
|
144
89
|
const nodeCollection = {
|
|
145
90
|
title: `{{t("Task", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
146
91
|
name: 'flow_nodes',
|
|
@@ -284,23 +229,19 @@ const todoCollection = {
|
|
|
284
229
|
};
|
|
285
230
|
const NodeColumn = (0, _react2().observer)(() => {
|
|
286
231
|
var _field$value$title, _field$value, _field$value2;
|
|
287
|
-
|
|
288
232
|
const field = (0, _react2().useField)();
|
|
289
233
|
return (_field$value$title = field === null || field === void 0 ? void 0 : (_field$value = field.value) === null || _field$value === void 0 ? void 0 : _field$value.title) !== null && _field$value$title !== void 0 ? _field$value$title : `#${(_field$value2 = field.value) === null || _field$value2 === void 0 ? void 0 : _field$value2.id}`;
|
|
290
234
|
});
|
|
291
235
|
const WorkflowColumn = (0, _react2().observer)(() => {
|
|
292
236
|
var _field$value$title2, _field$value3, _field$value4;
|
|
293
|
-
|
|
294
237
|
const field = (0, _react2().useField)();
|
|
295
238
|
return (_field$value$title2 = field === null || field === void 0 ? void 0 : (_field$value3 = field.value) === null || _field$value3 === void 0 ? void 0 : _field$value3.title) !== null && _field$value$title2 !== void 0 ? _field$value$title2 : `#${(_field$value4 = field.value) === null || _field$value4 === void 0 ? void 0 : _field$value4.id}`;
|
|
296
239
|
});
|
|
297
240
|
const UserColumn = (0, _react2().observer)(() => {
|
|
298
241
|
var _field$value$nickname, _field$value5, _field$value6;
|
|
299
|
-
|
|
300
242
|
const field = (0, _react2().useField)();
|
|
301
243
|
return (_field$value$nickname = field === null || field === void 0 ? void 0 : (_field$value5 = field.value) === null || _field$value5 === void 0 ? void 0 : _field$value5.nickname) !== null && _field$value$nickname !== void 0 ? _field$value$nickname : (_field$value6 = field.value) === null || _field$value6 === void 0 ? void 0 : _field$value6.id;
|
|
302
244
|
});
|
|
303
|
-
|
|
304
245
|
function WorkflowTodo() {
|
|
305
246
|
return _react().default.createElement(_client().SchemaComponent, {
|
|
306
247
|
components: {
|
|
@@ -440,68 +381,93 @@ function WorkflowTodo() {
|
|
|
440
381
|
}
|
|
441
382
|
});
|
|
442
383
|
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
384
|
+
function ActionBarProvider(props) {
|
|
385
|
+
// * status is done:
|
|
386
|
+
// 1. form is this form: show action button, and emphasis used status button
|
|
387
|
+
// 2. form is not this form: hide action bar
|
|
388
|
+
// * status is not done:
|
|
389
|
+
// 1. current user: show action bar
|
|
390
|
+
// 2. not current user: disabled action bar
|
|
391
|
+
const _useCurrentUserContex = (0, _client().useCurrentUserContext)(),
|
|
392
|
+
user = _useCurrentUserContex.data;
|
|
393
|
+
const _useRecord = (0, _client().useRecord)(),
|
|
394
|
+
status = _useRecord.status,
|
|
395
|
+
result = _useRecord.result,
|
|
396
|
+
userId = _useRecord.userId;
|
|
397
|
+
const buttonSchema = (0, _react2().useFieldSchema)();
|
|
398
|
+
const _buttonSchema$parent$ = buttonSchema.parent.toJSON(),
|
|
399
|
+
name = _buttonSchema$parent$.name;
|
|
400
|
+
let content = props.children;
|
|
401
|
+
if (status) {
|
|
402
|
+
if (!result[name]) {
|
|
403
|
+
content = null;
|
|
404
|
+
}
|
|
405
|
+
} else {
|
|
406
|
+
var _user$data;
|
|
407
|
+
if ((user === null || user === void 0 ? void 0 : (_user$data = user.data) === null || _user$data === void 0 ? void 0 : _user$data.id) !== userId) {
|
|
408
|
+
content = null;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
return content;
|
|
448
412
|
}
|
|
449
|
-
|
|
413
|
+
const ManualActionStatusContext = (0, _react().createContext)(null);
|
|
450
414
|
function ManualActionStatusProvider({
|
|
451
415
|
value,
|
|
452
416
|
children
|
|
453
417
|
}) {
|
|
418
|
+
const _useRecord2 = (0, _client().useRecord)(),
|
|
419
|
+
status = _useRecord2.status;
|
|
420
|
+
const button = (0, _react2().useField)();
|
|
421
|
+
(0, _react().useEffect)(() => {
|
|
422
|
+
if (status) {
|
|
423
|
+
button.disabled = true;
|
|
424
|
+
button.visible = status === value;
|
|
425
|
+
}
|
|
426
|
+
}, [status, value]);
|
|
454
427
|
return _react().default.createElement(ManualActionStatusContext.Provider, {
|
|
455
428
|
value: value
|
|
456
429
|
}, children);
|
|
457
430
|
}
|
|
458
|
-
|
|
459
431
|
function useSubmit() {
|
|
460
432
|
const api = (0, _client().useAPIClient)();
|
|
461
|
-
|
|
462
433
|
const _useActionContext = (0, _client().useActionContext)(),
|
|
463
|
-
|
|
464
|
-
|
|
434
|
+
setVisible = _useActionContext.setVisible;
|
|
465
435
|
const _useForm = (0, _react2().useForm)(),
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
const nextStatus =
|
|
470
|
-
|
|
436
|
+
values = _useForm.values,
|
|
437
|
+
submit = _useForm.submit;
|
|
438
|
+
const buttonSchema = (0, _react2().useFieldSchema)();
|
|
439
|
+
const nextStatus = (0, _react().useContext)(ManualActionStatusContext);
|
|
471
440
|
const _useTableBlockContext = (0, _client().useTableBlockContext)(),
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
id = _useRecord.id;
|
|
476
|
-
|
|
441
|
+
service = _useTableBlockContext.service;
|
|
442
|
+
const _useRecord3 = (0, _client().useRecord)(),
|
|
443
|
+
id = _useRecord3.id;
|
|
477
444
|
return {
|
|
478
445
|
run() {
|
|
479
446
|
return _asyncToGenerator(function* () {
|
|
480
447
|
yield submit();
|
|
448
|
+
const _buttonSchema$parent$2 = buttonSchema.parent.parent.toJSON(),
|
|
449
|
+
name = _buttonSchema$parent$2.name;
|
|
481
450
|
yield api.resource('users_jobs').submit({
|
|
482
451
|
filterByTk: id,
|
|
483
452
|
values: {
|
|
484
453
|
status: nextStatus,
|
|
485
|
-
result:
|
|
454
|
+
result: {
|
|
455
|
+
[name]: values
|
|
456
|
+
}
|
|
486
457
|
}
|
|
487
458
|
});
|
|
488
459
|
setVisible(false);
|
|
489
460
|
service.refresh();
|
|
490
461
|
})();
|
|
491
462
|
}
|
|
492
|
-
|
|
493
463
|
};
|
|
494
464
|
}
|
|
495
|
-
|
|
496
465
|
function useFlowRecordFromBlock(opts) {
|
|
497
466
|
var _execution$jobs;
|
|
498
|
-
|
|
499
467
|
const _useFieldSchema = (0, _react2().useFieldSchema)(),
|
|
500
|
-
|
|
501
|
-
|
|
468
|
+
dataSource = _useFieldSchema['x-context-datasource'];
|
|
502
469
|
const _useFlowContext = (0, _FlowContext.useFlowContext)(),
|
|
503
|
-
|
|
504
|
-
|
|
470
|
+
execution = _useFlowContext.execution;
|
|
505
471
|
let result = (0, _jsonTemplates().default)(dataSource)({
|
|
506
472
|
$context: execution === null || execution === void 0 ? void 0 : execution.context,
|
|
507
473
|
$jobsMapByNodeId: ((_execution$jobs = execution === null || execution === void 0 ? void 0 : execution.jobs) !== null && _execution$jobs !== void 0 ? _execution$jobs : []).reduce((map, job) => Object.assign(map, {
|
|
@@ -514,42 +480,34 @@ function useFlowRecordFromBlock(opts) {
|
|
|
514
480
|
});
|
|
515
481
|
}, opts);
|
|
516
482
|
}
|
|
517
|
-
|
|
518
483
|
function FlowContextProvider(props) {
|
|
519
484
|
const api = (0, _client().useAPIClient)();
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
executionId = _useRecord2.executionId;
|
|
524
|
-
|
|
485
|
+
const _useRecord4 = (0, _client().useRecord)(),
|
|
486
|
+
id = _useRecord4.id,
|
|
487
|
+
node = _useRecord4.node;
|
|
525
488
|
const _useState = (0, _react().useState)(null),
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
489
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
490
|
+
flowContext = _useState2[0],
|
|
491
|
+
setFlowContext = _useState2[1];
|
|
530
492
|
(0, _react().useEffect)(() => {
|
|
531
493
|
var _api$resource$get, _api$resource;
|
|
532
|
-
|
|
533
|
-
if (!executionId) {
|
|
494
|
+
if (!id) {
|
|
534
495
|
return;
|
|
535
496
|
}
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
appends: ['workflow', 'workflow.nodes', 'jobs']
|
|
497
|
+
(_api$resource$get = (_api$resource = api.resource('users_jobs')).get) === null || _api$resource$get === void 0 ? void 0 : _api$resource$get.call(_api$resource, {
|
|
498
|
+
filterByTk: id,
|
|
499
|
+
appends: ['workflow', 'workflow.nodes', 'execution', 'execution.jobs']
|
|
540
500
|
}).then(({
|
|
541
501
|
data
|
|
542
502
|
}) => {
|
|
543
503
|
var _data$data;
|
|
544
|
-
|
|
545
504
|
const _ref = (_data$data = data === null || data === void 0 ? void 0 : data.data) !== null && _data$data !== void 0 ? _data$data : {},
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
505
|
+
_ref$workflow = _ref.workflow,
|
|
506
|
+
_ref$workflow2 = _ref$workflow === void 0 ? {} : _ref$workflow,
|
|
507
|
+
_ref$workflow2$nodes = _ref$workflow2.nodes,
|
|
508
|
+
nodes = _ref$workflow2$nodes === void 0 ? [] : _ref$workflow2$nodes,
|
|
509
|
+
workflow = _objectWithoutProperties(_ref$workflow2, _excluded),
|
|
510
|
+
execution = _ref.execution;
|
|
553
511
|
(0, _utils.linkNodes)(nodes);
|
|
554
512
|
setFlowContext({
|
|
555
513
|
workflow,
|
|
@@ -557,14 +515,12 @@ function FlowContextProvider(props) {
|
|
|
557
515
|
execution
|
|
558
516
|
});
|
|
559
517
|
});
|
|
560
|
-
}, [
|
|
561
|
-
|
|
518
|
+
}, [id]);
|
|
562
519
|
if (!flowContext) {
|
|
563
520
|
return null;
|
|
564
521
|
}
|
|
565
|
-
|
|
566
|
-
const
|
|
567
|
-
const nodeComponents = nodes.reduce((components, {
|
|
522
|
+
const upstreams = (0, _.useAvailableUpstreams)(flowContext.nodes.find(item => item.id === node.id));
|
|
523
|
+
const nodeComponents = upstreams.reduce((components, {
|
|
568
524
|
type
|
|
569
525
|
}) => Object.assign(components, _.instructions.get(type).components), {});
|
|
570
526
|
return _react().default.createElement(_FlowContext.FlowContext.Provider, {
|
|
@@ -573,32 +529,19 @@ function FlowContextProvider(props) {
|
|
|
573
529
|
components: _objectSpread({}, nodeComponents)
|
|
574
530
|
}, props.children));
|
|
575
531
|
}
|
|
576
|
-
|
|
577
532
|
WorkflowTodo.Drawer = function () {
|
|
578
|
-
var _node$config
|
|
579
|
-
|
|
533
|
+
var _node$config, _node$title;
|
|
580
534
|
const ctx = (0, _react().useContext)(_client().SchemaComponentContext);
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
const form = (0, _react().useMemo)(() => (0, _core().createForm)({
|
|
591
|
-
readPretty: Boolean(status),
|
|
592
|
-
initialValues: result
|
|
593
|
-
}), [result]);
|
|
594
|
-
|
|
595
|
-
const _ref2 = (_node$config$schema = node.config.schema) !== null && _node$config$schema !== void 0 ? _node$config$schema : {},
|
|
596
|
-
blocks = _ref2.blocks,
|
|
597
|
-
collection = _ref2.collection,
|
|
598
|
-
actions = _ref2.actions;
|
|
599
|
-
|
|
535
|
+
const _useRecord5 = (0, _client().useRecord)(),
|
|
536
|
+
id = _useRecord5.id,
|
|
537
|
+
node = _useRecord5.node,
|
|
538
|
+
workflow = _useRecord5.workflow,
|
|
539
|
+
status = _useRecord5.status,
|
|
540
|
+
updatedAt = _useRecord5.updatedAt;
|
|
541
|
+
const _ref2 = (_node$config = node.config) !== null && _node$config !== void 0 ? _node$config : {},
|
|
542
|
+
schema = _ref2.schema;
|
|
600
543
|
const statusOption = _constants.JobStatusOptionsMap[status];
|
|
601
|
-
const
|
|
544
|
+
const footerSchema = status ? {
|
|
602
545
|
date: {
|
|
603
546
|
type: 'void',
|
|
604
547
|
'x-component': 'time',
|
|
@@ -618,26 +561,21 @@ WorkflowTodo.Drawer = function () {
|
|
|
618
561
|
},
|
|
619
562
|
'x-content': statusOption.label
|
|
620
563
|
}
|
|
621
|
-
} :
|
|
564
|
+
} : null;
|
|
622
565
|
return _react().default.createElement(_client().SchemaComponentContext.Provider, {
|
|
623
566
|
value: _objectSpread(_objectSpread({}, ctx), {}, {
|
|
624
567
|
designable: false
|
|
625
568
|
})
|
|
626
|
-
}, _react().default.createElement(_client().CollectionProvider, {
|
|
627
|
-
collection: collection
|
|
628
569
|
}, _react().default.createElement(_client().SchemaComponent, {
|
|
629
|
-
components: {
|
|
570
|
+
components: _objectSpread({
|
|
630
571
|
Tag: _antd().Tag,
|
|
572
|
+
ActionBarProvider,
|
|
631
573
|
ManualActionStatusProvider,
|
|
632
574
|
FlowContextProvider
|
|
633
|
-
},
|
|
575
|
+
}, _customForm.default.block.components),
|
|
634
576
|
schema: {
|
|
635
577
|
type: 'void',
|
|
636
578
|
name: `drawer-${id}-${status}`,
|
|
637
|
-
'x-decorator': 'Form',
|
|
638
|
-
'x-decorator-props': {
|
|
639
|
-
form
|
|
640
|
-
},
|
|
641
579
|
'x-component': 'Action.Drawer',
|
|
642
580
|
'x-component-props': {
|
|
643
581
|
className: 'nb-action-popup'
|
|
@@ -648,29 +586,27 @@ WorkflowTodo.Drawer = function () {
|
|
|
648
586
|
type: 'void',
|
|
649
587
|
'x-decorator': 'FlowContextProvider',
|
|
650
588
|
'x-component': 'Tabs',
|
|
651
|
-
properties:
|
|
589
|
+
properties: schema
|
|
652
590
|
},
|
|
653
591
|
footer: {
|
|
654
592
|
type: 'void',
|
|
655
593
|
'x-component': 'Action.Drawer.Footer',
|
|
656
|
-
properties:
|
|
594
|
+
properties: footerSchema
|
|
657
595
|
}
|
|
658
596
|
}
|
|
659
597
|
},
|
|
660
|
-
scope: {
|
|
598
|
+
scope: _objectSpread({
|
|
661
599
|
useSubmit,
|
|
662
600
|
useFlowRecordFromBlock
|
|
663
|
-
}
|
|
664
|
-
}))
|
|
601
|
+
}, _customForm.default.block.scope)
|
|
602
|
+
}));
|
|
665
603
|
};
|
|
666
|
-
|
|
667
604
|
WorkflowTodo.Decorator = function ({
|
|
668
605
|
children
|
|
669
606
|
}) {
|
|
670
607
|
const _useCollectionManager = (0, _client().useCollectionManager)(),
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
608
|
+
collections = _useCollectionManager.collections,
|
|
609
|
+
cm = _objectWithoutProperties(_useCollectionManager, _excluded2);
|
|
674
610
|
const blockProps = {
|
|
675
611
|
collection: 'users_jobs',
|
|
676
612
|
resource: 'users_jobs',
|
|
@@ -4,55 +4,39 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.WorkflowTodoBlockInitializer = WorkflowTodoBlockInitializer;
|
|
7
|
-
|
|
8
7
|
function _react() {
|
|
9
8
|
const data = _interopRequireDefault(require("react"));
|
|
10
|
-
|
|
11
9
|
_react = function _react() {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
function _icons() {
|
|
19
15
|
const data = require("@ant-design/icons");
|
|
20
|
-
|
|
21
16
|
_icons = function _icons() {
|
|
22
17
|
return data;
|
|
23
18
|
};
|
|
24
|
-
|
|
25
19
|
return data;
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
function _client() {
|
|
29
22
|
const data = require("@nocobase/client");
|
|
30
|
-
|
|
31
23
|
_client = function _client() {
|
|
32
24
|
return data;
|
|
33
25
|
};
|
|
34
|
-
|
|
35
26
|
return data;
|
|
36
27
|
}
|
|
37
|
-
|
|
38
28
|
const _excluded = ["insert"];
|
|
39
|
-
|
|
40
29
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
41
|
-
|
|
42
30
|
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; }
|
|
43
|
-
|
|
44
31
|
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; }
|
|
45
|
-
|
|
46
|
-
function
|
|
47
|
-
|
|
32
|
+
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; }
|
|
33
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
34
|
+
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); }
|
|
48
35
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
49
|
-
|
|
50
36
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
51
|
-
|
|
52
37
|
function WorkflowTodoBlockInitializer(_ref) {
|
|
53
38
|
let insert = _ref.insert,
|
|
54
|
-
|
|
55
|
-
|
|
39
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
56
40
|
return _react().default.createElement(_client().SchemaInitializer.Item, _objectSpread(_objectSpread({
|
|
57
41
|
icon: _react().default.createElement(_icons().TableOutlined, null)
|
|
58
42
|
}, props), {}, {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare function FormCollectionProvider(props: any): JSX.Element;
|
|
3
|
+
declare function CustomFormBlockInitializer({ insert, ...props }: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
insert: any;
|
|
6
|
+
}): JSX.Element;
|
|
7
|
+
declare function AddCustomFormField(props: any): JSX.Element;
|
|
8
|
+
declare function useFormBlockProps(): {
|
|
9
|
+
form: import("@formily/core").Form<any>;
|
|
10
|
+
};
|
|
11
|
+
declare const _default: {
|
|
12
|
+
title: string;
|
|
13
|
+
config: {
|
|
14
|
+
initializer: {
|
|
15
|
+
key: string;
|
|
16
|
+
type: string;
|
|
17
|
+
title: string;
|
|
18
|
+
component: typeof CustomFormBlockInitializer;
|
|
19
|
+
};
|
|
20
|
+
initializers: {
|
|
21
|
+
AddCustomFormField: typeof AddCustomFormField;
|
|
22
|
+
};
|
|
23
|
+
components: {
|
|
24
|
+
FormCollectionProvider: typeof FormCollectionProvider;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
block: {
|
|
28
|
+
scope: {
|
|
29
|
+
useFormBlockProps: typeof useFormBlockProps;
|
|
30
|
+
};
|
|
31
|
+
components: {
|
|
32
|
+
FormCollectionProvider: React.FC<{
|
|
33
|
+
allowNull?: boolean;
|
|
34
|
+
name?: string;
|
|
35
|
+
collection?: import("@nocobase/client").CollectionOptions;
|
|
36
|
+
}>;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export default _default;
|