@hzab/flowlong-designer 0.1.9 → 0.2.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/CHANGELOG.md +10 -0
- package/package.json +1 -1
- package/src/components/NodeWrap/Nodes/AddNode/index.tsx +12 -1
- package/src/components/NodeWrap/Nodes/Approver/index.tsx +1 -5
- package/src/components/NodeWrap/Nodes/Branch/components/Field/index.tsx +1 -1
- package/src/components/NodeWrap/Nodes/Branch/components/GroupUserSelectorModal/index.tsx +7 -7
- package/src/components/NodeWrap/Nodes/Branch/index.tsx +6 -11
- package/src/components/NodeWrap/Nodes/Send/index.tsx +1 -5
- package/src/components/NodeWrap/index.tsx +1 -0
- package/src/components/ScWorkflow/index.tsx +1 -2
- package/src/index.tsx +4 -4
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -79,9 +79,20 @@ export function getNodeKey() {
|
|
|
79
79
|
|
|
80
80
|
export const AddNode = (props) => {
|
|
81
81
|
const { modelValue, onChange, disable } = props;
|
|
82
|
-
|
|
82
|
+
/**重置nodeKey */
|
|
83
|
+
const resetNodeKey = (item) => {
|
|
84
|
+
if (item?.nodeKey) {
|
|
85
|
+
item.nodeKey = getNodeKey();
|
|
86
|
+
if (item?.conditionNodes?.length > 0) {
|
|
87
|
+
item?.conditionNodes?.forEach((el) => {
|
|
88
|
+
resetNodeKey(el);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
};
|
|
83
93
|
function addType(type) {
|
|
84
94
|
const data = _.cloneDeep(typeDataEnum[type]);
|
|
95
|
+
resetNodeKey(data);
|
|
85
96
|
data.childNode = modelValue;
|
|
86
97
|
delete data._Icon;
|
|
87
98
|
onChange && onChange(data);
|
|
@@ -123,11 +123,7 @@ export const Approver = (props) => {
|
|
|
123
123
|
<div className="title" style={{ background: "#ff943e" }}>
|
|
124
124
|
<UserOutlined />
|
|
125
125
|
<span>{modelValue?.nodeName}</span>
|
|
126
|
-
<DeleteOutlined
|
|
127
|
-
className="node-close-btn"
|
|
128
|
-
onClick={onNodeDel}
|
|
129
|
-
style={disable ? { cursor: "not-allowed" } : {}}
|
|
130
|
-
/>
|
|
126
|
+
{!disable && <DeleteOutlined className="node-close-btn" onClick={onNodeDel} />}
|
|
131
127
|
</div>
|
|
132
128
|
<div className="content">
|
|
133
129
|
{toText(modelValue) ? <span>{toText(modelValue)}</span> : <span className="placeholder">请选择</span>}
|
|
@@ -20,7 +20,7 @@ const Field = (props: FormMapProps) => {
|
|
|
20
20
|
}}
|
|
21
21
|
></Input>
|
|
22
22
|
)}
|
|
23
|
-
{["dept", "
|
|
23
|
+
{["dept", "assignee"].includes(type) && (
|
|
24
24
|
<GroupUserSelectorModal type={type} onChange={onChange} value={value}></GroupUserSelectorModal>
|
|
25
25
|
)}
|
|
26
26
|
</>
|
|
@@ -5,11 +5,11 @@ import { useEffect, useMemo, useRef, useState } from "react";
|
|
|
5
5
|
import "./index.less";
|
|
6
6
|
const fieldMap = {
|
|
7
7
|
dept: "deptList",
|
|
8
|
-
|
|
8
|
+
assignee: "userNameVos",
|
|
9
9
|
};
|
|
10
10
|
const titleMap = {
|
|
11
11
|
dept: "部门",
|
|
12
|
-
|
|
12
|
+
assignee: "用户",
|
|
13
13
|
};
|
|
14
14
|
const GroupUserSelectorModal = (props) => {
|
|
15
15
|
const { type, onChange, value = [] } = props;
|
|
@@ -36,7 +36,7 @@ const GroupUserSelectorModal = (props) => {
|
|
|
36
36
|
if (type === "dept") {
|
|
37
37
|
return deptModel;
|
|
38
38
|
}
|
|
39
|
-
if (type === "
|
|
39
|
+
if (type === "assignee") {
|
|
40
40
|
return userModel;
|
|
41
41
|
}
|
|
42
42
|
}, [type]);
|
|
@@ -52,7 +52,7 @@ const GroupUserSelectorModal = (props) => {
|
|
|
52
52
|
deptUserLabel: groupUserSelectorRef.current?.selectedList?.map((item) => item?.label)?.join(","),
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
if (type === "
|
|
55
|
+
if (type === "assignee") {
|
|
56
56
|
onOkValue = {
|
|
57
57
|
value: groupUserSelectorRef.current?.selectedList?.map((item) => item?.userId)?.join(","),
|
|
58
58
|
deptUserLabel: groupUserSelectorRef.current?.selectedList?.map((item) => item?.name)?.join(","),
|
|
@@ -71,14 +71,14 @@ const GroupUserSelectorModal = (props) => {
|
|
|
71
71
|
const groupUserSelectorValue = useMemo(() => {
|
|
72
72
|
const deptUserLabelArr = value?.deptUserLabel?.split(",") || [];
|
|
73
73
|
let valueArr = value?.value?.split(",");
|
|
74
|
-
if (type === "
|
|
74
|
+
if (type === "assignee") {
|
|
75
75
|
valueArr = value?.value?.split(",")?.map((el) => Number(el)) || [];
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
if (!value) {
|
|
79
79
|
return [];
|
|
80
80
|
}
|
|
81
|
-
if (type === "
|
|
81
|
+
if (type === "assignee") {
|
|
82
82
|
return deptUserLabelArr?.map((item, index) => ({
|
|
83
83
|
name: item,
|
|
84
84
|
id: valueArr?.length && valueArr[index],
|
|
@@ -120,7 +120,7 @@ const GroupUserSelectorModal = (props) => {
|
|
|
120
120
|
ref={groupUserSelectorRef}
|
|
121
121
|
model={model}
|
|
122
122
|
searchModel={model}
|
|
123
|
-
{...(type === "
|
|
123
|
+
{...(type === "assignee" ? userListConfig : {})}
|
|
124
124
|
></GroupUserSelector>
|
|
125
125
|
</div>
|
|
126
126
|
</Modal>
|
|
@@ -20,13 +20,7 @@ export const operatorOptions = [
|
|
|
20
20
|
{ label: "包含", value: "include" },
|
|
21
21
|
{ label: "不包含", value: "notinclude" },
|
|
22
22
|
];
|
|
23
|
-
|
|
24
|
-
// const conditionOption = [
|
|
25
|
-
// { label: "天", value: "day" },
|
|
26
|
-
// { label: "小时", value: "hour" },
|
|
27
|
-
// { label: "部门", value: "dept" },
|
|
28
|
-
// { label: "用户id", value: "useId" },
|
|
29
|
-
// ];
|
|
23
|
+
|
|
30
24
|
/**描述下拉字段 */
|
|
31
25
|
const descOption = [
|
|
32
26
|
{
|
|
@@ -41,7 +35,7 @@ const descOption = [
|
|
|
41
35
|
/** 时间类型 */
|
|
42
36
|
const timeType = ["day", "hour"];
|
|
43
37
|
/** 部门或用户 */
|
|
44
|
-
const deptUserType = ["dept", "
|
|
38
|
+
const deptUserType = ["dept", "assignee"];
|
|
45
39
|
export const Branch = (props) => {
|
|
46
40
|
const { modelValue: nodeConfig, onChange, ItemSlot, disable } = props;
|
|
47
41
|
const [form, setForm] = useState({
|
|
@@ -143,7 +137,7 @@ export const Branch = (props) => {
|
|
|
143
137
|
.map((conditionGroup) =>
|
|
144
138
|
conditionGroup.map((item) => {
|
|
145
139
|
const el = operatorOptions?.find((el) => el?.value === item?.operator);
|
|
146
|
-
if (["dept", "
|
|
140
|
+
if (["dept", "assignee"].includes(item?.field)) {
|
|
147
141
|
return `${item.label}${el?.label}${item?.deptUserLabel}`;
|
|
148
142
|
}
|
|
149
143
|
return `${item.label}${el?.label}${item.value}`;
|
|
@@ -253,7 +247,7 @@ export const Branch = (props) => {
|
|
|
253
247
|
if (condition?.field === "dept") {
|
|
254
248
|
operatorOptions = [{ label: "包含", value: "include" }];
|
|
255
249
|
}
|
|
256
|
-
if (condition?.field === "
|
|
250
|
+
if (condition?.field === "assignee") {
|
|
257
251
|
operatorOptions = [
|
|
258
252
|
{ label: "等于", value: "==" },
|
|
259
253
|
{ label: "包含", value: "include" },
|
|
@@ -263,7 +257,7 @@ export const Branch = (props) => {
|
|
|
263
257
|
if (condition?.label === "发起人") {
|
|
264
258
|
conditionOption = [
|
|
265
259
|
{ label: "部门", value: "dept" },
|
|
266
|
-
{ label: "用户id", value: "
|
|
260
|
+
{ label: "用户id", value: "assignee" },
|
|
267
261
|
];
|
|
268
262
|
}
|
|
269
263
|
return {
|
|
@@ -352,6 +346,7 @@ export const Branch = (props) => {
|
|
|
352
346
|
</div>
|
|
353
347
|
{item.childNode && ItemSlot ? (
|
|
354
348
|
<ItemSlot
|
|
349
|
+
{...props}
|
|
355
350
|
modelValue={item}
|
|
356
351
|
onChange={(val) => {
|
|
357
352
|
// 数据保存到指定对象中
|
|
@@ -125,11 +125,7 @@ export const Approver = (props) => {
|
|
|
125
125
|
<div className="title send-title">
|
|
126
126
|
<UserOutlined />
|
|
127
127
|
<span>{modelValue?.nodeName}</span>
|
|
128
|
-
<DeleteOutlined
|
|
129
|
-
className="node-close-btn"
|
|
130
|
-
onClick={onNodeDel}
|
|
131
|
-
style={disable ? { cursor: "not-allowed" } : {}}
|
|
132
|
-
/>
|
|
128
|
+
{!disable && <DeleteOutlined className="node-close-btn" onClick={onNodeDel} />}
|
|
133
129
|
</div>
|
|
134
130
|
<div className="content">
|
|
135
131
|
{toText(modelValue) ? <span>{toText(modelValue)}</span> : <span className="placeholder">请选择</span>}
|
|
@@ -5,6 +5,7 @@ import Branch from "./Nodes/Branch";
|
|
|
5
5
|
|
|
6
6
|
export const NodeWrap = (props) => {
|
|
7
7
|
const { modelValue: nodeConfig, onChange } = props;
|
|
8
|
+
|
|
8
9
|
return (
|
|
9
10
|
<div className="node-wrap">
|
|
10
11
|
{nodeConfig.type == 0 ? <Promoter {...props} modelValue={nodeConfig} onChange={onChange}></Promoter> : null}
|
|
@@ -4,8 +4,7 @@ import NodeWrap from "../NodeWrap";
|
|
|
4
4
|
import Selector from "../Selector";
|
|
5
5
|
|
|
6
6
|
export const ScWorkflow = (props) => {
|
|
7
|
-
const { modelValue: nodeConfig, onChange
|
|
8
|
-
|
|
7
|
+
const { modelValue: nodeConfig, onChange } = props;
|
|
9
8
|
return (
|
|
10
9
|
<div className="sc-workflow-design">
|
|
11
10
|
<div className="box-scale">
|
package/src/index.tsx
CHANGED
|
@@ -7,10 +7,10 @@ import { SelectContext, ISelectHandlerI } from "./components/Selector/SelectCont
|
|
|
7
7
|
import { getInitNodeData } from "./common/flowData";
|
|
8
8
|
|
|
9
9
|
import "./index.less";
|
|
10
|
-
import addImg from "
|
|
11
|
-
import subImg from "
|
|
12
|
-
import reloadImg from "
|
|
13
|
-
import checkJsonImg from "
|
|
10
|
+
import addImg from "./assets/img/add.png";
|
|
11
|
+
import subImg from "./assets/img/sub.png";
|
|
12
|
+
import reloadImg from "./assets/img/reload.png";
|
|
13
|
+
import checkJsonImg from "./assets/img/check-json.png";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* 复制指定字符串
|