@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
@@ -4,75 +4,48 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  function _react() {
9
8
  const data = _interopRequireWildcard(require("react"));
10
-
11
9
  _react = function _react() {
12
10
  return data;
13
11
  };
14
-
15
12
  return data;
16
13
  }
17
-
18
14
  function _css() {
19
15
  const data = require("@emotion/css");
20
-
21
16
  _css = function _css() {
22
17
  return data;
23
18
  };
24
-
25
19
  return data;
26
20
  }
27
-
28
21
  function _icons() {
29
22
  const data = require("@ant-design/icons");
30
-
31
23
  _icons = function _icons() {
32
24
  return data;
33
25
  };
34
-
35
26
  return data;
36
27
  }
37
-
38
28
  function _antd() {
39
29
  const data = require("antd");
40
-
41
30
  _antd = function _antd() {
42
31
  return data;
43
32
  };
44
-
45
33
  return data;
46
34
  }
47
-
48
35
  var _2 = require(".");
49
-
50
36
  var _Branch = require("../Branch");
51
-
52
37
  var _FlowContext = require("../FlowContext");
53
-
54
38
  var _style = require("../style");
55
-
56
39
  var _locale = require("../locale");
57
-
58
40
  var _RadioWithTooltip = require("../components/RadioWithTooltip");
59
-
60
41
  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); }
61
-
62
42
  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; }
63
-
64
43
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
65
-
66
44
  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."); }
67
-
68
45
  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); }
69
-
70
46
  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; }
71
-
72
- 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; }
73
-
47
+ 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; } }
74
48
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
75
-
76
49
  var _default = {
77
50
  title: `{{t("Parallel branch", { ns: "${_locale.NAMESPACE}" })}}`,
78
51
  type: 'parallel',
@@ -102,28 +75,22 @@ var _default = {
102
75
  }
103
76
  },
104
77
  view: {},
105
-
106
78
  render(data) {
107
79
  const id = data.id,
108
- mode = data.config.mode;
109
-
80
+ mode = data.config.mode;
110
81
  const _useFlowContext = (0, _FlowContext.useFlowContext)(),
111
- workflow = _useFlowContext.workflow,
112
- nodes = _useFlowContext.nodes;
113
-
82
+ workflow = _useFlowContext.workflow,
83
+ nodes = _useFlowContext.nodes;
114
84
  const branches = nodes.reduce((result, node) => {
115
85
  if (node.upstreamId === id && node.branchIndex != null) {
116
86
  return result.concat(node);
117
87
  }
118
-
119
88
  return result;
120
89
  }, []).sort((a, b) => a.branchIndex - b.branchIndex);
121
-
122
90
  const _useState = (0, _react().useState)(Math.max(2, branches.length)),
123
- _useState2 = _slicedToArray(_useState, 2),
124
- branchCount = _useState2[0],
125
- setBranchCount = _useState2[1];
126
-
91
+ _useState2 = _slicedToArray(_useState, 2),
92
+ branchCount = _useState2[0],
93
+ setBranchCount = _useState2[1];
127
94
  const tempBranches = Array(Math.max(0, branchCount - branches.length)).fill(null);
128
95
  const lastBranchHead = branches[branches.length - 1];
129
96
  return _react().default.createElement(_2.NodeDefaultView, {
@@ -182,7 +149,6 @@ var _default = {
182
149
  disabled: workflow.executed
183
150
  })))));
184
151
  },
185
-
186
152
  components: {
187
153
  RadioWithTooltip: _RadioWithTooltip.RadioWithTooltip
188
154
  }
@@ -19,17 +19,11 @@ declare const _default: {
19
19
  };
