@nocobase/plugin-workflow 0.9.1-alpha.2 → 0.9.2-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.
Files changed (131) hide show
  1. package/lib/client/AddButton.js +17 -64
  2. package/lib/client/Branch.js +0 -13
  3. package/lib/client/ExecutionCanvas.js +16 -63
  4. package/lib/client/ExecutionLink.js +3 -21
  5. package/lib/client/ExecutionPage.js +1 -19
  6. package/lib/client/ExecutionResourceProvider.js +6 -23
  7. package/lib/client/FlowContext.js +0 -8
  8. package/lib/client/WorkflowCanvas.js +56 -127
  9. package/lib/client/WorkflowLink.js +3 -21
  10. package/lib/client/WorkflowPage.js +1 -19
  11. package/lib/client/WorkflowProvider.js +24 -47
  12. package/lib/client/WorkflowShortcut.js +0 -16
  13. package/lib/client/components/CollectionBlockInitializer.js +12 -22
  14. package/lib/client/components/CollectionFieldInitializers.js +5 -24
  15. package/lib/client/components/CollectionFieldset.js +31 -79
  16. package/lib/client/components/Duration.js +0 -14
  17. package/lib/client/components/DynamicExpression.d.ts +4 -0
  18. package/lib/client/components/DynamicExpression.js +102 -0
  19. package/lib/client/components/FieldsSelect.d.ts +2 -0
  20. package/lib/client/components/FieldsSelect.js +66 -0
  21. package/lib/client/components/FilterDynamicComponent.js +1 -10
  22. package/lib/client/components/NullRender.js +0 -1
  23. package/lib/client/components/OpenDrawer.js +10 -35
  24. package/lib/client/components/RadioWithTooltip.js +5 -27
  25. package/lib/client/components/renderEngineReference.d.ts +1 -0
  26. package/lib/client/components/renderEngineReference.js +55 -0
  27. package/lib/client/constants.js +0 -9
  28. package/lib/client/index.js +0 -6
  29. package/lib/client/interfaces/expression.d.ts +3 -0
  30. package/lib/client/interfaces/expression.js +37 -0
  31. package/lib/client/locale/index.js +5 -15
  32. package/lib/client/locale/pt-BR.d.ts +130 -0
  33. package/lib/client/locale/pt-BR.js +136 -0
  34. package/lib/client/locale/zh-CN.d.ts +16 -1
  35. package/lib/client/locale/zh-CN.js +17 -2
  36. package/lib/client/nodes/calculation.d.ts +54 -3
  37. package/lib/client/nodes/calculation.js +136 -63
  38. package/lib/client/nodes/condition.d.ts +1 -1
  39. package/lib/client/nodes/condition.js +21 -76
  40. package/lib/client/nodes/create.d.ts +35 -9
  41. package/lib/client/nodes/create.js +13 -19
  42. package/lib/client/nodes/delay.d.ts +1 -3
  43. package/lib/client/nodes/delay.js +3 -10
  44. package/lib/client/nodes/destroy.d.ts +1 -6
  45. package/lib/client/nodes/destroy.js +12 -9
  46. package/lib/client/nodes/index.d.ts +2 -2
  47. package/lib/client/nodes/index.js +45 -147
  48. package/lib/client/nodes/manual/AssigneesSelect.js +6 -17
  49. package/lib/client/nodes/manual/ModeConfig.js +0 -27
  50. package/lib/client/nodes/manual/SchemaConfig.js +87 -449
  51. package/lib/client/nodes/manual/WorkflowTodo.js +99 -163
  52. package/lib/client/nodes/manual/WorkflowTodoBlockInitializer.js +4 -20
  53. package/lib/client/nodes/manual/forms/customForm.d.ts +40 -0
  54. package/lib/client/nodes/manual/forms/customForm.js +411 -0
  55. package/lib/client/nodes/manual/index.d.ts +12 -1
  56. package/lib/client/nodes/manual/index.js +54 -41
  57. package/lib/client/nodes/parallel.js +7 -41
  58. package/lib/client/nodes/query.d.ts +28 -7
  59. package/lib/client/nodes/query.js +15 -22
  60. package/lib/client/nodes/request.d.ts +2 -3
  61. package/lib/client/nodes/request.js +5 -22
  62. package/lib/client/nodes/update.d.ts +1 -6
  63. package/lib/client/nodes/update.js +8 -16
  64. package/lib/client/schemas/collection.d.ts +20 -4
  65. package/lib/client/schemas/collection.js +26 -22
  66. package/lib/client/schemas/executions.js +3 -18
  67. package/lib/client/schemas/workflows.js +10 -33
  68. package/lib/client/style.js +24 -21
  69. package/lib/client/triggers/collection.d.ts +24 -20
  70. package/lib/client/triggers/collection.js +34 -123
  71. package/lib/client/triggers/index.d.ts +2 -5
  72. package/lib/client/triggers/index.js +34 -105
  73. package/lib/client/triggers/schedule/DateFieldsSelect.js +6 -29
  74. package/lib/client/triggers/schedule/EndsByField.js +1 -18
  75. package/lib/client/triggers/schedule/OnField.js +10 -38
  76. package/lib/client/triggers/schedule/RepeatField.js +4 -32
  77. package/lib/client/triggers/schedule/ScheduleConfig.js +10 -51
  78. package/lib/client/triggers/schedule/index.d.ts +21 -0
  79. package/lib/client/triggers/schedule/index.js +21 -22
  80. package/lib/client/triggers/schedule/locale/Cron.zh-CN.js +8 -4
  81. package/lib/client/utils.d.ts +1 -0
  82. package/lib/client/utils.js +31 -10
  83. package/lib/client/variable.d.ts +7 -6
  84. package/lib/client/variable.js +132 -71
  85. package/lib/index.js +0 -2
  86. package/lib/server/Plugin.d.ts +7 -7
  87. package/lib/server/Plugin.js +76 -111
  88. package/lib/server/Processor.d.ts +2 -0
  89. package/lib/server/Processor.js +62 -125
  90. package/lib/server/actions/index.js +3 -10
  91. package/lib/server/actions/nodes.js +34 -87
  92. package/lib/server/actions/workflows.js +46 -96
  93. package/lib/server/collections/executions.js +1 -1
  94. package/lib/server/collections/flow_nodes.js +7 -4
  95. package/lib/server/collections/jobs.js +1 -1
  96. package/lib/server/collections/workflows.js +3 -4
  97. package/lib/server/fields/expression-field.d.ts +8 -0
  98. package/lib/server/fields/expression-field.js +26 -0
  99. package/lib/server/fields/index.d.ts +1 -0
  100. package/lib/server/fields/index.js +12 -0
  101. package/lib/server/functions/index.js +3 -14
  102. package/lib/server/index.js +0 -6
  103. package/lib/server/instructions/calculation.js +22 -17
  104. package/lib/server/instructions/condition.js +8 -52
  105. package/lib/server/instructions/create.js +31 -15
  106. package/lib/server/instructions/delay.js +4 -32
  107. package/lib/server/instructions/destroy.js +6 -12
  108. package/lib/server/instructions/index.js +6 -23
  109. package/lib/server/instructions/manual/actions.js +22 -31
  110. package/lib/server/instructions/manual/collecions/users_jobs.js +1 -1
  111. package/lib/server/instructions/manual/index.d.ts +13 -12
  112. package/lib/server/instructions/manual/index.js +9 -47
  113. package/lib/server/instructions/parallel.js +9 -36
  114. package/lib/server/instructions/query.js +17 -15
  115. package/lib/server/instructions/request.js +7 -30
  116. package/lib/server/instructions/update.js +8 -14
  117. package/lib/server/migrations/20221129153547-calculation-variables.js +3 -27
  118. package/lib/server/migrations/20230221032941-change-request-body-type.js +3 -26
  119. package/lib/server/migrations/20230221071831-calculation-expression.js +1 -33
  120. package/lib/server/migrations/20230221121203-condition-calculation.js +5 -28
  121. package/lib/server/migrations/20230221162902-jsonb-to-json.js +3 -18
  122. package/lib/server/migrations/20230411034722-manual-multi-form.d.ts +4 -0
  123. package/lib/server/migrations/20230411034722-manual-multi-form.js +303 -0
  124. package/lib/server/models/Execution.js +0 -5
  125. package/lib/server/models/FlowNode.js +0 -5
  126. package/lib/server/models/Job.js +0 -5
  127. package/lib/server/models/Workflow.js +0 -5
  128. package/lib/server/triggers/collection.js +39 -61
  129. package/lib/server/triggers/index.js +3 -22
  130. package/lib/server/triggers/schedule.js +72 -194
  131. package/package.json +14 -11
