@foblex/flow 12.2.0 → 12.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/domain/create-connection-markers/create-connection-markers-request.d.ts +5 -0
  2. package/domain/create-connection-markers/create-connection-markers.handler.d.ts +10 -0
  3. package/domain/create-connection-markers/index.d.ts +2 -0
  4. package/domain/get-connection.handler.d.ts +1 -1
  5. package/domain/get-element-rect-in-flow/get-element-rect-in-flow.handler.d.ts +1 -1
  6. package/domain/get-incoming-connections.handler.d.ts +1 -1
  7. package/domain/get-input-rect-in-flow/get-input-rect-in-flow.handler.d.ts +1 -1
  8. package/domain/get-nodes-rect/get-nodes-rect.handler.d.ts +1 -1
  9. package/domain/get-outgoing-connections.handler.d.ts +1 -1
  10. package/domain/get-output-rect-in-flow/get-output-rect-in-flow.handler.d.ts +1 -1
  11. package/domain/get-position-in-flow/get-position-in-flow-request.d.ts +5 -0
  12. package/domain/get-position-in-flow/get-position-in-flow.handler.d.ts +13 -0
  13. package/domain/get-position-in-flow/index.d.ts +2 -0
  14. package/domain/index.d.ts +3 -2
  15. package/domain/providers.d.ts +4 -3
  16. package/domain/redraw-connections/redraw-connections.handler.d.ts +2 -1
  17. package/domain/select/select.handler.d.ts +1 -1
  18. package/domain/select-all/select-all.handler.d.ts +1 -1
  19. package/domain/update-item-layer/index.d.ts +2 -0
  20. package/domain/update-item-layer/update-item-layer.handler.d.ts +8 -0
  21. package/domain/update-item-layer/update-item-layer.request.d.ts +6 -0
  22. package/esm2022/domain/create-connection-markers/create-connection-markers-request.mjs +6 -0
  23. package/esm2022/domain/create-connection-markers/create-connection-markers.handler.mjs +49 -0
  24. package/esm2022/domain/create-connection-markers/index.mjs +3 -0
  25. package/esm2022/domain/get-connection.handler.mjs +3 -4
  26. package/esm2022/domain/get-element-rect-in-flow/get-element-rect-in-flow.handler.mjs +3 -4
  27. package/esm2022/domain/get-incoming-connections.handler.mjs +2 -2
  28. package/esm2022/domain/get-input-rect-in-flow/get-input-rect-in-flow.handler.mjs +2 -2
  29. package/esm2022/domain/get-nodes-rect/get-nodes-rect.handler.mjs +2 -2
  30. package/esm2022/domain/get-outgoing-connections.handler.mjs +2 -2
  31. package/esm2022/domain/get-output-rect-in-flow/get-output-rect-in-flow.handler.mjs +2 -2
  32. package/esm2022/domain/get-position-in-flow/get-position-in-flow-request.mjs +6 -0
  33. package/esm2022/domain/get-position-in-flow/get-position-in-flow.handler.mjs +32 -0
  34. package/esm2022/domain/get-position-in-flow/index.mjs +3 -0
  35. package/esm2022/domain/index.mjs +4 -3
  36. package/esm2022/domain/providers.mjs +7 -5
  37. package/esm2022/domain/redraw-connections/redraw-connections.handler.mjs +11 -4
  38. package/esm2022/domain/select/select.handler.mjs +3 -3
  39. package/esm2022/domain/select-all/select-all.handler.mjs +2 -2
  40. package/esm2022/domain/update-item-layer/index.mjs +3 -0
  41. package/esm2022/domain/update-item-layer/update-item-layer.handler.mjs +29 -0
  42. package/esm2022/domain/update-item-layer/update-item-layer.request.mjs +7 -0
  43. package/esm2022/f-backgroud/f-background.component.mjs +4 -4
  44. package/esm2022/f-backgroud/f-circle-pattern/f-circle-pattern.component.mjs +100 -0
  45. package/esm2022/f-backgroud/f-circle-pattern/index.mjs +2 -0
  46. package/esm2022/f-backgroud/f-rect-pattern/f-rect-pattern.component.mjs +118 -0
  47. package/esm2022/f-backgroud/{f-cell-pattern → f-rect-pattern}/index.mjs +2 -2
  48. package/esm2022/f-backgroud/index.mjs +3 -2
  49. package/esm2022/f-canvas/f-canvas.component.mjs +4 -4
  50. package/esm2022/f-canvas/f-zoom/f-zoom-base.mjs +1 -1
  51. package/esm2022/f-canvas/f-zoom/f-zoom.directive.mjs +2 -2
  52. package/esm2022/f-connection/common/domain/calculate-connection-center/calculate-connection-center.handler.mjs +2 -3
  53. package/esm2022/f-connection/common/domain/f-bezier.path-builder.mjs +2 -2
  54. package/esm2022/f-connection/common/domain/f-segment.path-builder.mjs +2 -2
  55. package/esm2022/f-connection/common/domain/f-straight.path-builder.mjs +2 -2
  56. package/esm2022/f-connection/common/f-connection-base.mjs +4 -36
  57. package/esm2022/f-connection/common/f-path/f-connection-path.component.mjs +11 -15
  58. package/esm2022/f-connection/common/f-path/get-path-marker-id.mjs +15 -0
  59. package/esm2022/f-connection/common/f-path/index.mjs +2 -1
  60. package/esm2022/f-connection/common/mixins/change-connection-selection.mixin.mjs +5 -2
  61. package/esm2022/f-connection/f-connection/f-connection.component.mjs +71 -13
  62. package/esm2022/f-connection/f-connection-for-create/f-connection-for-create.component.mjs +46 -9
  63. package/esm2022/f-connection/f-marker/f-marker-base.mjs +1 -1
  64. package/esm2022/f-connection/f-marker/f-marker.directive.mjs +19 -5
  65. package/esm2022/f-connectors/f-node-input/f-node-input.directive.mjs +5 -7
  66. package/esm2022/f-connectors/f-node-outlet/f-node-outlet.directive.mjs +4 -4
  67. package/esm2022/f-connectors/f-node-output/f-node-output.directive.mjs +5 -4
  68. package/esm2022/f-draggable/canvas/canvas.drag-handler.mjs +1 -1
  69. package/esm2022/f-draggable/canvas/canvas.prepare-drag-sequence.mjs +2 -2
  70. package/esm2022/f-draggable/connections/create-connection/create-connection.on-pointer-up.mjs +14 -16
  71. package/esm2022/f-draggable/connections/create-connection/create-connection.prepare-drag-sequence.mjs +3 -3
  72. package/esm2022/f-draggable/connections/create-connection/f-create-connection.event.mjs +3 -2
  73. package/esm2022/f-draggable/connections/create-connection/find-first-can-be-connected-output-by-outlet/find-first-can-be-connected-output-by-outlet.handler.mjs +2 -2
  74. package/esm2022/f-draggable/connections/find-inputs-under-pointer/find-inputs-under-pointer.handler.mjs +2 -2
  75. package/esm2022/f-draggable/connections/find-inputs-under-pointer/first-not-connected-input-of-node-under-pointer/first-not-connected-input-of-node-under-pointer.handler.mjs +2 -2
  76. package/esm2022/f-draggable/connections/reassign-connection/reassign-connection.on-pointer-up.mjs +2 -2
  77. package/esm2022/f-draggable/connections/reassign-connection/reassign-connection.prepare-drag-sequence.mjs +7 -7
  78. package/esm2022/f-draggable/external-item/external-item.drag-handler.mjs +2 -1
  79. package/esm2022/f-draggable/external-item/external-item.on-pointer-up.mjs +3 -3
  80. package/esm2022/f-draggable/external-item/external-item.prepare-drag-sequence.mjs +2 -2
  81. package/esm2022/f-draggable/f-draggable-base.mjs +8 -1
  82. package/esm2022/f-draggable/f-draggable-data-context.mjs +4 -2
  83. package/esm2022/f-draggable/f-draggable.directive.mjs +11 -2
  84. package/esm2022/f-draggable/node/domain/is-connection-under-node/is-connection-under-node.handler.mjs +2 -2
  85. package/esm2022/f-draggable/node/node.on-pointer-up.mjs +2 -2
  86. package/esm2022/f-draggable/node/node.prepare-drag-sequence.mjs +7 -7
  87. package/esm2022/f-draggable/selection-area/get-can-be-selected-items/get-can-be-selected-items.handler.mjs +2 -2
  88. package/esm2022/f-draggable/selection-area/selection-area.drag-handle.mjs +1 -1
  89. package/esm2022/f-draggable/selection-area/selection-area.prepare-drag-sequence.mjs +2 -2
  90. package/esm2022/f-draggable/single-select/single-select.on-pointer-down.mjs +46 -56
  91. package/esm2022/f-flow/f-flow.component.mjs +12 -10
  92. package/esm2022/f-flow.module.mjs +13 -6
  93. package/esm2022/f-group/f-group-base.mjs +6 -0
  94. package/esm2022/f-group/f-group.directive.mjs +110 -0
  95. package/esm2022/f-group/index.mjs +4 -0
  96. package/esm2022/f-group/is-group.mjs +4 -0
  97. package/esm2022/f-line-alignment/f-line-alignment.component.mjs +2 -2
  98. package/esm2022/f-node/f-node-base.mjs +1 -1
  99. package/esm2022/f-node/f-node.directive.mjs +14 -11
  100. package/esm2022/f-storage/f-components-store.mjs +41 -0
  101. package/esm2022/f-storage/index.mjs +2 -0
  102. package/esm2022/public-api.mjs +3 -3
  103. package/f-backgroud/f-background.component.d.ts +1 -1
  104. package/f-backgroud/f-circle-pattern/f-circle-pattern.component.d.ts +32 -0
  105. package/f-backgroud/f-circle-pattern/index.d.ts +1 -0
  106. package/f-backgroud/f-rect-pattern/f-rect-pattern.component.d.ts +37 -0
  107. package/f-backgroud/f-rect-pattern/index.d.ts +1 -0
  108. package/f-backgroud/index.d.ts +2 -1
  109. package/f-canvas/f-canvas.component.d.ts +2 -2
  110. package/f-canvas/f-zoom/f-zoom-base.d.ts +1 -1
  111. package/f-canvas/f-zoom/f-zoom.directive.d.ts +1 -1
  112. package/f-connection/common/f-connection-base.d.ts +4 -5
  113. package/f-connection/common/f-path/f-connection-path.component.d.ts +1 -2
  114. package/f-connection/common/f-path/get-path-marker-id.d.ts +4 -0
  115. package/f-connection/common/f-path/index.d.ts +1 -0
  116. package/f-connection/common/mixins/change-connection-selection.mixin.d.ts +1 -0
  117. package/f-connection/f-connection/f-connection.component.d.ts +27 -11
  118. package/f-connection/f-connection-for-create/f-connection-for-create.component.d.ts +17 -7
  119. package/f-connection/f-marker/f-marker-base.d.ts +2 -0
  120. package/f-connection/f-marker/f-marker.directive.d.ts +10 -4
  121. package/f-connectors/f-node-input/f-node-input.directive.d.ts +1 -1
  122. package/f-connectors/f-node-outlet/f-node-outlet.directive.d.ts +1 -1
  123. package/f-connectors/f-node-output/f-node-output.directive.d.ts +1 -1
  124. package/f-draggable/canvas/canvas.drag-handler.d.ts +1 -1
  125. package/f-draggable/canvas/canvas.prepare-drag-sequence.d.ts +1 -1
  126. package/f-draggable/connections/create-connection/create-connection.on-pointer-up.d.ts +1 -1
  127. package/f-draggable/connections/create-connection/create-connection.prepare-drag-sequence.d.ts +1 -1
  128. package/f-draggable/connections/create-connection/f-create-connection.event.d.ts +4 -2
  129. package/f-draggable/connections/create-connection/find-first-can-be-connected-output-by-outlet/find-first-can-be-connected-output-by-outlet.handler.d.ts +1 -1
  130. package/f-draggable/connections/find-inputs-under-pointer/find-inputs-under-pointer.handler.d.ts +1 -1
  131. package/f-draggable/connections/find-inputs-under-pointer/first-not-connected-input-of-node-under-pointer/first-not-connected-input-of-node-under-pointer.handler.d.ts +1 -1
  132. package/f-draggable/connections/providers.d.ts +1 -1
  133. package/f-draggable/connections/reassign-connection/reassign-connection.on-pointer-up.d.ts +1 -1
  134. package/f-draggable/connections/reassign-connection/reassign-connection.prepare-drag-sequence.d.ts +3 -4
  135. package/f-draggable/external-item/external-item.on-pointer-up.d.ts +1 -1
  136. package/f-draggable/external-item/external-item.prepare-drag-sequence.d.ts +1 -1
  137. package/f-draggable/external-item/providers.d.ts +1 -1
  138. package/f-draggable/f-draggable-base.d.ts +2 -0
  139. package/f-draggable/f-draggable-data-context.d.ts +1 -0
  140. package/f-draggable/f-draggable.directive.d.ts +2 -1
  141. package/f-draggable/node/domain/is-connection-under-node/is-connection-under-node.handler.d.ts +1 -1
  142. package/f-draggable/node/node.on-pointer-up.d.ts +1 -1
  143. package/f-draggable/node/node.prepare-drag-sequence.d.ts +3 -4
  144. package/f-draggable/node/providers.d.ts +1 -1
  145. package/f-draggable/selection-area/get-can-be-selected-items/get-can-be-selected-items.handler.d.ts +1 -1
  146. package/f-draggable/selection-area/selection-area.drag-handle.d.ts +1 -1
  147. package/f-draggable/selection-area/selection-area.prepare-drag-sequence.d.ts +1 -1
  148. package/f-draggable/single-select/single-select.on-pointer-down.d.ts +12 -7
  149. package/f-flow/f-flow.component.d.ts +4 -2
  150. package/f-flow.module.d.ts +18 -16
  151. package/f-group/f-group-base.d.ts +6 -0
  152. package/f-group/f-group.directive.d.ts +31 -0
  153. package/f-group/index.d.ts +3 -0
  154. package/f-group/is-group.d.ts +1 -0
  155. package/f-line-alignment/f-line-alignment.component.d.ts +1 -1
  156. package/f-node/f-node-base.d.ts +1 -1
  157. package/f-node/f-node.directive.d.ts +3 -3
  158. package/{f-components-store.d.ts → f-storage/f-components-store.d.ts} +12 -17
  159. package/f-storage/index.d.ts +1 -0
  160. package/fesm2022/foblex-flow.mjs +772 -406
  161. package/fesm2022/foblex-flow.mjs.map +1 -1
  162. package/package.json +1 -1
  163. package/public-api.d.ts +2 -2
  164. package/domain/update-connection-layer.handler.d.ts +0 -12
  165. package/domain/update-node-layer.handler.d.ts +0 -12
  166. package/esm2022/domain/update-connection-layer.handler.mjs +0 -29
  167. package/esm2022/domain/update-node-layer.handler.mjs +0 -29
  168. package/esm2022/f-backgroud/f-cell-pattern/f-cell-pattern.component.mjs +0 -90
  169. package/esm2022/f-components-store.mjs +0 -68
  170. package/esm2022/get-flow-uid.mjs +0 -8
  171. package/f-backgroud/f-cell-pattern/f-cell-pattern.component.d.ts +0 -31
  172. package/f-backgroud/f-cell-pattern/index.d.ts +0 -1
  173. package/get-flow-uid.d.ts +0 -4
@@ -1,96 +1,218 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { InjectionToken, Component, ChangeDetectionStrategy, Input, Directive, Injectable, ContentChild, Inject, ViewChild, Optional, ContentChildren, SkipSelf, EventEmitter, Output, NgModule } from '@angular/core';
3
- import { TransformModelExtensions, DomElementExtensions, PointExtensions, RectExtensions, BooleanExtensions, sanitizeElementId, Point, GuidExtensions, VectorExtensions, EventExtensions, mixinChangePosition, mixinFitToParent, mixinOneToOneCentering, mixinChangeZoom, MouseEventExtensions, IMouseEvent, ITouchDownEvent, ITouchMoveEvent, ITouchUpEvent, SizeExtensions } from '@foblex/core';
4
- import { Subject, Observable, Subscription, startWith, debounceTime } from 'rxjs';
3
+ import { TransformModelExtensions, PointExtensions, SizeExtensions, DomElementExtensions, RectExtensions, BooleanExtensions, sanitizeElementId, Point, VectorExtensions, EventExtensions, mixinChangePosition, mixinFitToParent, mixinOneToOneCentering, mixinChangeZoom, MouseEventExtensions, IMouseEvent, ITouchDownEvent, ITouchMoveEvent, ITouchUpEvent } from '@foblex/core';
4
+ import { Subscription, Subject, startWith, Observable, merge, debounceTime } from 'rxjs';
5
5
  import * as i3 from '@angular/common';
6
6
  import { DOCUMENT, CommonModule } from '@angular/common';
7
7
  import { __decorate } from 'tslib';
8
8
 
9
9
  const F_BACKGROUND_PATTERN = new InjectionToken('F_BACKGROUND_PATTERN');
10
10
 
