@foblex/flow 1.5.0 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/domain/get-output-rect-in-flow/get-output-rect-in-flow-request.d.ts +4 -0
- package/domain/get-output-rect-in-flow/get-output-rect-in-flow-response.d.ts +7 -0
- package/domain/get-output-rect-in-flow/get-output-rect-in-flow.handler.d.ts +14 -0
- package/domain/get-output-rect-in-flow/index.d.ts +3 -0
- package/domain/index.d.ts +2 -1
- package/domain/providers.d.ts +3 -2
- package/domain/redraw-connections/index.d.ts +2 -0
- package/domain/redraw-connections/redraw-connections-request.d.ts +3 -0
- package/{f-flow/domain → domain}/redraw-connections/redraw-connections.handler.d.ts +8 -6
- package/esm2022/domain/get-connection-vector/get-connection-vector.handler.mjs +10 -3
- package/esm2022/domain/get-output-rect-in-flow/get-output-rect-in-flow-request.mjs +6 -0
- package/esm2022/domain/get-output-rect-in-flow/get-output-rect-in-flow-response.mjs +7 -0
- package/esm2022/domain/get-output-rect-in-flow/get-output-rect-in-flow.handler.mjs +33 -0
- package/esm2022/domain/get-output-rect-in-flow/index.mjs +4 -0
- package/esm2022/domain/index.mjs +3 -2
- package/esm2022/domain/providers.mjs +6 -4
- package/esm2022/domain/redraw-connections/index.mjs +3 -0
- package/esm2022/domain/redraw-connections/redraw-connections-request.mjs +5 -0
- package/esm2022/domain/redraw-connections/redraw-connections.handler.mjs +54 -0
- package/esm2022/f-canvas/f-canvas-base.mjs +3 -4
- package/esm2022/f-components-store.mjs +1 -1
- package/esm2022/f-connection/common/f-connection-base.mjs +5 -3
- package/esm2022/f-connection/common/f-path/f-connection-path.component.mjs +2 -2
- package/esm2022/f-connection/common/i-has-connection-from-to.mjs +1 -1
- package/esm2022/f-connection/common/mixins/change-connection-selection.mixin.mjs +1 -1
- package/esm2022/f-connection/common/mixins/change-connection-visibility.mixin.mjs +1 -1
- package/esm2022/f-connection/f-connection/f-connection.component.mjs +5 -5
- package/esm2022/f-connection/f-connection-for-create/f-connection-for-create.component.mjs +2 -2
- package/esm2022/f-connection/f-marker/f-marker.directive.mjs +2 -1
- package/esm2022/f-connectors/f-node-input/f-node-input.directive.mjs +3 -3
- package/esm2022/f-connectors/f-node-outlet/f-node-outlet.directive.mjs +3 -3
- package/esm2022/f-connectors/f-node-output/f-node-output.directive.mjs +3 -3
- package/esm2022/f-draggable/connections/create-connection/create-connection.drag-handler.mjs +6 -7
- package/esm2022/f-draggable/connections/create-connection/create-connection.on-pointer-up.mjs +3 -3
- package/esm2022/f-draggable/connections/create-connection/create-connection.prepare-drag-sequence.mjs +8 -8
- package/esm2022/f-draggable/connections/create-connection/f-create-connection.event.mjs +7 -0
- package/esm2022/f-draggable/connections/create-connection/index.mjs +2 -2
- package/esm2022/f-draggable/connections/reassign-connection/f-reassign-connection.event.mjs +9 -0
- package/esm2022/f-draggable/connections/reassign-connection/index.mjs +2 -2
- package/esm2022/f-draggable/connections/reassign-connection/reassign-connection.drag-handler.mjs +8 -9
- package/esm2022/f-draggable/connections/reassign-connection/reassign-connection.on-pointer-up.mjs +3 -3
- package/esm2022/f-draggable/connections/reassign-connection/reassign-connection.prepare-drag-sequence.mjs +7 -7
- package/esm2022/f-draggable/external-item/external-item.drag-handler.mjs +1 -1
- package/esm2022/f-draggable/external-item/external-item.on-pointer-up.mjs +3 -3
- package/esm2022/f-draggable/external-item/external-item.prepare-drag-sequence.mjs +3 -3
- package/esm2022/f-draggable/external-item/f-create-node.event.mjs +7 -0
- package/esm2022/f-draggable/external-item/index.mjs +2 -2
- package/esm2022/f-draggable/f-draggable-base.mjs +1 -1
- package/esm2022/f-draggable/f-draggable-data-context.mjs +1 -1
- package/esm2022/f-draggable/f-draggable.directive.mjs +3 -3
- package/esm2022/f-draggable/index.mjs +13 -0
- package/esm2022/f-draggable/node/connection-source.drag-handler.mjs +6 -7
- package/esm2022/f-draggable/node/connection-target.drag-handler.mjs +6 -7
- package/esm2022/f-draggable/node/connection.drag-handler.mjs +6 -7
- package/esm2022/f-draggable/node/node.prepare-drag-sequence.mjs +11 -11
- package/esm2022/f-draggable/single-select/f-selection-change-event.mjs +7 -0
- package/esm2022/f-draggable/single-select/index.mjs +2 -2
- package/esm2022/f-external-item/f-external-item-base.mjs +11 -0
- package/esm2022/f-external-item/f-external-item.directive.mjs +44 -0
- package/esm2022/f-external-item/f-external-item.service.mjs +28 -0
- package/esm2022/f-external-item/index.mjs +5 -0
- package/esm2022/f-external-item/is-external-item.mjs +7 -0
- package/esm2022/f-flow/f-flow.component.mjs +14 -20
- package/esm2022/f-flow/index.mjs +1 -2
- package/esm2022/f-flow.module.mjs +5 -4
- package/esm2022/f-line-alignment/domain/i-line-alignment-rect.mjs +2 -0
- package/esm2022/f-line-alignment/domain/i-line-alignment-result.mjs +2 -0
- package/esm2022/f-line-alignment/domain/i-nearest-coordinate-result.mjs +2 -0
- package/esm2022/f-line-alignment/domain/index.mjs +7 -0
- package/esm2022/f-line-alignment/domain/line-element.mjs +23 -0
- package/esm2022/f-line-alignment/domain/line-service.mjs +33 -0
- package/esm2022/f-line-alignment/domain/nearest-coordinate.mjs +100 -0
- package/esm2022/f-line-alignment/f-line-alignment-base.mjs +11 -0
- package/esm2022/f-line-alignment/f-line-alignment.component.mjs +90 -0
- package/esm2022/f-line-alignment/index.mjs +4 -0
- package/esm2022/f-mediator/f-flow-mediator.mjs +24 -0
- package/esm2022/f-mediator/f-handler-register.mjs +7 -0
- package/esm2022/f-mediator/index.mjs +3 -0
- package/esm2022/f-node/f-node.directive.mjs +3 -3
- package/esm2022/f-selection-area/domain/i-selection-area-rect.mjs +2 -0
- package/esm2022/f-selection-area/domain/index.mjs +2 -0
- package/esm2022/f-selection-area/f-selection-area-base.mjs +11 -0
- package/esm2022/f-selection-area/f-selection-area.component.mjs +44 -0
- package/esm2022/f-selection-area/index.mjs +4 -0
- package/esm2022/public-api.mjs +6 -3
- package/f-canvas/f-canvas-base.d.ts +3 -4
- package/f-components-store.d.ts +1 -1
- package/f-connection/common/f-connection-base.d.ts +2 -2
- package/f-connection/common/i-has-connection-from-to.d.ts +1 -1
- package/f-connection/common/mixins/change-connection-selection.mixin.d.ts +1 -2
- package/f-connection/common/mixins/change-connection-visibility.mixin.d.ts +1 -2
- package/f-connection/f-connection/f-connection.component.d.ts +2 -2
- package/f-connection/f-connection-for-create/f-connection-for-create.component.d.ts +1 -1
- package/f-draggable/connections/create-connection/create-connection.drag-handler.d.ts +3 -4
- package/f-draggable/connections/create-connection/create-connection.prepare-drag-sequence.d.ts +4 -4
- package/f-draggable/connections/create-connection/f-create-connection.event.d.ts +5 -0
- package/f-draggable/connections/create-connection/index.d.ts +1 -1
- package/f-draggable/connections/reassign-connection/f-reassign-connection.event.d.ts +7 -0
- package/f-draggable/connections/reassign-connection/index.d.ts +1 -1
- package/f-draggable/connections/reassign-connection/reassign-connection.drag-handler.d.ts +4 -4
- package/f-draggable/connections/reassign-connection/reassign-connection.prepare-drag-sequence.d.ts +4 -4
- package/f-draggable/external-item/external-item.drag-handler.d.ts +1 -1
- package/f-draggable/external-item/external-item.prepare-drag-sequence.d.ts +1 -1
- package/f-draggable/external-item/{create-node.event.d.ts → f-create-node.event.d.ts} +1 -1
- package/f-draggable/external-item/index.d.ts +1 -1
- package/f-draggable/f-draggable-base.d.ts +8 -8
- package/f-draggable/f-draggable-data-context.d.ts +2 -1
- package/f-draggable/f-draggable.directive.d.ts +7 -7
- package/f-draggable/{public-api.d.ts → index.d.ts} +0 -1
- package/f-draggable/node/connection-source.drag-handler.d.ts +4 -4
- package/f-draggable/node/connection-target.drag-handler.d.ts +4 -4
- package/f-draggable/node/connection.drag-handler.d.ts +4 -4
- package/f-draggable/node/node.prepare-drag-sequence.d.ts +4 -4
- package/f-draggable/single-select/{selection-change-event.d.ts → f-selection-change-event.d.ts} +1 -1
- package/f-draggable/single-select/index.d.ts +1 -1
- package/f-flow/f-flow.component.d.ts +3 -3
- package/f-flow/index.d.ts +0 -1
- package/f-flow.module.d.ts +3 -3
- package/{f-draggable/components/f-line-alignment → f-line-alignment}/f-line-alignment-base.d.ts +1 -1
- package/{f-draggable/components/f-line-alignment → f-line-alignment}/f-line-alignment.component.d.ts +4 -4
- package/f-mediator/f-flow-mediator.d.ts +12 -0
- package/f-mediator/f-handler-register.d.ts +5 -0
- package/f-mediator/index.d.ts +2 -0
- package/{f-draggable/components/f-selection-area → f-selection-area}/f-selection-area.component.d.ts +1 -1
- package/fesm2022/foblex-flow.mjs +1100 -1135
- package/fesm2022/foblex-flow.mjs.map +1 -1
- package/package.json +2 -2
- package/public-api.d.ts +5 -2
- package/common-behaviours/change-position.d.ts +0 -10
- package/common-behaviours/change-zoom/change-zoom.d.ts +0 -6
- package/common-behaviours/change-zoom/i-can-change-zoom.d.ts +0 -6
- package/common-behaviours/change-zoom/index.d.ts +0 -2
- package/common-behaviours/constructor.d.ts +0 -2
- package/common-behaviours/fit-to-parent/fit-to-parent.d.ts +0 -6
- package/common-behaviours/fit-to-parent/i-can-fit-to-parent.d.ts +0 -4
- package/common-behaviours/fit-to-parent/index.d.ts +0 -2
- package/common-behaviours/i-transformable.d.ts +0 -4
- package/common-behaviours/index.d.ts +0 -6
- package/common-behaviours/one-to-one-centering/i-can-one-to-one-centering.d.ts +0 -4
- package/common-behaviours/one-to-one-centering/index.d.ts +0 -2
- package/common-behaviours/one-to-one-centering/one-to-one-centering.d.ts +0 -6
- package/domain/get-output-rect-in-flow.handler.d.ts +0 -19
- package/esm2022/common-behaviours/change-position.mjs +0 -15
- package/esm2022/common-behaviours/change-zoom/change-zoom.mjs +0 -25
- package/esm2022/common-behaviours/change-zoom/i-can-change-zoom.mjs +0 -2
- package/esm2022/common-behaviours/change-zoom/index.mjs +0 -3
- package/esm2022/common-behaviours/constructor.mjs +0 -2
- package/esm2022/common-behaviours/fit-to-parent/fit-to-parent.mjs +0 -27
- package/esm2022/common-behaviours/fit-to-parent/i-can-fit-to-parent.mjs +0 -2
- package/esm2022/common-behaviours/fit-to-parent/index.mjs +0 -3
- package/esm2022/common-behaviours/i-transformable.mjs +0 -2
- package/esm2022/common-behaviours/index.mjs +0 -7
- package/esm2022/common-behaviours/one-to-one-centering/i-can-one-to-one-centering.mjs +0 -2
- package/esm2022/common-behaviours/one-to-one-centering/index.mjs +0 -3
- package/esm2022/common-behaviours/one-to-one-centering/one-to-one-centering.mjs +0 -24
- package/esm2022/domain/get-output-rect-in-flow.handler.mjs +0 -25
- package/esm2022/f-draggable/components/f-external-item/f-external-item-base.mjs +0 -11
- package/esm2022/f-draggable/components/f-external-item/f-external-item.directive.mjs +0 -44
- package/esm2022/f-draggable/components/f-external-item/f-external-item.service.mjs +0 -28
- package/esm2022/f-draggable/components/f-external-item/index.mjs +0 -5
- package/esm2022/f-draggable/components/f-external-item/is-external-item.mjs +0 -7
- package/esm2022/f-draggable/components/f-line-alignment/domain/i-line-alignment-rect.mjs +0 -2
- package/esm2022/f-draggable/components/f-line-alignment/domain/i-line-alignment-result.mjs +0 -2
- package/esm2022/f-draggable/components/f-line-alignment/domain/i-nearest-coordinate-result.mjs +0 -2
- package/esm2022/f-draggable/components/f-line-alignment/domain/index.mjs +0 -7
- package/esm2022/f-draggable/components/f-line-alignment/domain/line-element.mjs +0 -23
- package/esm2022/f-draggable/components/f-line-alignment/domain/line-service.mjs +0 -33
- package/esm2022/f-draggable/components/f-line-alignment/domain/nearest-coordinate.mjs +0 -100
- package/esm2022/f-draggable/components/f-line-alignment/f-line-alignment-base.mjs +0 -11
- package/esm2022/f-draggable/components/f-line-alignment/f-line-alignment.component.mjs +0 -90
- package/esm2022/f-draggable/components/f-line-alignment/index.mjs +0 -4
- package/esm2022/f-draggable/components/f-selection-area/domain/i-selection-area-rect.mjs +0 -2
- package/esm2022/f-draggable/components/f-selection-area/domain/index.mjs +0 -2
- package/esm2022/f-draggable/components/f-selection-area/f-selection-area-base.mjs +0 -11
- package/esm2022/f-draggable/components/f-selection-area/f-selection-area.component.mjs +0 -44
- package/esm2022/f-draggable/components/f-selection-area/index.mjs +0 -4
- package/esm2022/f-draggable/components/index.mjs +0 -4
- package/esm2022/f-draggable/connections/create-connection/create-connection.event.mjs +0 -7
- package/esm2022/f-draggable/connections/reassign-connection/reassign-connection.event.mjs +0 -9
- package/esm2022/f-draggable/external-item/create-node.event.mjs +0 -7
- package/esm2022/f-draggable/public-api.mjs +0 -14
- package/esm2022/f-draggable/single-select/selection-change-event.mjs +0 -7
- package/esm2022/f-flow/domain/redraw-connections/redraw-connections.handler.mjs +0 -46
- package/f-draggable/components/index.d.ts +0 -3
- package/f-draggable/connections/create-connection/create-connection.event.d.ts +0 -5
- package/f-draggable/connections/reassign-connection/reassign-connection.event.d.ts +0 -7
- /package/{f-draggable/components/f-external-item → f-external-item}/f-external-item-base.d.ts +0 -0
- /package/{f-draggable/components/f-external-item → f-external-item}/f-external-item.directive.d.ts +0 -0
- /package/{f-draggable/components/f-external-item → f-external-item}/f-external-item.service.d.ts +0 -0
- /package/{f-draggable/components/f-external-item → f-external-item}/index.d.ts +0 -0
- /package/{f-draggable/components/f-external-item → f-external-item}/is-external-item.d.ts +0 -0
- /package/{f-draggable/components/f-line-alignment → f-line-alignment}/domain/i-line-alignment-rect.d.ts +0 -0
- /package/{f-draggable/components/f-line-alignment → f-line-alignment}/domain/i-line-alignment-result.d.ts +0 -0
- /package/{f-draggable/components/f-line-alignment → f-line-alignment}/domain/i-nearest-coordinate-result.d.ts +0 -0
- /package/{f-draggable/components/f-line-alignment → f-line-alignment}/domain/index.d.ts +0 -0
- /package/{f-draggable/components/f-line-alignment → f-line-alignment}/domain/line-element.d.ts +0 -0
- /package/{f-draggable/components/f-line-alignment → f-line-alignment}/domain/line-service.d.ts +0 -0
- /package/{f-draggable/components/f-line-alignment → f-line-alignment}/domain/nearest-coordinate.d.ts +0 -0
- /package/{f-draggable/components/f-line-alignment → f-line-alignment}/index.d.ts +0 -0
- /package/{f-draggable/components/f-selection-area → f-selection-area}/domain/i-selection-area-rect.d.ts +0 -0
- /package/{f-draggable/components/f-selection-area → f-selection-area}/domain/index.d.ts +0 -0
- /package/{f-draggable/components/f-selection-area → f-selection-area}/f-selection-area-base.d.ts +0 -0
- /package/{f-draggable/components/f-selection-area → f-selection-area}/index.d.ts +0 -0
package/fesm2022/foblex-flow.mjs
CHANGED
|
@@ -1,96 +1,10 @@
|
|
|
1
|
-
import { PointExtensions, TransformModelExtensions, DomElementExtensions, RectExtensions, BooleanExtensions, sanitizeElementId, Point, GuidExtensions, VectorExtensions, EventExtensions, SizeExtensions, MouseEventExtensions, IMouseEvent, ITouchDownEvent, ITouchMoveEvent, ITouchUpEvent } from '@foblex/core';
|
|
2
1
|
import * as i0 from '@angular/core';
|
|
3
2
|
import { InjectionToken, Component, ChangeDetectionStrategy, Input, Directive, Injectable, ContentChild, Inject, ViewChild, ContentChildren, Optional, SkipSelf, EventEmitter, Output, NgModule } from '@angular/core';
|
|
3
|
+
import { TransformModelExtensions, DomElementExtensions, PointExtensions, RectExtensions, BooleanExtensions, sanitizeElementId, Point, GuidExtensions, VectorExtensions, EventExtensions, mixinChangePosition, mixinFitToParent, mixinOneToOneCentering, mixinChangeZoom, SizeExtensions, MouseEventExtensions, IMouseEvent, ITouchDownEvent, ITouchMoveEvent, ITouchUpEvent } from '@foblex/core';
|
|
4
4
|
import { Subject, Observable, Subscription, startWith, debounceTime } from 'rxjs';
|
|
5
|
+
import { __decorate } from 'tslib';
|
|
5
6
|
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
6
7
|
|
|
7
|
-
function mixinChangeZoom(base) {
|
|
8
|
-
return class extends base {
|
|
9
|
-
setZoom(scaleValue, toPosition) {
|
|
10
|
-
if (scaleValue !== this.transform.scale) {
|
|
11
|
-
const summaryPosition = PointExtensions.sum(this.transform.scaledPosition, this.transform.position);
|
|
12
|
-
const newX = toPosition.x - (toPosition.x - summaryPosition.x) * scaleValue / this.transform.scale;
|
|
13
|
-
const newY = toPosition.y - (toPosition.y - summaryPosition.y) * scaleValue / this.transform.scale;
|
|
14
|
-
this.transform.scale = scaleValue;
|
|
15
|
-
this.transform.scaledPosition = PointExtensions.sub(PointExtensions.initialize(newX, newY), this.transform.position);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
setScalePosition(value) {
|
|
19
|
-
this.transform.scaledPosition = value;
|
|
20
|
-
}
|
|
21
|
-
resetZoom() {
|
|
22
|
-
this.transform.scale = 1;
|
|
23
|
-
this.transform.scaledPosition = PointExtensions.initialize();
|
|
24
|
-
}
|
|
25
|
-
constructor(...args) {
|
|
26
|
-
super(...args);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function mixinFitToParent(base) {
|
|
32
|
-
return class extends base {
|
|
33
|
-
fitToParent(rect, parentRect, points) {
|
|
34
|
-
this.transform.scaledPosition = PointExtensions.initialize();
|
|
35
|
-
this.transform.position = this.getZeroPositionWithoutScale(points);
|
|
36
|
-
const itemsContainerWidth = rect.width / this.transform.scale;
|
|
37
|
-
const itemsContainerHeight = rect.height / this.transform.scale;
|
|
38
|
-
if ((itemsContainerWidth > parentRect.width || itemsContainerHeight > parentRect.height) ||
|
|
39
|
-
itemsContainerWidth < parentRect.width && itemsContainerHeight < parentRect.height) {
|
|
40
|
-
this.transform.scale = Math.min(parentRect.width / itemsContainerWidth, parentRect.height / itemsContainerHeight);
|
|
41
|
-
}
|
|
42
|
-
const newX = (parentRect.width - itemsContainerWidth * this.transform.scale) / 2 - this.transform.position.x * this.transform.scale;
|
|
43
|
-
const newY = (parentRect.height - itemsContainerHeight * this.transform.scale) / 2 - this.transform.position.y * this.transform.scale;
|
|
44
|
-
this.transform.position = PointExtensions.initialize(newX, newY);
|
|
45
|
-
}
|
|
46
|
-
getZeroPositionWithoutScale(points) {
|
|
47
|
-
const xPoint = points.length ? Math.min(...points.map((point) => point.x)) : 0;
|
|
48
|
-
const yPoint = points.length ? Math.min(...points.map((point) => point.y)) : 0;
|
|
49
|
-
return PointExtensions.initialize(xPoint, yPoint);
|
|
50
|
-
}
|
|
51
|
-
constructor(...args) {
|
|
52
|
-
super(...args);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function mixinOneToOneCentering(base) {
|
|
58
|
-
return class extends base {
|
|
59
|
-
oneToOneCentering(rect, parentRect, points) {
|
|
60
|
-
this.transform.scaledPosition = PointExtensions.initialize();
|
|
61
|
-
this.transform.position = this.getZeroPositionWithoutScale(points);
|
|
62
|
-
const itemsContainerWidth = rect.width / this.transform.scale;
|
|
63
|
-
const itemsContainerHeight = rect.height / this.transform.scale;
|
|
64
|
-
this.transform.scale = 1;
|
|
65
|
-
const newX = (parentRect.width - itemsContainerWidth * this.transform.scale) / 2 - this.transform.position.x * this.transform.scale;
|
|
66
|
-
const newY = (parentRect.height - itemsContainerHeight * this.transform.scale) / 2 - this.transform.position.y * this.transform.scale;
|
|
67
|
-
this.transform.position = PointExtensions.initialize(newX, newY);
|
|
68
|
-
}
|
|
69
|
-
getZeroPositionWithoutScale(points) {
|
|
70
|
-
const xPoint = points.length ? Math.min(...points.map((point) => point.x)) : 0;
|
|
71
|
-
const yPoint = points.length ? Math.min(...points.map((point) => point.y)) : 0;
|
|
72
|
-
return PointExtensions.initialize(xPoint, yPoint);
|
|
73
|
-
}
|
|
74
|
-
constructor(...args) {
|
|
75
|
-
super(...args);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function mixinChangePosition(base) {
|
|
81
|
-
return class extends base {
|
|
82
|
-
getPosition() {
|
|
83
|
-
return this.transform.position;
|
|
84
|
-
}
|
|
85
|
-
setPosition(position) {
|
|
86
|
-
this.transform.position = PointExtensions.copy(position);
|
|
87
|
-
}
|
|
88
|
-
constructor(...args) {
|
|
89
|
-
super(...args);
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
|
|
94
8
|
const F_BACKGROUND_PATTERN = new InjectionToken('F_BACKGROUND_PATTERN');
|
|
95
9
|
|
|
96
10
|
let uniqueId$9 = 0;
|
|
@@ -504,7 +418,7 @@ class FNodeInputDirective extends FNodeInputBase {
|
|
|
504
418
|
this.fComponentsStore.removeInput(this);
|
|
505
419
|
}
|
|
506
420
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FNodeInputDirective, deps: [{ token: i0.ElementRef }, { token: F_NODE }, { token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
507
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.1", type: FNodeInputDirective, selector: "[fNodeInput]", inputs: { id: ["fInputId", "id"], multiple: ["fInputMultiple", "multiple"], disabled: ["fInputDisabled", "disabled"], _fConnectableSide: ["fInputConnectableSide", "_fConnectableSide"] }, 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, useExisting: FNodeInputDirective }], exportAs: ["fNodeInput"], usesInheritance: true, ngImport: i0 }); }
|
|
421
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.1", type: FNodeInputDirective, selector: "[fNodeInput]", inputs: { id: ["fInputId", "id"], multiple: ["fInputMultiple", "multiple"], disabled: ["fInputDisabled", "disabled"], _fConnectableSide: ["fInputConnectableSide", "_fConnectableSide"] }, host: { properties: { "attr.data-f-input-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, useExisting: FNodeInputDirective }], exportAs: ["fNodeInput"], usesInheritance: true, ngImport: i0 }); }
|
|
508
422
|
}
|
|
509
423
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FNodeInputDirective, decorators: [{
|
|
510
424
|
type: Directive,
|
|
@@ -512,7 +426,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImpor
|
|
|
512
426
|
selector: "[fNodeInput]",
|
|
513
427
|
exportAs: 'fNodeInput',
|
|
514
428
|
host: {
|
|
515
|
-
'[attr.id]': 'id',
|
|
429
|
+
'[attr.data-f-input-id]': 'id',
|
|
516
430
|
class: "f-component f-node-input",
|
|
517
431
|
'[class.f-node-input-multiple]': 'multiple',
|
|
518
432
|
'[class.f-node-input-disabled]': 'disabled',
|
|
@@ -597,7 +511,7 @@ class FNodeOutletDirective extends FNodeOutletBase {
|
|
|
597
511
|
this.fComponentsStore.removeOutlet(this);
|
|
598
512
|
}
|
|
599
513
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FNodeOutletDirective, deps: [{ token: i0.ElementRef }, { token: F_NODE }, { token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
600
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.1", type: FNodeOutletDirective, selector: "[fNodeOutlet]", inputs: { id: ["fOutletId", "id"], disabled: ["fOutletDisabled", "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, useExisting: FNodeOutletDirective }], exportAs: ["fNodeOutlet"], usesInheritance: true, ngImport: i0 }); }
|
|
514
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.1", type: FNodeOutletDirective, selector: "[fNodeOutlet]", inputs: { id: ["fOutletId", "id"], disabled: ["fOutletDisabled", "disabled"], isConnectionFromOutlet: "isConnectionFromOutlet" }, host: { properties: { "attr.data-f-outlet-id": "id", "class.f-node-outlet-disabled": "disabled" }, classAttribute: "f-component f-node-outlet" }, providers: [{ provide: F_NODE_OUTLET, useExisting: FNodeOutletDirective }], exportAs: ["fNodeOutlet"], usesInheritance: true, ngImport: i0 }); }
|
|
601
515
|
}
|
|
602
516
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FNodeOutletDirective, decorators: [{
|
|
603
517
|
type: Directive,
|
|
@@ -605,7 +519,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImpor
|
|
|
605
519
|
selector: "[fNodeOutlet]",
|
|
606
520
|
exportAs: 'fNodeOutlet',
|
|
607
521
|
host: {
|
|
608
|
-
'[attr.id]': 'id',
|
|
522
|
+
'[attr.data-f-outlet-id]': 'id',
|
|
609
523
|
class: "f-component f-node-outlet",
|
|
610
524
|
'[class.f-node-outlet-disabled]': 'disabled'
|
|
611
525
|
},
|
|
@@ -685,7 +599,7 @@ class FNodeOutputDirective extends FNodeOutputBase {
|
|
|
685
599
|
this.fComponentsStore.removeOutput(this);
|
|
686
600
|
}
|
|
687
601
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FNodeOutputDirective, deps: [{ token: i0.ElementRef }, { token: F_NODE }, { token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
688
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.1", type: FNodeOutputDirective, selector: "[fNodeOutput]", inputs: { id: ["fOutputId", "id"], disabled: ["fOutputDisabled", "disabled"], _fConnectableSide: ["fOutputConnectableSide", "_fConnectableSide"] }, host: { properties: { "attr.id": "id", "class.f-node-output-disabled": "disabled" }, classAttribute: "f-component f-node-output" }, providers: [{ provide: F_NODE_OUTPUT, useExisting: FNodeOutputDirective }], exportAs: ["fNodeOutput"], usesInheritance: true, ngImport: i0 }); }
|
|
602
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.1", type: FNodeOutputDirective, selector: "[fNodeOutput]", inputs: { id: ["fOutputId", "id"], disabled: ["fOutputDisabled", "disabled"], _fConnectableSide: ["fOutputConnectableSide", "_fConnectableSide"] }, host: { properties: { "attr.data-f-output-id": "id", "class.f-node-output-disabled": "disabled" }, classAttribute: "f-component f-node-output" }, providers: [{ provide: F_NODE_OUTPUT, useExisting: FNodeOutputDirective }], exportAs: ["fNodeOutput"], usesInheritance: true, ngImport: i0 }); }
|
|
689
603
|
}
|
|
690
604
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FNodeOutputDirective, decorators: [{
|
|
691
605
|
type: Directive,
|
|
@@ -693,7 +607,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImpor
|
|
|
693
607
|
selector: "[fNodeOutput]",
|
|
694
608
|
exportAs: 'fNodeOutput',
|
|
695
609
|
host: {
|
|
696
|
-
'[attr.id]': 'id',
|
|
610
|
+
'[attr.data-f-output-id]': 'id',
|
|
697
611
|
class: "f-component f-node-output",
|
|
698
612
|
'[class.f-node-output-disabled]': 'disabled',
|
|
699
613
|
},
|
|
@@ -1164,6 +1078,7 @@ class FMarkerDirective extends FMarkerBase {
|
|
|
1164
1078
|
this.refX = 0;
|
|
1165
1079
|
this.refY = 0;
|
|
1166
1080
|
this.type = EFMarkerType.START;
|
|
1081
|
+
this.hostElement.style.display = 'none';
|
|
1167
1082
|
}
|
|
1168
1083
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FMarkerDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1169
1084
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.1", type: FMarkerDirective, isStandalone: true, selector: "svg[fMarker]", inputs: { hostElement: "hostElement", width: "width", height: "height", refX: "refX", refY: "refY", type: "type" }, host: { classAttribute: "f-component f-marker" }, providers: [{ provide: F_MARKER, useExisting: FMarkerDirective }], usesInheritance: true, ngImport: i0 }); }
|
|
@@ -1221,7 +1136,7 @@ class FConnectionPathComponent {
|
|
|
1221
1136
|
this.hostElement.setAttribute('marker-end', `url(#${this.getMarkerId(EFMarkerType.END)})`);
|
|
1222
1137
|
}
|
|
1223
1138
|
getMarkerId(type) {
|
|
1224
|
-
return sanitizeElementId(`${getFlowUid()}-${type}-${this.base.
|
|
1139
|
+
return sanitizeElementId(`${getFlowUid()}-${type}-${this.base.fConnectionId}`);
|
|
1225
1140
|
}
|
|
1226
1141
|
isSelected() {
|
|
1227
1142
|
return this.hostElement.getAttribute('marker-start') === `url(#${this.getMarkerId(EFMarkerType.SELECTED_START)})`;
|
|
@@ -1360,7 +1275,7 @@ class FConnectionBase extends MIXIN_BASE$1 {
|
|
|
1360
1275
|
this.fDefs.nativeElement.innerHTML = '';
|
|
1361
1276
|
this.fMarkers.forEach((marker) => {
|
|
1362
1277
|
const markerElement = DomElementExtensions.createSvgElement('marker');
|
|
1363
|
-
markerElement.setAttribute('id', getFlowUid() + '-' + marker.type + '-' + this.
|
|
1278
|
+
markerElement.setAttribute('id', getFlowUid() + '-' + marker.type + '-' + this.fConnectionId);
|
|
1364
1279
|
markerElement.setAttribute('markerHeight', `${marker.height}`);
|
|
1365
1280
|
markerElement.setAttribute('markerWidth', `${marker.width}`);
|
|
1366
1281
|
markerElement.setAttribute('orient', 'auto');
|
|
@@ -1369,7 +1284,9 @@ class FConnectionBase extends MIXIN_BASE$1 {
|
|
|
1369
1284
|
markerElement.setAttribute('markerUnits', 'strokeWidth');
|
|
1370
1285
|
marker.hostElement.setAttribute('height', `${marker.height}`);
|
|
1371
1286
|
marker.hostElement.setAttribute('width', `${marker.width}`);
|
|
1372
|
-
|
|
1287
|
+
const clone = marker.hostElement.cloneNode(true);
|
|
1288
|
+
clone.style.display = 'unset';
|
|
1289
|
+
markerElement.append(clone);
|
|
1373
1290
|
this.fDefs.nativeElement.append(markerElement);
|
|
1374
1291
|
});
|
|
1375
1292
|
this.fMarkers.forEach((marker) => {
|
|
@@ -1432,7 +1349,7 @@ class FConnectionForCreateComponent extends FConnectionBase {
|
|
|
1432
1349
|
constructor(elementReference, fComponentsStore) {
|
|
1433
1350
|
super(elementReference);
|
|
1434
1351
|
this.fComponentsStore = fComponentsStore;
|
|
1435
|
-
this.
|
|
1352
|
+
this.fConnectionId = `f-connection-for-create-${uniqueId$4++}`;
|
|
1436
1353
|
this.fText = '';
|
|
1437
1354
|
this.fStartColor = 'black';
|
|
1438
1355
|
this.fEndColor = 'black';
|
|
@@ -1515,7 +1432,7 @@ class FConnectionComponent extends FConnectionBase {
|
|
|
1515
1432
|
constructor(elementReference, fComponentsStore) {
|
|
1516
1433
|
super(elementReference);
|
|
1517
1434
|
this.fComponentsStore = fComponentsStore;
|
|
1518
|
-
this.
|
|
1435
|
+
this.fConnectionId = `f-connection-${uniqueId$3++}`;
|
|
1519
1436
|
this.fText = '';
|
|
1520
1437
|
this.fStartColor = 'black';
|
|
1521
1438
|
this.fEndColor = 'black';
|
|
@@ -1530,16 +1447,16 @@ class FConnectionComponent extends FConnectionBase {
|
|
|
1530
1447
|
this.fComponentsStore.removeConnection(this);
|
|
1531
1448
|
}
|
|
1532
1449
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FConnectionComponent, deps: [{ token: i0.ElementRef }, { token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1533
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "17.2.1", type: FConnectionComponent, selector: "f-connection", inputs: {
|
|
1450
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "17.2.1", type: FConnectionComponent, selector: "f-connection", inputs: { fConnectionId: "fConnectionId", fText: "fText", fStartColor: "fStartColor", fEndColor: "fEndColor", fOutputId: "fOutputId", fInputId: "fInputId", fBehavior: ["fBehavior", "fBehavior", castToConnectionBehavior], fType: ["fType", "fType", castToConnectionType], disabled: "disabled" }, host: { properties: { "attr.id": "fConnectionId", "class.f-connection-disabled": "disabled" }, classAttribute: "f-component f-connection" }, providers: [{ provide: F_CONNECTION, useExisting: FConnectionComponent }], queries: [{ propertyName: "fMarkers", predicate: F_MARKER, descendants: true }], viewQueries: [{ propertyName: "fDefs", first: true, predicate: ["defs"], descendants: true, static: true }, { propertyName: "fPath", first: true, predicate: CONNECTION_PATH, descendants: true, static: true }, { propertyName: "fGradient", first: true, predicate: CONNECTION_GRADIENT, descendants: true, static: true }, { propertyName: "fDragHandle", first: true, predicate: FConnectionDragHandleComponent, descendants: true, static: true }, { propertyName: "fSelection", first: true, predicate: FConnectionSelectionComponent, descendants: true, static: true }, { propertyName: "fTextComponent", first: true, predicate: CONNECTION_TEXT, descendants: true, static: true }, { propertyName: "fConnectionCenter", first: true, predicate: ["fConnectionCenter"], descendants: true, static: true }], exportAs: ["fComponent"], usesInheritance: true, ngImport: i0, template: "<svg xmlns=\"http://www.w3.org/2000/svg\" style=\"overflow: visible; display: block; vertical-align: middle;\">\n <defs #defs></defs>\n <g class=\"f-connection-group\">\n <linearGradient fConnectionGradient></linearGradient>\n <path fConnectionSelection [attr.d]=\"path\"></path>\n <g>\n <path f-connection-path\n [attr.d]=\"path\">\n </path>\n <circle f-connection-drag-handle r=\"8\"></circle>\n </g>\n <text f-connection-text></text>\n </g>\n <ng-content></ng-content>\n</svg>\n<div #fConnectionCenter class=\"f-connection-center\">\n <ng-content select=\"[fConnectionCenter]\"></ng-content>\n</div>\n", styles: [":host{pointer-events:none;position:absolute}:host svg{overflow:visible}:host svg .f-connection-group{pointer-events:all}\n"], dependencies: [{ kind: "component", type: FConnectionDragHandleComponent, selector: "circle[f-connection-drag-handle]" }, { kind: "component", type: FConnectionGradientComponent, selector: "linearGradient[fConnectionGradient]" }, { kind: "component", type: FConnectionPathComponent, selector: "path[f-connection-path]" }, { kind: "component", type: FConnectionTextComponent, selector: "text[f-connection-text]" }, { kind: "component", type: FConnectionSelectionComponent, selector: "path[fConnectionSelection]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1534
1451
|
}
|
|
1535
1452
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FConnectionComponent, decorators: [{
|
|
1536
1453
|
type: Component,
|
|
1537
1454
|
args: [{ selector: "f-connection", exportAs: 'fComponent', changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1538
|
-
'[attr.id]': '
|
|
1455
|
+
'[attr.id]': 'fConnectionId',
|
|
1539
1456
|
class: "f-component f-connection",
|
|
1540
1457
|
'[class.f-connection-disabled]': 'disabled',
|
|
1541
1458
|
}, providers: [{ provide: F_CONNECTION, useExisting: FConnectionComponent }], template: "<svg xmlns=\"http://www.w3.org/2000/svg\" style=\"overflow: visible; display: block; vertical-align: middle;\">\n <defs #defs></defs>\n <g class=\"f-connection-group\">\n <linearGradient fConnectionGradient></linearGradient>\n <path fConnectionSelection [attr.d]=\"path\"></path>\n <g>\n <path f-connection-path\n [attr.d]=\"path\">\n </path>\n <circle f-connection-drag-handle r=\"8\"></circle>\n </g>\n <text f-connection-text></text>\n </g>\n <ng-content></ng-content>\n</svg>\n<div #fConnectionCenter class=\"f-connection-center\">\n <ng-content select=\"[fConnectionCenter]\"></ng-content>\n</div>\n", styles: [":host{pointer-events:none;position:absolute}:host svg{overflow:visible}:host svg .f-connection-group{pointer-events:all}\n"] }]
|
|
1542
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: FComponentsStore }], propDecorators: {
|
|
1459
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: FComponentsStore }], propDecorators: { fConnectionId: [{
|
|
1543
1460
|
type: Input
|
|
1544
1461
|
}], fText: [{
|
|
1545
1462
|
type: Input
|
|
@@ -1778,7 +1695,7 @@ class FNodeDirective extends FNodeBase {
|
|
|
1778
1695
|
this.subscriptions$.unsubscribe();
|
|
1779
1696
|
}
|
|
1780
1697
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FNodeDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1781
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.1", type: FNodeDirective, selector: "[fNode]", inputs: { fNodeId: "fNodeId", position: ["fNodePosition", "position"], disabled: "disabled" }, outputs: { positionChange: "fNodePositionChange" }, host: { properties: { "attr.id": "fNodeId", "class.f-node-disabled": "disabled" }, classAttribute: "f-node f-component" }, providers: [
|
|
1698
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.1", type: FNodeDirective, selector: "[fNode]", inputs: { fNodeId: "fNodeId", position: ["fNodePosition", "position"], disabled: "disabled" }, outputs: { positionChange: "fNodePositionChange" }, host: { properties: { "attr.data-f-node-id": "fNodeId", "class.f-node-disabled": "disabled" }, classAttribute: "f-node f-component" }, providers: [
|
|
1782
1699
|
{ provide: F_NODE, useExisting: FNodeDirective }
|
|
1783
1700
|
], exportAs: ["fComponent"], usesInheritance: true, ngImport: i0 }); }
|
|
1784
1701
|
}
|
|
@@ -1788,7 +1705,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImpor
|
|
|
1788
1705
|
selector: "[fNode]",
|
|
1789
1706
|
exportAs: "fComponent",
|
|
1790
1707
|
host: {
|
|
1791
|
-
'[attr.id]': 'fNodeId',
|
|
1708
|
+
'[attr.data-f-node-id]': 'fNodeId',
|
|
1792
1709
|
class: "f-node f-component",
|
|
1793
1710
|
'[class.f-node-disabled]': 'disabled'
|
|
1794
1711
|
},
|
|
@@ -1978,7 +1895,45 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImpor
|
|
|
1978
1895
|
type: Directive
|
|
1979
1896
|
}], ctorParameters: () => [] });
|
|
1980
1897
|
|
|
1981
|
-
class
|
|
1898
|
+
class GetConnectionVectorRequest {
|
|
1899
|
+
constructor(outputRect, inputRect, behavior, outputSide, inputSide) {
|
|
1900
|
+
this.outputRect = outputRect;
|
|
1901
|
+
this.inputRect = inputRect;
|
|
1902
|
+
this.behavior = behavior;
|
|
1903
|
+
this.outputSide = outputSide;
|
|
1904
|
+
this.inputSide = inputSide;
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
class FFlowMediator {
|
|
1909
|
+
constructor(injector) {
|
|
1910
|
+
this.injector = injector;
|
|
1911
|
+
}
|
|
1912
|
+
static { this.handlers = new Map(); }
|
|
1913
|
+
static register(type, handler) {
|
|
1914
|
+
this.handlers.set(type.name, handler);
|
|
1915
|
+
}
|
|
1916
|
+
send(request) {
|
|
1917
|
+
const handler = FFlowMediator.handlers.get(request.constructor.name);
|
|
1918
|
+
if (!handler) {
|
|
1919
|
+
throw new Error('Handler not registered for request type.');
|
|
1920
|
+
}
|
|
1921
|
+
return this.injector.get(handler).handle(request);
|
|
1922
|
+
}
|
|
1923
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FFlowMediator, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1924
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FFlowMediator }); }
|
|
1925
|
+
}
|
|
1926
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FFlowMediator, decorators: [{
|
|
1927
|
+
type: Injectable
|
|
1928
|
+
}], ctorParameters: () => [{ type: i0.Injector }] });
|
|
1929
|
+
|
|
1930
|
+
function FHandlerRegister(requestType) {
|
|
1931
|
+
return function (constructor) {
|
|
1932
|
+
FFlowMediator.register(requestType, constructor);
|
|
1933
|
+
};
|
|
1934
|
+
}
|
|
1935
|
+
|
|
1936
|
+
let GetConnectionVectorHandler = class GetConnectionVectorHandler {
|
|
1982
1937
|
constructor() {
|
|
1983
1938
|
this.behaviorHandlers = {
|
|
1984
1939
|
[EFConnectionBehavior.FLOATING.toString()]: this.floatingBehavior,
|
|
@@ -2014,7 +1969,10 @@ class GetConnectionVectorHandler {
|
|
|
2014
1969
|
}
|
|
2015
1970
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: GetConnectionVectorHandler, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2016
1971
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: GetConnectionVectorHandler }); }
|
|
2017
|
-
}
|
|
1972
|
+
};
|
|
1973
|
+
GetConnectionVectorHandler = __decorate([
|
|
1974
|
+
FHandlerRegister(GetConnectionVectorRequest)
|
|
1975
|
+
], GetConnectionVectorHandler);
|
|
2018
1976
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: GetConnectionVectorHandler, decorators: [{
|
|
2019
1977
|
type: Injectable
|
|
2020
1978
|
}] });
|
|
@@ -2045,13 +2003,9 @@ const positionFixedOutbound = {
|
|
|
2045
2003
|
},
|
|
2046
2004
|
};
|
|
2047
2005
|
|
|
2048
|
-
class
|
|
2049
|
-
constructor(
|
|
2050
|
-
this.
|
|
2051
|
-
this.inputRect = inputRect;
|
|
2052
|
-
this.behavior = behavior;
|
|
2053
|
-
this.outputSide = outputSide;
|
|
2054
|
-
this.inputSide = inputSide;
|
|
2006
|
+
class GetOutputRectInFlowRequest {
|
|
2007
|
+
constructor(fOutputId) {
|
|
2008
|
+
this.fOutputId = fOutputId;
|
|
2055
2009
|
}
|
|
2056
2010
|
}
|
|
2057
2011
|
|
|
@@ -2065,6 +2019,109 @@ function requiredOutput() {
|
|
|
2065
2019
|
return new Error(`The node must contain at least one fOutput if there is an fOutlet`);
|
|
2066
2020
|
}
|
|
2067
2021
|
|
|
2022
|
+
class GetOutputRectInFlowResponse {
|
|
2023
|
+
constructor(rect, fConnectableSide) {
|
|
2024
|
+
this.rect = rect;
|
|
2025
|
+
this.fConnectableSide = fConnectableSide;
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
|
|
2029
|
+
class GetElementRectInFlowHandler {
|
|
2030
|
+
get transform() {
|
|
2031
|
+
return this.fComponentsStore.transform;
|
|
2032
|
+
}
|
|
2033
|
+
get flowHost() {
|
|
2034
|
+
return this.fComponentsStore.flowHost;
|
|
2035
|
+
}
|
|
2036
|
+
constructor(fComponentsStore) {
|
|
2037
|
+
this.fComponentsStore = fComponentsStore;
|
|
2038
|
+
}
|
|
2039
|
+
handle(element) {
|
|
2040
|
+
const systemRect = RectExtensions.fromElement(element);
|
|
2041
|
+
const position = Point.fromPoint(systemRect).elementTransform(this.flowHost).sub(this.transform.scaledPosition).sub(this.transform.position).div(this.transform.scale);
|
|
2042
|
+
const size = SizeExtensions.initialize(systemRect.width / this.transform.scale, systemRect.height / this.transform.scale);
|
|
2043
|
+
const result = RectExtensions.initialize(position.x, position.y, size.width, size.height);
|
|
2044
|
+
return result;
|
|
2045
|
+
}
|
|
2046
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: GetElementRectInFlowHandler, deps: [{ token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2047
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: GetElementRectInFlowHandler }); }
|
|
2048
|
+
}
|
|
2049
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: GetElementRectInFlowHandler, decorators: [{
|
|
2050
|
+
type: Injectable
|
|
2051
|
+
}], ctorParameters: () => [{ type: FComponentsStore }] });
|
|
2052
|
+
|
|
2053
|
+
let GetOutputRectInFlowHandler = class GetOutputRectInFlowHandler {
|
|
2054
|
+
constructor(fComponentsStore, getElementRectInFlowHandler) {
|
|
2055
|
+
this.fComponentsStore = fComponentsStore;
|
|
2056
|
+
this.getElementRectInFlowHandler = getElementRectInFlowHandler;
|
|
2057
|
+
}
|
|
2058
|
+
handle(request) {
|
|
2059
|
+
const output = this.fComponentsStore.fOutputs.find((x) => x.id === request.fOutputId);
|
|
2060
|
+
if (!output) {
|
|
2061
|
+
throw OutputNotFound(request.fOutputId);
|
|
2062
|
+
}
|
|
2063
|
+
const result = this.getElementRectInFlowHandler.handle(output.hostElement);
|
|
2064
|
+
return new GetOutputRectInFlowResponse(result, output.fConnectableSide);
|
|
2065
|
+
}
|
|
2066
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: GetOutputRectInFlowHandler, deps: [{ token: FComponentsStore }, { token: GetElementRectInFlowHandler }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2067
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: GetOutputRectInFlowHandler }); }
|
|
2068
|
+
};
|
|
2069
|
+
GetOutputRectInFlowHandler = __decorate([
|
|
2070
|
+
FHandlerRegister(GetOutputRectInFlowRequest)
|
|
2071
|
+
], GetOutputRectInFlowHandler);
|
|
2072
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: GetOutputRectInFlowHandler, decorators: [{
|
|
2073
|
+
type: Injectable
|
|
2074
|
+
}], ctorParameters: () => [{ type: FComponentsStore }, { type: GetElementRectInFlowHandler }] });
|
|
2075
|
+
|
|
2076
|
+
class RedrawConnectionsRequest {
|
|
2077
|
+
constructor() {
|
|
2078
|
+
}
|
|
2079
|
+
}
|
|
2080
|
+
|
|
2081
|
+
let RedrawConnectionsHandler = class RedrawConnectionsHandler {
|
|
2082
|
+
constructor(fComponentsStore, getElementRectInFlowHandler, fMediator) {
|
|
2083
|
+
this.fComponentsStore = fComponentsStore;
|
|
2084
|
+
this.getElementRectInFlowHandler = getElementRectInFlowHandler;
|
|
2085
|
+
this.fMediator = fMediator;
|
|
2086
|
+
}
|
|
2087
|
+
handle(request) {
|
|
2088
|
+
this.resetConnectors();
|
|
2089
|
+
this.fComponentsStore.fTempConnection?.setMarkers();
|
|
2090
|
+
this.fComponentsStore.fConnections.forEach((connection) => {
|
|
2091
|
+
const output = this.fComponentsStore.fOutputs.find((x) => x.id === connection.fOutputId);
|
|
2092
|
+
const input = this.fComponentsStore.fInputs.find((x) => x.id === connection.fInputId);
|
|
2093
|
+
if (output && input) {
|
|
2094
|
+
this.setupConnection(output, input, connection);
|
|
2095
|
+
}
|
|
2096
|
+
});
|
|
2097
|
+
}
|
|
2098
|
+
resetConnectors() {
|
|
2099
|
+
this.fComponentsStore.fOutputs.forEach((output) => output.setConnected(false));
|
|
2100
|
+
this.fComponentsStore.fInputs.forEach((input) => input.setConnected(false));
|
|
2101
|
+
}
|
|
2102
|
+
setupConnection(output, input, connection) {
|
|
2103
|
+
output.setConnected(true);
|
|
2104
|
+
input.setConnected(true);
|
|
2105
|
+
const vector = this.getVector(output, input, connection);
|
|
2106
|
+
connection.setVector(vector.point1, output.fConnectableSide, vector.point2, input.fConnectableSide);
|
|
2107
|
+
connection.setMarkers();
|
|
2108
|
+
connection.initialize();
|
|
2109
|
+
}
|
|
2110
|
+
getVector(output, input, connection) {
|
|
2111
|
+
const outputRect = this.getElementRectInFlowHandler.handle(output.hostElement);
|
|
2112
|
+
const inputRect = this.getElementRectInFlowHandler.handle(input.hostElement);
|
|
2113
|
+
return this.fMediator.send(new GetConnectionVectorRequest(outputRect, inputRect, connection.fBehavior, output.fConnectableSide, input.fConnectableSide));
|
|
2114
|
+
}
|
|
2115
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: RedrawConnectionsHandler, deps: [{ token: FComponentsStore }, { token: GetElementRectInFlowHandler }, { token: FFlowMediator }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2116
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: RedrawConnectionsHandler }); }
|
|
2117
|
+
};
|
|
2118
|
+
RedrawConnectionsHandler = __decorate([
|
|
2119
|
+
FHandlerRegister(RedrawConnectionsRequest)
|
|
2120
|
+
], RedrawConnectionsHandler);
|
|
2121
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: RedrawConnectionsHandler, decorators: [{
|
|
2122
|
+
type: Injectable
|
|
2123
|
+
}], ctorParameters: () => [{ type: FComponentsStore }, { type: GetElementRectInFlowHandler }, { type: FFlowMediator }] });
|
|
2124
|
+
|
|
2068
2125
|
class GetAllNodesRectHandler {
|
|
2069
2126
|
constructor(fComponentsStore) {
|
|
2070
2127
|
this.fComponentsStore = fComponentsStore;
|
|
@@ -2102,30 +2159,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImpor
|
|
|
2102
2159
|
type: Injectable
|
|
2103
2160
|
}], ctorParameters: () => [{ type: FComponentsStore }] });
|
|
2104
2161
|
|
|
2105
|
-
class GetElementRectInFlowHandler {
|
|
2106
|
-
get transform() {
|
|
2107
|
-
return this.fComponentsStore.transform;
|
|
2108
|
-
}
|
|
2109
|
-
get flowHost() {
|
|
2110
|
-
return this.fComponentsStore.flowHost;
|
|
2111
|
-
}
|
|
2112
|
-
constructor(fComponentsStore) {
|
|
2113
|
-
this.fComponentsStore = fComponentsStore;
|
|
2114
|
-
}
|
|
2115
|
-
handle(element) {
|
|
2116
|
-
const systemRect = RectExtensions.fromElement(element);
|
|
2117
|
-
const position = Point.fromPoint(systemRect).elementTransform(this.flowHost).sub(this.transform.scaledPosition).sub(this.transform.position).div(this.transform.scale);
|
|
2118
|
-
const size = SizeExtensions.initialize(systemRect.width / this.transform.scale, systemRect.height / this.transform.scale);
|
|
2119
|
-
const result = RectExtensions.initialize(position.x, position.y, size.width, size.height);
|
|
2120
|
-
return result;
|
|
2121
|
-
}
|
|
2122
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: GetElementRectInFlowHandler, deps: [{ token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2123
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: GetElementRectInFlowHandler }); }
|
|
2124
|
-
}
|
|
2125
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: GetElementRectInFlowHandler, decorators: [{
|
|
2126
|
-
type: Injectable
|
|
2127
|
-
}], ctorParameters: () => [{ type: FComponentsStore }] });
|
|
2128
|
-
|
|
2129
2162
|
class GetIncomingConnectionsHandler {
|
|
2130
2163
|
get fConnections() {
|
|
2131
2164
|
return this.fComponentsStore.fConnections;
|
|
@@ -2186,26 +2219,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImpor
|
|
|
2186
2219
|
type: Injectable
|
|
2187
2220
|
}], ctorParameters: () => [{ type: FComponentsStore }, { type: GetElementRectInFlowHandler }] });
|
|
2188
2221
|
|
|
2189
|
-
class GetOutputRectInFlowHandler {
|
|
2190
|
-
constructor(fComponentsStore, getElementRectInFlowHandler) {
|
|
2191
|
-
this.fComponentsStore = fComponentsStore;
|
|
2192
|
-
this.getElementRectInFlowHandler = getElementRectInFlowHandler;
|
|
2193
|
-
}
|
|
2194
|
-
handle(outputId) {
|
|
2195
|
-
const output = this.fComponentsStore.fOutputs.find((x) => x.id === outputId);
|
|
2196
|
-
if (!output) {
|
|
2197
|
-
throw OutputNotFound(outputId);
|
|
2198
|
-
}
|
|
2199
|
-
const result = this.getElementRectInFlowHandler.handle(output.hostElement);
|
|
2200
|
-
return { rect: result, fConnectableSide: output.fConnectableSide };
|
|
2201
|
-
}
|
|
2202
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: GetOutputRectInFlowHandler, deps: [{ token: FComponentsStore }, { token: GetElementRectInFlowHandler }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2203
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: GetOutputRectInFlowHandler }); }
|
|
2204
|
-
}
|
|
2205
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: GetOutputRectInFlowHandler, decorators: [{
|
|
2206
|
-
type: Injectable
|
|
2207
|
-
}], ctorParameters: () => [{ type: FComponentsStore }, { type: GetElementRectInFlowHandler }] });
|
|
2208
|
-
|
|
2209
2222
|
class UpdateNodeLayerHandler {
|
|
2210
2223
|
get fNodesContainer() {
|
|
2211
2224
|
return this.fComponentsStore.fCanvas?.fNodesContainer?.nativeElement;
|
|
@@ -2307,11 +2320,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImpor
|
|
|
2307
2320
|
}], ctorParameters: () => [{ type: FComponentsStore }] });
|
|
2308
2321
|
|
|
2309
2322
|
const COMMON_PROVIDERS = [
|
|
2310
|
-
GetAllNodesRectHandler,
|
|
2311
2323
|
GetConnectionVectorHandler,
|
|
2324
|
+
GetOutputRectInFlowHandler,
|
|
2325
|
+
RedrawConnectionsHandler,
|
|
2326
|
+
GetAllNodesRectHandler,
|
|
2312
2327
|
GetConnectionHandler,
|
|
2313
2328
|
GetElementRectInFlowHandler,
|
|
2314
|
-
GetOutputRectInFlowHandler,
|
|
2315
2329
|
GetInputRectInFlowHandler,
|
|
2316
2330
|
GetIncomingConnectionsHandler,
|
|
2317
2331
|
GetOutgoingConnectionsHandler,
|
|
@@ -2493,942 +2507,644 @@ const CANVAS_PROVIDERS = [
|
|
|
2493
2507
|
CanvasPrepareDragSequence
|
|
2494
2508
|
];
|
|
2495
2509
|
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.1", type: FExternalItemBase, ngImport: i0 }); }
|
|
2500
|
-
}
|
|
2501
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FExternalItemBase, decorators: [{
|
|
2502
|
-
type: Directive
|
|
2503
|
-
}] });
|
|
2504
|
-
|
|
2505
|
-
function isExternalItem(element) {
|
|
2506
|
-
return !!element.closest('[fExternalItem]');
|
|
2507
|
-
}
|
|
2508
|
-
function getExternalItem(element) {
|
|
2509
|
-
return element.closest('[fExternalItem]');
|
|
2510
|
-
}
|
|
2511
|
-
|
|
2512
|
-
class FExternalItemService {
|
|
2513
|
-
constructor() {
|
|
2514
|
-
this.items = [];
|
|
2510
|
+
class FindFirstCanBeConnectedOutputByOutletHandler {
|
|
2511
|
+
get fNodes() {
|
|
2512
|
+
return this.fComponentsStore.fNodes;
|
|
2515
2513
|
}
|
|
2516
|
-
|
|
2517
|
-
this.
|
|
2514
|
+
get fOutputs() {
|
|
2515
|
+
return this.fComponentsStore.fOutputs;
|
|
2518
2516
|
}
|
|
2519
|
-
|
|
2520
|
-
|
|
2517
|
+
constructor(fComponentsStore) {
|
|
2518
|
+
this.fComponentsStore = fComponentsStore;
|
|
2521
2519
|
}
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2520
|
+
handle(outlet) {
|
|
2521
|
+
let result;
|
|
2522
|
+
const node = this.fNodes.find((x) => x.isContains(outlet.hostElement));
|
|
2523
|
+
if (!node) {
|
|
2524
|
+
throw new Error('Node not found');
|
|
2525
|
+
}
|
|
2526
|
+
const outputsOfNode = this.fOutputs.filter((x) => {
|
|
2527
|
+
return node.isContains(x.hostElement) && x.canBeConnected;
|
|
2528
|
+
});
|
|
2529
|
+
if (outputsOfNode.length > 0) {
|
|
2530
|
+
result = outputsOfNode[0];
|
|
2526
2531
|
}
|
|
2532
|
+
return result;
|
|
2527
2533
|
}
|
|
2528
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
2529
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
2534
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FindFirstCanBeConnectedOutputByOutletHandler, deps: [{ token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2535
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FindFirstCanBeConnectedOutputByOutletHandler }); }
|
|
2530
2536
|
}
|
|
2531
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
2532
|
-
type: Injectable
|
|
2533
|
-
|
|
2534
|
-
providedIn: 'root'
|
|
2535
|
-
}]
|
|
2536
|
-
}] });
|
|
2537
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FindFirstCanBeConnectedOutputByOutletHandler, decorators: [{
|
|
2538
|
+
type: Injectable
|
|
2539
|
+
}], ctorParameters: () => [{ type: FComponentsStore }] });
|
|
2537
2540
|
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2541
|
+
class CreateConnectionDragHandler {
|
|
2542
|
+
constructor(fMediator, connection, mouseDownPoint) {
|
|
2543
|
+
this.fMediator = fMediator;
|
|
2544
|
+
this.connection = connection;
|
|
2545
|
+
this.mouseDownPoint = mouseDownPoint;
|
|
2546
|
+
this.type = EFDraggableType.CREATE_CONNECTION;
|
|
2547
|
+
this.onPointerDownFromConnectorRect = RectExtensions.initialize();
|
|
2548
|
+
this.onPointerDownToConnectorRect = RectExtensions.initialize();
|
|
2549
|
+
this.outputSide = EFConnectableSide.BOTTOM;
|
|
2542
2550
|
}
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
this.
|
|
2546
|
-
this.
|
|
2547
|
-
this.
|
|
2551
|
+
initialize() {
|
|
2552
|
+
const outputRect = this.fMediator.send(new GetOutputRectInFlowRequest(this.connection.fOutputId));
|
|
2553
|
+
this.outputSide = outputRect.fConnectableSide;
|
|
2554
|
+
this.onPointerDownFromConnectorRect = outputRect.rect;
|
|
2555
|
+
this.onPointerDownToConnectorRect = RectExtensions.initialize(this.mouseDownPoint.x, this.mouseDownPoint.y, 0, 0);
|
|
2556
|
+
this.connection.show();
|
|
2557
|
+
this.move(new Point(0, 0));
|
|
2548
2558
|
}
|
|
2549
|
-
|
|
2550
|
-
|
|
2559
|
+
move(difference) {
|
|
2560
|
+
const toPoint = RectExtensions.addPoint(this.onPointerDownToConnectorRect, difference);
|
|
2561
|
+
const vector = this.fMediator.send(new GetConnectionVectorRequest(this.onPointerDownFromConnectorRect, toPoint, this.connection.fBehavior, this.outputSide, EFConnectableSide.TOP));
|
|
2562
|
+
this.connection.setVector(vector.point1, this.outputSide, vector.point2, EFConnectableSide.TOP);
|
|
2563
|
+
this.connection.redraw();
|
|
2551
2564
|
}
|
|
2552
|
-
|
|
2553
|
-
this.
|
|
2565
|
+
complete() {
|
|
2566
|
+
this.connection.redraw();
|
|
2567
|
+
this.connection.hide();
|
|
2554
2568
|
}
|
|
2555
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FExternalItemDirective, deps: [{ token: i0.ElementRef }, { token: FExternalItemService }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2556
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.1", type: FExternalItemDirective, selector: "[fExternalItem]", inputs: { id: "id", data: "data" }, host: { properties: { "attr.id": "id" }, classAttribute: "f-component f-external-item" }, providers: [
|
|
2557
|
-
{ provide: F_EXTERNAL_ITEM, useExisting: FExternalItemDirective }
|
|
2558
|
-
], usesInheritance: true, ngImport: i0 }); }
|
|
2559
2569
|
}
|
|
2560
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FExternalItemDirective, decorators: [{
|
|
2561
|
-
type: Directive,
|
|
2562
|
-
args: [{
|
|
2563
|
-
selector: "[fExternalItem]",
|
|
2564
|
-
host: {
|
|
2565
|
-
'[attr.id]': 'id',
|
|
2566
|
-
class: "f-component f-external-item",
|
|
2567
|
-
},
|
|
2568
|
-
providers: [
|
|
2569
|
-
{ provide: F_EXTERNAL_ITEM, useExisting: FExternalItemDirective }
|
|
2570
|
-
],
|
|
2571
|
-
}]
|
|
2572
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: FExternalItemService }], propDecorators: { id: [{
|
|
2573
|
-
type: Input
|
|
2574
|
-
}], data: [{
|
|
2575
|
-
type: Input
|
|
2576
|
-
}] } });
|
|
2577
2570
|
|
|
2578
|
-
class
|
|
2579
|
-
constructor(
|
|
2580
|
-
this.
|
|
2581
|
-
this.
|
|
2582
|
-
this.hostElement.appendChild(this.element);
|
|
2583
|
-
this.element.classList.add('f-line');
|
|
2571
|
+
class FCreateConnectionEvent {
|
|
2572
|
+
constructor(fOutputId, fInputId) {
|
|
2573
|
+
this.fOutputId = fOutputId;
|
|
2574
|
+
this.fInputId = fInputId;
|
|
2584
2575
|
}
|
|
2585
|
-
|
|
2586
|
-
|
|
2576
|
+
}
|
|
2577
|
+
|
|
2578
|
+
class FirstNotConnectedInputOfNodeUnderPointerHandler {
|
|
2579
|
+
get fNodes() {
|
|
2580
|
+
return this.fComponentsStore.fNodes;
|
|
2587
2581
|
}
|
|
2588
|
-
|
|
2589
|
-
this.
|
|
2582
|
+
get fInputs() {
|
|
2583
|
+
return this.fComponentsStore.fInputs;
|
|
2590
2584
|
}
|
|
2591
|
-
|
|
2592
|
-
this.
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2585
|
+
constructor(fComponentsStore) {
|
|
2586
|
+
this.fComponentsStore = fComponentsStore;
|
|
2587
|
+
}
|
|
2588
|
+
handle(event) {
|
|
2589
|
+
const position = event.getPosition();
|
|
2590
|
+
const elementsFromPoint = document.elementsFromPoint(position.x, position.y);
|
|
2591
|
+
const nodes = elementsFromPoint.map((element) => {
|
|
2592
|
+
return this.fNodes.find((x) => x.isContains(element));
|
|
2593
|
+
}).filter((x) => !!x);
|
|
2594
|
+
const inputs = nodes.map((x) => {
|
|
2595
|
+
return this.fInputs.filter((i) => x.isContains(i.hostElement)).find((i) => {
|
|
2596
|
+
return !i.isConnected && i.canBeConnected;
|
|
2597
|
+
});
|
|
2596
2598
|
});
|
|
2599
|
+
const result = inputs.find((x) => !!x);
|
|
2600
|
+
return result;
|
|
2597
2601
|
}
|
|
2602
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FirstNotConnectedInputOfNodeUnderPointerHandler, deps: [{ token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2603
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FirstNotConnectedInputOfNodeUnderPointerHandler }); }
|
|
2598
2604
|
}
|
|
2605
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FirstNotConnectedInputOfNodeUnderPointerHandler, decorators: [{
|
|
2606
|
+
type: Injectable
|
|
2607
|
+
}], ctorParameters: () => [{ type: FComponentsStore }] });
|
|
2599
2608
|
|
|
2600
|
-
class
|
|
2601
|
-
|
|
2602
|
-
this.
|
|
2603
|
-
this.fHorizontalLine = new LineElement(this.hostElement);
|
|
2604
|
-
this.fVerticalLine = new LineElement(this.hostElement);
|
|
2609
|
+
class InputsUnderPointerHandler {
|
|
2610
|
+
get fInputs() {
|
|
2611
|
+
return this.fComponentsStore.fInputs;
|
|
2605
2612
|
}
|
|
2606
|
-
|
|
2607
|
-
this.
|
|
2608
|
-
this.fVerticalLine.draw({
|
|
2609
|
-
left: x * transform.scale + transform.position.x + transform.scaledPosition.x,
|
|
2610
|
-
top: 0,
|
|
2611
|
-
width: 1,
|
|
2612
|
-
height: size.height
|
|
2613
|
-
});
|
|
2613
|
+
constructor(fComponentsStore) {
|
|
2614
|
+
this.fComponentsStore = fComponentsStore;
|
|
2614
2615
|
}
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
height: 1
|
|
2622
|
-
});
|
|
2616
|
+
handle(event) {
|
|
2617
|
+
const position = event.getPosition();
|
|
2618
|
+
const elementsFromPoint = document.elementsFromPoint(position.x, position.y);
|
|
2619
|
+
return elementsFromPoint.filter((x) => isNodeInput(x)).map((element) => {
|
|
2620
|
+
return this.fInputs.find((x) => x.isContains(element));
|
|
2621
|
+
}).filter((x) => !!x);
|
|
2623
2622
|
}
|
|
2624
|
-
|
|
2625
|
-
|
|
2623
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: InputsUnderPointerHandler, deps: [{ token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2624
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: InputsUnderPointerHandler }); }
|
|
2625
|
+
}
|
|
2626
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: InputsUnderPointerHandler, decorators: [{
|
|
2627
|
+
type: Injectable
|
|
2628
|
+
}], ctorParameters: () => [{ type: FComponentsStore }] });
|
|
2629
|
+
|
|
2630
|
+
class FindInputsUnderPointerRequest {
|
|
2631
|
+
constructor(event, dragHandler) {
|
|
2632
|
+
this.event = event;
|
|
2633
|
+
this.dragHandler = dragHandler;
|
|
2626
2634
|
}
|
|
2627
|
-
|
|
2628
|
-
|
|
2635
|
+
}
|
|
2636
|
+
|
|
2637
|
+
class FindInputsUnderPointerHandler {
|
|
2638
|
+
get fNodes() {
|
|
2639
|
+
return this.fComponentsStore.fNodes;
|
|
2640
|
+
}
|
|
2641
|
+
constructor(fComponentsStore, inputsUnderPointerHandler, firstNotConnectedInputOfNodeUnderPointerHandler) {
|
|
2642
|
+
this.fComponentsStore = fComponentsStore;
|
|
2643
|
+
this.inputsUnderPointerHandler = inputsUnderPointerHandler;
|
|
2644
|
+
this.firstNotConnectedInputOfNodeUnderPointerHandler = firstNotConnectedInputOfNodeUnderPointerHandler;
|
|
2645
|
+
}
|
|
2646
|
+
handle(payload) {
|
|
2647
|
+
const inputsUnderPointer = this.getInputsUnderPointer(payload);
|
|
2648
|
+
const output = this.fComponentsStore.fOutputs.find((x) => x.id === payload.dragHandler.connection.fOutputId);
|
|
2649
|
+
if (!output) {
|
|
2650
|
+
throw OutputNotFound(payload.dragHandler.connection.fOutputId);
|
|
2651
|
+
}
|
|
2652
|
+
return inputsUnderPointer.filter((x) => {
|
|
2653
|
+
const targetNode = this.fNodes.find((y) => y.isContains(x.hostElement));
|
|
2654
|
+
const sourceNode = this.fNodes.find((y) => y.isContains(output.hostElement));
|
|
2655
|
+
return sourceNode?.hostElement !== targetNode?.hostElement;
|
|
2656
|
+
});
|
|
2657
|
+
}
|
|
2658
|
+
getInputsUnderPointer(payload) {
|
|
2659
|
+
let inputs = this.inputsUnderPointerHandler.handle(payload.event);
|
|
2660
|
+
const input = this.firstNotConnectedInputOfNodeUnderPointerHandler.handle(payload.event);
|
|
2661
|
+
if (input) {
|
|
2662
|
+
inputs.push(input);
|
|
2663
|
+
}
|
|
2664
|
+
inputs = inputs.filter((x) => x.canBeConnected);
|
|
2665
|
+
return inputs;
|
|
2629
2666
|
}
|
|
2667
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FindInputsUnderPointerHandler, deps: [{ token: FComponentsStore }, { token: InputsUnderPointerHandler }, { token: FirstNotConnectedInputOfNodeUnderPointerHandler }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2668
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FindInputsUnderPointerHandler }); }
|
|
2630
2669
|
}
|
|
2670
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FindInputsUnderPointerHandler, decorators: [{
|
|
2671
|
+
type: Injectable
|
|
2672
|
+
}], ctorParameters: () => [{ type: FComponentsStore }, { type: InputsUnderPointerHandler }, { type: FirstNotConnectedInputOfNodeUnderPointerHandler }] });
|
|
2631
2673
|
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
* Constructor to initialize the NearestCoordinateFinder.
|
|
2639
|
-
* @param elements - The array of IRect elements.
|
|
2640
|
-
* @param target - The target IRect element.
|
|
2641
|
-
*/
|
|
2642
|
-
constructor(elements, target) {
|
|
2643
|
-
this.elements = elements;
|
|
2644
|
-
this.target = target;
|
|
2674
|
+
class CreateConnectionOnPointerUp {
|
|
2675
|
+
constructor(fComponentsStore, fDraggableDataContext, findInputsUnderPointerHandler, findFirstCanBeConnectedOutputByOutletHandler) {
|
|
2676
|
+
this.fComponentsStore = fComponentsStore;
|
|
2677
|
+
this.fDraggableDataContext = fDraggableDataContext;
|
|
2678
|
+
this.findInputsUnderPointerHandler = findInputsUnderPointerHandler;
|
|
2679
|
+
this.findFirstCanBeConnectedOutputByOutletHandler = findFirstCanBeConnectedOutputByOutletHandler;
|
|
2645
2680
|
}
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
const distanceLeftRight = this.target.x - (element.x + element.width);
|
|
2656
|
-
const distanceCenterCenter = this.target.gravityCenter.x - element.gravityCenter.x;
|
|
2657
|
-
const distanceRightLeft = (this.target.x + this.target.width) - element.x;
|
|
2658
|
-
const distanceRightRight = (this.target.x + this.target.width) - (element.x + element.width);
|
|
2659
|
-
if (Math.abs(distanceLeftLeft) <= ALIGN_THRESHOLD ||
|
|
2660
|
-
Math.abs(distanceLeftRight) <= ALIGN_THRESHOLD ||
|
|
2661
|
-
Math.abs(distanceCenterCenter) <= ALIGN_THRESHOLD ||
|
|
2662
|
-
Math.abs(distanceRightLeft) <= ALIGN_THRESHOLD ||
|
|
2663
|
-
Math.abs(distanceRightRight) <= ALIGN_THRESHOLD) {
|
|
2664
|
-
if (minDistance === undefined || Math.abs(distanceCenterCenter) < Math.abs(minDistance)) {
|
|
2665
|
-
minDistance = distanceCenterCenter;
|
|
2666
|
-
nearest = element.gravityCenter.x;
|
|
2667
|
-
}
|
|
2668
|
-
if (Math.abs(distanceLeftLeft) < Math.abs(minDistance)) {
|
|
2669
|
-
minDistance = distanceLeftLeft;
|
|
2670
|
-
nearest = element.x;
|
|
2671
|
-
}
|
|
2672
|
-
if (Math.abs(distanceRightRight) < Math.abs(minDistance)) {
|
|
2673
|
-
minDistance = distanceRightRight;
|
|
2674
|
-
nearest = element.x + element.width;
|
|
2681
|
+
handle(event) {
|
|
2682
|
+
const isCreateConnection = this.fDraggableDataContext.draggableItems.some((x) => x.type === EFDraggableType.CREATE_CONNECTION);
|
|
2683
|
+
if (isCreateConnection) {
|
|
2684
|
+
const handler = this.fDraggableDataContext.draggableItems[0];
|
|
2685
|
+
const inputsUnderPointer = this.findInputsUnderPointerHandler.handle(new FindInputsUnderPointerRequest(event, handler));
|
|
2686
|
+
if (inputsUnderPointer.length > 0) {
|
|
2687
|
+
let output = this.fComponentsStore.fOutputs.find((x) => x.id === handler.connection.fOutputId);
|
|
2688
|
+
if (!output) {
|
|
2689
|
+
output = this.fComponentsStore.fOutlets.find((x) => x.id === handler.connection.fOutputId);
|
|
2675
2690
|
}
|
|
2676
|
-
if (
|
|
2677
|
-
|
|
2678
|
-
nearest = element.x + element.width;
|
|
2691
|
+
if (!output) {
|
|
2692
|
+
throw OutputNotFound(handler.connection.fOutputId);
|
|
2679
2693
|
}
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
return { value: nearest, distance: minDistance };
|
|
2687
|
-
}
|
|
2688
|
-
/**
|
|
2689
|
-
* Finds the nearest coordinate on a specified axis.
|
|
2690
|
-
* @returns The nearest coordinate and its distance.
|
|
2691
|
-
*/
|
|
2692
|
-
findNearestCoordinateByY() {
|
|
2693
|
-
let nearest;
|
|
2694
|
-
let minDistance;
|
|
2695
|
-
for (const element of this.elements) {
|
|
2696
|
-
const distanceTopTop = this.target.y - element.y;
|
|
2697
|
-
const distanceTopBottom = this.target.y - (element.y + element.height);
|
|
2698
|
-
const distanceCenterCenter = this.target.gravityCenter.y - element.gravityCenter.y;
|
|
2699
|
-
const distanceBottomTop = (this.target.y + this.target.height) - element.y;
|
|
2700
|
-
const distanceBottomBottom = (this.target.y + this.target.height) - (element.y + element.height);
|
|
2701
|
-
if (Math.abs(distanceTopTop) <= ALIGN_THRESHOLD ||
|
|
2702
|
-
Math.abs(distanceTopBottom) <= ALIGN_THRESHOLD ||
|
|
2703
|
-
Math.abs(distanceCenterCenter) <= ALIGN_THRESHOLD ||
|
|
2704
|
-
Math.abs(distanceBottomTop) <= ALIGN_THRESHOLD ||
|
|
2705
|
-
Math.abs(distanceBottomBottom) <= ALIGN_THRESHOLD) {
|
|
2706
|
-
if (minDistance === undefined || Math.abs(distanceCenterCenter) < Math.abs(minDistance)) {
|
|
2707
|
-
minDistance = distanceCenterCenter;
|
|
2708
|
-
nearest = element.gravityCenter.y;
|
|
2709
|
-
}
|
|
2710
|
-
if (Math.abs(distanceTopTop) < Math.abs(minDistance)) {
|
|
2711
|
-
minDistance = distanceTopTop;
|
|
2712
|
-
nearest = element.y;
|
|
2713
|
-
}
|
|
2714
|
-
if (Math.abs(distanceBottomBottom) < Math.abs(minDistance)) {
|
|
2715
|
-
minDistance = distanceBottomBottom;
|
|
2716
|
-
nearest = element.y + element.height;
|
|
2717
|
-
}
|
|
2718
|
-
if (Math.abs(distanceTopBottom) < Math.abs(minDistance)) {
|
|
2719
|
-
minDistance = distanceTopBottom;
|
|
2720
|
-
nearest = element.y + element.height;
|
|
2721
|
-
}
|
|
2722
|
-
if (Math.abs(distanceBottomTop) < Math.abs(minDistance)) {
|
|
2723
|
-
minDistance = distanceBottomTop;
|
|
2724
|
-
nearest = element.y;
|
|
2694
|
+
const isOutlet = isNodeOutlet(output.hostElement);
|
|
2695
|
+
if (isOutlet) {
|
|
2696
|
+
output = this.findFirstCanBeConnectedOutputByOutletHandler.handle(output);
|
|
2697
|
+
if (!output) {
|
|
2698
|
+
throw requiredOutput();
|
|
2699
|
+
}
|
|
2725
2700
|
}
|
|
2701
|
+
this.fComponentsStore.fDraggable?.fCreateConnection.emit(new FCreateConnectionEvent(output.id, inputsUnderPointer[0]?.id));
|
|
2726
2702
|
}
|
|
2703
|
+
handler.complete();
|
|
2727
2704
|
}
|
|
2728
|
-
return { value: nearest, distance: minDistance };
|
|
2729
2705
|
}
|
|
2706
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: CreateConnectionOnPointerUp, deps: [{ token: FComponentsStore }, { token: FDraggableDataContext }, { token: FindInputsUnderPointerHandler }, { token: FindFirstCanBeConnectedOutputByOutletHandler }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2707
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: CreateConnectionOnPointerUp }); }
|
|
2730
2708
|
}
|
|
2709
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: CreateConnectionOnPointerUp, decorators: [{
|
|
2710
|
+
type: Injectable
|
|
2711
|
+
}], ctorParameters: () => [{ type: FComponentsStore }, { type: FDraggableDataContext }, { type: FindInputsUnderPointerHandler }, { type: FindFirstCanBeConnectedOutputByOutletHandler }] });
|
|
2731
2712
|
|
|
2732
|
-
|
|
2733
|
-
class FLineAlignmentBase {
|
|
2734
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FLineAlignmentBase, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2735
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.1", type: FLineAlignmentBase, ngImport: i0 }); }
|
|
2736
|
-
}
|
|
2737
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FLineAlignmentBase, decorators: [{
|
|
2738
|
-
type: Directive
|
|
2739
|
-
}] });
|
|
2740
|
-
|
|
2741
|
-
class FLineAlignmentComponent extends FLineAlignmentBase {
|
|
2742
|
-
get hostElement() {
|
|
2743
|
-
return this.elementReference.nativeElement;
|
|
2744
|
-
}
|
|
2713
|
+
class CreateConnectionPrepareDragSequence {
|
|
2745
2714
|
get transform() {
|
|
2746
2715
|
return this.fComponentsStore.fCanvas.transform;
|
|
2747
2716
|
}
|
|
2748
2717
|
get flowHost() {
|
|
2749
2718
|
return this.fComponentsStore.fFlow.hostElement;
|
|
2750
2719
|
}
|
|
2751
|
-
constructor(
|
|
2752
|
-
super();
|
|
2753
|
-
this.elementReference = elementReference;
|
|
2720
|
+
constructor(fComponentsStore, fDraggableDataContext, getElementRectInFlowHandler, fMediator, findFirstCanBeConnectedOutputByOutletHandler) {
|
|
2754
2721
|
this.fComponentsStore = fComponentsStore;
|
|
2755
2722
|
this.fDraggableDataContext = fDraggableDataContext;
|
|
2756
2723
|
this.getElementRectInFlowHandler = getElementRectInFlowHandler;
|
|
2757
|
-
this.
|
|
2758
|
-
this.
|
|
2759
|
-
this.rects = [];
|
|
2760
|
-
this.lineService = new LineService(this.hostElement);
|
|
2761
|
-
}
|
|
2762
|
-
ngOnInit() {
|
|
2763
|
-
this.fDraggableDataContext.fLineAlignment = this;
|
|
2764
|
-
}
|
|
2765
|
-
initialize(allNodes, currentNodes) {
|
|
2766
|
-
this.size = this.flowHost.getBoundingClientRect();
|
|
2767
|
-
this.rects = [];
|
|
2768
|
-
const draggedNodeRects = currentNodes.map((x) => {
|
|
2769
|
-
return this.getElementRectInFlowHandler.handle(x.hostElement);
|
|
2770
|
-
});
|
|
2771
|
-
this.draggedNodeRect = RectExtensions.union(draggedNodeRects);
|
|
2772
|
-
const allNodesExcludeCurrents = allNodes.filter((x) => {
|
|
2773
|
-
return !currentNodes.includes(x);
|
|
2774
|
-
});
|
|
2775
|
-
this.rects = allNodesExcludeCurrents.map((x) => {
|
|
2776
|
-
return this.getElementRectInFlowHandler.handle(x.hostElement);
|
|
2777
|
-
});
|
|
2778
|
-
}
|
|
2779
|
-
handle(difference) {
|
|
2780
|
-
this.drawIntersectingLines(difference);
|
|
2724
|
+
this.fMediator = fMediator;
|
|
2725
|
+
this.findFirstCanBeConnectedOutputByOutletHandler = findFirstCanBeConnectedOutputByOutletHandler;
|
|
2781
2726
|
}
|
|
2782
|
-
|
|
2783
|
-
const
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
else {
|
|
2788
|
-
this.lineService.hideVerticalLine();
|
|
2727
|
+
handle(event) {
|
|
2728
|
+
const node = this.fComponentsStore.findNode(event.targetElement);
|
|
2729
|
+
const pointerPositionInFlow = Point.fromPoint(event.getPosition()).elementTransform(this.flowHost);
|
|
2730
|
+
if (!node || this.fDraggableDataContext.draggableItems.length || !this.fComponentsStore.fTempConnection) {
|
|
2731
|
+
return;
|
|
2789
2732
|
}
|
|
2790
|
-
if (
|
|
2791
|
-
this.
|
|
2733
|
+
if (isNodeOutlet(event.targetElement)) {
|
|
2734
|
+
const outlet = this.fComponentsStore.fOutlets.find((x) => {
|
|
2735
|
+
return x.hostElement.contains(event.targetElement);
|
|
2736
|
+
});
|
|
2737
|
+
if (!outlet) {
|
|
2738
|
+
throw new Error('Outlet not found');
|
|
2739
|
+
}
|
|
2740
|
+
const nodeOutputs = this.fComponentsStore.fOutputs.filter((x) => node.isContains(x.hostElement));
|
|
2741
|
+
outlet.setOutputs(nodeOutputs);
|
|
2742
|
+
if (outlet.canBeConnected) {
|
|
2743
|
+
const outletCenter = this.getElementRectInFlowHandler.handle(outlet.hostElement).gravityCenter;
|
|
2744
|
+
if (outlet.isConnectionFromOutlet) {
|
|
2745
|
+
this.createConnectionHandler(pointerPositionInFlow, outlet, outletCenter);
|
|
2746
|
+
}
|
|
2747
|
+
else {
|
|
2748
|
+
const output = this.findFirstCanBeConnectedOutputByOutletHandler.handle(outlet);
|
|
2749
|
+
if (!output) {
|
|
2750
|
+
throw new Error('Output not found');
|
|
2751
|
+
}
|
|
2752
|
+
this.createConnectionHandler(pointerPositionInFlow, output, outletCenter);
|
|
2753
|
+
}
|
|
2754
|
+
}
|
|
2792
2755
|
}
|
|
2793
|
-
else {
|
|
2794
|
-
this.
|
|
2756
|
+
else if (this.isNodeOutput(event.targetElement, node)) {
|
|
2757
|
+
const output = this.fComponentsStore.fOutputs.find((x) => {
|
|
2758
|
+
return x.hostElement.contains(event.targetElement);
|
|
2759
|
+
});
|
|
2760
|
+
if (!output) {
|
|
2761
|
+
throw new Error('Output not found');
|
|
2762
|
+
}
|
|
2763
|
+
if (output.canBeConnected) {
|
|
2764
|
+
const outputCenter = this.getElementRectInFlowHandler.handle(output.hostElement).gravityCenter;
|
|
2765
|
+
this.createConnectionHandler(pointerPositionInFlow, output, outputCenter);
|
|
2766
|
+
}
|
|
2795
2767
|
}
|
|
2796
2768
|
}
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2769
|
+
createConnectionHandler(pointerPositionInCanvas, output, outputCenter) {
|
|
2770
|
+
this.fComponentsStore.fTempConnection.fOutputId = output.id;
|
|
2771
|
+
this.fComponentsStore.fTempConnection.initialize();
|
|
2772
|
+
this.fDraggableDataContext.onPointerDownScale = this.transform.scale;
|
|
2773
|
+
this.fDraggableDataContext.onPointerDownPosition = pointerPositionInCanvas.div(this.transform.scale);
|
|
2774
|
+
this.fDraggableDataContext.draggableItems = [
|
|
2775
|
+
new CreateConnectionDragHandler(this.fMediator, this.fComponentsStore.fTempConnection, outputCenter)
|
|
2776
|
+
];
|
|
2804
2777
|
}
|
|
2805
|
-
|
|
2806
|
-
this.
|
|
2807
|
-
|
|
2778
|
+
isNodeOutput(targetElement, node) {
|
|
2779
|
+
const outlets = this.fComponentsStore.fOutlets.filter((x) => node.isContains(x.hostElement));
|
|
2780
|
+
return isNodeOutput(targetElement) && !outlets.length;
|
|
2808
2781
|
}
|
|
2809
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
2810
|
-
static { this.ɵ
|
|
2811
|
-
{ provide: F_LINE_ALIGNMENT, useExisting: FLineAlignmentComponent }
|
|
2812
|
-
], exportAs: ["fComponent"], usesInheritance: true, ngImport: i0, template: "", isInline: true, styles: [":host{display:block;position:absolute;left:0;top:0;width:100%;height:100%;overflow:hidden;pointer-events:none;-webkit-user-select:none;user-select:none}\n"] }); }
|
|
2813
|
-
}
|
|
2814
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FLineAlignmentComponent, decorators: [{
|
|
2815
|
-
type: Component,
|
|
2816
|
-
args: [{ selector: "f-line-alignment", template: "", exportAs: "fComponent", host: {
|
|
2817
|
-
'class': 'f-line-alignment f-component'
|
|
2818
|
-
}, providers: [
|
|
2819
|
-
{ provide: F_LINE_ALIGNMENT, useExisting: FLineAlignmentComponent }
|
|
2820
|
-
], styles: [":host{display:block;position:absolute;left:0;top:0;width:100%;height:100%;overflow:hidden;pointer-events:none;-webkit-user-select:none;user-select:none}\n"] }]
|
|
2821
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: FComponentsStore }, { type: FDraggableDataContext }, { type: GetElementRectInFlowHandler }] });
|
|
2822
|
-
|
|
2823
|
-
const F_SELECTION_AREA = new InjectionToken('F_SELECTION_AREA');
|
|
2824
|
-
class FSelectionAreaBase {
|
|
2825
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FSelectionAreaBase, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2826
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.1", type: FSelectionAreaBase, ngImport: i0 }); }
|
|
2782
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: CreateConnectionPrepareDragSequence, deps: [{ token: FComponentsStore }, { token: FDraggableDataContext }, { token: GetElementRectInFlowHandler }, { token: FFlowMediator }, { token: FindFirstCanBeConnectedOutputByOutletHandler }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2783
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: CreateConnectionPrepareDragSequence }); }
|
|
2827
2784
|
}
|
|
2828
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
2829
|
-
type:
|
|
2830
|
-
}] });
|
|
2785
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: CreateConnectionPrepareDragSequence, decorators: [{
|
|
2786
|
+
type: Injectable
|
|
2787
|
+
}], ctorParameters: () => [{ type: FComponentsStore }, { type: FDraggableDataContext }, { type: GetElementRectInFlowHandler }, { type: FFlowMediator }, { type: FindFirstCanBeConnectedOutputByOutletHandler }] });
|
|
2831
2788
|
|
|
2832
|
-
class
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
this.
|
|
2839
|
-
this.
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
this.fDraggableDataContext.fSelectionArea = this;
|
|
2843
|
-
this.hostElement.style.display = 'none';
|
|
2789
|
+
class ReassignConnectionDragHandler {
|
|
2790
|
+
constructor(getInputRectInFlowHandler, fMediator, connection) {
|
|
2791
|
+
this.getInputRectInFlowHandler = getInputRectInFlowHandler;
|
|
2792
|
+
this.fMediator = fMediator;
|
|
2793
|
+
this.connection = connection;
|
|
2794
|
+
this.type = EFDraggableType.REASSIGN_CONNECTION;
|
|
2795
|
+
this.onPointerDownFromConnectorRect = RectExtensions.initialize();
|
|
2796
|
+
this.onPointerDownToConnectorRect = RectExtensions.initialize();
|
|
2797
|
+
this.outputSide = EFConnectableSide.BOTTOM;
|
|
2798
|
+
this.inputSide = EFConnectableSide.TOP;
|
|
2844
2799
|
}
|
|
2845
|
-
|
|
2846
|
-
this.
|
|
2800
|
+
initialize() {
|
|
2801
|
+
const fromConnector = this.fMediator.send(new GetOutputRectInFlowRequest(this.connection.fOutputId));
|
|
2802
|
+
this.inputSide = this.getInputRectInFlowHandler.handle(this.connection.fInputId).fConnectableSide;
|
|
2803
|
+
this.outputSide = fromConnector.fConnectableSide;
|
|
2804
|
+
this.onPointerDownFromConnectorRect = fromConnector.rect;
|
|
2805
|
+
this.onPointerDownToConnectorRect = RectExtensions.initialize(this.connection.vector.point2.x, this.connection.vector.point2.y, 0, 0);
|
|
2847
2806
|
}
|
|
2848
|
-
|
|
2849
|
-
this.
|
|
2807
|
+
move(difference) {
|
|
2808
|
+
const toRect = RectExtensions.addPoint(this.onPointerDownToConnectorRect, difference);
|
|
2809
|
+
const vector = this.fMediator.send(new GetConnectionVectorRequest(this.onPointerDownFromConnectorRect, toRect, this.connection.fBehavior, this.outputSide, this.inputSide));
|
|
2810
|
+
this.connection.setVector(vector.point1, this.outputSide, vector.point2, this.inputSide);
|
|
2811
|
+
this.connection.redraw();
|
|
2850
2812
|
}
|
|
2851
|
-
|
|
2852
|
-
const
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2813
|
+
complete() {
|
|
2814
|
+
const fromConnector = this.fMediator.send(new GetOutputRectInFlowRequest(this.connection.fOutputId));
|
|
2815
|
+
const toConnector = this.getInputRectInFlowHandler.handle(this.connection.fInputId);
|
|
2816
|
+
const vector = this.fMediator.send(new GetConnectionVectorRequest(fromConnector.rect, toConnector.rect, this.connection.fBehavior, fromConnector.fConnectableSide, toConnector.fConnectableSide));
|
|
2817
|
+
this.connection.setVector(vector.point1, fromConnector.fConnectableSide, vector.point2, toConnector.fConnectableSide);
|
|
2818
|
+
this.connection.redraw();
|
|
2857
2819
|
}
|
|
2858
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FSelectionAreaComponent, deps: [{ token: i0.ElementRef }, { token: FDraggableDataContext }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2859
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.1", type: FSelectionAreaComponent, selector: "f-selection-area", host: { classAttribute: "f-selection-area f-component" }, providers: [
|
|
2860
|
-
{ provide: F_SELECTION_AREA, useExisting: FSelectionAreaComponent }
|
|
2861
|
-
], usesInheritance: true, ngImport: i0, template: ``, isInline: true, styles: [":host{position:absolute}\n"] }); }
|
|
2862
2820
|
}
|
|
2863
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FSelectionAreaComponent, decorators: [{
|
|
2864
|
-
type: Component,
|
|
2865
|
-
args: [{ selector: "f-selection-area", template: ``, host: {
|
|
2866
|
-
'class': 'f-selection-area f-component'
|
|
2867
|
-
}, providers: [
|
|
2868
|
-
{ provide: F_SELECTION_AREA, useExisting: FSelectionAreaComponent }
|
|
2869
|
-
], styles: [":host{position:absolute}\n"] }]
|
|
2870
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: FDraggableDataContext }] });
|
|
2871
2821
|
|
|
2872
|
-
class
|
|
2873
|
-
|
|
2874
|
-
|
|
2822
|
+
class FReassignConnectionEvent {
|
|
2823
|
+
constructor(connectionId, fOutputId, oldFInputId, newFInputId) {
|
|
2824
|
+
this.connectionId = connectionId;
|
|
2825
|
+
this.fOutputId = fOutputId;
|
|
2826
|
+
this.oldFInputId = oldFInputId;
|
|
2827
|
+
this.newFInputId = newFInputId;
|
|
2875
2828
|
}
|
|
2876
|
-
|
|
2877
|
-
|
|
2829
|
+
}
|
|
2830
|
+
|
|
2831
|
+
class ReassignConnectionOnPointerUp {
|
|
2832
|
+
get fDraggable() {
|
|
2833
|
+
return this.fComponentsStore.fDraggable;
|
|
2878
2834
|
}
|
|
2879
|
-
constructor(fComponentsStore) {
|
|
2835
|
+
constructor(fComponentsStore, fDraggableDataContext, findInputsUnderPointerHandler) {
|
|
2880
2836
|
this.fComponentsStore = fComponentsStore;
|
|
2837
|
+
this.fDraggableDataContext = fDraggableDataContext;
|
|
2838
|
+
this.findInputsUnderPointerHandler = findInputsUnderPointerHandler;
|
|
2881
2839
|
}
|
|
2882
|
-
handle(
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2840
|
+
handle(event) {
|
|
2841
|
+
const isReassignConnection = this.fDraggableDataContext.draggableItems.some((x) => x.type === EFDraggableType.REASSIGN_CONNECTION);
|
|
2842
|
+
if (isReassignConnection) {
|
|
2843
|
+
const handler = this.fDraggableDataContext.draggableItems[0];
|
|
2844
|
+
const inputsUnderPointer = this.findInputsUnderPointerHandler.handle(new FindInputsUnderPointerRequest(event, handler));
|
|
2845
|
+
if (inputsUnderPointer.length > 0) {
|
|
2846
|
+
if (handler.connection.fInputId !== inputsUnderPointer[0]?.id) {
|
|
2847
|
+
this.fDraggable.fReassignConnection.emit(new FReassignConnectionEvent(handler.connection.fConnectionId, handler.connection.fOutputId, handler.connection.fInputId, inputsUnderPointer[0]?.id));
|
|
2848
|
+
}
|
|
2849
|
+
}
|
|
2850
|
+
handler.complete();
|
|
2893
2851
|
}
|
|
2894
|
-
return result;
|
|
2895
2852
|
}
|
|
2896
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
2897
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
2853
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ReassignConnectionOnPointerUp, deps: [{ token: FComponentsStore }, { token: FDraggableDataContext }, { token: FindInputsUnderPointerHandler }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2854
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ReassignConnectionOnPointerUp }); }
|
|
2898
2855
|
}
|
|
2899
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
2856
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ReassignConnectionOnPointerUp, decorators: [{
|
|
2900
2857
|
type: Injectable
|
|
2901
|
-
}], ctorParameters: () => [{ type: FComponentsStore }] });
|
|
2858
|
+
}], ctorParameters: () => [{ type: FComponentsStore }, { type: FDraggableDataContext }, { type: FindInputsUnderPointerHandler }] });
|
|
2902
2859
|
|
|
2903
|
-
class
|
|
2904
|
-
|
|
2905
|
-
this.
|
|
2906
|
-
this.getConnectionVectorHandler = getConnectionVectorHandler;
|
|
2907
|
-
this.connection = connection;
|
|
2908
|
-
this.mouseDownPoint = mouseDownPoint;
|
|
2909
|
-
this.type = EFDraggableType.CREATE_CONNECTION;
|
|
2910
|
-
this.onPointerDownFromConnectorRect = RectExtensions.initialize();
|
|
2911
|
-
this.onPointerDownToConnectorRect = RectExtensions.initialize();
|
|
2912
|
-
this.outputSide = EFConnectableSide.BOTTOM;
|
|
2860
|
+
class ReassignConnectionPrepareDragSequence {
|
|
2861
|
+
get transform() {
|
|
2862
|
+
return this.fComponentsStore.fCanvas.transform;
|
|
2913
2863
|
}
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
this.outputSide = outputRect.fConnectableSide;
|
|
2917
|
-
this.onPointerDownFromConnectorRect = outputRect.rect;
|
|
2918
|
-
this.onPointerDownToConnectorRect = RectExtensions.initialize(this.mouseDownPoint.x, this.mouseDownPoint.y, 0, 0);
|
|
2919
|
-
this.connection.show();
|
|
2920
|
-
this.move(new Point(0, 0));
|
|
2864
|
+
get flowHost() {
|
|
2865
|
+
return this.fComponentsStore.fFlow.hostElement;
|
|
2921
2866
|
}
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
this.
|
|
2926
|
-
this.
|
|
2867
|
+
constructor(fComponentsStore, fDraggableDataContext, getConnectionHandler, getInputRectInFlowHandler, fMediator, updateConnectionLayerHandler) {
|
|
2868
|
+
this.fComponentsStore = fComponentsStore;
|
|
2869
|
+
this.fDraggableDataContext = fDraggableDataContext;
|
|
2870
|
+
this.getConnectionHandler = getConnectionHandler;
|
|
2871
|
+
this.getInputRectInFlowHandler = getInputRectInFlowHandler;
|
|
2872
|
+
this.fMediator = fMediator;
|
|
2873
|
+
this.updateConnectionLayerHandler = updateConnectionLayerHandler;
|
|
2927
2874
|
}
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2875
|
+
handle(event) {
|
|
2876
|
+
const pointerPositionInFlow = Point.fromPoint(event.getPosition()).elementTransform(this.flowHost);
|
|
2877
|
+
const position = event.getPosition();
|
|
2878
|
+
const allElements = document.elementsFromPoint(position.x, position.y);
|
|
2879
|
+
const dragHandlesOfConnections = allElements.filter((x) => {
|
|
2880
|
+
return !!this.getConnectionHandler.handle(x) && x.classList.contains(F_CONNECTION_DRAG_HANDLE_CLASS);
|
|
2881
|
+
});
|
|
2882
|
+
let connectionToReassign;
|
|
2883
|
+
if (dragHandlesOfConnections.length) {
|
|
2884
|
+
const connections = dragHandlesOfConnections.map((x) => this.getConnectionHandler.handle(x)).filter((x) => !x?.disabled);
|
|
2885
|
+
if (connections.length) {
|
|
2886
|
+
connectionToReassign = this.getConnectionHandler.handle(dragHandlesOfConnections[0]);
|
|
2887
|
+
}
|
|
2888
|
+
}
|
|
2889
|
+
if (connectionToReassign && !this.fDraggableDataContext.draggableItems.length) {
|
|
2890
|
+
this.updateConnectionLayerHandler.handle(connectionToReassign);
|
|
2891
|
+
this.fDraggableDataContext.onPointerDownScale = this.transform.scale;
|
|
2892
|
+
this.fDraggableDataContext.onPointerDownPosition = pointerPositionInFlow.div(this.transform.scale);
|
|
2893
|
+
this.fDraggableDataContext.draggableItems = [
|
|
2894
|
+
new ReassignConnectionDragHandler(this.getInputRectInFlowHandler, this.fMediator, connectionToReassign)
|
|
2895
|
+
];
|
|
2896
|
+
}
|
|
2931
2897
|
}
|
|
2898
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ReassignConnectionPrepareDragSequence, deps: [{ token: FComponentsStore }, { token: FDraggableDataContext }, { token: GetConnectionHandler }, { token: GetInputRectInFlowHandler }, { token: FFlowMediator }, { token: UpdateConnectionLayerHandler }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2899
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ReassignConnectionPrepareDragSequence }); }
|
|
2932
2900
|
}
|
|
2901
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ReassignConnectionPrepareDragSequence, decorators: [{
|
|
2902
|
+
type: Injectable
|
|
2903
|
+
}], ctorParameters: () => [{ type: FComponentsStore }, { type: FDraggableDataContext }, { type: GetConnectionHandler }, { type: GetInputRectInFlowHandler }, { type: FFlowMediator }, { type: UpdateConnectionLayerHandler }] });
|
|
2904
|
+
|
|
2905
|
+
const CONNECTIONS_PROVIDERS = [
|
|
2906
|
+
FindFirstCanBeConnectedOutputByOutletHandler,
|
|
2907
|
+
CreateConnectionOnPointerUp,
|
|
2908
|
+
CreateConnectionPrepareDragSequence,
|
|
2909
|
+
FirstNotConnectedInputOfNodeUnderPointerHandler,
|
|
2910
|
+
InputsUnderPointerHandler,
|
|
2911
|
+
FindInputsUnderPointerHandler,
|
|
2912
|
+
ReassignConnectionOnPointerUp,
|
|
2913
|
+
ReassignConnectionPrepareDragSequence
|
|
2914
|
+
];
|
|
2933
2915
|
|
|
2934
|
-
class
|
|
2935
|
-
constructor(
|
|
2936
|
-
this.
|
|
2937
|
-
this.
|
|
2916
|
+
class FCreateNodeEvent {
|
|
2917
|
+
constructor(rect, data) {
|
|
2918
|
+
this.rect = rect;
|
|
2919
|
+
this.data = data;
|
|
2938
2920
|
}
|
|
2939
2921
|
}
|
|
2940
2922
|
|
|
2941
|
-
class
|
|
2942
|
-
|
|
2943
|
-
|
|
2923
|
+
class ExternalItemDragHandler {
|
|
2924
|
+
constructor(externalItem) {
|
|
2925
|
+
this.externalItem = externalItem;
|
|
2926
|
+
this.type = EFDraggableType.PALETTE_ITEM;
|
|
2927
|
+
this.onPointerDownRect = RectExtensions.initialize();
|
|
2928
|
+
this.difference = PointExtensions.initialize();
|
|
2944
2929
|
}
|
|
2945
|
-
|
|
2946
|
-
return
|
|
2930
|
+
getStyle(position) {
|
|
2931
|
+
return `position: absolute; left: 0; top: 0; transform: translate(${position.x}px, ${position.y}px)`;
|
|
2947
2932
|
}
|
|
2948
|
-
|
|
2949
|
-
this.
|
|
2933
|
+
initialize() {
|
|
2934
|
+
this.onPointerDownRect = this.getExternalItemRect();
|
|
2935
|
+
this.placeholder = DomElementExtensions.deepCloneNode(this.externalItem.hostElement);
|
|
2936
|
+
document.body.appendChild(this.placeholder);
|
|
2950
2937
|
}
|
|
2951
|
-
|
|
2952
|
-
const
|
|
2953
|
-
const
|
|
2954
|
-
const
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
return this.fInputs.filter((i) => x.isContains(i.hostElement)).find((i) => {
|
|
2959
|
-
return !i.isConnected && i.canBeConnected;
|
|
2960
|
-
});
|
|
2961
|
-
});
|
|
2962
|
-
const result = inputs.find((x) => !!x);
|
|
2963
|
-
return result;
|
|
2938
|
+
getExternalItemRect() {
|
|
2939
|
+
const rect = this.externalItem.hostElement.getBoundingClientRect();
|
|
2940
|
+
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
2941
|
+
const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
|
|
2942
|
+
const offsetTop = rect.top + scrollTop;
|
|
2943
|
+
const offsetLeft = rect.left + scrollLeft;
|
|
2944
|
+
return RectExtensions.initialize(offsetLeft, offsetTop, rect.width, rect.height);
|
|
2964
2945
|
}
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
type: Injectable
|
|
2970
|
-
}], ctorParameters: () => [{ type: FComponentsStore }] });
|
|
2971
|
-
|
|
2972
|
-
class InputsUnderPointerHandler {
|
|
2973
|
-
get fInputs() {
|
|
2974
|
-
return this.fComponentsStore.fInputs;
|
|
2946
|
+
move(difference) {
|
|
2947
|
+
this.difference = difference;
|
|
2948
|
+
const position = Point.fromPoint(this.onPointerDownRect).add(this.difference);
|
|
2949
|
+
this.placeholder.setAttribute('style', this.getStyle(position));
|
|
2975
2950
|
}
|
|
2976
|
-
|
|
2977
|
-
this.
|
|
2951
|
+
getPlaceholderRect() {
|
|
2952
|
+
return RectExtensions.fromElement(this.placeholder);
|
|
2978
2953
|
}
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
const elementsFromPoint = document.elementsFromPoint(position.x, position.y);
|
|
2982
|
-
return elementsFromPoint.filter((x) => isNodeInput(x)).map((element) => {
|
|
2983
|
-
return this.fInputs.find((x) => x.isContains(element));
|
|
2984
|
-
}).filter((x) => !!x);
|
|
2954
|
+
complete() {
|
|
2955
|
+
document.body.removeChild(this.placeholder);
|
|
2985
2956
|
}
|
|
2986
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: InputsUnderPointerHandler, deps: [{ token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2987
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: InputsUnderPointerHandler }); }
|
|
2988
2957
|
}
|
|
2989
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: InputsUnderPointerHandler, decorators: [{
|
|
2990
|
-
type: Injectable
|
|
2991
|
-
}], ctorParameters: () => [{ type: FComponentsStore }] });
|
|
2992
2958
|
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2959
|
+
const F_EXTERNAL_ITEM = new InjectionToken('F_EXTERNAL_ITEM');
|
|
2960
|
+
class FExternalItemBase {
|
|
2961
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FExternalItemBase, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
2962
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.1", type: FExternalItemBase, ngImport: i0 }); }
|
|
2963
|
+
}
|
|
2964
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FExternalItemBase, decorators: [{
|
|
2965
|
+
type: Directive
|
|
2966
|
+
}] });
|
|
2967
|
+
|
|
2968
|
+
function isExternalItem(element) {
|
|
2969
|
+
return !!element.closest('[fExternalItem]');
|
|
2970
|
+
}
|
|
2971
|
+
function getExternalItem(element) {
|
|
2972
|
+
return element.closest('[fExternalItem]');
|
|
2998
2973
|
}
|
|
2999
2974
|
|
|
3000
|
-
class
|
|
3001
|
-
|
|
3002
|
-
|
|
2975
|
+
class FExternalItemService {
|
|
2976
|
+
constructor() {
|
|
2977
|
+
this.items = [];
|
|
3003
2978
|
}
|
|
3004
|
-
|
|
3005
|
-
this.
|
|
3006
|
-
this.inputsUnderPointerHandler = inputsUnderPointerHandler;
|
|
3007
|
-
this.firstNotConnectedInputOfNodeUnderPointerHandler = firstNotConnectedInputOfNodeUnderPointerHandler;
|
|
2979
|
+
registerItem(item) {
|
|
2980
|
+
this.items.push(item);
|
|
3008
2981
|
}
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
const output = this.fComponentsStore.fOutputs.find((x) => x.id === payload.dragHandler.connection.fOutputId);
|
|
3012
|
-
if (!output) {
|
|
3013
|
-
throw OutputNotFound(payload.dragHandler.connection.fOutputId);
|
|
3014
|
-
}
|
|
3015
|
-
return inputsUnderPointer.filter((x) => {
|
|
3016
|
-
const targetNode = this.fNodes.find((y) => y.isContains(x.hostElement));
|
|
3017
|
-
const sourceNode = this.fNodes.find((y) => y.isContains(output.hostElement));
|
|
3018
|
-
return sourceNode?.hostElement !== targetNode?.hostElement;
|
|
3019
|
-
});
|
|
2982
|
+
getItem(element) {
|
|
2983
|
+
return this.items.find(item => item.hostElement === element);
|
|
3020
2984
|
}
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
inputs.push(input);
|
|
2985
|
+
removeItem(item) {
|
|
2986
|
+
const index = this.items.indexOf(item);
|
|
2987
|
+
if (index !== -1) {
|
|
2988
|
+
this.items.splice(index, 1);
|
|
3026
2989
|
}
|
|
3027
|
-
inputs = inputs.filter((x) => x.canBeConnected);
|
|
3028
|
-
return inputs;
|
|
3029
2990
|
}
|
|
3030
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
3031
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
2991
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FExternalItemService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2992
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FExternalItemService, providedIn: 'root' }); }
|
|
3032
2993
|
}
|
|
3033
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
3034
|
-
type: Injectable
|
|
3035
|
-
|
|
2994
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FExternalItemService, decorators: [{
|
|
2995
|
+
type: Injectable,
|
|
2996
|
+
args: [{
|
|
2997
|
+
providedIn: 'root'
|
|
2998
|
+
}]
|
|
2999
|
+
}] });
|
|
3036
3000
|
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
this.
|
|
3041
|
-
this.findInputsUnderPointerHandler = findInputsUnderPointerHandler;
|
|
3042
|
-
this.findFirstCanBeConnectedOutputByOutletHandler = findFirstCanBeConnectedOutputByOutletHandler;
|
|
3001
|
+
let uniqueId$1 = 0;
|
|
3002
|
+
class FExternalItemDirective extends FExternalItemBase {
|
|
3003
|
+
get hostElement() {
|
|
3004
|
+
return this.elementReference.nativeElement;
|
|
3043
3005
|
}
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
if (inputsUnderPointer.length > 0) {
|
|
3050
|
-
let output = this.fComponentsStore.fOutputs.find((x) => x.id === handler.connection.fOutputId);
|
|
3051
|
-
if (!output) {
|
|
3052
|
-
output = this.fComponentsStore.fOutlets.find((x) => x.id === handler.connection.fOutputId);
|
|
3053
|
-
}
|
|
3054
|
-
if (!output) {
|
|
3055
|
-
throw OutputNotFound(handler.connection.fOutputId);
|
|
3056
|
-
}
|
|
3057
|
-
const isOutlet = isNodeOutlet(output.hostElement);
|
|
3058
|
-
if (isOutlet) {
|
|
3059
|
-
output = this.findFirstCanBeConnectedOutputByOutletHandler.handle(output);
|
|
3060
|
-
if (!output) {
|
|
3061
|
-
throw requiredOutput();
|
|
3062
|
-
}
|
|
3063
|
-
}
|
|
3064
|
-
this.fComponentsStore.fDraggable?.fCreateConnection.emit(new CreateConnectionEvent(output.id, inputsUnderPointer[0]?.id));
|
|
3065
|
-
}
|
|
3066
|
-
handler.complete();
|
|
3067
|
-
}
|
|
3006
|
+
constructor(elementReference, fExternalItemService) {
|
|
3007
|
+
super();
|
|
3008
|
+
this.elementReference = elementReference;
|
|
3009
|
+
this.fExternalItemService = fExternalItemService;
|
|
3010
|
+
this.id = `f-external-item-${uniqueId$1++}`;
|
|
3068
3011
|
}
|
|
3069
|
-
|
|
3070
|
-
|
|
3012
|
+
ngOnInit() {
|
|
3013
|
+
this.fExternalItemService.registerItem(this);
|
|
3014
|
+
}
|
|
3015
|
+
ngOnDestroy() {
|
|
3016
|
+
this.fExternalItemService.removeItem(this);
|
|
3017
|
+
}
|
|
3018
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FExternalItemDirective, deps: [{ token: i0.ElementRef }, { token: FExternalItemService }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
3019
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.1", type: FExternalItemDirective, selector: "[fExternalItem]", inputs: { id: "id", data: "data" }, host: { properties: { "attr.id": "id" }, classAttribute: "f-component f-external-item" }, providers: [
|
|
3020
|
+
{ provide: F_EXTERNAL_ITEM, useExisting: FExternalItemDirective }
|
|
3021
|
+
], usesInheritance: true, ngImport: i0 }); }
|
|
3071
3022
|
}
|
|
3072
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
3073
|
-
type:
|
|
3074
|
-
|
|
3023
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FExternalItemDirective, decorators: [{
|
|
3024
|
+
type: Directive,
|
|
3025
|
+
args: [{
|
|
3026
|
+
selector: "[fExternalItem]",
|
|
3027
|
+
host: {
|
|
3028
|
+
'[attr.id]': 'id',
|
|
3029
|
+
class: "f-component f-external-item",
|
|
3030
|
+
},
|
|
3031
|
+
providers: [
|
|
3032
|
+
{ provide: F_EXTERNAL_ITEM, useExisting: FExternalItemDirective }
|
|
3033
|
+
],
|
|
3034
|
+
}]
|
|
3035
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: FExternalItemService }], propDecorators: { id: [{
|
|
3036
|
+
type: Input
|
|
3037
|
+
}], data: [{
|
|
3038
|
+
type: Input
|
|
3039
|
+
}] } });
|
|
3075
3040
|
|
|
3076
|
-
class
|
|
3041
|
+
class ExternalItemPrepareDragSequence {
|
|
3077
3042
|
get transform() {
|
|
3078
3043
|
return this.fComponentsStore.fCanvas.transform;
|
|
3079
3044
|
}
|
|
3080
3045
|
get flowHost() {
|
|
3081
3046
|
return this.fComponentsStore.fFlow.hostElement;
|
|
3082
3047
|
}
|
|
3083
|
-
constructor(fComponentsStore, fDraggableDataContext,
|
|
3048
|
+
constructor(fComponentsStore, fDraggableDataContext, fExternalItemService) {
|
|
3084
3049
|
this.fComponentsStore = fComponentsStore;
|
|
3085
3050
|
this.fDraggableDataContext = fDraggableDataContext;
|
|
3086
|
-
this.
|
|
3087
|
-
this.getConnectionVectorHandler = getConnectionVectorHandler;
|
|
3088
|
-
this.findFirstCanBeConnectedOutputByOutletHandler = findFirstCanBeConnectedOutputByOutletHandler;
|
|
3089
|
-
this.getOutputRectInFlowHandler = getOutputRectInFlowHandler;
|
|
3051
|
+
this.fExternalItemService = fExternalItemService;
|
|
3090
3052
|
}
|
|
3091
3053
|
handle(event) {
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
}
|
|
3097
|
-
if (isNodeOutlet(event.targetElement)) {
|
|
3098
|
-
const outlet = this.fComponentsStore.fOutlets.find((x) => {
|
|
3099
|
-
return x.hostElement.contains(event.targetElement);
|
|
3100
|
-
});
|
|
3101
|
-
if (!outlet) {
|
|
3102
|
-
throw new Error('Outlet not found');
|
|
3103
|
-
}
|
|
3104
|
-
const nodeOutputs = this.fComponentsStore.fOutputs.filter((x) => node.isContains(x.hostElement));
|
|
3105
|
-
outlet.setOutputs(nodeOutputs);
|
|
3106
|
-
if (outlet.canBeConnected) {
|
|
3107
|
-
const outletCenter = this.getElementRectInFlowHandler.handle(outlet.hostElement).gravityCenter;
|
|
3108
|
-
if (outlet.isConnectionFromOutlet) {
|
|
3109
|
-
this.createConnectionHandler(pointerPositionInFlow, outlet, outletCenter);
|
|
3110
|
-
}
|
|
3111
|
-
else {
|
|
3112
|
-
const output = this.findFirstCanBeConnectedOutputByOutletHandler.handle(outlet);
|
|
3113
|
-
if (!output) {
|
|
3114
|
-
throw new Error('Output not found');
|
|
3115
|
-
}
|
|
3116
|
-
this.createConnectionHandler(pointerPositionInFlow, output, outletCenter);
|
|
3117
|
-
}
|
|
3118
|
-
}
|
|
3119
|
-
}
|
|
3120
|
-
else if (this.isNodeOutput(event.targetElement, node)) {
|
|
3121
|
-
const output = this.fComponentsStore.fOutputs.find((x) => {
|
|
3122
|
-
return x.hostElement.contains(event.targetElement);
|
|
3123
|
-
});
|
|
3124
|
-
if (!output) {
|
|
3125
|
-
throw new Error('Output not found');
|
|
3126
|
-
}
|
|
3127
|
-
if (output.canBeConnected) {
|
|
3128
|
-
const outputCenter = this.getElementRectInFlowHandler.handle(output.hostElement).gravityCenter;
|
|
3129
|
-
this.createConnectionHandler(pointerPositionInFlow, output, outputCenter);
|
|
3054
|
+
if (isExternalItem(event.targetElement)) {
|
|
3055
|
+
const item = this.fExternalItemService.getItem(getExternalItem(event.targetElement));
|
|
3056
|
+
if (!item) {
|
|
3057
|
+
throw new Error('External item not found');
|
|
3130
3058
|
}
|
|
3059
|
+
const pointerPositionInFlow = Point.fromPoint(event.getPosition()).elementTransform(this.flowHost);
|
|
3060
|
+
this.fDraggableDataContext.onPointerDownScale = 1;
|
|
3061
|
+
this.fDraggableDataContext.onPointerDownPosition = pointerPositionInFlow.div(1);
|
|
3062
|
+
this.fDraggableDataContext.draggableItems = [
|
|
3063
|
+
new ExternalItemDragHandler(item)
|
|
3064
|
+
];
|
|
3131
3065
|
}
|
|
3132
3066
|
}
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
this.fComponentsStore.fTempConnection.initialize();
|
|
3136
|
-
this.fDraggableDataContext.onPointerDownScale = this.transform.scale;
|
|
3137
|
-
this.fDraggableDataContext.onPointerDownPosition = pointerPositionInCanvas.div(this.transform.scale);
|
|
3138
|
-
this.fDraggableDataContext.draggableItems = [
|
|
3139
|
-
new CreateConnectionDragHandler(this.getOutputRectInFlowHandler, this.getConnectionVectorHandler, this.fComponentsStore.fTempConnection, outputCenter)
|
|
3140
|
-
];
|
|
3141
|
-
}
|
|
3142
|
-
isNodeOutput(targetElement, node) {
|
|
3143
|
-
const outlets = this.fComponentsStore.fOutlets.filter((x) => node.isContains(x.hostElement));
|
|
3144
|
-
return isNodeOutput(targetElement) && !outlets.length;
|
|
3145
|
-
}
|
|
3146
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: CreateConnectionPrepareDragSequence, deps: [{ token: FComponentsStore }, { token: FDraggableDataContext }, { token: GetElementRectInFlowHandler }, { token: GetConnectionVectorHandler }, { token: FindFirstCanBeConnectedOutputByOutletHandler }, { token: GetOutputRectInFlowHandler }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3147
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: CreateConnectionPrepareDragSequence }); }
|
|
3067
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ExternalItemPrepareDragSequence, deps: [{ token: FComponentsStore }, { token: FDraggableDataContext }, { token: FExternalItemService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3068
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ExternalItemPrepareDragSequence }); }
|
|
3148
3069
|
}
|
|
3149
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
3070
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ExternalItemPrepareDragSequence, decorators: [{
|
|
3150
3071
|
type: Injectable
|
|
3151
|
-
}], ctorParameters: () => [{ type: FComponentsStore }, { type: FDraggableDataContext }, { type:
|
|
3152
|
-
|
|
3153
|
-
class ReassignConnectionDragHandler {
|
|
3154
|
-
constructor(getInputRectInFlowHandler, getOutputRectInFlowHandler, getConnectionVectorHandler, connection) {
|
|
3155
|
-
this.getInputRectInFlowHandler = getInputRectInFlowHandler;
|
|
3156
|
-
this.getOutputRectInFlowHandler = getOutputRectInFlowHandler;
|
|
3157
|
-
this.getConnectionVectorHandler = getConnectionVectorHandler;
|
|
3158
|
-
this.connection = connection;
|
|
3159
|
-
this.type = EFDraggableType.REASSIGN_CONNECTION;
|
|
3160
|
-
this.onPointerDownFromConnectorRect = RectExtensions.initialize();
|
|
3161
|
-
this.onPointerDownToConnectorRect = RectExtensions.initialize();
|
|
3162
|
-
this.outputSide = EFConnectableSide.BOTTOM;
|
|
3163
|
-
this.inputSide = EFConnectableSide.TOP;
|
|
3164
|
-
}
|
|
3165
|
-
initialize() {
|
|
3166
|
-
const fromConnector = this.getOutputRectInFlowHandler.handle(this.connection.fOutputId);
|
|
3167
|
-
this.inputSide = this.getInputRectInFlowHandler.handle(this.connection.fInputId).fConnectableSide;
|
|
3168
|
-
this.outputSide = fromConnector.fConnectableSide;
|
|
3169
|
-
this.onPointerDownFromConnectorRect = fromConnector.rect;
|
|
3170
|
-
this.onPointerDownToConnectorRect = RectExtensions.initialize(this.connection.vector.point2.x, this.connection.vector.point2.y, 0, 0);
|
|
3171
|
-
}
|
|
3172
|
-
move(difference) {
|
|
3173
|
-
const toRect = RectExtensions.addPoint(this.onPointerDownToConnectorRect, difference);
|
|
3174
|
-
const vector = this.getConnectionVectorHandler.handle(new GetConnectionVectorRequest(this.onPointerDownFromConnectorRect, toRect, this.connection.fBehavior, this.outputSide, this.inputSide));
|
|
3175
|
-
this.connection.setVector(vector.point1, this.outputSide, vector.point2, this.inputSide);
|
|
3176
|
-
this.connection.redraw();
|
|
3177
|
-
}
|
|
3178
|
-
complete() {
|
|
3179
|
-
const fromConnector = this.getOutputRectInFlowHandler.handle(this.connection.fOutputId);
|
|
3180
|
-
const toConnector = this.getInputRectInFlowHandler.handle(this.connection.fInputId);
|
|
3181
|
-
const vector = this.getConnectionVectorHandler.handle(new GetConnectionVectorRequest(fromConnector.rect, toConnector.rect, this.connection.fBehavior, fromConnector.fConnectableSide, toConnector.fConnectableSide));
|
|
3182
|
-
this.connection.setVector(vector.point1, fromConnector.fConnectableSide, vector.point2, toConnector.fConnectableSide);
|
|
3183
|
-
this.connection.redraw();
|
|
3184
|
-
}
|
|
3185
|
-
}
|
|
3072
|
+
}], ctorParameters: () => [{ type: FComponentsStore }, { type: FDraggableDataContext }, { type: FExternalItemService }] });
|
|
3186
3073
|
|
|
3187
|
-
class
|
|
3188
|
-
|
|
3189
|
-
this.
|
|
3190
|
-
this.outputId = outputId;
|
|
3191
|
-
this.oldInputId = oldInputId;
|
|
3192
|
-
this.newInputId = newInputId;
|
|
3074
|
+
class ExternalItemOnPointerUp {
|
|
3075
|
+
get flowHost() {
|
|
3076
|
+
return this.fComponentsStore.fFlow.hostElement;
|
|
3193
3077
|
}
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
class ReassignConnectionOnPointerUp {
|
|
3197
|
-
get fDraggable() {
|
|
3198
|
-
return this.fComponentsStore.fDraggable;
|
|
3078
|
+
get fCreateNode() {
|
|
3079
|
+
return this.fComponentsStore.fDraggable.fCreateNode;
|
|
3199
3080
|
}
|
|
3200
|
-
constructor(fComponentsStore, fDraggableDataContext,
|
|
3081
|
+
constructor(fComponentsStore, fDraggableDataContext, getElementRectInFlowHandler) {
|
|
3201
3082
|
this.fComponentsStore = fComponentsStore;
|
|
3202
3083
|
this.fDraggableDataContext = fDraggableDataContext;
|
|
3203
|
-
this.
|
|
3084
|
+
this.getElementRectInFlowHandler = getElementRectInFlowHandler;
|
|
3204
3085
|
}
|
|
3205
3086
|
handle(event) {
|
|
3206
|
-
const
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3087
|
+
const pointerPositionInFlow = Point.fromPoint(event.getPosition()).elementTransform(this.flowHost);
|
|
3088
|
+
let difference = pointerPositionInFlow.div(this.fDraggableDataContext.onPointerDownScale).sub(this.fDraggableDataContext.onPointerDownPosition);
|
|
3089
|
+
const isDragPaletteItem = this.fDraggableDataContext.draggableItems.some((x) => x.type === EFDraggableType.PALETTE_ITEM);
|
|
3090
|
+
if (isDragPaletteItem) {
|
|
3091
|
+
const dragHandler = this.fDraggableDataContext.draggableItems[0];
|
|
3092
|
+
dragHandler.move(difference);
|
|
3093
|
+
const isPointerInCanvasRect = document.elementsFromPoint(event.getPosition().x, event.getPosition().y).some((x) => x === this.flowHost);
|
|
3094
|
+
if (isPointerInCanvasRect) {
|
|
3095
|
+
const rectInCanvas = this.getElementRectInFlowHandler.handle(dragHandler.placeholder);
|
|
3096
|
+
this.fCreateNode.emit(new FCreateNodeEvent(rectInCanvas, dragHandler.externalItem.data));
|
|
3214
3097
|
}
|
|
3215
|
-
|
|
3098
|
+
dragHandler.complete();
|
|
3216
3099
|
}
|
|
3217
3100
|
}
|
|
3218
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
3219
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
3101
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ExternalItemOnPointerUp, deps: [{ token: FComponentsStore }, { token: FDraggableDataContext }, { token: GetElementRectInFlowHandler }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3102
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ExternalItemOnPointerUp }); }
|
|
3220
3103
|
}
|
|
3221
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
3104
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ExternalItemOnPointerUp, decorators: [{
|
|
3222
3105
|
type: Injectable
|
|
3223
|
-
}], ctorParameters: () => [{ type: FComponentsStore }, { type: FDraggableDataContext }, { type:
|
|
3106
|
+
}], ctorParameters: () => [{ type: FComponentsStore }, { type: FDraggableDataContext }, { type: GetElementRectInFlowHandler }] });
|
|
3224
3107
|
|
|
3225
|
-
|
|
3108
|
+
const EXTERNAL_ITEM_PROVIDERS = [
|
|
3109
|
+
ExternalItemOnPointerUp,
|
|
3110
|
+
ExternalItemPrepareDragSequence
|
|
3111
|
+
];
|
|
3112
|
+
|
|
3113
|
+
class IsConnectionUnderNodeHandler {
|
|
3226
3114
|
get transform() {
|
|
3227
3115
|
return this.fComponentsStore.fCanvas.transform;
|
|
3228
3116
|
}
|
|
3229
3117
|
get flowHost() {
|
|
3230
3118
|
return this.fComponentsStore.fFlow.hostElement;
|
|
3231
3119
|
}
|
|
3232
|
-
constructor(fComponentsStore, fDraggableDataContext,
|
|
3120
|
+
constructor(fComponentsStore, fDraggableDataContext, getElementRectInFlowHandler, getOutgoingConnectionsHandler, getIncomingConnectionsHandler) {
|
|
3233
3121
|
this.fComponentsStore = fComponentsStore;
|
|
3234
3122
|
this.fDraggableDataContext = fDraggableDataContext;
|
|
3235
|
-
this.
|
|
3236
|
-
this.
|
|
3237
|
-
this.
|
|
3238
|
-
this.getConnectionVectorHandler = getConnectionVectorHandler;
|
|
3239
|
-
this.updateConnectionLayerHandler = updateConnectionLayerHandler;
|
|
3123
|
+
this.getElementRectInFlowHandler = getElementRectInFlowHandler;
|
|
3124
|
+
this.getOutgoingConnectionsHandler = getOutgoingConnectionsHandler;
|
|
3125
|
+
this.getIncomingConnectionsHandler = getIncomingConnectionsHandler;
|
|
3240
3126
|
}
|
|
3241
|
-
handle(
|
|
3242
|
-
const
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3127
|
+
handle() {
|
|
3128
|
+
const isValid = this.isValidRequest();
|
|
3129
|
+
if (!isValid) {
|
|
3130
|
+
return;
|
|
3131
|
+
}
|
|
3132
|
+
const fNode = this.fDraggableDataContext.draggableItems[0].fNode;
|
|
3133
|
+
const outputsOfNode = this.getOutputsForNode(fNode);
|
|
3134
|
+
const inputsOfNode = this.getInputsForNode(fNode);
|
|
3135
|
+
const isCantBeConnectedByOutput = outputsOfNode.some((x) => !x.canBeConnected);
|
|
3136
|
+
const isCantBeConnectedByInput = this.fComponentsStore.fConnections.some((x) => {
|
|
3137
|
+
return inputsOfNode.find((input) => input.id === x.fInputId);
|
|
3247
3138
|
});
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
const
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
this.fDraggableDataContext.onPointerDownScale = this.transform.scale;
|
|
3258
|
-
this.fDraggableDataContext.onPointerDownPosition = pointerPositionInFlow.div(this.transform.scale);
|
|
3259
|
-
this.fDraggableDataContext.draggableItems = [
|
|
3260
|
-
new ReassignConnectionDragHandler(this.getInputRectInFlowHandler, this.getOutputRectInFlowHandler, this.getConnectionVectorHandler, connectionToReassign)
|
|
3261
|
-
];
|
|
3262
|
-
}
|
|
3263
|
-
}
|
|
3264
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ReassignConnectionPrepareDragSequence, deps: [{ token: FComponentsStore }, { token: FDraggableDataContext }, { token: GetConnectionHandler }, { token: GetInputRectInFlowHandler }, { token: GetOutputRectInFlowHandler }, { token: GetConnectionVectorHandler }, { token: UpdateConnectionLayerHandler }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3265
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ReassignConnectionPrepareDragSequence }); }
|
|
3266
|
-
}
|
|
3267
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ReassignConnectionPrepareDragSequence, decorators: [{
|
|
3268
|
-
type: Injectable
|
|
3269
|
-
}], ctorParameters: () => [{ type: FComponentsStore }, { type: FDraggableDataContext }, { type: GetConnectionHandler }, { type: GetInputRectInFlowHandler }, { type: GetOutputRectInFlowHandler }, { type: GetConnectionVectorHandler }, { type: UpdateConnectionLayerHandler }] });
|
|
3270
|
-
|
|
3271
|
-
const CONNECTIONS_PROVIDERS = [
|
|
3272
|
-
FindFirstCanBeConnectedOutputByOutletHandler,
|
|
3273
|
-
CreateConnectionOnPointerUp,
|
|
3274
|
-
CreateConnectionPrepareDragSequence,
|
|
3275
|
-
FirstNotConnectedInputOfNodeUnderPointerHandler,
|
|
3276
|
-
InputsUnderPointerHandler,
|
|
3277
|
-
FindInputsUnderPointerHandler,
|
|
3278
|
-
ReassignConnectionOnPointerUp,
|
|
3279
|
-
ReassignConnectionPrepareDragSequence
|
|
3280
|
-
];
|
|
3281
|
-
|
|
3282
|
-
class CreateNodeEvent {
|
|
3283
|
-
constructor(rect, data) {
|
|
3284
|
-
this.rect = rect;
|
|
3285
|
-
this.data = data;
|
|
3286
|
-
}
|
|
3287
|
-
}
|
|
3288
|
-
|
|
3289
|
-
class ExternalItemDragHandler {
|
|
3290
|
-
constructor(externalItem) {
|
|
3291
|
-
this.externalItem = externalItem;
|
|
3292
|
-
this.type = EFDraggableType.PALETTE_ITEM;
|
|
3293
|
-
this.onPointerDownRect = RectExtensions.initialize();
|
|
3294
|
-
this.difference = PointExtensions.initialize();
|
|
3295
|
-
}
|
|
3296
|
-
getStyle(position) {
|
|
3297
|
-
return `position: absolute; left: 0; top: 0; transform: translate(${position.x}px, ${position.y}px)`;
|
|
3298
|
-
}
|
|
3299
|
-
initialize() {
|
|
3300
|
-
this.onPointerDownRect = this.getExternalItemRect();
|
|
3301
|
-
this.placeholder = DomElementExtensions.deepCloneNode(this.externalItem.hostElement);
|
|
3302
|
-
document.body.appendChild(this.placeholder);
|
|
3303
|
-
}
|
|
3304
|
-
getExternalItemRect() {
|
|
3305
|
-
const rect = this.externalItem.hostElement.getBoundingClientRect();
|
|
3306
|
-
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
3307
|
-
const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
|
|
3308
|
-
const offsetTop = rect.top + scrollTop;
|
|
3309
|
-
const offsetLeft = rect.left + scrollLeft;
|
|
3310
|
-
return RectExtensions.initialize(offsetLeft, offsetTop, rect.width, rect.height);
|
|
3311
|
-
}
|
|
3312
|
-
move(difference) {
|
|
3313
|
-
this.difference = difference;
|
|
3314
|
-
const position = Point.fromPoint(this.onPointerDownRect).add(this.difference);
|
|
3315
|
-
this.placeholder.setAttribute('style', this.getStyle(position));
|
|
3316
|
-
}
|
|
3317
|
-
getPlaceholderRect() {
|
|
3318
|
-
return RectExtensions.fromElement(this.placeholder);
|
|
3319
|
-
}
|
|
3320
|
-
complete() {
|
|
3321
|
-
document.body.removeChild(this.placeholder);
|
|
3322
|
-
}
|
|
3323
|
-
}
|
|
3324
|
-
|
|
3325
|
-
class ExternalItemPrepareDragSequence {
|
|
3326
|
-
get transform() {
|
|
3327
|
-
return this.fComponentsStore.fCanvas.transform;
|
|
3328
|
-
}
|
|
3329
|
-
get flowHost() {
|
|
3330
|
-
return this.fComponentsStore.fFlow.hostElement;
|
|
3331
|
-
}
|
|
3332
|
-
constructor(fComponentsStore, fDraggableDataContext, fExternalItemService) {
|
|
3333
|
-
this.fComponentsStore = fComponentsStore;
|
|
3334
|
-
this.fDraggableDataContext = fDraggableDataContext;
|
|
3335
|
-
this.fExternalItemService = fExternalItemService;
|
|
3336
|
-
}
|
|
3337
|
-
handle(event) {
|
|
3338
|
-
if (isExternalItem(event.targetElement)) {
|
|
3339
|
-
const item = this.fExternalItemService.getItem(getExternalItem(event.targetElement));
|
|
3340
|
-
if (!item) {
|
|
3341
|
-
throw new Error('External item not found');
|
|
3342
|
-
}
|
|
3343
|
-
const pointerPositionInFlow = Point.fromPoint(event.getPosition()).elementTransform(this.flowHost);
|
|
3344
|
-
this.fDraggableDataContext.onPointerDownScale = 1;
|
|
3345
|
-
this.fDraggableDataContext.onPointerDownPosition = pointerPositionInFlow.div(1);
|
|
3346
|
-
this.fDraggableDataContext.draggableItems = [
|
|
3347
|
-
new ExternalItemDragHandler(item)
|
|
3348
|
-
];
|
|
3349
|
-
}
|
|
3350
|
-
}
|
|
3351
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ExternalItemPrepareDragSequence, deps: [{ token: FComponentsStore }, { token: FDraggableDataContext }, { token: FExternalItemService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3352
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ExternalItemPrepareDragSequence }); }
|
|
3353
|
-
}
|
|
3354
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ExternalItemPrepareDragSequence, decorators: [{
|
|
3355
|
-
type: Injectable
|
|
3356
|
-
}], ctorParameters: () => [{ type: FComponentsStore }, { type: FDraggableDataContext }, { type: FExternalItemService }] });
|
|
3357
|
-
|
|
3358
|
-
class ExternalItemOnPointerUp {
|
|
3359
|
-
get flowHost() {
|
|
3360
|
-
return this.fComponentsStore.fFlow.hostElement;
|
|
3361
|
-
}
|
|
3362
|
-
get fCreateNode() {
|
|
3363
|
-
return this.fComponentsStore.fDraggable.fCreateNode;
|
|
3364
|
-
}
|
|
3365
|
-
constructor(fComponentsStore, fDraggableDataContext, getElementRectInFlowHandler) {
|
|
3366
|
-
this.fComponentsStore = fComponentsStore;
|
|
3367
|
-
this.fDraggableDataContext = fDraggableDataContext;
|
|
3368
|
-
this.getElementRectInFlowHandler = getElementRectInFlowHandler;
|
|
3369
|
-
}
|
|
3370
|
-
handle(event) {
|
|
3371
|
-
const pointerPositionInFlow = Point.fromPoint(event.getPosition()).elementTransform(this.flowHost);
|
|
3372
|
-
let difference = pointerPositionInFlow.div(this.fDraggableDataContext.onPointerDownScale).sub(this.fDraggableDataContext.onPointerDownPosition);
|
|
3373
|
-
const isDragPaletteItem = this.fDraggableDataContext.draggableItems.some((x) => x.type === EFDraggableType.PALETTE_ITEM);
|
|
3374
|
-
if (isDragPaletteItem) {
|
|
3375
|
-
const dragHandler = this.fDraggableDataContext.draggableItems[0];
|
|
3376
|
-
dragHandler.move(difference);
|
|
3377
|
-
const isPointerInCanvasRect = document.elementsFromPoint(event.getPosition().x, event.getPosition().y).some((x) => x === this.flowHost);
|
|
3378
|
-
if (isPointerInCanvasRect) {
|
|
3379
|
-
const rectInCanvas = this.getElementRectInFlowHandler.handle(dragHandler.placeholder);
|
|
3380
|
-
this.fCreateNode.emit(new CreateNodeEvent(rectInCanvas, dragHandler.externalItem.data));
|
|
3381
|
-
}
|
|
3382
|
-
dragHandler.complete();
|
|
3383
|
-
}
|
|
3384
|
-
}
|
|
3385
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ExternalItemOnPointerUp, deps: [{ token: FComponentsStore }, { token: FDraggableDataContext }, { token: GetElementRectInFlowHandler }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3386
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ExternalItemOnPointerUp }); }
|
|
3387
|
-
}
|
|
3388
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: ExternalItemOnPointerUp, decorators: [{
|
|
3389
|
-
type: Injectable
|
|
3390
|
-
}], ctorParameters: () => [{ type: FComponentsStore }, { type: FDraggableDataContext }, { type: GetElementRectInFlowHandler }] });
|
|
3391
|
-
|
|
3392
|
-
const EXTERNAL_ITEM_PROVIDERS = [
|
|
3393
|
-
ExternalItemOnPointerUp,
|
|
3394
|
-
ExternalItemPrepareDragSequence
|
|
3395
|
-
];
|
|
3396
|
-
|
|
3397
|
-
class IsConnectionUnderNodeHandler {
|
|
3398
|
-
get transform() {
|
|
3399
|
-
return this.fComponentsStore.fCanvas.transform;
|
|
3400
|
-
}
|
|
3401
|
-
get flowHost() {
|
|
3402
|
-
return this.fComponentsStore.fFlow.hostElement;
|
|
3403
|
-
}
|
|
3404
|
-
constructor(fComponentsStore, fDraggableDataContext, getElementRectInFlowHandler, getOutgoingConnectionsHandler, getIncomingConnectionsHandler) {
|
|
3405
|
-
this.fComponentsStore = fComponentsStore;
|
|
3406
|
-
this.fDraggableDataContext = fDraggableDataContext;
|
|
3407
|
-
this.getElementRectInFlowHandler = getElementRectInFlowHandler;
|
|
3408
|
-
this.getOutgoingConnectionsHandler = getOutgoingConnectionsHandler;
|
|
3409
|
-
this.getIncomingConnectionsHandler = getIncomingConnectionsHandler;
|
|
3410
|
-
}
|
|
3411
|
-
handle() {
|
|
3412
|
-
const isValid = this.isValidRequest();
|
|
3413
|
-
if (!isValid) {
|
|
3414
|
-
return;
|
|
3415
|
-
}
|
|
3416
|
-
const fNode = this.fDraggableDataContext.draggableItems[0].fNode;
|
|
3417
|
-
const outputsOfNode = this.getOutputsForNode(fNode);
|
|
3418
|
-
const inputsOfNode = this.getInputsForNode(fNode);
|
|
3419
|
-
const isCantBeConnectedByOutput = outputsOfNode.some((x) => !x.canBeConnected);
|
|
3420
|
-
const isCantBeConnectedByInput = this.fComponentsStore.fConnections.some((x) => {
|
|
3421
|
-
return inputsOfNode.find((input) => input.id === x.fInputId);
|
|
3422
|
-
});
|
|
3423
|
-
if (!isCantBeConnectedByInput && outputsOfNode.length && !isCantBeConnectedByOutput && inputsOfNode.length) {
|
|
3424
|
-
const output = outputsOfNode[0];
|
|
3425
|
-
const input = inputsOfNode[0];
|
|
3426
|
-
const outgoingConnections = this.getOutgoingConnectionsHandler.handle([output]);
|
|
3427
|
-
const incomingConnections = this.getIncomingConnectionsHandler.handle([input]);
|
|
3428
|
-
if (outgoingConnections.length === 0 && incomingConnections.length === 0) {
|
|
3429
|
-
const connections = this.findConnectionsUnderNode(fNode);
|
|
3430
|
-
if (connections.length) {
|
|
3431
|
-
}
|
|
3139
|
+
if (!isCantBeConnectedByInput && outputsOfNode.length && !isCantBeConnectedByOutput && inputsOfNode.length) {
|
|
3140
|
+
const output = outputsOfNode[0];
|
|
3141
|
+
const input = inputsOfNode[0];
|
|
3142
|
+
const outgoingConnections = this.getOutgoingConnectionsHandler.handle([output]);
|
|
3143
|
+
const incomingConnections = this.getIncomingConnectionsHandler.handle([input]);
|
|
3144
|
+
if (outgoingConnections.length === 0 && incomingConnections.length === 0) {
|
|
3145
|
+
const connections = this.findConnectionsUnderNode(fNode);
|
|
3146
|
+
if (connections.length) {
|
|
3147
|
+
}
|
|
3432
3148
|
}
|
|
3433
3149
|
}
|
|
3434
3150
|
}
|
|
@@ -3458,10 +3174,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImpor
|
|
|
3458
3174
|
}], ctorParameters: () => [{ type: FComponentsStore }, { type: FDraggableDataContext }, { type: GetElementRectInFlowHandler }, { type: GetOutgoingConnectionsHandler }, { type: GetIncomingConnectionsHandler }] });
|
|
3459
3175
|
|
|
3460
3176
|
class ConnectionDragHandler {
|
|
3461
|
-
constructor(getInputRectInFlowHandler,
|
|
3177
|
+
constructor(getInputRectInFlowHandler, fMediator, connection) {
|
|
3462
3178
|
this.getInputRectInFlowHandler = getInputRectInFlowHandler;
|
|
3463
|
-
this.
|
|
3464
|
-
this.getConnectionVectorHandler = getConnectionVectorHandler;
|
|
3179
|
+
this.fMediator = fMediator;
|
|
3465
3180
|
this.connection = connection;
|
|
3466
3181
|
this.type = EFDraggableType.CONNECTION;
|
|
3467
3182
|
this.onPointerDownVector = VectorExtensions.initialize();
|
|
@@ -3469,11 +3184,11 @@ class ConnectionDragHandler {
|
|
|
3469
3184
|
this.toConnectorSide = EFConnectableSide.TOP;
|
|
3470
3185
|
}
|
|
3471
3186
|
initialize() {
|
|
3472
|
-
const fromConnector = this.
|
|
3187
|
+
const fromConnector = this.fMediator.send(new GetOutputRectInFlowRequest(this.connection.fOutputId));
|
|
3473
3188
|
this.fromConnectorSide = fromConnector.fConnectableSide;
|
|
3474
3189
|
const toConnector = this.getInputRectInFlowHandler.handle(this.connection.fInputId);
|
|
3475
3190
|
this.toConnectorSide = toConnector.fConnectableSide;
|
|
3476
|
-
this.onPointerDownVector = this.
|
|
3191
|
+
this.onPointerDownVector = this.fMediator.send(new GetConnectionVectorRequest(fromConnector.rect, toConnector.rect, this.connection.fBehavior, fromConnector.fConnectableSide, toConnector.fConnectableSide));
|
|
3477
3192
|
}
|
|
3478
3193
|
move(difference) {
|
|
3479
3194
|
const fromPoint = Point.fromPoint(this.onPointerDownVector.point1).add(difference);
|
|
@@ -3484,10 +3199,9 @@ class ConnectionDragHandler {
|
|
|
3484
3199
|
}
|
|
3485
3200
|
|
|
3486
3201
|
class ConnectionSourceDragHandler {
|
|
3487
|
-
constructor(getInputRectInFlowHandler,
|
|
3202
|
+
constructor(getInputRectInFlowHandler, fMediator, connection) {
|
|
3488
3203
|
this.getInputRectInFlowHandler = getInputRectInFlowHandler;
|
|
3489
|
-
this.
|
|
3490
|
-
this.getConnectionVectorHandler = getConnectionVectorHandler;
|
|
3204
|
+
this.fMediator = fMediator;
|
|
3491
3205
|
this.connection = connection;
|
|
3492
3206
|
this.type = EFDraggableType.CONNECTION;
|
|
3493
3207
|
this.fromConnectorRect = RectExtensions.initialize();
|
|
@@ -3496,7 +3210,7 @@ class ConnectionSourceDragHandler {
|
|
|
3496
3210
|
this.toConnectorSide = EFConnectableSide.TOP;
|
|
3497
3211
|
}
|
|
3498
3212
|
initialize() {
|
|
3499
|
-
const fromConnector = this.
|
|
3213
|
+
const fromConnector = this.fMediator.send(new GetOutputRectInFlowRequest(this.connection.fOutputId));
|
|
3500
3214
|
this.fromConnectorRect = fromConnector.rect;
|
|
3501
3215
|
this.fromConnectorSide = fromConnector.fConnectableSide;
|
|
3502
3216
|
const toConnector = this.getInputRectInFlowHandler.handle(this.connection.fInputId);
|
|
@@ -3505,17 +3219,16 @@ class ConnectionSourceDragHandler {
|
|
|
3505
3219
|
}
|
|
3506
3220
|
move(difference) {
|
|
3507
3221
|
const fromConnectorRect = RectExtensions.addPoint(this.fromConnectorRect, difference);
|
|
3508
|
-
const vector = this.
|
|
3222
|
+
const vector = this.fMediator.send(new GetConnectionVectorRequest(fromConnectorRect, this.toConnectorRect, this.connection.fBehavior, this.fromConnectorSide, this.toConnectorSide));
|
|
3509
3223
|
this.connection.setVector(vector.point1, this.fromConnectorSide, vector.point2, this.toConnectorSide);
|
|
3510
3224
|
this.connection.redraw();
|
|
3511
3225
|
}
|
|
3512
3226
|
}
|
|
3513
3227
|
|
|
3514
3228
|
class ConnectionTargetDragHandler {
|
|
3515
|
-
constructor(getInputRectInFlowHandler,
|
|
3229
|
+
constructor(getInputRectInFlowHandler, fMediator, connection) {
|
|
3516
3230
|
this.getInputRectInFlowHandler = getInputRectInFlowHandler;
|
|
3517
|
-
this.
|
|
3518
|
-
this.getConnectionVectorHandler = getConnectionVectorHandler;
|
|
3231
|
+
this.fMediator = fMediator;
|
|
3519
3232
|
this.connection = connection;
|
|
3520
3233
|
this.type = EFDraggableType.CONNECTION;
|
|
3521
3234
|
this.fromConnectorRect = RectExtensions.initialize();
|
|
@@ -3524,7 +3237,7 @@ class ConnectionTargetDragHandler {
|
|
|
3524
3237
|
this.toConnectorSide = EFConnectableSide.TOP;
|
|
3525
3238
|
}
|
|
3526
3239
|
initialize() {
|
|
3527
|
-
const fromConnector = this.
|
|
3240
|
+
const fromConnector = this.fMediator.send(new GetOutputRectInFlowRequest(this.connection.fOutputId));
|
|
3528
3241
|
this.fromConnectorRect = fromConnector.rect;
|
|
3529
3242
|
this.fromConnectorSide = fromConnector.fConnectableSide;
|
|
3530
3243
|
const toConnector = this.getInputRectInFlowHandler.handle(this.connection.fInputId);
|
|
@@ -3533,7 +3246,7 @@ class ConnectionTargetDragHandler {
|
|
|
3533
3246
|
}
|
|
3534
3247
|
move(difference) {
|
|
3535
3248
|
const toConnectorRect = RectExtensions.addPoint(this.toConnectorRect, difference);
|
|
3536
|
-
const vector = this.
|
|
3249
|
+
const vector = this.fMediator.send(new GetConnectionVectorRequest(this.fromConnectorRect, toConnectorRect, this.connection.fBehavior, this.fromConnectorSide, this.toConnectorSide));
|
|
3537
3250
|
this.connection.setVector(vector.point1, this.fromConnectorSide, vector.point2, this.toConnectorSide);
|
|
3538
3251
|
this.connection.redraw();
|
|
3539
3252
|
}
|
|
@@ -3602,15 +3315,14 @@ class NodePrepareDragSequence {
|
|
|
3602
3315
|
get flowHost() {
|
|
3603
3316
|
return this.fComponentsStore.fFlow.hostElement;
|
|
3604
3317
|
}
|
|
3605
|
-
constructor(fComponentsStore, fDraggableDataContext, updateNodeLayerHandler, getInputRectInFlowHandler,
|
|
3318
|
+
constructor(fComponentsStore, fDraggableDataContext, updateNodeLayerHandler, getInputRectInFlowHandler, getOutgoingConnectionsHandler, getIncomingConnectionsHandler, fMediator) {
|
|
3606
3319
|
this.fComponentsStore = fComponentsStore;
|
|
3607
3320
|
this.fDraggableDataContext = fDraggableDataContext;
|
|
3608
3321
|
this.updateNodeLayerHandler = updateNodeLayerHandler;
|
|
3609
3322
|
this.getInputRectInFlowHandler = getInputRectInFlowHandler;
|
|
3610
|
-
this.getOutputRectInFlowHandler = getOutputRectInFlowHandler;
|
|
3611
3323
|
this.getOutgoingConnectionsHandler = getOutgoingConnectionsHandler;
|
|
3612
3324
|
this.getIncomingConnectionsHandler = getIncomingConnectionsHandler;
|
|
3613
|
-
this.
|
|
3325
|
+
this.fMediator = fMediator;
|
|
3614
3326
|
}
|
|
3615
3327
|
handle(event) {
|
|
3616
3328
|
const node = this.fComponentsStore.findNode(event.targetElement);
|
|
@@ -3651,22 +3363,22 @@ class NodePrepareDragSequence {
|
|
|
3651
3363
|
const outputConnections = this.getOutgoingConnectionsHandler.handle(this.getOutputsForNode(nodeHandler.fNode));
|
|
3652
3364
|
outputConnections.forEach((c) => {
|
|
3653
3365
|
if (allInputIds.includes(c.fInputId)) {
|
|
3654
|
-
itemsToDrag.push(new ConnectionDragHandler(this.getInputRectInFlowHandler, this.
|
|
3366
|
+
itemsToDrag.push(new ConnectionDragHandler(this.getInputRectInFlowHandler, this.fMediator, c));
|
|
3655
3367
|
}
|
|
3656
3368
|
else {
|
|
3657
|
-
itemsToDrag.push(new ConnectionSourceDragHandler(this.getInputRectInFlowHandler, this.
|
|
3369
|
+
itemsToDrag.push(new ConnectionSourceDragHandler(this.getInputRectInFlowHandler, this.fMediator, c));
|
|
3658
3370
|
}
|
|
3659
3371
|
});
|
|
3660
3372
|
const inputConnections = this.getIncomingConnectionsHandler.handle(this.getInputsForNode(nodeHandler.fNode));
|
|
3661
3373
|
inputConnections.forEach((c) => {
|
|
3662
3374
|
if (allOutputIds.includes(c.fOutputId)) {
|
|
3663
|
-
const index = itemsToDrag.findIndex((x) => x.type === EFDraggableType.CONNECTION && x.connection.
|
|
3375
|
+
const index = itemsToDrag.findIndex((x) => x.type === EFDraggableType.CONNECTION && x.connection.fConnectionId === c.fConnectionId);
|
|
3664
3376
|
if (index !== -1) {
|
|
3665
|
-
itemsToDrag.push(new ConnectionDragHandler(this.getInputRectInFlowHandler, this.
|
|
3377
|
+
itemsToDrag.push(new ConnectionDragHandler(this.getInputRectInFlowHandler, this.fMediator, c));
|
|
3666
3378
|
}
|
|
3667
3379
|
}
|
|
3668
3380
|
else {
|
|
3669
|
-
itemsToDrag.push(new ConnectionTargetDragHandler(this.getInputRectInFlowHandler, this.
|
|
3381
|
+
itemsToDrag.push(new ConnectionTargetDragHandler(this.getInputRectInFlowHandler, this.fMediator, c));
|
|
3670
3382
|
}
|
|
3671
3383
|
});
|
|
3672
3384
|
});
|
|
@@ -3678,12 +3390,12 @@ class NodePrepareDragSequence {
|
|
|
3678
3390
|
getOutputsForNode(node) {
|
|
3679
3391
|
return this.fComponentsStore.fOutputs.filter((x) => node.isContains(x.hostElement));
|
|
3680
3392
|
}
|
|
3681
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: NodePrepareDragSequence, deps: [{ token: FComponentsStore }, { token: FDraggableDataContext }, { token: UpdateNodeLayerHandler }, { token: GetInputRectInFlowHandler }, { token:
|
|
3393
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: NodePrepareDragSequence, deps: [{ token: FComponentsStore }, { token: FDraggableDataContext }, { token: UpdateNodeLayerHandler }, { token: GetInputRectInFlowHandler }, { token: GetOutgoingConnectionsHandler }, { token: GetIncomingConnectionsHandler }, { token: FFlowMediator }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3682
3394
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: NodePrepareDragSequence }); }
|
|
3683
3395
|
}
|
|
3684
3396
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: NodePrepareDragSequence, decorators: [{
|
|
3685
3397
|
type: Injectable
|
|
3686
|
-
}], ctorParameters: () => [{ type: FComponentsStore }, { type: FDraggableDataContext }, { type: UpdateNodeLayerHandler }, { type: GetInputRectInFlowHandler }, { type:
|
|
3398
|
+
}], ctorParameters: () => [{ type: FComponentsStore }, { type: FDraggableDataContext }, { type: UpdateNodeLayerHandler }, { type: GetInputRectInFlowHandler }, { type: GetOutgoingConnectionsHandler }, { type: GetIncomingConnectionsHandler }, { type: FFlowMediator }] });
|
|
3687
3399
|
|
|
3688
3400
|
const NODE_PROVIDERS = [
|
|
3689
3401
|
NodeOnPointerUp,
|
|
@@ -3915,7 +3627,7 @@ const SINGLE_SELECT_PROVIDERS = [
|
|
|
3915
3627
|
SingleSelectOnPointerDown
|
|
3916
3628
|
];
|
|
3917
3629
|
|
|
3918
|
-
class
|
|
3630
|
+
class FSelectionChangeEvent {
|
|
3919
3631
|
constructor(nodes, connections) {
|
|
3920
3632
|
this.nodes = nodes;
|
|
3921
3633
|
this.connections = connections;
|
|
@@ -4068,176 +3780,429 @@ function isFakeTouchstartFromScreenReader(event) {
|
|
|
4068
3780
|
(touch.radiusY == null || touch.radiusY === 1));
|
|
4069
3781
|
}
|
|
4070
3782
|
|
|
4071
|
-
const F_DRAGGABLE = new InjectionToken('F_DRAGGABLE');
|
|
4072
|
-
class FDraggableBase extends IDragAndDropBase {
|
|
4073
|
-
constructor(ngZone) {
|
|
4074
|
-
super(ngZone);
|
|
4075
|
-
}
|
|
4076
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FDraggableBase, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
4077
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.1", type: FDraggableBase, usesInheritance: true, ngImport: i0 }); }
|
|
3783
|
+
const F_DRAGGABLE = new InjectionToken('F_DRAGGABLE');
|
|
3784
|
+
class FDraggableBase extends IDragAndDropBase {
|
|
3785
|
+
constructor(ngZone) {
|
|
3786
|
+
super(ngZone);
|
|
3787
|
+
}
|
|
3788
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FDraggableBase, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
3789
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.1", type: FDraggableBase, usesInheritance: true, ngImport: i0 }); }
|
|
3790
|
+
}
|
|
3791
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FDraggableBase, decorators: [{
|
|
3792
|
+
type: Directive
|
|
3793
|
+
}], ctorParameters: () => [{ type: i0.NgZone }] });
|
|
3794
|
+
|
|
3795
|
+
class FDraggableDirective extends FDraggableBase {
|
|
3796
|
+
get hostElement() {
|
|
3797
|
+
return this.elementReference.nativeElement;
|
|
3798
|
+
}
|
|
3799
|
+
constructor(elementReference, fDraggableDataContext, ngZone, injector, fComponentsStore, document) {
|
|
3800
|
+
super(ngZone);
|
|
3801
|
+
this.elementReference = elementReference;
|
|
3802
|
+
this.fDraggableDataContext = fDraggableDataContext;
|
|
3803
|
+
this.injector = injector;
|
|
3804
|
+
this.fComponentsStore = fComponentsStore;
|
|
3805
|
+
this.subscriptions$ = new Subscription();
|
|
3806
|
+
this.disabled = false;
|
|
3807
|
+
this.fSelectionChange = new EventEmitter();
|
|
3808
|
+
// @Output()
|
|
3809
|
+
// public override fConnectionIntersectNode: EventEmitter<ConnectionIntersectNodeEvent> = new EventEmitter<ConnectionIntersectNodeEvent>();
|
|
3810
|
+
this.fCreateNode = new EventEmitter();
|
|
3811
|
+
this.fReassignConnection = new EventEmitter();
|
|
3812
|
+
this.fCreateConnection = new EventEmitter();
|
|
3813
|
+
this.selectedItemsOnPointerDown = 0;
|
|
3814
|
+
this.document = document;
|
|
3815
|
+
}
|
|
3816
|
+
ngOnInit() {
|
|
3817
|
+
this.fComponentsStore.fDraggable = this;
|
|
3818
|
+
}
|
|
3819
|
+
ngAfterViewInit() {
|
|
3820
|
+
super.subscribe(this.document);
|
|
3821
|
+
}
|
|
3822
|
+
onPointerDown(event) {
|
|
3823
|
+
this.fDraggableDataContext.reset();
|
|
3824
|
+
let result = event.isMouseLeftButton();
|
|
3825
|
+
this.selectedItemsOnPointerDown = this.fDraggableDataContext.selectedItems.length;
|
|
3826
|
+
this.injector.get(SingleSelectOnPointerDown).handle(event);
|
|
3827
|
+
this.injector.get(ReassignConnectionPrepareDragSequence).handle(event);
|
|
3828
|
+
this.injector.get(CreateConnectionPrepareDragSequence).handle(event);
|
|
3829
|
+
this.emitSelectionChangeEvent();
|
|
3830
|
+
return result;
|
|
3831
|
+
}
|
|
3832
|
+
prepareDragSequence(event) {
|
|
3833
|
+
this.injector.get(SelectionAreaPrepareDragSequence).handle(event);
|
|
3834
|
+
this.injector.get(NodePrepareDragSequence).handle(event);
|
|
3835
|
+
this.injector.get(CanvasPrepareDragSequence).handle(event);
|
|
3836
|
+
this.injector.get(ExternalItemPrepareDragSequence).handle(event);
|
|
3837
|
+
this.fDraggableDataContext.draggableItems.forEach((item) => {
|
|
3838
|
+
item.initialize?.();
|
|
3839
|
+
});
|
|
3840
|
+
if (this.fDraggableDataContext.draggableItems.length > 0) {
|
|
3841
|
+
this.hostElement.classList.add('f-dragging');
|
|
3842
|
+
}
|
|
3843
|
+
}
|
|
3844
|
+
onPointerMove(event) {
|
|
3845
|
+
const pointerPositionInCanvas = Point.fromPoint(event.getPosition()).elementTransform(this.hostElement);
|
|
3846
|
+
const difference = pointerPositionInCanvas.div(this.fDraggableDataContext.onPointerDownScale).sub(this.fDraggableDataContext.onPointerDownPosition);
|
|
3847
|
+
this.fDraggableDataContext.draggableItems.forEach((item) => {
|
|
3848
|
+
item.move(difference);
|
|
3849
|
+
});
|
|
3850
|
+
}
|
|
3851
|
+
onPointerUp(event) {
|
|
3852
|
+
this.injector.get(ReassignConnectionOnPointerUp).handle(event);
|
|
3853
|
+
this.injector.get(CreateConnectionOnPointerUp).handle(event);
|
|
3854
|
+
this.injector.get(SelectionAreaOnPointerUp).handle(event);
|
|
3855
|
+
this.injector.get(NodeOnPointerUp).handle(event);
|
|
3856
|
+
this.injector.get(CanvasOnPointerUp).handle(event);
|
|
3857
|
+
this.injector.get(ExternalItemOnPointerUp).handle(event);
|
|
3858
|
+
this.hostElement.classList.remove('f-dragging');
|
|
3859
|
+
this.emitSelectionChangeEvent();
|
|
3860
|
+
this.fDraggableDataContext.reset();
|
|
3861
|
+
}
|
|
3862
|
+
emitSelectionChangeEvent() {
|
|
3863
|
+
if (!this.fDraggableDataContext.isSelectedChanged
|
|
3864
|
+
&& this.selectedItemsOnPointerDown === this.fDraggableDataContext.selectedItems.length) {
|
|
3865
|
+
return;
|
|
3866
|
+
}
|
|
3867
|
+
let selectedNodes = [];
|
|
3868
|
+
let selectedConnections = [];
|
|
3869
|
+
this.fDraggableDataContext.selectedItems.forEach((x) => {
|
|
3870
|
+
if (x.hostElement.classList.contains('f-node')) {
|
|
3871
|
+
selectedNodes.push(x.hostElement.id);
|
|
3872
|
+
}
|
|
3873
|
+
else {
|
|
3874
|
+
selectedConnections.push(x.hostElement.id);
|
|
3875
|
+
}
|
|
3876
|
+
});
|
|
3877
|
+
this.fSelectionChange.emit(new FSelectionChangeEvent(selectedNodes, selectedConnections));
|
|
3878
|
+
}
|
|
3879
|
+
ngOnDestroy() {
|
|
3880
|
+
super.unsubscribe();
|
|
3881
|
+
this.subscriptions$.unsubscribe();
|
|
3882
|
+
}
|
|
3883
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FDraggableDirective, deps: [{ token: i0.ElementRef }, { token: FDraggableDataContext }, { token: i0.NgZone }, { token: i0.Injector }, { token: FComponentsStore }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
3884
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.1", type: FDraggableDirective, selector: "f-flow[fDraggable]", inputs: { disabled: ["fDraggableDisabled", "disabled"] }, outputs: { fSelectionChange: "fSelectionChange", fCreateNode: "fCreateNode", fReassignConnection: "fReassignConnection", fCreateConnection: "fCreateConnection" }, providers: [
|
|
3885
|
+
{ provide: F_DRAGGABLE, useExisting: FDraggableDirective }
|
|
3886
|
+
], exportAs: ["fDraggable"], usesInheritance: true, ngImport: i0 }); }
|
|
3887
|
+
}
|
|
3888
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FDraggableDirective, decorators: [{
|
|
3889
|
+
type: Directive,
|
|
3890
|
+
args: [{
|
|
3891
|
+
selector: "f-flow[fDraggable]",
|
|
3892
|
+
exportAs: 'fDraggable',
|
|
3893
|
+
providers: [
|
|
3894
|
+
{ provide: F_DRAGGABLE, useExisting: FDraggableDirective }
|
|
3895
|
+
]
|
|
3896
|
+
}]
|
|
3897
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: FDraggableDataContext }, { type: i0.NgZone }, { type: i0.Injector }, { type: FComponentsStore }, { type: undefined, decorators: [{
|
|
3898
|
+
type: Inject,
|
|
3899
|
+
args: [DOCUMENT]
|
|
3900
|
+
}] }], propDecorators: { disabled: [{
|
|
3901
|
+
type: Input,
|
|
3902
|
+
args: ['fDraggableDisabled']
|
|
3903
|
+
}], fSelectionChange: [{
|
|
3904
|
+
type: Output
|
|
3905
|
+
}], fCreateNode: [{
|
|
3906
|
+
type: Output
|
|
3907
|
+
}], fReassignConnection: [{
|
|
3908
|
+
type: Output
|
|
3909
|
+
}], fCreateConnection: [{
|
|
3910
|
+
type: Output
|
|
3911
|
+
}] } });
|
|
3912
|
+
|
|
3913
|
+
class LineElement {
|
|
3914
|
+
constructor(hostElement) {
|
|
3915
|
+
this.hostElement = hostElement;
|
|
3916
|
+
this.element = DomElementExtensions.createHtmlElement('div');
|
|
3917
|
+
this.hostElement.appendChild(this.element);
|
|
3918
|
+
this.element.classList.add('f-line');
|
|
3919
|
+
}
|
|
3920
|
+
hide() {
|
|
3921
|
+
this.element.style.display = 'none';
|
|
3922
|
+
}
|
|
3923
|
+
show() {
|
|
3924
|
+
this.element.style.display = 'block';
|
|
3925
|
+
}
|
|
3926
|
+
draw(object) {
|
|
3927
|
+
this.element.style.position = 'absolute';
|
|
3928
|
+
Object.keys(object).forEach((key) => {
|
|
3929
|
+
// @ts-ignore
|
|
3930
|
+
this.element.style[key] = object[key] + 'px';
|
|
3931
|
+
});
|
|
3932
|
+
}
|
|
3933
|
+
}
|
|
3934
|
+
|
|
3935
|
+
class LineService {
|
|
3936
|
+
constructor(hostElement) {
|
|
3937
|
+
this.hostElement = hostElement;
|
|
3938
|
+
this.fHorizontalLine = new LineElement(this.hostElement);
|
|
3939
|
+
this.fVerticalLine = new LineElement(this.hostElement);
|
|
3940
|
+
}
|
|
3941
|
+
drawVerticalLine(x, size, transform) {
|
|
3942
|
+
this.fVerticalLine.show();
|
|
3943
|
+
this.fVerticalLine.draw({
|
|
3944
|
+
left: x * transform.scale + transform.position.x + transform.scaledPosition.x,
|
|
3945
|
+
top: 0,
|
|
3946
|
+
width: 1,
|
|
3947
|
+
height: size.height
|
|
3948
|
+
});
|
|
3949
|
+
}
|
|
3950
|
+
drawHorizontalLine(y, size, transform) {
|
|
3951
|
+
this.fHorizontalLine.show();
|
|
3952
|
+
this.fHorizontalLine.draw({
|
|
3953
|
+
left: 0,
|
|
3954
|
+
top: y * transform.scale + transform.position.y + transform.scaledPosition.y,
|
|
3955
|
+
width: size.width,
|
|
3956
|
+
height: 1
|
|
3957
|
+
});
|
|
3958
|
+
}
|
|
3959
|
+
hideVerticalLine() {
|
|
3960
|
+
this.fVerticalLine.hide();
|
|
3961
|
+
}
|
|
3962
|
+
hideHorizontalLine() {
|
|
3963
|
+
this.fHorizontalLine.hide();
|
|
3964
|
+
}
|
|
3965
|
+
}
|
|
3966
|
+
|
|
3967
|
+
const ALIGN_THRESHOLD = 10;
|
|
3968
|
+
/**
|
|
3969
|
+
* A class to find the nearest coordinate.
|
|
3970
|
+
*/
|
|
3971
|
+
class NearestCoordinateFinder {
|
|
3972
|
+
/**
|
|
3973
|
+
* Constructor to initialize the NearestCoordinateFinder.
|
|
3974
|
+
* @param elements - The array of IRect elements.
|
|
3975
|
+
* @param target - The target IRect element.
|
|
3976
|
+
*/
|
|
3977
|
+
constructor(elements, target) {
|
|
3978
|
+
this.elements = elements;
|
|
3979
|
+
this.target = target;
|
|
3980
|
+
}
|
|
3981
|
+
/**
|
|
3982
|
+
* Finds the nearest coordinate on a specified axis.
|
|
3983
|
+
* @returns The nearest coordinate and its distance.
|
|
3984
|
+
*/
|
|
3985
|
+
findNearestCoordinateByX() {
|
|
3986
|
+
let nearest;
|
|
3987
|
+
let minDistance;
|
|
3988
|
+
for (const element of this.elements) {
|
|
3989
|
+
const distanceLeftLeft = this.target.x - element.x;
|
|
3990
|
+
const distanceLeftRight = this.target.x - (element.x + element.width);
|
|
3991
|
+
const distanceCenterCenter = this.target.gravityCenter.x - element.gravityCenter.x;
|
|
3992
|
+
const distanceRightLeft = (this.target.x + this.target.width) - element.x;
|
|
3993
|
+
const distanceRightRight = (this.target.x + this.target.width) - (element.x + element.width);
|
|
3994
|
+
if (Math.abs(distanceLeftLeft) <= ALIGN_THRESHOLD ||
|
|
3995
|
+
Math.abs(distanceLeftRight) <= ALIGN_THRESHOLD ||
|
|
3996
|
+
Math.abs(distanceCenterCenter) <= ALIGN_THRESHOLD ||
|
|
3997
|
+
Math.abs(distanceRightLeft) <= ALIGN_THRESHOLD ||
|
|
3998
|
+
Math.abs(distanceRightRight) <= ALIGN_THRESHOLD) {
|
|
3999
|
+
if (minDistance === undefined || Math.abs(distanceCenterCenter) < Math.abs(minDistance)) {
|
|
4000
|
+
minDistance = distanceCenterCenter;
|
|
4001
|
+
nearest = element.gravityCenter.x;
|
|
4002
|
+
}
|
|
4003
|
+
if (Math.abs(distanceLeftLeft) < Math.abs(minDistance)) {
|
|
4004
|
+
minDistance = distanceLeftLeft;
|
|
4005
|
+
nearest = element.x;
|
|
4006
|
+
}
|
|
4007
|
+
if (Math.abs(distanceRightRight) < Math.abs(minDistance)) {
|
|
4008
|
+
minDistance = distanceRightRight;
|
|
4009
|
+
nearest = element.x + element.width;
|
|
4010
|
+
}
|
|
4011
|
+
if (Math.abs(distanceLeftRight) < Math.abs(minDistance)) {
|
|
4012
|
+
minDistance = distanceLeftRight;
|
|
4013
|
+
nearest = element.x + element.width;
|
|
4014
|
+
}
|
|
4015
|
+
if (Math.abs(distanceRightLeft) < Math.abs(minDistance)) {
|
|
4016
|
+
minDistance = distanceRightLeft;
|
|
4017
|
+
nearest = element.x;
|
|
4018
|
+
}
|
|
4019
|
+
}
|
|
4020
|
+
}
|
|
4021
|
+
return { value: nearest, distance: minDistance };
|
|
4022
|
+
}
|
|
4023
|
+
/**
|
|
4024
|
+
* Finds the nearest coordinate on a specified axis.
|
|
4025
|
+
* @returns The nearest coordinate and its distance.
|
|
4026
|
+
*/
|
|
4027
|
+
findNearestCoordinateByY() {
|
|
4028
|
+
let nearest;
|
|
4029
|
+
let minDistance;
|
|
4030
|
+
for (const element of this.elements) {
|
|
4031
|
+
const distanceTopTop = this.target.y - element.y;
|
|
4032
|
+
const distanceTopBottom = this.target.y - (element.y + element.height);
|
|
4033
|
+
const distanceCenterCenter = this.target.gravityCenter.y - element.gravityCenter.y;
|
|
4034
|
+
const distanceBottomTop = (this.target.y + this.target.height) - element.y;
|
|
4035
|
+
const distanceBottomBottom = (this.target.y + this.target.height) - (element.y + element.height);
|
|
4036
|
+
if (Math.abs(distanceTopTop) <= ALIGN_THRESHOLD ||
|
|
4037
|
+
Math.abs(distanceTopBottom) <= ALIGN_THRESHOLD ||
|
|
4038
|
+
Math.abs(distanceCenterCenter) <= ALIGN_THRESHOLD ||
|
|
4039
|
+
Math.abs(distanceBottomTop) <= ALIGN_THRESHOLD ||
|
|
4040
|
+
Math.abs(distanceBottomBottom) <= ALIGN_THRESHOLD) {
|
|
4041
|
+
if (minDistance === undefined || Math.abs(distanceCenterCenter) < Math.abs(minDistance)) {
|
|
4042
|
+
minDistance = distanceCenterCenter;
|
|
4043
|
+
nearest = element.gravityCenter.y;
|
|
4044
|
+
}
|
|
4045
|
+
if (Math.abs(distanceTopTop) < Math.abs(minDistance)) {
|
|
4046
|
+
minDistance = distanceTopTop;
|
|
4047
|
+
nearest = element.y;
|
|
4048
|
+
}
|
|
4049
|
+
if (Math.abs(distanceBottomBottom) < Math.abs(minDistance)) {
|
|
4050
|
+
minDistance = distanceBottomBottom;
|
|
4051
|
+
nearest = element.y + element.height;
|
|
4052
|
+
}
|
|
4053
|
+
if (Math.abs(distanceTopBottom) < Math.abs(minDistance)) {
|
|
4054
|
+
minDistance = distanceTopBottom;
|
|
4055
|
+
nearest = element.y + element.height;
|
|
4056
|
+
}
|
|
4057
|
+
if (Math.abs(distanceBottomTop) < Math.abs(minDistance)) {
|
|
4058
|
+
minDistance = distanceBottomTop;
|
|
4059
|
+
nearest = element.y;
|
|
4060
|
+
}
|
|
4061
|
+
}
|
|
4062
|
+
}
|
|
4063
|
+
return { value: nearest, distance: minDistance };
|
|
4064
|
+
}
|
|
4065
|
+
}
|
|
4066
|
+
|
|
4067
|
+
const F_LINE_ALIGNMENT = new InjectionToken('F_LINE_ALIGNMENT');
|
|
4068
|
+
class FLineAlignmentBase {
|
|
4069
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FLineAlignmentBase, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
4070
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.1", type: FLineAlignmentBase, ngImport: i0 }); }
|
|
4078
4071
|
}
|
|
4079
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
4072
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FLineAlignmentBase, decorators: [{
|
|
4080
4073
|
type: Directive
|
|
4081
|
-
}]
|
|
4074
|
+
}] });
|
|
4082
4075
|
|
|
4083
|
-
class
|
|
4076
|
+
class FLineAlignmentComponent extends FLineAlignmentBase {
|
|
4084
4077
|
get hostElement() {
|
|
4085
4078
|
return this.elementReference.nativeElement;
|
|
4086
4079
|
}
|
|
4087
|
-
|
|
4088
|
-
|
|
4080
|
+
get transform() {
|
|
4081
|
+
return this.fComponentsStore.fCanvas.transform;
|
|
4082
|
+
}
|
|
4083
|
+
get flowHost() {
|
|
4084
|
+
return this.fComponentsStore.fFlow.hostElement;
|
|
4085
|
+
}
|
|
4086
|
+
constructor(elementReference, fComponentsStore, fDraggableDataContext, getElementRectInFlowHandler) {
|
|
4087
|
+
super();
|
|
4089
4088
|
this.elementReference = elementReference;
|
|
4090
|
-
this.fDraggableDataContext = fDraggableDataContext;
|
|
4091
|
-
this.injector = injector;
|
|
4092
4089
|
this.fComponentsStore = fComponentsStore;
|
|
4093
|
-
this.
|
|
4094
|
-
this.
|
|
4095
|
-
this.
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
this.
|
|
4099
|
-
this.fReassignConnection = new EventEmitter();
|
|
4100
|
-
this.fCreateConnection = new EventEmitter();
|
|
4101
|
-
this.selectedItemsOnPointerDown = 0;
|
|
4102
|
-
this.document = document;
|
|
4090
|
+
this.fDraggableDataContext = fDraggableDataContext;
|
|
4091
|
+
this.getElementRectInFlowHandler = getElementRectInFlowHandler;
|
|
4092
|
+
this.size = SizeExtensions.initialize();
|
|
4093
|
+
this.draggedNodeRect = RectExtensions.initialize();
|
|
4094
|
+
this.rects = [];
|
|
4095
|
+
this.lineService = new LineService(this.hostElement);
|
|
4103
4096
|
}
|
|
4104
4097
|
ngOnInit() {
|
|
4105
|
-
this.
|
|
4106
|
-
}
|
|
4107
|
-
ngAfterViewInit() {
|
|
4108
|
-
super.subscribe(this.document);
|
|
4109
|
-
}
|
|
4110
|
-
onPointerDown(event) {
|
|
4111
|
-
this.fDraggableDataContext.reset();
|
|
4112
|
-
let result = event.isMouseLeftButton();
|
|
4113
|
-
this.selectedItemsOnPointerDown = this.fDraggableDataContext.selectedItems.length;
|
|
4114
|
-
this.injector.get(SingleSelectOnPointerDown).handle(event);
|
|
4115
|
-
this.injector.get(ReassignConnectionPrepareDragSequence).handle(event);
|
|
4116
|
-
this.injector.get(CreateConnectionPrepareDragSequence).handle(event);
|
|
4117
|
-
this.emitSelectionChangeEvent();
|
|
4118
|
-
return result;
|
|
4098
|
+
this.fDraggableDataContext.fLineAlignment = this;
|
|
4119
4099
|
}
|
|
4120
|
-
|
|
4121
|
-
this.
|
|
4122
|
-
this.
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
this.fDraggableDataContext.draggableItems.forEach((item) => {
|
|
4126
|
-
item.initialize?.();
|
|
4100
|
+
initialize(allNodes, currentNodes) {
|
|
4101
|
+
this.size = this.flowHost.getBoundingClientRect();
|
|
4102
|
+
this.rects = [];
|
|
4103
|
+
const draggedNodeRects = currentNodes.map((x) => {
|
|
4104
|
+
return this.getElementRectInFlowHandler.handle(x.hostElement);
|
|
4127
4105
|
});
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
const difference = pointerPositionInCanvas.div(this.fDraggableDataContext.onPointerDownScale).sub(this.fDraggableDataContext.onPointerDownPosition);
|
|
4135
|
-
this.fDraggableDataContext.draggableItems.forEach((item) => {
|
|
4136
|
-
item.move(difference);
|
|
4106
|
+
this.draggedNodeRect = RectExtensions.union(draggedNodeRects);
|
|
4107
|
+
const allNodesExcludeCurrents = allNodes.filter((x) => {
|
|
4108
|
+
return !currentNodes.includes(x);
|
|
4109
|
+
});
|
|
4110
|
+
this.rects = allNodesExcludeCurrents.map((x) => {
|
|
4111
|
+
return this.getElementRectInFlowHandler.handle(x.hostElement);
|
|
4137
4112
|
});
|
|
4138
4113
|
}
|
|
4139
|
-
|
|
4140
|
-
this.
|
|
4141
|
-
this.injector.get(CreateConnectionOnPointerUp).handle(event);
|
|
4142
|
-
this.injector.get(SelectionAreaOnPointerUp).handle(event);
|
|
4143
|
-
this.injector.get(NodeOnPointerUp).handle(event);
|
|
4144
|
-
this.injector.get(CanvasOnPointerUp).handle(event);
|
|
4145
|
-
this.injector.get(ExternalItemOnPointerUp).handle(event);
|
|
4146
|
-
this.hostElement.classList.remove('f-dragging');
|
|
4147
|
-
this.emitSelectionChangeEvent();
|
|
4148
|
-
this.fDraggableDataContext.reset();
|
|
4114
|
+
handle(difference) {
|
|
4115
|
+
this.drawIntersectingLines(difference);
|
|
4149
4116
|
}
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4117
|
+
drawIntersectingLines(difference) {
|
|
4118
|
+
const intersect = this.findNearestCoordinate(difference);
|
|
4119
|
+
if (intersect.xResult.value !== undefined) {
|
|
4120
|
+
this.lineService.drawVerticalLine(intersect.xResult.value, this.size, this.transform);
|
|
4121
|
+
}
|
|
4122
|
+
else {
|
|
4123
|
+
this.lineService.hideVerticalLine();
|
|
4124
|
+
}
|
|
4125
|
+
if (intersect.yResult.value !== undefined) {
|
|
4126
|
+
this.lineService.drawHorizontalLine(intersect.yResult.value, this.size, this.transform);
|
|
4127
|
+
}
|
|
4128
|
+
else {
|
|
4129
|
+
this.lineService.hideHorizontalLine();
|
|
4154
4130
|
}
|
|
4155
|
-
let selectedNodes = [];
|
|
4156
|
-
let selectedConnections = [];
|
|
4157
|
-
this.fDraggableDataContext.selectedItems.forEach((x) => {
|
|
4158
|
-
if (x.hostElement.classList.contains('f-node')) {
|
|
4159
|
-
selectedNodes.push(x.hostElement.id);
|
|
4160
|
-
}
|
|
4161
|
-
else {
|
|
4162
|
-
selectedConnections.push(x.hostElement.id);
|
|
4163
|
-
}
|
|
4164
|
-
});
|
|
4165
|
-
this.fSelectionChange.emit(new SelectionChangeEvent(selectedNodes, selectedConnections));
|
|
4166
4131
|
}
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
this.
|
|
4132
|
+
findNearestCoordinate(difference) {
|
|
4133
|
+
const rect = RectExtensions.addPoint(this.draggedNodeRect, difference);
|
|
4134
|
+
const finder = new NearestCoordinateFinder(this.rects, rect);
|
|
4135
|
+
const xResult = finder.findNearestCoordinateByX();
|
|
4136
|
+
const yResult = finder.findNearestCoordinateByY();
|
|
4137
|
+
const result = { xResult, yResult };
|
|
4138
|
+
return result;
|
|
4170
4139
|
}
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4140
|
+
complete() {
|
|
4141
|
+
this.lineService.hideVerticalLine();
|
|
4142
|
+
this.lineService.hideHorizontalLine();
|
|
4143
|
+
}
|
|
4144
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FLineAlignmentComponent, deps: [{ token: i0.ElementRef }, { token: FComponentsStore }, { token: FDraggableDataContext }, { token: GetElementRectInFlowHandler }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4145
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.1", type: FLineAlignmentComponent, selector: "f-line-alignment", host: { classAttribute: "f-line-alignment f-component" }, providers: [
|
|
4146
|
+
{ provide: F_LINE_ALIGNMENT, useExisting: FLineAlignmentComponent }
|
|
4147
|
+
], exportAs: ["fComponent"], usesInheritance: true, ngImport: i0, template: "", isInline: true, styles: [":host{display:block;position:absolute;left:0;top:0;width:100%;height:100%;overflow:hidden;pointer-events:none;-webkit-user-select:none;user-select:none}\n"] }); }
|
|
4175
4148
|
}
|
|
4176
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
4177
|
-
type:
|
|
4178
|
-
args: [{
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
}]
|
|
4185
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: FDraggableDataContext }, { type: i0.NgZone }, { type: i0.Injector }, { type: FComponentsStore }, { type: undefined, decorators: [{
|
|
4186
|
-
type: Inject,
|
|
4187
|
-
args: [DOCUMENT]
|
|
4188
|
-
}] }], propDecorators: { disabled: [{
|
|
4189
|
-
type: Input,
|
|
4190
|
-
args: ['fDraggableDisabled']
|
|
4191
|
-
}], fSelectionChange: [{
|
|
4192
|
-
type: Output
|
|
4193
|
-
}], fCreateNode: [{
|
|
4194
|
-
type: Output
|
|
4195
|
-
}], fReassignConnection: [{
|
|
4196
|
-
type: Output
|
|
4197
|
-
}], fCreateConnection: [{
|
|
4198
|
-
type: Output
|
|
4199
|
-
}] } });
|
|
4149
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FLineAlignmentComponent, decorators: [{
|
|
4150
|
+
type: Component,
|
|
4151
|
+
args: [{ selector: "f-line-alignment", template: "", exportAs: "fComponent", host: {
|
|
4152
|
+
'class': 'f-line-alignment f-component'
|
|
4153
|
+
}, providers: [
|
|
4154
|
+
{ provide: F_LINE_ALIGNMENT, useExisting: FLineAlignmentComponent }
|
|
4155
|
+
], styles: [":host{display:block;position:absolute;left:0;top:0;width:100%;height:100%;overflow:hidden;pointer-events:none;-webkit-user-select:none;user-select:none}\n"] }]
|
|
4156
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: FComponentsStore }, { type: FDraggableDataContext }, { type: GetElementRectInFlowHandler }] });
|
|
4200
4157
|
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4158
|
+
const F_SELECTION_AREA = new InjectionToken('F_SELECTION_AREA');
|
|
4159
|
+
class FSelectionAreaBase {
|
|
4160
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FSelectionAreaBase, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
4161
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.2.1", type: FSelectionAreaBase, ngImport: i0 }); }
|
|
4162
|
+
}
|
|
4163
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FSelectionAreaBase, decorators: [{
|
|
4164
|
+
type: Directive
|
|
4165
|
+
}] });
|
|
4166
|
+
|
|
4167
|
+
class FSelectionAreaComponent extends FSelectionAreaBase {
|
|
4168
|
+
get hostElement() {
|
|
4169
|
+
return this.elementReference.nativeElement;
|
|
4206
4170
|
}
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
this.
|
|
4210
|
-
this.
|
|
4211
|
-
const output = this.fComponentsStore.fOutputs.find((x) => x.id === connection.fOutputId);
|
|
4212
|
-
const input = this.fComponentsStore.fInputs.find((x) => x.id === connection.fInputId);
|
|
4213
|
-
if (output && input) {
|
|
4214
|
-
this.setupConnection(output, input, connection);
|
|
4215
|
-
}
|
|
4216
|
-
});
|
|
4171
|
+
constructor(elementReference, fDraggableDataContext) {
|
|
4172
|
+
super();
|
|
4173
|
+
this.elementReference = elementReference;
|
|
4174
|
+
this.fDraggableDataContext = fDraggableDataContext;
|
|
4217
4175
|
}
|
|
4218
|
-
|
|
4219
|
-
this.
|
|
4220
|
-
this.
|
|
4176
|
+
ngOnInit() {
|
|
4177
|
+
this.fDraggableDataContext.fSelectionArea = this;
|
|
4178
|
+
this.hostElement.style.display = 'none';
|
|
4221
4179
|
}
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
input.setConnected(true);
|
|
4225
|
-
const vector = this.getVector(output, input, connection);
|
|
4226
|
-
connection.setVector(vector.point1, output.fConnectableSide, vector.point2, input.fConnectableSide);
|
|
4227
|
-
connection.setMarkers();
|
|
4228
|
-
connection.initialize();
|
|
4180
|
+
hide() {
|
|
4181
|
+
this.hostElement.style.display = 'none';
|
|
4229
4182
|
}
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
const inputRect = this.getElementRectInFlowHandler.handle(input.hostElement);
|
|
4233
|
-
return this.getConnectionVectorHandler.handle(new GetConnectionVectorRequest(outputRect, inputRect, connection.fBehavior, output.fConnectableSide, input.fConnectableSide));
|
|
4183
|
+
show() {
|
|
4184
|
+
this.hostElement.style.display = 'block';
|
|
4234
4185
|
}
|
|
4235
|
-
|
|
4236
|
-
|
|
4186
|
+
draw(object) {
|
|
4187
|
+
const style = this.hostElement.style;
|
|
4188
|
+
style.left = object.left + 'px';
|
|
4189
|
+
style.top = object.top + 'px';
|
|
4190
|
+
style.width = object.width + 'px';
|
|
4191
|
+
style.height = object.height + 'px';
|
|
4192
|
+
}
|
|
4193
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FSelectionAreaComponent, deps: [{ token: i0.ElementRef }, { token: FDraggableDataContext }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4194
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.1", type: FSelectionAreaComponent, selector: "f-selection-area", host: { classAttribute: "f-selection-area f-component" }, providers: [
|
|
4195
|
+
{ provide: F_SELECTION_AREA, useExisting: FSelectionAreaComponent }
|
|
4196
|
+
], usesInheritance: true, ngImport: i0, template: ``, isInline: true, styles: [":host{position:absolute}\n"] }); }
|
|
4237
4197
|
}
|
|
4238
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type:
|
|
4239
|
-
type:
|
|
4240
|
-
|
|
4198
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FSelectionAreaComponent, decorators: [{
|
|
4199
|
+
type: Component,
|
|
4200
|
+
args: [{ selector: "f-selection-area", template: ``, host: {
|
|
4201
|
+
'class': 'f-selection-area f-component'
|
|
4202
|
+
}, providers: [
|
|
4203
|
+
{ provide: F_SELECTION_AREA, useExisting: FSelectionAreaComponent }
|
|
4204
|
+
], styles: [":host{position:absolute}\n"] }]
|
|
4205
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: FDraggableDataContext }] });
|
|
4241
4206
|
|
|
4242
4207
|
const F_FLOW = new InjectionToken('F_FLOW');
|
|
4243
4208
|
class FFlowBase {
|
|
@@ -4248,12 +4213,12 @@ class FFlowComponent extends FFlowBase {
|
|
|
4248
4213
|
get hostElement() {
|
|
4249
4214
|
return this.elementReference.nativeElement;
|
|
4250
4215
|
}
|
|
4251
|
-
constructor(elementReference,
|
|
4216
|
+
constructor(elementReference, getAllNodesRectHandler, fComponentsStore, fMediator) {
|
|
4252
4217
|
super();
|
|
4253
4218
|
this.elementReference = elementReference;
|
|
4254
|
-
this.redrawConnectionsHandler = redrawConnectionsHandler;
|
|
4255
4219
|
this.getAllNodesRectHandler = getAllNodesRectHandler;
|
|
4256
4220
|
this.fComponentsStore = fComponentsStore;
|
|
4221
|
+
this.fMediator = fMediator;
|
|
4257
4222
|
this.subscription$ = new Subscription();
|
|
4258
4223
|
this.fFlowId = `f-flow-${uniqueId++}`;
|
|
4259
4224
|
this.fLoaded = new EventEmitter();
|
|
@@ -4268,7 +4233,7 @@ class FFlowComponent extends FFlowBase {
|
|
|
4268
4233
|
}
|
|
4269
4234
|
subscribeOnElementsChanges() {
|
|
4270
4235
|
return this.fComponentsStore.changes.pipe(startWith(null), debounceTime(20)).subscribe(() => {
|
|
4271
|
-
this.
|
|
4236
|
+
this.fMediator.send(new RedrawConnectionsRequest());
|
|
4272
4237
|
if (!this.isLoaded) {
|
|
4273
4238
|
this.isLoaded = true;
|
|
4274
4239
|
this.fLoaded.emit();
|
|
@@ -4281,8 +4246,9 @@ class FFlowComponent extends FFlowBase {
|
|
|
4281
4246
|
ngOnDestroy() {
|
|
4282
4247
|
this.subscription$.unsubscribe();
|
|
4283
4248
|
}
|
|
4284
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FFlowComponent, deps: [{ token: i0.ElementRef }, { token:
|
|
4249
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.1", ngImport: i0, type: FFlowComponent, deps: [{ token: i0.ElementRef }, { token: GetAllNodesRectHandler }, { token: FComponentsStore }, { token: FFlowMediator }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4285
4250
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.1", type: FFlowComponent, selector: "f-flow", inputs: { fFlowId: "fFlowId" }, outputs: { fLoaded: "fLoaded" }, host: { properties: { "attr.id": "fFlowId" }, classAttribute: "f-component f-flow" }, providers: [
|
|
4251
|
+
FFlowMediator,
|
|
4286
4252
|
FComponentsStore,
|
|
4287
4253
|
FDraggableDataContext,
|
|
4288
4254
|
...SINGLE_SELECT_PROVIDERS,
|
|
@@ -4292,7 +4258,6 @@ class FFlowComponent extends FFlowBase {
|
|
|
4292
4258
|
...EXTERNAL_ITEM_PROVIDERS,
|
|
4293
4259
|
...CONNECTIONS_PROVIDERS,
|
|
4294
4260
|
...COMMON_PROVIDERS,
|
|
4295
|
-
RedrawConnectionsHandler,
|
|
4296
4261
|
{ provide: F_FLOW, useExisting: FFlowComponent },
|
|
4297
4262
|
], usesInheritance: true, ngImport: i0, template: "<ng-container>\n <ng-content select=\"[fDefinitions]\"></ng-content>\n\n <ng-content select=\"f-background\"></ng-content>\n\n <ng-content select=\"f-line-alignment\"></ng-content>\n\n <ng-content select=\"f-canvas\"></ng-content>\n\n <ng-content select=\"f-selection-area\"></ng-content>\n</ng-container>\n", styles: [":host{display:block;position:relative;width:100%;height:100%;overflow:hidden;pointer-events:all;-webkit-user-select:none;user-select:none;touch-action:none}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
4298
4263
|
}
|
|
@@ -4302,6 +4267,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImpor
|
|
|
4302
4267
|
'[attr.id]': 'fFlowId',
|
|
4303
4268
|
class: "f-component f-flow",
|
|
4304
4269
|
}, providers: [
|
|
4270
|
+
FFlowMediator,
|
|
4305
4271
|
FComponentsStore,
|
|
4306
4272
|
FDraggableDataContext,
|
|
4307
4273
|
...SINGLE_SELECT_PROVIDERS,
|
|
@@ -4311,10 +4277,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImpor
|
|
|
4311
4277
|
...EXTERNAL_ITEM_PROVIDERS,
|
|
4312
4278
|
...CONNECTIONS_PROVIDERS,
|
|
4313
4279
|
...COMMON_PROVIDERS,
|
|
4314
|
-
RedrawConnectionsHandler,
|
|
4315
4280
|
{ provide: F_FLOW, useExisting: FFlowComponent },
|
|
4316
4281
|
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container>\n <ng-content select=\"[fDefinitions]\"></ng-content>\n\n <ng-content select=\"f-background\"></ng-content>\n\n <ng-content select=\"f-line-alignment\"></ng-content>\n\n <ng-content select=\"f-canvas\"></ng-content>\n\n <ng-content select=\"f-selection-area\"></ng-content>\n</ng-container>\n", styles: [":host{display:block;position:relative;width:100%;height:100%;overflow:hidden;pointer-events:all;-webkit-user-select:none;user-select:none;touch-action:none}\n"] }]
|
|
4317
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type:
|
|
4282
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: GetAllNodesRectHandler }, { type: FComponentsStore }, { type: FFlowMediator }], propDecorators: { fFlowId: [{
|
|
4318
4283
|
type: Input
|
|
4319
4284
|
}], fLoaded: [{
|
|
4320
4285
|
type: Output
|
|
@@ -4413,5 +4378,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.1", ngImpor
|
|
|
4413
4378
|
* Generated bundle index. Do not edit.
|
|
4414
4379
|
*/
|
|
4415
4380
|
|
|
4416
|
-
export { CANVAS_PROVIDERS, COMMON_PROVIDERS, CONNECTIONS_PROVIDERS, CONNECTION_GRADIENT, CONNECTION_PATH, CONNECTION_TEXT, CalculateCenterBetweenPointsHandler, CalculateCenterBetweenPointsRequest, CalculateConnectionCenterHandler, CalculateConnectionCenterRequest, CalculateConnectorConnectableSideHandler, CalculateConnectorConnectableSideRequest, CanvasDragHandler, CanvasOnPointerUp, CanvasPrepareDragSequence, ConnectionDragHandler, ConnectionSourceDragHandler, ConnectionTargetDragHandler, CreateConnectionDragHandler,
|
|
4381
|
+
export { CANVAS_PROVIDERS, COMMON_PROVIDERS, CONNECTIONS_PROVIDERS, CONNECTION_GRADIENT, CONNECTION_PATH, CONNECTION_TEXT, CalculateCenterBetweenPointsHandler, CalculateCenterBetweenPointsRequest, CalculateConnectionCenterHandler, CalculateConnectionCenterRequest, CalculateConnectorConnectableSideHandler, CalculateConnectorConnectableSideRequest, CanvasDragHandler, CanvasOnPointerUp, CanvasPrepareDragSequence, ConnectionDragHandler, ConnectionSourceDragHandler, ConnectionTargetDragHandler, CreateConnectionDragHandler, CreateConnectionOnPointerUp, CreateConnectionPrepareDragSequence, EFConnectableSide, EFConnectionBehavior, EFConnectionType, EFDraggableType, EFMarkerType, EXTERNAL_ITEM_PROVIDERS, ExternalItemDragHandler, ExternalItemOnPointerUp, ExternalItemPrepareDragSequence, FBackgroundBase, FBackgroundComponent, FBezierPathBuilder, FCanvasBase, FCanvasChangeEvent, FCanvasComponent, FCellPatternComponent, FComponentsStore, FConnectionBase, FConnectionCenterDirective, FConnectionComponent, FConnectionDragHandleComponent, FConnectionForCreateComponent, FConnectionGradientComponent, FConnectionPathComponent, FConnectionSelectionComponent, FConnectionTextComponent, FConnectionTextPathDirective, FConnectorBase, FCreateConnectionEvent, FCreateNodeEvent, FDragHandleDirective, FDraggableBase, FDraggableDataContext, FDraggableDirective, FExternalItemBase, FExternalItemDirective, FExternalItemService, FFlowBase, FFlowComponent, FFlowMediator, FFlowModule, FHandlerRegister, FLOW, FLineAlignmentBase, FLineAlignmentComponent, FMarkerBase, FMarkerDirective, FNodeBase, FNodeDirective, FNodeInputBase, FNodeInputDirective, FNodeOutletBase, FNodeOutletDirective, FNodeOutputBase, FNodeOutputDirective, FPathBuilderBase, FPathBuilderSelector, FReassignConnectionEvent, FResizeObserver, FSegmentPathBuilder, FSelectionAreaBase, FSelectionAreaComponent, FSelectionChangeEvent, FStraightPathBuilder, FZoomBase, FZoomDirective, F_BACKGROUND, F_BACKGROUND_PATTERN, F_CANVAS, F_CONNECTION_DRAG_HANDLE_CLASS, F_CONNECTION_IDENTIFIERS, F_DRAGGABLE, F_DRAG_HANDLE, F_EXTERNAL_ITEM, F_FLOW, F_LINE_ALIGNMENT, F_MARKER, F_NODE, F_NODE_INPUT, F_NODE_OUTLET, F_NODE_OUTPUT, F_SELECTED_CLASS, F_SELECTION_AREA, F_ZOOM, FindFirstCanBeConnectedOutputByOutletHandler, FindInputsUnderPointerHandler, FindInputsUnderPointerRequest, FirstNotConnectedInputOfNodeUnderPointerHandler, GetAllNodesRectHandler, GetCanBeSelectedItemsHandler, GetConnectionHandler, GetConnectionVectorHandler, GetConnectionVectorRequest, GetElementRectInFlowHandler, GetIncomingConnectionsHandler, GetInputRectInFlowHandler, GetOutgoingConnectionsHandler, GetOutputRectInFlowHandler, GetOutputRectInFlowRequest, GetOutputRectInFlowResponse, IDragAndDropBase, InputNotFound, InputsUnderPointerHandler, IsConnectionUnderNodeHandler, LineElement, LineService, MOUSE_EVENT_IGNORE_TIME, NODE_PROVIDERS, NearestCoordinateFinder, NodeDragHandler, NodeOnPointerUp, NodePrepareDragSequence, OutputNotFound, ReassignConnectionDragHandler, ReassignConnectionOnPointerUp, ReassignConnectionPrepareDragSequence, RedrawConnectionsHandler, RedrawConnectionsRequest, SELECTION_AREA_PROVIDERS, SINGLE_SELECT_PROVIDERS, SelectAllHandler, SelectionAreaDragHandle, SelectionAreaOnPointerUp, SelectionAreaPrepareDragSequence, SingleSelectOnPointerDown, UpdateConnectionLayerHandler, UpdateNodeLayerHandler, castToConnectionBehavior, castToConnectionType, getExternalItem, getFlowUid, isExternalItem, isNode, isNodeDragHandle, isNodeInput, isNodeOutlet, isNodeOutput, mixinChangeConnectionSelection, mixinChangeConnectionVisibility, requiredOutput };
|
|
4417
4382
|
//# sourceMappingURL=foblex-flow.mjs.map
|