@foblex/flow 1.3.1 → 1.3.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.
@@ -2219,13 +2219,14 @@ class ReassignConnectionPrepareDragSequence {
2219
2219
  get flowHost() {
2220
2220
  return this.fComponentsStore.fFlow.hostElement;
2221
2221
  }
2222
- constructor(fComponentsStore, fDraggableDataContext, getConnectionHandler, getInputRectInFlowHandler, getOutputRectInFlowHandler, getConnectionVectorHandler) {
2222
+ constructor(fComponentsStore, fDraggableDataContext, getConnectionHandler, getInputRectInFlowHandler, getOutputRectInFlowHandler, getConnectionVectorHandler, updateConnectionLayerHandler) {
2223
2223
  this.fComponentsStore = fComponentsStore;
2224
2224
  this.fDraggableDataContext = fDraggableDataContext;
2225
2225
  this.getConnectionHandler = getConnectionHandler;
2226
2226
  this.getInputRectInFlowHandler = getInputRectInFlowHandler;
2227
2227
  this.getOutputRectInFlowHandler = getOutputRectInFlowHandler;
2228
2228
  this.getConnectionVectorHandler = getConnectionVectorHandler;
2229
+ this.updateConnectionLayerHandler = updateConnectionLayerHandler;
2229
2230
  }
2230
2231
  handle(event) {
2231
2232
  const pointerPositionInFlow = Point.fromPoint(event.getPosition()).elementTransform(this.flowHost);
@@ -2242,6 +2243,7 @@ class ReassignConnectionPrepareDragSequence {
2242
2243
  }
2243
2244
  }
2244
2245
  if (connectionToReassign && !this.fDraggableDataContext.draggableItems.length) {
2246
+ this.updateConnectionLayerHandler.handle(connectionToReassign);
2245
2247
  this.fDraggableDataContext.onPointerDownScale = this.transform.scale;
2246
2248
  this.fDraggableDataContext.onPointerDownPosition = pointerPositionInFlow.div(this.transform.scale);
2247
2249
  this.fDraggableDataContext.draggableItems = [
@@ -2249,12 +2251,12 @@ class ReassignConnectionPrepareDragSequence {
2249
2251
  ];
2250
2252
  }
2251
2253
  }
2252
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.9", ngImport: i0, type: ReassignConnectionPrepareDragSequence, deps: [{ token: FComponentsStore }, { token: FDraggableDataContext }, { token: GetConnectionHandler }, { token: GetInputRectInFlowHandler }, { token: GetOutputRectInFlowHandler }, { token: GetConnectionVectorHandler }], target: i0.ɵɵFactoryTarget.Injectable }); }
2254
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.9", ngImport: i0, type: ReassignConnectionPrepareDragSequence, deps: [{ token: FComponentsStore }, { token: FDraggableDataContext }, { token: GetConnectionHandler }, { token: GetInputRectInFlowHandler }, { token: GetOutputRectInFlowHandler }, { token: GetConnectionVectorHandler }, { token: UpdateConnectionLayerHandler }], target: i0.ɵɵFactoryTarget.Injectable }); }
2253
2255
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.9", ngImport: i0, type: ReassignConnectionPrepareDragSequence }); }
2254
2256
  }
2255
2257
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.9", ngImport: i0, type: ReassignConnectionPrepareDragSequence, decorators: [{
2256
2258
  type: Injectable
2257
- }], ctorParameters: () => [{ type: FComponentsStore }, { type: FDraggableDataContext }, { type: GetConnectionHandler }, { type: GetInputRectInFlowHandler }, { type: GetOutputRectInFlowHandler }, { type: GetConnectionVectorHandler }] });
2259
+ }], ctorParameters: () => [{ type: FComponentsStore }, { type: FDraggableDataContext }, { type: GetConnectionHandler }, { type: GetInputRectInFlowHandler }, { type: GetOutputRectInFlowHandler }, { type: GetConnectionVectorHandler }, { type: UpdateConnectionLayerHandler }] });
2258
2260
 
