strategy-panel 1.0.1 → 1.0.2

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 (341) hide show
  1. package/.fatherrc.ts +11 -26
  2. package/.umirc.ts +4 -0
  3. package/README.md +33 -33
  4. package/es/assets/decive.svg +1 -1
  5. package/es/assets/hand.svg +1 -1
  6. package/es/assets/lock.svg +8 -0
  7. package/es/components/canvas/component-tree-panel/category-tree/category-type.d.ts +1 -0
  8. package/es/{common/graph-common → components/canvas/component-tree-panel/category-tree}/category-type.js +28 -12
  9. package/es/{pages → components/canvas}/component-tree-panel/category-tree/index.d.ts +17 -16
  10. package/es/{pages → components/canvas}/component-tree-panel/category-tree/index.js +14 -14
  11. package/es/{pages → components/canvas}/component-tree-panel/category-tree/index.less +36 -36
  12. package/es/{pages → components/canvas}/component-tree-panel/category-tree/node-title.d.ts +12 -12
  13. package/es/{pages → components/canvas}/component-tree-panel/category-tree/node-title.js +5 -3
  14. package/es/{pages → components/canvas}/component-tree-panel/index.d.ts +17 -17
  15. package/es/{pages → components/canvas}/component-tree-panel/index.js +1 -0
  16. package/es/{pages → components/canvas}/component-tree-panel/index.less +1 -0
  17. package/es/{pages → components/canvas}/config-panel/components/condition-configuration/configure-modal/data-origin.d.ts +49 -49
  18. package/es/{pages → components/canvas}/config-panel/components/condition-configuration/configure-modal/data-origin.js +26 -34
  19. package/es/{pages → components/canvas}/config-panel/components/condition-configuration/configure-modal/index.d.ts +11 -11
  20. package/es/{pages → components/canvas}/config-panel/components/condition-configuration/configure-modal/index.js +15 -23
  21. package/es/{pages → components/canvas}/config-panel/components/condition-configuration/configure-modal/style.less +1 -1
  22. package/es/{pages → components/canvas}/config-panel/components/condition-configuration/cross-line.d.ts +9 -9
  23. package/es/{pages → components/canvas}/config-panel/components/condition-configuration/cross-line.js +6 -10
  24. package/es/{pages → components/canvas}/config-panel/components/condition-configuration/index.d.ts +10 -9
  25. package/es/{pages → components/canvas}/config-panel/components/condition-configuration/index.js +17 -13
  26. package/es/{pages → components/canvas}/config-panel/components/condition-configuration/style.less +74 -74
  27. package/es/{pages → components/canvas}/config-panel/components/time-trigger/components/cycle-time.d.ts +9 -9
  28. package/es/{pages → components/canvas}/config-panel/components/time-trigger/components/cycle-time.js +24 -33
  29. package/es/{pages → components/canvas}/config-panel/components/time-trigger/components/time-horizon.d.ts +10 -10
  30. package/es/{pages → components/canvas}/config-panel/components/time-trigger/components/time-horizon.js +18 -28
  31. package/es/{pages → components/canvas}/config-panel/components/time-trigger/delay-time.d.ts +9 -9
  32. package/es/components/canvas/config-panel/components/time-trigger/effective-time.d.ts +7 -0
  33. package/es/components/canvas/config-panel/components/time-trigger/effective-time.js +43 -0
  34. package/es/{pages → components/canvas}/config-panel/components/time-trigger/index.d.ts +9 -8
  35. package/es/{pages → components/canvas}/config-panel/components/time-trigger/index.js +18 -17
  36. package/es/{pages → components/canvas}/config-panel/components/time-trigger/interval-time.d.ts +9 -9
  37. package/es/{pages → components/canvas}/config-panel/components/time-trigger/interval-time.js +4 -8
  38. package/es/{pages → components/canvas}/config-panel/components/time-trigger/persistent-time.d.ts +9 -9
  39. package/es/components/canvas/config-panel/components/time-trigger/section-Detail.d.ts +10 -0
  40. package/es/components/canvas/config-panel/components/time-trigger/section-Detail.js +125 -0
  41. package/es/components/canvas/config-panel/components/time-trigger/section-time.d.ts +9 -0
  42. package/es/components/canvas/config-panel/components/time-trigger/section-time.js +81 -0
  43. package/es/{pages → components/canvas}/config-panel/components/time-trigger/timing-time.d.ts +9 -9
  44. package/es/{pages → components/canvas}/config-panel/components/time-trigger/timing-time.js +7 -11
  45. package/es/{pages → components/canvas}/config-panel/config-common.d.ts +38 -37
  46. package/es/{pages → components/canvas}/config-panel/config-common.js +9 -15
  47. package/es/{pages → components/canvas}/config-panel/index.d.ts +14 -13
  48. package/es/{pages → components/canvas}/config-panel/index.js +2 -2
  49. package/es/{pages → components/canvas}/config-panel/node-form.d.ts +23 -22
  50. package/es/{pages → components/canvas}/config-panel/node-form.js +14 -16
  51. package/es/{pages → components/canvas}/config-panel/style.less +90 -81
  52. package/es/{pages → components/canvas}/dag-canvas/canvas-content.d.ts +11 -10
  53. package/es/{pages → components/canvas}/dag-canvas/canvas-content.js +23 -12
  54. package/es/{pages → components/canvas}/dag-canvas/index.d.ts +23 -18
  55. package/es/{pages → components/canvas}/dag-canvas/index.js +5 -2
  56. package/es/{pages → components/canvas}/dag-canvas/preview.d.ts +10 -10
  57. package/es/components/canvas/dag-canvas/preview.js +53 -0
  58. package/es/{pages → components/canvas}/index.d.ts +48 -42
  59. package/es/{pages → components/canvas}/index.js +20 -10
  60. package/es/{pages → components/canvas}/index.less +2 -2
  61. package/es/{pages → components/canvas}/strategy-header/index.d.ts +48 -56
  62. package/es/components/canvas/strategy-header/index.js +210 -0
  63. package/es/{pages → components/canvas}/strategy-header/style.less +4 -3
  64. package/es/{pages → components/canvas}/strategy-header/theme-switch/index.d.ts +4 -4
  65. package/es/{pages → components/canvas}/strategy-header/theme-switch/index.js +2 -3
  66. package/es/index.d.ts +9 -8
  67. package/es/index.js +8 -7
  68. package/es/packages/graph-canvas/graph-common.d.ts +19 -0
  69. package/es/packages/graph-canvas/graph-common.js +19 -0
  70. package/es/packages/graph-canvas/graph-model/edge/group-edge/index.d.ts +4 -0
  71. package/es/packages/graph-canvas/graph-model/edge/group-edge/index.js +63 -0
  72. package/es/packages/graph-canvas/graph-model/edge/index.d.ts +2 -0
  73. package/es/packages/graph-canvas/graph-model/edge/index.js +2 -0
  74. package/es/packages/graph-canvas/graph-model/node/application-node/application-element.d.ts +9 -0
  75. package/es/packages/graph-canvas/graph-model/node/application-node/application-element.js +20 -0
  76. package/es/packages/graph-canvas/graph-model/node/application-node/application-element.less +17 -0
  77. package/es/packages/graph-canvas/graph-model/node/application-node/index.d.ts +7 -0
  78. package/es/{common/graph-common/shape/nodes/GroupNode.js → packages/graph-canvas/graph-model/node/application-node/index.js} +42 -22
  79. package/es/{common/graph-common/shape/nodes/CommonNode.d.ts → packages/graph-canvas/graph-model/node/common-node/index.d.ts} +7 -5
  80. package/es/{common/graph-common/shape/nodes/CommonNode.js → packages/graph-canvas/graph-model/node/common-node/index.js} +8 -7
  81. package/es/{common/graph-common/node-element → packages/graph-canvas/graph-model/node/common-node}/node-element.d.ts +9 -9
  82. package/es/{common/graph-common/node-element → packages/graph-canvas/graph-model/node/common-node}/node-element.js +16 -14
  83. package/es/{common/graph-common/node-element → packages/graph-canvas/graph-model/node/common-node}/node-element.less +4 -4
  84. package/es/{common/graph-common/node-element → packages/graph-canvas/graph-model/node/condition-node}/condition-element.d.ts +9 -9
  85. package/es/{common/graph-common/node-element → packages/graph-canvas/graph-model/node/condition-node}/condition-element.js +20 -15
  86. package/es/{common/graph-common/node-element → packages/graph-canvas/graph-model/node/condition-node}/condition-element.less +76 -81
  87. package/es/packages/graph-canvas/graph-model/node/condition-node/images/rhombus.svg +3 -0
  88. package/es/{common/graph-common/shape/nodes/ConditionJudgment.d.ts → packages/graph-canvas/graph-model/node/condition-node/index.d.ts} +5 -5
  89. package/es/{common/graph-common/shape/nodes/ConditionJudgment.js → packages/graph-canvas/graph-model/node/condition-node/index.js} +7 -6
  90. package/es/packages/graph-canvas/graph-model/node/index.d.ts +5 -0
  91. package/es/packages/graph-canvas/graph-model/node/index.js +5 -0
  92. package/es/packages/graph-canvas/graph-model/node/logical-node/images/AND.svg +11 -0
  93. package/es/packages/graph-canvas/graph-model/node/logical-node/images/OR.svg +11 -0
  94. package/es/packages/graph-canvas/graph-model/node/logical-node/images/XOR.svg +11 -0
  95. package/es/packages/graph-canvas/graph-model/node/logical-node/images/locking.svg +5 -0
  96. package/es/packages/graph-canvas/graph-model/node/logical-node/images/unlock.svg +5 -0
  97. package/es/packages/graph-canvas/graph-model/node/logical-node/index.d.ts +6 -0
  98. package/es/{common/graph-common/shape/nodes/LogicalNode.js → packages/graph-canvas/graph-model/node/logical-node/index.js} +15 -15
  99. package/es/packages/graph-canvas/graph-model/node/logical-node/logical-element.d.ts +9 -0
  100. package/es/{common/graph-common/node-element → packages/graph-canvas/graph-model/node/logical-node}/logical-element.js +36 -19
  101. package/es/{common/graph-common/node-element → packages/graph-canvas/graph-model/node/logical-node}/logical-element.less +4 -9
  102. package/es/packages/graph-canvas/graph-model/node/style.less +8 -0
  103. package/es/{common → packages/graph-canvas}/graph-utils/graph.d.ts +87 -83
  104. package/es/{common → packages/graph-canvas}/graph-utils/graph.js +8 -4
  105. package/es/{pages/rx-models/experiment-graph.d.ts → packages/graph-canvas/index.d.ts} +79 -82
  106. package/es/{pages/rx-models/experiment-graph.js → packages/graph-canvas/index.js} +285 -252
  107. package/es/packages/graph-canvas/node-types.d.ts +6 -0
  108. package/es/packages/graph-canvas/node-types.js +54 -0
  109. package/es/packages/graph-canvas/typings.d.ts +5 -0
  110. package/es/{common/constants → packages/graph-common}/global.d.ts +1 -1
  111. package/es/{common/constants → packages/graph-common}/graph.d.ts +12 -10
  112. package/es/{common/constants → packages/graph-common}/graph.js +4 -2
  113. package/es/{pages/rx-models → packages/graph-core}/graph-util.d.ts +182 -186
  114. package/es/{pages/rx-models → packages/graph-core}/graph-util.js +8 -15
  115. package/es/{pages/rx-models/graph-core.d.ts → packages/graph-core/index.d.ts} +96 -96
  116. package/es/{pages/rx-models/graph-core.js → packages/graph-core/index.js} +119 -87
  117. package/es/packages/graph-core/typing.d.ts +107 -0
  118. package/es/{common/graph-common → packages/graph-model}/connector/index.d.ts +1 -1
  119. package/es/packages/graph-model/connector/index.js +14 -0
  120. package/es/packages/graph-model/edge/edge.less +8 -0
  121. package/es/packages/graph-model/edge/index.d.ts +5 -0
  122. package/es/{common/graph-common/shape/edge.js → packages/graph-model/edge/index.js} +10 -61
  123. package/es/packages/graph-model/node/index.d.ts +7 -0
  124. package/es/{common/graph-common/shape/nodes/BaseNode.js → packages/graph-model/node/index.js} +12 -3
  125. package/es/{common/graph-common/node-element/common-element.less → packages/graph-model/node/node-basic.less} +1 -0
  126. package/es/{hooks → packages/hooks}/useObservableState.d.ts +3 -3
  127. package/es/packages/hooks/withMode.d.ts +3 -0
  128. package/es/packages/hooks/withMode.js +12 -0
  129. package/es/style/default.less +8 -0
  130. package/es/style/svgRaw.d.ts +1 -0
  131. package/es/style/svgRaw.js +1 -0
  132. package/es/typings.d.ts +2 -8
  133. package/es/utils/utils.d.ts +1 -1
  134. package/lib/assets/AND.svg +11 -0
  135. package/lib/assets/OR.svg +11 -0
  136. package/lib/assets/XOR.svg +11 -0
  137. package/lib/assets/add.svg +13 -0
  138. package/lib/assets/alarm.svg +11 -0
  139. package/lib/assets/application.svg +11 -0
  140. package/lib/assets/cancel.svg +13 -0
  141. package/lib/assets/check.svg +12 -0
  142. package/lib/assets/condition.svg +12 -0
  143. package/lib/assets/control.svg +11 -0
  144. package/lib/assets/decive.svg +11 -0
  145. package/lib/assets/delete.svg +11 -0
  146. package/lib/assets/device.svg +11 -0
  147. package/lib/assets/edit.svg +11 -0
  148. package/lib/assets/hand.svg +11 -0
  149. package/lib/assets/link.svg +11 -0
  150. package/lib/assets/lock.svg +8 -0
  151. package/lib/assets/logical.svg +12 -0
  152. package/lib/assets/notice.svg +11 -0
  153. package/lib/assets/order.svg +11 -0
  154. package/lib/assets/relation.svg +11 -0
  155. package/lib/assets/rhombus.svg +3 -0
  156. package/lib/assets/save.svg +13 -0
  157. package/lib/assets/time.svg +11 -0
  158. package/lib/assets/variate.svg +12 -0
  159. package/lib/components/canvas/component-tree-panel/category-tree/category-type.d.ts +1 -0
  160. package/lib/components/canvas/component-tree-panel/category-tree/category-type.js +111 -0
  161. package/lib/components/canvas/component-tree-panel/category-tree/index.d.ts +17 -0
  162. package/lib/components/canvas/component-tree-panel/category-tree/index.js +115 -0
  163. package/lib/components/canvas/component-tree-panel/category-tree/index.less +36 -0
  164. package/lib/components/canvas/component-tree-panel/category-tree/node-title.d.ts +12 -0
  165. package/lib/components/canvas/component-tree-panel/category-tree/node-title.js +75 -0
  166. package/lib/components/canvas/component-tree-panel/category-tree/node-title.less +113 -0
  167. package/lib/components/canvas/component-tree-panel/index.d.ts +17 -0
  168. package/lib/components/canvas/component-tree-panel/index.js +33 -0
  169. package/lib/components/canvas/component-tree-panel/index.less +52 -0
  170. package/lib/components/canvas/config-panel/components/condition-configuration/configure-modal/data-origin.d.ts +49 -0
  171. package/lib/components/canvas/config-panel/components/condition-configuration/configure-modal/data-origin.js +229 -0
  172. package/lib/components/canvas/config-panel/components/condition-configuration/configure-modal/index.d.ts +11 -0
  173. package/lib/components/canvas/config-panel/components/condition-configuration/configure-modal/index.js +187 -0
  174. package/lib/components/canvas/config-panel/components/condition-configuration/configure-modal/style.less +13 -0
  175. package/lib/components/canvas/config-panel/components/condition-configuration/cross-line.d.ts +9 -0
  176. package/lib/components/canvas/config-panel/components/condition-configuration/cross-line.js +57 -0
  177. package/lib/components/canvas/config-panel/components/condition-configuration/index.d.ts +10 -0
  178. package/lib/components/canvas/config-panel/components/condition-configuration/index.js +216 -0
  179. package/lib/components/canvas/config-panel/components/condition-configuration/style.less +74 -0
  180. package/lib/components/canvas/config-panel/components/time-trigger/components/cycle-time.d.ts +9 -0
  181. package/lib/components/canvas/config-panel/components/time-trigger/components/cycle-time.js +108 -0
  182. package/lib/components/canvas/config-panel/components/time-trigger/components/time-horizon.d.ts +10 -0
  183. package/lib/components/canvas/config-panel/components/time-trigger/components/time-horizon.js +78 -0
  184. package/lib/components/canvas/config-panel/components/time-trigger/delay-time.d.ts +9 -0
  185. package/lib/components/canvas/config-panel/components/time-trigger/delay-time.js +33 -0
  186. package/lib/components/canvas/config-panel/components/time-trigger/effective-time.d.ts +7 -0
  187. package/lib/components/canvas/config-panel/components/time-trigger/effective-time.js +58 -0
  188. package/lib/components/canvas/config-panel/components/time-trigger/index.d.ts +9 -0
  189. package/lib/components/canvas/config-panel/components/time-trigger/index.js +114 -0
  190. package/lib/components/canvas/config-panel/components/time-trigger/interval-time.d.ts +9 -0
  191. package/lib/components/canvas/config-panel/components/time-trigger/interval-time.js +63 -0
  192. package/lib/components/canvas/config-panel/components/time-trigger/persistent-time.d.ts +9 -0
  193. package/lib/components/canvas/config-panel/components/time-trigger/persistent-time.js +33 -0
  194. package/lib/components/canvas/config-panel/components/time-trigger/section-Detail.d.ts +10 -0
  195. package/lib/components/canvas/config-panel/components/time-trigger/section-Detail.js +140 -0
  196. package/lib/components/canvas/config-panel/components/time-trigger/section-time.d.ts +9 -0
  197. package/lib/components/canvas/config-panel/components/time-trigger/section-time.js +96 -0
  198. package/lib/components/canvas/config-panel/components/time-trigger/timing-time.d.ts +9 -0
  199. package/lib/components/canvas/config-panel/components/time-trigger/timing-time.js +65 -0
  200. package/lib/components/canvas/config-panel/config-common.d.ts +38 -0
  201. package/lib/components/canvas/config-panel/config-common.js +152 -0
  202. package/lib/components/canvas/config-panel/index.d.ts +14 -0
  203. package/lib/components/canvas/config-panel/index.js +68 -0
  204. package/lib/components/canvas/config-panel/node-form.d.ts +23 -0
  205. package/lib/components/canvas/config-panel/node-form.js +97 -0
  206. package/lib/components/canvas/config-panel/style.less +90 -0
  207. package/lib/components/canvas/dag-canvas/canvas-content.d.ts +11 -0
  208. package/lib/components/canvas/dag-canvas/canvas-content.js +130 -0
  209. package/lib/components/canvas/dag-canvas/canvas-content.less +5 -0
  210. package/lib/components/canvas/dag-canvas/index.d.ts +23 -0
  211. package/lib/components/canvas/dag-canvas/index.js +53 -0
  212. package/lib/components/canvas/dag-canvas/index.less +11 -0
  213. package/lib/components/canvas/dag-canvas/preview.d.ts +10 -0
  214. package/lib/components/canvas/dag-canvas/preview.js +73 -0
  215. package/lib/components/canvas/index.d.ts +48 -0
  216. package/lib/components/canvas/index.js +107 -0
  217. package/lib/components/canvas/index.less +50 -0
  218. package/lib/components/canvas/strategy-header/index.d.ts +48 -0
  219. package/lib/components/canvas/strategy-header/index.js +229 -0
  220. package/lib/components/canvas/strategy-header/style.less +23 -0
  221. package/lib/components/canvas/strategy-header/theme-switch/index.d.ts +4 -0
  222. package/lib/components/canvas/strategy-header/theme-switch/index.js +30 -0
  223. package/lib/components/canvas/strategy-header/theme-switch/style.less +11 -0
  224. package/lib/index.d.ts +9 -0
  225. package/lib/index.js +71 -0
  226. package/lib/packages/graph-canvas/graph-common.d.ts +19 -0
  227. package/lib/packages/graph-canvas/graph-common.js +27 -0
  228. package/lib/packages/graph-canvas/graph-model/edge/group-edge/edge.less +8 -0
  229. package/lib/packages/graph-canvas/graph-model/edge/group-edge/index.d.ts +4 -0
  230. package/lib/packages/graph-canvas/graph-model/edge/group-edge/index.js +74 -0
  231. package/lib/packages/graph-canvas/graph-model/edge/index.d.ts +2 -0
  232. package/lib/packages/graph-canvas/graph-model/edge/index.js +15 -0
  233. package/lib/packages/graph-canvas/graph-model/node/application-node/application-element.d.ts +9 -0
  234. package/lib/packages/graph-canvas/graph-model/node/application-node/application-element.js +31 -0
  235. package/lib/packages/graph-canvas/graph-model/node/application-node/application-element.less +17 -0
  236. package/lib/packages/graph-canvas/graph-model/node/application-node/index.d.ts +7 -0
  237. package/lib/packages/graph-canvas/graph-model/node/application-node/index.js +133 -0
  238. package/lib/packages/graph-canvas/graph-model/node/common-node/index.d.ts +7 -0
  239. package/lib/packages/graph-canvas/graph-model/node/common-node/index.js +133 -0
  240. package/lib/packages/graph-canvas/graph-model/node/common-node/node-element.d.ts +9 -0
  241. package/lib/packages/graph-canvas/graph-model/node/common-node/node-element.js +69 -0
  242. package/lib/packages/graph-canvas/graph-model/node/common-node/node-element.less +48 -0
  243. package/{es/common/graph-common/node-element/logical-element.d.ts → lib/packages/graph-canvas/graph-model/node/condition-node/condition-element.d.ts} +9 -9
  244. package/lib/packages/graph-canvas/graph-model/node/condition-node/condition-element.js +81 -0
  245. package/lib/packages/graph-canvas/graph-model/node/condition-node/condition-element.less +76 -0
  246. package/lib/packages/graph-canvas/graph-model/node/condition-node/images/rhombus.svg +3 -0
  247. package/{es/common/graph-common/shape/nodes/LogicalNode.d.ts → lib/packages/graph-canvas/graph-model/node/condition-node/index.d.ts} +5 -5
  248. package/lib/packages/graph-canvas/graph-model/node/condition-node/index.js +143 -0
  249. package/lib/packages/graph-canvas/graph-model/node/index.d.ts +5 -0
  250. package/lib/packages/graph-canvas/graph-model/node/index.js +39 -0
  251. package/lib/packages/graph-canvas/graph-model/node/logical-node/images/AND.svg +11 -0
  252. package/lib/packages/graph-canvas/graph-model/node/logical-node/images/OR.svg +11 -0
  253. package/lib/packages/graph-canvas/graph-model/node/logical-node/images/XOR.svg +11 -0
  254. package/lib/packages/graph-canvas/graph-model/node/logical-node/images/locking.svg +5 -0
  255. package/lib/packages/graph-canvas/graph-model/node/logical-node/images/unlock.svg +5 -0
  256. package/lib/packages/graph-canvas/graph-model/node/logical-node/index.d.ts +6 -0
  257. package/lib/packages/graph-canvas/graph-model/node/logical-node/index.js +143 -0
  258. package/lib/packages/graph-canvas/graph-model/node/logical-node/logical-element.d.ts +9 -0
  259. package/lib/packages/graph-canvas/graph-model/node/logical-node/logical-element.js +98 -0
  260. package/lib/packages/graph-canvas/graph-model/node/logical-node/logical-element.less +49 -0
  261. package/lib/packages/graph-canvas/graph-model/node/style.less +8 -0
  262. package/lib/packages/graph-canvas/graph-utils/graph.d.ts +87 -0
  263. package/lib/packages/graph-canvas/graph-utils/graph.js +124 -0
  264. package/lib/packages/graph-canvas/index.d.ts +79 -0
  265. package/lib/packages/graph-canvas/index.js +1292 -0
  266. package/lib/packages/graph-canvas/node-types.d.ts +6 -0
  267. package/lib/packages/graph-canvas/node-types.js +66 -0
  268. package/lib/packages/graph-canvas/typings.d.ts +5 -0
  269. package/lib/packages/graph-common/global.d.ts +1 -0
  270. package/lib/packages/graph-common/global.js +8 -0
  271. package/lib/packages/graph-common/graph.d.ts +12 -0
  272. package/lib/packages/graph-common/graph.js +37 -0
  273. package/lib/packages/graph-core/graph-util.d.ts +182 -0
  274. package/lib/packages/graph-core/graph-util.js +368 -0
  275. package/lib/packages/graph-core/index.d.ts +96 -0
  276. package/lib/packages/graph-core/index.js +798 -0
  277. package/lib/packages/graph-core/typing.d.ts +107 -0
  278. package/lib/packages/graph-model/connector/index.d.ts +1 -0
  279. package/lib/packages/graph-model/connector/index.js +17 -0
  280. package/lib/packages/graph-model/edge/edge.less +8 -0
  281. package/lib/packages/graph-model/edge/index.d.ts +5 -0
  282. package/lib/packages/graph-model/edge/index.js +73 -0
  283. package/lib/packages/graph-model/node/index.d.ts +7 -0
  284. package/lib/packages/graph-model/node/index.js +63 -0
  285. package/lib/packages/graph-model/node/node-basic.less +118 -0
  286. package/lib/packages/hooks/useObservableState.d.ts +3 -0
  287. package/lib/packages/hooks/useObservableState.js +55 -0
  288. package/lib/packages/hooks/withMode.d.ts +3 -0
  289. package/lib/packages/hooks/withMode.js +22 -0
  290. package/lib/style/basic.less +12 -0
  291. package/lib/style/default.less +10 -0
  292. package/lib/style/position.less +25 -0
  293. package/lib/style/svgRaw.d.ts +1 -0
  294. package/lib/style/svgRaw.js +8 -0
  295. package/lib/style/theme-light.less +7 -0
  296. package/lib/style/variable.less +3 -0
  297. package/lib/typings.d.ts +8 -0
  298. package/lib/utils/utils.d.ts +1 -0
  299. package/lib/utils/utils.js +13 -0
  300. package/package.json +38 -37
  301. package/tsconfig.json +1 -1
  302. package/es/common/graph-common/category-type.d.ts +0 -16
  303. package/es/common/graph-common/connector/index.js +0 -14
  304. package/es/common/graph-common/node-element/node-group.d.ts +0 -8
  305. package/es/common/graph-common/node-element/node-group.js +0 -395
  306. package/es/common/graph-common/node-element/node-group.less +0 -53
  307. package/es/common/graph-common/node-popover/index.d.ts +0 -7
  308. package/es/common/graph-common/node-popover/index.js +0 -11
  309. package/es/common/graph-common/node-popover/index.less +0 -5
  310. package/es/common/graph-common/node-types.d.ts +0 -28
  311. package/es/common/graph-common/node-types.js +0 -60
  312. package/es/common/graph-common/shape/edge.d.ts +0 -10
  313. package/es/common/graph-common/shape/node.d.ts +0 -6
  314. package/es/common/graph-common/shape/node.js +0 -6
  315. package/es/common/graph-common/shape/nodes/BaseNode.d.ts +0 -4
  316. package/es/common/graph-common/shape/nodes/GroupNode.d.ts +0 -4
  317. package/es/component/cut.d.ts +0 -10
  318. package/es/component/cut.js +0 -34
  319. package/es/component/cut.less +0 -6
  320. package/es/component/item-name.d.ts +0 -6
  321. package/es/component/item-name.js +0 -30
  322. package/es/component/keyword.d.ts +0 -9
  323. package/es/component/keyword.js +0 -26
  324. package/es/component/keyword.less +0 -11
  325. package/es/component/rx-component/rx-input.d.ts +0 -8
  326. package/es/component/rx-component/rx-input.js +0 -47
  327. package/es/hooks/withMode.d.ts +0 -1
  328. package/es/hooks/withMode.js +0 -16
  329. package/es/pages/dag-canvas/preview.js +0 -42
  330. package/es/pages/rx-models/graph-core.less +0 -14
  331. package/es/pages/rx-models/typing.d.ts +0 -126
  332. package/es/pages/strategy-header/index.js +0 -154
  333. /package/es/{pages → components/canvas}/component-tree-panel/category-tree/node-title.less +0 -0
  334. /package/es/{pages → components/canvas}/config-panel/components/time-trigger/delay-time.js +0 -0
  335. /package/es/{pages → components/canvas}/config-panel/components/time-trigger/persistent-time.js +0 -0
  336. /package/es/{pages → components/canvas}/dag-canvas/canvas-content.less +0 -0
  337. /package/es/{pages → components/canvas}/dag-canvas/index.less +0 -0
  338. /package/es/{pages → components/canvas}/strategy-header/theme-switch/style.less +0 -0
  339. /package/es/{common/graph-common/shape → packages/graph-canvas/graph-model/edge/group-edge}/edge.less +0 -0
  340. /package/es/{common/constants → packages/graph-common}/global.js +0 -0
  341. /package/es/{hooks → packages/hooks}/useObservableState.js +0 -0
