@nocobase/plugin-workflow 0.9.1-alpha.2 → 0.9.2-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -98,7 +98,7 @@ declare const _default: {
98
98
  }[];
99
99
  render(data: any): JSX.Element;
100
100
  scope: {
101
- renderReference: (key: string) => JSX.Element;
101
+ renderEngineReference: (key: string) => JSX.Element;
102
102
  useWorkflowVariableOptions: typeof useWorkflowVariableOptions;
103
103
  };
104
104
  components: {
@@ -5,109 +5,76 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Calculation = Calculation;
7
7
  exports.default = exports.calculators = void 0;
8
-
9
8
  function _react() {
10
9
  const data = _interopRequireDefault(require("react"));
11
-
12
10
  _react = function _react() {
13
11
  return data;
14
12
  };
15
-
16
13
  return data;
17
14
  }
18
-
19
15
  function _css() {
20
16
  const data = require("@emotion/css");
21
-
22
17
  _css = function _css() {
23
18
  return data;
24
19
  };
25
-
26
20
  return data;
27
21
  }
28
-
29
22
  function _antd() {
30
23
  const data = require("antd");
31
-
32
24
  _antd = function _antd() {
33
25
  return data;
34
26
  };
35
-
36
27
  return data;
37
28
  }
38
-
39
29
  function _icons() {
40
30
  const data = require("@ant-design/icons");
41
-
42
31
  _icons = function _icons() {
43
32
  return data;
44
33
  };
45
-
46
34
  return data;
47
35
  }
48
-
49
36
  function _reactI18next() {
50
37
  const data = require("react-i18next");
51
-
52
38
  _reactI18next = function _reactI18next() {
53
39
  return data;
54
40
  };
55
-
56
41
  return data;
57
42
  }
58
-
59
43
  function _client() {
60
44
  const data = require("@nocobase/utils/client");
61
-
62
45
  _client = function _client() {
63
46
  return data;
64
47
  };
65
-
66
48
  return data;
67
49
  }
68
-
69
50
  function _client2() {
70
51
  const data = require("@nocobase/client");
71
-
72
52
  _client2 = function _client2() {
73
53
  return data;
74
54
  };
75
-
76
55
  return data;
77
56
  }
78
-
79
57
  function _client3() {
80
58
  const data = require("@nocobase/evaluators/client");
81
-
82
59
  _client3 = function _client3() {
83
60
  return data;
84
61
  };
85
-
86
62
  return data;
87
63
  }
88
-
89
64
  var _ = require(".");
90
-
91
65
  var _Branch = require("../Branch");
92
-
93
66
  var _FlowContext = require("../FlowContext");
94
-
95
67
  var _style = require("../style");
96
-
97
68
  var _locale = require("../locale");
98
-
99
69
  var _variable = require("../variable");
100
-
101
70
  var _RadioWithTooltip = require("../components/RadioWithTooltip");
102
-
71
+ var _renderEngineReference = require("../components/renderEngineReference");
103
72
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
104
-
105
73
  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; }
106
-
107
74
  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; }
108
-
109
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
110
-
75
+ 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; }
76
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
77
+ 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); }
111
78
  const calculators = new (_client().Registry)();
112
79
  exports.calculators = calculators;