11
- let uniqueId$9 = 0;
12
- class FCellPatternComponent {
11
+ let uniqueId$b = 0;
12
+ class FRectPatternComponent {
13
13
  get hostElement() {
14
14
  return this.elementReference.nativeElement;
15
15
  }
16
- constructor(elementReference, changeDetectorRef) {
16
+ set vColor(value) {
17
+ this._vColor = value;
18
+ this._stateChanges.next();
19
+ }
20
+ set hColor(value) {
21
+ this._vColor = value;
22
+ this._stateChanges.next();
23
+ }
24
+ set vSize(value) {
25
+ this._vSize = value;
26
+ this._stateChanges.next();
27
+ }
28
+ set hSize(value) {
29
+ this._hSize = value;
30
+ this._stateChanges.next();
31
+ }
32
+ constructor(elementReference) {
17
33
  this.elementReference = elementReference;
18
- this.changeDetectorRef = changeDetectorRef;
19
- this.id = `f-pattern-${uniqueId$9++}`;
20
- this.verticalLineColor = 'rgba(0,0,0,0.1)';
21
- this.horizontalLineColor = 'rgba(0,0,0,0.1)';
22
- this.transform = TransformModelExtensions.default();
23
- this.x = 0;
24
- this.y = 0;
25
- this.defaultCellSize = 20;
26
- this.cellSize = this.defaultCellSize;
34
+ this._subscription$ = new Subscription();
35
+ this._stateChanges = new Subject();
36
+ this.id = `f-pattern-${uniqueId$b++}`;
37
+ this._vColor = 'rgba(0,0,0,0.1)';
38
+ this._hColor = 'rgba(0,0,0,0.1)';
39
+ this._vSize = 20;
40
+ this._hSize = 20;
41
+ this._transform = TransformModelExtensions.default();
42
+ this._position = PointExtensions.initialize();
43
+ this._size = SizeExtensions.initialize(this._hSize, this._vSize);
44
+ this.createPattern();
45
+ }
46
+ createPattern() {
47
+ this._pattern = DomElementExtensions.createSvgElement('pattern');
48
+ this._pattern.setAttribute('patternUnits', 'userSpaceOnUse');
49
+ this.hostElement.appendChild(this._pattern);
50
+ this._vLine = DomElementExtensions.createSvgElement('line');
51
+ this._pattern.appendChild(this._vLine);
52
+ this._hLine = DomElementExtensions.createSvgElement('line');
53
+ this._pattern.appendChild(this._hLine);
27
54
  }
28
55
  ngOnInit() {
29
- this.createPatternDom();
30
- this.redraw();
56
+ this._subscription$.add(this.subscribeToStateChanges());
31
57
  }
32
- createPatternDom() {
33
- this.pattern = DomElementExtensions.createSvgElement('pattern');
34
- this.pattern.setAttribute('patternUnits', 'userSpaceOnUse');
35
- this.hostElement.appendChild(this.pattern);
36
- this.horizontalLine = DomElementExtensions.createSvgElement('line');
37
- this.horizontalLine.setAttribute('stroke', this.horizontalLineColor);
38
- this.pattern.appendChild(this.horizontalLine);
39
- this.verticalLine = DomElementExtensions.createSvgElement('line');
40
- this.verticalLine.setAttribute('stroke', this.verticalLineColor);
41
- this.pattern.appendChild(this.verticalLine);
58
+ subscribeToStateChanges() {
59
+ return this._stateChanges.pipe(startWith(null)).subscribe(() => {
60
+ this.redraw();
61
+ });
42
62
  }
43
63
  calculatePattern() {
44
- this.x = this.transform.position.x + this.transform.scaledPosition.x;
45
- this.y = this.transform.position.y + this.transform.scaledPosition.y;
46
- this.cellSize = this.defaultCellSize * this.transform.scale;
64
+ this._position.x = this._transform.position.x + this._transform.scaledPosition.x;
65
+ this._position.y = this._transform.position.y + this._transform.scaledPosition.y;
66
+ this._size = SizeExtensions.initialize(this._hSize * this._transform.scale, this._vSize * this._transform.scale);
47
67
  }
48
68
  redraw() {
49
69
  this.calculatePattern();
50
70
  this.redrawPattern();
51
- this.redrawHorizontalLine();
52
- this.redrawVerticalLine();
53
- this.changeDetectorRef.detectChanges();
71
+ this.redrawLine(this._vLine, this._vColor, this._size.width, 0, this._size.width, this._size.height);
72
+ this.redrawLine(this._hLine, this._hColor, 0, this._size.height, this._size.width, this._size.height);
54
73
  }
55
74
  redrawPattern() {
56
- this.pattern.setAttribute('x', `${this.x}`);
57
- this.pattern.setAttribute('y', `${this.y}`);
58
- this.pattern.setAttribute('width', `${this.cellSize}`);
59
- this.pattern.setAttribute('height', `${this.cellSize}`);
60
- }
61
- redrawHorizontalLine() {
62
- this.horizontalLine.setAttribute('x1', `0`);
63
- this.horizontalLine.setAttribute('x2', `${this.cellSize}`);
64
- this.horizontalLine.setAttribute('y1', `${this.cellSize}`);
65
- this.horizontalLine.setAttribute('y2', `${this.cellSize}`);
66
- }
67
- redrawVerticalLine() {
68
- this.verticalLine.setAttribute('x1', `${this.cellSize}`);
69
- this.verticalLine.setAttribute('x2', `${this.cellSize}`);
70
- this.verticalLine.setAttribute('y1', `0`);
71
- this.verticalLine.setAttribute('y2', `${this.cellSize}`);
75
+ this._pattern.setAttribute('x', `${this._position.x}`);
76
+ this._pattern.setAttribute('y', `${this._position.y}`);
77
+ this._pattern.setAttribute('width', `${this._size.width}`);
78
+ this._pattern.setAttribute('height', `${this._size.height}`);
79
+ }
80
+ redrawLine(line, color, x1, y1, x2, y2) {
81
+ line.setAttribute('stroke', `${color}`);
82
+ line.setAttribute('x1', `${x1}`);
83
+ line.setAttribute('x2', `${x2}`);
84
+ line.setAttribute('y1', `${y1}`);
85
+ line.setAttribute('y2', `${y2}`);
72
86
  }
73
87
  setTransform(transform) {
74
- this.transform = transform;
75
- this.redraw();
88
+ this._transform = transform;
89
+ this._stateChanges.next();
76
90
  }
77
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FCellPatternComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
78
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.1", type: FCellPatternComponent, selector: "f-cell-pattern", inputs: { id: "id", verticalLineColor: "verticalLineColor", horizontalLineColor: "horizontalLineColor" }, host: { properties: { "attr.id": "id" } }, providers: [
79
- { provide: F_BACKGROUND_PATTERN, useExisting: FCellPatternComponent }
80
- ], ngImport: i0, template: "<ng-container></ng-container>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
91
+ ngOnDestroy() {
92
+ this._subscription$.unsubscribe();
93
+ }
94
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FRectPatternComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
95
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.1", type: FRectPatternComponent, selector: "f-rect-pattern", inputs: { id: "id", vColor: "vColor", hColor: "hColor", vSize: "vSize", hSize: "hSize" }, host: { properties: { "attr.id": "id" } }, providers: [
96
+ { provide: F_BACKGROUND_PATTERN, useExisting: FRectPatternComponent }
97
+ ], ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
81
98
  }
82
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FCellPatternComponent, decorators: [{
99
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FRectPatternComponent, decorators: [{
83
100
  type: Component,
84
- args: [{ selector: "f-cell-pattern", host: {
101
+ args: [{
102
+ selector: "f-rect-pattern",
103
+ template: ``,
104
+ host: {
85
105
  '[attr.id]': 'id'
86
- }, providers: [
87
- { provide: F_BACKGROUND_PATTERN, useExisting: FCellPatternComponent }
88
- ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container></ng-container>\n" }]
89
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }], propDecorators: { id: [{
106
+ },
107
+ providers: [
108
+ { provide: F_BACKGROUND_PATTERN, useExisting: FRectPatternComponent }
109
+ ],
110
+ changeDetection: ChangeDetectionStrategy.OnPush
111
+ }]
112
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { id: [{
113
+ type: Input
114
+ }], vColor: [{
115
+ type: Input
116
+ }], hColor: [{
117
+ type: Input
118
+ }], vSize: [{
119
+ type: Input
120
+ }], hSize: [{
121
+ type: Input
122
+ }] } });
123
+
124
+ let uniqueId$a = 0;
125
+ class FCirclePatternComponent {
126
+ get hostElement() {
127
+ return this.elementReference.nativeElement;
128
+ }
129
+ set color(value) {
130
+ this._color = value;
131
+ this._stateChanges.next();
132
+ }
133
+ set radius(value) {
134
+ this._radius = value;
135
+ this._stateChanges.next();
136
+ }
137
+ constructor(elementReference) {
138
+ this.elementReference = elementReference;
139
+ this._subscription$ = new Subscription();
140
+ this._stateChanges = new Subject();
141
+ this.id = `f-pattern-${uniqueId$a++}`;
142
+ this._color = 'rgba(0,0,0,0.1)';
143
+ this._radius = 20;
144
+ this._scaledRadius = 20;
145
+ this._transform = TransformModelExtensions.default();
146
+ this._position = PointExtensions.initialize();
147
+ this.createPattern();
148
+ }
149
+ createPattern() {
150
+ this._pattern = DomElementExtensions.createSvgElement('pattern');
151
+ this._pattern.setAttribute('patternUnits', 'userSpaceOnUse');
152
+ this.hostElement.appendChild(this._pattern);
153
+ this._circle = DomElementExtensions.createSvgElement('circle');
154
+ this._pattern.appendChild(this._circle);
155
+ }
156
+ ngOnInit() {
157
+ this._subscription$.add(this.subscribeToStateChanges());
158
+ }
159
+ subscribeToStateChanges() {
160
+ return this._stateChanges.pipe(startWith(null)).subscribe(() => {
161
+ this.redraw();
162
+ });
163
+ }
164
+ calculatePattern() {
165
+ this._position.x = this._transform.position.x + this._transform.scaledPosition.x;
166
+ this._position.y = this._transform.position.y + this._transform.scaledPosition.y;
167
+ this._scaledRadius = this._radius * this._transform.scale;
168
+ }
169
+ redraw() {
170
+ this.calculatePattern();
171
+ this.redrawPattern();
172
+ this.redrawElement();
173
+ }
174
+ redrawPattern() {
175
+ this._pattern.setAttribute('x', `${this._position.x}`);
176
+ this._pattern.setAttribute('y', `${this._position.y}`);
177
+ this._pattern.setAttribute('width', `${this._scaledRadius}`);
178
+ this._pattern.setAttribute('height', `${this._scaledRadius}`);
179
+ }
180
+ redrawElement() {
181
+ this._circle.setAttribute('fill', this._color);
182
+ this._circle.setAttribute('cx', `${this._scaledRadius / 2}`);
183
+ this._circle.setAttribute('cy', `${this._scaledRadius / 2}`);
184
+ this._circle.setAttribute('r', `${this._scaledRadius / this._radius}`);
185
+ }
186
+ setTransform(transform) {
187
+ this._transform = transform;
188
+ this._stateChanges.next();
189
+ }
190
+ ngOnDestroy() {
191
+ this._subscription$.unsubscribe();
192
+ }
193
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FCirclePatternComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
194
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.1", type: FCirclePatternComponent, selector: "f-circle-pattern", inputs: { id: "id", color: "color", radius: "radius" }, host: { properties: { "attr.id": "id" } }, providers: [
195
+ { provide: F_BACKGROUND_PATTERN, useExisting: FCirclePatternComponent }
196
+ ], ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
197
+ }
198
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FCirclePatternComponent, decorators: [{
199
+ type: Component,
200
+ args: [{
201
+ selector: "f-circle-pattern",
202
+ template: ``,
203
+ host: {
204
+ '[attr.id]': 'id'
205
+ },
206
+ providers: [
207
+ { provide: F_BACKGROUND_PATTERN, useExisting: FCirclePatternComponent }
208
+ ],
209
+ changeDetection: ChangeDetectionStrategy.OnPush
210
+ }]
211
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { id: [{
90
212
  type: Input
91
- }], verticalLineColor: [{
213
+ }], color: [{
92
214
  type: Input
93
- }], horizontalLineColor: [{
215
+ }], radius: [{
94
216
  type: Input
95
217
  }] } });
96
218
 
@@ -107,7 +229,9 @@ class FComponentsStore {
107
229
  constructor() {
108
230
  this.changes = new Subject();
109
231
  this.fNodes = [];
232
+ this.fGroups = [];
110
233
  this.fConnections = [];
234
+ this.fMarkers = [];
111
235
  this.fOutputs = [];
112
236
  this.fInputs = [];
113
237
  this.fOutlets = [];
@@ -118,48 +242,19 @@ class FComponentsStore {
118
242
  get transform() {
119
243
  return this.fCanvas?.transform;
120
244
  }
121
- addOutput(output) {
122
- this.fOutputs.push(output);
123
- this.changes.next();
124
- }
125
- removeOutput(output) {
126
- this.fOutputs = this.fOutputs.filter(o => o !== output);
127
- this.changes.next();
128
- }
129
- addInput(input) {
130
- this.fInputs.push(input);
131
- this.changes.next();
132
- }
133
- removeInput(input) {
134
- this.fInputs = this.fInputs.filter(i => i !== input);
135
- this.changes.next();
136
- }
137
- addOutlet(outlet) {
138
- this.fOutlets.push(outlet);
139
- this.changes.next();
140
- }
141
- removeOutlet(outlet) {
142
- this.fOutlets = this.fOutlets.filter(o => o !== outlet);
143
- this.changes.next();
144
- }
145
- addNode(node) {
146
- this.fNodes.push(node);
147
- this.changes.next();
148
- }
149
245
  findNode(element) {
150
246
  return this.fNodes.find(n => n.isContains(element));
151
247
  }
152
- removeNode(node) {
153
- this.fNodes = this.fNodes.filter(n => n !== node);
248
+ addComponent(collection, component) {
249
+ collection.push(component);
154
250
  this.changes.next();
155
251
  }
156
- addConnection(connection) {
157
- this.fConnections.push(connection);
158
- this.changes.next();
159
- }
160
- removeConnection(connection) {
161
- this.fConnections = this.fConnections.filter(c => c !== connection);
162
- this.changes.next();
252
+ removeComponent(collection, component) {
253
+ const index = collection.indexOf(component);
254
+ if (index > -1) {
255
+ collection.splice(index, 1);
256
+ this.changes.next();
257
+ }
163
258
  }
164
259
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FComponentsStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
165
260
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FComponentsStore }); }
@@ -168,7 +263,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
168
263
  type: Injectable
169
264
  }] });
170
265
 
171
- let uniqueId$8 = 0;
266
+ let uniqueId$9 = 0;
172
267
  class FBackgroundComponent extends FBackgroundBase {
173
268
  get hostElement() {
174
269
  return this.elementReference.nativeElement;
@@ -186,7 +281,7 @@ class FBackgroundComponent extends FBackgroundBase {
186
281
  const pattern = children.length ? children[0] : undefined;
187
282
  if (pattern) {
188
283
  const defs = DomElementExtensions.createSvgElement('defs');
189
- pattern.id = 'f-background-marker-' + uniqueId$8++;
284
+ pattern.id = 'f-background-marker-' + uniqueId$9++;
190
285
  this.fBackgroundPattern?.hostElement.remove();
191
286
  defs.appendChild(pattern);
192
287
  this.hostElement?.firstChild?.appendChild(defs);
@@ -209,13 +304,13 @@ class FBackgroundComponent extends FBackgroundBase {
209
304
  this.fComponentsStore.fBackground = undefined;
210
305
  }
211
306
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FBackgroundComponent, deps: [{ token: i0.ElementRef }, { token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Component }); }
212
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.1", type: FBackgroundComponent, selector: "f-background", host: { classAttribute: "f-component f-background" }, providers: [{ provide: F_BACKGROUND, useExisting: FBackgroundComponent }], queries: [{ propertyName: "fBackgroundPattern", first: true, predicate: F_BACKGROUND_PATTERN, descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<svg>\n <ng-content></ng-content>\n\n<!-- <rect width=\"100%\" height=\"100%\" fill=\"url(#background-pattern)\"></rect>-->\n</svg>\n", styles: [":host{position:absolute;width:100%;height:100%;left:0;top:0;transform-origin:0 0;pointer-events:none}:host svg{width:100%;height:100%}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
307
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.1", type: FBackgroundComponent, selector: "f-background", host: { classAttribute: "f-component f-background" }, providers: [{ provide: F_BACKGROUND, useExisting: FBackgroundComponent }], queries: [{ propertyName: "fBackgroundPattern", first: true, predicate: F_BACKGROUND_PATTERN, descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<svg><ng-content></ng-content></svg>\n", styles: [":host{position:absolute;width:100%;height:100%;left:0;top:0;transform-origin:0 0;pointer-events:none}:host svg{width:100%;height:100%}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
213
308
  }
214
309
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FBackgroundComponent, decorators: [{
215
310
  type: Component,
216
311
  args: [{ selector: "f-background", host: {
217
312
  'class': 'f-component f-background'
218
- }, providers: [{ provide: F_BACKGROUND, useExisting: FBackgroundComponent }], changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg>\n <ng-content></ng-content>\n\n<!-- <rect width=\"100%\" height=\"100%\" fill=\"url(#background-pattern)\"></rect>-->\n</svg>\n", styles: [":host{position:absolute;width:100%;height:100%;left:0;top:0;transform-origin:0 0;pointer-events:none}:host svg{width:100%;height:100%}\n"] }]
313
+ }, providers: [{ provide: F_BACKGROUND, useExisting: FBackgroundComponent }], changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg><ng-content></ng-content></svg>\n", styles: [":host{position:absolute;width:100%;height:100%;left:0;top:0;transform-origin:0 0;pointer-events:none}:host svg{width:100%;height:100%}\n"] }]
219
314
  }], ctorParameters: () => [{ type: i0.ElementRef }, { type: FComponentsStore }], propDecorators: { fBackgroundPattern: [{
220
315
  type: ContentChild,
221
316
  args: [F_BACKGROUND_PATTERN, { static: true }]
@@ -267,8 +362,7 @@ class CalculateConnectionCenterHandler {
267
362
  }
268
363
  }
269
364
  const remainingDistanceToCenter = halfTotalDistance - (accumulatedDistance - distances[centerIndex]);
270
- const result = this.findPointAtDistance(points[centerIndex], points[centerIndex + 1], remainingDistanceToCenter);
271
- return result;
365
+ return this.findPointAtDistance(points[centerIndex], points[centerIndex + 1], remainingDistanceToCenter);
272
366
  }
273
367
  calculateDistance(pointA, pointB) {
274
368
  return Math.sqrt(Math.pow(pointB.x - pointA.x, 2) + Math.pow(pointB.y - pointA.y, 2));
@@ -383,7 +477,7 @@ function castToConnectableSide(type) {
383
477
  return result;
384
478
  }
385
479
 
386
- let uniqueId$7 = 0;
480
+ let uniqueId$8 = 0;
387
481
  class FNodeInputDirective extends FNodeInputBase {
388
482
  get disabled() {
389
483
  return this.isDisabled;
@@ -397,6 +491,7 @@ class FNodeInputDirective extends FNodeInputBase {
397
491
  }
398
492
  set _fSide(value) {
399
493
  this._fConnectableSide = castToConnectableSide(value);
494
+ this.fNode.refresh();
400
495
  }
401
496
  get _fSide() {
402
497
  return this._fConnectableSide;
@@ -409,17 +504,14 @@ class FNodeInputDirective extends FNodeInputBase {
409
504
  this.elementReference = elementReference;
410
505
  this.fNode = fNode;
411
506
  this.fComponentsStore = fComponentsStore;
412
- this.id = `f-node-input-${uniqueId$7++}`;
507
+ this.id = `f-node-input-${uniqueId$8++}`;
413
508
  this.multiple = true;
414
509
  this.isDisabled = false;
415
510
  this._fConnectableSide = EFConnectableSide.AUTO;
416
511
  this.isConnected = false;
417
512
  }
418
513
  ngOnInit() {
419
- if (!this.fNode) {
420
- throw new Error('fNodeInput must be inside f-node');
421
- }
422
- this.fComponentsStore.addInput(this);
514
+ this.fComponentsStore.addComponent(this.fComponentsStore.fInputs, this);
423
515
  this.fNode.addConnector(this);
424
516
  }
425
517
  setConnected(isConnected) {
@@ -428,7 +520,7 @@ class FNodeInputDirective extends FNodeInputBase {
428
520
  }
429
521
  ngOnDestroy() {
430
522
  this.fNode.removeConnector(this);
431
- this.fComponentsStore.removeInput(this);
523
+ this.fComponentsStore.removeComponent(this.fComponentsStore.fInputs, this);
432
524
  }
433
525
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FNodeInputDirective, deps: [{ token: i0.ElementRef }, { token: F_NODE }, { token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Directive }); }
434
526
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.1", type: FNodeInputDirective, selector: "[fNodeInput]", inputs: { id: ["fInputId", "id"], multiple: ["fInputMultiple", "multiple"], disabled: ["fInputDisabled", "disabled"], _fSide: ["fInputConnectableSide", "_fSide"] }, 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 }); }
@@ -488,7 +580,7 @@ function isNodeOutlet(element) {
488
580
  return !!element.closest('[fNodeOutlet]');
489
581
  }
490
582
 
491
- let uniqueId$6 = 0;
583
+ let uniqueId$7 = 0;
492
584
  class FNodeOutletDirective extends FNodeOutletBase {
493
585
  get disabled() {
494
586
  return this.isDisabled;
@@ -508,7 +600,7 @@ class FNodeOutletDirective extends FNodeOutletBase {
508
600
  this.elementReference = elementReference;
509
601
  this.fNode = fNode;
510
602
  this.fComponentsStore = fComponentsStore;
511
- this.id = `f-node-outlet-${uniqueId$6++}`;
603
+ this.id = `f-node-outlet-${uniqueId$7++}`;
512
604
  this.isDisabled = false;
513
605
  this.fConnectableSide = EFConnectableSide.AUTO;
514
606
  this._fConnectableSide = EFConnectableSide.AUTO;
@@ -518,10 +610,10 @@ class FNodeOutletDirective extends FNodeOutletBase {
518
610
  if (!this.fNode) {
519
611
  throw new Error('fNodeOutlet must be inside fNode Directive');
520
612
  }
521
- this.fComponentsStore.addOutlet(this);
613
+ this.fComponentsStore.addComponent(this.fComponentsStore.fOutlets, this);
522
614
  }
523
615
  ngOnDestroy() {
524
- this.fComponentsStore.removeOutlet(this);
616
+ this.fComponentsStore.removeComponent(this.fComponentsStore.fOutlets, this);
525
617
  }
526
618
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FNodeOutletDirective, deps: [{ token: i0.ElementRef }, { token: F_NODE }, { token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Directive }); }
527
619
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.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 }); }
@@ -571,7 +663,7 @@ function isNodeOutput(element) {
571
663
  return !!element.closest('[fNodeOutput]');
572
664
  }
573
665
 
574
- let uniqueId$5 = 0;
666
+ let uniqueId$6 = 0;
575
667
  class FNodeOutputDirective extends FNodeOutputBase {
576
668
  get disabled() {
577
669
  return this.isDisabled;
@@ -585,6 +677,7 @@ class FNodeOutputDirective extends FNodeOutputBase {
585
677
  }
586
678
  set _fSide(value) {
587
679
  this._fConnectableSide = castToConnectableSide(value);
680
+ this.fNode.refresh();
588
681
  }
589
682
  get _fSide() {
590
683
  return this._fConnectableSide;
@@ -597,7 +690,7 @@ class FNodeOutputDirective extends FNodeOutputBase {
597
690
  this.elementReference = elementReference;
598
691
  this.fNode = fNode;
599
692
  this.fComponentsStore = fComponentsStore;
600
- this.id = `f-node-output-${uniqueId$5++}`;
693
+ this.id = `f-node-output-${uniqueId$6++}`;
601
694
  this.multiple = false;
602
695
  this.isDisabled = false;
603
696
  this._fConnectableSide = EFConnectableSide.AUTO;
@@ -608,7 +701,7 @@ class FNodeOutputDirective extends FNodeOutputBase {
608
701
  if (!this.fNode) {
609
702
  throw new Error('fNodeOutput must be inside fNode Directive');
610
703
  }
611
- this.fComponentsStore.addOutput(this);
704
+ this.fComponentsStore.addComponent(this.fComponentsStore.fOutputs, this);
612
705
  this.fNode.addConnector(this);
613
706
  }
614
707
  setConnected(isConnected) {
@@ -617,7 +710,7 @@ class FNodeOutputDirective extends FNodeOutputBase {
617
710
  }
618
711
  ngOnDestroy() {
619
712
  this.fNode.removeConnector(this);
620
- this.fComponentsStore.removeOutput(this);
713
+ this.fComponentsStore.removeComponent(this.fComponentsStore.fOutputs, this);
621
714
  }
622
715
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FNodeOutputDirective, deps: [{ token: i0.ElementRef }, { token: F_NODE }, { token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Directive }); }
623
716
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.1", type: FNodeOutputDirective, selector: "[fNodeOutput]", inputs: { id: ["fOutputId", "id"], multiple: ["fOutputMultiple", "multiple"], disabled: ["fOutputDisabled", "disabled"], _fSide: ["fOutputConnectableSide", "_fSide"], isSelfConnectable: "isSelfConnectable" }, 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 }); }
@@ -682,7 +775,7 @@ class FBezierPathBuilder {
682
775
  const { source, sourceSide, target, targetSide, offset } = request;
683
776
  const sourceAnglePoint = FBezierPathBuilder.getAnglePoint(sourceSide, source, target, offset);
684
777
  const targetAnglePoint = FBezierPathBuilder.getAnglePoint(targetSide, target, source, offset);
685
- const path = `M ${source.x} ${source.y} C ${sourceAnglePoint.x} ${sourceAnglePoint.y}, ${targetAnglePoint.x} ${targetAnglePoint.y}, ${target.x + 0.0001} ${target.y + 0.0001}`;
778
+ const path = `M ${source.x} ${source.y} C ${sourceAnglePoint.x} ${sourceAnglePoint.y}, ${targetAnglePoint.x} ${targetAnglePoint.y}, ${target.x + 0.0002} ${target.y + 0.0002}`;
686
779
  const connectionCenter = new CalculateConnectionCenterHandler().handle(new CalculateConnectionCenterRequest([source, sourceAnglePoint, targetAnglePoint, target]));
687
780
  return { path, connectionCenter };
688
781
  }
@@ -821,14 +914,14 @@ class FSegmentPathBuilder {
821
914
  return `${index === 0 ? 'M' : 'L'}${point.x} ${point.y}`;
822
915
  }
823
916
  buildLastLineSegment(index, point) {
824
- return `L${point.x + 0.0001} ${point.y + 0.0001}`;
917
+ return `L${point.x + 0.0002} ${point.y + 0.0002}`;
825
918
  }
826
919
  }
827
920
 
828
921
  class FStraightPathBuilder {
829
922
  handle(request) {
830
923
  const { source, target } = request;
831
- const path = `M ${source.x} ${source.y} L ${target.x + 0.0001} ${target.y + 0.0001}`;
924
+ const path = `M ${source.x} ${source.y} L ${target.x + 0.0002} ${target.y + 0.0002}`;
832
925
  const connectionCenter = new CalculateConnectionCenterHandler().handle(new CalculateConnectionCenterRequest([source, target]));
833
926
  return { path, connectionCenter };
834
927
  }
@@ -1064,13 +1157,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
1064
1157
 
1065
1158
  const CONNECTION_PATH = new InjectionToken('CONNECTION_PATH');
1066
1159
 
1067
- const FLOW = {
1068
- UID: GuidExtensions.generate(),
1069
- };
1070
- function getFlowUid() {
1071
- return FLOW.UID;
1072
- }
1073
-
1074
1160
  var EFMarkerType;
1075
1161
  (function (EFMarkerType) {
1076
1162
  EFMarkerType["START"] = "f-connection-marker-start";
@@ -1079,56 +1165,23 @@ var EFMarkerType;
1079
1165
  EFMarkerType["SELECTED_END"] = "f-connection-selected-marker-end";
1080
1166
  })(EFMarkerType || (EFMarkerType = {}));
1081
1167
 
1082
- const F_MARKER = new InjectionToken('F_MARKER');
1083
- class FMarkerBase {
1084
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FMarkerBase, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1085
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.1", type: FMarkerBase, ngImport: i0 }); }
1168
+ function getMarkerStartId(fConnectionId) {
1169
+ return sanitizeElementId(`${EFMarkerType.START}-${fConnectionId}`);
1086
1170
  }
1087
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FMarkerBase, decorators: [{
1088
- type: Directive
1089
- }] });
1090
-
1091
- class FMarkerDirective extends FMarkerBase {
1092
- get hostElement() {
1093
- return this.elementReference.nativeElement;
1094
- }
1095
- constructor(elementReference) {
1096
- super();
1097
- this.elementReference = elementReference;
1098
- this.width = 0;
1099
- this.height = 0;
1100
- this.refX = 0;
1101
- this.refY = 0;
1102
- this.type = EFMarkerType.START;
1103
- this.hostElement.style.display = 'none';
1104
- }
1105
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FMarkerDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
1106
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.1", type: FMarkerDirective, 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 }); }
1171
+ function getMarkerEndId(fConnectionId) {
1172
+ return sanitizeElementId(`${EFMarkerType.END}-${fConnectionId}`);
1173
+ }
1174
+ function getMarkerSelectedStartId(fConnectionId) {
1175
+ return sanitizeElementId(`${EFMarkerType.SELECTED_START}-${fConnectionId}`);
1176
+ }
1177
+ function getMarkerSelectedEndId(fConnectionId) {
1178
+ return sanitizeElementId(`${EFMarkerType.SELECTED_END}-${fConnectionId}`);
1107
1179
  }
1108
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FMarkerDirective, decorators: [{
1109
- type: Directive,
1110
- args: [{
1111
- selector: "svg[fMarker]",
1112
- host: {
1113
- class: "f-component f-marker"
1114
- },
1115
- providers: [{ provide: F_MARKER, useExisting: FMarkerDirective }],
1116
- }]
1117
- }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { hostElement: [{
1118
- type: Input
1119
- }], width: [{
1120
- type: Input
1121
- }], height: [{
1122
- type: Input
1123
- }], refX: [{
1124
- type: Input
1125
- }], refY: [{
1126
- type: Input
1127
- }], type: [{
1128
- type: Input
1129
- }] } });
1130
1180
 
1131
1181
  class FConnectionPathComponent {
1182
+ get fPathId() {
1183
+ return this.base.fConnectionId;
1184
+ }
1132
1185
  get linkToGradient() {
1133
1186
  return F_CONNECTION_IDENTIFIERS.linkToGradient(this.base.fConnectionId + this.base.fOutputId + this.base.fInputId);
1134
1187
  }
@@ -1149,21 +1202,15 @@ class FConnectionPathComponent {
1149
1202
  this.hostElement.setAttribute("d", `${path}`);
1150
1203
  }
1151
1204
  select() {
1152
- this.hostElement.setAttribute('marker-start', `url(#${this.getMarkerId(EFMarkerType.SELECTED_START)})`);
1153
- this.hostElement.setAttribute('marker-end', `url(#${this.getMarkerId(EFMarkerType.SELECTED_END)})`);
1205
+ this.hostElement.setAttribute('marker-start', `url(#${getMarkerSelectedStartId(this.base.fConnectionId)})`);
1206
+ this.hostElement.setAttribute('marker-end', `url(#${getMarkerSelectedEndId(this.base.fConnectionId)})`);
1154
1207
  }
1155
1208
  deselect() {
1156
- this.hostElement.setAttribute('marker-start', `url(#${this.getMarkerId(EFMarkerType.START)})`);
1157
- this.hostElement.setAttribute('marker-end', `url(#${this.getMarkerId(EFMarkerType.END)})`);
1158
- }
1159
- getMarkerId(type) {
1160
- return sanitizeElementId(`${getFlowUid()}-${type}-${this.base.fConnectionId}`);
1161
- }
1162
- isSelected() {
1163
- return this.hostElement.getAttribute('marker-start') === `url(#${this.getMarkerId(EFMarkerType.SELECTED_START)})`;
1209
+ this.hostElement.setAttribute('marker-start', `url(#${getMarkerStartId(this.base.fConnectionId)})`);
1210
+ this.hostElement.setAttribute('marker-end', `url(#${getMarkerEndId(this.base.fConnectionId)})`);
1164
1211
  }
1165
1212
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FConnectionPathComponent, deps: [{ token: i0.ElementRef }, { token: F_CONNECTION }], target: i0.ɵɵFactoryTarget.Component }); }
1166
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.1", type: FConnectionPathComponent, selector: "path[f-connection-path]", host: { properties: { "attr.id": "attrConnectionId", "attr.stroke": "linkToGradient" }, classAttribute: "f-component f-connection-path" }, providers: [{ provide: CONNECTION_PATH, useExisting: FConnectionPathComponent }], ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1213
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.1", type: FConnectionPathComponent, selector: "path[f-connection-path]", host: { properties: { "attr.id": "attrConnectionId", "attr.data-f-path-id": "fPathId", "attr.stroke": "linkToGradient" }, classAttribute: "f-component f-connection-path" }, providers: [{ provide: CONNECTION_PATH, useExisting: FConnectionPathComponent }], ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1167
1214
  }
1168
1215
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FConnectionPathComponent, decorators: [{
1169
1216
  type: Component,
@@ -1174,6 +1221,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
1174
1221
  host: {
1175
1222
  class: "f-component f-connection-path",
1176
1223
  '[attr.id]': 'attrConnectionId',
1224
+ '[attr.data-f-path-id]': 'fPathId',
1177
1225
  '[attr.stroke]': 'linkToGradient',
1178
1226
  },
1179
1227
  providers: [{ provide: CONNECTION_PATH, useExisting: FConnectionPathComponent }],
@@ -1225,13 +1273,16 @@ function mixinChangeConnectionSelection(base) {
1225
1273
  }
1226
1274
  select() {
1227
1275
  this.fPath?.select();
1228
- this.hostElement.classList.add(F_SELECTED_CLASS);
1276
+ if (!this.hostElement.classList.contains(F_SELECTED_CLASS)) {
1277
+ this.hostElement.classList.add(F_SELECTED_CLASS);
1278
+ }
1229
1279
  }
1230
1280
  isSelected() {
1231
1281
  return this.hostElement.classList.contains(F_SELECTED_CLASS);
1232
1282
  }
1233
1283
  constructor(...args) {
1234
1284
  super(...args);
1285
+ this.fSelectionDisabled = false;
1235
1286
  }
1236
1287
  };
1237
1288
  }
@@ -1300,12 +1351,6 @@ class FConnectionBase extends MIXIN_BASE$1 {
1300
1351
  this.fGradient.initialize();
1301
1352
  this.redraw();
1302
1353
  }
1303
- reset() {
1304
- this.path = '';
1305
- this.fPath.initialize();
1306
- this.fGradient.initialize();
1307
- this.redraw();
1308
- }
1309
1354
  isContains(element) {
1310
1355
  return (this.hostElement.firstChild?.lastChild).contains(element);
1311
1356
  }
@@ -1318,39 +1363,14 @@ class FConnectionBase extends MIXIN_BASE$1 {
1318
1363
  sourceSide: fromSide,
1319
1364
  target: to,
1320
1365
  targetSide: toSide,
1321
- radius: 8,
1322
- offset: 32
1366
+ radius: this.fRadius,
1367
+ offset: this.fOffset
1323
1368
  }
1324
1369
  });
1325
1370
  this.path = pathResult.path;
1326
1371
  const transform = `position: absolute; pointerEvents: all; transform: translate(-50%, -50%); left: ${pathResult.connectionCenter.x}px; top: ${pathResult.connectionCenter.y}px`;
1327
1372
  this.fConnectionCenter?.nativeElement?.setAttribute('style', transform);
1328
1373
  }
1329
- setMarkers() {
1330
- this.fDefs.nativeElement.innerHTML = '';
1331
- this.fMarkers.forEach((marker) => {
1332
- const markerElement = DomElementExtensions.createSvgElement('marker');
1333
- markerElement.setAttribute('id', this.getMarkerId(getFlowUid() + '-' + marker.type + '-' + this.fConnectionId));
1334
- markerElement.setAttribute('markerHeight', `${marker.height}`);
1335
- markerElement.setAttribute('markerWidth', `${marker.width}`);
1336
- markerElement.setAttribute('orient', 'auto');
1337
- markerElement.setAttribute('refX', `${marker.refX}`);
1338
- markerElement.setAttribute('refY', `${marker.refY}`);
1339
- markerElement.setAttribute('markerUnits', 'strokeWidth');
1340
- marker.hostElement.setAttribute('height', `${marker.height}`);
1341
- marker.hostElement.setAttribute('width', `${marker.width}`);
1342
- const clone = marker.hostElement.cloneNode(true);
1343
- clone.style.display = 'unset';
1344
- markerElement.append(clone);
1345
- this.fDefs.nativeElement.append(markerElement);
1346
- });
1347
- this.fMarkers.forEach((marker) => {
1348
- marker.hostElement.remove();
1349
- });
1350
- }
1351
- getMarkerId(id) {
1352
- return sanitizeElementId(id);
1353
- }
1354
1374
  redraw() {
1355
1375
  this.fPath.setPath(this.path);
1356
1376
  this.fSelection.setPath(this.path);
@@ -1406,30 +1426,67 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
1406
1426
  }]
1407
1427
  }] });
1408
1428
 
1409
- let uniqueId$4 = 0;
1429
+ let uniqueId$5 = 0;
1410
1430
  class FConnectionForCreateComponent extends FConnectionBase {
1431
+ set fStartColor(value) {
1432
+ this._fStartColor = value;
1433
+ this.fComponentsStore.changes.next();
1434
+ }
1435
+ get fStartColor() {
1436
+ return this._fStartColor;
1437
+ }
1438
+ set fEndColor(value) {
1439
+ this._fEndColor = value;
1440
+ this.fComponentsStore.changes.next();
1441
+ }
1442
+ get fEndColor() {
1443
+ return this._fEndColor;
1444
+ }
1445
+ set fRadius(value) {
1446
+ this._fRadius = value;
1447
+ this.fComponentsStore.changes.next();
1448
+ }
1449
+ get fRadius() {
1450
+ return this._fRadius;
1451
+ }
1452
+ set fOffset(value) {
1453
+ this._fOffset = value;
1454
+ this.fComponentsStore.changes.next();
1455
+ }
1456
+ get fOffset() {
1457
+ return this._fOffset;
1458
+ }
1411
1459
  set fBehavior(value) {
1412
1460
  this._behavior = castToConnectionBehavior(value);
1461
+ this.fComponentsStore.changes.next();
1413
1462
  }
1414
1463
  get fBehavior() {
1415
1464
  return this._behavior;
1416
1465
  }
1417
1466
  set fType(value) {
1418
1467
  this._type = value;
1468
+ this.fComponentsStore.changes.next();
1419
1469
  }
1420
1470
  get fType() {
1421
1471
  return this._type;
1422
1472
  }
1473
+ get fMarkers() {
1474
+ return this.fComponentsStore.fMarkers.filter((x) => {
1475
+ return this.hostElement.contains(x.hostElement);
1476
+ });
1477
+ }
1423
1478
  get boundingElement() {
1424
1479
  return this.fPath.hostElement;
1425
1480
  }
1426
1481
  constructor(elementReference, fConnectionFactory, fComponentsStore) {
1427
1482
  super(elementReference, fConnectionFactory);
1428
1483
  this.fComponentsStore = fComponentsStore;
1429
- this.fConnectionId = `f-connection-for-create-${uniqueId$4++}`;
1484
+ this.fConnectionId = `f-connection-for-create-${uniqueId$5++}`;
1430
1485
  this.fText = '';
1431
- this.fStartColor = 'black';
1432
- this.fEndColor = 'black';
1486
+ this._fStartColor = 'black';
1487
+ this._fEndColor = 'black';
1488
+ this._fRadius = 8;
1489
+ this._fOffset = 32;
1433
1490
  this._behavior = EFConnectionBehavior.FIXED;
1434
1491
  this._type = EFConnectionType.STRAIGHT;
1435
1492
  this.fDraggingDisabled = false;
@@ -1445,7 +1502,7 @@ class FConnectionForCreateComponent extends FConnectionBase {
1445
1502
  this.fComponentsStore.fTempConnection = undefined;
1446
1503
  }
1447
1504
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FConnectionForCreateComponent, deps: [{ token: i0.ElementRef }, { token: FConnectionFactory }, { token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Component }); }
1448
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.1", type: FConnectionForCreateComponent, selector: "f-connection-for-create", inputs: { fStartColor: "fStartColor", fEndColor: "fEndColor", fBehavior: "fBehavior", fType: "fType" }, host: { classAttribute: "f-component f-connection f-connection-for-create" }, providers: [{ provide: F_CONNECTION, useExisting: FConnectionForCreateComponent }], queries: [{ propertyName: "fMarkers", predicate: F_MARKER, descendants: true }, { propertyName: "fConnectionCenters", predicate: FConnectionCenterDirective, descendants: true }], viewQueries: [{ propertyName: "fDefs", first: true, predicate: ["defs"], descendants: true, static: true }, { propertyName: "fPath", first: true, predicate: CONNECTION_PATH, descendants: true, static: true }, { propertyName: "fGradient", first: true, predicate: CONNECTION_GRADIENT, descendants: true, static: true }, { propertyName: "fDragHandle", first: true, predicate: FConnectionDragHandleComponent, descendants: true, static: true }, { propertyName: "fSelection", first: true, predicate: FConnectionSelectionComponent, descendants: true, static: true }, { propertyName: "fTextComponent", first: true, predicate: CONNECTION_TEXT, descendants: true, static: true }, { propertyName: "fConnectionCenter", first: true, predicate: ["fConnectionCenter"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<svg xmlns=\"http://www.w3.org/2000/svg\">\n <defs #defs></defs>\n <g class=\"f-connection-group\">\n <linearGradient fConnectionGradient></linearGradient>\n <path fConnectionSelection [attr.d]=\"path\"></path>\n <g>\n <path f-connection-path\n [attr.d]=\"path\">\n </path>\n <circle f-connection-drag-handle r=\"8\"></circle>\n </g>\n <text f-connection-text></text>\n </g>\n <ng-content></ng-content>\n</svg>\n<div #fConnectionCenter class=\"f-connection-center\" *ngIf=\"fConnectionCenters.length\">\n <ng-content select=\"[fConnectionCenter]\"></ng-content>\n</div>\n", styles: [":host{pointer-events:none;position:absolute}:host svg{overflow:visible}:host svg .f-connection-group{pointer-events:all}\n"], dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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 }); }
1505
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.1", type: FConnectionForCreateComponent, selector: "f-connection-for-create", inputs: { fStartColor: "fStartColor", fEndColor: "fEndColor", fRadius: "fRadius", fOffset: "fOffset", fBehavior: "fBehavior", fType: "fType" }, host: { classAttribute: "f-component f-connection f-connection-for-create" }, providers: [{ provide: F_CONNECTION, useExisting: FConnectionForCreateComponent }], queries: [{ propertyName: "fConnectionCenters", predicate: FConnectionCenterDirective, descendants: true }], viewQueries: [{ propertyName: "fDefs", first: true, predicate: ["defs"], descendants: true, static: true }, { propertyName: "fPath", first: true, predicate: CONNECTION_PATH, descendants: true, static: true }, { propertyName: "fGradient", first: true, predicate: CONNECTION_GRADIENT, descendants: true, static: true }, { propertyName: "fDragHandle", first: true, predicate: FConnectionDragHandleComponent, descendants: true, static: true }, { propertyName: "fSelection", first: true, predicate: FConnectionSelectionComponent, descendants: true, static: true }, { propertyName: "fTextComponent", first: true, predicate: CONNECTION_TEXT, descendants: true, static: true }, { propertyName: "fConnectionCenter", first: true, predicate: ["fConnectionCenter"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<svg xmlns=\"http://www.w3.org/2000/svg\">\n <defs #defs></defs>\n <g class=\"f-connection-group\">\n <linearGradient fConnectionGradient></linearGradient>\n <path fConnectionSelection [attr.d]=\"path\"></path>\n <g>\n <path f-connection-path\n [attr.d]=\"path\">\n </path>\n <circle f-connection-drag-handle r=\"8\"></circle>\n </g>\n <text f-connection-text></text>\n </g>\n <ng-content></ng-content>\n</svg>\n<div #fConnectionCenter class=\"f-connection-center\" *ngIf=\"fConnectionCenters.length\">\n <ng-content select=\"[fConnectionCenter]\"></ng-content>\n</div>\n", styles: [":host{pointer-events:none;position:absolute}:host svg{overflow:visible}:host svg .f-connection-group{pointer-events:all}\n"], dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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 }); }
1449
1506
  }
