@foblex/flow 12.6.4 → 12.6.6

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 (259) hide show
  1. package/bundles/foblex-flow.umd.js +2589 -2297
  2. package/bundles/foblex-flow.umd.js.map +1 -1
  3. package/domain/create-connection-markers/create-connection-markers.execution.d.ts +5 -1
  4. package/domain/{clear-selection → f-selection/clear-selection}/clear-selection.execution.d.ts +1 -1
  5. package/domain/{get-selection → f-selection/get-selection}/get-selection.execution.d.ts +1 -1
  6. package/domain/f-selection/index.d.ts +6 -0
  7. package/domain/f-selection/providers.d.ts +6 -0
  8. package/domain/{select → f-selection/select}/select.execution.d.ts +2 -2
  9. package/domain/{select-all → f-selection/select-all}/select-all.execution.d.ts +2 -2
  10. package/domain/{select-and-update-node-layer → f-selection/select-and-update-node-layer}/select-and-update-node-layer.execution.d.ts +2 -2
  11. package/domain/f-selection/select-and-update-node-layer/select-and-update-node-layer.request.d.ts +5 -0
  12. package/domain/get-flow-state/providers.d.ts +1 -1
  13. package/domain/index.d.ts +1 -8
  14. package/domain/providers.d.ts +1 -9
  15. package/esm2015/domain/create-connection-markers/create-connection-markers.execution.js +10 -5
  16. package/esm2015/domain/f-selection/clear-selection/clear-selection.execution.js +26 -0
  17. package/esm2015/domain/f-selection/clear-selection/clear-selection.request.js +3 -0
  18. package/esm2015/domain/f-selection/clear-selection/index.js +3 -0
  19. package/esm2015/domain/f-selection/get-selection/get-selection.execution.js +35 -0
  20. package/esm2015/domain/f-selection/get-selection/get-selection.request.js +3 -0
  21. package/esm2015/domain/f-selection/get-selection/index.js +3 -0
  22. package/esm2015/domain/f-selection/index.js +7 -0
  23. package/esm2015/domain/f-selection/providers.js +13 -0
  24. package/esm2015/domain/f-selection/select/index.js +3 -0
  25. package/esm2015/domain/f-selection/select/select.execution.js +44 -0
  26. package/esm2015/domain/f-selection/select/select.request.js +7 -0
  27. package/esm2015/domain/f-selection/select-all/index.js +3 -0
  28. package/esm2015/domain/f-selection/select-all/select-all.execution.js +38 -0
  29. package/esm2015/domain/f-selection/select-all/select-all.request.js +3 -0
  30. package/esm2015/domain/f-selection/select-and-update-node-layer/index.js +3 -0
  31. package/esm2015/domain/f-selection/select-and-update-node-layer/select-and-update-node-layer.execution.js +35 -0
  32. package/esm2015/domain/f-selection/select-and-update-node-layer/select-and-update-node-layer.request.js +6 -0
  33. package/esm2015/domain/index.js +2 -9
  34. package/esm2015/domain/providers.js +7 -17
  35. package/esm2015/domain/redraw-connections/redraw-connections.execution.js +4 -1
  36. package/esm2015/f-backgroud/domain/add-pattern-to-background/add-pattern-to-background.execution.js +48 -0
  37. package/esm2015/f-backgroud/domain/add-pattern-to-background/add-pattern-to-background.request.js +6 -0
  38. package/esm2015/f-backgroud/domain/add-pattern-to-background/index.js +3 -0
  39. package/esm2015/f-backgroud/domain/i-f-background-pattern.js +1 -1
  40. package/esm2015/f-backgroud/domain/index.js +3 -1
  41. package/esm2015/f-backgroud/domain/providers.js +5 -0
  42. package/esm2015/f-backgroud/f-background.component.js +10 -28
  43. package/esm2015/f-canvas/domain/center-group-or-node/center-group-or-node-request.js +7 -0
  44. package/esm2015/f-canvas/domain/center-group-or-node/center-group-or-node.execution.js +49 -0
  45. package/esm2015/f-canvas/domain/center-group-or-node/index.js +3 -0
  46. package/esm2015/f-canvas/domain/fit-to-flow/fit-to-flow-request.js +7 -0
  47. package/esm2015/f-canvas/domain/fit-to-flow/fit-to-flow.execution.js +56 -0
  48. package/esm2015/f-canvas/domain/fit-to-flow/index.js +3 -0
  49. package/esm2015/f-canvas/domain/index.js +9 -1
  50. package/esm2015/f-canvas/domain/input-canvas-position/index.js +3 -0
  51. package/esm2015/f-canvas/domain/input-canvas-position/input-canvas-position-request.js +7 -0
  52. package/esm2015/f-canvas/domain/input-canvas-position/input-canvas-position.execution.js +34 -0
  53. package/esm2015/f-canvas/domain/input-canvas-scale/index.js +3 -0
  54. package/esm2015/f-canvas/domain/input-canvas-scale/input-canvas-scale-request.js +7 -0
  55. package/esm2015/f-canvas/domain/input-canvas-scale/input-canvas-scale.execution.js +29 -0
  56. package/esm2015/f-canvas/domain/providers.js +17 -0
  57. package/esm2015/f-canvas/domain/reset-scale/index.js +3 -0
  58. package/esm2015/f-canvas/domain/reset-scale/reset-scale-request.js +3 -0
  59. package/esm2015/f-canvas/domain/reset-scale/reset-scale.execution.js +29 -0
  60. package/esm2015/f-canvas/domain/reset-scale-and-center/index.js +3 -0
  61. package/esm2015/f-canvas/domain/reset-scale-and-center/reset-scale-and-center-request.js +6 -0
  62. package/esm2015/f-canvas/domain/reset-scale-and-center/reset-scale-and-center.execution.js +51 -0
  63. package/esm2015/f-canvas/domain/update-scale/index.js +3 -0
  64. package/esm2015/f-canvas/domain/update-scale/update-scale-request.js +7 -0
  65. package/esm2015/f-canvas/domain/update-scale/update-scale.execution.js +34 -0
  66. package/esm2015/f-canvas/f-canvas-base.js +12 -15
  67. package/esm2015/f-canvas/f-canvas.component.js +21 -44
  68. package/esm2015/f-connection/common/f-connection-base.js +1 -1
  69. package/esm2015/f-connection/f-connection/f-connection.component.js +2 -7
  70. package/esm2015/f-connection/f-connection-for-create/f-connection-for-create.component.js +1 -6
  71. package/esm2015/f-connection/f-snap-connection/f-snap-connection.component.js +13 -9
  72. package/esm2015/f-connection/providers.js +4 -2
  73. package/esm2015/f-connectors/f-node-input/index.js +1 -2
  74. package/esm2015/f-draggable/canvas/canvas.drag-handler.js +2 -2
  75. package/esm2015/f-draggable/connections/common/find-closest-input-using-snap-threshold/find-closest-input-using-snap-threshold.execution.js +39 -0
  76. package/esm2015/f-draggable/connections/common/find-closest-input-using-snap-threshold/find-closest-input-using-snap-threshold.request.js +8 -0
  77. package/esm2015/f-draggable/connections/common/find-closest-input-using-snap-threshold/index.js +3 -0
  78. package/esm2015/f-draggable/connections/common/get-all-can-be-connected-input-positions/get-all-can-be-connected-input-positions.execution.js +55 -0
  79. package/esm2015/f-draggable/connections/common/get-all-can-be-connected-input-positions/get-all-can-be-connected-input-positions.request.js +6 -0
  80. package/esm2015/f-draggable/connections/common/get-all-can-be-connected-input-positions/index.js +3 -0
  81. package/esm2015/f-draggable/connections/common/get-connector-with-rect/get-connector-with-rect-request.js +6 -0
  82. package/esm2015/f-draggable/connections/common/get-connector-with-rect/get-connector-with-rect.execution.js +28 -0
  83. package/esm2015/f-draggable/connections/common/get-connector-with-rect/i-connector-with-rect.js +2 -0
  84. package/esm2015/f-draggable/connections/common/get-connector-with-rect/index.js +4 -0
  85. package/esm2015/f-draggable/connections/common/get-input-under-pointer/get-input-under-pointer.execution.js +85 -0
  86. package/esm2015/f-draggable/connections/common/get-input-under-pointer/get-input-under-pointer.request.js +7 -0
  87. package/esm2015/f-draggable/connections/common/get-input-under-pointer/get-input-under-pointer.validator.js +35 -0
  88. package/esm2015/f-draggable/connections/common/get-input-under-pointer/index.js +4 -0
  89. package/esm2015/f-draggable/connections/common/index.js +6 -0
  90. package/esm2015/f-draggable/connections/common/providers.js +12 -0
  91. package/esm2015/f-draggable/connections/create-connection/create-connection-finalize/create-connection-finalize.execution.js +5 -5
  92. package/esm2015/f-draggable/connections/create-connection/create-connection-preparation/create-connection-drag-handler/create-connection-drag-handler.execution.js +4 -5
  93. package/esm2015/f-draggable/connections/create-connection/create-connection.drag-handler.js +51 -20
  94. package/esm2015/f-draggable/connections/index.js +2 -2
  95. package/esm2015/f-draggable/connections/providers.js +6 -4
  96. package/esm2015/f-draggable/connections/reassign-connection/f-reassign-connection.event.js +3 -3
  97. package/esm2015/f-draggable/connections/reassign-connection/reassign-connection-finalize/reassign-connection-finalize.execution.js +4 -4
  98. package/esm2015/f-draggable/connections/reassign-connection/reassign-connection-preparation/reassign-connection-preparation.execution.js +2 -2
  99. package/esm2015/f-draggable/connections/reassign-connection/reassign-connection.drag-handler.js +51 -23
  100. package/esm2015/f-draggable/node/connection-base-drag-handler.js +17 -19
  101. package/esm2015/f-draggable/node/connection-source.drag-handler.js +5 -4
  102. package/esm2015/f-draggable/node/connection-target.drag-handler.js +5 -4
  103. package/esm2015/f-draggable/node/connection.drag-handler.js +5 -4
  104. package/esm2015/f-draggable/node/create-move-nodes-drag-model-from-selection/domain/put-input-connection-handlers-to-array/put-input-connection-handlers-to-array.execution.js +3 -3
  105. package/esm2015/f-draggable/node/create-move-nodes-drag-model-from-selection/domain/put-output-connection-handlers-to-array/put-output-connection-handlers-to-array.execution.js +3 -3
  106. package/esm2015/f-draggable/node/node-move-preparation/node-move-preparation.execution.js +2 -2
  107. package/esm2015/f-draggable/providers.js +2 -2
  108. package/esm2015/f-flow/f-flow.component.js +8 -6
  109. package/esm2015/f-flow.module.js +18 -17
  110. package/esm2015/f-minimap/domain/f-minimap.drag-handler.js +2 -2
  111. package/esm2015/f-minimap/domain/minimap-drag-preparation/minimap-drag-preparation.execution.js +2 -2
  112. package/esm2015/f-storage/f-components-store.js +1 -1
  113. package/esm2015/f-zoom/f-zoom-base.js +4 -4
  114. package/esm2015/mixins/index.js +1 -6
  115. package/f-backgroud/domain/add-pattern-to-background/add-pattern-to-background.execution.d.ts +14 -0
  116. package/f-backgroud/domain/add-pattern-to-background/add-pattern-to-background.request.d.ts +5 -0
  117. package/f-backgroud/domain/add-pattern-to-background/index.d.ts +2 -0
  118. package/f-backgroud/domain/i-f-background-pattern.d.ts +1 -0
  119. package/f-backgroud/domain/index.d.ts +2 -0
  120. package/f-backgroud/domain/providers.d.ts +2 -0
  121. package/f-backgroud/f-background.component.d.ts +5 -4
  122. package/{domain → f-canvas/domain}/center-group-or-node/center-group-or-node.execution.d.ts +1 -1
  123. package/f-canvas/domain/fit-to-flow/fit-to-flow-request.d.ts +6 -0
  124. package/f-canvas/domain/fit-to-flow/fit-to-flow.execution.d.ts +16 -0
  125. package/f-canvas/domain/fit-to-flow/index.d.ts +2 -0
  126. package/f-canvas/domain/index.d.ts +8 -0
  127. package/f-canvas/domain/input-canvas-position/index.d.ts +2 -0
  128. package/f-canvas/domain/input-canvas-position/input-canvas-position-request.d.ts +6 -0
  129. package/f-canvas/domain/input-canvas-position/input-canvas-position.execution.d.ts +11 -0
  130. package/f-canvas/domain/input-canvas-scale/index.d.ts +2 -0
  131. package/f-canvas/domain/input-canvas-scale/input-canvas-scale-request.d.ts +6 -0
  132. package/f-canvas/domain/input-canvas-scale/input-canvas-scale.execution.d.ts +11 -0
  133. package/f-canvas/domain/providers.d.ts +8 -0
  134. package/f-canvas/domain/reset-scale/index.d.ts +2 -0
  135. package/f-canvas/domain/reset-scale/reset-scale-request.d.ts +2 -0
  136. package/f-canvas/domain/reset-scale/reset-scale.execution.d.ts +12 -0
  137. package/f-canvas/domain/reset-scale-and-center/index.d.ts +2 -0
  138. package/f-canvas/domain/reset-scale-and-center/reset-scale-and-center-request.d.ts +4 -0
  139. package/f-canvas/domain/reset-scale-and-center/reset-scale-and-center.execution.d.ts +16 -0
  140. package/f-canvas/domain/update-scale/index.d.ts +2 -0
  141. package/f-canvas/domain/update-scale/update-scale-request.d.ts +6 -0
  142. package/f-canvas/domain/update-scale/update-scale.execution.d.ts +12 -0
  143. package/f-canvas/f-canvas-base.d.ts +8 -12
  144. package/f-canvas/f-canvas.component.d.ts +3 -1
  145. package/f-connection/common/f-connection-base.d.ts +0 -2
  146. package/f-connection/f-connection/f-connection.component.d.ts +0 -2
  147. package/f-connection/f-connection-for-create/f-connection-for-create.component.d.ts +0 -2
  148. package/f-connection/f-snap-connection/f-snap-connection.component.d.ts +2 -3
  149. package/f-connection/providers.d.ts +2 -1
  150. package/f-connectors/f-node-input/index.d.ts +0 -1
  151. package/f-draggable/connections/common/find-closest-input-using-snap-threshold/find-closest-input-using-snap-threshold.execution.d.ts +11 -0
  152. package/f-draggable/connections/common/find-closest-input-using-snap-threshold/find-closest-input-using-snap-threshold.request.d.ts +8 -0
  153. package/f-draggable/connections/common/find-closest-input-using-snap-threshold/index.d.ts +2 -0
  154. package/f-draggable/connections/common/get-all-can-be-connected-input-positions/get-all-can-be-connected-input-positions.execution.d.ts +21 -0
  155. package/f-draggable/connections/common/get-all-can-be-connected-input-positions/get-all-can-be-connected-input-positions.request.d.ts +4 -0
  156. package/f-draggable/connections/common/get-all-can-be-connected-input-positions/index.d.ts +2 -0
  157. package/f-draggable/connections/common/get-connector-with-rect/get-connector-with-rect-request.d.ts +5 -0
  158. package/f-draggable/connections/common/get-connector-with-rect/get-connector-with-rect.execution.d.ts +11 -0
  159. package/f-draggable/connections/common/get-connector-with-rect/i-connector-with-rect.d.ts +6 -0
  160. package/f-draggable/connections/common/get-connector-with-rect/index.d.ts +3 -0
  161. package/f-draggable/connections/{get-input-under-pointer → common/get-input-under-pointer}/get-input-under-pointer.execution.d.ts +7 -4
  162. package/f-draggable/connections/{get-input-under-pointer → common/get-input-under-pointer}/get-input-under-pointer.request.d.ts +2 -2
  163. package/f-draggable/connections/{get-input-under-pointer → common/get-input-under-pointer}/get-input-under-pointer.validator.d.ts +1 -1
  164. package/f-draggable/connections/{get-input-under-pointer → common/get-input-under-pointer}/index.d.ts +0 -1
  165. package/f-draggable/connections/common/index.d.ts +5 -0
  166. package/f-draggable/connections/common/providers.d.ts +5 -0
  167. package/f-draggable/connections/create-connection/create-connection.drag-handler.d.ts +14 -5
  168. package/f-draggable/connections/index.d.ts +1 -1
  169. package/f-draggable/connections/providers.d.ts +1 -1
  170. package/f-draggable/connections/reassign-connection/f-reassign-connection.event.d.ts +6 -6
  171. package/f-draggable/connections/reassign-connection/reassign-connection.drag-handler.d.ts +16 -7
  172. package/f-draggable/node/connection-base-drag-handler.d.ts +9 -7
  173. package/f-draggable/node/connection-source.drag-handler.d.ts +2 -1
  174. package/f-draggable/node/connection-target.drag-handler.d.ts +2 -1
  175. package/f-draggable/node/connection.drag-handler.d.ts +2 -1
  176. package/f-draggable/providers.d.ts +1 -1
  177. package/f-flow.module.d.ts +19 -18
  178. package/f-node/providers.d.ts +1 -1
  179. package/f-storage/f-components-store.d.ts +1 -0
  180. package/fesm2015/foblex-flow.js +1514 -1260
  181. package/fesm2015/foblex-flow.js.map +1 -1
  182. package/mixins/index.d.ts +0 -5
  183. package/package.json +1 -1
  184. package/domain/get-input-rect-in-flow/get-input-rect-in-flow-request.d.ts +0 -4
  185. package/domain/get-input-rect-in-flow/get-input-rect-in-flow-response.d.ts +0 -7
  186. package/domain/get-input-rect-in-flow/get-input-rect-in-flow.execution.d.ts +0 -13
  187. package/domain/get-input-rect-in-flow/index.d.ts +0 -3
  188. package/domain/get-output-rect-in-flow/get-output-rect-in-flow-request.d.ts +0 -4
  189. package/domain/get-output-rect-in-flow/get-output-rect-in-flow-response.d.ts +0 -7
  190. package/domain/get-output-rect-in-flow/get-output-rect-in-flow.execution.d.ts +0 -13
  191. package/domain/get-output-rect-in-flow/index.d.ts +0 -3
  192. package/domain/select-and-update-node-layer/select-and-update-node-layer.request.d.ts +0 -5
  193. package/esm2015/domain/center-group-or-node/center-group-or-node-request.js +0 -7
  194. package/esm2015/domain/center-group-or-node/center-group-or-node.execution.js +0 -51
  195. package/esm2015/domain/center-group-or-node/index.js +0 -3
  196. package/esm2015/domain/clear-selection/clear-selection.execution.js +0 -26
  197. package/esm2015/domain/clear-selection/clear-selection.request.js +0 -3
  198. package/esm2015/domain/clear-selection/index.js +0 -3
  199. package/esm2015/domain/get-input-rect-in-flow/get-input-rect-in-flow-request.js +0 -6
  200. package/esm2015/domain/get-input-rect-in-flow/get-input-rect-in-flow-response.js +0 -7
  201. package/esm2015/domain/get-input-rect-in-flow/get-input-rect-in-flow.execution.js +0 -33
  202. package/esm2015/domain/get-input-rect-in-flow/index.js +0 -4
  203. package/esm2015/domain/get-output-rect-in-flow/get-output-rect-in-flow-request.js +0 -6
  204. package/esm2015/domain/get-output-rect-in-flow/get-output-rect-in-flow-response.js +0 -7
  205. package/esm2015/domain/get-output-rect-in-flow/get-output-rect-in-flow.execution.js +0 -37
  206. package/esm2015/domain/get-output-rect-in-flow/index.js +0 -4
  207. package/esm2015/domain/get-selection/get-selection.execution.js +0 -35
  208. package/esm2015/domain/get-selection/get-selection.request.js +0 -3
  209. package/esm2015/domain/get-selection/index.js +0 -3
  210. package/esm2015/domain/select/index.js +0 -3
  211. package/esm2015/domain/select/select.execution.js +0 -44
  212. package/esm2015/domain/select/select.request.js +0 -7
  213. package/esm2015/domain/select-all/index.js +0 -3
  214. package/esm2015/domain/select-all/select-all.execution.js +0 -38
  215. package/esm2015/domain/select-all/select-all.request.js +0 -3
  216. package/esm2015/domain/select-and-update-node-layer/index.js +0 -3
  217. package/esm2015/domain/select-and-update-node-layer/select-and-update-node-layer.execution.js +0 -35
  218. package/esm2015/domain/select-and-update-node-layer/select-and-update-node-layer.request.js +0 -6
  219. package/esm2015/f-connectors/f-node-input/is-node-input.js +0 -4
  220. package/esm2015/f-draggable/connections/get-input-under-pointer/get-input-under-pointer.execution.js +0 -74
  221. package/esm2015/f-draggable/connections/get-input-under-pointer/get-input-under-pointer.request.js +0 -7
  222. package/esm2015/f-draggable/connections/get-input-under-pointer/get-input-under-pointer.validator.js +0 -35
  223. package/esm2015/f-draggable/connections/get-input-under-pointer/index.js +0 -5
  224. package/esm2015/f-draggable/connections/get-input-under-pointer/providers.js +0 -7
  225. package/esm2015/mixins/change-position.js +0 -15
  226. package/esm2015/mixins/change-zoom/change-zoom.js +0 -25
  227. package/esm2015/mixins/change-zoom/i-can-change-zoom.js +0 -2
  228. package/esm2015/mixins/change-zoom/index.js +0 -3
  229. package/esm2015/mixins/fit-to-parent/fit-to-parent.js +0 -27
  230. package/esm2015/mixins/fit-to-parent/i-can-fit-to-parent.js +0 -2
  231. package/esm2015/mixins/fit-to-parent/index.js +0 -3
  232. package/esm2015/mixins/i-transformable.js +0 -2
  233. package/esm2015/mixins/one-to-one-centering/i-can-one-to-one-centering.js +0 -2
  234. package/esm2015/mixins/one-to-one-centering/index.js +0 -3
  235. package/esm2015/mixins/one-to-one-centering/one-to-one-centering.js +0 -24
  236. package/f-connectors/f-node-input/is-node-input.d.ts +0 -1
  237. package/f-draggable/connections/get-input-under-pointer/providers.d.ts +0 -3
  238. package/mixins/change-position.d.ts +0 -10
  239. package/mixins/change-zoom/change-zoom.d.ts +0 -6
  240. package/mixins/change-zoom/i-can-change-zoom.d.ts +0 -6
  241. package/mixins/change-zoom/index.d.ts +0 -2
  242. package/mixins/fit-to-parent/fit-to-parent.d.ts +0 -6
  243. package/mixins/fit-to-parent/i-can-fit-to-parent.d.ts +0 -4
  244. package/mixins/fit-to-parent/index.d.ts +0 -2
  245. package/mixins/i-transformable.d.ts +0 -4
  246. package/mixins/one-to-one-centering/i-can-one-to-one-centering.d.ts +0 -4
  247. package/mixins/one-to-one-centering/index.d.ts +0 -2
  248. package/mixins/one-to-one-centering/one-to-one-centering.d.ts +0 -6
  249. /package/domain/{clear-selection → f-selection/clear-selection}/clear-selection.request.d.ts +0 -0
  250. /package/domain/{clear-selection → f-selection/clear-selection}/index.d.ts +0 -0
  251. /package/domain/{get-selection → f-selection/get-selection}/get-selection.request.d.ts +0 -0
  252. /package/domain/{get-selection → f-selection/get-selection}/index.d.ts +0 -0
  253. /package/domain/{select → f-selection/select}/index.d.ts +0 -0
  254. /package/domain/{select → f-selection/select}/select.request.d.ts +0 -0
  255. /package/domain/{select-all → f-selection/select-all}/index.d.ts +0 -0
  256. /package/domain/{select-all → f-selection/select-all}/select-all.request.d.ts +0 -0
  257. /package/domain/{select-and-update-node-layer → f-selection/select-and-update-node-layer}/index.d.ts +0 -0
  258. /package/{domain → f-canvas/domain}/center-group-or-node/center-group-or-node-request.d.ts +0 -0
  259. /package/{domain → f-canvas/domain}/center-group-or-node/index.d.ts +0 -0
@@ -1,28 +1,29 @@
1
- import * as i0 from '@angular/core';
2
- import { InjectionToken, Injectable, Directive, Input, HostBinding, EventEmitter, Output, Inject, Component, ChangeDetectionStrategy, ViewChild, Optional, ContentChildren, NgZone, ContentChild, NgModule } from '@angular/core';
3
- import { PointExtensions, RectExtensions, Point, RoundedRect, LineExtensions, SizeExtensions, GetIntersections, Line, TransformModelExtensions } from '@foblex/2d';
4
- import { Subject, Observable, Subscription, merge } from 'rxjs';
5
- import { debounceTime, startWith } from 'rxjs/operators';
6
1
  import { __decorate } from 'tslib';
2
+ import { RoundedRect, RectExtensions, Point, PointExtensions, LineExtensions, SizeExtensions, GetIntersections, Line, TransformModelExtensions } from '@foblex/2d';
3
+ import * as i0 from '@angular/core';
4
+ import { Injectable, InjectionToken, Directive, Input, HostBinding, EventEmitter, Output, Inject, Component, ChangeDetectionStrategy, ViewChild, Optional, ContentChildren, NgZone, ContentChild, NgModule } from '@angular/core';
7
5
  import * as i2 from '@foblex/mediator';
8
6
  import { FExecutionRegister, FValidatorRegister, FMediator } from '@foblex/mediator';
9
- import { castToEnum, castToBoolean, normalizeDomElementId, flatMap, isClosestElementHasClass, getDataAttrValueFromClosestElementWithClass, deepCloneNode } from '@foblex/utils';
7
+ import { normalizeDomElementId, castToEnum, castToBoolean, flatMap, isClosestElementHasClass, getDataAttrValueFromClosestElementWithClass, deepCloneNode } from '@foblex/utils';
10
8
  import * as i1 from '@foblex/platform';
11
9
  import { EOperationSystem } from '@foblex/platform';
10
+ import { Subject, Observable, Subscription, merge } from 'rxjs';
11
+ import { debounceTime, startWith } from 'rxjs/operators';
12
12
  import * as i8 from '@angular/common';
13
13
  import { CommonModule } from '@angular/common';
14
14
  import { DragAndDropBase, EventExtensions } from '@foblex/drag-toolkit';
15
15
 
16
- const F_BACKGROUND_PATTERN = new InjectionToken('F_BACKGROUND_PATTERN');
17
-
18
- class CenterGroupOrNodeRequest {
19
- constructor(id, animated) {
20
- this.id = id;
21
- this.animated = animated;
16
+ class AddPatternToBackgroundRequest {
17
+ constructor(fPattern) {
18
+ this.fPattern = fPattern;
22
19
  }
23
20
  }
24
21
 
25
- const F_CANVAS_ANIMATION_DURATION = 150;
22
+ class CreateConnectionMarkersRequest {
23
+ constructor(fConnection) {
24
+ this.fConnection = fConnection;
25
+ }
26
+ }
26
27
 
27
28
  class FComponentsStore {
28
29
  constructor() {
@@ -84,47 +85,114 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
84
85
  type: Injectable
85
86
  }] });
86
87
 
87
- let CenterGroupOrNodeExecution = class CenterGroupOrNodeExecution {
88
- constructor(fComponentsStore) {
88
+ let CreateConnectionMarkersExecution = class CreateConnectionMarkersExecution {
89
+ constructor(fBrowser, fComponentsStore) {
90
+ this.fBrowser = fBrowser;
89
91
  this.fComponentsStore = fComponentsStore;
90
92
  }
91
- get transform() {
92
- return this.fComponentsStore.fCanvas.transform;
93
+ handle(request) {
94
+ const element = createSVGElement$1('defs', this.fBrowser);
95
+ const fConnection = request.fConnection;
96
+ this.getMarkers(fConnection).forEach((marker) => {
97
+ const markerElement = this.createMarkerElement(marker, fConnection.fId);
98
+ const clone = marker.hostElement.cloneNode(true);
99
+ clone.setAttribute('height', `${marker.height}`);
100
+ clone.setAttribute('width', `${marker.width}`);
101
+ clone.removeAttribute('markerUnits');
102
+ clone.style.display = 'unset';
103
+ markerElement.append(clone);
104
+ element.append(markerElement);
105
+ });
106
+ fConnection.fDefs.nativeElement.innerHTML = element.innerHTML;
107
+ this.makeSafariCompatible(fConnection);
108
+ }
109
+ getMarkers(fConnection) {
110
+ return this.fComponentsStore.fMarkers.filter((x) => fConnection.hostElement.contains(x.hostElement));
111
+ }
112
+ // Safari does not support markers on path elements if markers are defined after the path element
113
+ makeSafariCompatible(fConnection) {
114
+ fConnection.fPath.hostElement.replaceWith(fConnection.fPath.hostElement);
115
+ }
116
+ createMarkerElement(marker, fConnectionId) {
117
+ const markerElement = createSVGElement$1('marker', this.fBrowser);
118
+ markerElement.setAttribute('id', normalizeDomElementId(marker.type + '-' + fConnectionId));
119
+ markerElement.setAttribute('markerHeight', `${marker.height}`);
120
+ markerElement.setAttribute('markerWidth', `${marker.width}`);
121
+ markerElement.setAttribute('orient', `${marker.orient}`);
122
+ markerElement.setAttribute('refX', `${marker.refX}`);
123
+ markerElement.setAttribute('refY', `${marker.refY}`);
124
+ markerElement.setAttribute('markerUnits', `${marker.markerUnits}`);
125
+ return markerElement;
126
+ }
127
+ };
128
+ CreateConnectionMarkersExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CreateConnectionMarkersExecution, deps: [{ token: i1.BrowserService }, { token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Injectable });
129
+ CreateConnectionMarkersExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CreateConnectionMarkersExecution });
130
+ CreateConnectionMarkersExecution = __decorate([
131
+ FExecutionRegister(CreateConnectionMarkersRequest)
132
+ ], CreateConnectionMarkersExecution);
133
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CreateConnectionMarkersExecution, decorators: [{
134
+ type: Injectable
135
+ }], ctorParameters: function () { return [{ type: i1.BrowserService }, { type: FComponentsStore }]; } });
136
+ function createSVGElement$1(tag, fBrowser) {
137
+ return fBrowser.document.createElementNS('http://www.w3.org/2000/svg', tag);
138
+ }
139
+
140
+ class CreateRoundedRectFromElementRequest {
141
+ constructor(element) {
142
+ this.element = element;
143
+ }
144
+ }
145
+
146
+ let CreateRoundedRectFromElementExecution = class CreateRoundedRectFromElementExecution {
147
+ constructor(fBrowser) {
148
+ this.fBrowser = fBrowser;
93
149
  }
94
150
  handle(request) {
95
- const fNode = this.getNode(request.id);
96
- if (!fNode) {
97
- return;
98
- }
99
- this.toCenter(this.getNodeRect(fNode), this.getFlowRect(), fNode.position);
100
- request.animated ? this.fComponentsStore.fCanvas.redrawWithAnimation() : this.fComponentsStore.fCanvas.redraw();
101
- this.fComponentsStore.fCanvas.completeDrag();
102
- setTimeout(() => {
103
- this.fComponentsStore.componentDataChanged();
104
- }, F_CANVAS_ANIMATION_DURATION);
151
+ return this.setRadiusFromElement(RoundedRect.fromRect(RectExtensions.fromElement(request.element)), request.element);
105
152
  }
106
- toCenter(fNodeRect, fFlowRect, position) {
107
- this.transform.scaledPosition = PointExtensions.initialize();
108
- this.transform.position = PointExtensions.initialize((fFlowRect.width - fNodeRect.width) / 2 - position.x * this.transform.scale, (fFlowRect.height - fNodeRect.height) / 2 - position.y * this.transform.scale);
153
+ setRadiusFromElement(rect, element) {
154
+ const styles = this.getComputedStyle(element);
155
+ rect.radius1 = this.toPixels(styles.borderTopLeftRadius, element, styles.fontSize);
156
+ rect.radius2 = this.toPixels(styles.borderTopRightRadius, element, styles.fontSize);
157
+ rect.radius3 = this.toPixels(styles.borderBottomRightRadius, element, styles.fontSize);
158
+ rect.radius4 = this.toPixels(styles.borderBottomLeftRadius, element, styles.fontSize);
159
+ return rect;
109
160
  }
110
- getNode(id) {
111
- return this.fComponentsStore.fNodes.find((x) => x.fId === id);
161
+ getComputedStyle(element) {
162
+ return this.fBrowser.window.getComputedStyle(element);
112
163
  }
113
- getNodeRect(fNode) {
114
- return RectExtensions.fromElement(fNode.hostElement);
164
+ toPixels(value, element, fontSize) {
165
+ return this.fBrowser.toPixels(value, element.clientWidth, element.clientHeight, fontSize) || 0;
115
166
  }
116
- getFlowRect() {
117
- return RectExtensions.fromElement(this.fComponentsStore.fFlow.hostElement);
167
+ };
168
+ CreateRoundedRectFromElementExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CreateRoundedRectFromElementExecution, deps: [{ token: i1.BrowserService }], target: i0.ɵɵFactoryTarget.Injectable });
169
+ CreateRoundedRectFromElementExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CreateRoundedRectFromElementExecution });
170
+ CreateRoundedRectFromElementExecution = __decorate([
171
+ FExecutionRegister(CreateRoundedRectFromElementRequest)
172
+ ], CreateRoundedRectFromElementExecution);
173
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CreateRoundedRectFromElementExecution, decorators: [{
174
+ type: Injectable
175
+ }], ctorParameters: function () { return [{ type: i1.BrowserService }]; } });
176
+
177
+ class EmitTransformChangesRequest {
178
+ }
179
+
180
+ let EmitTransformChangesExecution = class EmitTransformChangesExecution {
181
+ constructor(fTransformStore) {
182
+ this.fTransformStore = fTransformStore;
183
+ }
184
+ handle(request) {
185
+ this.fTransformStore.changes.next();
118
186
  }
119
187
  };
