@nocobase/plugin-workflow 0.10.0-alpha.5 → 0.11.0-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.
- package/client.d.ts +2 -3
- package/client.js +1 -30
- package/lib/client/AddButton.js +1 -8
- package/lib/client/Branch.js +8 -8
- package/lib/client/CanvasContent.js +8 -8
- package/lib/client/ExecutionCanvas.js +20 -27
- package/lib/client/ExecutionPage.js +1 -8
- package/lib/client/WorkflowCanvas.js +3 -10
- package/lib/client/WorkflowPage.js +1 -8
- package/lib/client/WorkflowProvider.js +3 -42
- package/lib/client/components/CollectionFieldset.d.ts +1 -1
- package/lib/client/components/CollectionFieldset.js +8 -15
- package/lib/client/components/Duration.js +5 -5
- package/lib/client/components/DynamicExpression.d.ts +3 -3
- package/lib/client/components/DynamicExpression.js +14 -4
- package/lib/client/components/FieldsSelect.d.ts +1 -1
- package/lib/client/components/FieldsSelect.js +6 -6
- package/lib/client/components/NodeDescription.js +11 -11
- package/lib/client/components/RadioWithTooltip.js +13 -20
- package/lib/client/components/ValueBlock.js +14 -21
- package/lib/client/components/renderEngineReference.js +1 -8
- package/lib/client/index.d.ts +12 -4
- package/lib/client/index.js +78 -15
- package/lib/client/nodes/aggregate.d.ts +10 -4
- package/lib/client/nodes/aggregate.js +12 -9
- package/lib/client/nodes/calculation.d.ts +11 -16
- package/lib/client/nodes/calculation.js +72 -52
- package/lib/client/nodes/condition.d.ts +2 -6
- package/lib/client/nodes/condition.js +20 -24
- package/lib/client/nodes/create.d.ts +8 -5
- package/lib/client/nodes/create.js +34 -7
- package/lib/client/nodes/destroy.d.ts +1 -1
- package/lib/client/nodes/index.d.ts +4 -4
- package/lib/client/nodes/index.js +79 -86
- package/lib/client/nodes/loop.d.ts +3 -1
- package/lib/client/nodes/loop.js +48 -35
- package/lib/client/nodes/manual/ModeConfig.js +23 -30
- package/lib/client/nodes/manual/SchemaConfig.d.ts +3 -3
- package/lib/client/nodes/manual/SchemaConfig.js +18 -17
- package/lib/client/nodes/manual/WorkflowTodo.js +66 -72
- package/lib/client/nodes/manual/WorkflowTodoBlockInitializer.d.ts +2 -5
- package/lib/client/nodes/manual/WorkflowTodoBlockInitializer.js +6 -5
- package/lib/client/nodes/manual/forms/custom.js +11 -18
- package/lib/client/nodes/manual/index.d.ts +11 -5
- package/lib/client/nodes/manual/index.js +21 -10
- package/lib/client/nodes/parallel.js +20 -20
- package/lib/client/nodes/query.d.ts +7 -4
- package/lib/client/nodes/query.js +34 -7
- package/lib/client/nodes/request.d.ts +10 -6
- package/lib/client/nodes/request.js +37 -9
- package/lib/client/nodes/update.d.ts +2 -2
- package/lib/client/nodes/update.js +1 -1
- package/lib/client/schemas/collection.d.ts +1 -1
- package/lib/client/schemas/collection.js +3 -10
- package/lib/client/style.js +18 -18
- package/lib/client/triggers/collection.d.ts +4 -3
- package/lib/client/triggers/collection.js +21 -7
- package/lib/client/triggers/index.d.ts +2 -2
- package/lib/client/triggers/index.js +46 -52
- package/lib/client/triggers/schedule/DateFieldsSelect.js +1 -1
- package/lib/client/triggers/schedule/EndsByField.js +11 -11
- package/lib/client/triggers/schedule/OnField.js +11 -11
- package/lib/client/triggers/schedule/RepeatField.js +4 -4
- package/lib/client/triggers/schedule/ScheduleConfig.js +17 -24
- package/lib/client/triggers/schedule/index.d.ts +3 -4
- package/lib/client/triggers/schedule/index.js +21 -11
- package/lib/client/variable.d.ts +3 -4
- package/lib/client/variable.js +110 -45
- package/lib/server/Plugin.d.ts +2 -3
- package/lib/server/Plugin.js +8 -9
- package/lib/server/Processor.d.ts +2 -4
- package/lib/server/actions/nodes.js +7 -7
- package/lib/server/fields/expression-field.d.ts +1 -2
- package/lib/server/fields/expression-field.js +1 -8
- package/lib/server/functions/index.d.ts +2 -3
- package/lib/server/index.d.ts +1 -0
- package/lib/server/index.js +12 -0
- package/lib/server/instructions/aggregate.d.ts +1 -1
- package/lib/server/instructions/aggregate.js +5 -5
- package/lib/server/instructions/condition.d.ts +2 -1
- package/lib/server/instructions/create.d.ts +1 -1
- package/lib/server/instructions/delay.d.ts +3 -3
- package/lib/server/instructions/delay.js +66 -64
- package/lib/server/instructions/destroy.d.ts +1 -1
- package/lib/server/instructions/index.d.ts +5 -5
- package/lib/server/instructions/loop.d.ts +1 -2
- package/lib/server/instructions/manual/actions.js +1 -1
- package/lib/server/instructions/manual/forms/index.d.ts +1 -1
- package/lib/server/instructions/manual/index.d.ts +1 -1
- package/lib/server/instructions/parallel.d.ts +1 -2
- package/lib/server/instructions/query.d.ts +1 -1
- package/lib/server/instructions/request.d.ts +2 -2
- package/lib/server/instructions/request.js +1 -0
- package/lib/server/instructions/update.d.ts +1 -1
- package/lib/server/migrations/20230221071831-calculation-expression.js +1 -1
- package/lib/server/migrations/20230221121203-condition-calculation.js +1 -1
- package/lib/server/migrations/20230221162902-jsonb-to-json.js +7 -7
- package/lib/server/migrations/20230411034722-manual-multi-form.js +1 -8
- package/lib/server/triggers/collection.d.ts +1 -1
- package/lib/server/triggers/collection.js +2 -2
- package/lib/server/triggers/index.d.ts +1 -1
- package/lib/server/triggers/schedule.d.ts +1 -1
- package/lib/server/triggers/schedule.js +18 -18
- package/lib/server/{models → types}/Execution.d.ts +2 -3
- package/lib/server/{models → types}/FlowNode.d.ts +1 -2
- package/lib/server/{models → types}/Job.d.ts +1 -2
- package/lib/server/{models → types}/Workflow.d.ts +1 -2
- package/lib/server/types/index.d.ts +4 -0
- package/lib/server/types/index.js +5 -0
- package/package.json +40 -20
- package/server.d.ts +2 -3
- package/server.js +1 -30
- package/src/client/AddButton.tsx +99 -0
- package/src/client/Branch.tsx +35 -0
- package/src/client/CanvasContent.tsx +23 -0
- package/src/client/ExecutionCanvas.tsx +168 -0
- package/src/client/ExecutionLink.tsx +16 -0
- package/src/client/ExecutionPage.tsx +44 -0
- package/src/client/ExecutionResourceProvider.tsx +21 -0
- package/src/client/FlowContext.ts +7 -0
- package/src/client/WorkflowCanvas.tsx +220 -0
- package/src/client/WorkflowLink.tsx +16 -0
- package/src/client/WorkflowPage.tsx +51 -0
- package/src/client/WorkflowProvider.tsx +84 -0
- package/src/client/components/CollectionBlockInitializer.tsx +71 -0
- package/src/client/components/CollectionFieldset.tsx +158 -0
- package/src/client/components/Duration.tsx +45 -0
- package/src/client/components/DynamicExpression.tsx +53 -0
- package/src/client/components/FieldsSelect.tsx +28 -0
- package/src/client/components/FilterDynamicComponent.tsx +15 -0
- package/src/client/components/NodeDescription.tsx +44 -0
- package/src/client/components/NullRender.tsx +3 -0
- package/src/client/components/OpenDrawer.tsx +24 -0
- package/src/client/components/RadioWithTooltip.tsx +38 -0
- package/src/client/components/ValueBlock.tsx +67 -0
- package/src/client/components/renderEngineReference.tsx +30 -0
- package/src/client/constants.tsx +91 -0
- package/src/client/index.tsx +51 -0
- package/src/client/interfaces/expression.tsx +25 -0
- package/src/client/locale/en-US.ts +136 -0
- package/src/client/locale/es-ES.ts +129 -0
- package/src/client/locale/index.ts +18 -0
- package/src/client/locale/ja-JP.ts +90 -0
- package/src/client/locale/pt-BR.ts +136 -0
- package/src/client/locale/ru-RU.ts +90 -0
- package/src/client/locale/tr-TR.ts +90 -0
- package/src/client/locale/zh-CN.ts +242 -0
- package/src/client/nodes/aggregate.tsx +327 -0
- package/src/client/nodes/calculation.tsx +217 -0
- package/src/client/nodes/condition.tsx +490 -0
- package/src/client/nodes/create.tsx +86 -0
- package/src/client/nodes/delay.tsx +37 -0
- package/src/client/nodes/destroy.tsx +34 -0
- package/src/client/nodes/index.tsx +489 -0
- package/src/client/nodes/loop.tsx +159 -0
- package/src/client/nodes/manual/AssigneesSelect.tsx +33 -0
- package/src/client/nodes/manual/DetailsBlockProvider.tsx +80 -0
- package/src/client/nodes/manual/FormBlockInitializer.tsx +68 -0
- package/src/client/nodes/manual/FormBlockProvider.tsx +75 -0
- package/src/client/nodes/manual/ModeConfig.tsx +84 -0
- package/src/client/nodes/manual/SchemaConfig.tsx +365 -0
- package/src/client/nodes/manual/WorkflowTodo.tsx +611 -0
- package/src/client/nodes/manual/WorkflowTodoBlockInitializer.tsx +28 -0
- package/src/client/nodes/manual/forms/create.tsx +88 -0
- package/src/client/nodes/manual/forms/custom.tsx +388 -0
- package/src/client/nodes/manual/forms/update.tsx +130 -0
- package/src/client/nodes/manual/index.tsx +162 -0
- package/src/client/nodes/manual/utils.ts +28 -0
- package/src/client/nodes/parallel.tsx +137 -0
- package/src/client/nodes/query.tsx +89 -0
- package/src/client/nodes/request.tsx +185 -0
- package/src/client/nodes/update.tsx +99 -0
- package/src/client/schemas/collection.ts +75 -0
- package/src/client/schemas/executions.tsx +169 -0
- package/src/client/schemas/workflows.ts +364 -0
- package/src/client/style.tsx +312 -0
- package/src/client/triggers/collection.tsx +186 -0
- package/src/client/triggers/index.tsx +307 -0
- package/src/client/triggers/schedule/DateFieldsSelect.tsx +28 -0
- package/src/client/triggers/schedule/EndsByField.tsx +40 -0
- package/src/client/triggers/schedule/OnField.tsx +50 -0
- package/src/client/triggers/schedule/RepeatField.tsx +116 -0
- package/src/client/triggers/schedule/ScheduleConfig.tsx +225 -0
- package/src/client/triggers/schedule/constants.ts +4 -0
- package/src/client/triggers/schedule/index.tsx +72 -0
- package/src/client/triggers/schedule/locale/Cron.zh-CN.ts +79 -0
- package/src/client/utils.ts +36 -0
- package/src/client/variable.tsx +296 -0
- package/src/index.ts +1 -0
- package/src/server/Plugin.ts +351 -0
- package/src/server/Processor.ts +354 -0
- package/src/server/__tests__/Plugin.test.ts +398 -0
- package/src/server/__tests__/Processor.test.ts +474 -0
- package/src/server/__tests__/actions/workflows.test.ts +419 -0
- package/src/server/__tests__/collections/categories.ts +23 -0
- package/src/server/__tests__/collections/comments.ts +24 -0
- package/src/server/__tests__/collections/posts.ts +42 -0
- package/src/server/__tests__/collections/replies.ts +9 -0
- package/src/server/__tests__/collections/tags.ts +15 -0
- package/src/server/__tests__/index.ts +89 -0
- package/src/server/__tests__/instructions/aggregate.test.ts +294 -0
- package/src/server/__tests__/instructions/calculation.test.ts +265 -0
- package/src/server/__tests__/instructions/condition.test.ts +335 -0
- package/src/server/__tests__/instructions/create.test.ts +129 -0
- package/src/server/__tests__/instructions/delay.test.ts +182 -0
- package/src/server/__tests__/instructions/destroy.test.ts +58 -0
- package/src/server/__tests__/instructions/loop.test.ts +331 -0
- package/src/server/__tests__/instructions/manual.test.ts +854 -0
- package/src/server/__tests__/instructions/parallel.test.ts +445 -0
- package/src/server/__tests__/instructions/query.test.ts +359 -0
- package/src/server/__tests__/instructions/request.test.ts +217 -0
- package/src/server/__tests__/instructions/update.test.ts +189 -0
- package/src/server/__tests__/triggers/collection.test.ts +298 -0
- package/src/server/__tests__/triggers/schedule.test.ts +369 -0
- package/src/server/actions/index.ts +25 -0
- package/src/server/actions/nodes.ts +214 -0
- package/src/server/actions/workflows.ts +178 -0
- package/src/server/collections/executions.ts +35 -0
- package/src/server/collections/flow_nodes.ts +54 -0
- package/src/server/collections/jobs.ts +31 -0
- package/src/server/collections/workflows.ts +88 -0
- package/src/server/constants.ts +26 -0
- package/src/server/fields/expression-field.ts +11 -0
- package/src/server/fields/index.ts +7 -0
- package/src/server/functions/index.ts +16 -0
- package/src/server/index.ts +6 -0
- package/src/server/instructions/aggregate.ts +42 -0
- package/src/server/instructions/calculation.ts +41 -0
- package/src/server/instructions/condition.ts +172 -0
- package/src/server/instructions/create.ts +37 -0
- package/src/server/instructions/delay.ts +105 -0
- package/src/server/instructions/destroy.ts +23 -0
- package/src/server/instructions/index.ts +63 -0
- package/src/server/instructions/loop.ts +99 -0
- package/src/server/instructions/manual/actions.ts +79 -0
- package/src/server/instructions/manual/collecions/jobs.ts +17 -0
- package/src/server/instructions/manual/collecions/users.ts +15 -0
- package/src/server/instructions/manual/collecions/users_jobs.ts +50 -0
- package/src/server/instructions/manual/forms/create.ts +22 -0
- package/src/server/instructions/manual/forms/index.ts +12 -0
- package/src/server/instructions/manual/forms/update.ts +22 -0
- package/src/server/instructions/manual/index.ts +184 -0
- package/src/server/instructions/parallel.ts +121 -0
- package/src/server/instructions/query.ts +31 -0
- package/src/server/instructions/request.ts +87 -0
- package/src/server/instructions/update.ts +24 -0
- package/src/server/migrations/20221129153547-calculation-variables.ts +64 -0
- package/src/server/migrations/20230221032941-change-request-body-type.ts +76 -0
- package/src/server/migrations/20230221071831-calculation-expression.ts +102 -0
- package/src/server/migrations/20230221121203-condition-calculation.ts +82 -0
- package/src/server/migrations/20230221162902-jsonb-to-json.ts +51 -0
- package/src/server/migrations/20230411034722-manual-multi-form.ts +282 -0
- package/src/server/migrations/20230612021134-manual-collection-block.ts +138 -0
- package/src/server/triggers/collection.ts +142 -0
- package/src/server/triggers/index.ts +22 -0
- package/src/server/triggers/schedule.ts +567 -0
- package/src/server/types/Execution.ts +26 -0
- package/src/server/types/FlowNode.ts +21 -0
- package/src/server/types/Job.ts +18 -0
- package/src/server/types/Workflow.ts +36 -0
- package/src/server/types/index.ts +4 -0
- /package/lib/server/{models → types}/Execution.js +0 -0
- /package/lib/server/{models → types}/FlowNode.js +0 -0
- /package/lib/server/{models → types}/Job.js +0 -0
- /package/lib/server/{models → types}/Workflow.js +0 -0
|
@@ -61,6 +61,14 @@ var _default = {
|
|
|
61
61
|
value: null
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
+
}, {
|
|
65
|
+
target: 'appends',
|
|
66
|
+
effects: ['onFieldValueChange'],
|
|
67
|
+
fulfill: {
|
|
68
|
+
state: {
|
|
69
|
+
value: []
|
|
70
|
+
}
|
|
71
|
+
}
|
|
64
72
|
}]
|
|
65
73
|
}),
|
|
66
74
|
mode: {
|
|
@@ -69,7 +77,7 @@ var _default = {
|
|
|
69
77
|
'x-decorator': 'FormItem',
|
|
70
78
|
'x-component': 'Select',
|
|
71
79
|
'x-component-props': {
|
|
72
|
-
|
|
80
|
+
popupMatchSelectWidth: false,
|
|
73
81
|
options: collectionModeOptions,
|
|
74
82
|
placeholder: `{{t("Trigger on", { ns: "${_locale.NAMESPACE}" })}}`
|
|
75
83
|
},
|
|
@@ -134,21 +142,27 @@ var _default = {
|
|
|
134
142
|
FieldsSelect: _FieldsSelect.FieldsSelect
|
|
135
143
|
},
|
|
136
144
|
useVariables(config, options) {
|
|
137
|
-
var
|
|
138
|
-
const
|
|
139
|
-
|
|
145
|
+
var _config$appends;
|
|
146
|
+
const compile = (0, _client().useCompile)();
|
|
147
|
+
const _useCollectionManager = (0, _client().useCollectionManager)(),
|
|
148
|
+
getCollectionFields = _useCollectionManager.getCollectionFields;
|
|
140
149
|
const rootFields = [{
|
|
141
150
|
collectionName: config.collection,
|
|
142
151
|
name: 'data',
|
|
143
152
|
type: 'hasOne',
|
|
144
153
|
target: config.collection,
|
|
145
154
|
uiSchema: {
|
|
146
|
-
title:
|
|
155
|
+
title: (0, _locale.lang)('Trigger data')
|
|
147
156
|
}
|
|
148
157
|
}];
|
|
149
|
-
const
|
|
158
|
+
// const depth = config.appends?.length
|
|
159
|
+
// ? config.appends.reduce((max, item) => Math.max(max, item.split('.').length), 1) + 1
|
|
160
|
+
// : 1;
|
|
161
|
+
const result = (0, _variable.getCollectionFieldOptions)(_objectSpread(_objectSpread({}, options), {}, {
|
|
150
162
|
fields: rootFields,
|
|
151
|
-
|
|
163
|
+
appends: ['data', ...(((_config$appends = config.appends) === null || _config$appends === void 0 ? void 0 : _config$appends.map(item => `data.${item}`)) || [])],
|
|
164
|
+
compile,
|
|
165
|
+
getCollectionFields
|
|
152
166
|
}));
|
|
153
167
|
return result;
|
|
154
168
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { ISchema } from '@formily/react';
|
|
3
|
-
import { Registry } from '@nocobase/utils/client';
|
|
4
2
|
import { SchemaInitializerItemOptions } from '@nocobase/client';
|
|
3
|
+
import { Registry } from '@nocobase/utils/client';
|
|
4
|
+
import React from 'react';
|
|
5
5
|
import { VariableOptions } from '../variable';
|
|
6
6
|
export interface Trigger {
|
|
7
7
|
title: string;
|
|
@@ -5,16 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.triggers = exports.TriggerConfig = void 0;
|
|
7
7
|
exports.useTrigger = useTrigger;
|
|
8
|
-
function
|
|
9
|
-
const data =
|
|
10
|
-
|
|
11
|
-
return data;
|
|
12
|
-
};
|
|
13
|
-
return data;
|
|
14
|
-
}
|
|
15
|
-
function _css() {
|
|
16
|
-
const data = require("@emotion/css");
|
|
17
|
-
_css = function _css() {
|
|
8
|
+
function _icons() {
|
|
9
|
+
const data = require("@ant-design/icons");
|
|
10
|
+
_icons = function _icons() {
|
|
18
11
|
return data;
|
|
19
12
|
};
|
|
20
13
|
return data;
|
|
@@ -26,46 +19,46 @@ function _core() {
|
|
|
26
19
|
};
|
|
27
20
|
return data;
|
|
28
21
|
}
|
|
29
|
-
function
|
|
22
|
+
function _react() {
|
|
30
23
|
const data = require("@formily/react");
|
|
31
|
-
|
|
24
|
+
_react = function _react() {
|
|
32
25
|
return data;
|
|
33
26
|
};
|
|
34
27
|
return data;
|
|
35
28
|
}
|
|
36
29
|
function _client() {
|
|
37
|
-
const data = require("@nocobase/
|
|
30
|
+
const data = require("@nocobase/client");
|
|
38
31
|
_client = function _client() {
|
|
39
32
|
return data;
|
|
40
33
|
};
|
|
41
34
|
return data;
|
|
42
35
|
}
|
|
43
|
-
function
|
|
44
|
-
const data = require("
|
|
45
|
-
|
|
36
|
+
function _client2() {
|
|
37
|
+
const data = require("@nocobase/utils/client");
|
|
38
|
+
_client2 = function _client2() {
|
|
46
39
|
return data;
|
|
47
40
|
};
|
|
48
41
|
return data;
|
|
49
42
|
}
|
|
50
|
-
function
|
|
51
|
-
const data = require("
|
|
52
|
-
|
|
43
|
+
function _antd() {
|
|
44
|
+
const data = require("antd");
|
|
45
|
+
_antd = function _antd() {
|
|
53
46
|
return data;
|
|
54
47
|
};
|
|
55
48
|
return data;
|
|
56
49
|
}
|
|
57
|
-
function
|
|
58
|
-
const data = require("
|
|
59
|
-
|
|
50
|
+
function _react2() {
|
|
51
|
+
const data = _interopRequireWildcard(require("react"));
|
|
52
|
+
_react2 = function _react2() {
|
|
60
53
|
return data;
|
|
61
54
|
};
|
|
62
55
|
return data;
|
|
63
56
|
}
|
|
64
|
-
var _style = require("../style");
|
|
65
57
|
var _FlowContext = require("../FlowContext");
|
|
58
|
+
var _locale = require("../locale");
|
|
59
|
+
var _style = require("../style");
|
|
66
60
|
var _collection = _interopRequireDefault(require("./collection"));
|
|
67
61
|
var _schedule = _interopRequireDefault(require("./schedule/"));
|
|
68
|
-
var _locale = require("../locale");
|
|
69
62
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
70
63
|
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); }
|
|
71
64
|
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; }
|
|
@@ -84,12 +77,12 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
|
84
77
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
85
78
|
function useUpdateConfigAction() {
|
|
86
79
|
var _useFlowContext;
|
|
87
|
-
const form = (0,
|
|
88
|
-
const api = (0,
|
|
80
|
+
const form = (0, _react().useForm)();
|
|
81
|
+
const api = (0, _client().useAPIClient)();
|
|
89
82
|
const _ref = (_useFlowContext = (0, _FlowContext.useFlowContext)()) !== null && _useFlowContext !== void 0 ? _useFlowContext : {},
|
|
90
83
|
workflow = _ref.workflow;
|
|
91
|
-
const ctx = (0,
|
|
92
|
-
const _useResourceActionCon = (0,
|
|
84
|
+
const ctx = (0, _client().useActionContext)();
|
|
85
|
+
const _useResourceActionCon = (0, _client().useResourceActionContext)(),
|
|
93
86
|
refresh = _useResourceActionCon.refresh;
|
|
94
87
|
return {
|
|
95
88
|
run() {
|
|
@@ -112,12 +105,12 @@ function useUpdateConfigAction() {
|
|
|
112
105
|
}
|
|
113
106
|
};
|
|
114
107
|
}
|
|
115
|
-
const triggers = new (
|
|
108
|
+
const triggers = new (_client2().Registry)();
|
|
116
109
|
exports.triggers = triggers;
|
|
117
110
|
triggers.register(_collection.default.type, _collection.default);
|
|
118
111
|
triggers.register(_schedule.default.type, _schedule.default);
|
|
119
112
|
function TriggerExecution() {
|
|
120
|
-
const compile = (0,
|
|
113
|
+
const compile = (0, _client().useCompile)();
|
|
121
114
|
const _useFlowContext2 = (0, _FlowContext.useFlowContext)(),
|
|
122
115
|
workflow = _useFlowContext2.workflow,
|
|
123
116
|
execution = _useFlowContext2.execution;
|
|
@@ -125,13 +118,13 @@ function TriggerExecution() {
|
|
|
125
118
|
return null;
|
|
126
119
|
}
|
|
127
120
|
const trigger = triggers.get(workflow.type);
|
|
128
|
-
return
|
|
121
|
+
return _react2().default.createElement(_client().SchemaComponent, {
|
|
129
122
|
schema: {
|
|
130
123
|
type: 'void',
|
|
131
124
|
name: 'execution',
|
|
132
125
|
'x-component': 'Action',
|
|
133
126
|
'x-component-props': {
|
|
134
|
-
title:
|
|
127
|
+
title: _react2().default.createElement(_icons().InfoOutlined, null),
|
|
135
128
|
shape: 'circle',
|
|
136
129
|
className: _style.nodeJobButtonClass,
|
|
137
130
|
type: 'primary'
|
|
@@ -144,9 +137,9 @@ function TriggerExecution() {
|
|
|
144
137
|
initialValue: execution
|
|
145
138
|
},
|
|
146
139
|
'x-component': 'Action.Modal',
|
|
147
|
-
title:
|
|
148
|
-
className: (0,
|
|
149
|
-
},
|
|
140
|
+
title: _react2().default.createElement("div", {
|
|
141
|
+
className: (0, _client().cx)(_style.nodeTitleClass)
|
|
142
|
+
}, _react2().default.createElement(_antd().Tag, null, compile(trigger.title)), _react2().default.createElement("strong", null, workflow.title), _react2().default.createElement("span", {
|
|
150
143
|
className: "workflow-node-id"
|
|
151
144
|
}, "#", execution.id)),
|
|
152
145
|
properties: {
|
|
@@ -166,7 +159,7 @@ function TriggerExecution() {
|
|
|
166
159
|
'x-decorator': 'FormItem',
|
|
167
160
|
'x-component': 'Input.JSON',
|
|
168
161
|
'x-component-props': {
|
|
169
|
-
className: (0,
|
|
162
|
+
className: (0, _client().css)`
|
|
170
163
|
padding: 1em;
|
|
171
164
|
background-color: #eee;
|
|
172
165
|
`
|
|
@@ -180,27 +173,28 @@ function TriggerExecution() {
|
|
|
180
173
|
});
|
|
181
174
|
}
|
|
182
175
|
const TriggerConfig = () => {
|
|
183
|
-
const api = (0,
|
|
184
|
-
const compile = (0,
|
|
176
|
+
const api = (0, _client().useAPIClient)();
|
|
177
|
+
const compile = (0, _client().useCompile)();
|
|
185
178
|
const _useFlowContext3 = (0, _FlowContext.useFlowContext)(),
|
|
186
179
|
workflow = _useFlowContext3.workflow,
|
|
187
180
|
refresh = _useFlowContext3.refresh;
|
|
188
|
-
const _useState = (0,
|
|
181
|
+
const _useState = (0, _react2().useState)(''),
|
|
189
182
|
_useState2 = _slicedToArray(_useState, 2),
|
|
190
183
|
editingTitle = _useState2[0],
|
|
191
184
|
setEditingTitle = _useState2[1];
|
|
192
|
-
const _useState3 = (0,
|
|
185
|
+
const _useState3 = (0, _react2().useState)(false),
|
|
193
186
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
194
187
|
editingConfig = _useState4[0],
|
|
195
188
|
setEditingConfig = _useState4[1];
|
|
196
189
|
let typeTitle = '';
|
|
197
|
-
(0,
|
|
190
|
+
(0, _react2().useEffect)(() => {
|
|
198
191
|
if (workflow) {
|
|
199
192
|
var _workflow$title;
|
|
200
193
|
setEditingTitle((_workflow$title = workflow.title) !== null && _workflow$title !== void 0 ? _workflow$title : typeTitle);
|
|
201
194
|
}
|
|
202
195
|
}, [workflow]);
|
|
203
|
-
const form = (0,
|
|
196
|
+
const form = (0, _react2().useMemo)(() => (0, _core().createForm)({
|
|
197
|
+
initialValues: workflow === null || workflow === void 0 ? void 0 : workflow.config,
|
|
204
198
|
values: workflow === null || workflow === void 0 ? void 0 : workflow.config,
|
|
205
199
|
disabled: workflow === null || workflow === void 0 ? void 0 : workflow.executed
|
|
206
200
|
}), [workflow]);
|
|
@@ -253,24 +247,24 @@ const TriggerConfig = () => {
|
|
|
253
247
|
}
|
|
254
248
|
}
|
|
255
249
|
}
|
|
256
|
-
return
|
|
257
|
-
className: (0,
|
|
250
|
+
return _react2().default.createElement("div", {
|
|
251
|
+
className: (0, _client().cx)(_style.nodeCardClass),
|
|
258
252
|
onClick: onOpenDrawer
|
|
259
|
-
},
|
|
260
|
-
className: (0,
|
|
261
|
-
},
|
|
253
|
+
}, _react2().default.createElement("div", {
|
|
254
|
+
className: (0, _client().cx)(_style.nodeMetaClass, 'workflow-node-meta')
|
|
255
|
+
}, _react2().default.createElement(_antd().Tag, {
|
|
262
256
|
color: "gold"
|
|
263
|
-
}, titleText)),
|
|
257
|
+
}, titleText)), _react2().default.createElement("div", null, _react2().default.createElement(_antd().Input.TextArea, {
|
|
264
258
|
value: editingTitle,
|
|
265
259
|
onChange: ev => setEditingTitle(ev.target.value),
|
|
266
260
|
onBlur: ev => onChangeTitle(ev.target.value),
|
|
267
261
|
autoSize: true
|
|
268
|
-
})),
|
|
262
|
+
})), _react2().default.createElement(TriggerExecution, null), _react2().default.createElement(_client().ActionContextProvider, {
|
|
269
263
|
value: {
|
|
270
264
|
visible: editingConfig,
|
|
271
265
|
setVisible: setEditingConfig
|
|
272
266
|
}
|
|
273
|
-
},
|
|
267
|
+
}, _react2().default.createElement(_client().SchemaComponent, {
|
|
274
268
|
schema: {
|
|
275
269
|
name: `workflow-trigger-${workflow.id}`,
|
|
276
270
|
type: 'void',
|
|
@@ -299,7 +293,7 @@ const TriggerConfig = () => {
|
|
|
299
293
|
type: 'warning',
|
|
300
294
|
showIcon: true,
|
|
301
295
|
message: `{{t("Trigger in executed workflow cannot be modified", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
302
|
-
className: (0,
|
|
296
|
+
className: (0, _client().css)`
|
|
303
297
|
width: 100%;
|
|
304
298
|
font-size: 85%;
|
|
305
299
|
margin-bottom: 2em;
|
|
@@ -311,7 +305,7 @@ const TriggerConfig = () => {
|
|
|
311
305
|
type: 'void',
|
|
312
306
|
'x-component': 'fieldset',
|
|
313
307
|
'x-component-props': {
|
|
314
|
-
className: (0,
|
|
308
|
+
className: (0, _client().css)`
|
|
315
309
|
.ant-select:not(.full-width) {
|
|
316
310
|
width: auto;
|
|
317
311
|
min-width: 6em;
|
|
@@ -55,7 +55,7 @@ const DateFieldsSelect = (0, _react().observer)(props => {
|
|
|
55
55
|
values = _useForm.values;
|
|
56
56
|
const fields = getCollectionFields(values === null || values === void 0 ? void 0 : values.collection);
|
|
57
57
|
return _react2().default.createElement(_antd().Select, _objectSpread({
|
|
58
|
-
|
|
58
|
+
popupMatchSelectWidth: false,
|
|
59
59
|
placeholder: t('Select field')
|
|
60
60
|
}, props), fields.filter(field => !field.hidden && (field.uiSchema ? field.type === 'date' : false)).map(field => {
|
|
61
61
|
var _field$uiSchema;
|
|
@@ -4,23 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.EndsByField = EndsByField;
|
|
7
|
-
function
|
|
8
|
-
const data = require("@
|
|
9
|
-
|
|
7
|
+
function _client() {
|
|
8
|
+
const data = require("@nocobase/client");
|
|
9
|
+
_client = function _client() {
|
|
10
10
|
return data;
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
const data = require("
|
|
16
|
-
|
|
14
|
+
function _client2() {
|
|
15
|
+
const data = require("@nocobase/utils/client");
|
|
16
|
+
_client2 = function _client2() {
|
|
17
17
|
return data;
|
|
18
18
|
};
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const data =
|
|
23
|
-
|
|
21
|
+
function _antd() {
|
|
22
|
+
const data = require("antd");
|
|
23
|
+
_antd = function _antd() {
|
|
24
24
|
return data;
|
|
25
25
|
};
|
|
26
26
|
return data;
|
|
@@ -43,7 +43,7 @@ function EndsByField({
|
|
|
43
43
|
t = _useWorkflowTranslati.t;
|
|
44
44
|
const type = value != null ? typeof value === 'object' && !(value instanceof Date) ? 'field' : 'date' : null;
|
|
45
45
|
return _react().default.createElement("fieldset", {
|
|
46
|
-
className: (0,
|
|
46
|
+
className: (0, _client().css)`
|
|
47
47
|
display: flex;
|
|
48
48
|
gap: 0.5em;
|
|
49
49
|
`
|
|
@@ -63,7 +63,7 @@ function EndsByField({
|
|
|
63
63
|
onChange: _onChange
|
|
64
64
|
}) : null, type === 'date' ? _react().default.createElement(_antd().DatePicker, {
|
|
65
65
|
showTime: true,
|
|
66
|
-
value: (0,
|
|
66
|
+
value: (0, _client2().dayjs)(value),
|
|
67
67
|
onChange: v => {
|
|
68
68
|
_onChange(v ? v.toDate() : null);
|
|
69
69
|
}
|
|
@@ -4,23 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.OnField = OnField;
|
|
7
|
-
function
|
|
8
|
-
const data =
|
|
9
|
-
|
|
7
|
+
function _client() {
|
|
8
|
+
const data = require("@nocobase/client");
|
|
9
|
+
_client = function _client() {
|
|
10
10
|
return data;
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
const data = require("
|
|
16
|
-
|
|
14
|
+
function _antd() {
|
|
15
|
+
const data = require("antd");
|
|
16
|
+
_antd = function _antd() {
|
|
17
17
|
return data;
|
|
18
18
|
};
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const data = require("
|
|
23
|
-
|
|
21
|
+
function _react() {
|
|
22
|
+
const data = _interopRequireWildcard(require("react"));
|
|
23
|
+
_react = function _react() {
|
|
24
24
|
return data;
|
|
25
25
|
};
|
|
26
26
|
return data;
|
|
@@ -32,8 +32,8 @@ function _reactI18next() {
|
|
|
32
32
|
};
|
|
33
33
|
return data;
|
|
34
34
|
}
|
|
35
|
-
var _DateFieldsSelect = require("./DateFieldsSelect");
|
|
36
35
|
var _locale = require("../../locale");
|
|
36
|
+
var _DateFieldsSelect = require("./DateFieldsSelect");
|
|
37
37
|
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); }
|
|
38
38
|
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; }
|
|
39
39
|
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; }
|
|
@@ -60,7 +60,7 @@ function OnField({
|
|
|
60
60
|
dir = _useState2[0],
|
|
61
61
|
setDir = _useState2[1];
|
|
62
62
|
return _react().default.createElement("fieldset", {
|
|
63
|
-
className: (0,
|
|
63
|
+
className: (0, _client().css)`
|
|
64
64
|
display: flex;
|
|
65
65
|
gap: 0.5em;
|
|
66
66
|
`
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.RepeatField = RepeatField;
|
|
7
|
-
function
|
|
8
|
-
const data = require("@
|
|
9
|
-
|
|
7
|
+
function _client() {
|
|
8
|
+
const data = require("@nocobase/client");
|
|
9
|
+
_client = function _client() {
|
|
10
10
|
return data;
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
@@ -114,7 +114,7 @@ function RepeatField({
|
|
|
114
114
|
}
|
|
115
115
|
const locale = languages[localStorage.getItem('NOCOBASE_LOCALE') || 'en-US'];
|
|
116
116
|
return _react().default.createElement("fieldset", {
|
|
117
|
-
className: (0,
|
|
117
|
+
className: (0, _client().css)`
|
|
118
118
|
display: flex;
|
|
119
119
|
flex-direction: ${typeValue === 'cron' ? 'column' : 'row'};
|
|
120
120
|
align-items: flex-start;
|
|
@@ -4,13 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ScheduleConfig = void 0;
|
|
7
|
-
function _react() {
|
|
8
|
-
const data = _interopRequireWildcard(require("react"));
|
|
9
|
-
_react = function _react() {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
7
|
function _core() {
|
|
15
8
|
const data = require("@formily/core");
|
|
16
9
|
_core = function _core() {
|
|
@@ -18,33 +11,33 @@ function _core() {
|
|
|
18
11
|
};
|
|
19
12
|
return data;
|
|
20
13
|
}
|
|
21
|
-
function
|
|
14
|
+
function _react() {
|
|
22
15
|
const data = require("@formily/react");
|
|
23
|
-
|
|
16
|
+
_react = function _react() {
|
|
24
17
|
return data;
|
|
25
18
|
};
|
|
26
19
|
return data;
|
|
27
20
|
}
|
|
28
|
-
function
|
|
29
|
-
const data = require("@
|
|
30
|
-
|
|
21
|
+
function _client() {
|
|
22
|
+
const data = require("@nocobase/client");
|
|
23
|
+
_client = function _client() {
|
|
31
24
|
return data;
|
|
32
25
|
};
|
|
33
26
|
return data;
|
|
34
27
|
}
|
|
35
|
-
function
|
|
36
|
-
const data = require("
|
|
37
|
-
|
|
28
|
+
function _react2() {
|
|
29
|
+
const data = _interopRequireWildcard(require("react"));
|
|
30
|
+
_react2 = function _react2() {
|
|
38
31
|
return data;
|
|
39
32
|
};
|
|
40
33
|
return data;
|
|
41
34
|
}
|
|
35
|
+
var _locale = require("../../locale");
|
|
42
36
|
var _collection = require("../../schemas/collection");
|
|
43
|
-
var
|
|
37
|
+
var _constants = require("./constants");
|
|
44
38
|
var _EndsByField = require("./EndsByField");
|
|
39
|
+
var _OnField = require("./OnField");
|
|
45
40
|
var _RepeatField = require("./RepeatField");
|
|
46
|
-
var _constants = require("./constants");
|
|
47
|
-
var _locale = require("../../locale");
|
|
48
41
|
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); }
|
|
49
42
|
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; }
|
|
50
43
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
@@ -195,15 +188,15 @@ const scheduleModeOptions = [{
|
|
|
195
188
|
label: `{{t("Based on date field of collection", { ns: "${_locale.NAMESPACE}" })}}`
|
|
196
189
|
}];
|
|
197
190
|
const ScheduleConfig = () => {
|
|
198
|
-
const _useForm = (0,
|
|
191
|
+
const _useForm = (0, _react().useForm)(),
|
|
199
192
|
_useForm$values = _useForm.values,
|
|
200
193
|
values = _useForm$values === void 0 ? {} : _useForm$values,
|
|
201
194
|
clearFormGraph = _useForm.clearFormGraph;
|
|
202
|
-
const _useState = (0,
|
|
195
|
+
const _useState = (0, _react2().useState)(values.mode),
|
|
203
196
|
_useState2 = _slicedToArray(_useState, 2),
|
|
204
197
|
mode = _useState2[0],
|
|
205
198
|
setMode = _useState2[1];
|
|
206
|
-
(0,
|
|
199
|
+
(0, _react().useFormEffects)(() => {
|
|
207
200
|
(0, _core().onFieldValueChange)('mode', field => {
|
|
208
201
|
setMode(field.value);
|
|
209
202
|
clearFormGraph('collection');
|
|
@@ -213,7 +206,7 @@ const ScheduleConfig = () => {
|
|
|
213
206
|
clearFormGraph('limit');
|
|
214
207
|
});
|
|
215
208
|
});
|
|
216
|
-
return
|
|
209
|
+
return _react2().default.createElement(_react2().default.Fragment, null, _react2().default.createElement(_client().SchemaComponent, {
|
|
217
210
|
schema: {
|
|
218
211
|
type: 'number',
|
|
219
212
|
title: `{{t("Trigger mode", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
@@ -226,7 +219,7 @@ const ScheduleConfig = () => {
|
|
|
226
219
|
required: true,
|
|
227
220
|
default: _constants.SCHEDULE_MODE.STATIC
|
|
228
221
|
}
|
|
229
|
-
}),
|
|
222
|
+
}), _react2().default.createElement(_client().SchemaComponent, {
|
|
230
223
|
schema: {
|
|
231
224
|
type: 'void',
|
|
232
225
|
properties: {
|
|
@@ -234,7 +227,7 @@ const ScheduleConfig = () => {
|
|
|
234
227
|
type: 'void',
|
|
235
228
|
'x-component': 'fieldset',
|
|
236
229
|
'x-component-props': {
|
|
237
|
-
className: (0,
|
|
230
|
+
className: (0, _client().css)`
|
|
238
231
|
.ant-input-number {
|
|
239
232
|
width: 4em;
|
|
240
233
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { useCollectionDataSource, SchemaInitializerItemOptions } from '@nocobase/client';
|
|
2
3
|
declare const _default: {
|
|
3
4
|
title: string;
|
|
@@ -14,11 +15,9 @@ declare const _default: {
|
|
|
14
15
|
};
|
|
15
16
|
components: {
|
|
16
17
|
ScheduleConfig: () => import("react").JSX.Element;
|
|
17
|
-
FieldsSelect: import("react").MemoExoticComponent<import("@formily/reactive-react").ReactFC<
|
|
18
|
+
FieldsSelect: import("react").MemoExoticComponent<import("@formily/reactive-react").ReactFC<Omit<any, "ref">>>;
|
|
18
19
|
};
|
|
19
|
-
useVariables(config: any,
|
|
20
|
-
types: any;
|
|
21
|
-
}): any[];
|
|
20
|
+
useVariables(config: any, opts: any): any[];
|
|
22
21
|
useInitializers(config: any): SchemaInitializerItemOptions | null;
|
|
23
22
|
initializers: {};
|
|
24
23
|
};
|
|
@@ -17,6 +17,11 @@ var _locale = require("../../locale");
|
|
|
17
17
|
var _CollectionBlockInitializer = require("../../components/CollectionBlockInitializer");
|
|
18
18
|
var _variable = require("../../variable");
|
|
19
19
|
var _FieldsSelect = require("../../components/FieldsSelect");
|
|
20
|
+
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; }
|
|
21
|
+
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; }
|
|
22
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
24
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
20
25
|
var _default = {
|
|
21
26
|
title: `{{t("Schedule event", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
22
27
|
type: 'schedule',
|
|
@@ -34,28 +39,33 @@ var _default = {
|
|
|
34
39
|
ScheduleConfig: _ScheduleConfig.ScheduleConfig,
|
|
35
40
|
FieldsSelect: _FieldsSelect.FieldsSelect
|
|
36
41
|
},
|
|
37
|
-
useVariables(config, {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
+
useVariables(config, opts) {
|
|
43
|
+
var _config$appends;
|
|
44
|
+
const compile = (0, _client().useCompile)();
|
|
45
|
+
const _useCollectionManager = (0, _client().useCollectionManager)(),
|
|
46
|
+
getCollectionFields = _useCollectionManager.getCollectionFields;
|
|
42
47
|
const options = [];
|
|
43
|
-
if (!types || types.includes('date')) {
|
|
48
|
+
if (!(opts !== null && opts !== void 0 && opts.types) || opts.types.includes('date')) {
|
|
44
49
|
options.push({
|
|
45
50
|
key: 'date',
|
|
46
51
|
value: 'date',
|
|
47
|
-
label:
|
|
52
|
+
label: (0, _locale.lang)('Trigger time')
|
|
48
53
|
});
|
|
49
54
|
}
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
const depth = (_config$appends = config.appends) !== null && _config$appends !== void 0 && _config$appends.length ? config.appends.reduce((max, item) => Math.max(max, item.split('.').length), 1) + 1 : 1;
|
|
56
|
+
const fieldOptions = (0, _variable.getCollectionFieldOptions)(_objectSpread(_objectSpread({
|
|
57
|
+
depth
|
|
58
|
+
}, opts), {}, {
|
|
59
|
+
collection: config.collection,
|
|
60
|
+
compile,
|
|
61
|
+
getCollectionFields
|
|
62
|
+
}));
|
|
53
63
|
if (config.mode === _constants.SCHEDULE_MODE.COLLECTION_FIELD) {
|
|
54
64
|
if (fieldOptions.length) {
|
|
55
65
|
options.push({
|
|
56
66
|
key: 'data',
|
|
57
67
|
value: 'data',
|
|
58
|
-
label:
|
|
68
|
+
label: (0, _locale.lang)('Trigger data'),
|
|
59
69
|
children: fieldOptions
|
|
60
70
|
});
|
|
61
71
|
}
|
package/lib/client/variable.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type VariableOption = {
|
|
2
2
|
key?: string;
|
|
3
3
|
value: string;
|
|
4
4
|
label: string;
|
|
5
5
|
children?: VariableOptions;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
7
|
+
export type VariableOptions = VariableOption[] | null;
|
|
8
8
|
export declare const nodesOptions: {
|
|
9
9
|
label: string;
|
|
10
10
|
value: string;
|
|
@@ -37,7 +37,6 @@ export declare const BaseTypeSets: {
|
|
|
37
37
|
string: Set<string>;
|
|
38
38
|
date: Set<string>;
|
|
39
39
|
};
|
|
40
|
-
export declare function filterTypedFields(fields: any, types: any, depth?: number): any;
|
|
41
40
|
export declare function useWorkflowVariableOptions(options?: {}): {
|
|
42
41
|
label: any;
|
|
43
42
|
value: any;
|
|
@@ -45,4 +44,4 @@ export declare function useWorkflowVariableOptions(options?: {}): {
|
|
|
45
44
|
children: any;
|
|
46
45
|
disabled: boolean;
|
|
47
46
|
}[];
|
|
48
|
-
export declare function
|
|
47
|
+
export declare function getCollectionFieldOptions(options: any): VariableOption[];
|