@nocobase/plugin-workflow 0.9.0-alpha.2 → 0.9.1-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 (138) 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 +43 -27
  5. package/lib/client/Branch.d.ts +1 -1
  6. package/lib/client/ExecutionCanvas.js +5 -10
  7. package/lib/client/WorkflowCanvas.js +12 -42
  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 +25 -33
  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 +18 -18
  25. package/lib/client/locale/en-US.js +19 -19
  26. package/lib/client/locale/zh-CN.d.ts +47 -20
  27. package/lib/client/locale/zh-CN.js +48 -21
  28. package/lib/client/nodes/calculation.d.ts +39 -7
  29. package/lib/client/nodes/calculation.js +165 -19
  30. package/lib/client/nodes/condition.d.ts +67 -4
  31. package/lib/client/nodes/condition.js +283 -31
  32. package/lib/client/nodes/create.d.ts +10 -10
  33. package/lib/client/nodes/create.js +28 -42
  34. package/lib/client/nodes/delay.d.ts +4 -4
  35. package/lib/client/nodes/delay.js +10 -8
  36. package/lib/client/nodes/destroy.d.ts +4 -7
  37. package/lib/client/nodes/destroy.js +4 -5
  38. package/lib/client/nodes/index.d.ts +10 -2
  39. package/lib/client/nodes/index.js +217 -110
  40. package/lib/client/nodes/manual/AssigneesSelect.d.ts +6 -0
  41. package/lib/client/nodes/manual/AssigneesSelect.js +65 -0
  42. package/lib/client/nodes/manual/ModeConfig.d.ts +5 -0
  43. package/lib/client/nodes/manual/ModeConfig.js +160 -0
  44. package/lib/client/nodes/manual/SchemaConfig.d.ts +6 -0
  45. package/lib/client/nodes/manual/SchemaConfig.js +715 -0
  46. package/lib/client/nodes/manual/WorkflowTodo.d.ts +8 -0
  47. package/lib/client/nodes/manual/WorkflowTodo.js +691 -0
  48. package/lib/client/nodes/manual/WorkflowTodoBlockInitializer.d.ts +5 -0
  49. package/lib/client/nodes/manual/WorkflowTodoBlockInitializer.js +75 -0
  50. package/lib/client/nodes/manual/index.d.ts +62 -0
  51. package/lib/client/nodes/manual/index.js +137 -0
  52. package/lib/client/nodes/parallel.d.ts +12 -7
  53. package/lib/client/nodes/parallel.js +32 -39
  54. package/lib/client/nodes/query.d.ts +11 -19
  55. package/lib/client/nodes/query.js +40 -47
  56. package/lib/client/nodes/request.d.ts +77 -42
  57. package/lib/client/nodes/request.js +123 -69
  58. package/lib/client/nodes/update.d.ts +33 -29
  59. package/lib/client/nodes/update.js +14 -7
  60. package/lib/client/schemas/collection.d.ts +0 -3
  61. package/lib/client/schemas/collection.js +2 -7
  62. package/lib/client/schemas/executions.js +1 -1
  63. package/lib/client/schemas/workflows.js +1 -1
  64. package/lib/client/style.js +51 -9
  65. package/lib/client/triggers/collection.d.ts +44 -15
  66. package/lib/client/triggers/collection.js +104 -82
  67. package/lib/client/triggers/index.d.ts +6 -3
  68. package/lib/client/triggers/index.js +167 -74
  69. package/lib/client/triggers/schedule/DateFieldsSelect.js +1 -3
  70. package/lib/client/triggers/schedule/ScheduleConfig.js +15 -17
  71. package/lib/client/triggers/schedule/index.d.ts +7 -6
  72. package/lib/client/triggers/schedule/index.js +39 -81
  73. package/lib/client/utils.d.ts +1 -0
  74. package/lib/client/utils.js +38 -0
  75. package/lib/client/variable.d.ts +21 -0
  76. package/lib/client/variable.js +147 -0
  77. package/lib/server/Plugin.d.ts +3 -3
  78. package/lib/server/Plugin.js +12 -21
  79. package/lib/server/Processor.d.ts +9 -2
  80. package/lib/server/Processor.js +33 -33
  81. package/lib/server/actions/index.js +2 -4
  82. package/lib/server/actions/workflows.d.ts +1 -0
  83. package/lib/server/actions/workflows.js +80 -23
  84. package/lib/server/collections/executions.js +5 -7
  85. package/lib/server/collections/flow_nodes.js +6 -18
  86. package/lib/server/collections/jobs.js +3 -1
  87. package/lib/server/collections/workflows.js +8 -4
  88. package/lib/server/constants.d.ts +9 -3
  89. package/lib/server/constants.js +11 -5
  90. package/lib/server/functions/index.d.ts +4 -0
  91. package/lib/server/functions/index.js +38 -0
  92. package/lib/server/index.d.ts +0 -1
  93. package/lib/server/index.js +0 -14
  94. package/lib/server/instructions/calculation.d.ts +2 -7
  95. package/lib/server/instructions/calculation.js +32 -37
  96. package/lib/server/instructions/condition.d.ts +4 -4
  97. package/lib/server/instructions/condition.js +126 -54
  98. package/lib/server/instructions/index.js +1 -1
  99. package/lib/server/instructions/manual/actions.js +101 -0
  100. package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/jobs.d.ts +2 -0
  101. package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/jobs.js +2 -1
  102. package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/users_jobs.js +10 -10
  103. package/lib/server/instructions/manual/index.d.ts +25 -0
  104. package/lib/server/instructions/manual/index.js +200 -0
  105. package/lib/server/instructions/parallel.js +11 -7
  106. package/lib/server/instructions/request.d.ts +5 -4
  107. package/lib/server/instructions/request.js +60 -79
  108. package/lib/server/migrations/20230221032941-change-request-body-type.d.ts +5 -0
  109. package/lib/server/migrations/20230221032941-change-request-body-type.js +113 -0
  110. package/lib/server/migrations/20230221071831-calculation-expression.d.ts +4 -0
  111. package/lib/server/migrations/20230221071831-calculation-expression.js +143 -0
  112. package/lib/server/migrations/20230221121203-condition-calculation.d.ts +4 -0
  113. package/lib/server/migrations/20230221121203-condition-calculation.js +126 -0
  114. package/lib/server/migrations/20230221162902-jsonb-to-json.d.ts +4 -0
  115. package/lib/server/migrations/20230221162902-jsonb-to-json.js +81 -0
  116. package/lib/server/triggers/schedule.js +11 -3
  117. package/package.json +10 -10
  118. package/lib/client/calculators.d.ts +0 -89
  119. package/lib/client/calculators.js +0 -668
  120. package/lib/client/components/CollectionFieldSelect.d.ts +0 -2
  121. package/lib/client/components/CollectionFieldSelect.js +0 -106
  122. package/lib/client/components/EjsTextArea.d.ts +0 -2
  123. package/lib/client/components/EjsTextArea.js +0 -232
  124. package/lib/server/actions/jobs.d.ts +0 -2
  125. package/lib/server/actions/jobs.js +0 -39
  126. package/lib/server/calculators/index.d.ts +0 -40
  127. package/lib/server/calculators/index.js +0 -187
  128. package/lib/server/extensions/assignees/actions.js +0 -75
  129. package/lib/server/extensions/assignees/index.d.ts +0 -2
  130. package/lib/server/extensions/assignees/index.js +0 -273
  131. package/lib/server/extensions/index.d.ts +0 -3
  132. package/lib/server/extensions/index.js +0 -13
  133. package/lib/server/instructions/prompt.d.ts +0 -19
  134. package/lib/server/instructions/prompt.js +0 -131
  135. /package/lib/server/{extensions/assignees → instructions/manual}/actions.d.ts +0 -0
  136. /package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/users.d.ts +0 -0
  137. /package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/users.js +0 -0
  138. /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,62 @@
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
+ assignees: {
12
+ type: string;
13
+ title: string;
14
+ 'x-decorator': string;
15
+ 'x-component': string;
16
+ 'x-component-props': {};
17
+ required: boolean;
18
+ default: any[];
19
+ };
20
+ mode: {
21
+ type: string;
22
+ title: string;
23
+ 'x-decorator': string;
24
+ 'x-component': string;
25
+ default: number;
26
+ 'x-reactions': {
27
+ dependencies: string[];
28
+ fulfill: {
29
+ state: {
30
+ visible: string;
31
+ };
32
+ };
33
+ };
34
+ };
35
+ schema: {
36
+ type: string;
37
+ title: string;
38
+ 'x-decorator': string;
39
+ 'x-component': string;
40
+ properties: {
41
+ schema: {
42
+ type: string;
43
+ 'x-component': string;
44
+ };
45
+ };
46
+ };
47
+ };
48
+ view: {};
49
+ scope: {};
50
+ components: {
51
+ SchemaConfigButton: typeof SchemaConfigButton;
52
+ SchemaConfig: typeof SchemaConfig;
53
+ ModeConfig: typeof ModeConfig;
54
+ AssigneesSelect: typeof AssigneesSelect;
55
+ };
56
+ getOptions(config: any, types: any): any;
57
+ useInitializers(node: any): SchemaInitializerItemOptions | null;
58
+ initializers: {
59
+ CollectionFieldInitializers: typeof CollectionFieldInitializers;
60
+ };
61
+ };
62
+ export default _default;
@@ -0,0 +1,137 @@
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
+ assignees: {
58
+ type: 'array',
59
+ title: `{{t("Assignees", { ns: "${_locale.NAMESPACE}" })}}`,
60
+ 'x-decorator': 'FormItem',
61
+ 'x-component': 'AssigneesSelect',
62
+ 'x-component-props': {// multiple: true,
63
+ },
64
+ required: true,
65
+ default: []
66
+ },
67
+ mode: {
68
+ type: 'number',
69
+ title: `{{t("Mode", { ns: "${_locale.NAMESPACE}" })}}`,
70
+ 'x-decorator': 'FormItem',
71
+ 'x-component': 'ModeConfig',
72
+ default: 1,
73
+ 'x-reactions': {
74
+ dependencies: ['assignees'],
75
+ fulfill: {
76
+ state: {
77
+ visible: '{{$deps[0].length > 1}}'
78
+ }
79
+ }
80
+ }
81
+ },
82
+ schema: {
83
+ type: 'void',
84
+ title: `{{t("User interface", { ns: "${_locale.NAMESPACE}" })}}`,
85
+ 'x-decorator': 'FormItem',
86
+ 'x-component': 'SchemaConfigButton',
87
+ properties: {
88
+ schema: {
89
+ type: 'object',
90
+ 'x-component': 'SchemaConfig'
91
+ }
92
+ }
93
+ }
94
+ },
95
+ view: {},
96
+ scope: {},
97
+ components: {
98
+ SchemaConfigButton: _SchemaConfig.SchemaConfigButton,
99
+ SchemaConfig: _SchemaConfig.SchemaConfig,
100
+ ModeConfig: _ModeConfig.ModeConfig,
101
+ AssigneesSelect: _AssigneesSelect.AssigneesSelect
102
+ },
103
+
104
+ getOptions(config, types) {
105
+ var _config$schema$collec, _config$schema, _config$schema$collec2;
106
+
107
+ 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 => ({
108
+ key: field.name,
109
+ value: field.name,
110
+ label: field.uiSchema.title,
111
+ title: field.uiSchema.title
112
+ }));
113
+ const filteredFields = (0, _variable.filterTypedFields)(fields, types);
114
+ return filteredFields.length ? filteredFields : null;
115
+ },
116
+
117
+ useInitializers(node) {
118
+ var _node$config$schema, _node$config$schema$c, _node$config$schema$c2, _node$title;
119
+
120
+ 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) {
121
+ return null;
122
+ }
123
+
124
+ return {
125
+ type: 'item',
126
+ title: (_node$title = node.title) !== null && _node$title !== void 0 ? _node$title : `#${node.id}`,
127
+ component: _CollectionBlockInitializer.CollectionBlockInitializer,
128
+ collection: node.config.schema.collection,
129
+ dataSource: `{{$jobsMapByNodeId.${node.id}}}`
130
+ };
131
+ },
132
+
133
+ initializers: {
134
+ CollectionFieldInitializers: _CollectionFieldInitializers.CollectionFieldInitializers
135
+ }
136
+ };
137
+ exports.default = _default;
@@ -1,23 +1,28 @@
1
+ import { RadioWithTooltip } from "../components/RadioWithTooltip";
1
2
  declare const _default: {
2
3
  title: string;
3
4
  type: string;
4
5
  group: string;
5
6
  fieldset: {
6
- 'config.mode': {
7
+ mode: {
7
8
  type: string;
8
- name: string;
9
9
  title: string;
10
10
  'x-decorator': string;
11
11
  'x-component': string;
12
- 'x-component-props': {};
13
- enum: {
14
- value: string;
15
- label: JSX.Element;
16
- }[];
12
+ 'x-component-props': {
13
+ options: {
14
+ value: string;
15
+ label: string;
16
+ tooltip: string;
17
+ }[];
18
+ };
17
19
  default: string;
18
20
  };
19
21
  };
20
22
  view: {};
21
23
  render(data: any): JSX.Element;
24
+ components: {
25
+ RadioWithTooltip: typeof RadioWithTooltip;
26
+ };
22
27
  };
23
28
  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; }