120
- CenterGroupOrNodeExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CenterGroupOrNodeExecution, deps: [{ token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Injectable });
121
- CenterGroupOrNodeExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CenterGroupOrNodeExecution });
122
- CenterGroupOrNodeExecution = __decorate([
123
- FExecutionRegister(CenterGroupOrNodeRequest)
124
- ], CenterGroupOrNodeExecution);
125
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CenterGroupOrNodeExecution, decorators: [{
188
+ EmitTransformChangesExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: EmitTransformChangesExecution, deps: [{ token: FTransformStore }], target: i0.ɵɵFactoryTarget.Injectable });
189
+ EmitTransformChangesExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: EmitTransformChangesExecution });
190
+ EmitTransformChangesExecution = __decorate([
191
+ FExecutionRegister(EmitTransformChangesRequest)
192
+ ], EmitTransformChangesExecution);
193
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: EmitTransformChangesExecution, decorators: [{
126
194
  type: Injectable
127
- }], ctorParameters: function () { return [{ type: FComponentsStore }]; } });
195
+ }], ctorParameters: function () { return [{ type: FTransformStore }]; } });
128
196
 
129
197
  class ClearSelectionRequest {
130
198
  }
@@ -188,7 +256,7 @@ class CanvasDragHandler {
188
256
  this.fComponentsStore.fCanvas.redraw();
189
257
  }
190
258
  complete() {
191
- this.fComponentsStore.fCanvas.completeDrag();
259
+ this.fComponentsStore.fCanvas.emitCanvasChangeEvent();
192
260
  }
193
261
  }
194
262
 
@@ -292,95 +360,359 @@ const CANVAS_PROVIDERS = [
292
360
  ...CANVAS_MOVE_PREPARATION_PROVIDERS,
293
361
  ];
294
362
 
295
- var EFConnectableSide;
296
- (function (EFConnectableSide) {
297
- EFConnectableSide["LEFT"] = "left";
298
- EFConnectableSide["RIGHT"] = "right";
299
- EFConnectableSide["TOP"] = "top";
300
- EFConnectableSide["BOTTOM"] = "bottom";
301
- EFConnectableSide["AUTO"] = "auto";
302
- })(EFConnectableSide || (EFConnectableSide = {}));
363
+ class FindClosestInputUsingSnapThresholdRequest {
364
+ constructor(position, canBeConnectedInputs, snapThreshold) {
365
+ this.position = position;
366
+ this.canBeConnectedInputs = canBeConnectedInputs;
367
+ this.snapThreshold = snapThreshold;
368
+ }
369
+ }
303
370
 
304
- class CalculateConnectorConnectableSideHandler {
305
- handle(request) {
371
+ let FindClosestInputUsingSnapThresholdExecution = class FindClosestInputUsingSnapThresholdExecution {
372
+ handle(payload) {
306
373
  let result;
307
- if (request.fConnector._fConnectableSide === EFConnectableSide.AUTO) {
308
- result = this.getSideByDelta(request.fConnector.hostElement, request.fNodeHost);
309
- }
310
- else {
311
- result = request.fConnector._fConnectableSide;
374
+ let minDistance = Infinity;
375
+ for (const element of payload.canBeConnectedInputs) {
376
+ const distance = this.distanceToRectangle(payload.position, element);
377
+ if (distance < minDistance) {
378
+ minDistance = distance;
379
+ result = element;
380
+ }
312
381
  }
313
- return result;
382
+ return minDistance < payload.snapThreshold ? result : undefined;
314
383
  }
315
- getSideByDelta(fConnectorHost, fNodeHost) {
316
- let result;
317
- const childRect = RectExtensions.fromElement(fConnectorHost);
318
- const parentRect = fNodeHost.getBoundingClientRect();
319
- const deltaLeft = childRect.gravityCenter.x - parentRect.left;
320
- const deltaRight = parentRect.right - childRect.gravityCenter.x;
321
- const deltaTop = childRect.gravityCenter.y - parentRect.top;
322
- const deltaBottom = parentRect.bottom - childRect.gravityCenter.y;
323
- const minDelta = Math.min(deltaLeft, deltaRight, deltaTop, deltaBottom);
324
- if (minDelta === deltaLeft) {
325
- result = EFConnectableSide.LEFT;
326
- }
327
- else if (minDelta === deltaRight) {
328
- result = EFConnectableSide.RIGHT;
329
- }
330
- else if (minDelta === deltaTop) {
331
- result = EFConnectableSide.TOP;
332
- }
333
- else {
334
- result = EFConnectableSide.BOTTOM;
335
- }
336
- return result;
384
+ distanceToRectangle(point, inputWithRect) {
385
+ const closestX = this.clamp(point.x, inputWithRect.fRect.x, inputWithRect.fRect.x + inputWithRect.fRect.width);
386
+ const closestY = this.clamp(point.y, inputWithRect.fRect.y, inputWithRect.fRect.y + inputWithRect.fRect.height);
387
+ const dx = point.x - closestX;
388
+ const dy = point.y - closestY;
389
+ return Math.sqrt(dx * dx + dy * dy);
337
390
  }
338
- }
391
+ clamp(value, min, max) {
392
+ return Math.max(min, Math.min(max, value));
393
+ }
394
+ };
395
+ FindClosestInputUsingSnapThresholdExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FindClosestInputUsingSnapThresholdExecution, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
396
+ FindClosestInputUsingSnapThresholdExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FindClosestInputUsingSnapThresholdExecution });
397
+ FindClosestInputUsingSnapThresholdExecution = __decorate([
398
+ FExecutionRegister(FindClosestInputUsingSnapThresholdRequest)
399
+ ], FindClosestInputUsingSnapThresholdExecution);
400
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FindClosestInputUsingSnapThresholdExecution, decorators: [{
401
+ type: Injectable
402
+ }] });
339
403
 
340
- class CalculateConnectorConnectableSideRequest {
341
- constructor(fConnector, fNodeHost) {
342
- this.fConnector = fConnector;
343
- this.fNodeHost = fNodeHost;
404
+ class GetAllCanBeConnectedInputPositionsRequest {
405
+ constructor(fOutputId) {
406
+ this.fOutputId = fOutputId;
344
407
  }
345
408
  }
346
409
 
347
- class FConnectorBase {
348
- constructor() {
349
- this.stateChanges = new Subject();
350
- this.isSelfConnectable = true;
351
- this.fConnectableSide = EFConnectableSide.AUTO;
352
- this._fConnectableSide = EFConnectableSide.AUTO;
353
- }
354
- isContains(element) {
355
- return this.hostElement.contains(element);
356
- }
357
- setConnected(isConnected) {
358
- this.isConnected = isConnected;
410
+ class GetConnectorWithRectRequest {
411
+ constructor(connector) {
412
+ this.connector = connector;
359
413
  }
360
414
  }
361
415
 
362
- const F_NODE_INPUT = new InjectionToken('F_NODE_INPUT');
363
- class FNodeInputBase extends FConnectorBase {
364
- constructor() {
365
- super(...arguments);
366
- this.isConnected = false;
416
+ let GetConnectorWithRectExecution = class GetConnectorWithRectExecution {
417
+ constructor(fMediator) {
418
+ this.fMediator = fMediator;
367
419
  }
368
- get canBeConnected() {
369
- return !this.disabled && (this.multiple ? true : !this.isConnected);
420
+ handle(request) {
421
+ return {
422
+ fConnector: request.connector,
423
+ fRect: this.fMediator.send(new GetElementRectInFlowRequest(request.connector.hostElement))
424
+ };
370
425
  }
371
- }
372
- FNodeInputBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FNodeInputBase, deps: null, target: i0.ɵɵFactoryTarget.Directive });
373
- FNodeInputBasedir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: FNodeInputBase, usesInheritance: true, ngImport: i0 });
374
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FNodeInputBase, decorators: [{
375
- type: Directive
376
- }] });
426
+ };
427
+ GetConnectorWithRectExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetConnectorWithRectExecution, deps: [{ token: i2.FMediator }], target: i0.ɵɵFactoryTarget.Injectable });
428
+ GetConnectorWithRectExecutionprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetConnectorWithRectExecution });
429
+ GetConnectorWithRectExecution = __decorate([
430
+ FExecutionRegister(GetConnectorWithRectRequest)
431
+ ], GetConnectorWithRectExecution);
432
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetConnectorWithRectExecution, decorators: [{
433
+ type: Injectable
434
+ }], ctorParameters: function () { return [{ type: i2.FMediator }]; } });
377
435
 
378
- function isNodeInput(element) {
379
- return !!element.closest('[fNodeInput]');
380
- }
436
+ let GetAllCanBeConnectedInputPositionsExecution = class GetAllCanBeConnectedInputPositionsExecution {
437
+ constructor(fComponentsStore, fMediator) {
438
+ this.fComponentsStore = fComponentsStore;
439
+ this.fMediator = fMediator;
440
+ }
441
+ get fNodes() {
442
+ return this.fComponentsStore.fNodes;
443
+ }
444
+ get fInputs() {
445
+ return this.fComponentsStore.fInputs;
446
+ }
447
+ handle(payload) {
448
+ return this.getCanBeConnectedInputs(this.getOutput(payload.fOutputId)).map((x) => {
449
+ return this.fMediator.send(new GetConnectorWithRectRequest(x));
450
+ });
451
+ }
452
+ getOutput(fId) {
453
+ return this.findOutputById(fId) || this.findOutletById(fId);
454
+ }
455
+ findOutputById(fId) {
456
+ return this.fComponentsStore.fOutputs.find((x) => x.id === fId);
457
+ }
458
+ findOutletById(fId) {
459
+ return this.fComponentsStore.fOutlets.find((x) => x.id === fId);
460
+ }
461
+ getCanBeConnectedInputs(output) {
462
+ return output.isSelfConnectable ?
463
+ this.fInputs.filter((x) => x.canBeConnected) :
464
+ this.filterSelfConnectable(this.fInputs.filter((x) => x.canBeConnected), output);
465
+ }
466
+ filterSelfConnectable(inputs, output) {
467
+ return inputs.filter((x) => { var _a, _b; return ((_a = this.getNodeOfConnector(output)) === null || _a === void 0 ? void 0 : _a.hostElement) !== ((_b = this.getNodeOfConnector(x)) === null || _b === void 0 ? void 0 : _b.hostElement); });
468
+ }
469
+ getNodeOfConnector(connector) {
470
+ return this.fNodes.find((x) => x.isContains(connector.hostElement));
471
+ }
472
+ };
473
+ GetAllCanBeConnectedInputPositionsExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetAllCanBeConnectedInputPositionsExecution, deps: [{ token: FComponentsStore }, { token: i2.FMediator }], target: i0.ɵɵFactoryTarget.Injectable });
474
+ GetAllCanBeConnectedInputPositionsExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetAllCanBeConnectedInputPositionsExecution });
475
+ GetAllCanBeConnectedInputPositionsExecution = __decorate([
476
+ FExecutionRegister(GetAllCanBeConnectedInputPositionsRequest)
477
+ ], GetAllCanBeConnectedInputPositionsExecution);
478
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetAllCanBeConnectedInputPositionsExecution, decorators: [{
479
+ type: Injectable
480
+ }], ctorParameters: function () { return [{ type: FComponentsStore }, { type: i2.FMediator }]; } });
381
481
 
382
- function isGroup(element) {
383
- return !!element.closest('[fGroup]');
482
+ class GetInputUnderPointerRequest {
483
+ constructor(event, dragHandler) {
484
+ this.event = event;
485
+ this.dragHandler = dragHandler;
486
+ }
487
+ }
488
+
489
+ let GetInputUnderPointerExecution = class GetInputUnderPointerExecution {
490
+ constructor(fComponentsStore, fDraggableDataContext, fBrowser) {
491
+ this.fComponentsStore = fComponentsStore;
492
+ this.fDraggableDataContext = fDraggableDataContext;
493
+ this.fBrowser = fBrowser;
494
+ }
495
+ get fNodes() {
496
+ return this.fComponentsStore.fNodes;
497
+ }
498
+ get fInputs() {
499
+ return this.fComponentsStore.fInputs;
500
+ }
501
+ handle(payload) {
502
+ const output = (this.getOutput(payload.dragHandler) || this.getOutlet(payload.dragHandler));
503
+ const inputsUnderPointer = this.getInputsUnderPointer(payload.event.getPosition(), payload.dragHandler);
504
+ const connectors = output.isSelfConnectable ?
505
+ inputsUnderPointer :
506
+ this.filterSelfConnectable(inputsUnderPointer, output);
507
+ return connectors.length > 0 ? connectors[0] : undefined;
508
+ }
509
+ getOutput(dragHandler) {
510
+ return this.fComponentsStore.fOutputs.find((x) => x.id === dragHandler.fConnection.fOutputId);
511
+ }
512
+ getOutlet(dragHandler) {
513
+ return this.fComponentsStore.fOutlets.find((x) => x.id === dragHandler.fConnection.fOutputId);
514
+ }
515
+ getInputsUnderPointer(position, dragHandler) {
516
+ const result = this.getInputsInPosition(position);
517
+ const closestInput = dragHandler.getClosetInput(this.getDifference(position));
518
+ if (closestInput) {
519
+ result.push(closestInput.fConnector);
520
+ }
521
+ const input = this.getFirstConnectableInputOfNodeInPosition(position);
522
+ if (input) {
523
+ result.push(input);
524
+ }
525
+ return result;
526
+ }
527
+ getDifference(position) {
528
+ return Point.fromPoint(position).elementTransform(this.fComponentsStore.flowHost)
529
+ .div(this.fDraggableDataContext.onPointerDownScale).sub(this.fDraggableDataContext.onPointerDownPosition);
530
+ }
531
+ getInputsInPosition(position) {
532
+ return this.getElementsFromPoint(position).map((element) => this.fInputs.find(x => x.isContains(element) && x.canBeConnected)).filter((x) => !!x);
533
+ }
534
+ getElementsFromPoint(position) {
535
+ return this.fBrowser.document.elementsFromPoint(position.x, position.y);
536
+ }
537
+ getFirstConnectableInputOfNodeInPosition(position) {
538
+ return this.getNodesInPosition(position).map((x) => {
539
+ return this.fInputs.find((i) => x.isContains(i.hostElement) && i.canBeConnected);
540
+ }).find((x) => !!x);
541
+ }
542
+ getNodesInPosition(position) {
543
+ return this.getElementsFromPoint(position).map((element) => {
544
+ return this.fNodes.find((x) => x.isContains(element) && x.fConnectOnNode);
545
+ }).filter((x) => !!x);
546
+ }
547
+ filterSelfConnectable(inputs, connector) {
548
+ return inputs.filter((x) => {
549
+ const targetNode = this.fNodes.find((k) => k.isContains(x.hostElement));
550
+ const sourceNode = this.fNodes.find((k) => k.isContains(connector.hostElement));
551
+ return (sourceNode === null || sourceNode === void 0 ? void 0 : sourceNode.hostElement) !== (targetNode === null || targetNode === void 0 ? void 0 : targetNode.hostElement);
552
+ });
553
+ }
554
+ };
555
+ GetInputUnderPointerExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetInputUnderPointerExecution, deps: [{ token: FComponentsStore }, { token: FDraggableDataContext }, { token: i1.BrowserService }], target: i0.ɵɵFactoryTarget.Injectable });
556
+ GetInputUnderPointerExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetInputUnderPointerExecution });
557
+ GetInputUnderPointerExecution = __decorate([
558
+ FExecutionRegister(GetInputUnderPointerRequest)
559
+ ], GetInputUnderPointerExecution);
560
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetInputUnderPointerExecution, decorators: [{
561
+ type: Injectable
562
+ }], ctorParameters: function () { return [{ type: FComponentsStore }, { type: FDraggableDataContext }, { type: i1.BrowserService }]; } });
563
+
564
+ function createErrorClass(impl) {
565
+ const _super = (instance) => {
566
+ Error.call(instance);
567
+ };
568
+ const constructor = impl(_super);
569
+ constructor.prototype = Object.create(Error.prototype);
570
+ constructor.prototype.constructor = constructor;
571
+ return constructor;
572
+ }
573
+
574
+ const NotFoundError = createErrorClass((_super) => function error(message) {
575
+ _super(this);
576
+ this.message = message || 'The requested resource was not found.';
577
+ this.code = 404;
578
+ });
579
+
580
+ const ConflictError = createErrorClass((_super) => function error(message) {
581
+ _super(this);
582
+ this.message = message || 'Conflict error occurred.';
583
+ this.code = 409;
584
+ });
585
+
586
+ function OutputNotFound(id) {
587
+ return new NotFoundError(`Output with fOutputId ${id} not found. Make sure there is no f-connection to a non-existent fOutput.`);
588
+ }
589
+ function InputNotFound(id) {
590
+ return new NotFoundError(`Input with fInputId ${id} not found. Make sure there is no f-connection to a non-existent fInput.`);
591
+ }
592
+ function RequiredOutput() {
593
+ return new ConflictError(`The fNode must contain at least one fOutput if there is an fOutlet`);
594
+ }
595
+
596
+ let GetInputUnderPointerValidator = class GetInputUnderPointerValidator {
597
+ constructor(fComponentsStore) {
598
+ this.fComponentsStore = fComponentsStore;
599
+ }
600
+ handle(request) {
601
+ let output = this.getOutput(request.dragHandler) || this.getOutlet(request.dragHandler);
602
+ if (!output) {
603
+ throw OutputNotFound(request.dragHandler.fConnection.fOutputId);
604
+ }
605
+ return true;
606
+ }
607
+ getOutput(dragHandler) {
608
+ return this.fComponentsStore.fOutputs.find((x) => x.id === dragHandler.fConnection.fOutputId);
609
+ }
610
+ getOutlet(dragHandler) {
611
+ return this.fComponentsStore.fOutlets.find((x) => x.id === dragHandler.fConnection.fOutputId);
612
+ }
613
+ };
614
+ GetInputUnderPointerValidator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetInputUnderPointerValidator, deps: [{ token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Injectable });
615
+ GetInputUnderPointerValidator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetInputUnderPointerValidator });
616
+ GetInputUnderPointerValidator = __decorate([
617
+ FValidatorRegister(GetInputUnderPointerRequest)
618
+ ], GetInputUnderPointerValidator);
619
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetInputUnderPointerValidator, decorators: [{
620
+ type: Injectable
621
+ }], ctorParameters: function () { return [{ type: FComponentsStore }]; } });
622
+
623
+ const CONNECTION_DRAG_COMMON_PROVIDERS = [
624
+ FindClosestInputUsingSnapThresholdExecution,
625
+ GetAllCanBeConnectedInputPositionsExecution,
626
+ GetConnectorWithRectExecution,
627
+ GetInputUnderPointerExecution,
628
+ GetInputUnderPointerValidator
629
+ ];
630
+
631
+ var EFConnectableSide;
632
+ (function (EFConnectableSide) {
633
+ EFConnectableSide["LEFT"] = "left";
634
+ EFConnectableSide["RIGHT"] = "right";
635
+ EFConnectableSide["TOP"] = "top";
636
+ EFConnectableSide["BOTTOM"] = "bottom";
637
+ EFConnectableSide["AUTO"] = "auto";
638
+ })(EFConnectableSide || (EFConnectableSide = {}));
639
+
640
+ class CalculateConnectorConnectableSideHandler {
641
+ handle(request) {
642
+ let result;
643
+ if (request.fConnector._fConnectableSide === EFConnectableSide.AUTO) {
644
+ result = this.getSideByDelta(request.fConnector.hostElement, request.fNodeHost);
645
+ }
646
+ else {
647
+ result = request.fConnector._fConnectableSide;
648
+ }
649
+ return result;
650
+ }
651
+ getSideByDelta(fConnectorHost, fNodeHost) {
652
+ let result;
653
+ const childRect = RectExtensions.fromElement(fConnectorHost);
654
+ const parentRect = fNodeHost.getBoundingClientRect();
655
+ const deltaLeft = childRect.gravityCenter.x - parentRect.left;
656
+ const deltaRight = parentRect.right - childRect.gravityCenter.x;
657
+ const deltaTop = childRect.gravityCenter.y - parentRect.top;
658
+ const deltaBottom = parentRect.bottom - childRect.gravityCenter.y;
659
+ const minDelta = Math.min(deltaLeft, deltaRight, deltaTop, deltaBottom);
660
+ if (minDelta === deltaLeft) {
661
+ result = EFConnectableSide.LEFT;
662
+ }
663
+ else if (minDelta === deltaRight) {
664
+ result = EFConnectableSide.RIGHT;
665
+ }
666
+ else if (minDelta === deltaTop) {
667
+ result = EFConnectableSide.TOP;
668
+ }
669
+ else {
670
+ result = EFConnectableSide.BOTTOM;
671
+ }
672
+ return result;
673
+ }
674
+ }
675
+
676
+ class CalculateConnectorConnectableSideRequest {
677
+ constructor(fConnector, fNodeHost) {
678
+ this.fConnector = fConnector;
679
+ this.fNodeHost = fNodeHost;
680
+ }
681
+ }
682
+
683
+ class FConnectorBase {
684
+ constructor() {
685
+ this.stateChanges = new Subject();
686
+ this.isSelfConnectable = true;
687
+ this.fConnectableSide = EFConnectableSide.AUTO;
688
+ this._fConnectableSide = EFConnectableSide.AUTO;
689
+ }
690
+ isContains(element) {
691
+ return this.hostElement.contains(element);
692
+ }
693
+ setConnected(isConnected) {
694
+ this.isConnected = isConnected;
695
+ }
696
+ }
697
+
698
+ const F_NODE_INPUT = new InjectionToken('F_NODE_INPUT');
699
+ class FNodeInputBase extends FConnectorBase {
700
+ constructor() {
701
+ super(...arguments);
702
+ this.isConnected = false;
703
+ }
704
+ get canBeConnected() {
705
+ return !this.disabled && (this.multiple ? true : !this.isConnected);
706
+ }
707
+ }
708
+ FNodeInputBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FNodeInputBase, deps: null, target: i0.ɵɵFactoryTarget.Directive });
709
+ FNodeInputBase.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: FNodeInputBase, usesInheritance: true, ngImport: i0 });
710
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FNodeInputBase, decorators: [{
711
+ type: Directive
712
+ }] });
713
+
714
+ function isGroup(element) {
715
+ return !!element.closest('[fGroup]');
384
716
  }
385
717
 
386
718
  function isNode(element) {
@@ -527,100 +859,13 @@ function mixinChangeVisibility(base) {
527
859
  };
528
860
  }
529
861
 
530
- function mixinChangeZoom(base) {
531
- return class extends base {
532
- setZoom(scaleValue, toPosition) {
533
- if (scaleValue !== this.transform.scale) {
534
- const summaryPosition = PointExtensions.sum(this.transform.scaledPosition, this.transform.position);
535
- const newX = toPosition.x - (toPosition.x - summaryPosition.x) * scaleValue / this.transform.scale;
536
- const newY = toPosition.y - (toPosition.y - summaryPosition.y) * scaleValue / this.transform.scale;
537
- this.transform.scale = scaleValue;
538
- this.transform.scaledPosition = PointExtensions.sub(PointExtensions.initialize(newX, newY), this.transform.position);
539
- }
540
- }
541
- setScalePosition(value) {
542
- this.transform.scaledPosition = value;
543
- }
544
- resetZoom() {
545
- this.transform.scale = 1;
546
- this.transform.scaledPosition = PointExtensions.initialize();
547
- }
548
- constructor(...args) {
549
- super(...args);
550
- }
551
- };
552
- }
553
-
554
- function mixinFitToParent(base) {
555
- return class extends base {
556
- fitToParent(rect, parentRect, points, toCenter) {
557
- this.transform.scaledPosition = PointExtensions.initialize();
558
- this.transform.position = this.getZeroPositionWithoutScale(points);
559
- const itemsContainerWidth = (rect.width / this.transform.scale) + toCenter.x;
560
- const itemsContainerHeight = (rect.height / this.transform.scale) + toCenter.y;
561
- if ((itemsContainerWidth > parentRect.width || itemsContainerHeight > parentRect.height) ||
562
- itemsContainerWidth < parentRect.width && itemsContainerHeight < parentRect.height) {
563
- this.transform.scale = Math.min(parentRect.width / itemsContainerWidth, parentRect.height / itemsContainerHeight);
564
- }
565
- const newX = (parentRect.width - itemsContainerWidth * this.transform.scale) / 2 - this.transform.position.x * this.transform.scale;
566
- const newY = (parentRect.height - itemsContainerHeight * this.transform.scale) / 2 - this.transform.position.y * this.transform.scale;
567
- this.transform.position = PointExtensions.initialize(newX + (toCenter.x / 2) * this.transform.scale, newY + (toCenter.y / 2) * this.transform.scale);
568
- }
569
- getZeroPositionWithoutScale(points) {
570
- const xPoint = points.length ? Math.min(...points.map((point) => point.x)) : 0;
571
- const yPoint = points.length ? Math.min(...points.map((point) => point.y)) : 0;
572
- return PointExtensions.initialize(xPoint, yPoint);
573
- }
574
- constructor(...args) {
575
- super(...args);
576
- }
577
- };
578
- }
579
-
580
- function mixinOneToOneCentering(base) {
581
- return class extends base {
582
- oneToOneCentering(rect, parentRect, points) {
583
- this.transform.scaledPosition = PointExtensions.initialize();
584
- this.transform.position = this.getZeroPositionWithoutScale(points);
585
- const itemsContainerWidth = rect.width / this.transform.scale;
586
- const itemsContainerHeight = rect.height / this.transform.scale;
587
- this.transform.scale = 1;
588
- const newX = (parentRect.width - itemsContainerWidth * this.transform.scale) / 2 - this.transform.position.x * this.transform.scale;
589
- const newY = (parentRect.height - itemsContainerHeight * this.transform.scale) / 2 - this.transform.position.y * this.transform.scale;
590
- this.transform.position = PointExtensions.initialize(newX, newY);
591
- }
592
- getZeroPositionWithoutScale(points) {
593
- const xPoint = points.length ? Math.min(...points.map((point) => point.x)) : 0;
594
- const yPoint = points.length ? Math.min(...points.map((point) => point.y)) : 0;
595
- return PointExtensions.initialize(xPoint, yPoint);
596
- }
597
- constructor(...args) {
598
- super(...args);
599
- }
600
- };
601
- }
602
-
603
- function mixinChangePosition(base) {
604
- return class extends base {
605
- getPosition() {
606
- return this.transform.position;
607
- }
608
- setPosition(position) {
609
- this.transform.position = PointExtensions.copy(position);
610
- }
611
- constructor(...args) {
612
- super(...args);
613
- }
614
- };
615
- }
616
-
617
862
  const F_NODE = new InjectionToken('F_NODE');
