@nocobase/plugin-workflow 0.9.0-alpha.1 → 0.9.1-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 (136) hide show
  1. package/README.md +9 -0
  2. package/README.zh-CN.md +9 -0
  3. package/lib/client/AddButton.d.ts +1 -1
  4. package/lib/client/AddButton.js +7 -2
  5. package/lib/client/Branch.d.ts +1 -1
  6. package/lib/client/ExecutionCanvas.js +5 -10
  7. package/lib/client/WorkflowCanvas.js +11 -40
  8. package/lib/client/WorkflowProvider.js +10 -1
  9. package/lib/client/components/CollectionBlockInitializer.d.ts +7 -0
  10. package/lib/client/components/CollectionBlockInitializer.js +81 -0
  11. package/lib/client/components/CollectionFieldInitializers.d.ts +2 -0
  12. package/lib/client/components/CollectionFieldInitializers.js +89 -0
  13. package/lib/client/components/CollectionFieldset.js +21 -25
  14. package/lib/client/components/FilterDynamicComponent.d.ts +6 -0
  15. package/lib/client/components/FilterDynamicComponent.js +43 -0
  16. package/lib/client/components/NullRender.d.ts +1 -0
  17. package/lib/client/components/NullRender.js +10 -0
  18. package/lib/client/components/RadioWithTooltip.d.ts +7 -0
  19. package/lib/client/components/RadioWithTooltip.js +94 -0
  20. package/lib/client/constants.d.ts +10 -8
  21. package/lib/client/constants.js +52 -14
  22. package/lib/client/index.d.ts +0 -1
  23. package/lib/client/index.js +1 -10
  24. package/lib/client/locale/en-US.d.ts +38 -13
  25. package/lib/client/locale/en-US.js +39 -14
  26. package/lib/client/locale/index.js +12 -29
  27. package/lib/client/locale/zh-CN.d.ts +47 -20
  28. package/lib/client/locale/zh-CN.js +48 -21
  29. package/lib/client/nodes/calculation.d.ts +40 -6
  30. package/lib/client/nodes/calculation.js +171 -19
  31. package/lib/client/nodes/condition.d.ts +67 -0
  32. package/lib/client/nodes/condition.js +287 -27
  33. package/lib/client/nodes/create.d.ts +8 -6
  34. package/lib/client/nodes/create.js +27 -33
  35. package/lib/client/nodes/delay.d.ts +2 -0
  36. package/lib/client/nodes/delay.js +8 -4
  37. package/lib/client/nodes/destroy.d.ts +2 -2
  38. package/lib/client/nodes/destroy.js +2 -2
  39. package/lib/client/nodes/index.d.ts +10 -2
  40. package/lib/client/nodes/index.js +73 -27
  41. package/lib/client/nodes/manual/AssigneesSelect.d.ts +6 -0
  42. package/lib/client/nodes/manual/AssigneesSelect.js +64 -0
  43. package/lib/client/nodes/manual/ModeConfig.d.ts +5 -0
  44. package/lib/client/nodes/manual/ModeConfig.js +160 -0
  45. package/lib/client/nodes/manual/SchemaConfig.d.ts +6 -0
  46. package/lib/client/nodes/manual/SchemaConfig.js +715 -0
  47. package/lib/client/nodes/manual/WorkflowTodo.d.ts +8 -0
  48. package/lib/client/nodes/manual/WorkflowTodo.js +691 -0
  49. package/lib/client/nodes/manual/WorkflowTodoBlockInitializer.d.ts +5 -0
  50. package/lib/client/nodes/manual/WorkflowTodoBlockInitializer.js +75 -0
  51. package/lib/client/nodes/manual/index.d.ts +64 -0
  52. package/lib/client/nodes/manual/index.js +146 -0
  53. package/lib/client/nodes/parallel.d.ts +11 -5
  54. package/lib/client/nodes/parallel.js +22 -34
  55. package/lib/client/nodes/query.d.ts +9 -14
  56. package/lib/client/nodes/query.js +38 -44
  57. package/lib/client/nodes/request.d.ts +75 -33
  58. package/lib/client/nodes/request.js +124 -63
  59. package/lib/client/nodes/update.d.ts +2 -2
  60. package/lib/client/nodes/update.js +2 -2
  61. package/lib/client/schemas/collection.js +1 -1
  62. package/lib/client/schemas/executions.js +1 -1
  63. package/lib/client/schemas/workflows.js +1 -1
  64. package/lib/client/style.js +0 -4
  65. package/lib/client/triggers/collection.d.ts +7 -3
  66. package/lib/client/triggers/collection.js +39 -48
  67. package/lib/client/triggers/index.d.ts +5 -2
  68. package/lib/client/triggers/index.js +34 -12
  69. package/lib/client/triggers/schedule/index.d.ts +7 -5
  70. package/lib/client/triggers/schedule/index.js +38 -79
  71. package/lib/client/utils.d.ts +1 -0
  72. package/lib/client/utils.js +38 -0
  73. package/lib/client/variable.d.ts +21 -0
  74. package/lib/client/variable.js +147 -0
  75. package/lib/server/Plugin.d.ts +3 -3
  76. package/lib/server/Plugin.js +12 -21
  77. package/lib/server/Processor.d.ts +9 -2
  78. package/lib/server/Processor.js +39 -43
  79. package/lib/server/actions/index.js +2 -4
  80. package/lib/server/actions/workflows.d.ts +1 -0
  81. package/lib/server/actions/workflows.js +80 -23
  82. package/lib/server/collections/executions.js +5 -7
  83. package/lib/server/collections/flow_nodes.js +6 -18
  84. package/lib/server/collections/jobs.js +3 -1
  85. package/lib/server/collections/workflows.js +8 -4
  86. package/lib/server/constants.d.ts +9 -3
  87. package/lib/server/constants.js +11 -5
  88. package/lib/server/functions/index.d.ts +4 -0
  89. package/lib/server/functions/index.js +38 -0
  90. package/lib/server/index.d.ts +0 -1
  91. package/lib/server/index.js +0 -14
  92. package/lib/server/instructions/calculation.d.ts +2 -7
  93. package/lib/server/instructions/calculation.js +32 -37
  94. package/lib/server/instructions/condition.d.ts +4 -4
  95. package/lib/server/instructions/condition.js +126 -54
  96. package/lib/server/instructions/index.js +1 -1
  97. package/lib/server/instructions/manual/actions.js +101 -0
  98. package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/jobs.d.ts +2 -0
  99. package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/jobs.js +2 -1
  100. package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/users_jobs.js +10 -10
  101. package/lib/server/instructions/manual/index.d.ts +25 -0
  102. package/lib/server/instructions/manual/index.js +200 -0
  103. package/lib/server/instructions/parallel.js +11 -7
  104. package/lib/server/instructions/request.d.ts +8 -4
  105. package/lib/server/instructions/request.js +60 -94
  106. package/lib/server/migrations/20230221032941-change-request-body-type.d.ts +5 -0
  107. package/lib/server/migrations/20230221032941-change-request-body-type.js +113 -0
  108. package/lib/server/migrations/20230221071831-calculation-expression.d.ts +4 -0
  109. package/lib/server/migrations/20230221071831-calculation-expression.js +143 -0
  110. package/lib/server/migrations/20230221121203-condition-calculation.d.ts +4 -0
  111. package/lib/server/migrations/20230221121203-condition-calculation.js +126 -0
  112. package/lib/server/migrations/20230221162902-jsonb-to-json.d.ts +4 -0
  113. package/lib/server/migrations/20230221162902-jsonb-to-json.js +81 -0
  114. package/lib/server/triggers/schedule.js +11 -3
  115. package/package.json +11 -10
  116. package/lib/client/calculators.d.ts +0 -89
  117. package/lib/client/calculators.js +0 -668
  118. package/lib/client/components/CollectionFieldSelect.d.ts +0 -2
  119. package/lib/client/components/CollectionFieldSelect.js +0 -106
  120. package/lib/client/components/EjsTextArea.d.ts +0 -2
  121. package/lib/client/components/EjsTextArea.js +0 -232
  122. package/lib/server/actions/jobs.d.ts +0 -2
  123. package/lib/server/actions/jobs.js +0 -39
  124. package/lib/server/calculators/index.d.ts +0 -40
  125. package/lib/server/calculators/index.js +0 -187
  126. package/lib/server/extensions/assignees/actions.js +0 -75
  127. package/lib/server/extensions/assignees/index.d.ts +0 -2
  128. package/lib/server/extensions/assignees/index.js +0 -273
  129. package/lib/server/extensions/index.d.ts +0 -3
  130. package/lib/server/extensions/index.js +0 -13
  131. package/lib/server/instructions/prompt.d.ts +0 -19
  132. package/lib/server/instructions/prompt.js +0 -131
  133. /package/lib/server/{extensions/assignees → instructions/manual}/actions.d.ts +0 -0
  134. /package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/users.d.ts +0 -0
  135. /package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/users.js +0 -0
  136. /package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/users_jobs.d.ts +0 -0
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.WorkflowTodoBlockInitializer = WorkflowTodoBlockInitializer;
7
+
8
+ function _react() {
9
+ const data = _interopRequireDefault(require("react"));
10
+
11
+ _react = function _react() {
12
+ return data;
13
+ };
14
+
15
+ return data;
16
+ }
17
+
18
+ function _icons() {
19
+ const data = require("@ant-design/icons");
20
+
21
+ _icons = function _icons() {
22
+ return data;
23
+ };
24
+
25
+ return data;
26
+ }
27
+
28
+ function _client() {
29
+ const data = require("@nocobase/client");
30
+
31
+ _client = function _client() {
32
+ return data;
33
+ };
34
+
35
+ return data;
36
+ }
37
+
38
+ const _excluded = ["insert"];
39
+
40
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
41
+
42
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
43
+
44
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
45
+
46
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
47
+
48
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
49
+
50
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
51
+
52
+ function WorkflowTodoBlockInitializer(_ref) {
53
+ let insert = _ref.insert,
54
+ props = _objectWithoutProperties(_ref, _excluded);
55
+
56
+ return _react().default.createElement(_client().SchemaInitializer.Item, _objectSpread(_objectSpread({
57
+ icon: _react().default.createElement(_icons().TableOutlined, null)
58
+ }, props), {}, {
59
+ onClick: () => {
60
+ insert({
61
+ type: 'void',
62
+ 'x-decorator': 'WorkflowTodo.Decorator',
63
+ 'x-decorator-props': {},
64
+ 'x-component': 'CardItem',
65
+ 'x-designer': 'TableBlockDesigner',
66
+ properties: {
67
+ todos: {
68
+ type: 'void',
69
+ 'x-component': 'WorkflowTodo'
70
+ }
71
+ }
72
+ });
73
+ }
74
+ }));
75
+ }
@@ -0,0 +1,64 @@
1
+ import { SchemaInitializerItemOptions } from '@nocobase/client';
2
+ import { CollectionFieldInitializers } from '../../components/CollectionFieldInitializers';
3
+ import { SchemaConfig, SchemaConfigButton } from './SchemaConfig';
4
+ import { ModeConfig } from './ModeConfig';
5
+ import { AssigneesSelect } from './AssigneesSelect';
6
+ declare const _default: {
7
+ title: string;
8
+ type: string;
9
+ group: string;
10
+ fieldset: {
11
+ 'config.assignees': {
12
+ type: string;
13
+ name: string;
14
+ title: string;
15
+ 'x-decorator': string;
16
+ 'x-component': string;
17
+ 'x-component-props': {};
18
+ required: boolean;
19
+ default: any[];
20
+ };
21
+ 'config.mode': {
22
+ type: string;
23
+ name: string;
24
+ title: string;
25
+ 'x-decorator': string;
26
+ 'x-component': string;
27
+ default: number;
28
+ 'x-reactions': {
29
+ dependencies: string[];
30
+ fulfill: {
31
+ state: {
32
+ visible: string;
33
+ };
34
+ };
35
+ };
36
+ };
37
+ 'config.schema': {
38
+ type: string;
39
+ title: string;
40
+ 'x-decorator': string;
41
+ 'x-component': string;
42
+ properties: {
43
+ schema: {
44
+ type: string;
45
+ 'x-component': string;
46
+ };
47
+ };
48
+ };
49
+ };
50
+ view: {};
51
+ scope: {};
52
+ components: {
53
+ SchemaConfigButton: typeof SchemaConfigButton;
54
+ SchemaConfig: typeof SchemaConfig;
55
+ ModeConfig: typeof ModeConfig;
56
+ AssigneesSelect: typeof AssigneesSelect;
57
+ };
58
+ getOptions(config: any, types: any): any;
59
+ useInitializers(node: any): SchemaInitializerItemOptions | null;
60
+ initializers: {
61
+ CollectionFieldInitializers: typeof CollectionFieldInitializers;
62
+ };
63
+ };
64
+ export default _default;
@@ -0,0 +1,146 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ function _client() {
9
+ const data = require("@nocobase/client");
10
+
11
+ _client = function _client() {
12
+ return data;
13
+ };
14
+
15
+ return data;
16
+ }
17
+
18
+ var _CollectionBlockInitializer = require("../../components/CollectionBlockInitializer");
19
+
20
+ var _CollectionFieldInitializers = require("../../components/CollectionFieldInitializers");
21
+
22
+ var _variable = require("../../variable");
23
+
24
+ var _locale = require("../../locale");
25
+
26
+ var _SchemaConfig = require("./SchemaConfig");
27
+
28
+ var _ModeConfig = require("./ModeConfig");
29
+
30
+ var _AssigneesSelect = require("./AssigneesSelect");
31
+
32
+ const MULTIPLE_ASSIGNED_MODE = {
33
+ SINGLE: Symbol('single'),
34
+ ALL: Symbol('all'),
35
+ ANY: Symbol('any'),
36
+ ALL_PERCENTAGE: Symbol('all percentage'),
37
+ ANY_PERCENTAGE: Symbol('any percentage')
38
+ }; // TODO(optimize): change to register way
39
+
40
+ const initializerGroup = _client().BlockInitializers.items.find(group => group.key === 'media');
41
+
42
+ if (!initializerGroup.children.find(item => item.key === 'workflowTodos')) {
43
+ initializerGroup.children.push({
44
+ key: 'workflowTodos',
45
+ type: 'item',
46
+ title: `{{t("Workflow todos", { ns: "${_locale.NAMESPACE}" })}}`,
47
+ component: 'WorkflowTodoBlockInitializer',
48
+ icon: 'CheckSquareOutlined'
49
+ });
50
+ }
51
+
52
+ var _default = {
53
+ title: `{{t("Manual", { ns: "${_locale.NAMESPACE}" })}}`,
54
+ type: 'manual',
55
+ group: 'manual',
56
+ fieldset: {
57
+ 'config.assignees': {
58
+ type: 'array',
59
+ name: 'config.assignees',
60
+ title: `{{t("Assignees", { ns: "${_locale.NAMESPACE}" })}}`,
61
+ 'x-decorator': 'FormItem',
62
+ 'x-component': 'AssigneesSelect',
63
+ 'x-component-props': {// multiple: true,
64
+ // fieldNames: {
65
+ // label: 'nickname',
66
+ // value: 'id',
67
+ // },
68
+ // service: {
69
+ // resource: 'users'
70
+ // },
71
+ },
72
+ required: true,
73
+ default: []
74
+ },
75
+ 'config.mode': {
76
+ type: 'number',
77
+ name: 'config.mode',
78
+ title: `{{t("Mode", { ns: "${_locale.NAMESPACE}" })}}`,
79
+ 'x-decorator': 'FormItem',
80
+ 'x-component': 'ModeConfig',
81
+ default: 1,
82
+ 'x-reactions': {
83
+ dependencies: ['config.assignees'],
84
+ fulfill: {
85
+ state: {
86
+ visible: '{{$deps[0].length > 1}}'
87
+ }
88
+ }
89
+ }
90
+ },
91
+ 'config.schema': {
92
+ type: 'void',
93
+ title: `{{t("User interface", { ns: "${_locale.NAMESPACE}" })}}`,
94
+ 'x-decorator': 'FormItem',
95
+ 'x-component': 'SchemaConfigButton',
96
+ properties: {
97
+ schema: {
98
+ type: 'object',
99
+ 'x-component': 'SchemaConfig'
100
+ }
101
+ }
102
+ }
103
+ },
104
+ view: {},
105
+ scope: {},
106
+ components: {
107
+ SchemaConfigButton: _SchemaConfig.SchemaConfigButton,
108
+ SchemaConfig: _SchemaConfig.SchemaConfig,
109
+ ModeConfig: _ModeConfig.ModeConfig,
110
+ AssigneesSelect: _AssigneesSelect.AssigneesSelect
111
+ },
112
+
113
+ getOptions(config, types) {
114
+ var _config$schema$collec, _config$schema, _config$schema$collec2;
115
+
116
+ const fields = ((_config$schema$collec = (_config$schema = config.schema) === null || _config$schema === void 0 ? void 0 : (_config$schema$collec2 = _config$schema.collection) === null || _config$schema$collec2 === void 0 ? void 0 : _config$schema$collec2.fields) !== null && _config$schema$collec !== void 0 ? _config$schema$collec : []).map(field => ({
117
+ key: field.name,
118
+ value: field.name,
119
+ label: field.uiSchema.title,
120
+ title: field.uiSchema.title
121
+ }));
122
+ const filteredFields = (0, _variable.filterTypedFields)(fields, types);
123
+ return filteredFields.length ? filteredFields : null;
124
+ },
125
+
126
+ useInitializers(node) {
127
+ var _node$config$schema, _node$config$schema$c, _node$config$schema$c2, _node$title;
128
+
129
+ if (!((_node$config$schema = node.config.schema) === null || _node$config$schema === void 0 ? void 0 : (_node$config$schema$c = _node$config$schema.collection) === null || _node$config$schema$c === void 0 ? void 0 : (_node$config$schema$c2 = _node$config$schema$c.fields) === null || _node$config$schema$c2 === void 0 ? void 0 : _node$config$schema$c2.length) || node.config.mode) {
130
+ return null;
131
+ }
132
+
133
+ return {
134
+ type: 'item',
135
+ title: (_node$title = node.title) !== null && _node$title !== void 0 ? _node$title : `#${node.id}`,
136
+ component: _CollectionBlockInitializer.CollectionBlockInitializer,
137
+ collection: node.config.schema.collection,
138
+ dataSource: `{{$jobsMapByNodeId.${node.id}}}`
139
+ };
140
+ },
141
+
142
+ initializers: {
143
+ CollectionFieldInitializers: _CollectionFieldInitializers.CollectionFieldInitializers
144
+ }
145
+ };
146
+ exports.default = _default;
@@ -1,3 +1,4 @@
1
+ import { RadioWithTooltip } from "../components/RadioWithTooltip";
1
2
  declare const _default: {
2
3
  title: string;
3
4
  type: string;
@@ -9,15 +10,20 @@ declare const _default: {
9
10
  title: string;
10
11
  'x-decorator': string;
11
12
  'x-component': string;
12
- 'x-component-props': {};
13
- enum: {
14
- value: string;
15
- label: JSX.Element;
16
- }[];
13
+ 'x-component-props': {
14
+ options: {
15
+ value: string;
16
+ label: string;
17
+ tooltip: string;
18
+ }[];
19
+ };
17
20
  default: string;
18
21
  };
19
22
  };
