ngx-vflow 0.14.0 → 0.15.0

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 (35) hide show
  1. package/esm2022/lib/vflow/components/custom-node-base/custom-node-base.component.mjs +5 -7
  2. package/esm2022/lib/vflow/components/defs/defs.component.mjs +1 -1
  3. package/esm2022/lib/vflow/components/handle/handle.component.mjs +16 -14
  4. package/esm2022/lib/vflow/components/node/node.component.mjs +8 -3
  5. package/esm2022/lib/vflow/components/vflow/vflow.component.mjs +8 -5
  6. package/esm2022/lib/vflow/directives/drag-handle.directive.mjs +27 -0
  7. package/esm2022/lib/vflow/directives/map-context.directive.mjs +24 -17
  8. package/esm2022/lib/vflow/math/edge-path/bezier-path.mjs +14 -17
  9. package/esm2022/lib/vflow/math/edge-path/straigh-path.mjs +2 -6
  10. package/esm2022/lib/vflow/models/handle.model.mjs +3 -2
  11. package/esm2022/lib/vflow/models/node.model.mjs +2 -1
  12. package/esm2022/lib/vflow/models/toolbar.model.mjs +36 -0
  13. package/esm2022/lib/vflow/public-components/minimap/minimap.component.mjs +1 -1
  14. package/esm2022/lib/vflow/public-components/node-toolbar/node-toolbar.component.mjs +66 -0
  15. package/esm2022/lib/vflow/services/draggable.service.mjs +13 -15
  16. package/esm2022/lib/vflow/services/overlays.service.mjs +34 -0
  17. package/esm2022/lib/vflow/testing-utils/provide-custom-node-mocks.mjs +67 -0
  18. package/esm2022/lib/vflow/vflow.module.mjs +21 -9
  19. package/esm2022/public-api.mjs +5 -1
  20. package/fesm2022/ngx-vflow.mjs +308 -87
  21. package/fesm2022/ngx-vflow.mjs.map +1 -1
  22. package/lib/vflow/components/handle/handle.component.d.ts +3 -3
  23. package/lib/vflow/components/node/node.component.d.ts +2 -0
  24. package/lib/vflow/directives/drag-handle.directive.d.ts +8 -0
  25. package/lib/vflow/directives/map-context.directive.d.ts +3 -2
  26. package/lib/vflow/models/handle.model.d.ts +1 -0
  27. package/lib/vflow/models/node.model.d.ts +1 -0
  28. package/lib/vflow/models/toolbar.model.d.ts +19 -0
  29. package/lib/vflow/public-components/node-toolbar/node-toolbar.component.d.ts +22 -0
  30. package/lib/vflow/services/draggable.service.d.ts +0 -5
  31. package/lib/vflow/services/overlays.service.d.ts +11 -0
  32. package/lib/vflow/testing-utils/provide-custom-node-mocks.d.ts +2 -0
  33. package/lib/vflow/vflow.module.d.ts +14 -12
  34. package/package.json +1 -3
  35. package/public-api.d.ts +3 -0
@@ -1,12 +1,13 @@
1
- import { Injector, OnDestroy, OnInit, TemplateRef } from '@angular/core';
1
+ import { Injector, OnInit, TemplateRef } from '@angular/core';
2
2
  import { Position } from '../../types/position.type';
3
3
  import { HandleModel } from '../../models/handle.model';
4
4
  import { WithInjector } from '../../decorators/run-in-injection-context.decorator';
5
5
  import * as i0 from "@angular/core";