618
- const MIXIN_BASE$2 = mixinChangeSelection(class {
863
+ const MIXIN_BASE$1 = mixinChangeSelection(class {
619
864
  constructor(hostElement) {
620
865
  this.hostElement = hostElement;
621
866
  }
622
867
  });
623
- class FNodeBase extends MIXIN_BASE$2 {
868
+ class FNodeBase extends MIXIN_BASE$1 {
624
869
  constructor() {
625
870
  super(...arguments);
626
871
  this.stateChanges = new Subject();
@@ -660,7 +905,7 @@ class FResizeObserver extends Observable {
660
905
  }
661
906
  }
662
907
 
663
- let uniqueId$c = 0;
908
+ let uniqueId$d = 0;
664
909
  class FGroupDirective extends FNodeBase {
665
910
  constructor(elementReference, renderer, fComponentsStore, fMediator, fBrowser) {
666
911
  super(elementReference.nativeElement);
@@ -669,7 +914,7 @@ class FGroupDirective extends FNodeBase {
669
914
  this.fMediator = fMediator;
670
915
  this.fBrowser = fBrowser;
671
916
  this.subscriptions$ = new Subscription();
672
- this.fId = `f-group-${uniqueId$c++}`;
917
+ this.fId = `f-group-${uniqueId$d++}`;
673
918
  this.fParentId = null;
674
919
  this.positionChange = new EventEmitter();
675
920
  this.sizeChange = new EventEmitter();
@@ -793,7 +1038,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
793
1038
  type: Input
794
1039
  }] } });
795
1040
 
796
- let uniqueId$b = 0;
1041
+ let uniqueId$c = 0;
797
1042
  class FNodeDirective extends FNodeBase {
798
1043
  constructor(elementReference, renderer, fComponentsStore, fMediator, fBrowser) {
799
1044
  super(elementReference.nativeElement);
@@ -802,7 +1047,7 @@ class FNodeDirective extends FNodeBase {
802
1047
  this.fMediator = fMediator;
803
1048
  this.fBrowser = fBrowser;
804
1049
  this.subscriptions$ = new Subscription();
805
- this.fId = `f-node-${uniqueId$b++}`;
1050
+ this.fId = `f-node-${uniqueId$c++}`;
806
1051
  this.fParentId = null;
807
1052
  this.positionChange = new EventEmitter();
808
1053
  this.sizeChange = new EventEmitter();
@@ -934,14 +1179,14 @@ const F_NODE_PROVIDERS = [
934
1179
  FResizeHandleDirective,
935
1180
  ];
936
1181
 
937
- let uniqueId$a = 0;
1182
+ let uniqueId$b = 0;
938
1183
  class FNodeInputDirective extends FNodeInputBase {
939
1184
  constructor(elementReference, fNode, fComponentsStore) {
940
1185
  super();
941
1186
  this.elementReference = elementReference;
942
1187
  this.fNode = fNode;
943
1188
  this.fComponentsStore = fComponentsStore;
944
- this.id = `f-node-input-${uniqueId$a++}`;
1189
+ this.id = `f-node-input-${uniqueId$b++}`;
945
1190
  this.multiple = true;
946
1191
  this.isDisabled = false;
947
1192
  this._fConnectableSide = EFConnectableSide.AUTO;
@@ -1037,14 +1282,14 @@ function isNodeOutlet(element) {
1037
1282
  return !!element.closest('[fNodeOutlet]');
1038
1283
  }
1039
1284
 
1040
- let uniqueId$9 = 0;
1285
+ let uniqueId$a = 0;
1041
1286
  class FNodeOutletDirective extends FNodeOutletBase {
1042
1287
  constructor(elementReference, fNode, fComponentsStore) {
1043
1288
  super();
1044
1289
  this.elementReference = elementReference;
1045
1290
  this.fNode = fNode;
1046
1291
  this.fComponentsStore = fComponentsStore;
1047
- this.id = `f-node-outlet-${uniqueId$9++}`;
1292
+ this.id = `f-node-outlet-${uniqueId$a++}`;
1048
1293
  this.isDisabled = false;
1049
1294
  this.fConnectableSide = EFConnectableSide.AUTO;
1050
1295
  this._fConnectableSide = EFConnectableSide.AUTO;
@@ -1120,14 +1365,14 @@ function isNodeOutput(element) {
1120
1365
  return !!element.closest('[fNodeOutput]');
1121
1366
  }
1122
1367
 
1123
- let uniqueId$8 = 0;
1368
+ let uniqueId$9 = 0;
1124
1369
  class FNodeOutputDirective extends FNodeOutputBase {
1125
1370
  constructor(elementReference, fNode, fComponentsStore) {
1126
1371
  super();
1127
1372
  this.elementReference = elementReference;
1128
1373
  this.fNode = fNode;
1129
1374
  this.fComponentsStore = fComponentsStore;
1130
- this.id = `f-node-output-${uniqueId$8++}`;
1375
+ this.id = `f-node-output-${uniqueId$9++}`;
1131
1376
  this.multiple = false;
1132
1377
  this.isDisabled = false;
1133
1378
  this._fConnectableSide = EFConnectableSide.AUTO;
@@ -1218,143 +1463,6 @@ class CreateConnectionFinalizeRequest {
1218
1463
  }
1219
1464
  }
1220
1465
 
1221
- class GetInputUnderPointerRequest {
1222
- constructor(event, dragHandler) {
1223
- this.event = event;
1224
- this.dragHandler = dragHandler;
1225
- }
1226
- }
1227
-
1228
- let GetInputUnderPointerExecution = class GetInputUnderPointerExecution {
1229
- constructor(fComponentsStore, fBrowser) {
1230
- this.fComponentsStore = fComponentsStore;
1231
- this.fBrowser = fBrowser;
1232
- }
1233
- get fNodes() {
1234
- return this.fComponentsStore.fNodes;
1235
- }
1236
- get fInputs() {
1237
- return this.fComponentsStore.fInputs;
1238
- }
1239
- handle(payload) {
1240
- const output = (this.getOutput(payload.dragHandler) || this.getOutlet(payload.dragHandler));
1241
- const inputsUnderPointer = this.getInputsUnderPointer(payload.event.getPosition());
1242
- const connectors = output.isSelfConnectable ?
1243
- inputsUnderPointer :
1244
- this.filterSelfConnectable(inputsUnderPointer, output);
1245
- return connectors.length > 0 ? connectors[0] : undefined;
1246
- }
1247
- getOutput(dragHandler) {
1248
- return this.fComponentsStore.fOutputs.find((x) => x.id === dragHandler.connection.fOutputId);
1249
- }
1250
- getOutlet(dragHandler) {
1251
- return this.fComponentsStore.fOutlets.find((x) => x.id === dragHandler.connection.fOutputId);
1252
- }
1253
- getInputsUnderPointer(position) {
1254
- const result = this.getInputsInPosition(position);
1255
- const input = this.getFirstConnectableInputOfNodeInPosition(position);
1256
- if (input) {
1257
- result.push(input);
1258
- }
1259
- return result;
1260
- }
1261
- getInputsInPosition(position) {
1262
- return this.getElementsFromPoint(position).map((element) => this.fInputs.find(x => x.isContains(element) && x.canBeConnected)).filter((x) => !!x);
1263
- }
1264
- getElementsFromPoint(position) {
1265
- return this.fBrowser.document.elementsFromPoint(position.x, position.y);
1266
- }
1267
- getFirstConnectableInputOfNodeInPosition(position) {
1268
- return this.getNodesInPosition(position).map((x) => {
1269
- return this.fInputs.find((i) => x.isContains(i.hostElement) && i.canBeConnected);
1270
- }).find((x) => !!x);
1271
- }
1272
- getNodesInPosition(position) {
1273
- return this.getElementsFromPoint(position).map((element) => {
1274
- return this.fNodes.find((x) => x.isContains(element) && x.fConnectOnNode);
1275
- }).filter((x) => !!x);
1276
- }
1277
- filterSelfConnectable(inputs, connector) {
1278
- return inputs.filter((x) => {
1279
- const targetNode = this.fNodes.find((k) => k.isContains(x.hostElement));
1280
- const sourceNode = this.fNodes.find((k) => k.isContains(connector.hostElement));
1281
- return (sourceNode === null || sourceNode === void 0 ? void 0 : sourceNode.hostElement) !== (targetNode === null || targetNode === void 0 ? void 0 : targetNode.hostElement);
1282
- });
1283
- }
1284
- };
1285
- GetInputUnderPointerExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetInputUnderPointerExecution, deps: [{ token: FComponentsStore }, { token: i1.BrowserService }], target: i0.ɵɵFactoryTarget.Injectable });
1286
- GetInputUnderPointerExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetInputUnderPointerExecution });
1287
- GetInputUnderPointerExecution = __decorate([
1288
- FExecutionRegister(GetInputUnderPointerRequest)
1289
- ], GetInputUnderPointerExecution);
1290
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetInputUnderPointerExecution, decorators: [{
1291
- type: Injectable
1292
- }], ctorParameters: function () { return [{ type: FComponentsStore }, { type: i1.BrowserService }]; } });
1293
-
1294
- function createErrorClass(impl) {
1295
- const _super = (instance) => {
1296
- Error.call(instance);
1297
- };
1298
- const constructor = impl(_super);
1299
- constructor.prototype = Object.create(Error.prototype);
1300
- constructor.prototype.constructor = constructor;
1301
- return constructor;
1302
- }
1303
-
1304
- const NotFoundError = createErrorClass((_super) => function error(message) {
1305
- _super(this);
1306
- this.message = message || 'The requested resource was not found.';
1307
- this.code = 404;
1308
- });
1309
-
1310
- const ConflictError = createErrorClass((_super) => function error(message) {
1311
- _super(this);
1312
- this.message = message || 'Conflict error occurred.';
1313
- this.code = 409;
1314
- });
1315
-
1316
- function OutputNotFound(id) {
1317
- return new NotFoundError(`Output with fOutputId ${id} not found. Make sure there is no f-connection to a non-existent fOutput.`);
1318
- }
1319
- function InputNotFound(id) {
1320
- return new NotFoundError(`Input with fInputId ${id} not found. Make sure there is no f-connection to a non-existent fInput.`);
1321
- }
1322
- function RequiredOutput() {
1323
- return new ConflictError(`The fNode must contain at least one fOutput if there is an fOutlet`);
1324
- }
1325
-
1326
- let GetInputUnderPointerValidator = class GetInputUnderPointerValidator {
1327
- constructor(fComponentsStore) {
1328
- this.fComponentsStore = fComponentsStore;
1329
- }
1330
- handle(request) {
1331
- let output = this.getOutput(request.dragHandler) || this.getOutlet(request.dragHandler);
1332
- if (!output) {
1333
- throw OutputNotFound(request.dragHandler.connection.fOutputId);
1334
- }
1335
- return true;
1336
- }
1337
- getOutput(dragHandler) {
1338
- return this.fComponentsStore.fOutputs.find((x) => x.id === dragHandler.connection.fOutputId);
1339
- }
1340
- getOutlet(dragHandler) {
1341
- return this.fComponentsStore.fOutlets.find((x) => x.id === dragHandler.connection.fOutputId);
1342
- }
1343
- };
1344
- GetInputUnderPointerValidator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetInputUnderPointerValidator, deps: [{ token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Injectable });
1345
- GetInputUnderPointerValidator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetInputUnderPointerValidator });
1346
- GetInputUnderPointerValidator = __decorate([
1347
- FValidatorRegister(GetInputUnderPointerRequest)
1348
- ], GetInputUnderPointerValidator);
1349
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetInputUnderPointerValidator, decorators: [{
1350
- type: Injectable
1351
- }], ctorParameters: function () { return [{ type: FComponentsStore }]; } });
1352
-
1353
- const GET_INPUT_UNDER_POINTER_PROVIDERS = [
1354
- GetInputUnderPointerExecution,
1355
- GetInputUnderPointerValidator,
1356
- ];
1357
-
1358
1466
  class GetCanBeConnectedOutputByOutletRequest {
1359
1467
  constructor(outlet) {
1360
1468
  this.outlet = outlet;
@@ -1444,15 +1552,15 @@ let CreateConnectionFinalizeExecution = class CreateConnectionFinalizeExecution
1444
1552
  }
1445
1553
  getTargetOutput(output) {
1446
1554
  if (!output) {
1447
- throw OutputNotFound(this.dragHandler.connection.fOutputId);
1555
+ throw OutputNotFound(this.dragHandler.fConnection.fOutputId);
1448
1556
  }
1449
1557
  return isNodeOutlet(output.hostElement) ? this.fMediator.send(new GetCanBeConnectedOutputByOutletRequest(output)) : output;
1450
1558
  }
1451
1559
  getOutput() {
1452
- return this.fComponentsStore.fOutputs.find((x) => x.id === this.dragHandler.connection.fOutputId);
1560
+ return this.fComponentsStore.fOutputs.find((x) => x.id === this.dragHandler.fConnection.fOutputId);
1453
1561
  }
1454
1562
  getOutlet() {
1455
- return this.fComponentsStore.fOutlets.find((x) => x.id === this.dragHandler.connection.fOutputId);
1563
+ return this.fComponentsStore.fOutlets.find((x) => x.id === this.dragHandler.fConnection.fOutputId);
1456
1564
  }
1457
1565
  emitEvent(event) {
1458
1566
  var _a, _b;
@@ -1472,32 +1580,62 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
1472
1580
  }], ctorParameters: function () { return [{ type: FComponentsStore }, { type: FDraggableDataContext }, { type: i2.FMediator }]; } });
1473
1581
 
1474
1582
  class CreateConnectionDragHandler {
1475
- constructor(fMediator, connection, onPointerDownPosition) {
1583
+ constructor(fMediator, fComponentsStore, fOutput, onPointerDownPosition) {
1476
1584
  this.fMediator = fMediator;
1477
- this.connection = connection;
1585
+ this.fComponentsStore = fComponentsStore;
1586
+ this.fOutput = fOutput;
1478
1587
  this.onPointerDownPosition = onPointerDownPosition;
1479
- this.onPointerDownFromConnectorRect = new RoundedRect();
1480
- this.onPointerDownToConnectorRect = new RoundedRect();
1481
- this.outputSide = EFConnectableSide.BOTTOM;
1588
+ this.toConnectorRect = new RoundedRect();
1589
+ this.canBeConnectedInputs = [];
1590
+ }
1591
+ get fConnection() {
1592
+ return this.fComponentsStore.fTempConnection;
1593
+ }
1594
+ get fSnapConnection() {
1595
+ return this.fComponentsStore.fSnapConnection;
1482
1596
  }
1483
1597
  initialize() {
1484
- const outputRect = this.fMediator.send(new GetOutputRectInFlowRequest(this.connection.fOutputId));
1485
- this.outputSide = outputRect.fConnectableSide;
1486
- this.onPointerDownFromConnectorRect = RoundedRect.fromRoundedRect(outputRect.rect);
1487
- console.log('onPointerDown1', this.onPointerDownFromConnectorRect.x, this.onPointerDownFromConnectorRect.y);
1488
- this.onPointerDownToConnectorRect = RoundedRect.fromRect(RectExtensions.initialize(this.onPointerDownPosition.x, this.onPointerDownPosition.y, 0, 0));
1489
- console.log('onPointerDown2', this.onPointerDownPosition);
1490
- this.connection.show();
1598
+ if (this.fSnapConnection) {
1599
+ this.fSnapConnection.fOutputId = this.fOutput.id;
1600
+ this.fSnapConnection.initialize();
1601
+ this.canBeConnectedInputs = this.fMediator.send(new GetAllCanBeConnectedInputPositionsRequest(this.fOutput.id));
1602
+ }
1603
+ this.fConnection.fOutputId = this.fOutput.id;
1604
+ this.fConnection.initialize();
1605
+ this.fOutputWithRect = this.fMediator.send(new GetConnectorWithRectRequest(this.fOutput));
1606
+ this.toConnectorRect = RoundedRect.fromRect(RectExtensions.initialize(this.onPointerDownPosition.x, this.onPointerDownPosition.y));
1607
+ this.fConnection.show();
1491
1608
  this.move(PointExtensions.initialize());
1492
1609
  }
1493
1610
  move(difference) {
1494
- const line = this.fMediator.send(new GetConnectionLineRequest(this.onPointerDownFromConnectorRect, this.onPointerDownToConnectorRect.addPoint(difference), this.connection.fBehavior, this.outputSide, EFConnectableSide.TOP));
1495
- this.connection.setLine(line.point1, this.outputSide, line.point2, EFConnectableSide.TOP);
1496
- this.connection.redraw();
1611
+ this.drawTempConnection(this.toConnectorRect.addPoint(difference));
1612
+ this.drawSnapConnection(this.getClosetInput(difference));
1613
+ }
1614
+ drawTempConnection(fInputRect) {
1615
+ const line = this.fMediator.send(new GetConnectionLineRequest(this.fOutputWithRect.fRect, fInputRect, this.fConnection.fBehavior, this.fOutputWithRect.fConnector.fConnectableSide, EFConnectableSide.TOP));
1616
+ this.fConnection.setLine(line.point1, this.fOutputWithRect.fConnector.fConnectableSide, line.point2, EFConnectableSide.TOP);
1617
+ this.fConnection.redraw();
1618
+ }
1619
+ drawSnapConnection(fInputWithRect) {
1620
+ var _a;
1621
+ if (fInputWithRect) {
1622
+ const line = this.fMediator.send(new GetConnectionLineRequest(this.fOutputWithRect.fRect, fInputWithRect.fRect, this.fSnapConnection.fBehavior, this.fOutputWithRect.fConnector.fConnectableSide, fInputWithRect.fConnector.fConnectableSide));
1623
+ this.fSnapConnection.show();
1624
+ this.fSnapConnection.setLine(line.point1, this.fOutputWithRect.fConnector.fConnectableSide, line.point2, fInputWithRect.fConnector.fConnectableSide);
1625
+ this.fSnapConnection.redraw();
1626
+ }
1627
+ else {
1628
+ (_a = this.fSnapConnection) === null || _a === void 0 ? void 0 : _a.hide();
1629
+ }
1630
+ }
1631
+ getClosetInput(difference) {
1632
+ return this.fMediator.send(new FindClosestInputUsingSnapThresholdRequest(Point.fromPoint(this.toConnectorRect).add(difference), this.canBeConnectedInputs, this.fSnapConnection.fSnapThreshold));
1497
1633
  }
1498
1634
  complete() {
1499
- this.connection.redraw();
1500
- this.connection.hide();
1635
+ var _a;
1636
+ this.fConnection.redraw();
1637
+ this.fConnection.hide();
1638
+ (_a = this.fSnapConnection) === null || _a === void 0 ? void 0 : _a.hide();
1501
1639
  }
1502
1640
  }
1503
1641
 
@@ -1543,15 +1681,14 @@ let CreateConnectionDragHandlerExecution = class CreateConnectionDragHandlerExec
1543
1681
  return this.fComponentsStore.fCanvas.transform;
1544
1682
  }
1545
1683
  handle(request) {
1546
- this.fComponentsStore.fTempConnection.fOutputId = request.connector.id;
1547
- this.fComponentsStore.fTempConnection.initialize();
1548
1684
  this.fDraggableDataContext.onPointerDownScale = this.transform.scale;
1549
- const positionRelativeToFlowComponent = Point.fromPoint(request.onPointerDownPosition).elementTransform(this.flowHost).div(this.transform.scale);
1685
+ const positionRelativeToFlowComponent = Point.fromPoint(request.onPointerDownPosition)
1686
+ .elementTransform(this.flowHost).div(this.transform.scale);
1550
1687
  this.fDraggableDataContext.onPointerDownPosition = positionRelativeToFlowComponent;
1551
1688
  const positionRelativeToCanvasComponent = Point.fromPoint(positionRelativeToFlowComponent).mult(this.transform.scale)
1552
1689
  .sub(this.transform.position).sub(this.transform.scaledPosition).div(this.transform.scale);
1553
1690
  this.fDraggableDataContext.draggableItems = [
1554
- new CreateConnectionDragHandler(this.fMediator, this.fComponentsStore.fTempConnection, positionRelativeToCanvasComponent)
1691
+ new CreateConnectionDragHandler(this.fMediator, this.fComponentsStore, request.connector, positionRelativeToCanvasComponent)
1555
1692
  ];
1556
1693
  }
1557
1694
  };
@@ -1764,8 +1901,8 @@ class ReassignConnectionFinalizeRequest {
1764
1901
  }
1765
1902
 
1766
1903
  class FReassignConnectionEvent {
1767
- constructor(connectionId, fOutputId, oldFInputId, newFInputId) {
1768
- this.connectionId = connectionId;
1904
+ constructor(fConnectionId, fOutputId, oldFInputId, newFInputId) {
1905
+ this.fConnectionId = fConnectionId;
1769
1906
  this.fOutputId = fOutputId;
1770
1907
  this.oldFInputId = oldFInputId;
1771
1908
  this.newFInputId = newFInputId;
@@ -1793,13 +1930,13 @@ let ReassignConnectionFinalizeExecution = class ReassignConnectionFinalizeExecut
1793
1930
  if (!input || !this.isReassignToDifferentInput(input)) {
1794
1931
  return;
1795
1932
  }
1796
- this.fDraggable.fReassignConnection.emit(new FReassignConnectionEvent(this.dragHandler.connection.fId, this.dragHandler.connection.fOutputId, this.dragHandler.connection.fInputId, input.id));
1933
+ this.fDraggable.fReassignConnection.emit(new FReassignConnectionEvent(this.dragHandler.fConnection.fId, this.dragHandler.fConnection.fOutputId, this.dragHandler.fConnection.fInputId, input.id));
1797
1934
  }
1798
1935
  getInputUnderPointer(event) {
1799
1936
  return this.fMediator.send(new GetInputUnderPointerRequest(event, this.dragHandler));
1800
1937
  }
1801
1938
  isReassignToDifferentInput(inputsUnderPointer) {
1802
- return this.dragHandler.connection.fInputId !== inputsUnderPointer.id;
1939
+ return this.dragHandler.fConnection.fInputId !== inputsUnderPointer.id;
1803
1940
  }
1804
1941
  };
1805
1942
  ReassignConnectionFinalizeExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ReassignConnectionFinalizeExecution, deps: [{ token: FComponentsStore }, { token: FDraggableDataContext }, { token: i2.FMediator }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -1812,32 +1949,60 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
1812
1949
  }], ctorParameters: function () { return [{ type: FComponentsStore }, { type: FDraggableDataContext }, { type: i2.FMediator }]; } });
1813
1950
 
1814
1951
  class ReassignConnectionDragHandler {
1815
- constructor(fMediator, connection) {
1952
+ constructor(fMediator, fComponentsStore, fConnection) {
1816
1953
  this.fMediator = fMediator;
1817
- this.connection = connection;
1818
- this.onPointerDownFromConnectorRect = new RoundedRect();
1819
- this.onPointerDownToConnectorRect = new RoundedRect();
1820
- this.outputSide = EFConnectableSide.BOTTOM;
1821
- this.inputSide = EFConnectableSide.TOP;
1954
+ this.fComponentsStore = fComponentsStore;
1955
+ this.fConnection = fConnection;
1956
+ this.toConnectorRect = new RoundedRect();
1957
+ this.canBeConnectedInputs = [];
1958
+ }
1959
+ get fSnapConnection() {
1960
+ return this.fComponentsStore.fSnapConnection;
1822
1961
  }
1823
1962
  initialize() {
1824
- const fromConnector = this.fMediator.send(new GetOutputRectInFlowRequest(this.connection.fOutputId));
1825
- this.inputSide = this.fMediator.send(new GetInputRectInFlowRequest(this.connection.fInputId)).fConnectableSide;
1826
- this.outputSide = fromConnector.fConnectableSide;
1827
- this.onPointerDownFromConnectorRect = RoundedRect.fromRoundedRect(fromConnector.rect);
1828
- this.onPointerDownToConnectorRect = RoundedRect.fromRect(RectExtensions.initialize(this.connection.line.point2.x, this.connection.line.point2.y, 0, 0));
1963
+ if (this.fSnapConnection) {
1964
+ this.fSnapConnection.fOutputId = this.fConnection.fOutputId;
1965
+ this.fSnapConnection.initialize();
1966
+ this.canBeConnectedInputs = this.fMediator.send(new GetAllCanBeConnectedInputPositionsRequest(this.fConnection.fOutputId));
1967
+ }
1968
+ this.fOutputWithRect = this.fMediator.send(new GetConnectorWithRectRequest(this.getOutput()));
1969
+ this.fInputWithRect = this.fMediator.send(new GetConnectorWithRectRequest(this.getInput()));
1970
+ this.toConnectorRect = RoundedRect.fromRect(RectExtensions.initialize(this.fConnection.line.point2.x, this.fConnection.line.point2.y));
1971
+ }
1972
+ getOutput() {
1973
+ return this.fComponentsStore.fOutputs.find((x) => x.id === this.fConnection.fOutputId);
1974
+ }
1975
+ getInput() {
1976
+ return this.fComponentsStore.fInputs.find((x) => x.id === this.fConnection.fInputId);
1829
1977
  }
1830
1978
  move(difference) {
1831
- const line = this.fMediator.send(new GetConnectionLineRequest(this.onPointerDownFromConnectorRect, this.onPointerDownToConnectorRect.addPoint(difference), this.connection.fBehavior, this.outputSide, this.inputSide));
1832
- this.connection.setLine(line.point1, this.outputSide, line.point2, this.inputSide);
1833
- this.connection.redraw();
1979
+ this.drawConnection({ fRect: this.toConnectorRect.addPoint(difference), fConnector: this.fInputWithRect.fConnector });
1980
+ this.drawSnapConnection(this.getClosetInput(difference));
1981
+ }
1982
+ drawConnection(fInputWithRect) {
1983
+ const line = this.fMediator.send(new GetConnectionLineRequest(this.fOutputWithRect.fRect, fInputWithRect.fRect, this.fConnection.fBehavior, this.fOutputWithRect.fConnector.fConnectableSide, fInputWithRect.fConnector.fConnectableSide));
1984
+ this.fConnection.setLine(line.point1, this.fOutputWithRect.fConnector.fConnectableSide, line.point2, fInputWithRect.fConnector.fConnectableSide);
1985
+ this.fConnection.redraw();
1986
+ }
1987
+ drawSnapConnection(fInputWithRect) {
1988
+ var _a;
1989
+ if (fInputWithRect) {
1990
+ const line = this.fMediator.send(new GetConnectionLineRequest(this.fOutputWithRect.fRect, fInputWithRect.fRect, this.fSnapConnection.fBehavior, this.fOutputWithRect.fConnector.fConnectableSide, fInputWithRect.fConnector.fConnectableSide));
1991
+ this.fSnapConnection.show();
1992
+ this.fSnapConnection.setLine(line.point1, this.fOutputWithRect.fConnector.fConnectableSide, line.point2, fInputWithRect.fConnector.fConnectableSide);
1993
+ this.fSnapConnection.redraw();
1994
+ }
1995
+ else {
1996
+ (_a = this.fSnapConnection) === null || _a === void 0 ? void 0 : _a.hide();
1997
+ }
1998
+ }
1999
+ getClosetInput(difference) {
2000
+ return this.fMediator.send(new FindClosestInputUsingSnapThresholdRequest(Point.fromPoint(this.toConnectorRect).add(difference), this.canBeConnectedInputs, this.fSnapConnection.fSnapThreshold));
1834
2001
  }
1835
2002
  complete() {
1836
- const fromConnector = this.fMediator.send(new GetOutputRectInFlowRequest(this.connection.fOutputId));
1837
- const toConnector = this.fMediator.send(new GetInputRectInFlowRequest(this.connection.fInputId));
1838
- const line = this.fMediator.send(new GetConnectionLineRequest(fromConnector.rect, toConnector.rect, this.connection.fBehavior, fromConnector.fConnectableSide, toConnector.fConnectableSide));
1839
- this.connection.setLine(line.point1, fromConnector.fConnectableSide, line.point2, toConnector.fConnectableSide);
1840
- this.connection.redraw();
2003
+ var _a;
2004
+ this.drawConnection(this.fInputWithRect);
2005
+ (_a = this.fSnapConnection) === null || _a === void 0 ? void 0 : _a.hide();
1841
2006
  }
1842
2007
  }
1843
2008
 
@@ -2498,12 +2663,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
2498
2663
  args: [F_CONNECTION_BUILDERS]
2499
2664
  }] }]; } });
2500
2665
 
2501
- const MIXIN_BASE$1 = mixinChangeSelection(mixinChangeVisibility(class {
2666
+ const MIXIN_BASE = mixinChangeSelection(mixinChangeVisibility(class {
2502
2667
  constructor(hostElement) {
2503
2668
  this.hostElement = hostElement;
2504
2669
  }
2505
2670
  }));
2506
- class FConnectionBase extends MIXIN_BASE$1 {
2671
+ class FConnectionBase extends MIXIN_BASE {
2507
2672
  constructor(elementReference, cFactory) {
2508
2673
  super(elementReference.nativeElement);
2509
2674
  this.cFactory = cFactory;
@@ -2585,12 +2750,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
2585
2750
  }]
2586
2751
  }] });
2587
2752
 
2588
- let uniqueId$7 = 0;
2753
+ let uniqueId$8 = 0;
2589
2754
  class FConnectionForCreateComponent extends FConnectionBase {
2590
2755
  constructor(elementReference, fConnectionFactory, fComponentsStore) {
2591
2756
  super(elementReference, fConnectionFactory);
2592
2757
  this.fComponentsStore = fComponentsStore;
2593
- this.fId = `f-connection-for-create-${uniqueId$7++}`;
2758
+ this.fId = `f-connection-for-create-${uniqueId$8++}`;
2594
2759
  this.fText = '';
2595
2760
  this._fStartColor = 'black';
2596
2761
  this._fEndColor = 'black';
@@ -2643,11 +2808,6 @@ class FConnectionForCreateComponent extends FConnectionBase {
2643
2808
  get fType() {
2644
2809
  return this._type;
2645
2810
  }
2646
- get fMarkers() {
2647
- return this.fComponentsStore.fMarkers.filter((x) => {
2648
- return this.hostElement.contains(x.hostElement);
2649
- });
2650
- }
2651
2811
  get boundingElement() {
2652
2812
  return this.fPath.hostElement;
2653
2813
  }
@@ -2713,12 +2873,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
2713
2873
  args: [FConnectionCenterDirective, { descendants: true }]
2714
2874
  }] } });
2715
2875
 
