|
1 | 1 | import XFlow from '@xrenders/xflow'; |
2 | 2 | import settings from './setting'; |
| 3 | +import React from 'react'; |
3 | 4 |
|
4 | 5 | export default () => { |
5 | 6 | const nodes = [ |
6 | 7 | { |
| 8 | + id: 'hwqfyj734kgwljvt', |
7 | 9 | type: 'Start', |
8 | | - id: '1', |
9 | | - position: { x: -130, y: 290 }, |
| 10 | + position: { |
| 11 | + x: -159.0597703862493, |
| 12 | + y: 323.4293111587479, |
| 13 | + }, |
10 | 14 | }, |
11 | 15 | { |
| 16 | + id: 'kshd2hp4vqm8ww19', |
12 | 17 | type: 'Switch', |
13 | | - id: '2', |
14 | | - position: { x: 171.25, y: 218.75 }, |
15 | | - data: { list: [{ value: '条件1' }] }, |
| 18 | + position: { |
| 19 | + x: 180.79626287562883, |
| 20 | + y: 209.9170981759363, |
| 21 | + }, |
| 22 | + data: { |
| 23 | + list: [ |
| 24 | + { |
| 25 | + _conditionId: 'condition_1nmzbhnbtv1se6sd', // 对应的 sourceHandle: 'condition_1nmzbhnbtv1se6sd'的边 |
| 26 | + value: '条件1', |
| 27 | + }, |
| 28 | + { |
| 29 | + value: '条件2', |
| 30 | + _conditionId: 'condition_enxhwfca1ebn55td', // 对应sourceHandle: 'condition_enxhwfca1ebn55td'的边 |
| 31 | + }, |
| 32 | + { |
| 33 | + value: '条件3', |
| 34 | + _conditionId: 'condition_z1f7b93zwbx1xycu',// 对应sourceHandle: 'condition_z1f7b93zwbx1xycu'的边 |
| 35 | + }, |
| 36 | + ], |
| 37 | + desc: '', |
| 38 | + }, |
16 | 39 | }, |
17 | 40 | { |
18 | | - type: 'End', |
19 | | - id: '3', |
20 | | - position: { x: 915, y: 287.5 }, |
| 41 | + id: 'ql61j2tdli4xage0', |
| 42 | + type: 'Prompt', |
| 43 | + position: { |
| 44 | + x: 578.75, |
| 45 | + y: 176.25, |
| 46 | + }, |
| 47 | + }, |
| 48 | + { |
| 49 | + id: 'fab1j735q8iow6u3', |
| 50 | + type: 'knowledge', |
| 51 | + position: { |
| 52 | + x: 577.5, |
| 53 | + y: 318.75, |
| 54 | + }, |
21 | 55 | }, |
22 | 56 | { |
23 | | - id: 'g29rz9ol4ugqz8m8', |
| 57 | + id: '9mc5i628mfrxdow0', |
24 | 58 | type: 'Prompt', |
25 | | - position: { x: 525, y: 210 }, |
| 59 | + position: { |
| 60 | + x: 603.75, |
| 61 | + y: 422.5, |
| 62 | + }, |
26 | 63 | }, |
27 | 64 | { |
28 | | - id: 'swqutt73ihfa9lkb', |
| 65 | + id: 'xgkajbbgs8cls8r1', |
29 | 66 | type: 'knowledge', |
30 | | - position: { x: 522.5, y: 472.5 }, |
| 67 | + position: { |
| 68 | + x: 932.5, |
| 69 | + y: 556.25, |
| 70 | + }, |
| 71 | + }, |
| 72 | + { |
| 73 | + id: 'anmv2kcadqxj4k63', |
| 74 | + type: 'Prompt', |
| 75 | + position: { |
| 76 | + x: 540, |
| 77 | + y: 555, |
| 78 | + }, |
| 79 | + }, |
| 80 | + { |
| 81 | + id: '1obmsf5g1xfsypdj', |
| 82 | + type: 'End', |
| 83 | + position: { |
| 84 | + x: 1359.5373712437117, |
| 85 | + y: 359.3804592275014, |
| 86 | + }, |
31 | 87 | }, |
32 | 88 | ]; |
33 | 89 |
|
34 | 90 | const edges = [ |
35 | 91 | { |
36 | | - source: '1', |
37 | | - target: '2', |
38 | | - id: 'xy-edge__1-2', |
| 92 | + id: '0lnn4hks9wnz0lnq', |
| 93 | + source: 'hwqfyj734kgwljvt', |
| 94 | + target: 'kshd2hp4vqm8ww19', |
39 | 95 | }, |
40 | 96 | { |
41 | | - source: '2', |
42 | | - sourceHandle: 'id_0', |
43 | | - target: 'g29rz9ol4ugqz8m8', |
44 | | - id: 'xy-edge__2id_0-g29rz9ol4ugqz8m8', |
| 97 | + id: '5s6af77jbcqvzfod', |
| 98 | + source: 'kshd2hp4vqm8ww19',// switch节点的边 |
| 99 | + target: 'ql61j2tdli4xage0', |
| 100 | + sourceHandle: 'condition_1nmzbhnbtv1se6sd', // 对应 _conditionId为'condition_1nmzbhnbtv1se6sd'的条件 |
45 | 101 | }, |
46 | | - { id: 'w6vmrun9sos4t6ds', target: 'swqutt73ihfa9lkb' }, |
47 | 102 | { |
48 | | - source: '2', |
49 | | - sourceHandle: 'id_else', |
50 | | - target: 'swqutt73ihfa9lkb', |
51 | | - id: 'xy-edge__2id_else-swqutt73ihfa9lkb', |
| 103 | + id: '6tw709qgc3mtazrv', |
| 104 | + source: 'kshd2hp4vqm8ww19',// switch节点的边 |
| 105 | + target: 'fab1j735q8iow6u3', |
| 106 | + sourceHandle: 'condition_enxhwfca1ebn55td', // 对应 _conditionId为'condition_enxhwfca1ebn55td'的条件 |
52 | 107 | }, |
53 | 108 | { |
54 | | - source: 'g29rz9ol4ugqz8m8', |
55 | | - target: '3', |
56 | | - id: 'xy-edge__g29rz9ol4ugqz8m8-3', |
| 109 | + id: 'vzlvdo69ljcqegc8', |
| 110 | + source: 'kshd2hp4vqm8ww19',// switch节点的边 |
| 111 | + target: '9mc5i628mfrxdow0', |
| 112 | + sourceHandle: 'condition_z1f7b93zwbx1xycu',// 对应 _conditionId为'condition_z1f7b93zwbx1xycu'的条件 |
57 | 113 | }, |
58 | 114 | { |
59 | | - source: 'swqutt73ihfa9lkb', |
60 | | - target: '3', |
61 | | - id: 'xy-edge__swqutt73ihfa9lkb-3', |
| 115 | + id: 'j8p8fnr5au9k25pb', |
| 116 | + source: 'kshd2hp4vqm8ww19',// switch节点的边 |
| 117 | + target: 'anmv2kcadqxj4k63', |
| 118 | + sourceHandle: 'condition_else',// condition_else 对应默认路径ELSE |
| 119 | + }, |
| 120 | + { |
| 121 | + id: '0qfpkc9vcjdb31qp', |
| 122 | + source: 'anmv2kcadqxj4k63', |
| 123 | + target: 'xgkajbbgs8cls8r1', |
| 124 | + }, |
| 125 | + { |
| 126 | + id: '5h05o312rfbj4559', |
| 127 | + source: 'ql61j2tdli4xage0', |
| 128 | + target: '1obmsf5g1xfsypdj', |
| 129 | + }, |
| 130 | + { |
| 131 | + source: 'fab1j735q8iow6u3', |
| 132 | + target: '1obmsf5g1xfsypdj', |
| 133 | + id: 'xy-edge__fab1j735q8iow6u3-1obmsf5g1xfsypdj', |
| 134 | + }, |
| 135 | + { |
| 136 | + source: '9mc5i628mfrxdow0', |
| 137 | + target: '1obmsf5g1xfsypdj', |
| 138 | + id: 'xy-edge__9mc5i628mfrxdow0-1obmsf5g1xfsypdj', |
| 139 | + }, |
| 140 | + { |
| 141 | + source: 'xgkajbbgs8cls8r1', |
| 142 | + target: '1obmsf5g1xfsypdj', |
| 143 | + id: 'xy-edge__xgkajbbgs8cls8r1-1obmsf5g1xfsypdj', |
62 | 144 | }, |
63 | 145 | ]; |
64 | | - |
65 | 146 | return ( |
66 | 147 | <div style={{ height: '600px' }}> |
67 | 148 | <XFlow |
|
0 commit comments