@nocobase/plugin-workflow 0.9.1-alpha.2 → 0.9.2-alpha.2
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/lib/client/AddButton.js +17 -64
- package/lib/client/Branch.js +0 -13
- package/lib/client/ExecutionCanvas.js +16 -63
- package/lib/client/ExecutionLink.js +3 -21
- package/lib/client/ExecutionPage.js +1 -19
- package/lib/client/ExecutionResourceProvider.js +6 -23
- package/lib/client/FlowContext.js +0 -8
- package/lib/client/WorkflowCanvas.js +56 -127
- package/lib/client/WorkflowLink.js +3 -21
- package/lib/client/WorkflowPage.js +1 -19
- package/lib/client/WorkflowProvider.js +24 -47
- package/lib/client/WorkflowShortcut.js +0 -16
- package/lib/client/components/CollectionBlockInitializer.js +12 -22
- package/lib/client/components/CollectionFieldInitializers.js +5 -24
- package/lib/client/components/CollectionFieldset.js +31 -79
- package/lib/client/components/Duration.js +0 -14
- package/lib/client/components/DynamicExpression.d.ts +4 -0
- package/lib/client/components/DynamicExpression.js +102 -0
- package/lib/client/components/FieldsSelect.d.ts +2 -0
- package/lib/client/components/FieldsSelect.js +66 -0
- package/lib/client/components/FilterDynamicComponent.js +1 -10
- package/lib/client/components/NullRender.js +0 -1
- package/lib/client/components/OpenDrawer.js +10 -35
- package/lib/client/components/RadioWithTooltip.js +5 -27
- package/lib/client/components/renderEngineReference.d.ts +1 -0
- package/lib/client/components/renderEngineReference.js +55 -0
- package/lib/client/constants.js +0 -9
- package/lib/client/index.js +0 -6
- package/lib/client/interfaces/expression.d.ts +3 -0
- package/lib/client/interfaces/expression.js +37 -0
- package/lib/client/locale/index.js +5 -15
- package/lib/client/locale/pt-BR.d.ts +130 -0
- package/lib/client/locale/pt-BR.js +136 -0
- package/lib/client/locale/zh-CN.d.ts +16 -1
- package/lib/client/locale/zh-CN.js +17 -2
- package/lib/client/nodes/calculation.d.ts +54 -3
- package/lib/client/nodes/calculation.js +136 -63
- package/lib/client/nodes/condition.d.ts +1 -1
- package/lib/client/nodes/condition.js +21 -76
- package/lib/client/nodes/create.d.ts +35 -9
- package/lib/client/nodes/create.js +13 -19
- package/lib/client/nodes/delay.d.ts +1 -3
- package/lib/client/nodes/delay.js +3 -10
- package/lib/client/nodes/destroy.d.ts +1 -6
- package/lib/client/nodes/destroy.js +12 -9
- package/lib/client/nodes/index.d.ts +2 -2
- package/lib/client/nodes/index.js +45 -147
- package/lib/client/nodes/manual/AssigneesSelect.js +6 -17
- package/lib/client/nodes/manual/ModeConfig.js +0 -27
- package/lib/client/nodes/manual/SchemaConfig.js +87 -449
- package/lib/client/nodes/manual/WorkflowTodo.js +99 -163
- package/lib/client/nodes/manual/WorkflowTodoBlockInitializer.js +4 -20
- package/lib/client/nodes/manual/forms/customForm.d.ts +40 -0
- package/lib/client/nodes/manual/forms/customForm.js +411 -0
- package/lib/client/nodes/manual/index.d.ts +12 -1
- package/lib/client/nodes/manual/index.js +54 -41
- package/lib/client/nodes/parallel.js +7 -41
- package/lib/client/nodes/query.d.ts +28 -7
- package/lib/client/nodes/query.js +15 -22
- package/lib/client/nodes/request.d.ts +2 -3
- package/lib/client/nodes/request.js +5 -22
- package/lib/client/nodes/update.d.ts +1 -6
- package/lib/client/nodes/update.js +8 -16
- package/lib/client/schemas/collection.d.ts +20 -4
- package/lib/client/schemas/collection.js +26 -22
- package/lib/client/schemas/executions.js +3 -18
- package/lib/client/schemas/workflows.js +10 -33
- package/lib/client/style.js +24 -21
- package/lib/client/triggers/collection.d.ts +24 -20
- package/lib/client/triggers/collection.js +34 -123
- package/lib/client/triggers/index.d.ts +2 -5
- package/lib/client/triggers/index.js +34 -105
- package/lib/client/triggers/schedule/DateFieldsSelect.js +6 -29
- package/lib/client/triggers/schedule/EndsByField.js +1 -18
- package/lib/client/triggers/schedule/OnField.js +10 -38
- package/lib/client/triggers/schedule/RepeatField.js +4 -32
- package/lib/client/triggers/schedule/ScheduleConfig.js +10 -51
- package/lib/client/triggers/schedule/index.d.ts +21 -0
- package/lib/client/triggers/schedule/index.js +21 -22
- package/lib/client/triggers/schedule/locale/Cron.zh-CN.js +8 -4
- package/lib/client/utils.d.ts +1 -0
- package/lib/client/utils.js +31 -10
- package/lib/client/variable.d.ts +7 -6
- package/lib/client/variable.js +132 -71
- package/lib/index.js +0 -2
- package/lib/server/Plugin.d.ts +7 -7
- package/lib/server/Plugin.js +76 -111
- package/lib/server/Processor.d.ts +2 -0
- package/lib/server/Processor.js +62 -125
- package/lib/server/actions/index.js +3 -10
- package/lib/server/actions/nodes.js +34 -87
- package/lib/server/actions/workflows.js +46 -96
- package/lib/server/collections/executions.js +1 -1
- package/lib/server/collections/flow_nodes.js +7 -4
- package/lib/server/collections/jobs.js +1 -1
- package/lib/server/collections/workflows.js +3 -4
- package/lib/server/fields/expression-field.d.ts +8 -0
- package/lib/server/fields/expression-field.js +26 -0
- package/lib/server/fields/index.d.ts +1 -0
- package/lib/server/fields/index.js +12 -0
- package/lib/server/functions/index.js +3 -14
- package/lib/server/index.js +0 -6
- package/lib/server/instructions/calculation.js +22 -17
- package/lib/server/instructions/condition.js +8 -52
- package/lib/server/instructions/create.js +31 -15
- package/lib/server/instructions/delay.js +4 -32
- package/lib/server/instructions/destroy.js +6 -12
- package/lib/server/instructions/index.js +6 -23
- package/lib/server/instructions/manual/actions.js +22 -31
- package/lib/server/instructions/manual/collecions/users_jobs.js +1 -1
- package/lib/server/instructions/manual/index.d.ts +13 -12
- package/lib/server/instructions/manual/index.js +9 -47
- package/lib/server/instructions/parallel.js +9 -36
- package/lib/server/instructions/query.js +17 -15
- package/lib/server/instructions/request.js +7 -30
- package/lib/server/instructions/update.js +8 -14
- package/lib/server/migrations/20221129153547-calculation-variables.js +3 -27
- package/lib/server/migrations/20230221032941-change-request-body-type.js +3 -26
- package/lib/server/migrations/20230221071831-calculation-expression.js +1 -33
- package/lib/server/migrations/20230221121203-condition-calculation.js +5 -28
- package/lib/server/migrations/20230221162902-jsonb-to-json.js +3 -18
- package/lib/server/migrations/20230411034722-manual-multi-form.d.ts +4 -0
- package/lib/server/migrations/20230411034722-manual-multi-form.js +303 -0
- package/lib/server/models/Execution.js +0 -5
- package/lib/server/models/FlowNode.js +0 -5
- package/lib/server/models/Job.js +0 -5
- package/lib/server/models/Workflow.js +0 -5
- package/lib/server/triggers/collection.js +39 -61
- package/lib/server/triggers/index.js +3 -22
- package/lib/server/triggers/schedule.js +72 -194
- package/package.json +14 -11
|
@@ -4,53 +4,37 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.RepeatField = RepeatField;
|
|
7
|
-
|
|
8
7
|
function _css() {
|
|
9
8
|
const data = require("@emotion/css");
|
|
10
|
-
|
|
11
9
|
_css = function _css() {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
function _antd() {
|
|
19
15
|
const data = require("antd");
|
|
20
|
-
|
|
21
16
|
_antd = function _antd() {
|
|
22
17
|
return data;
|
|
23
18
|
};
|
|
24
|
-
|
|
25
19
|
return data;
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
function _react() {
|
|
29
22
|
const data = _interopRequireDefault(require("react"));
|
|
30
|
-
|
|
31
23
|
_react = function _react() {
|
|
32
24
|
return data;
|
|
33
25
|
};
|
|
34
|
-
|
|
35
26
|
return data;
|
|
36
27
|
}
|
|
37
|
-
|
|
38
28
|
function _reactJsCron() {
|
|
39
29
|
const data = require("react-js-cron");
|
|
40
|
-
|
|
41
30
|
_reactJsCron = function _reactJsCron() {
|
|
42
31
|
return data;
|
|
43
32
|
};
|
|
44
|
-
|
|
45
33
|
return data;
|
|
46
34
|
}
|
|
47
|
-
|
|
48
35
|
var _locale = require("../../locale");
|
|
49
|
-
|
|
50
36
|
var _Cron = _interopRequireDefault(require("./locale/Cron.zh-CN"));
|
|
51
|
-
|
|
52
37
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
53
|
-
|
|
54
38
|
const languages = {
|
|
55
39
|
'zh-CN': _Cron.default
|
|
56
40
|
};
|
|
@@ -73,40 +57,34 @@ const RepeatOptions = [{
|
|
|
73
57
|
value: 604800000,
|
|
74
58
|
text: 'By week',
|
|
75
59
|
unitText: 'Weeks'
|
|
76
|
-
},
|
|
60
|
+
},
|
|
61
|
+
// { value: 18144_000_000, text: 'By 30 days' },
|
|
77
62
|
{
|
|
78
63
|
value: 'cron',
|
|
79
64
|
text: 'Advanced'
|
|
80
65
|
}];
|
|
81
|
-
|
|
82
66
|
function getNumberOption(v) {
|
|
83
67
|
const opts = RepeatOptions.filter(option => typeof option.value === 'number').reverse();
|
|
84
68
|
return opts.find(item => !(v % item.value));
|
|
85
69
|
}
|
|
86
|
-
|
|
87
70
|
function getRepeatTypeValue(v) {
|
|
88
71
|
switch (typeof v) {
|
|
89
72
|
case 'number':
|
|
90
73
|
const option = getNumberOption(v);
|
|
91
74
|
return option ? option.value : 'none';
|
|
92
|
-
|
|
93
75
|
case 'string':
|
|
94
76
|
return 'cron';
|
|
95
|
-
|
|
96
77
|
default:
|
|
97
78
|
break;
|
|
98
79
|
}
|
|
99
|
-
|
|
100
80
|
return 'none';
|
|
101
81
|
}
|
|
102
|
-
|
|
103
82
|
function CommonRepeatField({
|
|
104
83
|
value,
|
|
105
84
|
onChange: _onChange
|
|
106
85
|
}) {
|
|
107
86
|
const _useWorkflowTranslati = (0, _locale.useWorkflowTranslation)(),
|
|
108
|
-
|
|
109
|
-
|
|
87
|
+
t = _useWorkflowTranslati.t;
|
|
110
88
|
const option = getNumberOption(value);
|
|
111
89
|
return _react().default.createElement(_antd().InputNumber, {
|
|
112
90
|
value: value / option.value,
|
|
@@ -116,30 +94,24 @@ function CommonRepeatField({
|
|
|
116
94
|
addonAfter: t(option.unitText)
|
|
117
95
|
});
|
|
118
96
|
}
|
|
119
|
-
|
|
120
97
|
function RepeatField({
|
|
121
98
|
value = null,
|
|
122
99
|
onChange
|
|
123
100
|
}) {
|
|
124
101
|
const _useWorkflowTranslati2 = (0, _locale.useWorkflowTranslation)(),
|
|
125
|
-
|
|
126
|
-
|
|
102
|
+
t = _useWorkflowTranslati2.t;
|
|
127
103
|
const typeValue = getRepeatTypeValue(value);
|
|
128
|
-
|
|
129
104
|
function onTypeChange(v) {
|
|
130
105
|
if (v === 'none') {
|
|
131
106
|
onChange(null);
|
|
132
107
|
return;
|
|
133
108
|
}
|
|
134
|
-
|
|
135
109
|
if (v === 'cron') {
|
|
136
110
|
onChange('0 * * * * *');
|
|
137
111
|
return;
|
|
138
112
|
}
|
|
139
|
-
|
|
140
113
|
onChange(v);
|
|
141
114
|
}
|
|
142
|
-
|
|
143
115
|
const locale = languages[localStorage.getItem('NOCOBASE_LOCALE') || 'en-US'];
|
|
144
116
|
return _react().default.createElement("fieldset", {
|
|
145
117
|
className: (0, _css().css)`
|
|
@@ -4,96 +4,64 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ScheduleConfig = void 0;
|
|
7
|
-
|
|
8
7
|
function _react() {
|
|
9
8
|
const data = _interopRequireWildcard(require("react"));
|
|
10
|
-
|
|
11
9
|
_react = function _react() {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
function _core() {
|
|
19
15
|
const data = require("@formily/core");
|
|
20
|
-
|
|
21
16
|
_core = function _core() {
|
|
22
17
|
return data;
|
|
23
18
|
};
|
|
24
|
-
|
|
25
19
|
return data;
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
function _react2() {
|
|
29
22
|
const data = require("@formily/react");
|
|
30
|
-
|
|
31
23
|
_react2 = function _react2() {
|
|
32
24
|
return data;
|
|
33
25
|
};
|
|
34
|
-
|
|
35
26
|
return data;
|
|
36
27
|
}
|
|
37
|
-
|
|
38
28
|
function _css() {
|
|
39
29
|
const data = require("@emotion/css");
|
|
40
|
-
|
|
41
30
|
_css = function _css() {
|
|
42
31
|
return data;
|
|
43
32
|
};
|
|
44
|
-
|
|
45
33
|
return data;
|
|
46
34
|
}
|
|
47
|
-
|
|
48
35
|
function _client() {
|
|
49
36
|
const data = require("@nocobase/client");
|
|
50
|
-
|
|
51
37
|
_client = function _client() {
|
|
52
38
|
return data;
|
|
53
39
|
};
|
|
54
|
-
|
|
55
40
|
return data;
|
|
56
41
|
}
|
|
57
|
-
|
|
58
42
|
var _collection = require("../../schemas/collection");
|
|
59
|
-
|
|
60
43
|
var _OnField = require("./OnField");
|
|
61
|
-
|
|
62
44
|
var _EndsByField = require("./EndsByField");
|
|
63
|
-
|
|
64
45
|
var _RepeatField = require("./RepeatField");
|
|
65
|
-
|
|
66
46
|
var _constants = require("./constants");
|
|
67
|
-
|
|
68
47
|
var _locale = require("../../locale");
|
|
69
|
-
|
|
70
48
|
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
|
-
|
|
72
49
|
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; }
|
|
73
|
-
|
|
74
50
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
75
|
-
|
|
76
51
|
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."); }
|
|
77
|
-
|
|
78
52
|
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); }
|
|
79
|
-
|
|
80
53
|
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; }
|
|
81
|
-
|
|
82
|
-
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; }
|
|
83
|
-
|
|
54
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
84
55
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
85
|
-
|
|
86
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; }
|
|
87
|
-
|
|
88
57
|
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
|
|
91
|
-
|
|
58
|
+
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; }
|
|
59
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
60
|
+
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); }
|
|
92
61
|
const ModeFieldsets = {
|
|
93
62
|
[_constants.SCHEDULE_MODE.STATIC]: {
|
|
94
63
|
startsOn: {
|
|
95
64
|
type: 'datetime',
|
|
96
|
-
name: 'startsOn',
|
|
97
65
|
title: `{{t("Starts on", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
98
66
|
'x-decorator': 'FormItem',
|
|
99
67
|
'x-component': 'DatePicker',
|
|
@@ -104,7 +72,6 @@ const ModeFieldsets = {
|
|
|
104
72
|
},
|
|
105
73
|
repeat: {
|
|
106
74
|
type: 'string',
|
|
107
|
-
name: 'repeat',
|
|
108
75
|
title: `{{t("Repeat mode", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
109
76
|
'x-decorator': 'FormItem',
|
|
110
77
|
'x-component': 'RepeatField',
|
|
@@ -126,7 +93,6 @@ const ModeFieldsets = {
|
|
|
126
93
|
},
|
|
127
94
|
endsOn: {
|
|
128
95
|
type: 'datetime',
|
|
129
|
-
name: 'endsOn',
|
|
130
96
|
title: `{{t("Ends on", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
131
97
|
'x-decorator': 'FormItem',
|
|
132
98
|
'x-component': 'DatePicker',
|
|
@@ -136,7 +102,6 @@ const ModeFieldsets = {
|
|
|
136
102
|
},
|
|
137
103
|
limit: {
|
|
138
104
|
type: 'number',
|
|
139
|
-
name: 'limit',
|
|
140
105
|
title: `{{t("Repeat limit", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
141
106
|
'x-decorator': 'FormItem',
|
|
142
107
|
'x-component': 'InputNumber',
|
|
@@ -175,7 +140,6 @@ const ModeFieldsets = {
|
|
|
175
140
|
},
|
|
176
141
|
repeat: {
|
|
177
142
|
type: 'string',
|
|
178
|
-
name: 'repeat',
|
|
179
143
|
title: `{{t("Repeat mode", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
180
144
|
'x-decorator': 'FormItem',
|
|
181
145
|
'x-component': 'RepeatField',
|
|
@@ -203,7 +167,6 @@ const ModeFieldsets = {
|
|
|
203
167
|
},
|
|
204
168
|
limit: {
|
|
205
169
|
type: 'number',
|
|
206
|
-
name: 'limit',
|
|
207
170
|
title: `{{t("Repeat limit", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
208
171
|
'x-decorator': 'FormItem',
|
|
209
172
|
'x-component': 'InputNumber',
|
|
@@ -221,18 +184,15 @@ const scheduleModeOptions = [{
|
|
|
221
184
|
value: _constants.SCHEDULE_MODE.COLLECTION_FIELD,
|
|
222
185
|
label: `{{t("Based on date field of collection", { ns: "${_locale.NAMESPACE}" })}}`
|
|
223
186
|
}];
|
|
224
|
-
|
|
225
187
|
const ScheduleConfig = () => {
|
|
226
188
|
const _useForm = (0, _react2().useForm)(),
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
189
|
+
_useForm$values = _useForm.values,
|
|
190
|
+
values = _useForm$values === void 0 ? {} : _useForm$values,
|
|
191
|
+
clearFormGraph = _useForm.clearFormGraph;
|
|
231
192
|
const _useState = (0, _react().useState)(values.mode),
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
193
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
194
|
+
mode = _useState2[0],
|
|
195
|
+
setMode = _useState2[1];
|
|
236
196
|
(0, _react2().useFormEffects)(() => {
|
|
237
197
|
(0, _core().onFieldValueChange)('mode', field => {
|
|
238
198
|
setMode(field.value);
|
|
@@ -285,5 +245,4 @@ const ScheduleConfig = () => {
|
|
|
285
245
|
}
|
|
286
246
|
}));
|
|
287
247
|
};
|
|
288
|
-
|
|
289
248
|
exports.ScheduleConfig = ScheduleConfig;
|
|
@@ -9,12 +9,33 @@ declare const _default: {
|
|
|
9
9
|
'x-component': string;
|
|
10
10
|
'x-component-props': {};
|
|
11
11
|
};
|
|
12
|
+
appends: {
|
|
13
|
+
'x-reactions': {
|
|
14
|
+
dependencies: string[];
|
|
15
|
+
fulfill: {
|
|
16
|
+
state: {
|
|
17
|
+
visible: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
}[];
|
|
21
|
+
type: string;
|
|
22
|
+
title: string;
|
|
23
|
+
description: string;
|
|
24
|
+
'x-decorator': string;
|
|
25
|
+
'x-component': string;
|
|
26
|
+
'x-component-props': {
|
|
27
|
+
mode: string;
|
|
28
|
+
placeholder: string;
|
|
29
|
+
filter(field: any): boolean;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
12
32
|
};
|
|
13
33
|
scope: {
|
|
14
34
|
useCollectionDataSource: typeof useCollectionDataSource;
|
|
15
35
|
};
|
|
16
36
|
components: {
|
|
17
37
|
ScheduleConfig: () => JSX.Element;
|
|
38
|
+
FieldsSelect: import("react").MemoExoticComponent<import("react").FunctionComponent<Pick<any, string | number | symbol>>>;
|
|
18
39
|
};
|
|
19
40
|
getOptions(config: any, types: any): any[];
|
|
20
41
|
useInitializers(config: any): SchemaInitializerItemOptions | null;
|
|
@@ -4,29 +4,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
function _client() {
|
|
9
8
|
const data = require("@nocobase/client");
|
|
10
|
-
|
|
11
9
|
_client = function _client() {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
var _ScheduleConfig = require("./ScheduleConfig");
|
|
19
|
-
|
|
20
15
|
var _constants = require("./constants");
|
|
21
|
-
|
|
22
16
|
var _locale = require("../../locale");
|
|
23
|
-
|
|
24
17
|
var _CollectionFieldInitializers = require("../../components/CollectionFieldInitializers");
|
|
25
|
-
|
|
26
18
|
var _CollectionBlockInitializer = require("../../components/CollectionBlockInitializer");
|
|
27
|
-
|
|
28
19
|
var _variable = require("../../variable");
|
|
29
|
-
|
|
20
|
+
var _collection = require("../../schemas/collection");
|
|
21
|
+
var _FieldsSelect = require("../../components/FieldsSelect");
|
|
22
|
+
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; }
|
|
23
|
+
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; }
|
|
24
|
+
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; }
|
|
25
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
26
|
+
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); }
|
|
30
27
|
var _default = {
|
|
31
28
|
title: `{{t("Schedule event", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
32
29
|
type: 'schedule',
|
|
@@ -35,21 +32,29 @@ var _default = {
|
|
|
35
32
|
type: 'void',
|
|
36
33
|
'x-component': 'ScheduleConfig',
|
|
37
34
|
'x-component-props': {}
|
|
38
|
-
}
|
|
35
|
+
},
|
|
36
|
+
appends: _objectSpread(_objectSpread({}, _collection.appends), {}, {
|
|
37
|
+
'x-reactions': [{
|
|
38
|
+
dependencies: ['mode', 'collection'],
|
|
39
|
+
fulfill: {
|
|
40
|
+
state: {
|
|
41
|
+
visible: `{{$deps[0] === ${_constants.SCHEDULE_MODE.COLLECTION_FIELD} && $deps[1]}}`
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}]
|
|
45
|
+
})
|
|
39
46
|
},
|
|
40
47
|
scope: {
|
|
41
48
|
useCollectionDataSource: _client().useCollectionDataSource
|
|
42
49
|
},
|
|
43
50
|
components: {
|
|
44
|
-
ScheduleConfig: _ScheduleConfig.ScheduleConfig
|
|
51
|
+
ScheduleConfig: _ScheduleConfig.ScheduleConfig,
|
|
52
|
+
FieldsSelect: _FieldsSelect.FieldsSelect
|
|
45
53
|
},
|
|
46
|
-
|
|
47
54
|
getOptions(config, types) {
|
|
48
55
|
const _useWorkflowTranslati = (0, _locale.useWorkflowTranslation)(),
|
|
49
|
-
|
|
50
|
-
|
|
56
|
+
t = _useWorkflowTranslati.t;
|
|
51
57
|
const options = [];
|
|
52
|
-
|
|
53
58
|
if (!types || types.includes('date')) {
|
|
54
59
|
options.push({
|
|
55
60
|
key: 'date',
|
|
@@ -57,12 +62,10 @@ var _default = {
|
|
|
57
62
|
label: t('Trigger time')
|
|
58
63
|
});
|
|
59
64
|
}
|
|
60
|
-
|
|
61
65
|
if (config.mode === _constants.SCHEDULE_MODE.COLLECTION_FIELD) {
|
|
62
66
|
const fieldOptions = (0, _variable.useCollectionFieldOptions)({
|
|
63
67
|
collection: config.collection
|
|
64
68
|
});
|
|
65
|
-
|
|
66
69
|
if (fieldOptions.length) {
|
|
67
70
|
options.push({
|
|
68
71
|
key: 'data',
|
|
@@ -72,15 +75,12 @@ var _default = {
|
|
|
72
75
|
});
|
|
73
76
|
}
|
|
74
77
|
}
|
|
75
|
-
|
|
76
78
|
return options;
|
|
77
79
|
},
|
|
78
|
-
|
|
79
80
|
useInitializers(config) {
|
|
80
81
|
if (!config.collection) {
|
|
81
82
|
return null;
|
|
82
83
|
}
|
|
83
|
-
|
|
84
84
|
return {
|
|
85
85
|
type: 'item',
|
|
86
86
|
title: `{{t("Trigger data", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
@@ -89,7 +89,6 @@ var _default = {
|
|
|
89
89
|
dataSource: '{{$context.data}}'
|
|
90
90
|
};
|
|
91
91
|
},
|
|
92
|
-
|
|
93
92
|
initializers: {
|
|
94
93
|
CollectionFieldInitializers: _CollectionFieldInitializers.CollectionFieldInitializers
|
|
95
94
|
}
|
|
@@ -32,13 +32,17 @@ var _default = {
|
|
|
32
32
|
suffixMinutesForHourPeriod: '分钟',
|
|
33
33
|
errorInvalidCron: '不符合 cron 规则的表达式',
|
|
34
34
|
clearButtonText: '清空',
|
|
35
|
-
weekDays: [
|
|
35
|
+
weekDays: [
|
|
36
|
+
// Order is important, the index will be used as value
|
|
36
37
|
'周日', '周一', '周二', '周三', '周四', '周五', '周六'],
|
|
37
|
-
months: [
|
|
38
|
+
months: [
|
|
39
|
+
// Order is important, the index will be used as value
|
|
38
40
|
'一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
|
|
39
|
-
altWeekDays: [
|
|
41
|
+
altWeekDays: [
|
|
42
|
+
// Order is important, the index will be used as value
|
|
40
43
|
'周日', '周一', '周二', '周三', '周四', '周五', '周六'],
|
|
41
|
-
altMonths: [
|
|
44
|
+
altMonths: [
|
|
45
|
+
// Order is important, the index will be used as value
|
|
42
46
|
'一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']
|
|
43
47
|
};
|
|
44
48
|
exports.default = _default;
|
package/lib/client/utils.d.ts
CHANGED
package/lib/client/utils.js
CHANGED
|
@@ -3,29 +3,26 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.isValidFilter = isValidFilter;
|
|
6
7
|
exports.linkNodes = linkNodes;
|
|
7
|
-
|
|
8
|
-
function
|
|
9
|
-
|
|
8
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
+
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."); }
|
|
10
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
10
13
|
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); }
|
|
11
|
-
|
|
12
14
|
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; }
|
|
13
|
-
|
|
14
15
|
function linkNodes(nodes) {
|
|
15
16
|
const nodesMap = new Map();
|
|
16
17
|
nodes.forEach(item => nodesMap.set(item.id, item));
|
|
17
|
-
|
|
18
18
|
var _iterator = _createForOfIteratorHelper(nodesMap.values()),
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
_step;
|
|
21
20
|
try {
|
|
22
21
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
23
22
|
let node = _step.value;
|
|
24
|
-
|
|
25
23
|
if (node.upstreamId) {
|
|
26
24
|
node.upstream = nodesMap.get(node.upstreamId);
|
|
27
25
|
}
|
|
28
|
-
|
|
29
26
|
if (node.downstreamId) {
|
|
30
27
|
node.downstream = nodesMap.get(node.downstreamId);
|
|
31
28
|
}
|
|
@@ -35,4 +32,28 @@ function linkNodes(nodes) {
|
|
|
35
32
|
} finally {
|
|
36
33
|
_iterator.f();
|
|
37
34
|
}
|
|
35
|
+
}
|
|
36
|
+
function isValidFilter(condition) {
|
|
37
|
+
const group = condition.$and || condition.$or;
|
|
38
|
+
if (!group) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
return group.some(item => {
|
|
42
|
+
if (item.$and || item.$or) {
|
|
43
|
+
return isValidFilter(item);
|
|
44
|
+
}
|
|
45
|
+
const _Object$keys = Object.keys(item),
|
|
46
|
+
_Object$keys2 = _slicedToArray(_Object$keys, 1),
|
|
47
|
+
name = _Object$keys2[0];
|
|
48
|
+
if (!name || !item[name]) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
const _Object$keys3 = Object.keys(item[name]),
|
|
52
|
+
_Object$keys4 = _slicedToArray(_Object$keys3, 1),
|
|
53
|
+
op = _Object$keys4[0];
|
|
54
|
+
if (!op || typeof item[name][op] === 'undefined') {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
return true;
|
|
58
|
+
});
|
|
38
59
|
}
|
package/lib/client/variable.d.ts
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
export declare type VariableOption = {
|
|
2
|
-
key
|
|
2
|
+
key?: string;
|
|
3
3
|
value: string;
|
|
4
4
|
label: string;
|
|
5
|
-
children?:
|
|
5
|
+
children?: VariableOptions;
|
|
6
6
|
};
|
|
7
|
-
export declare
|
|
7
|
+
export declare type VariableOptions = VariableOption[] | null;
|
|
8
|
+
export declare const BaseTypeSets: {
|
|
8
9
|
boolean: Set<string>;
|
|
9
10
|
number: Set<string>;
|
|
10
11
|
string: Set<string>;
|
|
11
12
|
date: Set<string>;
|
|
12
13
|
};
|
|
13
|
-
export declare function filterTypedFields(fields: any, types: any): any;
|
|
14
|
-
export declare function useWorkflowVariableOptions(): {
|
|
14
|
+
export declare function filterTypedFields(fields: any, types: any, depth?: number): any;
|
|
15
|
+
export declare function useWorkflowVariableOptions(types?: any): {
|
|
15
16
|
label: any;
|
|
16
17
|
value: any;
|
|
17
18
|
key: any;
|
|
18
19
|
children: any;
|
|
19
20
|
disabled: boolean;
|
|
20
21
|
}[];
|
|
21
|
-
export declare function useCollectionFieldOptions(
|
|
22
|
+
export declare function useCollectionFieldOptions(options: any): VariableOption[];
|