1450
1507
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FConnectionForCreateComponent, decorators: [{
1451
1508
  type: Component,
@@ -1456,6 +1513,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
1456
1513
  type: Input
1457
1514
  }], fEndColor: [{
1458
1515
  type: Input
1516
+ }], fRadius: [{
1517
+ type: Input
1518
+ }], fOffset: [{
1519
+ type: Input
1459
1520
  }], fBehavior: [{
1460
1521
  type: Input
1461
1522
  }], fType: [{
@@ -1463,9 +1524,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
1463
1524
  }], fDefs: [{
1464
1525
  type: ViewChild,
1465
1526
  args: ['defs', { static: true }]
1466
- }], fMarkers: [{
1467
- type: ContentChildren,
1468
- args: [F_MARKER, { descendants: true }]
1469
1527
  }], fPath: [{
1470
1528
  type: ViewChild,
1471
1529
  args: [CONNECTION_PATH, { static: true }]
@@ -1489,43 +1547,101 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
1489
1547
  args: [FConnectionCenterDirective, { descendants: true }]
1490
1548
  }] } });
1491
1549
 
1492
- let uniqueId$3 = 0;
1550
+ let uniqueId$4 = 0;
1493
1551
  class FConnectionComponent extends FConnectionBase {
1552
+ set fText(value) {
1553
+ this._fText = value;
1554
+ this.fComponentsStore.changes.next();
1555
+ }
1556
+ get fText() {
1557
+ return this._fText;
1558
+ }
1559
+ set fStartColor(value) {
1560
+ this._fStartColor = value;
1561
+ this.fComponentsStore.changes.next();
1562
+ }
1563
+ get fStartColor() {
1564
+ return this._fStartColor;
1565
+ }
1566
+ set fEndColor(value) {
1567
+ this._fEndColor = value;
1568
+ this.fComponentsStore.changes.next();
1569
+ }
1570
+ get fEndColor() {
1571
+ return this._fEndColor;
1572
+ }
1573
+ set fOutputId(value) {
1574
+ this._fOutputId = value;
1575
+ this.fComponentsStore.changes.next();
1576
+ }
1577
+ get fOutputId() {
1578
+ return this._fOutputId;
1579
+ }
1580
+ set fInputId(value) {
1581
+ this._fInputId = value;
1582
+ this.fComponentsStore.changes.next();
1583
+ }
1584
+ get fInputId() {
1585
+ return this._fInputId;
1586
+ }
1587
+ set fRadius(value) {
1588
+ this._fRadius = value;
1589
+ this.fComponentsStore.changes.next();
1590
+ }
1591
+ get fRadius() {
1592
+ return this._fRadius;
1593
+ }
1594
+ set fOffset(value) {
1595
+ this._fOffset = value;
1596
+ this.fComponentsStore.changes.next();
1597
+ }
1598
+ get fOffset() {
1599
+ return this._fOffset;
1600
+ }
1494
1601
  set fBehavior(value) {
1495
1602
  this._behavior = castToConnectionBehavior(value);
1603
+ this.fComponentsStore.changes.next();
1496
1604
  }
1497
1605
  get fBehavior() {
1498
1606
  return this._behavior;
1499
1607
  }
1500
1608
  set fType(value) {
1501
1609
  this._type = value;
1610
+ this.fComponentsStore.changes.next();
1502
1611
  }
1503
1612
  get fType() {
1504
1613
  return this._type;
1505
1614
  }
1615
+ get fMarkers() {
1616
+ return this.fComponentsStore.fMarkers.filter((x) => {
1617
+ return this.hostElement.contains(x.hostElement);
1618
+ });
1619
+ }
1506
1620
  get boundingElement() {
1507
1621
  return this.fPath.hostElement;
1508
1622
  }
1509
1623
  constructor(elementReference, fConnectionFactory, fComponentsStore) {
1510
1624
  super(elementReference, fConnectionFactory);
1511
1625
  this.fComponentsStore = fComponentsStore;
1512
- this.fConnectionId = `f-connection-${uniqueId$3++}`;
1513
- this.fText = '';
1514
- this.fStartColor = 'black';
1515
- this.fEndColor = 'black';
1626
+ this.fConnectionId = `f-connection-${uniqueId$4++}`;
1627
+ this._fText = '';
1628
+ this._fStartColor = 'black';
1629
+ this._fEndColor = 'black';
1630
+ this._fRadius = 8;
1631
+ this._fOffset = 32;
1516
1632
  this._behavior = EFConnectionBehavior.FIXED;
1517
1633
  this._type = EFConnectionType.STRAIGHT;
1518
1634
  this.fDraggingDisabled = false;
1519
1635
  this.fSelectionDisabled = false;
1520
1636
  }
1521
1637
  ngOnInit() {
1522
- this.fComponentsStore.addConnection(this);
1638
+ this.fComponentsStore.addComponent(this.fComponentsStore.fConnections, this);
1523
1639
  }
1524
1640
  ngOnDestroy() {
1525
- this.fComponentsStore.removeConnection(this);
1641
+ this.fComponentsStore.removeComponent(this.fComponentsStore.fConnections, this);
1526
1642
  }
1527
1643
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FConnectionComponent, deps: [{ token: i0.ElementRef }, { token: FConnectionFactory }, { token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Component }); }
1528
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.1", type: FConnectionComponent, selector: "f-connection", inputs: { fConnectionId: "fConnectionId", fText: "fText", fStartColor: "fStartColor", fEndColor: "fEndColor", fOutputId: "fOutputId", fInputId: "fInputId", fBehavior: "fBehavior", fType: "fType", fDraggingDisabled: ["fReassignDisabled", "fDraggingDisabled"], fSelectionDisabled: "fSelectionDisabled" }, host: { properties: { "attr.id": "fConnectionId", "class.f-connection-selection-disabled": "fSelectionDisabled", "class.f-connection-reassign-disabled": "fDraggingDisabled" }, classAttribute: "f-component f-connection" }, providers: [{ provide: F_CONNECTION, useExisting: FConnectionComponent }], queries: [{ propertyName: "fMarkers", predicate: F_MARKER, descendants: true }, { propertyName: "fConnectionCenters", predicate: FConnectionCenterDirective, descendants: true }], viewQueries: [{ propertyName: "fDefs", first: true, predicate: ["defs"], descendants: true, static: true }, { propertyName: "fPath", first: true, predicate: CONNECTION_PATH, descendants: true, static: true }, { propertyName: "fGradient", first: true, predicate: CONNECTION_GRADIENT, descendants: true, static: true }, { propertyName: "fDragHandle", first: true, predicate: FConnectionDragHandleComponent, descendants: true, static: true }, { propertyName: "fSelection", first: true, predicate: FConnectionSelectionComponent, descendants: true, static: true }, { propertyName: "fTextComponent", first: true, predicate: CONNECTION_TEXT, descendants: true, static: true }, { propertyName: "fConnectionCenter", first: true, predicate: ["fConnectionCenter"], descendants: true }], exportAs: ["fComponent"], usesInheritance: true, ngImport: i0, template: "<svg xmlns=\"http://www.w3.org/2000/svg\" style=\"overflow: visible; display: block; vertical-align: middle;\">\n <defs #defs></defs>\n <g class=\"f-connection-group\">\n <linearGradient fConnectionGradient></linearGradient>\n <path fConnectionSelection [attr.d]=\"path\"></path>\n <g>\n <path f-connection-path\n [attr.d]=\"path\">\n </path>\n <circle f-connection-drag-handle r=\"8\"></circle>\n </g>\n <text f-connection-text></text>\n </g>\n <ng-content></ng-content>\n</svg>\n<div #fConnectionCenter class=\"f-connection-center\" *ngIf=\"fConnectionCenters.length\">\n <ng-content select=\"[fConnectionCenter]\"></ng-content>\n</div>\n", styles: [":host{pointer-events:none;position:absolute}:host svg{overflow:visible}:host svg .f-connection-group{pointer-events:all}\n"], dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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 }); }
1644
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.1", type: FConnectionComponent, selector: "f-connection", inputs: { fConnectionId: "fConnectionId", fText: "fText", fStartColor: "fStartColor", fEndColor: "fEndColor", fOutputId: "fOutputId", fInputId: "fInputId", fRadius: "fRadius", fOffset: "fOffset", fBehavior: "fBehavior", fType: "fType", fDraggingDisabled: ["fReassignDisabled", "fDraggingDisabled"], fSelectionDisabled: "fSelectionDisabled" }, host: { properties: { "attr.id": "fConnectionId", "class.f-connection-selection-disabled": "fSelectionDisabled", "class.f-connection-reassign-disabled": "fDraggingDisabled" }, classAttribute: "f-component f-connection" }, providers: [{ provide: F_CONNECTION, useExisting: FConnectionComponent }], queries: [{ propertyName: "fConnectionCenters", predicate: FConnectionCenterDirective, descendants: true }], viewQueries: [{ propertyName: "fDefs", first: true, predicate: ["defs"], descendants: true, static: true }, { propertyName: "fPath", first: true, predicate: CONNECTION_PATH, descendants: true, static: true }, { propertyName: "fGradient", first: true, predicate: CONNECTION_GRADIENT, descendants: true, static: true }, { propertyName: "fDragHandle", first: true, predicate: FConnectionDragHandleComponent, descendants: true, static: true }, { propertyName: "fSelection", first: true, predicate: FConnectionSelectionComponent, descendants: true, static: true }, { propertyName: "fTextComponent", first: true, predicate: CONNECTION_TEXT, descendants: true, static: true }, { propertyName: "fConnectionCenter", first: true, predicate: ["fConnectionCenter"], descendants: true }], exportAs: ["fComponent"], usesInheritance: true, ngImport: i0, template: "<svg xmlns=\"http://www.w3.org/2000/svg\" style=\"overflow: visible; display: block; vertical-align: middle;\">\n <defs #defs></defs>\n <ng-content></ng-content>\n <g class=\"f-connection-group\">\n <linearGradient fConnectionGradient></linearGradient>\n <path fConnectionSelection [attr.d]=\"path\"></path>\n <g>\n <path f-connection-path [attr.d]=\"path\">\n </path>\n <circle f-connection-drag-handle r=\"8\"></circle>\n </g>\n <text f-connection-text></text>\n </g>\n</svg>\n<div #fConnectionCenter class=\"f-connection-center\" *ngIf=\"fConnectionCenters.length\">\n <ng-content select=\"[fConnectionCenter]\"></ng-content>\n</div>\n", styles: [":host{pointer-events:none;position:absolute}:host svg{overflow:visible}:host svg .f-connection-group{pointer-events:all}\n"], dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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 }); }
1529
1645
  }