@@ -0,0 +1,6 @@
1
+ export declare const SCENE_DISPLAY: any;
2
+ export declare const COMPONENTS_TYPE: any;
3
+ export declare const COMMONLY_USED: any;
4
+ export declare const SIGN_OPERATION: any;
5
+ export declare const MOTION_OPERATION: any;
6
+ export declare const PanelType: any;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SIGN_OPERATION = exports.SCENE_DISPLAY = exports.PanelType = exports.MOTION_OPERATION = exports.COMPONENTS_TYPE = exports.COMMONLY_USED = void 0;
7
+ var SCENE_DISPLAY = {
8
+ EQUIPMENT: 'SCENE_DISPLAY_EQUIPMENT',
9
+ // 设备触发
10
+ TIME: 'SCENE_DISPLAY_TIME',
11
+ // 时间触发
12
+ MANUAL: 'SCENE_DISPLAY_MANUAL' // 手动触发
13
+
14
+ }; // 场景触发
15
+
16
+ exports.SCENE_DISPLAY = SCENE_DISPLAY;
17
+ var COMPONENTS_TYPE = {
18
+ COMMONLY_USED: 'COMMONLY_USED',
19
+ // 通用组件
20
+ SCENE_DISPLAY: 'SCENE_DISPLAY',
21
+ // 场景触发
22
+ SIGN_OPERATION: 'SIGN_OPERATION',
23
+ // 运算符号
24
+ MOTION_OPERATION: 'MOTION_OPERATION',
25
+ // 运动符号
26
+ APPLICATION: 'APPLICATION' // 应用组件
27
+
28
+ };
29
+ exports.COMPONENTS_TYPE = COMPONENTS_TYPE;
30
+ var COMMONLY_USED = {
31
+ VARIATE: 'COMMONLY_USED_VARIATE',
32
+ // 变量
33
+ LOCKED: 'COMMONLY_USED_SERVICE_LOCKING'
34
+ }; // 通用组件
35
+
36
+ exports.COMMONLY_USED = COMMONLY_USED;
37
+ var SIGN_OPERATION = {
38
+ RELATION: 'SIGN_OPERATION_RELATION',
39
+ // 关系运算
40
+ LOGICAL: 'SIGN_OPERATION_LOGICAL',
41
+ // 逻辑运算
42
+ CONDITION: 'SIGN_OPERATION_CONDITION' // 条件判断
43
+
44
+ }; // 运算符号
45
+
46
+ exports.SIGN_OPERATION = SIGN_OPERATION;
47
+ var MOTION_OPERATION = {
48
+ ALARM: 'MOTION_OPERATION_ALARM',
49
+ // 报警
50
+ NOTICE: 'MOTION_OPERATION_NOTICE',
51
+ // 通知
52
+ ORDER: 'MOTION_OPERATION_ORDER',
53
+ // 派发工单
54
+ CONTROL: 'MOTION_OPERATION_CONTROL' // 远程控制
55
+
56
+ }; // 运动符号
57
+
58
+ exports.MOTION_OPERATION = MOTION_OPERATION;
59
+ var PanelType = {
60
+ COMMONLY_USED: COMMONLY_USED,
61
+ SCENE_DISPLAY: SCENE_DISPLAY,
62
+ SIGN_OPERATION: SIGN_OPERATION,
63
+ MOTION_OPERATION: MOTION_OPERATION,
64
+ COMPONENTS_TYPE: COMPONENTS_TYPE
65
+ };
66
+ exports.PanelType = PanelType;
@@ -0,0 +1,5 @@
1
+ export type ModeType = 'platform' | 'view';
2
+
3
+ export interface PanelComponentProps {
4
+ mode?: ModeType;
5
+ }
@@ -0,0 +1 @@
1
+ export declare const ANT_PREFIX = "ant";
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ANT_PREFIX = void 0;
7
+ var ANT_PREFIX = 'ant';
8
+ exports.ANT_PREFIX = ANT_PREFIX;
@@ -0,0 +1,12 @@
1
+ export declare const GROUP_HORIZONTAL__PADDING = 24;
2
+ export declare const GROUP_VERTICAL__PADDING = 40;
3
+ export declare const NODE_WIDTH = 180;
4
+ export declare const NODE_HEIGHT = 43;
5
+ export declare const APPLICATION_NODE_WIDTH = 400;
6
+ export declare const APPLICATION_NODE_HEIGHT = 300;
7
+ export declare const LOGICAL_EDG = 50;
8
+ export declare const CONDITION_WIDTH = 260;
9
+ export declare const CONDITION_HEIGHT = 107;
10
+ export declare const RERENDER_EVENT = "RERENDER_EVENT";
11
+ export declare const DRAGGABLE_ALGO_COMPONENT = "ALGO_COMPONENT";
12
+ export declare const DRAGGABLE_MODEL = "MODEL";
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.RERENDER_EVENT = exports.NODE_WIDTH = exports.NODE_HEIGHT = exports.LOGICAL_EDG = exports.GROUP_VERTICAL__PADDING = exports.GROUP_HORIZONTAL__PADDING = exports.DRAGGABLE_MODEL = exports.DRAGGABLE_ALGO_COMPONENT = exports.CONDITION_WIDTH = exports.CONDITION_HEIGHT = exports.APPLICATION_NODE_WIDTH = exports.APPLICATION_NODE_HEIGHT = void 0;
7
+ var GROUP_HORIZONTAL__PADDING = 24; // 分组横向 padding
8
+
9
+ exports.GROUP_HORIZONTAL__PADDING = GROUP_HORIZONTAL__PADDING;
10
+ var GROUP_VERTICAL__PADDING = 40; // 分组纵向 padding
11
+
12
+ exports.GROUP_VERTICAL__PADDING = GROUP_VERTICAL__PADDING;
13
+ var NODE_WIDTH = 180;
14
+ exports.NODE_WIDTH = NODE_WIDTH;
15
+ var NODE_HEIGHT = 43;
16
+ exports.NODE_HEIGHT = NODE_HEIGHT;
17
+ var APPLICATION_NODE_WIDTH = 400;
18
+ exports.APPLICATION_NODE_WIDTH = APPLICATION_NODE_WIDTH;
19
+ var APPLICATION_NODE_HEIGHT = 300;
20
+ exports.APPLICATION_NODE_HEIGHT = APPLICATION_NODE_HEIGHT;
21
+ var LOGICAL_EDG = 50;
22
+ exports.LOGICAL_EDG = LOGICAL_EDG;
23
+ var CONDITION_WIDTH = 260;
24
+ exports.CONDITION_WIDTH = CONDITION_WIDTH;
25
+ var CONDITION_HEIGHT = 107; // 触发画布重新渲染事件
26
+
27
+ exports.CONDITION_HEIGHT = CONDITION_HEIGHT;
28
+ var RERENDER_EVENT = 'RERENDER_EVENT';
29
+ /*
30
+ * 以下是拖拽相关
31
+ */
32
+
33
+ exports.RERENDER_EVENT = RERENDER_EVENT;
34
+ var DRAGGABLE_ALGO_COMPONENT = 'ALGO_COMPONENT';
35
+ exports.DRAGGABLE_ALGO_COMPONENT = DRAGGABLE_ALGO_COMPONENT;
36
+ var DRAGGABLE_MODEL = 'MODEL';
37
+ exports.DRAGGABLE_MODEL = DRAGGABLE_MODEL;
@@ -0,0 +1,182 @@
1
+ import type { NExperimentGraph } from './typing';
2
+ import type BaseNode from '../graph-model/node';
3
+ import '../graph-model/connector';
4
+ export declare function expandGroupAccordingToNodes(params: {
5
+ moveNodes: BaseNode[];
6
+ }): void;
7
+ export declare function formatNodeInfoToNodeMeta(nodeData: NExperimentGraph.Node, inputPortConnectedMap?: {
8
+ [k: string]: boolean;
9
+ }): {
10
+ x: number;
11
+ y: number;
12
+ type: string;
13
+ id: string;
14
+ data: {
15
+ type: string;
16
+ x: number;
17
+ y: number;
18
+ id: string;
19
+ outPorts: NExperimentGraph.Port[];
20
+ inPorts: NExperimentGraph.Port[];
21
+ positionX: number;
22
+ positionY: number;
23
+ codeName?: string | undefined;
24
+ category?: string | undefined;
25
+ name: string;
26
+ nodeInstanceId?: number | undefined;
27
+ groupId?: number | undefined;
28
+ status?: number | undefined;
29
+ };
30
+ ports: {
31
+ items: any[];
32
+ };
33
+ zIndex: number;
34
+ outPorts: NExperimentGraph.Port[];
35
+ inPorts: NExperimentGraph.Port[];
36
+ positionX: number;
37
+ positionY: number;
38
+ codeName?: string | undefined;
39
+ category?: string | undefined;
40
+ name: string;
41
+ nodeInstanceId?: number | undefined;
42
+ groupId?: number | undefined;
43
+ status?: number | undefined;
44
+ };
45
+ export declare function calcNodeScale(groupData: NExperimentGraph.Group, children: any[]): {
46
+ x: number;
47
+ y: number;
48
+ width: number;
49
+ height: number;
50
+ };
51
+ export declare function formatGroupInfoToNodeMeta(groupData: NExperimentGraph.Group, nodeData: any[], edges?: any[]): {
52
+ id: string;
53
+ x: number;
54
+ y: number;
55
+ width: number;
56
+ height: number;
57
+ zIndex: number;
58
+ data: {
59
+ type: string;
60
+ includedNodes: any[];
61
+ id: string;
62
+ isCollapsed: boolean;
63
+ experimentId: number;
64
+ name: string;
65
+ };
66
+ ports: {
67
+ items: {
68
+ group: string;
69
+ id: string;
70
+ connected: boolean;
71
+ }[];
72
+ };
73
+ isCollapsed: boolean;
74
+ experimentId: number;
75
+ name: string;
76
+ type: string;
77
+ } | {
78
+ id: string;
79
+ x: number;
80
+ y: number;
81
+ width: number;
82
+ height: number;
83
+ zIndex: number;
84
+ data: {
85
+ type: string;
86
+ includedNodes: any[];
87
+ id: string;
88
+ isCollapsed: boolean;
89
+ experimentId: number;
90
+ name: string;
91
+ };
92
+ isCollapsed: boolean;
93
+ experimentId: number;
94
+ name: string;
95
+ type: string;
96
+ };
97
+ export declare function formatGraphData(graphData?: NExperimentGraph.ExperimentGraph): {
98
+ nodes: ({
99
+ x: number;
100
+ y: number;
101
+ type: string;
102
+ id: string;
103
+ data: {
104
+ type: string;
105
+ x: number;
106
+ y: number;
107
+ id: string;
108
+ outPorts: NExperimentGraph.Port[];
109
+ inPorts: NExperimentGraph.Port[];
110
+ positionX: number;
111
+ positionY: number;
112
+ codeName?: string | undefined;
113
+ category?: string | undefined;
114
+ name: string;
115
+ nodeInstanceId?: number | undefined;
116
+ groupId?: number | undefined;
117
+ status?: number | undefined;
118
+ };
119
+ ports: {
120
+ items: any[];
121
+ };
122
+ zIndex: number;
123
+ outPorts: NExperimentGraph.Port[];
124
+ inPorts: NExperimentGraph.Port[];
125
+ positionX: number;
126
+ positionY: number;
127
+ codeName?: string | undefined;
128
+ category?: string | undefined;
129
+ name: string;
130
+ nodeInstanceId?: number | undefined;
131
+ groupId?: number | undefined;
132
+ status?: number | undefined;
133
+ } | {
134
+ id: string;
135
+ x: number;
136
+ y: number;
137
+ width: number;
138
+ height: number;
139
+ zIndex: number;
140
+ data: {
141
+ type: string;
142
+ includedNodes: any[];
143
+ id: string;
144
+ isCollapsed: boolean;
145
+ experimentId: number;
146
+ name: string;
147
+ };
148
+ isCollapsed: boolean;
149
+ experimentId: number;
150
+ name: string;
151
+ type: string;
152
+ })[];
153
+ edges: {
154
+ data: {
155
+ inputPortId: number;
156
+ outputPortId: number;
157
+ source: number;
158
+ type?: string | undefined;
159
+ target: number;
160
+ };
161
+ sourceAnchor: string;
162
+ source: {
163
+ cell: string;
164
+ port: string;
165
+ anchor: {
166
+ name: string;
167
+ };
168
+ };
169
+ target: {
170
+ cell: string;
171
+ port: string;
172
+ anchor: {
173
+ name: string;
174
+ };
175
+ };
176
+ label: string;
177
+ zIndex: number;
178
+ inputPortId: number;
179
+ outputPortId: number;
180
+ type?: string | undefined;
181
+ }[];
182
+ };
@@ -0,0 +1,368 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.calcNodeScale = calcNodeScale;
7
+ exports.expandGroupAccordingToNodes = expandGroupAccordingToNodes;
8
+ exports.formatGraphData = formatGraphData;
9
+ exports.formatGroupInfoToNodeMeta = formatGroupInfoToNodeMeta;
10
+ exports.formatNodeInfoToNodeMeta = formatNodeInfoToNodeMeta;
11
+
12
+ var _lodashEs = require("lodash-es");
13
+
14
+ var _graph = require("../graph-common/graph");
15
+
16
+ require("../graph-model/connector");
17
+
18
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
19
+
20
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
21
+
22
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
23
+
24
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
25
+
26
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
27
+
28
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
29
+
30
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
31
+
32
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
33
+
34
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
35
+
36
+ // group 范围适应内部节点变化
37
+ function expandGroupAccordingToNodes(params) {
38
+ var moveNodes = params.moveNodes;
39
+ var parentNodes = [];
40
+ moveNodes.forEach(function (node) {
41
+ var parentNode = node.getParent();
42
+
43
+ if (parentNode && !parentNodes.includes(parentNode)) {
44
+ parentNodes.push(parentNode);
45
+ }
46
+ });
47
+ parentNodes.forEach(function (parent) {
48
+ var originSize = parent.getSize();
49
+ var originPosition = parent.getPosition();
50
+ var originX = originPosition.x;
51
+ var originY = originPosition.y;
52
+ var originWidth = originSize.width;
53
+ var originHeight = originSize.height;
54
+ var children = parent.getChildren();
55
+ var childNodes = children.filter(function (child) {
56
+ return child.isNode();
57
+ });
58
+
59
+ if (childNodes !== null && childNodes !== void 0 && childNodes.length) {
60
+ var _minBy, _minBy2, _maxBy, _maxBy2;
61
+
62
+ var positions = childNodes.map(function (childNode) {
63
+ return childNode.getPosition();
64
+ });
65
+ var minX = ((_minBy = (0, _lodashEs.minBy)(positions, 'x')) === null || _minBy === void 0 ? void 0 : _minBy.x) || 0;
66
+ var minY = ((_minBy2 = (0, _lodashEs.minBy)(positions, 'y')) === null || _minBy2 === void 0 ? void 0 : _minBy2.y) || 0;
67
+ var maxX = ((_maxBy = (0, _lodashEs.maxBy)(positions, 'x')) === null || _maxBy === void 0 ? void 0 : _maxBy.x) || 0;
68
+ var maxY = ((_maxBy2 = (0, _lodashEs.maxBy)(positions, 'y')) === null || _maxBy2 === void 0 ? void 0 : _maxBy2.y) || 0;
69
+ var nextX = minX - _graph.GROUP_HORIZONTAL__PADDING;
70
+ var nextY = minY - _graph.GROUP_VERTICAL__PADDING;
71
+ var nextWidth = maxX - minX + 2 * _graph.GROUP_HORIZONTAL__PADDING + _graph.NODE_WIDTH;
72
+ var nextHeight = maxY - minY + 2 * _graph.GROUP_VERTICAL__PADDING + _graph.NODE_HEIGHT;
73
+
74
+ if (originX !== nextX || originY !== nextY || originWidth !== nextWidth || originHeight !== nextHeight) {
75
+ parent.prop({
76
+ position: {
77
+ x: nextX,
78
+ y: nextY
79
+ },
80
+ size: {
81
+ width: nextWidth,
82
+ height: nextHeight
83
+ }
84
+ });
85
+ }
86
+ }
87
+ });
88
+ } // 格式化单个节点,新增节点时复用
89
+
90
+
91
+ function formatNodeInfoToNodeMeta(nodeData) {
92
+ var inputPortConnectedMap = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
93
+ console.log('formatNodeInfoToNodeMeta', nodeData);
94
+ var portItems = [];
95
+ var id = nodeData.id,
96
+ nodeInstanceId = nodeData.nodeInstanceId,
97
+ positionX = nodeData.positionX,
98
+ positionY = nodeData.positionY,
99
+ inPorts = nodeData.inPorts,
100
+ outPorts = nodeData.outPorts;
101
+ (0, _lodashEs.sortBy)(inPorts, 'sequence').forEach(function (inPort) {
102
+ portItems.push(_objectSpread(_objectSpread({}, inPort), {}, {
103
+ group: 'in',
104
+ id: inPort.id.toString(),
105
+ connected: inputPortConnectedMap[inPort.id.toString()]
106
+ }));
107
+ });
108
+ (0, _lodashEs.sortBy)(outPorts, 'sequence').forEach(function (outPort) {
109
+ portItems.push(_objectSpread(_objectSpread({}, outPort), {}, {
110
+ group: (outPort === null || outPort === void 0 ? void 0 : outPort.group) || 'out',
111
+ id: outPort.id.toString(),
112
+ connected: inputPortConnectedMap[outPort.id.toString()]
113
+ }));
114
+ });
115
+ var x = positionX || 0;
116
+ var y = positionY || 0;
117
+ return _objectSpread(_objectSpread({}, nodeData), {}, {
118
+ x: x,
119
+ y: y,
120
+ type: 'node',
121
+ id: (nodeInstanceId || id).toString(),
122
+ data: _objectSpread(_objectSpread({}, nodeData), {}, {
123
+ type: 'node',
124
+ x: x,
125
+ y: y,
126
+ id: (nodeInstanceId || id).toString()
127
+ }),
128
+ ports: {
129
+ items: portItems
130
+ },
131
+ zIndex: 10
132
+ });
133
+ } // 根据群组节点的收缩状态及子节点,计算出节点群组的尺寸和位置
134
+
135
+
136
+ function calcNodeScale(groupData, children) {
137
+ var _minBy3, _minBy4, _maxBy3, _maxBy4;
138
+
139
+ var _groupData$isCollapse = groupData.isCollapsed,
140
+ isCollapsed = _groupData$isCollapse === void 0 ? false : _groupData$isCollapse;
141
+ var minX = (_minBy3 = (0, _lodashEs.minBy)(children, 'x')) === null || _minBy3 === void 0 ? void 0 : _minBy3.x;
142
+ var minY = (_minBy4 = (0, _lodashEs.minBy)(children, 'y')) === null || _minBy4 === void 0 ? void 0 : _minBy4.y;
143
+ var maxX = (_maxBy3 = (0, _lodashEs.maxBy)(children, 'x')) === null || _maxBy3 === void 0 ? void 0 : _maxBy3.x;
144
+ var maxY = (_maxBy4 = (0, _lodashEs.maxBy)(children, 'y')) === null || _maxBy4 === void 0 ? void 0 : _maxBy4.y;
145
+ var defaultX = minX - _graph.GROUP_HORIZONTAL__PADDING;
146
+ var defaultY = minY - _graph.GROUP_VERTICAL__PADDING;
147
+ var defaultWidth = maxX - minX + 2 * _graph.GROUP_HORIZONTAL__PADDING + _graph.NODE_WIDTH;
148
+
149
+ if (isCollapsed) {
150
+ return {
151
+ x: defaultX + defaultWidth / 2 - _graph.NODE_WIDTH / 2,
152
+ y: defaultY,
153
+ width: _graph.NODE_WIDTH,
154
+ height: _graph.NODE_HEIGHT
155
+ };
156
+ }
157
+
158
+ return {
159
+ x: defaultX,
160
+ y: defaultY,
161
+ width: defaultWidth,
162
+ height: maxY - minY + 2 * _graph.GROUP_VERTICAL__PADDING + _graph.NODE_HEIGHT
163
+ };
164
+ } // 格式化单个群组,新增群组时复用
165
+
166
+
167
+ function formatGroupInfoToNodeMeta(groupData, nodeData, edges) {
168
+ var id = groupData.id,
169
+ _groupData$isCollapse2 = groupData.isCollapsed,
170
+ isCollapsed = _groupData$isCollapse2 === void 0 ? false : _groupData$isCollapse2;
171
+ var includedNodes = nodeData.filter(function (nodeMeta) {
172
+ return nodeMeta.groupId.toString() === id.toString();
173
+ });
174
+
175
+ var _calcNodeScale = calcNodeScale(groupData, includedNodes),
176
+ x = _calcNodeScale.x,
177
+ y = _calcNodeScale.y,
178
+ width = _calcNodeScale.width,
179
+ height = _calcNodeScale.height; // group 已收缩则必定已存在,而不是处理新增的 group,因此处理的 nodeData 是 meta 数据而不是 getData 的数据
180
+
181
+
182
+ if (isCollapsed && edges) {
183
+ // eslint-disable-next-line no-param-reassign
184
+ includedNodes.forEach(function (node) {
185
+ node.data.hide = true;
186
+ });
187
+ var includedNodeIds = includedNodes.map(function (nodeDataItem) {
188
+ return nodeDataItem.id.toString();
189
+ }); // 从外部进入到 group 内部的连线
190
+
191
+ var edgesFromOutside = edges.filter(function (edge) {
192
+ var source = edge.source,
193
+ target = edge.target;
194
+ return includedNodeIds.includes(target.cell.toString()) && !includedNodeIds.includes(source.cell.toString());
195
+ }); // 从 group 穿到外部的连线
196
+
197
+ var edgesToOutside = edges.filter(function (edge) {
198
+ var source = edge.source,
199
+ target = edge.target;
200
+ return includedNodeIds.includes(source.cell.toString()) && !includedNodeIds.includes(target.cell.toString());
201
+ });
202
+ var portItems = [];
203
+
204
+ if (edgesFromOutside !== null && edgesFromOutside !== void 0 && edgesFromOutside.length) {
205
+ var portId = Date.now().toString();
206
+ portItems.push({
207
+ group: 'in',
208
+ id: portId,
209
+ connected: true
210
+ }); // 增加 group 的输入桩
211
+ // 增加连接到 group 输入桩的连线
212
+
213
+ edgesFromOutside.forEach(function (edge) {
214
+ var source = edge.source,
215
+ outputPortId = edge.outputPortId;
216
+ edges.push({
217
+ sourceAnchor: 'bottom',
218
+ source: {
219
+ cell: source.cell.toString(),
220
+ port: outputPortId.toString(),
221
+ anchor: {
222
+ name: 'bottom'
223
+ }
224
+ },
225
+ target: {
226
+ cell: id.toString(),
227
+ port: portId,
228
+ anchor: {
229
+ name: 'center'
230
+ }
231
+ },
232
+ label: '',
233
+ zIndex: 1
234
+ });
235
+ });
236
+ }
237
+
238
+ if (edgesToOutside !== null && edgesToOutside !== void 0 && edgesToOutside.length) {
239
+ var _portId = (Date.now() + 1).toString();
240
+
241
+ portItems.push({
242
+ group: 'out',
243
+ id: _portId,
244
+ connected: false
245
+ }); // 增加 group 的输出桩
246
+ // 增加链接到 group 输出桩的连线
247
+
248
+ edgesToOutside.forEach(function (edge) {
249
+ var target = edge.target,
250
+ inputPortId = edge.inputPortId;
251
+ edges.push({
252
+ type: 'group',
253
+ sourceAnchor: 'bottom',
254
+ source: {
255
+ cell: id,
256
+ port: _portId,
257
+ anchor: {
258
+ name: 'bottom'
259
+ }
260
+ },
261
+ target: {
262
+ cell: target.cell,
263
+ port: inputPortId,
264
+ anchor: {
265
+ name: 'center'
266
+ }
267
+ },
268
+ label: '',
269
+ zIndex: 1
270
+ });
271
+ });
272
+ }
273
+
274
+ return _objectSpread(_objectSpread({
275
+ type: 'group'
276
+ }, groupData), {}, {
277
+ id: id.toString(),
278
+ x: x,
279
+ y: y,
280
+ width: width,
281
+ height: height,
282
+ zIndex: 1,
283
+ data: _objectSpread(_objectSpread({}, groupData), {}, {
284
+ type: 'group',
285
+ includedNodes: includedNodes,
286
+ id: id.toString()
287
+ }),
288
+ ports: {
289
+ items: portItems
290
+ }
291
+ });
292
+ }
293
+
294
+ return _objectSpread(_objectSpread({
295
+ type: 'group'
296
+ }, groupData), {}, {
297
+ id: id.toString(),
298
+ x: x,
299
+ y: y,
300
+ width: width,
301
+ height: height,
302
+ zIndex: 1,
303
+ data: _objectSpread(_objectSpread({}, groupData), {}, {
304
+ type: 'group',
305
+ includedNodes: includedNodes,
306
+ id: id.toString()
307
+ })
308
+ });
309
+ } // 将接口返回的图信息转换为图渲染引擎可渲染的信息
310
+
311
+
312
+ function formatGraphData() {
313
+ var graphData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
314
+ var _graphData$nodes = graphData.nodes,
315
+ nodes = _graphData$nodes === void 0 ? [] : _graphData$nodes,
316
+ _graphData$links = graphData.links,
317
+ links = _graphData$links === void 0 ? [] : _graphData$links,
318
+ _graphData$groups = graphData.groups,
319
+ groups = _graphData$groups === void 0 ? [] : _graphData$groups; // 格式化边
320
+
321
+ var formattedEdges = links.map(function (link) {
322
+ var source = link.source,
323
+ outputPortId = link.outputPortId,
324
+ target = link.target,
325
+ inputPortId = link.inputPortId;
326
+ return _objectSpread(_objectSpread({}, link), {}, {
327
+ data: _objectSpread({}, link),
328
+ sourceAnchor: 'bottom',
329
+ source: {
330
+ cell: source.toString(),
331
+ port: outputPortId.toString(),
332
+ anchor: {
333
+ name: 'bottom'
334
+ }
335
+ },
336
+ target: {
337
+ cell: target.toString(),
338
+ port: inputPortId.toString(),
339
+ anchor: {
340
+ name: 'center'
341
+ }
342
+ },
343
+ label: '',
344
+ zIndex: 1
345
+ });
346
+ }); // 记录所有已连线的输入桩
347
+
348
+ var inputPortConnectedMap = formattedEdges.reduce(function (acc, edge) {
349
+ acc[edge.inputPortId] = true;
350
+ return acc;
351
+ }, {}); // 格式化算法组件节点
352
+
353
+ var formattedNodes = nodes.map(function (nodeData) {
354
+ return formatNodeInfoToNodeMeta(nodeData, inputPortConnectedMap);
355
+ }); // 格式化群组节点
356
+
357
+ var formattedGroups = groups.map(function (groupData) {
358
+ return formatGroupInfoToNodeMeta(groupData, formattedNodes, formattedEdges);
359
+ });
360
+ return {
361
+ nodes: [].concat(_toConsumableArray(formattedNodes), _toConsumableArray(formattedGroups.filter(function (group) {
362
+ var _group$data, _group$data$includedN;
363
+
364
+ return !!(group !== null && group !== void 0 && (_group$data = group.data) !== null && _group$data !== void 0 && (_group$data$includedN = _group$data.includedNodes) !== null && _group$data$includedN !== void 0 && _group$data$includedN.length);
365
+ }))),
366
+ edges: formattedEdges
367
+ };
368
+ }