6
- export declare class HandleComponent implements OnInit, OnDestroy, WithInjector {
6
+ export declare class HandleComponent implements OnInit, WithInjector {
7
7
  injector: Injector;
8
8
  private handleService;
9
9
  private element;
10
+ private destroyRef;
10
11
  /**
11
12
  * At what side of node this component should be placed
12
13
  */
@@ -22,7 +23,6 @@ export declare class HandleComponent implements OnInit, OnDestroy, WithInjector
22
23
  template?: TemplateRef<any>;
23
24
  model: HandleModel;
24
25
  ngOnInit(): void;
25
- ngOnDestroy(): void;
26
26
  static ɵfac: i0.ɵɵFactoryDeclaration<HandleComponent, never>;
27
27
  static ɵcmp: i0.ɵɵComponentDeclaration<HandleComponent, "handle", never, { "position": { "alias": "position"; "required": true; }; "type": { "alias": "type"; "required": true; }; "id": { "alias": "id"; "required": false; }; "template": { "alias": "template"; "required": false; }; }, {}, never, never, false, never>;
28
28
  }
@@ -15,6 +15,7 @@ export declare class NodeComponent implements OnInit, AfterViewInit, OnDestroy,
15
15
  private hostRef;
16
16
  private connectionController;
17
17
  private nodeAccessor;
18
+ private overlaysService;
18
19
  private zone;
19
20
  nodeModel: NodeModel;
20
21
  nodeTemplate?: TemplateRef<any>;
@@ -24,6 +25,7 @@ export declare class NodeComponent implements OnInit, AfterViewInit, OnDestroy,
24
25
  protected showMagnet: import("@angular/core").Signal<boolean>;
25
26
  protected styleWidth: import("@angular/core").Signal<string>;
26
27
  protected styleHeight: import("@angular/core").Signal<string>;
28
+ protected toolbar: import("@angular/core").Signal<import("../../models/toolbar.model").ToolbarModel | undefined>;
27
29
  ngOnInit(): void;
28
30
  ngAfterViewInit(): void;
29
31
  ngOnDestroy(): void;
@@ -0,0 +1,8 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class DragHandleDirective {
3
+ private nodeAccessor;
4
+ private get model();
5
+ constructor();
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<DragHandleDirective, never>;
7
+ static ɵdir: i0.ɵɵDirectiveDeclaration<DragHandleDirective, "[dragHandle]", never, {}, {}, never, never, false, never>;
8
+ }
@@ -17,8 +17,9 @@ export declare class MapContextDirective implements OnInit {
17
17
  protected zoomBehavior: ZoomBehavior<SVGSVGElement, unknown>;
18
18
  ngOnInit(): void;
19
19
  private handleZoom;
20
- private onD3zoomStart;
21
- private onD3zoomEnd;
20
+ private handleZoomStart;
21
+ private handleZoomEnd;
22
+ private filterCondition;
22
23
  static ɵfac: i0.ɵɵFactoryDeclaration<MapContextDirective, never>;
23
24
  static ɵdir: i0.ɵɵDirectiveDeclaration<MapContextDirective, "g[mapContext]", never, {}, {}, never, never, false, never>;
24
25
  }
@@ -50,6 +50,7 @@ export declare class HandleModel {
50
50
  y: number;
51
51
  }>;
52
52
  state: import("@angular/core").WritableSignal<HandleState>;
53
+ node: import("ngx-vflow").Node<unknown> | import("ngx-vflow").DynamicNode<unknown>;
53
54
  };
54
55
  };
55
56
  constructor(rawHandle: NodeHandle, parentNode: NodeModel);