2259
2261
  const CONNECTIONS_PROVIDERS = [
2260
2262
  FindFirstCanBeConnectedOutputByOutletHandler,
@@ -2680,10 +2682,11 @@ const NODE_PROVIDERS = [
2680
2682
  ];
2681
2683
 
2682
2684
  class SingleSelectOnPointerDown {
2683
- constructor(fComponentsStore, fDraggableDataContext, getConnectionHandler) {
2685
+ constructor(fComponentsStore, fDraggableDataContext, getConnectionHandler, updateConnectionLayerHandler) {
2684
2686
  this.fComponentsStore = fComponentsStore;
2685
2687
  this.fDraggableDataContext = fDraggableDataContext;
2686
2688
  this.getConnectionHandler = getConnectionHandler;
2689
+ this.updateConnectionLayerHandler = updateConnectionLayerHandler;
2687
2690
  }
2688
2691
  handle(event) {
2689
2692
  if (!this.fComponentsStore.fFlow?.hostElement.contains(event.targetElement)) {
@@ -2709,6 +2712,7 @@ class SingleSelectOnPointerDown {
2709
2712
  }
2710
2713
  }
2711
2714
  else if (connection) {
2715
+ this.updateConnectionLayerHandler.handle(connection);
2712
2716
  if (!this.fDraggableDataContext.selectedItems.includes(connection)) {
2713
2717
  this.fDraggableDataContext.selectedItems.push(connection);
2714
2718
  if (element?.hostElement.id !== connection.hostElement.id) {
@@ -2742,12 +2746,12 @@ class SingleSelectOnPointerDown {
2742
2746
  }
2743
2747
  });
2744
2748
  }
2745
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.9", ngImport: i0, type: SingleSelectOnPointerDown, deps: [{ token: FComponentsStore }, { token: FDraggableDataContext }, { token: GetConnectionHandler }], target: i0.ɵɵFactoryTarget.Injectable }); }
2749
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.9", ngImport: i0, type: SingleSelectOnPointerDown, deps: [{ token: FComponentsStore }, { token: FDraggableDataContext }, { token: GetConnectionHandler }, { token: UpdateConnectionLayerHandler }], target: i0.ɵɵFactoryTarget.Injectable }); }
2746
2750
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.9", ngImport: i0, type: SingleSelectOnPointerDown }); }
2747
2751
  }
2748
2752
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.9", ngImport: i0, type: SingleSelectOnPointerDown, decorators: [{
2749
2753
  type: Injectable
2750
- }], ctorParameters: () => [{ type: FComponentsStore }, { type: FDraggableDataContext }, { type: GetConnectionHandler }] });
2754
+ }], ctorParameters: () => [{ type: FComponentsStore }, { type: FDraggableDataContext }, { type: GetConnectionHandler }, { type: UpdateConnectionLayerHandler }] });
2751
2755
 
