@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,47 +4,32 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.workflowSchema = void 0;
|
|
7
|
-
|
|
8
7
|
function _antd() {
|
|
9
8
|
const data = require("antd");
|
|
10
|
-
|
|
11
9
|
_antd = function _antd() {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
function _reactI18next() {
|
|
19
15
|
const data = require("react-i18next");
|
|
20
|
-
|
|
21
16
|
_reactI18next = function _reactI18next() {
|
|
22
17
|
return data;
|
|
23
18
|
};
|
|
24
|
-
|
|
25
19
|
return data;
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
function _client() {
|
|
29
22
|
const data = require("@nocobase/client");
|
|
30
|
-
|
|
31
23
|
_client = function _client() {
|
|
32
24
|
return data;
|
|
33
25
|
};
|
|
34
|
-
|
|
35
26
|
return data;
|
|
36
27
|
}
|
|
37
|
-
|
|
38
28
|
var _locale = require("../locale");
|
|
39
|
-
|
|
40
29
|
var _triggers = require("../triggers");
|
|
41
|
-
|
|
42
30
|
var _executions = require("./executions");
|
|
43
|
-
|
|
44
31
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
45
|
-
|
|
46
32
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
47
|
-
|
|
48
33
|
const collection = {
|
|
49
34
|
name: 'workflows',
|
|
50
35
|
fields: [{
|
|
@@ -312,9 +297,9 @@ const workflowSchema = {
|
|
|
312
297
|
type: 'primary'
|
|
313
298
|
},
|
|
314
299
|
properties: {
|
|
315
|
-
|
|
300
|
+
drawer: {
|
|
316
301
|
type: 'void',
|
|
317
|
-
'x-component': 'Action.
|
|
302
|
+
'x-component': 'Action.Drawer',
|
|
318
303
|
'x-decorator': 'Form',
|
|
319
304
|
'x-decorator-props': {
|
|
320
305
|
useValues: '{{ cm.useValuesFromRecord }}'
|
|
@@ -335,7 +320,7 @@ const workflowSchema = {
|
|
|
335
320
|
},
|
|
336
321
|
footer: {
|
|
337
322
|
type: 'void',
|
|
338
|
-
'x-component': 'Action.
|
|
323
|
+
'x-component': 'Action.Drawer.Footer',
|
|
339
324
|
properties: {
|
|
340
325
|
cancel: {
|
|
341
326
|
title: '{{ t("Cancel") }}',
|
|
@@ -365,36 +350,29 @@ const workflowSchema = {
|
|
|
365
350
|
'x-component-props': {
|
|
366
351
|
useAction() {
|
|
367
352
|
const _useTranslation = (0, _reactI18next().useTranslation)(),
|
|
368
|
-
|
|
369
|
-
|
|
353
|
+
t = _useTranslation.t;
|
|
370
354
|
const _useResourceActionCon = (0, _client().useResourceActionContext)(),
|
|
371
|
-
|
|
372
|
-
|
|
355
|
+
refresh = _useResourceActionCon.refresh;
|
|
373
356
|
const _useResourceContext = (0, _client().useResourceContext)(),
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
357
|
+
resource = _useResourceContext.resource,
|
|
358
|
+
targetKey = _useResourceContext.targetKey;
|
|
377
359
|
const _useRecord = (0, _client().useRecord)(),
|
|
378
|
-
|
|
379
|
-
|
|
360
|
+
filterByTk = _useRecord[targetKey];
|
|
380
361
|
return {
|
|
381
362
|
run() {
|
|
382
363
|
return _asyncToGenerator(function* () {
|
|
383
364
|
yield resource.revision({
|
|
384
365
|
filterByTk
|
|
385
366
|
});
|
|
386
|
-
|
|
387
367
|
_antd().message.success(t('Operation succeeded'));
|
|
388
|
-
|
|
389
368
|
refresh();
|
|
390
369
|
})();
|
|
391
370
|
}
|
|
392
|
-
|
|
393
371
|
};
|
|
394
372
|
}
|
|
395
|
-
|
|
396
373
|
}
|
|
397
|
-
}
|
|
374
|
+
}
|
|
375
|
+
// delete: {
|
|
398
376
|
// type: 'void',
|
|
399
377
|
// title: '{{ t("Delete") }}',
|
|
400
378
|
// 'x-component': 'Action.Link',
|
|
@@ -406,7 +384,6 @@ const workflowSchema = {
|
|
|
406
384
|
// useAction: '{{ cm.useDestroyActionAndRefreshCM }}',
|
|
407
385
|
// },
|
|
408
386
|
// },
|
|
409
|
-
|
|
410
387
|
}
|
|
411
388
|
}
|
|
412
389
|
}
|
package/lib/client/style.js
CHANGED
|
@@ -4,17 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.workflowVersionDropdownClass = exports.workflowPageClass = exports.nodeTitleClass = exports.nodeSubtreeClass = exports.nodeMetaClass = exports.nodeHeaderClass = exports.nodeClass = exports.nodeCardClass = exports.nodeBlockClass = exports.branchClass = exports.branchBlockClass = exports.addButtonClass = void 0;
|
|
7
|
-
|
|
8
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
|
const workflowPageClass = (0, _css().css)`
|
|
19
15
|
.workflow-toolbar{
|
|
20
16
|
display: flex;
|
|
@@ -49,28 +45,19 @@ const workflowPageClass = (0, _css().css)`
|
|
|
49
45
|
flex-direction: column;
|
|
50
46
|
align-items: center;
|
|
51
47
|
padding: 2em;
|
|
48
|
+
|
|
49
|
+
.end{
|
|
50
|
+
cursor: default;
|
|
51
|
+
|
|
52
|
+
&:hover{
|
|
53
|
+
box-shadow: 0 .25em .5em rgba(0, 0, 0, .1);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
52
56
|
}
|
|
53
57
|
`;
|
|
54
58
|
exports.workflowPageClass = workflowPageClass;
|
|
55
59
|
const workflowVersionDropdownClass = (0, _css().css)`
|
|
56
60
|
.ant-dropdown-menu-item{
|
|
57
|
-
|
|
58
|
-
strong{
|
|
59
|
-
font-weight: normal;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
&.enabled{
|
|
63
|
-
strong{
|
|
64
|
-
font-weight: bold;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
&.unexecuted{
|
|
69
|
-
strong{
|
|
70
|
-
font-style: italic;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
61
|
.ant-dropdown-menu-title-content{
|
|
75
62
|
text-align: right;
|
|
76
63
|
|
|
@@ -79,6 +66,22 @@ const workflowVersionDropdownClass = (0, _css().css)`
|
|
|
79
66
|
color: #999;
|
|
80
67
|
font-size: 80%;
|
|
81
68
|
}
|
|
69
|
+
|
|
70
|
+
strong{
|
|
71
|
+
font-weight: normal;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
> .enabled{
|
|
75
|
+
strong{
|
|
76
|
+
font-weight: bold;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
> .unexecuted{
|
|
81
|
+
strong{
|
|
82
|
+
font-style: italic;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
82
85
|
}
|
|
83
86
|
}
|
|
84
87
|
`;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { SchemaInitializerItemOptions, useCollectionDataSource } from '@nocobase/client';
|
|
3
2
|
import { CollectionFieldInitializers } from '../components/CollectionFieldInitializers';
|
|
4
3
|
declare const _default: {
|
|
@@ -37,25 +36,14 @@ declare const _default: {
|
|
|
37
36
|
placeholder: string;
|
|
38
37
|
};
|
|
39
38
|
required: boolean;
|
|
40
|
-
'x-reactions':
|
|
39
|
+
'x-reactions': {
|
|
41
40
|
dependencies: string[];
|
|
42
41
|
fulfill: {
|
|
43
42
|
state: {
|
|
44
43
|
visible: string;
|
|
45
|
-
disabled?: undefined;
|
|
46
44
|
};
|
|
47
45
|
};
|
|
48
|
-
|
|
49
|
-
} | {
|
|
50
|
-
target: string;
|
|
51
|
-
fulfill: {
|
|
52
|
-
state: {
|
|
53
|
-
disabled: string;
|
|
54
|
-
visible?: undefined;
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
dependencies?: undefined;
|
|
58
|
-
})[];
|
|
46
|
+
}[];
|
|
59
47
|
};
|
|
60
48
|
changed: {
|
|
61
49
|
type: string;
|
|
@@ -89,10 +77,6 @@ declare const _default: {
|
|
|
89
77
|
}[];
|
|
90
78
|
type: string;
|
|
91
79
|
'x-decorator': string;
|
|
92
|
-
'x-decorator-props': {
|
|
93
|
-
labelAlign: string;
|
|
94
|
-
className: string;
|
|
95
|
-
};
|
|
96
80
|
'x-component': string;
|
|
97
81
|
'x-component-props': {
|
|
98
82
|
useProps(): {
|
|
@@ -102,14 +86,34 @@ declare const _default: {
|
|
|
102
86
|
dynamicComponent: string;
|
|
103
87
|
};
|
|
104
88
|
};
|
|
89
|
+
appends: {
|
|
90
|
+
'x-reactions': {
|
|
91
|
+
dependencies: string[];
|
|
92
|
+
fulfill: {
|
|
93
|
+
state: {
|
|
94
|
+
visible: string;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
}[];
|
|
98
|
+
type: string;
|
|
99
|
+
title: string;
|
|
100
|
+
description: string;
|
|
101
|
+
'x-decorator': string;
|
|
102
|
+
'x-component': string;
|
|
103
|
+
'x-component-props': {
|
|
104
|
+
mode: string;
|
|
105
|
+
placeholder: string;
|
|
106
|
+
filter(field: any): boolean;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
105
109
|
};
|
|
106
110
|
scope: {
|
|
107
111
|
useCollectionDataSource: typeof useCollectionDataSource;
|
|
108
112
|
};
|
|
109
113
|
components: {
|
|
110
|
-
FieldsSelect:
|
|
114
|
+
FieldsSelect: import("react").MemoExoticComponent<import("react").FunctionComponent<Pick<any, string | number | symbol>>>;
|
|
111
115
|
};
|
|
112
|
-
getOptions(config: any, types: any):
|
|
116
|
+
getOptions(config: any, types: any): import("../variable").VariableOption[];
|
|
113
117
|
useInitializers(config: any): SchemaInitializerItemOptions | null;
|
|
114
118
|
initializers: {
|
|
115
119
|
CollectionFieldInitializers: typeof CollectionFieldInitializers;
|
|
@@ -4,94 +4,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
function _react() {
|
|
9
|
-
const data = _interopRequireDefault(require("react"));
|
|
10
|
-
|
|
11
|
-
_react = function _react() {
|
|
12
|
-
return data;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
return data;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function _antd() {
|
|
19
|
-
const data = require("antd");
|
|
20
|
-
|
|
21
|
-
_antd = function _antd() {
|
|
22
|
-
return data;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
return data;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function _react2() {
|
|
29
|
-
const data = require("@formily/react");
|
|
30
|
-
|
|
31
|
-
_react2 = function _react2() {
|
|
32
|
-
return data;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
return data;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
7
|
function _client() {
|
|
39
8
|
const data = require("@nocobase/client");
|
|
40
|
-
|
|
41
9
|
_client = function _client() {
|
|
42
10
|
return data;
|
|
43
11
|
};
|
|
44
|
-
|
|
45
12
|
return data;
|
|
46
13
|
}
|
|
47
|
-
|
|
48
14
|
var _collection = require("../schemas/collection");
|
|
49
|
-
|
|
50
15
|
var _variable = require("../variable");
|
|
51
|
-
|
|
52
16
|
var _CollectionBlockInitializer = require("../components/CollectionBlockInitializer");
|
|
53
|
-
|
|
54
17
|
var _CollectionFieldInitializers = require("../components/CollectionFieldInitializers");
|
|
55
|
-
|
|
56
18
|
var _locale = require("../locale");
|
|
57
|
-
|
|
58
|
-
const _excluded = ["filter"];
|
|
59
|
-
|
|
60
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
61
|
-
|
|
19
|
+
var _FieldsSelect = require("../components/FieldsSelect");
|
|
62
20
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
63
|
-
|
|
64
21
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
65
|
-
|
|
66
|
-
function
|
|
67
|
-
|
|
68
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
69
|
-
|
|
70
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
71
|
-
|
|
72
|
-
const FieldsSelect = (0, _react2().observer)(props => {
|
|
73
|
-
const _props$filter = props.filter,
|
|
74
|
-
filter = _props$filter === void 0 ? () => true : _props$filter,
|
|
75
|
-
others = _objectWithoutProperties(props, _excluded);
|
|
76
|
-
|
|
77
|
-
const compile = (0, _client().useCompile)();
|
|
78
|
-
|
|
79
|
-
const _useCollectionManager = (0, _client().useCollectionManager)(),
|
|
80
|
-
getCollectionFields = _useCollectionManager.getCollectionFields;
|
|
81
|
-
|
|
82
|
-
const _useForm = (0, _react2().useForm)(),
|
|
83
|
-
values = _useForm.values;
|
|
84
|
-
|
|
85
|
-
const fields = getCollectionFields(values === null || values === void 0 ? void 0 : values.collection);
|
|
86
|
-
return _react().default.createElement(_antd().Select, _objectSpread({}, others), fields.filter(filter).map(field => {
|
|
87
|
-
var _field$uiSchema;
|
|
88
|
-
|
|
89
|
-
return _react().default.createElement(_antd().Select.Option, {
|
|
90
|
-
key: field.name,
|
|
91
|
-
value: field.name
|
|
92
|
-
}, compile((_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema.title));
|
|
93
|
-
}));
|
|
94
|
-
});
|
|
22
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
24
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
95
25
|
const COLLECTION_TRIGGER_MODE = {
|
|
96
26
|
CREATED: 1,
|
|
97
27
|
UPDATED: 2,
|
|
@@ -151,13 +81,6 @@ var _default = {
|
|
|
151
81
|
visible: '{{!!$deps[0]}}'
|
|
152
82
|
}
|
|
153
83
|
}
|
|
154
|
-
}, {
|
|
155
|
-
target: 'changed',
|
|
156
|
-
fulfill: {
|
|
157
|
-
state: {
|
|
158
|
-
disabled: `{{!($self.value & ${COLLECTION_TRIGGER_MODE.UPDATED})}}`
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
84
|
}]
|
|
162
85
|
},
|
|
163
86
|
changed: {
|
|
@@ -169,17 +92,15 @@ var _default = {
|
|
|
169
92
|
'x-component-props': {
|
|
170
93
|
mode: 'multiple',
|
|
171
94
|
placeholder: '{{t("Select Field")}}',
|
|
172
|
-
|
|
173
95
|
filter(field) {
|
|
174
96
|
return !field.hidden && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : true) && !['linkTo', 'hasOne', 'hasMany', 'belongsToMany'].includes(field.type);
|
|
175
97
|
}
|
|
176
|
-
|
|
177
98
|
},
|
|
178
99
|
'x-reactions': [{
|
|
179
|
-
dependencies: ['collection'],
|
|
100
|
+
dependencies: ['collection', 'mode'],
|
|
180
101
|
fulfill: {
|
|
181
102
|
state: {
|
|
182
|
-
visible:
|
|
103
|
+
visible: `{{!!$deps[0] && ($deps[1] & ${COLLECTION_TRIGGER_MODE.UPDATED})}}`
|
|
183
104
|
}
|
|
184
105
|
}
|
|
185
106
|
}]
|
|
@@ -194,67 +115,57 @@ var _default = {
|
|
|
194
115
|
}
|
|
195
116
|
}
|
|
196
117
|
}]
|
|
197
|
-
})
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
// {
|
|
209
|
-
// dependencies: ['collection'],
|
|
210
|
-
// fulfill: {
|
|
211
|
-
// state: {
|
|
212
|
-
// visible: '{{!!$deps[0]}}',
|
|
213
|
-
// },
|
|
214
|
-
// }
|
|
215
|
-
// },
|
|
216
|
-
// ]
|
|
217
|
-
// },
|
|
218
|
-
|
|
118
|
+
}),
|
|
119
|
+
appends: _objectSpread(_objectSpread({}, _collection.appends), {}, {
|
|
120
|
+
'x-reactions': [..._collection.appends['x-reactions'], {
|
|
121
|
+
dependencies: ['mode'],
|
|
122
|
+
fulfill: {
|
|
123
|
+
state: {
|
|
124
|
+
visible: `{{!($deps[0] & ${COLLECTION_TRIGGER_MODE.DELETED})}}`
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}]
|
|
128
|
+
})
|
|
219
129
|
},
|
|
220
130
|
scope: {
|
|
221
131
|
useCollectionDataSource: _client().useCollectionDataSource
|
|
222
132
|
},
|
|
223
133
|
components: {
|
|
224
|
-
FieldsSelect
|
|
134
|
+
FieldsSelect: _FieldsSelect.FieldsSelect
|
|
225
135
|
},
|
|
226
|
-
|
|
227
136
|
getOptions(config, types) {
|
|
137
|
+
var _config$appends;
|
|
228
138
|
const _useWorkflowTranslati = (0, _locale.useWorkflowTranslation)(),
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
139
|
+
t = _useWorkflowTranslati.t;
|
|
140
|
+
const rootFields = [{
|
|
141
|
+
collectionName: config.collection,
|
|
142
|
+
name: 'data',
|
|
143
|
+
type: 'hasOne',
|
|
144
|
+
target: config.collection,
|
|
145
|
+
uiSchema: {
|
|
146
|
+
title: t('Trigger data')
|
|
147
|
+
}
|
|
148
|
+
}];
|
|
149
|
+
const options = (0, _variable.useCollectionFieldOptions)({
|
|
150
|
+
fields: rootFields,
|
|
151
|
+
types,
|
|
152
|
+
depth: ((_config$appends = config.appends) === null || _config$appends === void 0 ? void 0 : _config$appends.length) ? 2 : 1
|
|
234
153
|
});
|
|
235
|
-
const options = [...((fieldOptions === null || fieldOptions === void 0 ? void 0 : fieldOptions.length) ? [{
|
|
236
|
-
label: t('Trigger data'),
|
|
237
|
-
key: 'data',
|
|
238
|
-
value: 'data',
|
|
239
|
-
children: fieldOptions
|
|
240
|
-
}] : [])];
|
|
241
154
|
return options;
|
|
242
155
|
},
|
|
243
|
-
|
|
244
156
|
useInitializers(config) {
|
|
245
157
|
if (!config.collection) {
|
|
246
158
|
return null;
|
|
247
159
|
}
|
|
248
|
-
|
|
249
160
|
return {
|
|
250
161
|
type: 'item',
|
|
162
|
+
key: 'triggerData',
|
|
251
163
|
title: `{{t("Trigger data", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
252
164
|
component: _CollectionBlockInitializer.CollectionBlockInitializer,
|
|
253
165
|
collection: config.collection,
|
|
254
166
|
dataSource: '{{$context.data}}'
|
|
255
167
|
};
|
|
256
168
|
},
|
|
257
|
-
|
|
258
169
|
initializers: {
|
|
259
170
|
CollectionFieldInitializers: _CollectionFieldInitializers.CollectionFieldInitializers
|
|
260
171
|
}
|
|
@@ -2,14 +2,11 @@ import React from "react";
|
|
|
2
2
|
import { ISchema } from "@formily/react";
|
|
3
3
|
import { Registry } from "@nocobase/utils/client";
|
|
4
4
|
import { SchemaInitializerItemOptions } from '@nocobase/client';
|
|
5
|
+
import { VariableOptions } from "../variable";
|
|
5
6
|
export interface Trigger {
|
|
6
7
|
title: string;
|
|
7
8
|
type: string;
|
|
8
|
-
getOptions?(config: any, types: any[]):
|
|
9
|
-
label: string;
|
|
10
|
-
value: any;
|
|
11
|
-
key: string;
|
|
12
|
-
}[];
|
|
9
|
+
getOptions?(config: any, types: any[]): VariableOptions;
|
|
13
10
|
fieldset: {
|
|
14
11
|
[key: string]: ISchema;
|
|
15
12
|
};
|