@nocobase/plugin-workflow 0.7.1-alpha.5 → 0.7.2-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 (127) 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/Duration.d.ts +5 -0
  18. package/lib/client/components/Duration.js +96 -0
  19. package/lib/client/index.d.ts +3 -0
  20. package/lib/client/index.js +38 -0
  21. package/lib/client/nodes/calculation.d.ts +25 -0
  22. package/lib/client/nodes/calculation.js +85 -0
  23. package/lib/client/nodes/condition.d.ts +46 -0
  24. package/lib/client/nodes/condition.js +346 -0
  25. package/lib/client/nodes/create.d.ts +46 -0
  26. package/lib/client/nodes/create.js +133 -0
  27. package/lib/client/nodes/delay.d.ts +36 -0
  28. package/lib/client/nodes/delay.js +49 -0
  29. package/lib/client/nodes/destroy.d.ts +55 -0
  30. package/lib/client/nodes/destroy.js +46 -0
  31. package/lib/client/nodes/index.d.ts +33 -0
  32. package/lib/client/nodes/index.js +390 -0
  33. package/lib/client/nodes/parallel.d.ts +24 -0
  34. package/lib/client/nodes/parallel.js +216 -0
  35. package/lib/client/nodes/query.d.ts +70 -0
  36. package/lib/client/nodes/query.js +143 -0
  37. package/lib/client/nodes/update.d.ts +60 -0
  38. package/lib/client/nodes/update.js +48 -0
  39. package/lib/client/schemas/collection.d.ts +42 -0
  40. package/lib/client/schemas/collection.js +98 -0
  41. package/lib/client/schemas/executions.d.ts +209 -0
  42. package/lib/client/schemas/executions.js +164 -0
  43. package/lib/client/schemas/workflows.d.ts +2 -0
  44. package/lib/client/schemas/workflows.js +328 -0
  45. package/lib/client/style.d.ts +12 -0
  46. package/lib/client/style.js +216 -0
  47. package/lib/client/triggers/collection.d.ts +92 -0
  48. package/lib/client/triggers/collection.js +253 -0
  49. package/lib/client/triggers/index.d.ts +26 -0
  50. package/lib/client/triggers/index.js +238 -0
  51. package/lib/client/triggers/schedule/DateFieldsSelect.d.ts +2 -0
  52. package/lib/client/triggers/schedule/DateFieldsSelect.js +92 -0
  53. package/lib/client/triggers/schedule/EndsByField.d.ts +5 -0
  54. package/lib/client/triggers/schedule/EndsByField.js +102 -0
  55. package/lib/client/triggers/schedule/OnField.d.ts +5 -0
  56. package/lib/client/triggers/schedule/OnField.js +128 -0
  57. package/lib/client/triggers/schedule/RepeatField.d.ts +5 -0
  58. package/lib/client/triggers/schedule/RepeatField.js +191 -0
  59. package/lib/client/triggers/schedule/ScheduleConfig.d.ts +1 -0
  60. package/lib/client/triggers/schedule/ScheduleConfig.js +286 -0
  61. package/lib/client/triggers/schedule/index.d.ts +25 -0
  62. package/lib/client/triggers/schedule/index.js +124 -0
  63. package/lib/client/triggers/schedule/locale/Cron.zh-CN.d.ts +34 -0
  64. package/lib/client/triggers/schedule/locale/Cron.zh-CN.js +44 -0
  65. package/lib/index.d.ts +1 -6
  66. package/lib/index.js +2 -73
  67. package/lib/{Plugin.d.ts → server/Plugin.d.ts} +0 -0
  68. package/lib/{Plugin.js → server/Plugin.js} +0 -0
  69. package/lib/{Processor.d.ts → server/Processor.d.ts} +4 -3
  70. package/lib/{Processor.js → server/Processor.js} +40 -24
  71. package/lib/{actions → server/actions}/index.d.ts +0 -0
  72. package/lib/{actions → server/actions}/index.js +0 -0
  73. package/lib/{actions → server/actions}/nodes.d.ts +0 -0
  74. package/lib/{actions → server/actions}/nodes.js +1 -0
  75. package/lib/{actions → server/actions}/workflows.d.ts +0 -0
  76. package/lib/{actions → server/actions}/workflows.js +0 -0
  77. package/lib/{calculators → server/calculators}/index.d.ts +0 -0
  78. package/lib/{calculators → server/calculators}/index.js +0 -0
  79. package/lib/{collections → server/collections}/executions.d.ts +0 -0
  80. package/lib/{collections → server/collections}/executions.js +0 -0
  81. package/lib/{collections → server/collections}/flow_nodes.d.ts +0 -0
  82. package/lib/{collections → server/collections}/flow_nodes.js +0 -0
  83. package/lib/{collections → server/collections}/jobs.d.ts +0 -0
  84. package/lib/{collections → server/collections}/jobs.js +0 -0
  85. package/lib/{collections → server/collections}/workflows.d.ts +0 -0
  86. package/lib/{collections → server/collections}/workflows.js +0 -0
  87. package/lib/{constants.d.ts → server/constants.d.ts} +0 -0
  88. package/lib/{constants.js → server/constants.js} +0 -0
  89. package/lib/server/index.d.ts +6 -0
  90. package/lib/server/index.js +86 -0
  91. package/lib/{instructions → server/instructions}/calculation.d.ts +0 -0
  92. package/lib/{instructions → server/instructions}/calculation.js +0 -0
  93. package/lib/{instructions → server/instructions}/condition.d.ts +0 -0
  94. package/lib/{instructions → server/instructions}/condition.js +0 -0
  95. package/lib/{instructions → server/instructions}/create.d.ts +0 -0
  96. package/lib/{instructions → server/instructions}/create.js +0 -0
  97. package/lib/{instructions → server/instructions}/delay.d.ts +0 -0
  98. package/lib/{instructions → server/instructions}/delay.js +12 -5
  99. package/lib/{instructions → server/instructions}/destroy.d.ts +0 -0
  100. package/lib/{instructions → server/instructions}/destroy.js +0 -0
  101. package/lib/{instructions → server/instructions}/index.d.ts +0 -0
  102. package/lib/{instructions → server/instructions}/index.js +0 -0
  103. package/lib/{instructions → server/instructions}/parallel.d.ts +0 -0
  104. package/lib/{instructions → server/instructions}/parallel.js +62 -20
  105. package/lib/{instructions → server/instructions}/prompt.d.ts +0 -0
  106. package/lib/{instructions → server/instructions}/prompt.js +0 -0
  107. package/lib/{instructions → server/instructions}/query.d.ts +0 -0
  108. package/lib/{instructions → server/instructions}/query.js +0 -0
  109. package/lib/{instructions → server/instructions}/update.d.ts +0 -0
  110. package/lib/{instructions → server/instructions}/update.js +0 -0
  111. package/lib/{models → server/models}/Execution.d.ts +0 -0
  112. package/lib/{models → server/models}/Execution.js +0 -0
  113. package/lib/{models → server/models}/FlowNode.d.ts +0 -0
  114. package/lib/{models → server/models}/FlowNode.js +0 -0
  115. package/lib/{models → server/models}/Job.d.ts +0 -0
  116. package/lib/{models → server/models}/Job.js +0 -0
  117. package/lib/{models → server/models}/Workflow.d.ts +0 -0
  118. package/lib/{models → server/models}/Workflow.js +0 -0
  119. package/lib/{triggers → server/triggers}/collection.d.ts +0 -0
  120. package/lib/{triggers → server/triggers}/collection.js +0 -0
  121. package/lib/{triggers → server/triggers}/index.d.ts +0 -0
  122. package/lib/{triggers → server/triggers}/index.js +0 -0
  123. package/lib/{triggers → server/triggers}/schedule.d.ts +0 -0
  124. package/lib/{triggers → server/triggers}/schedule.js +2 -2
  125. package/package.json +10 -8
  126. package/server.d.ts +4 -0
  127. 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,92 @@
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({ type, options, onChange }: {
87
+ type: any;
88
+ options: any;
89
+ onChange: any;
90
+ }): JSX.Element;
91
+ };
92
+ export default _default;
@@ -0,0 +1,253 @@
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 _calculators = require("../calculators");
51
+
52
+ var _collection = require("../schemas/collection");
53
+
54
+ function _reactI18next() {
55
+ const data = require("react-i18next");
56
+
57
+ _reactI18next = function _reactI18next() {
58
+ return data;
59
+ };
60
+
61
+ return data;
62
+ }
63
+
64
+ function _css() {
65
+ const data = require("@emotion/css");
66
+
67
+ _css = function _css() {
68
+ return data;
69
+ };
70
+
71
+ return data;
72
+ }
73
+
74
+ function _core() {
75
+ const data = require("@formily/core");
76
+
77
+ _core = function _core() {
78
+ return data;
79
+ };
80
+
81
+ return data;
82
+ }
83
+
84
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
85
+
86
+ 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; }
87
+
88
+ 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; }
89
+
90
+ 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; }
91
+
92
+ const FieldsSelect = (0, _react2().observer)(props => {
93
+ var _values$config;
94
+
95
+ const compile = (0, _client().useCompile)();
96
+
97
+ const _useCollectionManager = (0, _client().useCollectionManager)(),
98
+ getCollectionFields = _useCollectionManager.getCollectionFields;
99
+
100
+ const _useForm = (0, _react2().useForm)(),
101
+ values = _useForm.values,
102
+ clearFormGraph = _useForm.clearFormGraph,
103
+ setValuesIn = _useForm.setValuesIn;
104
+
105
+ const fields = getCollectionFields(values === null || values === void 0 ? void 0 : (_values$config = values.config) === null || _values$config === void 0 ? void 0 : _values$config.collection);
106
+ (0, _react2().useFormEffects)(() => {
107
+ (0, _core().onFieldValueChange)('config.collection', field => {
108
+ clearFormGraph('config.changed');
109
+ setValuesIn('config.condition', null);
110
+ });
111
+ });
112
+ return _react().default.createElement(_antd().Select, _objectSpread(_objectSpread({}, props), {}, {
113
+ className: (0, _css().css)`
114
+ min-width: 6em;
115
+ `
116
+ }), fields.filter(field => !field.hidden && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : true)).map(field => {
117
+ var _field$uiSchema;
118
+
119
+ return _react().default.createElement(_antd().Select.Option, {
120
+ key: field.name,
121
+ value: field.name
122
+ }, compile((_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema.title));
123
+ }));
124
+ });
125
+ var _default = {
126
+ title: '{{t("Collection event")}}',
127
+ type: 'collection',
128
+ fieldset: {
129
+ 'config.collection': _objectSpread(_objectSpread({}, _collection.collection), {}, {
130
+ ['x-reactions']: [..._collection.collection['x-reactions'], {
131
+ target: 'config.mode',
132
+ fulfill: {
133
+ state: {
134
+ visible: '{{!!$self.value}}'
135
+ }
136
+ }
137
+ }, {
138
+ target: 'config.changed',
139
+ fulfill: {
140
+ state: {
141
+ visible: '{{!!$self.value}}'
142
+ }
143
+ }
144
+ }, {
145
+ target: 'config.condition',
146
+ fulfill: {
147
+ state: {
148
+ visible: '{{!!$self.value}}'
149
+ }
150
+ }
151
+ }]
152
+ }),
153
+ 'config.mode': {
154
+ type: 'number',
155
+ title: '{{t("Trigger on")}}',
156
+ name: 'config.mode',
157
+ 'x-decorator': 'FormItem',
158
+ 'x-component': 'Select',
159
+ 'x-component-props': {
160
+ options: [{
161
+ value: 1,
162
+ label: '{{t("After record added")}}'
163
+ }, {
164
+ value: 2,
165
+ label: '{{t("After record updated")}}'
166
+ }, {
167
+ value: 3,
168
+ label: '{{t("After record added or updated")}}'
169
+ }, {
170
+ value: 4,
171
+ label: '{{t("After record deleted")}}'
172
+ }],
173
+ placeholder: '{{t("Trigger on")}}'
174
+ },
175
+ required: true,
176
+ 'x-reactions': [{
177
+ target: 'config.changed',
178
+ fulfill: {
179
+ state: {
180
+ disabled: '{{!($self.value & 0b010)}}'
181
+ }
182
+ }
183
+ }]
184
+ },
185
+ 'config.changed': {
186
+ type: 'array',
187
+ name: 'changed',
188
+ title: '{{t("Changed fields")}}',
189
+ 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.")}}',
190
+ 'x-decorator': 'FormItem',
191
+ 'x-component': 'FieldsSelect',
192
+ 'x-component-props': {
193
+ mode: 'multiple',
194
+ placeholder: '{{t("Select Field")}}'
195
+ }
196
+ },
197
+ 'config.condition': _objectSpread(_objectSpread({}, _collection.filter), {}, {
198
+ name: 'config.condition',
199
+ title: '{{t("Only triggers when match conditions")}}'
200
+ })
201
+ },
202
+ scope: {
203
+ useCollectionDataSource: _client().useCollectionDataSource
204
+ },
205
+ components: {
206
+ FieldsSelect
207
+ },
208
+
209
+ getter({
210
+ type,
211
+ options,
212
+ onChange: _onChange
213
+ }) {
214
+ var _collections$find, _options$path;
215
+
216
+ const _useTranslation = (0, _reactI18next().useTranslation)(),
217
+ t = _useTranslation.t;
218
+
219
+ const compile = (0, _client().useCompile)();
220
+
221
+ const _useCollectionManager2 = (0, _client().useCollectionManager)(),
222
+ _useCollectionManager3 = _useCollectionManager2.collections,
223
+ collections = _useCollectionManager3 === void 0 ? [] : _useCollectionManager3;
224
+
225
+ const _useFlowContext = (0, _WorkflowCanvas.useFlowContext)(),
226
+ workflow = _useFlowContext.workflow;
227
+
228
+ const collection = (_collections$find = collections.find(item => item.name === workflow.config.collection)) !== null && _collections$find !== void 0 ? _collections$find : {
229
+ fields: []
230
+ };
231
+ return _react().default.createElement(_antd().Select, {
232
+ placeholder: t('Fields'),
233
+ value: options === null || options === void 0 ? void 0 : (_options$path = options.path) === null || _options$path === void 0 ? void 0 : _options$path.replace(/^data\./, ''),
234
+ onChange: path => {
235
+ _onChange({
236
+ type,
237
+ options: _objectSpread(_objectSpread({}, options), {}, {
238
+ path: `data.${path}`
239
+ })
240
+ });
241
+ }
242
+ }, collection.fields.filter(field => {
243
+ var _field$uiSchema2;
244
+
245
+ return _calculators.BaseTypeSet.has(field === null || field === void 0 ? void 0 : (_field$uiSchema2 = field.uiSchema) === null || _field$uiSchema2 === void 0 ? void 0 : _field$uiSchema2.type);
246
+ }).map(field => _react().default.createElement(_antd().Select.Option, {
247
+ key: field.name,
248
+ value: field.name
249
+ }, compile(field.uiSchema.title))));
250
+ }
251
+
252
+ };
253
+ 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;