@hzab/flowlong-designer 0.1.6 → 0.1.8

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 CHANGED
@@ -1,3 +1,13 @@
1
+ # @hzab/flowlong-designer@0.1.8
2
+
3
+ fix:重置将子节点置为 null
4
+ fix:发起人节点正常删除
5
+
6
+ # @hzab/flowlong-designer@0.1.7
7
+
8
+ fix:请假天数文案改为时长
9
+ fix:条件节点-其他条件进入此流程不可编辑
10
+
1
11
  # @hzab/flowlong-designer@0.1.6
2
12
 
3
13
  fix:条件节点-描述字段改下拉框
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hzab/flowlong-designer",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "自定义审批流配置组件",
5
5
  "main": "src",
6
6
  "scripts": {
@@ -80,7 +80,8 @@
80
80
  background-color: rgb(202, 202, 202);
81
81
  }
82
82
 
83
- .auto-judge {
83
+ .auto-judge,
84
+ .auto-judge-disable {
84
85
  position: relative;
85
86
  width: 220px;
86
87
  min-height: 72px;
@@ -91,7 +92,8 @@
91
92
  box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.1);
92
93
  }
93
94
 
94
- .auto-judge::before {
95
+ .auto-judge::before,
96
+ .auto-judge-disable::before {
95
97
  content: "";
96
98
  position: absolute;
97
99
  top: -12px;
@@ -101,18 +103,21 @@
101
103
  border-style: solid;
102
104
  border-width: 8px 6px 4px;
103
105
  border-color: rgb(202, 202, 202) transparent transparent;
104
- background: rgb(239, 239, 239);
106
+ background: #fff;
105
107
  }
106
108
 
107
- .auto-judge .title {
109
+ .auto-judge .title,
110
+ .auto-judge-disable .title {
108
111
  line-height: 16px;
109
112
  }
110
113
 
111
- .auto-judge .title .node-title {
114
+ .auto-judge .title .node-title,
115
+ .auto-judge-disable .title .node-title {
112
116
  color: #15bc83;
113
117
  }
114
118
 
115
- .auto-judge .title .delete-btn {
119
+ .auto-judge .title .delete-btn,
120
+ .auto-judge-disable .title .delete-btn {
116
121
  font-size: 15px;
117
122
  position: absolute;
118
123
  top: 15px;
@@ -121,19 +126,22 @@
121
126
  display: none;
122
127
  }
123
128
 
124
- .auto-judge .title .priority-title {
129
+ .auto-judge .title .priority-title,
130
+ .auto-judge-disable .title .priority-title {
125
131
  position: absolute;
126
132
  top: 15px;
127
133
  right: 15px;
128
134
  color: #999;
129
135
  }
130
136
 
131
- .auto-judge .content {
137
+ .auto-judge .content,
138
+ .auto-judge-disable .content {
132
139
  position: relative;
133
140
  padding-top: 15px;
134
141
  }
135
142
 
136
- .auto-judge .content .placeholder {
143
+ .auto-judge .content .placeholder,
144
+ .auto-judge-disable .content .placeholder {
137
145
  color: #999;
138
146
  }
139
147
 
@@ -157,7 +165,8 @@
157
165
  }
158
166
  }
159
167
 
160
- .auto-judge .sort-left {
168
+ .auto-judge .sort-left,
169
+ .auto-judge-disable .sort-left {
161
170
  position: absolute;
162
171
  top: 0;
163
172
  bottom: 0;
@@ -169,7 +178,8 @@
169
178
  flex-direction: column;
170
179
  }
171
180
 
172
- .auto-judge .sort-right {
181
+ .auto-judge .sort-right,
182
+ .auto-judge-disable .sort-right {
173
183
  position: absolute;
174
184
  top: 0;
175
185
  bottom: 0;
@@ -186,7 +196,8 @@
186
196
  background: #eee;
187
197
  }
188
198
 
189
- .auto-judge:after {
199
+ .auto-judge:after,
200
+ .auto-judge-disable:after {
190
201
  pointer-events: none;
191
202
  content: "";
192
203
  position: absolute;
@@ -204,6 +215,10 @@
204
215
  box-shadow: 0 0 6px 0 rgba(50, 150, 250, 0.3);
205
216
  }
206
217
 
218
+ .auto-judge-disable {
219
+ cursor: not-allowed;
220
+ }
221
+
207
222
  .top-left-cover-line,
208
223
  .top-right-cover-line {
209
224
  position: absolute;
@@ -30,8 +30,8 @@ export const operatorOptions = [
30
30
  /**描述下拉字段 */
31
31
  const descOption = [
32
32
  {
33
- label: "请假天数",
34
- value: "请假天数",
33
+ label: "时长",
34
+ value: "时长",
35
35
  },
36
36
  {
37
37
  label: "发起人",
@@ -63,19 +63,33 @@ export const Branch = (props) => {
63
63
  const curIdxRef = useRef(-1);
64
64
 
65
65
  const nodeTitleRef = useRef();
66
-
66
+ /** 数组位置互换*/
67
+ function swapLastTwo(arr) {
68
+ if (arr.length >= 2) {
69
+ const temp = arr[arr.length - 1];
70
+ arr[arr.length - 1] = arr[arr.length - 2];
71
+ arr[arr.length - 2] = temp;
72
+ }
73
+ return arr;
74
+ }
67
75
  function onTermAdd() {
68
76
  if (!nodeConfig.conditionNodes) {
69
77
  nodeConfig.conditionNodes = [];
70
78
  }
71
79
  let len = nodeConfig.conditionNodes?.length + 1;
72
80
  nodeConfig.conditionNodes?.push({
73
- nodeName: "条件" + len,
81
+ // nodeName: "条件" + len,
74
82
  type: 3,
75
83
  priorityLevel: len,
76
84
  conditionMode: 1,
77
85
  conditionList: [],
78
86
  });
87
+ nodeConfig.conditionNodes = swapLastTwo(nodeConfig.conditionNodes);
88
+
89
+ nodeConfig.conditionNodes.forEach((el, index) => {
90
+ el.priorityLevel = index;
91
+ el.nodeName = el.nodeName ? el.nodeName : "条件" + (index + 1);
92
+ });
79
93
  onChange && onChange({ ...nodeConfig });
80
94
  }
81
95
  function onShow(idx) {
@@ -121,6 +135,7 @@ export const Branch = (props) => {
121
135
  onChange({ ...nodeConfig });
122
136
  }
123
137
  }
138
+
124
139
  function toText(nodeConfig, idx) {
125
140
  var { conditionList } = nodeConfig.conditionNodes[idx];
126
141
  if (conditionList && conditionList.length == 1) {
@@ -266,22 +281,28 @@ export const Branch = (props) => {
266
281
  添加条件
267
282
  </Button>
268
283
  {nodeConfig?.conditionNodes?.map((item, idx) => {
284
+ const conditionDisable = idx == nodeConfig.conditionNodes?.length - 1;
285
+
269
286
  return (
270
287
  <div className="col-box" key={idx}>
271
288
  <div className="condition-node">
272
289
  <div className="condition-node-box">
273
290
  <div
274
- className="auto-judge"
291
+ className={conditionDisable ? "auto-judge-disable" : "auto-judge"}
275
292
  onClick={() => {
276
- onShow(idx);
293
+ if (!conditionDisable) {
294
+ onShow(idx);
295
+ }
277
296
  }}
278
297
  >
279
- {idx != 0 ? (
298
+ {idx != 0 && !conditionDisable ? (
280
299
  <div
281
300
  className="sort-left"
282
301
  onClick={(e) => {
283
- e.stopPropagation();
284
- arrTransfer(idx, -1);
302
+ if (!conditionDisable) {
303
+ e.stopPropagation();
304
+ arrTransfer(idx, -1);
305
+ }
285
306
  }}
286
307
  >
287
308
  <LeftOutlined />
@@ -290,14 +311,15 @@ export const Branch = (props) => {
290
311
  <div className="title">
291
312
  <span className="node-title">{item.nodeName}</span>
292
313
  <span className="priority-title">优先级{item.priorityLevel}</span>
293
-
294
- <DeleteOutlined
295
- className="delete-btn"
296
- onClick={(e) => {
297
- e.stopPropagation();
298
- onTermDel(idx);
299
- }}
300
- />
314
+ {!conditionDisable && (
315
+ <DeleteOutlined
316
+ className="delete-btn"
317
+ onClick={(e) => {
318
+ e.stopPropagation();
319
+ onTermDel(idx);
320
+ }}
321
+ />
322
+ )}
301
323
  </div>
302
324
  <div className="content">
303
325
  {toText(nodeConfig, idx) ? (
@@ -306,7 +328,7 @@ export const Branch = (props) => {
306
328
  <span className="placeholder">请设置条件</span>
307
329
  )}
308
330
  </div>
309
- {idx != nodeConfig.conditionNodes?.length - 1 ? (
331
+ {idx != nodeConfig.conditionNodes?.length - 1 && idx < nodeConfig.conditionNodes?.length - 2 ? (
310
332
  <div
311
333
  className="sort-right"
312
334
  onClick={(e) => {
@@ -434,7 +456,7 @@ export const Branch = (props) => {
434
456
  className="condition-content-box-item"
435
457
  onChange={(e) => {
436
458
  condition.label = e;
437
- if (e === "请假天数") {
459
+ if (e === "时长") {
438
460
  condition.field = "day";
439
461
  }
440
462
  if (e === "发起人") {
@@ -137,13 +137,18 @@ export const Promoter = (props) => {
137
137
  <Button
138
138
  type="primary"
139
139
  onClick={() =>
140
- selectorCtx.setSelectHandler(2, form.nodeAssigneeList, (selected) => {
141
- setForm((f) => {
142
- // 设置 人员、角色 列表数组
143
- f.nodeAssigneeList = selected;
144
- return { ...f };
145
- });
146
- }, 1)
140
+ selectorCtx.setSelectHandler(
141
+ 2,
142
+ form.nodeAssigneeList,
143
+ (selected) => {
144
+ setForm((f) => {
145
+ // 设置 人员、角色 列表数组
146
+ f.nodeAssigneeList = selected;
147
+ return { ...f };
148
+ });
149
+ },
150
+ 1,
151
+ )
147
152
  }
148
153
  >
149
154
  选择人员
@@ -155,7 +160,8 @@ export const Promoter = (props) => {
155
160
  key={idx}
156
161
  className="node-assignee-item"
157
162
  closable
158
- onClose={() => {
163
+ onClose={(e) => {
164
+ e.preventDefault();
159
165
  onRoleDel(idx);
160
166
  }}
161
167
  >
package/src/index.tsx CHANGED
@@ -82,7 +82,7 @@ function FlowlongDesigner(props, ref) {
82
82
  /** 重置 */
83
83
  const onReset = () => {
84
84
  const newData = { ...data };
85
- newData.nodeConfig.childNode = {};
85
+ newData.nodeConfig.childNode = null;
86
86
  setData(newData);
87
87
  };
88
88