@@ -76,44 +78,26 @@ var _default = {
76
78
  type: 'parallel',
77
79
  group: 'control',
78
80
  fieldset: {
79
- 'config.mode': {
81
+ mode: {
80
82
  type: 'string',
81
- name: 'config.mode',
82
83
  title: `{{t("Mode", { ns: "${_locale.NAMESPACE}" })}}`,
83
84
  '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
- }],
85
+ 'x-component': 'RadioWithTooltip',
86
+ 'x-component-props': {
87
+ options: [{
88
+ value: 'all',
89
+ label: `{{t('All succeeded', { ns: "${_locale.NAMESPACE}" })}}`,
90
+ tooltip: `{{t('Continue after all branches succeeded', { ns: "${_locale.NAMESPACE}" })}}`
91
+ }, {
92
+ value: 'any',
93
+ label: `{{t('Any succeeded', { ns: "${_locale.NAMESPACE}" })}}`,
94
+ tooltip: `{{t('Continue after any branch succeeded', { ns: "${_locale.NAMESPACE}" })}}`
95
+ }, {
96
+ value: 'race',
97
+ label: `{{t('Any succeeded or failed', { ns: "${_locale.NAMESPACE}" })}}`,
98
+ tooltip: `{{t('Continue after any branch succeeded, or exit after any branch failed', { ns: "${_locale.NAMESPACE}" })}}`
99
+ }]
100
+ },
117
101
  default: 'all'
118
102
  }
119
103
  },
