@mx-sose-front/mx-sose-graph 1.0.0

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 (337) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +343 -0
  3. package/dist/index.d.ts +3937 -0
  4. package/dist/index.esm.js +74367 -0
  5. package/dist/index.esm.js.map +1 -0
  6. package/dist/index.umd.js +38 -0
  7. package/dist/index.umd.js.map +1 -0
  8. package/dist/style.css +1 -0
  9. package/package.json +70 -0
  10. package/src/components/ContextMenu.vue +475 -0
  11. package/src/components/Diagram/StrategicTaxonomyDiagram.vue +141 -0
  12. package/src/components/Edge/Edge.vue +366 -0
  13. package/src/components/InteractionLayer.vue +2033 -0
  14. package/src/components/Label.vue +0 -0
  15. package/src/components/LineStyle/ConnectionLine.vue +126 -0
  16. package/src/components/LineStyle/LineStyleMarker.vue +87 -0
  17. package/src/components/Pin/Pin.vue +220 -0
  18. package/src/components/Pin/Port.vue +172 -0
  19. package/src/components/Shape/Action.vue +121 -0
  20. package/src/components/Shape/ActivityAction.vue +155 -0
  21. package/src/components/Shape/Block.vue +306 -0
  22. package/src/components/Shape/ConceptualRole.vue +266 -0
  23. package/src/components/Shape/Diagram.vue +220 -0
  24. package/src/components/Shape/DividingLine.vue +594 -0
  25. package/src/components/Shape/DogEar.vue +224 -0
  26. package/src/components/Shape/Package.vue +340 -0
  27. package/src/constants/edgeShapeKeys.ts +81 -0
  28. package/src/constants/index.ts +440 -0
  29. package/src/index.ts +28 -0
  30. package/src/render/shape-registry.ts +17 -0
  31. package/src/render/shape-renderer.ts +103 -0
  32. package/src/statics/icons/childIcons/relations@3x.png +0 -0
  33. package/src/statics/icons/childIcons/role@3x.png +0 -0
  34. package/src/statics/icons/childIcons//344/270/232/345/212/241/344/277/241/345/217/267@3x.png +0 -0
  35. package/src/statics/icons/childIcons//344/270/232/345/212/241/344/277/241/346/201/257@3x.png +0 -0
  36. package/src/statics/icons/childIcons//344/270/232/345/212/241/344/277/241/346/201/257/345/233/276@3x.png +0 -0
  37. package/src/statics/icons/childIcons//344/270/232/345/212/241/345/206/205/351/203/250/346/265/201/347/250/213/345/233/276@3x.png +0 -0
  38. package/src/statics/icons/childIcons//344/270/232/345/212/241/345/206/205/351/203/250/350/277/236/351/200/232/345/233/276@3x.png +0 -0
  39. package/src/statics/icons/childIcons//344/270/232/345/212/241/345/212/250/344/275/234@3x.png +0 -0
  40. package/src/statics/icons/childIcons//344/270/232/345/212/241/345/217/202/346/225/260@3x.png +0 -0
  41. package/src/statics/icons/childIcons//344/270/232/345/212/241/345/217/202/346/225/260/345/233/276@3x.png +0 -0
  42. package/src/statics/icons/childIcons//344/270/232/345/212/241/345/257/271/350/261/241/346/265/201@3x.png +0 -0
  43. package/src/statics/icons/childIcons//344/270/232/345/212/241/346/211/247/350/241/214/350/200/205@3x.png +0 -0
  44. package/src/statics/icons/childIcons//344/270/232/345/212/241/346/216/245/345/217/243@3x.png +0 -0
  45. package/src/statics/icons/childIcons//344/270/232/345/212/241/346/216/247/345/210/266/346/265/201@3x.png +0 -0
  46. package/src/statics/icons/childIcons//344/270/232/345/212/241/346/246/202/345/277/265/345/233/276@3x.png +0 -0
  47. package/src/statics/icons/childIcons//344/270/232/345/212/241/346/246/202/345/277/265/350/241/250@3x.png +0 -0
  48. package/src/statics/icons/childIcons//344/270/232/345/212/241/346/264/273/345/212/250@3x.png +0 -0
  49. package/src/statics/icons/childIcons//344/270/232/345/212/241/346/264/273/345/212/250/344/270/216/350/203/275/345/212/233/346/230/240/345/260/204/347/237/251/351/230/265@3x.png +0 -0
  50. package/src/statics/icons/childIcons//344/270/232/345/212/241/346/264/273/345/212/250/345/212/250/344/275/234@3x.png +0 -0
  51. package/src/statics/icons/childIcons//344/270/232/345/212/241/346/264/273/345/212/250/346/265/201/347/250/213/345/233/276@3x.png +0 -0
  52. package/src/statics/icons/childIcons//344/270/232/345/212/241/346/264/273/345/212/250/347/273/223/346/236/204/345/233/276@3x.png +0 -0
  53. package/src/statics/icons/childIcons//344/270/232/345/212/241/346/265/201/347/250/213/345/233/276@3x.png +0 -0
  54. package/src/statics/icons/childIcons//344/270/232/345/212/241/347/212/266/346/200/201/345/233/276@3x.png +0 -0
  55. package/src/statics/icons/childIcons//344/270/232/345/212/241/347/253/257/345/217/243@3x.png +0 -0
  56. package/src/statics/icons/childIcons//344/270/232/345/212/241/347/272/246/346/235/237@3x.png +0 -0
  57. package/src/statics/icons/childIcons//344/270/232/345/212/241/347/272/246/346/235/237/345/233/276@3x.png +0 -0
  58. package/src/statics/icons/childIcons//344/270/232/345/212/241/347/272/246/346/235/237/345/256/232/344/271/211/345/233/276@3x.png +0 -0
  59. package/src/statics/icons/childIcons//344/270/232/345/212/241/347/272/246/346/235/237/350/241/250@3x.png +0 -0
  60. package/src/statics/icons/childIcons//344/270/232/345/212/241/347/273/223/346/236/204@3x.png +0 -0
  61. package/src/statics/icons/childIcons//344/270/232/345/212/241/350/207/252/347/224/261/345/210/206/347/261/273/345/233/276@3x.png +0 -0
  62. package/src/statics/icons/childIcons//344/270/232/345/212/241/350/247/222/350/211/262@3x.png +0 -0
  63. package/src/statics/icons/childIcons//344/270/232/345/212/241/350/277/236/346/216/245/345/231/250@3x.png +0 -0
  64. package/src/statics/icons/childIcons//344/270/232/345/212/241/350/277/236/351/200/232/345/233/276@3x.png +0 -0
  65. package/src/statics/icons/childIcons//344/270/232/345/212/241/350/277/236/351/200/232/350/241/250@3x.png +0 -0
  66. package/src/statics/icons/childIcons//344/270/232/345/212/241/351/253/230/347/272/247/346/246/202/345/277/265/345/233/276@3x.png +0 -0
  67. package/src/statics/icons/childIcons//344/272/272/345/221/230@3x.png +0 -0
  68. package/src/statics/icons/childIcons//344/272/272/345/221/230/345/206/205/351/203/250/346/265/201/347/250/213/345/233/276@3x.png +0 -0
  69. package/src/statics/icons/childIcons//344/272/272/345/221/230/345/206/205/351/203/250/350/277/236/351/200/232/345/233/276@3x.png +0 -0
  70. package/src/statics/icons/childIcons//344/272/272/345/221/230/345/217/202/346/225/260/345/233/276@3x.png +0 -0
  71. package/src/statics/icons/childIcons//344/272/272/345/221/230/346/246/202/345/277/265/345/233/276@3x.png +0 -0
  72. package/src/statics/icons/childIcons//344/272/272/345/221/230/346/246/202/345/277/265/350/241/250@3x.png +0 -0
  73. package/src/statics/icons/childIcons//344/272/272/345/221/230/346/265/201/347/250/213/345/233/276@3x.png +0 -0
  74. package/src/statics/icons/childIcons//344/272/272/345/221/230/347/212/266/346/200/201/345/233/276@3x.png +0 -0
  75. package/src/statics/icons/childIcons//344/272/272/345/221/230/347/272/246/346/235/237/345/233/276@3x-2.png +0 -0
  76. package/src/statics/icons/childIcons//344/272/272/345/221/230/347/272/246/346/235/237/345/233/276@3x.png +0 -0
  77. package/src/statics/icons/childIcons//344/272/272/345/221/230/347/273/223/346/236/204/345/233/276@3x.png +0 -0
  78. package/src/statics/icons/childIcons//344/272/272/345/221/230/350/277/236/351/200/232/345/233/276@3x.png +0 -0
  79. package/src/statics/icons/childIcons//344/272/272/345/221/230/350/277/236/351/200/232/350/241/250@3x.png +0 -0
  80. package/src/statics/icons/childIcons//344/273/267/345/200/274/346/265/201@3x.png +0 -0
  81. package/src/statics/icons/childIcons//344/273/273/346/204/217/345/205/263/347/263/273@3x.png +0 -0
  82. package/src/statics/icons/childIcons//344/273/273/346/204/217/350/277/236/346/216/245/345/231/250@3x.png +0 -0
  83. package/src/statics/icons/childIcons//344/274/201/344/270/232/344/275/277/345/221/275@3x.png +0 -0
  84. package/src/statics/icons/childIcons//344/274/201/344/270/232/345/205/250/347/224/237/345/221/275/345/221/250/346/234/237@3x.png +0 -0
  85. package/src/statics/icons/childIcons//344/274/201/344/270/232/346/204/277/346/231/257@3x.png +0 -0
  86. package/src/statics/icons/childIcons//344/274/201/344/270/232/347/233/256/346/240/207@3x.png +0 -0
  87. package/src/statics/icons/childIcons//344/275/215/347/275/256@3x.png +0 -0
  88. package/src/statics/icons/childIcons//344/275/223/347/263/273/346/236/266/346/236/204@3x.png +0 -0
  89. package/src/statics/icons/childIcons//344/276/235/350/265/226@3x.png +0 -0
  90. package/src/statics/icons/childIcons//344/277/235/346/212/244@3x.png +0 -0
  91. package/src/statics/icons/childIcons//344/277/241/346/201/257/346/250/241/345/236/213@3x.png +0 -0
  92. package/src/statics/icons/childIcons//345/210/233/351/200/240@3x.png +0 -0
  93. package/src/statics/icons/childIcons//345/212/237/350/203/275@3x.png +0 -0
  94. package/src/statics/icons/childIcons//345/212/237/350/203/275/344/270/216/344/270/232/345/212/241/346/264/273/345/212/250/346/230/240/345/260/204/347/237/251/351/230/265@3x.png +0 -0
  95. package/src/statics/icons/childIcons//345/212/237/350/203/275/345/212/250/344/275/234@3x.png +0 -0
  96. package/src/statics/icons/childIcons//345/212/237/350/203/275/345/257/271/350/261/241/346/265/201@3x.png +0 -0
  97. package/src/statics/icons/childIcons//345/212/237/350/203/275/346/216/247/345/210/266/346/265/201@3x.png +0 -0
  98. package/src/statics/icons/childIcons//345/217/214/345/220/221/345/205/263/350/201/224@3x.png +0 -0
  99. package/src/statics/icons/childIcons//345/217/227/345/210/260/345/275/261/345/223/215@3x.png +0 -0
  100. package/src/statics/icons/childIcons//345/234/260/347/220/206/346/224/277/346/262/273/350/214/203/345/233/264/347/261/273/345/236/213@3x.png +0 -0
  101. package/src/statics/icons/childIcons//345/241/253/345/206/231/350/201/214/344/275/215/347/224/263/350/257/267@3x.png +0 -0
  102. package/src/statics/icons/childIcons//345/256/211/345/205/250/345/206/205/351/203/250/346/265/201/347/250/213/345/233/276@3x.png +0 -0
  103. package/src/statics/icons/childIcons//345/256/211/345/205/250/346/216/247/345/210/266@3x.png +0 -0
  104. package/src/statics/icons/childIcons//345/256/211/345/205/250/346/246/202/345/277/265/345/233/276@3x.png +0 -0
  105. package/src/statics/icons/childIcons//345/256/211/345/205/250/346/246/202/345/277/265/350/241/250@3x.png +0 -0
  106. package/src/statics/icons/childIcons//345/256/211/345/205/250/346/265/201/347/250/213@3x.png +0 -0
  107. package/src/statics/icons/childIcons//345/256/211/345/205/250/346/265/201/347/250/213/345/212/250/344/275/234@3x.png +0 -0
  108. package/src/statics/icons/childIcons//345/256/211/345/205/250/346/265/201/347/250/213/345/233/276@3x.png +0 -0
  109. package/src/statics/icons/childIcons//345/256/211/345/205/250/347/272/246/346/235/237@3x.png +0 -0
  110. package/src/statics/icons/childIcons//345/256/211/345/205/250/347/272/246/346/235/237/345/233/276@3x.png +0 -0
  111. package/src/statics/icons/childIcons//345/256/211/345/205/250/347/272/246/346/235/237/345/256/232/344/271/211/345/233/276@3x.png +0 -0
  112. package/src/statics/icons/childIcons//345/256/211/345/205/250/347/273/223/346/236/204/345/233/276@3x.png +0 -0
  113. package/src/statics/icons/childIcons//345/256/211/345/205/250/350/277/236/351/200/232/345/233/276@3x.png +0 -0
  114. package/src/statics/icons/childIcons//345/256/211/345/205/250/350/277/236/351/200/232/350/241/250@3x.png +0 -0
  115. package/src/statics/icons/childIcons//345/256/211/345/205/250/351/232/224/347/246/273@3x.png +0 -0
  116. package/src/statics/icons/childIcons//345/256/211/345/205/250/351/243/216/351/231/251@3x.png +0 -0
  117. package/src/statics/icons/childIcons//345/256/232/345/220/221/345/205/263/347/263/273@3x.png +0 -0
  118. package/src/statics/icons/childIcons//345/256/232/345/220/221/345/205/263/350/201/224@3x.png +0 -0
  119. package/src/statics/icons/childIcons//345/256/232/345/220/221/347/273/204/346/210/220@3x.png +0 -0
  120. package/src/statics/icons/childIcons//345/256/232/345/220/221/350/201/232/345/220/210@3x.png +0 -0
  121. package/src/statics/icons/childIcons//345/256/236/351/231/205/344/272/272/345/221/230@3x.png +0 -0
  122. package/src/statics/icons/childIcons//345/256/236/351/231/205/344/274/201/344/270/232/351/230/266/346/256/265@3x.png +0 -0
  123. package/src/statics/icons/childIcons//345/256/236/351/231/205/344/275/215/347/275/256@3x.png +0 -0
  124. package/src/statics/icons/childIcons//345/256/236/351/231/205/345/261/236/346/200/247/350/256/276/347/275/256@3x.png +0 -0
  125. package/src/statics/icons/childIcons//345/256/236/351/231/205/346/210/230/347/225/245/351/230/266/346/256/265/347/224/230/347/211/271/345/233/276@3x.png +0 -0
  126. package/src/statics/icons/childIcons//345/256/236/351/231/205/346/214/201/347/273/255/344/273/273/345/212/241@3x.png +0 -0
  127. package/src/statics/icons/childIcons//345/256/236/351/231/205/346/234/215/345/212/241@3x.png +0 -0
  128. package/src/statics/icons/childIcons//345/256/236/351/231/205/346/235/241/344/273/266@3x.png +0 -0
  129. package/src/statics/icons/childIcons//345/256/236/351/231/205/347/216/257/345/242/203@3x.png +0 -0
  130. package/src/statics/icons/childIcons//345/256/236/351/231/205/347/273/204/347/273/207@3x.png +0 -0
  131. package/src/statics/icons/childIcons//345/256/236/351/231/205/350/201/214/344/275/215@3x.png +0 -0
  132. package/src/statics/icons/childIcons//345/256/236/351/231/205/350/201/214/350/264/243@3x.png +0 -0
  133. package/src/statics/icons/childIcons//345/256/236/351/231/205/350/264/243/344/273/273@3x.png +0 -0
  134. package/src/statics/icons/childIcons//345/256/236/351/231/205/350/265/204/346/272/220@3x.png +0 -0
  135. package/src/statics/icons/childIcons//345/256/236/351/231/205/350/265/204/346/272/220/344/270/216/345/256/236/351/231/205/351/241/271/347/233/256/345/257/271/345/272/224/345/205/263/347/263/273/347/237/251/351/230/265@3x.png +0 -0
  136. package/src/statics/icons/childIcons//345/256/236/351/231/205/350/265/204/346/272/220/346/246/202/345/277/265/347/237/251/351/230/265@3x.png +0 -0
  137. package/src/statics/icons/childIcons//345/256/236/351/231/205/350/265/204/346/272/220/347/273/223/346/236/204/345/233/276@3x.png +0 -0
  138. package/src/statics/icons/childIcons//345/256/236/351/231/205/350/265/204/346/272/220/350/277/236/351/200/232/345/233/276@3x.png +0 -0
  139. package/src/statics/icons/childIcons//345/256/236/351/231/205/351/241/271/347/233/256@3x.png +0 -0
  140. package/src/statics/icons/childIcons//345/256/236/351/231/205/351/241/271/347/233/256/344/270/216/350/203/275/345/212/233/347/232/204/346/230/240/345/260/204/347/237/251/351/230/265@3x.png +0 -0
  141. package/src/statics/icons/childIcons//345/256/236/351/231/205/351/241/271/347/233/256/351/207/214/347/250/213/347/242/221@3x.png +0 -0
  142. package/src/statics/icons/childIcons//345/256/236/351/231/205/351/241/271/347/233/256/351/207/214/347/250/213/347/242/221/346/261/207/346/200/273/350/241/250@3x.png +0 -0
  143. package/src/statics/icons/childIcons//345/256/236/351/231/205/351/243/216/351/231/251@3x.png +0 -0
  144. package/src/statics/icons/childIcons//345/261/225/347/244/272@3x.png +0 -0
  145. package/src/statics/icons/childIcons//345/267/262/347/237/245/350/265/204/346/272/220@3x.png +0 -0
  146. package/src/statics/icons/childIcons//345/274/200/345/261/225/345/267/245/344/275/234/350/203/275/345/212/233@3x.png +0 -0
  147. package/src/statics/icons/childIcons//345/274/225/347/224/250/345/261/236/346/200/247@3x.png +0 -0
  148. package/src/statics/icons/childIcons//345/275/261/345/223/215@3x-2.png +0 -0
  149. package/src/statics/icons/childIcons//345/275/261/345/223/215@3x.png +0 -0
  150. package/src/statics/icons/childIcons//346/204/277/346/231/257/345/256/243/350/250/200@3x.png +0 -0
  151. package/src/statics/icons/childIcons//346/210/230/347/225/245@3x.png +0 -0
  152. package/src/statics/icons/childIcons//346/210/230/347/225/245/344/277/241/346/201/257@3x.png +0 -0
  153. package/src/statics/icons/childIcons//346/210/230/347/225/245/344/277/241/346/201/257/345/233/276@3x-2.png +0 -0
  154. package/src/statics/icons/childIcons//346/210/230/347/225/245/344/277/241/346/201/257/345/233/276@3x.png +0 -0
  155. package/src/statics/icons/childIcons//346/210/230/347/225/245/345/217/202/346/225/260/345/233/276@3x.png +0 -0
  156. package/src/statics/icons/childIcons//346/210/230/347/225/245/345/256/236/351/231/205/346/210/230/347/225/245/351/230/266/346/256/265/345/210/206/347/261/273/350/241/250@3x.png +0 -0
  157. package/src/statics/icons/childIcons//346/210/230/347/225/245/345/256/236/351/231/205/351/203/250/347/275/262/345/233/276@3x.png +0 -0
  158. package/src/statics/icons/childIcons//346/210/230/347/225/245/346/246/202/345/277/265/345/233/276@3x.png +0 -0
  159. package/src/statics/icons/childIcons//346/210/230/347/225/245/346/265/201/347/250/213/345/233/276@3x-2.png +0 -0
  160. package/src/statics/icons/childIcons//346/210/230/347/225/245/346/265/201/347/250/213/345/233/276@3x.png +0 -0
  161. package/src/statics/icons/childIcons//346/210/230/347/225/245/347/212/266/346/200/201/345/233/276@3x.png +0 -0
  162. package/src/statics/icons/childIcons//346/210/230/347/225/245/347/272/246/346/235/237@3x.png +0 -0
  163. package/src/statics/icons/childIcons//346/210/230/347/225/245/347/272/246/346/235/237/345/233/276@3x.png +0 -0
  164. package/src/statics/icons/childIcons//346/210/230/347/225/245/347/272/246/346/235/237/345/256/232/344/271/211/345/233/276@3x.png +0 -0
  165. package/src/statics/icons/childIcons//346/210/230/347/225/245/347/273/223/346/236/204/345/233/276@3x.png +0 -0
  166. package/src/statics/icons/childIcons//346/210/230/347/225/245/350/277/236/351/200/232/345/233/276@3x-2.png +0 -0
  167. package/src/statics/icons/childIcons//346/210/230/347/225/245/350/277/236/351/200/232/345/233/276@3x.png +0 -0
  168. package/src/statics/icons/childIcons//346/210/230/347/225/245/350/277/236/351/200/232/347/237/251/351/230/265@3x-2.png +0 -0
  169. package/src/statics/icons/childIcons//346/210/230/347/225/245/350/277/236/351/200/232/347/237/251/351/230/265@3x.png +0 -0
  170. package/src/statics/icons/childIcons//346/210/230/347/225/245/351/230/266/346/256/265@3x.png +0 -0
  171. package/src/statics/icons/childIcons//346/211/247/350/241/214@3x.png +0 -0
  172. package/src/statics/icons/childIcons//346/211/247/350/241/214/350/200/205/345/206/205/351/203/250/350/277/236/351/200/232/345/233/276@3x.png +0 -0
  173. package/src/statics/icons/childIcons//346/211/247/350/241/214/350/200/205/346/246/202/345/277/265/345/233/276@3x.png +0 -0
  174. package/src/statics/icons/childIcons//346/211/247/350/241/214/350/200/205/347/273/223/346/236/204/345/233/276@3x-2.png +0 -0
  175. package/src/statics/icons/childIcons//346/211/247/350/241/214/350/200/205/347/273/223/346/236/204/345/233/276@3x.png +0 -0
  176. package/src/statics/icons/childIcons//346/211/247/350/241/214/350/200/205/350/277/236/351/200/232/345/233/276@3x.png +0 -0
  177. package/src/statics/icons/childIcons//346/211/277/346/213/205/351/243/216/351/231/251@3x.png +0 -0
  178. package/src/statics/icons/childIcons//346/212/200/346/234/257@3x.png +0 -0
  179. package/src/statics/icons/childIcons//346/213/245/346/234/211/346/265/201/347/250/213@3x.png +0 -0
  180. package/src/statics/icons/childIcons//346/217/220/344/276/233/346/235/203/351/231/220@3x.png +0 -0
  181. package/src/statics/icons/childIcons//346/227/266/346/234/272@3x.png +0 -0
  182. package/src/statics/icons/childIcons//346/234/215/345/212/241@3x.png +0 -0
  183. package/src/statics/icons/childIcons//346/234/215/345/212/241/344/270/216/344/270/232/345/212/241/346/264/273/345/212/250/346/230/240/345/260/204/347/237/251/351/230/265@3x.png +0 -0
  184. package/src/statics/icons/childIcons//346/234/215/345/212/241/344/270/216/346/234/215/345/212/241/345/220/210/345/220/214/346/230/240/345/260/204/347/237/251/351/230/265@3x.png +0 -0
  185. package/src/statics/icons/childIcons//346/234/215/345/212/241/344/270/216/350/203/275/345/212/233/346/230/240/345/260/204/347/237/251/351/230/265@3x.png +0 -0
  186. package/src/statics/icons/childIcons//346/234/215/345/212/241/344/277/241/345/217/267@3x.png +0 -0
  187. package/src/statics/icons/childIcons//346/234/215/345/212/241/345/206/205/351/203/250/346/265/201/347/250/213/345/233/276@3x.png +0 -0
  188. package/src/statics/icons/childIcons//346/234/215/345/212/241/345/206/205/351/203/250/350/277/236/351/200/232/345/233/276@3x.png +0 -0
  189. package/src/statics/icons/childIcons//346/234/215/345/212/241/345/212/237/350/203/275@3x.png +0 -0
  190. package/src/statics/icons/childIcons//346/234/215/345/212/241/345/212/237/350/203/275/345/212/250/344/275/234@3x.png +0 -0
  191. package/src/statics/icons/childIcons//346/234/215/345/212/241/345/212/250/344/275/234@3x.png +0 -0
  192. package/src/statics/icons/childIcons//346/234/215/345/212/241/345/217/202/346/225/260@3x.png +0 -0
  193. package/src/statics/icons/childIcons//346/234/215/345/212/241/345/217/202/346/225/260/345/233/276@3x.png +0 -0
  194. package/src/statics/icons/childIcons//346/234/215/345/212/241/345/257/271/350/261/241/346/265/201@3x.png +0 -0
  195. package/src/statics/icons/childIcons//346/234/215/345/212/241/346/216/245/345/217/243@3x.png +0 -0
  196. package/src/statics/icons/childIcons//346/234/215/345/212/241/346/216/247/345/210/266/346/265/201@3x.png +0 -0
  197. package/src/statics/icons/childIcons//346/234/215/345/212/241/346/246/202/345/277/265/345/233/276@3x.png +0 -0
  198. package/src/statics/icons/childIcons//346/234/215/345/212/241/346/246/202/345/277/265/350/241/250@3x.png +0 -0
  199. package/src/statics/icons/childIcons//346/234/215/345/212/241/346/265/201/347/250/213/345/233/276@3x.png +0 -0
  200. package/src/statics/icons/childIcons//346/234/215/345/212/241/347/212/266/346/200/201/345/233/276@3x.png +0 -0
  201. package/src/statics/icons/childIcons//346/234/215/345/212/241/347/253/257/345/217/243@3x.png +0 -0
  202. package/src/statics/icons/childIcons//346/234/215/345/212/241/347/272/246/346/235/237/345/233/276@3x.png +0 -0
  203. package/src/statics/icons/childIcons//346/234/215/345/212/241/347/272/246/346/235/237/345/256/232/344/271/211/345/233/276@3x.png +0 -0
  204. package/src/statics/icons/childIcons//346/234/215/345/212/241/347/273/223/346/236/204@3x.png +0 -0
  205. package/src/statics/icons/childIcons//346/234/215/345/212/241/347/273/223/346/236/204/345/233/276@3x.png +0 -0
  206. package/src/statics/icons/childIcons//346/234/215/345/212/241/350/247/222/350/211/262@3x.png +0 -0
  207. package/src/statics/icons/childIcons//346/234/215/345/212/241/350/267/257/347/272/277/345/233/276@3x.png +0 -0
  208. package/src/statics/icons/childIcons//346/234/215/345/212/241/350/277/236/346/216/245/345/231/250@3x.png +0 -0
  209. package/src/statics/icons/childIcons//346/234/215/345/212/241/350/277/236/351/200/232/345/233/276@3x.png +0 -0
  210. package/src/statics/icons/childIcons//346/234/215/345/212/241/350/277/236/351/200/232/350/241/250@3x-2.png +0 -0
  211. package/src/statics/icons/childIcons//346/234/215/345/212/241/350/277/236/351/200/232/350/241/250@3x.png +0 -0
  212. package/src/statics/icons/childIcons//346/235/203/351/231/220@3x.png +0 -0
  213. package/src/statics/icons/childIcons//346/235/241/344/273/266@3x.png +0 -0
  214. package/src/statics/icons/childIcons//346/240/207/345/207/206/344/270/232/345/212/241/346/264/273/345/212/250@3x.png +0 -0
  215. package/src/statics/icons/childIcons//346/240/207/345/207/206/346/246/202/345/277/265/345/233/276@3x.png +0 -0
  216. package/src/statics/icons/childIcons//346/240/207/345/207/206/346/246/202/345/277/265/350/241/250@3x.png +0 -0
  217. package/src/statics/icons/childIcons//346/240/207/345/207/206/347/273/223/346/236/204/345/233/276@3x.png +0 -0
  218. package/src/statics/icons/childIcons//346/240/207/345/207/206/350/267/257/347/272/277/345/233/276@3x.png +0 -0
  219. package/src/statics/icons/childIcons//346/240/207/345/207/206/350/277/275/346/272/257/345/233/276@3x.png +0 -0
  220. package/src/statics/icons/childIcons//346/246/202/345/277/265/350/247/222/350/211/262@3x.png +0 -0
  221. package/src/statics/icons/childIcons//346/263/233/345/214/226@3x.png +0 -0
  222. package/src/statics/icons/childIcons//347/212/266/345/206/265@3x.png +0 -0
  223. package/src/statics/icons/childIcons//347/216/257/345/242/203@3x.png +0 -0
  224. package/src/statics/icons/childIcons//347/233/270/346/257/224@3x (1).png +0 -0
  225. package/src/statics/icons/childIcons//347/263/273/347/273/237@3x.png +0 -0
  226. package/src/statics/icons/childIcons//347/273/204/346/210/220@3x.png +0 -0
  227. package/src/statics/icons/childIcons//347/273/204/347/273/207@3x.png +0 -0
  228. package/src/statics/icons/childIcons//347/273/204/347/273/207/351/230/266/346/256/265@3x.png +0 -0
  229. package/src/statics/icons/childIcons//347/273/221/345/256/232/350/277/236/346/216/245/345/231/250@3x.png +0 -0
  230. package/src/statics/icons/childIcons//347/274/223/350/247/243@3x.png +0 -0
  231. package/src/statics/icons/childIcons//350/201/214/344/275/215@3x.png +0 -0
  232. package/src/statics/icons/childIcons//350/201/232/345/220/210@3x.png +0 -0
  233. package/src/statics/icons/childIcons//350/203/275/345/212/233@3x.png +0 -0
  234. package/src/statics/icons/childIcons//350/203/275/345/212/233/350/201/214/350/264/243@3x.png +0 -0
  235. package/src/statics/icons/childIcons//350/203/275/345/212/233/351/205/215/347/275/256@3x.png +0 -0
  236. package/src/statics/icons/childIcons//350/203/275/345/244/237/350/203/234/344/273/273@3x.png +0 -0
  237. package/src/statics/icons/childIcons//350/207/252/347/204/266/350/265/204/346/272/220@3x.png +0 -0
  238. package/src/statics/icons/childIcons//350/246/201/346/261/202@3x.png +0 -0
  239. package/src/statics/icons/childIcons//350/256/276/347/275/256/347/261/273/345/236/213.png +0 -0
  240. package/src/statics/icons/childIcons//350/264/237/350/264/243@3x.png +0 -0
  241. package/src/statics/icons/childIcons//350/264/243/344/273/273@3x.png +0 -0
  242. package/src/statics/icons/childIcons//350/265/204/344/272/247/351/243/216/351/231/251/346/230/240/345/260/204/347/237/251/351/230/265@3x.png +0 -0
  243. package/src/statics/icons/childIcons//350/265/204/346/272/220/344/270/216/344/270/232/345/212/241/346/264/273/345/212/250/346/230/240/345/260/204/347/237/251/351/230/265@3x.png +0 -0
  244. package/src/statics/icons/childIcons//350/265/204/346/272/220/344/270/216/350/203/275/345/212/233/346/230/240/345/260/204/347/237/251/351/230/265@3x.png +0 -0
  245. package/src/statics/icons/childIcons//350/265/204/346/272/220/344/277/241/345/217/267@3x.png +0 -0
  246. package/src/statics/icons/childIcons//350/265/204/346/272/220/344/277/241/346/201/257@3x.png +0 -0
  247. package/src/statics/icons/childIcons//350/265/204/346/272/220/344/277/241/346/201/257/345/233/276@3x.png +0 -0
  248. package/src/statics/icons/childIcons//350/265/204/346/272/220/345/206/205/351/203/250/346/265/201/347/250/213/345/233/276@3x.png +0 -0
  249. package/src/statics/icons/childIcons//350/265/204/346/272/220/345/206/205/351/203/250/350/277/236/351/200/232/345/233/276@3x.png +0 -0
  250. package/src/statics/icons/childIcons//350/265/204/346/272/220/345/212/250/344/275/234@3x.png +0 -0
  251. package/src/statics/icons/childIcons//350/265/204/346/272/220/345/217/202/346/225/260@3x.png +0 -0
  252. package/src/statics/icons/childIcons//350/265/204/346/272/220/345/217/202/346/225/260/345/233/276@3x.png +0 -0
  253. package/src/statics/icons/childIcons//350/265/204/346/272/220/345/267/245/344/273/266@3x.png +0 -0
  254. package/src/statics/icons/childIcons//350/265/204/346/272/220/346/216/245/345/217/243@3x.png +0 -0
  255. package/src/statics/icons/childIcons//350/265/204/346/272/220/346/234/215/345/212/241@3x.png +0 -0
  256. package/src/statics/icons/childIcons//350/265/204/346/272/220/346/236/266/346/236/204@3x.png +0 -0
  257. package/src/statics/icons/childIcons//350/265/204/346/272/220/346/246/202/345/277/265/345/233/276@3x.png +0 -0
  258. package/src/statics/icons/childIcons//350/265/204/346/272/220/346/246/202/345/277/265/350/241/250@3x.png +0 -0
  259. package/src/statics/icons/childIcons//350/265/204/346/272/220/346/264/273/345/212/250/346/265/201/347/250/213/345/233/276@3x.png +0 -0
  260. package/src/statics/icons/childIcons//350/265/204/346/272/220/346/264/273/345/212/250/347/273/223/346/236/204/345/233/276@3x.png +0 -0
  261. package/src/statics/icons/childIcons//350/265/204/346/272/220/346/265/201/347/250/213/345/233/276@3x.png +0 -0
  262. package/src/statics/icons/childIcons//350/265/204/346/272/220/347/212/266/346/200/201/345/233/276@3x.png +0 -0
  263. package/src/statics/icons/childIcons//350/265/204/346/272/220/347/253/257/345/217/243@3x.png +0 -0
  264. package/src/statics/icons/childIcons//350/265/204/346/272/220/347/272/246/346/235/237@3x.png +0 -0
  265. package/src/statics/icons/childIcons//350/265/204/346/272/220/347/273/223/346/236/204@3x.png +0 -0
  266. package/src/statics/icons/childIcons//350/265/204/346/272/220/347/273/223/346/236/204/345/233/276@3x.png +0 -0
  267. package/src/statics/icons/childIcons//350/265/204/346/272/220/347/274/223/350/247/243/346/216/252/346/226/275@3x.png +0 -0
  268. package/src/statics/icons/childIcons//350/265/204/346/272/220/350/247/222/350/211/262@3x.png +0 -0
  269. package/src/statics/icons/childIcons//350/265/204/346/272/220/350/277/236/346/216/245/345/231/250@3x.png +0 -0
  270. package/src/statics/icons/childIcons//350/265/204/346/272/220/350/277/236/351/200/232/345/233/276@3x.png +0 -0
  271. package/src/statics/icons/childIcons//350/265/204/346/272/220/350/277/236/351/200/232/350/241/250@3x.png +0 -0
  272. package/src/statics/icons/childIcons//350/275/257/344/273/266@3x.png +0 -0
  273. package/src/statics/icons/childIcons//350/276/223/345/205/245/346/240/223@3x.png +0 -0
  274. package/src/statics/icons/childIcons//350/276/223/345/207/272/346/240/223@3x.png +0 -0
  275. package/src/statics/icons/childIcons//350/276/276/345/210/260@3x.png +0 -0
  276. package/src/statics/icons/childIcons//350/277/236/346/216/245/345/231/250@3x.png +0 -0
  277. package/src/statics/icons/childIcons//350/277/236/347/272/277@3x.png +0 -0
  278. package/src/statics/icons/childIcons//351/207/214/347/250/213/347/242/221/344/276/235/350/265/226@3x.png +0 -0
  279. package/src/statics/icons/childIcons//351/230/266/346/256/265@3x.png +0 -0
  280. package/src/statics/icons/childIcons//351/234/200/346/261/202/346/235/203/351/231/220@3x.png +0 -0
  281. package/src/statics/icons/childIcons//351/241/266/347/272/247/344/270/232/345/212/241/346/246/202/345/277/265/345/233/276@3x.png +0 -0
  282. package/src/statics/icons/childIcons//351/241/271/347/233/256@3x.png +0 -0
  283. package/src/statics/icons/childIcons//351/241/271/347/233/256/344/270/273/351/242/230@3x.png +0 -0
  284. package/src/statics/icons/childIcons//351/241/271/347/233/256/345/206/205/351/203/250/346/265/201/347/250/213/345/233/276@3x.png +0 -0
  285. package/src/statics/icons/childIcons//351/241/271/347/233/256/346/246/202/345/277/265/345/233/276@3x.png +0 -0
  286. package/src/statics/icons/childIcons//351/241/271/347/233/256/346/246/202/345/277/265/350/241/250@3x.png +0 -0
  287. package/src/statics/icons/childIcons//351/241/271/347/233/256/346/264/273/345/212/250@3x.png +0 -0
  288. package/src/statics/icons/childIcons//351/241/271/347/233/256/346/264/273/345/212/250/344/270/216/350/203/275/345/212/233/347/232/204/346/230/240/345/260/204/347/237/251/351/230/265@3x.png +0 -0
  289. package/src/statics/icons/childIcons//351/241/271/347/233/256/346/264/273/345/212/250/345/212/250/344/275/234@3x.png +0 -0
  290. package/src/statics/icons/childIcons//351/241/271/347/233/256/346/265/201/347/250/213/345/233/276@3x.png +0 -0
  291. package/src/statics/icons/childIcons//351/241/271/347/233/256/347/273/223/346/236/204/345/233/276@3x.png +0 -0
  292. package/src/statics/icons/childIcons//351/241/271/347/233/256/350/247/222/350/211/262@3x.png +0 -0
  293. package/src/statics/icons/childIcons//351/241/271/347/233/256/350/267/257/347/272/277/345/233/276@3x.png +0 -0
  294. package/src/statics/icons/childIcons//351/241/271/347/233/256/350/277/236/351/200/232/345/233/276@3x.png +0 -0
  295. package/src/statics/icons/childIcons//351/241/271/347/233/256/351/207/214/347/250/213/347/242/221@3x.png +0 -0
  296. package/src/statics/icons/childIcons//351/241/271/347/233/256/351/207/214/347/250/213/347/242/221/350/247/222/350/211/262@3x.png +0 -0
  297. package/src/statics/icons/childIcons//351/241/272/345/272/217@3x-2.png +0 -0
  298. package/src/statics/icons/childIcons//351/241/272/345/272/217@3x.png +0 -0
  299. package/src/statics/icons/childIcons//351/243/216/351/231/251@3x.png +0 -0
  300. package/src/statics/icons/childIcons//351/243/216/351/231/251/344/270/216/345/256/211/345/205/250/346/216/247/345/210/266/346/230/240/345/260/204/347/237/251/351/230/265@3x.png +0 -0
  301. package/src/statics/icons/childIcons//351/253/230/347/272/247/344/270/232/345/212/241/346/246/202/345/277/265@3x.png +0 -0
  302. package/src/statics/icons/createMenu/config.png +0 -0
  303. package/src/statics/icons/createMenu/contact.png +0 -0
  304. package/src/statics/icons/createMenu/copy.png +0 -0
  305. package/src/statics/icons/createMenu/delete.png +0 -0
  306. package/src/statics/icons/createMenu/diagram.png +0 -0
  307. package/src/statics/icons/createMenu/element.png +0 -0
  308. package/src/statics/icons/createMenu/locateChart.png +0 -0
  309. package/src/statics/icons/createMenu/paste.png +0 -0
  310. package/src/statics/icons/createMenu/rename.png +0 -0
  311. package/src/statics/icons/createMenu/scissors.png +0 -0
  312. package/src/store/eventBus.ts +38 -0
  313. package/src/store/graphStore.ts +782 -0
  314. package/src/store/index.ts +8 -0
  315. package/src/style/index.css +1 -0
  316. package/src/style/tailwind.css +33 -0
  317. package/src/types/index.ts +200 -0
  318. package/src/utils/autoExpandParent.ts +94 -0
  319. package/src/utils/colorUtils.ts +137 -0
  320. package/src/utils/compartment.ts +534 -0
  321. package/src/utils/containers.ts +910 -0
  322. package/src/utils/diagram.ts +403 -0
  323. package/src/utils/dom.ts +21 -0
  324. package/src/utils/drag.ts +224 -0
  325. package/src/utils/edgeUtils.ts +787 -0
  326. package/src/utils/geom.ts +177 -0
  327. package/src/utils/graphDragService.ts +329 -0
  328. package/src/utils/highlightUtils.ts +162 -0
  329. package/src/utils/hittest.ts +135 -0
  330. package/src/utils/iconLoader.ts +105 -0
  331. package/src/utils/index.ts +20 -0
  332. package/src/utils/packgeMap.ts +1 -0
  333. package/src/utils/pinUtils.ts +484 -0
  334. package/src/utils/policy.ts +212 -0
  335. package/src/utils/zorder.ts +39 -0
  336. package/src/view/graph.vue +419 -0
  337. package/src/vite-env.d.ts +33 -0
