@coding-flow/flow-design 0.1.4 → 0.1.5
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/dist/components/design-editor/node-components/strategy/operator-load.js +39 -17
- package/dist/script-components/components/action/components/add-audit.js +22 -10
- package/dist/script-components/components/action/components/delegate.js +22 -10
- package/dist/script-components/components/action/components/max-operator-count.d.ts +15 -0
- package/dist/script-components/components/action/components/max-operator-count.js +16 -0
- package/dist/script-components/components/action/components/transfer.js +22 -10
- package/dist/script-components/components/sub-process/index.js +12 -1
- package/dist/script-components/components/sub-process/presenters/sub-process-presenter.d.ts +4 -0
- package/dist/script-components/components/sub-process/presenters/sub-process-presenter.js +5 -1
- package/dist/script-components/components/sub-process/typings/index.d.ts +4 -0
- package/package.json +7 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import react from "react";
|
|
3
3
|
import { Button, Form, Select, Space } from "antd";
|
|
4
4
|
import { Field } from "@flowgram.ai/fixed-layout-editor";
|
|
@@ -6,6 +6,7 @@ import { EditOutlined } from "@ant-design/icons";
|
|
|
6
6
|
import { GroovyScriptPreview } from "../../../../script-components/components/groovy-script-preview.js";
|
|
7
7
|
import { OperatorLoadConfigModal } from "../../../../script-components/modal/operator-load-config-modal.js";
|
|
8
8
|
import { GroovyScriptLoader } from "../../../../script-components/components/groovy-script-loader.js";
|
|
9
|
+
import { MaxOperatorCountInput } from "../../../../script-components/components/action/components/max-operator-count.js";
|
|
9
10
|
import { FieldTip } from "../../../field-tip/index.js";
|
|
10
11
|
const SELECT_TYPE_OPTIONS = [
|
|
11
12
|
{
|
|
@@ -102,23 +103,44 @@ const OperatorLoadStrategy = ()=>{
|
|
|
102
103
|
name: "OperatorLoadStrategy.selectType",
|
|
103
104
|
render: ({ field: { value: selectType } })=>{
|
|
104
105
|
const isRangeMode = 'INITIATOR_SELECT' === selectType || 'APPROVER_SELECT' === selectType;
|
|
105
|
-
return /*#__PURE__*/
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
106
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
107
|
+
children: [
|
|
108
|
+
/*#__PURE__*/ jsx(Form.Item, {
|
|
109
|
+
label: /*#__PURE__*/ jsx(FieldTip, {
|
|
110
|
+
label: isRangeMode ? "设定人员范围" : "当前操作人",
|
|
111
|
+
description: isRangeMode ? "设定可选人员范围,留空表示不限范围(可选任意人)。" : "通过脚本设定该节点的操作人。"
|
|
112
|
+
}),
|
|
113
|
+
name: [
|
|
114
|
+
"OperatorLoadStrategy",
|
|
115
|
+
"script"
|
|
116
|
+
],
|
|
117
|
+
children: /*#__PURE__*/ jsx(Field, {
|
|
118
|
+
name: "OperatorLoadStrategy.script",
|
|
119
|
+
render: ({ field: { value, onChange } })=>/*#__PURE__*/ jsx(GroovyScriptLoader, {
|
|
120
|
+
content: OperatorLoadScriptContent,
|
|
121
|
+
value: value,
|
|
122
|
+
onChange: onChange
|
|
123
|
+
})
|
|
120
124
|
})
|
|
121
|
-
|
|
125
|
+
}),
|
|
126
|
+
isRangeMode && /*#__PURE__*/ jsx(Form.Item, {
|
|
127
|
+
label: /*#__PURE__*/ jsx(FieldTip, {
|
|
128
|
+
label: "最大可选人数",
|
|
129
|
+
description: "限制发起人/审批人可选人数的最大值,-1 表示不限制;固定为 1 时即为单选。"
|
|
130
|
+
}),
|
|
131
|
+
name: [
|
|
132
|
+
"OperatorLoadStrategy",
|
|
133
|
+
"maxOperatorCount"
|
|
134
|
+
],
|
|
135
|
+
children: /*#__PURE__*/ jsx(Field, {
|
|
136
|
+
name: "OperatorLoadStrategy.maxOperatorCount",
|
|
137
|
+
render: ({ field: { value, onChange } })=>/*#__PURE__*/ jsx(MaxOperatorCountInput, {
|
|
138
|
+
value: value,
|
|
139
|
+
onChange: onChange
|
|
140
|
+
})
|
|
141
|
+
})
|
|
142
|
+
})
|
|
143
|
+
]
|
|
122
144
|
});
|
|
123
145
|
}
|
|
124
146
|
})
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import { Col, Form, Row } from "antd";
|
|
4
4
|
import { OperatorLoadPluginView } from "../../../../plugins/view/operator-load-view.js";
|
|
5
|
+
import { MaxOperatorCountInput } from "./max-operator-count.js";
|
|
5
6
|
const AddAuditInput = (props)=>{
|
|
6
7
|
const script = props.value || '';
|
|
7
8
|
const handleChange = (value)=>{
|
|
@@ -12,15 +13,26 @@ const AddAuditInput = (props)=>{
|
|
|
12
13
|
onChange: handleChange
|
|
13
14
|
});
|
|
14
15
|
};
|
|
15
|
-
const AddAuditActionForm = (props)=>/*#__PURE__*/
|
|
16
|
-
children:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
const AddAuditActionForm = (props)=>/*#__PURE__*/ jsxs(Row, {
|
|
17
|
+
children: [
|
|
18
|
+
/*#__PURE__*/ jsx(Col, {
|
|
19
|
+
span: 24,
|
|
20
|
+
children: /*#__PURE__*/ jsx(Form.Item, {
|
|
21
|
+
name: "maxOperatorCount",
|
|
22
|
+
label: "最大可选人数",
|
|
23
|
+
help: "限制加签时可选人数的最大值,-1 表示不限制;固定为 1 时即为单选",
|
|
24
|
+
children: /*#__PURE__*/ jsx(MaxOperatorCountInput, {})
|
|
25
|
+
})
|
|
26
|
+
}),
|
|
27
|
+
/*#__PURE__*/ jsx(Col, {
|
|
28
|
+
span: 24,
|
|
29
|
+
children: /*#__PURE__*/ jsx(Form.Item, {
|
|
30
|
+
name: "script",
|
|
31
|
+
label: "加签人员范围",
|
|
32
|
+
help: "加签人员范围为空时,即为全部人员",
|
|
33
|
+
children: /*#__PURE__*/ jsx(AddAuditInput, {})
|
|
34
|
+
})
|
|
23
35
|
})
|
|
24
|
-
|
|
36
|
+
]
|
|
25
37
|
});
|
|
26
38
|
export { AddAuditActionForm };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import { OperatorLoadPluginView } from "../../../../plugins/view/operator-load-view.js";
|
|
4
|
+
import { MaxOperatorCountInput } from "./max-operator-count.js";
|
|
4
5
|
import { Col, Form, Row } from "antd";
|
|
5
6
|
const DelegateInput = (props)=>{
|
|
6
7
|
const script = props.value || '';
|
|
@@ -12,15 +13,26 @@ const DelegateInput = (props)=>{
|
|
|
12
13
|
onChange: handleChange
|
|
13
14
|
});
|
|
14
15
|
};
|
|
15
|
-
const DelegateActionForm = (props)=>/*#__PURE__*/
|
|
16
|
-
children:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
const DelegateActionForm = (props)=>/*#__PURE__*/ jsxs(Row, {
|
|
17
|
+
children: [
|
|
18
|
+
/*#__PURE__*/ jsx(Col, {
|
|
19
|
+
span: 24,
|
|
20
|
+
children: /*#__PURE__*/ jsx(Form.Item, {
|
|
21
|
+
name: "maxOperatorCount",
|
|
22
|
+
label: "最大可选人数",
|
|
23
|
+
help: "限制委派时可选人数的最大值,-1 表示不限制;固定为 1 时即为单选",
|
|
24
|
+
children: /*#__PURE__*/ jsx(MaxOperatorCountInput, {})
|
|
25
|
+
})
|
|
26
|
+
}),
|
|
27
|
+
/*#__PURE__*/ jsx(Col, {
|
|
28
|
+
span: 24,
|
|
29
|
+
children: /*#__PURE__*/ jsx(Form.Item, {
|
|
30
|
+
name: "script",
|
|
31
|
+
label: "委派人员范围",
|
|
32
|
+
help: "委派人员范围为空时,即为全部人员",
|
|
33
|
+
children: /*#__PURE__*/ jsx(DelegateInput, {})
|
|
34
|
+
})
|
|
23
35
|
})
|
|
24
|
-
|
|
36
|
+
]
|
|
25
37
|
});
|
|
26
38
|
export { DelegateActionForm };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* 最大可选人数的默认值,-1 表示不限制
|
|
4
|
+
*/
|
|
5
|
+
export declare const DEFAULT_MAX_OPERATOR_COUNT = -1;
|
|
6
|
+
interface MaxOperatorCountInputProps {
|
|
7
|
+
value?: number;
|
|
8
|
+
onChange?: (value: number) => void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 最大可选人数输入框
|
|
12
|
+
* 为空时按 -1(不限制)处理
|
|
13
|
+
*/
|
|
14
|
+
export declare const MaxOperatorCountInput: React.FC<MaxOperatorCountInputProps>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { InputNumber } from "antd";
|
|
4
|
+
const DEFAULT_MAX_OPERATOR_COUNT = -1;
|
|
5
|
+
const MaxOperatorCountInput = (props)=>/*#__PURE__*/ jsx(InputNumber, {
|
|
6
|
+
style: {
|
|
7
|
+
width: '100%'
|
|
8
|
+
},
|
|
9
|
+
min: -1,
|
|
10
|
+
placeholder: "-1 表示不限制",
|
|
11
|
+
value: props.value ?? DEFAULT_MAX_OPERATOR_COUNT,
|
|
12
|
+
onChange: (val)=>{
|
|
13
|
+
props.onChange?.(val ?? DEFAULT_MAX_OPERATOR_COUNT);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
export { DEFAULT_MAX_OPERATOR_COUNT, MaxOperatorCountInput };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import { OperatorLoadPluginView } from "../../../../plugins/view/operator-load-view.js";
|
|
4
|
+
import { MaxOperatorCountInput } from "./max-operator-count.js";
|
|
4
5
|
import { Col, Form, Row } from "antd";
|
|
5
6
|
const TransferInput = (props)=>{
|
|
6
7
|
const script = props.value || '';
|
|
@@ -12,15 +13,26 @@ const TransferInput = (props)=>{
|
|
|
12
13
|
onChange: handleChange
|
|
13
14
|
});
|
|
14
15
|
};
|
|
15
|
-
const TransferActionForm = (props)=>/*#__PURE__*/
|
|
16
|
-
children:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
const TransferActionForm = (props)=>/*#__PURE__*/ jsxs(Row, {
|
|
17
|
+
children: [
|
|
18
|
+
/*#__PURE__*/ jsx(Col, {
|
|
19
|
+
span: 24,
|
|
20
|
+
children: /*#__PURE__*/ jsx(Form.Item, {
|
|
21
|
+
name: "maxOperatorCount",
|
|
22
|
+
label: "最大可选人数",
|
|
23
|
+
help: "限制转办时可选人数的最大值,-1 表示不限制;固定为 1 时即为单选",
|
|
24
|
+
children: /*#__PURE__*/ jsx(MaxOperatorCountInput, {})
|
|
25
|
+
})
|
|
26
|
+
}),
|
|
27
|
+
/*#__PURE__*/ jsx(Col, {
|
|
28
|
+
span: 24,
|
|
29
|
+
children: /*#__PURE__*/ jsx(Form.Item, {
|
|
30
|
+
name: "script",
|
|
31
|
+
label: "转办人员范围",
|
|
32
|
+
help: "转办人员范围为空时,即为全部人员",
|
|
33
|
+
children: /*#__PURE__*/ jsx(TransferInput, {})
|
|
34
|
+
})
|
|
23
35
|
})
|
|
24
|
-
|
|
36
|
+
]
|
|
25
37
|
});
|
|
26
38
|
export { TransferActionForm };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import react from "react";
|
|
3
|
-
import { Button, Card, Form, Select, Space } from "antd";
|
|
3
|
+
import { Button, Card, Form, Input, Select, Space } from "antd";
|
|
4
4
|
import { useTargetWorkflowPresenter } from "./hooks/use-target-workflow-presenter.js";
|
|
5
5
|
import { SubProcessOperatorPluginView } from "../../../plugins/view/sub-process-opreator-view.js";
|
|
6
6
|
import { FormDataView } from "../form-data/index.js";
|
|
@@ -94,6 +94,17 @@ const SubProcessConfigItem = ({ form, index, removable, remove })=>{
|
|
|
94
94
|
children: /*#__PURE__*/ jsx(FormDataView, {
|
|
95
95
|
form: state.form
|
|
96
96
|
})
|
|
97
|
+
}),
|
|
98
|
+
/*#__PURE__*/ jsx(Form.Item, {
|
|
99
|
+
name: [
|
|
100
|
+
index,
|
|
101
|
+
"workTitle"
|
|
102
|
+
],
|
|
103
|
+
label: "子流程标题",
|
|
104
|
+
tooltip: "不填写时子流程使用流程定义标题;填写后该实例以自定义标题展示(issue #197)",
|
|
105
|
+
children: /*#__PURE__*/ jsx(Input, {
|
|
106
|
+
placeholder: "不填则使用流程定义标题"
|
|
107
|
+
})
|
|
97
108
|
})
|
|
98
109
|
]
|
|
99
110
|
});
|
|
@@ -19,6 +19,10 @@ export declare class SubProcessPresenter {
|
|
|
19
19
|
updateScript(values: SubProcessFormValues): void;
|
|
20
20
|
private toFormData;
|
|
21
21
|
private toScript;
|
|
22
|
+
/**
|
|
23
|
+
* 转义 Groovy 字符串字面量中的单引号,防止用户输入破坏脚本。
|
|
24
|
+
*/
|
|
25
|
+
private escapeSingleQuotes;
|
|
22
26
|
private isRecord;
|
|
23
27
|
private isSubProcessConfig;
|
|
24
28
|
}
|
|
@@ -48,6 +48,7 @@ class SubProcessPresenter {
|
|
|
48
48
|
const meta = JSON.stringify(values);
|
|
49
49
|
const requests = values.processes.map((config)=>{
|
|
50
50
|
const formData = this.toFormData(config);
|
|
51
|
+
if (config.workTitle) return `request.toCreateRequest('${config.workId}', ${config.operatorId}, '${config.actionId}', '${formData}', '${this.escapeSingleQuotes(config.workTitle)}')`;
|
|
51
52
|
return `request.toCreateRequest('${config.workId}', ${config.operatorId}, '${config.actionId}', '${formData}')`;
|
|
52
53
|
}).join(',\n ');
|
|
53
54
|
return `
|
|
@@ -59,9 +60,12 @@ class SubProcessPresenter {
|
|
|
59
60
|
];
|
|
60
61
|
}`;
|
|
61
62
|
}
|
|
63
|
+
escapeSingleQuotes(value) {
|
|
64
|
+
return value.replace(/'/g, "\\'");
|
|
65
|
+
}
|
|
62
66
|
isRecord(value) {
|
|
63
67
|
return 'object' == typeof value && null !== value;
|
|
64
68
|
}
|
|
65
|
-
isSubProcessConfig = (value)=>this.isRecord(value) && (void 0 === value.workId || 'string' == typeof value.workId) && (void 0 === value.actionId || 'string' == typeof value.actionId) && (void 0 === value.operatorId || 'string' == typeof value.operatorId || 'number' == typeof value.operatorId) && (void 0 === value.formData || 'string' == typeof value.formData);
|
|
69
|
+
isSubProcessConfig = (value)=>this.isRecord(value) && (void 0 === value.workId || 'string' == typeof value.workId) && (void 0 === value.actionId || 'string' == typeof value.actionId) && (void 0 === value.operatorId || 'string' == typeof value.operatorId || 'number' == typeof value.operatorId) && (void 0 === value.formData || 'string' == typeof value.formData) && (void 0 === value.workTitle || 'string' == typeof value.workTitle);
|
|
66
70
|
}
|
|
67
71
|
export { SubProcessPresenter };
|
|
@@ -11,6 +11,10 @@ export interface SubProcessConfig {
|
|
|
11
11
|
actionId?: string;
|
|
12
12
|
operatorId?: string | number;
|
|
13
13
|
formData?: string;
|
|
14
|
+
/**
|
|
15
|
+
* 子流程标题;不填则子流程回落流程定义标题(issue #197)
|
|
16
|
+
*/
|
|
17
|
+
workTitle?: string;
|
|
14
18
|
}
|
|
15
19
|
export interface SubProcessFormValues {
|
|
16
20
|
processes: SubProcessConfig[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coding-flow/flow-design",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "flow-engine design components ",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -54,16 +54,16 @@
|
|
|
54
54
|
"nanoid": "^5.1.6",
|
|
55
55
|
"react-redux": "^9.2.0",
|
|
56
56
|
"styled-components": "^5.3.11",
|
|
57
|
-
"@coding-flow/flow-
|
|
58
|
-
"@coding-flow/flow-pc-ui": "0.1.
|
|
59
|
-
"@coding-flow/flow-
|
|
60
|
-
"@coding-flow/flow-icons": "0.1.
|
|
57
|
+
"@coding-flow/flow-core": "0.1.5",
|
|
58
|
+
"@coding-flow/flow-pc-ui": "0.1.5",
|
|
59
|
+
"@coding-flow/flow-types": "0.1.5",
|
|
60
|
+
"@coding-flow/flow-icons": "0.1.5"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/lodash-es": "^4.17.12",
|
|
64
64
|
"@types/styled-components": "^5.1.36",
|
|
65
|
-
"@coding-flow/flow-
|
|
66
|
-
"@coding-flow/flow-
|
|
65
|
+
"@coding-flow/flow-core": "0.1.5",
|
|
66
|
+
"@coding-flow/flow-types": "0.1.5"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
69
69
|
"build": "rslib build",
|