@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
package/README.md
ADDED
package/README.zh-CN.md
ADDED
package/lib/client/AddButton.js
CHANGED
|
@@ -77,6 +77,12 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
77
77
|
|
|
78
78
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
79
79
|
|
|
80
|
+
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; }
|
|
81
|
+
|
|
82
|
+
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; }
|
|
83
|
+
|
|
84
|
+
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; }
|
|
85
|
+
|
|
80
86
|
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); } }
|
|
81
87
|
|
|
82
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); }); }; }
|
|
@@ -94,7 +100,7 @@ function AddButton({
|
|
|
94
100
|
|
|
95
101
|
const _ref = (_useFlowContext = (0, _FlowContext.useFlowContext)()) !== null && _useFlowContext !== void 0 ? _useFlowContext : {},
|
|
96
102
|
workflow = _ref.workflow,
|
|
97
|
-
|
|
103
|
+
refresh = _ref.refresh;
|
|
98
104
|
|
|
99
105
|
if (!workflow) {
|
|
100
106
|
return null;
|
|
@@ -118,9 +124,13 @@ function AddButton({
|
|
|
118
124
|
const _keyPath = _slicedToArray(keyPath, 1),
|
|
119
125
|
optionKey = _keyPath[0];
|
|
120
126
|
|
|
127
|
+
const instruction = _nodes.instructions.get(type);
|
|
128
|
+
|
|
121
129
|
if (optionKey) {
|
|
122
|
-
|
|
123
|
-
|
|
130
|
+
var _instruction$options$, _instruction$options;
|
|
131
|
+
|
|
132
|
+
const _ref2 = (_instruction$options$ = (_instruction$options = instruction.options) === null || _instruction$options === void 0 ? void 0 : _instruction$options.find(item => item.key === optionKey)) !== null && _instruction$options$ !== void 0 ? _instruction$options$ : {},
|
|
133
|
+
value = _ref2.value;
|
|
124
134
|
|
|
125
135
|
Object.assign(config, value);
|
|
126
136
|
}
|
|
@@ -130,47 +140,53 @@ function AddButton({
|
|
|
130
140
|
type,
|
|
131
141
|
upstreamId: (_upstream$id = upstream === null || upstream === void 0 ? void 0 : upstream.id) !== null && _upstream$id !== void 0 ? _upstream$id : null,
|
|
132
142
|
branchIndex,
|
|
143
|
+
title: compile(instruction.title),
|
|
133
144
|
config
|
|
134
145
|
}
|
|
135
146
|
}),
|
|
136
147
|
node = _yield$resource$creat.data.data;
|
|
137
148
|
|
|
138
|
-
|
|
149
|
+
refresh();
|
|
139
150
|
});
|
|
140
151
|
return _onCreate.apply(this, arguments);
|
|
141
152
|
}
|
|
142
153
|
|
|
154
|
+
const instructionList = Array.from(_nodes.instructions.getValues());
|
|
143
155
|
const groups = [{
|
|
144
|
-
|
|
145
|
-
|
|
156
|
+
key: 'control',
|
|
157
|
+
label: `{{t("Control", { ns: "${_locale.NAMESPACE}" })}}`
|
|
146
158
|
}, {
|
|
147
|
-
|
|
148
|
-
|
|
159
|
+
key: 'collection',
|
|
160
|
+
label: `{{t("Collection operations", { ns: "${_locale.NAMESPACE}" })}}`
|
|
149
161
|
}, {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
|
|
162
|
+
key: 'manual',
|
|
163
|
+
label: `{{t("Manual", { ns: "${_locale.NAMESPACE}" })}}`
|
|
164
|
+
}, {
|
|
165
|
+
key: 'extended',
|
|
166
|
+
label: `{{t("Extended types", { ns: "${_locale.NAMESPACE}" })}}`
|
|
167
|
+
}].filter(group => instructionList.filter(item => item.group === group.key).length).map(group => {
|
|
168
|
+
const groupInstructions = instructionList.filter(item => item.group === group.key);
|
|
169
|
+
return _objectSpread(_objectSpread({}, group), {}, {
|
|
170
|
+
type: 'group',
|
|
171
|
+
children: groupInstructions.map(item => ({
|
|
172
|
+
key: item.type,
|
|
173
|
+
label: item.title,
|
|
174
|
+
type: item.options ? 'subMenu' : null,
|
|
175
|
+
children: item.options ? item.options.map(option => ({
|
|
176
|
+
key: option.key,
|
|
177
|
+
label: option.label
|
|
178
|
+
})) : null
|
|
179
|
+
}))
|
|
180
|
+
});
|
|
181
|
+
});
|
|
154
182
|
return _react().default.createElement("div", {
|
|
155
183
|
className: (0, _css().cx)(_style.addButtonClass)
|
|
156
184
|
}, _react().default.createElement(_antd().Dropdown, {
|
|
157
185
|
trigger: ['click'],
|
|
158
186
|
overlay: _react().default.createElement(_antd().Menu, {
|
|
159
|
-
onClick: ev => onCreate(ev)
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
return groupInstructions.length ? _react().default.createElement(_antd().Menu.ItemGroup, {
|
|
163
|
-
key: group.value,
|
|
164
|
-
title: compile(group.name)
|
|
165
|
-
}, groupInstructions.map(item => item.options ? _react().default.createElement(_antd().Menu.SubMenu, {
|
|
166
|
-
key: item.type,
|
|
167
|
-
title: compile(item.title)
|
|
168
|
-
}, item.options.map(option => _react().default.createElement(_antd().Menu.Item, {
|
|
169
|
-
key: option.key
|
|
170
|
-
}, compile(option.label)))) : _react().default.createElement(_antd().Menu.Item, {
|
|
171
|
-
key: item.type
|
|
172
|
-
}, compile(item.title)))) : null;
|
|
173
|
-
})),
|
|
187
|
+
onClick: ev => onCreate(ev),
|
|
188
|
+
items: compile(groups)
|
|
189
|
+
}),
|
|
174
190
|
disabled: workflow.executed
|
|
175
191
|
}, _react().default.createElement(_antd().Button, {
|
|
176
192
|
shape: "circle",
|
package/lib/client/Branch.d.ts
CHANGED
|
@@ -77,6 +77,8 @@ var _constants = require("./constants");
|
|
|
77
77
|
|
|
78
78
|
var _locale = require("./locale");
|
|
79
79
|
|
|
80
|
+
var _utils = require("./utils");
|
|
81
|
+
|
|
80
82
|
const _excluded = ["nodes", "revisions"],
|
|
81
83
|
_excluded2 = ["jobs", "workflow"];
|
|
82
84
|
|
|
@@ -94,7 +96,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
94
96
|
|
|
95
97
|
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; }
|
|
96
98
|
|
|
97
|
-
function
|
|
99
|
+
function attachJobs(nodes, jobs = []) {
|
|
98
100
|
const nodesMap = new Map();
|
|
99
101
|
nodes.forEach(item => nodesMap.set(item.id, item));
|
|
100
102
|
const jobsMap = new Map();
|
|
@@ -107,14 +109,6 @@ function makeNodes(nodes, jobs = []) {
|
|
|
107
109
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
108
110
|
let node = _step.value;
|
|
109
111
|
|
|
110
|
-
if (node.upstreamId) {
|
|
111
|
-
node.upstream = nodesMap.get(node.upstreamId);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
if (node.downstreamId) {
|
|
115
|
-
node.downstream = nodesMap.get(node.downstreamId);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
112
|
if (jobsMap.has(node.id)) {
|
|
119
113
|
node.job = jobsMap.get(node.id);
|
|
120
114
|
}
|
|
@@ -167,7 +161,8 @@ function ExecutionCanvas() {
|
|
|
167
161
|
workflow = _objectWithoutProperties(_ref2$workflow2, _excluded),
|
|
168
162
|
execution = _objectWithoutProperties(_ref2, _excluded2);
|
|
169
163
|
|
|
170
|
-
|
|
164
|
+
(0, _utils.linkNodes)(nodes);
|
|
165
|
+
attachJobs(nodes, jobs);
|
|
171
166
|
const entry = nodes.find(item => !item.upstream);
|
|
172
167
|
const statusOption = _constants.ExecutionStatusOptionsMap[execution.status];
|
|
173
168
|
return _react().default.createElement(_FlowContext.FlowContext.Provider, {
|
|
@@ -99,6 +99,8 @@ var _ExecutionLink = require("./ExecutionLink");
|
|
|
99
99
|
|
|
100
100
|
var _locale = require("./locale");
|
|
101
101
|
|
|
102
|
+
var _utils = require("./utils");
|
|
103
|
+
|
|
102
104
|
const _excluded = ["request", "filter"],
|
|
103
105
|
_excluded2 = ["nodes", "revisions"];
|
|
104
106
|
|
|
@@ -116,16 +118,14 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
|
116
118
|
|
|
117
119
|
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."); }
|
|
118
120
|
|
|
119
|
-
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; }
|
|
120
|
-
|
|
121
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
122
|
-
|
|
123
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
124
|
-
|
|
125
121
|
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); }
|
|
126
122
|
|
|
127
123
|
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; }
|
|
128
124
|
|
|
125
|
+
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; }
|
|
126
|
+
|
|
127
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
128
|
+
|
|
129
129
|
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; }
|
|
130
130
|
|
|
131
131
|
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; }
|
|
@@ -160,32 +160,6 @@ function ExecutionResourceProvider(_ref) {
|
|
|
160
160
|
return _react().default.createElement(_client().ResourceActionProvider, _objectSpread({}, props));
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
function makeNodes(nodes) {
|
|
164
|
-
const nodesMap = new Map();
|
|
165
|
-
nodes.forEach(item => nodesMap.set(item.id, item));
|
|
166
|
-
|
|
167
|
-
var _iterator = _createForOfIteratorHelper(nodesMap.values()),
|
|
168
|
-
_step;
|
|
169
|
-
|
|
170
|
-
try {
|
|
171
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
172
|
-
let node = _step.value;
|
|
173
|
-
|
|
174
|
-
if (node.upstreamId) {
|
|
175
|
-
node.upstream = nodesMap.get(node.upstreamId);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
if (node.downstreamId) {
|
|
179
|
-
node.downstream = nodesMap.get(node.downstreamId);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
} catch (err) {
|
|
183
|
-
_iterator.e(err);
|
|
184
|
-
} finally {
|
|
185
|
-
_iterator.f();
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
163
|
function WorkflowCanvas() {
|
|
190
164
|
var _data$data2;
|
|
191
165
|
|
|
@@ -200,8 +174,7 @@ function WorkflowCanvas() {
|
|
|
200
174
|
loading = _useResourceActionCon.loading;
|
|
201
175
|
|
|
202
176
|
const _useResourceContext = (0, _client().useResourceContext)(),
|
|
203
|
-
resource = _useResourceContext.resource
|
|
204
|
-
targetKey = _useResourceContext.targetKey;
|
|
177
|
+
resource = _useResourceContext.resource;
|
|
205
178
|
|
|
206
179
|
const _useDocumentTitle = (0, _client().useDocumentTitle)(),
|
|
207
180
|
setTitle = _useDocumentTitle.setTitle;
|
|
@@ -231,7 +204,7 @@ function WorkflowCanvas() {
|
|
|
231
204
|
revisions = _ref3$revisions === void 0 ? [] : _ref3$revisions,
|
|
232
205
|
workflow = _objectWithoutProperties(_ref3, _excluded2);
|
|
233
206
|
|
|
234
|
-
|
|
207
|
+
(0, _utils.linkNodes)(nodes);
|
|
235
208
|
const entry = nodes.find(item => !item.upstream);
|
|
236
209
|
|
|
237
210
|
function onSwitchVersion({
|
|
@@ -249,11 +222,9 @@ function WorkflowCanvas() {
|
|
|
249
222
|
function _onToggle() {
|
|
250
223
|
_onToggle = _asyncToGenerator(function* (value) {
|
|
251
224
|
yield resource.update({
|
|
252
|
-
filterByTk: workflow
|
|
225
|
+
filterByTk: workflow.id,
|
|
253
226
|
values: {
|
|
254
|
-
enabled: value
|
|
255
|
-
// NOTE: keep `key` field to adapt for backend
|
|
256
|
-
key: workflow.key
|
|
227
|
+
enabled: value
|
|
257
228
|
}
|
|
258
229
|
});
|
|
259
230
|
refresh();
|
|
@@ -268,7 +239,7 @@ function WorkflowCanvas() {
|
|
|
268
239
|
function _onRevision() {
|
|
269
240
|
_onRevision = _asyncToGenerator(function* () {
|
|
270
241
|
const _yield$resource$revis = yield resource.revision({
|
|
271
|
-
filterByTk: workflow
|
|
242
|
+
filterByTk: workflow.id,
|
|
272
243
|
filter: {
|
|
273
244
|
key: workflow.key
|
|
274
245
|
}
|
|
@@ -310,8 +281,7 @@ function WorkflowCanvas() {
|
|
|
310
281
|
value: {
|
|
311
282
|
workflow,
|
|
312
283
|
nodes,
|
|
313
|
-
|
|
314
|
-
onNodeRemoved: refresh
|
|
284
|
+
refresh
|
|
315
285
|
}
|
|
316
286
|
}, _react().default.createElement("div", {
|
|
317
287
|
className: "workflow-toolbar"
|
|
@@ -56,6 +56,10 @@ var _ExecutionLink = require("./ExecutionLink");
|
|
|
56
56
|
|
|
57
57
|
var _OpenDrawer = _interopRequireDefault(require("./components/OpenDrawer"));
|
|
58
58
|
|
|
59
|
+
var _WorkflowTodo = require("./nodes/manual/WorkflowTodo");
|
|
60
|
+
|
|
61
|
+
var _WorkflowTodoBlockInitializer = require("./nodes/manual/WorkflowTodoBlockInitializer");
|
|
62
|
+
|
|
59
63
|
const _excluded = ["routes", "components"];
|
|
60
64
|
|
|
61
65
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -143,12 +147,17 @@ const WorkflowProvider = props => {
|
|
|
143
147
|
}, others), {}, {
|
|
144
148
|
routes
|
|
145
149
|
})
|
|
150
|
+
}, _react().default.createElement(_client().SchemaComponentOptions, {
|
|
151
|
+
components: {
|
|
152
|
+
WorkflowTodo: _WorkflowTodo.WorkflowTodo,
|
|
153
|
+
WorkflowTodoBlockInitializer: _WorkflowTodoBlockInitializer.WorkflowTodoBlockInitializer
|
|
154
|
+
}
|
|
146
155
|
}, _react().default.createElement(WorkflowContext.Provider, {
|
|
147
156
|
value: {
|
|
148
157
|
triggers: _triggers.triggers,
|
|
149
158
|
instructions: _nodes.instructions
|
|
150
159
|
}
|
|
151
|
-
}, props.children))));
|
|
160
|
+
}, props.children)))));
|
|
152
161
|
};
|
|
153
162
|
|
|
154
163
|
exports.WorkflowProvider = WorkflowProvider;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CollectionBlockInitializer = CollectionBlockInitializer;
|
|
7
|
+
|
|
8
|
+
function _react() {
|
|
9
|
+
const data = _interopRequireDefault(require("react"));
|
|
10
|
+
|
|
11
|
+
_react = function _react() {
|
|
12
|
+
return data;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function _client() {
|
|
19
|
+
const data = require("@nocobase/client");
|
|
20
|
+
|
|
21
|
+
_client = function _client() {
|
|
22
|
+
return data;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const _excluded = ["insert", "collection", "dataSource"];
|
|
29
|
+
|
|
30
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
|
+
|
|
32
|
+
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; }
|
|
33
|
+
|
|
34
|
+
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; }
|
|
35
|
+
|
|
36
|
+
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; }
|
|
37
|
+
|
|
38
|
+
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; }
|
|
39
|
+
|
|
40
|
+
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; }
|
|
41
|
+
|
|
42
|
+
function CollectionBlockInitializer(_ref) {
|
|
43
|
+
let insert = _ref.insert,
|
|
44
|
+
collection = _ref.collection,
|
|
45
|
+
dataSource = _ref.dataSource,
|
|
46
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
47
|
+
|
|
48
|
+
const _useCollectionManager = (0, _client().useCollectionManager)(),
|
|
49
|
+
getCollection = _useCollectionManager.getCollection;
|
|
50
|
+
|
|
51
|
+
const resovledCollection = getCollection(collection);
|
|
52
|
+
return _react().default.createElement(_client().SchemaInitializer.Item, _objectSpread(_objectSpread({}, props), {}, {
|
|
53
|
+
onClick: () => {
|
|
54
|
+
insert({
|
|
55
|
+
type: 'void',
|
|
56
|
+
name: resovledCollection.name,
|
|
57
|
+
title: resovledCollection.title,
|
|
58
|
+
'x-decorator': 'CollectionProvider',
|
|
59
|
+
'x-decorator-props': {
|
|
60
|
+
collection
|
|
61
|
+
},
|
|
62
|
+
'x-component': 'CardItem',
|
|
63
|
+
'x-component-props': {// title: props.title
|
|
64
|
+
},
|
|
65
|
+
'x-designer': 'SimpleDesigner',
|
|
66
|
+
properties: {
|
|
67
|
+
grid: {
|
|
68
|
+
type: 'void',
|
|
69
|
+
'x-decorator': 'Form',
|
|
70
|
+
'x-decorator-props': {
|
|
71
|
+
useValues: '{{ useFlowRecordFromBlock }}'
|
|
72
|
+
},
|
|
73
|
+
'x-component': 'Grid',
|
|
74
|
+
'x-initializer': 'CollectionFieldInitializers',
|
|
75
|
+
'x-context-datasource': dataSource
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CollectionFieldInitializers = CollectionFieldInitializers;
|
|
7
|
+
|
|
8
|
+
function _react() {
|
|
9
|
+
const data = _interopRequireDefault(require("react"));
|
|
10
|
+
|
|
11
|
+
_react = function _react() {
|
|
12
|
+
return data;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function _lodash() {
|
|
19
|
+
const data = require("lodash");
|
|
20
|
+
|
|
21
|
+
_lodash = function _lodash() {
|
|
22
|
+
return data;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function _client() {
|
|
29
|
+
const data = require("@nocobase/client");
|
|
30
|
+
|
|
31
|
+
_client = function _client() {
|
|
32
|
+
return data;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return data;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const _excluded = ["field"];
|
|
39
|
+
|
|
40
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
41
|
+
|
|
42
|
+
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
|
+
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 _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; }
|
|
47
|
+
|
|
48
|
+
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
|
+
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
|
+
function CollectionFieldInitializer(_ref) {
|
|
53
|
+
var _uiSchema$title;
|
|
54
|
+
|
|
55
|
+
let field = _ref.field,
|
|
56
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
57
|
+
|
|
58
|
+
const uiSchema = (0, _lodash().cloneDeep)(field.uiSchema);
|
|
59
|
+
delete uiSchema['x-uid'];
|
|
60
|
+
return _react().default.createElement(_client().InitializerWithSwitch, _objectSpread(_objectSpread({}, props), {}, {
|
|
61
|
+
schema: _objectSpread(_objectSpread({}, uiSchema), {}, {
|
|
62
|
+
name: field.name,
|
|
63
|
+
title: (_uiSchema$title = uiSchema.title) !== null && _uiSchema$title !== void 0 ? _uiSchema$title : field.name,
|
|
64
|
+
'x-decorator': 'FormItem',
|
|
65
|
+
'x-read-pretty': true,
|
|
66
|
+
'x-designer': 'FormItem.Designer',
|
|
67
|
+
'x-collection-field': field.name
|
|
68
|
+
}),
|
|
69
|
+
type: "x-collection-field"
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function CollectionFieldInitializers(props) {
|
|
74
|
+
const _useCollection = (0, _client().useCollection)(),
|
|
75
|
+
fields = _useCollection.fields;
|
|
76
|
+
|
|
77
|
+
const items = fields.filter(field => !['belongsTo', 'hasOne', 'hasMany', 'belongsToMany'].includes(field.type) && field.uiSchema).map(field => ({
|
|
78
|
+
key: field.name,
|
|
79
|
+
type: 'item',
|
|
80
|
+
title: field.uiSchema.title,
|
|
81
|
+
component: CollectionFieldInitializer,
|
|
82
|
+
field
|
|
83
|
+
}));
|
|
84
|
+
return _react().default.createElement(_client().SchemaInitializer.Button, _objectSpread(_objectSpread({}, props), {}, {
|
|
85
|
+
items: items,
|
|
86
|
+
title: "{{t('Configure fields')}}",
|
|
87
|
+
wrap: _client().gridRowColWrap
|
|
88
|
+
}));
|
|
89
|
+
}
|