2752
2756
  const SINGLE_SELECT_PROVIDERS = [
2753
2757
  SingleSelectOnPointerDown
@@ -3084,6 +3088,7 @@ class FDraggableDirective extends FDraggableBase {
3084
3088
  this.fCreateNode = new EventEmitter();
3085
3089
  this.fReassignConnection = new EventEmitter();
3086
3090
  this.fCreateConnection = new EventEmitter();
3091
+ this.selectedItemsOnPointerDown = 0;
3087
3092
  this.document = document;
3088
3093
  }
3089
3094
  ngOnInit() {
@@ -3095,6 +3100,7 @@ class FDraggableDirective extends FDraggableBase {
3095
3100
  onPointerDown(event) {
3096
3101
  this.fDraggableDataContext.reset();
3097
3102
  let result = event.isMouseLeftButton();
3103
+ this.selectedItemsOnPointerDown = this.fDraggableDataContext.selectedItems.length;
3098
3104
  this.injector.get(SingleSelectOnPointerDown).handle(event);
3099
3105
  this.injector.get(ReassignConnectionPrepareDragSequence).handle(event);
3100
3106
  this.injector.get(CreateConnectionPrepareDragSequence).handle(event);
@@ -3132,7 +3138,8 @@ class FDraggableDirective extends FDraggableBase {
3132
3138
  this.fDraggableDataContext.reset();
3133
3139
  }
3134
3140
  emitSelectionChangeEvent() {
3135
- if (!this.fDraggableDataContext.isSelectedChanged) {
3141
+ if (!this.fDraggableDataContext.isSelectedChanged
3142
+ && this.selectedItemsOnPointerDown === this.fDraggableDataContext.selectedItems.length) {
3136
3143
  return;
3137
3144
  }
3138
3145
  let selectedNodes = [];
@@ -3208,6 +3215,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.9", ngImpor
3208
3215
  type: Injectable
3209
3216
  }], ctorParameters: () => [{ type: FComponentsStore }, { type: FDraggableDataContext }] });
3210
3217
 
3218
+ class UpdateConnectionLayerHandler {
3219
+ get fConnectionsContainer() {
3220
+ return this.fComponentsStore.fCanvas?.fConnectionsContainer?.nativeElement;
3221
+ }
3222
+ constructor(fComponentsStore) {
3223
+ this.fComponentsStore = fComponentsStore;
3224
+ }
3225
+ handle(connection) {
3226
+ const elements = Array.from(this.fConnectionsContainer.children);
3227
+ const elementsCount = elements.length;
3228
+ const targetIndex = elements.findIndex((x) => x === connection.hostElement);
3229
+ if (targetIndex !== elementsCount - 1) {
3230
+ const afterElements = elements.splice(targetIndex + 1);
3231
+ afterElements.forEach((x) => {
3232
+ this.fConnectionsContainer.removeChild(x);
3233
+ this.fConnectionsContainer.insertBefore(x, connection.hostElement);
3234
+ });
3235
+ }
3236
+ }
3237
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.9", ngImport: i0, type: UpdateConnectionLayerHandler, deps: [{ token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Injectable }); }
3238
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.9", ngImport: i0, type: UpdateConnectionLayerHandler }); }
3239
+ }
3240
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.9", ngImport: i0, type: UpdateConnectionLayerHandler, decorators: [{
3241
+ type: Injectable
3242
+ }], ctorParameters: () => [{ type: FComponentsStore }] });
3243
+
3211
3244
  const COMMON_PROVIDERS = [
3212
3245
  GetAllNodesRectHandler,
3213
3246
  GetConnectionVectorHandler,
@@ -3218,6 +3251,7 @@ const COMMON_PROVIDERS = [
3218
3251
  GetIncomingConnectionsHandler,
3219
3252
  GetOutgoingConnectionsHandler,
3220
3253
  SelectAllHandler,
3254
+ UpdateConnectionLayerHandler,
3221
3255
  UpdateNodeLayerHandler,
3222
3256
  ];
3223
3257
 
@@ -4014,13 +4048,13 @@ class FCanvasComponent extends FCanvasBase {
4014
4048
  this.selectAllHandler.handle();
4015
4049
  }
4016
4050
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.9", ngImport: i0, type: FCanvasComponent, deps: [{ token: GetAllNodesRectHandler }, { token: SelectAllHandler }, { token: i0.ElementRef }, { token: FComponentsStore }], target: i0.ɵɵFactoryTarget.Component }); }
4017
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.9", 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 }], exportAs: ["fComponent"], usesInheritance: true, ngImport: i0, template: "<ng-container>\n <div>\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=\"f-node\"></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 }); }
4051
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.9", 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=\"f-node\"></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 }); }
4018
4052
  }
4019
4053
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.9", ngImport: i0, type: FCanvasComponent, decorators: [{
4020
4054
  type: Component,
4021
4055
  args: [{ selector: 'f-canvas', exportAs: 'fComponent', host: {
4022
4056
  'class': 'f-component f-canvas',
4023
- }, providers: [{ provide: F_CANVAS, useExisting: FCanvasComponent }], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container>\n <div>\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=\"f-node\"></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"] }]
4057
+ }, 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=\"f-node\"></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"] }]
4024
4058
  }], ctorParameters: () => [{ type: GetAllNodesRectHandler }, { type: SelectAllHandler }, { type: i0.ElementRef }, { type: FComponentsStore }], propDecorators: { fCanvasChange: [{
4025
4059
  type: Output
4026
4060
  }], position: [{
@@ -4030,6 +4064,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.9", ngImpor
4030
4064
  }], fNodesContainer: [{
4031
4065
  type: ViewChild,
4032
4066
  args: ['fNodesContainer', { static: true }]
4067
+ }], fConnectionsContainer: [{
4068
+ type: ViewChild,
4069
+ args: ['fConnectionsContainer', { static: true }]
4033
4070
  }] } });
4034
4071
 
4035
4072
  const F_FLOW = new InjectionToken('F_FLOW');