2716
- let uniqueId$6 = 0;
2876
+ let uniqueId$7 = 0;
2717
2877
  class FConnectionComponent extends FConnectionBase {
2718
2878
  constructor(elementReference, fConnectionFactory, fComponentsStore) {
2719
2879
  super(elementReference, fConnectionFactory);
2720
2880
  this.fComponentsStore = fComponentsStore;
2721
- this.fId = `f-connection-${uniqueId$6++}`;
2881
+ this.fId = `f-connection-${uniqueId$7++}`;
2722
2882
  this._fText = '';
2723
2883
  this._fStartColor = 'black';
2724
2884
  this._fEndColor = 'black';
@@ -2792,11 +2952,6 @@ class FConnectionComponent extends FConnectionBase {
2792
2952
  get fType() {
2793
2953
  return this._type;
2794
2954
  }
2795
- get fMarkers() {
2796
- return this.fComponentsStore.fMarkers.filter((x) => {
2797
- return this.hostElement.contains(x.hostElement);
2798
- });
2799
- }
2800
2955
  get boundingElement() {
2801
2956
  return this.fPath.hostElement;
2802
2957
  }
@@ -2808,7 +2963,7 @@ class FConnectionComponent extends FConnectionBase {
2808
2963
  }
2809
2964
  }
2810
2965
  FConnectionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FConnectionComponent, deps: [{ token: i0.ElementRef }, { token: FConnectionFactory }, { token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Component });
2811
- FConnectionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: FConnectionComponent, selector: "f-connection", inputs: { fId: ["fConnectionId", "fId"], fText: "fText", fStartColor: "fStartColor", fEndColor: "fEndColor", fOutputId: "fOutputId", fInputId: "fInputId", fRadius: "fRadius", fOffset: "fOffset", fBehavior: "fBehavior", fType: "fType", fDraggingDisabled: ["fReassignDisabled", "fDraggingDisabled"], fSelectionDisabled: "fSelectionDisabled" }, host: { properties: { "attr.id": "fId", "class.f-connection-selection-disabled": "fSelectionDisabled", "class.f-connection-reassign-disabled": "fDraggingDisabled" }, classAttribute: "f-component f-connection" }, providers: [{ provide: F_CONNECTION, useExisting: FConnectionComponent }], queries: [{ propertyName: "fConnectionCenters", predicate: FConnectionCenterDirective, descendants: true }], viewQueries: [{ propertyName: "fDefs", first: true, predicate: ["defs"], descendants: true, static: true }, { propertyName: "fPath", first: true, predicate: CONNECTION_PATH, descendants: true, static: true }, { propertyName: "fGradient", first: true, predicate: CONNECTION_GRADIENT, descendants: true, static: true }, { propertyName: "fDragHandle", first: true, predicate: FConnectionDragHandleComponent, descendants: true, static: true }, { propertyName: "fSelection", first: true, predicate: FConnectionSelectionComponent, descendants: true, static: true }, { propertyName: "fTextComponent", first: true, predicate: CONNECTION_TEXT, descendants: true, static: true }, { propertyName: "fConnectionCenter", first: true, predicate: ["fConnectionCenter"], descendants: true }], exportAs: ["fComponent"], usesInheritance: true, ngImport: i0, template: "<svg xmlns=\"http://www.w3.org/2000/svg\" style=\"overflow: visible; display: block; vertical-align: middle;\">\n <defs #defs></defs>\n <ng-content></ng-content>\n <g class=\"f-connection-group\">\n <linearGradient fConnectionGradient></linearGradient>\n <path fConnectionSelection [attr.d]=\"path\"></path>\n <g>\n <path f-connection-path [attr.d]=\"path\"></path>\n <circle f-connection-drag-handle r=\"8\"></circle>\n </g>\n <text f-connection-text></text>\n </g>\n</svg>\n<div #fConnectionCenter class=\"f-connection-center\" *ngIf=\"fConnectionCenters.length\">\n <ng-content select=\"[fConnectionCenter]\"></ng-content>\n</div>\n", styles: [":host{pointer-events:none;position:absolute;display:none}:host svg{overflow:visible}:host svg .f-connection-group{pointer-events:all}:host .f-connection-center{pointer-events:all}\n"], components: [{ type: FConnectionGradientComponent, selector: "linearGradient[fConnectionGradient]" }, { type: FConnectionSelectionComponent, selector: "path[fConnectionSelection]" }, { type: FConnectionPathComponent, selector: "path[f-connection-path]" }, { type: FConnectionDragHandleComponent, selector: "circle[f-connection-drag-handle]" }, { type: FConnectionTextComponent, selector: "text[f-connection-text]" }], directives: [{ type: i8.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2966
+ FConnectionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: FConnectionComponent, selector: "f-connection", inputs: { fId: ["fConnectionId", "fId"], fText: "fText", fStartColor: "fStartColor", fEndColor: "fEndColor", fOutputId: "fOutputId", fInputId: "fInputId", fRadius: "fRadius", fOffset: "fOffset", fBehavior: "fBehavior", fType: "fType", fDraggingDisabled: ["fReassignDisabled", "fDraggingDisabled"], fSelectionDisabled: "fSelectionDisabled" }, host: { properties: { "attr.id": "fId", "class.f-connection-selection-disabled": "fSelectionDisabled", "class.f-connection-reassign-disabled": "fDraggingDisabled" }, classAttribute: "f-component f-connection" }, providers: [{ provide: F_CONNECTION, useExisting: FConnectionComponent }], queries: [{ propertyName: "fConnectionCenters", predicate: FConnectionCenterDirective, descendants: true }], viewQueries: [{ propertyName: "fDefs", first: true, predicate: ["defs"], descendants: true, static: true }, { propertyName: "fPath", first: true, predicate: CONNECTION_PATH, descendants: true, static: true }, { propertyName: "fGradient", first: true, predicate: CONNECTION_GRADIENT, descendants: true, static: true }, { propertyName: "fDragHandle", first: true, predicate: FConnectionDragHandleComponent, descendants: true, static: true }, { propertyName: "fSelection", first: true, predicate: FConnectionSelectionComponent, descendants: true, static: true }, { propertyName: "fTextComponent", first: true, predicate: CONNECTION_TEXT, descendants: true, static: true }, { propertyName: "fConnectionCenter", first: true, predicate: ["fConnectionCenter"], descendants: true }], exportAs: ["fComponent"], usesInheritance: true, ngImport: i0, template: "<svg xmlns=\"http://www.w3.org/2000/svg\" style=\"overflow: visible; display: block; vertical-align: middle;\">\n <defs #defs></defs>\n <ng-content></ng-content>\n <g class=\"f-connection-group\">\n <linearGradient fConnectionGradient></linearGradient>\n <path fConnectionSelection [attr.d]=\"path\"></path>\n <g>\n <path f-connection-path [attr.d]=\"path\"></path>\n <circle f-connection-drag-handle r=\"8\"></circle>\n </g>\n <text f-connection-text></text>\n </g>\n</svg>\n<div #fConnectionCenter class=\"f-connection-center\" *ngIf=\"fConnectionCenters.length\">\n <ng-content select=\"[fConnectionCenter]\"></ng-content>\n</div>\n", styles: [":host{pointer-events:none;position:absolute}:host svg{overflow:visible}:host svg .f-connection-group{pointer-events:all}:host .f-connection-center{pointer-events:all}\n"], components: [{ type: FConnectionGradientComponent, selector: "linearGradient[fConnectionGradient]" }, { type: FConnectionSelectionComponent, selector: "path[fConnectionSelection]" }, { type: FConnectionPathComponent, selector: "path[f-connection-path]" }, { type: FConnectionDragHandleComponent, selector: "circle[f-connection-drag-handle]" }, { type: FConnectionTextComponent, selector: "text[f-connection-text]" }], directives: [{ type: i8.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2812
2967
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FConnectionComponent, decorators: [{
2813
2968
  type: Component,
2814
2969
  args: [{
@@ -2947,15 +3102,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
2947
3102
  type: Input
2948
3103
  }] } });
2949
3104
 
2950
- let uniqueId$5 = 0;
3105
+ let uniqueId$6 = 0;
2951
3106
  class FSnapConnectionComponent extends FConnectionBase {
2952
3107
  constructor(elementReference, fConnectionFactory, fComponentsStore) {
2953
3108
  super(elementReference, fConnectionFactory);
2954
3109
  this.fComponentsStore = fComponentsStore;
2955
- this.fId = `f-snap-connection-${uniqueId$5++}`;
3110
+ this.fId = `f-snap-connection-${uniqueId$6++}`;
2956
3111
  this.fText = '';
2957
3112
  this._fStartColor = 'black';
2958
3113
  this._fEndColor = 'black';
3114
+ this.fSnapThreshold = 20;
2959
3115
  this._fRadius = 8;
2960
3116
  this._fOffset = 32;
2961
3117
  this._behavior = EFConnectionBehavior.FIXED;
@@ -3005,26 +3161,21 @@ class FSnapConnectionComponent extends FConnectionBase {
3005
3161
  get fType() {
3006
3162
  return this._type;
3007
3163
  }
3008
- get fMarkers() {
3009
- return this.fComponentsStore.fMarkers.filter((x) => {
3010
- return this.hostElement.contains(x.hostElement);
3011
- });
3012
- }
3013
3164
  get boundingElement() {
3014
3165
  return this.fPath.hostElement;
3015
3166
  }
3016
3167
  ngOnInit() {
3017
- this.fComponentsStore.fTempConnection = this;
3168
+ this.fComponentsStore.fSnapConnection = this;
3018
3169
  }
3019
3170
  ngAfterViewInit() {
3020
3171
  this.hide();
3021
3172
  }
3022
3173
  ngOnDestroy() {
3023
- this.fComponentsStore.fTempConnection = undefined;
3174
+ this.fComponentsStore.fSnapConnection = undefined;
3024
3175
  }
3025
3176
  }
3026
3177
  FSnapConnectionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FSnapConnectionComponent, deps: [{ token: i0.ElementRef }, { token: FConnectionFactory }, { token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Component });
3027
- FSnapConnectionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: FSnapConnectionComponent, selector: "f-snap-connection", inputs: { fStartColor: "fStartColor", fEndColor: "fEndColor", fRadius: "fRadius", fOffset: "fOffset", fBehavior: "fBehavior", fType: "fType" }, host: { classAttribute: "f-component f-connection f-snap-connection" }, providers: [{ provide: F_CONNECTION, useExisting: FSnapConnectionComponent }], queries: [{ propertyName: "fConnectionCenters", predicate: FConnectionCenterDirective, descendants: true }], viewQueries: [{ propertyName: "fDefs", first: true, predicate: ["defs"], descendants: true, static: true }, { propertyName: "fPath", first: true, predicate: CONNECTION_PATH, descendants: true, static: true }, { propertyName: "fGradient", first: true, predicate: CONNECTION_GRADIENT, descendants: true, static: true }, { propertyName: "fDragHandle", first: true, predicate: FConnectionDragHandleComponent, descendants: true, static: true }, { propertyName: "fSelection", first: true, predicate: FConnectionSelectionComponent, descendants: true, static: true }, { propertyName: "fTextComponent", first: true, predicate: CONNECTION_TEXT, descendants: true, static: true }, { propertyName: "fConnectionCenter", first: true, predicate: ["fConnectionCenter"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<svg xmlns=\"http://www.w3.org/2000/svg\">\n <defs #defs></defs>\n <g class=\"f-connection-group\">\n <linearGradient fConnectionGradient></linearGradient>\n <path fConnectionSelection [attr.d]=\"path\"></path>\n <g>\n <path f-connection-path\n [attr.d]=\"path\">\n </path>\n <circle f-connection-drag-handle r=\"8\"></circle>\n </g>\n <text f-connection-text></text>\n </g>\n <ng-content></ng-content>\n</svg>\n<div #fConnectionCenter class=\"f-connection-center\" *ngIf=\"fConnectionCenters.length\">\n <ng-content select=\"[fConnectionCenter]\"></ng-content>\n</div>\n", styles: [":host{pointer-events:none;position:absolute}:host svg{overflow:visible}:host svg .f-connection-group{pointer-events:all}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3178
+ FSnapConnectionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: FSnapConnectionComponent, selector: "f-snap-connection", inputs: { fStartColor: "fStartColor", fEndColor: "fEndColor", fSnapThreshold: "fSnapThreshold", fRadius: "fRadius", fOffset: "fOffset", fBehavior: "fBehavior", fType: "fType" }, host: { classAttribute: "f-component f-connection f-snap-connection" }, providers: [{ provide: F_CONNECTION, useExisting: FSnapConnectionComponent }], queries: [{ propertyName: "fConnectionCenters", predicate: FConnectionCenterDirective, descendants: true }], viewQueries: [{ propertyName: "fDefs", first: true, predicate: ["defs"], descendants: true, static: true }, { propertyName: "fPath", first: true, predicate: CONNECTION_PATH, descendants: true, static: true }, { propertyName: "fGradient", first: true, predicate: CONNECTION_GRADIENT, descendants: true, static: true }, { propertyName: "fDragHandle", first: true, predicate: FConnectionDragHandleComponent, descendants: true, static: true }, { propertyName: "fSelection", first: true, predicate: FConnectionSelectionComponent, descendants: true, static: true }, { propertyName: "fTextComponent", first: true, predicate: CONNECTION_TEXT, descendants: true, static: true }, { propertyName: "fConnectionCenter", first: true, predicate: ["fConnectionCenter"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<svg xmlns=\"http://www.w3.org/2000/svg\">\n <defs #defs></defs>\n <g class=\"f-connection-group\">\n <linearGradient fConnectionGradient></linearGradient>\n <path fConnectionSelection [attr.d]=\"path\"></path>\n <g>\n <path f-connection-path\n [attr.d]=\"path\">\n </path>\n <circle f-connection-drag-handle r=\"8\"></circle>\n </g>\n <text f-connection-text></text>\n </g>\n <ng-content></ng-content>\n</svg>\n<div #fConnectionCenter class=\"f-connection-center\" *ngIf=\"fConnectionCenters.length\">\n <ng-content select=\"[fConnectionCenter]\"></ng-content>\n</div>\n", styles: [":host{pointer-events:none;position:absolute}:host svg{overflow:visible}:host svg .f-connection-group{pointer-events:all}:host .f-connection-center{pointer-events:all}\n"], components: [{ type: FConnectionGradientComponent, selector: "linearGradient[fConnectionGradient]" }, { type: FConnectionSelectionComponent, selector: "path[fConnectionSelection]" }, { type: FConnectionPathComponent, selector: "path[f-connection-path]" }, { type: FConnectionDragHandleComponent, selector: "circle[f-connection-drag-handle]" }, { type: FConnectionTextComponent, selector: "text[f-connection-text]" }], directives: [{ type: i8.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3028
3179
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FSnapConnectionComponent, decorators: [{
3029
3180
  type: Component,
3030
3181
  args: [{
@@ -3041,6 +3192,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
3041
3192
  type: Input
3042
3193
  }], fEndColor: [{
3043
3194
  type: Input
3195
+ }], fSnapThreshold: [{
3196
+ type: Input
3044
3197
  }], fRadius: [{
3045
3198
  type: Input
3046
3199
  }], fOffset: [{
@@ -3085,7 +3238,8 @@ const F_CONNECTION_PROVIDERS = [
3085
3238
  FConnectionComponent,
3086
3239
  FConnectionCenterDirective,
3087
3240
  FConnectionForCreateComponent,
3088
- FMarkerDirective
3241
+ FMarkerDirective,
3242
+ FSnapConnectionComponent
3089
3243
  ];
3090
3244
 
3091
3245
  let ReassignConnectionPreparationExecution = class ReassignConnectionPreparationExecution {
@@ -3114,7 +3268,7 @@ let ReassignConnectionPreparationExecution = class ReassignConnectionPreparation
3114
3268
  this.fDraggableDataContext.onPointerDownPosition = Point.fromPoint(request.event.getPosition())
3115
3269
  .elementTransform(this.flowHost).div(this.transform.scale);
3116
3270
  this.fDraggableDataContext.draggableItems = [
3117
- new ReassignConnectionDragHandler(this.fMediator, connectionToReassign)
3271
+ new ReassignConnectionDragHandler(this.fMediator, this.fComponentsStore, connectionToReassign)
3118
3272
  ];
3119
3273
  }
3120
3274
  getDragHandleElement(position) {
@@ -3178,12 +3332,12 @@ const REASSIGN_CONNECTION_PREPARATION_PROVIDERS = [
3178
3332
  ];
3179
3333
 
3180
3334
  const CONNECTIONS_PROVIDERS = [
3335
+ ...CONNECTION_DRAG_COMMON_PROVIDERS,
3181
3336
  ...CREATE_CONNECTION_FINALIZE_PROVIDERS,
3182
3337
  ...CREATE_CONNECTION_PREPARATION_PROVIDERS,
3183
3338
  ...GET_CAN_BE_CONNECTED_OUTPUT_BY_OUTLET_PROVIDERS,
3184
3339
  ...REASSIGN_CONNECTION_FINALIZE_PROVIDERS,
3185
3340
  ...REASSIGN_CONNECTION_PREPARATION_PROVIDERS,
3186
- ...GET_INPUT_UNDER_POINTER_PROVIDERS,
3187
3341
  ];
3188
3342
 
3189
3343
  class GetNodePaddingRequest {
@@ -3374,21 +3528,20 @@ class PutInputConnectionHandlersToArrayRequest {
3374
3528
  }
3375
3529
 
3376
3530
  class ConnectionBaseDragHandler {
3377
- constructor(fMediator, connection) {
3531
+ constructor(fMediator, fComponentsStore, connection) {
3378
3532
  this.fMediator = fMediator;
3533
+ this.fComponentsStore = fComponentsStore;
3379
3534
  this.connection = connection;
3380
- this.fromConnectorRect = new RoundedRect();
3381
- this.fromConnectorSide = EFConnectableSide.BOTTOM;
3382
- this.toConnectorRect = new RoundedRect();
3383
- this.toConnectorSide = EFConnectableSide.TOP;
3384
3535
  }
3385
3536
  initialize() {
3386
- const fromConnector = this.fMediator.send(new GetOutputRectInFlowRequest(this.connection.fOutputId));
3387
- this.fromConnectorRect = RoundedRect.fromRoundedRect(fromConnector.rect);
3388
- this.fromConnectorSide = fromConnector.fConnectableSide;
3389
- const toConnector = this.fMediator.send(new GetInputRectInFlowRequest(this.connection.fInputId));
3390
- this.toConnectorRect = RoundedRect.fromRoundedRect(toConnector.rect);
3391
- this.toConnectorSide = toConnector.fConnectableSide;
3537
+ this.fOutputWithRect = this.fMediator.send(new GetConnectorWithRectRequest(this.getOutput()));
3538
+ this.fInputWithRect = this.fMediator.send(new GetConnectorWithRectRequest(this.getInput()));
3539
+ }
3540
+ getOutput() {
3541
+ return this.fComponentsStore.fOutputs.find((x) => x.id === this.connection.fOutputId);
3542
+ }
3543
+ getInput() {
3544
+ return this.fComponentsStore.fInputs.find((x) => x.id === this.connection.fInputId);
3392
3545
  }
3393
3546
  getDifference(difference, restrictions) {
3394
3547
  return {
@@ -3397,19 +3550,19 @@ class ConnectionBaseDragHandler {
3397
3550
  };
3398
3551
  }
3399
3552
  redrawConnection(line) {
3400
- this.connection.setLine(line.point1, this.fromConnectorSide, line.point2, this.toConnectorSide);
3553
+ this.connection.setLine(line.point1, this.fOutputWithRect.fConnector.fConnectableSide, line.point2, this.fInputWithRect.fConnector.fConnectableSide);
3401
3554
  this.connection.redraw();
3402
3555
  }
3403
3556
  }
3404
- ConnectionBaseDragHandler.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConnectionBaseDragHandler, deps: [{ token: i2.FMediator }, { token: FConnectionBase }], target: i0.ɵɵFactoryTarget.Directive });
3557
+ ConnectionBaseDragHandler.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConnectionBaseDragHandler, deps: [{ token: i2.FMediator }, { token: FComponentsStore }, { token: FConnectionBase }], target: i0.ɵɵFactoryTarget.Directive });
3405
3558
  ConnectionBaseDragHandler.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: ConnectionBaseDragHandler, ngImport: i0 });
3406
3559
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ConnectionBaseDragHandler, decorators: [{
3407
3560
  type: Directive
3408
- }], ctorParameters: function () { return [{ type: i2.FMediator }, { type: FConnectionBase }]; } });
3561
+ }], ctorParameters: function () { return [{ type: i2.FMediator }, { type: FComponentsStore }, { type: FConnectionBase }]; } });
3409
3562
 
3410
3563
  class ConnectionDragHandler extends ConnectionBaseDragHandler {
3411
- constructor(fMediator, connection) {
3412
- super(fMediator, connection);
3564
+ constructor(fMediator, fComponentsStore, connection) {
3565
+ super(fMediator, fComponentsStore, connection);
3413
3566
  }
3414
3567
  setOutputRestrictions(min, max) {
3415
3568
  this.sourceRestrictions = { min, max };
@@ -3421,13 +3574,13 @@ class ConnectionDragHandler extends ConnectionBaseDragHandler {
3421
3574
  this.redrawConnection(this.getNewLineValue(difference));
3422
3575
  }
3423
3576
  getNewLineValue(difference) {
3424
- return this.fMediator.send(new GetConnectionLineRequest(this.fromConnectorRect.addPoint(this.getDifference(Object.assign({}, difference), this.sourceRestrictions)), this.toConnectorRect.addPoint(this.getDifference(Object.assign({}, difference), this.targetRestrictions)), this.connection.fBehavior, this.fromConnectorSide, this.toConnectorSide));
3577
+ return this.fMediator.send(new GetConnectionLineRequest(RoundedRect.fromRect(this.fOutputWithRect.fRect).addPoint(this.getDifference(Object.assign({}, difference), this.sourceRestrictions)), RoundedRect.fromRect(this.fInputWithRect.fRect).addPoint(this.getDifference(Object.assign({}, difference), this.targetRestrictions)), this.connection.fBehavior, this.fOutputWithRect.fConnector.fConnectableSide, this.fInputWithRect.fConnector.fConnectableSide));
3425
3578
  }
3426
3579
  }
3427
3580
 
3428
3581
  class ConnectionTargetDragHandler extends ConnectionBaseDragHandler {
3429
- constructor(fMediator, connection, minDistance, maxDistance) {
3430
- super(fMediator, connection);
3582
+ constructor(fMediator, fComponentsStore, connection, minDistance, maxDistance) {
3583
+ super(fMediator, fComponentsStore, connection);
3431
3584
  this.minDistance = minDistance;
3432
3585
  this.maxDistance = maxDistance;
3433
3586
  }
@@ -3435,7 +3588,7 @@ class ConnectionTargetDragHandler extends ConnectionBaseDragHandler {
3435
3588
  this.redrawConnection(this.getNewLineValue(difference));
3436
3589
  }
3437
3590
  getNewLineValue(difference) {
3438
- return this.fMediator.send(new GetConnectionLineRequest(this.fromConnectorRect, this.toConnectorRect.addPoint(this.getDifference(Object.assign({}, difference), { min: this.minDistance, max: this.maxDistance })), this.connection.fBehavior, this.fromConnectorSide, this.toConnectorSide));
3591
+ return this.fMediator.send(new GetConnectionLineRequest(RoundedRect.fromRect(this.fOutputWithRect.fRect), RoundedRect.fromRect(this.fInputWithRect.fRect).addPoint(this.getDifference(Object.assign({}, difference), { min: this.minDistance, max: this.maxDistance })), this.connection.fBehavior, this.fOutputWithRect.fConnector.fConnectableSide, this.fInputWithRect.fConnector.fConnectableSide));
3439
3592
  }
3440
3593
  }
3441
3594
 
@@ -3479,7 +3632,7 @@ let PutInputConnectionHandlersToArrayExecution = class PutInputConnectionHandler
3479
3632
  return result;
3480
3633
  }
3481
3634
  getNewConnectionHandler(connection, nodeDragHandler) {
3482
- const handler = new ConnectionDragHandler(this.fMediator, connection);
3635
+ const handler = new ConnectionDragHandler(this.fMediator, this.fComponentsStore, connection);
3483
3636
  handler.setInputRestrictions(nodeDragHandler.minDistance, nodeDragHandler.maxDistance);
3484
3637
  return handler;
3485
3638
  }
@@ -3487,7 +3640,7 @@ let PutInputConnectionHandlersToArrayExecution = class PutInputConnectionHandler
3487
3640
  result[index].setInputRestrictions(nodeDragHandler.minDistance, nodeDragHandler.maxDistance);
3488
3641
  }
3489
3642
  getNewSourceConnectionHandler(connection, nodeDragHandler) {
3490
- return new ConnectionTargetDragHandler(this.fMediator, connection, nodeDragHandler.minDistance, nodeDragHandler.maxDistance);
3643
+ return new ConnectionTargetDragHandler(this.fMediator, this.fComponentsStore, connection, nodeDragHandler.minDistance, nodeDragHandler.maxDistance);
3491
3644
  }
3492
3645
  };
3493
3646
  PutInputConnectionHandlersToArrayExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: PutInputConnectionHandlersToArrayExecution, deps: [{ token: FComponentsStore }, { token: i2.FMediator }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -3508,8 +3661,8 @@ class PutOutputConnectionHandlersToArrayRequest {
3508
3661
  }
3509
3662
 
3510
3663
  class ConnectionSourceDragHandler extends ConnectionBaseDragHandler {
3511
- constructor(fMediator, connection, minDistance, maxDistance) {
3512
- super(fMediator, connection);
3664
+ constructor(fMediator, fComponentsStore, connection, minDistance, maxDistance) {
3665
+ super(fMediator, fComponentsStore, connection);
3513
3666
  this.minDistance = minDistance;
3514
3667
  this.maxDistance = maxDistance;
3515
3668
  }
@@ -3517,7 +3670,7 @@ class ConnectionSourceDragHandler extends ConnectionBaseDragHandler {
3517
3670
  this.redrawConnection(this.getNewLineValue(difference));
3518
3671
  }
3519
3672
  getNewLineValue(difference) {
3520
- return this.fMediator.send(new GetConnectionLineRequest(this.fromConnectorRect.addPoint(this.getDifference(Object.assign({}, difference), { min: this.minDistance, max: this.maxDistance })), this.toConnectorRect, this.connection.fBehavior, this.fromConnectorSide, this.toConnectorSide));
3673
+ return this.fMediator.send(new GetConnectionLineRequest(RoundedRect.fromRect(this.fOutputWithRect.fRect).addPoint(this.getDifference(Object.assign({}, difference), { min: this.minDistance, max: this.maxDistance })), RoundedRect.fromRect(this.fInputWithRect.fRect), this.connection.fBehavior, this.fOutputWithRect.fConnector.fConnectableSide, this.fInputWithRect.fConnector.fConnectableSide));
3521
3674
  }
3522
3675
  }
3523
3676
 
@@ -3561,7 +3714,7 @@ let PutOutputConnectionHandlersToArrayExecution = class PutOutputConnectionHandl
3561
3714
  return result;
3562
3715
  }
3563
3716
  getNewConnectionHandler(connection, nodeDragHandler) {
3564
- const handler = new ConnectionDragHandler(this.fMediator, connection);
3717
+ const handler = new ConnectionDragHandler(this.fMediator, this.fComponentsStore, connection);
3565
3718
  handler.setOutputRestrictions(nodeDragHandler.minDistance, nodeDragHandler.maxDistance);
3566
3719
  return handler;
3567
3720
  }
@@ -3569,7 +3722,7 @@ let PutOutputConnectionHandlersToArrayExecution = class PutOutputConnectionHandl
3569
3722
  result[index].setOutputRestrictions(nodeDragHandler.minDistance, nodeDragHandler.maxDistance);
3570
3723
  }
3571
3724
  getNewSourceConnectionHandler(connection, nodeDragHandler) {
3572
- return new ConnectionSourceDragHandler(this.fMediator, connection, nodeDragHandler.minDistance, nodeDragHandler.maxDistance);
3725
+ return new ConnectionSourceDragHandler(this.fMediator, this.fComponentsStore, connection, nodeDragHandler.minDistance, nodeDragHandler.maxDistance);
3573
3726
  }
3574
3727
  };
3575
3728
  PutOutputConnectionHandlersToArrayExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: PutOutputConnectionHandlersToArrayExecution, deps: [{ token: FComponentsStore }, { token: i2.FMediator }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -4673,13 +4826,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
4673
4826
  }]
4674
4827
  }] });
4675
4828
 
4676
- let uniqueId$4 = 0;
4829
+ let uniqueId$5 = 0;
4677
4830
  class FExternalItemDirective extends FExternalItemBase {
4678
4831
  constructor(elementReference, fExternalItemService) {
4679
4832
  super();
4680
4833
  this.elementReference = elementReference;
4681
4834
  this.fExternalItemService = fExternalItemService;
4682
- this.fExternalItemId = `f-external-item-${uniqueId$4++}`;
4835
+ this.fExternalItemId = `f-external-item-${uniqueId$5++}`;
4683
4836
  this.fDisabled = false;
4684
4837
  }
4685
4838
  get hostElement() {
@@ -4966,7 +5119,7 @@ class FMinimapDragHandler {
4966
5119
  complete() {
4967
5120
  var _a;
4968
5121
  (_a = this.fComponentsStore.fCanvas) === null || _a === void 0 ? void 0 : _a.hostElement.classList.remove('f-scaled-animate');
4969
- this.fComponentsStore.fCanvas.completeDrag();
5122
+ this.fComponentsStore.fCanvas.emitCanvasChangeEvent();
4970
5123
  }
4971
5124
  }
4972
5125
 
@@ -4984,7 +5137,7 @@ let MinimapDragPreparationExecution = class MinimapDragPreparationExecution {
4984
5137
  const startCanvasPosition = Point.fromPoint(this.fComponentsStore.fCanvas.transform.position);
4985
5138
  this.fComponentsStore.fCanvas.setPosition(this.getNewPosition(eventPoint, request.minimap));
4986
5139
  this.fComponentsStore.fCanvas.redraw();
4987
- this.fComponentsStore.fCanvas.completeDrag();
5140
+ this.fComponentsStore.fCanvas.emitCanvasChangeEvent();
4988
5141
  this.fDraggableDataContext.onPointerDownScale = 1;
4989
5142
  this.fDraggableDataContext.onPointerDownPosition = Point.fromPoint(eventPoint).elementTransform(this.flowHost);
4990
5143
  this.fDraggableDataContext.draggableItems = [
@@ -5281,201 +5434,158 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
5281
5434
  type: Injectable
5282
5435
  }], ctorParameters: function () { return [{ type: FDraggableDataContext }]; } });
5283
5436
 
5284
- class CreateConnectionMarkersRequest {
5285
- constructor(fConnection) {
5286
- this.fConnection = fConnection;
5287
- }
5437
+ class GetSelectionRequest {
5288
5438
  }
5289
5439
 
5290
- let CreateConnectionMarkersExecution = class CreateConnectionMarkersExecution {
5291
- constructor(fBrowser) {
5292
- this.fBrowser = fBrowser;
5440
+ let GetSelectionExecution = class GetSelectionExecution {
5441
+ constructor(fDraggableDataContext) {
5442
+ this.fDraggableDataContext = fDraggableDataContext;
5293
5443
  }
5294
- handle(request) {
5295
- const element = createSVGElement$1('defs', this.fBrowser);
5296
- const fConnection = request.fConnection;
5297
- fConnection.fMarkers.forEach((marker) => {
5298
- const markerElement = this.createMarkerElement(marker, fConnection.fId);
5299
- const clone = marker.hostElement.cloneNode(true);
5300
- clone.setAttribute('height', `${marker.height}`);
5301
- clone.setAttribute('width', `${marker.width}`);
5302
- clone.removeAttribute('markerUnits');
5303
- clone.style.display = 'unset';
5304
- markerElement.append(clone);
5305
- element.append(markerElement);
5444
+ handle() {
5445
+ let selectedNodes = [];
5446
+ let selectedConnections = [];
5447
+ this.fDraggableDataContext.selectedItems.forEach((x) => {
5448
+ if (x.hostElement.classList.contains('f-node')) {
5449
+ selectedNodes.push(x.hostElement.dataset['fNodeId']);
5450
+ }
5451
+ else {
5452
+ selectedConnections.push(x.hostElement.id);
5453
+ }
5306
5454
  });
5307
- fConnection.fDefs.nativeElement.innerHTML = element.innerHTML;
5308
- this.makeSafariCompatible(fConnection);
5309
- }
5310
- // Safari does not support markers on path elements if markers are defined after the path element
5311
- makeSafariCompatible(fConnection) {
5312
- fConnection.fPath.hostElement.replaceWith(fConnection.fPath.hostElement);
5313
- }
5314
- createMarkerElement(marker, fConnectionId) {
5315
- const markerElement = createSVGElement$1('marker', this.fBrowser);
5316
- markerElement.setAttribute('id', normalizeDomElementId(marker.type + '-' + fConnectionId));
5317
- markerElement.setAttribute('markerHeight', `${marker.height}`);
5318
- markerElement.setAttribute('markerWidth', `${marker.width}`);
5319
- markerElement.setAttribute('orient', `${marker.orient}`);
5320
- markerElement.setAttribute('refX', `${marker.refX}`);
5321
- markerElement.setAttribute('refY', `${marker.refY}`);
5322
- markerElement.setAttribute('markerUnits', `${marker.markerUnits}`);
5323
- return markerElement;
5455
+ return new FSelectionChangeEvent(selectedNodes, selectedConnections);
5324
5456
  }
5325
5457
  };
5326
- CreateConnectionMarkersExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CreateConnectionMarkersExecution, deps: [{ token: i1.BrowserService }], target: i0.ɵɵFactoryTarget.Injectable });
5327
- CreateConnectionMarkersExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CreateConnectionMarkersExecution });
5328
- CreateConnectionMarkersExecution = __decorate([
5329
- FExecutionRegister(CreateConnectionMarkersRequest)
5330
- ], CreateConnectionMarkersExecution);
5331
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CreateConnectionMarkersExecution, decorators: [{
5458
+ GetSelectionExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetSelectionExecution, deps: [{ token: FDraggableDataContext }], target: i0.ɵɵFactoryTarget.Injectable });
5459
+ GetSelectionExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetSelectionExecution });
5460
+ GetSelectionExecution = __decorate([
5461
+ FExecutionRegister(GetSelectionRequest)
5462
+ ], GetSelectionExecution);
5463
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetSelectionExecution, decorators: [{
5332
5464
  type: Injectable
5333
- }], ctorParameters: function () { return [{ type: i1.BrowserService }]; } });
5334
- function createSVGElement$1(tag, fBrowser) {
5335
- return fBrowser.document.createElementNS('http://www.w3.org/2000/svg', tag);
5336
- }
5465
+ }], ctorParameters: function () { return [{ type: FDraggableDataContext }]; } });
5337
5466
 
5338
- class CreateRoundedRectFromElementRequest {
5339
- constructor(element) {
5340
- this.element = element;
5341
- }
5467
+ class SelectRequest {
5468
+ constructor(nodes, connections) {
5469
+ this.nodes = nodes;
5470
+ this.connections = connections;
5471
+ }
5342
5472
  }
5343
5473
 
5344
- let CreateRoundedRectFromElementExecution = class CreateRoundedRectFromElementExecution {
5345
- constructor(fBrowser) {
5346
- this.fBrowser = fBrowser;
5474
+ let SelectExecution = class SelectExecution {
5475
+ constructor(fDataContext, fDraggableDataContext) {
5476
+ this.fDataContext = fDataContext;
5477
+ this.fDraggableDataContext = fDraggableDataContext;
5347
5478
  }
5348
5479
  handle(request) {
5349
- return this.setRadiusFromElement(RoundedRect.fromRect(RectExtensions.fromElement(request.element)), request.element);
5350
- }
5351
- setRadiusFromElement(rect, element) {
5352
- const styles = this.getComputedStyle(element);
5353
- rect.radius1 = this.toPixels(styles.borderTopLeftRadius, element, styles.fontSize);
5354
- rect.radius2 = this.toPixels(styles.borderTopRightRadius, element, styles.fontSize);
5355
- rect.radius3 = this.toPixels(styles.borderBottomRightRadius, element, styles.fontSize);
5356
- rect.radius4 = this.toPixels(styles.borderBottomLeftRadius, element, styles.fontSize);
5357
- return rect;
5358
- }
5359
- getComputedStyle(element) {
5360
- return this.fBrowser.window.getComputedStyle(element);
5361
- }
5362
- toPixels(value, element, fontSize) {
5363
- return this.fBrowser.toPixels(value, element.clientWidth, element.clientHeight, fontSize) || 0;
5480
+ this.fDraggableDataContext.selectedItems.forEach((x) => {
5481
+ x.deselect();
5482
+ });
5483
+ this.fDraggableDataContext.selectedItems = [];
5484
+ request.nodes.forEach((key) => {
5485
+ const node = this.fDataContext.fNodes.find((x) => x.fId === key);
5486
+ if (node) {
5487
+ node.select();
5488
+ this.fDraggableDataContext.selectedItems.push(node);
5489
+ }
5490
+ });
5491
+ request.connections.forEach((key) => {
5492
+ const connection = this.fDataContext.fConnections.find((x) => x.fId === key);
5493
+ if (connection) {
5494
+ connection.select();
5495
+ this.fDraggableDataContext.selectedItems.push(connection);
5496
+ }
5497
+ });
5498
+ this.fDraggableDataContext.isSelectedChanged = true;
5364
5499
  }
5365
5500
  };
5366
- CreateRoundedRectFromElementExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CreateRoundedRectFromElementExecution, deps: [{ token: i1.BrowserService }], target: i0.ɵɵFactoryTarget.Injectable });
5367
- CreateRoundedRectFromElementExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CreateRoundedRectFromElementExecution });
5368
- CreateRoundedRectFromElementExecution = __decorate([
5369
- FExecutionRegister(CreateRoundedRectFromElementRequest)
5370
- ], CreateRoundedRectFromElementExecution);
5371
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CreateRoundedRectFromElementExecution, decorators: [{
5501
+ SelectExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SelectExecution, deps: [{ token: FComponentsStore }, { token: FDraggableDataContext }], target: i0.ɵɵFactoryTarget.Injectable });
5502
+ SelectExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SelectExecution });
5503
+ SelectExecution = __decorate([
5504
+ FExecutionRegister(SelectRequest)
5505
+ ], SelectExecution);
5506
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SelectExecution, decorators: [{
5372
5507
  type: Injectable
5373
- }], ctorParameters: function () { return [{ type: i1.BrowserService }]; } });
5508
+ }], ctorParameters: function () { return [{ type: FComponentsStore }, { type: FDraggableDataContext }]; } });
5374
5509
 
5375
- class EmitTransformChangesRequest {
5510
+ class SelectAllRequest {
5376
5511
  }
5377
5512
 
5378
- let EmitTransformChangesExecution = class EmitTransformChangesExecution {
5379
- constructor(fTransformStore) {
5380
- this.fTransformStore = fTransformStore;
5513
+ let SelectAllExecution = class SelectAllExecution {
5514
+ constructor(fDataContext, fDraggableDataContext) {
5515
+ this.fDataContext = fDataContext;
5516
+ this.fDraggableDataContext = fDraggableDataContext;
5381
5517
  }
5382
5518
  handle(request) {
5383
- this.fTransformStore.changes.next();
5519
+ this.fDraggableDataContext.selectedItems.forEach((x) => {
5520
+ x.deselect();
5521
+ });
5522
+ this.fDraggableDataContext.selectedItems = [];
5523
+ this.fDataContext.fNodes.forEach((x) => {
5524
+ x.select();
5525
+ this.fDraggableDataContext.selectedItems.push(x);
5526
+ });
5527
+ this.fDataContext.fConnections.forEach((x) => {
5528
+ x.select();
5529
+ this.fDraggableDataContext.selectedItems.push(x);
5530
+ });
5531
+ this.fDraggableDataContext.isSelectedChanged = true;
5384
5532
  }
5385
5533
  };
5386
- EmitTransformChangesExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: EmitTransformChangesExecution, deps: [{ token: FTransformStore }], target: i0.ɵɵFactoryTarget.Injectable });
5387
- EmitTransformChangesExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: EmitTransformChangesExecution });
5388
- EmitTransformChangesExecution = __decorate([
5389
- FExecutionRegister(EmitTransformChangesRequest)
5390
- ], EmitTransformChangesExecution);
5391
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: EmitTransformChangesExecution, decorators: [{
5534
+ SelectAllExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SelectAllExecution, deps: [{ token: FComponentsStore }, { token: FDraggableDataContext }], target: i0.ɵɵFactoryTarget.Injectable });
5535
+ SelectAllExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SelectAllExecution });
5536
+ SelectAllExecution = __decorate([
5537
+ FExecutionRegister(SelectAllRequest)
5538
+ ], SelectAllExecution);
5539
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SelectAllExecution, decorators: [{
5392
5540
  type: Injectable
5393
- }], ctorParameters: function () { return [{ type: FTransformStore }]; } });
5541
+ }], ctorParameters: function () { return [{ type: FComponentsStore }, { type: FDraggableDataContext }]; } });
5394
5542
 