20
20
  params: {
21
21
  type: string;
22
- title: string;
23
- 'x-decorator': string;
24
22
  properties: {
25
23
  filter: {
26
24
  type: string;
27
25
  title: string;
28
26
  'x-decorator': string;
29
- 'x-decorator-props': {
30
- labelAlign: string;
31
- className: string;
32
- };
33
27
  'x-component': string;
34
28
  'x-component-props': {
35
29
  useProps(): {
@@ -39,8 +33,34 @@ declare const _default: {
39
33
  dynamicComponent: string;
40
34
  };
41
35
  };
36
+ appends: {
37
+ type: string;
38
+ title: string;
39
+ description: string;
40
+ 'x-decorator': string;
41
+ 'x-component': string;
42
+ 'x-component-props': {
43
+ mode: string;
44
+ placeholder: string;
45
+ filter(field: any): boolean;
46
+ };
47
+ 'x-reactions': {
48
+ dependencies: string[];
49
+ fulfill: {
50
+ state: {
51
+ visible: string;
52
+ };
53
+ };
54
+ }[];
55
+ };
42
56
  };
43
57
  };
58
+ failOnEmpty: {
59
+ type: string;
60
+ title: string;
61
+ 'x-decorator': string;
62
+ 'x-component': string;
63
+ };
44
64
  };
45
65
  view: {};
46
66
  scope: {
@@ -48,8 +68,9 @@ declare const _default: {
48
68
  };
49
69
  components: {
50
70
  FilterDynamicComponent: typeof FilterDynamicComponent;
71
+ FieldsSelect: import("react").MemoExoticComponent<import("react").FunctionComponent<Pick<any, string | number | symbol>>>;
51
72
  };
52
- getOptions(config: any, types: any): any;
73
+ getOptions(config: any, types: any): import("../variable").VariableOption[];
53
74
  useInitializers(node: any): SchemaInitializerItemOptions | null;
54
75
  initializers: {
55
76
  CollectionFieldInitializers: typeof CollectionFieldInitializers;
@@ -4,39 +4,29 @@ 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 _locale = require("../locale");
21
-
22
16
  var _CollectionBlockInitializer = require("../components/CollectionBlockInitializer");
23
-
24
17
  var _CollectionFieldInitializers = require("../components/CollectionFieldInitializers");
25
-
26
18
  var _FilterDynamicComponent = require("../components/FilterDynamicComponent");
27
-
28
19
  var _variable = require("../variable");
29
-
20
+ var _FieldsSelect = require("../components/FieldsSelect");
30
21
  var _default = {
31
22
  title: `{{t("Query record", { ns: "${_locale.NAMESPACE}" })}}`,
32
23
  type: 'query',
33
24
  group: 'collection',
34
25
  fieldset: {
35
26
  collection: _collection.collection,
36
- // 'config.multiple': {
27
+ // multiple: {
37
28
  // type: 'boolean',
38
29
  // title: `{{t("Multiple records", { ns: "${NAMESPACE}" })}}`,
39
- // name: 'config.multiple',
40
30
  // 'x-decorator': 'FormItem',
41
31
  // 'x-component': 'Checkbox',
42
32
  // 'x-component-props': {
@@ -45,11 +35,16 @@ var _default = {
45
35
  // },
46
36
  params: {
47
37
  type: 'object',
48
- title: '',
49
- 'x-decorator': 'FormItem',
50
38
  properties: {
51
- filter: _collection.filter
39
+ filter: _collection.filter,
40
+ appends: _collection.appends
52
41
  }
42
+ },
43
+ failOnEmpty: {
44
+ type: 'boolean',
45
+ title: `{{t("Fail on no data", { ns: "${_locale.NAMESPACE}" })}}`,
46
+ 'x-decorator': 'FormItem',
47
+ 'x-component': 'Checkbox'
53
48
  }
54
49
  },
55
50
  view: {},
@@ -57,23 +52,22 @@ var _default = {
57
52
  useCollectionDataSource: _client().useCollectionDataSource
58
53
  },
59
54
  components: {
60
- FilterDynamicComponent: _FilterDynamicComponent.FilterDynamicComponent
55
+ FilterDynamicComponent: _FilterDynamicComponent.FilterDynamicComponent,
56
+ FieldsSelect: _FieldsSelect.FieldsSelect
61
57
  },
62
-
63
58
  getOptions(config, types) {
59
+ var _config$params, _config$params$append;
64
60
  return (0, _variable.useCollectionFieldOptions)({
65
61
  collection: config.collection,
66
- types
62
+ types,
63
+ 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
67
64
  });
68
65
  },
69
-
70
66
  useInitializers(node) {
71
67
  var _node$title;
72
-
73
68
  if (!node.config.collection) {
74
69
  return null;
75
70
  }
76
-
77
71
  return {
78
72
  type: 'item',
79
73
  title: (_node$title = node.title) !== null && _node$title !== void 0 ? _node$title : `#${node.id}`,
@@ -82,7 +76,6 @@ var _default = {
82
76
  dataSource: `{{$jobsMapByNodeId.${node.id}}}`
83
77
  };
84
78
  },
85
-
86
79
  initializers: {
87
80
  CollectionFieldInitializers: _CollectionFieldInitializers.CollectionFieldInitializers
88
81
  }
@@ -25,12 +25,11 @@ declare const _default: {
25
25
  required: boolean;
26
26
  title: string;
27
27
  'x-decorator': string;
28
- 'x-decorator-props': {
29
- className: string;
30
- };
28
+ 'x-decorator-props': {};
31
29
  'x-component': string;
32
30
  'x-component-props': {
33
31
  placeholder: string;
32
+ className: string;
34
33
  };
35
34
  };
36
35
  headers: {
@@ -4,31 +4,22 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  function _antd() {
9
8
  const data = require("@formily/antd");
10
-
11
9
  _antd = function _antd() {
12
10
  return data;
13
11
  };
14
-
15
12
  return data;
16
13
  }
17
-
18
14
  function _css() {
19
15
  const data = require("@emotion/css");
20
-
21
16
  _css = function _css() {
22
17
  return data;
23
18
  };
24
-
25
19
  return data;
26
20
  }
27
-
28
21
  var _locale = require("../locale");
29
-
30
22
  var _variable = require("../variable");
31
-
32
23
  var _default = {
33
24
  title: `{{t("HTTP request", { ns: "${_locale.NAMESPACE}" })}}`,
34
25
  type: 'request',
@@ -67,19 +58,11 @@ var _default = {
67
58
  required: true,
68
59
  title: `{{t("URL", { ns: "${_locale.NAMESPACE}" })}}`,
69
60
  'x-decorator': 'FormItem',
70
- 'x-decorator-props': {
71
- className: (0, _css().css)`
72
- .ant-formily-item-control-content-component{
73
- .ant-input-affix-wrapper,
74
- .ant-input{
75
- width: 100%;
76
- }
77
- }
78
- `
79
- },
61
+ 'x-decorator-props': {},
80
62
  'x-component': 'Input',
81
63
  'x-component-props': {
82
- placeholder: 'https://www.nocobase.com'
64
+ placeholder: 'https://www.nocobase.com',
65
+ className: 'full-width'
83
66
  }
84
67
  },
85
68
  headers: {
@@ -185,10 +168,10 @@ var _default = {
185
168
  minRows: 10
186
169
  },
187
170
  placeholder: `{{t("Input request data", { ns: "${_locale.NAMESPACE}" })}}`,
188
- className: (0, _css().css)`
171
+ className: (0, _css().cx)('full-width', (0, _css().css)`
189
172
  font-size: 90%;
190
173
  font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
191
- `
174
+ `)
192
175
  },
193
176
  description: `{{t("Only support standard JSON data", { ns: "${_locale.NAMESPACE}" })}}`
194
177
  },
@@ -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: {
25
23
  title: string;
24
+ "x-validator"(value: any): string;
26
25
  type: 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,33 +4,24 @@ 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 _CollectionFieldset = _interopRequireDefault(require("../components/CollectionFieldset"));
21
-
16
+ var _utils = require("../utils");
22
17
  var _locale = require("../locale");
23
-
24
18
  var _collection = require("../schemas/collection");
25
-
26
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
-
28
20
  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; }
29
-
30
21
  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; }
31
-
32
- 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; }
33
-
22
+ 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; }
23
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
24
+ 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); }
34
25
  var _default = {
35
26
  title: `{{t("Update record", { ns: "${_locale.NAMESPACE}" })}}`,
36
27
  type: 'update',
@@ -39,11 +30,12 @@ var _default = {
39
30
  collection: _collection.collection,
40
31
  params: {
41
32
  type: 'object',
42
- title: '',
43
- 'x-decorator': 'FormItem',
44
33
  properties: {
45
34
  filter: _objectSpread(_objectSpread({}, _collection.filter), {}, {
46
- title: `{{t("Only update records matching conditions", { ns: "${_locale.NAMESPACE}" })}}`
35
+ title: `{{t("Only update records matching conditions", { ns: "${_locale.NAMESPACE}" })}}`,
36
+ ['x-validator'](value) {
37
+ return (0, _utils.isValidFilter)(value) ? '' : `{{t("Please add at least one condition", { ns: "${_locale.NAMESPACE}" })}}`;
38
+ }
47
39
  }),
48
40
  values: _collection.values
49
41
  }
@@ -24,10 +24,6 @@ export declare const filter: {
24
24
  type: string;
25
25
  title: string;
26
26
  'x-decorator': string;
27
- 'x-decorator-props': {
28
- labelAlign: string;
29
- className: string;
30
- };
31
27
  'x-component': string;
32
28
  'x-component-props': {
33
29
  useProps(): {
@@ -37,3 +33,23 @@ export declare const filter: {
37
33
  dynamicComponent: string;
38
34
  };
39
35
  };
36
+ export declare const appends: {
37
+ type: string;
38
+ title: string;
39
+ description: string;
40
+ 'x-decorator': string;
41
+ 'x-component': string;
42
+ 'x-component-props': {
43
+ mode: string;
44
+ placeholder: string;
45
+ filter(field: any): boolean;
46
+ };
47
+ 'x-reactions': {
48
+ dependencies: string[];
49
+ fulfill: {
50
+ state: {
51
+ visible: string;
52
+ };
53
+ };
54
+ }[];
55
+ };
@@ -3,40 +3,29 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.values = exports.filter = exports.collection = void 0;
7
-
6
+ exports.values = exports.filter = exports.collection = exports.appends = void 0;
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 _react() {
19
15
  const data = require("@formily/react");
20
-
21
16
  _react = function _react() {
22
17
  return data;
23
18
  };
24
-
25
19
  return data;
26
20
  }
27
-
28
21
  function _client() {
29
22
  const data = require("@nocobase/client");
30
-
31
23
  _client = function _client() {
32
24
  return data;
33
25
  };
34
-
35
26
  return data;
36
27
  }
37
-
38
28
  var _locale = require("../locale");
39
-
40
29
  const collection = {
41
30
  type: 'string',
42
31
  title: '{{t("Collection")}}',
@@ -67,18 +56,11 @@ const filter = {
67
56
  type: 'object',
68
57
  title: '{{t("Filter")}}',
69
58
  'x-decorator': 'FormItem',
70
- 'x-decorator-props': {
71
- labelAlign: 'left',
72
- className: (0, _css().css)`
73
- flex-direction: column;
74
- `
75
- },
76
59
  'x-component': 'Filter',
77
60
  'x-component-props': {
78
61
  useProps() {
79
62
  const _useForm = (0, _react().useForm)(),
80
- values = _useForm.values;
81
-
63
+ values = _useForm.values;
82
64
  const options = (0, _client().useCollectionFilterOptions)(values === null || values === void 0 ? void 0 : values.collection);
83
65
  return {
84
66
  options,
@@ -88,8 +70,30 @@ const filter = {
88
70
  `
89
71
  };
90
72
  },
91
-
92
73
  dynamicComponent: 'FilterDynamicComponent'
93
74
  }
94
75
  };
95
- exports.filter = filter;
76
+ exports.filter = filter;
77
+ const appends = {
78
+ type: 'array',
79
+ title: `{{t("Preload associations", { ns: "${_locale.NAMESPACE}" })}}`,
80
+ description: `{{t("Only configured association field could be accessed in following nodes", { ns: "${_locale.NAMESPACE}" })}}`,
81
+ 'x-decorator': 'FormItem',
82
+ 'x-component': 'FieldsSelect',
83
+ 'x-component-props': {
84
+ mode: 'multiple',
85
+ placeholder: '{{t("Select Field")}}',
86
+ filter(field) {
87
+ return ['linkTo', 'belongsTo', 'hasOne', 'hasMany', 'belongsToMany'].includes(field.type);
88
+ }
89
+ },
90
+ 'x-reactions': [{
91
+ dependencies: ['collection'],
92
+ fulfill: {
93
+ state: {
94
+ visible: '{{!!$deps[0]}}'
95
+ }
96
+ }
97
+ }]
98
+ };
99
+ exports.appends = appends;
@@ -4,43 +4,30 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.executionSchema = exports.executionCollection = 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 _reactRouterDom() {
19
15
  const data = require("react-router-dom");
20
-
21
16
  _reactRouterDom = function _reactRouterDom() {
22
17
  return data;
23
18
  };
24
-
25
19
  return data;
26
20
  }
27
-
28
21
  function _client() {
29
22
  const data = require("@nocobase/client");
30
-
31
23
  _client = function _client() {
32
24
  return data;
33
25
  };
34
-
35
26
  return data;
36
27
  }
37
-
38
28
  var _constants = require("../constants");
39
-
40
29
  var _locale = require("../locale");
41
-
42
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
43
-
44
31
  const executionCollection = {
45
32
  name: 'executions',
46
33
  fields: [{
@@ -62,19 +49,16 @@ const executionCollection = {
62
49
  uiSchema: {
63
50
  type: 'number',
64
51
  title: `{{t("Version", { ns: "${_locale.NAMESPACE}" })}}`,
65
-
66
52
  ['x-component']({
67
53
  value
68
54
  }) {
69
55
  const _useActionContext = (0, _client().useActionContext)(),
70
- setVisible = _useActionContext.setVisible;
71
-
56
+ setVisible = _useActionContext.setVisible;
72
57
  return _react().default.createElement(_reactRouterDom().Link, {
73
58
  to: `/admin/settings/workflow/workflows/${value}`,
74
59
  onClick: () => setVisible(false)
75
60
  }, `#${value}`);
76
61
  }
77
-
78
62
  }
79
63
  }, {
80
64
  type: 'number',
@@ -122,7 +106,8 @@ const executionSchema = {
122
106
  marginBottom: 16
123
107
  }
124
108
  },
125
- properties: {// filter: {
109
+ properties: {
110
+ // filter: {
126
111
  // type: 'object',
127
112
  // 'x-component': 'Filter',
128
113
  // }