20
23
  view: {};
21
24
  render(data: any): JSX.Element;
25
+ components: {
26
+ RadioWithTooltip: typeof RadioWithTooltip;
27
+ };
22
28
  };
23
29
  export default _default;
@@ -55,6 +55,8 @@ var _style = require("../style");
55
55
 
56
56
  var _locale = require("../locale");
57
57
 
58
+ var _RadioWithTooltip = require("../components/RadioWithTooltip");
59
+
58
60
  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); }
59
61
 
60
62
  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; }
@@ -81,39 +83,22 @@ var _default = {
81
83
  name: 'config.mode',
82
84
  title: `{{t("Mode", { ns: "${_locale.NAMESPACE}" })}}`,
83
85
  'x-decorator': 'FormItem',
84
- 'x-component': 'Radio.Group',
85
- 'x-component-props': {},
86
- enum: [{
87
- value: 'all',
88
- label: _react().default.createElement(_antd().Tooltip, {
89
- title: (0, _locale.lang)('Continue after all branches succeeded'),
90
- placement: "bottom"
91
- }, (0, _locale.lang)('All succeeded'), " ", _react().default.createElement(_icons().QuestionCircleOutlined, {
92
- style: {
93
- color: '#999'
94
- }
95
- }))
96
- }, {
97
- value: 'any',
98
- label: _react().default.createElement(_antd().Tooltip, {
99
- title: (0, _locale.lang)('Continue after any branch succeeded'),
100
- placement: "bottom"
101
- }, (0, _locale.lang)('Any succeeded'), " ", _react().default.createElement(_icons().QuestionCircleOutlined, {
102
- style: {
103
- color: '#999'
104
- }
105
- }))
106
- }, {
107
- value: 'race',
108
- label: _react().default.createElement(_antd().Tooltip, {
109
- title: (0, _locale.lang)('Continue after any branch succeeded, or exit after any branch failed'),
110
- placement: "bottom"
111
- }, (0, _locale.lang)('Any succeeded or failed'), " ", _react().default.createElement(_icons().QuestionCircleOutlined, {
112
- style: {
113
- color: '#999'
114
- }
115
- }))
116
- }],
86
+ 'x-component': 'RadioWithTooltip',
87
+ 'x-component-props': {
88
+ options: [{
89
+ value: 'all',
90
+ label: `{{t('All succeeded', { ns: "${_locale.NAMESPACE}" })}}`,
91
+ tooltip: `{{t('Continue after all branches succeeded', { ns: "${_locale.NAMESPACE}" })}}`
92
+ }, {
93
+ value: 'any',
94
+ label: `{{t('Any succeeded', { ns: "${_locale.NAMESPACE}" })}}`,
95
+ tooltip: `{{t('Continue after any branch succeeded', { ns: "${_locale.NAMESPACE}" })}}`
96
+ }, {
97
+ value: 'race',
98
+ label: `{{t('Any succeeded or failed', { ns: "${_locale.NAMESPACE}" })}}`,
99
+ tooltip: `{{t('Continue after any branch succeeded, or exit after any branch failed', { ns: "${_locale.NAMESPACE}" })}}`
100
+ }]
101
+ },
117
102
  default: 'all'
118
103
  }