113
80
  calculators.register('equal', {
@@ -213,11 +180,9 @@ const calculatorGroups = [{
213
180
  value: 'date',
214
181
  title: `{{t("Date", { ns: "${_locale.NAMESPACE}" })}}`
215
182
  }];
216
-
217
183
  function getGroupCalculators(group) {
218
184
  return Array.from(calculators.getEntities()).filter(([key, value]) => value.group === group);
219
185
  }
220
-
221
186
  function Calculation({
222
187
  calculator,
223
188
  operands = [],
@@ -238,7 +203,8 @@ function Calculation({
238
203
  calculator,
239
204
  operands: [v, operands[1]]
240
205
  }),
241
- scope: options
206
+ scope: options,
207
+ useTypedConstant: true
242
208
  }), _react().default.createElement(_antd().Select, {
243
209
  value: calculator,
244
210
  onChange: v => _onChange({
@@ -260,10 +226,10 @@ function Calculation({
260
226
  calculator,
261
227
  operands: [operands[0], v]
262
228
  }),
263
- scope: options
229
+ scope: options,
230
+ useTypedConstant: true
264
231
  }));
265
232
  }
266
-
267
233
  function CalculationItem({
268
234
  value,
269
235
  onChange: _onChange2,
@@ -272,10 +238,9 @@ function CalculationItem({
272
238
  if (!value) {
273
239
  return null;
274
240
  }
275
-
276
241
  const calculator = value.calculator,
277
- _value$operands = value.operands,
278
- operands = _value$operands === void 0 ? [] : _value$operands;
242
+ _value$operands = value.operands,
243
+ operands = _value$operands === void 0 ? [] : _value$operands;
279
244
  return _react().default.createElement("div", {
280
245
  className: (0, _css().css)`
281
246
  display: flex;
@@ -297,19 +262,16 @@ function CalculationItem({
297
262
  icon: _react().default.createElement(_icons().CloseCircleOutlined, null)
298
263
  }));
299
264
  }
300
-
301
265
  function CalculationGroup({
302
266
  value,
303
267
  onChange: _onChange3
304
268
  }) {
305
269
  const _useTranslation = (0, _reactI18next().useTranslation)(),
306
- t = _useTranslation.t;
307
-
270
+ t = _useTranslation.t;
308
271
  const _value$type = value.type,
309
- type = _value$type === void 0 ? 'and' : _value$type,
310
- _value$calculations = value.calculations,
311
- calculations = _value$calculations === void 0 ? [] : _value$calculations;
312
-
272
+ type = _value$type === void 0 ? 'and' : _value$type,
273
+ _value$calculations = value.calculations,
274
+ calculations = _value$calculations === void 0 ? [] : _value$calculations;
313
275
  function onAddSingle() {
314
276
  _onChange3(_objectSpread(_objectSpread({}, value), {}, {
315
277
  calculations: [...calculations, {
@@ -318,7 +280,6 @@ function CalculationGroup({
318
280
  }]
319
281
  }));
320
282
  }
321
-
322
283
  function onAddGroup() {
323
284
  _onChange3(_objectSpread(_objectSpread({}, value), {}, {
324
285
  calculations: [...calculations, {
@@ -330,23 +291,18 @@ function CalculationGroup({
330
291
  }]
331
292
  }));
332
293
  }
333
-
334
294
  function _onRemove(i) {
335
295
  calculations.splice(i, 1);
336
-
337
296
  _onChange3(_objectSpread(_objectSpread({}, value), {}, {
338
297
  calculations: [...calculations]
339
298
  }));
340
299
  }
341
-
342
300
  function onItemChange(i, v) {
343
301
  calculations.splice(i, 1, v);
344
-
345
302
  _onChange3(_objectSpread(_objectSpread({}, value), {}, {
346
303
  calculations: [...calculations]
347
304
  }));
348
305
  }
349
-
350
306
  return _react().default.createElement("div", {
351
307
  className: (0, _css().cx)('node-type-condition-group', (0, _css().css)`
352
308
  position: relative;
@@ -403,7 +359,6 @@ function CalculationGroup({
403
359
  onClick: onAddGroup
404
360
  }, t('Add condition group'))));
405
361
  }
406
-
407
362
  function CalculationConfig({
408
363
  value,
409
364
  onChange: _onChange4
@@ -421,7 +376,6 @@ function CalculationConfig({
421
376
  }))
422
377
  });
423
378
  }
424
-
425
379
  var _default = {
426
380
  title: `{{t("Condition", { ns: "${_locale.NAMESPACE}" })}}`,
427
381
  type: 'condition',
@@ -481,17 +435,13 @@ var _default = {
481
435
  'x-component-props': {
482
436
  scope: '{{useWorkflowVariableOptions}}'
483
437
  },
484
-
485
438
  ['x-validator'](value, rules, {
486
439
  form
487
440
  }) {
488
441
  const values = form.values;
489
-
490
442
  const _evaluators$get = _client3().evaluators.get(values.engine),
491
- evaluate = _evaluators$get.evaluate;
492
-
493
- const exp = value.trim().replace(/{{([^{}]+)}}/g, '1');
494
-
443
+ evaluate = _evaluators$get.evaluate;
444
+ const exp = value.trim().replace(/{{([^{}]+)}}/g, ' 1 ');
495
445
  try {
496
446
  evaluate(exp);
497
447
  return '';
@@ -499,7 +449,6 @@ var _default = {
499
449
  return (0, _locale.lang)('Expression syntax error');
500
450
  }
501
451
  },
502
-
503
452
  'x-reactions': {
504
453
  dependencies: ['engine'],
505
454
  fulfill: {
@@ -507,7 +456,7 @@ var _default = {
507
456
  visible: '{{$deps[0] !== "basic"}}'
508
457
  },
509
458
  schema: {
510
- description: '{{renderReference($deps[0])}}'
459
+ description: '{{renderEngineReference($deps[0])}}'
511
460
  }
512
461
  }
513
462
  },
@@ -528,16 +477,13 @@ var _default = {
528
477
  rejectOnFalse: false
529
478
  }
530
479
  }],
531
-
532
480
  render(data) {
533
481
  const _useTranslation2 = (0, _reactI18next().useTranslation)(),
534
- t = _useTranslation2.t;
535
-
482
+ t = _useTranslation2.t;
536
483
  const _useFlowContext = (0, _FlowContext.useFlowContext)(),
537
- nodes = _useFlowContext.nodes;
538
-
484
+ nodes = _useFlowContext.nodes;
539
485
  const id = data.id,
540
- rejectOnFalse = data.config.rejectOnFalse;
486
+ rejectOnFalse = data.config.rejectOnFalse;
541
487
  const trueEntry = nodes.find(item => item.upstreamId === id && item.branchIndex === 1);
542
488
  const falseEntry = nodes.find(item => item.upstreamId === id && item.branchIndex === 0);
543
489
  return _react().default.createElement(_.NodeDefaultView, {
@@ -581,9 +527,8 @@ var _default = {
581
527
  className: (0, _css().css)`left: 4em;`
582
528
  }, t('Yes')))));
583
529
  },
584
-
585
530
  scope: {
586
- renderReference: _client3().renderReference,
531
+ renderEngineReference: _renderEngineReference.renderEngineReference,
587
532
  useWorkflowVariableOptions: _variable.useWorkflowVariableOptions
588
533
  },
589
534
  components: {
@@ -16,16 +16,41 @@ declare const _default: {
16
16
  placeholder: string;
17
17
  };
18
18
  };
19
- 'params.values': {
19
+ params: {
20
20
  type: string;
21
- title: string;
22
- 'x-decorator': string;
23
- 'x-decorator-props': {
24
- labelAlign: string;
25
- className: string;
21
+ properties: {
22
+ values: {
23
+ type: string;
24
+ title: string;
25
+ 'x-decorator': string;
26
+ 'x-decorator-props': {
27
+ labelAlign: string;
28
+ className: string;
29
+ };
30
+ 'x-component': string;
31
+ description: string;
32
+ };
33
+ appends: {
34
+ type: string;
35
+ title: string;
36
+ description: string;
37
+ 'x-decorator': string;
38
+ 'x-component': string;
39
+ 'x-component-props': {
40
+ mode: string;
41
+ placeholder: string;
42
+ filter(field: any): boolean;
43
+ };
44
+ 'x-reactions': {
45
+ dependencies: string[];
46
+ fulfill: {
47
+ state: {
48
+ visible: string;
49
+ };
50
+ };
51
+ }[];
52
+ };
26
53
  };
27
- 'x-component': string;
28
- description: string;
29
54
  };
30
55
  };
31
56
  view: {};
@@ -34,8 +59,9 @@ declare const _default: {
34
59
  };
35
60
  components: {
36
61
  CollectionFieldset: import("react").MemoExoticComponent<import("react").FunctionComponent<Pick<any, string | number | symbol>>>;
62
+ FieldsSelect: import("react").MemoExoticComponent<import("react").FunctionComponent<Pick<any, string | number | symbol>>>;
37
63
  };
38
- getOptions(config: any, types: any): any;
64
+ getOptions(config: any, types: any): import("../variable").VariableOption[];
39
65
  useInitializers(node: any): SchemaInitializerItemOptions | null;
40
66
  initializers: {
41
67
  CollectionFieldInitializers: typeof CollectionFieldInitializers;
@@ -4,31 +4,21 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
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
  var _collection = require("../schemas/collection");
19
-
20
15
  var _CollectionFieldset = _interopRequireDefault(require("../components/CollectionFieldset"));
21
-
22
16
  var _locale = require("../locale");
23
-
24
17
  var _CollectionBlockInitializer = require("../components/CollectionBlockInitializer");
25
-
26
18
  var _CollectionFieldInitializers = require("../components/CollectionFieldInitializers");
27
-
28
19
  var _variable = require("../variable");
29
-
20
+ var _FieldsSelect = require("../components/FieldsSelect");
30
21
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
-
32
22
  var _default = {
33
23
  title: `{{t("Create record", { ns: "${_locale.NAMESPACE}" })}}`,
34
24
  type: 'create',
@@ -45,30 +35,35 @@ var _default = {
45
35
  // disabled: true
46
36
  // }
47
37
  // },
48
- 'params.values': _collection.values
38
+ params: {
39
+ type: 'object',
40
+ properties: {
41
+ values: _collection.values,
42
+ appends: _collection.appends
43
+ }
44
+ }
49
45
  },
50
46
  view: {},
51
47
  scope: {
52
48
  useCollectionDataSource: _client().useCollectionDataSource
53
49
  },
54
50
  components: {
55
- CollectionFieldset: _CollectionFieldset.default
51
+ CollectionFieldset: _CollectionFieldset.default,
52
+ FieldsSelect: _FieldsSelect.FieldsSelect
56
53
  },
57
-
58
54
  getOptions(config, types) {
55
+ var _config$params, _config$params$append;
59
56
  return (0, _variable.useCollectionFieldOptions)({
60
57
  collection: config.collection,
61
- types
58
+ types,
59
+ depth: ((_config$params = config.params) === null || _config$params === void 0 ? void 0 : (_config$params$append = _config$params.appends) === null || _config$params$append === void 0 ? void 0 : _config$params$append.length) ? 1 : 0
62
60
  });
63
61
  },
64
-
65
62
  useInitializers(node) {
66
63
  var _node$title;
67
-
68
64
  if (!node.config.collection) {
69
65
  return null;
70
66
  }
71
-
72
67
  return {
73
68
  type: 'item',
74
69
  title: (_node$title = node.title) !== null && _node$title !== void 0 ? _node$title : `#${node.id}`,
@@ -77,7 +72,6 @@ var _default = {
77
72
  dataSource: `{{$jobsMapByNodeId.${node.id}}}`
78
73
  };
79
74
  },
80
-
81
75
  initializers: {
82
76
  CollectionFieldInitializers: _CollectionFieldInitializers.CollectionFieldInitializers
83
77
  }
@@ -17,14 +17,12 @@ declare const _default: {
17
17
  title: string;
18
18
  'x-decorator': string;
19
19
  'x-component': string;
20
- 'x-component-props': {
21
- placeholder: string;
22
- };
23
20
  enum: {
24
21
  label: string;
25
22
  value: number;
26
23
  }[];
27
24
  required: boolean;
25
+ default: number;
28
26
  };
29
27
  };
30
28
  view: {};
@@ -4,15 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _Duration = _interopRequireDefault(require("../components/Duration"));
9
-
10
8
  var _constants = require("../constants");
11
-
12
9
  var _locale = require("../locale");
13
-
14
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
11
  var _default = {
17
12
  title: `{{t("Delay", { ns: "${_locale.NAMESPACE}" })}}`,
18
13
  type: 'delay',
@@ -30,10 +25,7 @@ var _default = {
30
25
  type: 'number',
31
26
  title: `{{t("End Status", { ns: "${_locale.NAMESPACE}" })}}`,
32
27
  'x-decorator': 'FormItem',
33
- 'x-component': 'Select',
34
- 'x-component-props': {
35
- placeholder: `{{t("Select status", { ns: "${_locale.NAMESPACE}" })}}`
36
- },
28
+ 'x-component': 'Radio.Group',
37
29
  enum: [{
38
30
  label: `{{t("Succeed and continue", { ns: "${_locale.NAMESPACE}" })}}`,
39
31
  value: _constants.JOB_STATUS.RESOLVED
@@ -41,7 +33,8 @@ var _default = {
41
33
  label: `{{t("Fail and exit", { ns: "${_locale.NAMESPACE}" })}}`,
42
34
  value: _constants.JOB_STATUS.FAILED
43
35
  }],
44
- required: true
36
+ required: true,
37
+ default: _constants.JOB_STATUS.RESOLVED
45
38
  }
46
39
  },
47
40
  view: {},
@@ -18,17 +18,12 @@ declare const _default: {
18
18
  };
19
19
  params: {
20
20
  type: string;
21
- title: string;
22
- 'x-decorator': string;
23
21
  properties: {
24
22
  filter: {
23
+ "x-validator"(value: any): string;
25
24
  type: string;
26
25
  title: string;
27
26
  'x-decorator': string;
28
- 'x-decorator-props': {
29
- labelAlign: string;
30
- className: string;
31
- };
32
27
  'x-component': string;
33
28
  'x-component-props': {
34
29
  useProps(): {
@@ -4,21 +4,22 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
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
  var _FilterDynamicComponent = require("../components/FilterDynamicComponent");
19
-
20
15
  var _collection = require("../schemas/collection");
21
-
16
+ var _utils = require("../utils");
17
+ var _locale = require("../locale");
18
+ 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; }
19
+ 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; }
20
+ 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; }
21
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
22
+ 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); }
22
23
  var _default = {
23
24
  title: '{{t("Delete record")}}',
24
25
  type: 'destroy',
@@ -27,10 +28,12 @@ var _default = {
27
28
  collection: _collection.collection,
28
29
  params: {
29
30
  type: 'object',
30
- title: '',
31
- 'x-decorator': 'FormItem',
32
31
  properties: {
33
- filter: _collection.filter
32
+ filter: _objectSpread(_objectSpread({}, _collection.filter), {}, {
33
+ ['x-validator'](value) {
34
+ return (0, _utils.isValidFilter)(value) ? '' : `{{t("Please add at least one condition", { ns: "${_locale.NAMESPACE}" })}}`;
35
+ }
36
+ })
34
37
  }
35
38
  }
36
39
  },
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { ISchema } from '@formily/react';
3
3
  import { Registry } from '@nocobase/utils/client';
4
4
  import { SchemaInitializerItemOptions } from '@nocobase/client';
5
- import { VariableOption } from '../variable';
5
+ import { VariableOptions } from '../variable';
6
6
  export interface Instruction {
7
7
  title: string;
8
8
  type: string;
@@ -24,7 +24,7 @@ export interface Instruction {
24
24
  };
25
25
  render?(props: any): React.ReactNode;
26
26
  endding?: boolean;
27
- getOptions?(config: any, types?: any): VariableOption[] | null;
27
+ getOptions?(config: any, types?: any): VariableOptions;
28
28
  useInitializers?(node: any): SchemaInitializerItemOptions | null;
29
29
  initializers?: {
30
30
  [key: string]: any;