@nocobase/plugin-workflow 0.9.1-alpha.1 → 0.9.2-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client/AddButton.js +50 -86
- package/lib/client/Branch.js +0 -13
- package/lib/client/ExecutionCanvas.js +16 -63
- package/lib/client/ExecutionLink.js +3 -21
- package/lib/client/ExecutionPage.js +1 -19
- package/lib/client/ExecutionResourceProvider.js +6 -23
- package/lib/client/FlowContext.js +0 -8
- package/lib/client/WorkflowCanvas.js +57 -129
- package/lib/client/WorkflowLink.js +3 -21
- package/lib/client/WorkflowPage.js +1 -19
- package/lib/client/WorkflowProvider.js +24 -47
- package/lib/client/WorkflowShortcut.js +0 -16
- package/lib/client/components/CollectionBlockInitializer.js +12 -22
- package/lib/client/components/CollectionFieldInitializers.js +5 -24
- package/lib/client/components/CollectionFieldset.js +33 -85
- package/lib/client/components/Duration.js +0 -14
- package/lib/client/components/DynamicExpression.d.ts +4 -0
- package/lib/client/components/DynamicExpression.js +102 -0
- package/lib/client/components/FieldsSelect.d.ts +2 -0
- package/lib/client/components/FieldsSelect.js +66 -0
- package/lib/client/components/FilterDynamicComponent.js +1 -10
- package/lib/client/components/NullRender.js +0 -1
- package/lib/client/components/OpenDrawer.js +10 -35
- package/lib/client/components/RadioWithTooltip.js +5 -27
- package/lib/client/components/renderEngineReference.d.ts +1 -0
- package/lib/client/components/renderEngineReference.js +55 -0
- package/lib/client/constants.js +0 -9
- package/lib/client/index.js +0 -6
- package/lib/client/interfaces/expression.d.ts +3 -0
- package/lib/client/interfaces/expression.js +37 -0
- package/lib/client/locale/index.js +5 -15
- package/lib/client/locale/pt-BR.d.ts +130 -0
- package/lib/client/locale/pt-BR.js +136 -0
- package/lib/client/locale/zh-CN.d.ts +16 -1
- package/lib/client/locale/zh-CN.js +17 -2
- package/lib/client/nodes/calculation.d.ts +56 -7
- package/lib/client/nodes/calculation.js +141 -74
- package/lib/client/nodes/condition.d.ts +5 -9
- package/lib/client/nodes/condition.js +30 -93
- package/lib/client/nodes/create.d.ts +36 -12
- package/lib/client/nodes/create.js +14 -28
- package/lib/client/nodes/delay.d.ts +3 -7
- package/lib/client/nodes/delay.js +5 -14
- package/lib/client/nodes/destroy.d.ts +3 -11
- package/lib/client/nodes/destroy.js +14 -12
- package/lib/client/nodes/index.d.ts +2 -2
- package/lib/client/nodes/index.js +181 -222
- package/lib/client/nodes/manual/AssigneesSelect.js +8 -18
- package/lib/client/nodes/manual/ModeConfig.js +0 -27
- package/lib/client/nodes/manual/SchemaConfig.js +87 -449
- package/lib/client/nodes/manual/WorkflowTodo.js +99 -163
- package/lib/client/nodes/manual/WorkflowTodoBlockInitializer.js +4 -20
- package/lib/client/nodes/manual/forms/customForm.d.ts +40 -0
- package/lib/client/nodes/manual/forms/customForm.js +411 -0
- package/lib/client/nodes/manual/index.d.ts +15 -6
- package/lib/client/nodes/manual/index.js +58 -54
- package/lib/client/nodes/parallel.d.ts +1 -2
- package/lib/client/nodes/parallel.js +16 -45
- package/lib/client/nodes/query.d.ts +30 -12
- package/lib/client/nodes/query.js +17 -25
- package/lib/client/nodes/request.d.ts +9 -17
- package/lib/client/nodes/request.js +13 -37
- package/lib/client/nodes/update.d.ts +27 -28
- package/lib/client/nodes/update.js +17 -18
- package/lib/client/schemas/collection.d.ts +20 -7
- package/lib/client/schemas/collection.js +27 -28
- package/lib/client/schemas/executions.js +3 -18
- package/lib/client/schemas/workflows.js +10 -33
- package/lib/client/style.js +75 -26
- package/lib/client/triggers/collection.d.ts +47 -18
- package/lib/client/triggers/collection.js +65 -123
- package/lib/client/triggers/index.d.ts +3 -6
- package/lib/client/triggers/index.js +146 -146
- package/lib/client/triggers/schedule/DateFieldsSelect.js +7 -32
- package/lib/client/triggers/schedule/EndsByField.js +1 -18
- package/lib/client/triggers/schedule/OnField.js +10 -38
- package/lib/client/triggers/schedule/RepeatField.js +4 -32
- package/lib/client/triggers/schedule/ScheduleConfig.js +25 -68
- package/lib/client/triggers/schedule/index.d.ts +21 -1
- package/lib/client/triggers/schedule/index.js +22 -24
- package/lib/client/triggers/schedule/locale/Cron.zh-CN.js +8 -4
- package/lib/client/utils.d.ts +1 -0
- package/lib/client/utils.js +31 -10
- package/lib/client/variable.d.ts +7 -6
- package/lib/client/variable.js +132 -71
- package/lib/index.js +0 -2
- package/lib/server/Plugin.d.ts +7 -7
- package/lib/server/Plugin.js +76 -111
- package/lib/server/Processor.d.ts +2 -0
- package/lib/server/Processor.js +62 -125
- package/lib/server/actions/index.js +3 -10
- package/lib/server/actions/nodes.js +34 -87
- package/lib/server/actions/workflows.js +46 -96
- package/lib/server/collections/executions.js +1 -1
- package/lib/server/collections/flow_nodes.js +7 -4
- package/lib/server/collections/jobs.js +1 -1
- package/lib/server/collections/workflows.js +3 -4
- package/lib/server/fields/expression-field.d.ts +8 -0
- package/lib/server/fields/expression-field.js +26 -0
- package/lib/server/fields/index.d.ts +1 -0
- package/lib/server/fields/index.js +12 -0
- package/lib/server/functions/index.js +3 -14
- package/lib/server/index.js +0 -6
- package/lib/server/instructions/calculation.js +22 -17
- package/lib/server/instructions/condition.js +8 -52
- package/lib/server/instructions/create.js +31 -15
- package/lib/server/instructions/delay.js +4 -32
- package/lib/server/instructions/destroy.js +6 -12
- package/lib/server/instructions/index.js +6 -23
- package/lib/server/instructions/manual/actions.js +22 -31
- package/lib/server/instructions/manual/collecions/users_jobs.js +1 -1
- package/lib/server/instructions/manual/index.d.ts +13 -12
- package/lib/server/instructions/manual/index.js +9 -47
- package/lib/server/instructions/parallel.js +9 -36
- package/lib/server/instructions/query.js +17 -15
- package/lib/server/instructions/request.js +7 -30
- package/lib/server/instructions/update.js +8 -14
- package/lib/server/migrations/20221129153547-calculation-variables.js +3 -27
- package/lib/server/migrations/20230221032941-change-request-body-type.js +3 -26
- package/lib/server/migrations/20230221071831-calculation-expression.js +1 -33
- package/lib/server/migrations/20230221121203-condition-calculation.js +5 -28
- package/lib/server/migrations/20230221162902-jsonb-to-json.js +3 -18
- package/lib/server/migrations/20230411034722-manual-multi-form.d.ts +4 -0
- package/lib/server/migrations/20230411034722-manual-multi-form.js +303 -0
- package/lib/server/models/Execution.js +0 -5
- package/lib/server/models/FlowNode.js +0 -5
- package/lib/server/models/Job.js +0 -5
- package/lib/server/models/Workflow.js +0 -5
- package/lib/server/triggers/collection.js +39 -61
- package/lib/server/triggers/index.js +3 -22
- package/lib/server/triggers/schedule.js +72 -194
- package/package.json +14 -11
|
@@ -5,176 +5,128 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.triggers = exports.TriggerConfig = void 0;
|
|
7
7
|
exports.useTrigger = useTrigger;
|
|
8
|
-
|
|
8
|
+
function _react() {
|
|
9
|
+
const data = _interopRequireWildcard(require("react"));
|
|
10
|
+
_react = function _react() {
|
|
11
|
+
return data;
|
|
12
|
+
};
|
|
13
|
+
return data;
|
|
14
|
+
}
|
|
9
15
|
function _css() {
|
|
10
16
|
const data = require("@emotion/css");
|
|
11
|
-
|
|
12
17
|
_css = function _css() {
|
|
13
18
|
return data;
|
|
14
19
|
};
|
|
15
|
-
|
|
16
20
|
return data;
|
|
17
21
|
}
|
|
18
|
-
|
|
19
|
-
function _react() {
|
|
22
|
+
function _react2() {
|
|
20
23
|
const data = require("@formily/react");
|
|
21
|
-
|
|
22
|
-
_react = function _react() {
|
|
24
|
+
_react2 = function _react2() {
|
|
23
25
|
return data;
|
|
24
26
|
};
|
|
25
|
-
|
|
26
27
|
return data;
|
|
27
28
|
}
|
|
28
|
-
|
|
29
29
|
function _client() {
|
|
30
30
|
const data = require("@nocobase/utils/client");
|
|
31
|
-
|
|
32
31
|
_client = function _client() {
|
|
33
32
|
return data;
|
|
34
33
|
};
|
|
35
|
-
|
|
36
34
|
return data;
|
|
37
35
|
}
|
|
38
|
-
|
|
39
36
|
function _antd() {
|
|
40
37
|
const data = require("antd");
|
|
41
|
-
|
|
42
38
|
_antd = function _antd() {
|
|
43
39
|
return data;
|
|
44
40
|
};
|
|
45
|
-
|
|
46
|
-
return data;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function _react2() {
|
|
50
|
-
const data = _interopRequireDefault(require("react"));
|
|
51
|
-
|
|
52
|
-
_react2 = function _react2() {
|
|
53
|
-
return data;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
return data;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function _reactI18next() {
|
|
60
|
-
const data = require("react-i18next");
|
|
61
|
-
|
|
62
|
-
_reactI18next = function _reactI18next() {
|
|
63
|
-
return data;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
41
|
return data;
|
|
67
42
|
}
|
|
68
|
-
|
|
69
43
|
function _icons() {
|
|
70
44
|
const data = require("@ant-design/icons");
|
|
71
|
-
|
|
72
45
|
_icons = function _icons() {
|
|
73
46
|
return data;
|
|
74
47
|
};
|
|
75
|
-
|
|
76
48
|
return data;
|
|
77
49
|
}
|
|
78
|
-
|
|
79
50
|
function _client2() {
|
|
80
51
|
const data = require("@nocobase/client");
|
|
81
|
-
|
|
82
52
|
_client2 = function _client2() {
|
|
83
53
|
return data;
|
|
84
54
|
};
|
|
85
|
-
|
|
86
55
|
return data;
|
|
87
56
|
}
|
|
88
|
-
|
|
89
57
|
var _style = require("../style");
|
|
90
|
-
|
|
91
58
|
var _FlowContext = require("../FlowContext");
|
|
92
|
-
|
|
93
59
|
var _collection = _interopRequireDefault(require("./collection"));
|
|
94
|
-
|
|
95
60
|
var _schedule = _interopRequireDefault(require("./schedule/"));
|
|
96
|
-
|
|
97
61
|
var _locale = require("../locale");
|
|
98
|
-
|
|
99
62
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
100
|
-
|
|
63
|
+
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); }
|
|
64
|
+
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; }
|
|
101
65
|
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; }
|
|
102
|
-
|
|
103
66
|
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; }
|
|
104
|
-
|
|
105
|
-
function
|
|
106
|
-
|
|
67
|
+
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; }
|
|
68
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
69
|
+
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); }
|
|
70
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
71
|
+
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."); }
|
|
72
|
+
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); }
|
|
73
|
+
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; }
|
|
74
|
+
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; } }
|
|
75
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
107
76
|
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); } }
|
|
108
|
-
|
|
109
77
|
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); }); }; }
|
|
110
|
-
|
|
111
78
|
function useUpdateConfigAction() {
|
|
112
79
|
var _useFlowContext;
|
|
113
|
-
|
|
114
|
-
const _useTranslation = (0, _reactI18next().useTranslation)(),
|
|
115
|
-
t = _useTranslation.t;
|
|
116
|
-
|
|
117
|
-
const form = (0, _react().useForm)();
|
|
80
|
+
const form = (0, _react2().useForm)();
|
|
118
81
|
const api = (0, _client2().useAPIClient)();
|
|
119
|
-
|
|
120
82
|
const _ref = (_useFlowContext = (0, _FlowContext.useFlowContext)()) !== null && _useFlowContext !== void 0 ? _useFlowContext : {},
|
|
121
|
-
|
|
122
|
-
|
|
83
|
+
workflow = _ref.workflow;
|
|
123
84
|
const ctx = (0, _client2().useActionContext)();
|
|
124
|
-
|
|
125
85
|
const _useResourceActionCon = (0, _client2().useResourceActionContext)(),
|
|
126
|
-
|
|
127
|
-
|
|
86
|
+
refresh = _useResourceActionCon.refresh;
|
|
128
87
|
return {
|
|
129
88
|
run() {
|
|
130
89
|
return _asyncToGenerator(function* () {
|
|
131
90
|
var _api$resource$update, _api$resource;
|
|
132
|
-
|
|
133
91
|
if (workflow.executed) {
|
|
134
|
-
_antd().message.error(
|
|
135
|
-
|
|
92
|
+
_antd().message.error((0, _locale.lang)('Trigger in executed workflow cannot be modified'));
|
|
136
93
|
return;
|
|
137
94
|
}
|
|
138
|
-
|
|
139
95
|
yield form.submit();
|
|
140
96
|
yield (_api$resource$update = (_api$resource = api.resource('workflows')).update) === null || _api$resource$update === void 0 ? void 0 : _api$resource$update.call(_api$resource, {
|
|
141
97
|
filterByTk: workflow.id,
|
|
142
|
-
values:
|
|
98
|
+
values: {
|
|
99
|
+
config: form.values
|
|
100
|
+
}
|
|
143
101
|
});
|
|
144
102
|
ctx.setVisible(false);
|
|
145
103
|
refresh();
|
|
146
104
|
})();
|
|
147
105
|
}
|
|
148
|
-
|
|
149
106
|
};
|
|
150
107
|
}
|
|
151
|
-
|
|
152
108
|
;
|
|
153
109
|
;
|
|
154
110
|
const triggers = new (_client().Registry)();
|
|
155
111
|
exports.triggers = triggers;
|
|
156
112
|
triggers.register(_collection.default.type, _collection.default);
|
|
157
113
|
triggers.register(_schedule.default.type, _schedule.default);
|
|
158
|
-
|
|
159
114
|
function TriggerExecution() {
|
|
160
115
|
const compile = (0, _client2().useCompile)();
|
|
161
|
-
|
|
162
116
|
const _useFlowContext2 = (0, _FlowContext.useFlowContext)(),
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
117
|
+
workflow = _useFlowContext2.workflow,
|
|
118
|
+
execution = _useFlowContext2.execution;
|
|
166
119
|
if (!execution) {
|
|
167
120
|
return null;
|
|
168
121
|
}
|
|
169
|
-
|
|
170
122
|
const trigger = triggers.get(workflow.type);
|
|
171
|
-
return
|
|
123
|
+
return _react().default.createElement(_client2().SchemaComponent, {
|
|
172
124
|
schema: {
|
|
173
125
|
type: 'void',
|
|
174
126
|
name: 'execution',
|
|
175
127
|
'x-component': 'Action',
|
|
176
128
|
'x-component-props': {
|
|
177
|
-
title:
|
|
129
|
+
title: _react().default.createElement(_icons().InfoOutlined, null),
|
|
178
130
|
shape: 'circle',
|
|
179
131
|
className: 'workflow-node-job-button',
|
|
180
132
|
type: 'primary'
|
|
@@ -187,9 +139,9 @@ function TriggerExecution() {
|
|
|
187
139
|
initialValue: execution
|
|
188
140
|
},
|
|
189
141
|
'x-component': 'Action.Modal',
|
|
190
|
-
title:
|
|
142
|
+
title: _react().default.createElement("div", {
|
|
191
143
|
className: (0, _css().cx)(_style.nodeTitleClass)
|
|
192
|
-
},
|
|
144
|
+
}, _react().default.createElement(_antd().Tag, null, compile(trigger.title)), _react().default.createElement("strong", null, workflow.title), _react().default.createElement("span", {
|
|
193
145
|
className: "workflow-node-id"
|
|
194
146
|
}, "#", execution.id)),
|
|
195
147
|
properties: {
|
|
@@ -222,47 +174,103 @@ function TriggerExecution() {
|
|
|
222
174
|
}
|
|
223
175
|
});
|
|
224
176
|
}
|
|
225
|
-
|
|
226
177
|
const TriggerConfig = () => {
|
|
227
|
-
const
|
|
228
|
-
t = _useTranslation2.t;
|
|
229
|
-
|
|
178
|
+
const api = (0, _client2().useAPIClient)();
|
|
230
179
|
const compile = (0, _client2().useCompile)();
|
|
231
|
-
|
|
232
180
|
const _useFlowContext3 = (0, _FlowContext.useFlowContext)(),
|
|
233
|
-
|
|
234
|
-
|
|
181
|
+
workflow = _useFlowContext3.workflow,
|
|
182
|
+
refresh = _useFlowContext3.refresh;
|
|
183
|
+
const _useState = (0, _react().useState)(''),
|
|
184
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
185
|
+
editingTitle = _useState2[0],
|
|
186
|
+
setEditingTitle = _useState2[1];
|
|
187
|
+
const _useState3 = (0, _react().useState)(false),
|
|
188
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
189
|
+
editingConfig = _useState4[0],
|
|
190
|
+
setEditingConfig = _useState4[1];
|
|
191
|
+
(0, _react().useEffect)(() => {
|
|
192
|
+
var _workflow$title;
|
|
193
|
+
setEditingTitle((_workflow$title = workflow.title) !== null && _workflow$title !== void 0 ? _workflow$title : typeTitle);
|
|
194
|
+
}, [workflow]);
|
|
235
195
|
if (!workflow || !workflow.type) {
|
|
236
196
|
return null;
|
|
237
197
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
198
|
+
const title = workflow.title,
|
|
199
|
+
type = workflow.type,
|
|
200
|
+
config = workflow.config,
|
|
201
|
+
executed = workflow.executed;
|
|
243
202
|
const _triggers$get = triggers.get(type),
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
203
|
+
typeTitle = _triggers$get.title,
|
|
204
|
+
fieldset = _triggers$get.fieldset,
|
|
205
|
+
scope = _triggers$get.scope,
|
|
206
|
+
components = _triggers$get.components;
|
|
249
207
|
const detailText = executed ? '{{t("View")}}' : '{{t("Configure")}}';
|
|
250
|
-
const titleText = `${(0, _locale.lang)('Trigger')}: ${compile(
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
208
|
+
const titleText = `${(0, _locale.lang)('Trigger')}: ${compile(typeTitle)}`;
|
|
209
|
+
function onChangeTitle(_x2) {
|
|
210
|
+
return _onChangeTitle.apply(this, arguments);
|
|
211
|
+
}
|
|
212
|
+
function _onChangeTitle() {
|
|
213
|
+
_onChangeTitle = _asyncToGenerator(function* (next) {
|
|
214
|
+
var _api$resource$update2, _api$resource2;
|
|
215
|
+
const t = next || typeTitle;
|
|
216
|
+
setEditingTitle(t);
|
|
217
|
+
if (t === title) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
yield (_api$resource$update2 = (_api$resource2 = api.resource('workflows')).update) === null || _api$resource$update2 === void 0 ? void 0 : _api$resource$update2.call(_api$resource2, {
|
|
221
|
+
filterByTk: workflow.id,
|
|
222
|
+
values: {
|
|
223
|
+
title: t
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
refresh();
|
|
227
|
+
});
|
|
228
|
+
return _onChangeTitle.apply(this, arguments);
|
|
229
|
+
}
|
|
230
|
+
function onOpenDrawer(ev) {
|
|
231
|
+
if (ev.target === ev.currentTarget) {
|
|
232
|
+
setEditingConfig(true);
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
const whiteSet = new Set(['workflow-node-meta', 'workflow-node-config-button', 'ant-input-disabled']);
|
|
236
|
+
for (let el = ev.target; el && el !== ev.currentTarget; el = el.parentNode) {
|
|
237
|
+
if (Array.from(el.classList).some(name => whiteSet.has(name))) {
|
|
238
|
+
setEditingConfig(true);
|
|
239
|
+
ev.stopPropagation();
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return _react().default.createElement("div", {
|
|
245
|
+
className: (0, _css().cx)(_style.nodeCardClass),
|
|
246
|
+
onClick: onOpenDrawer
|
|
247
|
+
}, _react().default.createElement("div", {
|
|
248
|
+
className: (0, _css().cx)(_style.nodeMetaClass, 'workflow-node-meta')
|
|
249
|
+
}, _react().default.createElement(_antd().Tag, {
|
|
258
250
|
color: "gold"
|
|
259
|
-
},
|
|
251
|
+
}, titleText)), _react().default.createElement("div", null, _react().default.createElement(_antd().Input.TextArea, {
|
|
252
|
+
value: editingTitle,
|
|
253
|
+
onChange: ev => setEditingTitle(ev.target.value),
|
|
254
|
+
onBlur: ev => onChangeTitle(ev.target.value),
|
|
255
|
+
autoSize: true
|
|
256
|
+
})), _react().default.createElement(TriggerExecution, null), _react().default.createElement(_client2().ActionContext.Provider, {
|
|
257
|
+
value: {
|
|
258
|
+
visible: editingConfig,
|
|
259
|
+
setVisible: setEditingConfig
|
|
260
|
+
}
|
|
261
|
+
}, _react().default.createElement(_client2().SchemaComponent, {
|
|
260
262
|
schema: {
|
|
261
263
|
type: 'void',
|
|
262
|
-
title: detailText,
|
|
263
|
-
'x-component': 'Action.Link',
|
|
264
|
-
name: 'drawer',
|
|
265
264
|
properties: {
|
|
265
|
+
config: {
|
|
266
|
+
type: 'void',
|
|
267
|
+
'x-content': detailText,
|
|
268
|
+
'x-component': _antd().Button,
|
|
269
|
+
'x-component-props': {
|
|
270
|
+
type: 'link',
|
|
271
|
+
className: 'workflow-node-config-button'
|
|
272
|
+
}
|
|
273
|
+
},
|
|
266
274
|
drawer: {
|
|
267
275
|
type: 'void',
|
|
268
276
|
title: titleText,
|
|
@@ -270,46 +278,41 @@ const TriggerConfig = () => {
|
|
|
270
278
|
'x-decorator': 'Form',
|
|
271
279
|
'x-decorator-props': {
|
|
272
280
|
disabled: workflow.executed,
|
|
273
|
-
|
|
274
281
|
useValues(options) {
|
|
275
282
|
return (0, _client2().useRequest)(() => Promise.resolve({
|
|
276
|
-
data:
|
|
277
|
-
config
|
|
278
|
-
}
|
|
283
|
+
data: config
|
|
279
284
|
}), options);
|
|
280
285
|
}
|
|
281
|
-
|
|
282
286
|
},
|
|
283
|
-
properties: {
|
|
284
|
-
|
|
287
|
+
properties: _objectSpread(_objectSpread({}, executed ? {
|
|
288
|
+
alert: {
|
|
289
|
+
'x-component': _antd().Alert,
|
|
290
|
+
'x-component-props': {
|
|
291
|
+
type: 'warning',
|
|
292
|
+
showIcon: true,
|
|
293
|
+
message: `{{t("Trigger in executed workflow cannot be modified", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
294
|
+
className: (0, _css().css)`
|
|
295
|
+
width: 100%;
|
|
296
|
+
font-size: 85%;
|
|
297
|
+
margin-bottom: 2em;
|
|
298
|
+
`
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
} : {}), {}, {
|
|
302
|
+
fieldset: {
|
|
285
303
|
type: 'void',
|
|
286
|
-
name: 'config',
|
|
287
304
|
'x-component': 'fieldset',
|
|
288
305
|
'x-component-props': {
|
|
289
306
|
className: (0, _css().css)`
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
307
|
+
.ant-select:not(.full-width){
|
|
308
|
+
width: auto;
|
|
309
|
+
min-width: 6em;
|
|
310
|
+
}
|
|
311
|
+
`
|
|
295
312
|
},
|
|
296
|
-
properties:
|
|
297
|
-
alert: {
|
|
298
|
-
'x-component': _antd().Alert,
|
|
299
|
-
'x-component-props': {
|
|
300
|
-
type: 'warning',
|
|
301
|
-
showIcon: true,
|
|
302
|
-
message: `{{t("Trigger in executed workflow cannot be modified", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
303
|
-
className: (0, _css().css)`
|
|
304
|
-
width: 100%;
|
|
305
|
-
font-size: 85%;
|
|
306
|
-
margin-bottom: 2em;
|
|
307
|
-
`
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
} : {}), fieldset)
|
|
313
|
+
properties: fieldset
|
|
311
314
|
},
|
|
312
|
-
actions: executed ?
|
|
315
|
+
actions: _objectSpread({}, executed ? {} : {
|
|
313
316
|
type: 'void',
|
|
314
317
|
'x-component': 'Action.Drawer.Footer',
|
|
315
318
|
properties: {
|
|
@@ -329,21 +332,18 @@ const TriggerConfig = () => {
|
|
|
329
332
|
}
|
|
330
333
|
}
|
|
331
334
|
}
|
|
332
|
-
}
|
|
333
|
-
}
|
|
335
|
+
})
|
|
336
|
+
})
|
|
334
337
|
}
|
|
335
338
|
}
|
|
336
339
|
},
|
|
337
340
|
scope: scope,
|
|
338
341
|
components: components
|
|
339
|
-
}));
|
|
342
|
+
})));
|
|
340
343
|
};
|
|
341
|
-
|
|
342
344
|
exports.TriggerConfig = TriggerConfig;
|
|
343
|
-
|
|
344
345
|
function useTrigger() {
|
|
345
346
|
const _useFlowContext4 = (0, _FlowContext.useFlowContext)(),
|
|
346
|
-
|
|
347
|
-
|
|
347
|
+
workflow = _useFlowContext4.workflow;
|
|
348
348
|
return triggers.get(workflow.type);
|
|
349
349
|
}
|
|
@@ -4,85 +4,60 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.DateFieldsSelect = void 0;
|
|
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 _react2() {
|
|
19
15
|
const data = require("@formily/react");
|
|
20
|
-
|
|
21
16
|
_react2 = function _react2() {
|
|
22
17
|
return data;
|
|
23
18
|
};
|
|
24
|
-
|
|
25
19
|
return data;
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
function _antd() {
|
|
29
22
|
const data = require("antd");
|
|
30
|
-
|
|
31
23
|
_antd = function _antd() {
|
|
32
24
|
return data;
|
|
33
25
|
};
|
|
34
|
-
|
|
35
26
|
return data;
|
|
36
27
|
}
|
|
37
|
-
|
|
38
28
|
function _reactI18next() {
|
|
39
29
|
const data = require("react-i18next");
|
|
40
|
-
|
|
41
30
|
_reactI18next = function _reactI18next() {
|
|
42
31
|
return data;
|
|
43
32
|
};
|
|
44
|
-
|
|
45
33
|
return data;
|
|
46
34
|
}
|
|
47
|
-
|
|
48
35
|
function _client() {
|
|
49
36
|
const data = require("@nocobase/client");
|
|
50
|
-
|
|
51
37
|
_client = function _client() {
|
|
52
38
|
return data;
|
|
53
39
|
};
|
|
54
|
-
|
|
55
40
|
return data;
|
|
56
41
|
}
|
|
57
|
-
|
|
58
42
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
59
|
-
|
|
60
43
|
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; }
|
|
61
|
-
|
|
62
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; }
|
|
63
|
-
|
|
64
|
-
function
|
|
65
|
-
|
|
45
|
+
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; }
|
|
46
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
47
|
+
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); }
|
|
66
48
|
const DateFieldsSelect = (0, _react2().observer)(props => {
|
|
67
|
-
var _values$config;
|
|
68
|
-
|
|
69
49
|
const _useTranslation = (0, _reactI18next().useTranslation)(),
|
|
70
|
-
|
|
71
|
-
|
|
50
|
+
t = _useTranslation.t;
|
|
72
51
|
const compile = (0, _client().useCompile)();
|
|
73
|
-
|
|
74
52
|
const _useCollectionManager = (0, _client().useCollectionManager)(),
|
|
75
|
-
|
|
76
|
-
|
|
53
|
+
getCollectionFields = _useCollectionManager.getCollectionFields;
|
|
77
54
|
const _useForm = (0, _react2().useForm)(),
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const fields = getCollectionFields(values === null || values === void 0 ? void 0 : (_values$config = values.config) === null || _values$config === void 0 ? void 0 : _values$config.collection);
|
|
55
|
+
values = _useForm.values;
|
|
56
|
+
const fields = getCollectionFields(values === null || values === void 0 ? void 0 : values.collection);
|
|
81
57
|
return _react().default.createElement(_antd().Select, _objectSpread({
|
|
82
58
|
placeholder: t('Select Field')
|
|
83
59
|
}, props), fields.filter(field => !field.hidden && (field.uiSchema ? field.type === 'date' : false)).map(field => {
|
|
84
60
|
var _field$uiSchema;
|
|
85
|
-
|
|
86
61
|
return _react().default.createElement(_antd().Select.Option, {
|
|
87
62
|
key: field.name,
|
|
88
63
|
value: field.name
|
|
@@ -4,60 +4,43 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.EndsByField = EndsByField;
|
|
7
|
-
|
|
8
7
|
function _css() {
|
|
9
8
|
const data = require("@emotion/css");
|
|
10
|
-
|
|
11
9
|
_css = function _css() {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
function _antd() {
|
|
19
15
|
const data = require("antd");
|
|
20
|
-
|
|
21
16
|
_antd = function _antd() {
|
|
22
17
|
return data;
|
|
23
18
|
};
|
|
24
|
-
|
|
25
19
|
return data;
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
function _moment() {
|
|
29
22
|
const data = _interopRequireDefault(require("moment"));
|
|
30
|
-
|
|
31
23
|
_moment = function _moment() {
|
|
32
24
|
return data;
|
|
33
25
|
};
|
|
34
|
-
|
|
35
26
|
return data;
|
|
36
27
|
}
|
|
37
|
-
|
|
38
28
|
function _react() {
|
|
39
29
|
const data = _interopRequireDefault(require("react"));
|
|
40
|
-
|
|
41
30
|
_react = function _react() {
|
|
42
31
|
return data;
|
|
43
32
|
};
|
|
44
|
-
|
|
45
33
|
return data;
|
|
46
34
|
}
|
|
47
|
-
|
|
48
35
|
var _locale = require("../../locale");
|
|
49
|
-
|
|
50
36
|
var _OnField = require("./OnField");
|
|
51
|
-
|
|
52
37
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
53
|
-
|
|
54
38
|
function EndsByField({
|
|
55
39
|
value,
|
|
56
40
|
onChange: _onChange
|
|
57
41
|
}) {
|
|
58
42
|
const _useWorkflowTranslati = (0, _locale.useWorkflowTranslation)(),
|
|
59
|
-
|
|
60
|
-
|
|
43
|
+
t = _useWorkflowTranslati.t;
|
|
61
44
|
const type = value != null ? typeof value === 'object' && !(value instanceof Date) ? 'field' : 'date' : null;
|
|
62
45
|
return _react().default.createElement("fieldset", {
|
|
63
46
|
className: (0, _css().css)`
|