@nocobase/plugin-workflow 0.7.1-alpha.7 → 0.7.2-alpha.3

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 (129) hide show
  1. package/client.d.ts +4 -0
  2. package/client.js +30 -0
  3. package/lib/client/ExecutionResourceProvider.d.ts +4 -0
  4. package/lib/client/ExecutionResourceProvider.js +64 -0
  5. package/lib/client/WorkflowCanvas.d.ts +15 -0
  6. package/lib/client/WorkflowCanvas.js +393 -0
  7. package/lib/client/WorkflowLink.d.ts +1 -0
  8. package/lib/client/WorkflowLink.js +66 -0
  9. package/lib/client/WorkflowPage.d.ts +1 -0
  10. package/lib/client/WorkflowPage.js +92 -0
  11. package/lib/client/WorkflowProvider.d.ts +1 -0
  12. package/lib/client/WorkflowProvider.js +78 -0
  13. package/lib/client/WorkflowShortcut.d.ts +1 -0
  14. package/lib/client/WorkflowShortcut.js +123 -0
  15. package/lib/client/calculators.d.ts +101 -0
  16. package/lib/client/calculators.js +739 -0
  17. package/lib/client/components/CollectionFieldSelect.d.ts +2 -0
  18. package/lib/client/components/CollectionFieldSelect.js +106 -0
  19. package/lib/client/components/Duration.d.ts +5 -0
  20. package/lib/client/components/Duration.js +96 -0
  21. package/lib/client/index.d.ts +3 -0
  22. package/lib/client/index.js +38 -0
  23. package/lib/client/nodes/calculation.d.ts +25 -0
  24. package/lib/client/nodes/calculation.js +85 -0
  25. package/lib/client/nodes/condition.d.ts +46 -0
  26. package/lib/client/nodes/condition.js +346 -0
  27. package/lib/client/nodes/create.d.ts +42 -0
  28. package/lib/client/nodes/create.js +99 -0
  29. package/lib/client/nodes/delay.d.ts +36 -0
  30. package/lib/client/nodes/delay.js +49 -0
  31. package/lib/client/nodes/destroy.d.ts +55 -0
  32. package/lib/client/nodes/destroy.js +46 -0
  33. package/lib/client/nodes/index.d.ts +33 -0
  34. package/lib/client/nodes/index.js +390 -0
  35. package/lib/client/nodes/parallel.d.ts +24 -0
  36. package/lib/client/nodes/parallel.js +216 -0
  37. package/lib/client/nodes/query.d.ts +66 -0
  38. package/lib/client/nodes/query.js +105 -0
  39. package/lib/client/nodes/update.d.ts +60 -0
  40. package/lib/client/nodes/update.js +48 -0
  41. package/lib/client/schemas/collection.d.ts +42 -0
  42. package/lib/client/schemas/collection.js +98 -0
  43. package/lib/client/schemas/executions.d.ts +209 -0
  44. package/lib/client/schemas/executions.js +164 -0
  45. package/lib/client/schemas/workflows.d.ts +2 -0
  46. package/lib/client/schemas/workflows.js +328 -0
  47. package/lib/client/style.d.ts +12 -0
  48. package/lib/client/style.js +216 -0
  49. package/lib/client/triggers/collection.d.ts +88 -0
  50. package/lib/client/triggers/collection.js +225 -0
  51. package/lib/client/triggers/index.d.ts +26 -0
  52. package/lib/client/triggers/index.js +238 -0
  53. package/lib/client/triggers/schedule/DateFieldsSelect.d.ts +2 -0
  54. package/lib/client/triggers/schedule/DateFieldsSelect.js +92 -0
  55. package/lib/client/triggers/schedule/EndsByField.d.ts +5 -0
  56. package/lib/client/triggers/schedule/EndsByField.js +102 -0
  57. package/lib/client/triggers/schedule/OnField.d.ts +5 -0
  58. package/lib/client/triggers/schedule/OnField.js +128 -0
  59. package/lib/client/triggers/schedule/RepeatField.d.ts +5 -0
  60. package/lib/client/triggers/schedule/RepeatField.js +191 -0
  61. package/lib/client/triggers/schedule/ScheduleConfig.d.ts +1 -0
  62. package/lib/client/triggers/schedule/ScheduleConfig.js +286 -0
  63. package/lib/client/triggers/schedule/index.d.ts +25 -0
  64. package/lib/client/triggers/schedule/index.js +124 -0
  65. package/lib/client/triggers/schedule/locale/Cron.zh-CN.d.ts +34 -0
  66. package/lib/client/triggers/schedule/locale/Cron.zh-CN.js +44 -0
  67. package/lib/index.d.ts +1 -6
  68. package/lib/index.js +2 -73
  69. package/lib/{Plugin.d.ts → server/Plugin.d.ts} +0 -0
  70. package/lib/{Plugin.js → server/Plugin.js} +0 -0
  71. package/lib/{Processor.d.ts → server/Processor.d.ts} +4 -3
  72. package/lib/{Processor.js → server/Processor.js} +40 -24
  73. package/lib/{actions → server/actions}/index.d.ts +0 -0
  74. package/lib/{actions → server/actions}/index.js +0 -0
  75. package/lib/{actions → server/actions}/nodes.d.ts +0 -0
  76. package/lib/{actions → server/actions}/nodes.js +1 -0
  77. package/lib/{actions → server/actions}/workflows.d.ts +0 -0
  78. package/lib/{actions → server/actions}/workflows.js +10 -0
  79. package/lib/{calculators → server/calculators}/index.d.ts +0 -0
  80. package/lib/{calculators → server/calculators}/index.js +0 -0
  81. package/lib/{collections → server/collections}/executions.d.ts +0 -0
  82. package/lib/{collections → server/collections}/executions.js +0 -0
  83. package/lib/{collections → server/collections}/flow_nodes.d.ts +0 -0
  84. package/lib/{collections → server/collections}/flow_nodes.js +0 -0
  85. package/lib/{collections → server/collections}/jobs.d.ts +0 -0
  86. package/lib/{collections → server/collections}/jobs.js +0 -0
  87. package/lib/{collections → server/collections}/workflows.d.ts +0 -0
  88. package/lib/{collections → server/collections}/workflows.js +0 -0
  89. package/lib/{constants.d.ts → server/constants.d.ts} +0 -0
  90. package/lib/{constants.js → server/constants.js} +0 -0
  91. package/lib/server/index.d.ts +6 -0
  92. package/lib/server/index.js +86 -0
  93. package/lib/{instructions → server/instructions}/calculation.d.ts +0 -0
  94. package/lib/{instructions → server/instructions}/calculation.js +0 -0
  95. package/lib/{instructions → server/instructions}/condition.d.ts +0 -0
  96. package/lib/{instructions → server/instructions}/condition.js +0 -0
  97. package/lib/{instructions → server/instructions}/create.d.ts +0 -0
  98. package/lib/{instructions → server/instructions}/create.js +0 -0
  99. package/lib/{instructions → server/instructions}/delay.d.ts +0 -0
  100. package/lib/{instructions → server/instructions}/delay.js +12 -5
  101. package/lib/{instructions → server/instructions}/destroy.d.ts +0 -0
  102. package/lib/{instructions → server/instructions}/destroy.js +0 -0
  103. package/lib/{instructions → server/instructions}/index.d.ts +0 -0
  104. package/lib/{instructions → server/instructions}/index.js +0 -0
  105. package/lib/{instructions → server/instructions}/parallel.d.ts +0 -0
  106. package/lib/{instructions → server/instructions}/parallel.js +62 -20
  107. package/lib/{instructions → server/instructions}/prompt.d.ts +0 -0
  108. package/lib/{instructions → server/instructions}/prompt.js +0 -0
  109. package/lib/{instructions → server/instructions}/query.d.ts +0 -0
  110. package/lib/{instructions → server/instructions}/query.js +0 -0
  111. package/lib/{instructions → server/instructions}/update.d.ts +0 -0
  112. package/lib/{instructions → server/instructions}/update.js +0 -0
  113. package/lib/{models → server/models}/Execution.d.ts +0 -0
  114. package/lib/{models → server/models}/Execution.js +0 -0
  115. package/lib/{models → server/models}/FlowNode.d.ts +0 -0
  116. package/lib/{models → server/models}/FlowNode.js +0 -0
  117. package/lib/{models → server/models}/Job.d.ts +0 -0
  118. package/lib/{models → server/models}/Job.js +0 -0
  119. package/lib/{models → server/models}/Workflow.d.ts +0 -0
  120. package/lib/{models → server/models}/Workflow.js +0 -0
  121. package/lib/{triggers → server/triggers}/collection.d.ts +0 -0
  122. package/lib/{triggers → server/triggers}/collection.js +0 -0
  123. package/lib/{triggers → server/triggers}/index.d.ts +0 -0
  124. package/lib/{triggers → server/triggers}/index.js +0 -0
  125. package/lib/{triggers → server/triggers}/schedule.d.ts +0 -0
  126. package/lib/{triggers → server/triggers}/schedule.js +2 -2
  127. package/package.json +10 -8
  128. package/server.d.ts +4 -0
  129. package/server.js +30 -0
