@hzab/flowlong-designer 1.0.0 → 1.0.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/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # @hzab/flowlong-designer@1.0.2
2
+
3
+ fix:修复条件节点删除
4
+
5
+ # @hzab/flowlong-designer@1.0.1
6
+
7
+ fix:详情优化(节点可点击打开详情)
8
+
1
9
  # @hzab/flowlong-designer@1.0.0
2
10
 
3
11
  fix:审核人默认值为或签
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hzab/flowlong-designer",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "自定义审批流配置组件",
5
5
  "main": "src",
6
6
  "scripts": {
@@ -84,4 +84,8 @@
84
84
  .ant-btn+.ant-btn {
85
85
  margin-left: 12px;
86
86
  }
87
+ }
88
+
89
+ .disable-delete-button {
90
+ cursor: not-allowed;
87
91
  }
@@ -33,9 +33,6 @@ export const Approver = (props) => {
33
33
  const nodeTitleRef = useRef();
34
34
 
35
35
  function onShow() {
36
- if (disable) {
37
- return;
38
- }
39
36
  setDrawer(true);
40
37
  setForm(JSON.parse(JSON.stringify(modelValue)));
41
38
  }
@@ -119,7 +116,7 @@ export const Approver = (props) => {
119
116
  return (
120
117
  <div className="approver-wrap">
121
118
  <div className="node-wrap">
122
- <div className={`${disable ? "node-wrap-box-disable" : "node-wrap-box"}`} onClick={onShow}>
119
+ <div className="node-wrap-box" onClick={onShow}>
123
120
  <div className="title" style={{ background: "#ff943e" }}>
124
121
  <UserOutlined />
125
122
  <span>{modelValue?.nodeName}</span>
@@ -155,7 +152,7 @@ export const Approver = (props) => {
155
152
  ) : (
156
153
  <div className="drawer-title">
157
154
  {form.nodeName || "审批人设置"}
158
- <EditOutlined className="node-wrap-drawer__title-edit" onClick={onEditTitle} />
155
+ {!disable && <EditOutlined className="node-wrap-drawer__title-edit" onClick={onEditTitle} />}
159
156
  </div>
160
157
  )}
161
158
  </div>
@@ -166,7 +163,7 @@ export const Approver = (props) => {
166
163
  getContainer="body"
167
164
  footer={
168
165
  <div className="approver-drawer-footer">
169
- <Button type="primary" onClick={onDrawerSave}>
166
+ <Button type="primary" onClick={onDrawerSave} disabled={disable}>
170
167
  保存
171
168
  </Button>
172
169
  <Button onClick={onDrawerClose}>取消</Button>
@@ -174,6 +171,7 @@ export const Approver = (props) => {
174
171
  }
175
172
  >
176
173
  <Form
174
+ disabled={disable}
177
175
  ref={formRef}
178
176
  name="approverForm"
179
177
  labelCol={{ span: 8 }}
@@ -5,13 +5,15 @@ interface FormMapProps {
5
5
  type: string;
6
6
  onChange?: (v: any) => void;
7
7
  value?: any;
8
+ disabled?: boolean;
8
9
  }
9
10
  const Field = (props: FormMapProps) => {
10
- const { type, onChange, value } = props;
11
+ const { type, onChange, value, disabled } = props;
11
12
  return (
12
13
  <>
13
14
  {["day", "hour"].includes(type) && (
14
15
  <Input
16
+ disabled={disabled}
15
17
  value={value}
16
18
  placeholder="值"
17
19
  type="number"
@@ -21,7 +23,12 @@ const Field = (props: FormMapProps) => {
21
23
  ></Input>
22
24
  )}
23
25
  {["dept", "assignee"].includes(type) && (
24
- <GroupUserSelectorModal type={type} onChange={onChange} value={value}></GroupUserSelectorModal>
26
+ <GroupUserSelectorModal
27
+ type={type}
28
+ onChange={onChange}
29
+ value={value}
30
+ disabled={disabled}
31
+ ></GroupUserSelectorModal>
25
32
  )}
26
33
  </>
27
34
  );
@@ -12,7 +12,7 @@ const titleMap = {
12
12
  assignee: "用户",
13
13
  };
14
14
  const GroupUserSelectorModal = (props) => {
15
- const { type, onChange, value = [] } = props;
15
+ const { type, onChange, value = [], disabled } = props;
16
16
  const [open, setOpen] = useState(false);
17
17
  const groupUserSelectorRef = useRef(null);
18
18
  const deptModel = new DataModel({
@@ -92,13 +92,14 @@ const GroupUserSelectorModal = (props) => {
92
92
  return (
93
93
  <div>
94
94
  <Input
95
+ disabled={disabled}
95
96
  value={value?.deptUserLabel || null}
96
97
  readOnly
97
98
  onClick={() => {
98
99
  setOpen(true);
99
100
  }}
100
101
  placeholder="请点击编辑"
101
- style={{ cursor: "pointer" }}
102
+ style={!disabled ? { cursor: "pointer" } : {}}
102
103
  ></Input>
103
104
  <Modal
104
105
  title={titleMap[type]}
@@ -368,4 +368,10 @@
368
368
  margin-left: 12px;
369
369
  }
370
370
  }
371
+
372
+
373
+ }
374
+
375
+ .disable-delete-button {
376
+ cursor: not-allowed;
371
377
  }
@@ -213,6 +213,9 @@ export const Branch = (props) => {
213
213
  setForm((f) => ({ ...f }));
214
214
  }
215
215
  function deleteConditionList(conditionList, idx) {
216
+ if (disable) {
217
+ return;
218
+ }
216
219
  conditionList.splice(idx, 1);
217
220
  setForm((f) => ({ ...f }));
218
221
  }
@@ -279,7 +282,7 @@ export const Branch = (props) => {
279
282
  添加条件
280
283
  </Button>
281
284
  {nodeConfig?.conditionNodes?.map((item, idx) => {
282
- const conditionDisable = idx == nodeConfig.conditionNodes?.length - 1 || disable;
285
+ const conditionDisable = idx == nodeConfig.conditionNodes?.length - 1;
283
286
 
284
287
  return (
285
288
  <div className="col-box" key={idx}>
@@ -309,7 +312,7 @@ export const Branch = (props) => {
309
312
  <div className="title">
310
313
  <span className="node-title">{item.nodeName}</span>
311
314
  <span className="priority-title">优先级{item.priorityLevel}</span>
312
- {!conditionDisable && (
315
+ {!conditionDisable && !disable && (
313
316
  <DeleteOutlined
314
317
  className="delete-btn"
315
318
  onClick={(e) => {
@@ -400,14 +403,14 @@ export const Branch = (props) => {
400
403
  ) : (
401
404
  <div className="drawer-title">
402
405
  {form.nodeName || "条件设置"}
403
- <EditOutlined className="node-wrap-drawer__title-edit" onClick={onEditTitle} />
406
+ {!disable && <EditOutlined className="node-wrap-drawer__title-edit" onClick={onEditTitle} />}
404
407
  </div>
405
408
  )}
406
409
  </div>
407
410
  }
408
411
  footer={
409
412
  <>
410
- <Button type="primary" onClick={onDrawerSave}>
413
+ <Button type="primary" onClick={onDrawerSave} disabled={disable}>
411
414
  保存
412
415
  </Button>
413
416
  <Button onClick={onDrawerClose}>取消</Button>
@@ -424,10 +427,13 @@ export const Branch = (props) => {
424
427
  <span>条件组 {conditionGroupIdx + 1}</span>
425
428
  <div
426
429
  onClick={() => {
430
+ if (disable) {
431
+ return;
432
+ }
427
433
  deleteConditionGroup(conditionGroupIdx);
428
434
  }}
429
435
  >
430
- <DeleteOutlined className="branch-delete-icon" />
436
+ <DeleteOutlined className={`branch-delete-icon ${disable ? "disable-delete-button" : ""}`} />
431
437
  </div>
432
438
  </div>
433
439
 
@@ -446,12 +452,15 @@ export const Branch = (props) => {
446
452
  <div className="condition-relation">
447
453
  <span>{idx == 0 ? "当" : "且"}</span>
448
454
  <div onClick={() => deleteConditionList(conditionGroup, idx)}>
449
- <DeleteOutlined className="branch-delete-icon" />
455
+ <DeleteOutlined
456
+ className={`branch-delete-icon ${disable ? "disable-delete-button" : ""}`}
457
+ />
450
458
  </div>
451
459
  </div>
452
460
  <div className="condition-content">
453
461
  <div className="condition-content-box">
454
462
  <Select
463
+ disabled={disable}
455
464
  value={condition.label}
456
465
  options={descOption}
457
466
  className="condition-content-box-item"
@@ -470,6 +479,7 @@ export const Branch = (props) => {
470
479
  }}
471
480
  ></Select>
472
481
  <Select
482
+ disabled={disable}
473
483
  options={conditionOption}
474
484
  value={condition.field}
475
485
  onChange={(e) => {
@@ -485,6 +495,7 @@ export const Branch = (props) => {
485
495
  placeholder="条件字段"
486
496
  />
487
497
  <Select
498
+ disabled={disable}
488
499
  value={condition.operator}
489
500
  onChange={(val) => {
490
501
  condition.operator = val;
@@ -496,6 +507,7 @@ export const Branch = (props) => {
496
507
  className="condition-content-box-item"
497
508
  ></Select>
498
509
  <Field
510
+ disabled={disable}
499
511
  value={fieldValue}
500
512
  type={condition.field}
501
513
  onChange={(e) => {
@@ -517,7 +529,7 @@ export const Branch = (props) => {
517
529
  })}
518
530
  </div>
519
531
  <div className="sub-content">
520
- <Button type="primary" onClick={() => onConditionAdd(conditionGroup)}>
532
+ <Button type="primary" onClick={() => onConditionAdd(conditionGroup)} disabled={disable}>
521
533
  添加条件
522
534
  </Button>
523
535
  </div>
@@ -525,7 +537,9 @@ export const Branch = (props) => {
525
537
  </div>
526
538
  );
527
539
  })}
528
- <Button onClick={onConditionGroupAdd}>添加条件组</Button>
540
+ <Button onClick={onConditionGroupAdd} disabled={disable}>
541
+ 添加条件组
542
+ </Button>
529
543
  </Drawer>
530
544
  </div>
531
545
  );
@@ -33,9 +33,6 @@ export const Approver = (props) => {
33
33
  const nodeTitleRef = useRef();
34
34
 
35
35
  function onShow() {
36
- if (disable) {
37
- return;
38
- }
39
36
  setDrawer(true);
40
37
  setForm(JSON.parse(JSON.stringify(modelValue)));
41
38
  }
@@ -121,7 +118,7 @@ export const Approver = (props) => {
121
118
  return (
122
119
  <div className="approver-wrap">
123
120
  <div className="node-wrap">
124
- <div className={`${disable ? "node-wrap-box-disable" : "node-wrap-box"}`} onClick={onShow}>
121
+ <div className={"node-wrap-box"} onClick={onShow}>
125
122
  <div className="title send-title">
126
123
  <UserOutlined />
127
124
  <span>{modelValue?.nodeName}</span>
@@ -157,7 +154,7 @@ export const Approver = (props) => {
157
154
  ) : (
158
155
  <div className="drawer-title">
159
156
  {form.nodeName || "审批人设置"}
160
- <EditOutlined className="node-wrap-drawer__title-edit" onClick={onEditTitle} />
157
+ {!disable && <EditOutlined className="node-wrap-drawer__title-edit" onClick={onEditTitle} />}
161
158
  </div>
162
159
  )}
163
160
  </div>
@@ -168,7 +165,7 @@ export const Approver = (props) => {
168
165
  getContainer="body"
169
166
  footer={
170
167
  <div className="approver-drawer-footer">
171
- <Button type="primary" onClick={onDrawerSave}>
168
+ <Button type="primary" onClick={onDrawerSave} disabled={disable}>
172
169
  保存
173
170
  </Button>
174
171
  <Button onClick={onDrawerClose}>取消</Button>
@@ -182,6 +179,7 @@ export const Approver = (props) => {
182
179
  wrapperCol={{ span: 16 }}
183
180
  initialValues={form}
184
181
  autoComplete="off"
182
+ disabled={disable}
185
183
  >
186
184
  <Form.Item label="审批人员类型" name="setType">
187
185
  <Select