119
104
  },
@@ -191,7 +176,10 @@ var _default = {
191
176
  `,
192
177
  onClick: () => setBranchCount(branchCount + 1)
193
178
  })))));
194
- }
179
+ },
195
180
 
181
+ components: {
182
+ RadioWithTooltip: _RadioWithTooltip.RadioWithTooltip
183
+ }
196
184
  };
197
185
  exports.default = _default;
@@ -1,5 +1,6 @@
1
- import { useCollectionDataSource } from '@nocobase/client';
2
- import { VariableComponent } from '../calculators';
1
+ import { SchemaInitializerItemOptions, useCollectionDataSource } from '@nocobase/client';
2
+ import { CollectionFieldInitializers } from '../components/CollectionFieldInitializers';
3
+ import { FilterDynamicComponent } from '../components/FilterDynamicComponent';
3
4
  declare const _default: {
4
5
  title: string;
5
6
  type: string;
@@ -17,16 +18,6 @@ declare const _default: {
17
18
  placeholder: string;
18
19
  };
19
20
  };
20
- 'config.multiple': {
21
- type: string;
22
- title: string;
23
- name: string;
24
- 'x-decorator': string;
25
- 'x-component': string;
26
- 'x-component-props': {
27
- disabled: boolean;
28
- };
29
- };
30
21
  'config.params': {
31
22
  type: string;
32
23
  name: string;
@@ -59,8 +50,12 @@ declare const _default: {
59
50
  useCollectionDataSource: typeof useCollectionDataSource;
60
51
  };
61
52
  components: {
62
- VariableComponent: typeof VariableComponent;
53
+ FilterDynamicComponent: typeof FilterDynamicComponent;
54
+ };
55
+ getOptions(config: any, types: any): any;
56
+ useInitializers(node: any): SchemaInitializerItemOptions | null;
57
+ initializers: {
58
+ CollectionFieldInitializers: typeof CollectionFieldInitializers;
63
59
  };
64
- getter(props: any): JSX.Element;
65
60
  };
66
61
  export default _default;
@@ -5,16 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- function _react() {
9
- const data = _interopRequireDefault(require("react"));
10
-
11
- _react = function _react() {
12
- return data;
13
- };
14
-
15
- return data;
16
- }
17
-
18
8
  function _client() {
19
9
  const data = require("@nocobase/client");
20
10
 
@@ -25,17 +15,17 @@ function _client() {
25
15
  return data;
26
16
  }
27
17
 
28
- var _FlowContext = require("../FlowContext");
18
+ var _collection = require("../schemas/collection");
29
19
 
30
- var _calculators = require("../calculators");
20
+ var _locale = require("../locale");
31
21
 
32
- var _collection = require("../schemas/collection");
22
+ var _CollectionBlockInitializer = require("../components/CollectionBlockInitializer");
33
23
 
34
- var _CollectionFieldSelect = _interopRequireDefault(require("../components/CollectionFieldSelect"));
24
+ var _CollectionFieldInitializers = require("../components/CollectionFieldInitializers");
35
25
 
36
- var _locale = require("../locale");
26
+ var _FilterDynamicComponent = require("../components/FilterDynamicComponent");
37
27
 
38
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
28
+ var _variable = require("../variable");
39
29
 
40
30
  var _default = {
41
31
  title: `{{t("Query record", { ns: "${_locale.NAMESPACE}" })}}`,
@@ -43,16 +33,16 @@ var _default = {
43
33
  group: 'collection',
44
34
  fieldset: {
45
35
  'config.collection': _collection.collection,
46
- 'config.multiple': {
47
- type: 'boolean',
48
- title: `{{t("Multiple records", { ns: "${_locale.NAMESPACE}" })}}`,
49
- name: 'config.multiple',
50
- 'x-decorator': 'FormItem',
51
- 'x-component': 'Checkbox',
52
- 'x-component-props': {
53
- disabled: true
54
- }
55
- },
36
+ // 'config.multiple': {
37
+ // type: 'boolean',
38
+ // title: `{{t("Multiple records", { ns: "${NAMESPACE}" })}}`,
39
+ // name: 'config.multiple',
40
+ // 'x-decorator': 'FormItem',
41
+ // 'x-component': 'Checkbox',
42
+ // 'x-component-props': {
43
+ // disabled: true
44
+ // }
45
+ // },
56
46
  'config.params': {
57
47
  type: 'object',
58
48
  name: 'config.params',
@@ -68,30 +58,34 @@ var _default = {
68
58
  useCollectionDataSource: _client().useCollectionDataSource
69
59
  },
70
60
  components: {
71
- VariableComponent: _calculators.VariableComponent
61
+ FilterDynamicComponent: _FilterDynamicComponent.FilterDynamicComponent
72
62
  },
73
63
 
74
- getter(props) {
75
- const _onChange = props.onChange;
64
+ getOptions(config, types) {
65
+ return (0, _variable.useCollectionFieldOptions)({
66
+ collection: config.collection,
67
+ types
68
+ });
69
+ },
76
70
 
77
- const _useFlowContext = (0, _FlowContext.useFlowContext)(),
78
- nodes = _useFlowContext.nodes;
71
+ useInitializers(node) {
72
+ var _node$title;
79
73
 
80
- const _useOperandContext = (0, _calculators.useOperandContext)(),
81
- options = _useOperandContext.options;
74
+ if (!node.config.collection) {
75
+ return null;
76
+ }
82
77
 
83
- const _nodes$find = nodes.find(n => n.id == options.nodeId),
84
- config = _nodes$find.config;
78
+ return {
79
+ type: 'item',
80
+ title: (_node$title = node.title) !== null && _node$title !== void 0 ? _node$title : `#${node.id}`,
81
+ component: _CollectionBlockInitializer.CollectionBlockInitializer,
82
+ collection: node.config.collection,
83
+ dataSource: `{{$jobsMapByNodeId.${node.id}}}`
84
+ };
85
+ },
85
86
 
86
- const value = options === null || options === void 0 ? void 0 : options.path;
87
- return _react().default.createElement(_CollectionFieldSelect.default, {
88
- collection: config.collection,
89
- value: value,
90
- onChange: path => {
91
- _onChange(`{{$jobsMapByNodeId.${options.nodeId}.${path}}}`);
92
- }
93
- });
87
+ initializers: {
88
+ CollectionFieldInitializers: _CollectionFieldInitializers.CollectionFieldInitializers
94
89
  }
95
-
96
90
  };
97
91
  exports.default = _default;