1530
1646
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FConnectionComponent, decorators: [{
1531
1647
  type: Component,
@@ -1534,7 +1650,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
1534
1650
  class: "f-component f-connection",
1535
1651
  '[class.f-connection-selection-disabled]': 'fSelectionDisabled',
1536
1652
  '[class.f-connection-reassign-disabled]': 'fDraggingDisabled',
1537
- }, 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\" *ngIf=\"fConnectionCenters.length\">\n <ng-content select=\"[fConnectionCenter]\"></ng-content>\n</div>\n", styles: [":host{pointer-events:none;position:absolute}:host svg{overflow:visible}:host svg .f-connection-group{pointer-events:all}\n"] }]
1653
+ }, 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 <ng-content></ng-content>\n <g class=\"f-connection-group\">\n <linearGradient fConnectionGradient></linearGradient>\n <path fConnectionSelection [attr.d]=\"path\"></path>\n <g>\n <path f-connection-path [attr.d]=\"path\">\n </path>\n <circle f-connection-drag-handle r=\"8\"></circle>\n </g>\n <text f-connection-text></text>\n </g>\n</svg>\n<div #fConnectionCenter class=\"f-connection-center\" *ngIf=\"fConnectionCenters.length\">\n <ng-content select=\"[fConnectionCenter]\"></ng-content>\n</div>\n", styles: [":host{pointer-events:none;position:absolute}:host svg{overflow:visible}:host svg .f-connection-group{pointer-events:all}\n"] }]
1538
1654
  }], ctorParameters: () => [{ type: i0.ElementRef }, { type: FConnectionFactory }, { type: FComponentsStore }], propDecorators: { fConnectionId: [{
1539
1655
  type: Input
1540
1656
  }], fText: [{
@@ -1547,6 +1663,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
1547
1663
  type: Input
1548
1664
  }], fInputId: [{
1549
1665
  type: Input
1666
+ }], fRadius: [{
1667
+ type: Input
1668
+ }], fOffset: [{
1669
+ type: Input
1550
1670
  }], fBehavior: [{
1551
1671
  type: Input
1552
1672
  }], fType: [{
@@ -1559,9 +1679,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
1559
1679
  }], fDefs: [{
1560
1680
  type: ViewChild,
1561
1681
  args: ['defs', { static: true }]
1562
- }], fMarkers: [{
1563
- type: ContentChildren,
1564
- args: [F_MARKER, { descendants: true }]
1565
1682
  }], fPath: [{
1566
1683
  type: ViewChild,
1567
1684
  args: [CONNECTION_PATH, { static: true }]
@@ -1585,6 +1702,68 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
1585
1702
  args: [FConnectionCenterDirective, { descendants: true }]
1586
1703
  }] } });
