@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,534 @@
1
+ // utils/compartment.ts
2
+ import type { Bounds, CompartmentRecord, Shape } from '@/types'
3
+ import _ from 'lodash'
4
+ import { toRaw } from 'vue';
5
+
6
+ export type Rect = { x: number; y: number; width: number; height: number }
7
+ export type Zones = {
8
+ header: Rect
9
+ content: Rect
10
+ childrenArea: Rect
11
+ parentBounds: Rect
12
+ }
13
+
14
+ // 标记值缓存
15
+ let taggedValueLabelsCache: string[] = []
16
+ let COMPARTMENT_KEY_SET = new Set<string>()
17
+
18
+ export function setTaggedValueLabelsCache(labels: string[]) {
19
+ taggedValueLabelsCache = labels ?? []
20
+ // 同时更新 Set,全部转小写
21
+ COMPARTMENT_KEY_SET = new Set(
22
+ taggedValueLabelsCache.map(k => k.toLowerCase())
23
+ )
24
+ }
25
+ // 缓存 packagesTypes
26
+ let packageTypesCache: string[] = []
27
+ let PACKAGE_TYPES_SET = new Set<string>()
28
+
29
+ // 由外部(组件里 watch props.packages)调用
30
+ export function setPackageTypesCache(types: string[]) {
31
+ packageTypesCache = types ?? []
32
+ PACKAGE_TYPES_SET = new Set(
33
+ packageTypesCache.map(t => t.toLowerCase())
34
+ )
35
+ }
36
+ export const isShapeTypeNotInPackageTypes = (s?: Shape): boolean => {
37
+ if (!s || !s.shapeKey) return false
38
+ return !PACKAGE_TYPES_SET.has(String(s.shapeKey).toLowerCase())
39
+ }
40
+ export const CANVAS_LEFT = 0
41
+ export const CANVAS_TOP = 0
42
+ const INSET = 6
43
+ const DIVIDER = 1
44
+
45
+ // 从 meta 读头/内容高度
46
+ function readHeaderH(p: Shape) {
47
+ return Number(p.meta?.headerH) ||
48
+ Number((p.meta as any)?.upperHeight) || 30
49
+ }
50
+ function readContentH(p: Shape) {
51
+ return Number(p.meta?.contentH) ||
52
+ Number((p as any).keywordsBounds?.height) ||
53
+ Math.ceil((Number((p as any).keywordsStyle?.fontSize) || 14) * 1.3)
54
+ }
55
+
56
+ // 单个子所需的四向扩容
57
+ function growNeedForChildRect(parent: Shape, child: { x: number; y: number; width: number; height: number }) {
58
+ const pb = parent.bounds!
59
+ const pX = pb.x ?? 0, pY = pb.y ?? 0, pW = pb.width ?? 0, pH = pb.height ?? 0
60
+ const pRight = pX + pW, pBottom = pY + pH
61
+
62
+ const headerH = readHeaderH(parent)
63
+ const contentH = readContentH(parent)
64
+ // children 可放置区的可见顶(子必须在它之下)
65
+ const childrenTop = pY + headerH + DIVIDER + contentH + INSET
66
+
67
+ // 理想扩容(不考虑画布边界)
68
+ let needLeft = Math.max(0, pX - (child.x - INSET))
69
+ let needUp = Math.max(0, childrenTop - child.y)
70
+ let needRight = Math.max(0, (child.x + child.width + INSET) - pRight)
71
+ let needDown = Math.max(0, (child.y + child.height + INSET) - pBottom)
72
+
73
+ // 画布裁剪:向左/向上受边界限制
74
+ const availLeft = Math.max(0, pX - CANVAS_LEFT)
75
+ const availUp = Math.max(0, pY - CANVAS_TOP)
76
+ needLeft = Math.min(needLeft, availLeft)
77
+ needUp = Math.min(needUp, availUp)
78
+
79
+ return { needLeft, needRight, needUp, needDown }
80
+ }
81
+
82
+ // 聚合父下所有子,统一扩父
83
+ export function ensureCompartmentAfterParentMoved(
84
+ shapes: Shape[],
85
+ parent: Shape,
86
+ updateShape: (id: string, u: Partial<Shape>) => void
87
+ ) {
88
+ if (!isCompartment(parent)) return
89
+
90
+ // 只统计“非隔间”的亲子,避免把其它隔间当成子去触发扩容
91
+ const kids = shapes.filter(
92
+ x => x.parenShapeId === parent.id && x.bounds && !isCompartment(x)
93
+ )
94
+
95
+ let L = 0, R = 0, U = 0, D = 0
96
+ for (const k of kids) {
97
+ const g = growNeedForChildRect(parent, k.bounds as any)
98
+ L = Math.max(L, g.needLeft)
99
+ R = Math.max(R, g.needRight)
100
+ U = Math.max(U, g.needUp)
101
+ D = Math.max(D, g.needDown)
102
+ }
103
+
104
+ if (L || R || U || D) {
105
+ const pb = parent.bounds!
106
+ updateShape(parent.id, {
107
+ bounds: {
108
+ x: (pb.x ?? 0) - L,
109
+ y: (pb.y ?? 0) - U,
110
+ width: (pb.width ?? 0) + L + R,
111
+ height: (pb.height ?? 0) + U + D,
112
+ }
113
+ })
114
+ }
115
+ }
116
+ // 用于缓存每个隔间组件的几何分区:header / content / childrenArea
117
+ const zonesMap = new Map<string, Zones>()
118
+ // 注册或更新某个隔间的分区信息
119
+ export function setCompartmentZones(shapeId: string, z: Zones) {
120
+ zonesMap.set(shapeId, z)
121
+ }
122
+ // 读取某个隔间的分区信息;不存在时返回 null(
123
+ export const getCompartmentZones = (id: string) => zonesMap.get(id) ?? null
124
+ // 清除某个隔间的分区信息(组件卸载/重建时调用)
125
+ export const clearCompartmentZones = (id: string) => zonesMap.delete(id)
126
+ // 隔间类型判断
127
+ export const isCompartment = (s?: Shape): boolean => {
128
+ if (!s || !s.shapeKey) return false
129
+ return COMPARTMENT_KEY_SET.has(String(s.shapeKey).toLowerCase())
130
+ }
131
+ /** 该 shape 目前是否位于某个隔间内(沿父链向上找) */
132
+ export function isInsideAnyCompartment(shapes: Shape[], s?: Shape | null): boolean {
133
+ if (!s) return false
134
+ let p = shapes.find(x => x.id === s.parenShapeId) || null
135
+ while (p) {
136
+ if (isCompartment(p)) return true
137
+ const parentId = p.parenShapeId
138
+ p = shapes.find(x => x.id === parentId) || null
139
+ }
140
+ return false
141
+ }
142
+ /** 该 shape 目前是否允许被当做“父容器” */
143
+ export function allowAsParent(shapes: Shape[], s: Shape): boolean {
144
+ // 规则:在隔间里的任何元素都不能当父容器;隔间本身是否允许当父由你现有逻辑决定
145
+ return !isInsideAnyCompartment(shapes, s)
146
+ }
147
+ const MIN_CHILD_AREA = 8
148
+ export function clampCompartmentResize(
149
+ shapes: Shape[],
150
+ parent: Shape,
151
+ next: { x: number; y: number; width: number; height: number },
152
+ handle: "nw" | "ne" | "sw" | "se"
153
+ ) {
154
+ const pb = parent.bounds!
155
+ const headerH = readHeaderH(parent)
156
+ const contentH = readContentH(parent)
157
+
158
+ // 常量与顶区计算保持一致
159
+ const minTopSpace = headerH + DIVIDER + contentH + INSET
160
+ // 仅用于 bottom 方向最小高度的约束(子区至少预留 MIN_CHILD_AREA)
161
+ const minHeightIfNeed = minTopSpace + MIN_CHILD_AREA + INSET
162
+
163
+ // 顶部 handle:nw / ne(保持你原逻辑)
164
+ if (handle === 'nw' || handle === 'ne') {
165
+ // children 顶 = next.y + minTopSpace
166
+ let nextChildrenTop = next.y + minTopSpace
167
+
168
+ // 现有“非隔间”的子(避免子又是隔间的情况)
169
+ const kids = shapes.filter(
170
+ k => k.parenShapeId === parent.id && k.bounds && k.id !== parent.id && k.shapeKey !== 'EnterpriseGoal'
171
+ )
172
+ const minChildTop = kids.length ? Math.min(...kids.map(k => (k.bounds!.y ?? 0))) : Infinity
173
+
174
+ // 不把 children 顶压过现有子元素
175
+ if (minChildTop !== Infinity && nextChildrenTop > minChildTop) {
176
+ const delta = nextChildrenTop - minChildTop
177
+ // 从上边缩 → 用“回退 y + 增加 height”的方式抵消
178
+ next.y -= delta
179
+ next.height += delta
180
+ // 重新计算 children 顶
181
+ nextChildrenTop = next.y + minTopSpace
182
+ }
183
+
184
+ // 顶部基础高度不能被压没(至少保留 minTopSpace)
185
+ const currentTopSpace = (nextChildrenTop - next.y)
186
+ if (currentTopSpace < minTopSpace) {
187
+ const need = (minTopSpace - currentTopSpace)
188
+ next.y -= need
189
+ next.height += need
190
+ }
191
+
192
+ // 预留最小 children 区高度
193
+ if (next.height < minHeightIfNeed) {
194
+ const need = (minHeightIfNeed - next.height)
195
+ next.y -= need
196
+ next.height += need
197
+ }
198
+
199
+ // 防御
200
+ if (next.width < 1) next.width = 1
201
+ if (next.height < 1) next.height = 1
202
+ return next
203
+ }
204
+
205
+ // 底部 handle:sw / se
206
+ // 仅当“没有任何子元素”时,才需要预留头部+内容区+最小子区高度
207
+ if (handle === 'sw' || handle === 'se') {
208
+ const hasAnyChild = shapes.some(k => k.parenShapeId === parent.id && k.id !== parent.id)
209
+ if (!hasAnyChild) {
210
+ // 从底部缩放不改 y,只限制最小高度
211
+ if (next.height < minHeightIfNeed) {
212
+ next.height = minHeightIfNeed
213
+ }
214
+ if (next.width < 1) next.width = 1
215
+ if (next.height < 1) next.height = 1
216
+ return next
217
+ }
218
+ // 有子元素时,不特殊处理(保持原有行为)
219
+ if (next.width < 1) next.width = 1
220
+ if (next.height < 1) next.height = 1
221
+ return next
222
+ }
223
+
224
+ // 其他(理论上不会到这,兜底)
225
+ return next
226
+ }
227
+ // 根据 shape 的几何与量测到的头/内容高度
228
+ export function buildZones(shape: Shape, m?: { headerH: number; contentH: number }) {
229
+ // 规范化父边界
230
+ const b = shape.bounds ?? { x: 0, y: 0, width: 0, height: 0 }
231
+ const bx = Number(b.x ?? 0)
232
+ const by = Number(b.y ?? 0)
233
+ const bwidth = Number(b.width ?? 0)
234
+ const bheight = Number(b.height ?? 0)
235
+ // 输入的量测高度(header / content),优先使用入参,其次读 meta 兜底
236
+ const headerH = m?.headerH ?? Number(shape.meta?.headerH) ?? 0
237
+ const contentH = m?.contentH ?? Number(shape.meta?.contentH) ?? 0
238
+ //布局常量(与视觉设计保持一致)
239
+ const DIVIDER = 1 // 头部与内容区之间的分隔线高度
240
+ const INSET = 6 // childrenArea 左右内边距(避免贴边)
241
+ const PAD_TOP = 6 // childrenArea 顶部留白(与内容区分隔)
242
+ // 头部区域:从父容器顶部开始,占用 headerH 高度
243
+ const header = { x: bx, y: by, width: bwidth, height: headerH }
244
+ // 内容区域:紧随 header,下方预留 DIVIDER 作为分隔
245
+ const content = { x: bx, y: by + headerH + DIVIDER, width: bwidth, height: contentH }
246
+ // 子元素可放置区:在内容区下方再留 PAD_TOP 顶部留白
247
+ const childrenAreaTop = by + headerH + DIVIDER + contentH + PAD_TOP
248
+ const childrenArea = {
249
+ x: bx + INSET,
250
+ y: childrenAreaTop,
251
+ width: Math.max(0, bwidth - INSET * 2),
252
+ height: Math.max(0, by + bheight - INSET - childrenAreaTop)
253
+ }
254
+ // 父容器整体边界(用于统一判定“放不下时扩父”等逻辑)
255
+ const parentBounds = { x: bx, y: by, width: bwidth, height: bheight }
256
+ return { header, content, childrenArea, parentBounds }
257
+ }
258
+ /** 运行时数组:不存在就建出来 */
259
+ function ensureComparentsArray(parent: Shape): CompartmentRecord[] {
260
+ const any = parent as any
261
+ if (!Array.isArray(any.comparents)) {
262
+ any.comparents = [emptyRecord(parent)]
263
+ } else if (any.comparents.length === 0) {
264
+ any.comparents = [emptyRecord(parent)]
265
+ } else if (!isRecord(any.comparents[0])) {
266
+ // 兼容:若是旧结构(如 Shape[] 或奇怪内容),迁移成新结构
267
+ any.comparents = migrateUnknownComparentsToRecords(any.comparents, parent)
268
+ }
269
+ return any.comparents as CompartmentRecord[]
270
+ }
271
+
272
+ /** 持久化字符串:不存在就设为空字符串 */
273
+ function ensureComparentsJSON(parent: Shape): string {
274
+ const any = parent as any
275
+ if (typeof any.comparentsJSON !== 'string') any.comparentsJSON = ''
276
+ return any.comparentsJSON as string
277
+ }
278
+
279
+ /** 生成“可持久化”的 Shape 快照(去除会导致循环/膨胀的字段) */
280
+ function makePersistableSnapshot(s: Shape): Shape {
281
+ const raw = toRaw(s)
282
+ const snap = JSON.parse(JSON.stringify(raw))
283
+ delete (snap as any).comparents
284
+ delete (snap as any).comparentsJSON
285
+ // delete (snap as any).showComparents
286
+ return snap
287
+ }
288
+
289
+ /** 新建一个空记录(从 parent 初始化 bounds/model 信息) */
290
+ function emptyRecord(parent: Shape): CompartmentRecord {
291
+ return {
292
+ bounds: '' as Bounds,
293
+ modelId: '',
294
+ modelName: '',
295
+ comparentShapes: [],
296
+ }
297
+ }
298
+
299
+ /** 类型守卫:是否为 CompartmentRecord */
300
+ function isRecord(val: any): val is CompartmentRecord {
301
+ return !!val && typeof val === 'object' && Array.isArray(val.comparentShapes)
302
+ }
303
+
304
+ /** 解析旧 JSON 结构或异常值,统一转为 CompartmentRecord[] */
305
+ function parseComparentsJSONCompat(json: string, parent: Shape): CompartmentRecord[] {
306
+ if (!json) return [emptyRecord(parent)]
307
+ try {
308
+ const data = JSON.parse(json)
309
+
310
+ // 新结构:数组,首项为 CompartmentRecord
311
+ if (Array.isArray(data) && data[0] && isRecord(data[0])) {
312
+ return data as CompartmentRecord[]
313
+ }
314
+
315
+ // 老结构:[{ comparent_shapes: [...] }]
316
+ if (Array.isArray(data) && data[0] && Array.isArray(data[0].comparent_shapes)) {
317
+ const rec = emptyRecord(parent)
318
+ rec.comparentShapes = data[0].comparent_shapes
319
+ return [rec]
320
+ }
321
+
322
+ // 兜底:非法/未知结构
323
+ return [emptyRecord(parent)]
324
+ } catch {
325
+ return [emptyRecord(parent)]
326
+ }
327
+ }
328
+
329
+ /** 将未知的运行时 comparents 迁移为新结构记录数组 */
330
+ function migrateUnknownComparentsToRecords(unknown: any, parent: Shape): CompartmentRecord[] {
331
+ // 旧运行时可能是 Shape[]
332
+ if (Array.isArray(unknown) && (unknown.length === 0 || unknown[0]?.id)) {
333
+ const rec = emptyRecord(parent)
334
+ rec.comparentShapes = (unknown as Shape[]).map(makePersistableSnapshot)
335
+ return [rec]
336
+ }
337
+ // 其他情况直接兜底空记录
338
+ return [emptyRecord(parent)]
339
+ }
340
+
341
+ /** 写回 comparentsJSON(新结构:CompartmentRecord[]) */
342
+ function writeComparentsJSONFromRuntime(
343
+ parent: Shape,
344
+ updateShape: (id: string, u: Partial<Shape>) => void
345
+ ) {
346
+ const list = ensureComparentsArray(parent)
347
+ // 同步父的 bounds / model 信息(保持最新)
348
+ // list[0].bounds = '' as Bounds
349
+ list[0].modelId = ''
350
+ list[0].modelName = ''
351
+
352
+ // 子形状使用快照,避免把 Proxy/循环结构写入
353
+ const snapped = list[0].comparentShapes.map(makePersistableSnapshot)
354
+ const next: CompartmentRecord[] = [{
355
+ ...list[0],
356
+ comparentShapes: snapped,
357
+ }]
358
+ // 同步 showComparents
359
+ const show = calcShowComparentsFlag({ ...(parent as any), comparents: next } as Shape)
360
+ updateShape(parent.id, {
361
+ comparents: next,
362
+ comparentsJSON: JSON.stringify(next),
363
+ showComparents: show,
364
+ } as any)
365
+ }
366
+
367
+ // ===================== 对外 API(方法名保持不变) =====================
368
+
369
+ /** 把运行时 comparents[] 同步到 comparentsJSON(新结构:CompartmentRecord[]) */
370
+ export function syncComparentsJSON(
371
+ parent: Shape,
372
+ updateShape: (id: string, u: Partial<Shape>) => void
373
+ ) {
374
+ if (!isCompartment(parent)) return
375
+ writeComparentsJSONFromRuntime(parent, updateShape)
376
+ }
377
+
378
+ /** 启动/刷新后:compar entsJSON → 运行时 comparents(新结构) */
379
+ export function hydrateComparentsFromJSON(
380
+ parent: Shape,
381
+ updateShape: (id: string, u: Partial<Shape>) => void
382
+ ) {
383
+ if (!isCompartment(parent)) return
384
+ const json = ensureComparentsJSON(parent)
385
+ const recs = parseComparentsJSONCompat(json, parent)
386
+ // 运行时直接等于记录数组
387
+ updateShape(parent.id, { comparents: recs } as any)
388
+ // 同步 showComparents
389
+ const show = calcShowComparentsFlag({ ...(parent as any), comparents: recs } as Shape)
390
+ updateShape(parent.id, { showComparents: show } as any)
391
+
392
+ // 若解析到老结构立刻迁移
393
+ try {
394
+ const parsed = JSON.parse(json)
395
+ if (!(Array.isArray(parsed) && parsed[0] && isRecord(parsed[0]))) {
396
+ updateShape(parent.id, { comparentsJSON: JSON.stringify(recs) } as any)
397
+ }
398
+ } catch {
399
+ updateShape(parent.id, { comparentsJSON: JSON.stringify(recs) } as any)
400
+ }
401
+ }
402
+
403
+ /** 添加一个“整个子 Shape 快照”到 comparents[0].comparentShapes,并同步 JSON */
404
+ export function addChildShapeToCompartment(
405
+ parent: Shape,
406
+ child: Shape,
407
+ updateShape: (id: string, u: Partial<Shape>) => void
408
+ ) {
409
+ if (!isShapeTypeNotInPackageTypes(parent)) return
410
+
411
+ const list = ensureComparentsArray(parent)
412
+ const rec = list[0] || emptyRecord(parent)
413
+
414
+ const cid = (child as any)?.id
415
+ if (!cid) return
416
+ if (rec.comparentShapes.some(x => x?.id === cid)) return
417
+ const snap = makePersistableSnapshot(child)
418
+ //被加入隔间的“子快照”一律 false(它不是隔间)
419
+ ; (snap as any).showComparents = false
420
+
421
+ rec.comparentShapes = [...rec.comparentShapes, snap]
422
+ list[0] = rec
423
+
424
+ updateShape(parent.id, { comparents: list } as any)
425
+ updateShape(parent.id, { showComparents: true } as any)
426
+ writeComparentsJSONFromRuntime(parent, updateShape)
427
+ }
428
+
429
+ /** 从 comparents[0].comparentShapes 移除一个子(按 id),并同步 JSON */
430
+ export function removeChildShapeFromCompartment(
431
+ parent: Shape,
432
+ child: Shape,
433
+ updateShape: (id: string, u: Partial<Shape>) => void
434
+ ) {
435
+ if (!isShapeTypeNotInPackageTypes(parent)) return
436
+
437
+ const list = ensureComparentsArray(parent)
438
+ const rec = list[0] || emptyRecord(parent)
439
+
440
+ const cid = (child as any)?.id
441
+ if (!cid) return
442
+
443
+ const nextChildren = rec.comparentShapes.filter(x => x?.id !== cid)
444
+ if (nextChildren.length === rec.comparentShapes.length) return
445
+
446
+ rec.comparentShapes = nextChildren
447
+ list[0] = rec
448
+
449
+ updateShape(parent.id, { comparents: list } as any)
450
+ const show = nextChildren.length > 0
451
+ updateShape(parent.id, { showComparents: show } as any)
452
+ writeComparentsJSONFromRuntime(parent, updateShape)
453
+ }
454
+
455
+ /** 兜底:按 parenShapeId 重建 comparents[0].comparentShapes(启动/恢复后) */
456
+ export function rebuildAllCompartmentChildrenAsShapes(
457
+ shapes: Shape[],
458
+ updateShape: (id: string, u: Partial<Shape>) => void
459
+ ) {
460
+ for (const p of shapes) {
461
+ if (!isShapeTypeNotInPackageTypes(p)) continue
462
+
463
+ const children = shapes.filter(ch => ch.parenShapeId === p.id)
464
+ const snaps = children.map(makePersistableSnapshot)
465
+
466
+ // 运行时:确保有记录,再覆盖其 comparentShapes
467
+ const list = ensureComparentsArray(p)
468
+ const rec = list[0] || emptyRecord(p)
469
+ rec.modelId = ''
470
+ rec.modelName = ''
471
+ rec.comparentShapes = snaps
472
+ list[0] = rec
473
+
474
+ updateShape(p.id, { comparents: list } as any)
475
+ updateShape(p.id, { comparentsJSON: JSON.stringify(list) } as any)
476
+ updateShape(p.id, { showComparents: snaps.length > 0 } as any)
477
+ }
478
+ }
479
+
480
+
481
+ // 同步comparentShapes中的数据到shapes当中
482
+ export function syncComparentShapesIntoRuntime(input: Shape[]): Shape[] {
483
+ // 先用 Map 去重并保留传入的最新实体
484
+ const byId = new Map<string, Shape>()
485
+ for (const s of input) byId.set(s.id, _.cloneDeep(s))
486
+
487
+ for (const parent of input) {
488
+ const comps = (parent as any)?.comparents
489
+ if (!Array.isArray(comps)) continue
490
+
491
+ for (const rec of comps) {
492
+ const children = Array.isArray(rec?.comparentShapes) ? rec.comparentShapes : []
493
+ for (const snap of children as any[]) {
494
+ if (!snap || !snap.id) continue
495
+ const child = _.cloneDeep(snap)
496
+
497
+ // 确保父子与画布归属
498
+ if (!child.parenShapeId) child.parenShapeId = parent.id
499
+ if (!child.diagramId) child.diagramId = parent.diagramId
500
+
501
+ // Upsert:已存在则合并(以后端快照为主,但保留已有 bounds/style 的结构)
502
+ const existed = byId.get(child.id)
503
+ if (existed) {
504
+ byId.set(child.id, {
505
+ ...existed,
506
+ ...child,
507
+ bounds: child.bounds ? { ...(existed as any).bounds, ...child.bounds } : existed.bounds,
508
+ style: child.style ? { ...((existed as any).style || {}), ...child.style } : existed.style,
509
+ } as Shape)
510
+ } else {
511
+ byId.set(child.id, child as Shape)
512
+ }
513
+ }
514
+ }
515
+ }
516
+ // 统一修正 showComparents
517
+ for (const s of byId.values()) {
518
+ if (isShapeTypeNotInPackageTypes(s)) {
519
+ ; (s as any).showComparents = calcShowComparentsFlag(s)
520
+ } else {
521
+ ; (s as any).showComparents = false
522
+ }
523
+ }
524
+
525
+ return Array.from(byId.values())
526
+ }
527
+ //处理showComparents字段
528
+ function calcShowComparentsFlag(parent: Shape): boolean {
529
+ if (!isShapeTypeNotInPackageTypes(parent)) return false
530
+ const comps = (parent as any)?.comparents
531
+ if (!Array.isArray(comps) || comps.length === 0) return false
532
+ const rec = comps[0]
533
+ return Array.isArray(rec?.comparentShapes) && rec.comparentShapes.length > 0
534
+ }