@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.
- package/client.d.ts +4 -0
- package/client.js +30 -0
- package/lib/client/ExecutionResourceProvider.d.ts +4 -0
- package/lib/client/ExecutionResourceProvider.js +64 -0
- package/lib/client/WorkflowCanvas.d.ts +15 -0
- package/lib/client/WorkflowCanvas.js +393 -0
- package/lib/client/WorkflowLink.d.ts +1 -0
- package/lib/client/WorkflowLink.js +66 -0
- package/lib/client/WorkflowPage.d.ts +1 -0
- package/lib/client/WorkflowPage.js +92 -0
- package/lib/client/WorkflowProvider.d.ts +1 -0
- package/lib/client/WorkflowProvider.js +78 -0
- package/lib/client/WorkflowShortcut.d.ts +1 -0
- package/lib/client/WorkflowShortcut.js +123 -0
- package/lib/client/calculators.d.ts +101 -0
- package/lib/client/calculators.js +739 -0
- package/lib/client/components/Duration.d.ts +5 -0
- package/lib/client/components/Duration.js +96 -0
- package/lib/client/index.d.ts +3 -0
- package/lib/client/index.js +38 -0
- package/lib/client/nodes/calculation.d.ts +25 -0
- package/lib/client/nodes/calculation.js +85 -0
- package/lib/client/nodes/condition.d.ts +46 -0
- package/lib/client/nodes/condition.js +346 -0
- package/lib/client/nodes/create.d.ts +46 -0
- package/lib/client/nodes/create.js +133 -0
- package/lib/client/nodes/delay.d.ts +36 -0
- package/lib/client/nodes/delay.js +49 -0
- package/lib/client/nodes/destroy.d.ts +55 -0
- package/lib/client/nodes/destroy.js +46 -0
- package/lib/client/nodes/index.d.ts +33 -0
- package/lib/client/nodes/index.js +390 -0
- package/lib/client/nodes/parallel.d.ts +24 -0
- package/lib/client/nodes/parallel.js +216 -0
- package/lib/client/nodes/query.d.ts +70 -0
- package/lib/client/nodes/query.js +143 -0
- package/lib/client/nodes/update.d.ts +60 -0
- package/lib/client/nodes/update.js +48 -0
- package/lib/client/schemas/collection.d.ts +42 -0
- package/lib/client/schemas/collection.js +98 -0
- package/lib/client/schemas/executions.d.ts +209 -0
- package/lib/client/schemas/executions.js +164 -0
- package/lib/client/schemas/workflows.d.ts +2 -0
- package/lib/client/schemas/workflows.js +328 -0
- package/lib/client/style.d.ts +12 -0
- package/lib/client/style.js +216 -0
- package/lib/client/triggers/collection.d.ts +92 -0
- package/lib/client/triggers/collection.js +253 -0
- package/lib/client/triggers/index.d.ts +26 -0
- package/lib/client/triggers/index.js +238 -0
- package/lib/client/triggers/schedule/DateFieldsSelect.d.ts +2 -0
- package/lib/client/triggers/schedule/DateFieldsSelect.js +92 -0
- package/lib/client/triggers/schedule/EndsByField.d.ts +5 -0
- package/lib/client/triggers/schedule/EndsByField.js +102 -0
- package/lib/client/triggers/schedule/OnField.d.ts +5 -0
- package/lib/client/triggers/schedule/OnField.js +128 -0
- package/lib/client/triggers/schedule/RepeatField.d.ts +5 -0
- package/lib/client/triggers/schedule/RepeatField.js +191 -0
- package/lib/client/triggers/schedule/ScheduleConfig.d.ts +1 -0
- package/lib/client/triggers/schedule/ScheduleConfig.js +286 -0
- package/lib/client/triggers/schedule/index.d.ts +25 -0
- package/lib/client/triggers/schedule/index.js +124 -0
- package/lib/client/triggers/schedule/locale/Cron.zh-CN.d.ts +34 -0
- package/lib/client/triggers/schedule/locale/Cron.zh-CN.js +44 -0
- package/lib/index.d.ts +1 -6
- package/lib/index.js +2 -73
- package/lib/{Plugin.d.ts → server/Plugin.d.ts} +0 -0
- package/lib/{Plugin.js → server/Plugin.js} +0 -0
- package/lib/{Processor.d.ts → server/Processor.d.ts} +4 -3
- package/lib/{Processor.js → server/Processor.js} +40 -24
- package/lib/{actions → server/actions}/index.d.ts +0 -0
- package/lib/{actions → server/actions}/index.js +0 -0
- package/lib/{actions → server/actions}/nodes.d.ts +0 -0
- package/lib/{actions → server/actions}/nodes.js +1 -0
- package/lib/{actions → server/actions}/workflows.d.ts +0 -0
- package/lib/{actions → server/actions}/workflows.js +0 -0
- package/lib/{calculators → server/calculators}/index.d.ts +0 -0
- package/lib/{calculators → server/calculators}/index.js +0 -0
- package/lib/{collections → server/collections}/executions.d.ts +0 -0
- package/lib/{collections → server/collections}/executions.js +0 -0
- package/lib/{collections → server/collections}/flow_nodes.d.ts +0 -0
- package/lib/{collections → server/collections}/flow_nodes.js +0 -0
- package/lib/{collections → server/collections}/jobs.d.ts +0 -0
- package/lib/{collections → server/collections}/jobs.js +0 -0
- package/lib/{collections → server/collections}/workflows.d.ts +0 -0
- package/lib/{collections → server/collections}/workflows.js +0 -0
- package/lib/{constants.d.ts → server/constants.d.ts} +0 -0
- package/lib/{constants.js → server/constants.js} +0 -0
- package/lib/server/index.d.ts +6 -0
- package/lib/server/index.js +86 -0
- package/lib/{instructions → server/instructions}/calculation.d.ts +0 -0
- package/lib/{instructions → server/instructions}/calculation.js +0 -0
- package/lib/{instructions → server/instructions}/condition.d.ts +0 -0
- package/lib/{instructions → server/instructions}/condition.js +0 -0
- package/lib/{instructions → server/instructions}/create.d.ts +0 -0
- package/lib/{instructions → server/instructions}/create.js +0 -0
- package/lib/{instructions → server/instructions}/delay.d.ts +0 -0
- package/lib/{instructions → server/instructions}/delay.js +12 -5
- package/lib/{instructions → server/instructions}/destroy.d.ts +0 -0
- package/lib/{instructions → server/instructions}/destroy.js +0 -0
- package/lib/{instructions → server/instructions}/index.d.ts +0 -0
- package/lib/{instructions → server/instructions}/index.js +0 -0
- package/lib/{instructions → server/instructions}/parallel.d.ts +0 -0
- package/lib/{instructions → server/instructions}/parallel.js +62 -20
- package/lib/{instructions → server/instructions}/prompt.d.ts +0 -0
- package/lib/{instructions → server/instructions}/prompt.js +0 -0
- package/lib/{instructions → server/instructions}/query.d.ts +0 -0
- package/lib/{instructions → server/instructions}/query.js +0 -0
- package/lib/{instructions → server/instructions}/update.d.ts +0 -0
- package/lib/{instructions → server/instructions}/update.js +0 -0
- package/lib/{models → server/models}/Execution.d.ts +0 -0
- package/lib/{models → server/models}/Execution.js +0 -0
- package/lib/{models → server/models}/FlowNode.d.ts +0 -0
- package/lib/{models → server/models}/FlowNode.js +0 -0
- package/lib/{models → server/models}/Job.d.ts +0 -0
- package/lib/{models → server/models}/Job.js +0 -0
- package/lib/{models → server/models}/Workflow.d.ts +0 -0
- package/lib/{models → server/models}/Workflow.js +0 -0
- package/lib/{triggers → server/triggers}/collection.d.ts +0 -0
- package/lib/{triggers → server/triggers}/collection.js +0 -0
- package/lib/{triggers → server/triggers}/index.d.ts +0 -0
- package/lib/{triggers → server/triggers}/index.js +0 -0
- package/lib/{triggers → server/triggers}/schedule.d.ts +0 -0
- package/lib/{triggers → server/triggers}/schedule.js +2 -2
- package/package.json +10 -8
- package/server.d.ts +4 -0
- package/server.js +30 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.RepeatField = RepeatField;
|
|
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
|
+
function _antd() {
|
|
19
|
+
const data = require("antd");
|
|
20
|
+
|
|
21
|
+
_antd = function _antd() {
|
|
22
|
+
return data;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function _react() {
|
|
29
|
+
const data = _interopRequireDefault(require("react"));
|
|
30
|
+
|
|
31
|
+
_react = function _react() {
|
|
32
|
+
return data;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return data;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function _reactI18next() {
|
|
39
|
+
const data = require("react-i18next");
|
|
40
|
+
|
|
41
|
+
_reactI18next = function _reactI18next() {
|
|
42
|
+
return data;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return data;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function _reactJsCron() {
|
|
49
|
+
const data = require("react-js-cron");
|
|
50
|
+
|
|
51
|
+
_reactJsCron = function _reactJsCron() {
|
|
52
|
+
return data;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return data;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
var _Cron = _interopRequireDefault(require("./locale/Cron.zh-CN"));
|
|
59
|
+
|
|
60
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
61
|
+
|
|
62
|
+
const languages = {
|
|
63
|
+
'zh-CN': _Cron.default
|
|
64
|
+
};
|
|
65
|
+
const RepeatOptions = [{
|
|
66
|
+
value: 'none',
|
|
67
|
+
text: 'No repeat'
|
|
68
|
+
}, {
|
|
69
|
+
value: 60000,
|
|
70
|
+
text: 'By minute',
|
|
71
|
+
unitText: 'Minutes'
|
|
72
|
+
}, {
|
|
73
|
+
value: 3600000,
|
|
74
|
+
text: 'By hour',
|
|
75
|
+
unitText: 'Hours'
|
|
76
|
+
}, {
|
|
77
|
+
value: 86400000,
|
|
78
|
+
text: 'By day',
|
|
79
|
+
unitText: 'Days'
|
|
80
|
+
}, {
|
|
81
|
+
value: 604800000,
|
|
82
|
+
text: 'By week',
|
|
83
|
+
unitText: 'Weeks'
|
|
84
|
+
}, // { value: 18144_000_000, text: 'By 30 days' },
|
|
85
|
+
{
|
|
86
|
+
value: 'cron',
|
|
87
|
+
text: 'Advanced'
|
|
88
|
+
}];
|
|
89
|
+
|
|
90
|
+
function getNumberOption(v) {
|
|
91
|
+
const opts = RepeatOptions.filter(option => typeof option.value === 'number').reverse();
|
|
92
|
+
return opts.find(item => !(v % item.value));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function getRepeatTypeValue(v) {
|
|
96
|
+
switch (typeof v) {
|
|
97
|
+
case 'number':
|
|
98
|
+
const option = getNumberOption(v);
|
|
99
|
+
return option ? option.value : 'none';
|
|
100
|
+
|
|
101
|
+
case 'string':
|
|
102
|
+
return 'cron';
|
|
103
|
+
|
|
104
|
+
default:
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return 'none';
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function CommonRepeatField({
|
|
112
|
+
value,
|
|
113
|
+
onChange: _onChange
|
|
114
|
+
}) {
|
|
115
|
+
const _useTranslation = (0, _reactI18next().useTranslation)(),
|
|
116
|
+
t = _useTranslation.t;
|
|
117
|
+
|
|
118
|
+
const option = getNumberOption(value);
|
|
119
|
+
return _react().default.createElement(_antd().InputNumber, {
|
|
120
|
+
value: value / option.value,
|
|
121
|
+
onChange: v => _onChange(v * option.value),
|
|
122
|
+
min: 1,
|
|
123
|
+
addonBefore: t('Every'),
|
|
124
|
+
addonAfter: t(option.unitText)
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function RepeatField({
|
|
129
|
+
value = null,
|
|
130
|
+
onChange
|
|
131
|
+
}) {
|
|
132
|
+
const _useTranslation2 = (0, _reactI18next().useTranslation)(),
|
|
133
|
+
t = _useTranslation2.t;
|
|
134
|
+
|
|
135
|
+
const typeValue = getRepeatTypeValue(value);
|
|
136
|
+
|
|
137
|
+
function onTypeChange(v) {
|
|
138
|
+
if (v === 'none') {
|
|
139
|
+
onChange(null);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (v === 'cron') {
|
|
144
|
+
onChange('0 * * * * *');
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
onChange(v);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const locale = languages[localStorage.getItem('NOCOBASE_LOCALE') || 'en-US'];
|
|
152
|
+
return _react().default.createElement("fieldset", {
|
|
153
|
+
className: (0, _css().css)`
|
|
154
|
+
display: flex;
|
|
155
|
+
flex-direction: ${typeValue === 'cron' ? 'column' : 'row'};
|
|
156
|
+
align-items: flex-start;
|
|
157
|
+
gap: .5em;
|
|
158
|
+
|
|
159
|
+
.react-js-cron{
|
|
160
|
+
padding: .5em .5em 0 .5em;
|
|
161
|
+
border: 1px dashed #ccc;
|
|
162
|
+
|
|
163
|
+
.react-js-cron-field{
|
|
164
|
+
margin-bottom: .5em;
|
|
165
|
+
|
|
166
|
+
> span{
|
|
167
|
+
margin: 0 .5em 0 0;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
> .react-js-cron-select{
|
|
171
|
+
margin: 0 .5em 0 0;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
`
|
|
176
|
+
}, _react().default.createElement(_antd().Select, {
|
|
177
|
+
value: typeValue,
|
|
178
|
+
onChange: onTypeChange
|
|
179
|
+
}, RepeatOptions.map(item => _react().default.createElement(_antd().Select.Option, {
|
|
180
|
+
key: item.value,
|
|
181
|
+
value: item.value
|
|
182
|
+
}, t(item.text)))), typeof typeValue === 'number' ? _react().default.createElement(CommonRepeatField, {
|
|
183
|
+
value: value,
|
|
184
|
+
onChange: onChange
|
|
185
|
+
}) : null, typeValue === 'cron' ? _react().default.createElement(_reactJsCron().Cron, {
|
|
186
|
+
value: value.trim().split(/\s+/).slice(1).join(' '),
|
|
187
|
+
setValue: v => onChange(`0 ${v}`),
|
|
188
|
+
clearButton: false,
|
|
189
|
+
locale: locale
|
|
190
|
+
}) : null);
|
|
191
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ScheduleConfig: () => JSX.Element;
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ScheduleConfig = void 0;
|
|
7
|
+
|
|
8
|
+
function _react() {
|
|
9
|
+
const data = _interopRequireWildcard(require("react"));
|
|
10
|
+
|
|
11
|
+
_react = function _react() {
|
|
12
|
+
return data;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function _core() {
|
|
19
|
+
const data = require("@formily/core");
|
|
20
|
+
|
|
21
|
+
_core = function _core() {
|
|
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 _css() {
|
|
39
|
+
const data = require("@emotion/css");
|
|
40
|
+
|
|
41
|
+
_css = function _css() {
|
|
42
|
+
return data;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return data;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function _client() {
|
|
49
|
+
const data = require("@nocobase/client");
|
|
50
|
+
|
|
51
|
+
_client = function _client() {
|
|
52
|
+
return data;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return data;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
var _collection = require("../../schemas/collection");
|
|
59
|
+
|
|
60
|
+
var _OnField = require("./OnField");
|
|
61
|
+
|
|
62
|
+
var _EndsByField = require("./EndsByField");
|
|
63
|
+
|
|
64
|
+
var _RepeatField = require("./RepeatField");
|
|
65
|
+
|
|
66
|
+
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); }
|
|
67
|
+
|
|
68
|
+
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; }
|
|
69
|
+
|
|
70
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
71
|
+
|
|
72
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
73
|
+
|
|
74
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
75
|
+
|
|
76
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
77
|
+
|
|
78
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
79
|
+
|
|
80
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
81
|
+
|
|
82
|
+
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; }
|
|
83
|
+
|
|
84
|
+
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; }
|
|
85
|
+
|
|
86
|
+
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; }
|
|
87
|
+
|
|
88
|
+
const ModeFieldsets = {
|
|
89
|
+
0: {
|
|
90
|
+
startsOn: {
|
|
91
|
+
type: 'datetime',
|
|
92
|
+
name: 'startsOn',
|
|
93
|
+
title: '{{t("Starts on")}}',
|
|
94
|
+
'x-decorator': 'FormItem',
|
|
95
|
+
'x-component': 'DatePicker',
|
|
96
|
+
'x-component-props': {
|
|
97
|
+
showTime: true
|
|
98
|
+
},
|
|
99
|
+
required: true
|
|
100
|
+
},
|
|
101
|
+
repeat: {
|
|
102
|
+
type: 'string',
|
|
103
|
+
name: 'repeat',
|
|
104
|
+
title: '{{t("Repeat mode")}}',
|
|
105
|
+
'x-decorator': 'FormItem',
|
|
106
|
+
'x-component': 'RepeatField',
|
|
107
|
+
'x-reactions': [{
|
|
108
|
+
target: 'config.endsOn',
|
|
109
|
+
fulfill: {
|
|
110
|
+
state: {
|
|
111
|
+
visible: '{{!!$self.value}}'
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}, {
|
|
115
|
+
target: 'config.limit',
|
|
116
|
+
fulfill: {
|
|
117
|
+
state: {
|
|
118
|
+
visible: '{{!!$self.value}}'
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}]
|
|
122
|
+
},
|
|
123
|
+
endsOn: {
|
|
124
|
+
type: 'datetime',
|
|
125
|
+
name: 'endsOn',
|
|
126
|
+
title: '{{t("Ends on")}}',
|
|
127
|
+
'x-decorator': 'FormItem',
|
|
128
|
+
'x-component': 'DatePicker',
|
|
129
|
+
'x-component-props': {
|
|
130
|
+
showTime: true
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
limit: {
|
|
134
|
+
type: 'number',
|
|
135
|
+
name: 'limit',
|
|
136
|
+
title: '{{t("Repeat limit")}}',
|
|
137
|
+
'x-decorator': 'FormItem',
|
|
138
|
+
'x-component': 'InputNumber',
|
|
139
|
+
'x-component-props': {
|
|
140
|
+
placeholder: '{{t("No limit")}}',
|
|
141
|
+
min: 0
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
1: {
|
|
146
|
+
collection: _objectSpread(_objectSpread({}, _collection.collection), {}, {
|
|
147
|
+
'x-reactions': [..._collection.collection['x-reactions'], {
|
|
148
|
+
// only full path works
|
|
149
|
+
target: 'config.startsOn',
|
|
150
|
+
fulfill: {
|
|
151
|
+
state: {
|
|
152
|
+
visible: '{{!!$self.value}}'
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}]
|
|
156
|
+
}),
|
|
157
|
+
startsOn: {
|
|
158
|
+
type: 'object',
|
|
159
|
+
title: '{{t("Starts on")}}',
|
|
160
|
+
'x-decorator': 'FormItem',
|
|
161
|
+
'x-component': 'OnField',
|
|
162
|
+
'x-reactions': [{
|
|
163
|
+
target: 'config.repeat',
|
|
164
|
+
fulfill: {
|
|
165
|
+
state: {
|
|
166
|
+
visible: '{{!!$self.value}}'
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}],
|
|
170
|
+
required: true
|
|
171
|
+
},
|
|
172
|
+
repeat: {
|
|
173
|
+
type: 'string',
|
|
174
|
+
name: 'repeat',
|
|
175
|
+
title: '{{t("Repeat mode")}}',
|
|
176
|
+
'x-decorator': 'FormItem',
|
|
177
|
+
'x-component': 'RepeatField',
|
|
178
|
+
'x-reactions': [{
|
|
179
|
+
target: 'config.endsOn',
|
|
180
|
+
fulfill: {
|
|
181
|
+
state: {
|
|
182
|
+
visible: '{{!!$self.value}}'
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}, {
|
|
186
|
+
target: 'config.limit',
|
|
187
|
+
fulfill: {
|
|
188
|
+
state: {
|
|
189
|
+
visible: '{{!!$self.value}}'
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}]
|
|
193
|
+
},
|
|
194
|
+
endsOn: {
|
|
195
|
+
type: 'object',
|
|
196
|
+
title: '{{t("Ends on")}}',
|
|
197
|
+
'x-decorator': 'FormItem',
|
|
198
|
+
'x-component': 'EndsByField'
|
|
199
|
+
},
|
|
200
|
+
limit: {
|
|
201
|
+
type: 'number',
|
|
202
|
+
name: 'limit',
|
|
203
|
+
title: '{{t("Repeat limit")}}',
|
|
204
|
+
'x-decorator': 'FormItem',
|
|
205
|
+
'x-component': 'InputNumber',
|
|
206
|
+
'x-component-props': {
|
|
207
|
+
placeholder: '{{t("No limit")}}',
|
|
208
|
+
min: 0
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const ScheduleConfig = () => {
|
|
215
|
+
const _useForm = (0, _react2().useForm)(),
|
|
216
|
+
_useForm$values = _useForm.values,
|
|
217
|
+
values = _useForm$values === void 0 ? {} : _useForm$values,
|
|
218
|
+
clearFormGraph = _useForm.clearFormGraph;
|
|
219
|
+
|
|
220
|
+
const _values$config = values.config,
|
|
221
|
+
config = _values$config === void 0 ? {} : _values$config;
|
|
222
|
+
|
|
223
|
+
const _useState = (0, _react().useState)(config.mode),
|
|
224
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
225
|
+
mode = _useState2[0],
|
|
226
|
+
setMode = _useState2[1];
|
|
227
|
+
|
|
228
|
+
(0, _react2().useFormEffects)(() => {
|
|
229
|
+
(0, _core().onFieldValueChange)('config.mode', field => {
|
|
230
|
+
setMode(field.value);
|
|
231
|
+
clearFormGraph('config.collection');
|
|
232
|
+
clearFormGraph('config.startsOn');
|
|
233
|
+
clearFormGraph('config.repeat');
|
|
234
|
+
clearFormGraph('config.endsOn');
|
|
235
|
+
clearFormGraph('config.limit');
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
return _react().default.createElement(_react().default.Fragment, null, _react().default.createElement(_client().SchemaComponent, {
|
|
239
|
+
schema: {
|
|
240
|
+
type: 'number',
|
|
241
|
+
title: '{{t("Trigger mode")}}',
|
|
242
|
+
name: 'mode',
|
|
243
|
+
'x-decorator': 'FormItem',
|
|
244
|
+
'x-component': 'Radio.Group',
|
|
245
|
+
'x-component-props': {
|
|
246
|
+
options: [{
|
|
247
|
+
value: 0,
|
|
248
|
+
label: '{{t("Based on certain date")}}'
|
|
249
|
+
}, {
|
|
250
|
+
value: 1,
|
|
251
|
+
label: '{{t("Based on date field of collection")}}'
|
|
252
|
+
}]
|
|
253
|
+
},
|
|
254
|
+
required: true
|
|
255
|
+
}
|
|
256
|
+
}), _react().default.createElement(_client().SchemaComponent, {
|
|
257
|
+
schema: {
|
|
258
|
+
type: 'void',
|
|
259
|
+
properties: {
|
|
260
|
+
[`mode-${mode}`]: {
|
|
261
|
+
type: 'void',
|
|
262
|
+
'x-component': 'fieldset',
|
|
263
|
+
'x-component-props': {
|
|
264
|
+
className: (0, _css().css)`
|
|
265
|
+
.ant-input-number{
|
|
266
|
+
width: 4em;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.ant-picker{
|
|
270
|
+
width: auto;
|
|
271
|
+
}
|
|
272
|
+
`
|
|
273
|
+
},
|
|
274
|
+
properties: ModeFieldsets[mode]
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
components: {
|
|
279
|
+
OnField: _OnField.OnField,
|
|
280
|
+
RepeatField: _RepeatField.RepeatField,
|
|
281
|
+
EndsByField: _EndsByField.EndsByField
|
|
282
|
+
}
|
|
283
|
+
}));
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
exports.ScheduleConfig = ScheduleConfig;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useCollectionDataSource } from '@nocobase/client';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
title: string;
|
|
4
|
+
type: string;
|
|
5
|
+
fieldset: {
|
|
6
|
+
config: {
|
|
7
|
+
type: string;
|
|
8
|
+
name: string;
|
|
9
|
+
'x-component': string;
|
|
10
|
+
'x-component-props': {};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
scope: {
|
|
14
|
+
useCollectionDataSource: typeof useCollectionDataSource;
|
|
15
|
+
};
|
|
16
|
+
components: {
|
|
17
|
+
ScheduleConfig: () => JSX.Element;
|
|
18
|
+
};
|
|
19
|
+
getter({ type, options, onChange }: {
|
|
20
|
+
type: any;
|
|
21
|
+
options: any;
|
|
22
|
+
onChange: any;
|
|
23
|
+
}): JSX.Element;
|
|
24
|
+
};
|
|
25
|
+
export default _default;
|
|
@@ -0,0 +1,124 @@
|
|
|
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 _reactI18next() {
|
|
19
|
+
const data = require("react-i18next");
|
|
20
|
+
|
|
21
|
+
_reactI18next = function _reactI18next() {
|
|
22
|
+
return data;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function _antd() {
|
|
29
|
+
const data = require("antd");
|
|
30
|
+
|
|
31
|
+
_antd = function _antd() {
|
|
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 _ScheduleConfig = require("./ScheduleConfig");
|
|
49
|
+
|
|
50
|
+
var _WorkflowCanvas = require("../../WorkflowCanvas");
|
|
51
|
+
|
|
52
|
+
var _calculators = require("../../calculators");
|
|
53
|
+
|
|
54
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
55
|
+
|
|
56
|
+
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; }
|
|
57
|
+
|
|
58
|
+
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; }
|
|
59
|
+
|
|
60
|
+
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; }
|
|
61
|
+
|
|
62
|
+
var _default = {
|
|
63
|
+
title: '{{t("Schedule event")}}',
|
|
64
|
+
type: 'schedule',
|
|
65
|
+
fieldset: {
|
|
66
|
+
config: {
|
|
67
|
+
type: 'object',
|
|
68
|
+
name: 'config',
|
|
69
|
+
'x-component': 'ScheduleConfig',
|
|
70
|
+
'x-component-props': {}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
scope: {
|
|
74
|
+
useCollectionDataSource: _client().useCollectionDataSource
|
|
75
|
+
},
|
|
76
|
+
components: {
|
|
77
|
+
ScheduleConfig: _ScheduleConfig.ScheduleConfig
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
getter({
|
|
81
|
+
type,
|
|
82
|
+
options,
|
|
83
|
+
onChange: _onChange
|
|
84
|
+
}) {
|
|
85
|
+
var _collections$find, _options$path;
|
|
86
|
+
|
|
87
|
+
const _useTranslation = (0, _reactI18next().useTranslation)(),
|
|
88
|
+
t = _useTranslation.t;
|
|
89
|
+
|
|
90
|
+
const compile = (0, _client().useCompile)();
|
|
91
|
+
|
|
92
|
+
const _useCollectionManager = (0, _client().useCollectionManager)(),
|
|
93
|
+
_useCollectionManager2 = _useCollectionManager.collections,
|
|
94
|
+
collections = _useCollectionManager2 === void 0 ? [] : _useCollectionManager2;
|
|
95
|
+
|
|
96
|
+
const _useFlowContext = (0, _WorkflowCanvas.useFlowContext)(),
|
|
97
|
+
workflow = _useFlowContext.workflow;
|
|
98
|
+
|
|
99
|
+
const collection = (_collections$find = collections.find(item => item.name === workflow.config.collection)) !== null && _collections$find !== void 0 ? _collections$find : {
|
|
100
|
+
fields: []
|
|
101
|
+
};
|
|
102
|
+
return _react().default.createElement(_antd().Select, {
|
|
103
|
+
placeholder: t('Fields'),
|
|
104
|
+
value: options === null || options === void 0 ? void 0 : (_options$path = options.path) === null || _options$path === void 0 ? void 0 : _options$path.replace(/^data\./, ''),
|
|
105
|
+
onChange: path => {
|
|
106
|
+
_onChange({
|
|
107
|
+
type,
|
|
108
|
+
options: _objectSpread(_objectSpread({}, options), {}, {
|
|
109
|
+
path: `data.${path}`
|
|
110
|
+
})
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}, collection.fields.filter(field => {
|
|
114
|
+
var _field$uiSchema;
|
|
115
|
+
|
|
116
|
+
return _calculators.BaseTypeSet.has(field === null || field === void 0 ? void 0 : (_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema.type);
|
|
117
|
+
}).map(field => _react().default.createElement(_antd().Select.Option, {
|
|
118
|
+
key: field.name,
|
|
119
|
+
value: field.name
|
|
120
|
+
}, compile(field.uiSchema.title))));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
};
|
|
124
|
+
exports.default = _default;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
everyText: string;
|
|
3
|
+
emptyMonths: string;
|
|
4
|
+
emptyMonthDays: string;
|
|
5
|
+
emptyMonthDaysShort: string;
|
|
6
|
+
emptyWeekDays: string;
|
|
7
|
+
emptyWeekDaysShort: string;
|
|
8
|
+
emptyHours: string;
|
|
9
|
+
emptyMinutes: string;
|
|
10
|
+
emptyMinutesForHourPeriod: string;
|
|
11
|
+
yearOption: string;
|
|
12
|
+
monthOption: string;
|
|
13
|
+
weekOption: string;
|
|
14
|
+
dayOption: string;
|
|
15
|
+
hourOption: string;
|
|
16
|
+
minuteOption: string;
|
|
17
|
+
rebootOption: string;
|
|
18
|
+
prefixPeriod: string;
|
|
19
|
+
prefixMonths: string;
|
|
20
|
+
prefixMonthDays: string;
|
|
21
|
+
prefixWeekDays: string;
|
|
22
|
+
prefixWeekDaysForMonthAndYearPeriod: string;
|
|
23
|
+
prefixHours: string;
|
|
24
|
+
prefixMinutes: string;
|
|
25
|
+
prefixMinutesForHourPeriod: string;
|
|
26
|
+
suffixMinutesForHourPeriod: string;
|
|
27
|
+
errorInvalidCron: string;
|
|
28
|
+
clearButtonText: string;
|
|
29
|
+
weekDays: string[];
|
|
30
|
+
months: string[];
|
|
31
|
+
altWeekDays: string[];
|
|
32
|
+
altMonths: string[];
|
|
33
|
+
};
|
|
34
|
+
export default _default;
|