5395
- class GetElementRectInFlowRequest {
5396
- constructor(element) {
5397
- this.element = element;
5543
+ class SelectAndUpdateNodeLayerRequest {
5544
+ constructor(fNode) {
5545
+ this.fNode = fNode;
5398
5546
  }
5399
5547
  }
5400
5548
 
5401
- let GetElementRectInFlowExecution = class GetElementRectInFlowExecution {
5402
- constructor(fComponentsStore, fMediator) {
5403
- this.fComponentsStore = fComponentsStore;
5404
- this.fMediator = fMediator;
5405
- }
5406
- get transform() {
5407
- return this.fComponentsStore.transform;
5408
- }
5409
- get flowHost() {
5410
- return this.fComponentsStore.flowHost;
5549
+ class MoveFrontElementsBeforeTargetElementRequest {
5550
+ constructor(fItemsContainer, // fGroupsContainer || fNodesContainer || fConnectionsContainer
5551
+ allElements, elementsThatShouldBeInFront, targetIndex) {
5552
+ this.fItemsContainer = fItemsContainer;
5553
+ this.allElements = allElements;
5554
+ this.elementsThatShouldBeInFront = elementsThatShouldBeInFront;
5555
+ this.targetIndex = targetIndex;
5411
5556
  }
5557
+ }
5558
+
5559
+ let MoveFrontElementsBeforeTargetElementExecution = class MoveFrontElementsBeforeTargetElementExecution {
5412
5560
  handle(request) {
5413
- const systemRect = this.fMediator.send(new CreateRoundedRectFromElementRequest(request.element));
5414
- const position = this.transformElementPositionInFlow(systemRect);
5415
- const size = this.transformElementSizeInFlow(systemRect);
5416
- return new RoundedRect(position.x, position.y, size.width, size.height, systemRect.radius1, systemRect.radius2, systemRect.radius3, systemRect.radius4);
5417
- }
5418
- transformElementPositionInFlow(rect) {
5419
- return Point.fromPoint(rect).elementTransform(this.flowHost).sub(this.transform.scaledPosition).sub(this.transform.position).div(this.transform.scale);
5420
- }
5421
- transformElementSizeInFlow(rect) {
5422
- return SizeExtensions.initialize(rect.width / this.transform.scale, rect.height / this.transform.scale);
5561
+ const elementsToMove = [];
5562
+ for (let i = request.targetIndex + 1; i < request.allElements.length; i++) {
5563
+ const element = request.allElements[i];
5564
+ if (!request.elementsThatShouldBeInFront.includes(element)) {
5565
+ elementsToMove.push(element);
5566
+ }
5567
+ }
5568
+ elementsToMove.forEach((x) => {
5569
+ request.fItemsContainer.removeChild(x);
5570
+ request.fItemsContainer.insertBefore(x, request.allElements[request.targetIndex]);
5571
+ });
5423
5572
  }
5424
5573
  };
5425
- GetElementRectInFlowExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetElementRectInFlowExecution, deps: [{ token: FComponentsStore }, { token: i2.FMediator }], target: i0.ɵɵFactoryTarget.Injectable });
5426
- GetElementRectInFlowExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetElementRectInFlowExecution });
5427
- GetElementRectInFlowExecution = __decorate([
5428
- FExecutionRegister(GetElementRectInFlowRequest)
5429
- ], GetElementRectInFlowExecution);
5430
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetElementRectInFlowExecution, decorators: [{
5574
+ MoveFrontElementsBeforeTargetElementExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MoveFrontElementsBeforeTargetElementExecution, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
5575
+ MoveFrontElementsBeforeTargetElementExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MoveFrontElementsBeforeTargetElementExecution });
5576
+ MoveFrontElementsBeforeTargetElementExecution = __decorate([
5577
+ FExecutionRegister(MoveFrontElementsBeforeTargetElementRequest)
5578
+ ], MoveFrontElementsBeforeTargetElementExecution);
5579
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MoveFrontElementsBeforeTargetElementExecution, decorators: [{
5431
5580
  type: Injectable
5432
- }], ctorParameters: function () { return [{ type: FComponentsStore }, { type: i2.FMediator }]; } });
5581
+ }] });
5433
5582
 
5434
- let GetCanBeSelectedItemsExecution = class GetCanBeSelectedItemsExecution {
5435
- constructor(fComponentsStore, fDraggableDataContext, fMediator) {
5436
- this.fComponentsStore = fComponentsStore;
5437
- this.fDraggableDataContext = fDraggableDataContext;
5438
- this.fMediator = fMediator;
5439
- }
5440
- get fNodes() {
5441
- return this.fComponentsStore.fNodes;
5442
- }
5443
- get fConnections() {
5444
- return this.fComponentsStore.fConnections;
5445
- }
5446
- get transform() {
5447
- return this.fComponentsStore.fCanvas.transform;
5448
- }
5449
- handle() {
5450
- return [...this.getNodesWithRects(), ...this.getConnectionsWithRects()].filter((x) => {
5451
- return !this.fDraggableDataContext.selectedItems.includes(x.element);
5452
- });
5453
- }
5454
- getNodesWithRects() {
5455
- return this.fNodes.filter((x) => !x.fSelectionDisabled).map((x) => {
5456
- return {
5457
- element: x,
5458
- rect: RectExtensions.mult(this.fMediator.send(new GetElementRectInFlowRequest(x.hostElement)), this.transform.scale)
5459
- };
5460
- });
5461
- }
5462
- getConnectionsWithRects() {
5463
- return this.fConnections.filter((x) => !x.fSelectionDisabled).map((x) => {
5464
- return {
5465
- element: x,
5466
- rect: RectExtensions.mult(this.fMediator.send(new GetElementRectInFlowRequest(x.boundingElement)), this.transform.scale)
5467
- };
5468
- });
5583
+ class UpdateItemAndChildrenLayersRequest {
5584
+ constructor(item, itemContainer) {
5585
+ this.item = item;
5586
+ this.itemContainer = itemContainer;
5469
5587
  }
5470
- };
5471
- GetCanBeSelectedItemsExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetCanBeSelectedItemsExecution, deps: [{ token: FComponentsStore }, { token: FDraggableDataContext }, { token: i2.FMediator }], target: i0.ɵɵFactoryTarget.Injectable });
5472
- GetCanBeSelectedItemsExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetCanBeSelectedItemsExecution });
5473
- GetCanBeSelectedItemsExecution = __decorate([
5474
- FExecutionRegister(GetCanBeSelectedItemsRequest)
5475
- ], GetCanBeSelectedItemsExecution);
5476
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetCanBeSelectedItemsExecution, decorators: [{
5477
- type: Injectable
5478
- }], ctorParameters: function () { return [{ type: FComponentsStore }, { type: FDraggableDataContext }, { type: i2.FMediator }]; } });
5588
+ }
5479
5589
 
5480
5590
  class GetDeepChildrenNodesAndGroupsRequest {
5481
5591
  constructor(fId) {
@@ -5511,36 +5621,239 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
5511
5621
  type: Injectable
5512
5622
  }], ctorParameters: function () { return [{ type: FComponentsStore }]; } });
5513
5623
 
5514
- class GetConnectionLineRequest {
5515
- constructor(outputRect, inputRect, behavior, outputSide, inputSide) {
5516
- this.outputRect = outputRect;
5517
- this.inputRect = inputRect;
5518
- this.behavior = behavior;
5519
- this.outputSide = outputSide;
5520
- this.inputSide = inputSide;
5624
+ let UpdateItemAndChildrenLayersExecution = class UpdateItemAndChildrenLayersExecution {
5625
+ constructor(fComponentsStore, fMediator) {
5626
+ this.fComponentsStore = fComponentsStore;
5627
+ this.fMediator = fMediator;
5521
5628
  }
5522
- }
5523
-
5524
- let GetConnectionLineExecution = class GetConnectionLineExecution {
5525
- constructor() {
5526
- this.behaviorHandlers = {
5527
- [EFConnectionBehavior.FLOATING.toString()]: this.floatingBehavior,
5528
- [EFConnectionBehavior.FIXED_CENTER.toString()]: this.fixedCenterBehavior,
5529
- [EFConnectionBehavior.FIXED.toString()]: this.fixedOutboundBehaviour,
5530
- };
5629
+ get fGroupsContainer() {
5630
+ return this.fComponentsStore.fCanvas.fGroupsContainer.nativeElement;
5531
5631
  }
5532
- handle(payload) {
5533
- return this.behaviorHandlers[payload.behavior](payload);
5632
+ get fNodesContainer() {
5633
+ return this.fComponentsStore.fCanvas.fNodesContainer.nativeElement;
5534
5634
  }
5535
- floatingBehavior(payload) {
5536
- const fromResult = GetIntersections.getRoundedRectIntersections(payload.outputRect.gravityCenter, payload.inputRect.gravityCenter, payload.outputRect)[0];
5537
- const toResult = GetIntersections.getRoundedRectIntersections(payload.inputRect.gravityCenter, payload.outputRect.gravityCenter, payload.inputRect)[0];
5538
- return new Line(fromResult ? fromResult : payload.outputRect.gravityCenter, toResult ? toResult : payload.inputRect.gravityCenter);
5635
+ get fConnectionsContainer() {
5636
+ return this.fComponentsStore.fCanvas.fConnectionsContainer.nativeElement;
5539
5637
  }
5540
- fixedCenterBehavior(payload) {
5541
- return new Line(payload.outputRect.gravityCenter, payload.inputRect.gravityCenter);
5638
+ handle(request) {
5639
+ switch (request.itemContainer) {
5640
+ case this.fGroupsContainer:
5641
+ this.handleGroup(request);
5642
+ break;
5643
+ case this.fNodesContainer:
5644
+ this.handleNode(request);
5645
+ break;
5646
+ case this.fConnectionsContainer:
5647
+ this.handleConnection(request);
5648
+ break;
5649
+ default:
5650
+ throw new Error('Unknown container');
5651
+ }
5542
5652
  }
5543
- fixedOutboundBehaviour(payload) {
5653
+ handleGroup(request) {
5654
+ const childrenNodesAndGroups = this.getChildrenNodesAndGroups(request.item.fId);
5655
+ const childrenGroups = this.getChildrenGroups(childrenNodesAndGroups);
5656
+ this.updateLayers(this.fGroupsContainer, request.item.hostElement, childrenGroups);
5657
+ const childrenNodes = this.getChildrenNodes(childrenNodesAndGroups);
5658
+ if (childrenNodes.length) {
5659
+ this.updateLayers(this.fNodesContainer, childrenNodes[0], childrenNodes);
5660
+ }
5661
+ }
5662
+ handleNode(request) {
5663
+ const childrenNodesAndGroups = this.getChildrenNodesAndGroups(request.item.fId);
5664
+ const childrenNodes = this.getChildrenNodes(childrenNodesAndGroups);
5665
+ this.updateLayers(request.itemContainer, request.item.hostElement, childrenNodes);
5666
+ }
5667
+ handleConnection(request) {
5668
+ this.updateLayers(request.itemContainer, request.item.hostElement, []);
5669
+ }
5670
+ updateLayers(itemContainer, item, elementsThatShouldBeInFront) {
5671
+ const allElements = Array.from(itemContainer.children);
5672
+ const targetIndex = allElements.findIndex((x) => x === item);
5673
+ if (this.isAnythingNeedToBeMoved(allElements, targetIndex, elementsThatShouldBeInFront)) {
5674
+ this.fMediator.send(new MoveFrontElementsBeforeTargetElementRequest(itemContainer, allElements, elementsThatShouldBeInFront, targetIndex));
5675
+ }
5676
+ }
5677
+ isAnythingNeedToBeMoved(allElements, targetIndex, elementsThatShouldBeInFront) {
5678
+ for (let i = targetIndex + 1; i < allElements.length; i++) {
5679
+ if (!elementsThatShouldBeInFront.includes(allElements[i])) {
5680
+ return true;
5681
+ }
5682
+ }
5683
+ return false;
5684
+ }
5685
+ getChildrenGroups(elements) {
5686
+ const allElements = Array.from(this.fGroupsContainer.children);
5687
+ return elements.filter((x) => this.fGroupsContainer.contains(x))
5688
+ .sort((a, b) => allElements.indexOf(a) - allElements.indexOf(b));
5689
+ }
5690
+ getChildrenNodes(elements) {
5691
+ const allElements = Array.from(this.fNodesContainer.children);
5692
+ return elements.filter((x) => this.fNodesContainer.contains(x))
5693
+ .sort((a, b) => allElements.indexOf(a) - allElements.indexOf(b));
5694
+ }
5695
+ getChildrenNodesAndGroups(fId) {
5696
+ return this.fMediator.send(new GetDeepChildrenNodesAndGroupsRequest(fId)).map((x) => x.hostElement);
5697
+ }
5698
+ };
5699
+ UpdateItemAndChildrenLayersExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: UpdateItemAndChildrenLayersExecution, deps: [{ token: FComponentsStore }, { token: i2.FMediator }], target: i0.ɵɵFactoryTarget.Injectable });
5700
+ UpdateItemAndChildrenLayersExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: UpdateItemAndChildrenLayersExecution });
5701
+ UpdateItemAndChildrenLayersExecution = __decorate([
5702
+ FExecutionRegister(UpdateItemAndChildrenLayersRequest)
5703
+ ], UpdateItemAndChildrenLayersExecution);
5704
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: UpdateItemAndChildrenLayersExecution, decorators: [{
5705
+ type: Injectable
5706
+ }], ctorParameters: function () { return [{ type: FComponentsStore }, { type: i2.FMediator }]; } });
5707
+
5708
+ let SelectAndUpdateNodeLayerExecution = class SelectAndUpdateNodeLayerExecution {
5709
+ constructor(fDraggableDataContext, fMediator) {
5710
+ this.fDraggableDataContext = fDraggableDataContext;
5711
+ this.fMediator = fMediator;
5712
+ }
5713
+ handle(request) {
5714
+ this.selectNodeIfNotSelected(request.fNode);
5715
+ this.fMediator.send(new UpdateItemAndChildrenLayersRequest(request.fNode, request.fNode.hostElement.parentElement));
5716
+ }
5717
+ selectNodeIfNotSelected(fNode) {
5718
+ if (!this.fDraggableDataContext.selectedItems.includes(fNode) && !fNode.fSelectionDisabled) {
5719
+ this.fDraggableDataContext.selectedItems.push(fNode);
5720
+ fNode.select();
5721
+ this.fDraggableDataContext.isSelectedChanged = true;
5722
+ }
5723
+ }
5724
+ };
5725
+ SelectAndUpdateNodeLayerExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SelectAndUpdateNodeLayerExecution, deps: [{ token: FDraggableDataContext }, { token: i2.FMediator }], target: i0.ɵɵFactoryTarget.Injectable });
5726
+ SelectAndUpdateNodeLayerExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SelectAndUpdateNodeLayerExecution });
5727
+ SelectAndUpdateNodeLayerExecution = __decorate([
5728
+ FExecutionRegister(SelectAndUpdateNodeLayerRequest)
5729
+ ], SelectAndUpdateNodeLayerExecution);
5730
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SelectAndUpdateNodeLayerExecution, decorators: [{
5731
+ type: Injectable
5732
+ }], ctorParameters: function () { return [{ type: FDraggableDataContext }, { type: i2.FMediator }]; } });
5733
+
5734
+ const F_SELECTION_FEATURES = [
5735
+ ClearSelectionExecution,
5736
+ GetSelectionExecution,
5737
+ SelectExecution,
5738
+ SelectAllExecution,
5739
+ SelectAndUpdateNodeLayerExecution
5740
+ ];
5741
+
5742
+ class GetElementRectInFlowRequest {
5743
+ constructor(element) {
5744
+ this.element = element;
5745
+ }
5746
+ }
5747
+
5748
+ let GetElementRectInFlowExecution = class GetElementRectInFlowExecution {
5749
+ constructor(fComponentsStore, fMediator) {
5750
+ this.fComponentsStore = fComponentsStore;
5751
+ this.fMediator = fMediator;
5752
+ }
5753
+ get transform() {
5754
+ return this.fComponentsStore.transform;
5755
+ }
5756
+ get flowHost() {
5757
+ return this.fComponentsStore.flowHost;
5758
+ }
5759
+ handle(request) {
5760
+ const systemRect = this.fMediator.send(new CreateRoundedRectFromElementRequest(request.element));
5761
+ const position = this.transformElementPositionInFlow(systemRect);
5762
+ const size = this.transformElementSizeInFlow(systemRect);
5763
+ return new RoundedRect(position.x, position.y, size.width, size.height, systemRect.radius1, systemRect.radius2, systemRect.radius3, systemRect.radius4);
5764
+ }
5765
+ transformElementPositionInFlow(rect) {
5766
+ return Point.fromPoint(rect).elementTransform(this.flowHost).sub(this.transform.scaledPosition).sub(this.transform.position).div(this.transform.scale);
5767
+ }
5768
+ transformElementSizeInFlow(rect) {
5769
+ return SizeExtensions.initialize(rect.width / this.transform.scale, rect.height / this.transform.scale);
5770
+ }
5771
+ };
5772
+ GetElementRectInFlowExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetElementRectInFlowExecution, deps: [{ token: FComponentsStore }, { token: i2.FMediator }], target: i0.ɵɵFactoryTarget.Injectable });
5773
+ GetElementRectInFlowExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetElementRectInFlowExecution });
5774
+ GetElementRectInFlowExecution = __decorate([
5775
+ FExecutionRegister(GetElementRectInFlowRequest)
5776
+ ], GetElementRectInFlowExecution);
5777
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetElementRectInFlowExecution, decorators: [{
5778
+ type: Injectable
5779
+ }], ctorParameters: function () { return [{ type: FComponentsStore }, { type: i2.FMediator }]; } });
5780
+
5781
+ let GetCanBeSelectedItemsExecution = class GetCanBeSelectedItemsExecution {
5782
+ constructor(fComponentsStore, fDraggableDataContext, fMediator) {
5783
+ this.fComponentsStore = fComponentsStore;
5784
+ this.fDraggableDataContext = fDraggableDataContext;
5785
+ this.fMediator = fMediator;
5786
+ }
5787
+ get fNodes() {
5788
+ return this.fComponentsStore.fNodes;
5789
+ }
5790
+ get fConnections() {
5791
+ return this.fComponentsStore.fConnections;
5792
+ }
5793
+ get transform() {
5794
+ return this.fComponentsStore.fCanvas.transform;
5795
+ }
5796
+ handle() {
5797
+ return [...this.getNodesWithRects(), ...this.getConnectionsWithRects()].filter((x) => {
5798
+ return !this.fDraggableDataContext.selectedItems.includes(x.element);
5799
+ });
5800
+ }
5801
+ getNodesWithRects() {
5802
+ return this.fNodes.filter((x) => !x.fSelectionDisabled).map((x) => {
5803
+ return {
5804
+ element: x,
5805
+ rect: RectExtensions.mult(this.fMediator.send(new GetElementRectInFlowRequest(x.hostElement)), this.transform.scale)
5806
+ };
5807
+ });
5808
+ }
5809
+ getConnectionsWithRects() {
5810
+ return this.fConnections.filter((x) => !x.fSelectionDisabled).map((x) => {
5811
+ return {
5812
+ element: x,
5813
+ rect: RectExtensions.mult(this.fMediator.send(new GetElementRectInFlowRequest(x.boundingElement)), this.transform.scale)
5814
+ };
5815
+ });
5816
+ }
5817
+ };
5818
+ GetCanBeSelectedItemsExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetCanBeSelectedItemsExecution, deps: [{ token: FComponentsStore }, { token: FDraggableDataContext }, { token: i2.FMediator }], target: i0.ɵɵFactoryTarget.Injectable });
5819
+ GetCanBeSelectedItemsExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetCanBeSelectedItemsExecution });
5820
+ GetCanBeSelectedItemsExecution = __decorate([
5821
+ FExecutionRegister(GetCanBeSelectedItemsRequest)
5822
+ ], GetCanBeSelectedItemsExecution);
5823
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetCanBeSelectedItemsExecution, decorators: [{
5824
+ type: Injectable
5825
+ }], ctorParameters: function () { return [{ type: FComponentsStore }, { type: FDraggableDataContext }, { type: i2.FMediator }]; } });
5826
+
5827
+ class GetConnectionLineRequest {
5828
+ constructor(outputRect, inputRect, behavior, outputSide, inputSide) {
5829
+ this.outputRect = outputRect;
5830
+ this.inputRect = inputRect;
5831
+ this.behavior = behavior;
5832
+ this.outputSide = outputSide;
5833
+ this.inputSide = inputSide;
5834
+ }
5835
+ }
5836
+
5837
+ let GetConnectionLineExecution = class GetConnectionLineExecution {
5838
+ constructor() {
5839
+ this.behaviorHandlers = {
5840
+ [EFConnectionBehavior.FLOATING.toString()]: this.floatingBehavior,
5841
+ [EFConnectionBehavior.FIXED_CENTER.toString()]: this.fixedCenterBehavior,
5842
+ [EFConnectionBehavior.FIXED.toString()]: this.fixedOutboundBehaviour,
5843
+ };
5844
+ }
5845
+ handle(payload) {
5846
+ return this.behaviorHandlers[payload.behavior](payload);
5847
+ }
5848
+ floatingBehavior(payload) {
5849
+ const fromResult = GetIntersections.getRoundedRectIntersections(payload.outputRect.gravityCenter, payload.inputRect.gravityCenter, payload.outputRect)[0];
5850
+ const toResult = GetIntersections.getRoundedRectIntersections(payload.inputRect.gravityCenter, payload.outputRect.gravityCenter, payload.inputRect)[0];
5851
+ return new Line(fromResult ? fromResult : payload.outputRect.gravityCenter, toResult ? toResult : payload.inputRect.gravityCenter);
5852
+ }
5853
+ fixedCenterBehavior(payload) {
5854
+ return new Line(payload.outputRect.gravityCenter, payload.inputRect.gravityCenter);
5855
+ }
5856
+ fixedOutboundBehaviour(payload) {
5544
5857
  return new Line(positionFixedOutbound[payload.outputSide === EFConnectableSide.AUTO ? EFConnectableSide.BOTTOM : payload.outputSide](payload.outputRect), positionFixedOutbound[payload.inputSide === EFConnectableSide.AUTO ? EFConnectableSide.TOP : payload.inputSide](payload.inputRect));
5545
5858
  }
5546
5859
  };
@@ -5722,41 +6035,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
5722
6035
  type: Injectable
5723
6036
  }], ctorParameters: function () { return [{ type: FComponentsStore }]; } });
5724
6037
 
5725
- class GetInputRectInFlowRequest {
5726
- constructor(fInputId) {
5727
- this.fInputId = fInputId;
5728
- }
5729
- }
5730
-
5731
- class GetInputRectInFlowResponse {
5732
- constructor(rect, fConnectableSide) {
5733
- this.rect = rect;
5734
- this.fConnectableSide = fConnectableSide;
5735
- }
5736
- }
5737
-
5738
- let GetInputRectInFlowExecution = class GetInputRectInFlowExecution {
5739
- constructor(fComponentsStore, fMediator) {
5740
- this.fComponentsStore = fComponentsStore;
5741
- this.fMediator = fMediator;
5742
- }
5743
- handle(request) {
5744
- const input = this.fComponentsStore.fInputs.find((x) => x.id === request.fInputId);
5745
- if (!input) {
5746
- throw InputNotFound(request.fInputId);
5747
- }
5748
- return new GetInputRectInFlowResponse(this.fMediator.send(new GetElementRectInFlowRequest(input.hostElement)), input.fConnectableSide);
5749
- }
5750
- };
5751
- GetInputRectInFlowExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetInputRectInFlowExecution, deps: [{ token: FComponentsStore }, { token: i2.FMediator }], target: i0.ɵɵFactoryTarget.Injectable });
5752
- GetInputRectInFlowExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetInputRectInFlowExecution });
5753
- GetInputRectInFlowExecution = __decorate([
5754
- FExecutionRegister(GetInputRectInFlowRequest)
5755
- ], GetInputRectInFlowExecution);
5756
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetInputRectInFlowExecution, decorators: [{
5757
- type: Injectable
5758
- }], ctorParameters: function () { return [{ type: FComponentsStore }, { type: i2.FMediator }]; } });
5759
-
5760
6038
  class GetNodesRectRequest {
5761
6039
  }
5762
6040
 
@@ -5783,45 +6061,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
5783
6061
  type: Injectable
5784
6062
  }], ctorParameters: function () { return [{ type: FComponentsStore }]; } });
5785
6063
 
5786
- class GetOutputRectInFlowRequest {
5787
- constructor(fOutputId) {
5788
- this.fOutputId = fOutputId;
5789
- }
5790
- }
5791
-
5792
- class GetOutputRectInFlowResponse {
5793
- constructor(rect, fConnectableSide) {
5794
- this.rect = rect;
5795
- this.fConnectableSide = fConnectableSide;
5796
- }
5797
- }
5798
-
5799
- let GetOutputRectInFlowExecution = class GetOutputRectInFlowExecution {
5800
- constructor(fComponentsStore, fMediator) {
5801
- this.fComponentsStore = fComponentsStore;
5802
- this.fMediator = fMediator;
5803
- }
5804
- handle(request) {
5805
- let output = this.fComponentsStore.fOutputs.find((x) => x.id === request.fOutputId);
5806
- if (!output) {
5807
- output = this.fComponentsStore.fOutlets.find((x) => x.id === request.fOutputId);
5808
- }
5809
- if (!output) {
5810
- throw OutputNotFound(request.fOutputId);
5811
- }
5812
- const result = this.fMediator.send(new GetElementRectInFlowRequest(output.hostElement));
5813
- return new GetOutputRectInFlowResponse(result, output.fConnectableSide);
5814
- }
5815
- };
5816
- GetOutputRectInFlowExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetOutputRectInFlowExecution, deps: [{ token: FComponentsStore }, { token: i2.FMediator }], target: i0.ɵɵFactoryTarget.Injectable });
5817
- GetOutputRectInFlowExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetOutputRectInFlowExecution });
5818
- GetOutputRectInFlowExecution = __decorate([
5819
- FExecutionRegister(GetOutputRectInFlowRequest)
5820
- ], GetOutputRectInFlowExecution);
5821
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetOutputRectInFlowExecution, decorators: [{
5822
- type: Injectable
5823
- }], ctorParameters: function () { return [{ type: FComponentsStore }, { type: i2.FMediator }]; } });
5824
-
5825
6064
  class GetPositionInFlowRequest {
5826
6065
  constructor(position) {
5827
6066
  this.position = position;
@@ -5852,47 +6091,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
5852
6091
  type: Injectable
5853
6092
  }], ctorParameters: function () { return [{ type: FComponentsStore }]; } });
5854
6093
 
5855
- class GetSelectionRequest {
5856
- }
5857
-
5858
- let GetSelectionExecution = class GetSelectionExecution {
5859
- constructor(fDraggableDataContext) {
6094
+ let IsConnectionUnderNodeExecution = class IsConnectionUnderNodeExecution {
6095
+ constructor(fComponentsStore, fDraggableDataContext, fMediator) {
6096
+ this.fComponentsStore = fComponentsStore;
5860
6097
  this.fDraggableDataContext = fDraggableDataContext;
5861
- }
5862
- handle() {
5863
- let selectedNodes = [];
5864
- let selectedConnections = [];
5865
- this.fDraggableDataContext.selectedItems.forEach((x) => {
5866
- if (x.hostElement.classList.contains('f-node')) {
5867
- selectedNodes.push(x.hostElement.dataset['fNodeId']);
5868
- }
5869
- else {
5870
- selectedConnections.push(x.hostElement.id);
5871
- }
5872
- });
5873
- return new FSelectionChangeEvent(selectedNodes, selectedConnections);
5874
- }
5875
- };
5876
- GetSelectionExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetSelectionExecution, deps: [{ token: FDraggableDataContext }], target: i0.ɵɵFactoryTarget.Injectable });
5877
- GetSelectionExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetSelectionExecution });
5878
- GetSelectionExecution = __decorate([
5879
- FExecutionRegister(GetSelectionRequest)
5880
- ], GetSelectionExecution);
5881
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: GetSelectionExecution, decorators: [{
5882
- type: Injectable
5883
- }], ctorParameters: function () { return [{ type: FDraggableDataContext }]; } });
5884
-
5885
- let IsConnectionUnderNodeExecution = class IsConnectionUnderNodeExecution {
5886
- constructor(fComponentsStore, fDraggableDataContext, fMediator) {
5887
- this.fComponentsStore = fComponentsStore;
5888
- this.fDraggableDataContext = fDraggableDataContext;
5889
- this.fMediator = fMediator;
5890
- }
5891
- get transform() {
5892
- return this.fComponentsStore.fCanvas.transform;
5893
- }
5894
- get flowHost() {
5895
- return this.fComponentsStore.fFlow.hostElement;
6098
+ this.fMediator = fMediator;
6099
+ }
6100
+ get transform() {
6101
+ return this.fComponentsStore.fCanvas.transform;
6102
+ }
6103
+ get flowHost() {
6104
+ return this.fComponentsStore.fFlow.hostElement;
5896
6105
  }
5897
6106
  handle() {
5898
6107
  const isValid = this.isValidRequest();
@@ -5960,6 +6169,9 @@ let RedrawConnectionsExecution = class RedrawConnectionsExecution {
5960
6169
  if (this.fComponentsStore.fTempConnection) {
5961
6170
  this.setMarkers(this.fComponentsStore.fTempConnection);
5962
6171
  }
6172
+ if (this.fComponentsStore.fSnapConnection) {
6173
+ this.setMarkers(this.fComponentsStore.fSnapConnection);
6174
+ }
5963
6175
  this.fComponentsStore.fConnections.forEach((connection) => {
5964
6176
  const output = this.fComponentsStore.fOutputs.find((x) => x.id === connection.fOutputId);
5965
6177
  const input = this.fComponentsStore.fInputs.find((x) => x.id === connection.fInputId);
@@ -5999,421 +6211,592 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
5999
6211
  type: Injectable
6000
6212
  }], ctorParameters: function () { return [{ type: FComponentsStore }, { type: i2.FMediator }]; } });
6001
6213
 
6002
- class SelectRequest {
6003
- constructor(nodes, connections) {
6004
- this.nodes = nodes;
6005
- this.connections = connections;
6006
- }
6214
+ class ShowConnectionsAfterCalculationsRequest {
6007
6215
  }
6008
6216
 
6009
- let SelectExecution = class SelectExecution {
6010
- constructor(fDataContext, fDraggableDataContext) {
6011
- this.fDataContext = fDataContext;
6012
- this.fDraggableDataContext = fDraggableDataContext;
6217
+ let ShowConnectionsAfterCalculationsExecution = class ShowConnectionsAfterCalculationsExecution {
6218
+ constructor(fComponentsStore) {
6219
+ this.fComponentsStore = fComponentsStore;
6013
6220
  }
6014
6221
  handle(request) {
6015
- this.fDraggableDataContext.selectedItems.forEach((x) => {
6016
- x.deselect();
6017
- });
6018
- this.fDraggableDataContext.selectedItems = [];
6019
- request.nodes.forEach((key) => {
6020
- const node = this.fDataContext.fNodes.find((x) => x.fId === key);
6021
- if (node) {
6022
- node.select();
6023
- this.fDraggableDataContext.selectedItems.push(node);
6024
- }
6025
- });
6026
- request.connections.forEach((key) => {
6027
- const connection = this.fDataContext.fConnections.find((x) => x.fId === key);
6028
- if (connection) {
6029
- connection.select();
6030
- this.fDraggableDataContext.selectedItems.push(connection);
6031
- }
6222
+ this.fComponentsStore.fConnections.forEach((connection) => {
6223
+ connection.hostElement.style.display = 'unset';
6032
6224
  });
6033
- this.fDraggableDataContext.isSelectedChanged = true;
6034
6225
  }
6035
6226
  };
6036
- SelectExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SelectExecution, deps: [{ token: FComponentsStore }, { token: FDraggableDataContext }], target: i0.ɵɵFactoryTarget.Injectable });
6037
- SelectExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SelectExecution });
6038
- SelectExecution = __decorate([
6039
- FExecutionRegister(SelectRequest)
6040
- ], SelectExecution);
6041
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SelectExecution, decorators: [{
6227
+ ShowConnectionsAfterCalculationsExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ShowConnectionsAfterCalculationsExecution, deps: [{ token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Injectable });
6228
+ ShowConnectionsAfterCalculationsExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ShowConnectionsAfterCalculationsExecution });
6229
+ ShowConnectionsAfterCalculationsExecution = __decorate([
6230
+ FExecutionRegister(ShowConnectionsAfterCalculationsRequest)
6231
+ ], ShowConnectionsAfterCalculationsExecution);
6232
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ShowConnectionsAfterCalculationsExecution, decorators: [{
6042
6233
  type: Injectable
6043
- }], ctorParameters: function () { return [{ type: FComponentsStore }, { type: FDraggableDataContext }]; } });
6234
+ }], ctorParameters: function () { return [{ type: FComponentsStore }]; } });
6044
6235
 
