@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,594 @@
1
+ <template>
2
+ <div :style="bounds">
3
+ <!-- 确保SVG始终有足够的宽度显示所有内容 -->
4
+ <svg class="capability-shape" :width="bounds.width" :height="bounds.height" preserveAspectRatio="xMinYMin meet">
5
+ <!-- 定义渐变 -->
6
+ <defs>
7
+ <linearGradient :id="`gradient-${shape.id}`" x1="0%" y1="0%" x2="100%" y2="0%">
8
+ <stop offset="0%" :stop-color="gradientLeftColor" />
9
+ <stop offset="75%" :stop-color="gradientMiddleColor" />
10
+ <stop offset="100%" :stop-color="gradientRightColor" />
11
+ </linearGradient>
12
+ </defs>
13
+
14
+ <!-- 背景矩形 - 边框在外部方向,位置和尺寸根据边框宽度调整 -->
15
+ <rect :x="strokeWidth / 2" :y="strokeWidth / 2" :width="bounds.width - strokeWidth"
16
+ :height="bounds.height - strokeWidth" :rx="2" :ry="2"
17
+ :fill="isGhost ? 'transparent' : `url(#gradient-${shape.id})`" :stroke="strokeColor" :stroke-width="strokeWidth"
18
+ stroke-alignment="outer" />
19
+
20
+ <!-- 头部区域 -->
21
+ <g v-show="!isGhost">
22
+ <!-- 头部下划线 -->
23
+ <line x1="0" :y1="65" x2="100%" :y2="65" :stroke="strokeColor" stroke-width="0.5" />
24
+
25
+ <!-- 关键词和图标区域 -->
26
+ <g @click.stop="emit('name-click', shape, $event)" cursor="pointer">
27
+ <!-- 关键词文本 -->
28
+ <foreignObject :x="10" :y="5" :width="bounds.width - 20"
29
+ :height="Math.max(20, (keywordsStyle.fontSize || 12) * 1.5)">
30
+ <div class="name-text-svg" :style="{
31
+ fontSize: `${keywordsStyle.fontSize || keywordsBounds.height || 12}px`,
32
+ fontFamily: keywordsStyle.fontFamily || '思源黑体',
33
+ fontWeight: keywordsStyle.fontWeight || 'normal',
34
+ color: keywordsStyle.color || '#000000',
35
+ lineHeight: '1',
36
+ }">
37
+ {{ shape.keywords }}
38
+ </div>
39
+ </foreignObject>
40
+
41
+ <!-- 图标 -->
42
+ <image v-if="showIcon" :x="bounds.width - 30" :y="5" :width="20" :height="20"
43
+ :href="getIcon('childIcons', shape.icon || '')" />
44
+
45
+ <!-- 名称文本 -->
46
+ <foreignObject :x="0" :y="31" :width="bounds.width" :height="20">
47
+ <div class="shape-name-svg" :style="{
48
+ fontSize: `${nameStyle.fontSize || nameBounds.height || 12}px`,
49
+ fontFamily: nameStyle.fontFamily || '思源黑体',
50
+ fontWeight: nameStyle.fontWeight || 'bold',
51
+ color: nameStyle.color || '#000000',
52
+ lineHeight: '1',
53
+ }">
54
+ {{ shape.name }}
55
+ </div>
56
+ </foreignObject>
57
+ </g>
58
+ </g>
59
+
60
+ <!-- 内容区域 - 只在非拖拽预览状态显示 -->
61
+ <foreignObject v-show="!isGhost" :x="12" :y="headerHeight + 15" :width="bounds.width - 24" :height="contentHeight"
62
+ @click.stop="emit('keywords-click', shape, $event)">
63
+ <div class="content-text-svg" ref="contentRef">
64
+ <div v-for="value in shape.taggedValueLabels" :key="value.id" class="content-item" v-html="value.name"></div>
65
+ </div>
66
+ </foreignObject>
67
+ </svg>
68
+ </div>
69
+ </template>
70
+
71
+ <script setup lang="ts">
72
+ import { computed, ref, onMounted, nextTick, onBeforeUnmount, watch } from 'vue'
73
+ import type { Shape } from '../../types'
74
+ import { getIcon } from "../../utils/iconLoader";
75
+ import { setCompartmentZones, type Rect } from '../../utils/compartment';
76
+ import { adjustColorLightness } from '../../utils/colorUtils'
77
+ import { useGraphStore } from '../../store';
78
+ import { eventBus } from '../../store/eventBus';
79
+ import { debounce } from 'lodash';
80
+
81
+ // 组件Props定义
82
+ interface Props {
83
+ shape: Shape
84
+ upperHeight?: number
85
+ }
86
+ const emit = defineEmits<{
87
+ (e: 'shape-click', shape: Shape, event: MouseEvent): void
88
+ (e: 'keywords-click', shape: Shape, event: MouseEvent): void
89
+ (e: 'name-click', shape: Shape, event: MouseEvent): void
90
+ (e: 'update:keywords', value: string, shape: Shape): void
91
+ (e: 'compartment-metrics', payload: { headerH: number; contentH: number }, shape: Shape): void
92
+ }>()
93
+ const props = defineProps<Props>()
94
+ const graphStore = useGraphStore()
95
+
96
+ // 状态管理
97
+ const isResizing = ref(false);
98
+ const isGhost = computed(() => (props.shape as any).meta?.isGhost)
99
+ const lastHeight = ref<number | null>(null); // 记录上一次高度,用于防循环
100
+ // 定义底部边距
101
+ const bottomMargin = 10; // 下半区域底部额外边距(单位:px)
102
+
103
+ // 样式计算
104
+ const strokeColor = computed(() => props.shape.style?.borderColor ?? '#8a6d3b')
105
+ const strokeWidth = computed(() => {
106
+ // 拖拽预览时边框宽度为4,正常状态使用配置的边框宽度
107
+ return isGhost.value ? 4 : (props.shape.style?.borderWidth ?? 0.5)
108
+ })
109
+
110
+ // 渐变背景色计算(基于填充色)
111
+ const baseColor = computed(() => props.shape.keywordsStyle?.backgroundColor || '#e3f2fd')
112
+ const gradientLeftColor = computed(() => adjustColorLightness(baseColor.value, 10))
113
+ const gradientMiddleColor = computed(() => baseColor.value)
114
+ const gradientRightColor = computed(() => adjustColorLightness(baseColor.value, 28))
115
+
116
+ // 文本相关属性
117
+ const showIcon = computed(() => props.shape.showIcon || false)
118
+ // 获取 keywordsBounds 和 nameBounds
119
+ const keywordsBounds = computed(() => props.shape.keywordsBounds || {})
120
+ const nameBounds = computed(() => props.shape.nameBounds || {})
121
+
122
+ // 获取 keywordsStyle 和 nameStyle
123
+ const keywordsStyle = computed(() => props.shape.keywordsStyle || {})
124
+ const nameStyle = computed(() => props.shape.nameStyle || {})
125
+
126
+ // 计算关键词文本的foreignObject高度
127
+ const keywordsForeignObjectHeight = computed(() => {
128
+ return Math.max(20, (keywordsStyle.value.fontSize || 12) * 1.5);
129
+ });
130
+
131
+ // 计算名称文本的foreignObject高度
132
+ const nameForeignObjectHeight = computed(() => {
133
+ return Math.max(20, (nameStyle.value.fontSize || 12) * 1.5);
134
+ });
135
+
136
+ // 计算文本内容的估计宽度(基于字符数和字体大小)
137
+ const estimatedTextWidth = computed(() => {
138
+ // 获取字体大小
139
+ const nameFontSize = nameStyle.value.fontSize || nameBounds.value.height || 12;
140
+ const keywordsFontSize = keywordsStyle.value.fontSize || keywordsBounds.value.height || 12;
141
+
142
+ // 假设每个字符的平均宽度是字体大小的1倍
143
+ const nameCharWidth = nameFontSize * 1;
144
+ const keywordsCharWidth = keywordsFontSize * 1;
145
+
146
+ // 计算名称文本的宽度
147
+ const nameTextWidth = (props.shape.name?.length || 0) * nameCharWidth;
148
+ // 计算关键词文本的宽度
149
+ const keywordsTextWidth = (props.shape.keywords?.length || 0) * keywordsCharWidth;
150
+
151
+ // 返回较大的宽度,并添加一些边距(左右各20px)
152
+ const maxTextWidth = Math.max(nameTextWidth, keywordsTextWidth);
153
+ return maxTextWidth + 40; // 左右各20px边距
154
+ });
155
+
156
+ // 获取边界信息
157
+ const bounds = computed(() => {
158
+ // 即使在缩放状态下也应用最小宽度保护,确保预览框右边不显示的问题
159
+ let width = props.shape.bounds?.width || 120;
160
+ // 确保始终保持最小宽度,防止缩小时右边内容被截断
161
+ const minWidth = Math.max(estimatedTextWidth.value, 120); // 设置一个基础最小宽度120
162
+ width = Math.max(minWidth, width);
163
+ return {
164
+ width: width,
165
+ height: props.shape.bounds?.height || 80,
166
+ zIndex: (props.shape.style?.zIndex as number) ?? 0,
167
+ }
168
+ })
169
+ // 头部高度计算
170
+ const headerHeight = computed(() => {
171
+ // 基于内容估算头部高度
172
+ const hasKeywords = !!props.shape.keywords;
173
+ const hasName = !!props.shape.name;
174
+ if (!hasKeywords && !hasName) return 40;
175
+
176
+ let height = 5; // 顶部边距
177
+ if (hasKeywords) {
178
+ height += keywordsForeignObjectHeight.value;
179
+ if (hasName) {
180
+ height += 1; // keywords和name之间的原始间距
181
+ }
182
+ }
183
+ if (hasName) {
184
+ height += nameForeignObjectHeight.value;
185
+ }
186
+
187
+ height += 10; // 底部边距
188
+
189
+ // 确保最小高度,同时考虑字体大小可能较大的情况
190
+ const fontSizeBasedMinHeight = Math.max(
191
+ hasKeywords ? (keywordsStyle.value.fontSize || 12) * 2 : 0,
192
+ hasName ? (nameStyle.value.fontSize || 12) * 2 : 0
193
+ ) + (hasKeywords && hasName ? 11 : 10); // 基础间距
194
+
195
+ // 确保最小高度
196
+ return Math.max(height, fontSizeBasedMinHeight, 40);
197
+ })
198
+
199
+ // 响应式状态管理
200
+ const actualContentHeight = ref<number>(0); // 实际内容高度
201
+ const contentRef = ref<HTMLElement | null>(null);
202
+
203
+ // 内容区域高度计算
204
+ const contentHeight = computed(() => {
205
+ // 计算内容实际需要的最小高度
206
+ if (actualContentHeight.value > 0) {
207
+ return actualContentHeight.value + bottomMargin; // 实际内容高度+边距
208
+ }
209
+
210
+ // 估算值:每个项目约20px高度,加上底部边距
211
+ const itemCount = props.shape.taggedValueLabels?.length || 0;
212
+ return Math.max(20, itemCount * 20 + bottomMargin);
213
+ })
214
+
215
+ // 内容区域定义(用于compartment功能)
216
+ const contentZone = computed(() => ({
217
+ x: (props.shape.bounds?.x || 0) + 12,
218
+ y: (props.shape.bounds?.y || 0) + headerHeight.value + 10, // 调整间距以匹配下划线位置
219
+ width: (props.shape.bounds?.width || 0) - 24,
220
+ height: contentHeight.value
221
+ }))
222
+
223
+ // 上半部分高度计算逻辑
224
+ const reportMetrics = () => {
225
+ const hh = headerHeight.value;
226
+ const cc = contentHeight.value;
227
+
228
+ // 防止无限循环:只有当高度实际发生变化时才更新
229
+ const currentHeight = hh + cc;
230
+ if (lastHeight.value !== null && lastHeight.value === currentHeight) {
231
+ return;
232
+ }
233
+ lastHeight.value = currentHeight;
234
+
235
+ // 避免直接修改props,使用emit传递需要的信息
236
+ emit('compartment-metrics', { headerH: hh, contentH: cc }, props.shape);
237
+
238
+ // 计算区域划分
239
+ const b = props.shape.bounds
240
+ if (
241
+ !b ||
242
+ b.x == null ||
243
+ b.y == null ||
244
+ b.width == null ||
245
+ b.height == null
246
+ ) {
247
+ return
248
+ }
249
+
250
+ const divider = 1, PAD_TOP = 6, INSET = 6;
251
+ const header: Rect = {
252
+ x: b.x,
253
+ y: b.y,
254
+ width: b.width,
255
+ height: hh + 5 // 增加header高度以匹配下移的下划线
256
+ };
257
+
258
+ const top = b.y + hh + 5 + divider + cc + PAD_TOP; // 考虑下划线下移5px
259
+ const childrenArea: Rect = {
260
+ x: b.x + INSET,
261
+ y: top,
262
+ width: Math.max(0, b.width - 2 * INSET),
263
+ height: Math.max(0, b.y + b.height - INSET - top)
264
+ };
265
+
266
+ const parentBounds: Rect = {
267
+ x: b.x,
268
+ y: b.y,
269
+ width: b.width,
270
+ height: b.height
271
+ };
272
+
273
+ setCompartmentZones(props.shape.id, {
274
+ header,
275
+ content: contentZone.value,
276
+ childrenArea,
277
+ parentBounds
278
+ });
279
+ }
280
+
281
+ // 测量实际内容高度并更新组件
282
+ const measureContentHeight = () => {
283
+ if (!contentRef.value) return;
284
+
285
+ // 强制重新计算内容尺寸,特别是在宽度变化的情况下
286
+ contentRef.value.style.width = '100%'; // 确保内容区域宽度正确
287
+ contentRef.value.style.height = 'auto'; // 重置高度以测量实际需要的高度
288
+
289
+ // 获取实际内容高度
290
+ const actualHeight = contentRef.value.scrollHeight;
291
+ if (actualHeight !== actualContentHeight.value) {
292
+ actualContentHeight.value = actualHeight;
293
+ nextTick(() => {
294
+ updateShapeBounds()
295
+ debouncedReportMetrics()
296
+ })
297
+
298
+ }
299
+ };
300
+
301
+ // 更新组件宽度和高度
302
+ const updateShapeBounds = () => {
303
+ // 计算内容所需的最小总高度
304
+ const minTotalHeight = headerHeight.value + 15 + contentHeight.value + 10; // 加上一些额外空间
305
+
306
+ // 设置一个基于字体大小的最小高度,确保字体较大时组件也能正常显示
307
+ const fontSizeBasedMinHeight = Math.max(
308
+ (keywordsStyle.value.fontSize || 12) * 3,
309
+ (nameStyle.value.fontSize || 12) * 3
310
+ ) + 50; // 基于字体大小的最小高度 + 内容区域基本高度
311
+
312
+ // 设置一个明确的最小高度限制,确保组件不会太小
313
+ const explicitMinHeight = 110; // 明确的最小高度值,不小于100
314
+ const effectiveMinHeight = Math.max(minTotalHeight, fontSizeBasedMinHeight, explicitMinHeight);
315
+
316
+ // 获取当前组件尺寸
317
+ const currentWidth = props.shape.bounds?.width || 0;
318
+ const currentHeight = props.shape.bounds?.height || 0;
319
+
320
+ // 获取所需宽度,确保包含文本内容和图标
321
+ const requiredWidth = Math.max(estimatedTextWidth.value, 120); // 确保至少有120的宽度
322
+
323
+ // 准备更新的属性
324
+ const updates: any = {};
325
+
326
+ // 重要:无论是否在缩放中,都确保组件高度至少达到有效最小高度
327
+ // 这可以防止预览框在缩放过程中变得太小
328
+ if (currentHeight < effectiveMinHeight) {
329
+ updates.height = effectiveMinHeight;
330
+ }
331
+
332
+ // 无论是否在缩放中,都确保宽度至少达到所需宽度
333
+ // 这可以防止缩小时预览框右边不显示
334
+ if (currentWidth < requiredWidth) {
335
+ updates.width = requiredWidth;
336
+ }
337
+
338
+ // 如果有更新,则应用
339
+ if (Object.keys(updates).length > 0) {
340
+ graphStore.updateShape(props.shape.id, {
341
+ bounds: {
342
+ ...props.shape.bounds,
343
+ ...updates
344
+ }
345
+ });
346
+ }
347
+ };
348
+
349
+ // 添加额外的尺寸保护,在拖拽结束后强制检查最小尺寸
350
+ const enforceMinSizeOnResizeEnd = () => {
351
+ handleDragEnd();
352
+ // 强制应用最小尺寸,确保即使在缩放过程中也能保持最小高度和宽度
353
+ nextTick(() => {
354
+ // 获取当前组件尺寸
355
+ const currentHeight = props.shape.bounds?.height || 0;
356
+ const currentWidth = props.shape.bounds?.width || 0;
357
+ const explicitMinHeight = 110;
358
+ const explicitMinWidth = 120; // 设置明确的最小宽度
359
+
360
+ const updates: any = {};
361
+
362
+ // 如果当前高度小于最小高度,立即更新
363
+ if (currentHeight < explicitMinHeight) {
364
+ updates.height = explicitMinHeight;
365
+ }
366
+
367
+ // 如果当前宽度小于最小宽度,立即更新,确保预览框右边显示完整
368
+ if (currentWidth < explicitMinWidth) {
369
+ updates.width = explicitMinWidth;
370
+ }
371
+
372
+ // 如果有高度或宽度更新,立即应用
373
+ if (Object.keys(updates).length > 0) {
374
+ graphStore.updateShape(props.shape.id, {
375
+ bounds: {
376
+ ...props.shape.bounds,
377
+ ...updates
378
+ }
379
+ });
380
+ }
381
+
382
+ // 然后再运行常规的更新逻辑
383
+ updateShapeBounds();
384
+ });
385
+ };
386
+
387
+ // 创建防抖版本的updateShapeBounds函数
388
+ const debouncedUpdateShapeBounds = debounce(updateShapeBounds, 100);
389
+
390
+ // 监听尺寸变化,更新compartment区域
391
+ const debouncedReportMetrics = debounce(reportMetrics, 100);
392
+ const debouncedMeasureContentHeight = debounce(measureContentHeight, 100);
393
+
394
+ // 监听拖拽缩放事件
395
+ const handleDragStart = () => {
396
+ isResizing.value = true;
397
+ };
398
+
399
+ const handleDragEnd = () => {
400
+ isResizing.value = false;
401
+ nextTick(() => reportMetrics());
402
+ };
403
+
404
+ // 初始化和事件监听
405
+ onMounted(() => {
406
+ // 初始计算
407
+ nextTick(() => {
408
+ reportMetrics();
409
+ // 初始测量内容高度
410
+ setTimeout(measureContentHeight, 0);
411
+ // 初始更新图元尺寸
412
+ updateShapeBounds();
413
+ });
414
+
415
+ // 事件总线监听
416
+ eventBus.on('shape-drag-start', handleDragStart);
417
+ eventBus.on('shape-drag-end', handleDragEnd);
418
+ eventBus.on('shape-resize-start', handleDragStart);
419
+ eventBus.on('shape-resize-end', enforceMinSizeOnResizeEnd);
420
+
421
+ // 监听内容变化相关的事件
422
+ window.addEventListener('resize', debouncedMeasureContentHeight);
423
+ });
424
+
425
+ // 监听shape变化,重新计算尺寸
426
+ watch(() => [props.shape.name, props.shape.keywords, props.shape.bounds?.width, keywordsStyle.value, nameStyle.value], () => {
427
+ if (!isResizing.value) {
428
+ nextTick(() => {
429
+ reportMetrics();
430
+ // 当内容或宽度变化时重新测量高度
431
+ debouncedMeasureContentHeight();
432
+ });
433
+ }
434
+ }, { deep: true }); // 启用深度监听以捕获样式对象的变化
435
+
436
+ // 监听contentHeight变化,更新组件尺寸
437
+ watch(contentHeight, () => {
438
+ if (!isResizing.value) {
439
+ nextTick(() => {
440
+ reportMetrics();
441
+ updateShapeBounds();
442
+ });
443
+ }
444
+ });
445
+
446
+ // 监听name变化时更新宽度
447
+ watch(() => props.shape.name, () => {
448
+ if (!isResizing.value) {
449
+ nextTick(() => {
450
+ updateShapeBounds();
451
+ });
452
+ }
453
+ });
454
+
455
+ // 监听keywords变化时更新宽度
456
+ watch(() => props.shape.keywords, () => {
457
+ if (!isResizing.value) {
458
+ nextTick(() => {
459
+ updateShapeBounds();
460
+ });
461
+ }
462
+ });
463
+
464
+ // 监听字体样式变化时更新宽度和高度
465
+ watch(() => [nameStyle.value.fontSize, nameStyle.value.fontFamily, nameStyle.value.fontWeight,
466
+ nameBounds.value.height, keywordsStyle.value.fontSize, keywordsStyle.value.fontFamily,
467
+ keywordsStyle.value.fontWeight, keywordsBounds.value.height], () => {
468
+ if (!isResizing.value) {
469
+ nextTick(() => {
470
+ updateShapeBounds();
471
+ });
472
+ }
473
+ }, { deep: true });
474
+
475
+ // 监听bounds宽度变化,但只在非缩放状态下响应
476
+ watch(() => props.shape.bounds.width, () => {
477
+ if (!isResizing.value) {
478
+ nextTick(() => {
479
+ updateShapeBounds();
480
+ });
481
+ }
482
+ });
483
+ // 监听 taggedValueLabels 的内容变化(比如富文本 name 变长/变多行)
484
+ // 不能只看 length,因为文本变长时 length 不变
485
+ watch(
486
+ () => props.shape.taggedValueLabels,
487
+ () => {
488
+ if (!isResizing.value) {
489
+ nextTick(() => {
490
+ // 重新测量内容高度
491
+ debouncedMeasureContentHeight()
492
+ })
493
+ }
494
+ },
495
+ { deep: true }
496
+ )
497
+ onBeforeUnmount(() => {
498
+ eventBus.off('shape-drag-start', handleDragStart);
499
+ eventBus.off('shape-drag-end', handleDragEnd);
500
+ eventBus.off('shape-resize-start', handleDragStart);
501
+ eventBus.off('shape-resize-end', enforceMinSizeOnResizeEnd);
502
+ window.removeEventListener('resize', debouncedMeasureContentHeight);
503
+ });
504
+ // ================== 监听 bounds 宽高变化 ==================
505
+
506
+ // 原始宽高(150 x 135)
507
+ const DEFAULT_WIDTH = 150
508
+ const DEFAULT_HEIGHT = 135
509
+
510
+ // 记录上一次的宽高,用来做去重判断
511
+ const lastBounds = ref({
512
+ width: props.shape.bounds.width ?? DEFAULT_WIDTH,
513
+ height: props.shape.bounds.height ?? DEFAULT_HEIGHT,
514
+ })
515
+
516
+ /**
517
+ * 当当前 shape 的宽高发生变化时,要执行的逻辑
518
+ */
519
+
520
+ // 同时监听 bounds.width 和 bounds.height
521
+ watch(
522
+ () => [props.shape.bounds.width, props.shape.bounds.height],
523
+ ([newW, newH]) => {
524
+ if (!isGhost.value) return
525
+ // 宽高兜底到默认值(150 x 135)
526
+ const width = newW ?? DEFAULT_WIDTH
527
+ const height = newH ?? DEFAULT_HEIGHT
528
+
529
+ // 如果和上一次一致,直接返回,避免重复触发
530
+ if (
531
+ width == lastBounds.value.width &&
532
+ height == lastBounds.value.height
533
+ ) {
534
+ return
535
+ }
536
+
537
+ // 更新“上一次”的记录
538
+ lastBounds.value = { width, height }
539
+ // 只有当宽高不再是原始 150 x 135 时才认为“真的变化”,再去调用其他方法
540
+ if (
541
+ width !== DEFAULT_WIDTH || height !== DEFAULT_HEIGHT) {
542
+ graphStore.expandParentAndEmitSizeUpdateByChild(props.shape)
543
+ }
544
+ }
545
+ )
546
+ </script>
547
+
548
+ <style scoped>
549
+ .capability-shape {
550
+ display: inline-block;
551
+ position: relative;
552
+ overflow: visible;
553
+ /* 确保内容不会被截断 */
554
+ box-sizing: content-box;
555
+ /* 确保宽度计算正确 */
556
+ }
557
+
558
+ /* SVG内的HTML元素样式 */
559
+ ::v-deep(.name-text-svg) {
560
+ text-align: left;
561
+ }
562
+
563
+ ::v-deep(.shape-name-svg) {
564
+ text-align: center;
565
+ }
566
+
567
+ ::v-deep(.content-text-svg) {
568
+ font-size: 13px;
569
+ line-height: 1.4;
570
+ color: #000;
571
+ font-family: Arial, sans-serif;
572
+ min-height: 20px;
573
+ /* 确保内容可以完全显示 */
574
+ overflow: visible;
575
+ width: 100%;
576
+ /* 确保宽度占满父容器 */
577
+ box-sizing: border-box;
578
+ }
579
+
580
+ ::v-deep(.content-item) {
581
+ margin-bottom: 4px;
582
+ word-break: break-word;
583
+ white-space: normal;
584
+ /* 确保文本可以正常换行 */
585
+ overflow: visible;
586
+ width: 100%;
587
+ /* 确保每个项目都占满宽度 */
588
+ box-sizing: border-box;
589
+ }
590
+
591
+ ::v-deep(.content-item:last-child) {
592
+ margin-bottom: 0;
593
+ }
594
+ </style>