1587
1704
 
1705
+ const F_MARKER = new InjectionToken('F_MARKER');
1706
+ class FMarkerBase {
1707
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FMarkerBase, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1708
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.1", type: FMarkerBase, ngImport: i0 }); }
1709
+ }
1710
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FMarkerBase, decorators: [{
1711
+ type: Directive
1712
+ }] });
1713
+
1714
+ class FMarkerDirective extends FMarkerBase {
1715
+ get hostElement() {
1716
+ return this.elementReference.nativeElement;
1717
+ }
1718
+ constructor(fComponentsStore, elementReference) {
1719
+ super();
1720
+ this.fComponentsStore = fComponentsStore;
1721
+ this.elementReference = elementReference;
1722
+ this.width = 0;
1723
+ this.height = 0;
1724
+ this.refX = 0;
1725
+ this.refY = 0;
1726
+ this.type = EFMarkerType.START;
1727
+ this.orient = 'auto';
1728
+ this.markerUnits = 'strokeWidth';
1729
+ this.hostElement.style.display = 'none';
1730
+ }
1731
+ ngOnInit() {
1732
+ this.fComponentsStore.addComponent(this.fComponentsStore.fMarkers, this);
1733
+ }
1734
+ ngOnDestroy() {
1735
+ this.fComponentsStore.removeComponent(this.fComponentsStore.fMarkers, this);
1736
+ }
1737
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FMarkerDirective, deps: [{ token: FComponentsStore }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
1738
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.1", type: FMarkerDirective, selector: "svg[fMarker]", inputs: { hostElement: "hostElement", width: "width", height: "height", refX: "refX", refY: "refY", type: "type", orient: "orient", markerUnits: "markerUnits" }, host: { classAttribute: "f-component f-marker" }, providers: [{ provide: F_MARKER, useExisting: FMarkerDirective }], usesInheritance: true, ngImport: i0 }); }
1739
+ }
1740
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FMarkerDirective, decorators: [{
1741
+ type: Directive,
1742
+ args: [{
1743
+ selector: "svg[fMarker]",
1744
+ host: {
1745
+ class: "f-component f-marker"
1746
+ },
1747
+ providers: [{ provide: F_MARKER, useExisting: FMarkerDirective }],
1748
+ }]
1749
+ }], ctorParameters: () => [{ type: FComponentsStore }, { type: i0.ElementRef }], propDecorators: { hostElement: [{
1750
+ type: Input
1751
+ }], width: [{
1752
+ type: Input
1753
+ }], height: [{
1754
+ type: Input
1755
+ }], refX: [{
1756
+ type: Input
1757
+ }], refY: [{
1758
+ type: Input
1759
+ }], type: [{
1760
+ type: Input
1761
+ }], orient: [{
1762
+ type: Input
1763
+ }], markerUnits: [{
1764
+ type: Input
1765
+ }] } });
1766
+
1588
1767
  const F_NODE = new InjectionToken('F_NODE');
1589
1768
  class FNodeBase {
1590
1769
  constructor() {
@@ -1698,7 +1877,7 @@ class FResizeObserver extends Observable {
1698
1877
  }
1699
1878
  }
1700
1879
 
1701
- let uniqueId$2 = 0;
1880
+ let uniqueId$3 = 0;
1702
1881
  class FNodeDirective extends FNodeBase {
1703
1882
  set position(value) {
1704
1883
  this._position = PointExtensions.castToPoint(value);
@@ -1716,7 +1895,7 @@ class FNodeDirective extends FNodeBase {
1716
1895
  this.renderer = renderer;
1717
1896
  this.fComponentsStore = fComponentsStore;
1718
1897
  this.subscriptions$ = new Subscription();
1719
- this.fNodeId = `f-node-${uniqueId$2++}`;
1898
+ this.fId = `f-node-${uniqueId$3++}`;
1720
1899
  this.positionChange = new EventEmitter();
1721
1900
  this.fDraggingDisabled = false;
1722
1901
  this.fSelectionDisabled = false;
@@ -1730,7 +1909,7 @@ class FNodeDirective extends FNodeBase {
1730
1909
  this.setStyle('left', '0');
1731
1910
  this.setStyle('top', '0');
1732
1911
  super.redraw();
1733
- this.fComponentsStore.addNode(this);
1912
+ this.fComponentsStore.addComponent(this.fComponentsStore.fNodes, this);
1734
1913
  }
1735
1914
  setStyle(styleName, value) {
1736
1915
  this.renderer.setStyle(this.hostElement, styleName, value);
@@ -1739,7 +1918,7 @@ class FNodeDirective extends FNodeBase {
1739
1918
  this.subscriptions$.add(this.subscribeOnResizeChanges());
1740
1919
  }
1741
1920
  subscribeOnResizeChanges() {
1742
- return new FResizeObserver(this.hostElement).pipe(startWith(null)).subscribe(() => {
1921
+ return merge(new FResizeObserver(this.hostElement), this.stateChanges).pipe(debounceTime(5), startWith(null)).subscribe(() => {
1743
1922
  this.connectors.forEach((fConnector) => {
1744
1923
  fConnector.fConnectableSide = new CalculateConnectorConnectableSideHandler().handle(new CalculateConnectorConnectableSideRequest(fConnector, this.hostElement));
1745
1924
  });
@@ -1748,23 +1927,25 @@ class FNodeDirective extends FNodeBase {
1748
1927
  }
1749
1928
  addConnector(connector) {
1750
1929
  this.connectors.push(connector);
1930
+ this.stateChanges.next();
1751
1931
  }
1752
1932
  removeConnector(connector) {
1753
1933
  const index = this.connectors.indexOf(connector);
1754
1934
  if (index !== -1) {
1755
1935
  this.connectors.splice(index, 1);
1756
1936
  }
1937
+ this.stateChanges.next();
1757
1938
  }
1758
1939
  refresh() {
1759
1940
  this.stateChanges.next();
1760
1941
  }
1761
1942
  ngOnDestroy() {
1762
- this.fComponentsStore.removeNode(this);
1943
+ this.fComponentsStore.removeComponent(this.fComponentsStore.fNodes, this);
1763
1944
  this.stateChanges.complete();
1764
1945
  this.subscriptions$.unsubscribe();
1765
1946
  }
1766
1947
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FNodeDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Directive }); }
1767
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.1", type: FNodeDirective, selector: "[fNode]", inputs: { fNodeId: "fNodeId", position: ["fNodePosition", "position"], fDraggingDisabled: ["fNodeDraggingDisabled", "fDraggingDisabled"], fSelectionDisabled: ["fNodeSelectionDisabled", "fSelectionDisabled"] }, outputs: { positionChange: "fNodePositionChange" }, host: { properties: { "attr.data-f-node-id": "fNodeId", "class.f-node-dragging-disabled": "fDraggingDisabled", "class.f-node-selection-disabled": "fSelectionDisabled" }, classAttribute: "f-node f-component" }, providers: [
1948
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.1", type: FNodeDirective, selector: "[fNode]", inputs: { fId: ["fNodeId", "fId"], position: ["fNodePosition", "position"], fDraggingDisabled: ["fNodeDraggingDisabled", "fDraggingDisabled"], fSelectionDisabled: ["fNodeSelectionDisabled", "fSelectionDisabled"] }, outputs: { positionChange: "fNodePositionChange" }, host: { properties: { "attr.data-f-node-id": "fId", "class.f-node-dragging-disabled": "fDraggingDisabled", "class.f-node-selection-disabled": "fSelectionDisabled" }, classAttribute: "f-node f-component" }, providers: [
1768
1949
  { provide: F_NODE, useExisting: FNodeDirective }
1769
1950
  ], exportAs: ["fComponent"], usesInheritance: true, ngImport: i0 }); }
1770
1951
  }
@@ -1774,7 +1955,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
1774
1955
  selector: "[fNode]",
1775
1956
  exportAs: "fComponent",
1776
1957
  host: {
1777
- '[attr.data-f-node-id]': 'fNodeId',
1958
+ '[attr.data-f-node-id]': 'fId',
1778
1959
  class: "f-node f-component",
1779
1960
  '[class.f-node-dragging-disabled]': 'fDraggingDisabled',
1780
1961
  '[class.f-node-selection-disabled]': 'fSelectionDisabled'
@@ -1783,8 +1964,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
1783
1964
  { provide: F_NODE, useExisting: FNodeDirective }
1784
1965
  ],
1785
1966
  }]
1786
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: FComponentsStore }], propDecorators: { fNodeId: [{
1787
- type: Input
1967
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: FComponentsStore }], propDecorators: { fId: [{
1968
+ type: Input,
1969
+ args: ['fNodeId']
1788
1970
  }], position: [{
1789
1971
  type: Input,
1790
1972
  args: ['fNodePosition']
@@ -2041,7 +2223,9 @@ class FDraggableDataContext {
2041
2223
  this.draggableItems = [];
2042
2224
  this.onPointerDownScale = 1;
2043
2225
  this.onPointerDownPosition = new Point(0, 0);
2044
- this.isSelectedChanged = false;
2226
+ }
2227
+ markSelectionAsChanged() {
2228
+ this.isSelectedChanged = true;
2045
2229
  }
2046
2230
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FDraggableDataContext, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2047
2231
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FDraggableDataContext }); }
@@ -2167,9 +2351,10 @@ class CreateConnectionDragHandler {
2167
2351
  }
2168
2352
 
2169
2353
  class FCreateConnectionEvent {
2170
- constructor(fOutputId, fInputId) {
2354
+ constructor(fOutputId, fInputId, fDropPosition) {
2171
2355
  this.fOutputId = fOutputId;
2172
2356
  this.fInputId = fInputId;
2357
+ this.fDropPosition = fDropPosition;
2173
2358
  }
2174
2359
  }
2175
2360
 
@@ -2304,23 +2489,21 @@ class CreateConnectionOnPointerUp {
2304
2489
  if (isCreateConnection) {
2305
2490
  const handler = this.fDraggableDataContext.draggableItems[0];
2306
2491
  const inputsUnderPointer = this.findInputsUnderPointerHandler.handle(new FindInputsUnderPointerRequest(event, handler));
2307
- if (inputsUnderPointer.length > 0) {
2308
- let output = this.fComponentsStore.fOutputs.find((x) => x.id === handler.connection.fOutputId);
2309
- if (!output) {
2310
- output = this.fComponentsStore.fOutlets.find((x) => x.id === handler.connection.fOutputId);
2311
- }
2492
+ let output = this.fComponentsStore.fOutputs.find((x) => x.id === handler.connection.fOutputId);
2493
+ if (!output) {
2494
+ output = this.fComponentsStore.fOutlets.find((x) => x.id === handler.connection.fOutputId);
2495
+ }
2496
+ if (!output) {
2497
+ throw OutputNotFound(handler.connection.fOutputId);
2498
+ }
2499
+ const isOutlet = isNodeOutlet(output.hostElement);
2500
+ if (isOutlet) {
2501
+ output = this.findFirstCanBeConnectedOutputByOutletHandler.handle(output);
2312
2502
  if (!output) {
2313
- throw OutputNotFound(handler.connection.fOutputId);
2503
+ throw RequiredOutput();
2314
2504
  }
2315
- const isOutlet = isNodeOutlet(output.hostElement);
2316
- if (isOutlet) {
2317
- output = this.findFirstCanBeConnectedOutputByOutletHandler.handle(output);
2318
- if (!output) {
2319
- throw RequiredOutput();
2320
- }
2321
- }
2322
- this.fComponentsStore.fDraggable?.fCreateConnection.emit(new FCreateConnectionEvent(output.id, inputsUnderPointer[0]?.id));
2323
2505
  }
2506
+ this.fComponentsStore.fDraggable?.fCreateConnection.emit(new FCreateConnectionEvent(output.id, inputsUnderPointer[0]?.id, event.getPosition()));
2324
2507
  handler.complete();
2325
2508
  }
2326
2509
  }
@@ -2483,12 +2666,11 @@ class ReassignConnectionPrepareDragSequence {
2483
2666
  get flowHost() {
2484
2667
  return this.fComponentsStore.fFlow.hostElement;
2485
2668
  }
2486
- constructor(fComponentsStore, fDraggableDataContext, getConnectionHandler, fMediator, updateConnectionLayerHandler) {
2669
+ constructor(fComponentsStore, fDraggableDataContext, getConnectionHandler, fMediator) {
2487
2670
  this.fComponentsStore = fComponentsStore;
2488
2671
  this.fDraggableDataContext = fDraggableDataContext;
2489
2672
  this.getConnectionHandler = getConnectionHandler;
2490
2673
  this.fMediator = fMediator;
2491
- this.updateConnectionLayerHandler = updateConnectionLayerHandler;
2492
2674
  }
2493
2675
  handle(event) {
2494
2676
  const pointerPositionInFlow = Point.fromPoint(event.getPosition()).elementTransform(this.flowHost);
@@ -2505,7 +2687,7 @@ class ReassignConnectionPrepareDragSequence {
2505
2687
  }
2506
2688
  }
2507
2689
  if (connectionToReassign && !this.fDraggableDataContext.draggableItems.length) {
2508
- this.updateConnectionLayerHandler.handle(connectionToReassign);
2690
+ this.fMediator.send(new UpdateItemLayerRequest(connectionToReassign, this.fComponentsStore.fCanvas.fConnectionsContainer.nativeElement));
2509
2691
  this.fDraggableDataContext.onPointerDownScale = this.transform.scale;
2510
2692
  this.fDraggableDataContext.onPointerDownPosition = pointerPositionInFlow.div(this.transform.scale);
2511
2693
  this.fDraggableDataContext.draggableItems = [
@@ -2513,12 +2695,12 @@ class ReassignConnectionPrepareDragSequence {
2513
2695
  ];
2514
2696
  }
2515
2697
  }
2516
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ReassignConnectionPrepareDragSequence, deps: [{ token: FComponentsStore }, { token: FDraggableDataContext }, { token: GetConnectionHandler }, { token: FFlowMediator }, { token: UpdateConnectionLayerHandler }], target: i0.ɵɵFactoryTarget.Injectable }); }
2698
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ReassignConnectionPrepareDragSequence, deps: [{ token: FComponentsStore }, { token: FDraggableDataContext }, { token: GetConnectionHandler }, { token: FFlowMediator }], target: i0.ɵɵFactoryTarget.Injectable }); }
2517
2699
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ReassignConnectionPrepareDragSequence }); }
2518
2700
  }