6045
- class SelectAllRequest {
6236
+ class SortNodeLayersRequest {
6046
6237
  }
6047
6238
 
6048
- let SelectAllExecution = class SelectAllExecution {
6049
- constructor(fDataContext, fDraggableDataContext) {
6050
- this.fDataContext = fDataContext;
6051
- this.fDraggableDataContext = fDraggableDataContext;
6239
+ let SortNodeLayersExecution = class SortNodeLayersExecution {
6240
+ constructor(fComponentsStore, fMediator, fBrowser) {
6241
+ this.fComponentsStore = fComponentsStore;
6242
+ this.fMediator = fMediator;
6243
+ this.fBrowser = fBrowser;
6244
+ }
6245
+ get fGroupsContainer() {
6246
+ return this.fComponentsStore.fCanvas.fGroupsContainer.nativeElement;
6247
+ }
6248
+ get fNodesContainer() {
6249
+ return this.fComponentsStore.fCanvas.fNodesContainer.nativeElement;
6250
+ }
6251
+ get fNodesContainerElements() {
6252
+ return Array.from(this.fNodesContainer.children);
6052
6253
  }
6053
6254
  handle(request) {
6054
- this.fDraggableDataContext.selectedItems.forEach((x) => {
6055
- x.deselect();
6056
- });
6057
- this.fDraggableDataContext.selectedItems = [];
6058
- this.fDataContext.fNodes.forEach((x) => {
6059
- x.select();
6060
- this.fDraggableDataContext.selectedItems.push(x);
6061
- });
6062
- this.fDataContext.fConnections.forEach((x) => {
6063
- x.select();
6064
- this.fDraggableDataContext.selectedItems.push(x);
6255
+ this.getGroups().forEach((parent) => {
6256
+ this.moveChildrenNodes(this.getSortedChildrenNodes(parent));
6065
6257
  });
6066
- this.fDraggableDataContext.isSelectedChanged = true;
6067
6258
  }
6068
- };
6069
- SelectAllExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SelectAllExecution, deps: [{ token: FComponentsStore }, { token: FDraggableDataContext }], target: i0.ɵɵFactoryTarget.Injectable });
6070
- SelectAllExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SelectAllExecution });
6071
- SelectAllExecution = __decorate([
6072
- FExecutionRegister(SelectAllRequest)
6073
- ], SelectAllExecution);
6074
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SelectAllExecution, decorators: [{
6075
- type: Injectable
6076
- }], ctorParameters: function () { return [{ type: FComponentsStore }, { type: FDraggableDataContext }]; } });
6077
-
6078
- class SelectAndUpdateNodeLayerRequest {
6079
- constructor(node) {
6080
- this.node = node;
6259
+ getGroups() {
6260
+ return this.fComponentsStore.fNodes.filter((x) => this.fGroupsContainer.contains(x.hostElement));
6081
6261
  }
6082
- }
6083
-
6084
- class MoveFrontElementsBeforeTargetElementRequest {
6085
- constructor(fItemsContainer, // fGroupsContainer || fNodesContainer || fConnectionsContainer
6086
- allElements, elementsThatShouldBeInFront, targetIndex) {
6087
- this.fItemsContainer = fItemsContainer;
6088
- this.allElements = allElements;
6089
- this.elementsThatShouldBeInFront = elementsThatShouldBeInFront;
6090
- this.targetIndex = targetIndex;
6262
+ getSortedChildrenNodes(parent) {
6263
+ const allElements = this.fNodesContainerElements;
6264
+ return this.getChildrenNodes(parent.fId)
6265
+ .sort((a, b) => allElements.indexOf(a) - allElements.indexOf(b));
6091
6266
  }
6092
- }
6093
-
6094
- let MoveFrontElementsBeforeTargetElementExecution = class MoveFrontElementsBeforeTargetElementExecution {
6095
- handle(request) {
6096
- const elementsToMove = [];
6097
- for (let i = request.targetIndex + 1; i < request.allElements.length; i++) {
6098
- const element = request.allElements[i];
6099
- if (!request.elementsThatShouldBeInFront.includes(element)) {
6100
- elementsToMove.push(element);
6101
- }
6102
- }
6103
- elementsToMove.forEach((x) => {
6104
- request.fItemsContainer.removeChild(x);
6105
- request.fItemsContainer.insertBefore(x, request.allElements[request.targetIndex]);
6267
+ getChildrenNodes(fId) {
6268
+ return this.fMediator.send(new GetDeepChildrenNodesAndGroupsRequest(fId))
6269
+ .filter((x) => this.fNodesContainer.contains(x.hostElement)).map((x) => x.hostElement);
6270
+ }
6271
+ moveChildrenNodes(sortedChildrenGroups) {
6272
+ const fragment = this.fBrowser.document.createDocumentFragment();
6273
+ sortedChildrenGroups.forEach((childGroup) => {
6274
+ fragment.appendChild(childGroup); // Append automatically removes the element from its current position
6106
6275
  });
6276
+ this.fNodesContainer.appendChild(fragment);
6107
6277
  }
6108
6278
  };
6109
- MoveFrontElementsBeforeTargetElementExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MoveFrontElementsBeforeTargetElementExecution, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6110
- MoveFrontElementsBeforeTargetElementExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MoveFrontElementsBeforeTargetElementExecution });
6111
- MoveFrontElementsBeforeTargetElementExecution = __decorate([
6112
- FExecutionRegister(MoveFrontElementsBeforeTargetElementRequest)
6113
- ], MoveFrontElementsBeforeTargetElementExecution);
6114
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MoveFrontElementsBeforeTargetElementExecution, decorators: [{
6279
+ SortNodeLayersExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SortNodeLayersExecution, deps: [{ token: FComponentsStore }, { token: i2.FMediator }, { token: i1.BrowserService }], target: i0.ɵɵFactoryTarget.Injectable });
6280
+ SortNodeLayersExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SortNodeLayersExecution });
6281
+ SortNodeLayersExecution = __decorate([
6282
+ FExecutionRegister(SortNodeLayersRequest)
6283
+ ], SortNodeLayersExecution);
6284
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SortNodeLayersExecution, decorators: [{
6115
6285
  type: Injectable
6116
- }] });
6286
+ }], ctorParameters: function () { return [{ type: FComponentsStore }, { type: i2.FMediator }, { type: i1.BrowserService }]; } });
6117
6287
 
6118
- class UpdateItemAndChildrenLayersRequest {
6119
- constructor(item, itemContainer) {
6120
- this.item = item;
6121
- this.itemContainer = itemContainer;
6288
+ class SortItemsByParentRequest {
6289
+ constructor(fItemsContainer // fGroupsContainer || fNodesContainer
6290
+ ) {
6291
+ this.fItemsContainer = fItemsContainer;
6122
6292
  }
6123
6293
  }
6124
6294
 
6125
- let UpdateItemAndChildrenLayersExecution = class UpdateItemAndChildrenLayersExecution {
6126
- constructor(fComponentsStore, fMediator) {
6295
+ let SortItemsByParentExecution = class SortItemsByParentExecution {
6296
+ constructor(fComponentsStore, fMediator, fBrowser) {
6127
6297
  this.fComponentsStore = fComponentsStore;
6128
6298
  this.fMediator = fMediator;
6299
+ this.fBrowser = fBrowser;
6129
6300
  }
6130
- get fGroupsContainer() {
6131
- return this.fComponentsStore.fCanvas.fGroupsContainer.nativeElement;
6132
- }
6133
- get fNodesContainer() {
6134
- return this.fComponentsStore.fCanvas.fNodesContainer.nativeElement;
6135
- }
6136
- get fConnectionsContainer() {
6137
- return this.fComponentsStore.fCanvas.fConnectionsContainer.nativeElement;
6301
+ get fItemsFromContainer() {
6302
+ return Array.from(this.fItemsContainer.children);
6138
6303
  }
6139
6304
  handle(request) {
6140
- switch (request.itemContainer) {
6141
- case this.fGroupsContainer:
6142
- this.handleGroup(request);
6143
- break;
6144
- case this.fNodesContainer:
6145
- this.handleNode(request);
6146
- break;
6147
- case this.fConnectionsContainer:
6148
- this.handleConnection(request);
6149
- break;
6150
- default:
6151
- throw new Error('Unknown container');
6152
- }
6305
+ this.fItemsContainer = request.fItemsContainer;
6306
+ this.getItems().forEach((parent) => {
6307
+ this.moveChildrenItems(this.getSortedChildrenItems(parent), parent);
6308
+ });
6153
6309
  }
6154
- handleGroup(request) {
6155
- const childrenNodesAndGroups = this.getChildrenNodesAndGroups(request.item.fId);
6156
- const childrenGroups = this.getChildrenGroups(childrenNodesAndGroups);
6157
- this.updateLayers(this.fGroupsContainer, request.item.hostElement, childrenGroups);
6158
- const childrenNodes = this.getChildrenNodes(childrenNodesAndGroups);
6159
- if (childrenNodes.length) {
6160
- this.updateLayers(this.fNodesContainer, childrenNodes[0], childrenNodes);
6161
- }
6310
+ getItems() {
6311
+ return this.fComponentsStore.fNodes.filter((x) => this.fItemsContainer.contains(x.hostElement));
6162
6312
  }
6163
- handleNode(request) {
6164
- const childrenNodesAndGroups = this.getChildrenNodesAndGroups(request.item.fId);
6165
- const childrenNodes = this.getChildrenNodes(childrenNodesAndGroups);
6166
- this.updateLayers(request.itemContainer, request.item.hostElement, childrenNodes);
6313
+ getSortedChildrenItems(parent) {
6314
+ const allElements = this.fItemsFromContainer;
6315
+ const parentIndex = allElements.indexOf(parent.hostElement);
6316
+ return this.getChildrenGroups(parent.fId)
6317
+ .filter((child) => allElements.indexOf(child) < parentIndex)
6318
+ .sort((a, b) => allElements.indexOf(a) - allElements.indexOf(b));
6167
6319
  }
6168
- handleConnection(request) {
6169
- this.updateLayers(request.itemContainer, request.item.hostElement, []);
6320
+ getChildrenGroups(fId) {
6321
+ return this.fMediator.send(new GetDeepChildrenNodesAndGroupsRequest(fId))
6322
+ .filter((x) => this.fItemsContainer.contains(x.hostElement)).map((x) => x.hostElement);
6170
6323
  }
6171
- updateLayers(itemContainer, item, elementsThatShouldBeInFront) {
6172
- const allElements = Array.from(itemContainer.children);
6173
- const targetIndex = allElements.findIndex((x) => x === item);
6174
- if (this.isAnythingNeedToBeMoved(allElements, targetIndex, elementsThatShouldBeInFront)) {
6175
- this.fMediator.send(new MoveFrontElementsBeforeTargetElementRequest(itemContainer, allElements, elementsThatShouldBeInFront, targetIndex));
6176
- }
6324
+ moveChildrenItems(sortedChildrenItems, parent) {
6325
+ let nextSibling = parent.hostElement.nextElementSibling;
6326
+ const fragment = this.fBrowser.document.createDocumentFragment();
6327
+ sortedChildrenItems.forEach((child) => {
6328
+ fragment.appendChild(child); // Append automatically removes the element from its current position
6329
+ });
6330
+ this.fItemsContainer.insertBefore(fragment, nextSibling);
6177
6331
  }
6178
- isAnythingNeedToBeMoved(allElements, targetIndex, elementsThatShouldBeInFront) {
6179
- for (let i = targetIndex + 1; i < allElements.length; i++) {
6180
- if (!elementsThatShouldBeInFront.includes(allElements[i])) {
6181
- return true;
6182
- }
6332
+ };
6333
+ SortItemsByParentExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SortItemsByParentExecution, deps: [{ token: FComponentsStore }, { token: i2.FMediator }, { token: i1.BrowserService }], target: i0.ɵɵFactoryTarget.Injectable });
6334
+ SortItemsByParentExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SortItemsByParentExecution });
6335
+ SortItemsByParentExecution = __decorate([
6336
+ FExecutionRegister(SortItemsByParentRequest)
6337
+ ], SortItemsByParentExecution);
6338
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SortItemsByParentExecution, decorators: [{
6339
+ type: Injectable
6340
+ }], ctorParameters: function () { return [{ type: FComponentsStore }, { type: i2.FMediator }, { type: i1.BrowserService }]; } });
6341
+
6342
+ class SortItemLayersRequest {
6343
+ }
6344
+
6345
+ let SortItemLayersExecution = class SortItemLayersExecution {
6346
+ constructor(fMediator, fComponentsStore) {
6347
+ this.fMediator = fMediator;
6348
+ this.fComponentsStore = fComponentsStore;
6349
+ }
6350
+ handle(request) {
6351
+ this.fMediator.send(new SortItemsByParentRequest(this.fComponentsStore.fCanvas.fGroupsContainer.nativeElement));
6352
+ this.fMediator.send(new SortNodeLayersRequest());
6353
+ this.fMediator.send(new SortItemsByParentRequest(this.fComponentsStore.fCanvas.fNodesContainer.nativeElement));
6354
+ }
6355
+ };
6356
+ SortItemLayersExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SortItemLayersExecution, deps: [{ token: i2.FMediator }, { token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Injectable });
6357
+ SortItemLayersExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SortItemLayersExecution });
6358
+ SortItemLayersExecution = __decorate([
6359
+ FExecutionRegister(SortItemLayersRequest)
6360
+ ], SortItemLayersExecution);
6361
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SortItemLayersExecution, decorators: [{
6362
+ type: Injectable
6363
+ }], ctorParameters: function () { return [{ type: i2.FMediator }, { type: FComponentsStore }]; } });
6364
+
6365
+ class SubscribeOnTransformChangesRequest {
6366
+ }
6367
+
6368
+ let SubscribeOnTransformChangesExecution = class SubscribeOnTransformChangesExecution {
6369
+ constructor(fTransformStore, fComponentsStore) {
6370
+ this.fTransformStore = fTransformStore;
6371
+ this.fComponentsStore = fComponentsStore;
6372
+ }
6373
+ handle(request) {
6374
+ return merge(this.fTransformStore.changes, this.fComponentsStore.componentsData$, this.fComponentsStore.componentsCount$);
6375
+ }
6376
+ };
6377
+ SubscribeOnTransformChangesExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SubscribeOnTransformChangesExecution, deps: [{ token: FTransformStore }, { token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Injectable });
6378
+ SubscribeOnTransformChangesExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SubscribeOnTransformChangesExecution });
6379
+ SubscribeOnTransformChangesExecution = __decorate([
6380
+ FExecutionRegister(SubscribeOnTransformChangesRequest)
6381
+ ], SubscribeOnTransformChangesExecution);
6382
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SubscribeOnTransformChangesExecution, decorators: [{
6383
+ type: Injectable
6384
+ }], ctorParameters: function () { return [{ type: FTransformStore }, { type: FComponentsStore }]; } });
6385
+
6386
+ const F_CANVAS_ANIMATION_DURATION = 150;
6387
+
6388
+ function createSVGElement(tag, fBrowser) {
6389
+ return fBrowser.document.createElementNS('http://www.w3.org/2000/svg', tag);
6390
+ }
6391
+
6392
+ class CenterGroupOrNodeRequest {
6393
+ constructor(id, animated) {
6394
+ this.id = id;
6395
+ this.animated = animated;
6396
+ }
6397
+ }
6398
+
6399
+ let CenterGroupOrNodeExecution = class CenterGroupOrNodeExecution {
6400
+ constructor(fComponentsStore) {
6401
+ this.fComponentsStore = fComponentsStore;
6402
+ }
6403
+ get transform() {
6404
+ return this.fComponentsStore.fCanvas.transform;
6405
+ }
6406
+ handle(request) {
6407
+ const fNode = this.getNode(request.id);
6408
+ if (!fNode) {
6409
+ return;
6183
6410
  }
6184
- return false;
6411
+ this.toCenter(this.getNodeRect(fNode), this.getFlowRect(), fNode.position);
6412
+ request.animated ? this.fComponentsStore.fCanvas.redrawWithAnimation() : this.fComponentsStore.fCanvas.redraw();
6413
+ this.fComponentsStore.fCanvas.emitCanvasChangeEvent();
6414
+ setTimeout(() => this.fComponentsStore.componentDataChanged(), F_CANVAS_ANIMATION_DURATION);
6185
6415
  }
6186
- getChildrenGroups(elements) {
6187
- const allElements = Array.from(this.fGroupsContainer.children);
6188
- return elements.filter((x) => this.fGroupsContainer.contains(x))
6189
- .sort((a, b) => allElements.indexOf(a) - allElements.indexOf(b));
6416
+ toCenter(fNodeRect, fFlowRect, position) {
6417
+ this.transform.scaledPosition = PointExtensions.initialize();
6418
+ this.transform.position = PointExtensions.initialize((fFlowRect.width - fNodeRect.width) / 2 - position.x * this.transform.scale, (fFlowRect.height - fNodeRect.height) / 2 - position.y * this.transform.scale);
6190
6419
  }
6191
- getChildrenNodes(elements) {
6192
- const allElements = Array.from(this.fNodesContainer.children);
6193
- return elements.filter((x) => this.fNodesContainer.contains(x))
6194
- .sort((a, b) => allElements.indexOf(a) - allElements.indexOf(b));
6420
+ getNode(id) {
6421
+ return this.fComponentsStore.fNodes.find((x) => x.fId === id);
6195
6422
  }
6196
- getChildrenNodesAndGroups(fId) {
6197
- return this.fMediator.send(new GetDeepChildrenNodesAndGroupsRequest(fId)).map((x) => x.hostElement);
6423
+ getNodeRect(fNode) {
6424
+ return RectExtensions.fromElement(fNode.hostElement);
6425
+ }
6426
+ getFlowRect() {
6427
+ return RectExtensions.fromElement(this.fComponentsStore.fFlow.hostElement);
6198
6428
  }
6199
6429
  };
6200
- UpdateItemAndChildrenLayersExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: UpdateItemAndChildrenLayersExecution, deps: [{ token: FComponentsStore }, { token: i2.FMediator }], target: i0.ɵɵFactoryTarget.Injectable });
6201
- UpdateItemAndChildrenLayersExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: UpdateItemAndChildrenLayersExecution });
6202
- UpdateItemAndChildrenLayersExecution = __decorate([
6203
- FExecutionRegister(UpdateItemAndChildrenLayersRequest)
6204
- ], UpdateItemAndChildrenLayersExecution);
6205
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: UpdateItemAndChildrenLayersExecution, decorators: [{
6430
+ CenterGroupOrNodeExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CenterGroupOrNodeExecution, deps: [{ token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Injectable });
6431
+ CenterGroupOrNodeExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CenterGroupOrNodeExecution });
6432
+ CenterGroupOrNodeExecution = __decorate([
6433
+ FExecutionRegister(CenterGroupOrNodeRequest)
6434
+ ], CenterGroupOrNodeExecution);
6435
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CenterGroupOrNodeExecution, decorators: [{
6206
6436
  type: Injectable
6207
- }], ctorParameters: function () { return [{ type: FComponentsStore }, { type: i2.FMediator }]; } });
6437
+ }], ctorParameters: function () { return [{ type: FComponentsStore }]; } });
6208
6438
 
6209
- let SelectAndUpdateNodeLayerExecution = class SelectAndUpdateNodeLayerExecution {
6210
- constructor(fDraggableDataContext, fMediator) {
6211
- this.fDraggableDataContext = fDraggableDataContext;
6439
+ class FitToFlowRequest {
6440
+ constructor(toCenter, animated) {
6441
+ this.toCenter = toCenter;
6442
+ this.animated = animated;
6443
+ }
6444
+ }
6445
+
6446
+ let FitToFlowExecution = class FitToFlowExecution {
6447
+ constructor(fComponentsStore, fMediator) {
6448
+ this.fComponentsStore = fComponentsStore;
6212
6449
  this.fMediator = fMediator;
6213
6450
  }
6214
- handle(request) {
6215
- this.selectNodeIfNotSelected(request.node);
6216
- this.fMediator.send(new UpdateItemAndChildrenLayersRequest(request.node, request.node.hostElement.parentElement));
6451
+ get transform() {
6452
+ return this.fComponentsStore.fCanvas.transform;
6217
6453
  }
6218
- selectNodeIfNotSelected(node) {
6219
- if (!this.fDraggableDataContext.selectedItems.includes(node) && !node.fSelectionDisabled) {
6220
- this.fDraggableDataContext.selectedItems.push(node);
6221
- node.select();
6222
- this.fDraggableDataContext.isSelectedChanged = true;
6454
+ handle(request) {
6455
+ const fNodesRect = this.fMediator.send(new GetNodesRectRequest()) || RectExtensions.initialize();
6456
+ if (fNodesRect.width === 0 || fNodesRect.height === 0) {
6457
+ return;
6223
6458
  }
6459
+ this.fitToParent(fNodesRect, RectExtensions.fromElement(this.fComponentsStore.fFlow.hostElement), this.fComponentsStore.fNodes.map((x) => x.position), request.toCenter);
6460
+ request.animated ? this.fComponentsStore.fCanvas.redrawWithAnimation() : this.fComponentsStore.fCanvas.redraw();
6461
+ this.fComponentsStore.fCanvas.emitCanvasChangeEvent();
6462
+ setTimeout(() => this.fComponentsStore.componentDataChanged(), F_CANVAS_ANIMATION_DURATION);
6463
+ }
6464
+ fitToParent(rect, parentRect, points, toCenter) {
6465
+ this.transform.scaledPosition = PointExtensions.initialize();
6466
+ this.transform.position = this.getZeroPositionWithoutScale(points);
6467
+ const itemsContainerWidth = (rect.width / this.transform.scale) + toCenter.x;
6468
+ const itemsContainerHeight = (rect.height / this.transform.scale) + toCenter.y;
6469
+ if ((itemsContainerWidth > parentRect.width || itemsContainerHeight > parentRect.height) ||
6470
+ itemsContainerWidth < parentRect.width && itemsContainerHeight < parentRect.height) {
6471
+ this.transform.scale = Math.min(parentRect.width / itemsContainerWidth, parentRect.height / itemsContainerHeight);
6472
+ }
6473
+ const newX = (parentRect.width - itemsContainerWidth * this.transform.scale) / 2 - this.transform.position.x * this.transform.scale;
6474
+ const newY = (parentRect.height - itemsContainerHeight * this.transform.scale) / 2 - this.transform.position.y * this.transform.scale;
6475
+ this.transform.position = PointExtensions.initialize(newX + (toCenter.x / 2) * this.transform.scale, newY + (toCenter.y / 2) * this.transform.scale);
6476
+ }
6477
+ getZeroPositionWithoutScale(points) {
6478
+ const xPoint = points.length ? Math.min(...points.map((point) => point.x)) : 0;
6479
+ const yPoint = points.length ? Math.min(...points.map((point) => point.y)) : 0;
6480
+ return PointExtensions.initialize(xPoint, yPoint);
6224
6481
  }
6225
6482
  };
6226
- SelectAndUpdateNodeLayerExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SelectAndUpdateNodeLayerExecution, deps: [{ token: FDraggableDataContext }, { token: i2.FMediator }], target: i0.ɵɵFactoryTarget.Injectable });
6227
- SelectAndUpdateNodeLayerExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SelectAndUpdateNodeLayerExecution });
6228
- SelectAndUpdateNodeLayerExecution = __decorate([
6229
- FExecutionRegister(SelectAndUpdateNodeLayerRequest)
6230
- ], SelectAndUpdateNodeLayerExecution);
6231
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SelectAndUpdateNodeLayerExecution, decorators: [{
6483
+ FitToFlowExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FitToFlowExecution, deps: [{ token: FComponentsStore }, { token: i2.FMediator }], target: i0.ɵɵFactoryTarget.Injectable });
6484
+ FitToFlowExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FitToFlowExecution });
6485
+ FitToFlowExecution = __decorate([
6486
+ FExecutionRegister(FitToFlowRequest)
6487
+ ], FitToFlowExecution);
6488
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FitToFlowExecution, decorators: [{
6232
6489
  type: Injectable
6233
- }], ctorParameters: function () { return [{ type: FDraggableDataContext }, { type: i2.FMediator }]; } });
6490
+ }], ctorParameters: function () { return [{ type: FComponentsStore }, { type: i2.FMediator }]; } });
6234
6491
 
6235
- class ShowConnectionsAfterCalculationsRequest {
6492
+ class InputCanvasPositionRequest {
6493
+ constructor(transform, position) {
6494
+ this.transform = transform;
6495
+ this.position = position;
6496
+ }
6236
6497
  }
6237
6498
 
6238
- let ShowConnectionsAfterCalculationsExecution = class ShowConnectionsAfterCalculationsExecution {
6499
+ let InputCanvasPositionExecution = class InputCanvasPositionExecution {
6239
6500
  constructor(fComponentsStore) {
6240
6501
  this.fComponentsStore = fComponentsStore;
6241
6502
  }
6242
6503
  handle(request) {
6243
- this.fComponentsStore.fConnections.forEach((connection) => {
6244
- connection.hostElement.style.display = 'unset';
6245
- });
6504
+ var _a;
6505
+ if (!request.position) {
6506
+ return;
6507
+ }
6508
+ const position = PointExtensions.sum(request.transform.position, request.transform.scaledPosition);
6509
+ if (!PointExtensions.isEqual(position, request.position)) {
6510
+ request.transform.position = request.position;
6511
+ request.transform.scaledPosition = PointExtensions.initialize();
6512
+ (_a = this.fComponentsStore.fCanvas) === null || _a === void 0 ? void 0 : _a.redraw();
6513
+ }
6246
6514
  }
6247
6515
  };
6248
- ShowConnectionsAfterCalculationsExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ShowConnectionsAfterCalculationsExecution, deps: [{ token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Injectable });
6249
- ShowConnectionsAfterCalculationsExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ShowConnectionsAfterCalculationsExecution });
6250
- ShowConnectionsAfterCalculationsExecution = __decorate([
6251
- FExecutionRegister(ShowConnectionsAfterCalculationsRequest)
6252
- ], ShowConnectionsAfterCalculationsExecution);
6253
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ShowConnectionsAfterCalculationsExecution, decorators: [{
6516
+ InputCanvasPositionExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: InputCanvasPositionExecution, deps: [{ token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Injectable });
6517
+ InputCanvasPositionExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: InputCanvasPositionExecution });
6518
+ InputCanvasPositionExecution = __decorate([
6519
+ FExecutionRegister(InputCanvasPositionRequest)
6520
+ ], InputCanvasPositionExecution);
6521
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: InputCanvasPositionExecution, decorators: [{
6254
6522
  type: Injectable
6255
6523
  }], ctorParameters: function () { return [{ type: FComponentsStore }]; } });
6256
6524
 
6257
- class SortNodeLayersRequest {
6525
+ class InputCanvasScaleRequest {
6526
+ constructor(transform, scale) {
6527
+ this.transform = transform;
6528
+ this.scale = scale;
6529
+ }
6258
6530
  }
6259
6531
 
6260
- let SortNodeLayersExecution = class SortNodeLayersExecution {
6261
- constructor(fComponentsStore, fMediator, fBrowser) {
6532
+ let InputCanvasScaleExecution = class InputCanvasScaleExecution {
6533
+ constructor(fComponentsStore) {
6262
6534
  this.fComponentsStore = fComponentsStore;
6263
- this.fMediator = fMediator;
6264
- this.fBrowser = fBrowser;
6265
6535
  }
6266
- get fGroupsContainer() {
6267
- return this.fComponentsStore.fCanvas.fGroupsContainer.nativeElement;
6536
+ handle(request) {
6537
+ var _a;
6538
+ if (!request.scale) {
6539
+ return;
6540
+ }
6541
+ request.transform.scale = request.scale;
6542
+ (_a = this.fComponentsStore.fCanvas) === null || _a === void 0 ? void 0 : _a.redraw();
6268
6543
  }
6269
- get fNodesContainer() {
6270
- return this.fComponentsStore.fCanvas.fNodesContainer.nativeElement;
6544
+ };
6545
+ InputCanvasScaleExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: InputCanvasScaleExecution, deps: [{ token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Injectable });
6546
+ InputCanvasScaleExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: InputCanvasScaleExecution });
6547
+ InputCanvasScaleExecution = __decorate([
6548
+ FExecutionRegister(InputCanvasScaleRequest)
6549
+ ], InputCanvasScaleExecution);
6550
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: InputCanvasScaleExecution, decorators: [{
6551
+ type: Injectable
6552
+ }], ctorParameters: function () { return [{ type: FComponentsStore }]; } });
6553
+
6554
+ class ResetScaleRequest {
6555
+ }
6556
+
6557
+ let ResetScaleExecution = class ResetScaleExecution {
6558
+ constructor(fComponentsStore) {
6559
+ this.fComponentsStore = fComponentsStore;
6271
6560
  }
6272
- get fNodesContainerElements() {
6273
- return Array.from(this.fNodesContainer.children);
6561
+ get transform() {
6562
+ return this.fComponentsStore.fCanvas.transform;
6274
6563
  }
6275
6564
  handle(request) {
6276
- this.getGroups().forEach((parent) => {
6277
- this.moveChildrenNodes(this.getSortedChildrenNodes(parent));
6278
- });
6565
+ this.transform.scale = 1;
6566
+ this.transform.scaledPosition = PointExtensions.initialize();
6279
6567
  }
6280
- getGroups() {
6281
- return this.fComponentsStore.fNodes.filter((x) => this.fGroupsContainer.contains(x.hostElement));
6568
+ };
6569
+ ResetScaleExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ResetScaleExecution, deps: [{ token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Injectable });
6570
+ ResetScaleExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ResetScaleExecution });
6571
+ ResetScaleExecution = __decorate([
6572
+ FExecutionRegister(ResetScaleRequest)
6573
+ ], ResetScaleExecution);
6574
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ResetScaleExecution, decorators: [{
6575
+ type: Injectable
6576
+ }], ctorParameters: function () { return [{ type: FComponentsStore }]; } });
6577
+
6578
+ class ResetScaleAndCenterRequest {
6579
+ constructor(animated) {
6580
+ this.animated = animated;
6282
6581
  }
6283
- getSortedChildrenNodes(parent) {
6284
- const allElements = this.fNodesContainerElements;
6285
- return this.getChildrenNodes(parent.fId)
6286
- .sort((a, b) => allElements.indexOf(a) - allElements.indexOf(b));
6582
+ }
6583
+
6584
+ let ResetScaleAndCenterExecution = class ResetScaleAndCenterExecution {
6585
+ constructor(fComponentsStore, fMediator) {
6586
+ this.fComponentsStore = fComponentsStore;
6587
+ this.fMediator = fMediator;
6287
6588
  }
6288
- getChildrenNodes(fId) {
6289
- return this.fMediator.send(new GetDeepChildrenNodesAndGroupsRequest(fId))
6290
- .filter((x) => this.fNodesContainer.contains(x.hostElement)).map((x) => x.hostElement);
6589
+ get transform() {
6590
+ return this.fComponentsStore.fCanvas.transform;
6291
6591
  }
6292
- moveChildrenNodes(sortedChildrenGroups) {
6293
- const fragment = this.fBrowser.document.createDocumentFragment();
6294
- sortedChildrenGroups.forEach((childGroup) => {
6295
- fragment.appendChild(childGroup); // Append automatically removes the element from its current position
6296
- });
6297
- this.fNodesContainer.appendChild(fragment);
6592
+ handle(request) {
6593
+ const fNodesRect = this.fMediator.send(new GetNodesRectRequest()) || RectExtensions.initialize();
6594
+ if (fNodesRect.width === 0 || fNodesRect.height === 0) {
6595
+ return;
6596
+ }
6597
+ this.oneToOneCentering(fNodesRect, RectExtensions.fromElement(this.fComponentsStore.fFlow.hostElement), this.fComponentsStore.fNodes.map((x) => x.position));
6598
+ request.animated ? this.fComponentsStore.fCanvas.redrawWithAnimation() : this.fComponentsStore.fCanvas.redraw();
6599
+ this.fComponentsStore.fCanvas.emitCanvasChangeEvent();
6600
+ setTimeout(() => this.fComponentsStore.componentDataChanged(), F_CANVAS_ANIMATION_DURATION);
6601
+ }
6602
+ oneToOneCentering(rect, parentRect, points) {
6603
+ this.transform.scaledPosition = PointExtensions.initialize();
6604
+ this.transform.position = this.getZeroPositionWithoutScale(points);
6605
+ const newX = (parentRect.width - rect.width / this.transform.scale) / 2 - this.transform.position.x;
6606
+ const newY = (parentRect.height - rect.height / this.transform.scale) / 2 - this.transform.position.y;
6607
+ this.transform.scale = 1;
6608
+ this.transform.position = PointExtensions.initialize(newX, newY);
6609
+ }
6610
+ getZeroPositionWithoutScale(points) {
6611
+ const xPoint = points.length ? Math.min(...points.map((point) => point.x)) : 0;
6612
+ const yPoint = points.length ? Math.min(...points.map((point) => point.y)) : 0;
6613
+ return PointExtensions.initialize(xPoint, yPoint);
6298
6614
  }
6299
6615
  };
6300
- SortNodeLayersExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SortNodeLayersExecution, deps: [{ token: FComponentsStore }, { token: i2.FMediator }, { token: i1.BrowserService }], target: i0.ɵɵFactoryTarget.Injectable });
6301
- SortNodeLayersExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SortNodeLayersExecution });
6302
- SortNodeLayersExecution = __decorate([
6303
- FExecutionRegister(SortNodeLayersRequest)
6304
- ], SortNodeLayersExecution);
6305
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SortNodeLayersExecution, decorators: [{
6616
+ ResetScaleAndCenterExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ResetScaleAndCenterExecution, deps: [{ token: FComponentsStore }, { token: i2.FMediator }], target: i0.ɵɵFactoryTarget.Injectable });
6617
+ ResetScaleAndCenterExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ResetScaleAndCenterExecution });
6618
+ ResetScaleAndCenterExecution = __decorate([
6619
+ FExecutionRegister(ResetScaleAndCenterRequest)
6620
+ ], ResetScaleAndCenterExecution);
6621
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ResetScaleAndCenterExecution, decorators: [{
6306
6622
  type: Injectable
6307
- }], ctorParameters: function () { return [{ type: FComponentsStore }, { type: i2.FMediator }, { type: i1.BrowserService }]; } });
6623
+ }], ctorParameters: function () { return [{ type: FComponentsStore }, { type: i2.FMediator }]; } });
6308
6624
 
