ngx-vflow 0.3.0 → 0.4.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.
- package/esm2022/lib/vflow/components/edge/edge.component.mjs +18 -6
- package/esm2022/lib/vflow/components/handle/handle.component.mjs +7 -7
- package/esm2022/lib/vflow/components/node/node.component.mjs +22 -8
- package/esm2022/lib/vflow/components/vflow/vflow.component.mjs +33 -20
- package/esm2022/lib/vflow/decorators/run-in-injection-context.decorator.mjs +6 -14
- package/esm2022/lib/vflow/directives/map-context.directive.mjs +31 -4
- package/esm2022/lib/vflow/directives/root-svg-context.directive.mjs +1 -1
- package/esm2022/lib/vflow/directives/selectable.directive.mjs +39 -0
- package/esm2022/lib/vflow/interfaces/flow-entity.interface.mjs +2 -0
- package/esm2022/lib/vflow/interfaces/template-context.interface.mjs +1 -1
- package/esm2022/lib/vflow/models/edge.model.mjs +3 -1
- package/esm2022/lib/vflow/models/node.model.mjs +9 -12
- package/esm2022/lib/vflow/services/edge-changes.service.mjs +6 -2
- package/esm2022/lib/vflow/services/flow-entities.service.mjs +5 -1
- package/esm2022/lib/vflow/services/flow-settings.service.mjs +25 -0
- package/esm2022/lib/vflow/services/node-changes.service.mjs +7 -3
- package/esm2022/lib/vflow/services/node-rendering.service.mjs +22 -0
- package/esm2022/lib/vflow/services/selection.service.mjs +45 -0
- package/esm2022/lib/vflow/types/edge-change.type.mjs +1 -1
- package/esm2022/lib/vflow/types/node-change.type.mjs +1 -1
- package/esm2022/lib/vflow/vflow.module.mjs +9 -4
- package/esm2022/public-api.mjs +2 -1
- package/fesm2022/ngx-vflow.mjs +307 -144
- package/fesm2022/ngx-vflow.mjs.map +1 -1
- package/lib/vflow/components/edge/edge.component.d.ts +5 -2
- package/lib/vflow/components/handle/handle.component.d.ts +4 -3
- package/lib/vflow/components/node/node.component.d.ts +9 -3
- package/lib/vflow/components/vflow/vflow.component.d.ts +11 -5
- package/lib/vflow/decorators/run-in-injection-context.decorator.d.ts +2 -5
- package/lib/vflow/directives/map-context.directive.d.ts +5 -0
- package/lib/vflow/directives/selectable.directive.d.ts +11 -0
- package/lib/vflow/interfaces/flow-entity.interface.d.ts +4 -0
- package/lib/vflow/interfaces/template-context.interface.d.ts +1 -0
- package/lib/vflow/models/edge.model.d.ts +7 -3
- package/lib/vflow/models/node.model.d.ts +6 -9
- package/lib/vflow/services/edge-changes.service.d.ts +5 -0
- package/lib/vflow/services/flow-entities.service.d.ts +5 -2
- package/lib/vflow/services/flow-settings.service.d.ts +20 -0
- package/lib/vflow/services/node-changes.service.d.ts +5 -0
- package/lib/vflow/services/node-rendering.service.d.ts +9 -0
- package/lib/vflow/services/selection.service.d.ts +19 -0
- package/lib/vflow/types/edge-change.type.d.ts +5 -1
- package/lib/vflow/types/node-change.type.d.ts +5 -1
- package/lib/vflow/vflow.module.d.ts +4 -3
- package/package.json +3 -3
- package/public-api.d.ts +1 -0
- package/esm2022/lib/vflow/models/flow.model.mjs +0 -18
- package/lib/vflow/models/flow.model.d.ts +0 -16
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import { OnInit, Signal, TemplateRef } from '@angular/core';
|
|
1
|
+
import { Injector, OnInit, Signal, TemplateRef } from '@angular/core';
|
|
2
2
|
import { EdgeModel } from '../../models/edge.model';
|
|
3
3
|
import { EdgeContext } from '../../interfaces/template-context.interface';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
export declare class EdgeComponent implements OnInit {
|
|
6
|
+
protected injector: Injector;
|
|
7
|
+
private selectionService;
|
|
8
|
+
private flowSettingsService;
|
|
6
9
|
model: EdgeModel;
|
|
7
10
|
edgeTemplate?: TemplateRef<EdgeContext>;
|
|
8
11
|
edgeLabelHtmlTemplate?: TemplateRef<any>;
|
|
9
12
|
protected markerStartUrl: Signal<string>;
|
|
10
13
|
protected markerEndUrl: Signal<string>;
|
|
11
|
-
protected readonly defaultColor = "rgb(177, 177, 183)";
|
|
12
14
|
protected edgeContext: EdgeContext;
|
|
13
15
|
ngOnInit(): void;
|
|
16
|
+
onEdgeMouseDown(): void;
|
|
14
17
|
static ɵfac: i0.ɵɵFactoryDeclaration<EdgeComponent, never>;
|
|
15
18
|
static ɵcmp: i0.ɵɵComponentDeclaration<EdgeComponent, "g[edge]", never, { "model": { "alias": "model"; "required": false; }; "edgeTemplate": { "alias": "edgeTemplate"; "required": false; }; "edgeLabelHtmlTemplate": { "alias": "edgeLabelHtmlTemplate"; "required": false; }; }, {}, never, never, false, never>;
|
|
16
19
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { OnDestroy, OnInit, TemplateRef } from '@angular/core';
|
|
1
|
+
import { Injector, OnDestroy, OnInit, TemplateRef } from '@angular/core';
|
|
2
2
|
import { Position } from '../../types/position.type';
|
|
3
3
|
import { HandleModel } from '../../models/handle.model';
|
|
4
|
-
import {
|
|
4
|
+
import { WithInjector } from '../../decorators/run-in-injection-context.decorator';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
|
-
export declare class HandleComponent
|
|
6
|
+
export declare class HandleComponent implements OnInit, OnDestroy, WithInjector {
|
|
7
|
+
injector: Injector;
|
|
7
8
|
private handleService;
|
|
8
9
|
private element;
|
|
9
10
|
/**
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { AfterViewInit, ElementRef, NgZone, OnDestroy, OnInit, TemplateRef } from '@angular/core';
|
|
1
|
+
import { AfterViewInit, ElementRef, Injector, NgZone, OnDestroy, OnInit, TemplateRef } from '@angular/core';
|
|
2
2
|
import { NodeModel } from '../../models/node.model';
|
|
3
3
|
import { HandleService } from '../../services/handle.service';
|
|
4
4
|
import { HandleModel } from '../../models/handle.model';
|
|
5
|
-
import {
|
|
5
|
+
import { WithInjector } from '../../decorators/run-in-injection-context.decorator';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
7
7
|
export type HandleState = 'valid' | 'invalid' | 'idle';
|
|
8
|
-
export declare class NodeComponent
|
|
8
|
+
export declare class NodeComponent implements OnInit, AfterViewInit, OnDestroy, WithInjector {
|
|
9
|
+
injector: Injector;
|
|
9
10
|
protected handleService: HandleService;
|
|
10
11
|
protected zone: NgZone;
|
|
11
12
|
nodeModel: NodeModel;
|
|
@@ -15,6 +16,9 @@ export declare class NodeComponent extends WithInjectorDirective implements OnIn
|
|
|
15
16
|
private draggableService;
|
|
16
17
|
private flowStatusService;
|
|
17
18
|
private flowEntitiesService;
|
|
19
|
+
private nodeRenderingService;
|
|
20
|
+
private flowSettingsService;
|
|
21
|
+
private selectionService;
|
|
18
22
|
private hostRef;
|
|
19
23
|
protected showMagnet: import("@angular/core").Signal<boolean>;
|
|
20
24
|
private subscription;
|
|
@@ -31,6 +35,8 @@ export declare class NodeComponent extends WithInjectorDirective implements OnIn
|
|
|
31
35
|
* TODO srp
|
|
32
36
|
*/
|
|
33
37
|
protected resetValidateTargetHandle(targetHandle: HandleModel): void;
|
|
38
|
+
protected pullNode(): void;
|
|
39
|
+
protected selectNode(): void;
|
|
34
40
|
private setInitialHandles;
|
|
35
41
|
static ɵfac: i0.ɵɵFactoryDeclaration<NodeComponent, never>;
|
|
36
42
|
static ɵcmp: i0.ɵɵComponentDeclaration<NodeComponent, "g[node]", never, { "nodeModel": { "alias": "nodeModel"; "required": false; }; "nodeHtmlTemplate": { "alias": "nodeHtmlTemplate"; "required": false; }; }, {}, never, never, false, never>;
|
|
@@ -6,7 +6,6 @@ import { Edge } from '../../interfaces/edge.interface';
|
|
|
6
6
|
import { EdgeModel } from '../../models/edge.model';
|
|
7
7
|
import { ConnectionTemplateDirective, EdgeLabelHtmlTemplateDirective, EdgeTemplateDirective, NodeHtmlTemplateDirective } from '../../directives/template.directive';
|
|
8
8
|
import { HandlePositions } from '../../interfaces/handle-positions.interface';
|
|
9
|
-
import { FlowModel } from '../../models/flow.model';
|
|
10
9
|
import { Point } from '../../interfaces/point.interface';
|
|
11
10
|
import { ViewportState } from '../../interfaces/viewport.interface';
|
|
12
11
|
import { ConnectionModel } from '../../models/connection.model';
|
|
@@ -21,6 +20,8 @@ export declare class VflowComponent {
|
|
|
21
20
|
private flowEntitiesService;
|
|
22
21
|
private nodesChangeService;
|
|
23
22
|
private edgesChangeService;
|
|
23
|
+
private nodeRenderingService;
|
|
24
|
+
private flowSettingsService;
|
|
24
25
|
private injector;
|
|
25
26
|
/**
|
|
26
27
|
* Size for flow view
|
|
@@ -54,6 +55,10 @@ export declare class VflowComponent {
|
|
|
54
55
|
* Background color for flow
|
|
55
56
|
*/
|
|
56
57
|
background: string;
|
|
58
|
+
/**
|
|
59
|
+
* Global rule if you can or can't select entities
|
|
60
|
+
*/
|
|
61
|
+
set entitiesSelectable(value: boolean);
|
|
57
62
|
/**
|
|
58
63
|
* Settings for connection (it renders when user tries to create edge between nodes)
|
|
59
64
|
*
|
|
@@ -65,12 +70,12 @@ export declare class VflowComponent {
|
|
|
65
70
|
* Nodes to render
|
|
66
71
|
*/
|
|
67
72
|
set nodes(newNodes: Node[]);
|
|
68
|
-
protected
|
|
73
|
+
protected nodeModels: Signal<NodeModel<unknown>[]>;
|
|
69
74
|
/**
|
|
70
75
|
* Edges to render
|
|
71
76
|
*/
|
|
72
77
|
set edges(newEdges: Edge[]);
|
|
73
|
-
protected
|
|
78
|
+
protected edgeModels: Signal<EdgeModel[]>;
|
|
74
79
|
protected nodeHtmlDirective?: NodeHtmlTemplateDirective;
|
|
75
80
|
protected edgeTemplateDirective?: EdgeTemplateDirective;
|
|
76
81
|
protected edgeLabelHtmlDirective?: EdgeLabelHtmlTemplateDirective;
|
|
@@ -100,7 +105,8 @@ export declare class VflowComponent {
|
|
|
100
105
|
* Observable with nodes change
|
|
101
106
|
*/
|
|
102
107
|
readonly edgesChange$: import("rxjs").Observable<EdgeChange[]>;
|
|
103
|
-
protected
|
|
108
|
+
protected flowWidth: Signal<string | number>;
|
|
109
|
+
protected flowHeight: Signal<string | number>;
|
|
104
110
|
protected markers: Signal<Map<number, import("ngx-vflow").Marker>>;
|
|
105
111
|
/**
|
|
106
112
|
* Change viewport to specified state
|
|
@@ -133,6 +139,6 @@ export declare class VflowComponent {
|
|
|
133
139
|
protected trackNodes(idx: number, { node }: NodeModel): Node<unknown>;
|
|
134
140
|
protected trackEdges(idx: number, { edge }: EdgeModel): Edge<unknown>;
|
|
135
141
|
static ɵfac: i0.ɵɵFactoryDeclaration<VflowComponent, never>;
|
|
136
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<VflowComponent, "vflow", never, { "view": { "alias": "view"; "required": false; }; "minZoom": { "alias": "minZoom"; "required": false; }; "maxZoom": { "alias": "maxZoom"; "required": false; }; "handlePositions": { "alias": "handlePositions"; "required": false; }; "background": { "alias": "background"; "required": false; }; "connection": { "alias": "connection"; "required": false; }; "nodes": { "alias": "nodes"; "required": true; }; "edges": { "alias": "edges"; "required": false; }; }, {}, ["nodeHtmlDirective", "edgeTemplateDirective", "edgeLabelHtmlDirective", "connectionTemplateDirective"], never, false, [{ directive: typeof i1.ConnectionControllerDirective; inputs: {}; outputs: { "onConnect": "onConnect"; }; }, { directive: typeof i2.ChangesControllerDirective; inputs: {}; outputs: { "onNodesChange": "onNodesChange"; "onEdgesChange": "onEdgesChange"; }; }]>;
|
|
142
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<VflowComponent, "vflow", never, { "view": { "alias": "view"; "required": false; }; "minZoom": { "alias": "minZoom"; "required": false; }; "maxZoom": { "alias": "maxZoom"; "required": false; }; "handlePositions": { "alias": "handlePositions"; "required": false; }; "background": { "alias": "background"; "required": false; }; "entitiesSelectable": { "alias": "entitiesSelectable"; "required": false; }; "connection": { "alias": "connection"; "required": false; }; "nodes": { "alias": "nodes"; "required": true; }; "edges": { "alias": "edges"; "required": false; }; }, {}, ["nodeHtmlDirective", "edgeTemplateDirective", "edgeLabelHtmlDirective", "connectionTemplateDirective"], never, false, [{ directive: typeof i1.ConnectionControllerDirective; inputs: {}; outputs: { "onConnect": "onConnect"; }; }, { directive: typeof i2.ChangesControllerDirective; inputs: {}; outputs: { "onNodesChange": "onNodesChange"; "onEdgesChange": "onEdgesChange"; }; }]>;
|
|
137
143
|
static ngAcceptInputType_connection: i3.ConnectionSettings;
|
|
138
144
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { Injector } from "@angular/core";
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
2
|
export declare function InjectionContext(target: any, key: string, descriptor: PropertyDescriptor): PropertyDescriptor;
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<WithInjectorDirective, never>;
|
|
7
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<WithInjectorDirective, never, never, {}, {}, never, never, false, never>;
|
|
3
|
+
export interface WithInjector {
|
|
4
|
+
injector: Injector;
|
|
8
5
|
}
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
import { OnInit } from '@angular/core';
|
|
2
2
|
import { ZoomBehavior } from 'd3-zoom';
|
|
3
3
|
import { ViewportService } from '../services/viewport.service';
|
|
4
|
+
import { SelectionService, ViewportForSelection } from '../services/selection.service';
|
|
4
5
|
import * as i0 from "@angular/core";
|
|
5
6
|
export declare class MapContextDirective implements OnInit {
|
|
6
7
|
minZoom: number;
|
|
7
8
|
maxZoom: number;
|
|
8
9
|
protected rootSvg: SVGSVGElement;
|
|
9
10
|
protected host: SVGGElement;
|
|
11
|
+
protected selectionService: SelectionService;
|
|
10
12
|
protected viewportService: ViewportService;
|
|
11
13
|
protected rootSvgSelection: import("d3-selection").Selection<SVGSVGElement, unknown, null, undefined>;
|
|
12
14
|
protected zoomableSelection: import("d3-selection").Selection<SVGGElement, unknown, null, undefined>;
|
|
15
|
+
protected viewportForSelection: Partial<ViewportForSelection>;
|
|
13
16
|
protected manualViewportChangeEffect: import("@angular/core").EffectRef;
|
|
14
17
|
protected zoomBehavior: ZoomBehavior<SVGSVGElement, unknown>;
|
|
15
18
|
ngOnInit(): void;
|
|
16
19
|
private handleZoom;
|
|
20
|
+
private onD3zoomStart;
|
|
21
|
+
private onD3zoomEnd;
|
|
17
22
|
static ɵfac: i0.ɵɵFactoryDeclaration<MapContextDirective, never>;
|
|
18
23
|
static ɵdir: i0.ɵɵDirectiveDeclaration<MapContextDirective, "g[mapContext]", never, { "minZoom": { "alias": "minZoom"; "required": false; }; "maxZoom": { "alias": "maxZoom"; "required": false; }; }, {}, never, never, false, never>;
|
|
19
24
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class SelectableDirective {
|
|
3
|
+
private flowSettingsService;
|
|
4
|
+
private selectionService;
|
|
5
|
+
private parentEdge;
|
|
6
|
+
private parentNode;
|
|
7
|
+
protected onMousedown(): void;
|
|
8
|
+
private entity;
|
|
9
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SelectableDirective, never>;
|
|
10
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<SelectableDirective, "[selectable]", never, {}, {}, never, never, false, never>;
|
|
11
|
+
}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
import { WritableSignal } from "@angular/core";
|
|
1
2
|
import { EdgeLabelPosition } from "../interfaces/edge-label.interface";
|
|
2
3
|
import { Edge, Curve, EdgeType } from "../interfaces/edge.interface";
|
|
3
4
|
import { EdgeLabelModel } from "./edge-label.model";
|
|
4
5
|
import { NodeModel } from "./node.model";
|
|
5
|
-
|
|
6
|
+
import { FlowEntity } from "../interfaces/flow-entity.interface";
|
|
7
|
+
export declare class EdgeModel implements FlowEntity {
|
|
6
8
|
edge: Edge;
|
|
7
|
-
source:
|
|
8
|
-
target:
|
|
9
|
+
source: WritableSignal<NodeModel<unknown> | undefined>;
|
|
10
|
+
target: WritableSignal<NodeModel<unknown> | undefined>;
|
|
9
11
|
curve: Curve;
|
|
10
12
|
type: EdgeType;
|
|
13
|
+
selected: WritableSignal<boolean>;
|
|
14
|
+
selected$: import("rxjs").Observable<boolean>;
|
|
11
15
|
detached: import("@angular/core").Signal<boolean>;
|
|
12
16
|
detached$: import("rxjs").Observable<boolean>;
|
|
13
17
|
path: import("@angular/core").Signal<{
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Node } from '../interfaces/node.interface';
|
|
2
|
-
import { FlowModel } from './flow.model';
|
|
3
2
|
import { HandleModel } from './handle.model';
|
|
4
|
-
|
|
3
|
+
import { FlowEntity } from '../interfaces/flow-entity.interface';
|
|
4
|
+
export declare class NodeModel<T = unknown> implements FlowEntity {
|
|
5
5
|
node: Node<T>;
|
|
6
|
+
private flowSettingsService;
|
|
6
7
|
point: import("@angular/core").WritableSignal<{
|
|
7
8
|
x: number;
|
|
8
9
|
y: number;
|
|
@@ -15,6 +16,9 @@ export declare class NodeModel<T = unknown> {
|
|
|
15
16
|
width: number;
|
|
16
17
|
height: number;
|
|
17
18
|
}>;
|
|
19
|
+
renderOrder: import("@angular/core").WritableSignal<number>;
|
|
20
|
+
selected: import("@angular/core").WritableSignal<boolean>;
|
|
21
|
+
selected$: import("rxjs").Observable<boolean>;
|
|
18
22
|
pointTransform: import("@angular/core").Signal<string>;
|
|
19
23
|
sourcePosition: import("@angular/core").Signal<import("ngx-vflow").Position>;
|
|
20
24
|
targetPosition: import("@angular/core").Signal<import("ngx-vflow").Position>;
|
|
@@ -22,12 +26,5 @@ export declare class NodeModel<T = unknown> {
|
|
|
22
26
|
handles$: import("rxjs").Observable<HandleModel[]>;
|
|
23
27
|
draggable: boolean;
|
|
24
28
|
readonly magnetRadius = 20;
|
|
25
|
-
private flow;
|
|
26
29
|
constructor(node: Node<T>);
|
|
27
|
-
/**
|
|
28
|
-
* Bind parent flow model to node
|
|
29
|
-
*
|
|
30
|
-
* @param flow parent flow
|
|
31
|
-
*/
|
|
32
|
-
bindFlow(flow: FlowModel): void;
|
|
33
30
|
}
|
|
@@ -16,6 +16,11 @@ export declare class EdgeChangesService {
|
|
|
16
16
|
type: "remove";
|
|
17
17
|
id: string;
|
|
18
18
|
}[]>;
|
|
19
|
+
protected edgeSelectChange$: Observable<{
|
|
20
|
+
type: "select";
|
|
21
|
+
id: string;
|
|
22
|
+
selected: boolean;
|
|
23
|
+
}[]>;
|
|
19
24
|
readonly changes$: Observable<EdgeChange[]>;
|
|
20
25
|
static ɵfac: i0.ɵɵFactoryDeclaration<EdgeChangesService, never>;
|
|
21
26
|
static ɵprov: i0.ɵɵInjectableDeclaration<EdgeChangesService>;
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
+
import { Signal } from '@angular/core';
|
|
1
2
|
import { NodeModel } from '../models/node.model';
|
|
2
3
|
import { EdgeModel } from '../models/edge.model';
|
|
3
4
|
import { ConnectionModel } from '../models/connection.model';
|
|
4
5
|
import { Marker } from '../interfaces/marker.interface';
|
|
6
|
+
import { FlowEntity } from '../interfaces/flow-entity.interface';
|
|
5
7
|
import * as i0 from "@angular/core";
|
|
6
8
|
export declare class FlowEntitiesService {
|
|
7
9
|
readonly nodes: import("@angular/core").WritableSignal<NodeModel<unknown>[]>;
|
|
8
10
|
readonly edges: import("@angular/core").WritableSignal<EdgeModel[]>;
|
|
9
11
|
readonly connection: import("@angular/core").WritableSignal<ConnectionModel>;
|
|
10
|
-
readonly markers:
|
|
11
|
-
readonly validEdges:
|
|
12
|
+
readonly markers: Signal<Map<number, Marker>>;
|
|
13
|
+
readonly validEdges: Signal<EdgeModel[]>;
|
|
14
|
+
entities: Signal<FlowEntity[]>;
|
|
12
15
|
getNode<T>(id: string): NodeModel<T> | undefined;
|
|
13
16
|
getDetachedEdges(): EdgeModel[];
|
|
14
17
|
static ɵfac: i0.ɵɵFactoryDeclaration<FlowEntitiesService, never>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { WritableSignal } from '@angular/core';
|
|
2
|
+
import { HandlePositions } from '../interfaces/handle-positions.interface';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class FlowSettingsService {
|
|
5
|
+
entitiesSelectable: WritableSignal<boolean>;
|
|
6
|
+
/**
|
|
7
|
+
* Global setting with handle positions. Nodes derive this value
|
|
8
|
+
*
|
|
9
|
+
* @deprecated
|
|
10
|
+
*/
|
|
11
|
+
handlePositions: WritableSignal<HandlePositions>;
|
|
12
|
+
/**
|
|
13
|
+
* @see {VflowComponent.view}
|
|
14
|
+
*/
|
|
15
|
+
view: WritableSignal<[number, number] | 'auto'>;
|
|
16
|
+
flowWidth: import("@angular/core").Signal<string | number>;
|
|
17
|
+
flowHeight: import("@angular/core").Signal<string | number>;
|
|
18
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FlowSettingsService, never>;
|
|
19
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<FlowSettingsService>;
|
|
20
|
+
}
|
|
@@ -20,6 +20,11 @@ export declare class NodesChangeService {
|
|
|
20
20
|
type: "remove";
|
|
21
21
|
id: string;
|
|
22
22
|
}[]>;
|
|
23
|
+
protected nodeSelectedChange$: Observable<{
|
|
24
|
+
type: "select";
|
|
25
|
+
id: string;
|
|
26
|
+
selected: boolean;
|
|
27
|
+
}[]>;
|
|
23
28
|
readonly changes$: Observable<NodeChange[]>;
|
|
24
29
|
static ɵfac: i0.ɵɵFactoryDeclaration<NodesChangeService, never>;
|
|
25
30
|
static ɵprov: i0.ɵɵInjectableDeclaration<NodesChangeService>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NodeModel } from '../models/node.model';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class NodeRenderingService {
|
|
4
|
+
private flowEntitiesService;
|
|
5
|
+
readonly nodes: import("@angular/core").Signal<NodeModel<unknown>[]>;
|
|
6
|
+
pullNode(node: NodeModel): void;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NodeRenderingService, never>;
|
|
8
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NodeRenderingService>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ViewportState } from '../interfaces/viewport.interface';
|
|
2
|
+
import { FlowEntity } from '../interfaces/flow-entity.interface';
|
|
3
|
+
import { Subject } from 'rxjs';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export interface ViewportForSelection {
|
|
6
|
+
start: ViewportState;
|
|
7
|
+
end: ViewportState;
|
|
8
|
+
target: Element;
|
|
9
|
+
}
|
|
10
|
+
export declare class SelectionService {
|
|
11
|
+
private static delta;
|
|
12
|
+
private flowEntitiesService;
|
|
13
|
+
protected viewport$: Subject<ViewportForSelection>;
|
|
14
|
+
protected resetSelection: import("rxjs").Subscription;
|
|
15
|
+
setViewport(viewport: ViewportForSelection): void;
|
|
16
|
+
select(entity: FlowEntity | null): void;
|
|
17
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SelectionService, never>;
|
|
18
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<SelectionService>;
|
|
19
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type EdgeChange = EdgeDetachedChange | EdgeAddChange | EdgeRemoveChange;
|
|
1
|
+
export type EdgeChange = EdgeDetachedChange | EdgeAddChange | EdgeRemoveChange | EdgeSelectChange;
|
|
2
2
|
/**
|
|
3
3
|
* @experimental
|
|
4
4
|
*/
|
|
@@ -11,6 +11,10 @@ export interface EdgeAddChange extends EdgeChangeShared {
|
|
|
11
11
|
export interface EdgeRemoveChange extends EdgeChangeShared {
|
|
12
12
|
type: 'remove';
|
|
13
13
|
}
|
|
14
|
+
export interface EdgeSelectChange extends EdgeChangeShared {
|
|
15
|
+
type: 'select';
|
|
16
|
+
selected: boolean;
|
|
17
|
+
}
|
|
14
18
|
interface EdgeChangeShared {
|
|
15
19
|
id: string;
|
|
16
20
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Point } from "../interfaces/point.interface";
|
|
2
|
-
export type NodeChange = NodePositionChange | NodeAddChange | NodeRemoveChange;
|
|
2
|
+
export type NodeChange = NodePositionChange | NodeAddChange | NodeRemoveChange | NodeSelectedChange;
|
|
3
3
|
export interface NodePositionChange extends NodeChangeShared {
|
|
4
4
|
type: 'position';
|
|
5
5
|
point: Point;
|
|
@@ -10,6 +10,10 @@ export interface NodeAddChange extends NodeChangeShared {
|
|
|
10
10
|
export interface NodeRemoveChange extends NodeChangeShared {
|
|
11
11
|
type: 'remove';
|
|
12
12
|
}
|
|
13
|
+
export interface NodeSelectedChange extends NodeChangeShared {
|
|
14
|
+
type: 'select';
|
|
15
|
+
selected: boolean;
|
|
16
|
+
}
|
|
13
17
|
interface NodeChangeShared {
|
|
14
18
|
id: string;
|
|
15
19
|
}
|
|
@@ -11,10 +11,11 @@ import * as i9 from "./directives/map-context.directive";
|
|
|
11
11
|
import * as i10 from "./directives/reference.directive";
|
|
12
12
|
import * as i11 from "./directives/root-svg-context.directive";
|
|
13
13
|
import * as i12 from "./directives/handle-size-controller.directive";
|
|
14
|
-
import * as i13 from "./directives/
|
|
15
|
-
import * as i14 from "
|
|
14
|
+
import * as i13 from "./directives/selectable.directive";
|
|
15
|
+
import * as i14 from "./directives/template.directive";
|
|
16
|
+
import * as i15 from "@angular/common";
|
|
16
17
|
export declare class VflowModule {
|
|
17
18
|
static ɵfac: i0.ɵɵFactoryDeclaration<VflowModule, never>;
|
|
18
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<VflowModule, [typeof i1.VflowComponent, typeof i2.NodeComponent, typeof i3.EdgeComponent, typeof i4.EdgeLabelComponent, typeof i5.ConnectionComponent, typeof i6.HandleComponent, typeof i7.DefsComponent, typeof i8.SpacePointContextDirective, typeof i9.MapContextDirective, typeof i10.RootSvgReferenceDirective, typeof i11.RootSvgContextDirective, typeof i12.HandleSizeControllerDirective, typeof i13.NodeHtmlTemplateDirective, typeof
|
|
19
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<VflowModule, [typeof i1.VflowComponent, typeof i2.NodeComponent, typeof i3.EdgeComponent, typeof i4.EdgeLabelComponent, typeof i5.ConnectionComponent, typeof i6.HandleComponent, typeof i7.DefsComponent, typeof i8.SpacePointContextDirective, typeof i9.MapContextDirective, typeof i10.RootSvgReferenceDirective, typeof i11.RootSvgContextDirective, typeof i12.HandleSizeControllerDirective, typeof i13.SelectableDirective, typeof i14.NodeHtmlTemplateDirective, typeof i14.EdgeLabelHtmlTemplateDirective, typeof i14.EdgeTemplateDirective, typeof i14.ConnectionTemplateDirective, typeof i14.HandleTemplateDirective], [typeof i15.CommonModule], [typeof i1.VflowComponent, typeof i6.HandleComponent, typeof i13.SelectableDirective, typeof i14.NodeHtmlTemplateDirective, typeof i14.EdgeLabelHtmlTemplateDirective, typeof i14.EdgeTemplateDirective, typeof i14.ConnectionTemplateDirective, typeof i14.HandleTemplateDirective]>;
|
|
19
20
|
static ɵinj: i0.ɵɵInjectorDeclaration<VflowModule>;
|
|
20
21
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ngx-vflow",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://www.ngx-vflow.org/",
|
|
6
6
|
"author": "Artem Mangilev",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"type": "git"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@angular/common": "^16.2.0 || 17.x",
|
|
20
|
-
"@angular/core": "^16.2.0 || 17.x",
|
|
19
|
+
"@angular/common": "^16.2.0 || 17.x || 18.x",
|
|
20
|
+
"@angular/core": "^16.2.0 || 17.x || 18.x",
|
|
21
21
|
"d3-drag": "^3.0.0",
|
|
22
22
|
"d3-path": "^3.1.0",
|
|
23
23
|
"d3-selection": "^3.0.0",
|
package/public-api.d.ts
CHANGED
|
@@ -17,3 +17,4 @@ export * from './lib/vflow/components/handle/handle.component';
|
|
|
17
17
|
export * from './lib/vflow/directives/template.directive';
|
|
18
18
|
export * from './lib/vflow/directives/connection-controller.directive';
|
|
19
19
|
export * from './lib/vflow/directives/changes-controller.directive';
|
|
20
|
+
export * from './lib/vflow/directives/selectable.directive';
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { computed, signal } from "@angular/core";
|
|
2
|
-
export class FlowModel {
|
|
3
|
-
constructor() {
|
|
4
|
-
/**
|
|
5
|
-
* Global setting with handle positions. Nodes derive this value
|
|
6
|
-
*
|
|
7
|
-
* @deprecated
|
|
8
|
-
*/
|
|
9
|
-
this.handlePositions = signal({ source: 'right', target: 'left' });
|
|
10
|
-
/**
|
|
11
|
-
* @see {VflowComponent.view}
|
|
12
|
-
*/
|
|
13
|
-
this.view = signal([400, 400]);
|
|
14
|
-
this.flowWidth = computed(() => this.view() === 'auto' ? '100%' : this.view()[0]);
|
|
15
|
-
this.flowHeight = computed(() => this.view() === 'auto' ? '100%' : this.view()[1]);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmxvdy5tb2RlbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL25neC12Zmxvdy1saWIvc3JjL2xpYi92Zmxvdy9tb2RlbHMvZmxvdy5tb2RlbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQTBCLFFBQVEsRUFBRSxNQUFNLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFHekUsTUFBTSxPQUFPLFNBQVM7SUFBdEI7UUFDRTs7OztXQUlHO1FBQ0ksb0JBQWUsR0FBb0MsTUFBTSxDQUFDLEVBQUUsTUFBTSxFQUFFLE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSxFQUFFLENBQUMsQ0FBQTtRQUVyRzs7V0FFRztRQUNJLFNBQUksR0FBOEMsTUFBTSxDQUFDLENBQUMsR0FBRyxFQUFFLEdBQUcsQ0FBQyxDQUFDLENBQUE7UUFFcEUsY0FBUyxHQUFHLFFBQVEsQ0FBQyxHQUFHLEVBQUUsQ0FBQyxJQUFJLENBQUMsSUFBSSxFQUFFLEtBQUssTUFBTSxDQUFDLENBQUMsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLElBQUksQ0FBQyxJQUFJLEVBQUUsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFBO1FBRTVFLGVBQVUsR0FBRyxRQUFRLENBQUMsR0FBRyxFQUFFLENBQUMsSUFBSSxDQUFDLElBQUksRUFBRSxLQUFLLE1BQU0sQ0FBQyxDQUFDLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FBQyxJQUFJLENBQUMsSUFBSSxFQUFFLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQTtJQUN0RixDQUFDO0NBQUEiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBTaWduYWwsIFdyaXRhYmxlU2lnbmFsLCBjb21wdXRlZCwgc2lnbmFsIH0gZnJvbSBcIkBhbmd1bGFyL2NvcmVcIjtcbmltcG9ydCB7IEhhbmRsZVBvc2l0aW9ucyB9IGZyb20gXCIuLi9pbnRlcmZhY2VzL2hhbmRsZS1wb3NpdGlvbnMuaW50ZXJmYWNlXCI7XG5cbmV4cG9ydCBjbGFzcyBGbG93TW9kZWwge1xuICAvKipcbiAgICogR2xvYmFsIHNldHRpbmcgd2l0aCBoYW5kbGUgcG9zaXRpb25zLiBOb2RlcyBkZXJpdmUgdGhpcyB2YWx1ZVxuICAgKlxuICAgKiBAZGVwcmVjYXRlZFxuICAgKi9cbiAgcHVibGljIGhhbmRsZVBvc2l0aW9uczogV3JpdGFibGVTaWduYWw8SGFuZGxlUG9zaXRpb25zPiA9IHNpZ25hbCh7IHNvdXJjZTogJ3JpZ2h0JywgdGFyZ2V0OiAnbGVmdCcgfSlcblxuICAvKipcbiAgICogQHNlZSB7VmZsb3dDb21wb25lbnQudmlld31cbiAgICovXG4gIHB1YmxpYyB2aWV3OiBXcml0YWJsZVNpZ25hbDxbbnVtYmVyLCBudW1iZXJdIHwgJ2F1dG8nPiA9IHNpZ25hbChbNDAwLCA0MDBdKVxuXG4gIHB1YmxpYyBmbG93V2lkdGggPSBjb21wdXRlZCgoKSA9PiB0aGlzLnZpZXcoKSA9PT0gJ2F1dG8nID8gJzEwMCUnIDogdGhpcy52aWV3KClbMF0pXG5cbiAgcHVibGljIGZsb3dIZWlnaHQgPSBjb21wdXRlZCgoKSA9PiB0aGlzLnZpZXcoKSA9PT0gJ2F1dG8nID8gJzEwMCUnIDogdGhpcy52aWV3KClbMV0pXG59XG4iXX0=
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Signal, WritableSignal } from "@angular/core";
|
|
2
|
-
import { HandlePositions } from "../interfaces/handle-positions.interface";
|
|
3
|
-
export declare class FlowModel {
|
|
4
|
-
/**
|
|
5
|
-
* Global setting with handle positions. Nodes derive this value
|
|
6
|
-
*
|
|
7
|
-
* @deprecated
|
|
8
|
-
*/
|
|
9
|
-
handlePositions: WritableSignal<HandlePositions>;
|
|
10
|
-
/**
|
|
11
|
-
* @see {VflowComponent.view}
|
|
12
|
-
*/
|
|
13
|
-
view: WritableSignal<[number, number] | 'auto'>;
|
|
14
|
-
flowWidth: Signal<string | number>;
|
|
15
|
-
flowHeight: Signal<string | number>;
|
|
16
|
-
}
|