2519
2701
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ReassignConnectionPrepareDragSequence, decorators: [{
2520
2702
  type: Injectable
2521
- }], ctorParameters: () => [{ type: FComponentsStore }, { type: FDraggableDataContext }, { type: GetConnectionHandler }, { type: FFlowMediator }, { type: UpdateConnectionLayerHandler }] });
2703
+ }], ctorParameters: () => [{ type: FComponentsStore }, { type: FDraggableDataContext }, { type: GetConnectionHandler }, { type: FFlowMediator }] });
2522
2704
 
2523
2705
  const CONNECTIONS_PROVIDERS = [
2524
2706
  FindFirstCanBeConnectedOutputByOutletHandler,
@@ -2550,6 +2732,7 @@ class ExternalItemDragHandler {
2550
2732
  initialize() {
2551
2733
  this.onPointerDownRect = this.getExternalItemRect();
2552
2734
  this.placeholder = DomElementExtensions.deepCloneNode(this.externalItem.hostElement);
2735
+ this.placeholder.setAttribute('style', this.getStyle(Point.fromPoint(this.onPointerDownRect)));
2553
2736
  document.body.appendChild(this.placeholder);
2554
2737
  }
2555
2738
  getExternalItemRect() {
@@ -2612,7 +2795,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
2612
2795
  }]
2613
2796
  }] });
2614
2797
 
2615
- let uniqueId$1 = 0;
2798
+ let uniqueId$2 = 0;
2616
2799
  class FExternalItemDirective extends FExternalItemBase {
2617
2800
  get hostElement() {
2618
2801
  return this.elementReference.nativeElement;
@@ -2621,7 +2804,7 @@ class FExternalItemDirective extends FExternalItemBase {
2621
2804
  super();
2622
2805
  this.elementReference = elementReference;
2623
2806
  this.fExternalItemService = fExternalItemService;
2624
- this.fExternalItemId = `f-external-item-${uniqueId$1++}`;
2807
+ this.fExternalItemId = `f-external-item-${uniqueId$2++}`;
2625
2808
  this.fDisabled = false;
2626
2809
  }
2627
2810
  ngOnInit() {
@@ -2933,10 +3116,9 @@ class NodePrepareDragSequence {
2933
3116
  get flowHost() {
2934
3117
  return this.fComponentsStore.fFlow.hostElement;
2935
3118
  }
2936
- constructor(fComponentsStore, fDraggableDataContext, updateNodeLayerHandler, getOutgoingConnectionsHandler, getIncomingConnectionsHandler, fMediator) {
3119
+ constructor(fComponentsStore, fDraggableDataContext, getOutgoingConnectionsHandler, getIncomingConnectionsHandler, fMediator) {
2937
3120
  this.fComponentsStore = fComponentsStore;
2938
3121
  this.fDraggableDataContext = fDraggableDataContext;
2939
- this.updateNodeLayerHandler = updateNodeLayerHandler;
2940
3122
  this.getOutgoingConnectionsHandler = getOutgoingConnectionsHandler;
2941
3123
  this.getIncomingConnectionsHandler = getIncomingConnectionsHandler;
2942
3124
  this.fMediator = fMediator;
@@ -2951,7 +3133,7 @@ class NodePrepareDragSequence {
2951
3133
  node.select();
2952
3134
  this.fDraggableDataContext.isSelectedChanged = true;
2953
3135
  }
2954
- this.updateNodeLayerHandler.handle(node);
3136
+ this.fMediator.send(new UpdateItemLayerRequest(node, this.fComponentsStore.fCanvas.fNodesContainer.nativeElement));
2955
3137
  const itemsToDrag = this.calculateDraggableConnectionsAndNodes();
2956
3138
  const draggedNodes = itemsToDrag.filter((x) => {
2957
3139
  return x.type === EFDraggableType.NODE;
@@ -3007,12 +3189,12 @@ class NodePrepareDragSequence {
3007
3189
  getOutputsForNode(node) {
3008
3190
  return this.fComponentsStore.fOutputs.filter((x) => node.isContains(x.hostElement));
3009
3191
  }
3010
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: NodePrepareDragSequence, deps: [{ token: FComponentsStore }, { token: FDraggableDataContext }, { token: UpdateNodeLayerHandler }, { token: GetOutgoingConnectionsHandler }, { token: GetIncomingConnectionsHandler }, { token: FFlowMediator }], target: i0.ɵɵFactoryTarget.Injectable }); }
3192
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: NodePrepareDragSequence, deps: [{ token: FComponentsStore }, { token: FDraggableDataContext }, { token: GetOutgoingConnectionsHandler }, { token: GetIncomingConnectionsHandler }, { token: FFlowMediator }], target: i0.ɵɵFactoryTarget.Injectable }); }
3011
3193
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: NodePrepareDragSequence }); }
3012
3194
  }
3013
3195
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: NodePrepareDragSequence, decorators: [{
3014
3196
  type: Injectable
3015
- }], ctorParameters: () => [{ type: FComponentsStore }, { type: FDraggableDataContext }, { type: UpdateNodeLayerHandler }, { type: GetOutgoingConnectionsHandler }, { type: GetIncomingConnectionsHandler }, { type: FFlowMediator }] });
3197
+ }], ctorParameters: () => [{ type: FComponentsStore }, { type: FDraggableDataContext }, { type: GetOutgoingConnectionsHandler }, { type: GetIncomingConnectionsHandler }, { type: FFlowMediator }] });
3016
3198
 
3017
3199
  const NODE_PROVIDERS = [
3018
3200
  NodeOnPointerUp,
@@ -3169,82 +3351,71 @@ const SELECTION_AREA_PROVIDERS = [
3169
3351
  ];
3170
3352
 
3171
3353
  class SingleSelectOnPointerDown {
3172
- constructor(fComponentsStore, fDraggableDataContext, getConnectionHandler, updateConnectionLayerHandler) {
3354
+ constructor(fComponentsStore, fDraggableDataContext, getConnectionHandler, fMediator) {
3173
3355
  this.fComponentsStore = fComponentsStore;
3174
3356
  this.fDraggableDataContext = fDraggableDataContext;
3175
3357
  this.getConnectionHandler = getConnectionHandler;
3176
- this.updateConnectionLayerHandler = updateConnectionLayerHandler;
3358
+ this.fMediator = fMediator;
3177
3359
  }
3178
3360
  handle(event) {
3179
3361
  if (!this.fComponentsStore.fFlow?.hostElement.contains(event.targetElement)) {
3180
3362
  return;
3181
3363
  }
3182
- const node = this.fComponentsStore.findNode(event.targetElement);
3183
- const connection = this.getConnectionHandler.handle(event.targetElement);
3184
- this.deselectAll(node, event);
3185
- let element;
3186
- if (this.fDraggableDataContext.selectedItems.length) {
3187
- element = this.fDraggableDataContext.selectedItems[0];
3364
+ const item = this.getSelectableItem(event);
3365
+ if (item) {
3366
+ this.fMediator.send(new UpdateItemLayerRequest(item, item.hostElement.parentElement));
3188
3367
  }
3189
- this.resetSelectionIfNotMultiselect(event);
3190
- if (node) {
3191
- if (!this.fDraggableDataContext.selectedItems.includes(node) && !node.fSelectionDisabled) {
3192
- this.fDraggableDataContext.selectedItems.push(node);
3193
- if (element?.hostElement.dataset['fNodeId'] !== node.hostElement.dataset['fNodeId']) {
3194
- this.fDraggableDataContext.isSelectedChanged = true;
3195
- }
3196
- }
3197
- else {
3198
- const index = this.fDraggableDataContext.selectedItems.indexOf(node);
3199
- if (index > -1) {
3200
- this.fDraggableDataContext.selectedItems.splice(index, 1);
3201
- }
3368
+ this.isMultiselectEnabled(event) ? this.multiSelect(item) : this.singleSelect(item);
3369
+ }
3370
+ getSelectableItem(event) {
3371
+ return this.fComponentsStore.findNode(event.targetElement) || this.getConnectionHandler.handle(event.targetElement);
3372
+ }
3373
+ isMultiselectEnabled(event) {
3374
+ return MouseEventExtensions.isCommandButton(event.originalEvent) ||
3375
+ MouseEventExtensions.isShiftPressed(event.originalEvent);
3376
+ }
3377
+ singleSelect(item) {
3378
+ if (item) {
3379
+ if (!item.isSelected() && !item.fSelectionDisabled) {
3380
+ this.clearSelection();
3381
+ this.selectItem(item);
3202
3382
  }
3203
3383
  }
3204
- else if (connection) {
3205
- this.updateConnectionLayerHandler.handle(connection);
3206
- if (!this.fDraggableDataContext.selectedItems.includes(connection) && !connection.fSelectionDisabled) {
3207
- this.fDraggableDataContext.selectedItems.push(connection);
3208
- if (element?.hostElement.id !== connection.hostElement.id) {
3209
- this.fDraggableDataContext.isSelectedChanged = true;
3210
- }
3211
- }
3212
- else {
3213
- const index = this.fDraggableDataContext.selectedItems.indexOf(connection);
3214
- if (index > -1) {
3215
- this.fDraggableDataContext.selectedItems.splice(index, 1);
3216
- }
3217
- }
3384
+ else {
3385
+ this.clearSelection();
3218
3386
  }
3219
- this.selectIfNotSelected();
3220
3387
  }
3221
- deselectAll(node, event) {
3222
- this.fDraggableDataContext.selectedItems.forEach((x) => {
3223
- if (x !== node || (!isNodeOutlet(event.targetElement) && !isNodeOutput(event.targetElement))) {
3224
- x.deselect();
3225
- }
3226
- });
3388
+ multiSelect(item) {
3389
+ if (item && !item.fSelectionDisabled) {
3390
+ item.isSelected() ? this.deselectItem(item) : this.selectItem(item);
3391
+ }
3227
3392
  }
3228
- resetSelectionIfNotMultiselect(event) {
3229
- const isMultiselect = MouseEventExtensions.isCommandButton(event.originalEvent) ||
3230
- MouseEventExtensions.isShiftPressed(event.originalEvent);
3231
- if (!isMultiselect) {
3232
- this.fDraggableDataContext.selectedItems = [];
3393
+ deselectItem(item) {
3394
+ const index = this.fDraggableDataContext.selectedItems.indexOf(item);
3395
+ if (index > -1) {
3396
+ this.fDraggableDataContext.selectedItems.splice(index, 1);
3233
3397
  }
3398
+ item.deselect();
3399
+ this.fDraggableDataContext.markSelectionAsChanged();
3234
3400
  }
3235
- selectIfNotSelected() {
3401
+ selectItem(item) {
3402
+ this.fDraggableDataContext.selectedItems.push(item);
3403
+ item.select();
3404
+ this.fDraggableDataContext.markSelectionAsChanged();
3405
+ }
3406
+ clearSelection() {
3236
3407
  this.fDraggableDataContext.selectedItems.forEach((x) => {
3237
- if (!x.isSelected()) {
3238
- x.select();
3239
- }
3408
+ x.deselect();
3409
+ this.fDraggableDataContext.markSelectionAsChanged();
3240
3410
  });
3411
+ this.fDraggableDataContext.selectedItems = [];
3241
3412
  }
3242
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: SingleSelectOnPointerDown, deps: [{ token: FComponentsStore }, { token: FDraggableDataContext }, { token: GetConnectionHandler }, { token: UpdateConnectionLayerHandler }], target: i0.ɵɵFactoryTarget.Injectable }); }
3413
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: SingleSelectOnPointerDown, deps: [{ token: FComponentsStore }, { token: FDraggableDataContext }, { token: GetConnectionHandler }, { token: FFlowMediator }], target: i0.ɵɵFactoryTarget.Injectable }); }
3243
3414
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: SingleSelectOnPointerDown }); }
3244
3415
  }
3245
3416
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: SingleSelectOnPointerDown, decorators: [{
3246
3417
  type: Injectable
3247
- }], ctorParameters: () => [{ type: FComponentsStore }, { type: FDraggableDataContext }, { type: GetConnectionHandler }, { type: UpdateConnectionLayerHandler }] });
3418
+ }], ctorParameters: () => [{ type: FComponentsStore }, { type: FDraggableDataContext }, { type: GetConnectionHandler }, { type: FFlowMediator }] });
3248
3419
 
3249
3420
  const SINGLE_SELECT_PROVIDERS = [
3250
3421
  SingleSelectOnPointerDown
@@ -3282,10 +3453,12 @@ class FDraggableBase {
3282
3453
  this.dragStartTime = Date.now();
3283
3454
  this.dragStartPosition = mouseEvent.getPosition();
3284
3455
  this.ngZone.runOutsideAngular(() => {
3456
+ this.document?.addEventListener('selectstart', this.onSelectStart, EventExtensions.activeListener());
3285
3457
  this.document?.addEventListener('mousemove', this.onMouseMove);
3286
3458
  this.document?.addEventListener('mouseup', this.onMouseUp);
3287
3459
  });
3288
3460
  this.mouseListeners = () => {
3461
+ this.document?.removeEventListener('selectstart', this.onSelectStart, EventExtensions.activeListener());
3289
3462
  this.document?.removeEventListener('mousemove', this.onMouseMove);
3290
3463
  this.document?.removeEventListener('mouseup', this.onMouseUp);
3291
3464
  };
@@ -3302,15 +3475,20 @@ class FDraggableBase {
3302
3475
  this.dragStartTime = Date.now();
3303
3476
  this.dragStartPosition = touchEvent.getPosition();
3304
3477
  this.ngZone.runOutsideAngular(() => {
3478
+ this.document?.addEventListener('selectstart', this.onSelectStart, EventExtensions.activeListener());
3305
3479
  this.document?.addEventListener('touchmove', this.onTouchMove);
3306
3480
  this.document?.addEventListener('touchend', this.onTouchUp);
3307
3481
  });
3308
3482
  this.touchListeners = () => {
3483
+ this.document?.removeEventListener('selectstart', this.onSelectStart, EventExtensions.activeListener());
3309
3484
  this.document?.removeEventListener('touchmove', this.onTouchMove);
3310
3485
  this.document?.removeEventListener('touchend', this.onTouchUp);
3311
3486
  };
3312
3487
  }
3313
3488
  };
3489
+ this.onSelectStart = (event) => {
3490
+ this.onSelect(event);
3491
+ };
3314
3492
  this.onMouseMove = (event) => {
3315
3493
  this.moveHandler(new IMouseEvent(event));
3316
3494
  };
@@ -3453,6 +3631,13 @@ class FDraggableDirective extends FDraggableBase {
3453
3631
  this.hostElement.classList.add('f-dragging');
3454
3632
  }
3455
3633
  }
3634
+ onSelect(event) {
3635
+ const isTargetNotHtml = event.constructor.name === 'Event';
3636
+ const target = isTargetNotHtml ? event.target.parentNode : event.target;
3637
+ if (target && isExternalItem(target)) {
3638
+ event.preventDefault();
3639
+ }
3640
+ }
3456
3641
  onPointerMove(event) {
3457
3642
  const pointerPositionInCanvas = Point.fromPoint(event.getPosition()).elementTransform(this.hostElement);
3458
3643
  const difference = pointerPositionInCanvas.div(this.fDraggableDataContext.onPointerDownScale).sub(this.fDraggableDataContext.onPointerDownPosition);
@@ -3479,6 +3664,7 @@ class FDraggableDirective extends FDraggableBase {
3479
3664
  }
3480
3665
  const result = this.fMediator.send(new GetSelectionRequest());
3481
3666
  this.fSelectionChange.emit(result);
3667
+ this.fDraggableDataContext.isSelectedChanged = false;
3482
3668
  }
3483
3669
  ngOnDestroy() {
3484
3670
  super.unsubscribe();
@@ -3542,6 +3728,54 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
3542
3728
  type: Injectable
3543
3729
  }], ctorParameters: () => [{ type: FDraggableDataContext }] });