6309
- class SortItemsByParentRequest {
6310
- constructor(fItemsContainer // fGroupsContainer || fNodesContainer
6311
- ) {
6312
- this.fItemsContainer = fItemsContainer;
6625
+ class UpdateScaleRequest {
6626
+ constructor(scale, toPosition) {
6627
+ this.scale = scale;
6628
+ this.toPosition = toPosition;
6313
6629
  }
6314
6630
  }
6315
6631
 
6316
- let SortItemsByParentExecution = class SortItemsByParentExecution {
6317
- constructor(fComponentsStore, fMediator, fBrowser) {
6632
+ let UpdateScaleExecution = class UpdateScaleExecution {
6633
+ constructor(fComponentsStore) {
6318
6634
  this.fComponentsStore = fComponentsStore;
6319
- this.fMediator = fMediator;
6320
- this.fBrowser = fBrowser;
6321
6635
  }
6322
- get fItemsFromContainer() {
6323
- return Array.from(this.fItemsContainer.children);
6636
+ get transform() {
6637
+ return this.fComponentsStore.fCanvas.transform;
6324
6638
  }
6325
6639
  handle(request) {
6326
- this.fItemsContainer = request.fItemsContainer;
6327
- this.getItems().forEach((parent) => {
6328
- this.moveChildrenItems(this.getSortedChildrenItems(parent), parent);
6329
- });
6640
+ if (request.scale !== this.transform.scale) {
6641
+ const summaryPosition = PointExtensions.sum(this.transform.scaledPosition, this.transform.position);
6642
+ const newX = request.toPosition.x - (request.toPosition.x - summaryPosition.x) * request.scale / this.transform.scale;
6643
+ const newY = request.toPosition.y - (request.toPosition.y - summaryPosition.y) * request.scale / this.transform.scale;
6644
+ this.transform.scale = request.scale;
6645
+ this.transform.scaledPosition = PointExtensions.sub(PointExtensions.initialize(newX, newY), this.transform.position);
6646
+ }
6330
6647
  }
6331
- getItems() {
6332
- return this.fComponentsStore.fNodes.filter((x) => this.fItemsContainer.contains(x.hostElement));
6648
+ };
6649
+ UpdateScaleExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: UpdateScaleExecution, deps: [{ token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Injectable });
6650
+ UpdateScaleExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: UpdateScaleExecution });
6651
+ UpdateScaleExecution = __decorate([
6652
+ FExecutionRegister(UpdateScaleRequest)
6653
+ ], UpdateScaleExecution);
6654
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: UpdateScaleExecution, decorators: [{
6655
+ type: Injectable
6656
+ }], ctorParameters: function () { return [{ type: FComponentsStore }]; } });
6657
+
6658
+ class FCanvasChangeEvent {
6659
+ constructor(position, scale) {
6660
+ this.position = position;
6661
+ this.scale = scale;
6333
6662
  }
6334
- getSortedChildrenItems(parent) {
6335
- const allElements = this.fItemsFromContainer;
6336
- const parentIndex = allElements.indexOf(parent.hostElement);
6337
- return this.getChildrenGroups(parent.fId)
6338
- .filter((child) => allElements.indexOf(child) < parentIndex)
6339
- .sort((a, b) => allElements.indexOf(a) - allElements.indexOf(b));
6663
+ }
6664
+
6665
+ const F_CANVAS_FEATURES = [
6666
+ CenterGroupOrNodeExecution,
6667
+ FitToFlowExecution,
6668
+ InputCanvasPositionExecution,
6669
+ InputCanvasScaleExecution,
6670
+ ResetScaleExecution,
6671
+ ResetScaleAndCenterExecution,
6672
+ UpdateScaleExecution
6673
+ ];
6674
+
6675
+ const F_CANVAS = new InjectionToken('F_CANVAS');
6676
+ class FCanvasBase {
6677
+ constructor() {
6678
+ this.transform = TransformModelExtensions.default();
6340
6679
  }
6341
- getChildrenGroups(fId) {
6342
- return this.fMediator.send(new GetDeepChildrenNodesAndGroupsRequest(fId))
6343
- .filter((x) => this.fItemsContainer.contains(x.hostElement)).map((x) => x.hostElement);
6680
+ getPosition() {
6681
+ return this.transform.position;
6682
+ }
6683
+ setPosition(position) {
6684
+ this.transform.position = position;
6685
+ }
6686
+ emitCanvasChangeEvent() {
6687
+ this.fCanvasChange.emit(new FCanvasChangeEvent(PointExtensions.sum(this.transform.position, this.transform.scaledPosition), this.transform.scale));
6688
+ }
6689
+ }
6690
+ FCanvasBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FCanvasBase, deps: [], target: i0.ɵɵFactoryTarget.Directive });
6691
+ FCanvasBase.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: FCanvasBase, ngImport: i0 });
6692
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FCanvasBase, decorators: [{
6693
+ type: Directive
6694
+ }] });
6695
+
6696
+ class FCanvasComponent extends FCanvasBase {
6697
+ constructor(elementReference, fMediator, fComponentsStore) {
6698
+ super();
6699
+ this.elementReference = elementReference;
6700
+ this.fMediator = fMediator;
6701
+ this.fComponentsStore = fComponentsStore;
6702
+ this.fCanvasChange = new EventEmitter();
6703
+ }
6704
+ set position(value) {
6705
+ this.fMediator.send(new InputCanvasPositionRequest(this.transform, value));
6706
+ }
6707
+ set scale(value) {
6708
+ this.fMediator.send(new InputCanvasScaleRequest(this.transform, value));
6709
+ }
6710
+ get fNodes() {
6711
+ return this.fComponentsStore.fNodes;
6712
+ }
6713
+ get hostElement() {
6714
+ return this.elementReference.nativeElement;
6715
+ }
6716
+ ngOnInit() {
6717
+ this.fComponentsStore.fCanvas = this;
6718
+ }
6719
+ redraw() {
6720
+ var _a;
6721
+ (_a = this.fComponentsStore.fBackground) === null || _a === void 0 ? void 0 : _a.setTransform(this.transform);
6722
+ this.hostElement.setAttribute("style", `transform: ${TransformModelExtensions.toString(this.transform)}`);
6723
+ this.fMediator.send(new EmitTransformChangesRequest());
6724
+ }
6725
+ redrawWithAnimation() {
6726
+ var _a;
6727
+ (_a = this.fComponentsStore.fBackground) === null || _a === void 0 ? void 0 : _a.setTransform(this.transform);
6728
+ this.hostElement.setAttribute("style", `transition: transform ${F_CANVAS_ANIMATION_DURATION}ms ease-in-out; transform: ${TransformModelExtensions.toString(this.transform)}`);
6729
+ setTimeout(() => {
6730
+ this.redraw();
6731
+ }, F_CANVAS_ANIMATION_DURATION);
6732
+ }
6733
+ centerGroupOrNode(id, animated = true) {
6734
+ this.fMediator.send(new CenterGroupOrNodeRequest(id, animated));
6344
6735
  }
6345
- moveChildrenItems(sortedChildrenItems, parent) {
6346
- let nextSibling = parent.hostElement.nextElementSibling;
6347
- const fragment = this.fBrowser.document.createDocumentFragment();
6348
- sortedChildrenItems.forEach((child) => {
6349
- fragment.appendChild(child); // Append automatically removes the element from its current position
6350
- });
6351
- this.fItemsContainer.insertBefore(fragment, nextSibling);
6736
+ fitToScreen(toCenter = PointExtensions.initialize(), animated = true) {
6737
+ this.fMediator.send(new FitToFlowRequest(toCenter, animated));
6352
6738
  }
6353
- };
6354
- SortItemsByParentExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SortItemsByParentExecution, deps: [{ token: FComponentsStore }, { token: i2.FMediator }, { token: i1.BrowserService }], target: i0.ɵɵFactoryTarget.Injectable });
6355
- SortItemsByParentExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SortItemsByParentExecution });
6356
- SortItemsByParentExecution = __decorate([
6357
- FExecutionRegister(SortItemsByParentRequest)
6358
- ], SortItemsByParentExecution);
6359
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SortItemsByParentExecution, decorators: [{
6360
- type: Injectable
6361
- }], ctorParameters: function () { return [{ type: FComponentsStore }, { type: i2.FMediator }, { type: i1.BrowserService }]; } });
6362
-
6363
- class SortItemLayersRequest {
6364
- }
6365
-
6366
- let SortItemLayersExecution = class SortItemLayersExecution {
6367
- constructor(fMediator, fComponentsStore) {
6368
- this.fMediator = fMediator;
6369
- this.fComponentsStore = fComponentsStore;
6739
+ resetScaleAndCenter(animated = true) {
6740
+ this.fMediator.send(new ResetScaleAndCenterRequest(animated));
6370
6741
  }
6371
- handle(request) {
6372
- this.fMediator.send(new SortItemsByParentRequest(this.fComponentsStore.fCanvas.fGroupsContainer.nativeElement));
6373
- this.fMediator.send(new SortNodeLayersRequest());
6374
- this.fMediator.send(new SortItemsByParentRequest(this.fComponentsStore.fCanvas.fNodesContainer.nativeElement));
6742
+ setZoom(scale, toPosition = PointExtensions.initialize()) {
6743
+ this.fMediator.send(new UpdateScaleRequest(scale, toPosition));
6744
+ }
6745
+ resetZoom() {
6746
+ this.fMediator.send(new ResetScaleRequest());
6375
6747
  }
6376
- };
6377
- SortItemLayersExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SortItemLayersExecution, deps: [{ token: i2.FMediator }, { token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Injectable });
6378
- SortItemLayersExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SortItemLayersExecution });
6379
- SortItemLayersExecution = __decorate([
6380
- FExecutionRegister(SortItemLayersRequest)
6381
- ], SortItemLayersExecution);
6382
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SortItemLayersExecution, decorators: [{
6383
- type: Injectable
6384
- }], ctorParameters: function () { return [{ type: i2.FMediator }, { type: FComponentsStore }]; } });
6385
-
6386
- class SubscribeOnTransformChangesRequest {
6387
6748
  }
6749
+ FCanvasComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FCanvasComponent, deps: [{ token: i0.ElementRef }, { token: i2.FMediator }, { token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Component });
6750
+ FCanvasComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: FCanvasComponent, selector: "f-canvas", inputs: { position: "position", scale: "scale" }, outputs: { fCanvasChange: "fCanvasChange" }, host: { classAttribute: "f-component f-canvas" }, providers: [
6751
+ { provide: F_CANVAS, useExisting: FCanvasComponent }
6752
+ ], viewQueries: [{ propertyName: "fGroupsContainer", first: true, predicate: ["fGroupsContainer"], descendants: true, static: true }, { propertyName: "fNodesContainer", first: true, predicate: ["fNodesContainer"], descendants: true, static: true }, { propertyName: "fConnectionsContainer", first: true, predicate: ["fConnectionsContainer"], descendants: true, static: true }], exportAs: ["fComponent"], usesInheritance: true, ngImport: i0, template: "<ng-container>\n <div #fGroupsContainer>\n <ng-content select=\"[fGroup]\"></ng-content>\n </div>\n <div #fConnectionsContainer>\n <ng-content select=\"f-snap-connection\"></ng-content>\n <ng-content select=\"f-connection\"></ng-content>\n <ng-content select=\"f-connection-for-create\"></ng-content>\n </div>\n\n <div #fNodesContainer>\n <ng-content select=\"[fNode]\"></ng-content>\n </div>\n</ng-container>\n", styles: [":host{position:absolute;overflow:visible;width:100%;height:100%;left:0;top:0;transform-origin:0 0;pointer-events:none}:host.f-scaled-animate{transition:transform .09s}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
6753
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FCanvasComponent, decorators: [{
6754
+ type: Component,
6755
+ args: [{
6756
+ selector: 'f-canvas',
6757
+ templateUrl: './f-canvas.component.html',
6758
+ styleUrls: ['./f-canvas.component.scss'],
6759
+ exportAs: 'fComponent',
6760
+ host: {
6761
+ 'class': 'f-component f-canvas',
6762
+ },
6763
+ providers: [
6764
+ { provide: F_CANVAS, useExisting: FCanvasComponent }
6765
+ ],
6766
+ changeDetection: ChangeDetectionStrategy.OnPush,
6767
+ }]
6768
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i2.FMediator }, { type: FComponentsStore }]; }, propDecorators: { fCanvasChange: [{
6769
+ type: Output
6770
+ }], position: [{
6771
+ type: Input
6772
+ }], scale: [{
6773
+ type: Input
6774
+ }], fGroupsContainer: [{
6775
+ type: ViewChild,
6776
+ args: ['fGroupsContainer', { static: true }]
6777
+ }], fNodesContainer: [{
6778
+ type: ViewChild,
6779
+ args: ['fNodesContainer', { static: true }]
6780
+ }], fConnectionsContainer: [{
6781
+ type: ViewChild,
6782
+ args: ['fConnectionsContainer', { static: true }]
6783
+ }] } });
6388
6784
 
6389
- let SubscribeOnTransformChangesExecution = class SubscribeOnTransformChangesExecution {
6390
- constructor(fTransformStore, fComponentsStore) {
6391
- this.fTransformStore = fTransformStore;
6392
- this.fComponentsStore = fComponentsStore;
6393
- }
6394
- handle(request) {
6395
- return merge(this.fTransformStore.changes, this.fComponentsStore.componentsData$, this.fComponentsStore.componentsCount$);
6396
- }
6397
- };
6398
- SubscribeOnTransformChangesExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SubscribeOnTransformChangesExecution, deps: [{ token: FTransformStore }, { token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Injectable });
6399
- SubscribeOnTransformChangesExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SubscribeOnTransformChangesExecution });
6400
- SubscribeOnTransformChangesExecution = __decorate([
6401
- FExecutionRegister(SubscribeOnTransformChangesRequest)
6402
- ], SubscribeOnTransformChangesExecution);
6403
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SubscribeOnTransformChangesExecution, decorators: [{
6404
- type: Injectable
6405
- }], ctorParameters: function () { return [{ type: FTransformStore }, { type: FComponentsStore }]; } });
6785
+ const F_CANVAS_PROVIDERS = [
6786
+ FCanvasComponent,
6787
+ ];
6406
6788
 
6407
- function createSVGElement(tag, fBrowser) {
6408
- return fBrowser.document.createElementNS('http://www.w3.org/2000/svg', tag);
6409
- }
6789
+ const F_BACKGROUND_FEATURES = [
6790
+ AddPatternToBackgroundExecution
6791
+ ];
6410
6792
 
6411
6793
  const COMMON_PROVIDERS = [
6412
- CenterGroupOrNodeExecution,
6413
- ClearSelectionExecution,
6794
+ ...F_CANVAS_FEATURES,
6795
+ ...F_BACKGROUND_FEATURES,
6414
6796
  CreateConnectionMarkersExecution,
6415
6797
  CreateRoundedRectFromElementExecution,
6416
6798
  EmitTransformChangesExecution,
6799
+ ...F_SELECTION_FEATURES,
6417
6800
  GetCanBeSelectedItemsExecution,
6418
6801
  GetDeepChildrenNodesAndGroupsExecution,
6419
6802
  GetConnectionLineExecution,
@@ -6421,14 +6804,9 @@ const COMMON_PROVIDERS = [
6421
6804
  ...GET_FLOW_STATE_PROVIDERS,
6422
6805
  GetScaledNodeRectsWithFlowPositionExecution,
6423
6806
  GetNodesRectExecution,
6424
- GetOutputRectInFlowExecution,
6425
6807
  GetPositionInFlowExecution,
6426
- GetSelectionExecution,
6427
6808
  IsConnectionUnderNodeExecution,
6428
6809
  RedrawConnectionsExecution,
6429
- SelectExecution,
6430
- SelectAllExecution,
6431
- SelectAndUpdateNodeLayerExecution,
6432
6810
  ShowConnectionsAfterCalculationsExecution,
6433
6811
  SortItemLayersExecution,
6434
6812
  SortItemsByParentExecution,
@@ -6436,9 +6814,48 @@ const COMMON_PROVIDERS = [
6436
6814
  SubscribeOnTransformChangesExecution,
6437
6815
  UpdateItemAndChildrenLayersExecution,
6438
6816
  MoveFrontElementsBeforeTargetElementExecution,
6439
- GetInputRectInFlowExecution,
6440
6817
  ];
6441
6818
 
6819
+ let uniqueId$4 = 0;
6820
+ let AddPatternToBackgroundExecution = class AddPatternToBackgroundExecution {
6821
+ constructor(fComponentsStore, fBrowser) {
6822
+ this.fComponentsStore = fComponentsStore;
6823
+ this.fBrowser = fBrowser;
6824
+ }
6825
+ get fBackground() {
6826
+ return this.fComponentsStore.fBackground;
6827
+ }
6828
+ handle(request) {
6829
+ var _a, _b, _c, _d, _e, _f, _g;
6830
+ const children = ((_a = request.fPattern) === null || _a === void 0 ? void 0 : _a.hostElement.getElementsByTagName('pattern')) || [];
6831
+ const pattern = children.length ? children[0] : undefined;
6832
+ if (pattern) {
6833
+ const defs = createSVGElement('defs', this.fBrowser);
6834
+ pattern.id = 'f-background-pattern-' + uniqueId$4++;
6835
+ (_b = request.fPattern) === null || _b === void 0 ? void 0 : _b.hostElement.remove();
6836
+ defs.appendChild(pattern);
6837
+ (_d = (_c = this.fBackground.hostElement) === null || _c === void 0 ? void 0 : _c.firstChild) === null || _d === void 0 ? void 0 : _d.appendChild(defs);
6838
+ const rect = createSVGElement('rect', this.fBrowser);
6839
+ rect.setAttribute('fill', 'url(#' + pattern.id + ')');
6840
+ rect.setAttribute('width', '100%');
6841
+ rect.setAttribute('height', '100%');
6842
+ (_e = this.fBackground.hostElement.firstChild) === null || _e === void 0 ? void 0 : _e.appendChild(rect);
6843
+ const transform = ((_f = this.fComponentsStore.fCanvas) === null || _f === void 0 ? void 0 : _f.transform) || TransformModelExtensions.default();
6844
+ (_g = request.fPattern) === null || _g === void 0 ? void 0 : _g.setTransform(transform);
6845
+ }
6846
+ }
6847
+ };
6848
+ AddPatternToBackgroundExecution.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: AddPatternToBackgroundExecution, deps: [{ token: FComponentsStore }, { token: i1.BrowserService }], target: i0.ɵɵFactoryTarget.Injectable });
6849
+ AddPatternToBackgroundExecution.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: AddPatternToBackgroundExecution });
6850
+ AddPatternToBackgroundExecution = __decorate([
6851
+ FExecutionRegister(AddPatternToBackgroundRequest)
6852
+ ], AddPatternToBackgroundExecution);
6853
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: AddPatternToBackgroundExecution, decorators: [{
6854
+ type: Injectable
6855
+ }], ctorParameters: function () { return [{ type: FComponentsStore }, { type: i1.BrowserService }]; } });
6856
+
6857
+ const F_BACKGROUND_PATTERN = new InjectionToken('F_BACKGROUND_PATTERN');
6858
+
6442
6859
  let uniqueId$3 = 0;