@@ -11,155 +11,100 @@ exports.RemoveButton = RemoveButton;
11
11
  exports.instructions = void 0;
12
12
  exports.useAvailableUpstreams = useAvailableUpstreams;
13
13
  exports.useNodeContext = useNodeContext;
14
-
15
14
  function _react() {
16
15
  const data = _interopRequireWildcard(require("react"));
17
-
18
16
  _react = function _react() {
19
17
  return data;
20
18
  };
21
-
22
19
  return data;
23
20
  }
24
-
25
21
  function _icons() {
26
22
  const data = require("@ant-design/icons");
27
-
28
23
  _icons = function _icons() {
29
24
  return data;
30
25
  };
31
-
32
26
  return data;
33
27
  }
34
-
35
28
  function _css() {
36
29
  const data = require("@emotion/css");
37
-
38
30
  _css = function _css() {
39
31
  return data;
40
32
  };
41
-
42
33
  return data;
43
34
  }
44
-
45
35
  function _react2() {
46
36
  const data = require("@formily/react");
47
-
48
37
  _react2 = function _react2() {
49
38
  return data;
50
39
  };
51
-
52
40
  return data;
53
41
  }
54
-
55
42
  function _antd() {
56
43
  const data = require("antd");
57
-
58
44
  _antd = function _antd() {
59
45
  return data;
60
46
  };
61
-
62
47
  return data;
63
48
  }
