@nocobase/plugin-workflow 0.9.4-alpha.2 → 0.10.0-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.d.ts +2 -2
- package/lib/client/Branch.d.ts +2 -2
- package/lib/client/CanvasContent.d.ts +2 -2
- package/lib/client/ExecutionCanvas.d.ts +2 -2
- package/lib/client/ExecutionCanvas.js +1 -1
- package/lib/client/ExecutionLink.d.ts +2 -1
- package/lib/client/ExecutionPage.d.ts +2 -1
- package/lib/client/ExecutionPage.js +14 -15
- package/lib/client/ExecutionResourceProvider.d.ts +2 -1
- package/lib/client/WorkflowCanvas.d.ts +2 -2
- package/lib/client/WorkflowCanvas.js +31 -31
- package/lib/client/WorkflowLink.d.ts +2 -1
- package/lib/client/WorkflowPage.d.ts +2 -1
- package/lib/client/WorkflowPage.js +11 -10
- package/lib/client/WorkflowProvider.d.ts +1 -1
- package/lib/client/WorkflowProvider.js +15 -15
- package/lib/client/components/CollectionBlockInitializer.d.ts +2 -7
- package/lib/client/components/CollectionBlockInitializer.js +49 -17
- package/lib/client/components/CollectionFieldset.d.ts +2 -2
- package/lib/client/components/CollectionFieldset.js +18 -15
- package/lib/client/components/Duration.d.ts +2 -2
- package/lib/client/components/DynamicExpression.d.ts +3 -1
- package/lib/client/components/DynamicExpression.js +2 -0
- package/lib/client/components/FieldsSelect.d.ts +1 -1
- package/lib/client/components/FieldsSelect.js +2 -0
- package/lib/client/components/FilterDynamicComponent.d.ts +2 -2
- package/lib/client/components/NodeDescription.d.ts +2 -2
- package/lib/client/components/OpenDrawer.d.ts +2 -2
- package/lib/client/components/OpenDrawer.js +1 -1
- package/lib/client/components/RadioWithTooltip.d.ts +2 -2
- package/lib/client/components/renderEngineReference.d.ts +2 -1
- package/lib/client/constants.d.ts +2 -1
- package/lib/client/locale/zh-CN.d.ts +3 -0
- package/lib/client/locale/zh-CN.js +3 -0
- package/lib/client/nodes/aggregate.d.ts +1 -1
- package/lib/client/nodes/calculation.d.ts +4 -3
- package/lib/client/nodes/condition.d.ts +6 -4
- package/lib/client/nodes/condition.js +3 -1
- package/lib/client/nodes/create.d.ts +3 -6
- package/lib/client/nodes/create.js +1 -4
- package/lib/client/nodes/index.d.ts +5 -5
- package/lib/client/nodes/index.js +7 -4
- package/lib/client/nodes/loop.d.ts +4 -1
- package/lib/client/nodes/loop.js +3 -1
- package/lib/client/nodes/manual/AssigneesSelect.d.ts +2 -2
- package/lib/client/nodes/manual/DetailsBlockProvider.d.ts +2 -0
- package/lib/client/nodes/manual/DetailsBlockProvider.js +106 -0
- package/lib/client/nodes/manual/FormBlockInitializer.d.ts +2 -0
- package/lib/client/nodes/manual/FormBlockInitializer.js +106 -0
- package/lib/client/nodes/manual/FormBlockProvider.d.ts +2 -0
- package/lib/client/nodes/manual/FormBlockProvider.js +113 -0
- package/lib/client/nodes/manual/ModeConfig.d.ts +2 -2
- package/lib/client/nodes/manual/SchemaConfig.d.ts +43 -3
- package/lib/client/nodes/manual/SchemaConfig.js +42 -79
- package/lib/client/nodes/manual/WorkflowTodo.d.ts +5 -8
- package/lib/client/nodes/manual/WorkflowTodo.js +111 -76
- package/lib/client/nodes/manual/WorkflowTodoBlockInitializer.d.ts +2 -2
- package/lib/client/nodes/manual/forms/create.d.ts +3 -0
- package/lib/client/nodes/manual/forms/create.js +104 -0
- package/lib/client/nodes/manual/forms/custom.d.ts +3 -0
- package/lib/client/nodes/manual/forms/{customForm.js → custom.js} +63 -45
- package/lib/client/nodes/manual/forms/update.d.ts +3 -0
- package/lib/client/nodes/manual/forms/update.js +161 -0
- package/lib/client/nodes/manual/index.d.ts +2 -5
- package/lib/client/nodes/manual/index.js +17 -16
- package/lib/client/nodes/manual/utils.d.ts +2 -0
- package/lib/client/nodes/manual/utils.js +31 -0
- package/lib/client/nodes/parallel.d.ts +4 -1
- package/lib/client/nodes/parallel.js +3 -1
- package/lib/client/nodes/query.d.ts +2 -5
- package/lib/client/nodes/query.js +2 -5
- package/lib/client/nodes/request.d.ts +1 -1
- package/lib/client/nodes/request.js +1 -11
- package/lib/client/nodes/update.d.ts +1 -1
- package/lib/client/schemas/collection.js +1 -1
- package/lib/client/schemas/executions.d.ts +2 -0
- package/lib/client/triggers/collection.d.ts +2 -5
- package/lib/client/triggers/collection.js +5 -8
- package/lib/client/triggers/index.d.ts +1 -2
- package/lib/client/triggers/index.js +4 -3
- package/lib/client/triggers/schedule/DateFieldsSelect.js +14 -12
- package/lib/client/triggers/schedule/EndsByField.d.ts +2 -2
- package/lib/client/triggers/schedule/OnField.d.ts +2 -2
- package/lib/client/triggers/schedule/RepeatField.d.ts +2 -2
- package/lib/client/triggers/schedule/ScheduleConfig.d.ts +2 -1
- package/lib/client/triggers/schedule/index.d.ts +3 -6
- package/lib/client/triggers/schedule/index.js +1 -4
- package/lib/server/Processor.js +1 -2
- package/lib/server/instructions/manual/actions.js +42 -47
- package/lib/server/instructions/manual/forms/create.d.ts +5 -0
- package/lib/server/instructions/manual/forms/create.js +46 -0
- package/lib/server/instructions/manual/forms/index.d.ts +6 -0
- package/lib/server/instructions/manual/forms/index.js +15 -0
- package/lib/server/instructions/manual/forms/update.d.ts +6 -0
- package/lib/server/instructions/manual/forms/update.js +47 -0
- package/lib/server/instructions/manual/index.d.ts +3 -0
- package/lib/server/instructions/manual/index.js +16 -3
- package/lib/server/instructions/request.js +1 -1
- package/lib/server/migrations/20230612021134-manual-collection-block.d.ts +4 -0
- package/lib/server/migrations/20230612021134-manual-collection-block.js +155 -0
- package/package.json +16 -13
- package/lib/client/WorkflowShortcut.d.ts +0 -1
- package/lib/client/WorkflowShortcut.js +0 -48
- package/lib/client/components/CollectionFieldInitializers.d.ts +0 -2
- package/lib/client/components/CollectionFieldInitializers.js +0 -70
- package/lib/client/nodes/manual/forms/customForm.d.ts +0 -40
|
@@ -51,7 +51,7 @@ function _default(_ref) {
|
|
|
51
51
|
visible = _useState2[0],
|
|
52
52
|
setVisible = _useState2[1];
|
|
53
53
|
const fieldSchema = (0, _react2().useFieldSchema)();
|
|
54
|
-
return _react().default.createElement(_client().
|
|
54
|
+
return _react().default.createElement(_client().ActionContextProvider, {
|
|
55
55
|
value: {
|
|
56
56
|
visible,
|
|
57
57
|
setVisible,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
export interface RadioWithTooltipOption {
|
|
3
3
|
value: any;
|
|
4
4
|
label: string;
|
|
5
5
|
tooltip?: string;
|
|
6
6
|
}
|
|
7
|
-
export declare function RadioWithTooltip(props: any): JSX.Element;
|
|
7
|
+
export declare function RadioWithTooltip(props: any): React.JSX.Element;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const renderEngineReference: (key: string) => React.JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
export declare const EXECUTION_STATUS: {
|
|
2
3
|
QUEUEING: any;
|
|
3
4
|
STARTED: number;
|
|
@@ -27,6 +28,6 @@ export declare const JobStatusOptions: {
|
|
|
27
28
|
value: number;
|
|
28
29
|
label: string;
|
|
29
30
|
color: string;
|
|
30
|
-
icon: JSX.Element;
|
|
31
|
+
icon: React.JSX.Element;
|
|
31
32
|
}[];
|
|
32
33
|
export declare const JobStatusOptionsMap: {};
|
|
@@ -146,6 +146,9 @@ declare const _default: {
|
|
|
146
146
|
'Field name existed in form': string;
|
|
147
147
|
'Custom form': string;
|
|
148
148
|
'Data record': string;
|
|
149
|
+
'Create record form': string;
|
|
150
|
+
'Update record form': string;
|
|
151
|
+
'Filter settings': string;
|
|
149
152
|
'Create record': string;
|
|
150
153
|
'Add new record to a collection. You can use variables from upstream nodes to assign values to fields.': string;
|
|
151
154
|
'Update record': string;
|
|
@@ -152,6 +152,9 @@ var _default = {
|
|
|
152
152
|
'Field name existed in form': '表单中已有对应标识的字段',
|
|
153
153
|
'Custom form': '自定义表单',
|
|
154
154
|
'Data record': '数据记录',
|
|
155
|
+
'Create record form': '新增数据表单',
|
|
156
|
+
'Update record form': '更新数据表单',
|
|
157
|
+
'Filter settings': '筛选设置',
|
|
155
158
|
'Create record': '新增数据',
|
|
156
159
|
'Add new record to a collection. You can use variables from upstream nodes to assign values to fields.': '向一个数据表中添加新的数据。可以使用上游节点里的变量为字段赋值。',
|
|
157
160
|
'Update record': '更新数据',
|
|
@@ -171,7 +171,7 @@ declare const _default: {
|
|
|
171
171
|
components: {
|
|
172
172
|
SchemaComponentContext: React.Context<import("@nocobase/client").ISchemaComponentContext>;
|
|
173
173
|
FilterDynamicComponent: typeof FilterDynamicComponent;
|
|
174
|
-
FieldsSelect: React.MemoExoticComponent<
|
|
174
|
+
FieldsSelect: React.MemoExoticComponent<import("@formily/react").ReactFC<Pick<any, string | number | symbol>>>;
|
|
175
175
|
ValueBlock: (() => JSX.Element) & {
|
|
176
176
|
Initializer: (props: any) => JSX.Element;
|
|
177
177
|
Result: (props: any) => JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SchemaInitializerItemOptions } from '@nocobase/client';
|
|
2
|
+
import React from 'react';
|
|
2
3
|
import { RadioWithTooltip } from '../components/RadioWithTooltip';
|
|
3
4
|
import { useWorkflowVariableOptions } from '../variable';
|
|
4
5
|
declare function useWorkflowVariableEntityOptions(): {
|
|
@@ -90,17 +91,17 @@ declare const _default: {
|
|
|
90
91
|
scope: {
|
|
91
92
|
useWorkflowVariableOptions: typeof useWorkflowVariableOptions;
|
|
92
93
|
useWorkflowVariableEntityOptions: typeof useWorkflowVariableEntityOptions;
|
|
93
|
-
renderEngineReference: (key: string) => JSX.Element;
|
|
94
|
+
renderEngineReference: (key: string) => React.JSX.Element;
|
|
94
95
|
};
|
|
95
96
|
components: {
|
|
96
97
|
CalculationResult({ dataSource }: {
|
|
97
98
|
dataSource: any;
|
|
98
|
-
}): string | JSX.Element;
|
|
99
|
+
}): string | React.JSX.Element;
|
|
99
100
|
RadioWithTooltip: typeof RadioWithTooltip;
|
|
100
101
|
DynamicConfig: ({ value, onChange }: {
|
|
101
102
|
value: any;
|
|
102
103
|
onChange: any;
|
|
103
|
-
}) => JSX.Element;
|
|
104
|
+
}) => React.JSX.Element;
|
|
104
105
|
};
|
|
105
106
|
useVariables(current: any, options: any): any[];
|
|
106
107
|
useInitializers(node: any): SchemaInitializerItemOptions;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { Registry } from '@nocobase/utils/client';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { RadioWithTooltip } from '../components/RadioWithTooltip';
|
|
4
4
|
import { useWorkflowVariableOptions } from '../variable';
|
|
5
5
|
interface Calculator {
|
|
@@ -11,7 +11,7 @@ export declare const calculators: Registry<Calculator>;
|
|
|
11
11
|
declare function CalculationConfig({ value, onChange }: {
|
|
12
12
|
value: any;
|
|
13
13
|
onChange: any;
|
|
14
|
-
}): JSX.Element;
|
|
14
|
+
}): React.JSX.Element;
|
|
15
15
|
declare const _default: {
|
|
16
16
|
title: string;
|
|
17
17
|
type: string;
|
|
@@ -92,9 +92,11 @@ declare const _default: {
|
|
|
92
92
|
rejectOnFalse: boolean;
|
|
93
93
|
};
|
|
94
94
|
}[];
|
|
95
|
-
|
|
95
|
+
component: ({ data }: {
|
|
96
|
+
data: any;
|
|
97
|
+
}) => React.JSX.Element;
|
|
96
98
|
scope: {
|
|
97
|
-
renderEngineReference: (key: string) => JSX.Element;
|
|
99
|
+
renderEngineReference: (key: string) => React.JSX.Element;
|
|
98
100
|
useWorkflowVariableOptions: typeof useWorkflowVariableOptions;
|
|
99
101
|
};
|
|
100
102
|
components: {
|
|
@@ -478,7 +478,9 @@ var _default = {
|
|
|
478
478
|
rejectOnFalse: false
|
|
479
479
|
}
|
|
480
480
|
}],
|
|
481
|
-
|
|
481
|
+
component: function Component({
|
|
482
|
+
data
|
|
483
|
+
}) {
|
|
482
484
|
const _useTranslation2 = (0, _reactI18next().useTranslation)(),
|
|
483
485
|
t = _useTranslation2.t;
|
|
484
486
|
const _useFlowContext = (0, _FlowContext.useFlowContext)(),
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SchemaInitializerItemOptions, useCollectionDataSource } from '@nocobase/client';
|
|
2
|
-
import { CollectionFieldInitializers } from '../components/CollectionFieldInitializers';
|
|
3
2
|
declare const _default: {
|
|
4
3
|
title: string;
|
|
5
4
|
type: string;
|
|
@@ -59,15 +58,13 @@ declare const _default: {
|
|
|
59
58
|
useCollectionDataSource: typeof useCollectionDataSource;
|
|
60
59
|
};
|
|
61
60
|
components: {
|
|
62
|
-
CollectionFieldset: import("react").MemoExoticComponent<import("react").
|
|
63
|
-
FieldsSelect: import("react").MemoExoticComponent<import("react").
|
|
61
|
+
CollectionFieldset: import("react").MemoExoticComponent<import("@formily/reactive-react").ReactFC<Pick<any, string | number | symbol>>>;
|
|
62
|
+
FieldsSelect: import("react").MemoExoticComponent<import("@formily/reactive-react").ReactFC<Pick<any, string | number | symbol>>>;
|
|
64
63
|
};
|
|
65
64
|
useVariables({ config }: {
|
|
66
65
|
config: any;
|
|
67
66
|
}, options: any): import("../variable").VariableOption[];
|
|
68
67
|
useInitializers(node: any): SchemaInitializerItemOptions | null;
|
|
69
|
-
initializers: {
|
|
70
|
-
CollectionFieldInitializers: typeof CollectionFieldInitializers;
|
|
71
|
-
};
|
|
68
|
+
initializers: {};
|
|
72
69
|
};
|
|
73
70
|
export default _default;
|
|
@@ -15,7 +15,6 @@ var _collection = require("../schemas/collection");
|
|
|
15
15
|
var _CollectionFieldset = _interopRequireDefault(require("../components/CollectionFieldset"));
|
|
16
16
|
var _locale = require("../locale");
|
|
17
17
|
var _CollectionBlockInitializer = require("../components/CollectionBlockInitializer");
|
|
18
|
-
var _CollectionFieldInitializers = require("../components/CollectionFieldInitializers");
|
|
19
18
|
var _variable = require("../variable");
|
|
20
19
|
var _FieldsSelect = require("../components/FieldsSelect");
|
|
21
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -81,8 +80,6 @@ var _default = {
|
|
|
81
80
|
dataSource: `{{$jobsMapByNodeId.${node.id}}}`
|
|
82
81
|
};
|
|
83
82
|
},
|
|
84
|
-
initializers: {
|
|
85
|
-
CollectionFieldInitializers: _CollectionFieldInitializers.CollectionFieldInitializers
|
|
86
|
-
}
|
|
83
|
+
initializers: {}
|
|
87
84
|
};
|
|
88
85
|
exports.default = _default;
|
|
@@ -23,7 +23,7 @@ export interface Instruction {
|
|
|
23
23
|
components?: {
|
|
24
24
|
[key: string]: any;
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
component?(props: any): JSX.Element;
|
|
27
27
|
endding?: boolean;
|
|
28
28
|
useVariables?(node: any, options?: any): VariableOptions;
|
|
29
29
|
useScopeVariables?(node: any, options?: any): VariableOptions;
|
|
@@ -39,7 +39,7 @@ export declare function useAvailableUpstreams(node: any): any[];
|
|
|
39
39
|
export declare function useUpstreamScopes(node: any): any[];
|
|
40
40
|
export declare function Node({ data }: {
|
|
41
41
|
data: any;
|
|
42
|
-
}): JSX.Element;
|
|
43
|
-
export declare function RemoveButton(): JSX.Element;
|
|
44
|
-
export declare function JobButton(): JSX.Element;
|
|
45
|
-
export declare function NodeDefaultView(props: any): JSX.Element;
|
|
42
|
+
}): React.JSX.Element;
|
|
43
|
+
export declare function RemoveButton(): React.JSX.Element;
|
|
44
|
+
export declare function JobButton(): React.JSX.Element;
|
|
45
|
+
export declare function NodeDefaultView(props: any): React.JSX.Element;
|
|
@@ -179,14 +179,17 @@ function useUpstreamScopes(node) {
|
|
|
179
179
|
function Node({
|
|
180
180
|
data
|
|
181
181
|
}) {
|
|
182
|
-
const
|
|
182
|
+
const _instructions$get = instructions.get(data.type),
|
|
183
|
+
_instructions$get$com = _instructions$get.component,
|
|
184
|
+
Component = _instructions$get$com === void 0 ? NodeDefaultView : _instructions$get$com,
|
|
185
|
+
endding = _instructions$get.endding;
|
|
183
186
|
return _react().default.createElement(NodeContext.Provider, {
|
|
184
187
|
value: data
|
|
185
188
|
}, _react().default.createElement("div", {
|
|
186
189
|
className: (0, _css().cx)(_style.nodeBlockClass)
|
|
187
|
-
},
|
|
190
|
+
}, _react().default.createElement(Component, {
|
|
188
191
|
data: data
|
|
189
|
-
}), !
|
|
192
|
+
}), !endding ? _react().default.createElement(_AddButton.AddButton, {
|
|
190
193
|
upstream: data
|
|
191
194
|
}) : _react().default.createElement("div", {
|
|
192
195
|
className: (0, _css().css)`
|
|
@@ -420,7 +423,7 @@ function NodeDefaultView(props) {
|
|
|
420
423
|
onChange: ev => setEditingTitle(ev.target.value),
|
|
421
424
|
onBlur: ev => onChangeTitle(ev.target.value),
|
|
422
425
|
autoSize: true
|
|
423
|
-
})), _react().default.createElement(RemoveButton, null), _react().default.createElement(JobButton, null), _react().default.createElement(_client2().
|
|
426
|
+
})), _react().default.createElement(RemoveButton, null), _react().default.createElement(JobButton, null), _react().default.createElement(_client2().ActionContextProvider, {
|
|
424
427
|
value: {
|
|
425
428
|
visible: editingConfig,
|
|
426
429
|
setVisible: setEditingConfig
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { useWorkflowVariableOptions, VariableOption } from '../variable';
|
|
2
3
|
declare const _default: {
|
|
3
4
|
title: string;
|
|
@@ -19,7 +20,9 @@ declare const _default: {
|
|
|
19
20
|
};
|
|
20
21
|
};
|
|
21
22
|
view: {};
|
|
22
|
-
|
|
23
|
+
component: ({ data }: {
|
|
24
|
+
data: any;
|
|
25
|
+
}) => React.JSX.Element;
|
|
23
26
|
scope: {
|
|
24
27
|
useWorkflowVariableOptions: typeof useWorkflowVariableOptions;
|
|
25
28
|
};
|
package/lib/client/nodes/loop.js
CHANGED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DetailsBlockProvider = DetailsBlockProvider;
|
|
7
|
+
function _react() {
|
|
8
|
+
const data = _interopRequireWildcard(require("react"));
|
|
9
|
+
_react = function _react() {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _core() {
|
|
15
|
+
const data = require("@formily/core");
|
|
16
|
+
_core = function _core() {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _react2() {
|
|
22
|
+
const data = require("@formily/react");
|
|
23
|
+
_react2 = function _react2() {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
function _client() {
|
|
29
|
+
const data = require("@nocobase/client");
|
|
30
|
+
_client = function _client() {
|
|
31
|
+
return data;
|
|
32
|
+
};
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
var _FlowContext = require("../../FlowContext");
|
|
36
|
+
function _client2() {
|
|
37
|
+
const data = require("@nocobase/utils/client");
|
|
38
|
+
_client2 = function _client2() {
|
|
39
|
+
return data;
|
|
40
|
+
};
|
|
41
|
+
return data;
|
|
42
|
+
}
|
|
43
|
+
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); }
|
|
44
|
+
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; }
|
|
45
|
+
function useFlowContextData(dataSource) {
|
|
46
|
+
const _useFlowContext = (0, _FlowContext.useFlowContext)(),
|
|
47
|
+
execution = _useFlowContext.execution;
|
|
48
|
+
const data = (0, _react().useMemo)(() => {
|
|
49
|
+
var _execution$jobs;
|
|
50
|
+
return {
|
|
51
|
+
$context: execution === null || execution === void 0 ? void 0 : execution.context,
|
|
52
|
+
$jobsMapByNodeId: ((_execution$jobs = execution === null || execution === void 0 ? void 0 : execution.jobs) !== null && _execution$jobs !== void 0 ? _execution$jobs : []).reduce((map, job) => Object.assign(map, {
|
|
53
|
+
[job.nodeId]: job.result
|
|
54
|
+
}), {})
|
|
55
|
+
};
|
|
56
|
+
}, [execution]);
|
|
57
|
+
const result = (0, _react().useMemo)(() => (0, _client2().parse)(dataSource)(data), [execution]);
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
function DetailsBlockProvider(props) {
|
|
61
|
+
const field = (0, _react2().useField)();
|
|
62
|
+
const formBlockRef = (0, _react().useRef)(null);
|
|
63
|
+
const _useAssociationNames = (0, _client().useAssociationNames)(),
|
|
64
|
+
appends = _useAssociationNames.appends,
|
|
65
|
+
updateAssociationValues = _useAssociationNames.updateAssociationValues;
|
|
66
|
+
const values = useFlowContextData(props.dataSource);
|
|
67
|
+
const form = (0, _react().useMemo)(() => (0, _core().createForm)({
|
|
68
|
+
values,
|
|
69
|
+
readPretty: true
|
|
70
|
+
}), [values]);
|
|
71
|
+
const params = {
|
|
72
|
+
appends
|
|
73
|
+
};
|
|
74
|
+
const service = {
|
|
75
|
+
loading: false,
|
|
76
|
+
data: {
|
|
77
|
+
data: values
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const api = (0, _client().useAPIClient)();
|
|
81
|
+
const resource = api.resource(props.collection);
|
|
82
|
+
const __parent = (0, _react().useContext)(_client().BlockRequestContext);
|
|
83
|
+
return _react().default.createElement(_client().CollectionProvider, {
|
|
84
|
+
collection: props.collection
|
|
85
|
+
}, _react().default.createElement(_client().RecordProvider, {
|
|
86
|
+
record: values,
|
|
87
|
+
parent: false
|
|
88
|
+
}, _react().default.createElement(_client().BlockRequestContext.Provider, {
|
|
89
|
+
value: {
|
|
90
|
+
block: 'form',
|
|
91
|
+
field,
|
|
92
|
+
service,
|
|
93
|
+
resource,
|
|
94
|
+
__parent
|
|
95
|
+
}
|
|
96
|
+
}, _react().default.createElement(_client().FormBlockContext.Provider, {
|
|
97
|
+
value: {
|
|
98
|
+
params,
|
|
99
|
+
form,
|
|
100
|
+
field,
|
|
101
|
+
service,
|
|
102
|
+
updateAssociationValues,
|
|
103
|
+
formBlockRef
|
|
104
|
+
}
|
|
105
|
+
}, props.children))));
|
|
106
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FormBlockInitializer = FormBlockInitializer;
|
|
7
|
+
function _react() {
|
|
8
|
+
const data = _interopRequireDefault(require("react"));
|
|
9
|
+
_react = function _react() {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _client() {
|
|
15
|
+
const data = require("@nocobase/client");
|
|
16
|
+
_client = function _client() {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
var _utils = require("./utils");
|
|
22
|
+
var _constants = require("../../constants");
|
|
23
|
+
var _locale = require("../../locale");
|
|
24
|
+
const _excluded = ["insert", "schema"];
|
|
25
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
26
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
27
|
+
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."); }
|
|
28
|
+
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); }
|
|
29
|
+
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; }
|
|
30
|
+
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; } }
|
|
31
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
32
|
+
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; }
|
|
33
|
+
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; }
|
|
34
|
+
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; }
|
|
35
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
36
|
+
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); }
|
|
37
|
+
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); } }
|
|
38
|
+
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); }); }; }
|
|
39
|
+
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; }
|
|
40
|
+
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; }
|
|
41
|
+
function InternalFormBlockInitializer(_ref) {
|
|
42
|
+
let insert = _ref.insert,
|
|
43
|
+
schema = _ref.schema,
|
|
44
|
+
others = _objectWithoutProperties(_ref, _excluded);
|
|
45
|
+
const _useSchemaTemplateMan = (0, _client().useSchemaTemplateManager)(),
|
|
46
|
+
getTemplateSchemaByMode = _useSchemaTemplateMan.getTemplateSchemaByMode;
|
|
47
|
+
const items = (0, _client().useRecordCollectionDataSourceItems)('FormItem');
|
|
48
|
+
function onConfirm(_x) {
|
|
49
|
+
return _onConfirm.apply(this, arguments);
|
|
50
|
+
}
|
|
51
|
+
function _onConfirm() {
|
|
52
|
+
_onConfirm = _asyncToGenerator(function* ({
|
|
53
|
+
item
|
|
54
|
+
}) {
|
|
55
|
+
const template = item.template ? yield getTemplateSchemaByMode(item) : null;
|
|
56
|
+
const result = (0, _client().createFormBlockSchema)(_objectSpread(_objectSpread({
|
|
57
|
+
actionInitializers: 'AddActionButton',
|
|
58
|
+
actions: {
|
|
59
|
+
resolve: {
|
|
60
|
+
type: 'void',
|
|
61
|
+
title: `{{t("Continue the process", { ns: "${_locale.NAMESPACE}" })}}`,
|
|
62
|
+
'x-decorator': 'ManualActionStatusProvider',
|
|
63
|
+
'x-decorator-props': {
|
|
64
|
+
value: _constants.JOB_STATUS.RESOLVED
|
|
65
|
+
},
|
|
66
|
+
'x-component': 'Action',
|
|
67
|
+
'x-component-props': {
|
|
68
|
+
type: 'primary',
|
|
69
|
+
useAction: '{{ useSubmit }}'
|
|
70
|
+
},
|
|
71
|
+
'x-designer': 'Action.Designer',
|
|
72
|
+
'x-designer-props': {
|
|
73
|
+
type: 'record'
|
|
74
|
+
},
|
|
75
|
+
'x-action': `${_constants.JOB_STATUS.RESOLVED}`
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}, schema), {}, {
|
|
79
|
+
template
|
|
80
|
+
}));
|
|
81
|
+
delete result['x-acl-action-props'];
|
|
82
|
+
delete result['x-acl-action'];
|
|
83
|
+
const _Object$keys = Object.keys(result.properties),
|
|
84
|
+
_Object$keys2 = _slicedToArray(_Object$keys, 1),
|
|
85
|
+
formKey = _Object$keys2[0];
|
|
86
|
+
result.properties[formKey].properties.actions['x-decorator'] = 'ActionBarProvider';
|
|
87
|
+
(0, _utils.traverseSchema)(result, node => {
|
|
88
|
+
if (node['x-uid']) {
|
|
89
|
+
delete node['x-uid'];
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
insert(result);
|
|
93
|
+
});
|
|
94
|
+
return _onConfirm.apply(this, arguments);
|
|
95
|
+
}
|
|
96
|
+
return _react().default.createElement(_client().SchemaInitializer.Item, _objectSpread(_objectSpread({}, others), {}, {
|
|
97
|
+
onClick: onConfirm,
|
|
98
|
+
items: items
|
|
99
|
+
}));
|
|
100
|
+
}
|
|
101
|
+
function FormBlockInitializer(props) {
|
|
102
|
+
var _props$schema;
|
|
103
|
+
return _react().default.createElement(_client().CollectionProvider, {
|
|
104
|
+
collection: (_props$schema = props.schema) === null || _props$schema === void 0 ? void 0 : _props$schema.collection
|
|
105
|
+
}, _react().default.createElement(InternalFormBlockInitializer, _objectSpread({}, props)));
|
|
106
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FormBlockProvider = FormBlockProvider;
|
|
7
|
+
function _react() {
|
|
8
|
+
const data = _interopRequireWildcard(require("react"));
|
|
9
|
+
_react = function _react() {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _core() {
|
|
15
|
+
const data = require("@formily/core");
|
|
16
|
+
_core = function _core() {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _react2() {
|
|
22
|
+
const data = require("@formily/react");
|
|
23
|
+
_react2 = function _react2() {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
function _client() {
|
|
29
|
+
const data = require("@nocobase/client");
|
|
30
|
+
_client = function _client() {
|
|
31
|
+
return data;
|
|
32
|
+
};
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
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); }
|
|
36
|
+
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; }
|
|
37
|
+
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; }
|
|
38
|
+
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; }
|
|
39
|
+
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; }
|
|
40
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
41
|
+
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); }
|
|
42
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
43
|
+
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."); }
|
|
44
|
+
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); }
|
|
45
|
+
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; }
|
|
46
|
+
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; } }
|
|
47
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
48
|
+
function FormBlockProvider(props) {
|
|
49
|
+
var _fieldSchema$toJSON$p, _userJob$result, _field$component;
|
|
50
|
+
const userJob = (0, _client().useRecord)();
|
|
51
|
+
const fieldSchema = (0, _react2().useFieldSchema)();
|
|
52
|
+
const field = (0, _react2().useField)();
|
|
53
|
+
const formBlockRef = (0, _react().useRef)(null);
|
|
54
|
+
const _useAssociationNames = (0, _client().useAssociationNames)(),
|
|
55
|
+
appends = _useAssociationNames.appends,
|
|
56
|
+
updateAssociationValues = _useAssociationNames.updateAssociationValues;
|
|
57
|
+
const _Object$keys = Object.keys((_fieldSchema$toJSON$p = fieldSchema.toJSON().properties) !== null && _fieldSchema$toJSON$p !== void 0 ? _fieldSchema$toJSON$p : {}),
|
|
58
|
+
_Object$keys2 = _slicedToArray(_Object$keys, 1),
|
|
59
|
+
formKey = _Object$keys2[0];
|
|
60
|
+
const values = userJob === null || userJob === void 0 ? void 0 : (_userJob$result = userJob.result) === null || _userJob$result === void 0 ? void 0 : _userJob$result[formKey];
|
|
61
|
+
const _useDesignable = (0, _client().useDesignable)(),
|
|
62
|
+
findComponent = _useDesignable.findComponent;
|
|
63
|
+
const Component = findComponent((_field$component = field.component) === null || _field$component === void 0 ? void 0 : _field$component[0]) || _react().default.Fragment;
|
|
64
|
+
const form = (0, _react().useMemo)(() => (0, _core().createForm)({
|
|
65
|
+
initialValues: values
|
|
66
|
+
}), [values]);
|
|
67
|
+
const params = _objectSpread({
|
|
68
|
+
appends
|
|
69
|
+
}, props.params);
|
|
70
|
+
const service = {
|
|
71
|
+
loading: false,
|
|
72
|
+
data: {
|
|
73
|
+
data: values
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const api = (0, _client().useAPIClient)();
|
|
77
|
+
const resource = api.resource(props.collection);
|
|
78
|
+
const __parent = (0, _react().useContext)(_client().BlockRequestContext);
|
|
79
|
+
return _react().default.createElement(_client().CollectionProvider, {
|
|
80
|
+
collection: props.collection
|
|
81
|
+
}, _react().default.createElement(_client().RecordProvider, {
|
|
82
|
+
record: values,
|
|
83
|
+
parent: false
|
|
84
|
+
}, _react().default.createElement(_client().BlockRequestContext.Provider, {
|
|
85
|
+
value: {
|
|
86
|
+
block: 'form',
|
|
87
|
+
props,
|
|
88
|
+
field,
|
|
89
|
+
service,
|
|
90
|
+
resource,
|
|
91
|
+
__parent
|
|
92
|
+
}
|
|
93
|
+
}, _react().default.createElement(_client().FormBlockContext.Provider, {
|
|
94
|
+
value: {
|
|
95
|
+
params,
|
|
96
|
+
form,
|
|
97
|
+
field,
|
|
98
|
+
service,
|
|
99
|
+
updateAssociationValues,
|
|
100
|
+
formBlockRef
|
|
101
|
+
}
|
|
102
|
+
}, _react().default.createElement(Component, _objectSpread({}, field.componentProps), _react().default.createElement(_client().FormV2.Templates, {
|
|
103
|
+
style: {
|
|
104
|
+
marginBottom: 18
|
|
105
|
+
},
|
|
106
|
+
form: form
|
|
107
|
+
}), _react().default.createElement("div", {
|
|
108
|
+
ref: formBlockRef
|
|
109
|
+
}, _react().default.createElement(_react2().RecursionField, {
|
|
110
|
+
schema: fieldSchema,
|
|
111
|
+
onlyRenderProperties: true
|
|
112
|
+
})))))));
|
|
113
|
+
}
|