@nocobase/plugin-workflow 0.9.0-alpha.2 → 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 (135) 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 +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 +40 -6
  29. package/lib/client/nodes/calculation.js +171 -19
  30. package/lib/client/nodes/condition.d.ts +67 -0
  31. package/lib/client/nodes/condition.js +287 -27
  32. package/lib/client/nodes/create.d.ts +8 -6
  33. package/lib/client/nodes/create.js +27 -33
  34. package/lib/client/nodes/delay.d.ts +2 -0
  35. package/lib/client/nodes/delay.js +8 -4
  36. package/lib/client/nodes/destroy.d.ts +2 -2
  37. package/lib/client/nodes/destroy.js +2 -2
  38. package/lib/client/nodes/index.d.ts +10 -2
  39. package/lib/client/nodes/index.js +73 -27
  40. package/lib/client/nodes/manual/AssigneesSelect.d.ts +6 -0
  41. package/lib/client/nodes/manual/AssigneesSelect.js +64 -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 +64 -0
  51. package/lib/client/nodes/manual/index.js +146 -0
  52. package/lib/client/nodes/parallel.d.ts +11 -5
  53. package/lib/client/nodes/parallel.js +22 -34
  54. package/lib/client/nodes/query.d.ts +9 -14
  55. package/lib/client/nodes/query.js +38 -44
  56. package/lib/client/nodes/request.d.ts +75 -33
  57. package/lib/client/nodes/request.js +124 -63
  58. package/lib/client/nodes/update.d.ts +2 -2
  59. package/lib/client/nodes/update.js +2 -2
  60. package/lib/client/schemas/collection.js +1 -1
  61. package/lib/client/schemas/executions.js +1 -1
  62. package/lib/client/schemas/workflows.js +1 -1
  63. package/lib/client/style.js +0 -4
  64. package/lib/client/triggers/collection.d.ts +7 -3
  65. package/lib/client/triggers/collection.js +39 -48
  66. package/lib/client/triggers/index.d.ts +5 -2
  67. package/lib/client/triggers/index.js +34 -12
  68. package/lib/client/triggers/schedule/index.d.ts +7 -5
  69. package/lib/client/triggers/schedule/index.js +38 -79
  70. package/lib/client/utils.d.ts +1 -0
  71. package/lib/client/utils.js +38 -0
  72. package/lib/client/variable.d.ts +21 -0
  73. package/lib/client/variable.js +147 -0
  74. package/lib/server/Plugin.d.ts +3 -3
  75. package/lib/server/Plugin.js +12 -21
  76. package/lib/server/Processor.d.ts +9 -2
  77. package/lib/server/Processor.js +33 -33
  78. package/lib/server/actions/index.js +2 -4
  79. package/lib/server/actions/workflows.d.ts +1 -0
  80. package/lib/server/actions/workflows.js +80 -23
  81. package/lib/server/collections/executions.js +5 -7
  82. package/lib/server/collections/flow_nodes.js +6 -18
  83. package/lib/server/collections/jobs.js +3 -1
  84. package/lib/server/collections/workflows.js +8 -4
  85. package/lib/server/constants.d.ts +9 -3
  86. package/lib/server/constants.js +11 -5
  87. package/lib/server/functions/index.d.ts +4 -0
  88. package/lib/server/functions/index.js +38 -0
  89. package/lib/server/index.d.ts +0 -1
  90. package/lib/server/index.js +0 -14
  91. package/lib/server/instructions/calculation.d.ts +2 -7
  92. package/lib/server/instructions/calculation.js +32 -37
  93. package/lib/server/instructions/condition.d.ts +4 -4
  94. package/lib/server/instructions/condition.js +126 -54
  95. package/lib/server/instructions/index.js +1 -1
  96. package/lib/server/instructions/manual/actions.js +101 -0
  97. package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/jobs.d.ts +2 -0
  98. package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/jobs.js +2 -1
  99. package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/users_jobs.js +10 -10
  100. package/lib/server/instructions/manual/index.d.ts +25 -0
  101. package/lib/server/instructions/manual/index.js +200 -0
  102. package/lib/server/instructions/parallel.js +11 -7
  103. package/lib/server/instructions/request.d.ts +5 -4
  104. package/lib/server/instructions/request.js +60 -79
  105. package/lib/server/migrations/20230221032941-change-request-body-type.d.ts +5 -0
  106. package/lib/server/migrations/20230221032941-change-request-body-type.js +113 -0
  107. package/lib/server/migrations/20230221071831-calculation-expression.d.ts +4 -0
  108. package/lib/server/migrations/20230221071831-calculation-expression.js +143 -0
  109. package/lib/server/migrations/20230221121203-condition-calculation.d.ts +4 -0
  110. package/lib/server/migrations/20230221121203-condition-calculation.js +126 -0
  111. package/lib/server/migrations/20230221162902-jsonb-to-json.d.ts +4 -0
  112. package/lib/server/migrations/20230221162902-jsonb-to-json.js +81 -0
  113. package/lib/server/triggers/schedule.js +11 -3
  114. package/package.json +10 -10
  115. package/lib/client/calculators.d.ts +0 -89
  116. package/lib/client/calculators.js +0 -668
  117. package/lib/client/components/CollectionFieldSelect.d.ts +0 -2
  118. package/lib/client/components/CollectionFieldSelect.js +0 -106
  119. package/lib/client/components/EjsTextArea.d.ts +0 -2
  120. package/lib/client/components/EjsTextArea.js +0 -232
  121. package/lib/server/actions/jobs.d.ts +0 -2
  122. package/lib/server/actions/jobs.js +0 -39
  123. package/lib/server/calculators/index.d.ts +0 -40
  124. package/lib/server/calculators/index.js +0 -187
  125. package/lib/server/extensions/assignees/actions.js +0 -75
  126. package/lib/server/extensions/assignees/index.d.ts +0 -2
  127. package/lib/server/extensions/assignees/index.js +0 -273
  128. package/lib/server/extensions/index.d.ts +0 -3
  129. package/lib/server/extensions/index.js +0 -13
  130. package/lib/server/instructions/prompt.d.ts +0 -19
  131. package/lib/server/instructions/prompt.js +0 -131
  132. /package/lib/server/{extensions/assignees → instructions/manual}/actions.d.ts +0 -0
  133. /package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/users.d.ts +0 -0
  134. /package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/users.js +0 -0
  135. /package/lib/server/{extensions/assignees/collections → instructions/manual/collecions}/users_jobs.d.ts +0 -0
