@logicflow/extension 2.2.0-alpha.7 → 2.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.
Files changed (125) hide show
  1. package/README.md +16 -0
  2. package/package.json +10 -7
  3. package/.turbo/turbo-build.log +0 -38
  4. package/CHANGELOG.md +0 -1829
  5. package/__test__/bpmn-adapter.test.js +0 -227
  6. package/es/materials/curved-edge/__test__/curved-edge.test.d.ts +0 -1
  7. package/es/materials/curved-edge/__test__/curved-edge.test.js +0 -18
  8. package/jest.config.js +0 -198
  9. package/lib/materials/curved-edge/__test__/curved-edge.test.d.ts +0 -1
  10. package/lib/materials/curved-edge/__test__/curved-edge.test.js +0 -20
  11. package/rollup.config.js +0 -52
  12. package/src/NodeResize/BasicShape/Ellipse.tsx +0 -22
  13. package/src/NodeResize/BasicShape/Polygon.tsx +0 -24
  14. package/src/NodeResize/BasicShape/Rect.tsx +0 -44
  15. package/src/NodeResize/control/Control.tsx +0 -537
  16. package/src/NodeResize/control/ControlGroup.tsx +0 -76
  17. package/src/NodeResize/control/Util.ts +0 -206
  18. package/src/NodeResize/index.ts +0 -26
  19. package/src/NodeResize/node/DiamondResize.tsx +0 -149
  20. package/src/NodeResize/node/EllipseResize.tsx +0 -140
  21. package/src/NodeResize/node/HtmlResize.tsx +0 -125
  22. package/src/NodeResize/node/RectResize.tsx +0 -126
  23. package/src/NodeResize/node/index.ts +0 -4
  24. package/src/bpmn/constant.ts +0 -56
  25. package/src/bpmn/events/EndEvent.ts +0 -73
  26. package/src/bpmn/events/StartEvent.ts +0 -52
  27. package/src/bpmn/events/index.ts +0 -2
  28. package/src/bpmn/flow/SequenceFlow.ts +0 -25
  29. package/src/bpmn/flow/index.ts +0 -1
  30. package/src/bpmn/gateways/ExclusiveGateway.ts +0 -71
  31. package/src/bpmn/gateways/index.ts +0 -1
  32. package/src/bpmn/getBpmnId.ts +0 -31
  33. package/src/bpmn/index.ts +0 -60
  34. package/src/bpmn/tasks/ServiceTask.ts +0 -63
  35. package/src/bpmn/tasks/UserTask.ts +0 -64
  36. package/src/bpmn/tasks/index.ts +0 -2
  37. package/src/bpmn-adapter/bpmnIds.ts +0 -31
  38. package/src/bpmn-adapter/index.ts +0 -835
  39. package/src/bpmn-adapter/json2xml.ts +0 -127
  40. package/src/bpmn-adapter/xml2json.ts +0 -544
  41. package/src/bpmn-elements/README.md +0 -223
  42. package/src/bpmn-elements/__tests__/definition.test.js +0 -72
  43. package/src/bpmn-elements/index.d.ts +0 -26
  44. package/src/bpmn-elements/index.ts +0 -107
  45. package/src/bpmn-elements/presets/Event/EndEventFactory.ts +0 -114
  46. package/src/bpmn-elements/presets/Event/IntermediateCatchEvent.ts +0 -108
  47. package/src/bpmn-elements/presets/Event/IntermediateThrowEvent.ts +0 -109
  48. package/src/bpmn-elements/presets/Event/StartEventFactory.ts +0 -114
  49. package/src/bpmn-elements/presets/Event/boundaryEventFactory.ts +0 -117
  50. package/src/bpmn-elements/presets/Event/index.ts +0 -14
  51. package/src/bpmn-elements/presets/Flow/flow.d.ts +0 -6
  52. package/src/bpmn-elements/presets/Flow/index.ts +0 -8
  53. package/src/bpmn-elements/presets/Flow/manhattan.ts +0 -691
  54. package/src/bpmn-elements/presets/Flow/sequenceFlow.ts +0 -65
  55. package/src/bpmn-elements/presets/Gateway/gateway.ts +0 -107
  56. package/src/bpmn-elements/presets/Gateway/index.ts +0 -23
  57. package/src/bpmn-elements/presets/Pool/Lane.ts +0 -211
  58. package/src/bpmn-elements/presets/Pool/Pool.ts +0 -284
  59. package/src/bpmn-elements/presets/Pool/index.ts +0 -89
  60. package/src/bpmn-elements/presets/Task/index.ts +0 -122
  61. package/src/bpmn-elements/presets/Task/subProcess.ts +0 -189
  62. package/src/bpmn-elements/presets/Task/task.ts +0 -193
  63. package/src/bpmn-elements/presets/icons.ts +0 -155
  64. package/src/bpmn-elements/utils.ts +0 -52
  65. package/src/bpmn-elements-adapter/README.md +0 -293
  66. package/src/bpmn-elements-adapter/__tests__/adapter_in.test.js +0 -528
  67. package/src/bpmn-elements-adapter/__tests__/adapter_out.test.js +0 -569
  68. package/src/bpmn-elements-adapter/constant.ts +0 -76
  69. package/src/bpmn-elements-adapter/index.ts +0 -1134
  70. package/src/bpmn-elements-adapter/json2xml.ts +0 -105
  71. package/src/bpmn-elements-adapter/xml2json.ts +0 -542
  72. package/src/components/context-menu/index.ts +0 -253
  73. package/src/components/control/index.ts +0 -155
  74. package/src/components/dnd-panel/index.ts +0 -137
  75. package/src/components/highlight/index.ts +0 -227
  76. package/src/components/menu/index.ts +0 -748
  77. package/src/components/mini-map/index.ts +0 -686
  78. package/src/components/selection-select/index.ts +0 -387
  79. package/src/dynamic-group/index.ts +0 -774
  80. package/src/dynamic-group/model.ts +0 -580
  81. package/src/dynamic-group/node.ts +0 -288
  82. package/src/dynamic-group/utils.ts +0 -46
  83. package/src/index.less +0 -1
  84. package/src/index.ts +0 -47
  85. package/src/insert-node-in-polyline/edge.ts +0 -175
  86. package/src/insert-node-in-polyline/index.ts +0 -193
  87. package/src/materials/curved-edge/__test__/curved-edge.test.ts +0 -46
  88. package/src/materials/curved-edge/index.ts +0 -217
  89. package/src/materials/group/GroupNode.ts +0 -437
  90. package/src/materials/group/index.ts +0 -542
  91. package/src/materials/node-selection/index.ts +0 -380
  92. package/src/mindmap/fakerRoot.ts +0 -19
  93. package/src/mindmap/index.ts +0 -328
  94. package/src/mindmap/markContent.ts +0 -81
  95. package/src/mindmap/markContentOption.ts +0 -81
  96. package/src/mindmap/markEntity.ts +0 -82
  97. package/src/mindmap/markRoot.ts +0 -83
  98. package/src/mindmap/theme.ts +0 -11
  99. package/src/pool/LaneModel.ts +0 -226
  100. package/src/pool/LaneView.ts +0 -220
  101. package/src/pool/PoolModel.ts +0 -631
  102. package/src/pool/PoolView.ts +0 -75
  103. package/src/pool/constant.ts +0 -19
  104. package/src/pool/index.ts +0 -621
  105. package/src/pool/utils.ts +0 -46
  106. package/src/rect-label-node/RectLabelNodeView.ts +0 -33
  107. package/src/rect-label-node/index.ts +0 -15
  108. package/src/style/index.less +0 -381
  109. package/src/style/raw.ts +0 -328
  110. package/src/tools/auto-layout/index.ts +0 -282
  111. package/src/tools/flow-path/index.ts +0 -233
  112. package/src/tools/label/Label.tsx +0 -357
  113. package/src/tools/label/LabelModel.ts +0 -83
  114. package/src/tools/label/LabelOverlay.tsx +0 -162
  115. package/src/tools/label/algorithm.ts +0 -42
  116. package/src/tools/label/index.ts +0 -479
  117. package/src/tools/label/mediumEditor.ts +0 -121
  118. package/src/tools/label/utils.ts +0 -395
  119. package/src/tools/proximity-connect/index.ts +0 -435
  120. package/src/tools/snapshot/README.md +0 -145
  121. package/src/tools/snapshot/index.ts +0 -701
  122. package/src/tools/snapshot/utils.ts +0 -163
  123. package/src/turbo-adapter/index.ts +0 -212
  124. package/stats.html +0 -4842
  125. package/tsconfig.json +0 -18