@@ -0,0 +1,216 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.workflowVersionDropdownClass = exports.workflowPageClass = exports.nodeTitleClass = exports.nodeSubtreeClass = exports.nodeMetaClass = exports.nodeHeaderClass = exports.nodeClass = exports.nodeCardClass = exports.nodeBlockClass = exports.branchClass = exports.branchBlockClass = exports.addButtonClass = void 0;
7
+
8
+ function _css() {
9
+ const data = require("@emotion/css");
10
+
11
+ _css = function _css() {
12
+ return data;
13
+ };
14
+
15
+ return data;
16
+ }
17
+
18
+ const workflowPageClass = (0, _css().css)`
19
+ height: 100%;
20
+ width: 100%;
21
+ overflow: auto;
22
+
23
+ .workflow-toolbar{
24
+ display: flex;
25
+ align-items: center;
26
+ justify-content: space-between;
27
+ padding: 0.5rem 1rem;
28
+ background: #fff;
29
+
30
+ header{
31
+ display: flex;
32
+ align-items: center;
33
+ gap: .5em;
34
+ }
35
+
36
+ aside{
37
+ display: flex;
38
+ align-items: center;
39
+ gap: .5em;
40
+ }
41
+ }
42
+
43
+ .workflow-canvas{
44
+ width: min-content;
45
+ min-width: 100%;
46
+ display: flex;
47
+ flex-direction: column;
48
+ align-items: center;
49
+ padding: 2em;
50
+ }
51
+ `;
52
+ exports.workflowPageClass = workflowPageClass;
53
+ const workflowVersionDropdownClass = (0, _css().css)`
54
+ .ant-dropdown-menu-item{
55
+
56
+ &.unexecuted{
57
+ font-style: italic;
58
+ }
59
+
60
+ .ant-dropdown-menu-title-content{
61
+ text-align: right;
62
+
63
+ time{
64
+ margin-left: 0.5rem;
65
+ color: #999;
66
+ font-size: 80%;
67
+ }
68
+ }
69
+ }
70
+ `;
71
+ exports.workflowVersionDropdownClass = workflowVersionDropdownClass;
72
+ const branchBlockClass = (0, _css().css)`
73
+ display: flex;
74
+ position: relative;
75
+
76
+ :before{
77
+ content: "";
78
+ position: absolute;
79
+ top: 0;
80
+ bottom: 0;
81
+ left: calc(50% - .5px);
82
+ width: 1px;
83
+ background-color: #f0f2f5;
84
+ }
85
+ `;
86
+ exports.branchBlockClass = branchBlockClass;
87
+ const branchClass = (0, _css().css)`
88
+ display: flex;
89
+ flex-direction: column;
90
+ align-items: center;
91
+ position: relative;
92
+ padding: 0 2em;
93
+
94
+ .workflow-node-list{
95
+ flex-grow: 1;
96
+ min-width: 20em;
97
+ }
98
+
99
+ .workflow-branch-lines{
100
+ position: absolute;
101
+ top: 0;
102
+ bottom: 0;
103
+ width: 1px;
104
+ background-color: #ddd;
105
+ }
106
+
107
+ :before,:after{
108
+ content: "";
109
+ position: absolute;
110
+ height: 1px;
111
+ background-color: #ddd;
112
+ }
113
+
114
+ :before{
115
+ top: 0;
116
+ }
117
+
118
+ :after{
119
+ bottom: 0;
120
+ }
121
+
122
+ :not(:first-child):not(:last-child){
123
+ :before,:after{
124
+ left: 0;
125
+ width: 100%;
126
+ }
127
+ }
128
+
129
+ :last-child:not(:first-child){
130
+ :before,:after{
131
+ right: 50%;
132
+ width: 50%;
133
+ }
134
+ }
135
+
136
+ :first-child:not(:last-child){
137
+ :before,:after{
138
+ left: 50%;
139
+ width: 50%;
140
+ }
141
+ }
142
+ `;
143
+ exports.branchClass = branchClass;
144
+ const nodeBlockClass = (0, _css().css)`
145
+ flex-grow: 1;
146
+ flex-shrink: 0;
147
+ display: flex;
148
+ flex-direction: column;
149
+ align-items: center;
150
+ position: relative;
151
+ `;
152
+ exports.nodeBlockClass = nodeBlockClass;
153
+ const nodeClass = (0, _css().css)`
154
+ flex-shrink: 0;
155
+ display: flex;
156
+ flex-direction: column;
157
+ align-items: center;
158
+ `;
159
+ exports.nodeClass = nodeClass;
160
+ const nodeCardClass = (0, _css().css)`
161
+ width: 20em;
162
+ background: #fff;
163
+ padding: 1em;
164
+ box-shadow: 0 .25em .5em rgba(0, 0, 0, .1);
165
+
166
+ .workflow-node-remove-button{
167
+ position: absolute;
168
+ right: -.5em;
169
+ top: -.5em;
170
+ color: #999;
171
+ opacity: 0;
172
+ transition: opacity .3s ease;
173
+
174
+ &[disabled]{
175
+ display: none;
176
+ }
177
+
178
+ &:hover {
179
+ color: red;
180
+ }
181
+ }
182
+
183
+ &:hover{
184
+ .workflow-node-remove-button{
185
+ opacity: 1;
186
+ }
187
+ }
188
+ `;
189
+ exports.nodeCardClass = nodeCardClass;
190
+ const nodeHeaderClass = (0, _css().css)`
191
+ position: relative;
192
+ `;
193
+ exports.nodeHeaderClass = nodeHeaderClass;
194
+ const nodeMetaClass = (0, _css().css)`
195
+ margin-bottom: .5em;
196
+ `;
197
+ exports.nodeMetaClass = nodeMetaClass;
198
+ const nodeTitleClass = (0, _css().css)`
199
+ font-weight: normal;
200
+
201
+ .workflow-node-id{
202
+ color: #999;
203
+ }
204
+ `;
205
+ exports.nodeTitleClass = nodeTitleClass;
206
+ const nodeSubtreeClass = (0, _css().css)`
207
+ display: flex;
208
+ flex-direction: column-reverse;
209
+ align-items: center;
210
+ `;
211
+ exports.nodeSubtreeClass = nodeSubtreeClass;
212
+ const addButtonClass = (0, _css().css)`
213
+ flex-shrink: 0;
214
+ padding: 2em 0;
215
+ `;
216
+ exports.addButtonClass = addButtonClass;
@@ -0,0 +1,88 @@
1
+ import React from 'react';
2
+ import { useCollectionDataSource } from '@nocobase/client';
3
+ declare const _default: {
4
+ title: string;
5
+ type: string;
6
+ fieldset: {
7
+ 'config.collection': {
8
+ "x-reactions": (string | {
9
+ target: string;
10
+ fulfill: {
11
+ state: {
12
+ visible: string;
13
+ };
14
+ };
15
+ })[];
16
+ type: string;
17
+ title: string;
18
+ name: string;
19
+ required: boolean;
20
+ 'x-decorator': string;
21
+ 'x-component': string;
22
+ 'x-component-props': {
23
+ placeholder: string;
24
+ };
25
+ };
26
+ 'config.mode': {
27
+ type: string;
28
+ title: string;
29
+ name: string;
30
+ 'x-decorator': string;
31
+ 'x-component': string;
32
+ 'x-component-props': {
33
+ options: {
34
+ value: number;
35
+ label: string;
36
+ }[];
37
+ placeholder: string;
38
+ };
39
+ required: boolean;
40
+ 'x-reactions': {
41
+ target: string;
42
+ fulfill: {
43
+ state: {
44
+ disabled: string;
45
+ };
46
+ };
47
+ }[];
48
+ };
49
+ 'config.changed': {
50
+ type: string;
51
+ name: string;
52
+ title: string;
53
+ description: string;
54
+ 'x-decorator': string;
55
+ 'x-component': string;
56
+ 'x-component-props': {
57
+ mode: string;
58
+ placeholder: string;
59
+ };
60
+ };
61
+ 'config.condition': {
62
+ name: string;
63
+ title: string;
64
+ type: string;
65
+ 'x-decorator': string;
66
+ 'x-decorator-props': {
67
+ labelAlign: string;
68
+ className: string;
69
+ };
70
+ 'x-component': string;
71
+ 'x-component-props': {
72
+ useProps(): {
73
+ options: any[];
74
+ className: string;
75
+ };
76
+ dynamicComponent: string;
77
+ };
78
+ };
79
+ };
80
+ scope: {
81
+ useCollectionDataSource: typeof useCollectionDataSource;
82
+ };
83
+ components: {
84
+ FieldsSelect: React.MemoExoticComponent<React.FunctionComponent<unknown>>;
85
+ };
86
+ getter(props: any): JSX.Element;
87
+ };
88
+ export default _default;
@@ -0,0 +1,225 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
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 _antd() {
19
+ const data = require("antd");
20
+
21
+ _antd = function _antd() {
22
+ return data;
23
+ };
24
+
25
+ return data;
26
+ }
27
+
28
+ function _react2() {
29
+ const data = require("@formily/react");
30
+
31
+ _react2 = function _react2() {
32
+ return data;
33
+ };
34
+
35
+ return data;
36
+ }
37
+
38
+ function _client() {
39
+ const data = require("@nocobase/client");
40
+
41
+ _client = function _client() {
42
+ return data;
43
+ };
44
+
45
+ return data;
46
+ }
47
+
48
+ var _WorkflowCanvas = require("../WorkflowCanvas");
49
+
50
+ var _collection = require("../schemas/collection");
51
+
52
+ function _css() {
53
+ const data = require("@emotion/css");
54
+
55
+ _css = function _css() {
56
+ return data;
57
+ };
58
+
59
+ return data;
60
+ }
61
+
62
+ function _core() {
63
+ const data = require("@formily/core");
64
+
65
+ _core = function _core() {
66
+ return data;
67
+ };
68
+
69
+ return data;
70
+ }
71
+
72
+ var _CollectionFieldSelect = _interopRequireDefault(require("../components/CollectionFieldSelect"));
73
+
74
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
75
+
76
+ 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; }
77
+
78
+ 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; }
79
+
80
+ 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; }
81
+
82
+ const FieldsSelect = (0, _react2().observer)(props => {
83
+ var _values$config;
84
+
85
+ const compile = (0, _client().useCompile)();
86
+
87
+ const _useCollectionManager = (0, _client().useCollectionManager)(),
88
+ getCollectionFields = _useCollectionManager.getCollectionFields;
89
+
90
+ const _useForm = (0, _react2().useForm)(),
91
+ values = _useForm.values,
92
+ clearFormGraph = _useForm.clearFormGraph,
93
+ setValuesIn = _useForm.setValuesIn;
94
+
95
+ const fields = getCollectionFields(values === null || values === void 0 ? void 0 : (_values$config = values.config) === null || _values$config === void 0 ? void 0 : _values$config.collection);
96
+ (0, _react2().useFormEffects)(() => {
97
+ (0, _core().onFieldValueChange)('config.collection', field => {
98
+ clearFormGraph('config.changed');
99
+ setValuesIn('config.condition', null);
100
+ });
101
+ });
102
+ return _react().default.createElement(_antd().Select, _objectSpread(_objectSpread({}, props), {}, {
103
+ className: (0, _css().css)`
104
+ min-width: 6em;
105
+ `
106
+ }), fields.filter(field => !field.hidden && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : true)).map(field => {
107
+ var _field$uiSchema;
108
+
109
+ return _react().default.createElement(_antd().Select.Option, {
110
+ key: field.name,
111
+ value: field.name
112
+ }, compile((_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema.title));
113
+ }));
114
+ });
115
+ var _default = {
116
+ title: '{{t("Collection event")}}',
117
+ type: 'collection',
118
+ fieldset: {
119
+ 'config.collection': _objectSpread(_objectSpread({}, _collection.collection), {}, {
120
+ ['x-reactions']: [..._collection.collection['x-reactions'], {
121
+ target: 'config.mode',
122
+ fulfill: {
123
+ state: {
124
+ visible: '{{!!$self.value}}'
125
+ }
126
+ }
127
+ }, {
128
+ target: 'config.changed',
129
+ fulfill: {
130
+ state: {
131
+ visible: '{{!!$self.value}}'
132
+ }
133
+ }
134
+ }, {
135
+ target: 'config.condition',
136
+ fulfill: {
137
+ state: {
138
+ visible: '{{!!$self.value}}'
139
+ }
140
+ }
141
+ }]
142
+ }),
143
+ 'config.mode': {
144
+ type: 'number',
145
+ title: '{{t("Trigger on")}}',
146
+ name: 'config.mode',
147
+ 'x-decorator': 'FormItem',
148
+ 'x-component': 'Select',
149
+ 'x-component-props': {
150
+ options: [{
151
+ value: 1,
152
+ label: '{{t("After record added")}}'
153
+ }, {
154
+ value: 2,
155
+ label: '{{t("After record updated")}}'
156
+ }, {
157
+ value: 3,
158
+ label: '{{t("After record added or updated")}}'
159
+ }, {
160
+ value: 4,
161
+ label: '{{t("After record deleted")}}'
162
+ }],
163
+ placeholder: '{{t("Trigger on")}}'
164
+ },
165
+ required: true,
166
+ 'x-reactions': [{
167
+ target: 'config.changed',
168
+ fulfill: {
169
+ state: {
170
+ disabled: '{{!($self.value & 0b010)}}'
171
+ }
172
+ }
173
+ }]
174
+ },
175
+ 'config.changed': {
176
+ type: 'array',
177
+ name: 'changed',
178
+ title: '{{t("Changed fields")}}',
179
+ description: '{{t("Triggered only if one of the selected fields changes. If unselected, it means that it will be triggered when any field changes. When record is added or deleted, any field is considered to have been changed.")}}',
180
+ 'x-decorator': 'FormItem',
181
+ 'x-component': 'FieldsSelect',
182
+ 'x-component-props': {
183
+ mode: 'multiple',
184
+ placeholder: '{{t("Select Field")}}'
185
+ }
186
+ },
187
+ 'config.condition': _objectSpread(_objectSpread({}, _collection.filter), {}, {
188
+ name: 'config.condition',
189
+ title: '{{t("Only triggers when match conditions")}}'
190
+ })
191
+ },
192
+ scope: {
193
+ useCollectionDataSource: _client().useCollectionDataSource
194
+ },
195
+ components: {
196
+ FieldsSelect
197
+ },
198
+
199
+ getter(props) {
200
+ var _options$path;
201
+
202
+ const type = props.type,
203
+ options = props.options,
204
+ _onChange = props.onChange;
205
+
206
+ const _useFlowContext = (0, _WorkflowCanvas.useFlowContext)(),
207
+ workflow = _useFlowContext.workflow;
208
+
209
+ const value = options === null || options === void 0 ? void 0 : (_options$path = options.path) === null || _options$path === void 0 ? void 0 : _options$path.replace(/^data\./, '');
210
+ return _react().default.createElement(_CollectionFieldSelect.default, {
211
+ collection: workflow.config.collection,
212
+ value: value,
213
+ onChange: value => {
214
+ _onChange({
215
+ type,
216
+ options: _objectSpread(_objectSpread({}, options), {}, {
217
+ path: `data.${value}`
218
+ })
219
+ });
220
+ }
221
+ });
222
+ }
223
+
224
+ };
225
+ exports.default = _default;
@@ -0,0 +1,26 @@
1
+ import { ISchema } from "@formily/react";
2
+ import { Registry } from "@nocobase/utils/client";
3
+ import React from "react";
4
+ export interface Trigger {
5
+ title: string;
6
+ type: string;
7
+ options?: {
8
+ label: string;
9
+ value: any;
10
+ key: string;
11
+ }[];
12
+ fieldset: {
13
+ [key: string]: ISchema;
14
+ };
15
+ view?: ISchema;
16
+ scope?: {
17
+ [key: string]: any;
18
+ };
19
+ components?: {
20
+ [key: string]: any;
21
+ };
22
+ render?(props: any): React.ReactElement;
23
+ getter?(node: any): React.ReactElement;
24
+ }
25
+ export declare const triggers: Registry<Trigger>;
26
+ export declare const TriggerConfig: () => JSX.Element;