@@ -1,39 +1,38 @@
1
- import React from 'react';
2
- import EjsTextArea from '../components/EjsTextArea';
1
+ import { useWorkflowVariableOptions } from '../variable';
3
2
  declare const _default: {
4
3
  title: string;
5
4
  type: string;
6
5
  group: string;
7
6
  fieldset: {
8
- 'config.url': {
7
+ 'config.method': {
9
8
  type: string;
10
9
  name: string;
11
10
  required: boolean;
12
11
  title: string;
13
12
  'x-decorator': string;
14
- 'x-decorator-props': {};
15
13
  'x-component': string;
16
14
  'x-component-props': {
17
- autoSize: {
18
- minRows: number;
19
- };
20
- placeholder: string;
21
- description: string;
15
+ showSearch: boolean;
16
+ allowClear: boolean;
22
17
  };
18
+ enum: {
19
+ label: string;
20
+ value: string;
21
+ }[];
22
+ default: string;
23
23
  };
24
- 'config.timeout': {
24
+ 'config.url': {
25
25
  type: string;
26
26
  name: string;
27
27
  required: boolean;
28
28
  title: string;
29
29
  'x-decorator': string;
30
- 'x-decorator-props': {};
30
+ 'x-decorator-props': {
31
+ className: string;
32
+ };
31
33
  'x-component': string;
32
34
  'x-component-props': {
33
- addonAfter: string;
34
- min: number;
35
- step: number;
36
- defaultValue: number;
35
+ placeholder: string;
37
36
  };
38
37
  };
39
38
  'config.headers': {
@@ -63,7 +62,7 @@ declare const _default: {
63
62
  'x-decorator': string;
64
63
  'x-component': string;
65
64
  'x-component-props': {
66
- placeholder: string;
65
+ scope: typeof useWorkflowVariableOptions;
67
66
  };
68
67
  };
69
68
  remove: {
@@ -83,37 +82,81 @@ declare const _default: {
83
82
  };
84
83
  };
85
84
  };
86
- 'config.method': {
85
+ 'config.params': {
87
86
  type: string;
88
87
  name: string;
89
- required: boolean;
90
- title: string;
91
- 'x-decorator': string;
92
88
  'x-component': string;
93
- 'x-component-props': {
94
- defaultValue: string;
95
- showSearch: boolean;
96
- allowClear: boolean;
89
+ 'x-decorator': string;
90
+ title: string;
91
+ items: {
92
+ type: string;
93
+ properties: {
94
+ space: {
95
+ type: string;
96
+ 'x-component': string;
97
+ properties: {
98
+ name: {
99
+ type: string;
100
+ 'x-decorator': string;
101
+ 'x-component': string;
102
+ 'x-component-props': {
103
+ placeholder: string;
104
+ };
105
+ };
106
+ value: {
107
+ type: string;
108
+ 'x-decorator': string;
109
+ 'x-component': string;
110
+ 'x-component-props': {
111
+ scope: typeof useWorkflowVariableOptions;
112
+ };
113
+ };
114
+ remove: {
115
+ type: string;
116
+ 'x-decorator': string;
117
+ 'x-component': string;
118
+ };
119
+ };
120
+ };
121
+ };
122
+ };
123
+ properties: {
124
+ add: {
125
+ type: string;
126
+ title: string;
127
+ 'x-component': string;
128
+ };
97
129
  };
98
- enum: {
99
- label: string;
100
- value: string;
101
- }[];
102
130
  };
103
131
  'config.data': {
104
132
  type: string;
105
133
  name: string;
106
- 'x-hidden': boolean;
107
134
  title: string;
108
135
  'x-decorator': string;
109
136
  'x-decorator-props': {};
110
137
  'x-component': string;
111
138
  'x-component-props': {
139
+ scope: typeof useWorkflowVariableOptions;
112
140
  autoSize: {
113
141
  minRows: number;
114
142
  };
115
143
  placeholder: string;
116
- description: string;
144
+ className: string;
145
+ };
146
+ description: string;
147
+ };
148
+ 'config.timeout': {
149
+ type: string;
150
+ name: string;
151
+ title: string;
152
+ 'x-decorator': string;
153
+ 'x-decorator-props': {};
154
+ 'x-component': string;
155
+ 'x-component-props': {
156
+ addonAfter: string;
157
+ min: number;
158
+ step: number;
159
+ defaultValue: number;
117
160
  };
118
161
  };
119
162
  'config.ignoreFail': {
@@ -127,12 +170,11 @@ declare const _default: {
127
170
  view: {};
128
171
  scope: {};
129
172
  components: {
130
- ArrayItems: React.FC<React.HTMLAttributes<HTMLDivElement>> & import("@formily/antd").ArrayBaseMixins & {
131
- Item?: React.FC<React.HTMLAttributes<HTMLDivElement> & {
173
+ ArrayItems: import("react").FC<import("react").HTMLAttributes<HTMLDivElement>> & import("@formily/antd").ArrayBaseMixins & {
174
+ Item?: import("react").FC<import("react").HTMLAttributes<HTMLDivElement> & {
132
175
  type?: "divide" | "card";
133
176
  }>;
134
177
  };
135
- EjsTextArea: typeof EjsTextArea;
136
178
  };
137
179
  };
138
180
  export default _default;
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _locale = require("../locale");
9
-
10
8
  function _antd() {
11
9
  const data = require("@formily/antd");
12
10
 
@@ -17,44 +15,73 @@ function _antd() {
17
15
  return data;
18
16
  }
19
17
 
20
- var _EjsTextArea = _interopRequireDefault(require("../components/EjsTextArea"));
18
+ function _css() {
19
+ const data = require("@emotion/css");
20
+
21
+ _css = function _css() {
22
+ return data;
23
+ };
21
24
 
22
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
+ return data;
26
+ }
27
+
28
+ var _locale = require("../locale");
29
+
30
+ var _variable = require("../variable");
23
31
 
24
32
  var _default = {
25
33
  title: `{{t("HTTP request", { ns: "${_locale.NAMESPACE}" })}}`,
26
34
  type: 'request',
27
35
  group: 'extended',
28
36
  fieldset: {
29
- 'config.url': {
37
+ 'config.method': {
30
38
  type: 'string',
31
- name: 'config.url',
39
+ name: 'config.method',
32
40
  required: true,
33
- title: `{{t("URL", { ns: "${_locale.NAMESPACE}" })}}`,
41
+ title: `{{t("HTTP method", { ns: "${_locale.NAMESPACE}" })}}`,
34
42
  'x-decorator': 'FormItem',
35
- 'x-decorator-props': {},
36
- 'x-component': 'EjsTextArea',
43
+ 'x-component': 'Select',
37
44
  'x-component-props': {
38
- autoSize: {
39
- minRows: 1
40
- },
41
- placeholder: 'https://xxxxxx',
42
- description: `{{t("You can use the above available variables in URL.", { ns: "${_locale.NAMESPACE}" })}}`
43
- }
45
+ showSearch: false,
46
+ allowClear: false
47
+ },
48
+ enum: [{
49
+ label: 'GET',
50
+ value: 'GET'
51
+ }, {
52
+ label: 'POST',
53
+ value: 'POST'
54
+ }, {
55
+ label: 'PUT',
56
+ value: 'PUT'
57
+ }, {
58
+ label: 'PATCH',
59
+ value: 'PATCH'
60
+ }, {
61
+ label: 'DELETE',
62
+ value: 'DELETE'
63
+ }],
64
+ default: 'POST'
44
65
  },
45
- 'config.timeout': {
46
- type: 'number',
47
- name: 'config.timeout',
66
+ 'config.url': {
67
+ type: 'string',
68
+ name: 'config.url',
48
69
  required: true,
49
- title: `{{t("Timeout config", { ns: "${_locale.NAMESPACE}" })}}`,
70
+ title: `{{t("URL", { ns: "${_locale.NAMESPACE}" })}}`,
50
71
  'x-decorator': 'FormItem',
51
- 'x-decorator-props': {},
52
- 'x-component': 'InputNumber',
72
+ 'x-decorator-props': {
73
+ className: (0, _css().css)`
74
+ .ant-formily-item-control-content-component{
75
+ .ant-input-affix-wrapper,
76
+ .ant-input{
77
+ width: 100%;
78
+ }
79
+ }
80
+ `
81
+ },
82
+ 'x-component': 'Input',
53
83
  'x-component-props': {
54
- addonAfter: `{{t("ms", { ns: "${_locale.NAMESPACE}" })}}`,
55
- min: 1,
56
- step: 1000,
57
- defaultValue: 5000
84
+ placeholder: 'https://www.nocobase.com'
58
85
  }
59
86
  },
60
87
  'config.headers': {
@@ -62,8 +89,8 @@ var _default = {
62
89
  name: 'config.headers',
63
90
  'x-component': 'ArrayItems',
64
91
  'x-decorator': 'FormItem',
65
- title: `{{t("Request headers", { ns: "${_locale.NAMESPACE}" })}}`,
66
- description: `{{t("Default headers is Content-Type: application/json", { ns: "${_locale.NAMESPACE}" })}}`,
92
+ title: `{{t("Headers", { ns: "${_locale.NAMESPACE}" })}}`,
93
+ description: `{{t('"Content-Type" only support "application/json", and no need to specify', { ns: "${_locale.NAMESPACE}" })}}`,
67
94
  items: {
68
95
  type: 'object',
69
96
  properties: {
@@ -76,15 +103,15 @@ var _default = {
76
103
  'x-decorator': 'FormItem',
77
104
  'x-component': 'Input',
78
105
  'x-component-props': {
79
- placeholder: `{{t("Name(e.g. Content-Type)", { ns: "${_locale.NAMESPACE}" })}}`
106
+ placeholder: `{{t("Name")}}`
80
107
  }
81
108
  },
82
109
  value: {
83
110
  type: 'string',
84
111
  'x-decorator': 'FormItem',
85
- 'x-component': 'Input',
112
+ 'x-component': 'Variable.Input',
86
113
  'x-component-props': {
87
- placeholder: `{{t("Value(e.g. Application/json)", { ns: "${_locale.NAMESPACE}" })}}`
114
+ scope: _variable.useWorkflowVariableOptions
88
115
  }
89
116
  },
90
117
  remove: {
@@ -104,49 +131,84 @@ var _default = {
104
131
  }
105
132
  }
106
133
  },
107
- 'config.method': {
108
- type: 'string',
109
- name: 'config.method',
110
- required: true,
111
- title: `{{t("HTTP method", { ns: "${_locale.NAMESPACE}" })}}`,
134
+ 'config.params': {
135
+ type: 'array',
136
+ name: 'config.params',
137
+ 'x-component': 'ArrayItems',
112
138
  'x-decorator': 'FormItem',
113
- 'x-component': 'Select',
114
- 'x-component-props': {
115
- defaultValue: 'POST',
116
- showSearch: false,
117
- allowClear: false
139
+ title: `{{t("Parameters", { ns: "${_locale.NAMESPACE}" })}}`,
140
+ items: {
141
+ type: 'object',
142
+ properties: {
143
+ space: {
144
+ type: 'void',
145
+ 'x-component': 'Space',
146
+ properties: {
147
+ name: {
148
+ type: 'string',
149
+ 'x-decorator': 'FormItem',
150
+ 'x-component': 'Input',
151
+ 'x-component-props': {
152
+ placeholder: `{{t("Name")}}`
153
+ }
154
+ },
155
+ value: {
156
+ type: 'string',
157
+ 'x-decorator': 'FormItem',
158
+ 'x-component': 'Variable.Input',
159
+ 'x-component-props': {
160
+ scope: _variable.useWorkflowVariableOptions
161
+ }
162
+ },
163
+ remove: {
164
+ type: 'void',
165
+ 'x-decorator': 'FormItem',
166
+ 'x-component': 'ArrayItems.Remove'
167
+ }
168
+ }
169
+ }
170
+ }
118
171
  },
119
- enum: [{
120
- label: 'GET',
121
- value: 'GET'
122
- }, {
123
- label: 'POST',
124
- value: 'POST'
125
- }, {
126
- label: 'PUT',
127
- value: 'PUT'
128
- }, {
129
- label: 'PATCH',
130
- value: 'PATCH'
131
- }, {
132
- label: 'DELETE',
133
- value: 'DELETE'
134
- }]
172
+ properties: {
173
+ add: {
174
+ type: 'void',
175
+ title: `{{t("Add parameter", { ns: "${_locale.NAMESPACE}" })}}`,
176
+ 'x-component': 'ArrayItems.Addition'
177
+ }
178
+ }
135
179
  },
136
180
  'config.data': {
137
181
  type: 'string',
138
182
  name: 'config.data',
139
- 'x-hidden': false,
140
- title: `{{t("Request data", { ns: "${_locale.NAMESPACE}" })}}`,
183
+ title: `{{t("Body", { ns: "${_locale.NAMESPACE}" })}}`,
141
184
  'x-decorator': 'FormItem',
142
185
  'x-decorator-props': {},
143
- 'x-component': 'EjsTextArea',
186
+ 'x-component': 'Variable.JSON',
144
187
  'x-component-props': {
188
+ scope: _variable.useWorkflowVariableOptions,
145
189
  autoSize: {
146
- minRows: 5
190
+ minRows: 10
147
191
  },
148
192
  placeholder: `{{t("Input request data", { ns: "${_locale.NAMESPACE}" })}}`,
149
- description: `{{t("You can use the above available variables in request data.", { ns: "${_locale.NAMESPACE}" })}}`
193
+ className: (0, _css().css)`
194
+ font-size: 85%;
195
+ font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
196
+ `
197
+ },
198
+ description: `{{t("Only support standard JSON data", { ns: "${_locale.NAMESPACE}" })}}`
199
+ },
200
+ 'config.timeout': {
201
+ type: 'number',
202
+ name: 'config.timeout',
203
+ title: `{{t("Timeout config", { ns: "${_locale.NAMESPACE}" })}}`,
204
+ 'x-decorator': 'FormItem',
205
+ 'x-decorator-props': {},
206
+ 'x-component': 'InputNumber',
207
+ 'x-component-props': {
208
+ addonAfter: `{{t("ms", { ns: "${_locale.NAMESPACE}" })}}`,
209
+ min: 1,
210
+ step: 1000,
211
+ defaultValue: 5000
150
212
  }
151
213
  },
152
214
  'config.ignoreFail': {
@@ -160,8 +222,7 @@ var _default = {
160
222
  view: {},
161
223
  scope: {},
162
224
  components: {
163
- ArrayItems: _antd().ArrayItems,
164
- EjsTextArea: _EjsTextArea.default
225
+ ArrayItems: _antd().ArrayItems
165
226
  }
166
227
  };
167
228
  exports.default = _default;
@@ -1,5 +1,5 @@
1
1
  import { useCollectionDataSource } from '@nocobase/client';
2
- import { VariableComponent } from '../calculators';
2
+ import { FilterDynamicComponent } from '../components/FilterDynamicComponent';
3
3
  declare const _default: {
4
4
  title: string;
5
5
  type: string;
@@ -53,7 +53,7 @@ declare const _default: {
53
53
  useCollectionDataSource: typeof useCollectionDataSource;
54
54
  };
55
55
  components: {
56
- VariableComponent: typeof VariableComponent;
56
+ FilterDynamicComponent: typeof FilterDynamicComponent;
57
57
  CollectionFieldset: import("react").MemoExoticComponent<import("react").FunctionComponent<Pick<any, string | number | symbol>>>;
58
58
  };
59
59
  };
@@ -15,7 +15,7 @@ function _client() {
15
15
  return data;
16
16
  }
17
17
 
18
- var _calculators = require("../calculators");
18
+ var _FilterDynamicComponent = require("../components/FilterDynamicComponent");
19
19
 
20
20
  var _CollectionFieldset = _interopRequireDefault(require("../components/CollectionFieldset"));
21
21
 
@@ -47,7 +47,7 @@ var _default = {
47
47
  useCollectionDataSource: _client().useCollectionDataSource
48
48
  },
49
49
  components: {
50
- VariableComponent: _calculators.VariableComponent,
50
+ FilterDynamicComponent: _FilterDynamicComponent.FilterDynamicComponent,
51
51
  CollectionFieldset: _CollectionFieldset.default
52
52
  }
53
53
  };
@@ -94,7 +94,7 @@ const filter = {
94
94
  };
95
95
  },
96
96
 
97
- dynamicComponent: 'VariableComponent'
97
+ dynamicComponent: 'FilterDynamicComponent'
98
98
  }
99
99
  };
100
100
  exports.filter = filter;
@@ -56,7 +56,7 @@ const executionCollection = {
56
56
  'x-read-pretty': true
57
57
  }
58
58
  }, {
59
- interface: 'object',
59
+ interface: 'm2o',
60
60
  type: 'belongsTo',
61
61
  name: 'workflowId',
62
62
  uiSchema: {
@@ -132,7 +132,7 @@ const workflowSchema = {
132
132
  filter: {
133
133
  current: true
134
134
  },
135
- sort: ['-enabled', '-createdAt'],
135
+ sort: ['-createdAt'],
136
136
  except: ['config']
137
137
  }
138
138
  }
@@ -16,10 +16,6 @@ function _css() {
16
16
  }
17
17
 
18
18
  const workflowPageClass = (0, _css().css)`
19
- height: 100%;
20
- width: 100%;
21
- overflow: auto;
22
-
23
19
  .workflow-toolbar{
24
20
  display: flex;
25
21
  align-items: center;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
- import { useCollectionDataSource } from '@nocobase/client';
2
+ import { SchemaInitializerItemOptions, useCollectionDataSource } from '@nocobase/client';
3
+ import { CollectionFieldInitializers } from '../components/CollectionFieldInitializers';
3
4
  declare const _default: {
4
5
  title: string;
5
6
  type: string;
@@ -83,7 +84,10 @@ declare const _default: {
83
84
  components: {
84
85
  FieldsSelect: React.MemoExoticComponent<React.FunctionComponent<unknown>>;
85
86
  };
86
- getOptions(config: any): any[];
87
- getter(props: any): JSX.Element;
87
+ getOptions(config: any, types: any): any[];
88
+ useInitializers(config: any): SchemaInitializerItemOptions | null;
89
+ initializers: {
90
+ CollectionFieldInitializers: typeof CollectionFieldInitializers;
91
+ };
88
92
  };
89
93
  export default _default;
@@ -25,56 +25,46 @@ function _antd() {
25
25
  return data;
26
26
  }
27
27
 
28
- function _react2() {
29
- const data = require("@formily/react");
28
+ function _core() {
29
+ const data = require("@formily/core");
30
30
 
31
- _react2 = function _react2() {
31
+ _core = function _core() {
32
32
  return data;
33
33
  };
34
34
 
35
35
  return data;
36
36
  }
37
37
 
38
- function _client() {
39
- const data = require("@nocobase/client");
38
+ function _react2() {
39
+ const data = require("@formily/react");
40
40
 
41
- _client = function _client() {
41
+ _react2 = function _react2() {
42
42
  return data;
43
43
  };
44
44
 
45
45
  return data;
46
46
  }
47
47
 
48
- var _FlowContext = require("../FlowContext");
49
-
50
- var _collection = require("../schemas/collection");
51
-
52
- function _css() {
53
- const data = require("@emotion/css");
48
+ function _client() {
49
+ const data = require("@nocobase/client");
54
50
 
55
- _css = function _css() {
51
+ _client = function _client() {
56
52
  return data;
57
53
  };
58
54
 
59
55
  return data;
60
56
  }
61
57
 
62
- function _core() {
63
- const data = require("@formily/core");
58
+ var _collection = require("../schemas/collection");
64
59
 
65
- _core = function _core() {
66
- return data;
67
- };
60
+ var _variable = require("../variable");
68
61
 
69
- return data;
70
- }
62
+ var _CollectionBlockInitializer = require("../components/CollectionBlockInitializer");
71
63
 
72
- var _CollectionFieldSelect = _interopRequireDefault(require("../components/CollectionFieldSelect"));
64
+ var _CollectionFieldInitializers = require("../components/CollectionFieldInitializers");
73
65
 
74
66
  var _locale = require("../locale");
75
67
 
76
- var _calculators = require("../calculators");
77
-
78
68
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
79
69
 
80
70
  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; }
@@ -103,11 +93,7 @@ const FieldsSelect = (0, _react2().observer)(props => {
103
93
  setValuesIn('config.condition', null);
104
94
  });
105
95
  });
106
- return _react().default.createElement(_antd().Select, _objectSpread(_objectSpread({}, props), {}, {
107
- className: (0, _css().css)`
108
- min-width: 6em;
109
- `
110
- }), fields.filter(field => !field.hidden && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : true) && !['linkTo', 'hasOne', 'hasMany', 'belongsToMany'].includes(field.type)).map(field => {
96
+ return _react().default.createElement(_antd().Select, _objectSpread({}, props), fields.filter(field => !field.hidden && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : true) && !['linkTo', 'hasOne', 'hasMany', 'belongsToMany'].includes(field.type)).map(field => {
111
97
  var _field$uiSchema;
112
98
 
113
99
  return _react().default.createElement(_antd().Select.Option, {
@@ -207,34 +193,39 @@ var _default = {
207
193
  FieldsSelect
208
194
  },
209
195
 
210
- getOptions(config) {
196
+ getOptions(config, types) {
211
197
  const _useWorkflowTranslati = (0, _locale.useWorkflowTranslation)(),
212
198
  t = _useWorkflowTranslati.t;
213
199
 
214
- const options = [{
200
+ const fieldOptions = (0, _variable.useCollectionFieldOptions)({
201
+ collection: config.collection,
202
+ types
203
+ });
204
+ const options = [...((fieldOptions === null || fieldOptions === void 0 ? void 0 : fieldOptions.length) ? [{
205
+ label: t('Trigger data'),
206
+ key: 'data',
215
207
  value: 'data',
216
- label: t('Trigger data')
217
- }];
208
+ children: fieldOptions
209
+ }] : [])];
218
210
  return options;
219
211
  },
220
212
 
221
- getter(props) {
222
- const _onChange = props.onChange;
223
-
224
- const _useFlowContext = (0, _FlowContext.useFlowContext)(),
225
- workflow = _useFlowContext.workflow;
226
-
227
- const _useOperandContext = (0, _calculators.useOperandContext)(),
228
- options = _useOperandContext.options;
213
+ useInitializers(config) {
214
+ if (!config.collection) {
215
+ return null;
216
+ }
217
+
218
+ return {
219
+ type: 'item',
220
+ title: `{{t("Trigger data", { ns: "${_locale.NAMESPACE}" })}}`,
221
+ component: _CollectionBlockInitializer.CollectionBlockInitializer,
222
+ collection: config.collection,
223
+ dataSource: '{{$context.data}}'
224
+ };
225
+ },
229
226
 
230
- return _react().default.createElement(_CollectionFieldSelect.default, {
231
- collection: workflow.config.collection,
232
- value: options === null || options === void 0 ? void 0 : options.path,
233
- onChange: path => {
234
- _onChange(`{{$context.data.${path}}}`);
235
- }
236
- });
227
+ initializers: {
228
+ CollectionFieldInitializers: _CollectionFieldInitializers.CollectionFieldInitializers
237
229
  }
238
-
239
230
  };
240
231
  exports.default = _default;