dcim-topology2d 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (512) hide show
  1. package/activity-diagram/index.d.ts +5 -0
  2. package/activity-diagram/index.js +6 -0
  3. package/activity-diagram/index.js.map +1 -0
  4. package/activity-diagram/src/final/final.d.ts +2 -0
  5. package/activity-diagram/src/final/final.js +10 -0
  6. package/activity-diagram/src/final/final.js.map +1 -0
  7. package/activity-diagram/src/final/final.rect.d.ts +3 -0
  8. package/activity-diagram/src/final/final.rect.js +11 -0
  9. package/activity-diagram/src/final/final.rect.js.map +1 -0
  10. package/activity-diagram/src/final/index.d.ts +2 -0
  11. package/activity-diagram/src/final/index.js +3 -0
  12. package/activity-diagram/src/final/index.js.map +1 -0
  13. package/activity-diagram/src/fork/fork.anchor.d.ts +3 -0
  14. package/activity-diagram/src/fork/fork.anchor.js +28 -0
  15. package/activity-diagram/src/fork/fork.anchor.js.map +1 -0
  16. package/activity-diagram/src/fork/fork.d.ts +2 -0
  17. package/activity-diagram/src/fork/fork.js +25 -0
  18. package/activity-diagram/src/fork/fork.js.map +1 -0
  19. package/activity-diagram/src/fork/fork.rect.d.ts +3 -0
  20. package/activity-diagram/src/fork/fork.rect.js +9 -0
  21. package/activity-diagram/src/fork/fork.rect.js.map +1 -0
  22. package/activity-diagram/src/fork/index.d.ts +3 -0
  23. package/activity-diagram/src/fork/index.js +4 -0
  24. package/activity-diagram/src/fork/index.js.map +1 -0
  25. package/activity-diagram/src/register.d.ts +1 -0
  26. package/activity-diagram/src/register.js +13 -0
  27. package/activity-diagram/src/register.js.map +1 -0
  28. package/activity-diagram/src/swimlaneH/index.d.ts +2 -0
  29. package/activity-diagram/src/swimlaneH/index.js +3 -0
  30. package/activity-diagram/src/swimlaneH/index.js.map +1 -0
  31. package/activity-diagram/src/swimlaneH/swimlaneH.d.ts +2 -0
  32. package/activity-diagram/src/swimlaneH/swimlaneH.js +27 -0
  33. package/activity-diagram/src/swimlaneH/swimlaneH.js.map +1 -0
  34. package/activity-diagram/src/swimlaneH/swimlaneH.rect.d.ts +3 -0
  35. package/activity-diagram/src/swimlaneH/swimlaneH.rect.js +9 -0
  36. package/activity-diagram/src/swimlaneH/swimlaneH.rect.js.map +1 -0
  37. package/activity-diagram/src/swimlaneV/index.d.ts +2 -0
  38. package/activity-diagram/src/swimlaneV/index.js +3 -0
  39. package/activity-diagram/src/swimlaneV/index.js.map +1 -0
  40. package/activity-diagram/src/swimlaneV/swimlaneV.d.ts +2 -0
  41. package/activity-diagram/src/swimlaneV/swimlaneV.js +27 -0
  42. package/activity-diagram/src/swimlaneV/swimlaneV.js.map +1 -0
  43. package/activity-diagram/src/swimlaneV/swimlaneV.rect.d.ts +3 -0
  44. package/activity-diagram/src/swimlaneV/swimlaneV.rect.js +9 -0
  45. package/activity-diagram/src/swimlaneV/swimlaneV.rect.js.map +1 -0
  46. package/chart-diagram/index.d.ts +3 -0
  47. package/chart-diagram/index.js +4 -0
  48. package/chart-diagram/index.js.map +1 -0
  49. package/chart-diagram/src/echarts/echarts.min.js +22 -0
  50. package/chart-diagram/src/echarts/index.d.ts +4 -0
  51. package/chart-diagram/src/echarts/index.js +104 -0
  52. package/chart-diagram/src/echarts/index.js.map +1 -0
  53. package/chart-diagram/src/register.d.ts +1 -0
  54. package/chart-diagram/src/register.js +12 -0
  55. package/chart-diagram/src/register.js.map +1 -0
  56. package/class-diagram/index.d.ts +2 -0
  57. package/class-diagram/index.js +3 -0
  58. package/class-diagram/index.js.map +1 -0
  59. package/class-diagram/src/class/class.d.ts +3 -0
  60. package/class-diagram/src/class/class.js +56 -0
  61. package/class-diagram/src/class/class.js.map +1 -0
  62. package/class-diagram/src/class/class.rect.d.ts +5 -0
  63. package/class-diagram/src/class/class.rect.js +16 -0
  64. package/class-diagram/src/class/class.rect.js.map +1 -0
  65. package/class-diagram/src/class/index.d.ts +2 -0
  66. package/class-diagram/src/class/index.js +3 -0
  67. package/class-diagram/src/class/index.js.map +1 -0
  68. package/class-diagram/src/register.d.ts +1 -0
  69. package/class-diagram/src/register.js +7 -0
  70. package/class-diagram/src/register.js.map +1 -0
  71. package/core/index.d.ts +8 -0
  72. package/core/index.js +26 -0
  73. package/core/index.js.map +1 -0
  74. package/core/src/activeLayer.d.ts +55 -0
  75. package/core/src/activeLayer.js +679 -0
  76. package/core/src/activeLayer.js.map +1 -0
  77. package/core/src/animateLayer.d.ts +23 -0
  78. package/core/src/animateLayer.js +227 -0
  79. package/core/src/animateLayer.js.map +1 -0
  80. package/core/src/calling.d.ts +37 -0
  81. package/core/src/calling.js +253 -0
  82. package/core/src/canvas.d.ts +19 -0
  83. package/core/src/canvas.js +81 -0
  84. package/core/src/canvas.js.map +1 -0
  85. package/core/src/common.d.ts +102 -0
  86. package/core/src/common.js +1254 -0
  87. package/core/src/core.d.ts +104 -0
  88. package/core/src/core.js +2281 -0
  89. package/core/src/core.js.map +1 -0
  90. package/core/src/divLayer.d.ts +61 -0
  91. package/core/src/divLayer.js +485 -0
  92. package/core/src/divLayer.js.map +1 -0
  93. package/core/src/healps/changeData.d.ts +8 -0
  94. package/core/src/healps/changeData.js +205 -0
  95. package/core/src/healps/index.d.ts +1 -0
  96. package/core/src/healps/index.js +1 -0
  97. package/core/src/hoverLayer.d.ts +32 -0
  98. package/core/src/hoverLayer.js +199 -0
  99. package/core/src/hoverLayer.js.map +1 -0
  100. package/core/src/layer.d.ts +5 -0
  101. package/core/src/layer.js +11 -0
  102. package/core/src/layer.js.map +1 -0
  103. package/core/src/middles/arrows/circle.d.ts +3 -0
  104. package/core/src/middles/arrows/circle.js +20 -0
  105. package/core/src/middles/arrows/circle.js.map +1 -0
  106. package/core/src/middles/arrows/diamond.d.ts +3 -0
  107. package/core/src/middles/arrows/diamond.js +28 -0
  108. package/core/src/middles/arrows/diamond.js.map +1 -0
  109. package/core/src/middles/arrows/line.d.ts +4 -0
  110. package/core/src/middles/arrows/line.js +42 -0
  111. package/core/src/middles/arrows/line.js.map +1 -0
  112. package/core/src/middles/arrows/triangle.d.ts +3 -0
  113. package/core/src/middles/arrows/triangle.js +25 -0
  114. package/core/src/middles/arrows/triangle.js.map +1 -0
  115. package/core/src/middles/default.anchor.d.ts +2 -0
  116. package/core/src/middles/default.anchor.js +9 -0
  117. package/core/src/middles/default.anchor.js.map +1 -0
  118. package/core/src/middles/default.d.ts +12 -0
  119. package/core/src/middles/default.js +257 -0
  120. package/core/src/middles/default.js.map +1 -0
  121. package/core/src/middles/default.rect.d.ts +3 -0
  122. package/core/src/middles/default.rect.js +19 -0
  123. package/core/src/middles/default.rect.js.map +1 -0
  124. package/core/src/middles/index.d.ts +3 -0
  125. package/core/src/middles/index.js +4 -0
  126. package/core/src/middles/index.js.map +1 -0
  127. package/core/src/middles/lines/curve.d.ts +10 -0
  128. package/core/src/middles/lines/curve.js +127 -0
  129. package/core/src/middles/lines/curve.js.map +1 -0
  130. package/core/src/middles/lines/line.d.ts +4 -0
  131. package/core/src/middles/lines/line.js +11 -0
  132. package/core/src/middles/lines/line.js.map +1 -0
  133. package/core/src/middles/lines/mind.d.ts +6 -0
  134. package/core/src/middles/lines/mind.js +90 -0
  135. package/core/src/middles/lines/mind.js.map +1 -0
  136. package/core/src/middles/lines/polyline.d.ts +7 -0
  137. package/core/src/middles/lines/polyline.js +309 -0
  138. package/core/src/middles/lines/polyline.js.map +1 -0
  139. package/core/src/middles/nodes/arbitrarygraph.anchor.d.ts +2 -0
  140. package/core/src/middles/nodes/arbitrarygraph.anchor.js +18 -0
  141. package/core/src/middles/nodes/arbitrarygraph.d.ts +2 -0
  142. package/core/src/middles/nodes/arbitrarygraph.js +17 -0
  143. package/core/src/middles/nodes/arrow.anchor.d.ts +2 -0
  144. package/core/src/middles/nodes/arrow.anchor.js +7 -0
  145. package/core/src/middles/nodes/arrow.anchor.js.map +1 -0
  146. package/core/src/middles/nodes/arrow.d.ts +4 -0
  147. package/core/src/middles/nodes/arrow.js +44 -0
  148. package/core/src/middles/nodes/arrow.js.map +1 -0
  149. package/core/src/middles/nodes/arrow.rect.d.ts +7 -0
  150. package/core/src/middles/nodes/arrow.rect.js +23 -0
  151. package/core/src/middles/nodes/arrow.rect.js.map +1 -0
  152. package/core/src/middles/nodes/circle.anchor.d.ts +2 -0
  153. package/core/src/middles/nodes/circle.anchor.js +18 -0
  154. package/core/src/middles/nodes/circle.anchor.js.map +1 -0
  155. package/core/src/middles/nodes/circle.d.ts +2 -0
  156. package/core/src/middles/nodes/circle.js +7 -0
  157. package/core/src/middles/nodes/circle.js.map +1 -0
  158. package/core/src/middles/nodes/circle.rect.d.ts +3 -0
  159. package/core/src/middles/nodes/circle.rect.js +27 -0
  160. package/core/src/middles/nodes/circle.rect.js.map +1 -0
  161. package/core/src/middles/nodes/cloud.anchor.d.ts +2 -0
  162. package/core/src/middles/nodes/cloud.anchor.js +9 -0
  163. package/core/src/middles/nodes/cloud.anchor.js.map +1 -0
  164. package/core/src/middles/nodes/cloud.d.ts +2 -0
  165. package/core/src/middles/nodes/cloud.js +11 -0
  166. package/core/src/middles/nodes/cloud.js.map +1 -0
  167. package/core/src/middles/nodes/cloud.rect.d.ts +3 -0
  168. package/core/src/middles/nodes/cloud.rect.js +9 -0
  169. package/core/src/middles/nodes/cloud.rect.js.map +1 -0
  170. package/core/src/middles/nodes/cube.anchor.d.ts +2 -0
  171. package/core/src/middles/nodes/cube.anchor.js +10 -0
  172. package/core/src/middles/nodes/cube.anchor.js.map +1 -0
  173. package/core/src/middles/nodes/cube.d.ts +2 -0
  174. package/core/src/middles/nodes/cube.js +5 -0
  175. package/core/src/middles/nodes/cube.js.map +1 -0
  176. package/core/src/middles/nodes/cube.model.d.ts +14 -0
  177. package/core/src/middles/nodes/cube.model.js +64 -0
  178. package/core/src/middles/nodes/cube.model.js.map +1 -0
  179. package/core/src/middles/nodes/cube.rect.d.ts +3 -0
  180. package/core/src/middles/nodes/cube.rect.js +11 -0
  181. package/core/src/middles/nodes/cube.rect.js.map +1 -0
  182. package/core/src/middles/nodes/diamond.d.ts +2 -0
  183. package/core/src/middles/nodes/diamond.js +11 -0
  184. package/core/src/middles/nodes/diamond.js.map +1 -0
  185. package/core/src/middles/nodes/diamond.rect.d.ts +3 -0
  186. package/core/src/middles/nodes/diamond.rect.js +27 -0
  187. package/core/src/middles/nodes/diamond.rect.js.map +1 -0
  188. package/core/src/middles/nodes/file.d.ts +2 -0
  189. package/core/src/middles/nodes/file.js +16 -0
  190. package/core/src/middles/nodes/file.js.map +1 -0
  191. package/core/src/middles/nodes/formtable.d.ts +2 -0
  192. package/core/src/middles/nodes/formtable.js +100 -0
  193. package/core/src/middles/nodes/hexagon.anchor.d.ts +2 -0
  194. package/core/src/middles/nodes/hexagon.anchor.js +21 -0
  195. package/core/src/middles/nodes/hexagon.anchor.js.map +1 -0
  196. package/core/src/middles/nodes/hexagon.d.ts +2 -0
  197. package/core/src/middles/nodes/hexagon.js +14 -0
  198. package/core/src/middles/nodes/hexagon.js.map +1 -0
  199. package/core/src/middles/nodes/hexagon.rect.d.ts +3 -0
  200. package/core/src/middles/nodes/hexagon.rect.js +14 -0
  201. package/core/src/middles/nodes/hexagon.rect.js.map +1 -0
  202. package/core/src/middles/nodes/image.anchor.d.ts +2 -0
  203. package/core/src/middles/nodes/image.anchor.js +12 -0
  204. package/core/src/middles/nodes/image.anchor.js.map +1 -0
  205. package/core/src/middles/nodes/image.rect.d.ts +3 -0
  206. package/core/src/middles/nodes/image.rect.js +65 -0
  207. package/core/src/middles/nodes/image.rect.js.map +1 -0
  208. package/core/src/middles/nodes/line.anchor.d.ts +2 -0
  209. package/core/src/middles/nodes/line.anchor.js +13 -0
  210. package/core/src/middles/nodes/line.anchor.js.map +1 -0
  211. package/core/src/middles/nodes/line.d.ts +2 -0
  212. package/core/src/middles/nodes/line.js +9 -0
  213. package/core/src/middles/nodes/line.js.map +1 -0
  214. package/core/src/middles/nodes/line.rect.d.ts +3 -0
  215. package/core/src/middles/nodes/line.rect.js +9 -0
  216. package/core/src/middles/nodes/line.rect.js.map +1 -0
  217. package/core/src/middles/nodes/message.anchor.d.ts +2 -0
  218. package/core/src/middles/nodes/message.anchor.js +9 -0
  219. package/core/src/middles/nodes/message.anchor.js.map +1 -0
  220. package/core/src/middles/nodes/message.d.ts +2 -0
  221. package/core/src/middles/nodes/message.js +14 -0
  222. package/core/src/middles/nodes/message.js.map +1 -0
  223. package/core/src/middles/nodes/message.rect.d.ts +3 -0
  224. package/core/src/middles/nodes/message.rect.js +10 -0
  225. package/core/src/middles/nodes/message.rect.js.map +1 -0
  226. package/core/src/middles/nodes/pentagon.anchor.d.ts +2 -0
  227. package/core/src/middles/nodes/pentagon.anchor.js +10 -0
  228. package/core/src/middles/nodes/pentagon.anchor.js.map +1 -0
  229. package/core/src/middles/nodes/pentagon.d.ts +2 -0
  230. package/core/src/middles/nodes/pentagon.js +12 -0
  231. package/core/src/middles/nodes/pentagon.js.map +1 -0
  232. package/core/src/middles/nodes/pentagon.rect.d.ts +3 -0
  233. package/core/src/middles/nodes/pentagon.rect.js +23 -0
  234. package/core/src/middles/nodes/pentagon.rect.js.map +1 -0
  235. package/core/src/middles/nodes/pentagram.anchor.d.ts +2 -0
  236. package/core/src/middles/nodes/pentagram.anchor.js +10 -0
  237. package/core/src/middles/nodes/pentagram.anchor.js.map +1 -0
  238. package/core/src/middles/nodes/pentagram.d.ts +2 -0
  239. package/core/src/middles/nodes/pentagram.js +11 -0
  240. package/core/src/middles/nodes/pentagram.js.map +1 -0
  241. package/core/src/middles/nodes/pentagram.rect.d.ts +3 -0
  242. package/core/src/middles/nodes/pentagram.rect.js +11 -0
  243. package/core/src/middles/nodes/pentagram.rect.js.map +1 -0
  244. package/core/src/middles/nodes/people.d.ts +2 -0
  245. package/core/src/middles/nodes/people.js +17 -0
  246. package/core/src/middles/nodes/people.js.map +1 -0
  247. package/core/src/middles/nodes/people.rect.d.ts +3 -0
  248. package/core/src/middles/nodes/people.rect.js +9 -0
  249. package/core/src/middles/nodes/people.rect.js.map +1 -0
  250. package/core/src/middles/nodes/rectangle.d.ts +2 -0
  251. package/core/src/middles/nodes/rectangle.js +25 -0
  252. package/core/src/middles/nodes/rectangle.js.map +1 -0
  253. package/core/src/middles/nodes/rectangle.rect.d.ts +3 -0
  254. package/core/src/middles/nodes/rectangle.rect.js +11 -0
  255. package/core/src/middles/nodes/rectangle.rect.js.map +1 -0
  256. package/core/src/middles/nodes/tablePagination.d.ts +2 -0
  257. package/core/src/middles/nodes/tablePagination.js +106 -0
  258. package/core/src/middles/nodes/text.d.ts +8 -0
  259. package/core/src/middles/nodes/text.js +295 -0
  260. package/core/src/middles/nodes/text.js.map +1 -0
  261. package/core/src/middles/nodes/triangle.anchor.d.ts +2 -0
  262. package/core/src/middles/nodes/triangle.anchor.js +9 -0
  263. package/core/src/middles/nodes/triangle.anchor.js.map +1 -0
  264. package/core/src/middles/nodes/triangle.d.ts +2 -0
  265. package/core/src/middles/nodes/triangle.js +10 -0
  266. package/core/src/middles/nodes/triangle.js.map +1 -0
  267. package/core/src/middles/nodes/triangle.rect.d.ts +3 -0
  268. package/core/src/middles/nodes/triangle.rect.js +23 -0
  269. package/core/src/middles/nodes/triangle.rect.js.map +1 -0
  270. package/core/src/models/data.d.ts +26 -0
  271. package/core/src/models/data.js +77 -0
  272. package/core/src/models/data.js.map +1 -0
  273. package/core/src/models/direction.d.ts +7 -0
  274. package/core/src/models/direction.js +9 -0
  275. package/core/src/models/direction.js.map +1 -0
  276. package/core/src/models/event.d.ts +13 -0
  277. package/core/src/models/event.js +16 -0
  278. package/core/src/models/event.js.map +1 -0
  279. package/core/src/models/index.d.ts +9 -0
  280. package/core/src/models/index.js +10 -0
  281. package/core/src/models/index.js.map +1 -0
  282. package/core/src/models/line.d.ts +53 -0
  283. package/core/src/models/line.js +442 -0
  284. package/core/src/models/line.js.map +1 -0
  285. package/core/src/models/node.d.ts +95 -0
  286. package/core/src/models/node.js +944 -0
  287. package/core/src/models/node.js.map +1 -0
  288. package/core/src/models/pen.d.ts +122 -0
  289. package/core/src/models/pen.js +362 -0
  290. package/core/src/models/pen.js.map +1 -0
  291. package/core/src/models/point.d.ts +25 -0
  292. package/core/src/models/point.js +59 -0
  293. package/core/src/models/point.js.map +1 -0
  294. package/core/src/models/rect.d.ts +22 -0
  295. package/core/src/models/rect.js +93 -0
  296. package/core/src/models/rect.js.map +1 -0
  297. package/core/src/models/status.d.ts +10 -0
  298. package/core/src/models/status.js +13 -0
  299. package/core/src/models/status.js.map +1 -0
  300. package/core/src/mqtt.d.ts +14 -0
  301. package/core/src/mqtt.js +82 -0
  302. package/core/src/mqtt.js.map +1 -0
  303. package/core/src/mqtt.min.d.ts +2 -0
  304. package/core/src/mqtt.min.js +2447 -0
  305. package/core/src/mqtt.min.js.map +1 -0
  306. package/core/src/offscreen.d.ts +16 -0
  307. package/core/src/offscreen.js +70 -0
  308. package/core/src/offscreen.js.map +1 -0
  309. package/core/src/options.d.ts +66 -0
  310. package/core/src/options.js +42 -0
  311. package/core/src/options.js.map +1 -0
  312. package/core/src/poll.js +39 -0
  313. package/core/src/preview.d.ts +29 -0
  314. package/core/src/preview.js +247 -0
  315. package/core/src/renderLayer.d.ts +36 -0
  316. package/core/src/renderLayer.js +187 -0
  317. package/core/src/renderLayer.js.map +1 -0
  318. package/core/src/socket.d.ts +10 -0
  319. package/core/src/socket.js +51 -0
  320. package/core/src/socket.js.map +1 -0
  321. package/core/src/utils/browser.d.ts +1 -0
  322. package/core/src/utils/browser.js +4 -0
  323. package/core/src/utils/browser.js.map +1 -0
  324. package/core/src/utils/canvas.d.ts +13 -0
  325. package/core/src/utils/canvas.js +84 -0
  326. package/core/src/utils/canvas.js.map +1 -0
  327. package/core/src/utils/construction.d.ts +41 -0
  328. package/core/src/utils/construction.js +36 -0
  329. package/core/src/utils/conversion.d.ts +0 -0
  330. package/core/src/utils/conversion.js +0 -0
  331. package/core/src/utils/dom.d.ts +8 -0
  332. package/core/src/utils/dom.js +67 -0
  333. package/core/src/utils/dom.js.map +1 -0
  334. package/core/src/utils/index.d.ts +9 -0
  335. package/core/src/utils/index.js +10 -0
  336. package/core/src/utils/index.js.map +1 -0
  337. package/core/src/utils/math.d.ts +3 -0
  338. package/core/src/utils/math.js +118 -0
  339. package/core/src/utils/math.js.map +1 -0
  340. package/core/src/utils/onmousevent.d.ts +5 -0
  341. package/core/src/utils/onmousevent.js +57 -0
  342. package/core/src/utils/padding.d.ts +7 -0
  343. package/core/src/utils/padding.js +47 -0
  344. package/core/src/utils/padding.js.map +1 -0
  345. package/core/src/utils/rect.d.ts +7 -0
  346. package/core/src/utils/rect.js +72 -0
  347. package/core/src/utils/rect.js.map +1 -0
  348. package/core/src/utils/uuid.d.ts +4 -0
  349. package/core/src/utils/uuid.js +13 -0
  350. package/core/src/utils/uuid.js.map +1 -0
  351. package/flow-diagram/index.d.ts +12 -0
  352. package/flow-diagram/index.js +13 -0
  353. package/flow-diagram/index.js.map +1 -0
  354. package/flow-diagram/src/comment/comment.anchor.d.ts +2 -0
  355. package/flow-diagram/src/comment/comment.anchor.js +5 -0
  356. package/flow-diagram/src/comment/comment.anchor.js.map +1 -0
  357. package/flow-diagram/src/comment/comment.d.ts +2 -0
  358. package/flow-diagram/src/comment/comment.js +10 -0
  359. package/flow-diagram/src/comment/comment.js.map +1 -0
  360. package/flow-diagram/src/comment/index.d.ts +2 -0
  361. package/flow-diagram/src/comment/index.js +3 -0
  362. package/flow-diagram/src/comment/index.js.map +1 -0
  363. package/flow-diagram/src/data/data.anchor.d.ts +2 -0
  364. package/flow-diagram/src/data/data.anchor.js +8 -0
  365. package/flow-diagram/src/data/data.anchor.js.map +1 -0
  366. package/flow-diagram/src/data/data.d.ts +2 -0
  367. package/flow-diagram/src/data/data.js +12 -0
  368. package/flow-diagram/src/data/data.js.map +1 -0
  369. package/flow-diagram/src/data/data.rect.d.ts +3 -0
  370. package/flow-diagram/src/data/data.rect.js +9 -0
  371. package/flow-diagram/src/data/data.rect.js.map +1 -0
  372. package/flow-diagram/src/data/index.d.ts +3 -0
  373. package/flow-diagram/src/data/index.js +4 -0
  374. package/flow-diagram/src/data/index.js.map +1 -0
  375. package/flow-diagram/src/db/db.d.ts +2 -0
  376. package/flow-diagram/src/db/db.js +14 -0
  377. package/flow-diagram/src/db/db.js.map +1 -0
  378. package/flow-diagram/src/db/db.rect.d.ts +4 -0
  379. package/flow-diagram/src/db/db.rect.js +9 -0
  380. package/flow-diagram/src/db/db.rect.js.map +1 -0
  381. package/flow-diagram/src/db/index.d.ts +2 -0
  382. package/flow-diagram/src/db/index.js +3 -0
  383. package/flow-diagram/src/db/index.js.map +1 -0
  384. package/flow-diagram/src/display/display.anchor.d.ts +2 -0
  385. package/flow-diagram/src/display/display.anchor.js +8 -0
  386. package/flow-diagram/src/display/display.anchor.js.map +1 -0
  387. package/flow-diagram/src/display/display.d.ts +2 -0
  388. package/flow-diagram/src/display/display.js +13 -0
  389. package/flow-diagram/src/display/display.js.map +1 -0
  390. package/flow-diagram/src/display/display.rect.d.ts +3 -0
  391. package/flow-diagram/src/display/display.rect.js +9 -0
  392. package/flow-diagram/src/display/display.rect.js.map +1 -0
  393. package/flow-diagram/src/display/index.d.ts +3 -0
  394. package/flow-diagram/src/display/index.js +4 -0
  395. package/flow-diagram/src/display/index.js.map +1 -0
  396. package/flow-diagram/src/document/document.anchor.d.ts +2 -0
  397. package/flow-diagram/src/document/document.anchor.js +8 -0
  398. package/flow-diagram/src/document/document.anchor.js.map +1 -0
  399. package/flow-diagram/src/document/document.d.ts +2 -0
  400. package/flow-diagram/src/document/document.js +15 -0
  401. package/flow-diagram/src/document/document.js.map +1 -0
  402. package/flow-diagram/src/document/document.rect.d.ts +3 -0
  403. package/flow-diagram/src/document/document.rect.js +9 -0
  404. package/flow-diagram/src/document/document.rect.js.map +1 -0
  405. package/flow-diagram/src/document/index.d.ts +3 -0
  406. package/flow-diagram/src/document/index.js +4 -0
  407. package/flow-diagram/src/document/index.js.map +1 -0
  408. package/flow-diagram/src/externStorage/externStorage.anchor.d.ts +2 -0
  409. package/flow-diagram/src/externStorage/externStorage.anchor.js +8 -0
  410. package/flow-diagram/src/externStorage/externStorage.anchor.js.map +1 -0
  411. package/flow-diagram/src/externStorage/externStorage.d.ts +2 -0
  412. package/flow-diagram/src/externStorage/externStorage.js +12 -0
  413. package/flow-diagram/src/externStorage/externStorage.js.map +1 -0
  414. package/flow-diagram/src/externStorage/externStorage.rect.d.ts +3 -0
  415. package/flow-diagram/src/externStorage/externStorage.rect.js +9 -0
  416. package/flow-diagram/src/externStorage/externStorage.rect.js.map +1 -0
  417. package/flow-diagram/src/externStorage/index.d.ts +3 -0
  418. package/flow-diagram/src/externStorage/index.js +4 -0
  419. package/flow-diagram/src/externStorage/index.js.map +1 -0
  420. package/flow-diagram/src/internalStorage/index.d.ts +2 -0
  421. package/flow-diagram/src/internalStorage/index.js +3 -0
  422. package/flow-diagram/src/internalStorage/index.js.map +1 -0
  423. package/flow-diagram/src/internalStorage/internalStorage.d.ts +2 -0
  424. package/flow-diagram/src/internalStorage/internalStorage.js +16 -0
  425. package/flow-diagram/src/internalStorage/internalStorage.js.map +1 -0
  426. package/flow-diagram/src/internalStorage/internalStorage.rect.d.ts +3 -0
  427. package/flow-diagram/src/internalStorage/internalStorage.rect.js +10 -0
  428. package/flow-diagram/src/internalStorage/internalStorage.rect.js.map +1 -0
  429. package/flow-diagram/src/manually/index.d.ts +3 -0
  430. package/flow-diagram/src/manually/index.js +4 -0
  431. package/flow-diagram/src/manually/index.js.map +1 -0
  432. package/flow-diagram/src/manually/manually.anchor.d.ts +2 -0
  433. package/flow-diagram/src/manually/manually.anchor.js +8 -0
  434. package/flow-diagram/src/manually/manually.anchor.js.map +1 -0
  435. package/flow-diagram/src/manually/manually.d.ts +2 -0
  436. package/flow-diagram/src/manually/manually.js +12 -0
  437. package/flow-diagram/src/manually/manually.js.map +1 -0
  438. package/flow-diagram/src/manually/manually.rect.d.ts +3 -0
  439. package/flow-diagram/src/manually/manually.rect.js +9 -0
  440. package/flow-diagram/src/manually/manually.rect.js.map +1 -0
  441. package/flow-diagram/src/parallel/index.d.ts +2 -0
  442. package/flow-diagram/src/parallel/index.js +3 -0
  443. package/flow-diagram/src/parallel/index.js.map +1 -0
  444. package/flow-diagram/src/parallel/parallel.anchor.d.ts +2 -0
  445. package/flow-diagram/src/parallel/parallel.anchor.js +6 -0
  446. package/flow-diagram/src/parallel/parallel.anchor.js.map +1 -0
  447. package/flow-diagram/src/parallel/parallel.d.ts +2 -0
  448. package/flow-diagram/src/parallel/parallel.js +9 -0
  449. package/flow-diagram/src/parallel/parallel.js.map +1 -0
  450. package/flow-diagram/src/queue/index.d.ts +2 -0
  451. package/flow-diagram/src/queue/index.js +3 -0
  452. package/flow-diagram/src/queue/index.js.map +1 -0
  453. package/flow-diagram/src/queue/queue.d.ts +2 -0
  454. package/flow-diagram/src/queue/queue.js +9 -0
  455. package/flow-diagram/src/queue/queue.js.map +1 -0
  456. package/flow-diagram/src/queue/queue.rect.d.ts +3 -0
  457. package/flow-diagram/src/queue/queue.rect.js +11 -0
  458. package/flow-diagram/src/queue/queue.rect.js.map +1 -0
  459. package/flow-diagram/src/register.d.ts +1 -0
  460. package/flow-diagram/src/register.js +26 -0
  461. package/flow-diagram/src/register.js.map +1 -0
  462. package/flow-diagram/src/subprocess/index.d.ts +2 -0
  463. package/flow-diagram/src/subprocess/index.js +3 -0
  464. package/flow-diagram/src/subprocess/index.js.map +1 -0
  465. package/flow-diagram/src/subprocess/subprocess.d.ts +2 -0
  466. package/flow-diagram/src/subprocess/subprocess.js +16 -0
  467. package/flow-diagram/src/subprocess/subprocess.js.map +1 -0
  468. package/flow-diagram/src/subprocess/subprocess.rect.d.ts +3 -0
  469. package/flow-diagram/src/subprocess/subprocess.rect.js +9 -0
  470. package/flow-diagram/src/subprocess/subprocess.rect.js.map +1 -0
  471. package/layout/index.d.ts +2 -0
  472. package/layout/index.js +3 -0
  473. package/layout/index.js.map +1 -0
  474. package/layout/src/align.d.ts +3 -0
  475. package/layout/src/align.js +67 -0
  476. package/layout/src/align.js.map +1 -0
  477. package/layout/src/layout.d.ts +9 -0
  478. package/layout/src/layout.js +50 -0
  479. package/layout/src/layout.js.map +1 -0
  480. package/myShape-diagram/myShape.js +196 -0
  481. package/myShape-diagram/myShape.ts +1 -0
  482. package/package.json +15 -0
  483. package/sequence-diagram/index.d.ts +3 -0
  484. package/sequence-diagram/index.js +4 -0
  485. package/sequence-diagram/index.js.map +1 -0
  486. package/sequence-diagram/src/focus/focus.anchor.d.ts +2 -0
  487. package/sequence-diagram/src/focus/focus.anchor.js +15 -0
  488. package/sequence-diagram/src/focus/focus.anchor.js.map +1 -0
  489. package/sequence-diagram/src/focus/focus.d.ts +2 -0
  490. package/sequence-diagram/src/focus/focus.js +13 -0
  491. package/sequence-diagram/src/focus/focus.js.map +1 -0
  492. package/sequence-diagram/src/focus/focus.rect.d.ts +3 -0
  493. package/sequence-diagram/src/focus/focus.rect.js +9 -0
  494. package/sequence-diagram/src/focus/focus.rect.js.map +1 -0
  495. package/sequence-diagram/src/focus/index.d.ts +3 -0
  496. package/sequence-diagram/src/focus/index.js +4 -0
  497. package/sequence-diagram/src/focus/index.js.map +1 -0
  498. package/sequence-diagram/src/lifeline/index.d.ts +3 -0
  499. package/sequence-diagram/src/lifeline/index.js +4 -0
  500. package/sequence-diagram/src/lifeline/index.js.map +1 -0
  501. package/sequence-diagram/src/lifeline/lifeline.anchor.d.ts +2 -0
  502. package/sequence-diagram/src/lifeline/lifeline.anchor.js +9 -0
  503. package/sequence-diagram/src/lifeline/lifeline.anchor.js.map +1 -0
  504. package/sequence-diagram/src/lifeline/lifeline.d.ts +2 -0
  505. package/sequence-diagram/src/lifeline/lifeline.js +35 -0
  506. package/sequence-diagram/src/lifeline/lifeline.js.map +1 -0
  507. package/sequence-diagram/src/lifeline/lifeline.rect.d.ts +3 -0
  508. package/sequence-diagram/src/lifeline/lifeline.rect.js +9 -0
  509. package/sequence-diagram/src/lifeline/lifeline.rect.js.map +1 -0
  510. package/sequence-diagram/src/register.d.ts +1 -0
  511. package/sequence-diagram/src/register.js +8 -0
  512. package/sequence-diagram/src/register.js.map +1 -0