3544
3730
 
3731
+ class CreateConnectionMarkersRequest {
3732
+ constructor(fConnection) {
3733
+ this.fConnection = fConnection;
3734
+ }
3735
+ }
3736
+
3737
+ let CreateConnectionMarkersHandler = class CreateConnectionMarkersHandler {
3738
+ handle(request) {
3739
+ const element = DomElementExtensions.createSvgElement('defs');
3740
+ const fConnection = request.fConnection;
3741
+ fConnection.fMarkers.forEach((marker) => {
3742
+ const markerElement = this.createMarkerElement(marker, fConnection.fConnectionId);
3743
+ const clone = marker.hostElement.cloneNode(true);
3744
+ clone.setAttribute('height', `${marker.height}`);
3745
+ clone.setAttribute('width', `${marker.width}`);
3746
+ clone.removeAttribute('markerUnits');
3747
+ clone.style.display = 'unset';
3748
+ markerElement.append(clone);
3749
+ element.append(markerElement);
3750
+ });
3751
+ fConnection.fDefs.nativeElement.innerHTML = element.innerHTML;
3752
+ this.makeSafariCompatible(fConnection);
3753
+ }
3754
+ // Safari does not support markers on path elements if markers are defined after the path element
3755
+ makeSafariCompatible(fConnection) {
3756
+ fConnection.fPath.hostElement.replaceWith(fConnection.fPath.hostElement);
3757
+ }
3758
+ createMarkerElement(marker, fConnectionId) {
3759
+ const markerElement = DomElementExtensions.createSvgElement('marker');
3760
+ markerElement.setAttribute('id', sanitizeElementId(marker.type + '-' + fConnectionId));
3761
+ markerElement.setAttribute('markerHeight', `${marker.height}`);
3762
+ markerElement.setAttribute('markerWidth', `${marker.width}`);
3763
+ markerElement.setAttribute('orient', `${marker.orient}`);
3764
+ markerElement.setAttribute('refX', `${marker.refX}`);
3765
+ markerElement.setAttribute('refY', `${marker.refY}`);
3766
+ markerElement.setAttribute('markerUnits', `${marker.markerUnits}`);
3767
+ return markerElement;
3768
+ }
3769
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: CreateConnectionMarkersHandler, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
3770
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: CreateConnectionMarkersHandler }); }
3771
+ };
3772
+ CreateConnectionMarkersHandler = __decorate([
3773
+ FHandlerRegister(CreateConnectionMarkersRequest)
3774
+ ], CreateConnectionMarkersHandler);
3775
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: CreateConnectionMarkersHandler, decorators: [{
3776
+ type: Injectable
3777
+ }] });
3778
+
3545
3779
  class GetConnectionVectorRequest {
3546
3780
  constructor(outputRect, inputRect, behavior, outputSide, inputSide) {
3547
3781
  this.outputRect = outputRect;
@@ -3642,8 +3876,7 @@ let GetElementRectInFlowHandler = class GetElementRectInFlowHandler {
3642
3876
  const systemRect = RectExtensions.fromElement(request.element);
3643
3877
  const position = Point.fromPoint(systemRect).elementTransform(this.flowHost).sub(this.transform.scaledPosition).sub(this.transform.position).div(this.transform.scale);
3644
3878
  const size = SizeExtensions.initialize(systemRect.width / this.transform.scale, systemRect.height / this.transform.scale);
3645
- const result = RectExtensions.initialize(position.x, position.y, size.width, size.height);
3646
- return result;
3879
+ return RectExtensions.initialize(position.x, position.y, size.width, size.height);
3647
3880
  }
3648
3881
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: GetElementRectInFlowHandler, deps: [{ token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Injectable }); }
3649
3882
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: GetElementRectInFlowHandler }); }
@@ -3755,6 +3988,36 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
3755
3988
  type: Injectable
3756
3989
  }], ctorParameters: () => [{ type: FComponentsStore }, { type: FFlowMediator }] });
3757
3990
 
3991
+ class GetPositionInFlowRequest {
3992
+ constructor(position) {
3993
+ this.position = position;
3994
+ }
3995
+ }
3996
+
3997
+ let GetPositionInFlowHandler = class GetPositionInFlowHandler {
3998
+ get transform() {
3999
+ return this.fComponentsStore.transform;
4000
+ }
4001
+ get flowHost() {
4002
+ return this.fComponentsStore.flowHost;
4003
+ }
4004
+ constructor(fComponentsStore) {
4005
+ this.fComponentsStore = fComponentsStore;
4006
+ }
4007
+ handle(request) {
4008
+ return Point.fromPoint(request.position).elementTransform(this.flowHost)
4009
+ .sub(this.transform.scaledPosition).sub(this.transform.position).div(this.transform.scale);
4010
+ }
4011
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: GetPositionInFlowHandler, deps: [{ token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Injectable }); }
4012
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: GetPositionInFlowHandler }); }
4013
+ };
4014
+ GetPositionInFlowHandler = __decorate([
4015
+ FHandlerRegister(GetPositionInFlowRequest)
4016
+ ], GetPositionInFlowHandler);
4017
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: GetPositionInFlowHandler, decorators: [{
4018
+ type: Injectable
4019
+ }], ctorParameters: () => [{ type: FComponentsStore }] });
4020
+
3758
4021
  class GetSelectionRequest {
3759
4022
  }
3760
4023
 
@@ -3795,7 +4058,9 @@ let RedrawConnectionsHandler = class RedrawConnectionsHandler {
3795
4058
  }
3796
4059
  handle(request) {
3797
4060
  this.resetConnectors();
3798
- this.fComponentsStore.fTempConnection?.setMarkers();
4061
+ if (this.fComponentsStore.fTempConnection) {
4062
+ this.setMarkers(this.fComponentsStore.fTempConnection);
4063
+ }
3799
4064
  this.fComponentsStore.fConnections.forEach((connection) => {
3800
4065
  const output = this.fComponentsStore.fOutputs.find((x) => x.id === connection.fOutputId);
3801
4066
  const input = this.fComponentsStore.fInputs.find((x) => x.id === connection.fInputId);
@@ -3812,15 +4077,19 @@ let RedrawConnectionsHandler = class RedrawConnectionsHandler {
3812
4077
  output.setConnected(true);
3813
4078
  input.setConnected(true);
3814
4079
  const vector = this.getVector(output, input, connection);
4080
+ this.setMarkers(connection);
3815
4081
  connection.setVector(vector.point1, output.fConnectableSide, vector.point2, input.fConnectableSide);
3816
- connection.setMarkers();
3817
4082
  connection.initialize();
4083
+ connection.isSelected() ? connection.select() : null;
3818
4084
  }
3819
4085
  getVector(output, input, connection) {
3820
4086
  const outputRect = this.fMediator.send(new GetElementRectInFlowRequest(output.hostElement));
3821
4087
  const inputRect = this.fMediator.send(new GetElementRectInFlowRequest(input.hostElement));
3822
4088
  return this.fMediator.send(new GetConnectionVectorRequest(outputRect, inputRect, connection.fBehavior, output.fConnectableSide, input.fConnectableSide));
3823
4089
  }
4090
+ setMarkers(connection) {
4091
+ this.fMediator.send(new CreateConnectionMarkersRequest(connection));
4092
+ }
3824
4093
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: RedrawConnectionsHandler, deps: [{ token: FComponentsStore }, { token: FFlowMediator }], target: i0.ɵɵFactoryTarget.Injectable }); }
3825
4094
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: RedrawConnectionsHandler }); }
3826
4095
  };
@@ -3849,7 +4118,7 @@ let SelectHandler = class SelectHandler {
3849
4118
  });
3850
4119
  this.fDraggableDataContext.selectedItems = [];
3851
4120
  request.nodes.forEach((key) => {
3852
- const node = this.fDataContext.fNodes.find((x) => x.fNodeId === key);
4121
+ const node = this.fDataContext.fNodes.find((x) => x.fId === key);
3853
4122
  if (node) {
3854
4123
  node.select();
3855
4124
  this.fDraggableDataContext.selectedItems.push(node);
@@ -3907,6 +4176,36 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
3907
4176
  type: Injectable
3908
4177
  }], ctorParameters: () => [{ type: FComponentsStore }, { type: FDraggableDataContext }] });
3909
4178
 
4179
+ class UpdateItemLayerRequest {
4180
+ constructor(item, itemContainer) {
4181
+ this.item = item;
4182
+ this.itemContainer = itemContainer;
4183
+ }
4184
+ }
4185
+
4186
+ let UpdateItemLayerHandler = class UpdateItemLayerHandler {
4187
+ handle(request) {
4188
+ const elements = Array.from(request.itemContainer.children);
4189
+ const elementsCount = elements.length;
4190
+ const targetIndex = elements.findIndex((x) => x === request.item.hostElement);
4191
+ if (targetIndex !== elementsCount - 1) {
4192
+ const afterElements = elements.splice(targetIndex + 1);
4193
+ afterElements.forEach((x) => {
4194
+ request.itemContainer.removeChild(x);
4195
+ request.itemContainer.insertBefore(x, request.item.hostElement);
4196
+ });
4197
+ }
4198
+ }
4199
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: UpdateItemLayerHandler, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
4200
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: UpdateItemLayerHandler }); }
4201
+ };
4202
+ UpdateItemLayerHandler = __decorate([
4203
+ FHandlerRegister(UpdateItemLayerRequest)
4204
+ ], UpdateItemLayerHandler);
4205
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: UpdateItemLayerHandler, decorators: [{
4206
+ type: Injectable
4207
+ }] });
4208
+
3910
4209
  class GetConnectionHandler {
3911
4210
  get fConnections() {
3912
4211
  return this.fComponentsStore.fConnections;
@@ -3915,8 +4214,7 @@ class GetConnectionHandler {
3915
4214
  this.fComponentsStore = fComponentsStore;
3916
4215
  }
3917
4216
  handle(element) {
3918
- const result = this.fConnections.find(c => c.isContains(element));
3919
- return result;
4217
+ return this.fConnections.find(c => c.isContains(element));
3920
4218
  }
3921
4219
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: GetConnectionHandler, deps: [{ token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Injectable }); }
3922
4220
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: GetConnectionHandler }); }
@@ -3965,74 +4263,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
3965
4263
  type: Injectable
3966
4264
  }], ctorParameters: () => [{ type: FComponentsStore }] });
3967
4265
 
3968
- class UpdateNodeLayerHandler {
3969
- get fNodesContainer() {
3970
- return this.fComponentsStore.fCanvas?.fNodesContainer?.nativeElement;
3971
- }
3972
- constructor(fComponentsStore) {
3973
- this.fComponentsStore = fComponentsStore;
3974
- }
3975
- handle(node) {
3976
- const elements = Array.from(this.fNodesContainer.children);
3977
- const elementsCount = elements.length;
3978
- const targetIndex = elements.findIndex((x) => x === node.hostElement);
3979
- if (targetIndex !== elementsCount - 1) {
3980
- const afterElements = elements.splice(targetIndex + 1);
3981
- afterElements.forEach((x) => {
3982
- this.fNodesContainer.removeChild(x);
3983
- this.fNodesContainer.insertBefore(x, node.hostElement);
3984
- });
3985
- }
3986
- }
3987
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: UpdateNodeLayerHandler, deps: [{ token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Injectable }); }
3988
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: UpdateNodeLayerHandler }); }
3989
- }
3990
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: UpdateNodeLayerHandler, decorators: [{
3991
- type: Injectable
3992
- }], ctorParameters: () => [{ type: FComponentsStore }] });
3993
-
3994
- class UpdateConnectionLayerHandler {
3995
- get fConnectionsContainer() {
3996
- return this.fComponentsStore.fCanvas?.fConnectionsContainer?.nativeElement;
3997
- }
3998
- constructor(fComponentsStore) {
3999
- this.fComponentsStore = fComponentsStore;
4000
- }
4001
- handle(connection) {
4002
- const elements = Array.from(this.fConnectionsContainer.children);
4003
- const elementsCount = elements.length;
4004
- const targetIndex = elements.findIndex((x) => x === connection.hostElement);
4005
- if (targetIndex !== elementsCount - 1) {
4006
- const afterElements = elements.splice(targetIndex + 1);
4007
- afterElements.forEach((x) => {
4008
- this.fConnectionsContainer.removeChild(x);
4009
- this.fConnectionsContainer.insertBefore(x, connection.hostElement);
4010
- });
4011
- }
4012
- }
4013
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: UpdateConnectionLayerHandler, deps: [{ token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Injectable }); }
4014
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: UpdateConnectionLayerHandler }); }
4015
- }
4016
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: UpdateConnectionLayerHandler, decorators: [{
4017
- type: Injectable
4018
- }], ctorParameters: () => [{ type: FComponentsStore }] });
4019
-
4020
4266
  const COMMON_PROVIDERS = [
4021
4267
  ClearSelectionHandler,
4268
+ CreateConnectionMarkersHandler,
4022
4269
  GetConnectionVectorHandler,
4023
4270
  GetElementRectInFlowHandler,
4024
4271
  GetNodesRectHandler,
4025
4272
  GetOutputRectInFlowHandler,
4273
+ GetPositionInFlowHandler,
4026
4274
  GetSelectionHandler,
4027
4275
  RedrawConnectionsHandler,
4028
4276
  SelectHandler,
4029
4277
  SelectAllHandler,
4278
+ UpdateItemLayerHandler,
4030
4279
  GetConnectionHandler,
4031
4280
  GetInputRectInFlowHandler,
4032
4281
  GetIncomingConnectionsHandler,
4033
4282
  GetOutgoingConnectionsHandler,
4034
- UpdateConnectionLayerHandler,
4035
- UpdateNodeLayerHandler,
4036
4283
  ];
4037
4284
 
4038
4285
  class FCanvasComponent extends FCanvasBase {
@@ -4104,13 +4351,13 @@ class FCanvasComponent extends FCanvasBase {
4104
4351
  this.completeDrag();
4105
4352
  }
4106
4353
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FCanvasComponent, deps: [{ token: i0.ElementRef }, { token: FFlowMediator }, { token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Component }); }
4107
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.1", type: FCanvasComponent, selector: "f-canvas", inputs: { position: "position", scale: "scale" }, outputs: { fCanvasChange: "fCanvasChange" }, host: { classAttribute: "f-component f-canvas" }, providers: [{ provide: F_CANVAS, useExisting: FCanvasComponent }], viewQueries: [{ propertyName: "fNodesContainer", first: true, predicate: ["fNodesContainer"], descendants: true, static: true }, { propertyName: "fConnectionsContainer", first: true, predicate: ["fConnectionsContainer"], descendants: true, static: true }], exportAs: ["fComponent"], usesInheritance: true, ngImport: i0, template: "<ng-container>\n <div #fConnectionsContainer>\n <ng-content select=\"f-connection\"></ng-content>\n <ng-content select=\"f-connection-for-create\"></ng-content>\n </div>\n <div #fNodesContainer>\n <ng-content select=\"[fNode]\"></ng-content>\n </div>\n</ng-container>\n", styles: [":host{position:absolute;overflow:visible;width:100%;height:100%;left:0;top:0;transform-origin:0 0;pointer-events:none}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
4354
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.1", type: FCanvasComponent, selector: "f-canvas", inputs: { position: "position", scale: "scale" }, outputs: { fCanvasChange: "fCanvasChange" }, host: { classAttribute: "f-component f-canvas" }, providers: [{ provide: F_CANVAS, useExisting: FCanvasComponent }], viewQueries: [{ propertyName: "fNodesContainer", first: true, predicate: ["fNodesContainer"], descendants: true, static: true }, { propertyName: "fConnectionsContainer", first: true, predicate: ["fConnectionsContainer"], descendants: true, static: true }], exportAs: ["fComponent"], usesInheritance: true, ngImport: i0, template: "<ng-container>\n <div #fConnectionsContainer>\n <ng-content select=\"f-connection\"></ng-content>\n <ng-content select=\"f-connection-for-create\"></ng-content>\n </div>\n <div #fNodesContainer>\n <ng-content select=\"[fGroup]\"></ng-content>\n <ng-content select=\"[fNode]\"></ng-content>\n </div>\n</ng-container>\n", styles: [":host{position:absolute;overflow:visible;width:100%;height:100%;left:0;top:0;transform-origin:0 0;pointer-events:none}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
4108
4355
  }
