@foblex/flow 0.0.1
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.
- package/README.md +24 -0
- package/esm2022/foblex-flow.mjs +5 -0
- package/esm2022/lib/common-behaviours/change-position.mjs +15 -0
- package/esm2022/lib/common-behaviours/change-zoom/change-zoom.mjs +25 -0
- package/esm2022/lib/common-behaviours/change-zoom/i-can-change-zoom.mjs +2 -0
- package/esm2022/lib/common-behaviours/change-zoom/index.mjs +3 -0
- package/esm2022/lib/common-behaviours/constructor.mjs +2 -0
- package/esm2022/lib/common-behaviours/fit-to-parent/fit-to-parent.mjs +27 -0
- package/esm2022/lib/common-behaviours/fit-to-parent/i-can-fit-to-parent.mjs +2 -0
- package/esm2022/lib/common-behaviours/fit-to-parent/index.mjs +3 -0
- package/esm2022/lib/common-behaviours/index.mjs +6 -0
- package/esm2022/lib/common-behaviours/one-to-one-centering/i-can-one-to-one-centering.mjs +2 -0
- package/esm2022/lib/common-behaviours/one-to-one-centering/index.mjs +3 -0
- package/esm2022/lib/common-behaviours/one-to-one-centering/one-to-one-centering.mjs +24 -0
- package/esm2022/lib/components/f-connection/f-connection-base.mjs +28 -0
- package/esm2022/lib/components/f-connection/f-connection-identifiers.mjs +21 -0
- package/esm2022/lib/components/f-connection/f-connection-text/f-connection-text-path.directive.mjs +38 -0
- package/esm2022/lib/components/f-connection/f-connection-text/f-connection-text.component.mjs +55 -0
- package/esm2022/lib/components/f-connection/f-connection-text/index.mjs +3 -0
- package/esm2022/lib/components/f-connection/f-connection.component.mjs +91 -0
- package/esm2022/lib/components/f-connection/f-connection.module.mjs +47 -0
- package/esm2022/lib/components/f-connection/f-drag-handle/f-connection-drag-handle.component.mjs +30 -0
- package/esm2022/lib/components/f-connection/f-drag-handle/index.mjs +2 -0
- package/esm2022/lib/components/f-connection/f-gradient/f-connection-gradient.component.mjs +59 -0
- package/esm2022/lib/components/f-connection/f-gradient/index.mjs +2 -0
- package/esm2022/lib/components/f-connection/f-path/f-connection-path.component.mjs +55 -0
- package/esm2022/lib/components/f-connection/f-path/index.mjs +2 -0
- package/esm2022/lib/components/f-connection/f-selection/f-connection-selection.component.mjs +34 -0
- package/esm2022/lib/components/f-connection/f-selection/index.mjs +2 -0
- package/esm2022/lib/components/f-connection/f-temp-connection/f-temp-connection.component.mjs +61 -0
- package/esm2022/lib/components/f-connection/f-temp-connection/index.mjs +3 -0
- package/esm2022/lib/components/f-connection/f-temp-connection/temp-connection-input-output-model.mjs +7 -0
- package/esm2022/lib/components/f-connection/get-connection-intersect.mjs +10 -0
- package/esm2022/lib/components/f-connection/i-input-output-model.mjs +2 -0
- package/esm2022/lib/components/f-connection/index.mjs +13 -0
- package/esm2022/lib/components/f-connection/public-api.mjs +4 -0
- package/esm2022/lib/components/f-connectors/f-connector-base.mjs +14 -0
- package/esm2022/lib/components/f-connectors/f-node-input/f-node-input-base.mjs +19 -0
- package/esm2022/lib/components/f-connectors/f-node-input/f-node-input.directive.mjs +58 -0
- package/esm2022/lib/components/f-connectors/f-node-input/index.mjs +4 -0
- package/esm2022/lib/components/f-connectors/f-node-input/is-node-input.mjs +4 -0
- package/esm2022/lib/components/f-connectors/f-node-input/public-api.mjs +2 -0
- package/esm2022/lib/components/f-connectors/f-node-outlet/f-node-outlet-base.mjs +22 -0
- package/esm2022/lib/components/f-connectors/f-node-outlet/f-node-outlet.directive.mjs +56 -0
- package/esm2022/lib/components/f-connectors/f-node-outlet/index.mjs +4 -0
- package/esm2022/lib/components/f-connectors/f-node-outlet/is-node-outlet.mjs +4 -0
- package/esm2022/lib/components/f-connectors/f-node-outlet/public-api.mjs +2 -0
- package/esm2022/lib/components/f-connectors/f-node-output/f-node-output-base.mjs +19 -0
- package/esm2022/lib/components/f-connectors/f-node-output/f-node-output.directive.mjs +54 -0
- package/esm2022/lib/components/f-connectors/f-node-output/index.mjs +4 -0
- package/esm2022/lib/components/f-connectors/f-node-output/is-node-output.mjs +4 -0
- package/esm2022/lib/components/f-connectors/f-node-output/public-api.mjs +2 -0
- package/esm2022/lib/components/f-connectors/f-out-connector-base.mjs +4 -0
- package/esm2022/lib/components/f-connectors/get-element-rect-in-canvas.mjs +8 -0
- package/esm2022/lib/components/f-connectors/index.mjs +7 -0
- package/esm2022/lib/components/f-connectors/public-api.mjs +4 -0
- package/esm2022/lib/components/f-flow/f-flow-base.mjs +54 -0
- package/esm2022/lib/components/f-flow/f-flow.component.mjs +67 -0
- package/esm2022/lib/components/f-flow/index.mjs +3 -0
- package/esm2022/lib/components/f-flow/public-api.mjs +2 -0
- package/esm2022/lib/components/f-node/f-drag-handle/f-drag-handle.directive.mjs +54 -0
- package/esm2022/lib/components/f-node/f-drag-handle/index.mjs +3 -0
- package/esm2022/lib/components/f-node/f-drag-handle/is-drag-handle.mjs +20 -0
- package/esm2022/lib/components/f-node/f-drag-handle/public-api.mjs +2 -0
- package/esm2022/lib/components/f-node/f-foreign-object/f-foreign-object-base.mjs +40 -0
- package/esm2022/lib/components/f-node/f-foreign-object/f-foreign-object.component.mjs +49 -0
- package/esm2022/lib/components/f-node/f-foreign-object/index.mjs +3 -0
- package/esm2022/lib/components/f-node/f-foreign-object/public-api.mjs +2 -0
- package/esm2022/lib/components/f-node/f-node-base.mjs +28 -0
- package/esm2022/lib/components/f-node/f-node.component.mjs +63 -0
- package/esm2022/lib/components/f-node/index.mjs +5 -0
- package/esm2022/lib/components/f-node/public-api.mjs +4 -0
- package/esm2022/lib/components/index.mjs +6 -0
- package/esm2022/lib/components/public-api.mjs +5 -0
- package/esm2022/lib/directives/f-connect-if-intersect/connect-if-intersect/connect-if-intersect.handler.mjs +58 -0
- package/esm2022/lib/directives/f-connect-if-intersect/connect-if-intersect/connect-if-intersect.request.mjs +6 -0
- package/esm2022/lib/directives/f-connect-if-intersect/connect-if-intersect/index.mjs +3 -0
- package/esm2022/lib/directives/f-connect-if-intersect/f-connect-if-intersect.directive.mjs +41 -0
- package/esm2022/lib/directives/f-connect-if-intersect/index.mjs +3 -0
- package/esm2022/lib/directives/f-connect-if-intersect/public-api.mjs +2 -0
- package/esm2022/lib/directives/f-containers/f-connections-container/f-connections-container-base.mjs +32 -0
- package/esm2022/lib/directives/f-containers/f-connections-container/f-connections-container.component.mjs +30 -0
- package/esm2022/lib/directives/f-containers/f-connections-container/index.mjs +3 -0
- package/esm2022/lib/directives/f-containers/f-connections-container/public-api.mjs +2 -0
- package/esm2022/lib/directives/f-containers/f-items-container/f-items-container-base.mjs +44 -0
- package/esm2022/lib/directives/f-containers/f-items-container/f-items-container.directive.mjs +25 -0
- package/esm2022/lib/directives/f-containers/f-items-container/index.mjs +3 -0
- package/esm2022/lib/directives/f-containers/f-items-container/public-api.mjs +2 -0
- package/esm2022/lib/directives/f-containers/f-nodes-container/f-nodes-container-base.mjs +39 -0
- package/esm2022/lib/directives/f-containers/f-nodes-container/f-nodes-container.component.mjs +25 -0
- package/esm2022/lib/directives/f-containers/f-nodes-container/index.mjs +3 -0
- package/esm2022/lib/directives/f-containers/f-nodes-container/public-api.mjs +2 -0
- package/esm2022/lib/directives/f-containers/index.mjs +4 -0
- package/esm2022/lib/directives/f-containers/public-api.mjs +4 -0
- package/esm2022/lib/directives/f-draggable/canvas/canvas-on-pointer-down/canvas-on-pointer-down.handler.mjs +24 -0
- package/esm2022/lib/directives/f-draggable/canvas/canvas-on-pointer-down/canvas-on-pointer-down.request.mjs +6 -0
- package/esm2022/lib/directives/f-draggable/canvas/canvas-on-pointer-down/index.mjs +3 -0
- package/esm2022/lib/directives/f-draggable/canvas/canvas-on-pointer-move/canvas.on-pointer-move.mjs +20 -0
- package/esm2022/lib/directives/f-draggable/canvas/canvas-on-pointer-move/index.mjs +2 -0
- package/esm2022/lib/directives/f-draggable/canvas/index.mjs +3 -0
- package/esm2022/lib/directives/f-draggable/connections/create-connection/create-connection-on-pointer-down/create-connection-on-pointer-down.request.mjs +7 -0
- package/esm2022/lib/directives/f-draggable/connections/create-connection/create-connection-on-pointer-down/create-connection.on-pointer-down.mjs +78 -0
- package/esm2022/lib/directives/f-draggable/connections/create-connection/create-connection-on-pointer-down/index.mjs +3 -0
- package/esm2022/lib/directives/f-draggable/connections/create-connection/create-connection-on-pointer-up/create-connection-on-pointer-up.request.mjs +7 -0
- package/esm2022/lib/directives/f-draggable/connections/create-connection/create-connection-on-pointer-up/create-connection.on-pointer-up.mjs +31 -0
- package/esm2022/lib/directives/f-draggable/connections/create-connection/create-connection-on-pointer-up/index.mjs +3 -0
- package/esm2022/lib/directives/f-draggable/connections/create-connection/create-connection.event.mjs +7 -0
- package/esm2022/lib/directives/f-draggable/connections/create-connection/create-connection.on-pointer-move.mjs +28 -0
- package/esm2022/lib/directives/f-draggable/connections/create-connection/find-first-can-be-connected-output-by-outlet/find-first-can-be-connected-output-by-outlet.handler.mjs +20 -0
- package/esm2022/lib/directives/f-draggable/connections/create-connection/find-first-can-be-connected-output-by-outlet/find-first-can-be-connected-output-by-outlet.request.mjs +6 -0
- package/esm2022/lib/directives/f-draggable/connections/create-connection/find-first-can-be-connected-output-by-outlet/index.mjs +3 -0
- package/esm2022/lib/directives/f-draggable/connections/create-connection/index.mjs +6 -0
- package/esm2022/lib/directives/f-draggable/connections/find-inputs-under-pointer/find-inputs-under-pointer.handler.mjs +25 -0
- package/esm2022/lib/directives/f-draggable/connections/find-inputs-under-pointer/find-inputs-under-pointer.request.mjs +7 -0
- package/esm2022/lib/directives/f-draggable/connections/find-inputs-under-pointer/first-not-connected-input-of-node-under-pointer/first-not-connected-input-of-node-under-pointer.handler.mjs +20 -0
- package/esm2022/lib/directives/f-draggable/connections/find-inputs-under-pointer/first-not-connected-input-of-node-under-pointer/first-not-connected-input-of-node-under-pointer.request.mjs +6 -0
- package/esm2022/lib/directives/f-draggable/connections/find-inputs-under-pointer/first-not-connected-input-of-node-under-pointer/index.mjs +3 -0
- package/esm2022/lib/directives/f-draggable/connections/find-inputs-under-pointer/index.mjs +5 -0
- package/esm2022/lib/directives/f-draggable/connections/find-inputs-under-pointer/inputs-under-pointer/index.mjs +3 -0
- package/esm2022/lib/directives/f-draggable/connections/find-inputs-under-pointer/inputs-under-pointer/inputs-under-pointer.handler.mjs +14 -0
- package/esm2022/lib/directives/f-draggable/connections/find-inputs-under-pointer/inputs-under-pointer/inputs-under-pointer.request.mjs +6 -0
- package/esm2022/lib/directives/f-draggable/connections/index.mjs +4 -0
- package/esm2022/lib/directives/f-draggable/connections/reassign-connection/index.mjs +5 -0
- package/esm2022/lib/directives/f-draggable/connections/reassign-connection/reassign-connection.event.mjs +9 -0
- package/esm2022/lib/directives/f-draggable/connections/reassign-connection/reassign-on-pointer-down/index.mjs +3 -0
- package/esm2022/lib/directives/f-draggable/connections/reassign-connection/reassign-on-pointer-down/reassign-connection-on-pointer-down.request.mjs +7 -0
- package/esm2022/lib/directives/f-draggable/connections/reassign-connection/reassign-on-pointer-down/reassign-connection.on-pointer-down.mjs +36 -0
- package/esm2022/lib/directives/f-draggable/connections/reassign-connection/reassign-on-pointer-move/index.mjs +2 -0
- package/esm2022/lib/directives/f-draggable/connections/reassign-connection/reassign-on-pointer-move/reassign-connection.on-pointer-move.mjs +31 -0
- package/esm2022/lib/directives/f-draggable/connections/reassign-connection/reassign-on-pointer-up/index.mjs +3 -0
- package/esm2022/lib/directives/f-draggable/connections/reassign-connection/reassign-on-pointer-up/reassign-connection-on-pointer-up.request.mjs +7 -0
- package/esm2022/lib/directives/f-draggable/connections/reassign-connection/reassign-on-pointer-up/reassign-connection.on-pointer-up.mjs +23 -0
- package/esm2022/lib/directives/f-draggable/default-drag-handler/default-drag.handler.mjs +11 -0
- package/esm2022/lib/directives/f-draggable/default-drag-handler/index.mjs +2 -0
- package/esm2022/lib/directives/f-draggable/e-draggable-type.mjs +12 -0
- package/esm2022/lib/directives/f-draggable/external-item/create-node.event.mjs +7 -0
- package/esm2022/lib/directives/f-draggable/external-item/external-item-on-pointer-down/external-item-on-pointer-down.handler.mjs +28 -0
- package/esm2022/lib/directives/f-draggable/external-item/external-item-on-pointer-down/external-item-on-pointer-down.request.mjs +6 -0
- package/esm2022/lib/directives/f-draggable/external-item/external-item-on-pointer-down/index.mjs +3 -0
- package/esm2022/lib/directives/f-draggable/external-item/external-item-on-pointer-move/external-item-on-pointer-move.handler.mjs +30 -0
- package/esm2022/lib/directives/f-draggable/external-item/external-item-on-pointer-move/index.mjs +2 -0
- package/esm2022/lib/directives/f-draggable/external-item/external-item-on-pointer-up/external-item-on-pointer-up.handler.mjs +26 -0
- package/esm2022/lib/directives/f-draggable/external-item/external-item-on-pointer-up/external-item-on-pointer-up.request.mjs +7 -0
- package/esm2022/lib/directives/f-draggable/external-item/external-item-on-pointer-up/index.mjs +3 -0
- package/esm2022/lib/directives/f-draggable/external-item/index.mjs +5 -0
- package/esm2022/lib/directives/f-draggable/f-draggable-base.mjs +103 -0
- package/esm2022/lib/directives/f-draggable/f-draggable.directive.mjs +52 -0
- package/esm2022/lib/directives/f-draggable/f-draggable.module.mjs +49 -0
- package/esm2022/lib/directives/f-draggable/f-draggable.service.mjs +23 -0
- package/esm2022/lib/directives/f-draggable/i-drag-handler.mjs +2 -0
- package/esm2022/lib/directives/f-draggable/i-draggable-item.mjs +2 -0
- package/esm2022/lib/directives/f-draggable/index.mjs +14 -0
- package/esm2022/lib/directives/f-draggable/node/index.mjs +4 -0
- package/esm2022/lib/directives/f-draggable/node/node-on-pointer-down/index.mjs +3 -0
- package/esm2022/lib/directives/f-draggable/node/node-on-pointer-down/node-on-pointer-down.request.mjs +9 -0
- package/esm2022/lib/directives/f-draggable/node/node-on-pointer-down/node.on-pointer-down.mjs +88 -0
- package/esm2022/lib/directives/f-draggable/node/node-on-pointer-move/f-connection-source.drag-handler.mjs +24 -0
- package/esm2022/lib/directives/f-draggable/node/node-on-pointer-move/f-connection-target.drag-handler.mjs +24 -0
- package/esm2022/lib/directives/f-draggable/node/node-on-pointer-move/f-connection.drag-handler.mjs +22 -0
- package/esm2022/lib/directives/f-draggable/node/node-on-pointer-move/index.mjs +5 -0
- package/esm2022/lib/directives/f-draggable/node/node-on-pointer-move/node.on-pointer-move.mjs +23 -0
- package/esm2022/lib/directives/f-draggable/node/node-on-pointer-up/index.mjs +3 -0
- package/esm2022/lib/directives/f-draggable/node/node-on-pointer-up/node-on-pointer-up.request.mjs +7 -0
- package/esm2022/lib/directives/f-draggable/node/node-on-pointer-up/node.on-pointer-up.mjs +28 -0
- package/esm2022/lib/directives/f-draggable/public-api.mjs +2 -0
- package/esm2022/lib/directives/f-draggable/selection/index.mjs +4 -0
- package/esm2022/lib/directives/f-draggable/selection/selection-on-pointer-down/index.mjs +3 -0
- package/esm2022/lib/directives/f-draggable/selection/selection-on-pointer-down/selection-on-pointer-down.request.mjs +8 -0
- package/esm2022/lib/directives/f-draggable/selection/selection-on-pointer-down/selection.on-pointer-down.mjs +60 -0
- package/esm2022/lib/directives/f-draggable/selection/selection-on-pointer-move/index.mjs +2 -0
- package/esm2022/lib/directives/f-draggable/selection/selection-on-pointer-move/selection.on-pointer-move.mjs +54 -0
- package/esm2022/lib/directives/f-draggable/selection/selection-on-pointer-up/index.mjs +3 -0
- package/esm2022/lib/directives/f-draggable/selection/selection-on-pointer-up/selection-on-pointer-up.request.mjs +8 -0
- package/esm2022/lib/directives/f-draggable/selection/selection-on-pointer-up/selection.on-pointer-up.mjs +22 -0
- package/esm2022/lib/directives/f-external-item/f-external-item-base.mjs +11 -0
- package/esm2022/lib/directives/f-external-item/f-external-item.directive.mjs +44 -0
- package/esm2022/lib/directives/f-external-item/f-external-item.service.mjs +25 -0
- package/esm2022/lib/directives/f-external-item/index.mjs +5 -0
- package/esm2022/lib/directives/f-external-item/is-external-item.mjs +7 -0
- package/esm2022/lib/directives/f-external-item/public-api.mjs +2 -0
- package/esm2022/lib/directives/f-line-alignment/domain/find-nearest-coordinate-by-x.mjs +40 -0
- package/esm2022/lib/directives/f-line-alignment/domain/find-nearest-coordinate-by-y.mjs +40 -0
- package/esm2022/lib/directives/f-line-alignment/domain/i-line-alignment-result.mjs +2 -0
- package/esm2022/lib/directives/f-line-alignment/domain/i-nearest-coordinate-result.mjs +2 -0
- package/esm2022/lib/directives/f-line-alignment/domain/index.mjs +5 -0
- package/esm2022/lib/directives/f-line-alignment/f-line-alignment.directive.mjs +105 -0
- package/esm2022/lib/directives/f-line-alignment/index.mjs +3 -0
- package/esm2022/lib/directives/f-line-alignment/public-api.mjs +2 -0
- package/esm2022/lib/directives/f-selection/f-selection.directive.mjs +40 -0
- package/esm2022/lib/directives/f-selection/index.mjs +2 -0
- package/esm2022/lib/directives/f-selection/public-api.mjs +2 -0
- package/esm2022/lib/directives/f-zoom/f-zoom-base.mjs +87 -0
- package/esm2022/lib/directives/f-zoom/f-zoom.directive.mjs +57 -0
- package/esm2022/lib/directives/f-zoom/index.mjs +3 -0
- package/esm2022/lib/directives/f-zoom/public-api.mjs +2 -0
- package/esm2022/lib/directives/index.mjs +8 -0
- package/esm2022/lib/directives/public-api.mjs +8 -0
- package/esm2022/lib/f-flow.module.mjs +79 -0
- package/esm2022/lib/i-has-state-changes.mjs +2 -0
- package/esm2022/lib/i-selectable.mjs +2 -0
- package/esm2022/lib/internal/f-backgroud/f-background-base.mjs +25 -0
- package/esm2022/lib/internal/f-backgroud/f-background.directive.mjs +24 -0
- package/esm2022/lib/internal/f-backgroud/index.mjs +3 -0
- package/esm2022/lib/internal/f-canvas/f-canvas-base.mjs +25 -0
- package/esm2022/lib/internal/f-canvas/f-canvas.directive.mjs +19 -0
- package/esm2022/lib/internal/f-canvas/index.mjs +3 -0
- package/esm2022/lib/internal/index.mjs +3 -0
- package/esm2022/lib/public-api.mjs +5 -0
- package/esm2022/public-api.mjs +2 -0
- package/fesm2022/foblex-flow.mjs +3055 -0
- package/fesm2022/foblex-flow.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/common-behaviours/change-position.d.ts +9 -0
- package/lib/common-behaviours/change-zoom/change-zoom.d.ts +6 -0
- package/lib/common-behaviours/change-zoom/i-can-change-zoom.d.ts +6 -0
- package/lib/common-behaviours/change-zoom/index.d.ts +2 -0
- package/lib/common-behaviours/constructor.d.ts +2 -0
- package/lib/common-behaviours/fit-to-parent/fit-to-parent.d.ts +6 -0
- package/lib/common-behaviours/fit-to-parent/i-can-fit-to-parent.d.ts +4 -0
- package/lib/common-behaviours/fit-to-parent/index.d.ts +2 -0
- package/lib/common-behaviours/index.d.ts +5 -0
- package/lib/common-behaviours/one-to-one-centering/i-can-one-to-one-centering.d.ts +4 -0
- package/lib/common-behaviours/one-to-one-centering/index.d.ts +2 -0
- package/lib/common-behaviours/one-to-one-centering/one-to-one-centering.d.ts +6 -0
- package/lib/components/f-connection/f-connection-base.d.ts +28 -0
- package/lib/components/f-connection/f-connection-identifiers.d.ts +8 -0
- package/lib/components/f-connection/f-connection-text/f-connection-text-path.directive.d.ts +17 -0
- package/lib/components/f-connection/f-connection-text/f-connection-text.component.d.ts +19 -0
- package/lib/components/f-connection/f-connection-text/index.d.ts +2 -0
- package/lib/components/f-connection/f-connection.component.d.ts +33 -0
- package/lib/components/f-connection/f-connection.module.d.ts +15 -0
- package/lib/components/f-connection/f-drag-handle/f-connection-drag-handle.component.d.ts +13 -0
- package/lib/components/f-connection/f-drag-handle/index.d.ts +1 -0
- package/lib/components/f-connection/f-gradient/f-connection-gradient.component.d.ts +21 -0
- package/lib/components/f-connection/f-gradient/index.d.ts +1 -0
- package/lib/components/f-connection/f-path/f-connection-path.component.d.ts +20 -0
- package/lib/components/f-connection/f-path/index.d.ts +1 -0
- package/lib/components/f-connection/f-selection/f-connection-selection.component.d.ts +15 -0
- package/lib/components/f-connection/f-selection/index.d.ts +1 -0
- package/lib/components/f-connection/f-temp-connection/f-temp-connection.component.d.ts +27 -0
- package/lib/components/f-connection/f-temp-connection/index.d.ts +2 -0
- package/lib/components/f-connection/f-temp-connection/temp-connection-input-output-model.d.ts +7 -0
- package/lib/components/f-connection/get-connection-intersect.d.ts +2 -0
- package/lib/components/f-connection/i-input-output-model.d.ts +5 -0
- package/lib/components/f-connection/index.d.ts +12 -0
- package/lib/components/f-connection/public-api.d.ts +3 -0
- package/lib/components/f-connectors/f-connector-base.d.ts +13 -0
- package/lib/components/f-connectors/f-node-input/f-node-input-base.d.ts +11 -0
- package/lib/components/f-connectors/f-node-input/f-node-input.directive.d.ts +17 -0
- package/lib/components/f-connectors/f-node-input/index.d.ts +3 -0
- package/lib/components/f-connectors/f-node-input/is-node-input.d.ts +1 -0
- package/lib/components/f-connectors/f-node-input/public-api.d.ts +1 -0
- package/lib/components/f-connectors/f-node-outlet/f-node-outlet-base.d.ts +12 -0
- package/lib/components/f-connectors/f-node-outlet/f-node-outlet.directive.d.ts +17 -0
- package/lib/components/f-connectors/f-node-outlet/index.d.ts +3 -0
- package/lib/components/f-connectors/f-node-outlet/is-node-outlet.d.ts +1 -0
- package/lib/components/f-connectors/f-node-outlet/public-api.d.ts +1 -0
- package/lib/components/f-connectors/f-node-output/f-node-output-base.d.ts +10 -0
- package/lib/components/f-connectors/f-node-output/f-node-output.directive.d.ts +16 -0
- package/lib/components/f-connectors/f-node-output/index.d.ts +3 -0
- package/lib/components/f-connectors/f-node-output/is-node-output.d.ts +1 -0
- package/lib/components/f-connectors/f-node-output/public-api.d.ts +1 -0
- package/lib/components/f-connectors/f-out-connector-base.d.ts +4 -0
- package/lib/components/f-connectors/get-element-rect-in-canvas.d.ts +2 -0
- package/lib/components/f-connectors/index.d.ts +6 -0
- package/lib/components/f-connectors/public-api.d.ts +3 -0
- package/lib/components/f-flow/f-flow-base.d.ts +31 -0
- package/lib/components/f-flow/f-flow.component.d.ts +32 -0
- package/lib/components/f-flow/index.d.ts +2 -0
- package/lib/components/f-flow/public-api.d.ts +1 -0
- package/lib/components/f-node/f-drag-handle/f-drag-handle.directive.d.ts +19 -0
- package/lib/components/f-node/f-drag-handle/index.d.ts +2 -0
- package/lib/components/f-node/f-drag-handle/is-drag-handle.d.ts +1 -0
- package/lib/components/f-node/f-drag-handle/public-api.d.ts +1 -0
- package/lib/components/f-node/f-foreign-object/f-foreign-object-base.d.ts +20 -0
- package/lib/components/f-node/f-foreign-object/f-foreign-object.component.d.ts +16 -0
- package/lib/components/f-node/f-foreign-object/index.d.ts +2 -0
- package/lib/components/f-node/f-foreign-object/public-api.d.ts +1 -0
- package/lib/components/f-node/f-node-base.d.ts +24 -0
- package/lib/components/f-node/f-node.component.d.ts +23 -0
- package/lib/components/f-node/index.d.ts +4 -0
- package/lib/components/f-node/public-api.d.ts +3 -0
- package/lib/components/index.d.ts +5 -0
- package/lib/components/public-api.d.ts +4 -0
- package/lib/directives/f-connect-if-intersect/connect-if-intersect/connect-if-intersect.handler.d.ts +16 -0
- package/lib/directives/f-connect-if-intersect/connect-if-intersect/connect-if-intersect.request.d.ts +5 -0
- package/lib/directives/f-connect-if-intersect/connect-if-intersect/index.d.ts +2 -0
- package/lib/directives/f-connect-if-intersect/f-connect-if-intersect.directive.d.ts +16 -0
- package/lib/directives/f-connect-if-intersect/index.d.ts +2 -0
- package/lib/directives/f-connect-if-intersect/public-api.d.ts +1 -0
- package/lib/directives/f-containers/f-connections-container/f-connections-container-base.d.ts +18 -0
- package/lib/directives/f-containers/f-connections-container/f-connections-container.component.d.ts +14 -0
- package/lib/directives/f-containers/f-connections-container/index.d.ts +2 -0
- package/lib/directives/f-containers/f-connections-container/public-api.d.ts +1 -0
- package/lib/directives/f-containers/f-items-container/f-items-container-base.d.ts +23 -0
- package/lib/directives/f-containers/f-items-container/f-items-container.directive.d.ts +9 -0
- package/lib/directives/f-containers/f-items-container/index.d.ts +2 -0
- package/lib/directives/f-containers/f-items-container/public-api.d.ts +1 -0
- package/lib/directives/f-containers/f-nodes-container/f-nodes-container-base.d.ts +18 -0
- package/lib/directives/f-containers/f-nodes-container/f-nodes-container.component.d.ts +12 -0
- package/lib/directives/f-containers/f-nodes-container/index.d.ts +2 -0
- package/lib/directives/f-containers/f-nodes-container/public-api.d.ts +1 -0
- package/lib/directives/f-containers/index.d.ts +3 -0
- package/lib/directives/f-containers/public-api.d.ts +3 -0
- package/lib/directives/f-draggable/canvas/canvas-on-pointer-down/canvas-on-pointer-down.handler.d.ts +12 -0
- package/lib/directives/f-draggable/canvas/canvas-on-pointer-down/canvas-on-pointer-down.request.d.ts +5 -0
- package/lib/directives/f-draggable/canvas/canvas-on-pointer-down/index.d.ts +2 -0
- package/lib/directives/f-draggable/canvas/canvas-on-pointer-move/canvas.on-pointer-move.d.ts +13 -0
- package/lib/directives/f-draggable/canvas/canvas-on-pointer-move/index.d.ts +1 -0
- package/lib/directives/f-draggable/canvas/index.d.ts +2 -0
- package/lib/directives/f-draggable/connections/create-connection/create-connection-on-pointer-down/create-connection-on-pointer-down.request.d.ts +6 -0
- package/lib/directives/f-draggable/connections/create-connection/create-connection-on-pointer-down/create-connection.on-pointer-down.d.ts +14 -0
- package/lib/directives/f-draggable/connections/create-connection/create-connection-on-pointer-down/index.d.ts +2 -0
- package/lib/directives/f-draggable/connections/create-connection/create-connection-on-pointer-up/create-connection-on-pointer-up.request.d.ts +7 -0
- package/lib/directives/f-draggable/connections/create-connection/create-connection-on-pointer-up/create-connection.on-pointer-up.d.ts +11 -0
- package/lib/directives/f-draggable/connections/create-connection/create-connection-on-pointer-up/index.d.ts +2 -0
- package/lib/directives/f-draggable/connections/create-connection/create-connection.event.d.ts +5 -0
- package/lib/directives/f-draggable/connections/create-connection/create-connection.on-pointer-move.d.ts +16 -0
- package/lib/directives/f-draggable/connections/create-connection/find-first-can-be-connected-output-by-outlet/find-first-can-be-connected-output-by-outlet.handler.d.ts +8 -0
- package/lib/directives/f-draggable/connections/create-connection/find-first-can-be-connected-output-by-outlet/find-first-can-be-connected-output-by-outlet.request.d.ts +5 -0
- package/lib/directives/f-draggable/connections/create-connection/find-first-can-be-connected-output-by-outlet/index.d.ts +2 -0
- package/lib/directives/f-draggable/connections/create-connection/index.d.ts +5 -0
- package/lib/directives/f-draggable/connections/find-inputs-under-pointer/find-inputs-under-pointer.handler.d.ts +9 -0
- package/lib/directives/f-draggable/connections/find-inputs-under-pointer/find-inputs-under-pointer.request.d.ts +8 -0
- package/lib/directives/f-draggable/connections/find-inputs-under-pointer/first-not-connected-input-of-node-under-pointer/first-not-connected-input-of-node-under-pointer.handler.d.ts +8 -0
- package/lib/directives/f-draggable/connections/find-inputs-under-pointer/first-not-connected-input-of-node-under-pointer/first-not-connected-input-of-node-under-pointer.request.d.ts +5 -0
- package/lib/directives/f-draggable/connections/find-inputs-under-pointer/first-not-connected-input-of-node-under-pointer/index.d.ts +2 -0
- package/lib/directives/f-draggable/connections/find-inputs-under-pointer/index.d.ts +4 -0
- package/lib/directives/f-draggable/connections/find-inputs-under-pointer/inputs-under-pointer/index.d.ts +2 -0
- package/lib/directives/f-draggable/connections/find-inputs-under-pointer/inputs-under-pointer/inputs-under-pointer.handler.d.ts +8 -0
- package/lib/directives/f-draggable/connections/find-inputs-under-pointer/inputs-under-pointer/inputs-under-pointer.request.d.ts +5 -0
- package/lib/directives/f-draggable/connections/index.d.ts +3 -0
- package/lib/directives/f-draggable/connections/reassign-connection/index.d.ts +4 -0
- package/lib/directives/f-draggable/connections/reassign-connection/reassign-connection.event.d.ts +7 -0
- package/lib/directives/f-draggable/connections/reassign-connection/reassign-on-pointer-down/index.d.ts +2 -0
- package/lib/directives/f-draggable/connections/reassign-connection/reassign-on-pointer-down/reassign-connection-on-pointer-down.request.d.ts +6 -0
- package/lib/directives/f-draggable/connections/reassign-connection/reassign-on-pointer-down/reassign-connection.on-pointer-down.d.ts +11 -0
- package/lib/directives/f-draggable/connections/reassign-connection/reassign-on-pointer-move/index.d.ts +1 -0
- package/lib/directives/f-draggable/connections/reassign-connection/reassign-on-pointer-move/reassign-connection.on-pointer-move.d.ts +17 -0
- package/lib/directives/f-draggable/connections/reassign-connection/reassign-on-pointer-up/index.d.ts +2 -0
- package/lib/directives/f-draggable/connections/reassign-connection/reassign-on-pointer-up/reassign-connection-on-pointer-up.request.d.ts +7 -0
- package/lib/directives/f-draggable/connections/reassign-connection/reassign-on-pointer-up/reassign-connection.on-pointer-up.d.ts +11 -0
- package/lib/directives/f-draggable/default-drag-handler/default-drag.handler.d.ts +5 -0
- package/lib/directives/f-draggable/default-drag-handler/index.d.ts +1 -0
- package/lib/directives/f-draggable/e-draggable-type.d.ts +10 -0
- package/lib/directives/f-draggable/external-item/create-node.event.d.ts +6 -0
- package/lib/directives/f-draggable/external-item/external-item-on-pointer-down/external-item-on-pointer-down.handler.d.ts +10 -0
- package/lib/directives/f-draggable/external-item/external-item-on-pointer-down/external-item-on-pointer-down.request.d.ts +5 -0
- package/lib/directives/f-draggable/external-item/external-item-on-pointer-down/index.d.ts +2 -0
- package/lib/directives/f-draggable/external-item/external-item-on-pointer-move/external-item-on-pointer-move.handler.d.ts +17 -0
- package/lib/directives/f-draggable/external-item/external-item-on-pointer-move/index.d.ts +1 -0
- package/lib/directives/f-draggable/external-item/external-item-on-pointer-up/external-item-on-pointer-up.handler.d.ts +11 -0
- package/lib/directives/f-draggable/external-item/external-item-on-pointer-up/external-item-on-pointer-up.request.d.ts +7 -0
- package/lib/directives/f-draggable/external-item/external-item-on-pointer-up/index.d.ts +2 -0
- package/lib/directives/f-draggable/external-item/index.d.ts +4 -0
- package/lib/directives/f-draggable/f-draggable-base.d.ts +46 -0
- package/lib/directives/f-draggable/f-draggable.directive.d.ts +22 -0
- package/lib/directives/f-draggable/f-draggable.module.d.ts +11 -0
- package/lib/directives/f-draggable/f-draggable.service.d.ts +13 -0
- package/lib/directives/f-draggable/i-drag-handler.d.ts +9 -0
- package/lib/directives/f-draggable/i-draggable-item.d.ts +8 -0
- package/lib/directives/f-draggable/index.d.ts +13 -0
- package/lib/directives/f-draggable/node/index.d.ts +3 -0
- package/lib/directives/f-draggable/node/node-on-pointer-down/index.d.ts +2 -0
- package/lib/directives/f-draggable/node/node-on-pointer-down/node-on-pointer-down.request.d.ts +9 -0
- package/lib/directives/f-draggable/node/node-on-pointer-down/node.on-pointer-down.d.ts +17 -0
- package/lib/directives/f-draggable/node/node-on-pointer-move/f-connection-source.drag-handler.d.ts +15 -0
- package/lib/directives/f-draggable/node/node-on-pointer-move/f-connection-target.drag-handler.d.ts +15 -0
- package/lib/directives/f-draggable/node/node-on-pointer-move/f-connection.drag-handler.d.ts +14 -0
- package/lib/directives/f-draggable/node/node-on-pointer-move/index.d.ts +4 -0
- package/lib/directives/f-draggable/node/node-on-pointer-move/node.on-pointer-move.d.ts +15 -0
- package/lib/directives/f-draggable/node/node-on-pointer-up/index.d.ts +2 -0
- package/lib/directives/f-draggable/node/node-on-pointer-up/node-on-pointer-up.request.d.ts +7 -0
- package/lib/directives/f-draggable/node/node-on-pointer-up/node.on-pointer-up.d.ts +11 -0
- package/lib/directives/f-draggable/public-api.d.ts +1 -0
- package/lib/directives/f-draggable/selection/index.d.ts +3 -0
- package/lib/directives/f-draggable/selection/selection-on-pointer-down/index.d.ts +2 -0
- package/lib/directives/f-draggable/selection/selection-on-pointer-down/selection-on-pointer-down.request.d.ts +8 -0
- package/lib/directives/f-draggable/selection/selection-on-pointer-down/selection.on-pointer-down.d.ts +11 -0
- package/lib/directives/f-draggable/selection/selection-on-pointer-move/index.d.ts +1 -0
- package/lib/directives/f-draggable/selection/selection-on-pointer-move/selection.on-pointer-move.d.ts +19 -0
- package/lib/directives/f-draggable/selection/selection-on-pointer-up/index.d.ts +2 -0
- package/lib/directives/f-draggable/selection/selection-on-pointer-up/selection-on-pointer-up.request.d.ts +9 -0
- package/lib/directives/f-draggable/selection/selection-on-pointer-up/selection.on-pointer-up.d.ts +8 -0
- package/lib/directives/f-external-item/f-external-item-base.d.ts +11 -0
- package/lib/directives/f-external-item/f-external-item.directive.d.ts +16 -0
- package/lib/directives/f-external-item/f-external-item.service.d.ts +10 -0
- package/lib/directives/f-external-item/index.d.ts +4 -0
- package/lib/directives/f-external-item/is-external-item.d.ts +2 -0
- package/lib/directives/f-external-item/public-api.d.ts +1 -0
- package/lib/directives/f-line-alignment/domain/find-nearest-coordinate-by-x.d.ts +3 -0
- package/lib/directives/f-line-alignment/domain/find-nearest-coordinate-by-y.d.ts +3 -0
- package/lib/directives/f-line-alignment/domain/i-line-alignment-result.d.ts +5 -0
- package/lib/directives/f-line-alignment/domain/i-nearest-coordinate-result.d.ts +4 -0
- package/lib/directives/f-line-alignment/domain/index.d.ts +4 -0
- package/lib/directives/f-line-alignment/f-line-alignment.directive.d.ts +25 -0
- package/lib/directives/f-line-alignment/index.d.ts +2 -0
- package/lib/directives/f-line-alignment/public-api.d.ts +1 -0
- package/lib/directives/f-selection/f-selection.directive.d.ts +15 -0
- package/lib/directives/f-selection/index.d.ts +1 -0
- package/lib/directives/f-selection/public-api.d.ts +1 -0
- package/lib/directives/f-zoom/f-zoom-base.d.ts +24 -0
- package/lib/directives/f-zoom/f-zoom.directive.d.ts +15 -0
- package/lib/directives/f-zoom/index.d.ts +2 -0
- package/lib/directives/f-zoom/public-api.d.ts +1 -0
- package/lib/directives/index.d.ts +7 -0
- package/lib/directives/public-api.d.ts +7 -0
- package/lib/f-flow.module.d.ts +21 -0
- package/lib/i-has-state-changes.d.ts +4 -0
- package/lib/i-selectable.d.ts +6 -0
- package/lib/internal/f-backgroud/f-background-base.d.ts +15 -0
- package/lib/internal/f-backgroud/f-background.directive.d.ts +9 -0
- package/lib/internal/f-backgroud/index.d.ts +2 -0
- package/lib/internal/f-canvas/f-canvas-base.d.ts +12 -0
- package/lib/internal/f-canvas/f-canvas.directive.d.ts +8 -0
- package/lib/internal/f-canvas/index.d.ts +2 -0
- package/lib/internal/index.d.ts +2 -0
- package/lib/public-api.d.ts +4 -0
- package/package.json +26 -0
- package/public-api.d.ts +1 -0
|
@@ -0,0 +1,3055 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, Directive, Component, ChangeDetectionStrategy, Input, ViewChild, EventEmitter, Output, NgModule, Inject, Optional, SkipSelf, ContentChildren, ContentChild, Injectable } from '@angular/core';
|
|
3
|
+
import { VectorExtensions, Point, PointExtensions, TransformModelExtensions, RectExtensions, SizeExtensions, BooleanExtensions, FResizeObserver, RectFElement, DomElementExtensions, MouseEventExtensions, IDragAndDropBase, LineFElement, EventExtensions } from '@foblex/core';
|
|
4
|
+
import { Subject, merge, startWith, takeUntil, defer, switchMap, take, Subscription, debounceTime } from 'rxjs';
|
|
5
|
+
import * as i2 from '@angular/common';
|
|
6
|
+
import { CommonModule } from '@angular/common';
|
|
7
|
+
|
|
8
|
+
const F_SELECTED_CLASS = 'f-selected';
|
|
9
|
+
|
|
10
|
+
const F_CONNECTION_COMPONENT = new InjectionToken('F_CONNECTION_COMPONENT');
|
|
11
|
+
class FConnectionBase {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.path = '';
|
|
14
|
+
this.vector = VectorExtensions.initialize();
|
|
15
|
+
}
|
|
16
|
+
initialize() {
|
|
17
|
+
}
|
|
18
|
+
isContains(element) {
|
|
19
|
+
return this.hostElement.contains(element);
|
|
20
|
+
}
|
|
21
|
+
deselect() {
|
|
22
|
+
this.hostElement.classList.remove(F_SELECTED_CLASS);
|
|
23
|
+
}
|
|
24
|
+
select() {
|
|
25
|
+
this.hostElement.classList.add(F_SELECTED_CLASS);
|
|
26
|
+
}
|
|
27
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FConnectionBase, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
28
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.4", type: FConnectionBase, ngImport: i0 }); }
|
|
29
|
+
}
|
|
30
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FConnectionBase, decorators: [{
|
|
31
|
+
type: Directive
|
|
32
|
+
}] });
|
|
33
|
+
|
|
34
|
+
const F_CONNECTION_IDENTIFIERS = {
|
|
35
|
+
textId(connectionId) {
|
|
36
|
+
return 'connection_text_' + connectionId;
|
|
37
|
+
},
|
|
38
|
+
connectionForSelectionId(connectionId) {
|
|
39
|
+
return 'connection_for_selection_' + connectionId;
|
|
40
|
+
},
|
|
41
|
+
connectionId(connectionId) {
|
|
42
|
+
return 'connection_' + connectionId;
|
|
43
|
+
},
|
|
44
|
+
gradientId(connectionId) {
|
|
45
|
+
return 'connection_gradient_' + connectionId;
|
|
46
|
+
},
|
|
47
|
+
linkToGradient(connectionId) {
|
|
48
|
+
return `url(#${F_CONNECTION_IDENTIFIERS.gradientId(connectionId)})`;
|
|
49
|
+
},
|
|
50
|
+
linkToConnection(connectionId) {
|
|
51
|
+
return `#${F_CONNECTION_IDENTIFIERS.connectionId(connectionId)}`;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
class FConnectionPathComponent {
|
|
56
|
+
get linkToGradient() {
|
|
57
|
+
return F_CONNECTION_IDENTIFIERS.linkToGradient(this.fromTo?.output.id + this.fromTo?.input?.id);
|
|
58
|
+
}
|
|
59
|
+
get attrConnectionId() {
|
|
60
|
+
return F_CONNECTION_IDENTIFIERS.connectionId(this.fromTo?.output.id + this.fromTo?.input?.id);
|
|
61
|
+
}
|
|
62
|
+
get hostElement() {
|
|
63
|
+
return this.elementReference.nativeElement;
|
|
64
|
+
}
|
|
65
|
+
constructor(elementReference) {
|
|
66
|
+
this.elementReference = elementReference;
|
|
67
|
+
}
|
|
68
|
+
ngOnInit() {
|
|
69
|
+
this.deselect();
|
|
70
|
+
}
|
|
71
|
+
setPath(path) {
|
|
72
|
+
this.hostElement.setAttribute("d", `${path}`);
|
|
73
|
+
}
|
|
74
|
+
select() {
|
|
75
|
+
this.hostElement.setAttribute('marker-start', `url(#connection-marker-start-selected)`);
|
|
76
|
+
this.hostElement.setAttribute('marker-end', `url(#connection-marker-end-selected)`);
|
|
77
|
+
}
|
|
78
|
+
deselect() {
|
|
79
|
+
if (this.fromTo?.input) {
|
|
80
|
+
this.hostElement.setAttribute('marker-start', `url(#connection-marker-start-${this.fromTo?.output?.color})`);
|
|
81
|
+
this.hostElement.setAttribute('marker-end', `url(#connection-marker-end-${this.fromTo?.input?.color})`);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
this.hostElement.setAttribute('marker-start', `url(#connection-marker-start)`);
|
|
85
|
+
this.hostElement.setAttribute('marker-end', `url(#connection-marker-end)`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FConnectionPathComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
89
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.4", type: FConnectionPathComponent, selector: "path[f-connection-path]", inputs: { fromTo: "fromTo" }, host: { properties: { "attr.id": "attrConnectionId", "attr.stroke": "linkToGradient" }, classAttribute: "f-component f-connection-path" }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
90
|
+
}
|
|
91
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FConnectionPathComponent, decorators: [{
|
|
92
|
+
type: Component,
|
|
93
|
+
args: [{
|
|
94
|
+
selector: "path[f-connection-path]",
|
|
95
|
+
template: '',
|
|
96
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
97
|
+
host: {
|
|
98
|
+
class: "f-component f-connection-path",
|
|
99
|
+
'[attr.id]': 'attrConnectionId',
|
|
100
|
+
'[attr.stroke]': 'linkToGradient',
|
|
101
|
+
},
|
|
102
|
+
}]
|
|
103
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { fromTo: [{
|
|
104
|
+
type: Input
|
|
105
|
+
}] } });
|
|
106
|
+
|
|
107
|
+
class FConnectionGradientComponent {
|
|
108
|
+
get gradientId() {
|
|
109
|
+
return F_CONNECTION_IDENTIFIERS.gradientId(this.fromTo?.output.id + this.fromTo?.input?.id);
|
|
110
|
+
}
|
|
111
|
+
get hostElement() {
|
|
112
|
+
return this.elementReference.nativeElement;
|
|
113
|
+
}
|
|
114
|
+
get stop1Element() {
|
|
115
|
+
return this.elementReference.nativeElement.children.item(0);
|
|
116
|
+
}
|
|
117
|
+
get stop2Element() {
|
|
118
|
+
return this.elementReference.nativeElement.children.item(1);
|
|
119
|
+
}
|
|
120
|
+
constructor(elementReference) {
|
|
121
|
+
this.elementReference = elementReference;
|
|
122
|
+
}
|
|
123
|
+
ngAfterContentInit() {
|
|
124
|
+
this.stop1Element.setAttribute('offset', '0%');
|
|
125
|
+
this.stop2Element.setAttribute('offset', '100%');
|
|
126
|
+
}
|
|
127
|
+
updateGradient() {
|
|
128
|
+
this.setFromColor(this.fromTo?.output.color);
|
|
129
|
+
this.setToColor(this.fromTo?.input?.color);
|
|
130
|
+
}
|
|
131
|
+
setFromColor(color) {
|
|
132
|
+
this.stop1Element.setAttribute('stop-color', color || 'transparent');
|
|
133
|
+
}
|
|
134
|
+
setToColor(color) {
|
|
135
|
+
this.stop2Element.setAttribute('stop-color', color || 'transparent');
|
|
136
|
+
}
|
|
137
|
+
redraw(vector) {
|
|
138
|
+
const x = vector.point2.x - vector.point1.x;
|
|
139
|
+
const y = vector.point2.y - vector.point1.y;
|
|
140
|
+
const distance = Math.sqrt(x * x + y * y) || 0.01;
|
|
141
|
+
const from = new Point(0.5 - (0.5 * x) / distance, 0.5 - (0.5 * y) / distance);
|
|
142
|
+
this.hostElement.setAttribute('x1', from.x.toString());
|
|
143
|
+
this.hostElement.setAttribute('y1', from.y.toString());
|
|
144
|
+
const to = new Point(0.5 + (0.5 * x) / distance, 0.5 + (0.5 * y) / distance);
|
|
145
|
+
this.hostElement.setAttribute('x2', to.x.toString());
|
|
146
|
+
this.hostElement.setAttribute('y2', to.y.toString());
|
|
147
|
+
this.updateGradient();
|
|
148
|
+
}
|
|
149
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FConnectionGradientComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
150
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.4", type: FConnectionGradientComponent, selector: "linearGradient[fConnectionGradient]", inputs: { fromTo: "fromTo" }, host: { properties: { "attr.id": "gradientId" }, classAttribute: "f-component f-connection-gradient" }, ngImport: i0, template: "<ng-container xmlns:svg=\"http://www.w3.org/2000/svg\">\n <svg:stop/>\n <svg:stop/>\n</ng-container>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
151
|
+
}
|
|
152
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FConnectionGradientComponent, decorators: [{
|
|
153
|
+
type: Component,
|
|
154
|
+
args: [{ selector: "linearGradient[fConnectionGradient]", changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
155
|
+
class: "f-component f-connection-gradient",
|
|
156
|
+
'[attr.id]': 'gradientId'
|
|
157
|
+
}, template: "<ng-container xmlns:svg=\"http://www.w3.org/2000/svg\">\n <svg:stop/>\n <svg:stop/>\n</ng-container>\n" }]
|
|
158
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { fromTo: [{
|
|
159
|
+
type: Input
|
|
160
|
+
}] } });
|
|
161
|
+
|
|
162
|
+
class FConnectionTextPathDirective {
|
|
163
|
+
get linkToConnection() {
|
|
164
|
+
return F_CONNECTION_IDENTIFIERS.linkToConnection(this.fromTo?.output.id + this.fromTo?.input?.id);
|
|
165
|
+
}
|
|
166
|
+
get hostElement() {
|
|
167
|
+
return this.elementReference.nativeElement;
|
|
168
|
+
}
|
|
169
|
+
constructor(elementReference) {
|
|
170
|
+
this.elementReference = elementReference;
|
|
171
|
+
}
|
|
172
|
+
ngOnInit() {
|
|
173
|
+
this.hostElement.setAttribute('startOffset', '50%');
|
|
174
|
+
this.hostElement.setAttribute('text-anchor', `middle`);
|
|
175
|
+
}
|
|
176
|
+
getBBox() {
|
|
177
|
+
return this.hostElement.getBBox();
|
|
178
|
+
}
|
|
179
|
+
setOffset(offset) {
|
|
180
|
+
this.hostElement.setAttribute('startOffset', offset.toString());
|
|
181
|
+
}
|
|
182
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FConnectionTextPathDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
183
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.4", type: FConnectionTextPathDirective, selector: "textPath[f-connection-text-path]", inputs: { fromTo: "fromTo" }, host: { properties: { "attr.href": "linkToConnection" } }, ngImport: i0 }); }
|
|
184
|
+
}
|
|
185
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FConnectionTextPathDirective, decorators: [{
|
|
186
|
+
type: Directive,
|
|
187
|
+
args: [{
|
|
188
|
+
selector: 'textPath[f-connection-text-path]',
|
|
189
|
+
host: {
|
|
190
|
+
'[attr.href]': 'linkToConnection'
|
|
191
|
+
}
|
|
192
|
+
}]
|
|
193
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { fromTo: [{
|
|
194
|
+
type: Input
|
|
195
|
+
}] } });
|
|
196
|
+
|
|
197
|
+
class FConnectionTextComponent {
|
|
198
|
+
get textId() {
|
|
199
|
+
return F_CONNECTION_IDENTIFIERS.textId(this.fromTo?.output.id + this.fromTo?.input?.id);
|
|
200
|
+
}
|
|
201
|
+
get hostElement() {
|
|
202
|
+
return this.elementReference.nativeElement;
|
|
203
|
+
}
|
|
204
|
+
constructor(elementReference) {
|
|
205
|
+
this.elementReference = elementReference;
|
|
206
|
+
}
|
|
207
|
+
redraw(vector) {
|
|
208
|
+
const isTextReverse = FConnectionTextComponent.isTextReverse(vector);
|
|
209
|
+
this.hostElement.setAttribute('dy', isTextReverse ? '15' : '-8');
|
|
210
|
+
const textRect = this.textPathDirective.getBBox();
|
|
211
|
+
const textRectCenter = [textRect.x + textRect.width / 2, textRect.y + textRect.height / 2];
|
|
212
|
+
this.hostElement.setAttribute('transform', isTextReverse ? `rotate(180, ${textRectCenter})` : '');
|
|
213
|
+
const startOffset = FConnectionTextComponent.getTextStartOffset(vector, this.fromTo?.output.name || '');
|
|
214
|
+
// this.textPathDirective.setOffset(startOffset);
|
|
215
|
+
if (startOffset < 0) {
|
|
216
|
+
this.hostElement.style.display = 'none';
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
this.hostElement.style.display = 'unset';
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
static isTextReverse(vector) {
|
|
223
|
+
return vector.point1.x > vector.point2.x;
|
|
224
|
+
}
|
|
225
|
+
static getTextStartOffset(vector, name) {
|
|
226
|
+
const symbolWidth = 8;
|
|
227
|
+
const vectorLength = PointExtensions.hypotenuse(vector.point1, vector.point2);
|
|
228
|
+
return vectorLength / 2 - ((name || '').length * symbolWidth) / 2;
|
|
229
|
+
}
|
|
230
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FConnectionTextComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
231
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.4", type: FConnectionTextComponent, selector: "text[f-connection-text]", inputs: { fromTo: "fromTo" }, host: { properties: { "attr.id": "textId" }, classAttribute: "f-component f-connection-text" }, viewQueries: [{ propertyName: "textPathDirective", first: true, predicate: FConnectionTextPathDirective, descendants: true, static: true }], ngImport: i0, template: "<ng-container xmlns:svg=\"http://www.w3.org/2000/svg\">\n <svg:textPath f-connection-text-path [fromTo]=\"fromTo\">\n {{ fromTo?.output?.name }}\n </svg:textPath>\n</ng-container>\n", dependencies: [{ kind: "directive", type: FConnectionTextPathDirective, selector: "textPath[f-connection-text-path]", inputs: ["fromTo"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
232
|
+
}
|
|
233
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FConnectionTextComponent, decorators: [{
|
|
234
|
+
type: Component,
|
|
235
|
+
args: [{ selector: "text[f-connection-text]", changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
236
|
+
class: "f-component f-connection-text",
|
|
237
|
+
'[attr.id]': 'textId',
|
|
238
|
+
}, template: "<ng-container xmlns:svg=\"http://www.w3.org/2000/svg\">\n <svg:textPath f-connection-text-path [fromTo]=\"fromTo\">\n {{ fromTo?.output?.name }}\n </svg:textPath>\n</ng-container>\n" }]
|
|
239
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { fromTo: [{
|
|
240
|
+
type: Input
|
|
241
|
+
}], textPathDirective: [{
|
|
242
|
+
type: ViewChild,
|
|
243
|
+
args: [FConnectionTextPathDirective, { static: true }]
|
|
244
|
+
}] } });
|
|
245
|
+
|
|
246
|
+
const F_TEMP_CONNECTION_COMPONENT = new InjectionToken('F_TEMP_CONNECTION_COMPONENT');
|
|
247
|
+
let uniqueId$7 = 0;
|
|
248
|
+
class FTempConnectionComponent extends FConnectionBase {
|
|
249
|
+
get hostElement() {
|
|
250
|
+
return this.elementReference.nativeElement;
|
|
251
|
+
}
|
|
252
|
+
constructor(elementReference) {
|
|
253
|
+
super();
|
|
254
|
+
this.elementReference = elementReference;
|
|
255
|
+
this.id = `f-temp-connection-${uniqueId$7++}`;
|
|
256
|
+
}
|
|
257
|
+
ngAfterViewInit() {
|
|
258
|
+
this.hostElement.style.display = "none";
|
|
259
|
+
}
|
|
260
|
+
initializeDrag() {
|
|
261
|
+
this.hostElement.style.display = "unset";
|
|
262
|
+
}
|
|
263
|
+
setVector(vector) {
|
|
264
|
+
this.vector = vector;
|
|
265
|
+
this.path = `M${vector.point1.x},${vector.point1.y}L${vector.point2.x + 0.0001},${vector.point2.y + 0.0001}`;
|
|
266
|
+
}
|
|
267
|
+
redraw() {
|
|
268
|
+
this.fPath.setPath(this.path);
|
|
269
|
+
this.fGradient.redraw(this.vector);
|
|
270
|
+
this.fText.redraw(this.vector);
|
|
271
|
+
}
|
|
272
|
+
completeDrag() {
|
|
273
|
+
this.hostElement.style.display = "none";
|
|
274
|
+
}
|
|
275
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FTempConnectionComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
276
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.4", type: FTempConnectionComponent, selector: "g[fTempConnection]", host: { classAttribute: "f-component f-connection f-temp-connection" }, providers: [
|
|
277
|
+
{ provide: F_TEMP_CONNECTION_COMPONENT, useExisting: FTempConnectionComponent }
|
|
278
|
+
], viewQueries: [{ propertyName: "fPath", first: true, predicate: FConnectionPathComponent, descendants: true, static: true }, { propertyName: "fGradient", first: true, predicate: FConnectionGradientComponent, descendants: true, static: true }, { propertyName: "fText", first: true, predicate: FConnectionTextComponent, descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<ng-container xmlns:svg=\"http://www.w3.org/2000/svg\">\n <svg:linearGradient fConnectionGradient [fromTo]=\"fromTo\"></svg:linearGradient>\n <svg:g>\n <svg:path f-connection-path stroke-dasharray=\"10,10\" [attr.d]=\"path\" [fromTo]=\"fromTo\"></svg:path>\n </svg:g>\n <svg:text f-connection-text [fromTo]=\"fromTo\"></svg:text>\n</ng-container>\n", dependencies: [{ kind: "component", type: FConnectionGradientComponent, selector: "linearGradient[fConnectionGradient]", inputs: ["fromTo"] }, { kind: "component", type: FConnectionPathComponent, selector: "path[f-connection-path]", inputs: ["fromTo"] }, { kind: "component", type: FConnectionTextComponent, selector: "text[f-connection-text]", inputs: ["fromTo"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
279
|
+
}
|
|
280
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FTempConnectionComponent, decorators: [{
|
|
281
|
+
type: Component,
|
|
282
|
+
args: [{ selector: "g[fTempConnection]", changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
283
|
+
class: "f-component f-connection f-temp-connection"
|
|
284
|
+
}, providers: [
|
|
285
|
+
{ provide: F_TEMP_CONNECTION_COMPONENT, useExisting: FTempConnectionComponent }
|
|
286
|
+
], template: "<ng-container xmlns:svg=\"http://www.w3.org/2000/svg\">\n <svg:linearGradient fConnectionGradient [fromTo]=\"fromTo\"></svg:linearGradient>\n <svg:g>\n <svg:path f-connection-path stroke-dasharray=\"10,10\" [attr.d]=\"path\" [fromTo]=\"fromTo\"></svg:path>\n </svg:g>\n <svg:text f-connection-text [fromTo]=\"fromTo\"></svg:text>\n</ng-container>\n" }]
|
|
287
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { fPath: [{
|
|
288
|
+
type: ViewChild,
|
|
289
|
+
args: [FConnectionPathComponent, { static: true }]
|
|
290
|
+
}], fGradient: [{
|
|
291
|
+
type: ViewChild,
|
|
292
|
+
args: [FConnectionGradientComponent, { static: true }]
|
|
293
|
+
}], fText: [{
|
|
294
|
+
type: ViewChild,
|
|
295
|
+
args: [FConnectionTextComponent, { static: true }]
|
|
296
|
+
}] } });
|
|
297
|
+
|
|
298
|
+
const F_CONNECTION_DRAG_HANDLE_CLASS = 'f-connection-drag-handle';
|
|
299
|
+
class FConnectionDragHandleComponent {
|
|
300
|
+
get hostElement() {
|
|
301
|
+
return this.elementReference.nativeElement;
|
|
302
|
+
}
|
|
303
|
+
constructor(elementReference) {
|
|
304
|
+
this.elementReference = elementReference;
|
|
305
|
+
this.class = F_CONNECTION_DRAG_HANDLE_CLASS;
|
|
306
|
+
}
|
|
307
|
+
redraw(point) {
|
|
308
|
+
this.hostElement.setAttribute('cx', point.x.toString());
|
|
309
|
+
this.hostElement.setAttribute('cy', point.y.toString());
|
|
310
|
+
}
|
|
311
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FConnectionDragHandleComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
312
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.4", type: FConnectionDragHandleComponent, selector: "circle[f-connection-drag-handle]", host: { properties: { "class": "class" } }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
313
|
+
}
|
|
314
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FConnectionDragHandleComponent, decorators: [{
|
|
315
|
+
type: Component,
|
|
316
|
+
args: [{
|
|
317
|
+
selector: "circle[f-connection-drag-handle]",
|
|
318
|
+
template: '',
|
|
319
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
320
|
+
host: {
|
|
321
|
+
'[class]': 'class'
|
|
322
|
+
}
|
|
323
|
+
}]
|
|
324
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
|
|
325
|
+
|
|
326
|
+
class FConnectionSelectionComponent {
|
|
327
|
+
get connectionForSelectionId() {
|
|
328
|
+
return F_CONNECTION_IDENTIFIERS.connectionForSelectionId(this.fromTo?.output.id + this.fromTo?.input?.id);
|
|
329
|
+
}
|
|
330
|
+
get hostElement() {
|
|
331
|
+
return this.elementReference.nativeElement;
|
|
332
|
+
}
|
|
333
|
+
constructor(elementReference) {
|
|
334
|
+
this.elementReference = elementReference;
|
|
335
|
+
}
|
|
336
|
+
setPath(path) {
|
|
337
|
+
this.hostElement.setAttribute("d", `${path}`);
|
|
338
|
+
}
|
|
339
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FConnectionSelectionComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
340
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.4", type: FConnectionSelectionComponent, selector: "path[fConnectionSelection]", inputs: { fromTo: "fromTo" }, host: { properties: { "attr.id": "connectionForSelectionId" }, classAttribute: "f-component f-connection-selection" }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
341
|
+
}
|
|
342
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FConnectionSelectionComponent, decorators: [{
|
|
343
|
+
type: Component,
|
|
344
|
+
args: [{
|
|
345
|
+
selector: "path[fConnectionSelection]",
|
|
346
|
+
template: '',
|
|
347
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
348
|
+
host: {
|
|
349
|
+
class: "f-component f-connection-selection",
|
|
350
|
+
'[attr.id]': 'connectionForSelectionId',
|
|
351
|
+
},
|
|
352
|
+
}]
|
|
353
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { fromTo: [{
|
|
354
|
+
type: Input
|
|
355
|
+
}] } });
|
|
356
|
+
|
|
357
|
+
const F_CANVAS = new InjectionToken('F_CANVAS');
|
|
358
|
+
class FCanvasBase {
|
|
359
|
+
get hostElement() {
|
|
360
|
+
return this.elementReference.nativeElement;
|
|
361
|
+
}
|
|
362
|
+
constructor(elementReference) {
|
|
363
|
+
this.elementReference = elementReference;
|
|
364
|
+
this.initialize();
|
|
365
|
+
}
|
|
366
|
+
initialize() {
|
|
367
|
+
this.hostElement.setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns', 'http://www.w3.org/2000/svg');
|
|
368
|
+
this.hostElement.setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xlink', 'http://www.w3.org/1999/xlink');
|
|
369
|
+
this.hostElement.setAttribute('version', '1.1');
|
|
370
|
+
this.hostElement.setAttribute('baseProfile', 'full');
|
|
371
|
+
this.hostElement.style.cssText = 'user-select:none; width:100%; height:100%;';
|
|
372
|
+
}
|
|
373
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FCanvasBase, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
374
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.4", type: FCanvasBase, ngImport: i0 }); }
|
|
375
|
+
}
|
|
376
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FCanvasBase, decorators: [{
|
|
377
|
+
type: Directive
|
|
378
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
|
|
379
|
+
|
|
380
|
+
class FCanvasDirective extends FCanvasBase {
|
|
381
|
+
constructor(elementReference) {
|
|
382
|
+
super(elementReference);
|
|
383
|
+
}
|
|
384
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FCanvasDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
385
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.4", type: FCanvasDirective, isStandalone: true, selector: "svg[fCanvas]", providers: [{ provide: F_CANVAS, useExisting: FCanvasDirective }], usesInheritance: true, ngImport: i0 }); }
|
|
386
|
+
}
|
|
387
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FCanvasDirective, decorators: [{
|
|
388
|
+
type: Directive,
|
|
389
|
+
args: [{
|
|
390
|
+
selector: "svg[fCanvas]",
|
|
391
|
+
standalone: true,
|
|
392
|
+
providers: [{ provide: F_CANVAS, useExisting: FCanvasDirective }],
|
|
393
|
+
}]
|
|
394
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
|
|
395
|
+
|
|
396
|
+
function mixinChangeZoom(base) {
|
|
397
|
+
return class extends base {
|
|
398
|
+
setZoom(scaleValue, toPosition) {
|
|
399
|
+
if (scaleValue !== this.transform.scale) {
|
|
400
|
+
const summaryPosition = PointExtensions.sum(this.transform.scaledPosition, this.transform.position);
|
|
401
|
+
const newX = toPosition.x - (toPosition.x - summaryPosition.x) * scaleValue / this.transform.scale;
|
|
402
|
+
const newY = toPosition.y - (toPosition.y - summaryPosition.y) * scaleValue / this.transform.scale;
|
|
403
|
+
this.transform.scale = scaleValue;
|
|
404
|
+
this.transform.scaledPosition = PointExtensions.sub(PointExtensions.initialize(newX, newY), this.transform.position);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
setScalePosition(value) {
|
|
408
|
+
this.transform.scaledPosition = value;
|
|
409
|
+
}
|
|
410
|
+
resetZoom() {
|
|
411
|
+
this.transform.scale = 1;
|
|
412
|
+
this.transform.scaledPosition = PointExtensions.initialize();
|
|
413
|
+
}
|
|
414
|
+
constructor(...args) {
|
|
415
|
+
super(...args);
|
|
416
|
+
}
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
function mixinFitToParent(base) {
|
|
421
|
+
return class extends base {
|
|
422
|
+
fitToParent(rect, parentRect, points) {
|
|
423
|
+
this.transform.scaledPosition = PointExtensions.initialize();
|
|
424
|
+
this.transform.position = this.getZeroPositionWithoutScale(points);
|
|
425
|
+
const itemsContainerWidth = rect.width / this.transform.scale;
|
|
426
|
+
const itemsContainerHeight = rect.height / this.transform.scale;
|
|
427
|
+
if ((itemsContainerWidth > parentRect.width || itemsContainerHeight > parentRect.height) ||
|
|
428
|
+
itemsContainerWidth < parentRect.width && itemsContainerHeight < parentRect.height) {
|
|
429
|
+
this.transform.scale = Math.min(parentRect.width / itemsContainerWidth, parentRect.height / itemsContainerHeight);
|
|
430
|
+
}
|
|
431
|
+
const newX = (parentRect.width - itemsContainerWidth * this.transform.scale) / 2 - this.transform.position.x * this.transform.scale;
|
|
432
|
+
const newY = (parentRect.height - itemsContainerHeight * this.transform.scale) / 2 - this.transform.position.y * this.transform.scale;
|
|
433
|
+
this.transform.position = PointExtensions.initialize(newX, newY);
|
|
434
|
+
}
|
|
435
|
+
getZeroPositionWithoutScale(points) {
|
|
436
|
+
const xPoint = points.length ? Math.min(...points.map((point) => point.x)) : 0;
|
|
437
|
+
const yPoint = points.length ? Math.min(...points.map((point) => point.y)) : 0;
|
|
438
|
+
return PointExtensions.initialize(xPoint, yPoint);
|
|
439
|
+
}
|
|
440
|
+
constructor(...args) {
|
|
441
|
+
super(...args);
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
function mixinOneToOneCentering(base) {
|
|
447
|
+
return class extends base {
|
|
448
|
+
oneToOneCentering(rect, parentRect, points) {
|
|
449
|
+
this.transform.scaledPosition = PointExtensions.initialize();
|
|
450
|
+
this.transform.position = this.getZeroPositionWithoutScale(points);
|
|
451
|
+
const itemsContainerWidth = rect.width / this.transform.scale;
|
|
452
|
+
const itemsContainerHeight = rect.height / this.transform.scale;
|
|
453
|
+
this.transform.scale = 1;
|
|
454
|
+
const newX = (parentRect.width - itemsContainerWidth * this.transform.scale) / 2 - this.transform.position.x * this.transform.scale;
|
|
455
|
+
const newY = (parentRect.height - itemsContainerHeight * this.transform.scale) / 2 - this.transform.position.y * this.transform.scale;
|
|
456
|
+
this.transform.position = PointExtensions.initialize(newX, newY);
|
|
457
|
+
}
|
|
458
|
+
getZeroPositionWithoutScale(points) {
|
|
459
|
+
const xPoint = points.length ? Math.min(...points.map((point) => point.x)) : 0;
|
|
460
|
+
const yPoint = points.length ? Math.min(...points.map((point) => point.y)) : 0;
|
|
461
|
+
return PointExtensions.initialize(xPoint, yPoint);
|
|
462
|
+
}
|
|
463
|
+
constructor(...args) {
|
|
464
|
+
super(...args);
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
function mixinChangePosition(base) {
|
|
470
|
+
return class extends base {
|
|
471
|
+
getPosition() {
|
|
472
|
+
return this.transform.position;
|
|
473
|
+
}
|
|
474
|
+
setPosition(position) {
|
|
475
|
+
this.transform.position = PointExtensions.copy(position);
|
|
476
|
+
}
|
|
477
|
+
constructor(...args) {
|
|
478
|
+
super(...args);
|
|
479
|
+
}
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
const F_ITEMS_CONTAINER = new InjectionToken('F_ITEMS_CONTAINER');
|
|
484
|
+
const MIXIN_BASE = mixinChangePosition(mixinFitToParent(mixinOneToOneCentering(mixinChangeZoom(class {
|
|
485
|
+
constructor(transform) {
|
|
486
|
+
this.transform = transform;
|
|
487
|
+
}
|
|
488
|
+
}))));
|
|
489
|
+
class FItemsContainerBase extends MIXIN_BASE {
|
|
490
|
+
get hostElement() {
|
|
491
|
+
return this.elementReference.nativeElement;
|
|
492
|
+
}
|
|
493
|
+
constructor(elementReference) {
|
|
494
|
+
super(TransformModelExtensions.default());
|
|
495
|
+
this.elementReference = elementReference;
|
|
496
|
+
this.parseData();
|
|
497
|
+
}
|
|
498
|
+
parseData() {
|
|
499
|
+
const transform = TransformModelExtensions.fromString(this.hostElement.getAttribute("transform"));
|
|
500
|
+
this.transform = transform ? transform : this.transform;
|
|
501
|
+
}
|
|
502
|
+
redraw() {
|
|
503
|
+
this.hostElement.setAttribute("transform", TransformModelExtensions.toString(this.transform));
|
|
504
|
+
}
|
|
505
|
+
redrawWithAnimation() {
|
|
506
|
+
this.hostElement.setAttribute("style", 'transition: transform 0.15s ease-in-out');
|
|
507
|
+
this.redraw();
|
|
508
|
+
setTimeout(() => {
|
|
509
|
+
this.hostElement.removeAttribute("style");
|
|
510
|
+
}, 150);
|
|
511
|
+
}
|
|
512
|
+
completeDrag() {
|
|
513
|
+
// const position = PointExtensions.sum(this.transform.position, this.transform.scaledPosition);
|
|
514
|
+
this.canvasChange.emit();
|
|
515
|
+
}
|
|
516
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FItemsContainerBase, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
517
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.4", type: FItemsContainerBase, usesInheritance: true, ngImport: i0 }); }
|
|
518
|
+
}
|
|
519
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FItemsContainerBase, decorators: [{
|
|
520
|
+
type: Directive
|
|
521
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
|
|
522
|
+
|
|
523
|
+
class FItemsContainerDirective extends FItemsContainerBase {
|
|
524
|
+
constructor(elementReference) {
|
|
525
|
+
super(elementReference);
|
|
526
|
+
this.canvasChange = new EventEmitter();
|
|
527
|
+
}
|
|
528
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FItemsContainerDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
529
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.4", type: FItemsContainerDirective, selector: "g[fItemsContainer]", outputs: { canvasChange: "canvasChange" }, host: { classAttribute: "f-items-container" }, providers: [{ provide: F_ITEMS_CONTAINER, useExisting: FItemsContainerDirective }], exportAs: ["fComponent"], usesInheritance: true, ngImport: i0 }); }
|
|
530
|
+
}
|
|
531
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FItemsContainerDirective, decorators: [{
|
|
532
|
+
type: Directive,
|
|
533
|
+
args: [{
|
|
534
|
+
selector: "g[fItemsContainer]",
|
|
535
|
+
exportAs: 'fComponent',
|
|
536
|
+
host: {
|
|
537
|
+
'class': 'f-items-container'
|
|
538
|
+
},
|
|
539
|
+
providers: [{ provide: F_ITEMS_CONTAINER, useExisting: FItemsContainerDirective }],
|
|
540
|
+
}]
|
|
541
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { canvasChange: [{
|
|
542
|
+
type: Output
|
|
543
|
+
}] } });
|
|
544
|
+
|
|
545
|
+
const F_FLOW_COMPONENT = new InjectionToken('F_FLOW_COMPONENT');
|
|
546
|
+
class FFlowBase {
|
|
547
|
+
get hostElement() {
|
|
548
|
+
return this.elementReference.nativeElement;
|
|
549
|
+
}
|
|
550
|
+
constructor(elementReference, changeDetectorRef, ngZone) {
|
|
551
|
+
this.elementReference = elementReference;
|
|
552
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
553
|
+
this.ngZone = ngZone;
|
|
554
|
+
this.onDestroy = new Subject();
|
|
555
|
+
}
|
|
556
|
+
ngAfterContentInit() {
|
|
557
|
+
this.subscribeOnComponentsChanges();
|
|
558
|
+
}
|
|
559
|
+
subscribeOnComponentsChanges() {
|
|
560
|
+
console.log(this.fNodesContainer);
|
|
561
|
+
const changes = [
|
|
562
|
+
this.fNodesContainer.fNodes.changes,
|
|
563
|
+
this.fConnectionsContainer.fConnections.changes,
|
|
564
|
+
this.outlets.changes,
|
|
565
|
+
this.outputs.changes,
|
|
566
|
+
this.inputs.changes
|
|
567
|
+
];
|
|
568
|
+
merge(...changes).pipe(startWith(null), takeUntil(this.onDestroy)).subscribe(() => {
|
|
569
|
+
const changedOrDestroyed = merge(...changes, this.onDestroy);
|
|
570
|
+
// const nodesChanges = new QueryListStateChanges(this.ngZone).handle(this.nodes);
|
|
571
|
+
//
|
|
572
|
+
// merge(nodesChanges).pipe(startWith(null), takeUntil(changedOrDestroyed)).subscribe(() => {
|
|
573
|
+
//
|
|
574
|
+
//
|
|
575
|
+
// });
|
|
576
|
+
this.fConnectionsContainer.fConnections.forEach((connection) => {
|
|
577
|
+
connection.fromTo = {
|
|
578
|
+
output: this.outputs.find((x) => x.id === connection.outputId),
|
|
579
|
+
input: this.inputs.find((x) => x.id === connection.inputId)
|
|
580
|
+
};
|
|
581
|
+
connection.initialize();
|
|
582
|
+
});
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
ngOnDestroy() {
|
|
586
|
+
this.onDestroy.next();
|
|
587
|
+
this.onDestroy.complete();
|
|
588
|
+
}
|
|
589
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FFlowBase, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
590
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.4", type: FFlowBase, ngImport: i0 }); }
|
|
591
|
+
}
|
|
592
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FFlowBase, decorators: [{
|
|
593
|
+
type: Directive
|
|
594
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }]; } });
|
|
595
|
+
|
|
596
|
+
function getElementRectInCanvas(element, transform, svgHost) {
|
|
597
|
+
const rect = RectExtensions.fromElement(element);
|
|
598
|
+
const position = Point.fromPoint(rect).matrixTransform(svgHost).sub(transform.scaledPosition).sub(transform.position).div(transform.scale);
|
|
599
|
+
const size = SizeExtensions.initialize(rect.width / transform.scale, rect.height / transform.scale);
|
|
600
|
+
return RectExtensions.initialize(position.x, position.y, size.width, size.height);
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
class FConnectorBase {
|
|
604
|
+
constructor() {
|
|
605
|
+
this.stateChanges = new Subject();
|
|
606
|
+
}
|
|
607
|
+
getElementRectInCanvas(transform, svgHost) {
|
|
608
|
+
return getElementRectInCanvas(this.hostElement, transform, svgHost);
|
|
609
|
+
}
|
|
610
|
+
isContains(element) {
|
|
611
|
+
return this.hostElement.contains(element);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
const F_NODE_INPUT_DIRECTIVE = new InjectionToken('F_NODE_INPUT_DIRECTIVE');
|
|
616
|
+
class FNodeInputBase extends FConnectorBase {
|
|
617
|
+
constructor() {
|
|
618
|
+
super(...arguments);
|
|
619
|
+
this.isConnected = false;
|
|
620
|
+
}
|
|
621
|
+
get canBeConnected() {
|
|
622
|
+
return !this.disabled && (this.multiple ? true : !this.isConnected);
|
|
623
|
+
}
|
|
624
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FNodeInputBase, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
625
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.4", type: FNodeInputBase, usesInheritance: true, ngImport: i0 }); }
|
|
626
|
+
}
|
|
627
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FNodeInputBase, decorators: [{
|
|
628
|
+
type: Directive
|
|
629
|
+
}] });
|
|
630
|
+
|
|
631
|
+
function isNodeInput(element) {
|
|
632
|
+
return !!element.closest('[fNodeInput]');
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
let uniqueId$6 = 0;
|
|
636
|
+
class FNodeInputDirective extends FNodeInputBase {
|
|
637
|
+
get color() {
|
|
638
|
+
return this.fNodeInputColor || 'black';
|
|
639
|
+
}
|
|
640
|
+
get disabled() {
|
|
641
|
+
return this.isDisabled;
|
|
642
|
+
}
|
|
643
|
+
set disabled(isDisabled) {
|
|
644
|
+
const value = BooleanExtensions.castToBoolean(isDisabled);
|
|
645
|
+
if (value !== this.isDisabled) {
|
|
646
|
+
this.isDisabled = value;
|
|
647
|
+
this.stateChanges.next();
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
get hostElement() {
|
|
651
|
+
return this.elementReference.nativeElement;
|
|
652
|
+
}
|
|
653
|
+
constructor(elementReference) {
|
|
654
|
+
super();
|
|
655
|
+
this.elementReference = elementReference;
|
|
656
|
+
this.id = `f-node-input-${uniqueId$6++}`;
|
|
657
|
+
this.multiple = true;
|
|
658
|
+
this.isDisabled = false;
|
|
659
|
+
}
|
|
660
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FNodeInputDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
661
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.4", type: FNodeInputDirective, selector: "[fNodeInput]", inputs: { id: "id", fNodeInputColor: "fNodeInputColor", multiple: ["fNodeInputMultiple", "multiple"], disabled: ["fNodeInputDisabled", "disabled"] }, host: { properties: { "attr.id": "id", "class.f-node-input-multiple": "multiple", "class.f-node-input-disabled": "disabled", "class.f-node-input-not-connectable": "!canBeConnected" }, classAttribute: "f-component f-node-input" }, providers: [{ provide: F_NODE_INPUT_DIRECTIVE, useExisting: FNodeInputDirective }], usesInheritance: true, ngImport: i0 }); }
|
|
662
|
+
}
|
|
663
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FNodeInputDirective, decorators: [{
|
|
664
|
+
type: Directive,
|
|
665
|
+
args: [{
|
|
666
|
+
selector: "[fNodeInput]",
|
|
667
|
+
host: {
|
|
668
|
+
'[attr.id]': 'id',
|
|
669
|
+
class: "f-component f-node-input",
|
|
670
|
+
'[class.f-node-input-multiple]': 'multiple',
|
|
671
|
+
'[class.f-node-input-disabled]': 'disabled',
|
|
672
|
+
'[class.f-node-input-not-connectable]': '!canBeConnected',
|
|
673
|
+
},
|
|
674
|
+
providers: [{ provide: F_NODE_INPUT_DIRECTIVE, useExisting: FNodeInputDirective }],
|
|
675
|
+
}]
|
|
676
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { id: [{
|
|
677
|
+
type: Input
|
|
678
|
+
}], fNodeInputColor: [{
|
|
679
|
+
type: Input,
|
|
680
|
+
args: ['fNodeInputColor']
|
|
681
|
+
}], multiple: [{
|
|
682
|
+
type: Input,
|
|
683
|
+
args: ['fNodeInputMultiple']
|
|
684
|
+
}], disabled: [{
|
|
685
|
+
type: Input,
|
|
686
|
+
args: ['fNodeInputDisabled']
|
|
687
|
+
}] } });
|
|
688
|
+
|
|
689
|
+
class FOutConnectorBase extends FConnectorBase {
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
const F_NODE_OUTLET_DIRECTIVE = new InjectionToken('F_NODE_OUTLET_DIRECTIVE');
|
|
693
|
+
class FNodeOutletBase extends FOutConnectorBase {
|
|
694
|
+
constructor() {
|
|
695
|
+
super(...arguments);
|
|
696
|
+
this.outputs = [];
|
|
697
|
+
}
|
|
698
|
+
get canBeConnected() {
|
|
699
|
+
return !this.disabled;
|
|
700
|
+
}
|
|
701
|
+
setOutputs(outputs) {
|
|
702
|
+
this.outputs = outputs;
|
|
703
|
+
}
|
|
704
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FNodeOutletBase, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
705
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.4", type: FNodeOutletBase, usesInheritance: true, ngImport: i0 }); }
|
|
706
|
+
}
|
|
707
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FNodeOutletBase, decorators: [{
|
|
708
|
+
type: Directive
|
|
709
|
+
}] });
|
|
710
|
+
|
|
711
|
+
function isNodeOutlet(element) {
|
|
712
|
+
return !!element.closest('[fNodeOutlet]');
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
let uniqueId$5 = 0;
|
|
716
|
+
class FNodeOutletDirective extends FNodeOutletBase {
|
|
717
|
+
get disabled() {
|
|
718
|
+
return this.isDisabled;
|
|
719
|
+
}
|
|
720
|
+
set disabled(isDisabled) {
|
|
721
|
+
const value = BooleanExtensions.castToBoolean(isDisabled);
|
|
722
|
+
if (value !== this.isDisabled) {
|
|
723
|
+
this.isDisabled = value;
|
|
724
|
+
this.stateChanges.next();
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
get hostElement() {
|
|
728
|
+
return this.elementReference.nativeElement;
|
|
729
|
+
}
|
|
730
|
+
constructor(elementReference) {
|
|
731
|
+
super();
|
|
732
|
+
this.elementReference = elementReference;
|
|
733
|
+
this.id = `f-node-outlet-${uniqueId$5++}`;
|
|
734
|
+
this.color = 'black';
|
|
735
|
+
this.name = '';
|
|
736
|
+
this.isDisabled = false;
|
|
737
|
+
this.isConnectionFromOutlet = false;
|
|
738
|
+
}
|
|
739
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FNodeOutletDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
740
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.4", type: FNodeOutletDirective, selector: "[fNodeOutlet]", inputs: { id: "id", color: ["fNodeOutletColor", "color"], name: "name", disabled: ["fNodeOutletDisabled", "disabled"], isConnectionFromOutlet: "isConnectionFromOutlet" }, host: { properties: { "attr.id": "id", "class.f-node-outlet-disabled": "disabled" }, classAttribute: "f-component f-node-outlet" }, providers: [{ provide: F_NODE_OUTLET_DIRECTIVE, useExisting: FNodeOutletDirective }], usesInheritance: true, ngImport: i0 }); }
|
|
741
|
+
}
|
|
742
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FNodeOutletDirective, decorators: [{
|
|
743
|
+
type: Directive,
|
|
744
|
+
args: [{
|
|
745
|
+
selector: "[fNodeOutlet]",
|
|
746
|
+
host: {
|
|
747
|
+
'[attr.id]': 'id',
|
|
748
|
+
class: "f-component f-node-outlet",
|
|
749
|
+
'[class.f-node-outlet-disabled]': 'disabled'
|
|
750
|
+
},
|
|
751
|
+
providers: [{ provide: F_NODE_OUTLET_DIRECTIVE, useExisting: FNodeOutletDirective }],
|
|
752
|
+
}]
|
|
753
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { id: [{
|
|
754
|
+
type: Input
|
|
755
|
+
}], color: [{
|
|
756
|
+
type: Input,
|
|
757
|
+
args: ['fNodeOutletColor']
|
|
758
|
+
}], name: [{
|
|
759
|
+
type: Input
|
|
760
|
+
}], disabled: [{
|
|
761
|
+
type: Input,
|
|
762
|
+
args: ['fNodeOutletDisabled']
|
|
763
|
+
}], isConnectionFromOutlet: [{
|
|
764
|
+
type: Input
|
|
765
|
+
}] } });
|
|
766
|
+
|
|
767
|
+
const F_NODE_OUTPUT_DIRECTIVE = new InjectionToken('F_NODE_OUTPUT_DIRECTIVE');
|
|
768
|
+
class FNodeOutputBase extends FOutConnectorBase {
|
|
769
|
+
constructor() {
|
|
770
|
+
super(...arguments);
|
|
771
|
+
this.isConnected = false;
|
|
772
|
+
}
|
|
773
|
+
get canBeConnected() {
|
|
774
|
+
return !this.disabled && !this.isConnected;
|
|
775
|
+
}
|
|
776
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FNodeOutputBase, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
777
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.4", type: FNodeOutputBase, usesInheritance: true, ngImport: i0 }); }
|
|
778
|
+
}
|
|
779
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FNodeOutputBase, decorators: [{
|
|
780
|
+
type: Directive
|
|
781
|
+
}] });
|
|
782
|
+
|
|
783
|
+
function isNodeOutput(element) {
|
|
784
|
+
return !!element.closest('[fNodeOutput]');
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
let uniqueId$4 = 0;
|
|
788
|
+
class FNodeOutputDirective extends FNodeOutputBase {
|
|
789
|
+
get disabled() {
|
|
790
|
+
return this.isDisabled;
|
|
791
|
+
}
|
|
792
|
+
set disabled(isDisabled) {
|
|
793
|
+
const value = BooleanExtensions.castToBoolean(isDisabled);
|
|
794
|
+
if (value !== this.isDisabled) {
|
|
795
|
+
this.isDisabled = value;
|
|
796
|
+
this.stateChanges.next();
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
get hostElement() {
|
|
800
|
+
return this.elementReference.nativeElement;
|
|
801
|
+
}
|
|
802
|
+
constructor(elementReference) {
|
|
803
|
+
super();
|
|
804
|
+
this.elementReference = elementReference;
|
|
805
|
+
this.id = `f-node-output-${uniqueId$4++}`;
|
|
806
|
+
this.color = 'black';
|
|
807
|
+
this.name = '';
|
|
808
|
+
this.isDisabled = false;
|
|
809
|
+
}
|
|
810
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FNodeOutputDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
811
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.4", type: FNodeOutputDirective, selector: "[fNodeOutput]", inputs: { id: "id", color: ["fNodeOutputColor", "color"], name: "name", disabled: ["fNodeOutputDisabled", "disabled"] }, host: { properties: { "attr.id": "id", "class.f-node-output-disabled": "disabled", "class.f-node-output-connected": "isConnected" }, classAttribute: "f-component f-node-output" }, providers: [{ provide: F_NODE_OUTPUT_DIRECTIVE, useExisting: FNodeOutputDirective }], usesInheritance: true, ngImport: i0 }); }
|
|
812
|
+
}
|
|
813
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FNodeOutputDirective, decorators: [{
|
|
814
|
+
type: Directive,
|
|
815
|
+
args: [{
|
|
816
|
+
selector: "[fNodeOutput]",
|
|
817
|
+
host: {
|
|
818
|
+
'[attr.id]': 'id',
|
|
819
|
+
class: "f-component f-node-output",
|
|
820
|
+
'[class.f-node-output-disabled]': 'disabled',
|
|
821
|
+
'[class.f-node-output-connected]': 'isConnected'
|
|
822
|
+
},
|
|
823
|
+
providers: [{ provide: F_NODE_OUTPUT_DIRECTIVE, useExisting: FNodeOutputDirective }],
|
|
824
|
+
}]
|
|
825
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { id: [{
|
|
826
|
+
type: Input
|
|
827
|
+
}], color: [{
|
|
828
|
+
type: Input,
|
|
829
|
+
args: ['fNodeOutputColor']
|
|
830
|
+
}], name: [{
|
|
831
|
+
type: Input
|
|
832
|
+
}], disabled: [{
|
|
833
|
+
type: Input,
|
|
834
|
+
args: ['fNodeOutputDisabled']
|
|
835
|
+
}] } });
|
|
836
|
+
|
|
837
|
+
const F_NODES_CONTAINER = new InjectionToken('F_NODES_CONTAINER');
|
|
838
|
+
class FNodesContainerBase {
|
|
839
|
+
constructor(ngZone) {
|
|
840
|
+
this.ngZone = ngZone;
|
|
841
|
+
this.stateChanges = defer(() => {
|
|
842
|
+
const items = this.fNodes;
|
|
843
|
+
if (items) {
|
|
844
|
+
return items.changes.pipe(startWith(items), switchMap(() => merge(...items.map(x => merge(x.fForeignObject.stateChanges, x.stateChanges)))));
|
|
845
|
+
}
|
|
846
|
+
return this.ngZone.onStable.pipe(take(1), switchMap(() => this.stateChanges));
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
findNode(element) {
|
|
850
|
+
return this.fNodes.find((x) => {
|
|
851
|
+
return x.isContains(element);
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
setNodeToTopLayer(node) {
|
|
855
|
+
const elements = Array.from(this.hostElement.children);
|
|
856
|
+
const elementsCount = elements.length;
|
|
857
|
+
const targetIndex = elements.findIndex((x) => x === node.hostElement);
|
|
858
|
+
if (targetIndex !== elementsCount - 1) {
|
|
859
|
+
const afterElements = elements.splice(targetIndex + 1);
|
|
860
|
+
afterElements.forEach((x) => {
|
|
861
|
+
this.hostElement.removeChild(x);
|
|
862
|
+
this.hostElement.insertBefore(x, node.hostElement);
|
|
863
|
+
});
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FNodesContainerBase, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
867
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.4", type: FNodesContainerBase, ngImport: i0 }); }
|
|
868
|
+
}
|
|
869
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FNodesContainerBase, decorators: [{
|
|
870
|
+
type: Directive
|
|
871
|
+
}], ctorParameters: function () { return [{ type: i0.NgZone }]; } });
|
|
872
|
+
|
|
873
|
+
class TempConnectionInputOutputModel {
|
|
874
|
+
constructor(output) {
|
|
875
|
+
this.output = output;
|
|
876
|
+
this.input = null;
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
class FConnectionModule {
|
|
881
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FConnectionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
882
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.4", ngImport: i0, type: FConnectionModule, declarations: [FTempConnectionComponent,
|
|
883
|
+
FConnectionComponent,
|
|
884
|
+
FConnectionDragHandleComponent,
|
|
885
|
+
FConnectionGradientComponent,
|
|
886
|
+
FConnectionPathComponent,
|
|
887
|
+
FConnectionTextComponent,
|
|
888
|
+
FConnectionTextPathDirective,
|
|
889
|
+
FConnectionSelectionComponent], imports: [CommonModule], exports: [FTempConnectionComponent,
|
|
890
|
+
FConnectionComponent] }); }
|
|
891
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FConnectionModule, imports: [CommonModule] }); }
|
|
892
|
+
}
|
|
893
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FConnectionModule, decorators: [{
|
|
894
|
+
type: NgModule,
|
|
895
|
+
args: [{
|
|
896
|
+
declarations: [
|
|
897
|
+
FTempConnectionComponent,
|
|
898
|
+
FConnectionComponent,
|
|
899
|
+
FConnectionDragHandleComponent,
|
|
900
|
+
FConnectionGradientComponent,
|
|
901
|
+
FConnectionPathComponent,
|
|
902
|
+
FConnectionTextComponent,
|
|
903
|
+
FConnectionTextPathDirective,
|
|
904
|
+
FConnectionSelectionComponent
|
|
905
|
+
],
|
|
906
|
+
imports: [
|
|
907
|
+
CommonModule
|
|
908
|
+
],
|
|
909
|
+
exports: [
|
|
910
|
+
FTempConnectionComponent,
|
|
911
|
+
FConnectionComponent
|
|
912
|
+
]
|
|
913
|
+
}]
|
|
914
|
+
}] });
|
|
915
|
+
|
|
916
|
+
function getConnectionIntersect(fromRect, toRect) {
|
|
917
|
+
const fromResult = RectExtensions.intersectionWithVector(fromRect, fromRect.gravityCenter, toRect.gravityCenter);
|
|
918
|
+
const toResult = RectExtensions.intersectionWithVector(toRect, fromRect.gravityCenter, toRect.gravityCenter);
|
|
919
|
+
return {
|
|
920
|
+
point1: fromResult ? fromResult[1] : fromRect.gravityCenter,
|
|
921
|
+
point2: toResult ? toResult[0] : toRect.gravityCenter,
|
|
922
|
+
};
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
const F_NODE_COMPONENT = new InjectionToken('F_NODE_COMPONENT');
|
|
926
|
+
class FNodeBase {
|
|
927
|
+
constructor() {
|
|
928
|
+
this.stateChanges = new Subject();
|
|
929
|
+
}
|
|
930
|
+
isContains(element) {
|
|
931
|
+
return this.hostElement.contains(element);
|
|
932
|
+
}
|
|
933
|
+
redraw() {
|
|
934
|
+
this.hostElement.setAttribute('transform', 'translate(' + this.position.x + ',' + this.position.y + ')');
|
|
935
|
+
}
|
|
936
|
+
deselect() {
|
|
937
|
+
this.hostElement.classList.remove(F_SELECTED_CLASS);
|
|
938
|
+
}
|
|
939
|
+
select() {
|
|
940
|
+
this.hostElement.classList.add(F_SELECTED_CLASS);
|
|
941
|
+
}
|
|
942
|
+
updatePosition(position) {
|
|
943
|
+
this.position = position;
|
|
944
|
+
}
|
|
945
|
+
completeDrag() {
|
|
946
|
+
this.positionChange.emit(this.position);
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
const F_DRAG_HANDLE = new InjectionToken('F_DRAG_HANDLE');
|
|
951
|
+
class FDragHandleDirective {
|
|
952
|
+
get disabled() {
|
|
953
|
+
return this.isDisabled;
|
|
954
|
+
}
|
|
955
|
+
set disabled(isDisabled) {
|
|
956
|
+
const value = BooleanExtensions.castToBoolean(isDisabled);
|
|
957
|
+
if (value !== this.isDisabled) {
|
|
958
|
+
this.isDisabled = value;
|
|
959
|
+
this.stateChanges.next();
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
get hostElement() {
|
|
963
|
+
return this.elementReference.nativeElement;
|
|
964
|
+
}
|
|
965
|
+
constructor(elementReference, _parentNode) {
|
|
966
|
+
this.elementReference = elementReference;
|
|
967
|
+
this.stateChanges = new Subject();
|
|
968
|
+
this.isDisabled = false;
|
|
969
|
+
this._parentNode = _parentNode;
|
|
970
|
+
}
|
|
971
|
+
ngOnDestroy() {
|
|
972
|
+
this.stateChanges.complete();
|
|
973
|
+
}
|
|
974
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FDragHandleDirective, deps: [{ token: i0.ElementRef }, { token: F_NODE_COMPONENT, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
975
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.4", type: FDragHandleDirective, selector: "[fDragHandle]", inputs: { disabled: ["fDragHandleDisabled", "disabled"] }, host: { properties: { "class.f-drag-handle-disabled": "disabled" }, classAttribute: "f-drag-handle f-component" }, providers: [{ provide: F_DRAG_HANDLE, useExisting: FDragHandleDirective }], ngImport: i0 }); }
|
|
976
|
+
}
|
|
977
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FDragHandleDirective, decorators: [{
|
|
978
|
+
type: Directive,
|
|
979
|
+
args: [{
|
|
980
|
+
selector: "[fDragHandle]",
|
|
981
|
+
host: {
|
|
982
|
+
class: "f-drag-handle f-component",
|
|
983
|
+
'[class.f-drag-handle-disabled]': 'disabled'
|
|
984
|
+
},
|
|
985
|
+
providers: [{ provide: F_DRAG_HANDLE, useExisting: FDragHandleDirective }],
|
|
986
|
+
}]
|
|
987
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: undefined, decorators: [{
|
|
988
|
+
type: Inject,
|
|
989
|
+
args: [F_NODE_COMPONENT]
|
|
990
|
+
}, {
|
|
991
|
+
type: Optional
|
|
992
|
+
}, {
|
|
993
|
+
type: SkipSelf
|
|
994
|
+
}] }]; }, propDecorators: { disabled: [{
|
|
995
|
+
type: Input,
|
|
996
|
+
args: ['fDragHandleDisabled']
|
|
997
|
+
}] } });
|
|
998
|
+
|
|
999
|
+
function isNodeDragHandle(element) {
|
|
1000
|
+
const dragHandle = getClosestDragHandle(element);
|
|
1001
|
+
return !!dragHandle && !isElementOrParentExcluded(element);
|
|
1002
|
+
}
|
|
1003
|
+
function isElementOrParentExcluded(element) {
|
|
1004
|
+
const isContains = isElementContainsClass(element);
|
|
1005
|
+
const parentElement = element.parentElement;
|
|
1006
|
+
const dragHandle = getClosestDragHandle(parentElement);
|
|
1007
|
+
if (!isContains && !!dragHandle) {
|
|
1008
|
+
return isElementOrParentExcluded(parentElement);
|
|
1009
|
+
}
|
|
1010
|
+
return isContains;
|
|
1011
|
+
}
|
|
1012
|
+
function getClosestDragHandle(element) {
|
|
1013
|
+
return element.closest('[fDragHandle]');
|
|
1014
|
+
}
|
|
1015
|
+
function isElementContainsClass(element) {
|
|
1016
|
+
return element.classList.contains('f-drag-handle-disabled');
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
const F_FOREIGN_OBJECT_COMPONENT = new InjectionToken('F_FOREIGN_OBJECT_COMPONENT');
|
|
1020
|
+
class FForeignObjectBase {
|
|
1021
|
+
constructor(_parentNode) {
|
|
1022
|
+
this.subscriptions$ = new Subscription();
|
|
1023
|
+
this.stateChanges = new Subject();
|
|
1024
|
+
this._parentNode = _parentNode;
|
|
1025
|
+
}
|
|
1026
|
+
ngAfterViewInit() {
|
|
1027
|
+
this.subscriptions$.add(this.subscribeOnResizeChanges());
|
|
1028
|
+
}
|
|
1029
|
+
subscribeOnResizeChanges() {
|
|
1030
|
+
return new FResizeObserver(this.hostElement.firstChild).pipe(startWith(null), debounceTime(10)).subscribe(() => {
|
|
1031
|
+
this.redraw();
|
|
1032
|
+
this.stateChanges.next();
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1035
|
+
redraw() {
|
|
1036
|
+
const element = this.hostElement.firstChild;
|
|
1037
|
+
if (element && !!element.getBoundingClientRect) {
|
|
1038
|
+
const rect = RectExtensions.fromElement(element);
|
|
1039
|
+
const scale = this.transform.scale;
|
|
1040
|
+
this.hostElement.setAttribute("width", `${rect.width / scale}`);
|
|
1041
|
+
this.hostElement.setAttribute("height", `${rect.height / scale}`);
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
ngOnDestroy() {
|
|
1045
|
+
this.stateChanges.complete();
|
|
1046
|
+
this.subscriptions$.unsubscribe();
|
|
1047
|
+
}
|
|
1048
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FForeignObjectBase, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1049
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.4", type: FForeignObjectBase, ngImport: i0 }); }
|
|
1050
|
+
}
|
|
1051
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FForeignObjectBase, decorators: [{
|
|
1052
|
+
type: Directive
|
|
1053
|
+
}], ctorParameters: function () { return [{ type: undefined }]; } });
|
|
1054
|
+
|
|
1055
|
+
class FForeignObjectComponent extends FForeignObjectBase {
|
|
1056
|
+
get hostElement() {
|
|
1057
|
+
return this.elementReference.nativeElement;
|
|
1058
|
+
}
|
|
1059
|
+
get transform() {
|
|
1060
|
+
return this.flow.transform;
|
|
1061
|
+
}
|
|
1062
|
+
constructor(elementReference, flow, _parentNode) {
|
|
1063
|
+
super(_parentNode);
|
|
1064
|
+
this.elementReference = elementReference;
|
|
1065
|
+
this.flow = flow;
|
|
1066
|
+
this.defaultWidth = 100;
|
|
1067
|
+
this.defaultHeight = 100;
|
|
1068
|
+
this.hostElement.style.cssText = 'overflow:visible;';
|
|
1069
|
+
}
|
|
1070
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FForeignObjectComponent, deps: [{ token: i0.ElementRef }, { token: FFlowComponent }, { token: F_NODE_COMPONENT, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1071
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.4", type: FForeignObjectComponent, selector: "foreignObject[fForeignObject]", inputs: { defaultWidth: ["fDefaultWidth", "defaultWidth"], defaultHeight: ["fDefaultHeight", "defaultHeight"] }, host: { properties: { "attr.width": "defaultWidth", "attr.height": "defaultHeight" }, classAttribute: "f-foreign-object f-component" }, providers: [
|
|
1072
|
+
{ provide: F_FOREIGN_OBJECT_COMPONENT, useExisting: FForeignObjectComponent }
|
|
1073
|
+
], exportAs: ["fComponent"], usesInheritance: true, ngImport: i0, template: "<ng-container xmlns:svg=\"http://www.w3.org/2000/svg\">\n <ng-content></ng-content>\n</ng-container>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1074
|
+
}
|
|
1075
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FForeignObjectComponent, decorators: [{
|
|
1076
|
+
type: Component,
|
|
1077
|
+
args: [{ selector: "foreignObject[fForeignObject]", exportAs: "fComponent", changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1078
|
+
class: "f-foreign-object f-component",
|
|
1079
|
+
'[attr.width]': 'defaultWidth',
|
|
1080
|
+
'[attr.height]': 'defaultHeight'
|
|
1081
|
+
}, providers: [
|
|
1082
|
+
{ provide: F_FOREIGN_OBJECT_COMPONENT, useExisting: FForeignObjectComponent }
|
|
1083
|
+
], template: "<ng-container xmlns:svg=\"http://www.w3.org/2000/svg\">\n <ng-content></ng-content>\n</ng-container>\n" }]
|
|
1084
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: FFlowComponent }, { type: undefined, decorators: [{
|
|
1085
|
+
type: Inject,
|
|
1086
|
+
args: [F_NODE_COMPONENT]
|
|
1087
|
+
}, {
|
|
1088
|
+
type: Optional
|
|
1089
|
+
}, {
|
|
1090
|
+
type: SkipSelf
|
|
1091
|
+
}] }]; }, propDecorators: { defaultWidth: [{
|
|
1092
|
+
type: Input,
|
|
1093
|
+
args: ['fDefaultWidth']
|
|
1094
|
+
}], defaultHeight: [{
|
|
1095
|
+
type: Input,
|
|
1096
|
+
args: ['fDefaultHeight']
|
|
1097
|
+
}] } });
|
|
1098
|
+
|
|
1099
|
+
let uniqueId$3 = 0;
|
|
1100
|
+
class FNodeComponent extends FNodeBase {
|
|
1101
|
+
set position(value) {
|
|
1102
|
+
this._position = PointExtensions.castToPoint(value);
|
|
1103
|
+
this.refresh();
|
|
1104
|
+
}
|
|
1105
|
+
get position() {
|
|
1106
|
+
return this._position;
|
|
1107
|
+
}
|
|
1108
|
+
get hostElement() {
|
|
1109
|
+
return this.elementReference.nativeElement;
|
|
1110
|
+
}
|
|
1111
|
+
constructor(elementReference) {
|
|
1112
|
+
super();
|
|
1113
|
+
this.elementReference = elementReference;
|
|
1114
|
+
this.id = `f-node-${uniqueId$3++}`;
|
|
1115
|
+
this._position = PointExtensions.initialize();
|
|
1116
|
+
this.positionChange = new EventEmitter();
|
|
1117
|
+
}
|
|
1118
|
+
ngOnInit() {
|
|
1119
|
+
super.redraw();
|
|
1120
|
+
}
|
|
1121
|
+
refresh() {
|
|
1122
|
+
this.stateChanges.next();
|
|
1123
|
+
}
|
|
1124
|
+
ngOnDestroy() {
|
|
1125
|
+
this.stateChanges.complete();
|
|
1126
|
+
}
|
|
1127
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FNodeComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1128
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.4", type: FNodeComponent, selector: "g[fNode]", inputs: { id: "id", position: ["fNodePosition", "position"] }, outputs: { positionChange: "fNodePositionChange" }, host: { properties: { "attr.id": "id" }, classAttribute: "f-node f-component" }, providers: [
|
|
1129
|
+
{ provide: F_NODE_COMPONENT, useExisting: FNodeComponent }
|
|
1130
|
+
], queries: [{ propertyName: "fForeignObject", first: true, predicate: F_FOREIGN_OBJECT_COMPONENT, descendants: true, static: true }, { propertyName: "handles", predicate: F_DRAG_HANDLE, descendants: true }], exportAs: ["fComponent"], usesInheritance: true, ngImport: i0, template: "<ng-container xmlns:svg=\"http://www.w3.org/2000/svg\">\n <ng-content></ng-content>\n</ng-container>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1131
|
+
}
|
|
1132
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FNodeComponent, decorators: [{
|
|
1133
|
+
type: Component,
|
|
1134
|
+
args: [{ selector: "g[fNode]", exportAs: "fComponent", changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1135
|
+
'[attr.id]': 'id',
|
|
1136
|
+
class: "f-node f-component"
|
|
1137
|
+
}, providers: [
|
|
1138
|
+
{ provide: F_NODE_COMPONENT, useExisting: FNodeComponent }
|
|
1139
|
+
], template: "<ng-container xmlns:svg=\"http://www.w3.org/2000/svg\">\n <ng-content></ng-content>\n</ng-container>\n" }]
|
|
1140
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { id: [{
|
|
1141
|
+
type: Input
|
|
1142
|
+
}], handles: [{
|
|
1143
|
+
type: ContentChildren,
|
|
1144
|
+
args: [F_DRAG_HANDLE, { descendants: true }]
|
|
1145
|
+
}], fForeignObject: [{
|
|
1146
|
+
type: ContentChild,
|
|
1147
|
+
args: [F_FOREIGN_OBJECT_COMPONENT, { static: true }]
|
|
1148
|
+
}], position: [{
|
|
1149
|
+
type: Input,
|
|
1150
|
+
args: ['fNodePosition']
|
|
1151
|
+
}], positionChange: [{
|
|
1152
|
+
type: Output,
|
|
1153
|
+
args: ['fNodePositionChange']
|
|
1154
|
+
}] } });
|
|
1155
|
+
|
|
1156
|
+
const F_SELECTION = new InjectionToken('F_SELECTION');
|
|
1157
|
+
class FSelectionDirective {
|
|
1158
|
+
get hostElement() {
|
|
1159
|
+
return this.elementReference.nativeElement;
|
|
1160
|
+
}
|
|
1161
|
+
constructor(elementReference) {
|
|
1162
|
+
this.elementReference = elementReference;
|
|
1163
|
+
this.fElement = new RectFElement();
|
|
1164
|
+
this.hostElement.appendChild(this.fElement.hostElement);
|
|
1165
|
+
}
|
|
1166
|
+
hide() {
|
|
1167
|
+
this.fElement.hide();
|
|
1168
|
+
}
|
|
1169
|
+
show() {
|
|
1170
|
+
this.fElement.show();
|
|
1171
|
+
}
|
|
1172
|
+
draw(object) {
|
|
1173
|
+
this.fElement.draw(object);
|
|
1174
|
+
}
|
|
1175
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FSelectionDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1176
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.4", type: FSelectionDirective, selector: "g[fSelection]", host: { classAttribute: "f-selection f-component" }, providers: [
|
|
1177
|
+
{ provide: F_SELECTION, useExisting: FSelectionDirective }
|
|
1178
|
+
], ngImport: i0 }); }
|
|
1179
|
+
}
|
|
1180
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FSelectionDirective, decorators: [{
|
|
1181
|
+
type: Directive,
|
|
1182
|
+
args: [{
|
|
1183
|
+
selector: "g[fSelection]",
|
|
1184
|
+
host: {
|
|
1185
|
+
'class': 'f-selection f-component'
|
|
1186
|
+
},
|
|
1187
|
+
providers: [
|
|
1188
|
+
{ provide: F_SELECTION, useExisting: FSelectionDirective }
|
|
1189
|
+
],
|
|
1190
|
+
}]
|
|
1191
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
|
|
1192
|
+
|
|
1193
|
+
class FNodesContainerComponent extends FNodesContainerBase {
|
|
1194
|
+
get hostElement() {
|
|
1195
|
+
return this.elementReference.nativeElement;
|
|
1196
|
+
}
|
|
1197
|
+
constructor(elementReference, ngZone) {
|
|
1198
|
+
super(ngZone);
|
|
1199
|
+
this.elementReference = elementReference;
|
|
1200
|
+
}
|
|
1201
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FNodesContainerComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1202
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.4", type: FNodesContainerComponent, selector: "g[fNodesContainer]", host: { classAttribute: "f-nodes-container" }, providers: [{ provide: F_NODES_CONTAINER, useExisting: FNodesContainerComponent }], queries: [{ propertyName: "fNodes", predicate: F_NODE_COMPONENT, descendants: true }], exportAs: ["fComponent"], usesInheritance: true, ngImport: i0, template: "<ng-container xmlns:svg=\"http://www.w3.org/2000/svg\">\n <ng-content select=\"[fNode]\"></ng-content>\n</ng-container>\n" }); }
|
|
1203
|
+
}
|
|
1204
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FNodesContainerComponent, decorators: [{
|
|
1205
|
+
type: Component,
|
|
1206
|
+
args: [{ selector: "g[fNodesContainer]", exportAs: 'fComponent', host: {
|
|
1207
|
+
'class': 'f-nodes-container'
|
|
1208
|
+
}, providers: [{ provide: F_NODES_CONTAINER, useExisting: FNodesContainerComponent }], template: "<ng-container xmlns:svg=\"http://www.w3.org/2000/svg\">\n <ng-content select=\"[fNode]\"></ng-content>\n</ng-container>\n" }]
|
|
1209
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { fNodes: [{
|
|
1210
|
+
type: ContentChildren,
|
|
1211
|
+
args: [F_NODE_COMPONENT, { descendants: true }]
|
|
1212
|
+
}] } });
|
|
1213
|
+
|
|
1214
|
+
const F_CONNECTIONS_CONTAINER = new InjectionToken('F_CONNECTIONS_CONTAINER');
|
|
1215
|
+
class FConnectionsContainerBase {
|
|
1216
|
+
findConnectionWithElement(element) {
|
|
1217
|
+
return this.fConnections.toArray().find((x) => {
|
|
1218
|
+
return x.isContains(element);
|
|
1219
|
+
});
|
|
1220
|
+
}
|
|
1221
|
+
findOutgoingConnections(outputs) {
|
|
1222
|
+
return findOutgoingConnections(this.fConnections.toArray(), outputs);
|
|
1223
|
+
}
|
|
1224
|
+
findIncomingConnections(inputs) {
|
|
1225
|
+
return findIncomingConnections(this.fConnections.toArray(), inputs);
|
|
1226
|
+
}
|
|
1227
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FConnectionsContainerBase, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1228
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.4", type: FConnectionsContainerBase, ngImport: i0 }); }
|
|
1229
|
+
}
|
|
1230
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FConnectionsContainerBase, decorators: [{
|
|
1231
|
+
type: Directive
|
|
1232
|
+
}] });
|
|
1233
|
+
function findIncomingConnections(allConnections, inputs) {
|
|
1234
|
+
return allConnections.filter((x) => {
|
|
1235
|
+
return inputs.includes(x.fromTo.input);
|
|
1236
|
+
});
|
|
1237
|
+
}
|
|
1238
|
+
function findOutgoingConnections(allConnections, outputs) {
|
|
1239
|
+
return allConnections.filter((x) => {
|
|
1240
|
+
return outputs.includes(x.fromTo.output);
|
|
1241
|
+
});
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
const F_BACKGROUND = new InjectionToken('F_BACKGROUND');
|
|
1245
|
+
class FBackgroundBase {
|
|
1246
|
+
get hostElement() {
|
|
1247
|
+
return this.elementReference.nativeElement;
|
|
1248
|
+
}
|
|
1249
|
+
constructor(elementReference, fCanvas) {
|
|
1250
|
+
this.elementReference = elementReference;
|
|
1251
|
+
this.fCanvas = fCanvas;
|
|
1252
|
+
this.transform = TransformModelExtensions.default();
|
|
1253
|
+
console.log('FBackgroundBase');
|
|
1254
|
+
}
|
|
1255
|
+
isBackgroundElement(element) {
|
|
1256
|
+
return this.hostElement === element || this.hostElement.contains(element) || this.fCanvas.hostElement.contains(element);
|
|
1257
|
+
}
|
|
1258
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FBackgroundBase, deps: [{ token: i0.ElementRef }, { token: FCanvasBase }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1259
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.4", type: FBackgroundBase, ngImport: i0 }); }
|
|
1260
|
+
}
|
|
1261
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FBackgroundBase, decorators: [{
|
|
1262
|
+
type: Directive
|
|
1263
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: FCanvasBase }]; } });
|
|
1264
|
+
|
|
1265
|
+
class FBackgroundDirective extends FBackgroundBase {
|
|
1266
|
+
constructor(elementReference, fCanvas) {
|
|
1267
|
+
super(elementReference, fCanvas);
|
|
1268
|
+
}
|
|
1269
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FBackgroundDirective, deps: [{ token: i0.ElementRef }, { token: F_CANVAS }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1270
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.4", type: FBackgroundDirective, isStandalone: true, selector: "g[fBackground]", providers: [{ provide: F_BACKGROUND, useExisting: FBackgroundDirective }], usesInheritance: true, ngImport: i0 }); }
|
|
1271
|
+
}
|
|
1272
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FBackgroundDirective, decorators: [{
|
|
1273
|
+
type: Directive,
|
|
1274
|
+
args: [{
|
|
1275
|
+
selector: "g[fBackground]",
|
|
1276
|
+
standalone: true,
|
|
1277
|
+
providers: [{ provide: F_BACKGROUND, useExisting: FBackgroundDirective }],
|
|
1278
|
+
}]
|
|
1279
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: FCanvasBase, decorators: [{
|
|
1280
|
+
type: Inject,
|
|
1281
|
+
args: [F_CANVAS]
|
|
1282
|
+
}] }]; } });
|
|
1283
|
+
|
|
1284
|
+
let uniqueId$2 = 0;
|
|
1285
|
+
const CONNECTION_MARKER_START = "connection-marker-start";
|
|
1286
|
+
const CONNECTION_MARKER_END = "connection-marker-end";
|
|
1287
|
+
const CONNECTION_MARKER_START_SELECTED = "connection-marker-start-selected";
|
|
1288
|
+
const CONNECTION_MARKER_END_SELECTED = "connection-marker-end-selected";
|
|
1289
|
+
class FFlowComponent extends FFlowBase {
|
|
1290
|
+
get transform() {
|
|
1291
|
+
return this.fItemsContainer.transform;
|
|
1292
|
+
}
|
|
1293
|
+
constructor(elementReference, changeDetectorRef, ngZone) {
|
|
1294
|
+
super(elementReference, changeDetectorRef, ngZone);
|
|
1295
|
+
this.CONNECTION_MARKER_START = CONNECTION_MARKER_START;
|
|
1296
|
+
this.CONNECTION_MARKER_END = CONNECTION_MARKER_END;
|
|
1297
|
+
this.CONNECTION_MARKER_START_SELECTED = CONNECTION_MARKER_START_SELECTED;
|
|
1298
|
+
this.CONNECTION_MARKER_END_SELECTED = CONNECTION_MARKER_END_SELECTED;
|
|
1299
|
+
this.id = `f-flow-${uniqueId$2++}`;
|
|
1300
|
+
}
|
|
1301
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FFlowComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1302
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.4", type: FFlowComponent, selector: "svg[fFlow]", inputs: { id: "id" }, host: { properties: { "attr.id": "id" }, classAttribute: "f-component f-flow" }, providers: [{ provide: F_FLOW_COMPONENT, useExisting: FFlowComponent }], queries: [{ propertyName: "fNodesContainer", first: true, predicate: F_NODES_CONTAINER, descendants: true, static: true }, { propertyName: "fConnectionsContainer", first: true, predicate: F_CONNECTIONS_CONTAINER, descendants: true }, { propertyName: "fItemsContainer", first: true, predicate: F_ITEMS_CONTAINER, descendants: true, static: true }, { propertyName: "outlets", predicate: F_NODE_OUTLET_DIRECTIVE, descendants: true }, { propertyName: "outputs", predicate: F_NODE_OUTPUT_DIRECTIVE, descendants: true }, { propertyName: "inputs", predicate: F_NODE_INPUT_DIRECTIVE, descendants: true }], viewQueries: [{ propertyName: "fBackground", first: true, predicate: F_BACKGROUND, descendants: true, static: true }], usesInheritance: true, hostDirectives: [{ directive: FCanvasDirective }], ngImport: i0, template: "<ng-container xmlns:svg=\"http://www.w3.org/2000/svg\">\n <svg:g fBackground>\n <rect width=\"100%\" height=\"100%\" fill=\"url(#background)\"></rect>\n </svg:g>\n <ng-content></ng-content>\n <svg:defs>\n <svg:marker [id]=\"CONNECTION_MARKER_START\" class=\"connection-marker-start\" markerHeight=\"10\" markerWidth=\"10\" refY=\"5\" refX=\"5\">\n <svg:circle cx=\"5\" cy=\"5\" r=\"2\"></svg:circle>\n </svg:marker>\n <svg:marker [id]=\"CONNECTION_MARKER_END\" class=\"connection-marker-end\" markerHeight=\"10\" markerWidth=\"10\" orient=\"auto\" refX=\"5\" refY=\"3\">\n <svg:path d=\"M0,0 L6,3 0,6Z\"></svg:path>\n </svg:marker>\n <svg:marker [id]=\"CONNECTION_MARKER_START_SELECTED\" class=\"connection-marker-start f-selected\" markerHeight=\"10\" markerWidth=\"10\" refY=\"5\" refX=\"5\">\n <svg:circle cx=\"5\" cy=\"5\" r=\"2\"></svg:circle>\n </svg:marker>\n <svg:marker [id]=\"CONNECTION_MARKER_END_SELECTED\" class=\"connection-marker-end f-selected\" markerHeight=\"10\" markerWidth=\"10\" orient=\"auto\" refX=\"5\" refY=\"3\">\n <svg:path d=\"M0,0 L6,3 0,6Z\"></svg:path>\n </svg:marker>\n <ng-container *ngIf=\"fConnectionsContainer\">\n <ng-container *ngFor=\"let connection of fConnectionsContainer.fConnections.toArray()\">\n <svg:marker [id]=\"'connection-marker-start-' + connection.fromTo?.output?.color\" markerHeight=\"10\" markerWidth=\"10\" refY=\"5\" refX=\"5\">\n <svg:circle cx=\"5\" cy=\"5\" r=\"2\" [attr.stroke]=\"'none'\" [attr.fill]=\"connection.fromTo?.output?.color\"></svg:circle>\n </svg:marker>\n <svg:marker [id]=\"'connection-marker-end-' + connection.fromTo?.input?.color\" markerHeight=\"10\" markerWidth=\"10\" orient=\"auto\" refX=\"5\" refY=\"3\">\n <svg:path d=\"M0,0 L6,3 0,6Z\" [attr.stroke]=\"'none'\" [attr.fill]=\"connection.fromTo?.input?.color\"></svg:path>\n </svg:marker>\n </ng-container>\n\n </ng-container>\n <svg:pattern id=\"background\" height=\"10\" width=\"10\" class=\"fb-background-pattern\"\n patternUnits=\"userSpaceOnUse\">\n <svg:circle cx=\"5\" cy=\"5\" r=\"0.5\"/>\n </svg:pattern>\n </svg:defs>\n</ng-container>\n", dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: FBackgroundDirective, selector: "g[fBackground]" }] }); }
|
|
1303
|
+
}
|
|
1304
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FFlowComponent, decorators: [{
|
|
1305
|
+
type: Component,
|
|
1306
|
+
args: [{ selector: 'svg[fFlow]', hostDirectives: [
|
|
1307
|
+
{
|
|
1308
|
+
directive: FCanvasDirective
|
|
1309
|
+
}
|
|
1310
|
+
], host: {
|
|
1311
|
+
'[attr.id]': 'id',
|
|
1312
|
+
class: "f-component f-flow"
|
|
1313
|
+
}, providers: [{ provide: F_FLOW_COMPONENT, useExisting: FFlowComponent }], template: "<ng-container xmlns:svg=\"http://www.w3.org/2000/svg\">\n <svg:g fBackground>\n <rect width=\"100%\" height=\"100%\" fill=\"url(#background)\"></rect>\n </svg:g>\n <ng-content></ng-content>\n <svg:defs>\n <svg:marker [id]=\"CONNECTION_MARKER_START\" class=\"connection-marker-start\" markerHeight=\"10\" markerWidth=\"10\" refY=\"5\" refX=\"5\">\n <svg:circle cx=\"5\" cy=\"5\" r=\"2\"></svg:circle>\n </svg:marker>\n <svg:marker [id]=\"CONNECTION_MARKER_END\" class=\"connection-marker-end\" markerHeight=\"10\" markerWidth=\"10\" orient=\"auto\" refX=\"5\" refY=\"3\">\n <svg:path d=\"M0,0 L6,3 0,6Z\"></svg:path>\n </svg:marker>\n <svg:marker [id]=\"CONNECTION_MARKER_START_SELECTED\" class=\"connection-marker-start f-selected\" markerHeight=\"10\" markerWidth=\"10\" refY=\"5\" refX=\"5\">\n <svg:circle cx=\"5\" cy=\"5\" r=\"2\"></svg:circle>\n </svg:marker>\n <svg:marker [id]=\"CONNECTION_MARKER_END_SELECTED\" class=\"connection-marker-end f-selected\" markerHeight=\"10\" markerWidth=\"10\" orient=\"auto\" refX=\"5\" refY=\"3\">\n <svg:path d=\"M0,0 L6,3 0,6Z\"></svg:path>\n </svg:marker>\n <ng-container *ngIf=\"fConnectionsContainer\">\n <ng-container *ngFor=\"let connection of fConnectionsContainer.fConnections.toArray()\">\n <svg:marker [id]=\"'connection-marker-start-' + connection.fromTo?.output?.color\" markerHeight=\"10\" markerWidth=\"10\" refY=\"5\" refX=\"5\">\n <svg:circle cx=\"5\" cy=\"5\" r=\"2\" [attr.stroke]=\"'none'\" [attr.fill]=\"connection.fromTo?.output?.color\"></svg:circle>\n </svg:marker>\n <svg:marker [id]=\"'connection-marker-end-' + connection.fromTo?.input?.color\" markerHeight=\"10\" markerWidth=\"10\" orient=\"auto\" refX=\"5\" refY=\"3\">\n <svg:path d=\"M0,0 L6,3 0,6Z\" [attr.stroke]=\"'none'\" [attr.fill]=\"connection.fromTo?.input?.color\"></svg:path>\n </svg:marker>\n </ng-container>\n\n </ng-container>\n <svg:pattern id=\"background\" height=\"10\" width=\"10\" class=\"fb-background-pattern\"\n patternUnits=\"userSpaceOnUse\">\n <svg:circle cx=\"5\" cy=\"5\" r=\"0.5\"/>\n </svg:pattern>\n </svg:defs>\n</ng-container>\n" }]
|
|
1314
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }]; }, propDecorators: { id: [{
|
|
1315
|
+
type: Input
|
|
1316
|
+
}], fNodesContainer: [{
|
|
1317
|
+
type: ContentChild,
|
|
1318
|
+
args: [F_NODES_CONTAINER, { static: true }]
|
|
1319
|
+
}], fConnectionsContainer: [{
|
|
1320
|
+
type: ContentChild,
|
|
1321
|
+
args: [F_CONNECTIONS_CONTAINER, { descendants: true }]
|
|
1322
|
+
}], fItemsContainer: [{
|
|
1323
|
+
type: ContentChild,
|
|
1324
|
+
args: [F_ITEMS_CONTAINER, { static: true }]
|
|
1325
|
+
}], fBackground: [{
|
|
1326
|
+
type: ViewChild,
|
|
1327
|
+
args: [F_BACKGROUND, { static: true }]
|
|
1328
|
+
}], outlets: [{
|
|
1329
|
+
type: ContentChildren,
|
|
1330
|
+
args: [F_NODE_OUTLET_DIRECTIVE, { descendants: true }]
|
|
1331
|
+
}], outputs: [{
|
|
1332
|
+
type: ContentChildren,
|
|
1333
|
+
args: [F_NODE_OUTPUT_DIRECTIVE, { descendants: true }]
|
|
1334
|
+
}], inputs: [{
|
|
1335
|
+
type: ContentChildren,
|
|
1336
|
+
args: [F_NODE_INPUT_DIRECTIVE, { descendants: true }]
|
|
1337
|
+
}] } });
|
|
1338
|
+
|
|
1339
|
+
let uniqueId$1 = 0;
|
|
1340
|
+
class FConnectionComponent extends FConnectionBase {
|
|
1341
|
+
get hostElement() {
|
|
1342
|
+
return this.elementReference.nativeElement;
|
|
1343
|
+
}
|
|
1344
|
+
constructor(elementReference, flow) {
|
|
1345
|
+
super();
|
|
1346
|
+
this.elementReference = elementReference;
|
|
1347
|
+
this.flow = flow;
|
|
1348
|
+
this.id = `f-connection-${uniqueId$1++}`;
|
|
1349
|
+
}
|
|
1350
|
+
initialize() {
|
|
1351
|
+
const vector = getConnectionIntersect(this.fromTo.output.getElementRectInCanvas(this.flow.transform, this.flow.hostElement), this.fromTo.input.getElementRectInCanvas(this.flow.transform, this.flow.hostElement));
|
|
1352
|
+
this.setVector(vector);
|
|
1353
|
+
this.redraw();
|
|
1354
|
+
}
|
|
1355
|
+
initializeDrag() {
|
|
1356
|
+
}
|
|
1357
|
+
setVector(vector) {
|
|
1358
|
+
this.vector = vector;
|
|
1359
|
+
this.path = `M${vector.point1.x},${vector.point1.y}L${vector.point2.x + 0.0001},${vector.point2.y + 0.0001}`;
|
|
1360
|
+
}
|
|
1361
|
+
redraw() {
|
|
1362
|
+
this.fPath.setPath(this.path);
|
|
1363
|
+
this.fSelection.setPath(this.path);
|
|
1364
|
+
this.fGradient.redraw(this.vector);
|
|
1365
|
+
this.fDragHandle.redraw(this.vector.point2);
|
|
1366
|
+
this.fText.redraw(this.vector);
|
|
1367
|
+
}
|
|
1368
|
+
select() {
|
|
1369
|
+
this.fPath.select();
|
|
1370
|
+
super.select();
|
|
1371
|
+
}
|
|
1372
|
+
deselect() {
|
|
1373
|
+
this.fPath.deselect();
|
|
1374
|
+
super.deselect();
|
|
1375
|
+
}
|
|
1376
|
+
completeDrag() {
|
|
1377
|
+
this.redraw();
|
|
1378
|
+
}
|
|
1379
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FConnectionComponent, deps: [{ token: i0.ElementRef }, { token: F_FLOW_COMPONENT }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1380
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.4", type: FConnectionComponent, selector: "g[fConnection]", inputs: { id: "id", outputId: "outputId", inputId: "inputId" }, host: { properties: { "attr.id": "id" }, classAttribute: "f-component f-connection" }, providers: [{ provide: F_CONNECTION_COMPONENT, useExisting: FConnectionComponent }], viewQueries: [{ propertyName: "fPath", first: true, predicate: FConnectionPathComponent, descendants: true, static: true }, { propertyName: "fGradient", first: true, predicate: FConnectionGradientComponent, 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: "fText", first: true, predicate: FConnectionTextComponent, descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<ng-container xmlns:svg=\"http://www.w3.org/2000/svg\">\n <svg:linearGradient fConnectionGradient [fromTo]=\"fromTo\"></svg:linearGradient>\n <svg:path fConnectionSelection [attr.d]=\"path\" [fromTo]=\"fromTo\"></svg:path>\n <svg:g>\n <svg:path f-connection-path [attr.d]=\"path\" [fromTo]=\"fromTo\"></svg:path>\n <svg:circle f-connection-drag-handle r=\"8\"></svg:circle>\n </svg:g>\n <svg:text f-connection-text [fromTo]=\"fromTo\"></svg:text>\n</ng-container>\n", dependencies: [{ kind: "component", type: FConnectionDragHandleComponent, selector: "circle[f-connection-drag-handle]" }, { kind: "component", type: FConnectionGradientComponent, selector: "linearGradient[fConnectionGradient]", inputs: ["fromTo"] }, { kind: "component", type: FConnectionPathComponent, selector: "path[f-connection-path]", inputs: ["fromTo"] }, { kind: "component", type: FConnectionTextComponent, selector: "text[f-connection-text]", inputs: ["fromTo"] }, { kind: "component", type: FConnectionSelectionComponent, selector: "path[fConnectionSelection]", inputs: ["fromTo"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1381
|
+
}
|
|
1382
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FConnectionComponent, decorators: [{
|
|
1383
|
+
type: Component,
|
|
1384
|
+
args: [{ selector: "g[fConnection]", changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1385
|
+
'[attr.id]': 'id',
|
|
1386
|
+
class: "f-component f-connection"
|
|
1387
|
+
}, providers: [{ provide: F_CONNECTION_COMPONENT, useExisting: FConnectionComponent }], template: "<ng-container xmlns:svg=\"http://www.w3.org/2000/svg\">\n <svg:linearGradient fConnectionGradient [fromTo]=\"fromTo\"></svg:linearGradient>\n <svg:path fConnectionSelection [attr.d]=\"path\" [fromTo]=\"fromTo\"></svg:path>\n <svg:g>\n <svg:path f-connection-path [attr.d]=\"path\" [fromTo]=\"fromTo\"></svg:path>\n <svg:circle f-connection-drag-handle r=\"8\"></svg:circle>\n </svg:g>\n <svg:text f-connection-text [fromTo]=\"fromTo\"></svg:text>\n</ng-container>\n" }]
|
|
1388
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: FFlowBase, decorators: [{
|
|
1389
|
+
type: Inject,
|
|
1390
|
+
args: [F_FLOW_COMPONENT]
|
|
1391
|
+
}] }]; }, propDecorators: { id: [{
|
|
1392
|
+
type: Input
|
|
1393
|
+
}], outputId: [{
|
|
1394
|
+
type: Input
|
|
1395
|
+
}], inputId: [{
|
|
1396
|
+
type: Input
|
|
1397
|
+
}], fPath: [{
|
|
1398
|
+
type: ViewChild,
|
|
1399
|
+
args: [FConnectionPathComponent, { static: true }]
|
|
1400
|
+
}], fGradient: [{
|
|
1401
|
+
type: ViewChild,
|
|
1402
|
+
args: [FConnectionGradientComponent, { static: true }]
|
|
1403
|
+
}], fDragHandle: [{
|
|
1404
|
+
type: ViewChild,
|
|
1405
|
+
args: [FConnectionDragHandleComponent, { static: true }]
|
|
1406
|
+
}], fSelection: [{
|
|
1407
|
+
type: ViewChild,
|
|
1408
|
+
args: [FConnectionSelectionComponent, { static: true }]
|
|
1409
|
+
}], fText: [{
|
|
1410
|
+
type: ViewChild,
|
|
1411
|
+
args: [FConnectionTextComponent, { static: true }]
|
|
1412
|
+
}] } });
|
|
1413
|
+
|
|
1414
|
+
class FConnectionsContainerComponent extends FConnectionsContainerBase {
|
|
1415
|
+
get hostElement() {
|
|
1416
|
+
return this.elementReference.nativeElement;
|
|
1417
|
+
}
|
|
1418
|
+
constructor(elementReference) {
|
|
1419
|
+
super();
|
|
1420
|
+
this.elementReference = elementReference;
|
|
1421
|
+
}
|
|
1422
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FConnectionsContainerComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1423
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.4", type: FConnectionsContainerComponent, selector: "g[fConnectionsContainer]", host: { classAttribute: "f-connections-container" }, providers: [{ provide: F_CONNECTIONS_CONTAINER, useExisting: FConnectionsContainerComponent }], queries: [{ propertyName: "fConnections", predicate: F_CONNECTION_COMPONENT, descendants: true }], viewQueries: [{ propertyName: "fTempConnection", first: true, predicate: F_TEMP_CONNECTION_COMPONENT, descendants: true, static: true }], exportAs: ["fComponent"], usesInheritance: true, ngImport: i0, template: "<ng-container xmlns:svg=\"http://www.w3.org/2000/svg\">\n <ng-content select=\"[fConnection]\"></ng-content>\n <svg:g fTempConnection></svg:g>\n</ng-container>\n", dependencies: [{ kind: "component", type: FTempConnectionComponent, selector: "g[fTempConnection]" }] }); }
|
|
1424
|
+
}
|
|
1425
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FConnectionsContainerComponent, decorators: [{
|
|
1426
|
+
type: Component,
|
|
1427
|
+
args: [{ selector: "g[fConnectionsContainer]", exportAs: 'fComponent', host: {
|
|
1428
|
+
'class': 'f-connections-container'
|
|
1429
|
+
}, providers: [{ provide: F_CONNECTIONS_CONTAINER, useExisting: FConnectionsContainerComponent }], template: "<ng-container xmlns:svg=\"http://www.w3.org/2000/svg\">\n <ng-content select=\"[fConnection]\"></ng-content>\n <svg:g fTempConnection></svg:g>\n</ng-container>\n" }]
|
|
1430
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { fConnections: [{
|
|
1431
|
+
type: ContentChildren,
|
|
1432
|
+
args: [F_CONNECTION_COMPONENT, { descendants: true }]
|
|
1433
|
+
}], fTempConnection: [{
|
|
1434
|
+
type: ViewChild,
|
|
1435
|
+
args: [F_TEMP_CONNECTION_COMPONENT, { static: true }]
|
|
1436
|
+
}] } });
|
|
1437
|
+
|
|
1438
|
+
var EDraggableType;
|
|
1439
|
+
(function (EDraggableType) {
|
|
1440
|
+
EDraggableType["NODE"] = "node";
|
|
1441
|
+
EDraggableType["REASSIGN_CONNECTION"] = "reassign-connection";
|
|
1442
|
+
EDraggableType["TEMP_CONNECTION"] = "temp-connection";
|
|
1443
|
+
EDraggableType["CONNECTION"] = "connection";
|
|
1444
|
+
EDraggableType["CANVAS"] = "canvas";
|
|
1445
|
+
EDraggableType["PALETTE_ITEM"] = "palette-item";
|
|
1446
|
+
EDraggableType["DEFAULT"] = "default";
|
|
1447
|
+
EDraggableType["SELECTION"] = "selection";
|
|
1448
|
+
})(EDraggableType || (EDraggableType = {}));
|
|
1449
|
+
|
|
1450
|
+
class CanvasOnPointerMove {
|
|
1451
|
+
constructor(fItemsContainer) {
|
|
1452
|
+
this.fItemsContainer = fItemsContainer;
|
|
1453
|
+
this.type = EDraggableType.CANVAS;
|
|
1454
|
+
this.onPointerDownPosition = PointExtensions.initialize();
|
|
1455
|
+
this.onPointerDownPosition = this.fItemsContainer.transform.position;
|
|
1456
|
+
}
|
|
1457
|
+
initialize() {
|
|
1458
|
+
}
|
|
1459
|
+
move(difference) {
|
|
1460
|
+
this.fItemsContainer.setPosition(Point.fromPoint(this.onPointerDownPosition).add(difference));
|
|
1461
|
+
this.fItemsContainer.redraw();
|
|
1462
|
+
}
|
|
1463
|
+
complete() {
|
|
1464
|
+
this.fItemsContainer.completeDrag();
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1468
|
+
class CanvasOnPointerDownHandler {
|
|
1469
|
+
constructor(fBackground, fItemsContainer, hostElement) {
|
|
1470
|
+
this.fBackground = fBackground;
|
|
1471
|
+
this.fItemsContainer = fItemsContainer;
|
|
1472
|
+
this.hostElement = hostElement;
|
|
1473
|
+
}
|
|
1474
|
+
handle(payload) {
|
|
1475
|
+
let result;
|
|
1476
|
+
const pointerPositionInCanvas = Point.fromPoint(payload.event.getPosition()).matrixTransform(this.hostElement);
|
|
1477
|
+
if (this.fBackground.isBackgroundElement(payload.event.targetElement) && payload.event.isMouseLeftButton()) {
|
|
1478
|
+
result = {
|
|
1479
|
+
onPointerDownScale: 1,
|
|
1480
|
+
onPointerDownPosition: pointerPositionInCanvas.div(1),
|
|
1481
|
+
draggableItems: [
|
|
1482
|
+
new CanvasOnPointerMove(this.fItemsContainer)
|
|
1483
|
+
]
|
|
1484
|
+
};
|
|
1485
|
+
}
|
|
1486
|
+
return result;
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
class CanvasOnPointerDownRequest {
|
|
1491
|
+
constructor(event) {
|
|
1492
|
+
this.event = event;
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
class CreateConnectionOnPointerDownRequest {
|
|
1497
|
+
constructor(event, transform) {
|
|
1498
|
+
this.event = event;
|
|
1499
|
+
this.transform = transform;
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
class CreateConnectionOnPointerMove {
|
|
1504
|
+
constructor(connection, mouseDownPoint, transform, hostElement) {
|
|
1505
|
+
this.connection = connection;
|
|
1506
|
+
this.mouseDownPoint = mouseDownPoint;
|
|
1507
|
+
this.type = EDraggableType.TEMP_CONNECTION;
|
|
1508
|
+
this.onPointerDownFromConnectorRect = RectExtensions.initialize();
|
|
1509
|
+
this.onPointerDownToConnectorRect = RectExtensions.initialize();
|
|
1510
|
+
this.onPointerDownFromConnectorRect = this.connection.fromTo.output.getElementRectInCanvas(transform, hostElement);
|
|
1511
|
+
this.onPointerDownToConnectorRect = RectExtensions.initialize(this.mouseDownPoint.x, this.mouseDownPoint.y, 0, 0);
|
|
1512
|
+
}
|
|
1513
|
+
initialize() {
|
|
1514
|
+
this.connection.initializeDrag();
|
|
1515
|
+
this.move(new Point(0, 0));
|
|
1516
|
+
}
|
|
1517
|
+
move(difference) {
|
|
1518
|
+
const toPoint = RectExtensions.addPoint(this.onPointerDownToConnectorRect, difference);
|
|
1519
|
+
const vector = getConnectionIntersect(this.onPointerDownFromConnectorRect, toPoint);
|
|
1520
|
+
this.connection.setVector(vector);
|
|
1521
|
+
this.connection.redraw();
|
|
1522
|
+
}
|
|
1523
|
+
complete() {
|
|
1524
|
+
this.connection.completeDrag();
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
class FindFirstCanBeConnectedOutputByOutletHandler {
|
|
1529
|
+
constructor(fFlow) {
|
|
1530
|
+
this.fFlow = fFlow;
|
|
1531
|
+
}
|
|
1532
|
+
handle(payload) {
|
|
1533
|
+
let result;
|
|
1534
|
+
const node = this.fFlow.fNodesContainer.fNodes.find((x) => x.isContains(payload.outlet.hostElement));
|
|
1535
|
+
if (!node) {
|
|
1536
|
+
throw new Error('Node not found');
|
|
1537
|
+
}
|
|
1538
|
+
const outputsOfNode = this.fFlow.outputs.filter((x) => {
|
|
1539
|
+
return node.isContains(x.hostElement) && x.canBeConnected;
|
|
1540
|
+
});
|
|
1541
|
+
if (outputsOfNode.length > 0) {
|
|
1542
|
+
result = outputsOfNode[0];
|
|
1543
|
+
}
|
|
1544
|
+
return result;
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
class FindFirstCanBeConnectedOutputByOutletRequest {
|
|
1549
|
+
constructor(outlet) {
|
|
1550
|
+
this.outlet = outlet;
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
class CreateConnectionOnPointerDown {
|
|
1555
|
+
get fConnectionsContainer() {
|
|
1556
|
+
return this.fFlow.fConnectionsContainer;
|
|
1557
|
+
}
|
|
1558
|
+
get fNodesContainer() {
|
|
1559
|
+
return this.fFlow.fNodesContainer;
|
|
1560
|
+
}
|
|
1561
|
+
constructor(fFlow, hostElement) {
|
|
1562
|
+
this.fFlow = fFlow;
|
|
1563
|
+
this.hostElement = hostElement;
|
|
1564
|
+
}
|
|
1565
|
+
handle(payload) {
|
|
1566
|
+
let result;
|
|
1567
|
+
const node = this.fNodesContainer.findNode(payload.event.targetElement);
|
|
1568
|
+
const pointerPositionInCanvas = Point.fromPoint(payload.event.getPosition()).matrixTransform(this.hostElement);
|
|
1569
|
+
if (node) {
|
|
1570
|
+
if (isNodeOutlet(payload.event.targetElement)) {
|
|
1571
|
+
const outlet = this.fFlow.outlets.find((x) => {
|
|
1572
|
+
return x.hostElement.contains(payload.event.targetElement);
|
|
1573
|
+
});
|
|
1574
|
+
if (!outlet) {
|
|
1575
|
+
throw new Error('Outlet not found');
|
|
1576
|
+
}
|
|
1577
|
+
const nodeOutputs = this.fFlow.outputs.filter((x) => node.isContains(x.hostElement));
|
|
1578
|
+
outlet.setOutputs(nodeOutputs);
|
|
1579
|
+
if (outlet.canBeConnected) {
|
|
1580
|
+
if (outlet.isConnectionFromOutlet) {
|
|
1581
|
+
console.log('outlet', outlet.hostElement);
|
|
1582
|
+
const outletCenter = outlet.getElementRectInCanvas(payload.transform, this.hostElement).gravityCenter;
|
|
1583
|
+
console.log('outletCenter', outletCenter);
|
|
1584
|
+
result = this.createConnectionHandler(payload, pointerPositionInCanvas, outlet, outletCenter);
|
|
1585
|
+
}
|
|
1586
|
+
else {
|
|
1587
|
+
const output = new FindFirstCanBeConnectedOutputByOutletHandler(this.fFlow).handle(new FindFirstCanBeConnectedOutputByOutletRequest(outlet));
|
|
1588
|
+
if (!output) {
|
|
1589
|
+
throw new Error('Output not found');
|
|
1590
|
+
}
|
|
1591
|
+
const outputCenter = output.getElementRectInCanvas(payload.transform, this.hostElement).gravityCenter;
|
|
1592
|
+
result = this.createConnectionHandler(payload, pointerPositionInCanvas, output, outputCenter);
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
else if (this.isNodeOutput(payload.event.targetElement, node)) {
|
|
1597
|
+
const output = this.fFlow.outputs.find((x) => {
|
|
1598
|
+
return x.hostElement.contains(payload.event.targetElement);
|
|
1599
|
+
});
|
|
1600
|
+
if (!output) {
|
|
1601
|
+
throw new Error('Output not found');
|
|
1602
|
+
}
|
|
1603
|
+
if (output.canBeConnected) {
|
|
1604
|
+
const outputCenter = output.getElementRectInCanvas(payload.transform, this.hostElement).gravityCenter;
|
|
1605
|
+
result = this.createConnectionHandler(payload, pointerPositionInCanvas, output, outputCenter);
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
return result;
|
|
1610
|
+
}
|
|
1611
|
+
createConnectionHandler(payload, pointerPositionInCanvas, output, outputCenter) {
|
|
1612
|
+
// @ts-ignore
|
|
1613
|
+
this.fConnectionsContainer.fTempConnection.fromTo = new TempConnectionInputOutputModel(output);
|
|
1614
|
+
return {
|
|
1615
|
+
onPointerDownScale: payload.transform.scale,
|
|
1616
|
+
onPointerDownPosition: pointerPositionInCanvas.div(payload.transform.scale),
|
|
1617
|
+
draggableItems: [
|
|
1618
|
+
new CreateConnectionOnPointerMove(this.fConnectionsContainer.fTempConnection, outputCenter, payload.transform, this.hostElement)
|
|
1619
|
+
]
|
|
1620
|
+
};
|
|
1621
|
+
}
|
|
1622
|
+
isNodeOutput(targetElement, node) {
|
|
1623
|
+
const outlets = this.fFlow.outlets.filter((x) => node.isContains(x.hostElement));
|
|
1624
|
+
return isNodeOutput(targetElement) && !outlets.length;
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
class FirstNotConnectedInputOfNodeUnderPointerHandler {
|
|
1629
|
+
constructor(fFlow) {
|
|
1630
|
+
this.fFlow = fFlow;
|
|
1631
|
+
}
|
|
1632
|
+
handle(payload) {
|
|
1633
|
+
const position = payload.event.getPosition();
|
|
1634
|
+
const elementsFromPoint = document.elementsFromPoint(position.x, position.y);
|
|
1635
|
+
const nodes = elementsFromPoint.map((element) => {
|
|
1636
|
+
return this.fFlow.fNodesContainer.fNodes.find((x) => x.isContains(element));
|
|
1637
|
+
}).filter((x) => !!x);
|
|
1638
|
+
const inputs = nodes.map((x) => {
|
|
1639
|
+
return this.fFlow.inputs.filter((i) => x.isContains(i.hostElement)).find((i) => {
|
|
1640
|
+
return !i.isConnected && i.canBeConnected;
|
|
1641
|
+
});
|
|
1642
|
+
});
|
|
1643
|
+
const result = inputs.find((x) => !!x);
|
|
1644
|
+
return result;
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
class FirstNotConnectedInputOfNodeUnderPointerRequest {
|
|
1649
|
+
constructor(event) {
|
|
1650
|
+
this.event = event;
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
class InputsUnderPointerHandler {
|
|
1655
|
+
constructor(fFlow) {
|
|
1656
|
+
this.fFlow = fFlow;
|
|
1657
|
+
}
|
|
1658
|
+
handle(payload) {
|
|
1659
|
+
const position = payload.event.getPosition();
|
|
1660
|
+
const elementsFromPoint = document.elementsFromPoint(position.x, position.y);
|
|
1661
|
+
return elementsFromPoint.filter((x) => isNodeInput(x)).map((element) => {
|
|
1662
|
+
return this.fFlow.inputs.find((x) => x.isContains(element));
|
|
1663
|
+
}).filter((x) => !!x);
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
class InputsUnderPointerRequest {
|
|
1668
|
+
constructor(event) {
|
|
1669
|
+
this.event = event;
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1673
|
+
class FindInputsUnderPointerRequest {
|
|
1674
|
+
constructor(event, dragHandler) {
|
|
1675
|
+
this.event = event;
|
|
1676
|
+
this.dragHandler = dragHandler;
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
class FindInputsUnderPointerHandler {
|
|
1681
|
+
constructor(fFlow) {
|
|
1682
|
+
this.fFlow = fFlow;
|
|
1683
|
+
}
|
|
1684
|
+
handle(payload) {
|
|
1685
|
+
const inputsUnderPointer = this.getInputsUnderPointer(payload);
|
|
1686
|
+
return inputsUnderPointer.filter((x) => {
|
|
1687
|
+
const targetNode = this.fFlow.fNodesContainer.fNodes.find((y) => y.isContains(x.hostElement));
|
|
1688
|
+
const sourceNode = this.fFlow.fNodesContainer.fNodes.find((y) => y.isContains(payload.dragHandler.connection.fromTo.output.hostElement));
|
|
1689
|
+
return sourceNode?.hostElement !== targetNode?.hostElement;
|
|
1690
|
+
});
|
|
1691
|
+
}
|
|
1692
|
+
getInputsUnderPointer(payload) {
|
|
1693
|
+
let inputs = new InputsUnderPointerHandler(this.fFlow).handle(new InputsUnderPointerRequest(payload.event));
|
|
1694
|
+
const input = new FirstNotConnectedInputOfNodeUnderPointerHandler(this.fFlow).handle(new FirstNotConnectedInputOfNodeUnderPointerRequest(payload.event));
|
|
1695
|
+
if (input) {
|
|
1696
|
+
inputs.push(input);
|
|
1697
|
+
}
|
|
1698
|
+
inputs = inputs.filter((x) => x.canBeConnected);
|
|
1699
|
+
return inputs;
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
|
|
1703
|
+
class CreateConnectionEvent {
|
|
1704
|
+
constructor(outputId, inputId) {
|
|
1705
|
+
this.outputId = outputId;
|
|
1706
|
+
this.inputId = inputId;
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1710
|
+
class CreateConnectionOnPointerUp {
|
|
1711
|
+
constructor(fFlow, onCreateConnection) {
|
|
1712
|
+
this.fFlow = fFlow;
|
|
1713
|
+
this.onCreateConnection = onCreateConnection;
|
|
1714
|
+
}
|
|
1715
|
+
handle(payload) {
|
|
1716
|
+
const isCreateConnection = payload.dragHandler.draggableItems.some((x) => x.type === EDraggableType.TEMP_CONNECTION);
|
|
1717
|
+
if (isCreateConnection) {
|
|
1718
|
+
const handler = payload.dragHandler.draggableItems[0];
|
|
1719
|
+
const inputsUnderPointer = new FindInputsUnderPointerHandler(this.fFlow).handle(new FindInputsUnderPointerRequest(payload.event, handler));
|
|
1720
|
+
if (inputsUnderPointer.length > 0) {
|
|
1721
|
+
let output = handler.connection.fromTo.output;
|
|
1722
|
+
const isOutlet = isNodeOutlet(output.hostElement);
|
|
1723
|
+
if (isOutlet) {
|
|
1724
|
+
output = new FindFirstCanBeConnectedOutputByOutletHandler(this.fFlow).handle(new FindFirstCanBeConnectedOutputByOutletRequest(output));
|
|
1725
|
+
if (!output) {
|
|
1726
|
+
throw new Error('Output not found');
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
this.onCreateConnection.emit(new CreateConnectionEvent(output.id, inputsUnderPointer[0]?.id));
|
|
1730
|
+
}
|
|
1731
|
+
handler.complete();
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
class CreateConnectionOnPointerUpRequest {
|
|
1737
|
+
constructor(event, dragHandler) {
|
|
1738
|
+
this.event = event;
|
|
1739
|
+
this.dragHandler = dragHandler;
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
class ReassignConnectionOnPointerMove {
|
|
1744
|
+
constructor(connection, canvasTransform, canvasHost) {
|
|
1745
|
+
this.connection = connection;
|
|
1746
|
+
this.canvasTransform = canvasTransform;
|
|
1747
|
+
this.canvasHost = canvasHost;
|
|
1748
|
+
this.type = EDraggableType.REASSIGN_CONNECTION;
|
|
1749
|
+
this.onPointerDownFromConnectorRect = RectExtensions.initialize();
|
|
1750
|
+
this.onPointerDownToConnectorRect = RectExtensions.initialize();
|
|
1751
|
+
this.onPointerDownFromConnectorRect = this.connection.fromTo.output.getElementRectInCanvas(canvasTransform, canvasHost);
|
|
1752
|
+
this.onPointerDownToConnectorRect = RectExtensions.initialize(this.connection.vector.point2.x, this.connection.vector.point2.y, 0, 0);
|
|
1753
|
+
}
|
|
1754
|
+
initialize() {
|
|
1755
|
+
}
|
|
1756
|
+
move(difference) {
|
|
1757
|
+
const toRect = RectExtensions.addPoint(this.onPointerDownToConnectorRect, difference);
|
|
1758
|
+
const vector = getConnectionIntersect(this.onPointerDownFromConnectorRect, toRect);
|
|
1759
|
+
this.connection.setVector(vector);
|
|
1760
|
+
this.connection.redraw();
|
|
1761
|
+
}
|
|
1762
|
+
complete() {
|
|
1763
|
+
const fromConnectorRect = this.connection.fromTo.output.getElementRectInCanvas(this.canvasTransform, this.canvasHost);
|
|
1764
|
+
const toConnectorRect = this.connection.fromTo.input.getElementRectInCanvas(this.canvasTransform, this.canvasHost);
|
|
1765
|
+
const vector = getConnectionIntersect(fromConnectorRect, toConnectorRect);
|
|
1766
|
+
this.connection.setVector(vector);
|
|
1767
|
+
this.connection.completeDrag();
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
class ReassignConnectionOnPointerDown {
|
|
1772
|
+
get fConnectionsContainer() {
|
|
1773
|
+
return this.fFlow.fConnectionsContainer;
|
|
1774
|
+
}
|
|
1775
|
+
constructor(fFlow, hostElement) {
|
|
1776
|
+
this.fFlow = fFlow;
|
|
1777
|
+
this.hostElement = hostElement;
|
|
1778
|
+
}
|
|
1779
|
+
handle(payload) {
|
|
1780
|
+
let result;
|
|
1781
|
+
const pointerPositionInCanvas = Point.fromPoint(payload.event.getPosition()).matrixTransform(this.hostElement);
|
|
1782
|
+
const position = payload.event.getPosition();
|
|
1783
|
+
const allElements = document.elementsFromPoint(position.x, position.y);
|
|
1784
|
+
const dragHandlesOfConnections = allElements.filter((x) => {
|
|
1785
|
+
return !!this.fConnectionsContainer.findConnectionWithElement(x) && x.classList.contains(F_CONNECTION_DRAG_HANDLE_CLASS);
|
|
1786
|
+
});
|
|
1787
|
+
let connectionToReassign;
|
|
1788
|
+
if (dragHandlesOfConnections.length) {
|
|
1789
|
+
connectionToReassign = this.fConnectionsContainer.findConnectionWithElement(dragHandlesOfConnections[0]);
|
|
1790
|
+
}
|
|
1791
|
+
if (connectionToReassign && payload.event.isMouseLeftButton()) {
|
|
1792
|
+
result = {
|
|
1793
|
+
onPointerDownScale: payload.transform.scale,
|
|
1794
|
+
onPointerDownPosition: pointerPositionInCanvas.div(payload.transform.scale),
|
|
1795
|
+
draggableItems: [
|
|
1796
|
+
new ReassignConnectionOnPointerMove(connectionToReassign, payload.transform, this.hostElement)
|
|
1797
|
+
]
|
|
1798
|
+
};
|
|
1799
|
+
}
|
|
1800
|
+
return result;
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
class ReassignConnectionOnPointerDownRequest {
|
|
1805
|
+
constructor(event, transform) {
|
|
1806
|
+
this.event = event;
|
|
1807
|
+
this.transform = transform;
|
|
1808
|
+
}
|
|
1809
|
+
}
|
|
1810
|
+
|
|
1811
|
+
class ReassignConnectionEvent {
|
|
1812
|
+
constructor(connectionId, outputId, oldInputId, newInputId) {
|
|
1813
|
+
this.connectionId = connectionId;
|
|
1814
|
+
this.outputId = outputId;
|
|
1815
|
+
this.oldInputId = oldInputId;
|
|
1816
|
+
this.newInputId = newInputId;
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
|
|
1820
|
+
class ReassignConnectionOnPointerUp {
|
|
1821
|
+
constructor(fFlow, onReassignConnection) {
|
|
1822
|
+
this.fFlow = fFlow;
|
|
1823
|
+
this.onReassignConnection = onReassignConnection;
|
|
1824
|
+
}
|
|
1825
|
+
handle(payload) {
|
|
1826
|
+
const isReassignConnection = payload.dragHandler.draggableItems.some((x) => x.type === EDraggableType.REASSIGN_CONNECTION);
|
|
1827
|
+
if (isReassignConnection) {
|
|
1828
|
+
const handler = payload.dragHandler.draggableItems[0];
|
|
1829
|
+
const inputsUnderPointer = new FindInputsUnderPointerHandler(this.fFlow).handle(new FindInputsUnderPointerRequest(payload.event, handler));
|
|
1830
|
+
if (inputsUnderPointer.length > 0) {
|
|
1831
|
+
if (handler.connection.fromTo?.input?.id !== inputsUnderPointer[0]?.id) {
|
|
1832
|
+
this.onReassignConnection.emit(new ReassignConnectionEvent(handler.connection.id, handler.connection.fromTo?.output.id, handler.connection.fromTo?.input?.id, inputsUnderPointer[0]?.id));
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
handler.complete();
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
class ReassignConnectionOnPointerUpRequest {
|
|
1841
|
+
constructor(event, dragHandler) {
|
|
1842
|
+
this.event = event;
|
|
1843
|
+
this.dragHandler = dragHandler;
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
class DefaultDragHandler {
|
|
1848
|
+
handle() {
|
|
1849
|
+
return {
|
|
1850
|
+
onPointerDownScale: 1,
|
|
1851
|
+
onPointerDownPosition: new Point(0, 0),
|
|
1852
|
+
draggableItems: []
|
|
1853
|
+
};
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1857
|
+
class ExternalItemOnPointerDownRequest {
|
|
1858
|
+
constructor(event) {
|
|
1859
|
+
this.event = event;
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1863
|
+
const F_EXTERNAL_ITEM = new InjectionToken('F_EXTERNAL_ITEM');
|
|
1864
|
+
class FExternalItemBase {
|
|
1865
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FExternalItemBase, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1866
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.4", type: FExternalItemBase, ngImport: i0 }); }
|
|
1867
|
+
}
|
|
1868
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FExternalItemBase, decorators: [{
|
|
1869
|
+
type: Directive
|
|
1870
|
+
}] });
|
|
1871
|
+
|
|
1872
|
+
function isExternalItem(element) {
|
|
1873
|
+
return !!element.closest('[fExternalItem]');
|
|
1874
|
+
}
|
|
1875
|
+
function getExternalItem(element) {
|
|
1876
|
+
return element.closest('[fExternalItem]');
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1879
|
+
class FExternalItemService {
|
|
1880
|
+
constructor() {
|
|
1881
|
+
this.items = [];
|
|
1882
|
+
}
|
|
1883
|
+
registerItem(item) {
|
|
1884
|
+
this.items.push(item);
|
|
1885
|
+
}
|
|
1886
|
+
getItem(element) {
|
|
1887
|
+
return this.items.find(item => item.hostElement === element);
|
|
1888
|
+
}
|
|
1889
|
+
removeItem(item) {
|
|
1890
|
+
const index = this.items.indexOf(item);
|
|
1891
|
+
if (index !== -1) {
|
|
1892
|
+
this.items.splice(index, 1);
|
|
1893
|
+
}
|
|
1894
|
+
}
|
|
1895
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FExternalItemService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1896
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FExternalItemService }); }
|
|
1897
|
+
}
|
|
1898
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FExternalItemService, decorators: [{
|
|
1899
|
+
type: Injectable
|
|
1900
|
+
}] });
|
|
1901
|
+
|
|
1902
|
+
let uniqueId = 0;
|
|
1903
|
+
class FExternalItemDirective extends FExternalItemBase {
|
|
1904
|
+
get hostElement() {
|
|
1905
|
+
return this.elementReference.nativeElement;
|
|
1906
|
+
}
|
|
1907
|
+
constructor(elementReference, fExternalItemService) {
|
|
1908
|
+
super();
|
|
1909
|
+
this.elementReference = elementReference;
|
|
1910
|
+
this.fExternalItemService = fExternalItemService;
|
|
1911
|
+
this.id = `f-external-item-${uniqueId++}`;
|
|
1912
|
+
}
|
|
1913
|
+
ngOnInit() {
|
|
1914
|
+
this.fExternalItemService.registerItem(this);
|
|
1915
|
+
}
|
|
1916
|
+
ngOnDestroy() {
|
|
1917
|
+
this.fExternalItemService.removeItem(this);
|
|
1918
|
+
}
|
|
1919
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FExternalItemDirective, deps: [{ token: i0.ElementRef }, { token: FExternalItemService }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1920
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.4", type: FExternalItemDirective, selector: "[fExternalItem]", inputs: { id: "id", data: "data" }, host: { properties: { "attr.id": "id" }, classAttribute: "f-component f-external-item" }, providers: [
|
|
1921
|
+
{ provide: F_EXTERNAL_ITEM, useExisting: FExternalItemDirective }
|
|
1922
|
+
], usesInheritance: true, ngImport: i0 }); }
|
|
1923
|
+
}
|
|
1924
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FExternalItemDirective, decorators: [{
|
|
1925
|
+
type: Directive,
|
|
1926
|
+
args: [{
|
|
1927
|
+
selector: "[fExternalItem]",
|
|
1928
|
+
host: {
|
|
1929
|
+
'[attr.id]': 'id',
|
|
1930
|
+
class: "f-component f-external-item",
|
|
1931
|
+
},
|
|
1932
|
+
providers: [
|
|
1933
|
+
{ provide: F_EXTERNAL_ITEM, useExisting: FExternalItemDirective }
|
|
1934
|
+
],
|
|
1935
|
+
}]
|
|
1936
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: FExternalItemService }]; }, propDecorators: { id: [{
|
|
1937
|
+
type: Input
|
|
1938
|
+
}], data: [{
|
|
1939
|
+
type: Input
|
|
1940
|
+
}] } });
|
|
1941
|
+
|
|
1942
|
+
class ExternalItemOnPointerMoveHandler {
|
|
1943
|
+
constructor(externalItem) {
|
|
1944
|
+
this.externalItem = externalItem;
|
|
1945
|
+
this.type = EDraggableType.PALETTE_ITEM;
|
|
1946
|
+
this.onPointerDownRect = RectExtensions.initialize();
|
|
1947
|
+
this.difference = PointExtensions.initialize();
|
|
1948
|
+
}
|
|
1949
|
+
getStyle(position) {
|
|
1950
|
+
return `position: absolute; left: 0; top: 0; transform: translate(${position.x}px, ${position.y}px)`;
|
|
1951
|
+
}
|
|
1952
|
+
initialize() {
|
|
1953
|
+
this.onPointerDownRect = RectExtensions.fromElement(this.externalItem.hostElement);
|
|
1954
|
+
this.placeholder = DomElementExtensions.deepCloneNode(this.externalItem.hostElement);
|
|
1955
|
+
document.body.appendChild(this.placeholder);
|
|
1956
|
+
}
|
|
1957
|
+
move(difference) {
|
|
1958
|
+
this.difference = difference;
|
|
1959
|
+
const position = Point.fromPoint(this.onPointerDownRect).add(this.difference);
|
|
1960
|
+
this.placeholder.setAttribute('style', this.getStyle(position));
|
|
1961
|
+
}
|
|
1962
|
+
getPlaceholderRect() {
|
|
1963
|
+
return RectExtensions.fromElement(this.placeholder);
|
|
1964
|
+
}
|
|
1965
|
+
complete() {
|
|
1966
|
+
document.body.removeChild(this.placeholder);
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1970
|
+
class ExternalItemOnPointerDownHandler {
|
|
1971
|
+
constructor(fExternalItemService, hostElement) {
|
|
1972
|
+
this.fExternalItemService = fExternalItemService;
|
|
1973
|
+
this.hostElement = hostElement;
|
|
1974
|
+
}
|
|
1975
|
+
handle(payload) {
|
|
1976
|
+
let result;
|
|
1977
|
+
if (isExternalItem(payload.event.targetElement)) {
|
|
1978
|
+
const item = this.fExternalItemService.getItem(getExternalItem(payload.event.targetElement));
|
|
1979
|
+
if (!item) {
|
|
1980
|
+
throw new Error('External item not found');
|
|
1981
|
+
}
|
|
1982
|
+
const pointerPositionInCanvas = Point.fromPoint(payload.event.getPosition()).matrixTransform(this.hostElement);
|
|
1983
|
+
result = {
|
|
1984
|
+
onPointerDownScale: 1,
|
|
1985
|
+
onPointerDownPosition: pointerPositionInCanvas.div(1),
|
|
1986
|
+
draggableItems: [
|
|
1987
|
+
new ExternalItemOnPointerMoveHandler(item)
|
|
1988
|
+
]
|
|
1989
|
+
};
|
|
1990
|
+
}
|
|
1991
|
+
return result;
|
|
1992
|
+
}
|
|
1993
|
+
}
|
|
1994
|
+
|
|
1995
|
+
class CreateNodeEvent {
|
|
1996
|
+
constructor(rect, data) {
|
|
1997
|
+
this.rect = rect;
|
|
1998
|
+
this.data = data;
|
|
1999
|
+
}
|
|
2000
|
+
}
|
|
2001
|
+
|
|
2002
|
+
class ExternalItemOnPointerUpHandler {
|
|
2003
|
+
constructor(fFlow, onCreateNode) {
|
|
2004
|
+
this.fFlow = fFlow;
|
|
2005
|
+
this.onCreateNode = onCreateNode;
|
|
2006
|
+
}
|
|
2007
|
+
handle(payload) {
|
|
2008
|
+
const pointerPositionInCanvas = Point.fromPoint(payload.event.getPosition()).matrixTransform(this.fFlow.hostElement);
|
|
2009
|
+
let difference = pointerPositionInCanvas.div(payload.dragHandler.onPointerDownScale).sub(payload.dragHandler.onPointerDownPosition);
|
|
2010
|
+
const isDragPaletteItem = payload.dragHandler.draggableItems.some((x) => x.type === EDraggableType.PALETTE_ITEM);
|
|
2011
|
+
if (isDragPaletteItem) {
|
|
2012
|
+
const dragHandler = payload.dragHandler.draggableItems[0];
|
|
2013
|
+
dragHandler.move(difference);
|
|
2014
|
+
const isPointerInCanvasRect = document.elementsFromPoint(payload.event.getPosition().x, payload.event.getPosition().y).some((x) => x === this.fFlow.hostElement);
|
|
2015
|
+
if (isPointerInCanvasRect) {
|
|
2016
|
+
const rectInCanvas = getElementRectInCanvas(dragHandler.placeholder, this.fFlow.transform, this.fFlow.hostElement);
|
|
2017
|
+
this.onCreateNode.emit(new CreateNodeEvent(rectInCanvas, dragHandler.externalItem.data));
|
|
2018
|
+
}
|
|
2019
|
+
dragHandler.complete();
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
2023
|
+
|
|
2024
|
+
class ExternalItemOnPointerUpRequest {
|
|
2025
|
+
constructor(event, dragHandler) {
|
|
2026
|
+
this.event = event;
|
|
2027
|
+
this.dragHandler = dragHandler;
|
|
2028
|
+
}
|
|
2029
|
+
}
|
|
2030
|
+
|
|
2031
|
+
class NodeOnPointerDownRequest {
|
|
2032
|
+
constructor(event, transform, selectedItems, isMoveCurrentNode = false) {
|
|
2033
|
+
this.event = event;
|
|
2034
|
+
this.transform = transform;
|
|
2035
|
+
this.selectedItems = selectedItems;
|
|
2036
|
+
this.isMoveCurrentNode = isMoveCurrentNode;
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
|
|
2040
|
+
class FConnectionDragHandler {
|
|
2041
|
+
constructor(connection, canvasTransform, canvasHost) {
|
|
2042
|
+
this.connection = connection;
|
|
2043
|
+
this.type = EDraggableType.CONNECTION;
|
|
2044
|
+
this.onPointerDownVector = VectorExtensions.initialize();
|
|
2045
|
+
this.onPointerDownVector = getConnectionIntersect(this.connection.fromTo.output.getElementRectInCanvas(canvasTransform, canvasHost), this.connection.fromTo.input.getElementRectInCanvas(canvasTransform, canvasHost));
|
|
2046
|
+
}
|
|
2047
|
+
initialize() {
|
|
2048
|
+
}
|
|
2049
|
+
move(difference) {
|
|
2050
|
+
const fromPoint = Point.fromPoint(this.onPointerDownVector.point1).add(difference);
|
|
2051
|
+
const toPoint = Point.fromPoint(this.onPointerDownVector.point2).add(difference);
|
|
2052
|
+
this.connection.setVector(VectorExtensions.initialize(fromPoint, toPoint));
|
|
2053
|
+
this.connection.redraw();
|
|
2054
|
+
}
|
|
2055
|
+
complete() {
|
|
2056
|
+
}
|
|
2057
|
+
}
|
|
2058
|
+
|
|
2059
|
+
class FConnectionSourceDragHandler {
|
|
2060
|
+
constructor(connection, canvasTransform, canvasHost) {
|
|
2061
|
+
this.connection = connection;
|
|
2062
|
+
this.type = EDraggableType.CONNECTION;
|
|
2063
|
+
this.onPointerDownFromConnectorRect = RectExtensions.initialize();
|
|
2064
|
+
this.onPointerDownToConnectorRect = RectExtensions.initialize();
|
|
2065
|
+
this.onPointerDownFromConnectorRect = this.connection.fromTo.output.getElementRectInCanvas(canvasTransform, canvasHost);
|
|
2066
|
+
this.onPointerDownToConnectorRect = this.connection.fromTo.input.getElementRectInCanvas(canvasTransform, canvasHost);
|
|
2067
|
+
}
|
|
2068
|
+
initialize() {
|
|
2069
|
+
}
|
|
2070
|
+
move(difference) {
|
|
2071
|
+
const fromPoint = RectExtensions.addPoint(this.onPointerDownFromConnectorRect, difference);
|
|
2072
|
+
const vector = getConnectionIntersect(fromPoint, this.onPointerDownToConnectorRect);
|
|
2073
|
+
this.connection.setVector(vector);
|
|
2074
|
+
this.connection.redraw();
|
|
2075
|
+
}
|
|
2076
|
+
complete() {
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
|
|
2080
|
+
class FConnectionTargetDragHandler {
|
|
2081
|
+
constructor(connection, canvasTransform, canvasHost) {
|
|
2082
|
+
this.connection = connection;
|
|
2083
|
+
this.type = EDraggableType.CONNECTION;
|
|
2084
|
+
this.onPointerDownFromConnectorRect = RectExtensions.initialize();
|
|
2085
|
+
this.onPointerDownToConnectorRect = RectExtensions.initialize();
|
|
2086
|
+
this.onPointerDownFromConnectorRect = this.connection.fromTo.output.getElementRectInCanvas(canvasTransform, canvasHost);
|
|
2087
|
+
this.onPointerDownToConnectorRect = this.connection.fromTo.input.getElementRectInCanvas(canvasTransform, canvasHost);
|
|
2088
|
+
}
|
|
2089
|
+
initialize() {
|
|
2090
|
+
}
|
|
2091
|
+
move(difference) {
|
|
2092
|
+
const toPoint = RectExtensions.addPoint(this.onPointerDownToConnectorRect, difference);
|
|
2093
|
+
const vector = getConnectionIntersect(this.onPointerDownFromConnectorRect, toPoint);
|
|
2094
|
+
this.connection.setVector(vector);
|
|
2095
|
+
this.connection.redraw();
|
|
2096
|
+
}
|
|
2097
|
+
complete() {
|
|
2098
|
+
}
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2101
|
+
class NodeOnPointerMove {
|
|
2102
|
+
constructor(fLineAlignment, fNode) {
|
|
2103
|
+
this.fLineAlignment = fLineAlignment;
|
|
2104
|
+
this.fNode = fNode;
|
|
2105
|
+
this.type = EDraggableType.NODE;
|
|
2106
|
+
this.onPointerDownPosition = PointExtensions.initialize();
|
|
2107
|
+
this.onPointerDownPosition = this.fNode.position;
|
|
2108
|
+
}
|
|
2109
|
+
initialize() {
|
|
2110
|
+
}
|
|
2111
|
+
move(difference) {
|
|
2112
|
+
const position = Point.fromPoint(this.onPointerDownPosition).add(difference);
|
|
2113
|
+
this.fNode.updatePosition(position);
|
|
2114
|
+
this.fNode.redraw();
|
|
2115
|
+
this.fLineAlignment?.handle(difference);
|
|
2116
|
+
}
|
|
2117
|
+
complete() {
|
|
2118
|
+
this.fNode.completeDrag();
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
|
|
2122
|
+
class NodeOnPointerDown {
|
|
2123
|
+
get fConnectionsContainer() {
|
|
2124
|
+
return this.fFlow.fConnectionsContainer;
|
|
2125
|
+
}
|
|
2126
|
+
get fNodesContainer() {
|
|
2127
|
+
return this.fFlow.fNodesContainer;
|
|
2128
|
+
}
|
|
2129
|
+
constructor(fLineAlignment, fFlow, hostElement) {
|
|
2130
|
+
this.fLineAlignment = fLineAlignment;
|
|
2131
|
+
this.fFlow = fFlow;
|
|
2132
|
+
this.hostElement = hostElement;
|
|
2133
|
+
}
|
|
2134
|
+
handle(payload) {
|
|
2135
|
+
let result;
|
|
2136
|
+
const node = this.fNodesContainer.findNode(payload.event.targetElement);
|
|
2137
|
+
const pointerPositionInCanvas = Point.fromPoint(payload.event.getPosition()).matrixTransform(this.hostElement);
|
|
2138
|
+
if (node) {
|
|
2139
|
+
if (isNodeDragHandle(payload.event.targetElement)) {
|
|
2140
|
+
if (!payload.selectedItems.includes(node) && payload.isMoveCurrentNode) {
|
|
2141
|
+
payload.selectedItems.push(node);
|
|
2142
|
+
node.select();
|
|
2143
|
+
}
|
|
2144
|
+
this.fNodesContainer.setNodeToTopLayer(node);
|
|
2145
|
+
const itemsToDrag = this.calculateDraggableConnectionsAndNodes(payload);
|
|
2146
|
+
const draggedNodes = itemsToDrag.filter((x) => {
|
|
2147
|
+
return x.type === EDraggableType.NODE;
|
|
2148
|
+
}).map((x) => x.fNode);
|
|
2149
|
+
this.fLineAlignment?.initialize(this.fNodesContainer.fNodes.toArray(), draggedNodes);
|
|
2150
|
+
result = {
|
|
2151
|
+
onPointerDownScale: payload.transform.scale,
|
|
2152
|
+
onPointerDownPosition: pointerPositionInCanvas.div(payload.transform.scale),
|
|
2153
|
+
draggableItems: itemsToDrag
|
|
2154
|
+
};
|
|
2155
|
+
}
|
|
2156
|
+
}
|
|
2157
|
+
return result;
|
|
2158
|
+
}
|
|
2159
|
+
calculateDraggableConnectionsAndNodes(payload) {
|
|
2160
|
+
let itemsToDrag = [];
|
|
2161
|
+
const selectedNodes = payload.selectedItems.map((x) => {
|
|
2162
|
+
return this.fNodesContainer.findNode(x.hostElement);
|
|
2163
|
+
}).filter((x) => !!x);
|
|
2164
|
+
const nodeDragHandlers = selectedNodes.map((x) => new NodeOnPointerMove(this.fLineAlignment, x));
|
|
2165
|
+
itemsToDrag = nodeDragHandlers;
|
|
2166
|
+
const allOutputs = selectedNodes.reduce((result, x) => {
|
|
2167
|
+
return result.concat(this.getOutputsForNode(x));
|
|
2168
|
+
}, []);
|
|
2169
|
+
const allInputs = selectedNodes.reduce((result, x) => {
|
|
2170
|
+
return result.concat(this.getInputsForNode(x));
|
|
2171
|
+
}, []);
|
|
2172
|
+
nodeDragHandlers.forEach((nodeHandler) => {
|
|
2173
|
+
const outputConnections = this.fConnectionsContainer.findOutgoingConnections(this.getOutputsForNode(nodeHandler.fNode));
|
|
2174
|
+
outputConnections.forEach((c) => {
|
|
2175
|
+
if (allInputs.includes(c.fromTo.input)) {
|
|
2176
|
+
itemsToDrag.push(new FConnectionDragHandler(c, payload.transform, this.hostElement));
|
|
2177
|
+
}
|
|
2178
|
+
else {
|
|
2179
|
+
itemsToDrag.push(new FConnectionSourceDragHandler(c, payload.transform, this.hostElement));
|
|
2180
|
+
}
|
|
2181
|
+
});
|
|
2182
|
+
const inputConnections = this.fConnectionsContainer.findIncomingConnections(this.getInputsForNode(nodeHandler.fNode));
|
|
2183
|
+
inputConnections.forEach((c) => {
|
|
2184
|
+
if (allOutputs.includes(c.fromTo.output)) {
|
|
2185
|
+
const index = itemsToDrag.findIndex((x) => x.type === EDraggableType.CONNECTION && x.connection.id === c.id);
|
|
2186
|
+
if (index !== -1) {
|
|
2187
|
+
itemsToDrag.push(new FConnectionDragHandler(c, payload.transform, this.hostElement));
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2190
|
+
else {
|
|
2191
|
+
itemsToDrag.push(new FConnectionTargetDragHandler(c, payload.transform, this.hostElement));
|
|
2192
|
+
}
|
|
2193
|
+
});
|
|
2194
|
+
//itemsToDrag.push(new NodeOnPointerMove(this.fLineAlignment, x.fNode));
|
|
2195
|
+
});
|
|
2196
|
+
return itemsToDrag;
|
|
2197
|
+
}
|
|
2198
|
+
getInputsForNode(node) {
|
|
2199
|
+
return this.fFlow.inputs.toArray().filter((x) => node.isContains(x.hostElement));
|
|
2200
|
+
}
|
|
2201
|
+
getOutputsForNode(node) {
|
|
2202
|
+
return this.fFlow.outputs.toArray().filter((x) => node.isContains(x.hostElement));
|
|
2203
|
+
}
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2206
|
+
class NodeOnPointerUp {
|
|
2207
|
+
constructor(fLineAlignment, fConnectIfIntersect, hostElement) {
|
|
2208
|
+
this.fLineAlignment = fLineAlignment;
|
|
2209
|
+
this.fConnectIfIntersect = fConnectIfIntersect;
|
|
2210
|
+
this.hostElement = hostElement;
|
|
2211
|
+
}
|
|
2212
|
+
handle(payload) {
|
|
2213
|
+
const pointerPositionInCanvas = Point.fromPoint(payload.event.getPosition()).matrixTransform(this.hostElement);
|
|
2214
|
+
let difference = pointerPositionInCanvas.div(payload.dragHandler.onPointerDownScale).sub(payload.dragHandler.onPointerDownPosition);
|
|
2215
|
+
const isDragNodes = payload.dragHandler.draggableItems.some((x) => x.type === EDraggableType.NODE);
|
|
2216
|
+
if (isDragNodes) {
|
|
2217
|
+
const nearestIntersection = this.fLineAlignment?.findNearestCoordinate(difference);
|
|
2218
|
+
if (nearestIntersection) {
|
|
2219
|
+
difference.x = nearestIntersection.xResult.value ? (difference.x - nearestIntersection.xResult.distance) : difference.x;
|
|
2220
|
+
difference.y = nearestIntersection.yResult.value ? (difference.y - nearestIntersection.yResult.distance) : difference.y;
|
|
2221
|
+
}
|
|
2222
|
+
payload.dragHandler.draggableItems.forEach((x) => {
|
|
2223
|
+
x.move(difference);
|
|
2224
|
+
x.complete();
|
|
2225
|
+
});
|
|
2226
|
+
this.fConnectIfIntersect?.handle(payload.dragHandler.draggableItems);
|
|
2227
|
+
this.fLineAlignment?.complete();
|
|
2228
|
+
}
|
|
2229
|
+
}
|
|
2230
|
+
}
|
|
2231
|
+
|
|
2232
|
+
class NodeOnPointerUpRequest {
|
|
2233
|
+
constructor(event, dragHandler) {
|
|
2234
|
+
this.event = event;
|
|
2235
|
+
this.dragHandler = dragHandler;
|
|
2236
|
+
}
|
|
2237
|
+
}
|
|
2238
|
+
|
|
2239
|
+
class SelectionOnPointerMove {
|
|
2240
|
+
constructor(fFlow, fSelection, selectedOnStart, onPointerDownPosition = PointExtensions.initialize()) {
|
|
2241
|
+
this.fFlow = fFlow;
|
|
2242
|
+
this.fSelection = fSelection;
|
|
2243
|
+
this.selectedOnStart = selectedOnStart;
|
|
2244
|
+
this.onPointerDownPosition = onPointerDownPosition;
|
|
2245
|
+
this.type = EDraggableType.SELECTION;
|
|
2246
|
+
this.selectedItems = [];
|
|
2247
|
+
this.items = [];
|
|
2248
|
+
const nodeRects = fFlow.fNodesContainer.fNodes.map((x) => {
|
|
2249
|
+
return {
|
|
2250
|
+
element: x,
|
|
2251
|
+
rect: getElementRectInCanvas(x.hostElement, fFlow.transform, this.fFlow.hostElement)
|
|
2252
|
+
};
|
|
2253
|
+
});
|
|
2254
|
+
const lineRects = fFlow.fConnectionsContainer.fConnections.map((x) => {
|
|
2255
|
+
return {
|
|
2256
|
+
element: x,
|
|
2257
|
+
rect: getElementRectInCanvas(x.fPath.hostElement, fFlow.transform, this.fFlow.hostElement)
|
|
2258
|
+
};
|
|
2259
|
+
});
|
|
2260
|
+
this.items = [...nodeRects, ...lineRects].filter((x) => {
|
|
2261
|
+
return !selectedOnStart.includes(x.element);
|
|
2262
|
+
});
|
|
2263
|
+
}
|
|
2264
|
+
initialize() {
|
|
2265
|
+
this.fSelection?.show();
|
|
2266
|
+
this.fSelection?.draw({ ...this.onPointerDownPosition, width: 0, height: 0 });
|
|
2267
|
+
}
|
|
2268
|
+
move(difference) {
|
|
2269
|
+
const currentPoint = Point.fromPoint(difference).add(this.onPointerDownPosition);
|
|
2270
|
+
const x = Math.min(this.onPointerDownPosition.x, currentPoint.x);
|
|
2271
|
+
const y = Math.min(this.onPointerDownPosition.y, currentPoint.y);
|
|
2272
|
+
const width = Math.abs(difference.x);
|
|
2273
|
+
const height = Math.abs(difference.y);
|
|
2274
|
+
this.fSelection?.draw({ x, y, width, height });
|
|
2275
|
+
this.selectedItems = [];
|
|
2276
|
+
this.items.forEach((item) => {
|
|
2277
|
+
item.element.deselect();
|
|
2278
|
+
if (RectExtensions.intersectionWithRect(item.rect, RectExtensions.initialize(x, y, width, height))) {
|
|
2279
|
+
item.element.select();
|
|
2280
|
+
this.selectedItems.push(item.element);
|
|
2281
|
+
}
|
|
2282
|
+
});
|
|
2283
|
+
}
|
|
2284
|
+
complete() {
|
|
2285
|
+
this.fSelection?.hide();
|
|
2286
|
+
this.selectedItems.push(...this.selectedOnStart || []);
|
|
2287
|
+
}
|
|
2288
|
+
}
|
|
2289
|
+
|
|
2290
|
+
class SelectionOnPointerDown {
|
|
2291
|
+
constructor(fFlow, fSelection, hostElement) {
|
|
2292
|
+
this.fFlow = fFlow;
|
|
2293
|
+
this.fSelection = fSelection;
|
|
2294
|
+
this.hostElement = hostElement;
|
|
2295
|
+
}
|
|
2296
|
+
handle(payload) {
|
|
2297
|
+
const pointerPositionInCanvas = Point.fromPoint(payload.event.getPosition()).matrixTransform(this.hostElement);
|
|
2298
|
+
let node = this.fFlow.fNodesContainer.findNode(payload.event.targetElement);
|
|
2299
|
+
const connection = this.fFlow.fConnectionsContainer.findConnectionWithElement(payload.event.targetElement);
|
|
2300
|
+
payload.selectedItems.forEach((x) => {
|
|
2301
|
+
x.deselect();
|
|
2302
|
+
});
|
|
2303
|
+
const isMultiselect = MouseEventExtensions.isCommandButton(payload.event.originalEvent) ||
|
|
2304
|
+
MouseEventExtensions.isShiftPressed(payload.event.originalEvent);
|
|
2305
|
+
if (!isMultiselect) {
|
|
2306
|
+
payload.selectedItems = [];
|
|
2307
|
+
}
|
|
2308
|
+
if (node) {
|
|
2309
|
+
if (isNodeOutlet(payload.event.targetElement) || isNodeOutput(payload.event.targetElement)) {
|
|
2310
|
+
node = undefined;
|
|
2311
|
+
}
|
|
2312
|
+
if (node) {
|
|
2313
|
+
if (!payload.selectedItems.includes(node)) {
|
|
2314
|
+
payload.selectedItems.push(node);
|
|
2315
|
+
}
|
|
2316
|
+
else {
|
|
2317
|
+
payload.selectedItems.splice(payload.selectedItems.indexOf(node), 1);
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
else if (connection) {
|
|
2322
|
+
if (!payload.selectedItems.includes(connection)) {
|
|
2323
|
+
payload.selectedItems.push(connection);
|
|
2324
|
+
}
|
|
2325
|
+
else {
|
|
2326
|
+
payload.selectedItems.splice(payload.selectedItems.indexOf(connection), 1);
|
|
2327
|
+
}
|
|
2328
|
+
}
|
|
2329
|
+
payload.selectedItems.forEach((x) => {
|
|
2330
|
+
x.select();
|
|
2331
|
+
});
|
|
2332
|
+
let draggableItems = [];
|
|
2333
|
+
if (MouseEventExtensions.isShiftPressed(payload.event.originalEvent)) {
|
|
2334
|
+
draggableItems = [
|
|
2335
|
+
new SelectionOnPointerMove(this.fFlow, this.fSelection, payload.selectedItems, pointerPositionInCanvas)
|
|
2336
|
+
];
|
|
2337
|
+
}
|
|
2338
|
+
return {
|
|
2339
|
+
onPointerDownScale: 1,
|
|
2340
|
+
onPointerDownPosition: pointerPositionInCanvas.div(1),
|
|
2341
|
+
draggableItems: draggableItems,
|
|
2342
|
+
selectedItems: payload.selectedItems
|
|
2343
|
+
};
|
|
2344
|
+
}
|
|
2345
|
+
}
|
|
2346
|
+
|
|
2347
|
+
class SelectionOnPointerDownRequest {
|
|
2348
|
+
constructor(event, transform, selectedItems) {
|
|
2349
|
+
this.event = event;
|
|
2350
|
+
this.transform = transform;
|
|
2351
|
+
this.selectedItems = selectedItems;
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
|
|
2355
|
+
class SelectionOnPointerUp {
|
|
2356
|
+
constructor(hostElement) {
|
|
2357
|
+
this.hostElement = hostElement;
|
|
2358
|
+
}
|
|
2359
|
+
handle(payload) {
|
|
2360
|
+
let result = payload.selectedItems;
|
|
2361
|
+
const pointerPositionInCanvas = Point.fromPoint(payload.event.getPosition()).matrixTransform(this.hostElement);
|
|
2362
|
+
let difference = pointerPositionInCanvas.div(payload.dragHandler.onPointerDownScale).sub(payload.dragHandler.onPointerDownPosition);
|
|
2363
|
+
const isSelection = payload.dragHandler.draggableItems.some((x) => x.type === EDraggableType.SELECTION);
|
|
2364
|
+
if (isSelection) {
|
|
2365
|
+
payload.dragHandler.draggableItems.forEach((x) => {
|
|
2366
|
+
x.move(difference);
|
|
2367
|
+
x.complete();
|
|
2368
|
+
});
|
|
2369
|
+
result = payload.dragHandler.draggableItems[0].selectedItems;
|
|
2370
|
+
}
|
|
2371
|
+
return result;
|
|
2372
|
+
}
|
|
2373
|
+
}
|
|
2374
|
+
|
|
2375
|
+
class SelectionOnPointerUpRequest {
|
|
2376
|
+
constructor(event, dragHandler, selectedItems) {
|
|
2377
|
+
this.event = event;
|
|
2378
|
+
this.dragHandler = dragHandler;
|
|
2379
|
+
this.selectedItems = selectedItems;
|
|
2380
|
+
}
|
|
2381
|
+
}
|
|
2382
|
+
|
|
2383
|
+
class FDraggableService {
|
|
2384
|
+
get hostElement() {
|
|
2385
|
+
return this.fFlow.hostElement;
|
|
2386
|
+
}
|
|
2387
|
+
get transform() {
|
|
2388
|
+
return this.fFlow.transform;
|
|
2389
|
+
}
|
|
2390
|
+
constructor() {
|
|
2391
|
+
}
|
|
2392
|
+
setFlow(fFlow) {
|
|
2393
|
+
this.fFlow = fFlow;
|
|
2394
|
+
}
|
|
2395
|
+
onPointerDown(event) {
|
|
2396
|
+
}
|
|
2397
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FDraggableService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2398
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FDraggableService }); }
|
|
2399
|
+
}
|
|
2400
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FDraggableService, decorators: [{
|
|
2401
|
+
type: Injectable
|
|
2402
|
+
}], ctorParameters: function () { return []; } });
|
|
2403
|
+
|
|
2404
|
+
const F_DND_DIRECTIVE = new InjectionToken('F_DND_DIRECTIVE');
|
|
2405
|
+
class FDraggableBase extends IDragAndDropBase {
|
|
2406
|
+
get hostElement() {
|
|
2407
|
+
return this.elementReference.nativeElement;
|
|
2408
|
+
}
|
|
2409
|
+
get transform() {
|
|
2410
|
+
return this.fItemsContainer.transform;
|
|
2411
|
+
}
|
|
2412
|
+
get fItemsContainer() {
|
|
2413
|
+
return this.fFlow.fItemsContainer;
|
|
2414
|
+
}
|
|
2415
|
+
get fBackground() {
|
|
2416
|
+
return this.fFlow.fBackground;
|
|
2417
|
+
}
|
|
2418
|
+
constructor(fFlow, fDNDService, fExternalItemService, elementReference, ngZone) {
|
|
2419
|
+
super(ngZone);
|
|
2420
|
+
this.fFlow = fFlow;
|
|
2421
|
+
this.fDNDService = fDNDService;
|
|
2422
|
+
this.fExternalItemService = fExternalItemService;
|
|
2423
|
+
this.elementReference = elementReference;
|
|
2424
|
+
this.subscriptions$ = new Subscription();
|
|
2425
|
+
this.dragHandler = new DefaultDragHandler().handle();
|
|
2426
|
+
this.selectedItems = [];
|
|
2427
|
+
this.fDNDService.setFlow(this.fFlow);
|
|
2428
|
+
}
|
|
2429
|
+
ngAfterViewInit() {
|
|
2430
|
+
super.subscribe(document);
|
|
2431
|
+
this.dragSelection = new SelectionOnPointerDown(this.fFlow, this.fSelection, this.hostElement);
|
|
2432
|
+
this.reassignConnection = new ReassignConnectionOnPointerDown(this.fFlow, this.hostElement);
|
|
2433
|
+
this.dragCanvas = new CanvasOnPointerDownHandler(this.fBackground, this.fItemsContainer, this.hostElement);
|
|
2434
|
+
this.dragNode = new NodeOnPointerDown(this.fLineAlignment, this.fFlow, this.hostElement);
|
|
2435
|
+
this.createConnection = new CreateConnectionOnPointerDown(this.fFlow, this.hostElement);
|
|
2436
|
+
this.dragExternalItem = new ExternalItemOnPointerDownHandler(this.fExternalItemService, this.hostElement);
|
|
2437
|
+
}
|
|
2438
|
+
onPointerDown(event) {
|
|
2439
|
+
let result = event.isMouseLeftButton();
|
|
2440
|
+
const selection = this.dragSelection.handle(new SelectionOnPointerDownRequest(event, this.transform, this.selectedItems));
|
|
2441
|
+
this.selectedItems = selection.selectedItems || [];
|
|
2442
|
+
const reassignConnection = this.reassignConnection.handle(new ReassignConnectionOnPointerDownRequest(event, this.transform));
|
|
2443
|
+
const createConnection = this.createConnection.handle(new CreateConnectionOnPointerDownRequest(event, this.transform));
|
|
2444
|
+
const dragNode = this.dragNode.handle(new NodeOnPointerDownRequest(event, this.transform, this.selectedItems));
|
|
2445
|
+
const dragCanvas = this.dragCanvas.handle(new CanvasOnPointerDownRequest(event));
|
|
2446
|
+
const dragExternalItem = this.dragExternalItem.handle(new ExternalItemOnPointerDownRequest(event));
|
|
2447
|
+
const dragSelection = selection.draggableItems.length ? selection : undefined;
|
|
2448
|
+
const dragHandle = dragSelection || reassignConnection || createConnection || dragNode || dragCanvas || dragExternalItem;
|
|
2449
|
+
if (!dragHandle) {
|
|
2450
|
+
this.dragHandler = new DefaultDragHandler().handle();
|
|
2451
|
+
result = false;
|
|
2452
|
+
}
|
|
2453
|
+
else {
|
|
2454
|
+
this.dragHandler = dragHandle;
|
|
2455
|
+
}
|
|
2456
|
+
return result;
|
|
2457
|
+
}
|
|
2458
|
+
prepareDragSequence(event) {
|
|
2459
|
+
const isDragNodes = this.dragHandler.draggableItems.some((x) => x.type === EDraggableType.NODE);
|
|
2460
|
+
if (isDragNodes) {
|
|
2461
|
+
this.dragHandler = this.dragNode.handle(new NodeOnPointerDownRequest(event, this.transform, this.selectedItems, true));
|
|
2462
|
+
}
|
|
2463
|
+
this.dragHandler.draggableItems.forEach((item) => {
|
|
2464
|
+
item.initialize();
|
|
2465
|
+
});
|
|
2466
|
+
}
|
|
2467
|
+
onPointerMove(event) {
|
|
2468
|
+
const pointerPositionInCanvas = Point.fromPoint(event.getPosition()).matrixTransform(this.hostElement);
|
|
2469
|
+
const difference = pointerPositionInCanvas.div(this.dragHandler.onPointerDownScale).sub(this.dragHandler.onPointerDownPosition);
|
|
2470
|
+
this.dragHandler.draggableItems.forEach((item) => {
|
|
2471
|
+
item.move(difference);
|
|
2472
|
+
});
|
|
2473
|
+
}
|
|
2474
|
+
onPointerUp(event) {
|
|
2475
|
+
new ReassignConnectionOnPointerUp(this.fFlow, this.onReassignConnection).handle(new ReassignConnectionOnPointerUpRequest(event, this.dragHandler));
|
|
2476
|
+
new CreateConnectionOnPointerUp(this.fFlow, this.onCreateConnection).handle(new CreateConnectionOnPointerUpRequest(event, this.dragHandler));
|
|
2477
|
+
new NodeOnPointerUp(this.fLineAlignment, this.fConnectIfIntersect, this.hostElement).handle(new NodeOnPointerUpRequest(event, this.dragHandler));
|
|
2478
|
+
this.selectedItems = new SelectionOnPointerUp(this.hostElement).handle(new SelectionOnPointerUpRequest(event, this.dragHandler, this.selectedItems));
|
|
2479
|
+
new ExternalItemOnPointerUpHandler(this.fFlow, this.onCreateNode).handle(new ExternalItemOnPointerUpRequest(event, this.dragHandler));
|
|
2480
|
+
}
|
|
2481
|
+
ngOnDestroy() {
|
|
2482
|
+
super.unsubscribe();
|
|
2483
|
+
this.subscriptions$.unsubscribe();
|
|
2484
|
+
}
|
|
2485
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FDraggableBase, deps: [{ token: FFlowBase }, { token: FDraggableService }, { token: FExternalItemService }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2486
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.4", type: FDraggableBase, usesInheritance: true, ngImport: i0 }); }
|
|
2487
|
+
}
|
|
2488
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FDraggableBase, decorators: [{
|
|
2489
|
+
type: Directive
|
|
2490
|
+
}], ctorParameters: function () { return [{ type: FFlowBase }, { type: FDraggableService }, { type: FExternalItemService }, { type: i0.ElementRef }, { type: i0.NgZone }]; } });
|
|
2491
|
+
|
|
2492
|
+
const ALIGN_THRESHOLD$1 = 10;
|
|
2493
|
+
function findNearestCoordinateByX(elements, target) {
|
|
2494
|
+
let nearest;
|
|
2495
|
+
let minDistance;
|
|
2496
|
+
for (const element of elements) {
|
|
2497
|
+
const distanceLeftLeft = target.x - element.x;
|
|
2498
|
+
const distanceLeftRight = target.x - (element.x + element.width);
|
|
2499
|
+
const distanceCenterCenter = target.gravityCenter.x - element.gravityCenter.x;
|
|
2500
|
+
const distanceRightLeft = (target.x + target.width) - element.x;
|
|
2501
|
+
const distanceRightRight = (target.x + target.width) - (element.x + element.width);
|
|
2502
|
+
if (Math.abs(distanceLeftLeft) <= ALIGN_THRESHOLD$1 ||
|
|
2503
|
+
Math.abs(distanceLeftRight) <= ALIGN_THRESHOLD$1 ||
|
|
2504
|
+
Math.abs(distanceCenterCenter) <= ALIGN_THRESHOLD$1 ||
|
|
2505
|
+
Math.abs(distanceRightLeft) <= ALIGN_THRESHOLD$1 ||
|
|
2506
|
+
Math.abs(distanceRightRight) <= ALIGN_THRESHOLD$1) {
|
|
2507
|
+
if (minDistance === undefined || Math.abs(distanceCenterCenter) < Math.abs(minDistance)) {
|
|
2508
|
+
minDistance = distanceCenterCenter;
|
|
2509
|
+
nearest = element.gravityCenter.x;
|
|
2510
|
+
}
|
|
2511
|
+
if (Math.abs(distanceLeftLeft) < Math.abs(minDistance)) {
|
|
2512
|
+
minDistance = distanceLeftLeft;
|
|
2513
|
+
nearest = element.x;
|
|
2514
|
+
}
|
|
2515
|
+
if (Math.abs(distanceRightRight) < Math.abs(minDistance)) {
|
|
2516
|
+
minDistance = distanceRightRight;
|
|
2517
|
+
nearest = element.x + element.width;
|
|
2518
|
+
}
|
|
2519
|
+
if (Math.abs(distanceLeftRight) < Math.abs(minDistance)) {
|
|
2520
|
+
minDistance = distanceLeftRight;
|
|
2521
|
+
nearest = element.x + element.width;
|
|
2522
|
+
}
|
|
2523
|
+
if (Math.abs(distanceRightLeft) < Math.abs(minDistance)) {
|
|
2524
|
+
minDistance = distanceRightLeft;
|
|
2525
|
+
nearest = element.x;
|
|
2526
|
+
}
|
|
2527
|
+
}
|
|
2528
|
+
}
|
|
2529
|
+
return { value: nearest, distance: minDistance };
|
|
2530
|
+
}
|
|
2531
|
+
|
|
2532
|
+
const ALIGN_THRESHOLD = 10;
|
|
2533
|
+
function findNearestCoordinateByY(elements, target) {
|
|
2534
|
+
let nearest;
|
|
2535
|
+
let minDistance;
|
|
2536
|
+
for (const element of elements) {
|
|
2537
|
+
const distanceTopTop = target.y - element.y;
|
|
2538
|
+
const distanceTopBottom = target.y - (element.y + element.height);
|
|
2539
|
+
const distanceCenterCenter = target.gravityCenter.y - element.gravityCenter.y;
|
|
2540
|
+
const distanceBottomTop = (target.y + target.height) - element.y;
|
|
2541
|
+
const distanceBottomBottom = (target.y + target.height) - (element.y + element.height);
|
|
2542
|
+
if (Math.abs(distanceTopTop) <= ALIGN_THRESHOLD ||
|
|
2543
|
+
Math.abs(distanceTopBottom) <= ALIGN_THRESHOLD ||
|
|
2544
|
+
Math.abs(distanceCenterCenter) <= ALIGN_THRESHOLD ||
|
|
2545
|
+
Math.abs(distanceBottomTop) <= ALIGN_THRESHOLD ||
|
|
2546
|
+
Math.abs(distanceBottomBottom) <= ALIGN_THRESHOLD) {
|
|
2547
|
+
if (minDistance === undefined || Math.abs(distanceCenterCenter) < Math.abs(minDistance)) {
|
|
2548
|
+
minDistance = distanceCenterCenter;
|
|
2549
|
+
nearest = element.gravityCenter.y;
|
|
2550
|
+
}
|
|
2551
|
+
if (Math.abs(distanceTopTop) < Math.abs(minDistance)) {
|
|
2552
|
+
minDistance = distanceTopTop;
|
|
2553
|
+
nearest = element.y;
|
|
2554
|
+
}
|
|
2555
|
+
if (Math.abs(distanceBottomBottom) < Math.abs(minDistance)) {
|
|
2556
|
+
minDistance = distanceBottomBottom;
|
|
2557
|
+
nearest = element.y + element.height;
|
|
2558
|
+
}
|
|
2559
|
+
if (Math.abs(distanceTopBottom) < Math.abs(minDistance)) {
|
|
2560
|
+
minDistance = distanceTopBottom;
|
|
2561
|
+
nearest = element.y + element.height;
|
|
2562
|
+
}
|
|
2563
|
+
if (Math.abs(distanceBottomTop) < Math.abs(minDistance)) {
|
|
2564
|
+
minDistance = distanceBottomTop;
|
|
2565
|
+
nearest = element.y;
|
|
2566
|
+
}
|
|
2567
|
+
}
|
|
2568
|
+
}
|
|
2569
|
+
return { value: nearest, distance: minDistance };
|
|
2570
|
+
}
|
|
2571
|
+
|
|
2572
|
+
const F_LINE_ALIGNMENT = new InjectionToken('F_LINE_ALIGNMENT');
|
|
2573
|
+
class FLineAlignmentDirective {
|
|
2574
|
+
get hostElement() {
|
|
2575
|
+
return this.elementReference.nativeElement;
|
|
2576
|
+
}
|
|
2577
|
+
get transform() {
|
|
2578
|
+
return this.fFlow.fItemsContainer.transform;
|
|
2579
|
+
}
|
|
2580
|
+
constructor(fFlow, elementReference) {
|
|
2581
|
+
this.fFlow = fFlow;
|
|
2582
|
+
this.elementReference = elementReference;
|
|
2583
|
+
this.fHorizontalLine = new LineFElement();
|
|
2584
|
+
this.fVerticalLine = new LineFElement();
|
|
2585
|
+
this.size = SizeExtensions.initialize();
|
|
2586
|
+
this.draggedNodeRect = RectExtensions.initialize();
|
|
2587
|
+
this.rects = [];
|
|
2588
|
+
this.hostElement.appendChild(this.fHorizontalLine.hostElement);
|
|
2589
|
+
this.hostElement.appendChild(this.fVerticalLine.hostElement);
|
|
2590
|
+
}
|
|
2591
|
+
initialize(allNodes, currentNodes) {
|
|
2592
|
+
this.size = this.fFlow.hostElement.getBoundingClientRect();
|
|
2593
|
+
this.rects = [];
|
|
2594
|
+
const draggedNodeRects = currentNodes.map((x) => {
|
|
2595
|
+
return getElementRectInCanvas(x.hostElement, this.transform, this.fFlow.hostElement);
|
|
2596
|
+
});
|
|
2597
|
+
this.draggedNodeRect = RectExtensions.union(draggedNodeRects);
|
|
2598
|
+
const allNodesExcludeCurrents = allNodes.filter((x) => {
|
|
2599
|
+
return !currentNodes.includes(x);
|
|
2600
|
+
});
|
|
2601
|
+
this.rects = allNodesExcludeCurrents.map((x) => {
|
|
2602
|
+
return getElementRectInCanvas(x.hostElement, this.transform, this.fFlow.hostElement);
|
|
2603
|
+
});
|
|
2604
|
+
}
|
|
2605
|
+
handle(difference) {
|
|
2606
|
+
this.drawIntersections(difference);
|
|
2607
|
+
}
|
|
2608
|
+
drawIntersections(difference) {
|
|
2609
|
+
const intersect = this.findNearestCoordinate(difference);
|
|
2610
|
+
if (intersect.xResult.value !== undefined) {
|
|
2611
|
+
this.fVerticalLine.show();
|
|
2612
|
+
this.fVerticalLine.draw({
|
|
2613
|
+
x1: intersect.xResult.value * this.transform.scale + this.transform.position.x + this.transform.scaledPosition.x,
|
|
2614
|
+
x2: intersect.xResult.value * this.transform.scale + this.transform.position.x + this.transform.scaledPosition.x,
|
|
2615
|
+
y1: 0,
|
|
2616
|
+
y2: this.size.height
|
|
2617
|
+
});
|
|
2618
|
+
}
|
|
2619
|
+
else {
|
|
2620
|
+
this.fVerticalLine.hide();
|
|
2621
|
+
}
|
|
2622
|
+
if (intersect.yResult.value !== undefined) {
|
|
2623
|
+
this.fHorizontalLine.show();
|
|
2624
|
+
this.fHorizontalLine.draw({
|
|
2625
|
+
x1: 0,
|
|
2626
|
+
x2: this.size.width,
|
|
2627
|
+
y1: intersect.yResult.value * this.transform.scale + this.transform.position.y + this.transform.scaledPosition.y,
|
|
2628
|
+
y2: intersect.yResult.value * this.transform.scale + this.transform.position.y + this.transform.scaledPosition.y,
|
|
2629
|
+
});
|
|
2630
|
+
}
|
|
2631
|
+
else {
|
|
2632
|
+
this.fHorizontalLine.hide();
|
|
2633
|
+
}
|
|
2634
|
+
}
|
|
2635
|
+
findNearestCoordinate(difference) {
|
|
2636
|
+
let result = {
|
|
2637
|
+
xResult: { value: undefined, distance: undefined },
|
|
2638
|
+
yResult: { value: undefined, distance: undefined }
|
|
2639
|
+
};
|
|
2640
|
+
const rect = RectExtensions.addPoint(this.draggedNodeRect, difference);
|
|
2641
|
+
const xResult = findNearestCoordinateByX(this.rects, rect);
|
|
2642
|
+
const yResult = findNearestCoordinateByY(this.rects, rect);
|
|
2643
|
+
result = { xResult, yResult };
|
|
2644
|
+
return result;
|
|
2645
|
+
}
|
|
2646
|
+
complete() {
|
|
2647
|
+
this.fVerticalLine.hide();
|
|
2648
|
+
this.fHorizontalLine.hide();
|
|
2649
|
+
}
|
|
2650
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FLineAlignmentDirective, deps: [{ token: F_FLOW_COMPONENT }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2651
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.4", type: FLineAlignmentDirective, selector: "g[fLineAlignment]", host: { classAttribute: "f-line-alignment f-component" }, providers: [
|
|
2652
|
+
{ provide: F_LINE_ALIGNMENT, useExisting: FLineAlignmentDirective }
|
|
2653
|
+
], ngImport: i0 }); }
|
|
2654
|
+
}
|
|
2655
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FLineAlignmentDirective, decorators: [{
|
|
2656
|
+
type: Directive,
|
|
2657
|
+
args: [{
|
|
2658
|
+
selector: "g[fLineAlignment]",
|
|
2659
|
+
host: {
|
|
2660
|
+
'class': 'f-line-alignment f-component'
|
|
2661
|
+
},
|
|
2662
|
+
providers: [
|
|
2663
|
+
{ provide: F_LINE_ALIGNMENT, useExisting: FLineAlignmentDirective }
|
|
2664
|
+
],
|
|
2665
|
+
}]
|
|
2666
|
+
}], ctorParameters: function () { return [{ type: FFlowBase, decorators: [{
|
|
2667
|
+
type: Inject,
|
|
2668
|
+
args: [F_FLOW_COMPONENT]
|
|
2669
|
+
}] }, { type: i0.ElementRef }]; } });
|
|
2670
|
+
|
|
2671
|
+
class FDraggableDirective extends FDraggableBase {
|
|
2672
|
+
constructor(fFlow, fDNDService, fExternalItemService, elementReference, ngZone) {
|
|
2673
|
+
super(fFlow, fDNDService, fExternalItemService, elementReference, ngZone);
|
|
2674
|
+
this.disabled = false;
|
|
2675
|
+
this.onCreateConnection = new EventEmitter();
|
|
2676
|
+
this.onReassignConnection = new EventEmitter();
|
|
2677
|
+
this.onCreateNode = new EventEmitter();
|
|
2678
|
+
}
|
|
2679
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FDraggableDirective, deps: [{ token: F_FLOW_COMPONENT }, { token: FDraggableService }, { token: FExternalItemService }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2680
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.4", type: FDraggableDirective, selector: "svg[fDraggable]", inputs: { disabled: "disabled" }, outputs: { onCreateConnection: "onCreateConnection", onReassignConnection: "onReassignConnection", onCreateNode: "onCreateNode" }, providers: [
|
|
2681
|
+
{ provide: F_DND_DIRECTIVE, useExisting: FDraggableDirective }
|
|
2682
|
+
], queries: [{ propertyName: "fLineAlignment", first: true, predicate: F_LINE_ALIGNMENT, descendants: true, static: true }, { propertyName: "fConnectIfIntersect", first: true, predicate: F_CONNECT_IF_INTERSECT, descendants: true, static: true }, { propertyName: "fSelection", first: true, predicate: F_SELECTION, descendants: true, static: true }], usesInheritance: true, ngImport: i0 }); }
|
|
2683
|
+
}
|
|
2684
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FDraggableDirective, decorators: [{
|
|
2685
|
+
type: Directive,
|
|
2686
|
+
args: [{
|
|
2687
|
+
selector: "svg[fDraggable]",
|
|
2688
|
+
providers: [
|
|
2689
|
+
{ provide: F_DND_DIRECTIVE, useExisting: FDraggableDirective }
|
|
2690
|
+
]
|
|
2691
|
+
}]
|
|
2692
|
+
}], ctorParameters: function () { return [{ type: FFlowBase, decorators: [{
|
|
2693
|
+
type: Inject,
|
|
2694
|
+
args: [F_FLOW_COMPONENT]
|
|
2695
|
+
}] }, { type: FDraggableService }, { type: FExternalItemService }, { type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { disabled: [{
|
|
2696
|
+
type: Input
|
|
2697
|
+
}], fLineAlignment: [{
|
|
2698
|
+
type: ContentChild,
|
|
2699
|
+
args: [F_LINE_ALIGNMENT, { static: true }]
|
|
2700
|
+
}], fConnectIfIntersect: [{
|
|
2701
|
+
type: ContentChild,
|
|
2702
|
+
args: [F_CONNECT_IF_INTERSECT, { static: true }]
|
|
2703
|
+
}], fSelection: [{
|
|
2704
|
+
type: ContentChild,
|
|
2705
|
+
args: [F_SELECTION, { static: true }]
|
|
2706
|
+
}], onCreateConnection: [{
|
|
2707
|
+
type: Output
|
|
2708
|
+
}], onReassignConnection: [{
|
|
2709
|
+
type: Output
|
|
2710
|
+
}], onCreateNode: [{
|
|
2711
|
+
type: Output
|
|
2712
|
+
}] } });
|
|
2713
|
+
|
|
2714
|
+
class FDraggableModule {
|
|
2715
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FDraggableModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2716
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.4", ngImport: i0, type: FDraggableModule, declarations: [FDraggableDirective,
|
|
2717
|
+
FExternalItemDirective,
|
|
2718
|
+
FLineAlignmentDirective,
|
|
2719
|
+
FSelectionDirective,
|
|
2720
|
+
FConnectIfIntersectDirective], exports: [FDraggableDirective,
|
|
2721
|
+
FExternalItemDirective,
|
|
2722
|
+
FLineAlignmentDirective,
|
|
2723
|
+
FSelectionDirective,
|
|
2724
|
+
FConnectIfIntersectDirective] }); }
|
|
2725
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FDraggableModule, providers: [
|
|
2726
|
+
FExternalItemService,
|
|
2727
|
+
FDraggableService
|
|
2728
|
+
] }); }
|
|
2729
|
+
}
|
|
2730
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FDraggableModule, decorators: [{
|
|
2731
|
+
type: NgModule,
|
|
2732
|
+
args: [{
|
|
2733
|
+
declarations: [
|
|
2734
|
+
FDraggableDirective,
|
|
2735
|
+
FExternalItemDirective,
|
|
2736
|
+
FLineAlignmentDirective,
|
|
2737
|
+
FSelectionDirective,
|
|
2738
|
+
FConnectIfIntersectDirective
|
|
2739
|
+
],
|
|
2740
|
+
imports: [],
|
|
2741
|
+
providers: [
|
|
2742
|
+
FExternalItemService,
|
|
2743
|
+
FDraggableService
|
|
2744
|
+
],
|
|
2745
|
+
exports: [
|
|
2746
|
+
FDraggableDirective,
|
|
2747
|
+
FExternalItemDirective,
|
|
2748
|
+
FLineAlignmentDirective,
|
|
2749
|
+
FSelectionDirective,
|
|
2750
|
+
FConnectIfIntersectDirective
|
|
2751
|
+
]
|
|
2752
|
+
}]
|
|
2753
|
+
}] });
|
|
2754
|
+
|
|
2755
|
+
class ConnectIfIntersectHandler {
|
|
2756
|
+
constructor(connections, fFlow, fItemsContainer) {
|
|
2757
|
+
this.connections = connections;
|
|
2758
|
+
this.fFlow = fFlow;
|
|
2759
|
+
this.fItemsContainer = fItemsContainer;
|
|
2760
|
+
}
|
|
2761
|
+
handle(request) {
|
|
2762
|
+
const isValid = this.isValidRequest(request);
|
|
2763
|
+
if (!isValid) {
|
|
2764
|
+
return;
|
|
2765
|
+
}
|
|
2766
|
+
const fNode = request.draggableItems[0].fNode;
|
|
2767
|
+
const outputsOfNode = this.getOutputsForNode(fNode);
|
|
2768
|
+
const inputsOfNode = this.getInputsForNode(fNode);
|
|
2769
|
+
const isCantBeConnectedByOutput = outputsOfNode.some((x) => !x.canBeConnected);
|
|
2770
|
+
const isCantBeConnectedByInput = this.connections.some((x) => {
|
|
2771
|
+
return inputsOfNode.find((input) => input.id === x.fromTo?.input?.id);
|
|
2772
|
+
});
|
|
2773
|
+
if (!isCantBeConnectedByInput && outputsOfNode.length && !isCantBeConnectedByOutput && inputsOfNode.length) {
|
|
2774
|
+
const output = outputsOfNode[0];
|
|
2775
|
+
const input = inputsOfNode[0];
|
|
2776
|
+
const outgoingConnections = findOutgoingConnections(this.connections, [output]);
|
|
2777
|
+
const incomingConnections = findIncomingConnections(this.connections, [input]);
|
|
2778
|
+
if (outgoingConnections.length === 0 && incomingConnections.length === 0) {
|
|
2779
|
+
const connections = this.findConnectionsUnderNode(fNode);
|
|
2780
|
+
console.log('connections', connections);
|
|
2781
|
+
// if (connections.length) {
|
|
2782
|
+
// const connectedTo = (connections[ 0 ].fromTo?.output as FNodeOutputBase).connectedTo;
|
|
2783
|
+
// (connections[ 0 ].fromTo?.output as FNodeOutputBase).connectTo(input.id);
|
|
2784
|
+
// output.connectTo(connectedTo);
|
|
2785
|
+
// }
|
|
2786
|
+
}
|
|
2787
|
+
}
|
|
2788
|
+
}
|
|
2789
|
+
isValidRequest(request) {
|
|
2790
|
+
const result = request?.draggableItems.length === 1 &&
|
|
2791
|
+
request?.draggableItems[0].type === EDraggableType.NODE;
|
|
2792
|
+
return result;
|
|
2793
|
+
}
|
|
2794
|
+
getOutputsForNode(node) {
|
|
2795
|
+
return this.fFlow.outputs.filter((x) => node.isContains(x.hostElement));
|
|
2796
|
+
}
|
|
2797
|
+
getInputsForNode(node) {
|
|
2798
|
+
return this.fFlow.inputs.filter((x) => node.isContains(x.hostElement));
|
|
2799
|
+
}
|
|
2800
|
+
findConnectionsUnderNode(node) {
|
|
2801
|
+
const nodeRect = getElementRectInCanvas(node.hostElement, this.fItemsContainer.transform, this.fFlow.hostElement);
|
|
2802
|
+
return this.connections.filter((x) => {
|
|
2803
|
+
const intersection = RectExtensions.intersectionWithVector(nodeRect, x.vector.point1, x.vector.point2);
|
|
2804
|
+
return (intersection || []).length > 0;
|
|
2805
|
+
});
|
|
2806
|
+
}
|
|
2807
|
+
}
|
|
2808
|
+
|
|
2809
|
+
class ConnectIfIntersectRequest {
|
|
2810
|
+
constructor(draggableItems) {
|
|
2811
|
+
this.draggableItems = draggableItems;
|
|
2812
|
+
}
|
|
2813
|
+
}
|
|
2814
|
+
|
|
2815
|
+
const F_CONNECT_IF_INTERSECT = new InjectionToken('F_CONNECT_IF_INTERSECT');
|
|
2816
|
+
class FConnectIfIntersectDirective {
|
|
2817
|
+
constructor(fFlow, fItemsContainer) {
|
|
2818
|
+
this.fFlow = fFlow;
|
|
2819
|
+
this.fItemsContainer = fItemsContainer;
|
|
2820
|
+
}
|
|
2821
|
+
handle(draggableItems) {
|
|
2822
|
+
new ConnectIfIntersectHandler(this.fConnections.toArray(), this.fFlow, this.fItemsContainer).handle(new ConnectIfIntersectRequest(draggableItems));
|
|
2823
|
+
}
|
|
2824
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FConnectIfIntersectDirective, deps: [{ token: F_FLOW_COMPONENT }, { token: F_ITEMS_CONTAINER }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2825
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.4", type: FConnectIfIntersectDirective, selector: "g[fConnectIfIntersect]", providers: [
|
|
2826
|
+
{ provide: F_CONNECT_IF_INTERSECT, useExisting: FConnectIfIntersectDirective }
|
|
2827
|
+
], queries: [{ propertyName: "fConnections", predicate: F_CONNECTION_COMPONENT, descendants: true }], ngImport: i0 }); }
|
|
2828
|
+
}
|
|
2829
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FConnectIfIntersectDirective, decorators: [{
|
|
2830
|
+
type: Directive,
|
|
2831
|
+
args: [{
|
|
2832
|
+
selector: "g[fConnectIfIntersect]",
|
|
2833
|
+
providers: [
|
|
2834
|
+
{ provide: F_CONNECT_IF_INTERSECT, useExisting: FConnectIfIntersectDirective }
|
|
2835
|
+
]
|
|
2836
|
+
}]
|
|
2837
|
+
}], ctorParameters: function () { return [{ type: FFlowBase, decorators: [{
|
|
2838
|
+
type: Inject,
|
|
2839
|
+
args: [F_FLOW_COMPONENT]
|
|
2840
|
+
}] }, { type: FItemsContainerBase, decorators: [{
|
|
2841
|
+
type: Inject,
|
|
2842
|
+
args: [F_ITEMS_CONTAINER]
|
|
2843
|
+
}] }]; }, propDecorators: { fConnections: [{
|
|
2844
|
+
type: ContentChildren,
|
|
2845
|
+
args: [F_CONNECTION_COMPONENT, { descendants: true }]
|
|
2846
|
+
}] } });
|
|
2847
|
+
|
|
2848
|
+
const F_ZOOM = new InjectionToken('F_ZOOM');
|
|
2849
|
+
class FZoomBase {
|
|
2850
|
+
constructor(fItemsContainer, fDnd, fCanvas) {
|
|
2851
|
+
this.fItemsContainer = fItemsContainer;
|
|
2852
|
+
this.fDnd = fDnd;
|
|
2853
|
+
this.fCanvas = fCanvas;
|
|
2854
|
+
this.isEnabled = false;
|
|
2855
|
+
this.minimum = 0.3;
|
|
2856
|
+
this.maximum = 4;
|
|
2857
|
+
this.step = 1.1;
|
|
2858
|
+
this.listeners = EventExtensions.emptyListener();
|
|
2859
|
+
}
|
|
2860
|
+
toggleZoom() {
|
|
2861
|
+
if (this.isEnabled && this.fCanvas.hostElement) {
|
|
2862
|
+
this.subscribe();
|
|
2863
|
+
}
|
|
2864
|
+
else {
|
|
2865
|
+
this.unsubscribe();
|
|
2866
|
+
}
|
|
2867
|
+
}
|
|
2868
|
+
subscribe() {
|
|
2869
|
+
this.listeners();
|
|
2870
|
+
this.fCanvas.hostElement.addEventListener('wheel', this.onWheel.bind(this));
|
|
2871
|
+
this.fCanvas.hostElement.addEventListener('dblclick', this.onDoubleClick.bind(this));
|
|
2872
|
+
this.listeners = () => {
|
|
2873
|
+
this.fCanvas.hostElement.removeEventListener('wheel', this.onWheel.bind(this));
|
|
2874
|
+
this.fCanvas.hostElement.removeEventListener('dblclick', this.onDoubleClick.bind(this));
|
|
2875
|
+
};
|
|
2876
|
+
}
|
|
2877
|
+
getScale() {
|
|
2878
|
+
return this.fItemsContainer.transform.scale || 1;
|
|
2879
|
+
}
|
|
2880
|
+
onWheel(event) {
|
|
2881
|
+
event.preventDefault();
|
|
2882
|
+
if (this.fDnd.isDragStarted) {
|
|
2883
|
+
return;
|
|
2884
|
+
}
|
|
2885
|
+
let result = this.getScale();
|
|
2886
|
+
if (event.deltaY > 0) {
|
|
2887
|
+
if (this.getScale() / this.step >= this.minimum) {
|
|
2888
|
+
result = this.getScale() / this.step;
|
|
2889
|
+
}
|
|
2890
|
+
}
|
|
2891
|
+
else if (event.deltaY < 0) {
|
|
2892
|
+
if (this.getScale() * this.step <= this.maximum) {
|
|
2893
|
+
result = this.getScale() * this.step;
|
|
2894
|
+
}
|
|
2895
|
+
}
|
|
2896
|
+
const pointerPositionInCanvas = new Point(event.clientX, event.clientY).matrixTransform(this.fCanvas.hostElement);
|
|
2897
|
+
this.fItemsContainer.setZoom(result, pointerPositionInCanvas);
|
|
2898
|
+
this.fItemsContainer.redraw();
|
|
2899
|
+
this.fItemsContainer.completeDrag();
|
|
2900
|
+
}
|
|
2901
|
+
onZoomToCenter(deltaY) {
|
|
2902
|
+
const preventDefault = () => { };
|
|
2903
|
+
const rect = RectExtensions.fromElement(this.fCanvas.hostElement);
|
|
2904
|
+
this.onWheel({
|
|
2905
|
+
deltaY, preventDefault, clientX: rect.gravityCenter.x, clientY: rect.gravityCenter.y
|
|
2906
|
+
});
|
|
2907
|
+
}
|
|
2908
|
+
onDoubleClick(event) {
|
|
2909
|
+
event.preventDefault();
|
|
2910
|
+
if (this.fDnd.isDragStarted) {
|
|
2911
|
+
return;
|
|
2912
|
+
}
|
|
2913
|
+
let result = this.getScale();
|
|
2914
|
+
if (this.getScale() * 1.7 <= this.maximum) {
|
|
2915
|
+
result = this.getScale() * 1.7;
|
|
2916
|
+
}
|
|
2917
|
+
const pointerPositionInCanvas = new Point(event.clientX, event.clientY).matrixTransform(this.fCanvas.hostElement);
|
|
2918
|
+
this.fItemsContainer.setZoom(result, pointerPositionInCanvas);
|
|
2919
|
+
this.fItemsContainer.redrawWithAnimation();
|
|
2920
|
+
this.fItemsContainer.completeDrag();
|
|
2921
|
+
}
|
|
2922
|
+
reset() {
|
|
2923
|
+
this.fItemsContainer.resetZoom();
|
|
2924
|
+
this.fItemsContainer.redraw();
|
|
2925
|
+
this.fItemsContainer.completeDrag();
|
|
2926
|
+
}
|
|
2927
|
+
unsubscribe() {
|
|
2928
|
+
this.listeners();
|
|
2929
|
+
this.listeners = EventExtensions.emptyListener();
|
|
2930
|
+
}
|
|
2931
|
+
}
|
|
2932
|
+
|
|
2933
|
+
class FZoomDirective extends FZoomBase {
|
|
2934
|
+
get fFlowZoom() {
|
|
2935
|
+
return this.isEnabled;
|
|
2936
|
+
}
|
|
2937
|
+
set fFlowZoom(isEnabled) {
|
|
2938
|
+
const value = BooleanExtensions.castToBoolean(isEnabled);
|
|
2939
|
+
if (value !== this.isEnabled) {
|
|
2940
|
+
this.isEnabled = value;
|
|
2941
|
+
this.toggleZoom();
|
|
2942
|
+
}
|
|
2943
|
+
}
|
|
2944
|
+
constructor(fItemsContainer, fDnd, fCanvas) {
|
|
2945
|
+
super(fItemsContainer, fDnd, fCanvas);
|
|
2946
|
+
}
|
|
2947
|
+
ngAfterViewInit() {
|
|
2948
|
+
super.toggleZoom();
|
|
2949
|
+
}
|
|
2950
|
+
ngOnDestroy() {
|
|
2951
|
+
super.unsubscribe();
|
|
2952
|
+
}
|
|
2953
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FZoomDirective, deps: [{ token: F_ITEMS_CONTAINER }, { token: F_DND_DIRECTIVE }, { token: F_CANVAS }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2954
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.4", type: FZoomDirective, selector: "g[fZoom]", inputs: { fFlowZoom: ["fZoom", "fFlowZoom"] }, host: { classAttribute: "f-flow-zoom f-component" }, providers: [{ provide: F_ZOOM, useExisting: FZoomDirective }], exportAs: ["fComponent"], usesInheritance: true, ngImport: i0 }); }
|
|
2955
|
+
}
|
|
2956
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FZoomDirective, decorators: [{
|
|
2957
|
+
type: Directive,
|
|
2958
|
+
args: [{
|
|
2959
|
+
selector: "g[fZoom]",
|
|
2960
|
+
exportAs: 'fComponent',
|
|
2961
|
+
host: {
|
|
2962
|
+
'class': 'f-flow-zoom f-component'
|
|
2963
|
+
},
|
|
2964
|
+
providers: [{ provide: F_ZOOM, useExisting: FZoomDirective }],
|
|
2965
|
+
}]
|
|
2966
|
+
}], ctorParameters: function () { return [{ type: FItemsContainerBase, decorators: [{
|
|
2967
|
+
type: Inject,
|
|
2968
|
+
args: [F_ITEMS_CONTAINER]
|
|
2969
|
+
}] }, { type: FDraggableBase, decorators: [{
|
|
2970
|
+
type: Inject,
|
|
2971
|
+
args: [F_DND_DIRECTIVE]
|
|
2972
|
+
}] }, { type: FCanvasBase, decorators: [{
|
|
2973
|
+
type: Inject,
|
|
2974
|
+
args: [F_CANVAS]
|
|
2975
|
+
}] }]; }, propDecorators: { fFlowZoom: [{
|
|
2976
|
+
type: Input,
|
|
2977
|
+
args: ['fZoom']
|
|
2978
|
+
}] } });
|
|
2979
|
+
|
|
2980
|
+
class FFlowModule {
|
|
2981
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FFlowModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2982
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.4", ngImport: i0, type: FFlowModule, declarations: [FFlowComponent,
|
|
2983
|
+
FNodeComponent,
|
|
2984
|
+
FZoomDirective,
|
|
2985
|
+
FForeignObjectComponent,
|
|
2986
|
+
FDragHandleDirective,
|
|
2987
|
+
FItemsContainerDirective,
|
|
2988
|
+
FNodesContainerComponent,
|
|
2989
|
+
FConnectionsContainerComponent,
|
|
2990
|
+
FNodeInputDirective,
|
|
2991
|
+
FNodeOutletDirective,
|
|
2992
|
+
FNodeOutputDirective], imports: [CommonModule,
|
|
2993
|
+
FConnectionModule,
|
|
2994
|
+
FCanvasDirective,
|
|
2995
|
+
FBackgroundDirective], exports: [FFlowComponent,
|
|
2996
|
+
FNodeComponent,
|
|
2997
|
+
FZoomDirective,
|
|
2998
|
+
FForeignObjectComponent,
|
|
2999
|
+
FDragHandleDirective,
|
|
3000
|
+
FItemsContainerDirective,
|
|
3001
|
+
FNodesContainerComponent,
|
|
3002
|
+
FConnectionsContainerComponent,
|
|
3003
|
+
FConnectionModule,
|
|
3004
|
+
FNodeInputDirective,
|
|
3005
|
+
FNodeOutletDirective,
|
|
3006
|
+
FNodeOutputDirective] }); }
|
|
3007
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FFlowModule, imports: [CommonModule,
|
|
3008
|
+
FConnectionModule, FConnectionModule] }); }
|
|
3009
|
+
}
|
|
3010
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: FFlowModule, decorators: [{
|
|
3011
|
+
type: NgModule,
|
|
3012
|
+
args: [{
|
|
3013
|
+
declarations: [
|
|
3014
|
+
FFlowComponent,
|
|
3015
|
+
FNodeComponent,
|
|
3016
|
+
FZoomDirective,
|
|
3017
|
+
FForeignObjectComponent,
|
|
3018
|
+
FDragHandleDirective,
|
|
3019
|
+
FItemsContainerDirective,
|
|
3020
|
+
FNodesContainerComponent,
|
|
3021
|
+
FConnectionsContainerComponent,
|
|
3022
|
+
FNodeInputDirective,
|
|
3023
|
+
FNodeOutletDirective,
|
|
3024
|
+
FNodeOutputDirective,
|
|
3025
|
+
],
|
|
3026
|
+
imports: [
|
|
3027
|
+
CommonModule,
|
|
3028
|
+
FConnectionModule,
|
|
3029
|
+
FCanvasDirective,
|
|
3030
|
+
FBackgroundDirective,
|
|
3031
|
+
],
|
|
3032
|
+
providers: [],
|
|
3033
|
+
exports: [
|
|
3034
|
+
FFlowComponent,
|
|
3035
|
+
FNodeComponent,
|
|
3036
|
+
FZoomDirective,
|
|
3037
|
+
FForeignObjectComponent,
|
|
3038
|
+
FDragHandleDirective,
|
|
3039
|
+
FItemsContainerDirective,
|
|
3040
|
+
FNodesContainerComponent,
|
|
3041
|
+
FConnectionsContainerComponent,
|
|
3042
|
+
FConnectionModule,
|
|
3043
|
+
FNodeInputDirective,
|
|
3044
|
+
FNodeOutletDirective,
|
|
3045
|
+
FNodeOutputDirective,
|
|
3046
|
+
]
|
|
3047
|
+
}]
|
|
3048
|
+
}] });
|
|
3049
|
+
|
|
3050
|
+
/**
|
|
3051
|
+
* Generated bundle index. Do not edit.
|
|
3052
|
+
*/
|
|
3053
|
+
|
|
3054
|
+
export { CONNECTION_MARKER_END, CONNECTION_MARKER_END_SELECTED, CONNECTION_MARKER_START, CONNECTION_MARKER_START_SELECTED, FCanvasDirective, FConnectIfIntersectDirective, FConnectionComponent, FConnectionModule, FConnectionsContainerComponent, FDragHandleDirective, FDraggableDirective, FExternalItemDirective, FFlowComponent, FFlowModule, FForeignObjectComponent, FItemsContainerDirective, FLineAlignmentDirective, FNodeComponent, FNodeInputDirective, FNodeOutletDirective, FNodeOutputDirective, FNodesContainerComponent, FSelectionDirective, FTempConnectionComponent, FZoomDirective, F_CONNECT_IF_INTERSECT, F_DRAG_HANDLE, F_LINE_ALIGNMENT, F_SELECTION, F_TEMP_CONNECTION_COMPONENT };
|
|
3055
|
+
//# sourceMappingURL=foblex-flow.mjs.map
|