@@ -124,6 +108,7 @@ var _default = {
124
108
  mode = data.config.mode;
125
109
 
126
110
  const _useFlowContext = (0, _FlowContext.useFlowContext)(),
111
+ workflow = _useFlowContext.workflow,
127
112
  nodes = _useFlowContext.nodes;
128
113
 
129
114
  const branches = nodes.reduce((result, node) => {
@@ -169,7 +154,8 @@ var _default = {
169
154
  }, _react().default.createElement(_antd().Button, {
170
155
  shape: "circle",
171
156
  icon: _react().default.createElement(_icons().PlusOutlined, null),
172
- onClick: () => setBranchCount(branchCount - 1)
157
+ onClick: () => setBranchCount(branchCount - 1),
158
+ disabled: workflow.executed
173
159
  })) : null
174
160
  }))), _react().default.createElement("div", {
175
161
  className: (0, _css().css)`
@@ -177,7 +163,10 @@ var _default = {
177
163
  height: 2em;
178
164
  `
179
165
  }, _react().default.createElement(_antd().Tooltip, {
180
- title: (0, _locale.lang)('Add branch')
166
+ title: (0, _locale.lang)('Add branch'),
167
+ className: (0, _css().css)`
168
+ visibility: ${workflow.executed ? 'hidden' : 'visible'}
169
+ `
181
170
  }, _react().default.createElement(_antd().Button, {
182
171
  icon: _react().default.createElement(_icons().PlusOutlined, null),
183
172
  className: (0, _css().css)`
@@ -189,9 +178,13 @@ var _default = {
189
178
  transform: rotate(-45deg);
190
179
  }
191
180
  `,
192
- onClick: () => setBranchCount(branchCount + 1)
181
+ onClick: () => setBranchCount(branchCount + 1),
182
+ disabled: workflow.executed
193
183
  })))));