@@ -0,0 +1,1254 @@
1
+ import {Store} from 'le5le-store';
2
+ import {DivLayer} from './divLayer';
3
+ import {AnimateLayer} from './animateLayer';
4
+ import {RenderLayer} from './renderLayer';
5
+ import {Offscreen} from './offscreen';
6
+ import {Socket} from './socket';
7
+ import {Line, Node, Pen, Point, TopologyData, EventAction} from './models';
8
+ import {setConfItemNode} from './healps';
9
+ import {s8, formatPadding, getRect, previewType} from './utils';
10
+ import {DefalutOptions} from './options';
11
+ import {POLL} from './poll';
12
+ import axios from 'axios';
13
+ import * as mqtt from './mqtt.min';
14
+
15
+ var MoveInType;
16
+ (function (MoveInType) {
17
+ MoveInType[MoveInType["None"] = 0] = "None";
18
+ MoveInType[MoveInType["Line"] = 1] = "Line";
19
+ MoveInType[MoveInType["LineMove"] = 2] = "LineMove";
20
+ MoveInType[MoveInType["LineFrom"] = 3] = "LineFrom";
21
+ MoveInType[MoveInType["LineTo"] = 4] = "LineTo";
22
+ MoveInType[MoveInType["LineControlPoint"] = 5] = "LineControlPoint";
23
+ MoveInType[MoveInType["Nodes"] = 6] = "Nodes";
24
+ MoveInType[MoveInType["ResizeCP"] = 7] = "ResizeCP";
25
+ MoveInType[MoveInType["HoverAnchors"] = 8] = "HoverAnchors";
26
+ MoveInType[MoveInType["Rotate"] = 9] = "Rotate";
27
+ })(MoveInType || (MoveInType = {}));
28
+ var Common = /** @class */ (function () {
29
+ function Common(parent, options) {
30
+ var _this = this;
31
+ _this.moveInType = MoveInType;
32
+ this.mouseDown = null;
33
+ if (typeof parent === 'string') {
34
+ this.parentElem = document.getElementById(parent);
35
+ } else {
36
+ this.parentElem = parent;
37
+ }
38
+ if (!options) {
39
+ options = {};
40
+ }
41
+ this.parentElem.style.position = 'relative';
42
+ this.parentElem.style.overflow = 'auto';
43
+ var font = Object.assign({}, DefalutOptions.font, options.font);
44
+ options.font = font;
45
+ this.options = Object.assign({}, DefalutOptions, options);
46
+ this.data = new TopologyData();
47
+ this.id = s8();
48
+ Store.set(this.generateStoreKey('topology-data'), this.data);
49
+ var id = this.id;
50
+ this.animateLayer = new AnimateLayer(this.options, id);
51
+ this.offscreen = new Offscreen(this.parentElem, this.options, id);
52
+ this.canvas = new RenderLayer(this.parentElem, this.options, id);
53
+ this.divLayer = new DivLayer(this.parentElem, this.options, id);
54
+ this.divLayer.canvas.tabIndex = 0;
55
+ this.divLayer.canvas.ondblclick = this.ondblclick;
56
+ this.divLayer.canvas.onblur = function () {
57
+ _this.mouseDown = null;
58
+ };
59
+ this.subcribe = Store.subscribe(this.generateStoreKey('LT:render'), function () {
60
+ _this.render();
61
+ });
62
+ this.subcribeRender = Store.subscribe('LT:render', function () {
63
+ _this.render();
64
+ });
65
+ this.subcribeImage = Store.subscribe(this.generateStoreKey('LT:imageLoaded'), function () {
66
+ if (_this.imageTimer) {
67
+ clearTimeout(_this.imageTimer);
68
+ }
69
+ _this.imageTimer = setTimeout(function () {
70
+ //_this.canvas.clearBkImg();
71
+ _this.render();
72
+ }, 100);
73
+ });
74
+ this.subcribeAnimateEnd = Store.subscribe(this.generateStoreKey('animateEnd'), function (e) {
75
+ if (!e) {
76
+ return;
77
+ }
78
+ switch (e.type) {
79
+ case 'node':
80
+ _this.offscreen.render();
81
+ break;
82
+ }
83
+ _this.divLayer.playNext(e.data.nextAnimate);
84
+ _this.dispatch('animateEnd', e);
85
+ });
86
+ this.subcribeTableData = Store.subscribe('SYNC:tableData', function (data) {
87
+ _this.subcribeSyncTableData(data);
88
+ });
89
+ this.ondblclick = function (e) {
90
+ var canvasPos = _this.divLayer.canvas.getBoundingClientRect();
91
+ if (_this.moveIn.hoverNode) {
92
+ _this.dispatch('dblclick', _this.moveIn.hoverNode);
93
+ if (_this.moveIn.hoverNode
94
+ .getTextRect()
95
+ .hit(new Point(e.x - canvasPos.x, e.y - canvasPos.y))) {
96
+ _this.showInput(_this.moveIn.hoverNode);
97
+ }
98
+ _this.moveIn.hoverNode.dblclick();
99
+ } else if (_this.moveIn.hoverLine) {
100
+ _this.dispatch('dblclick', _this.moveIn.hoverLine);
101
+ if (!_this.moveIn.hoverLine.text ||
102
+ _this.moveIn.hoverLine
103
+ .getTextRect()
104
+ .hit(new Point(e.x - canvasPos.x, e.y - canvasPos.y))) {
105
+ _this.showInput(_this.moveIn.hoverLine);
106
+ }
107
+ _this.moveIn.hoverLine.dblclick();
108
+ }
109
+ };
110
+ this.openCount = 0;
111
+ this.timmerByTopology = null;
112
+ this.ratioCord = null;
113
+ this.lastTranlated = {x: 0, y: 0};
114
+ this.moveIn = {
115
+ type: 'None',
116
+ order: 0,
117
+ activeAnchorIndex: 0,
118
+ hoverAnchorIndex: 0,
119
+ hoverNode: null,
120
+ hoverLine: null,
121
+ activeNode: null,
122
+ lineControlPoint: null,
123
+ eventNode: null
124
+ };
125
+ this.initType = ''; // 初始化类型
126
+ this.pathRewrite = '';
127
+ this.initData = null; // 初始化数据
128
+ this.tagParams = {}; // 数据属性的集合,对应不同的事件类型
129
+ this.assetPoperties = {}; // 固定的资产详情的集合
130
+ this.isExistAssetKey = false; // 是否存在固定的资产详情
131
+ this.pollTime = { // 轮询的方式的定时器
132
+ Poll: null,
133
+ Poll1: null,
134
+ Poll2: null,
135
+ };
136
+ this.tip = '';
137
+ this.rendering = false;
138
+ this.isFullScreen = false;
139
+ this.socket = null;
140
+ this.inputObj = null;
141
+ this.input = document.createElement('textarea');
142
+ this.input.style.position = 'absolute';
143
+ this.input.style.zIndex = '-1';
144
+ this.input.style.left = '-1000px';
145
+ this.input.style.width = '0';
146
+ this.input.style.height = '0';
147
+ this.input.style.outline = 'none';
148
+ this.input.style.border = '1px solid #cdcdcd';
149
+ this.input.style.resize = 'none';
150
+ this.parentElem.appendChild(this.input);
151
+ this.paginationPageListBox = document.createElement('ul');
152
+ this.pagenationPageInput = document.createElement('input');
153
+ this.tablePaginationPageStyle();
154
+ this.parentElem.appendChild(this.paginationPageListBox);
155
+ // 列表数据选取
156
+ this.paginationPageListNode = function (ev) {
157
+ const node = _this.moveIn.activeNode;
158
+ node.paginationData.pageSize = ev.target.getAttribute('data-size');
159
+ node.paginationData.pageListLocal.hide = false;
160
+ node.paginationData.pageNumber = 1;
161
+ _this.paginationPageListBox.style.display = 'none';
162
+ _this.dispatch('node', node);
163
+ _this.render();
164
+ };
165
+ this.pagenationPageInputNode = function (ev) {
166
+ if (!ev.target.value) return
167
+ const node = _this.moveIn.activeNode;
168
+ node.paginationData.pageNumber = ev.target.value;
169
+ _this.pagenationPageInput.style.display = 'none';
170
+ _this.dispatch('node', node);
171
+ _this.render();
172
+ };
173
+ this.createMarkdownTip();
174
+ window.topology = this;
175
+ }
176
+
177
+ Common.prototype.conversionData = function (obj) {
178
+ this.parentElem.scrollLeft = 0;
179
+ this.parentElem.scrollTop = 0;
180
+ this.canvas.clearBkImg();
181
+ this.divLayer.clear();
182
+ let data = JSON.parse(JSON.stringify(obj));
183
+ if (!data) {
184
+ data = {pens: []};
185
+ }
186
+ Object.assign(this.data, data);
187
+ this.setBKImageRect();
188
+ this.ratioCord = {
189
+ ratio: 1,
190
+ scaleX: 1,
191
+ scaleY: 1
192
+ };
193
+ this.openCount = 0
194
+ this.data.pens = [];
195
+ // for old data.
196
+ if (data.nodes) {
197
+ for (var _i = 0, _a = data.nodes; _i < _a.length; _i++) {
198
+ var item = new Node(_a[_i]);
199
+ this.data.pens.push(item);
200
+ this.setSwitchTabData(item, _i);
201
+ }
202
+ for (var _b = 0, _c = data.lines; _b < _c.length; _b++) {
203
+ var item = _c[_b];
204
+ this.data.pens.push(new Line(item));
205
+ }
206
+ }
207
+ // end.
208
+ if (data.pens) {
209
+ for (var _d = 0, _e = data.pens; _d < _e.length; _d++) {
210
+ var item = _e[_d];
211
+ if (!item.from) {
212
+ var node = new Node(item);
213
+ this.data.pens.push(node);
214
+ this.setSwitchTabData(node, _d);
215
+ } else {
216
+ this.data.pens.push(new Line(item));
217
+ }
218
+ }
219
+ }
220
+ };
221
+ Common.prototype.setBKImageRect = function () {
222
+ if (this.data.bkImageRect) {
223
+ this.data.bkImageRect.x = this.data.bkImageRect.x ? Number(this.data.bkImageRect.x) : 0;
224
+ this.data.bkImageRect.y = this.data.bkImageRect.y ? Number(this.data.bkImageRect.y) : 0;
225
+ this.data.bkImageRect.width = this.data.bkImageRect.width ? Number(this.data.bkImageRect.width) : this.canvas.width;
226
+ this.data.bkImageRect.height = this.data.bkImageRect.height ? Number(this.data.bkImageRect.height) : this.canvas.height;
227
+ this.data.bkImageRect.center = {
228
+ x: this.data.bkImageRect.x + this.data.bkImageRect.width / 2,
229
+ y: this.data.bkImageRect.y + this.data.bkImageRect.height / 2
230
+ }
231
+ }
232
+ };
233
+ Common.prototype.setSwitchTabData = function (node, index, type) {
234
+ if (type) {
235
+ let topologyChangeData = Store.get('TCD:topologyChangeData');
236
+ if (topologyChangeData) {
237
+ const switchTabData = node.tags.find((t) => {
238
+ return t.includes('switchTabType');
239
+ });
240
+ const switchTabTypeData = topologyChangeData[`${switchTabData}Data`];
241
+ if (switchTabTypeData) {
242
+ delete switchTabTypeData[node.id];
243
+ for (let switchNode of Object.values(switchTabTypeData)) {
244
+ if (switchNode.tagOrder > index) switchNode.tagOrder--;
245
+ }
246
+ }
247
+ }
248
+ return;
249
+ }
250
+ if (node.tags && node.tags.length > 0) {
251
+ const tagTypeData = node.tags.find((t) => {
252
+ return t === 'statisticType' || t.includes('switchTabType');
253
+ });
254
+ if (tagTypeData) {
255
+ node.tagOrder = index;
256
+ let topologyChangeData = Store.get('TCD:topologyChangeData');
257
+ if (!topologyChangeData) topologyChangeData = {};
258
+ if (!topologyChangeData[`${tagTypeData}Data`]) topologyChangeData[`${tagTypeData}Data`] = {};
259
+ topologyChangeData[`${tagTypeData}Data`][node.id] = node;
260
+ Store.set('TCD:topologyChangeData', topologyChangeData);
261
+ }
262
+ }
263
+ };
264
+ Common.prototype.canvasResize = function (size) {
265
+ this.canvas.resize(size);
266
+ //this.canvas.bkImgRectResize(size);
267
+ this.offscreen.resize(size);
268
+ this.divLayer.resize(size);
269
+ };
270
+ // Render or redraw
271
+ Common.prototype.render = function (noFocus) {
272
+ if (this.rendering) {
273
+ return this;
274
+ }
275
+ this.rendering = true;
276
+ this.offscreen.render();
277
+ this.canvas.render();
278
+ this.rendering = false;
279
+ };
280
+ Common.prototype.generateStoreKey = function (key) {
281
+ return this.id + "-" + key;
282
+ };
283
+ Common.prototype.tablePaginationPageStyle = function () {
284
+ this.paginationPageListBox.style.position = 'absolute';
285
+ this.paginationPageListBox.style.width = 120 + 'px';
286
+ this.paginationPageListBox.style.display = 'none';
287
+ this.paginationPageListBox.style.padding = 0;
288
+ this.paginationPageListBox.style.boxShadow = '0 0 3px rgba(86,96,117,.3)';
289
+ this.paginationPageListBox.style.zIndex = 1;
290
+ this.paginationPageListBox.setAttribute('id', 'paginationPageList');
291
+ this.pagenationPageInput.style.position = 'absolute';
292
+ this.pagenationPageInput.style.width = 50 + 'px';
293
+ this.pagenationPageInput.style.padding = '0 5px';
294
+ this.pagenationPageInput.style.textAlign = 'center';
295
+ this.pagenationPageInput.style.color = '#fff';
296
+ this.pagenationPageInput.style.border = 'none';
297
+ this.pagenationPageInput.style.background = '#091229';
298
+ this.pagenationPageInput.style.display = 'none';
299
+ this.pagenationPageInput.style.zIndex = 1;
300
+ this.pagenationPageInput.setAttribute('id', 'pagenationPageInput');
301
+ };
302
+ // 监听表格数据变化
303
+ Common.prototype.subcribeSyncTableData = function (data) {
304
+ const {tableNodes, paginationNodes} = Store.get('FORM:tableData').data;
305
+ if (data && Object.keys(tableNodes).length > 0) {
306
+ const updateNodes = [];
307
+ for (let key of Object.keys(data)) {
308
+ const tnode = tableNodes[key];
309
+ const pageId = tnode.formData.bindPaginationId;
310
+ paginationNodes[pageId].paginationData.total = data[key].total;
311
+ paginationNodes[pageId].rect.width = tnode.rect.width;
312
+ updateNodes.push(tnode);
313
+ if (pageId) updateNodes.push(paginationNodes[pageId]);
314
+ // this.updateProps(updateNodes);
315
+ this.render();
316
+ }
317
+ }
318
+ };
319
+ // 上下翻页
320
+ Common.prototype.paginationPrevNextPage = function (node, val) {
321
+ const pageSize = Math.ceil(node.paginationData.total / node.paginationData.pageSize); // 分页总页码
322
+ let isChangePage = false;
323
+ if (val === 'prev' && node.paginationData.pageNumber > 1) {
324
+ node.paginationData.pageNumber--;
325
+ isChangePage = true;
326
+ }
327
+ if (val === 'next' && node.paginationData.pageNumber < pageSize) {
328
+ node.paginationData.pageNumber++;
329
+ node.paginationData.pageOrder++;
330
+ isChangePage = true;
331
+ }
332
+ if (!(val === 'prev' || val === 'next') && !(val === 'sl' || val === 'sr')) {
333
+ node.paginationData.pageNumber = val;
334
+ isChangePage = true;
335
+ }
336
+ if (isChangePage) {
337
+ //this.activeLayer.setPens([node]); // 更新节点数据
338
+ this.dispatch('node', node);
339
+ }
340
+ };
341
+ Common.prototype.pageListAndPageInputHide = function () {
342
+ if (this.paginationPageListBox) this.paginationPageListBox.style.display = 'none';
343
+ if (this.pagenationPageInput) this.pagenationPageInput.style.display = 'none';
344
+ };
345
+ Common.prototype.targetPageInputHandle = function (node, e) {
346
+ this.createPageInputEle(node);
347
+ console.log('targetPageInputHandle~~~~~~~~~~~~~~~~')
348
+ const targetPagex = node.paginationData.targetPageLocal.x;
349
+ const targetPagey = node.paginationData.targetPageLocal.y;
350
+ const isPageInputArea = e.offsetX >= targetPagex && e.offsetX <= targetPagex + 50;
351
+ this.pagenationPageInput.style.display = isPageInputArea ? 'block' : 'none';
352
+ this.pagenationPageInput.focus();
353
+ this.pagenationPageInput.addEventListener('blur', this.pagenationPageInputNode);
354
+ };
355
+ // 生成页码输入框
356
+ Common.prototype.createPageInputEle = function (node) {
357
+ this.pagenationPageInput.value = '';
358
+ this.pagenationPageInput.style.left = node.paginationData.targetPageLocal.x + 'px';
359
+ this.pagenationPageInput.style.top = node.paginationData.targetPageLocal.y + 'px';
360
+ this.pagenationPageInput.style.height = node.rect.height + 'px';
361
+ this.parentElem.appendChild(this.pagenationPageInput);
362
+ };
363
+ // 展开分页列表
364
+ Common.prototype.spreadPageListHandle = function (node, e) {
365
+ this.createPageListPanel(node); // 分页列表数据存在,创建列表
366
+ const px = node.paginationData.pageListLocal.px;
367
+ const py = node.paginationData.pageListLocal.py;
368
+ const isPageListArea = e.offsetX >= px && e.offsetX <= px + 120 && e.offsetY >= py - node.rect.height && e.offsetY <= py;
369
+ // 若点击的区域是分页列表区域
370
+ if (isPageListArea) {
371
+ const display = node.paginationData.pageListLocal.hide ? 'none' : 'block';
372
+ this.paginationPageListBox.style.display = display;
373
+ node.paginationData.pageListLocal.hide = !node.paginationData.pageListLocal.hide;
374
+ } else {
375
+ this.paginationPageListBox.style.display = 'none';
376
+ node.paginationData.pageListLocal.hide = false;
377
+ }
378
+ };
379
+ // 生成分页列表
380
+ Common.prototype.createPageListPanel = function (node) {
381
+ this.paginationPageListBox.innerHTML = '';
382
+ this.paginationPageListBox.style.left = node.paginationData.pageListLocal.x + 'px';
383
+ this.paginationPageListBox.style.top = node.paginationData.pageListLocal.y + 'px';
384
+ this.paginationPageListBox.style.height = node.rect.height * node.paginationData.pageList.length + 20 + 'px';
385
+ let createLi = '';
386
+ for (let i = 0; i < node.paginationData.pageList.length; i++) {
387
+ const text = node.paginationData.pageList[i];
388
+ createLi += `<li data-size="${text}" style="padding: 5px 10px;background-color: #284689;border-bottom: 1px solid #296fee;list-style: none;text-align: center;font-size: ${node.font.fontSize}px;color: ${node.font.color};cursor: pointer;">${text}条/页</li>`
389
+ }
390
+ this.paginationPageListBox.innerHTML = createLi;
391
+ this.paginationPageListBox.addEventListener('click', this.paginationPageListNode);
392
+ };
393
+ // 获取表格分页数据
394
+ Common.prototype.getSyncTableDataFromServer = async function (data, node) {
395
+ const path = this.pathRewrite ? this.pathRewrite + '/user/cockpit/mqtt-echart' : '/user/cockpit/mqtt-echart';
396
+ const ret = await axios.post(path, data);
397
+ //console.log('ret.data==========', ret, ret.data)
398
+ const tableData = {};
399
+ tableData[node.id] = {loading: true};
400
+ Store.set('SYNC:tableData', tableData);
401
+ if (ret.data && ret.data.data) {
402
+ console.log(ret.data.data)
403
+ tableData[node.id] = {
404
+ loading: false,
405
+ tableBody: ret.data.data.rows,
406
+ total: ret.data.data.total
407
+ }
408
+ Store.set('SYNC:tableData', tableData);
409
+ this.render();
410
+ }
411
+ if (ret.error) {
412
+ console.log('获取数据失败==================')
413
+ } else {
414
+ console.log('获取数据成功==================')
415
+ }
416
+
417
+ };
418
+ Common.prototype.switchStaticsCheckType = function (node, staticTypeNode) {
419
+ // 点击切换统计图统计类别
420
+ const switchTabData = node.tags.find((t) => {
421
+ return t.includes('switchTabType');
422
+ }); // 获取按钮组类型
423
+ if(!switchTabData) return;
424
+ const topologyChangeData = Store.get('TCD:topologyChangeData'); // 获取所有按钮组和按类型统计图组数据
425
+ const changeNode = topologyChangeData[`${switchTabData}Data`]; // 分别获取按钮组数据
426
+ // 如果存在按钮组节点数据
427
+ if (changeNode[node.id]) {
428
+ for (let switchNode of Object.values(changeNode)) {
429
+ if (this.data.pens[switchNode.tagOrder]) {
430
+ this.data.pens[switchNode.tagOrder].activeImgeIndex = switchNode.id !== node.id;
431
+ }
432
+ }
433
+ }
434
+ if (node.bindStaticId) {
435
+ const statisticTypeData = topologyChangeData.statisticTypeData;
436
+ if(!statisticTypeData) return;
437
+ const findCurentEchart = statisticTypeData[node.bindStaticId]; // 获取当前点中的节点绑定的统计图表数据
438
+ if (findCurentEchart && findCurentEchart.data.params) {
439
+ findCurentEchart.data.params['staticForType'] = staticTypeNode.dcimStaticForType; // 统计类型赋值
440
+ const mqttSyncData = Store.get('mqtt:responseData');
441
+ if (mqttSyncData) setConfItemNode(findCurentEchart, mqttSyncData);
442
+ }
443
+ }
444
+ this.render();
445
+ };
446
+ Common.prototype.s8 = function () {
447
+ return s8()
448
+ };
449
+ Common.prototype.openSocket = function (url) {
450
+ this.closeSocket();
451
+ if (url || this.data.websocket) {
452
+ this.socket = new Socket(url || this.data.websocket, this.data);
453
+ }
454
+ };
455
+ Common.prototype.closeSocket = function () {
456
+ if (this.socket) {
457
+ this.socket.close();
458
+ }
459
+ };
460
+ Common.prototype.openMqtt = function (url, options) {
461
+ this.closeMqtt();
462
+ if (url || this.data.mqttUrl) {
463
+ url = url || this.data.mqttUrl;
464
+ const mqttTopics = this.initData && this.initData.mqttTopics ? this.initData.mqttTopics : this.data.mqttTopics;
465
+ options = options || this.data.mqttOptions
466
+ let topics = mqttTopics
467
+ this.isEnd = false;
468
+ // let num = 0; // 记录推送的次数,用于判单丢失情况
469
+ this.mqttClient = mqtt.connect(url, options);
470
+ var _this = this;
471
+ this.mqttClient.on('message', function (topic, message) {
472
+ //console.log('openMqtt11===================', topic, message)
473
+ if (!_this.data.pens.length || !topic || topic != _this.data.mqttTopics) {
474
+ return;
475
+ }
476
+ if (!this.isEnd) {
477
+ _this.doMqttDrow(message.toString())
478
+ }
479
+ });
480
+ if (topics) {
481
+ this.mqttClient.subscribe(topics.split(','));
482
+ }
483
+ }
484
+ };
485
+ Common.prototype.openPoll = function (message, val) {
486
+ if (message) {
487
+ this.poll = new POLL(this.data, message, val);
488
+ }
489
+ };
490
+ Common.prototype.clearInterValAll = function () {
491
+ clearTimeout(this.timmerByTopology);
492
+ this.timmerByTopology = null;
493
+ };
494
+ Common.prototype.closeMqtt = function () {
495
+ if (this.mqttClient) {
496
+ this.isEnd = true
497
+ this.mqttClient.end();
498
+ }
499
+ };
500
+ Common.prototype.closePoll = function () {
501
+ for (let key in this.pollTime) {
502
+ clearInterval(this.pollTime[key])
503
+ }
504
+ };
505
+ Common.prototype.setNodeText = function () {
506
+ this.inputObj.text = this.input.value;
507
+ this.input.style.zIndex = '-1';
508
+ this.input.style.left = '-1000px';
509
+ this.input.style.width = '0';
510
+ this.offscreen.render();
511
+ this.dispatch('setText', this.inputObj);
512
+ this.inputObj = null;
513
+ };
514
+ Common.prototype.showInput = function (item) {
515
+ if (this.data.locked ||
516
+ item.locked ||
517
+ item.hideInput ||
518
+ this.options.hideInput) {
519
+ return;
520
+ }
521
+ this.inputObj = item;
522
+ var textRect = item.getTextRect();
523
+ this.input.value = item.text || '';
524
+ this.input.style.left = textRect.x + 'px';
525
+ this.input.style.top = textRect.y + 'px';
526
+ this.input.style.width = textRect.width + 'px';
527
+ this.input.style.height = textRect.height + 'px';
528
+ this.input.style.zIndex = '1000';
529
+ if (item.rotate / 360) {
530
+ this.input.style.transform = "rotate(" + item.rotate + "deg)";
531
+ } else {
532
+ this.input.style.transform = null;
533
+ }
534
+ this.input.focus();
535
+ };
536
+ Common.prototype.getRect = function (pens) {
537
+ if (!this.data) return;
538
+ if (!pens) {
539
+ pens = this.data.pens;
540
+ }
541
+ return getRect(pens);
542
+ };
543
+ Common.prototype.animate = function (autoplay) {
544
+ if (autoplay === void 0) {
545
+ autoplay = false;
546
+ }
547
+ this.animateLayer.readyPlay(null, autoplay);
548
+ this.animateLayer.animate();
549
+ };
550
+ Common.prototype.translate = function (x, y, process) {
551
+ if (!process) {
552
+ this.lastTranlated.x = 0;
553
+ this.lastTranlated.y = 0;
554
+ }
555
+ var offsetX = x - this.lastTranlated.x;
556
+ var offsetY = y - this.lastTranlated.y;
557
+ for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
558
+ var item = _a[_i];
559
+ item.translate(offsetX, offsetY);
560
+ }
561
+ this.animateLayer.pens.forEach(function (pen) {
562
+ if (pen instanceof Line) {
563
+ pen.translate(offsetX, offsetY);
564
+ }
565
+ });
566
+ this.lastTranlated.x = x;
567
+ this.lastTranlated.y = y;
568
+ };
569
+ Common.prototype.centerView = function (padding) {
570
+ if (!this.hasView())
571
+ return;
572
+ var rect = this.getRect();
573
+ var viewCenter = this.getViewCenter(padding);
574
+ var center = rect.center;
575
+ this.translate(viewCenter.x - center.x, viewCenter.y - center.y);
576
+ var parentElem = this.canvas.parentElem;
577
+ var x = (parentElem.scrollWidth - parentElem.offsetWidth) / 2;
578
+ var y = (parentElem.scrollHeight - parentElem.offsetHeight) / 2;
579
+ parentElem.scrollTo(x, y);
580
+ return true;
581
+ };
582
+ Common.prototype.hasView = function () {
583
+ var rect = this.getRect();
584
+ return !(rect.width === 99999 || rect.height === 99999);
585
+ };
586
+ Common.prototype.getViewCenter = function (viewPadding) {
587
+ var padding = formatPadding(viewPadding || this.options.viewPadding);
588
+ var _a = this.canvas, width = _a.width, height = _a.height;
589
+ return {
590
+ x: (width - padding[1] - padding[3]) / 2 + padding[3],
591
+ y: (height - padding[0] - padding[2]) / 2 + padding[0],
592
+ };
593
+ };
594
+ Common.prototype.createMarkdownTip = function () {
595
+ this.tipMarkdown = document.createElement('div');
596
+ this.tipMarkdown.style.position = 'fixed';
597
+ this.tipMarkdown.style.zIndex = '-1';
598
+ this.tipMarkdown.style.left = '-9999px';
599
+ this.tipMarkdown.style.width = 'auto';
600
+ this.tipMarkdown.style.outline = 'none';
601
+ this.tipMarkdown.style.border = '1px solid #646464';
602
+ this.tipMarkdown.style.backgroundColor = '#646464';
603
+ this.tipMarkdown.style.color = '#fff';
604
+ this.tipMarkdown.style.padding = '6px 10px';
605
+ // this.tipMarkdown.style.overflowY = 'auto';
606
+ this.tipMarkdown.style.minHeight = '30px';
607
+ this.tipMarkdown.style.maxHeight = '260px';
608
+ this.tipMarkdown.style.borderRadius = '6px';
609
+ this.tipMarkdown.style.whiteSpace = 'nowrap';
610
+ this.tipMarkdown.id = 'tipMarkdownBytopo'
611
+ document.body.appendChild(this.tipMarkdown);
612
+ };
613
+ Common.prototype.showTip = function (data, pos) {
614
+ if (!data ||
615
+ (!data.markdown && !data.tipId && !data.title) || !data.title ||
616
+ data.id === this.tip) {
617
+ return;
618
+ }
619
+ data.markdown = data.title
620
+ if (data.tipId) {
621
+ this.tipElem = document.getElementById(data.tipId);
622
+ }
623
+ var elem = this.tipElem;
624
+ if (data.markdown) {
625
+ elem = this.tipMarkdown;
626
+ var marked = window.marked;
627
+ if (marked) {
628
+ this.tipMarkdown.innerHTML = marked(data.markdown);
629
+ } else {
630
+ this.tipMarkdown.innerHTML = data.markdown;
631
+ }
632
+ var a = this.tipMarkdown.getElementsByTagName('A');
633
+ for (var i = 0; i < a.length; ++i) {
634
+ a[i].setAttribute('target', '_blank');
635
+ }
636
+ }
637
+ // 计算悬浮框文字的长度
638
+ var count = 0;
639
+ var str = data.markdown;
640
+ let strLength = str.length;
641
+ let dataRect = data.rect;
642
+ for (var i = 0; i < strLength; i++) {
643
+ if (str.charCodeAt(i) <= 255) {
644
+ count++;
645
+ } else {
646
+ count += 2;
647
+ }
648
+ }
649
+ var tipMarkdownMarginLeft = count * 3 + 11
650
+
651
+ var parentRect = this.parentElem.getBoundingClientRect();
652
+ var elemRect = elem.getBoundingClientRect();
653
+ var x = parentRect.left + dataRect.x;
654
+ var y = pos.y + parentRect.top;
655
+ if (data instanceof Node) {
656
+ x = x + dataRect.width / 2 - tipMarkdownMarginLeft
657
+ y = parentRect.top + dataRect.ey - dataRect.height - 46
658
+ }
659
+ x -= this.parentElem.scrollLeft;
660
+ y -= this.parentElem.scrollTop;
661
+ if (x < 0) {
662
+ x = 0;
663
+ }
664
+ if (x + elemRect.width > document.body.clientWidth) {
665
+ x = document.body.clientWidth - elemRect.width;
666
+ }
667
+ if (y + elemRect.height > document.body.clientHeight) {
668
+ y = document.body.clientHeight - elemRect.height;
669
+ }
670
+ elem.style.position = 'fixed';
671
+ elem.style.left = x + 'px';
672
+ elem.style.top = y + 'px';
673
+ elem.style.zIndex = '3000';
674
+ this.tip = data.id;
675
+ this.dispatch('tip', elem);
676
+ };
677
+ Common.prototype.hideTip = function () {
678
+ if (!this.tip) {
679
+ return;
680
+ }
681
+ this.tipMarkdown.style.left = '-9999px';
682
+ this.tipMarkdown.style.zIndex = '-1';
683
+ if (this.tipElem) {
684
+ this.tipElem.style.left = '-9999px';
685
+ this.tipElem.style.zIndex = '-1';
686
+ this.tipElem = null;
687
+ }
688
+ this.divLayer.canvas.title = '';
689
+ this.tip = '';
690
+ };
691
+ Common.prototype.dispatch = function (event, data) {
692
+ if (this.options.on) {
693
+ this.options.on(event, data);
694
+ }
695
+ if (event === 'node' && data.name == 'tablePagination' && this.options.type !== 'topology') {
696
+ const tableNodes = Store.get('FORM:tableData').data.tableNodes[data.paginationData.bindFromTableId];
697
+ const pageSize = data.paginationData.pageSize;
698
+ const offset = (parseInt(data.paginationData.pageNumber) - 1) * pageSize;
699
+ const params = {
700
+ id: tableNodes.id, // 表格ID
701
+ limit: data.paginationData.pageSize,
702
+ offset: offset
703
+ };
704
+ this.getSyncTableDataFromServer(params, tableNodes);
705
+ }
706
+ };
707
+ Common.prototype.onContent = async function (resetDCIM, data, type) {
708
+ //this.shareComponentData = data.shareComponent // 共享组件数据
709
+ if (resetDCIM) {
710
+ if (resetDCIM.pathRewrite != '') {
711
+ this.pathRewrite = resetDCIM.pathRewrite // 路径重写
712
+ }
713
+ if (resetDCIM.mqttUrl) {
714
+ data.mqttUrl = resetDCIM.mqttUrl
715
+ data.mqttOptions.username = resetDCIM.mqttUsername
716
+ data.mqttOptions.password = resetDCIM.mqttPassword
717
+ }
718
+ }
719
+ this.initType = type
720
+ this.initData = data
721
+ const canvasData = data ? data : this.data
722
+ //this.topologyDetailData = initData
723
+ const url = canvasData.mqttUrl
724
+ // if(url && url.indexOf('://') > -1){
725
+ this.onContentForEventType('Mqtt')
726
+ // }
727
+ if (canvasData.pollUrl) {
728
+ this.onContentForEventType('Poll')
729
+ }
730
+ if (canvasData.pollUrl1) {
731
+ this.onContentForEventType('Poll1')
732
+ }
733
+ if (canvasData.pollUrl2) {
734
+ this.onContentForEventType('Poll2')
735
+ }
736
+ };
737
+ Common.prototype.onContentForEventType = async function (eventType) {
738
+ // 获取属性中数据的集合
739
+ if (!this.initType) await this.initTagParams(eventType);
740
+ let tagParams = this.tagParams[eventType]
741
+ if (eventType === 'Mqtt') {
742
+ // 连接测试,MQTT
743
+ this.onMqttContent(tagParams)
744
+ } else if (eventType.indexOf('Poll') > -1) {
745
+ // 连接测试,轮询地址
746
+ this.onPollContent(tagParams, eventType)
747
+ }
748
+ };
749
+ Common.prototype.clearTagParams = function (eventType) {
750
+ this.tagParams[eventType] = {};
751
+ this.tagParams[eventType].tagIds = [];
752
+ this.tagParams[eventType].kpiAddrs = [];
753
+ this.tagParams[eventType].tagEcharts = [];
754
+ this.tagParams[eventType].assetIds = [];
755
+ this.tagParams[eventType].areaIds = [];
756
+ // this.tagParams[eventType].cockpitLayoutData = [];//统计图表组件类型ID
757
+ this.tagParams[eventType].echartData = [];//统计图表组件类型ID
758
+ };
759
+ Common.prototype.initTagParams = async function (eventType) {
760
+ this.clearTagParams(eventType)
761
+ const pensData = this.data.pens
762
+ let tagParams = this.getTagParams(pensData, eventType);
763
+ // 详情页面,即URL配置了资产id的页面
764
+ let assetId = this.getUrlParams('assetId')
765
+ // console.log('详情页面,即URL配置了资产id的页面',assetId,eventType, tagParams)
766
+ if (assetId && eventType === 'Mqtt') {
767
+ //if(assetId){
768
+ // 获取属性中绑定指标数据的集合
769
+ await this.getTagParamsForKpiAddrs(assetId, tagParams)
770
+ // 存在固定的资产详情,更新页面数据
771
+ // if(this.assetPoperties && this.isExistAssetKey === true){
772
+ if (this.assetPoperties) {
773
+ // 更新画布上固定的资产详情对应的值
774
+ //const canvasPens = this.pathRewrite ? canvasData.pens : this.canvas.data.pens
775
+ this.renderForAssetPoperties(this.canvas.data.pens);
776
+ }
777
+ }
778
+ };
779
+ Common.prototype.getTagParams = function (pens, eventType) {
780
+ const _this = this;
781
+ pens.forEach((pen) => {
782
+ if (pen.children != undefined && pen.children.length > 0) {
783
+ _this.getTagParams(pen.children, eventType)
784
+ } else {
785
+ _this.getTagParamsChildren(pen, eventType)
786
+ }
787
+ })
788
+ return this.tagParams[eventType]
789
+ };
790
+ Common.prototype.getTagParamsChildren = function (pen, eventType) {
791
+ let tagIds = []
792
+ let kpiAddrs = []
793
+ let assetIds = []
794
+ let areaIds = []
795
+ let tagEcharts = []
796
+ // let cockpitLayoutData = []
797
+ let echartData = []
798
+ let isEventType = false;
799
+ for (var _b = 0, _c = pen.events; _b < _c.length; _b++) {
800
+ var event_1 = _c[_b];
801
+ if ((event_1.type === 3 && eventType === 'Mqtt') || (event_1.type === 4 && eventType === 'Poll')
802
+ || (event_1.type === 5 && eventType === 'Poll1') || (event_1.type === 6 && eventType === 'Poll2')) {
803
+ isEventType = true;
804
+ }
805
+ }
806
+ if (isEventType === true) {
807
+ if (pen.data != undefined && this.checkType(pen.data) === 'Array' && pen.data.length > 0) {
808
+ pen.data.forEach((item) => {
809
+ if (item.key === 'tagId') {
810
+ tagIds.push(item.value)
811
+ }
812
+ if (item.key === 'kpiAddr') {
813
+ kpiAddrs.push(item.value)
814
+ }
815
+ if (item.key === 'assetKey') {
816
+ this.isExistAssetKey = true
817
+ }
818
+ if (item.key === 'assetId') {
819
+ assetIds.push(item.value)
820
+ }
821
+ if (item.key === 'areaId') {
822
+ areaIds.push(item.value)
823
+ }
824
+ })
825
+ }
826
+ // else if(pen.data != undefined && this.checkType(pen.data) === 'Object' && pen.tags != undefined && this.checkType(pen.tags) === 'Array' && pen.tags.length>0){
827
+ // pen.tags.forEach((item)=>{
828
+ // if( item.indexOf('echart') > -1){
829
+ // tagEcharts.push(item)
830
+ // }
831
+ // })
832
+ // }
833
+ else if (pen.data != undefined && this.checkType(pen.data) === 'Object' && this.checkType(pen.data.params) === 'Object') {
834
+
835
+ // pen.data.echarts && pen.data.echarts.option.series.length > 1 ? echartData.push(pen.data.params.id) : cockpitLayoutData.push(pen.data.params.id)
836
+ echartData.push(pen.data.params.id)
837
+
838
+ }
839
+ this.tagParams[eventType].tagIds = [...new Set(this.tagParams[eventType].tagIds.concat(tagIds))]
840
+ this.tagParams[eventType].kpiAddrs = [...new Set(this.tagParams[eventType].kpiAddrs.concat(kpiAddrs))]
841
+ this.tagParams[eventType].assetIds = [...new Set(this.tagParams[eventType].assetIds.concat(assetIds))]
842
+ this.tagParams[eventType].areaIds = [...new Set(this.tagParams[eventType].areaIds.concat(areaIds))]
843
+ this.tagParams[eventType].tagEcharts = [...new Set(this.tagParams[eventType].tagEcharts.concat(tagEcharts))]
844
+ // this.tagParams[eventType].cockpitLayoutData = [...new Set(this.tagParams[eventType].cockpitLayoutData.concat(cockpitLayoutData))]
845
+ this.tagParams[eventType].echartData = [...new Set(this.tagParams[eventType].echartData.concat(echartData))]
846
+ }
847
+ };
848
+ Common.prototype.getMqttData = async function (tagParams, panelData) {
849
+ let ret = {};
850
+ let data = {};
851
+ let path = '';
852
+ let assetData = null;
853
+ let pathRewrite = this.pathRewrite;
854
+ let canvasData = JSON.parse(JSON.stringify(this.canvas.data));
855
+ let mqttTopics = this.data.mqttTopics;
856
+ let tagParamsData = tagParams;
857
+ let detailJson = null;
858
+ Store.set('TIMEOUT:currentPage', `locationPath${this.s8()}`);
859
+ if (panelData) {
860
+ this.data.mqttTopics = mqttTopics
861
+ pathRewrite = panelData.pathRewrite;
862
+ canvasData = JSON.parse(JSON.stringify(panelData.data));
863
+ mqttTopics = panelData.mqttTopics;
864
+ if (panelData.assetId) {
865
+ const detailData = await this.getTagParamsForKpiAddrs(panelData.assetId, tagParams, pathRewrite);
866
+ if (detailData.data) {
867
+ tagParamsData.tagIds = detailData.tagIds;
868
+ assetData = detailData.data.asset;
869
+ detailJson = detailData.data;
870
+ tagParamsData.echartAssemblyData = detailJson.echartAssemblyData;
871
+ }
872
+ }
873
+ }
874
+ tagParamsData.locationPath = Store.get('TIMEOUT:currentPage');
875
+ if (!tagParams) {
876
+ data = this.theData
877
+ path = this.thePath
878
+ } else {
879
+ data = {
880
+ tagIds: tagParamsData.tagIds.join(","),
881
+ assetIds: tagParamsData.assetIds.join(","),
882
+ areaIds: tagParamsData.areaIds.join(","),
883
+ routingkey: mqttTopics,
884
+ echart: tagParamsData.tagEcharts.join(","),
885
+ echartData: tagParamsData.echartData
886
+ }
887
+ if (tagParamsData.echartAssemblyData) {
888
+ data.echartAssemblyData = tagParamsData.echartAssemblyData;
889
+ }
890
+ //const pathRewrite = panelData ? panelData.pathRewrite : this.pathRewrite
891
+ path = pathRewrite ? pathRewrite + '/user/cockpit/mqtt-data' : '/user/cockpit/mqtt-data'
892
+ this.thePath = path
893
+ this.theData = data
894
+ }
895
+ let drawedData = null
896
+ ret = await axios.post(path, data);
897
+ if (ret.data && ret.data.data) {
898
+ if (assetData) ret.data.data.asset = assetData
899
+ drawedData = this.mqttDataDrawing(canvasData, ret.data.data, detailJson)
900
+ }
901
+ this.clearInterValAll();
902
+ this.timmerByTopology = setTimeout(() => {
903
+ const locationPath = Store.get('TIMEOUT:currentPage');
904
+ if (locationPath === tagParamsData.locationPath) {
905
+ this.getMqttData(tagParamsData);
906
+ }
907
+ }, 180000); // 每3分钟定时请求,超过3分钟未收到MQTT将停止推送数据 180000
908
+ if (ret.error) {
909
+ return null;
910
+ } else {
911
+ return {
912
+ mqttData: drawedData,
913
+ detailData: detailJson
914
+ }
915
+ }
916
+ };
917
+ Common.prototype.mqttDataDrawing = function (data, retData, detailJson) {
918
+ const syncData = retData
919
+ const detailData = detailJson ? detailJson.data : [];
920
+ // console.log('收到消息', syncData)
921
+ Store.set('mqtt:responseData', syncData);
922
+ data.pens.map((item) => {
923
+ if (item.children != undefined) {
924
+ item.children.map((_item) => {
925
+ item.defaultFillStyle = item.fillStyle;
926
+ item.defaultFontColor = item.font.color;
927
+ if (item.name === 'line') item.defaultLineColor = item.strokeStyle;
928
+ if (!_item.data) return
929
+ //const node = detailData.length > 0 ? detailData : syncData
930
+ const functionData = _item.events.filter((ev) => {
931
+ return ev.action === EventAction.Function
932
+ })
933
+ const dataValue = functionData[0]
934
+ if (functionData.length > 0 && dataValue.value && retData) {
935
+ _item.data.map((d) => {
936
+ const {kpiData, tagData} = retData;
937
+ const key = d.key;
938
+ const value = d.value;
939
+ const _syncItem = key === 'tagId' ? tagData[value] : kpiData[value];
940
+ if ((key === 'tagId' || key === 'kpiAddr') && _syncItem) {
941
+ const isControl = parseInt(_syncItem.isControlDis); // 是否可控,0可控,1不可控
942
+ if (!isControl) {
943
+ d.tagVal = value
944
+ d.controlParams = _syncItem
945
+ // delete _syncItem[value]
946
+ // Object.assign(d, _syncItem)
947
+ }
948
+ }
949
+ })
950
+ //console.log('定制函数=====')
951
+ console.log('定制函数------')
952
+ const func = new Function('pen', 'params', dataValue.value)
953
+ func(_item, JSON.stringify(retData))
954
+ } else {
955
+ // console.log('默认函数')
956
+ setConfItemNode(_item, syncData);
957
+ }
958
+ this.machAnimateReset(item);
959
+ })
960
+ } else {
961
+ item.defaultFillStyle = item.fillStyle;
962
+ item.defaultFontColor = item.font.color;
963
+ if (item.name === 'line') item.defaultLineColor = item.strokeStyle;
964
+ if (!item.data) return
965
+ //const node = detailData.length > 0 ? detailData : syncData
966
+ const functionData = item.events.filter((ev) => {
967
+ return ev.action === EventAction.Function
968
+ })
969
+ const dataValue = functionData[0]
970
+ if (functionData.length > 0 && dataValue.value && retData) {
971
+ item.data.map((d) => {
972
+ const {kpiData, tagData} = retData;
973
+ const key = d.key;
974
+ const value = d.value;
975
+ const _syncItem = key === 'tagId' ? tagData[value] : kpiData[value];
976
+ if ((key === 'tagId' || key === 'kpiAddr') && _syncItem) {
977
+ const isControl = parseInt(_syncItem.isControlDis); // 是否可控,0可控,1不可控
978
+ if (!isControl) {
979
+ d.tagVal = value;
980
+ d.controlParams = _syncItem;
981
+ // delete _syncItem[value]
982
+ // Object.assign(d, _syncItem)
983
+ }
984
+ }
985
+ });
986
+ const func = new Function('pen', 'params', dataValue.value);
987
+ func(item, JSON.stringify(retData));
988
+ //const machData = func(item, JSON.stringify(retData));
989
+ console.log('定制函数------------');
990
+ } else {
991
+ // console.log('默认函数')
992
+ setConfItemNode(item, syncData);
993
+ }
994
+ this.machAnimateReset(item);
995
+ }
996
+ })
997
+ // console.log('执行完毕')
998
+ this.render();
999
+ this.animate(true);
1000
+ return data
1001
+ };
1002
+ Common.prototype.machAnimateReset = function (pen) {
1003
+ if (!pen.animateFrames || pen.animateFrames.length <= 0) return;
1004
+ for (var _a = 0, _af = pen.animateFrames; _a < _af.length; _a++) {
1005
+ var ani = _af[_a];
1006
+ ani.state.strokeStyle = pen.strokeStyle;
1007
+ ani.state.fillStyle = pen.fillStyle;
1008
+ }
1009
+ };
1010
+ Common.prototype.getTagParamsForKpiAddrs = async function (assetId, tagParams, apiStr) {
1011
+ let params = {
1012
+ assetId: assetId,
1013
+ tagIds: tagParams.tagIds.join(","),
1014
+ kpiAddrs: tagParams.kpiAddrs.join(","),
1015
+ echartAssemblyIds: tagParams.echartData,
1016
+ }
1017
+ let pathRewrite = apiStr ? apiStr : this.pathRewrite
1018
+ const path = pathRewrite ? pathRewrite + '/place/place_monitor/getPlaceAssetDetail' : '/place/place_monitor/getPlaceAssetDetail'
1019
+ let ret = await axios.post(path, params);
1020
+ // 遍历得到属性中绑定指标数据的集合
1021
+ const tagIds = this.getTagIdsForKpiAddrs(ret.data);
1022
+ // 详情页面,固定的资产详情的数据集合
1023
+ this.assetPoperties = ret.asset
1024
+
1025
+ return {
1026
+ data: ret.data,
1027
+ echartAssemblyData: ret.echartAssemblyData,
1028
+ tagIds: tagIds
1029
+ }
1030
+ };
1031
+ Common.prototype.getTagIdsForKpiAddrs = function (data) {
1032
+ let tagIds = [];
1033
+ const delData = this.pathRewrite ? data : data.data;
1034
+ if (delData && delData.length > 0) {
1035
+ delData.forEach((item) => {
1036
+ tagIds.push(item.tagId);
1037
+ })
1038
+ this.tagParams.detailAssetData = data;
1039
+ this.tagParams.Mqtt.tagIds = tagIds;
1040
+ }
1041
+ return tagIds
1042
+ };
1043
+ Common.prototype.renderForAssetPoperties = function (pens) {
1044
+ const _this = this;
1045
+ pens.forEach((pen) => {
1046
+ if (pen.children != undefined) {
1047
+ _this.renderForAssetPoperties(pen.children)
1048
+ } else {
1049
+ _this.renderForAssetPopertiesChildren(pen)
1050
+ }
1051
+ })
1052
+ };
1053
+ Common.prototype.renderForAssetPopertiesChildren = function (pen) {
1054
+ if (pen.data != undefined && pen.data != '' && typeof pen.data === 'object' && Array.isArray(pen.data) && pen.data.length > 0) {
1055
+ pen.data.forEach((item) => {
1056
+ Object.keys(this.assetPoperties).forEach(key => {
1057
+ if (item.key === 'assetKey') {
1058
+ if (item.value === key) {
1059
+ if (key === 'imgUrl' || key === 'principleImg') {
1060
+ pen.text = ''
1061
+ pen.image = this.pathRewrite ? this.pathRewrite + this.assetPoperties[key] : this.assetPoperties[key]
1062
+ } else {
1063
+ pen.text = this.assetPoperties[key]
1064
+ }
1065
+ }
1066
+ }
1067
+ })
1068
+ })
1069
+ }
1070
+ };
1071
+ Common.prototype.onMqttContent = async function (tagParams) {
1072
+ if (!this.initType) this.data.mqttTopics = 'mqtt-' + s8();
1073
+ // 告知MQTT属性中数据的集合
1074
+ const ret = !this.initType ? await this.getMqttData(tagParams) : this.initType;
1075
+ if (ret) {
1076
+ let mqttUrlStr = this.data.mqttUrl, mqttOption = this.data.mqttOptions
1077
+ if (this.initData) {
1078
+ const {mqttUrl, mqttOptions} = this.initData
1079
+ mqttUrlStr = mqttUrl
1080
+ mqttOption = mqttOptions
1081
+ }
1082
+ mqttOption.clientId = s8()
1083
+ this.openMqtt(mqttUrlStr, mqttOption);
1084
+ } else {
1085
+ console.log('请求出错')
1086
+ }
1087
+ };
1088
+ Common.prototype.onPollContent = function (tagParams, eventType) {
1089
+ const index = eventType[4] ? eventType[4] : ''
1090
+ // const url = 'pollUrl'+index;
1091
+ // const second = 'pollSecond'+index;
1092
+ const pollUrl = this.data['pollUrl' + index]
1093
+ const pollSecond = this.data['pollSecond' + index]
1094
+ this.onpollStop(eventType);
1095
+ if (pollUrl && pollSecond) {
1096
+ this.renderForPoll(tagParams, pollUrl, eventType);
1097
+ if (pollSecond != 0) { // 轮询
1098
+ let millisecond = parseInt(pollSecond * 1000)
1099
+ this.pollTime[eventType] = setInterval(() => {
1100
+ this.renderForPoll(tagParams, pollUrl, eventType);
1101
+ }, millisecond);
1102
+ }
1103
+ }
1104
+ };
1105
+ Common.prototype.onpollStop = function (eventType) {
1106
+ if (this.pollTime[eventType]) {
1107
+ clearInterval(this.pollTime[eventType])
1108
+ }
1109
+ };
1110
+ Common.prototype.renderForPoll = async function (tagParams, pollUrl, eventType) {
1111
+ let data = {
1112
+ tagIds: tagParams.tagIds.join(","),
1113
+ // assetIds: tagParams.assetIds.join(","),
1114
+ // echart: tagParams.tagEcharts.join(",")
1115
+ }
1116
+ const _this = this
1117
+ axios.post(pollUrl, data)
1118
+ .then((res) => {
1119
+ _this.openPoll(res, eventType);
1120
+ })
1121
+ .catch((error) => {
1122
+ console.log('轮询地址,连接失败', error)
1123
+ _this.onpollStop(eventType);
1124
+ });
1125
+ };
1126
+ Common.prototype.getUrlParams = function (name) {
1127
+ var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i')
1128
+ var r = window.location.search.substr(1).match(reg)
1129
+ if (r != null) return unescape(r[2])
1130
+ return null
1131
+ };
1132
+ Common.prototype.checkType = function (data) {
1133
+ return Object.prototype.toString.call(data).slice(8, -1)
1134
+ };
1135
+ Common.prototype.mqttLostMessage = function () {
1136
+ // console.log('发送请求mqtt-data')
1137
+ this.getMqttData(this.tagParams.Mqtt);
1138
+ };
1139
+ Common.prototype.doMqttDrow = function (ret) {
1140
+ let canvasData = this.canvas.data;
1141
+ ret = JSON.parse(ret);
1142
+ // console.log('处理消息')
1143
+ // console.log('this.canvas.data',this.canvas.data)
1144
+ this.mqttDataDrawing(canvasData, ret)
1145
+ };
1146
+ Common.prototype.hidePenByTag = function (pens, val) {
1147
+ const _this = this;
1148
+ pens.forEach((pen) => {
1149
+ if (pen.children != undefined) {
1150
+ _this.hidePenByTag(pen.children, val);
1151
+ }
1152
+ _this.hidePenVal(pen, val);
1153
+ });
1154
+ };
1155
+ Common.prototype.hidePenVal = function (pen, val) {
1156
+ const tags = pen.tags
1157
+ const obj = val ? JSON.parse(val) : {}
1158
+ const visibleRange = obj.visibleRange
1159
+ const visibleFnRange = obj.visibleFnRange
1160
+ const visibleValue = obj.visibleValue
1161
+ const hiddenRange = obj.hiddenRange
1162
+ const tabsValue = obj.tabsValue
1163
+ if (tags.length > 0) {
1164
+ if (visibleRange == '1') {
1165
+ if (this.openCount % 2 == 0) {
1166
+ visibleFnRange == '1' ? pen.visible = false : pen.visible = true
1167
+ } else {
1168
+ visibleFnRange == '1' ? pen.visible = true : pen.visible = false
1169
+ }
1170
+ } else if (visibleRange == '2') {
1171
+ if (visibleValue) {
1172
+ if (tags.includes(visibleValue))
1173
+ pen.visible = !pen.visible;
1174
+ }
1175
+ if (hiddenRange) {
1176
+ let arr = hiddenRange.split(',')
1177
+ let a = false
1178
+ arr = arr.filter(el => el !== visibleValue)
1179
+ for (let i = 0; i < tags.length; i++) {
1180
+ if (arr.indexOf(tags[i]) !== -1) {
1181
+ a = true
1182
+ }
1183
+ }
1184
+ if (a) {
1185
+ pen.visible = false;
1186
+ }
1187
+ }
1188
+ } else if (visibleRange == '3') {
1189
+ if (visibleValue) {
1190
+ if (tags.includes(tabsValue)) {
1191
+ if (tags.includes(visibleValue)) {
1192
+ pen.visible = true;
1193
+ } else {
1194
+ pen.visible = false;
1195
+ }
1196
+ }
1197
+ }
1198
+ }
1199
+ }
1200
+ this.render();
1201
+ };
1202
+ Common.prototype.destroyStatic = function () {
1203
+ this.clearInterValAll();
1204
+ this.closeSocket();
1205
+ this.closeMqtt();
1206
+ this.closePoll();
1207
+ this.subcribe.unsubscribe();
1208
+ this.subcribeRender.unsubscribe();
1209
+ this.subcribeImage.unsubscribe();
1210
+ this.subcribeAnimateEnd.unsubscribe();
1211
+ this.subcribeTableData.unsubscribe();
1212
+ this.animateLayer.destroy();
1213
+ this.animateLayer = null;
1214
+ this.divLayer.destroy();
1215
+ this.divLayer = null;
1216
+ this.canvas.destroy();
1217
+ this.canvas = null;
1218
+ this.offscreen.destroy();
1219
+ this.offscreen = null;
1220
+ this.data = null;
1221
+ Store.set('form:tableData', null);
1222
+ Store.set('TIMEOUT:currentPage', `empty${this.s8()}`);
1223
+ Store.set('FORM:tableData', {
1224
+ data: {
1225
+ tableNodes: {},
1226
+ paginationNodes: {},
1227
+ pageRelevTableNodes: {}
1228
+ }
1229
+ });
1230
+ document.body.removeChild(this.tipMarkdown);
1231
+ if (this.paginationPageListBox) this.paginationPageListBox.removeEventListener('click', this.paginationPageListNode);
1232
+ if (this.pagenationPageInput) this.pagenationPageInput.removeEventListener('click', this.pagenationPageInputNode);
1233
+ //优化
1234
+ Object.keys(this).forEach((item) => {
1235
+
1236
+
1237
+ if (typeof (item) === Object) {
1238
+
1239
+ Object.keys(item).foreach((i) => {
1240
+
1241
+ item[i] = null;
1242
+ })
1243
+ }
1244
+
1245
+ this[item] = null;
1246
+
1247
+ })
1248
+ //end
1249
+ window.topology = null;
1250
+ };
1251
+ // Render or redraw
1252
+ return Common;
1253
+ }());
1254
+ export {Common};