@@ -1,155 +0,0 @@
1
- import { h } from '@logicflow/core'
2
-
3
- // event
4
- export const messageIcon =
5
- 'm 8.459999999999999,11.34 l 0,12.6 l 18.900000000000002,0 l 0,-12.6 z l 9.450000000000001,5.4 l 9.450000000000001,-5.4'
6
- export const timerIcon: h.JSX.Element[] = [
7
- h('circle', {
8
- cx: 18,
9
- cy: 18,
10
- r: 11,
11
- style:
12
- 'stroke-linecap: round;stroke-linejoin: round;stroke: rgb(34, 36, 42);stroke-width: 2px;fill: white',
13
- }),
14
- h('path', {
15
- d: 'M 18,18 l 2.25,-7.5 m -2.25,7.5 l 5.25,1.5',
16
- style:
17
- 'fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 2px;',
18
- }),
19
- h('path', {
20
- d: 'M 18,18 m 0,7.5 l -0,2.25',
21
- transform: 'rotate(0,18,18)',
22
- style:
23
- 'fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;',
24
- }),
25
- h('path', {
26
- d: 'M 18,18 m 0,7.5 l -0,2.25',
27
- transform: 'rotate(30,18,18)',
28
- style:
29
- 'fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;',
30
- }),
31
- h('path', {
32
- d: 'M 18,18 m 0,7.5 l -0,2.25',
33
- transform: 'rotate(60,18,18)',
34
- style:
35
- 'fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;',
36
- }),
37
- h('path', {
38
- d: 'M 18,18 m 0,7.5 l -0,2.25',
39
- transform: 'rotate(90,18,18)',
40
- style:
41
- 'fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;',
42
- }),
43
- h('path', {
44
- d: 'M 18,18 m 0,7.5 l -0,2.25',
45
- transform: 'rotate(120,18,18)',
46
- style:
47
- 'fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;',
48
- }),
49
- h('path', {
50
- d: 'M 18,18 m 0,7.5 l -0,2.25',
51
- transform: 'rotate(150,18,18)',
52
- style:
53
- 'fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;',
54
- }),
55
- h('path', {
56
- d: 'M 18,18 m 0,7.5 l -0,2.25',
57
- transform: 'rotate(180,18,18)',
58
- style:
59
- 'fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;',
60
- }),
61
- h('path', {
62
- d: 'M 18,18 m 0,7.5 l -0,2.25',
63
- transform: 'rotate(210,18,18)',
64
- style:
65
- 'fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;',
66
- }),
67
- h('path', {
68
- d: 'M 18,18 m 0,7.5 l -0,2.25',
69
- transform: 'rotate(240,18,18)',
70
- style:
71
- 'fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;',
72
- }),
73
- h('path', {
74
- d: 'M 18,18 m 0,7.5 l -0,2.25',
75
- transform: 'rotate(270,18,18)',
76
- style:
77
- 'fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;',
78
- }),
79
- h('path', {
80
- d: 'M 18,18 m 0,7.5 l -0,2.25',
81
- transform: 'rotate(300,18,18)',
82
- style:
83
- 'fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;',
84
- }),
85
- h('path', {
86
- d: 'M 18,18 m 0,7.5 l -0,2.25',
87
- transform: 'rotate(330,18,18)',
88
- style:
89
- 'fill: none; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;',
90
- }),
91
- ]
92
- export const errorIcon =
93
- 'm 7.2,25.991999999999997 0.09350000000000001,-0.025300000000000003 7.3392,-9.610700000000001 7.667000000000001,8.9661 4.7003,-18.2204 -5.8707,11.6501 -7.299600000000001,-9.585400000000002 z'
94
- export const escalationIcon = 'M 18,7.2 l 8,20 l -8,-7 l -8,7 Z'
95
- export const compensationIcon =
96
- 'm 7.92,18 9,-6.5 0,13 z m 9.3,-0.4 8.7,-6.1 0,13 -8.7,-6.1 z'
97
- export const conditionalIcon =
98
- 'M 10.5,8.5 l 14.5,0 l 0,18 l -14.5,0 Z M 12.5,11.5 l 10.5,0 M 12.5,14.5 l 10.5,0 M 12.5,17.5 l 10.5,0 M 12.5,20.5 l 10.5,0 M 12.5,23.5 l 10.5,0 M 12.5,26.5 l 10.5,0 '
99
- export const linkIcon =
100
- 'm 20.52,9.468 0,4.4375 -13.5,0 0,6.75 13.5,0 0,4.4375 9.84375,-7.8125 -9.84375,-7.8125 z'
101
- export const signalIcon = 'M 18,7.2 l 9,16.2 l -18,0 Z'
102
- export const terminateIcon: h.JSX.Element[] = [
103
- h('circle', {
104
- cx: 18,
105
- cy: 18,
106
- r: 10,
107
- style:
108
- 'stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 4px; fill: rgb(34, 36, 42);',
109
- }),
110
- ]
111
-
112
- // gateway
113
- export const exclusiveIcon =
114
- 'm 16,15 7.42857142857143,9.714285714285715 -7.42857142857143,9.714285714285715 3.428571428571429,0 5.714285714285715,-7.464228571428572 5.714285714285715,7.464228571428572 3.428571428571429,0 -7.42857142857143,-9.714285714285715 7.42857142857143,-9.714285714285715 -3.428571428571429,0 -5.714285714285715,7.464228571428572 -5.714285714285715,-7.464228571428572 -3.428571428571429,0 z'
115
- export const parallelIcon =
116
- 'm 23,10 0,12.5 -12.5,0 0,5 12.5,0 0,12.5 5,0 0,-12.5 12.5,0 0,-5 -12.5,0 0,-12.5 -5,0 z'
117
- export const inclusiveIcon: h.JSX.Element = h('circle', {
118
- cx: 25,
119
- cy: 25,
120
- r: 13,
121
- style:
122
- 'stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 2.5px; fill: white;',
123
- })
124
-
125
- // task
126
- export const serviceTaskIcon =
127
- 'M882.527918 434.149934c-2.234901-5.303796-7.311523-8.853645-13.059434-9.138124l-61.390185-3.009544c-6.635117-20.973684-15.521508-41.175795-26.513864-60.282968l42.051745-47.743374c4.308119-4.889357 4.955872-12.004405 1.602498-17.59268-46.384423-77.30362-103.969956-101.422947-106.400309-102.410438-5.332449-2.170432-11.432377-1.090844-15.693424 2.77009L654.674467 240.664222c-17.004279-8.654101-35.092239-15.756869-53.995775-21.210068l-3.26537-66.490344c-0.280386-5.747911-3.833305-10.824533-9.134031-13.059434-1.683339-0.709151-30.193673-12.391215-76.866668-12.051477-46.672996-0.339738-75.18333 11.342326-76.866668 12.051477-5.300726 2.234901-8.853645 7.311523-9.134031 13.059434l-3.26537 66.490344c-18.903535 5.453199-36.991496 12.555967-53.995775 21.210068l-48.450479-43.922349c-4.261047-3.860934-10.360975-4.940522-15.693424-2.77009-2.430352 0.98749-60.015885 25.106818-106.400309 102.410438-3.353374 5.588275-2.705622 12.703323 1.602498 17.59268l42.051745 47.743374c-10.992355 19.107173-19.878746 39.309284-26.513864 60.282968l-61.390185 3.009544c-5.747911 0.284479-10.824533 3.834328-13.059434 9.138124-1.01512 2.415003-24.687262 60.190871-2.822278 147.651828 1.583055 6.324032 7.072069 10.893094 13.57518 11.308557 5.892197 0.37146 11.751648 0.523933 17.419741 0.667196 14.498202 0.372483 28.193109 0.723477 40.908712 4.63353 4.212952 1.294482 6.435573 8.270361 9.349949 18.763342 1.287319 4.640694 2.617617 9.43693 4.484128 14.010085 1.794879 4.393054 3.75758 8.570189 5.66093 12.607132 1.302669 2.765997 2.529613 5.380544 3.689019 8.018627 2.986007 6.803963 2.682086 9.773598 2.578732 10.349719-3.061732 3.672646-6.391571 7.238868-9.91379 11.015891-1.810229 1.943258-3.680832 3.949962-5.523807 5.980201l-22.560832 24.8909c-3.865028 4.261047-4.940522 10.365068-2.774183 15.693424 0.991584 2.426259 25.102724 60.011792 102.414531 106.400309 5.588275 3.353374 12.703323 2.701528 17.591657-1.603521l23.476691-20.682042c2.346441-2.061962 4.64888-4.336772 6.875594-6.534833 9.05319-8.93858 14.018272-12.95608 17.73185-11.576663 3.305279 1.222851 6.907317 3.166109 10.720156 5.228071 3.325745 1.794879 6.764054 3.650133 10.465352 5.288446 6.016017 2.662643 12.120039 4.688789 18.019399 6.65149 6.827499 2.266623 13.279445 4.409426 18.819624 7.275707 1.518586 0.782829 1.926886 0.994654 2.358721 7.830339 0.726547 11.496845 1.25048 23.276123 1.753947 34.672684 0.264013 5.900384 0.528026 11.803837 0.815575 17.700127 0.284479 5.743818 3.833305 10.82044 9.138124 13.05534 1.654686 0.698918 29.371958 12.063757 74.869175 12.063757 0.328481 0 3.65832 0 3.986801 0 45.497217 0 73.214489-11.364839 74.869175-12.063757 5.304819-2.234901 8.853645-7.311523 9.138124-13.05534 0.287549-5.89629 0.551562-11.799744 0.815575-17.700127 0.503467-11.396561 1.027399-23.175839 1.753947-34.672684 0.431835-6.835685 0.840134-7.04751 2.358721-7.830339 5.54018-2.866281 11.992125-5.009084 18.819624-7.275707 5.89936-1.962701 12.003382-3.988848 18.019399-6.65149 3.701299-1.638313 7.139607-3.493567 10.465352-5.288446 3.812839-2.061962 7.414877-4.00522 10.720156-5.228071 3.713578-1.379417 8.67866 2.638083 17.73185 11.576663 2.226714 2.198062 4.529153 4.472871 6.875594 6.534833l23.476691 20.682042c4.888334 4.305049 12.003382 4.956895 17.591657 1.603521 77.311807-46.388517 101.422947-103.97405 102.414531-106.400309 2.166339-5.328355 1.090844-11.432377-2.774183-15.693424l-22.560832-24.8909c-1.842974-2.030239-3.713578-4.036943-5.523807-5.980201-3.52222-3.777023-6.852058-7.343245-9.91379-11.015891-0.103354-0.576121-0.407276-3.545756 2.578732-10.349719 1.159406-2.638083 2.38635-5.252631 3.689019-8.018627 1.90335-4.036943 3.866051-8.214079 5.66093-12.607132 1.866511-4.573155 3.196809-9.369392 4.484128-14.010085 2.914376-10.492982 5.136997-17.46886 9.349949-18.763342 12.715603-3.910053 26.41051-4.261047 40.908712-4.63353 5.668093-0.143263 11.527544-0.295735 17.419741-0.667196 6.503111-0.415462 11.992125-4.984524 13.57518-11.308557C907.21518 494.340805 883.543038 436.564937 882.527918 434.149934zM643.49894 643.761929c-35.280528 35.280528-82.191954 54.711066-132.086317 54.711066s-96.806813-19.430538-132.086317-54.711066c-35.280528-35.279504-54.711066-82.191954-54.711066-132.086317 0-49.894364 19.430538-96.80272 54.711066-132.082224 35.283598-35.284621 82.191954-54.711066 132.086317-54.711066s96.80579 19.426445 132.086317 54.711066c35.279504 35.279504 54.711066 82.187861 54.711066 132.082224C698.210006 561.569976 678.782537 608.482425 643.49894 643.761929z'
128
-
129
- export const userTaskIcon =
130
- 'M655.807326 287.35973m-223.989415 0a218.879 218.879 0 1 0 447.978829 0 218.879 218.879 0 1 0-447.978829 0ZM1039.955839 895.482975c-0.490184-212.177424-172.287821-384.030443-384.148513-384.030443-211.862739 0-383.660376 171.85302-384.15056 384.030443L1039.955839 895.482975z'
131
-
132
- export const scriptTaskIcon =
133
- 'M6.402,0.5H20.902C20.902,0.5,15.069,3.333,15.069,6.083S19.486,12.083,19.486,15.25S15.319,20.333,15.319,20.333H0.235C0.235,20.333,5.235,17.665999999999997,5.235,15.332999999999998S0.6520000000000001,8.582999999999998,0.6520000000000001,6.082999999999998S6.402,0.5,6.402,0.5ZM3.5,4.5L13.5,4.5M3.8,8.5L13.8,8.5M6.3,12.5L16.3,12.5M6.5,16.5L16.5,16.5'
134
-
135
- export const manualTaskIcon =
136
- 'M0.5,3.751L4.583,0.5009999999999999C4.583,0.5009999999999999,15.749,0.5839999999999999,16.666,0.5839999999999999S14.249,3.5009999999999994,15.166,3.5009999999999994S26.833,3.5009999999999994,27.75,3.5009999999999994C28.916,5.209,27.582,6.667999999999999,26.916,7.167999999999999S27.791,9.084999999999999,25.916,11.584999999999999C25.166,11.834999999999999,26.666,13.459999999999999,24.583000000000002,14.918C23.416,15.501,25.166,16.46,23.333000000000002,17.750999999999998C22.166,17.750999999999998,2.5000000000000036,17.833999999999996,2.5000000000000036,17.833999999999996L0.5000000000000036,16.500999999999998V3.751ZM13.5,7L27,7M13.5,11L26,11M14,14.5L25,14.5M8.2,3.1L15,3.1'
137
-
138
- export const style = {
139
- throw:
140
- 'fill: rgb(34, 36, 42); stroke-linecap: round; stroke-linejoin: round; stroke: white; stroke-width: 1px;',
141
- catch:
142
- 'fill: white; stroke-linecap: round; stroke-linejoin: round; stroke: rgb(34, 36, 42); stroke-width: 1px;',
143
- nonIntermediate: 'stroke-width: 1.5; stroke-dash-array: 6',
144
- intermediate: 'stroke-width: 1.5',
145
- }
146
-
147
- // marker
148
- export const parallelMarker =
149
- 'm44,60 m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10'
150
-
151
- export const sequentialMarker =
152
- 'm47,61 m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0'
153
-
154
- export const loopMarker =
155
- 'm 50,73 c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902'
@@ -1,52 +0,0 @@
1
- /* eslint-disable no-bitwise */
2
- export function groupRule(this: any) {
3
- const rule = {
4
- message: '分组外的节点不允许连接分组内的',
5
- validate: (
6
- _sourceNode: any,
7
- _targetNode: any,
8
- // _sourceAnchor: any,
9
- // _targetAnchor: any,
10
- ) => {
11
- const isSourceNodeInsideTheGroup = !!_sourceNode.properties.parent
12
- const isTargetNodeInsideTheGroup = !!_targetNode.properties.parent
13
-
14
- return !(!isSourceNodeInsideTheGroup && isTargetNodeInsideTheGroup)
15
- },
16
- }
17
- this.targetRules.push(rule)
18
- }
19
-
20
- /* eslint-disable no-bitwise */
21
- class IDs {
22
- private _ids: Set<string>
23
-
24
- constructor() {
25
- globalThis._ids = this
26
- this._ids = new Set()
27
- }
28
-
29
- generateId() {
30
- const id = 'xxxxxxx'.replace(/[x]/g, (c) => {
31
- const r = (Math.random() * 16) | 0
32
- const v = c === 'x' ? r : (r & 0x3) | 0x8
33
- return v.toString(16)
34
- })
35
- return id
36
- }
37
-
38
- next() {
39
- let id = this.generateId()
40
- while (this._ids.has(id)) {
41
- id = this.generateId()
42
- }
43
- this._ids.add(id)
44
- return id
45
- }
46
- }
47
-
48
- const ids = globalThis?._ids || new IDs()
49
-
50
- export function genBpmnId(): string {
51
- return ids.next()
52
- }
@@ -1,293 +0,0 @@
1
- ## what's the difference?
2
-
3
- 和旧的bpmn-adapter相比,新的bpmn-adapter在调用adapterIn和adapterOut时,可以额外传入一个对象作为入参
4
-
5
- ``` ts
6
- type ExtraPropsType = {
7
- /**
8
- * retainedAttrsFields retainedAttrsFields会和默认的defaultRetainedProperties:
9
- * ["properties", "startPoint", "endPoint", "pointsList"]合并
10
- * 这意味着出现在这个数组里的字段当它的值是数组或是对象时不会被视为一个节点而是一个属性
11
- */
12
- retainedAttrsFields?: string[];
13
-
14
- /**
15
- * excludeFields会和默认的defaultExcludeFields合并,
16
- * 出现在这个数组中的字段在导出时会被忽略
17
- */
18
- excludeFields?: {
19
- in?: Set<string>;
20
- out?: Set<string>;
21
- };
22
-
23
- /**
24
- * transformer是一个数组,数组中的每一项都是一个对象,对象中包含in和out两个属性
25
- * in函数接收两个参数key 和 data,key为当前处理对象的key也就是节点名称,data为当前对象,当导入时会调用这个函数,对被导入数据进行处理,得到我们期望的数据
26
- * out函数接收一个参数data,data为当前处理节点数据,当导出时会调用这个函数,对需要导出的数据进行处理,得到我们期望的数据
27
- */
28
- transformer?: {
29
- [key: string]: {
30
- in?: (key: string, data: any) => any;
31
- out?: (data: any) => any;
32
- }
33
- };
34
-
35
- mapping?: {
36
- in?: {
37
- [key: string]: string;
38
- };
39
- out?: {
40
- [key: string]: string;
41
- };
42
- };
43
- };
44
- ```
45
-
46
- ## 使用
47
-
48
- ``` ts
49
- // step 1 引入adapter插件
50
- import { BpmnXmlAdapterV2 } from '@logicflow/extension';
51
- // step 2 注册插件
52
- LogicFlow.use(BpmnXmlAdapterV2);
53
- ...
54
- // step 3-1 调用默认导出
55
- const xmlResult = lf.adapterOut(lf.getGraphRawData())
56
- ```
57
-
58
- 很多时候,我们可能需要一些额外的参数帮助我们正确的进行导入导出,这时我们需要用到上面提到的adapterOut额外的入参ExtraPropsType
59
-
60
- ``` ts
61
- // step 3-2 使用adapterOut的第二个参数ExtraPropsType导出
62
-
63
- // 假如我们节点属性中有一个panels属性,它是一个数组,但是我们不希望它被视为一个节点,而是一个属性,那么我们可以这样做
64
- const extraProps = {
65
- retainedAttrsFields: ['panels']
66
- }
67
- // 假如我们节点属性中有一个runboost属性,但是我们希望导出时不包含这个属性,那么我们可以这样做
68
- extraProps.excludeFields = {
69
- out: new Set(['runboost'])
70
- }
71
- ```
72
-
73
- 假如我们要将包含判断条件的顺序流(sequenceFlow)以正确的XML格式导出,并且导入时正确处理得到我们想要的数据,那么我们可以这样做:
74
-
75
- ``` xml
76
- <!-- 顺序流的XML数据格式: -->
77
-
78
- <bpmn:sequenceFlow id="SequenceFlow_0j5q1qk" sourceRef="StartEvent_1" targetRef="Activity_0j5q1qk"/>
79
-
80
- <!-- 包含判断条件时 -->
81
-
82
- <bpmn:sequenceFlow id="SequenceFlow_0j5q1qk" sourceRef="StartEvent_1" targetRef="Activity_0j5q1qk">
83
- <bpmn:conditionExpression xsi:type="bpmn2:tFormalExpression">
84
- <![CDATA[${runboost === '1'}]]>
85
- </bpmn:conditionExpression>
86
- </bpmn:sequenceFlow>
87
- <!-- 或者 -->
88
- <bpmn:sequenceFlow id="SequenceFlow_0j5q1qk" sourceRef="StartEvent_1" targetRef="Activity_0j5q1qk">
89
- <bpmn:conditionExpression xsi:type="bpmn2:tFormalExpression">
90
- runboost === '1'
91
- </bpmn:conditionExpression>
92
- </bpmn:sequenceFlow>
93
- ```
94
-
95
- ``` ts
96
- /**
97
- * 以包含判断条件的顺序流为例,
98
- * 在进行导入时,我们需要把<bpmn:sequenceFlow>的子内容<bpmn:conditionExpression>内的属性提取出来,
99
- * 最终放入父元素bpmn:sequenceFlow的properties属性中
100
- * 所以导入的时候我们实际需要处理的<bpmn:conditionExpression>中的内容,
101
- * 它被处理后,数据会被合入bpmn:sequenceFlow的properties属性中
102
- */
103
- extraProps.transformer = {
104
- 'bpmn:sequenceFlow': {
105
- out(data: any) {
106
- const { properties: { expressionType, condition } } = data;
107
- if (condition) {
108
- if (expressionType === 'cdata') {
109
- return {
110
- json:
111
- `<bpmn:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[\${${
112
- condition
113
- }}]]></bpmn:conditionExpression>`,
114
- };
115
- }
116
- return {
117
- json: `<bpmn:conditionExpression xsi:type="bpmn2:tFormalExpression">${condition}</bpmn:conditionExpression>`,
118
- };
119
- }
120
- return {
121
- json: '',
122
- };
123
- },
124
- },
125
- // 返回的数据会被合并进父元素bpmn:sequenceFlow的properties属性中
126
- 'bpmn:conditionExpression': {
127
- in(_key: string, data: any) {
128
- let condition = '';
129
- let expressionType = '';
130
- if (data['#cdata-section']) {
131
- expressionType = 'cdata';
132
- condition = /^\$\{(.*)\}$/g.exec(data['#cdata-section'])?.[1] || '';
133
- } else if (data['#text']) {
134
- expressionType = 'normal';
135
- condition = data['#text'];
136
- }
137
- return {
138
- '-condition': condition,
139
- '-expressionType': expressionType,
140
- };
141
- },
142
- },
143
- }
144
- ```
145
-
146
- ***数据导入导出的原则是:导出时处理父元素;导入时处理子元素。***
147
-
148
- - 导出时,需要从父元素的属性中拿到子元素需要到数据并拼接出子元素。
149
- - 导入时,需要从子元素中提取我们需要的数据放入父元素的属性中。
150
-
151
- 在配置完需要的extraProps之后,我们就可以调用adapterOut方法导出数据。
152
-
153
- ``` ts
154
-
155
- const xmlResult = lf.adapterOut(lf.getGraphRawData(), extraProps)
156
- ```
157
-
158
- 目前,我们内置了一下transformer **(仅做参考)**:
159
-
160
- > 注意:这里内置的transformer仅做参考使用,这些transformer在编写的过程中是用来配合bpmn节点插件的,里面诸如`timerType`, `timerValue`, `definitionId`,都是通过bpmn节点插件的definitionConfig配置的。在实际使用该数据转换插件时,你完全可以不使用bpmn节点插件,通过你自己的方式为节点添加属性,自定义transformer来实现符合你需要的数据转换。
161
-
162
- ```ts
163
-
164
- let defaultTransformer: TransformerType = {
165
- 'bpmn:startEvent': {
166
- out(data: any) {
167
- const { properties } = data;
168
- return defaultTransformer[properties.definitionType]?.out(data) || {};
169
- },
170
- },
171
- 'bpmn:intermediateCatchEvent': {
172
- out(data: any) {
173
- const { properties } = data;
174
- return defaultTransformer[properties.definitionType]?.out(data) || {};
175
- },
176
- },
177
- 'bpmn:intermediateThrowEvent': {
178
- out(data: any) {
179
- const { properties } = data;
180
- return defaultTransformer[properties.definitionType]?.out(data) || {};
181
- },
182
- },
183
- 'bpmn:boundaryEvent': {
184
- out(data: any) {
185
- const { properties } = data;
186
- return defaultTransformer[properties.definitionType]?.out(data) || {};
187
- },
188
- },
189
- 'bpmn:sequenceFlow': {
190
- out(data: any) {
191
- const {
192
- properties: { expressionType, condition },
193
- } = data;
194
- if (condition) {
195
- if (expressionType === 'cdata') {
196
- return {
197
- json:
198
- `<bpmn:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[\${${
199
- condition
200
- }}]]></bpmn:conditionExpression>`,
201
- };
202
- }
203
- return {
204
- json: `<bpmn:conditionExpression xsi:type="bpmn2:tFormalExpression">${condition}</bpmn:conditionExpression>`,
205
- };
206
- }
207
- return {
208
- json: '',
209
- };
210
-
211
- },
212
- },
213
- 'bpmn:timerEventDefinition': {
214
- out(data: any) {
215
- // 这里的timerType, timerValue, definitionId
216
- // 都是通过通过的Bpmn节点插件扩展节点时,通过definitionConfig配置的属性,实际使用时需要根据自己的设置的属性对out函数进行修改
217
- const {
218
- properties: { timerType, timerValue, definitionId },
219
- } = data;
220
-
221
- const typeFunc = () => `<bpmn:${timerType} xsi:type="bpmn:tFormalExpression">${timerValue}</bpmn:${timerType}>`;
222
-
223
- return {
224
- json:
225
- `<bpmn:timerEventDefinition id="${definitionId}"${
226
- timerType && timerValue
227
- ? `>${typeFunc()}</bpmn:timerEventDefinition>`
228
- : '/>'}`,
229
- };
230
- },
231
- in(key: string, data: any) {
232
- const definitionType = key;
233
- const definitionId = data['-id'];
234
- let timerType = '';
235
- let timerValue = '';
236
- for (const key of Object.keys(data)) {
237
- if (key.includes('bpmn:')) {
238
- [, timerType] = key.split(':');
239
- timerValue = data[key]?.['#text'];
240
- }
241
- }
242
- return {
243
- '-definitionId': definitionId,
244
- '-definitionType': definitionType,
245
- '-timerType': timerType,
246
- '-timerValue': timerValue,
247
- };
248
- },
249
- },
250
- 'bpmn:conditionExpression': {
251
- in(_key: string, data: any) {
252
- let condition = '';
253
- let expressionType = '';
254
- if (data['#cdata-section']) {
255
- expressionType = 'cdata';
256
- condition = /^\$\{(.*)\}$/g.exec(data['#cdata-section'])?.[1] || '';
257
- } else if (data['#text']) {
258
- expressionType = 'normal';
259
- condition = data['#text'];
260
- }
261
-
262
- return {
263
- '-condition': condition,
264
- '-expressionType': expressionType,
265
- };
266
- },
267
- },
268
- };
269
-
270
- ```
271
-
272
- 传入的transformer和默认的transformer会通过
273
-
274
- ```ts
275
-
276
- const mergeInNOutObject = (target: any, source: any): TransformerType => {
277
- const sourceKeys = Object.keys(source);
278
- sourceKeys.forEach((key) => {
279
- if (target[key]) {
280
- const { in: fnIn, out: fnOut } = source[key];
281
- if (fnIn) {
282
- target[key].in = fnIn;
283
- }
284
- if (fnOut) {
285
- target[key].out = fnOut;
286
- }
287
- } else {
288
- target[key] = source[key];
289
- }
290
- });
291
- return target;
292
- };
293
- ```