64
-
65
49
  function _reactI18next() {
66
50
  const data = require("react-i18next");
67
-
68
51
  _reactI18next = function _reactI18next() {
69
52
  return data;
70
53
  };
71
-
72
54
  return data;
73
55
  }
74
-
75
56
  function _jsonTemplates() {
76
57
  const data = _interopRequireDefault(require("json-templates"));
77
-
78
58
  _jsonTemplates = function _jsonTemplates() {
79
59
  return data;
80
60
  };
81
-
82
61
  return data;
83
62
  }
84
-
85
63
  function _client() {
86
64
  const data = require("@nocobase/utils/client");
87
-
88
65
  _client = function _client() {
89
66
  return data;
90
67
  };
91
-
92
68
  return data;
93
69
  }
94
-
95
70
  function _client2() {
96
71
  const data = require("@nocobase/client");
97
-
98
72
  _client2 = function _client2() {
99
73
  return data;
100
74
  };
101
-
102
75
  return data;
103
76
  }
104
-
105
77
  var _style = require("../style");
106
-
107
78
  var _AddButton = require("../AddButton");
108
-
109
79
  var _FlowContext = require("../FlowContext");
110
-
111
80
  var _calculation = _interopRequireDefault(require("./calculation"));
112
-
113
81
  var _condition = _interopRequireDefault(require("./condition"));
114
-
115
82
  var _parallel = _interopRequireDefault(require("./parallel"));
116
-
117
83
  var _delay = _interopRequireDefault(require("./delay"));
118
-
119
84
  var _manual = _interopRequireDefault(require("./manual"));
120
-
121
85
  var _query = _interopRequireDefault(require("./query"));
122
-
123
86
  var _create = _interopRequireDefault(require("./create"));
124
-
125
87
  var _update = _interopRequireDefault(require("./update"));
126
-
127
88
  var _destroy = _interopRequireDefault(require("./destroy"));
128
-
129
89
  var _constants = require("../constants");
130
-
131
90
  var _locale = require("../locale");
132
-
133
91
  var _request = _interopRequireDefault(require("./request"));
134
-
135
92
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
136
-
137
93
  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); }
138
-
139
94
  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; }
140
-
141
95
  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; }
142
-
143
96
  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; }
144
-
145
- 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; }
146
-
97
+ 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; }
98
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
99
+ 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); }
147
100
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
148
-
149
101
  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."); }
150
-
151
102
  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); }
152
-
153
103
  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; }
154
-
155
- 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; }
156
-
104
+ 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; } }
157
105
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
158
-
159
106
  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); } }
