@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,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = _default;
|
|
7
|
+
|
|
8
|
+
function _react() {
|
|
9
|
+
const data = _interopRequireDefault(require("react"));
|
|
10
|
+
|
|
11
|
+
_react = function _react() {
|
|
12
|
+
return data;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function _antd() {
|
|
19
|
+
const data = require("antd");
|
|
20
|
+
|
|
21
|
+
_antd = function _antd() {
|
|
22
|
+
return data;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function _reactI18next() {
|
|
29
|
+
const data = require("react-i18next");
|
|
30
|
+
|
|
31
|
+
_reactI18next = function _reactI18next() {
|
|
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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
49
|
+
|
|
50
|
+
const UnitOptions = [{
|
|
51
|
+
value: 1000,
|
|
52
|
+
label: 'Seconds'
|
|
53
|
+
}, {
|
|
54
|
+
value: 60000,
|
|
55
|
+
label: 'Minutes'
|
|
56
|
+
}, {
|
|
57
|
+
value: 3600000,
|
|
58
|
+
label: 'Hours'
|
|
59
|
+
}, {
|
|
60
|
+
value: 86400000,
|
|
61
|
+
label: 'Days'
|
|
62
|
+
}, {
|
|
63
|
+
value: 604800000,
|
|
64
|
+
label: 'Weeks'
|
|
65
|
+
}];
|
|
66
|
+
|
|
67
|
+
function getNumberOption(v) {
|
|
68
|
+
return UnitOptions.slice().reverse().find(item => !(v % item.value));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function _default({
|
|
72
|
+
value = 60000,
|
|
73
|
+
onChange: _onChange
|
|
74
|
+
}) {
|
|
75
|
+
const _useTranslation = (0, _reactI18next().useTranslation)(),
|
|
76
|
+
t = _useTranslation.t;
|
|
77
|
+
|
|
78
|
+
const option = getNumberOption(value);
|
|
79
|
+
const quantity = Math.round(value / option.value);
|
|
80
|
+
return _react().default.createElement("fieldset", {
|
|
81
|
+
className: (0, _css().css)`
|
|
82
|
+
display: flex;
|
|
83
|
+
gap: .5em;
|
|
84
|
+
`
|
|
85
|
+
}, _react().default.createElement(_antd().InputNumber, {
|
|
86
|
+
min: 1,
|
|
87
|
+
value: quantity,
|
|
88
|
+
onChange: v => _onChange(Math.round(v * option.value))
|
|
89
|
+
}), _react().default.createElement(_antd().Select, {
|
|
90
|
+
value: option.value,
|
|
91
|
+
onChange: unit => _onChange(Math.round(quantity * unit))
|
|
92
|
+
}, UnitOptions.map(item => _react().default.createElement(_antd().Select.Option, {
|
|
93
|
+
key: item.value,
|
|
94
|
+
value: item.value
|
|
95
|
+
}, t(item.label)))));
|
|
96
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
triggers: true
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "default", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function get() {
|
|
12
|
+
return _WorkflowProvider.WorkflowProvider;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, "triggers", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function get() {
|
|
18
|
+
return _triggers.triggers;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
var _triggers = require("./triggers");
|
|
23
|
+
|
|
24
|
+
var _nodes = require("./nodes");
|
|
25
|
+
|
|
26
|
+
Object.keys(_nodes).forEach(function (key) {
|
|
27
|
+
if (key === "default" || key === "__esModule") return;
|
|
28
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
29
|
+
if (key in exports && exports[key] === _nodes[key]) return;
|
|
30
|
+
Object.defineProperty(exports, key, {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _nodes[key];
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
var _WorkflowProvider = require("./WorkflowProvider");
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const _default: {
|
|
3
|
+
title: string;
|
|
4
|
+
type: string;
|
|
5
|
+
group: string;
|
|
6
|
+
fieldset: {
|
|
7
|
+
'config.calculation': {
|
|
8
|
+
type: string;
|
|
9
|
+
title: string;
|
|
10
|
+
name: string;
|
|
11
|
+
required: boolean;
|
|
12
|
+
'x-decorator': string;
|
|
13
|
+
'x-component': string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
view: {};
|
|
17
|
+
components: {
|
|
18
|
+
CalculationConfig({ value, onChange }: {
|
|
19
|
+
value: any;
|
|
20
|
+
onChange: any;
|
|
21
|
+
}): JSX.Element;
|
|
22
|
+
};
|
|
23
|
+
getter(): JSX.Element;
|
|
24
|
+
};
|
|
25
|
+
export default _default;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
function _css() {
|
|
9
|
+
const data = require("@emotion/css");
|
|
10
|
+
|
|
11
|
+
_css = function _css() {
|
|
12
|
+
return data;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function _react() {
|
|
19
|
+
const data = _interopRequireDefault(require("react"));
|
|
20
|
+
|
|
21
|
+
_react = function _react() {
|
|
22
|
+
return data;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function _reactI18next() {
|
|
29
|
+
const data = require("react-i18next");
|
|
30
|
+
|
|
31
|
+
_reactI18next = function _reactI18next() {
|
|
32
|
+
return data;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return data;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
var _calculators = require("../calculators");
|
|
39
|
+
|
|
40
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
41
|
+
|
|
42
|
+
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; }
|
|
43
|
+
|
|
44
|
+
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; }
|
|
45
|
+
|
|
46
|
+
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; }
|
|
47
|
+
|
|
48
|
+
var _default = {
|
|
49
|
+
title: '{{t("Calculation")}}',
|
|
50
|
+
type: 'calculation',
|
|
51
|
+
group: 'control',
|
|
52
|
+
fieldset: {
|
|
53
|
+
'config.calculation': {
|
|
54
|
+
type: 'object',
|
|
55
|
+
title: '{{t("Configure calculation")}}',
|
|
56
|
+
name: 'config.calculation',
|
|
57
|
+
required: true,
|
|
58
|
+
'x-decorator': 'FormItem',
|
|
59
|
+
'x-component': 'CalculationConfig'
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
view: {},
|
|
63
|
+
components: {
|
|
64
|
+
CalculationConfig({
|
|
65
|
+
value,
|
|
66
|
+
onChange
|
|
67
|
+
}) {
|
|
68
|
+
return _react().default.createElement(_calculators.Calculation, _objectSpread(_objectSpread({}, value), {}, {
|
|
69
|
+
onChange: onChange
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
getter() {
|
|
76
|
+
const _useTranslation = (0, _reactI18next().useTranslation)(),
|
|
77
|
+
t = _useTranslation.t;
|
|
78
|
+
|
|
79
|
+
return _react().default.createElement("div", {
|
|
80
|
+
className: (0, _css().css)`flex-shrink: 0`
|
|
81
|
+
}, t('Calculation result'));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
};
|
|
85
|
+
exports.default = _default;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare function CalculationConfig({ value, onChange }: {
|
|
3
|
+
value: any;
|
|
4
|
+
onChange: any;
|
|
5
|
+
}): JSX.Element;
|
|
6
|
+
declare const _default: {
|
|
7
|
+
title: string;
|
|
8
|
+
type: string;
|
|
9
|
+
group: string;
|
|
10
|
+
fieldset: {
|
|
11
|
+
'config.rejectOnFalse': {
|
|
12
|
+
type: string;
|
|
13
|
+
name: string;
|
|
14
|
+
title: string;
|
|
15
|
+
'x-decorator': string;
|
|
16
|
+
'x-component': string;
|
|
17
|
+
'x-component-props': {
|
|
18
|
+
disabled: boolean;
|
|
19
|
+
};
|
|
20
|
+
enum: {
|
|
21
|
+
value: boolean;
|
|
22
|
+
label: string;
|
|
23
|
+
}[];
|
|
24
|
+
};
|
|
25
|
+
'config.calculation': {
|
|
26
|
+
type: string;
|
|
27
|
+
name: string;
|
|
28
|
+
title: string;
|
|
29
|
+
'x-decorator': string;
|
|
30
|
+
'x-component': string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
view: {};
|
|
34
|
+
options: {
|
|
35
|
+
label: string;
|
|
36
|
+
key: string;
|
|
37
|
+
value: {
|
|
38
|
+
rejectOnFalse: boolean;
|
|
39
|
+
};
|
|
40
|
+
}[];
|
|
41
|
+
render(data: any): JSX.Element;
|
|
42
|
+
components: {
|
|
43
|
+
CalculationConfig: typeof CalculationConfig;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export default _default;
|
|
@@ -0,0 +1,346 @@
|
|
|
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 _css() {
|
|
19
|
+
const data = require("@emotion/css");
|
|
20
|
+
|
|
21
|
+
_css = function _css() {
|
|
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 _icons() {
|
|
39
|
+
const data = require("@ant-design/icons");
|
|
40
|
+
|
|
41
|
+
_icons = function _icons() {
|
|
42
|
+
return data;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return data;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function _reactI18next() {
|
|
49
|
+
const data = require("react-i18next");
|
|
50
|
+
|
|
51
|
+
_reactI18next = function _reactI18next() {
|
|
52
|
+
return data;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return data;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function _client() {
|
|
59
|
+
const data = require("@nocobase/client");
|
|
60
|
+
|
|
61
|
+
_client = function _client() {
|
|
62
|
+
return data;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
return data;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
var _ = require(".");
|
|
69
|
+
|
|
70
|
+
var _WorkflowCanvas = require("../WorkflowCanvas");
|
|
71
|
+
|
|
72
|
+
var _style = require("../style");
|
|
73
|
+
|
|
74
|
+
var _calculators = require("../calculators");
|
|
75
|
+
|
|
76
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
77
|
+
|
|
78
|
+
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; }
|
|
79
|
+
|
|
80
|
+
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; }
|
|
81
|
+
|
|
82
|
+
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; }
|
|
83
|
+
|
|
84
|
+
function CalculationItem({
|
|
85
|
+
value,
|
|
86
|
+
onChange: _onChange,
|
|
87
|
+
onRemove
|
|
88
|
+
}) {
|
|
89
|
+
if (!value) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const calculator = value.calculator,
|
|
94
|
+
_value$operands = value.operands,
|
|
95
|
+
operands = _value$operands === void 0 ? [] : _value$operands;
|
|
96
|
+
return _react().default.createElement("div", {
|
|
97
|
+
className: (0, _css().css)`
|
|
98
|
+
display: flex;
|
|
99
|
+
position: relative;
|
|
100
|
+
margin: .5em 0;
|
|
101
|
+
`
|
|
102
|
+
}, value.group ? _react().default.createElement(CalculationGroup, {
|
|
103
|
+
value: value.group,
|
|
104
|
+
onChange: group => _onChange(_objectSpread(_objectSpread({}, value), {}, {
|
|
105
|
+
group
|
|
106
|
+
}))
|
|
107
|
+
}) : _react().default.createElement(_calculators.Calculation, {
|
|
108
|
+
operands: operands,
|
|
109
|
+
calculator: calculator,
|
|
110
|
+
onChange: _onChange
|
|
111
|
+
}), _react().default.createElement(_antd().Button, {
|
|
112
|
+
onClick: onRemove,
|
|
113
|
+
type: "link",
|
|
114
|
+
icon: _react().default.createElement(_icons().CloseCircleOutlined, null)
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function CalculationGroup({
|
|
119
|
+
value,
|
|
120
|
+
onChange: _onChange2
|
|
121
|
+
}) {
|
|
122
|
+
const _useTranslation = (0, _reactI18next().useTranslation)(),
|
|
123
|
+
t = _useTranslation.t;
|
|
124
|
+
|
|
125
|
+
const _value$type = value.type,
|
|
126
|
+
type = _value$type === void 0 ? 'and' : _value$type,
|
|
127
|
+
_value$calculations = value.calculations,
|
|
128
|
+
calculations = _value$calculations === void 0 ? [] : _value$calculations;
|
|
129
|
+
|
|
130
|
+
function onAddSingle() {
|
|
131
|
+
_onChange2(_objectSpread(_objectSpread({}, value), {}, {
|
|
132
|
+
calculations: [...calculations, {
|
|
133
|
+
not: false,
|
|
134
|
+
calculator: 'equal'
|
|
135
|
+
}]
|
|
136
|
+
}));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function onAddGroup() {
|
|
140
|
+
_onChange2(_objectSpread(_objectSpread({}, value), {}, {
|
|
141
|
+
calculations: [...calculations, {
|
|
142
|
+
not: false,
|
|
143
|
+
group: {
|
|
144
|
+
type: 'and',
|
|
145
|
+
calculations: []
|
|
146
|
+
}
|
|
147
|
+
}]
|
|
148
|
+
}));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function _onRemove(i) {
|
|
152
|
+
calculations.splice(i, 1);
|
|
153
|
+
|
|
154
|
+
_onChange2(_objectSpread(_objectSpread({}, value), {}, {
|
|
155
|
+
calculations: [...calculations]
|
|
156
|
+
}));
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function onItemChange(i, v) {
|
|
160
|
+
calculations.splice(i, 1, v);
|
|
161
|
+
|
|
162
|
+
_onChange2(_objectSpread(_objectSpread({}, value), {}, {
|
|
163
|
+
calculations: [...calculations]
|
|
164
|
+
}));
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return _react().default.createElement("div", {
|
|
168
|
+
className: (0, _css().cx)('node-type-condition-group', (0, _css().css)`
|
|
169
|
+
position: relative;
|
|
170
|
+
width: 100%;
|
|
171
|
+
|
|
172
|
+
.node-type-condition-group{
|
|
173
|
+
padding: .5em 1em;
|
|
174
|
+
border: 1px dashed #ddd;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
+ button{
|
|
178
|
+
position: absolute;
|
|
179
|
+
right: 0;
|
|
180
|
+
}
|
|
181
|
+
`)
|
|
182
|
+
}, _react().default.createElement("div", {
|
|
183
|
+
className: (0, _css().css)`
|
|
184
|
+
display: flex;
|
|
185
|
+
align-items: center;
|
|
186
|
+
gap: .5em;
|
|
187
|
+
|
|
188
|
+
.ant-select{
|
|
189
|
+
width: auto;
|
|
190
|
+
min-width: 6em;
|
|
191
|
+
}
|
|
192
|
+
`
|
|
193
|
+
}, _react().default.createElement(_reactI18next().Trans, null, 'Meet ', _react().default.createElement(_antd().Select, {
|
|
194
|
+
value: type,
|
|
195
|
+
onChange: t => _onChange2(_objectSpread(_objectSpread({}, value), {}, {
|
|
196
|
+
type: t
|
|
197
|
+
}))
|
|
198
|
+
}, _react().default.createElement(_antd().Select.Option, {
|
|
199
|
+
value: "and"
|
|
200
|
+
}, "All"), _react().default.createElement(_antd().Select.Option, {
|
|
201
|
+
value: "or"
|
|
202
|
+
}, "Any")), ' conditions in the group')), _react().default.createElement("div", {
|
|
203
|
+
className: "calculation-items"
|
|
204
|
+
}, calculations.map((calculation, i) => _react().default.createElement(CalculationItem, {
|
|
205
|
+
key: `${calculation.calculator}_${i}`,
|
|
206
|
+
value: calculation,
|
|
207
|
+
onChange: onItemChange.bind(this, i),
|
|
208
|
+
onRemove: () => _onRemove(i)
|
|
209
|
+
}))), _react().default.createElement("div", {
|
|
210
|
+
className: (0, _css().css)`
|
|
211
|
+
button{
|
|
212
|
+
padding: 0;
|
|
213
|
+
|
|
214
|
+
&:not(:last-child){
|
|
215
|
+
margin-right: 1em;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
`
|
|
219
|
+
}, _react().default.createElement(_antd().Button, {
|
|
220
|
+
type: "link",
|
|
221
|
+
onClick: onAddSingle
|
|
222
|
+
}, t('Add condition')), _react().default.createElement(_antd().Button, {
|
|
223
|
+
type: "link",
|
|
224
|
+
onClick: onAddGroup
|
|
225
|
+
}, t('Add condition group'))));
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function CalculationConfig({
|
|
229
|
+
value,
|
|
230
|
+
onChange: _onChange3
|
|
231
|
+
}) {
|
|
232
|
+
const rule = value && Object.keys(value).length ? value : {
|
|
233
|
+
group: {
|
|
234
|
+
type: 'and',
|
|
235
|
+
calculations: []
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
return _react().default.createElement(CalculationGroup, {
|
|
239
|
+
value: rule.group,
|
|
240
|
+
onChange: group => _onChange3(_objectSpread(_objectSpread({}, rule), {}, {
|
|
241
|
+
group
|
|
242
|
+
}))
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
var _default = {
|
|
247
|
+
title: '{{t("Condition")}}',
|
|
248
|
+
type: 'condition',
|
|
249
|
+
group: 'control',
|
|
250
|
+
fieldset: {
|
|
251
|
+
'config.rejectOnFalse': {
|
|
252
|
+
type: 'boolean',
|
|
253
|
+
name: 'config.rejectOnFalse',
|
|
254
|
+
title: '{{t("Mode")}}',
|
|
255
|
+
'x-decorator': 'FormItem',
|
|
256
|
+
'x-component': 'Radio.Group',
|
|
257
|
+
'x-component-props': {
|
|
258
|
+
disabled: true
|
|
259
|
+
},
|
|
260
|
+
enum: [{
|
|
261
|
+
value: true,
|
|
262
|
+
label: _client().i18n.t('Continue when "Yes"')
|
|
263
|
+
}, {
|
|
264
|
+
value: false,
|
|
265
|
+
label: _client().i18n.t('Branch into "Yes" and "No"')
|
|
266
|
+
}]
|
|
267
|
+
},
|
|
268
|
+
'config.calculation': {
|
|
269
|
+
type: 'string',
|
|
270
|
+
name: 'config.calculation',
|
|
271
|
+
title: '{{t("Conditions")}}',
|
|
272
|
+
'x-decorator': 'FormItem',
|
|
273
|
+
'x-component': 'CalculationConfig'
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
view: {},
|
|
277
|
+
options: [{
|
|
278
|
+
label: _client().i18n.t('Continue when "Yes"'),
|
|
279
|
+
key: 'rejectOnFalse',
|
|
280
|
+
value: {
|
|
281
|
+
rejectOnFalse: true
|
|
282
|
+
}
|
|
283
|
+
}, {
|
|
284
|
+
label: _client().i18n.t('Branch into "Yes" and "No"'),
|
|
285
|
+
key: 'branch',
|
|
286
|
+
value: {
|
|
287
|
+
rejectOnFalse: false
|
|
288
|
+
}
|
|
289
|
+
}],
|
|
290
|
+
|
|
291
|
+
render(data) {
|
|
292
|
+
const id = data.id,
|
|
293
|
+
rejectOnFalse = data.config.rejectOnFalse;
|
|
294
|
+
|
|
295
|
+
const _useFlowContext = (0, _WorkflowCanvas.useFlowContext)(),
|
|
296
|
+
nodes = _useFlowContext.nodes;
|
|
297
|
+
|
|
298
|
+
const trueEntry = nodes.find(item => item.upstreamId === id && item.branchIndex === 1);
|
|
299
|
+
const falseEntry = nodes.find(item => item.upstreamId === id && item.branchIndex === 0);
|
|
300
|
+
return _react().default.createElement(_.NodeDefaultView, {
|
|
301
|
+
data: data
|
|
302
|
+
}, rejectOnFalse ? null : _react().default.createElement("div", {
|
|
303
|
+
className: (0, _css().cx)(_style.nodeSubtreeClass)
|
|
304
|
+
}, _react().default.createElement("div", {
|
|
305
|
+
className: (0, _css().cx)(_style.branchBlockClass, (0, _css().css)`
|
|
306
|
+
> * > .workflow-branch-lines{
|
|
307
|
+
> button{
|
|
308
|
+
display: none;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
`)
|
|
312
|
+
}, _react().default.createElement(_WorkflowCanvas.Branch, {
|
|
313
|
+
from: data,
|
|
314
|
+
entry: falseEntry,
|
|
315
|
+
branchIndex: 0
|
|
316
|
+
}), _react().default.createElement(_WorkflowCanvas.Branch, {
|
|
317
|
+
from: data,
|
|
318
|
+
entry: trueEntry,
|
|
319
|
+
branchIndex: 1
|
|
320
|
+
})), _react().default.createElement("div", {
|
|
321
|
+
className: (0, _css().css)`
|
|
322
|
+
position: relative;
|
|
323
|
+
height: 2em;
|
|
324
|
+
overflow: visible;
|
|
325
|
+
|
|
326
|
+
> span{
|
|
327
|
+
position: absolute;
|
|
328
|
+
top: calc(1.5em - 1px);
|
|
329
|
+
line-height: 1em;
|
|
330
|
+
color: #999;
|
|
331
|
+
background-color: #f0f2f5;
|
|
332
|
+
padding: 1px;
|
|
333
|
+
}
|
|
334
|
+
`
|
|
335
|
+
}, _react().default.createElement("span", {
|
|
336
|
+
className: (0, _css().css)`right: 4em;`
|
|
337
|
+
}, _client().i18n.t('No')), _react().default.createElement("span", {
|
|
338
|
+
className: (0, _css().css)`left: 4em;`
|
|
339
|
+
}, _client().i18n.t('Yes')))));
|
|
340
|
+
},
|
|
341
|
+
|
|
342
|
+
components: {
|
|
343
|
+
CalculationConfig
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
exports.default = _default;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useCollectionDataSource } from '@nocobase/client';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
title: string;
|
|
5
|
+
type: string;
|
|
6
|
+
group: string;
|
|
7
|
+
fieldset: {
|
|
8
|
+
'config.collection': {
|
|
9
|
+
name: string;
|
|
10
|
+
type: string;
|
|
11
|
+
title: string;
|
|
12
|
+
required: boolean;
|
|
13
|
+
'x-reactions': string[];
|
|
14
|
+
'x-decorator': string;
|
|
15
|
+
'x-component': string;
|
|
16
|
+
'x-component-props': {
|
|
17
|
+
placeholder: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
'config.params.values': {
|
|
21
|
+
type: string;
|
|
22
|
+
title: string;
|
|
23
|
+
name: string;
|
|
24
|
+
'x-decorator': string;
|
|
25
|
+
'x-decorator-props': {
|
|
26
|
+
labelAlign: string;
|
|
27
|
+
className: string;
|
|
28
|
+
};
|
|
29
|
+
'x-component': string;
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
view: {};
|
|
34
|
+
scope: {
|
|
35
|
+
useCollectionDataSource: typeof useCollectionDataSource;
|
|
36
|
+
};
|
|
37
|
+
components: {
|
|
38
|
+
CollectionFieldset: React.MemoExoticComponent<React.FunctionComponent<Pick<any, string | number | symbol>>>;
|
|
39
|
+
};
|
|
40
|
+
getter({ type, options, onChange }: {
|
|
41
|
+
type: any;
|
|
42
|
+
options: any;
|
|
43
|
+
onChange: any;
|
|
44
|
+
}): JSX.Element;
|
|
45
|
+
};
|
|
46
|
+
export default _default;
|