6443
6860
  class FRectPatternComponent {
6444
6861
  constructor(elementReference, fBrowser) {
@@ -6660,11 +7077,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
6660
7077
 
6661
7078
  let uniqueId$1 = 0;
6662
7079
  class FBackgroundComponent extends FBackgroundBase {
6663
- constructor(elementReference, fComponentsStore, fBrowser) {
7080
+ constructor(elementReference, fComponentsStore, fMediator) {
6664
7081
  super();
6665
7082
  this.elementReference = elementReference;
6666
7083
  this.fComponentsStore = fComponentsStore;
6667
- this.fBrowser = fBrowser;
7084
+ this.fMediator = fMediator;
6668
7085
  }
6669
7086
  get hostElement() {
6670
7087
  return this.elementReference.nativeElement;
@@ -6673,23 +7090,7 @@ class FBackgroundComponent extends FBackgroundBase {
6673
7090
  this.fComponentsStore.fBackground = this;
6674
7091
  }
6675
7092
  ngAfterContentInit() {
6676
- var _a, _b, _c, _d, _e, _f, _g;
6677
- const children = ((_a = this.fBackgroundPattern) === null || _a === void 0 ? void 0 : _a.hostElement.getElementsByTagName('pattern')) || [];
6678
- const pattern = children.length ? children[0] : undefined;
6679
- if (pattern) {
6680
- const defs = createSVGElement('defs', this.fBrowser);
6681
- pattern.id = 'f-background-marker-' + uniqueId$1++;
6682
- (_b = this.fBackgroundPattern) === null || _b === void 0 ? void 0 : _b.hostElement.remove();
6683
- defs.appendChild(pattern);
6684
- (_d = (_c = this.hostElement) === null || _c === void 0 ? void 0 : _c.firstChild) === null || _d === void 0 ? void 0 : _d.appendChild(defs);
6685
- const rect = createSVGElement('rect', this.fBrowser);
6686
- rect.setAttribute('fill', 'url(#' + pattern.id + ')');
6687
- rect.setAttribute('width', '100%');
6688
- rect.setAttribute('height', '100%');
6689
- (_e = this.hostElement.firstChild) === null || _e === void 0 ? void 0 : _e.appendChild(rect);
6690
- const transform = ((_f = this.fComponentsStore.fCanvas) === null || _f === void 0 ? void 0 : _f.transform) || TransformModelExtensions.default();
6691
- (_g = this.fBackgroundPattern) === null || _g === void 0 ? void 0 : _g.setTransform(transform);
6692
- }
7093
+ this.fMediator.send(new AddPatternToBackgroundRequest(this.fBackgroundPattern));
6693
7094
  }
6694
7095
  isBackgroundElement(element) {
6695
7096
  return this.hostElement.contains(element);
@@ -6702,13 +7103,13 @@ class FBackgroundComponent extends FBackgroundBase {
6702
7103
  this.fComponentsStore.fBackground = undefined;
6703
7104
  }
6704
7105
  }
6705
- FBackgroundComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FBackgroundComponent, deps: [{ token: i0.ElementRef }, { token: FComponentsStore }, { token: i1.BrowserService }], target: i0.ɵɵFactoryTarget.Component });
6706
- FBackgroundComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: FBackgroundComponent, selector: "f-background", host: { classAttribute: "f-component f-background" }, providers: [{ provide: F_BACKGROUND, useExisting: FBackgroundComponent }], queries: [{ propertyName: "fBackgroundPattern", first: true, predicate: F_BACKGROUND_PATTERN, descendants: true }], usesInheritance: true, ngImport: i0, template: "<svg><ng-content></ng-content></svg>\n", styles: [":host{position:absolute;width:100%;height:100%;left:0;top:0;transform-origin:0 0;pointer-events:none}:host svg{width:100%;height:100%}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
7106
+ FBackgroundComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FBackgroundComponent, deps: [{ token: i0.ElementRef }, { token: FComponentsStore }, { token: i2.FMediator }], target: i0.ɵɵFactoryTarget.Component });
7107
+ FBackgroundComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: FBackgroundComponent, selector: "f-background", host: { classAttribute: "f-component f-background" }, providers: [{ provide: F_BACKGROUND, useExisting: FBackgroundComponent }], queries: [{ propertyName: "fBackgroundPattern", first: true, predicate: F_BACKGROUND_PATTERN, descendants: true }], usesInheritance: true, ngImport: i0, template: "<svg><ng-content></ng-content></svg>", isInline: true, styles: [":host{position:absolute;width:100%;height:100%;left:0;top:0;transform-origin:0 0;pointer-events:none}:host svg{width:100%;height:100%}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
6707
7108
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FBackgroundComponent, decorators: [{
6708
7109
  type: Component,
6709
7110
  args: [{
6710
7111
  selector: "f-background",
6711
- templateUrl: "./f-background.component.html",
7112
+ template: "<svg><ng-content></ng-content></svg>",
6712
7113
  styleUrls: ["./f-background.component.scss"],
6713
7114
  host: {
6714
7115
  'class': 'f-component f-background'
@@ -6716,7 +7117,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
6716
7117
  providers: [{ provide: F_BACKGROUND, useExisting: FBackgroundComponent }],
6717
7118
  changeDetection: ChangeDetectionStrategy.OnPush,
6718
7119
  }]
6719
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: FComponentsStore }, { type: i1.BrowserService }]; }, propDecorators: { fBackgroundPattern: [{
7120
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: FComponentsStore }, { type: i2.FMediator }]; }, propDecorators: { fBackgroundPattern: [{
6720
7121
  type: ContentChild,
6721
7122
  args: [F_BACKGROUND_PATTERN, { static: false }]
6722
7123
  }] } });
@@ -6727,153 +7128,6 @@ const F_BACKGROUND_PROVIDERS = [
6727
7128
  FCirclePatternComponent
6728
7129
  ];
6729
7130
 
6730
- class FCanvasChangeEvent {
6731
- constructor(position, scale) {
6732
- this.position = position;
6733
- this.scale = scale;
6734
- }
6735
- }
6736
-
6737
- const F_CANVAS = new InjectionToken('F_CANVAS');
6738
- const MIXIN_BASE = mixinChangePosition(mixinFitToParent(mixinOneToOneCentering(mixinChangeZoom(class {
6739
- constructor(transform) {
6740
- this.transform = transform;
6741
- }
6742
- }))));
6743
- class FCanvasBase extends MIXIN_BASE {
6744
- constructor() {
6745
- super(TransformModelExtensions.default());
6746
- }
6747
- completeDrag() {
6748
- this.fCanvasChange.emit(new FCanvasChangeEvent(this.getCanvasPosition(), this.transform.scale));
6749
- }
6750
- getCanvasPosition() {
6751
- return PointExtensions.sum(this.transform.position, this.transform.scaledPosition);
6752
- }
6753
- }
6754
- FCanvasBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FCanvasBase, deps: [], target: i0.ɵɵFactoryTarget.Directive });
6755
- FCanvasBase.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: FCanvasBase, usesInheritance: true, ngImport: i0 });
6756
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FCanvasBase, decorators: [{
6757
- type: Directive
6758
- }], ctorParameters: function () { return []; } });
6759
-
6760
- class FCanvasComponent extends FCanvasBase {
6761
- constructor(elementReference, fMediator, fComponentsStore) {
6762
- super();
6763
- this.elementReference = elementReference;
6764
- this.fMediator = fMediator;
6765
- this.fComponentsStore = fComponentsStore;
6766
- this.fCanvasChange = new EventEmitter();
6767
- }
6768
- set position(value) {
6769
- if (!value) {
6770
- return;
6771
- }
6772
- const position = PointExtensions.sum(this.transform.position, this.transform.scaledPosition);
6773
- if (!PointExtensions.isEqual(position, value)) {
6774
- this.transform.position = value;
6775
- this.transform.scaledPosition = PointExtensions.initialize();
6776
- this.redraw();
6777
- }
6778
- }
6779
- set scale(value) {
6780
- if (!value) {
6781
- return;
6782
- }
6783
- this.transform.scale = value;
6784
- this.redraw();
6785
- }
6786
- get fNodes() {
6787
- return this.fComponentsStore.fNodes;
6788
- }
6789
- get hostElement() {
6790
- return this.elementReference.nativeElement;
6791
- }
6792
- ngOnInit() {
6793
- this.fComponentsStore.fCanvas = this;
6794
- }
6795
- redraw() {
6796
- var _a;
6797
- (_a = this.fComponentsStore.fBackground) === null || _a === void 0 ? void 0 : _a.setTransform(this.transform);
6798
- this.hostElement.setAttribute("style", `transform: ${TransformModelExtensions.toString(this.transform)}`);
6799
- this.fMediator.send(new EmitTransformChangesRequest());
6800
- }
6801
- redrawWithAnimation() {
6802
- var _a;
6803
- (_a = this.fComponentsStore.fBackground) === null || _a === void 0 ? void 0 : _a.setTransform(this.transform);
6804
- this.hostElement.setAttribute("style", `transition: transform ${F_CANVAS_ANIMATION_DURATION}ms ease-in-out; transform: ${TransformModelExtensions.toString(this.transform)}`);
6805
- setTimeout(() => {
6806
- this.redraw();
6807
- }, F_CANVAS_ANIMATION_DURATION);
6808
- }
6809
- centerGroupOrNode(id, animated = true) {
6810
- this.fMediator.send(new CenterGroupOrNodeRequest(id, animated));
6811
- }
6812
- fitToScreen(toCenter = PointExtensions.initialize(), animated = true) {
6813
- const fNodesRect = this.fMediator.send(new GetNodesRectRequest()) || RectExtensions.initialize();
6814
- if (fNodesRect.width === 0 || fNodesRect.height === 0) {
6815
- return;
6816
- }
6817
- this.fitToParent(fNodesRect, RectExtensions.fromElement(this.fComponentsStore.fFlow.hostElement), this.fNodes.map((x) => {
6818
- return Point.fromPoint(x.position);
6819
- }), toCenter);
6820
- animated ? this.redrawWithAnimation() : this.redraw();
6821
- this.completeDrag();
6822
- setTimeout(() => {
6823
- this.fComponentsStore.componentDataChanged();
6824
- }, F_CANVAS_ANIMATION_DURATION);
6825
- }
6826
- oneToOne() {
6827
- const fNodesRect = this.fMediator.send(new GetNodesRectRequest()) || RectExtensions.initialize();
6828
- if (fNodesRect.width === 0 || fNodesRect.height === 0) {
6829
- return;
6830
- }
6831
- this.oneToOneCentering(fNodesRect, RectExtensions.fromElement(this.fComponentsStore.fFlow.hostElement), this.fNodes.map((x) => {
6832
- return Point.fromPoint(x.position);
6833
- }));
6834
- this.redrawWithAnimation();
6835
- this.completeDrag();
6836
- setTimeout(() => {
6837
- this.fComponentsStore.componentDataChanged();
6838
- }, F_CANVAS_ANIMATION_DURATION);
6839
- }
6840
- }
6841
- FCanvasComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FCanvasComponent, deps: [{ token: i0.ElementRef }, { token: i2.FMediator }, { token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Component });
6842
- FCanvasComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: FCanvasComponent, selector: "f-canvas", inputs: { position: "position", scale: "scale" }, outputs: { fCanvasChange: "fCanvasChange" }, host: { classAttribute: "f-component f-canvas" }, providers: [{ provide: F_CANVAS, useExisting: FCanvasComponent }], viewQueries: [{ propertyName: "fGroupsContainer", first: true, predicate: ["fGroupsContainer"], descendants: true, static: true }, { propertyName: "fNodesContainer", first: true, predicate: ["fNodesContainer"], descendants: true, static: true }, { propertyName: "fConnectionsContainer", first: true, predicate: ["fConnectionsContainer"], descendants: true, static: true }], exportAs: ["fComponent"], usesInheritance: true, ngImport: i0, template: "<ng-container>\n <div #fGroupsContainer>\n <ng-content select=\"[fGroup]\"></ng-content>\n </div>\n <div #fConnectionsContainer>\n <ng-content select=\"f-snap-connection\"></ng-content>\n <ng-content select=\"f-connection\"></ng-content>\n <ng-content select=\"f-connection-for-create\"></ng-content>\n </div>\n\n <div #fNodesContainer>\n <ng-content select=\"[fNode]\"></ng-content>\n </div>\n</ng-container>\n", styles: [":host{position:absolute;overflow:visible;width:100%;height:100%;left:0;top:0;transform-origin:0 0;pointer-events:none}:host.f-scaled-animate{transition:transform .09s}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
6843
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FCanvasComponent, decorators: [{
6844
- type: Component,
6845
- args: [{
6846
- selector: 'f-canvas',
6847
- templateUrl: './f-canvas.component.html',
6848
- styleUrls: ['./f-canvas.component.scss'],
6849
- exportAs: 'fComponent',
6850
- host: {
6851
- 'class': 'f-component f-canvas',
6852
- },
6853
- providers: [{ provide: F_CANVAS, useExisting: FCanvasComponent }],
6854
- changeDetection: ChangeDetectionStrategy.OnPush,
6855
- }]
6856
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i2.FMediator }, { type: FComponentsStore }]; }, propDecorators: { fCanvasChange: [{
6857
- type: Output
6858
- }], position: [{
6859
- type: Input
6860
- }], scale: [{
6861
- type: Input
6862
- }], fGroupsContainer: [{
6863
- type: ViewChild,
6864
- args: ['fGroupsContainer', { static: true }]
6865
- }], fNodesContainer: [{
6866
- type: ViewChild,
6867
- args: ['fNodesContainer', { static: true }]
6868
- }], fConnectionsContainer: [{
6869
- type: ViewChild,
6870
- args: ['fConnectionsContainer', { static: true }]
6871
- }] } });
6872
-
6873
- const F_CANVAS_PROVIDERS = [
6874
- FCanvasComponent,
6875
- ];
6876
-
6877
7131
  class LineElement {
6878
7132
  constructor(fBrowser, hostElement) {
6879
7133
  this.hostElement = hostElement;
@@ -7473,15 +7727,15 @@ class FFlowComponent extends FFlowBase {
7473
7727
  this.subscription$.add(this.subscribeOnComponentsCountChanges());
7474
7728
  }
7475
7729
  subscribeOnComponentsCountChanges() {
7476
- return this.fComponentsStore.componentsCount$.pipe(startWith(null), debounceTime(20)).subscribe(() => {
7730
+ return this.fComponentsStore.componentsCount$.pipe(startWith(null), debounceTime(1)).subscribe(() => {
7477
7731
  this.fMediator.send(new SortItemLayersRequest());
7478
7732
  });
7479
7733
  }
7480
7734
  subscribeOnElementsChanges() {
7481
- return this.fComponentsStore.componentsData$.pipe(startWith(null), debounceTime(20)).subscribe(() => {
7735
+ return this.fComponentsStore.componentsData$.pipe(startWith(null), debounceTime(1)).subscribe(() => {
7482
7736
  this.fMediator.send(new RedrawConnectionsRequest());
7483
7737
  if (!this.isLoaded) {
7484
- this.fMediator.send(new ShowConnectionsAfterCalculationsRequest());
7738
+ // this.fMediator.send(new ShowConnectionsAfterCalculationsRequest());
7485
7739
  this.isLoaded = true;
7486
7740
  this.fLoaded.emit();
7487
7741
  }
@@ -7612,7 +7866,7 @@ class FZoomBase {
7612
7866
  const pointerPositionInFlow = new Point(event.clientX, event.clientY).elementTransform(this.flowHost);
7613
7867
  this.fCanvas.setZoom(result, pointerPositionInFlow);
7614
7868
  this.fCanvas.redraw();
7615
- this.fCanvas.completeDrag();
7869
+ this.fCanvas.emitCanvasChangeEvent();
7616
7870
  }
7617
7871
  onDoubleClick(event) {
7618
7872
  var _a;
@@ -7629,7 +7883,7 @@ class FZoomBase {
7629
7883
  const pointerPositionInFlow = new Point(event.clientX, event.clientY).elementTransform(this.flowHost);
7630
7884
  this.fCanvas.setZoom(result, pointerPositionInFlow);
7631
7885
  this.fCanvas.redrawWithAnimation();
7632
- this.fCanvas.completeDrag();
7886
+ this.fCanvas.emitCanvasChangeEvent();
7633
7887
  }
7634
7888
  onZoomToCenter(deltaY, position) {
7635
7889
  const preventDefault = () => {
@@ -7648,7 +7902,7 @@ class FZoomBase {
7648
7902
  reset() {
7649
7903
  this.fCanvas.resetZoom();
7650
7904
  this.fCanvas.redraw();
7651
- this.fCanvas.completeDrag();
7905
+ this.fCanvas.emitCanvasChangeEvent();
7652
7906
  }
7653
7907
  unsubscribe() {
7654
7908
  this.listeners();
@@ -7717,7 +7971,7 @@ const F_ZOOM_PROVIDERS = [
7717
7971
  class FFlowModule {
7718
7972
  }
7719
7973
  FFlowModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FFlowModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
7720
- FFlowModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FFlowModule, declarations: [FBackgroundComponent, FRectPatternComponent, FCirclePatternComponent, FCanvasComponent, FZoomDirective, FConnectionTextComponent, FConnectionTextPathDirective, FConnectionDragHandleComponent, FConnectionGradientComponent, FConnectionPathComponent, FConnectionSelectionComponent, FConnectionComponent, FConnectionCenterDirective, FConnectionForCreateComponent, FMarkerDirective, FNodeInputDirective, FNodeOutletDirective, FNodeOutputDirective, FExternalItemDirective, FFlowComponent, FLineAlignmentComponent, FMinimapComponent, FMinimapCanvasDirective, FMinimapViewDirective, FMinimapFlowDirective, FGroupDirective, FNodeDirective, FDragHandleDirective, FResizeHandleDirective, FSelectionAreaComponent, FDraggableDirective], imports: [CommonModule], exports: [FBackgroundComponent, FRectPatternComponent, FCirclePatternComponent, FCanvasComponent, FZoomDirective, FConnectionTextComponent, FConnectionTextPathDirective, FConnectionDragHandleComponent, FConnectionGradientComponent, FConnectionPathComponent, FConnectionSelectionComponent, FConnectionComponent, FConnectionCenterDirective, FConnectionForCreateComponent, FMarkerDirective, FNodeInputDirective, FNodeOutletDirective, FNodeOutputDirective, FExternalItemDirective, FFlowComponent, FLineAlignmentComponent, FMinimapComponent, FMinimapCanvasDirective, FMinimapViewDirective, FMinimapFlowDirective, FGroupDirective, FNodeDirective, FDragHandleDirective, FResizeHandleDirective, FSelectionAreaComponent, FDraggableDirective] });
7974
+ FFlowModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FFlowModule, declarations: [FBackgroundComponent, FRectPatternComponent, FCirclePatternComponent, FCanvasComponent, FZoomDirective, FConnectionTextComponent, FConnectionTextPathDirective, FConnectionDragHandleComponent, FConnectionGradientComponent, FConnectionPathComponent, FConnectionSelectionComponent, FConnectionComponent, FConnectionCenterDirective, FConnectionForCreateComponent, FMarkerDirective, FSnapConnectionComponent, FNodeInputDirective, FNodeOutletDirective, FNodeOutputDirective, FExternalItemDirective, FFlowComponent, FLineAlignmentComponent, FMinimapComponent, FMinimapCanvasDirective, FMinimapViewDirective, FMinimapFlowDirective, FGroupDirective, FNodeDirective, FDragHandleDirective, FResizeHandleDirective, FSelectionAreaComponent, FDraggableDirective], imports: [CommonModule], exports: [FBackgroundComponent, FRectPatternComponent, FCirclePatternComponent, FCanvasComponent, FZoomDirective, FConnectionTextComponent, FConnectionTextPathDirective, FConnectionDragHandleComponent, FConnectionGradientComponent, FConnectionPathComponent, FConnectionSelectionComponent, FConnectionComponent, FConnectionCenterDirective, FConnectionForCreateComponent, FMarkerDirective, FSnapConnectionComponent, FNodeInputDirective, FNodeOutletDirective, FNodeOutputDirective, FExternalItemDirective, FFlowComponent, FLineAlignmentComponent, FMinimapComponent, FMinimapCanvasDirective, FMinimapViewDirective, FMinimapFlowDirective, FGroupDirective, FNodeDirective, FDragHandleDirective, FResizeHandleDirective, FSelectionAreaComponent, FDraggableDirective] });
7721
7975
  FFlowModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FFlowModule, imports: [[
7722
7976
  CommonModule,
7723
7977
  ]] });
@@ -7762,5 +8016,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
7762
8016
  * Generated bundle index. Do not edit.
7763
8017
  */
7764
8018
 
7765
- export { ApplyChildResizeRestrictionsExecution, ApplyChildResizeRestrictionsRequest, ApplyParentResizeRestrictionsExecution, ApplyParentResizeRestrictionsRequest, CANVAS_MOVE_FINALIZE_PROVIDERS, CANVAS_MOVE_PREPARATION_PROVIDERS, CANVAS_PROVIDERS, COMMON_PROVIDERS, CONNECTIONS_PROVIDERS, CONNECTION_GRADIENT, CONNECTION_PATH, CONNECTION_TEXT, CREATE_CONNECTION_DRAG_HANDLER_PROVIDERS, CREATE_CONNECTION_FINALIZE_PROVIDERS, CREATE_CONNECTION_FROM_OUTLET_PREPARATION_PROVIDERS, CREATE_CONNECTION_FROM_OUTPUT_PREPARATION_PROVIDERS, CREATE_CONNECTION_PREPARATION_PROVIDERS, CREATE_MOVE_NODE_DRAG_MODEL_FROM_SELECTION_PROVIDERS, CalculateCenterBetweenPointsHandler, CalculateCenterBetweenPointsRequest, CalculateChangedPositionExecution, CalculateChangedPositionRequest, CalculateChangedSizeExecution, CalculateChangedSizeRequest, CalculateConnectionCenterHandler, CalculateConnectionCenterRequest, CalculateConnectorConnectableSideHandler, CalculateConnectorConnectableSideRequest, CalculateFlowPointFromMinimapPointExecution, CalculateFlowPointFromMinimapPointRequest, CanvasDragHandler, CanvasMoveFinalizeExecution, CanvasMoveFinalizeRequest, CanvasMoveFinalizeValidator, CanvasMovePreparationExecution, CanvasMovePreparationRequest, CanvasMovePreparationValidator, CenterGroupOrNodeExecution, CenterGroupOrNodeRequest, ClearSelectionExecution, ClearSelectionRequest, ConnectionBaseDragHandler, ConnectionDragHandler, ConnectionSourceDragHandler, ConnectionTargetDragHandler, CreateConnectionDragHandler, CreateConnectionDragHandlerExecution, CreateConnectionDragHandlerRequest, CreateConnectionFinalizeExecution, CreateConnectionFinalizeRequest, CreateConnectionFinalizeValidator, CreateConnectionFromOutletPreparationExecution, CreateConnectionFromOutletPreparationRequest, CreateConnectionFromOutputPreparationExecution, CreateConnectionFromOutputPreparationRequest, CreateConnectionFromOutputPreparationValidator, CreateConnectionMarkersExecution, CreateConnectionMarkersRequest, CreateConnectionPreparationExecution, CreateConnectionPreparationRequest, CreateConnectionPreparationValidator, CreateMoveNodesDragModelFromSelectionExecution, CreateMoveNodesDragModelFromSelectionRequest, CreateRoundedRectFromElementExecution, CreateRoundedRectFromElementRequest, DRAG_AND_DROP_COMMON_PROVIDERS, EFConnectableSide, EFConnectionBehavior, EFConnectionType, EFMarkerType, EFResizeHandleType, EXTERNAL_ITEM_FINALIZE_PROVIDERS, EXTERNAL_ITEM_PREPARATION_PROVIDERS, EmitTransformChangesExecution, EmitTransformChangesRequest, ExternalItemDragHandler, ExternalItemFinalizeExecution, ExternalItemFinalizeRequest, ExternalItemFinalizeValidator, ExternalItemPreparationExecution, ExternalItemPreparationRequest, ExternalItemPreparationValidator, FBackgroundBase, FBackgroundComponent, FBezierPathBuilder, FCanvasBase, FCanvasChangeEvent, FCanvasComponent, FCirclePatternComponent, FComponentsStore, FConnectionBase, FConnectionCenterDirective, FConnectionComponent, FConnectionDragHandleComponent, FConnectionFactory, FConnectionForCreateComponent, FConnectionGradientComponent, FConnectionPathComponent, FConnectionSelectionComponent, FConnectionTextComponent, FConnectionTextPathDirective, FConnectorBase, FCreateConnectionEvent, FCreateNodeEvent, FDragHandleDirective, FDraggableBase, FDraggableDataContext, FDraggableDirective, FExternalItemBase, FExternalItemDirective, FExternalItemService, FFlowBase, FFlowComponent, FFlowModule, FGroupDirective, FLineAlignmentBase, FLineAlignmentComponent, FMarkerBase, FMarkerDirective, FMinimapCanvasDirective, FMinimapComponent, FMinimapData, FMinimapDragHandler, FMinimapFlowDirective, FMinimapViewDirective, FNodeBase, FNodeDirective, FNodeInputBase, FNodeInputDirective, FNodeOutletBase, FNodeOutletDirective, FNodeOutputBase, FNodeOutputDirective, FReassignConnectionEvent, FRectPatternComponent, FResizeHandleDirective, FResizeObserver, FRotateHandleDirective, FSegmentPathBuilder, FSelectionAreaBase, FSelectionAreaComponent, FSelectionChangeEvent, FSnapConnectionComponent, FStraightPathBuilder, FTransformStore, FZoomBase, FZoomDirective, F_BACKGROUND, F_BACKGROUND_PATTERN, F_BACKGROUND_PROVIDERS, F_CANVAS, F_CANVAS_ANIMATION_DURATION, F_CANVAS_PROVIDERS, F_CONNECTION_BUILDERS, F_CONNECTION_DRAG_HANDLE_CLASS, F_CONNECTION_IDENTIFIERS, F_CONNECTION_PROVIDERS, F_CONNECTORS_PROVIDERS, F_DRAGGABLE_PROVIDERS, F_DRAG_AND_DROP_PLUGIN, F_DRAG_HANDLE, F_EXTERNAL_ITEM, F_EXTERNAL_ITEM_DRAG_AND_DROP_PROVIDERS, F_EXTERNAL_ITEM_PROVIDERS, F_FLOW, F_FLOW_PROVIDERS, F_LINE_ALIGNMENT, F_LINE_ALIGNMENT_PROVIDERS, F_MARKER, F_MINIMAP_DRAG_AND_DROP_PROVIDERS, F_MINIMAP_PROVIDERS, F_NODE, F_NODE_INPUT, F_NODE_OUTLET, F_NODE_OUTPUT, F_NODE_PROVIDERS, F_RESIZE_HANDLE, F_SELECTED_CLASS, F_SELECTION_AREA_DRAG_AND_DROP_PROVIDERS, F_SELECTION_AREA_PROVIDERS, F_ZOOM, F_ZOOM_PROVIDERS, GET_CAN_BE_CONNECTED_OUTPUT_BY_OUTLET_PROVIDERS, GET_FLOW_STATE_PROVIDERS, GET_INPUT_UNDER_POINTER_PROVIDERS, GetCanBeConnectedOutputByOutletExecution, GetCanBeConnectedOutputByOutletRequest, GetCanBeConnectedOutputByOutletValidator, GetCanBeSelectedItemsExecution, GetConnectionLineExecution, GetConnectionLineRequest, GetDeepChildrenNodesAndGroupsExecution, GetDeepChildrenNodesAndGroupsRequest, GetElementRectInFlowExecution, GetElementRectInFlowRequest, GetFlowStateConnectionsExecution, GetFlowStateConnectionsRequest, GetFlowStateExecution, GetFlowStateNodesExecution, GetFlowStateNodesRequest, GetFlowStateRequest, GetInputRectInFlowExecution, GetInputRectInFlowRequest, GetInputRectInFlowResponse, GetInputUnderPointerExecution, GetInputUnderPointerRequest, GetInputUnderPointerValidator, GetNodeMoveRestrictionsExecution, GetNodeMoveRestrictionsRequest, GetNodePaddingExecution, GetNodePaddingRequest, GetNodeResizeRestrictionsExecution, GetNodeResizeRestrictionsRequest, GetNodesRectExecution, GetNodesRectRequest, GetNormalizedChildrenNodesRectExecution, GetNormalizedChildrenNodesRectRequest, GetNormalizedNodeRectExecution, GetNormalizedNodeRectRequest, GetNormalizedParentNodeRectExecution, GetNormalizedParentNodeRectRequest, GetOutputRectInFlowExecution, GetOutputRectInFlowRequest, GetOutputRectInFlowResponse, GetParentNodesExecution, GetParentNodesRequest, GetPositionInFlowExecution, GetPositionInFlowRequest, GetScaledNodeRectsWithFlowPositionExecution, GetScaledNodeRectsWithFlowPositionRequest, GetSelectionExecution, GetSelectionRequest, IsArrayHasParentNodeExecution, IsArrayHasParentNodeRequest, IsConnectionUnderNodeExecution, LineElement, LineService, MINIMAP_DRAG_FINALIZE_PROVIDERS, MINIMAP_DRAG_PREPARATION_PROVIDERS, MinimapDragFinalizeExecution, MinimapDragFinalizeRequest, MinimapDragFinalizeValidator, MinimapDragPreparationExecution, MinimapDragPreparationRequest, MinimapDragPreparationValidator, MoveFrontElementsBeforeTargetElementExecution, MoveFrontElementsBeforeTargetElementRequest, NODE_MOVE_FINALIZE_PROVIDERS, NODE_MOVE_PREPARATION_PROVIDERS, NODE_PROVIDERS, NODE_RESIZE_FINALIZE_PROVIDERS, NODE_RESIZE_PREPARATION_PROVIDERS, NODE_RESIZE_PROVIDERS, NearestCoordinateFinder, NodeDragHandler, NodeMoveFinalizeExecution, NodeMoveFinalizeRequest, NodeMoveFinalizeValidator, NodeMovePreparationExecution, NodeMovePreparationRequest, NodeMovePreparationValidator, NodeResizeByChildDragHandler, NodeResizeDragHandler, NodeResizeFinalizeExecution, NodeResizeFinalizeRequest, NodeResizeFinalizeValidator, NodeResizePreparationExecution, NodeResizePreparationRequest, NodeResizePreparationValidator, PutInputConnectionHandlersToArrayExecution, PutInputConnectionHandlersToArrayRequest, PutOutputConnectionHandlersToArrayExecution, PutOutputConnectionHandlersToArrayRequest, REASSIGN_CONNECTION_FINALIZE_PROVIDERS, REASSIGN_CONNECTION_PREPARATION_PROVIDERS, RESIZE_DIRECTIONS, ReassignConnectionDragHandler, ReassignConnectionFinalizeExecution, ReassignConnectionFinalizeRequest, ReassignConnectionFinalizeValidator, ReassignConnectionPreparationExecution, ReassignConnectionPreparationRequest, ReassignConnectionPreparationValidator, RedrawConnectionsExecution, RedrawConnectionsRequest, SELECTION_AREA_FINALIZE_PROVIDERS, SELECTION_AREA_PREPARATION_PROVIDERS, SINGLE_SELECT_PROVIDERS, SelectAllExecution, SelectAllRequest, SelectAndUpdateNodeLayerExecution, SelectAndUpdateNodeLayerRequest, SelectExecution, SelectRequest, SelectionAreaDragHandle, SelectionAreaFinalizeExecution, SelectionAreaFinalizeRequest, SelectionAreaFinalizeValidator, SelectionAreaPreparationExecution, SelectionAreaPreparationRequest, SelectionAreaPreparationValidator, ShowConnectionsAfterCalculationsExecution, ShowConnectionsAfterCalculationsRequest, SingleSelectExecution, SingleSelectRequest, SingleSelectValidator, SortItemLayersExecution, SortItemLayersRequest, SortItemsByParentExecution, SortItemsByParentRequest, SortNodeLayersExecution, SortNodeLayersRequest, SubscribeOnTransformChangesExecution, SubscribeOnTransformChangesRequest, UpdateItemAndChildrenLayersExecution, UpdateItemAndChildrenLayersRequest, checkRectIsFinite, createSVGElement, getExternalItem, getMarkerEndId, getMarkerSelectedEndId, getMarkerSelectedStartId, getMarkerStartId, isExternalItem, isGroup, isNode, isNodeInput, isNodeOutlet, isNodeOutput, mixinChangePosition, mixinChangeSelection, mixinChangeVisibility, mixinChangeZoom, mixinFitToParent, mixinOneToOneCentering };
8019
+ export { AddPatternToBackgroundExecution, AddPatternToBackgroundRequest, ApplyChildResizeRestrictionsExecution, ApplyChildResizeRestrictionsRequest, ApplyParentResizeRestrictionsExecution, ApplyParentResizeRestrictionsRequest, CANVAS_MOVE_FINALIZE_PROVIDERS, CANVAS_MOVE_PREPARATION_PROVIDERS, CANVAS_PROVIDERS, COMMON_PROVIDERS, CONNECTIONS_PROVIDERS, CONNECTION_DRAG_COMMON_PROVIDERS, CONNECTION_GRADIENT, CONNECTION_PATH, CONNECTION_TEXT, CREATE_CONNECTION_DRAG_HANDLER_PROVIDERS, CREATE_CONNECTION_FINALIZE_PROVIDERS, CREATE_CONNECTION_FROM_OUTLET_PREPARATION_PROVIDERS, CREATE_CONNECTION_FROM_OUTPUT_PREPARATION_PROVIDERS, CREATE_CONNECTION_PREPARATION_PROVIDERS, CREATE_MOVE_NODE_DRAG_MODEL_FROM_SELECTION_PROVIDERS, CalculateCenterBetweenPointsHandler, CalculateCenterBetweenPointsRequest, CalculateChangedPositionExecution, CalculateChangedPositionRequest, CalculateChangedSizeExecution, CalculateChangedSizeRequest, CalculateConnectionCenterHandler, CalculateConnectionCenterRequest, CalculateConnectorConnectableSideHandler, CalculateConnectorConnectableSideRequest, CalculateFlowPointFromMinimapPointExecution, CalculateFlowPointFromMinimapPointRequest, CanvasDragHandler, CanvasMoveFinalizeExecution, CanvasMoveFinalizeRequest, CanvasMoveFinalizeValidator, CanvasMovePreparationExecution, CanvasMovePreparationRequest, CanvasMovePreparationValidator, CenterGroupOrNodeExecution, CenterGroupOrNodeRequest, ClearSelectionExecution, ClearSelectionRequest, ConnectionBaseDragHandler, ConnectionDragHandler, ConnectionSourceDragHandler, ConnectionTargetDragHandler, CreateConnectionDragHandler, CreateConnectionDragHandlerExecution, CreateConnectionDragHandlerRequest, CreateConnectionFinalizeExecution, CreateConnectionFinalizeRequest, CreateConnectionFinalizeValidator, CreateConnectionFromOutletPreparationExecution, CreateConnectionFromOutletPreparationRequest, CreateConnectionFromOutputPreparationExecution, CreateConnectionFromOutputPreparationRequest, CreateConnectionFromOutputPreparationValidator, CreateConnectionMarkersExecution, CreateConnectionMarkersRequest, CreateConnectionPreparationExecution, CreateConnectionPreparationRequest, CreateConnectionPreparationValidator, CreateMoveNodesDragModelFromSelectionExecution, CreateMoveNodesDragModelFromSelectionRequest, CreateRoundedRectFromElementExecution, CreateRoundedRectFromElementRequest, DRAG_AND_DROP_COMMON_PROVIDERS, EFConnectableSide, EFConnectionBehavior, EFConnectionType, EFMarkerType, EFResizeHandleType, EXTERNAL_ITEM_FINALIZE_PROVIDERS, EXTERNAL_ITEM_PREPARATION_PROVIDERS, EmitTransformChangesExecution, EmitTransformChangesRequest, ExternalItemDragHandler, ExternalItemFinalizeExecution, ExternalItemFinalizeRequest, ExternalItemFinalizeValidator, ExternalItemPreparationExecution, ExternalItemPreparationRequest, ExternalItemPreparationValidator, FBackgroundBase, FBackgroundComponent, FBezierPathBuilder, FCanvasBase, FCanvasChangeEvent, FCanvasComponent, FCirclePatternComponent, FComponentsStore, FConnectionBase, FConnectionCenterDirective, FConnectionComponent, FConnectionDragHandleComponent, FConnectionFactory, FConnectionForCreateComponent, FConnectionGradientComponent, FConnectionPathComponent, FConnectionSelectionComponent, FConnectionTextComponent, FConnectionTextPathDirective, FConnectorBase, FCreateConnectionEvent, FCreateNodeEvent, FDragHandleDirective, FDraggableBase, FDraggableDataContext, FDraggableDirective, FExternalItemBase, FExternalItemDirective, FExternalItemService, FFlowBase, FFlowComponent, FFlowModule, FGroupDirective, FLineAlignmentBase, FLineAlignmentComponent, FMarkerBase, FMarkerDirective, FMinimapCanvasDirective, FMinimapComponent, FMinimapData, FMinimapDragHandler, FMinimapFlowDirective, FMinimapViewDirective, FNodeBase, FNodeDirective, FNodeInputBase, FNodeInputDirective, FNodeOutletBase, FNodeOutletDirective, FNodeOutputBase, FNodeOutputDirective, FReassignConnectionEvent, FRectPatternComponent, FResizeHandleDirective, FResizeObserver, FRotateHandleDirective, FSegmentPathBuilder, FSelectionAreaBase, FSelectionAreaComponent, FSelectionChangeEvent, FSnapConnectionComponent, FStraightPathBuilder, FTransformStore, FZoomBase, FZoomDirective, F_BACKGROUND, F_BACKGROUND_FEATURES, F_BACKGROUND_PATTERN, F_BACKGROUND_PROVIDERS, F_CANVAS, F_CANVAS_ANIMATION_DURATION, F_CANVAS_FEATURES, F_CANVAS_PROVIDERS, F_CONNECTION_BUILDERS, F_CONNECTION_DRAG_HANDLE_CLASS, F_CONNECTION_IDENTIFIERS, F_CONNECTION_PROVIDERS, F_CONNECTORS_PROVIDERS, F_DRAGGABLE_PROVIDERS, F_DRAG_AND_DROP_PLUGIN, F_DRAG_HANDLE, F_EXTERNAL_ITEM, F_EXTERNAL_ITEM_DRAG_AND_DROP_PROVIDERS, F_EXTERNAL_ITEM_PROVIDERS, F_FLOW, F_FLOW_PROVIDERS, F_LINE_ALIGNMENT, F_LINE_ALIGNMENT_PROVIDERS, F_MARKER, F_MINIMAP_DRAG_AND_DROP_PROVIDERS, F_MINIMAP_PROVIDERS, F_NODE, F_NODE_INPUT, F_NODE_OUTLET, F_NODE_OUTPUT, F_NODE_PROVIDERS, F_RESIZE_HANDLE, F_SELECTED_CLASS, F_SELECTION_AREA_DRAG_AND_DROP_PROVIDERS, F_SELECTION_AREA_PROVIDERS, F_SELECTION_FEATURES, F_ZOOM, F_ZOOM_PROVIDERS, FindClosestInputUsingSnapThresholdExecution, FindClosestInputUsingSnapThresholdRequest, FitToFlowExecution, FitToFlowRequest, GET_CAN_BE_CONNECTED_OUTPUT_BY_OUTLET_PROVIDERS, GET_FLOW_STATE_PROVIDERS, GetAllCanBeConnectedInputPositionsExecution, GetAllCanBeConnectedInputPositionsRequest, GetCanBeConnectedOutputByOutletExecution, GetCanBeConnectedOutputByOutletRequest, GetCanBeConnectedOutputByOutletValidator, GetCanBeSelectedItemsExecution, GetConnectionLineExecution, GetConnectionLineRequest, GetConnectorWithRectExecution, GetConnectorWithRectRequest, GetDeepChildrenNodesAndGroupsExecution, GetDeepChildrenNodesAndGroupsRequest, GetElementRectInFlowExecution, GetElementRectInFlowRequest, GetFlowStateConnectionsExecution, GetFlowStateConnectionsRequest, GetFlowStateExecution, GetFlowStateNodesExecution, GetFlowStateNodesRequest, GetFlowStateRequest, GetInputUnderPointerExecution, GetInputUnderPointerRequest, GetInputUnderPointerValidator, GetNodeMoveRestrictionsExecution, GetNodeMoveRestrictionsRequest, GetNodePaddingExecution, GetNodePaddingRequest, GetNodeResizeRestrictionsExecution, GetNodeResizeRestrictionsRequest, GetNodesRectExecution, GetNodesRectRequest, GetNormalizedChildrenNodesRectExecution, GetNormalizedChildrenNodesRectRequest, GetNormalizedNodeRectExecution, GetNormalizedNodeRectRequest, GetNormalizedParentNodeRectExecution, GetNormalizedParentNodeRectRequest, GetParentNodesExecution, GetParentNodesRequest, GetPositionInFlowExecution, GetPositionInFlowRequest, GetScaledNodeRectsWithFlowPositionExecution, GetScaledNodeRectsWithFlowPositionRequest, GetSelectionExecution, GetSelectionRequest, InputCanvasPositionExecution, InputCanvasPositionRequest, InputCanvasScaleExecution, InputCanvasScaleRequest, IsArrayHasParentNodeExecution, IsArrayHasParentNodeRequest, IsConnectionUnderNodeExecution, LineElement, LineService, MINIMAP_DRAG_FINALIZE_PROVIDERS, MINIMAP_DRAG_PREPARATION_PROVIDERS, MinimapDragFinalizeExecution, MinimapDragFinalizeRequest, MinimapDragFinalizeValidator, MinimapDragPreparationExecution, MinimapDragPreparationRequest, MinimapDragPreparationValidator, MoveFrontElementsBeforeTargetElementExecution, MoveFrontElementsBeforeTargetElementRequest, NODE_MOVE_FINALIZE_PROVIDERS, NODE_MOVE_PREPARATION_PROVIDERS, NODE_PROVIDERS, NODE_RESIZE_FINALIZE_PROVIDERS, NODE_RESIZE_PREPARATION_PROVIDERS, NODE_RESIZE_PROVIDERS, NearestCoordinateFinder, NodeDragHandler, NodeMoveFinalizeExecution, NodeMoveFinalizeRequest, NodeMoveFinalizeValidator, NodeMovePreparationExecution, NodeMovePreparationRequest, NodeMovePreparationValidator, NodeResizeByChildDragHandler, NodeResizeDragHandler, NodeResizeFinalizeExecution, NodeResizeFinalizeRequest, NodeResizeFinalizeValidator, NodeResizePreparationExecution, NodeResizePreparationRequest, NodeResizePreparationValidator, PutInputConnectionHandlersToArrayExecution, PutInputConnectionHandlersToArrayRequest, PutOutputConnectionHandlersToArrayExecution, PutOutputConnectionHandlersToArrayRequest, REASSIGN_CONNECTION_FINALIZE_PROVIDERS, REASSIGN_CONNECTION_PREPARATION_PROVIDERS, RESIZE_DIRECTIONS, ReassignConnectionDragHandler, ReassignConnectionFinalizeExecution, ReassignConnectionFinalizeRequest, ReassignConnectionFinalizeValidator, ReassignConnectionPreparationExecution, ReassignConnectionPreparationRequest, ReassignConnectionPreparationValidator, RedrawConnectionsExecution, RedrawConnectionsRequest, ResetScaleAndCenterExecution, ResetScaleAndCenterRequest, ResetScaleExecution, ResetScaleRequest, SELECTION_AREA_FINALIZE_PROVIDERS, SELECTION_AREA_PREPARATION_PROVIDERS, SINGLE_SELECT_PROVIDERS, SelectAllExecution, SelectAllRequest, SelectAndUpdateNodeLayerExecution, SelectAndUpdateNodeLayerRequest, SelectExecution, SelectRequest, SelectionAreaDragHandle, SelectionAreaFinalizeExecution, SelectionAreaFinalizeRequest, SelectionAreaFinalizeValidator, SelectionAreaPreparationExecution, SelectionAreaPreparationRequest, SelectionAreaPreparationValidator, ShowConnectionsAfterCalculationsExecution, ShowConnectionsAfterCalculationsRequest, SingleSelectExecution, SingleSelectRequest, SingleSelectValidator, SortItemLayersExecution, SortItemLayersRequest, SortItemsByParentExecution, SortItemsByParentRequest, SortNodeLayersExecution, SortNodeLayersRequest, SubscribeOnTransformChangesExecution, SubscribeOnTransformChangesRequest, UpdateItemAndChildrenLayersExecution, UpdateItemAndChildrenLayersRequest, UpdateScaleExecution, UpdateScaleRequest, checkRectIsFinite, createSVGElement, getExternalItem, getMarkerEndId, getMarkerSelectedEndId, getMarkerSelectedStartId, getMarkerStartId, isExternalItem, isGroup, isNode, isNodeOutlet, isNodeOutput, mixinChangeSelection, mixinChangeVisibility };
7766
8020
  //# sourceMappingURL=foblex-flow.js.map