160
-
161
107
  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); }); }; }
162
-
163
108
  ;
164
109
  const instructions = new (_client().Registry)();
165
110
  exports.instructions = instructions;
@@ -173,31 +118,23 @@ instructions.register('create', _create.default);
173
118
  instructions.register('update', _update.default);
174
119
  instructions.register('destroy', _destroy.default);
175
120
  instructions.register('request', _request.default);
176
-
177
121
  function useUpdateAction() {
178
122
  const form = (0, _react2().useForm)();
179
123
  const api = (0, _client2().useAPIClient)();
180
124
  const ctx = (0, _client2().useActionContext)();
181
-
182
125
  const _useResourceActionCon = (0, _client2().useResourceActionContext)(),
183
- refresh = _useResourceActionCon.refresh;
184
-
126
+ refresh = _useResourceActionCon.refresh;
185
127
  const data = useNodeContext();
186
-
187
128
  const _useFlowContext = (0, _FlowContext.useFlowContext)(),
188
- workflow = _useFlowContext.workflow;
189
-
129
+ workflow = _useFlowContext.workflow;
190
130
  return {
191
131
  run() {
192
132
  return _asyncToGenerator(function* () {
193
133
  var _api$resource$update, _api$resource;
194
-
195
134
  if (workflow.executed) {
196
135
  _antd().message.error((0, _locale.lang)('Node in executed workflow cannot be modified'));
197
-
198
136
  return;
199
137
  }
200
-
201
138
  yield form.submit();
202
139
  yield (_api$resource$update = (_api$resource = api.resource('flow_nodes', data.id)).update) === null || _api$resource$update === void 0 ? void 0 : _api$resource$update.call(_api$resource, {
203
140
  filterByTk: data.id,
@@ -209,30 +146,24 @@ function useUpdateAction() {
209
146
  refresh();
210
147
  })();
211
148
  }
212
-
213
149
  };
214
150
  }
215
-
216
151
  ;
217
-
218
152
  const NodeContext = _react().default.createContext({});
219
-
220
153
  exports.NodeContext = NodeContext;
221
-
222
154
  function useNodeContext() {
223
155
  return (0, _react().useContext)(NodeContext);
224
156
  }
225
-
226
157
  function useAvailableUpstreams(node) {
227
158
  const stack = [];
228
-
159
+ if (!node) {
160
+ return [];
161
+ }
229
162
  for (let current = node.upstream; current; current = current.upstream) {
230
163
  stack.push(current);
231
164
  }
232
-
233
165
  return stack;
234
166
  }
235
-
236
167
  function Node({
237
168
  data
238
169
  }) {
@@ -264,42 +195,31 @@ function Node({
264
195
  `
265
196
  }, _react().default.createElement(_icons().CloseOutlined, null))));
266
197
  }
267
-
268
198
  function RemoveButton() {
269
199
  var _useFlowContext2;
270
-
271
200
  const _useTranslation = (0, _reactI18next().useTranslation)(),
272
- t = _useTranslation.t;
273
-
201
+ t = _useTranslation.t;
274
202
  const api = (0, _client2().useAPIClient)();
275
-
276
203
  const _ref = (_useFlowContext2 = (0, _FlowContext.useFlowContext)()) !== null && _useFlowContext2 !== void 0 ? _useFlowContext2 : {},
277
- workflow = _ref.workflow,
278
- nodes = _ref.nodes,
279
- refresh = _ref.refresh;
280
-
204
+ workflow = _ref.workflow,
205
+ nodes = _ref.nodes,
206
+ refresh = _ref.refresh;
281
207
  const current = useNodeContext();
282
-
283
208
  if (!workflow) {
284
209
  return null;
285
210
  }
286
-
287
211
  const resource = api.resource('workflows.nodes', workflow.id);
288
-
289
212
  function onRemove() {
290
213
  return _onRemove.apply(this, arguments);
291
214
  }
292
-
293
215
  function _onRemove() {
294
216
  _onRemove = _asyncToGenerator(function* () {
295
217
  function onOk() {
296
218
  return _onOk.apply(this, arguments);
297
219
  }
298
-
299
220
  function _onOk() {
300
221
  _onOk = _asyncToGenerator(function* () {
301
222
  var _resource$destroy;
302
-
303
223
  yield (_resource$destroy = resource.destroy) === null || _resource$destroy === void 0 ? void 0 : _resource$destroy.call(resource, {
304
224
  filterByTk: current.id
305
225
  });
@@ -307,19 +227,16 @@ function RemoveButton() {
307
227
  });
308
228
  return _onOk.apply(this, arguments);
309
229
  }
310
-
311
230
  const usingNodes = nodes.filter(node => {
312
231
  if (node === current) {
313
232
  return false;
314
233
  }
315
-
316
234
  const template = (0, _jsonTemplates().default)(node.config);
317
235
  const refs = template.parameters.filter(({
318
236
  key
319
237
  }) => key.startsWith(`$jobsMapByNodeId.${current.id}.`) || key === `$jobsMapByNodeId.${current.id}`);
320
238
  return refs.length;
321
239
  });
322
-
323
240
  if (usingNodes.length) {
324
241
  _antd().Modal.error({
325
242
  title: (0, _locale.lang)('Can not delete'),
@@ -327,13 +244,10 @@ function RemoveButton() {
327
244
  nodes: usingNodes.map(item => `#${item.id}`).join(', ')
328
245
  })
329
246
  });
330
-
331
247
  return;
332
248
  }
333
-
334
249
  const hasBranches = !nodes.find(item => item.upstream === current && item.branchIndex != null);
335
250
  const message = hasBranches ? t('Are you sure you want to delete it?') : (0, _locale.lang)('This node contains branches, deleting will also be preformed to them, are you sure?');
336
-
337
251
  _antd().Modal.confirm({
338
252
  title: t('Delete'),
339
253
  content: message,
@@ -342,7 +256,6 @@ function RemoveButton() {
342
256
  });
343
257
  return _onRemove.apply(this, arguments);
344
258
  }
345
-
346
259
  return workflow.executed ? null : _react().default.createElement(_antd().Button, {
347
260
  type: "text",
348
261
  shape: "circle",
@@ -351,25 +264,19 @@ function RemoveButton() {
351
264
  className: "workflow-node-remove-button"
352
265
  });
353
266
  }
354
-
355
267
  function JobButton() {
356
268
  var _useNodeContext;
357
-
358
269
  const compile = (0, _client2().useCompile)();
359
-
360
270
  const _useFlowContext3 = (0, _FlowContext.useFlowContext)(),
361
- execution = _useFlowContext3.execution;
362
-
271
+ execution = _useFlowContext3.execution;
363
272
  const _ref2 = (_useNodeContext = useNodeContext()) !== null && _useNodeContext !== void 0 ? _useNodeContext : {},
364
- id = _ref2.id,
365
- type = _ref2.type,
366
- title = _ref2.title,
367
- job = _ref2.job;
368
-
273
+ id = _ref2.id,
274
+ type = _ref2.type,
275
+ title = _ref2.title,
276
+ job = _ref2.job;
369
277
  if (!execution) {
370
278
  return null;
371
279
  }
372
-
373
280
  if (!job) {
374
281
  return _react().default.createElement("span", {
375
282
  className: (0, _css().cx)('workflow-node-job-button', (0, _css().css)`
@@ -379,12 +286,11 @@ function JobButton() {
379
286
  `)
380
287
  });
381
288
  }
382
-
383
289
  const instruction = instructions.get(type);
384
290
  const _JobStatusOptionsMap$ = _constants.JobStatusOptionsMap[job.status],
385
- value = _JobStatusOptionsMap$.value,
386
- icon = _JobStatusOptionsMap$.icon,
387
- color = _JobStatusOptionsMap$.color;
291
+ value = _JobStatusOptionsMap$.value,
292
+ icon = _JobStatusOptionsMap$.icon,
293
+ color = _JobStatusOptionsMap$.color;
388
294
  return _react().default.createElement(_client2().SchemaComponent, {
389
295
  schema: {
390
296
  type: 'void',
@@ -460,48 +366,37 @@ function JobButton() {
460
366
  }
461
367
  });
462
368
  }
463
-
464
369
  function NodeDefaultView(props) {
465
370
  var _useFlowContext4, _data$title;
466
-
467
371
  const data = props.data,
468
- children = props.children;
372
+ children = props.children;
469
373
  const compile = (0, _client2().useCompile)();
470
374
  const api = (0, _client2().useAPIClient)();
471
-
472
375
  const _ref3 = (_useFlowContext4 = (0, _FlowContext.useFlowContext)()) !== null && _useFlowContext4 !== void 0 ? _useFlowContext4 : {},
473
- workflow = _ref3.workflow,
474
- refresh = _ref3.refresh;
475
-
376
+ workflow = _ref3.workflow,
377
+ refresh = _ref3.refresh;
476
378
  const instruction = instructions.get(data.type);
477
379
  const detailText = workflow.executed ? '{{t("View")}}' : '{{t("Configure")}}';
478
380
  const typeTitle = compile(instruction.title);
479
-
480
381
  const _useState = (0, _react().useState)((_data$title = data.title) !== null && _data$title !== void 0 ? _data$title : typeTitle),
481
- _useState2 = _slicedToArray(_useState, 2),
482
- editingTitle = _useState2[0],
483
- setEditingTitle = _useState2[1];
484
-
382
+ _useState2 = _slicedToArray(_useState, 2),
383
+ editingTitle = _useState2[0],
384
+ setEditingTitle = _useState2[1];
485
385
  const _useState3 = (0, _react().useState)(false),
486
- _useState4 = _slicedToArray(_useState3, 2),
487
- editingConfig = _useState4[0],
488
- setEditingConfig = _useState4[1];
489
-
490
- function onChangeTitle(_x) {
386
+ _useState4 = _slicedToArray(_useState3, 2),
387
+ editingConfig = _useState4[0],
388
+ setEditingConfig = _useState4[1];
389
+ function onChangeTitle(_x2) {
491
390
  return _onChangeTitle.apply(this, arguments);
492
391
  }
493
-
494
392
  function _onChangeTitle() {
495
393
  _onChangeTitle = _asyncToGenerator(function* (next) {
496
394
  var _api$resource$update2, _api$resource2;
497
-
498
395
  const title = next || typeTitle;
499
396
  setEditingTitle(title);
500
-
501
397
  if (title === data.title) {
502
398
  return;
503
399
  }
504
-
505
400
  yield (_api$resource$update2 = (_api$resource2 = api.resource('flow_nodes')).update) === null || _api$resource$update2 === void 0 ? void 0 : _api$resource$update2.call(_api$resource2, {
506
401
  filterByTk: data.id,
507
402
  values: {
@@ -512,15 +407,12 @@ function NodeDefaultView(props) {
512
407
  });
513
408
  return _onChangeTitle.apply(this, arguments);
514
409
  }
515
-
516
410
  function onOpenDrawer(ev) {
517
411
  if (ev.target === ev.currentTarget) {
518
412
  setEditingConfig(true);
519
413
  return;
520
414
  }
521
-
522
415
  const whiteSet = new Set(['workflow-node-meta', 'workflow-node-config-button', 'ant-input-disabled']);
523
-
524
416
  for (let el = ev.target; el && el !== ev.currentTarget; el = el.parentNode) {
525
417
  if (Array.from(el.classList).some(name => whiteSet.has(name))) {
526
418
  setEditingConfig(true);
@@ -529,7 +421,6 @@ function NodeDefaultView(props) {
529
421
  }
530
422
  }
531
423
  }
532
-
533
424
  return _react().default.createElement("div", {
534
425
  className: (0, _css().cx)(_style.nodeClass, `workflow-node-type-${data.type}`)
535
426
  }, _react().default.createElement("div", {
@@ -576,18 +467,15 @@ function NodeDefaultView(props) {
576
467
  'x-decorator': 'Form',
577
468
  'x-decorator-props': {
578
469
  disabled: workflow.executed,
579
-
580
470
  useValues(options) {
581
471
  const _useNodeContext2 = useNodeContext(),
582
- config = _useNodeContext2.config;
583
-
472
+ config = _useNodeContext2.config;
584
473
  return (0, _client2().useRequest)(() => {
585
474
  return Promise.resolve({
586
475
  data: config
587
476
  });
588
477
  }, options);
589
478
  }
590
-
591
479
  },
592
480
  properties: _objectSpread(_objectSpread({}, workflow.executed ? {
593
481
  alert: {
@@ -610,14 +498,24 @@ function NodeDefaultView(props) {
610
498
  'x-component': 'fieldset',
611
499
  'x-component-props': {
612
500
  className: (0, _css().css)`
613
- .ant-input,
614
501
  .ant-select,
615
502
  .ant-cascader-picker,
616
503
  .ant-picker,
617
504
  .ant-input-number,
618
505
  .ant-input-affix-wrapper{
619
- width: auto;
620
- min-width: 6em;
506
+ &:not(.full-width){
507
+ width: auto;
508
+ min-width: 6em;
509
+ }
510
+ }
511
+
512
+ .ant-input-affix-wrapper{
513
+ &:not(.full-width){
514
+ .ant-input{
515
+ width: auto;
516
+ min-width: 6em;
517
+ }
518
+ }
621
519
  }
622
520
  `
623
521
  },
@@ -4,46 +4,35 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.AssigneesSelect = AssigneesSelect;
7
-
8
7
  function _client() {
9
8
  const data = require("@nocobase/client");
10
-
11
9
  _client = function _client() {
12
10
  return data;
13
11
  };
14
-
15
12
  return data;
16
13
  }
17
-
18
14
  function _react() {
19
15
  const data = _interopRequireDefault(require("react"));
20
-
21
16
  _react = function _react() {
22
17
  return data;
23
18
  };
24
-
25
19
  return data;
26
20
  }
27
-
28
21
  var _variable = require("../../variable");
29
-
30
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
-
32
23
  function AssigneesSelect({
33
24
  multiple = false,
34
25
  value = [],
35
26
  onChange: _onChange
36
27
  }) {
37
- const scope = (0, _variable.useWorkflowVariableOptions)();
38
- console.log(value);
28
+ const scope = (0, _variable.useWorkflowVariableOptions)([{
29
+ type: 'reference',
30
+ options: {
31
+ collection: 'users'
32
+ }
33
+ }]);
39
34
  return _react().default.createElement(_client().Variable.Input, {
40
35
  scope: scope,
41
- types: [{
42
- type: 'reference',
43
- options: {
44
- collection: 'users'
45
- }
46
- }],
47
36
  value: value[0],
48
37
  onChange: next => {
49
38
  _onChange([next]);
@@ -4,91 +4,65 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ModeConfig = ModeConfig;
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 _antd() {
19
15
  const data = require("@formily/antd");
20
-
21
16
  _antd = function _antd() {
22
17
  return data;
23
18
  };
24
-
25
19
  return data;
26
20
  }
27
-
28
21
  function _antd2() {
29
22
  const data = require("antd");
30
-
31
23
  _antd2 = function _antd2() {
32
24
  return data;
33
25
  };
34
-
35
26
  return data;
36
27
  }
37
-
38
28
  function _icons() {
39
29
  const data = require("@ant-design/icons");
40
-
41
30
  _icons = function _icons() {
42
31
  return data;
43
32
  };
44
-
45
33
  return data;
46
34
  }
47
-
48
35
  function _css() {
49
36
  const data = require("@emotion/css");
50
-
51
37
  _css = function _css() {
52
38
  return data;
53
39
  };
54
-
55
40
  return data;
56
41
  }
57
-
58
42
  function _client() {
59
43
  const data = require("@nocobase/client");
60
-
61
44
  _client = function _client() {
62
45
  return data;
63
46
  };
64
-
65
47
  return data;
66
48
  }
67
-
68
49
  var _locale = require("../../locale");
69
-
70
50
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
71
-
72
51
  function parseMode(v) {
73
52
  if (!v) {
74
53
  return 'single';
75
54
  }
76
-
77
55
  if (v >= 1) {
78
56
  return 'all';
79
57
  }
80
-
81
58
  if (v <= -1) {
82
59
  return 'any';
83
60
  }
84
-
85
61
  const dir = Math.sign(v);
86
-
87
62
  if (dir > 0) {
88
63
  return '';
89
64
  }
90
65
  }
91
-
92
66
  function ModeConfig({
93
67
  value,
94
68
  onChange: _onChange
@@ -110,7 +84,6 @@ function ModeConfig({
110
84
  }
111
85
  }) => {
112
86
  console.log(v);
113
-
114
87
  _onChange(Number(v));
115
88
  }
116
89
  }, _react().default.createElement(_antd2().Radio, {