@@ -38,6 +38,7 @@ export declare class NodeModel<T = unknown> implements FlowEntity {
38
38
  handles: import("@angular/core").WritableSignal<HandleModel[]>;
39
39
  handles$: import("rxjs").Observable<HandleModel[]>;
40
40
  draggable: import("@angular/core").WritableSignal<boolean>;
41
+ dragHandlesCount: import("@angular/core").WritableSignal<number>;
41
42
  readonly magnetRadius = 20;
42
43
  isComponentType: boolean;
43
44
  text: Signal<string>;
@@ -0,0 +1,19 @@
1
+ import { TemplateRef } from "@angular/core";
2
+ import { Position } from "../types/position.type";
3
+ import { NodeModel } from "./node.model";
4
+ export declare class ToolbarModel {
5
+ node: NodeModel;
6
+ position: import("@angular/core").WritableSignal<Position>;
7
+ template: import("@angular/core").WritableSignal<TemplateRef<unknown> | null>;
8
+ offset: import("@angular/core").WritableSignal<number>;
9
+ point: import("@angular/core").Signal<{
10
+ x: number;
11
+ y: number;
12
+ }>;
13
+ transform: import("@angular/core").Signal<string>;
14
+ size: import("@angular/core").WritableSignal<{
15
+ width: number;
16
+ height: number;
17
+ }>;
18
+ constructor(node: NodeModel);
19
+ }
@@ -0,0 +1,22 @@
1
+ import { OnDestroy, OnInit, TemplateRef } from '@angular/core';
2
+ import { Position } from '../../types/position.type';
3
+ import { ToolbarModel } from '../../models/toolbar.model';
4
+ import * as i0 from "@angular/core";
5
+ export declare class NodeToolbarComponent implements OnInit, OnDestroy {
6
+ private overlaysService;
7
+ private nodeService;
8
+ set position(value: Position);
9
+ toolbarContentTemplate: TemplateRef<unknown>;
10
+ protected model: ToolbarModel;
11
+ ngOnInit(): void;
12
+ ngOnDestroy(): void;
13
+ static ɵfac: i0.ɵɵFactoryDeclaration<NodeToolbarComponent, never>;
14
+ static ɵcmp: i0.ɵɵComponentDeclaration<NodeToolbarComponent, "node-toolbar", never, { "position": { "alias": "position"; "required": false; }; }, {}, never, ["*"], false, never>;
15
+ }
16
+ export declare class NodeToolbarWrapperDirective implements OnInit {
17
+ private element;
18
+ model: ToolbarModel;
19
+ ngOnInit(): void;
20
+ static ɵfac: i0.ɵɵFactoryDeclaration<NodeToolbarWrapperDirective, never>;
21
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NodeToolbarWrapperDirective, "[nodeToolbarWrapper]", never, { "model": { "alias": "model"; "required": false; }; }, {}, never, never, false, never>;
22
+ }
@@ -29,11 +29,6 @@ export declare class DraggableService {
29
29
  * @returns
30
30
  */
31
31
  private getDragBehavior;
32
- /**
33
- * Specify ignoring drag behavior. It's responsible for not moving the map when user tries to drag node
34
- * with disabled drag behavior
35
- */
36
- private getIgnoreDragBehavior;
37
32
  private getDragNodes;
38
33
  static ɵfac: i0.ɵɵFactoryDeclaration<DraggableService, never>;
39
34
  static ɵprov: i0.ɵɵInjectableDeclaration<DraggableService>;
@@ -0,0 +1,11 @@
1
+ import { ToolbarModel } from '../models/toolbar.model';
2
+ import { NodeModel } from '../models/node.model';
3
+ import * as i0 from "@angular/core";
4
+ export declare class OverlaysService {
5
+ private toolbars;
6
+ nodeToolbars: import("@angular/core").Signal<Map<NodeModel<unknown>, ToolbarModel>>;
7
+ addToolbar(toolbar: ToolbarModel): void;
8
+ removeToolbar(toolbar: ToolbarModel): void;
9
+ static ɵfac: i0.ɵɵFactoryDeclaration<OverlaysService, never>;
10
+ static ɵprov: i0.ɵɵInjectableDeclaration<OverlaysService>;
11
+ }
@@ -0,0 +1,2 @@
1
+ import { Provider } from "@angular/core";
2
+ export declare function provideCustomNodeMocks(): Provider[];
@@ -10,19 +10,21 @@ import * as i8 from "./components/defs/defs.component";
10
10
  import * as i9 from "./components/background/background.component";
11
11
  import * as i10 from "./public-components/resizable/resizable.component";
12
12
  import * as i11 from "./public-components/minimap/minimap.component";
13
- import * as i12 from "./directives/space-point-context.directive";
14
- import * as i13 from "./directives/map-context.directive";
15
- import * as i14 from "./directives/reference.directive";
16
- import * as i15 from "./directives/root-svg-context.directive";
17
- import * as i16 from "./directives/handle-size-controller.directive";
18
- import * as i17 from "./directives/selectable.directive";
19
- import * as i18 from "./directives/pointer.directive";
20
- import * as i19 from "./directives/root-pointer.directive";
21
- import * as i20 from "./directives/flow-size-controller.directive";
22
- import * as i21 from "./directives/template.directive";
23
- import * as i22 from "@angular/common";
13
+ import * as i12 from "./public-components/node-toolbar/node-toolbar.component";
14
+ import * as i13 from "./directives/space-point-context.directive";
15
+ import * as i14 from "./directives/map-context.directive";
16
+ import * as i15 from "./directives/reference.directive";
17
+ import * as i16 from "./directives/root-svg-context.directive";
18
+ import * as i17 from "./directives/handle-size-controller.directive";
19
+ import * as i18 from "./directives/selectable.directive";
20
+ import * as i19 from "./directives/drag-handle.directive";
21
+ import * as i20 from "./directives/pointer.directive";
22
+ import * as i21 from "./directives/root-pointer.directive";
23
+ import * as i22 from "./directives/flow-size-controller.directive";
24
+ import * as i23 from "./directives/template.directive";
25
+ import * as i24 from "@angular/common";
24
26
  export declare class VflowModule {
25
27
  static ɵfac: i0.ɵɵFactoryDeclaration<VflowModule, never>;
26
- static ɵmod: i0.ɵɵNgModuleDeclaration<VflowModule, [typeof i1.VflowComponent, typeof i2.NodeComponent, typeof i3.DefaultNodeComponent, typeof i4.EdgeComponent, typeof i5.EdgeLabelComponent, typeof i6.ConnectionComponent, typeof i7.HandleComponent, typeof i8.DefsComponent, typeof i9.BackgroundComponent, typeof i10.ResizableComponent, typeof i11.MiniMapComponent, typeof i12.SpacePointContextDirective, typeof i13.MapContextDirective, typeof i14.RootSvgReferenceDirective, typeof i15.RootSvgContextDirective, typeof i16.HandleSizeControllerDirective, typeof i17.SelectableDirective, typeof i18.PointerDirective, typeof i19.RootPointerDirective, typeof i20.FlowSizeControllerDirective, typeof i21.NodeHtmlTemplateDirective, typeof i21.GroupNodeTemplateDirective, typeof i21.EdgeLabelHtmlTemplateDirective, typeof i21.EdgeTemplateDirective, typeof i21.ConnectionTemplateDirective, typeof i21.HandleTemplateDirective], [typeof i22.CommonModule], [typeof i1.VflowComponent, typeof i7.HandleComponent, typeof i10.ResizableComponent, typeof i17.SelectableDirective, typeof i11.MiniMapComponent, typeof i21.NodeHtmlTemplateDirective, typeof i21.GroupNodeTemplateDirective, typeof i21.EdgeLabelHtmlTemplateDirective, typeof i21.EdgeTemplateDirective, typeof i21.ConnectionTemplateDirective, typeof i21.HandleTemplateDirective]>;
28
+ static ɵmod: i0.ɵɵNgModuleDeclaration<VflowModule, [typeof i1.VflowComponent, typeof i2.NodeComponent, typeof i3.DefaultNodeComponent, typeof i4.EdgeComponent, typeof i5.EdgeLabelComponent, typeof i6.ConnectionComponent, typeof i7.HandleComponent, typeof i8.DefsComponent, typeof i9.BackgroundComponent, typeof i10.ResizableComponent, typeof i11.MiniMapComponent, typeof i12.NodeToolbarComponent, typeof i13.SpacePointContextDirective, typeof i14.MapContextDirective, typeof i15.RootSvgReferenceDirective, typeof i16.RootSvgContextDirective, typeof i17.HandleSizeControllerDirective, typeof i18.SelectableDirective, typeof i19.DragHandleDirective, typeof i20.PointerDirective, typeof i21.RootPointerDirective, typeof i22.FlowSizeControllerDirective, typeof i12.NodeToolbarWrapperDirective, typeof i23.NodeHtmlTemplateDirective, typeof i23.GroupNodeTemplateDirective, typeof i23.EdgeLabelHtmlTemplateDirective, typeof i23.EdgeTemplateDirective, typeof i23.ConnectionTemplateDirective, typeof i23.HandleTemplateDirective], [typeof i24.NgIf, typeof i24.NgForOf, typeof i24.NgTemplateOutlet, typeof i24.NgComponentOutlet, typeof i24.KeyValuePipe], [typeof i1.VflowComponent, typeof i7.HandleComponent, typeof i10.ResizableComponent, typeof i18.SelectableDirective, typeof i11.MiniMapComponent, typeof i12.NodeToolbarComponent, typeof i19.DragHandleDirective, typeof i23.NodeHtmlTemplateDirective, typeof i23.GroupNodeTemplateDirective, typeof i23.EdgeLabelHtmlTemplateDirective, typeof i23.EdgeTemplateDirective, typeof i23.ConnectionTemplateDirective, typeof i23.HandleTemplateDirective]>;
27
29
  static ɵinj: i0.ɵɵInjectorDeclaration<VflowModule>;
28
30
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-vflow",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "license": "MIT",
5
5
  "homepage": "https://www.ngx-vflow.org/",
6
6
  "author": "Artem Mangilev",
@@ -19,11 +19,9 @@
19
19
  "@angular/common": "^16.2.0 || 17.x || 18.x",
20
20
  "@angular/core": "^16.2.0 || 17.x || 18.x",
21
21
  "d3-drag": "^3.0.0",
22
- "d3-path": "^3.1.0",
23
22
  "d3-selection": "^3.0.0",
24
23
  "d3-zoom": "^3.0.0",
25
24
  "@types/d3-drag": "^3.0.7",
26
- "@types/d3-path": "^3.0.2",
27
25
  "@types/d3-selection": "^3.0.10",
28
26
  "@types/d3-zoom": "^3.0.8"
29
27
  },
package/public-api.d.ts CHANGED
@@ -24,7 +24,10 @@ export * from './lib/vflow/public-components/custom-node/custom-node.component';
24
24
  export * from './lib/vflow/public-components/custom-dynamic-node/custom-dynamic-node.component';
25
25
  export * from './lib/vflow/public-components/resizable/resizable.component';
26
26
  export * from './lib/vflow/public-components/minimap/minimap.component';
27
+ export * from './lib/vflow/public-components/node-toolbar/node-toolbar.component';
27
28
  export * from './lib/vflow/directives/template.directive';
28
29
  export * from './lib/vflow/directives/connection-controller.directive';
29
30
  export * from './lib/vflow/directives/changes-controller.directive';
30
31
  export * from './lib/vflow/directives/selectable.directive';
32
+ export * from './lib/vflow/directives/drag-handle.directive';
33
+ export * from './lib/vflow/testing-utils/provide-custom-node-mocks';