4109
4356
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FCanvasComponent, decorators: [{
4110
4357
  type: Component,
4111
4358
  args: [{ selector: 'f-canvas', exportAs: 'fComponent', host: {
4112
4359
  'class': 'f-component f-canvas',
4113
- }, providers: [{ provide: F_CANVAS, useExisting: FCanvasComponent }], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container>\n <div #fConnectionsContainer>\n <ng-content select=\"f-connection\"></ng-content>\n <ng-content select=\"f-connection-for-create\"></ng-content>\n </div>\n <div #fNodesContainer>\n <ng-content select=\"[fNode]\"></ng-content>\n </div>\n</ng-container>\n", styles: [":host{position:absolute;overflow:visible;width:100%;height:100%;left:0;top:0;transform-origin:0 0;pointer-events:none}\n"] }]
4360
+ }, providers: [{ provide: F_CANVAS, useExisting: FCanvasComponent }], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container>\n <div #fConnectionsContainer>\n <ng-content select=\"f-connection\"></ng-content>\n <ng-content select=\"f-connection-for-create\"></ng-content>\n </div>\n <div #fNodesContainer>\n <ng-content select=\"[fGroup]\"></ng-content>\n <ng-content select=\"[fNode]\"></ng-content>\n </div>\n</ng-container>\n", styles: [":host{position:absolute;overflow:visible;width:100%;height:100%;left:0;top:0;transform-origin:0 0;pointer-events:none}\n"] }]
4114
4361
  }], ctorParameters: () => [{ type: i0.ElementRef }, { type: FFlowMediator }, { type: FComponentsStore }], propDecorators: { fCanvasChange: [{
4115
4362
  type: Output
4116
4363
  }], position: [{
@@ -4423,7 +4670,7 @@ const F_FLOW = new InjectionToken('F_FLOW');
4423
4670
  class FFlowBase {
4424
4671
  }
4425
4672
 
4426
- let uniqueId = 0;
4673
+ let uniqueId$1 = 0;
4427
4674
  class FFlowComponent extends FFlowBase {
4428
4675
  get hostElement() {
4429
4676
  return this.elementReference.nativeElement;
@@ -4434,13 +4681,12 @@ class FFlowComponent extends FFlowBase {
4434
4681
  this.fComponentsStore = fComponentsStore;
4435
4682
  this.fMediator = fMediator;
4436
4683
  this.subscription$ = new Subscription();
4437
- this.fFlowId = `f-flow-${uniqueId++}`;
4684
+ this.fFlowId = `f-flow-${uniqueId$1++}`;
4438
4685
  this.fLoaded = new EventEmitter();
4439
4686
  this.isLoaded = false;
4440
4687
  }
4441
4688
  ngOnInit() {
4442
4689
  this.fComponentsStore.fFlow = this;
4443
- FLOW.UID = this.fFlowId;
4444
4690
  }
4445
4691
  ngAfterContentInit() {
4446
4692
  this.subscription$.add(this.subscribeOnElementsChanges());
@@ -4454,16 +4700,20 @@ class FFlowComponent extends FFlowBase {
4454
4700
  }
4455
4701
  });
4456
4702
  }
4703
+ redraw() {
4704
+ this.fComponentsStore.changes.next();
4705
+ }
4457
4706
  reset() {
4458
4707
  this.isLoaded = false;
4459
4708
  }
4460
4709
  getNodesRect() {
4461
- const result = this.fMediator.send(new GetNodesRectRequest());
4462
- return result;
4710
+ return this.fMediator.send(new GetNodesRectRequest());
4463
4711
  }
4464
4712
  getSelection() {
4465
- const result = this.fMediator.send(new GetSelectionRequest());
4466
- return result;
4713
+ return this.fMediator.send(new GetSelectionRequest());
4714
+ }
4715
+ getPositionInFlow(position) {
4716
+ return this.fMediator.send(new GetPositionInFlowRequest(position));
4467
4717
  }
4468
4718
  selectAll() {
4469
4719
  this.fMediator.send(new SelectAllRequest());
@@ -4518,6 +4768,116 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
4518
4768
  type: Output
4519
4769
  }] } });
4520
4770
 
4771
+ const F_GROUP = new InjectionToken('F_GROUP');
4772
+ class FGroupBase extends FNodeBase {
4773
+ }
4774
+
4775
+ let uniqueId = 0;
4776
+ class FGroupDirective extends FGroupBase {
4777
+ set position(value) {
4778
+ this._position = PointExtensions.castToPoint(value);
4779
+ this.refresh();
4780
+ }
4781
+ get position() {
4782
+ return this._position;
4783
+ }
4784
+ get hostElement() {
4785
+ return this.elementReference.nativeElement;
4786
+ }
4787
+ constructor(elementReference, renderer, fComponentsStore) {
4788
+ super();
4789
+ this.elementReference = elementReference;
4790
+ this.renderer = renderer;
4791
+ this.fComponentsStore = fComponentsStore;
4792
+ this.subscriptions$ = new Subscription();
4793
+ this.fId = `f-group-${uniqueId++}`;
4794
+ this.positionChange = new EventEmitter();
4795
+ this.fDraggingDisabled = false;
4796
+ this.fSelectionDisabled = false;
4797
+ this.connectors = [];
4798
+ }
4799
+ ngOnInit() {
4800
+ this.setStyle('position', 'absolute');
4801
+ this.setStyle('transform-origin', '0 0');
4802
+ this.setStyle('user-select', 'none');
4803
+ this.setStyle('pointer-events', 'all');
4804
+ this.setStyle('left', '0');
4805
+ this.setStyle('top', '0');
4806
+ super.redraw();
4807
+ this.fComponentsStore.addComponent(this.fComponentsStore.fGroups, this);
4808
+ }
4809
+ setStyle(styleName, value) {
4810
+ this.renderer.setStyle(this.hostElement, styleName, value);
4811
+ }
4812
+ ngAfterViewInit() {
4813
+ this.subscriptions$.add(this.subscribeOnResizeChanges());
4814
+ }
4815
+ subscribeOnResizeChanges() {
4816
+ return merge(new FResizeObserver(this.hostElement), this.stateChanges).pipe(debounceTime(5), startWith(null)).subscribe(() => {
4817
+ this.connectors.forEach((fConnector) => {
4818
+ fConnector.fConnectableSide = new CalculateConnectorConnectableSideHandler().handle(new CalculateConnectorConnectableSideRequest(fConnector, this.hostElement));
4819
+ });
4820
+ this.fComponentsStore.changes.next();
4821
+ });
4822
+ }
4823
+ addConnector(connector) {
4824
+ this.connectors.push(connector);
4825
+ this.stateChanges.next();
4826
+ }
4827
+ removeConnector(connector) {
4828
+ const index = this.connectors.indexOf(connector);
4829
+ if (index !== -1) {
4830
+ this.connectors.splice(index, 1);
4831
+ }
4832
+ this.stateChanges.next();
4833
+ }
4834
+ refresh() {
4835
+ this.stateChanges.next();
4836
+ }
4837
+ ngOnDestroy() {
4838
+ this.fComponentsStore.removeComponent(this.fComponentsStore.fGroups, this);
4839
+ this.stateChanges.complete();
4840
+ this.subscriptions$.unsubscribe();
4841
+ }
4842
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FGroupDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Directive }); }
4843
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.1", type: FGroupDirective, selector: "[fGroup]", inputs: { fId: ["fGroupId", "fId"], position: ["fGroupPosition", "position"], fDraggingDisabled: ["fGroupDraggingDisabled", "fDraggingDisabled"], fSelectionDisabled: ["fGroupSelectionDisabled", "fSelectionDisabled"] }, outputs: { positionChange: "fGroupPositionChange" }, host: { properties: { "attr.data-f-group-id": "fId" }, classAttribute: "f-group f-component" }, providers: [
4844
+ { provide: F_GROUP, useExisting: FGroupDirective }
4845
+ ], exportAs: ["fComponent"], usesInheritance: true, ngImport: i0 }); }
4846
+ }
4847
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FGroupDirective, decorators: [{
4848
+ type: Directive,
4849
+ args: [{
4850
+ selector: "[fGroup]",
4851
+ exportAs: "fComponent",
4852
+ host: {
4853
+ '[attr.data-f-group-id]': 'fId',
4854
+ class: "f-group f-component",
4855
+ },
4856
+ providers: [
4857
+ { provide: F_GROUP, useExisting: FGroupDirective }
4858
+ ],
4859
+ }]
4860
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: FComponentsStore }], propDecorators: { fId: [{
4861
+ type: Input,
4862
+ args: ['fGroupId']
4863
+ }], position: [{
4864
+ type: Input,
4865
+ args: ['fGroupPosition']
4866
+ }], positionChange: [{
4867
+ type: Output,
4868
+ args: ['fGroupPositionChange']
4869
+ }], fDraggingDisabled: [{
4870
+ type: Input,
4871
+ args: ['fGroupDraggingDisabled']
4872
+ }], fSelectionDisabled: [{
4873
+ type: Input,
4874
+ args: ['fGroupSelectionDisabled']
4875
+ }] } });
4876
+
4877
+ function isGroup(element) {
4878
+ return !!element.closest('[f-group]');
4879
+ }
4880
+
4521
4881
  class FFlowModule {
4522
4882
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: FFlowModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
4523
4883
  static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.1", ngImport: i0, type: FFlowModule, declarations: [FConnectionDragHandleComponent,
@@ -4530,9 +4890,11 @@ class FFlowModule {
4530
4890
  FMarkerDirective,
4531
4891
  FFlowComponent,
4532
4892
  FBackgroundComponent,
4533
- FCellPatternComponent,
4893
+ FRectPatternComponent,
4894
+ FCirclePatternComponent,
4534
4895
  FCanvasComponent,
4535
4896
  FNodeDirective,
4897
+ FGroupDirective,
4536
4898
  FDragHandleDirective,
4537
4899
  FConnectionComponent,
4538
4900
  FConnectionForCreateComponent,
@@ -4545,7 +4907,8 @@ class FFlowModule {
4545
4907
  FSelectionAreaComponent,
4546
4908
  FLineAlignmentComponent], imports: [CommonModule], exports: [FFlowComponent,
4547
4909
  FBackgroundComponent,
4548
- FCellPatternComponent,
4910
+ FRectPatternComponent,
4911
+ FCirclePatternComponent,
4549
4912
  FCanvasComponent,
4550
4913
  FNodeDirective,
4551
4914
  FDragHandleDirective,
@@ -4579,9 +4942,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
4579
4942
  FMarkerDirective,
4580
4943
  FFlowComponent,
4581
4944
  FBackgroundComponent,
4582
- FCellPatternComponent,
4945
+ FRectPatternComponent,
4946
+ FCirclePatternComponent,
4583
4947
  FCanvasComponent,
4584
4948
  FNodeDirective,
4949
+ FGroupDirective,
4585
4950
  FDragHandleDirective,
4586
4951
  FConnectionComponent,
4587
4952
  FConnectionForCreateComponent,
@@ -4603,7 +4968,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
4603
4968
  exports: [
4604
4969
  FFlowComponent,
4605
4970
  FBackgroundComponent,
4606
- FCellPatternComponent,
4971
+ FRectPatternComponent,
4972
+ FCirclePatternComponent,
4607
4973
  FCanvasComponent,
4608
4974
  FNodeDirective,
4609
4975
  FDragHandleDirective,
@@ -4627,5 +4993,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImpor
4627
4993
  * Generated bundle index. Do not edit.
4628
4994
  */
4629
4995
 
4630
- export { CANVAS_PROVIDERS, COMMON_PROVIDERS, CONNECTIONS_PROVIDERS, CONNECTION_GRADIENT, CONNECTION_PATH, CONNECTION_TEXT, CalculateCenterBetweenPointsHandler, CalculateCenterBetweenPointsRequest, CalculateConnectionCenterHandler, CalculateConnectionCenterRequest, CalculateConnectorConnectableSideHandler, CalculateConnectorConnectableSideRequest, CanvasDragHandler, CanvasOnPointerUp, CanvasPrepareDragSequence, ClearSelectionHandler, ClearSelectionRequest, 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, FConnectionFactory, 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, FReassignConnectionEvent, FResizeObserver, FSegmentPathBuilder, FSelectionAreaBase, FSelectionAreaComponent, FSelectionChangeEvent, FStraightPathBuilder, FZoomBase, FZoomDirective, F_BACKGROUND, F_BACKGROUND_PATTERN, F_CANVAS, F_CONNECTION_BUILDERS, 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, GetCanBeSelectedItemsHandler, GetConnectionHandler, GetConnectionVectorHandler, GetConnectionVectorRequest, GetElementRectInFlowHandler, GetElementRectInFlowRequest, GetIncomingConnectionsHandler, GetInputRectInFlowHandler, GetInputRectInFlowRequest, GetInputRectInFlowResponse, GetNodesRectHandler, GetNodesRectRequest, GetOutgoingConnectionsHandler, GetOutputRectInFlowHandler, GetOutputRectInFlowRequest, GetOutputRectInFlowResponse, GetSelectionHandler, GetSelectionRequest, IsConnectionUnderNodeHandler, LineElement, LineService, MOUSE_EVENT_IGNORE_TIME, NODE_PROVIDERS, NearestCoordinateFinder, NodeDragHandler, NodeOnPointerUp, NodePrepareDragSequence, ReassignConnectionDragHandler, ReassignConnectionOnPointerUp, ReassignConnectionPrepareDragSequence, RedrawConnectionsHandler, RedrawConnectionsRequest, SELECTION_AREA_PROVIDERS, SINGLE_SELECT_PROVIDERS, SelectAllHandler, SelectAllRequest, SelectHandler, SelectRequest, SelectionAreaDragHandle, SelectionAreaOnPointerUp, SelectionAreaPrepareDragSequence, SingleSelectOnPointerDown, UpdateConnectionLayerHandler, UpdateNodeLayerHandler, castToConnectableSide, castToConnectionBehavior, castToConnectionType, getExternalItem, getFlowUid, isExternalItem, isNode, isNodeDragHandle, isNodeInput, isNodeOutlet, isNodeOutput, mixinChangeConnectionSelection, mixinChangeConnectionVisibility };
4996
+ export { CANVAS_PROVIDERS, COMMON_PROVIDERS, CONNECTIONS_PROVIDERS, CONNECTION_GRADIENT, CONNECTION_PATH, CONNECTION_TEXT, CalculateCenterBetweenPointsHandler, CalculateCenterBetweenPointsRequest, CalculateConnectionCenterHandler, CalculateConnectionCenterRequest, CalculateConnectorConnectableSideHandler, CalculateConnectorConnectableSideRequest, CanvasDragHandler, CanvasOnPointerUp, CanvasPrepareDragSequence, ClearSelectionHandler, ClearSelectionRequest, ConnectionDragHandler, ConnectionSourceDragHandler, ConnectionTargetDragHandler, CreateConnectionDragHandler, CreateConnectionMarkersHandler, CreateConnectionMarkersRequest, CreateConnectionOnPointerUp, CreateConnectionPrepareDragSequence, EFConnectableSide, EFConnectionBehavior, EFConnectionType, EFDraggableType, EFMarkerType, EXTERNAL_ITEM_PROVIDERS, ExternalItemDragHandler, ExternalItemOnPointerUp, ExternalItemPrepareDragSequence, FBackgroundBase, FBackgroundComponent, FBezierPathBuilder, FCanvasBase, FCanvasChangeEvent, FCanvasComponent, FCirclePatternComponent, FComponentsStore, FConnectionBase, FConnectionCenterDirective, FConnectionComponent, FConnectionDragHandleComponent, FConnectionFactory, FConnectionForCreateComponent, FConnectionGradientComponent, FConnectionPathComponent, FConnectionSelectionComponent, FConnectionTextComponent, FConnectionTextPathDirective, FConnectorBase, FCreateConnectionEvent, FCreateNodeEvent, FDragHandleDirective, FDraggableBase, FDraggableDataContext, FDraggableDirective, FExternalItemBase, FExternalItemDirective, FExternalItemService, FFlowBase, FFlowComponent, FFlowMediator, FFlowModule, FGroupBase, FGroupDirective, FHandlerRegister, FLineAlignmentBase, FLineAlignmentComponent, FMarkerBase, FMarkerDirective, FNodeBase, FNodeDirective, FNodeInputBase, FNodeInputDirective, FNodeOutletBase, FNodeOutletDirective, FNodeOutputBase, FNodeOutputDirective, FReassignConnectionEvent, FRectPatternComponent, FResizeObserver, FSegmentPathBuilder, FSelectionAreaBase, FSelectionAreaComponent, FSelectionChangeEvent, FStraightPathBuilder, FZoomBase, FZoomDirective, F_BACKGROUND, F_BACKGROUND_PATTERN, F_CANVAS, F_CONNECTION_BUILDERS, F_CONNECTION_DRAG_HANDLE_CLASS, F_CONNECTION_IDENTIFIERS, F_DRAGGABLE, F_DRAG_HANDLE, F_EXTERNAL_ITEM, F_FLOW, F_GROUP, 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, GetCanBeSelectedItemsHandler, GetConnectionHandler, GetConnectionVectorHandler, GetConnectionVectorRequest, GetElementRectInFlowHandler, GetElementRectInFlowRequest, GetIncomingConnectionsHandler, GetInputRectInFlowHandler, GetInputRectInFlowRequest, GetInputRectInFlowResponse, GetNodesRectHandler, GetNodesRectRequest, GetOutgoingConnectionsHandler, GetOutputRectInFlowHandler, GetOutputRectInFlowRequest, GetOutputRectInFlowResponse, GetPositionInFlowHandler, GetPositionInFlowRequest, GetSelectionHandler, GetSelectionRequest, IsConnectionUnderNodeHandler, LineElement, LineService, MOUSE_EVENT_IGNORE_TIME, NODE_PROVIDERS, NearestCoordinateFinder, NodeDragHandler, NodeOnPointerUp, NodePrepareDragSequence, ReassignConnectionDragHandler, ReassignConnectionOnPointerUp, ReassignConnectionPrepareDragSequence, RedrawConnectionsHandler, RedrawConnectionsRequest, SELECTION_AREA_PROVIDERS, SINGLE_SELECT_PROVIDERS, SelectAllHandler, SelectAllRequest, SelectHandler, SelectRequest, SelectionAreaDragHandle, SelectionAreaOnPointerUp, SelectionAreaPrepareDragSequence, SingleSelectOnPointerDown, UpdateItemLayerHandler, UpdateItemLayerRequest, castToConnectableSide, castToConnectionBehavior, castToConnectionType, getExternalItem, getMarkerEndId, getMarkerSelectedEndId, getMarkerSelectedStartId, getMarkerStartId, isExternalItem, isGroup, isNode, isNodeDragHandle, isNodeInput, isNodeOutlet, isNodeOutput, mixinChangeConnectionSelection, mixinChangeConnectionVisibility };
4631
4997
  //# sourceMappingURL=foblex-flow.mjs.map