194
- }
184
+ },
195
185
 
186
+ components: {
187
+ RadioWithTooltip: _RadioWithTooltip.RadioWithTooltip
188
+ }
196
189
  };
197
190
  exports.default = _default;
@@ -1,14 +1,14 @@
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;
6
7
  group: string;
7
8
  fieldset: {
8
- 'config.collection': {
9
+ collection: {
9
10
  type: string;
10
11
  title: string;
11
- name: string;
12
12
  required: boolean;
13
13
  'x-reactions': string[];
14
14
  'x-decorator': string;
@@ -17,26 +17,14 @@ declare const _default: {
17
17
  placeholder: string;
18
18
  };
19
19
  };
20
- 'config.multiple': {
20
+ params: {
21
21
  type: string;
22
22
  title: string;
23
- name: string;
24
- 'x-decorator': string;
25
- 'x-component': string;
26
- 'x-component-props': {
27
- disabled: boolean;
28
- };
29
- };
30
- 'config.params': {
31
- type: string;
32
- name: string;
33
- title: string;
34
23
  'x-decorator': string;
35
24
  properties: {
36
25
  filter: {
37
26
  type: string;
38
27
  title: string;
39
- name: string;
40
28
  'x-decorator': string;
41
29
  'x-decorator-props': {
42
30
  labelAlign: string;
@@ -59,8 +47,12 @@ declare const _default: {
59
47
  useCollectionDataSource: typeof useCollectionDataSource;
60
48
  };
61
49
  components: {
62
- VariableComponent: typeof VariableComponent;
50
+ FilterDynamicComponent: typeof FilterDynamicComponent;
51
+ };
52
+ getOptions(config: any, types: any): any;
53
+ useInitializers(node: any): SchemaInitializerItemOptions | null;
54
+ initializers: {
55
+ CollectionFieldInitializers: typeof CollectionFieldInitializers;
63
56
  };
64
- getter(props: any): JSX.Element;
65
57
  };
66
58
  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,37 +15,36 @@ 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}" })}}`,
42
32
  type: 'query',
43
33
  group: 'collection',
44
34
  fieldset: {
45
- '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
- },
56
- 'config.params': {
35
+ collection: _collection.collection,
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
+ // },
46
+ params: {
57
47
  type: 'object',
58
- name: 'config.params',
59
48
  title: '',
60
49
  'x-decorator': 'FormItem',
61
50
  properties: {
@@ -68,30 +57,34 @@ var _default = {
68
57
  useCollectionDataSource: _client().useCollectionDataSource
69
58
  },
70
59
  components: {
71
- VariableComponent: _calculators.VariableComponent
60
+ FilterDynamicComponent: _FilterDynamicComponent.FilterDynamicComponent
72
61
  },
73
62
 
74
- getter(props) {
75
- const _onChange = props.onChange;
63
+ getOptions(config, types) {
64
+ return (0, _variable.useCollectionFieldOptions)({
65
+ collection: config.collection,
66
+ types
67
+ });
68
+ },
76
69
 
77
- const _useFlowContext = (0, _FlowContext.useFlowContext)(),
78
- nodes = _useFlowContext.nodes;
70
+ useInitializers(node) {
71
+ var _node$title;
79
72
 
80
- const _useOperandContext = (0, _calculators.useOperandContext)(),
81
- options = _useOperandContext.options;
73
+ if (!node.config.collection) {
74
+ return null;
75
+ }
82
76
 
83
- const _nodes$find = nodes.find(n => n.id == options.nodeId),
84
- config = _nodes$find.config;
77
+ return {
78
+ type: 'item',
79
+ title: (_node$title = node.title) !== null && _node$title !== void 0 ? _node$title : `#${node.id}`,
80
+ component: _CollectionBlockInitializer.CollectionBlockInitializer,
81
+ collection: node.config.collection,
82
+ dataSource: `{{$jobsMapByNodeId.${node.id}}}`
83
+ };
84
+ },
85
85
 
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
- });
86
+ initializers: {
87
+ CollectionFieldInitializers: _CollectionFieldInitializers.CollectionFieldInitializers
94
88
  }
95
-
96
89
  };
97
90
  exports.default = _default;