@@ -0,0 +1,266 @@
1
+ <template>
2
+ <div
3
+ class="diagram-shape"
4
+ :style="shapeStyle"
5
+ @click="onClick"
6
+ @dblclick="onDoubleClick"
7
+ @mousedown="preventScaleAndDrag"
8
+ @touchstart="preventScaleAndDrag"
9
+ @touchmove="preventTouchScale"
10
+ @touchend="preventTouchScale"
11
+ @wheel="onWheel"
12
+ @contextmenu.prevent
13
+ >
14
+ <svg :width="vbW" :height="vbH" :viewBox="`0 0 ${vbW} ${vbH}`" class="diagram-svg">
15
+ <!-- 背景矩形 - 使用边框颜色,支持拖拽预览和正常显示 -->
16
+ <rect
17
+ :x="strokeWidth / 2"
18
+ :y="strokeWidth / 2"
19
+ :width="vbW - strokeWidth"
20
+ :height="vbH - strokeWidth"
21
+ fill="transparent"
22
+ :stroke="strokeColor"
23
+ :stroke-width="shouldShowBorder ? strokeWidth : 0"
24
+ stroke-alignment="outer"
25
+ rx="2"
26
+ />
27
+
28
+ <g v-if="!isGhost">
29
+ <!-- 图片区域 -->
30
+ <g v-if="showIcon" @click="onImageClick">
31
+ <image
32
+ :x="(vbW - imageWidth) / 2"
33
+ :y="imageTopPadding"
34
+ :width="imageWidth"
35
+ :height="imageHeight"
36
+ :href="getIcon('childIcons', shape.icon || '')"
37
+ style="cursor: pointer;"
38
+ />
39
+ </g>
40
+ </g>
41
+ </svg>
42
+ </div>
43
+ </template>
44
+
45
+ <script setup lang="ts">
46
+ import { computed, nextTick, watch, onMounted, onUnmounted, type CSSProperties } from 'vue'
47
+ import type { Shape } from '../../types'
48
+ import { getIcon } from "../../utils/iconLoader";
49
+ // 引入graphStore来更新shapes中的bounds值
50
+ import { useGraphStore } from '../../store/graphStore'
51
+
52
+ // Props
53
+ interface Props {
54
+ shape: Shape
55
+ }
56
+
57
+ const emit = defineEmits<{
58
+ (e: 'shape-click', shape: Shape, event: MouseEvent): void
59
+ (e: 'image-click', shape: Shape, event: MouseEvent): void
60
+ (e: 'name-click', shape: Shape, event: MouseEvent): void
61
+ }>()
62
+
63
+ const props = defineProps<Props>()
64
+
65
+ // 获取graphStore实例
66
+ const graphStore = useGraphStore()
67
+
68
+ // 交互层在拖拽/缩放时会给 shape.meta.isGhost = true
69
+ const isGhost = computed(() => (props.shape as any).meta?.isGhost)
70
+
71
+ // 轮廓颜色(边框颜色)- 支持从style.borderColor获取,实现边框颜色回显
72
+ const strokeColor = computed(() =>
73
+ props.shape.style?.borderColor ?? '#8a6d3b'
74
+ )
75
+
76
+ // 轮廓线宽 - 支持动态调整,拖拽预览时显示较粗边框
77
+ const strokeWidth = computed(() =>
78
+ isGhost.value ? 4 : (props.shape.style?.borderWidth ?? 0.5)
79
+ )
80
+
81
+ const vbW = computed(() => props.shape.bounds.width || 30)
82
+ const vbH = computed(() => props.shape.bounds.height || 30)
83
+
84
+ // 图片尺寸 - 设置固定值,不受外部缩放影响
85
+ const imageWidth = computed(() => 30)
86
+ const imageHeight = computed(() => 30)
87
+
88
+ // 图片顶部边距
89
+ const imageTopPadding = computed(() =>0)
90
+
91
+ // 是否显示图标
92
+ const showIcon = computed(() => props.shape.showIcon)
93
+
94
+ // 计算是否应该显示边框 - 只有当边框颜色被明确设置时才显示
95
+ const shouldShowBorder = computed(() => {
96
+ // 如果处于拖拽预览状态,总是显示边框
97
+ if (isGhost.value) return true
98
+
99
+ // 只有当边框颜色被明确设置(不是默认值)时才显示边框
100
+ return props.shape.style?.borderColor !== undefined && props.shape.style?.borderColor !== null
101
+ })
102
+
103
+ // 更新图元的bounds尺寸,强制设置固定尺寸,但避免触发无限循环
104
+ const updateShapeBounds = async () => {
105
+ await nextTick();
106
+
107
+ // 检查当前尺寸是否已经是我们期望的固定尺寸
108
+ // 只有在真正需要更新时才调用graphStore.updateShape
109
+ const currentBounds = props.shape.bounds;
110
+ if (!currentBounds ||
111
+ currentBounds.width !== vbW.value ||
112
+ currentBounds.height !== vbH.value) {
113
+
114
+ // 强制使用固定尺寸,完全忽略外部缩放
115
+ // 只更新x/y坐标和固定的宽高
116
+ graphStore.updateShape(props.shape.id, {
117
+ bounds: {
118
+ x: currentBounds?.x || 0,
119
+ y: currentBounds?.y || 0,
120
+ width: vbW.value, // 固定宽度
121
+ height: vbH.value // 固定高度
122
+ }
123
+ });
124
+ }
125
+ };
126
+
127
+ // 使用requestAnimationFrame来安全地恢复尺寸,避免无限循环
128
+ let isUpdating = false;
129
+
130
+ // 安全的更新尺寸函数
131
+ const safeUpdateShapeBounds = () => {
132
+ // 防止重复调用
133
+ if (isUpdating) return;
134
+
135
+ isUpdating = true;
136
+
137
+ // 使用requestAnimationFrame确保在下一帧更新,避免阻塞UI
138
+ requestAnimationFrame(async () => {
139
+ await updateShapeBounds();
140
+ // 更新完成后重置标志
141
+ isUpdating = false;
142
+ });
143
+ };
144
+
145
+ // 监听bounds变化,但使用浅监听避免深度递归
146
+ // 只比较引用变化,不比较内部属性的深层变化
147
+ watch(() => props.shape.bounds, () => {
148
+ // 当bounds引用变化时(可能是外部缩放导致的),安全地恢复尺寸
149
+ safeUpdateShapeBounds();
150
+ }, { deep: false }); // 使用浅监听
151
+
152
+ // 监听showIcon变化时安全地更新尺寸
153
+ watch(() => props.shape.showIcon, () => {
154
+ safeUpdateShapeBounds();
155
+ });
156
+
157
+ // 添加一个定期检查机制,确保尺寸不会被长时间改变
158
+ let checkInterval: number | null = null;
159
+
160
+ onMounted(() => {
161
+ // 初始设置固定尺寸
162
+ updateShapeBounds();
163
+
164
+ // 设置定期检查,每500ms检查一次尺寸是否被改变
165
+ checkInterval = window.setInterval(() => {
166
+ const currentBounds = props.shape.bounds;
167
+ if (currentBounds && (currentBounds.width !== vbW.value || currentBounds.height !== vbH.value)) {
168
+ safeUpdateShapeBounds();
169
+ }
170
+ }, 500);
171
+ });
172
+
173
+ // 在组件卸载时清理定时器
174
+ onUnmounted(() => {
175
+ if (checkInterval) {
176
+ window.clearInterval(checkInterval);
177
+ }
178
+ });
179
+
180
+ // 只在组件挂载时设置一次尺寸,避免持续监听导致的循环
181
+
182
+ // 形状样式 - 使用固定尺寸,避免影响性能
183
+ const shapeStyle = computed<CSSProperties>(() => {
184
+ const { x = 0, y = 0 } = props.shape.bounds || {}
185
+
186
+ return {
187
+ position: 'absolute',
188
+ left: `${x}px`,
189
+ top: `${y}px`,
190
+ width: `${vbW.value}px`, // 固定宽度
191
+ height: `${vbH.value}px`, // 固定高度
192
+ zIndex: (props.shape.style?.zIndex as number) ?? 0,
193
+ }
194
+ })
195
+
196
+ const onClick = (event: MouseEvent) => {
197
+ event.stopPropagation();
198
+ event.preventDefault();
199
+ emit('shape-click', props.shape, event)
200
+ }
201
+
202
+ const onDoubleClick = (event: MouseEvent) => {
203
+ event.stopPropagation();
204
+ event.preventDefault();
205
+ }
206
+
207
+ // 阻止拖拽和缩放相关的事件
208
+ const preventScaleAndDrag = (event: Event) => {
209
+ event.stopPropagation();
210
+ event.preventDefault();
211
+ }
212
+
213
+ // 阻止触摸缩放事件
214
+ const preventTouchScale = (event: TouchEvent) => {
215
+ // 阻止多点触控缩放
216
+ if (event.touches.length > 1) {
217
+ event.stopPropagation();
218
+ event.preventDefault();
219
+ }
220
+ }
221
+
222
+ // 阻止鼠标滚轮缩放 - 完全禁用缩放功能
223
+ const onWheel = (event: WheelEvent) => {
224
+ // 完全阻止所有滚轮事件,包括缩放
225
+ event.stopPropagation();
226
+ event.preventDefault();
227
+ }
228
+
229
+ const onImageClick = (event: MouseEvent) => {
230
+ event.stopPropagation()
231
+ emit('image-click', props.shape, event)
232
+ }
233
+
234
+ const onNameClick = (event: MouseEvent) => {
235
+ event.stopPropagation()
236
+ emit('name-click', props.shape, event)
237
+ }
238
+ </script>
239
+
240
+ <style scoped>
241
+ .diagram-shape {
242
+ user-select: none;
243
+ -webkit-user-select: none;
244
+ -moz-user-select: none;
245
+ -ms-user-select: none;
246
+ pointer-events: auto;
247
+ /* 阻止拖拽缩放的CSS属性 */
248
+ touch-action: none;
249
+ -webkit-touch-action: none;
250
+ -ms-touch-action: none;
251
+ /* 完全禁用缩放 */
252
+ zoom: 1;
253
+ transform: none !important;
254
+ -webkit-transform: none !important;
255
+ -moz-transform: none !important;
256
+ -ms-transform: none !important;
257
+ }
258
+
259
+ .diagram-svg {
260
+ width: 100%;
261
+ height: 100%;
262
+ /* 禁用SVG内部的缩放 */
263
+ transform: none !important;
264
+ -webkit-transform: none !important;
265
+ }
266
+ </style>
@@ -0,0 +1,220 @@
1
+ <template>
2
+ <div class="diagram-shape" :style="shapeStyle" @click="onClick">
3
+ <svg :width="vbW" :height="vbH" :viewBox="`0 0 ${vbW} ${vbH}`" class="diagram-svg">
4
+ <!-- 拖拽预览时显示边框,正常显示时不显示 -->
5
+ <rect
6
+ v-if="isGhost"
7
+ :x="strokeWidth / 2"
8
+ :y="strokeWidth / 2"
9
+ :width="vbW - strokeWidth"
10
+ :height="vbH - strokeWidth"
11
+ fill="transparent"
12
+ :stroke="strokeColor"
13
+ :stroke-width="strokeWidth"
14
+ stroke-alignment="outer"
15
+ rx="2"
16
+ />
17
+
18
+ <g v-if="!isGhost">
19
+ <!-- 图片区域 -->
20
+ <g v-if="showIcon" @click="onImageClick">
21
+ <image
22
+ :x="(vbW - imageWidth) / 2"
23
+ :y="imageTopPadding"
24
+ :width="imageWidth"
25
+ :height="imageHeight"
26
+ :href="getIcon('childIcons', shape.icon || '')"
27
+ style="cursor: pointer;"
28
+ />
29
+ </g>
30
+
31
+ <!-- 名称文本区域 - 图片下方居中显示 -->
32
+ <text
33
+ :x="'50%'"
34
+ :y="textYPosition"
35
+ text-anchor="middle"
36
+ :font-family="nameStyle.fontFamily || '思源黑体'"
37
+ :font-size="nameStyle.fontSize || 12"
38
+ :font-weight="nameStyle.fontWeight || 'bold'"
39
+ :fill="nameStyle.color || '#000000'"
40
+ style="cursor: pointer;"
41
+ @click="onNameClick"
42
+ >
43
+ {{ shape.name }}
44
+ </text>
45
+ </g>
46
+ </svg>
47
+ </div>
48
+ </template>
49
+
50
+ <script setup lang="ts">
51
+ import { computed, nextTick, watch, onMounted, type CSSProperties } from 'vue'
52
+ import type { Shape } from '../../types'
53
+ import { getIcon } from "../../utils/iconLoader";
54
+ // 引入graphStore来更新shapes中的bounds值
55
+ import { useGraphStore } from '../../store/graphStore'
56
+
57
+ // Props
58
+ interface Props {
59
+ shape: Shape
60
+ }
61
+
62
+ const emit = defineEmits<{
63
+ (e: 'shape-click', shape: Shape, event: MouseEvent): void
64
+ (e: 'image-click', shape: Shape, event: MouseEvent): void
65
+ (e: 'name-click', shape: Shape, event: MouseEvent): void
66
+ }>()
67
+
68
+ const props = defineProps<Props>()
69
+
70
+ // 获取graphStore实例
71
+ const graphStore = useGraphStore()
72
+
73
+ // 交互层在拖拽/缩放时会给 shape.meta.isGhost = true
74
+ const isGhost = computed(() => (props.shape as any).meta?.isGhost)
75
+
76
+ // 轮廓颜色(边框颜色)- 只在拖拽预览时使用,与其他组件保持一致
77
+ const strokeColor = computed(() => {
78
+ return '#8a6d3b'
79
+ })
80
+
81
+ // 轮廓线宽 - 只在拖拽预览时使用
82
+ const strokeWidth = computed(() => {
83
+ return 4
84
+ })
85
+
86
+ // 视图框宽度和高度
87
+ const vbW = computed(() => props.shape.bounds?.width || 100)
88
+ const vbH = computed(() => props.shape.bounds?.height || 120)
89
+
90
+ // 图片尺寸
91
+ const imageWidth = computed(() => Math.min(vbW.value * 0.6, 35))
92
+ const imageHeight = computed(() => Math.min(vbH.value * 0.5, 35))
93
+
94
+ // 图片顶部边距
95
+ const imageTopPadding = computed(() => 5)
96
+
97
+ // 文本Y坐标位置 - 图片下方居中
98
+ const textYPosition = computed(() => {
99
+ return imageTopPadding.value + imageHeight.value + 20
100
+ })
101
+
102
+ // 是否显示图标
103
+ const showIcon = computed(() => props.shape.showIcon)
104
+
105
+ // 名称样式
106
+ const nameStyle = computed(() => {
107
+ if (props.shape.nameStyle) {
108
+ return typeof props.shape.nameStyle === 'string'
109
+ ? JSON.parse(props.shape.nameStyle)
110
+ : props.shape.nameStyle
111
+ }
112
+ return {}
113
+ })
114
+
115
+ // 计算文本内容的估计宽度(基于字符数和字体大小)
116
+ const estimatedTextWidth = computed(() => {
117
+ // 获取字体大小
118
+ const fontSize = nameStyle.value.fontSize || 12;
119
+ // 假设每个字符的平均宽度是字体大小的1倍
120
+ const charWidth = fontSize * 1;
121
+
122
+ // 计算名称文本的宽度
123
+ const nameTextWidth = (props.shape.name?.length || 0) * charWidth;
124
+
125
+ // 返回文本宽度,并添加一些边距(左右各10px)
126
+ const textWidth = nameTextWidth + 60; // 左右各10px边距
127
+
128
+ // 确保最小宽度不小于图片宽度和一些额外空间
129
+ return Math.max(textWidth, imageWidth.value + 40);
130
+ });
131
+
132
+ // 更新图元的bounds宽度
133
+ const updateShapeBounds = async () => {
134
+ await nextTick();
135
+
136
+ const requiredWidth = estimatedTextWidth.value;
137
+ const currentWidth = props.shape.bounds?.width || 100;
138
+
139
+ // 只有当文本所需宽度大于当前宽度时才更新
140
+ if (requiredWidth > currentWidth) {
141
+ graphStore.updateShape(props.shape.id, {
142
+ bounds: {
143
+ ...props.shape.bounds,
144
+ width: requiredWidth
145
+ }
146
+ });
147
+ }
148
+ };
149
+
150
+ // 组件挂载时更新一次宽度
151
+ onMounted(() => {
152
+ updateShapeBounds();
153
+ });
154
+
155
+ // 监听name变化时更新宽度并重新选择图元
156
+ watch(() => props.shape.name, () => {
157
+ updateShapeBounds();
158
+ // 只有当当前图元被选中时,才执行清空选择并重新选择的操作
159
+ if (graphStore.selectedShape?.id === props.shape.id) {
160
+ graphStore.clearSelection();
161
+ nextTick(() => {
162
+ graphStore.selectShape(props.shape);
163
+ });
164
+ }
165
+ });
166
+
167
+ // 监听字体样式变化时更新宽度
168
+ watch(() => nameStyle.value.fontSize, () => {
169
+ updateShapeBounds();
170
+ }, { deep: true });
171
+
172
+ // 监听bounds变化(如缩放操作后),确保宽度始终满足文本显示需求
173
+ watch(() => props.shape.bounds?.width, (newWidth) => {
174
+ if (newWidth !== undefined) {
175
+ updateShapeBounds();
176
+ }
177
+ });
178
+
179
+ // 形状样式
180
+ const shapeStyle = computed<CSSProperties>(() => {
181
+ const { x = 0, y = 0 } = props.shape.bounds || {}
182
+ // 确保宽度不小于文本所需的最小宽度
183
+ const width = Math.max(estimatedTextWidth.value, props.shape.bounds?.width || 100);
184
+
185
+ return {
186
+ position: 'absolute',
187
+ left: `${x}px`,
188
+ top: `${y}px`,
189
+ width: `${width}px`,
190
+ height: `${vbH.value}px`,
191
+ cursor: 'pointer'
192
+ }
193
+ })
194
+
195
+ // 点击事件处理
196
+ const onClick = (event: MouseEvent) => {
197
+ emit('shape-click', props.shape, event)
198
+ }
199
+
200
+ const onImageClick = (event: MouseEvent) => {
201
+ event.stopPropagation()
202
+ emit('image-click', props.shape, event)
203
+ }
204
+
205
+ const onNameClick = (event: MouseEvent) => {
206
+ event.stopPropagation()
207
+ emit('name-click', props.shape, event)
208
+ }
209
+ </script>
210
+
211
+ <style scoped>
212
+ .diagram-shape {
213
+ user-select: none;
214
+ }
215
+
216
+ .diagram-svg {
217
+ width: 100%;
218
+ height: 100%;
219
+ }
220
+ </style>