ngx-vflow 0.1.7 → 0.1.9
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/vflow/vflow.component.mjs +68 -2
- package/esm2022/lib/vflow/directives/changes-controller.directive.mjs +7 -1
- package/esm2022/lib/vflow/directives/connection-controller.directive.mjs +9 -1
- package/esm2022/lib/vflow/interfaces/node.interface.mjs +1 -1
- package/fesm2022/ngx-vflow.mjs +81 -1
- package/fesm2022/ngx-vflow.mjs.map +1 -1
- package/lib/vflow/components/vflow/vflow.component.d.ts +75 -13
- package/lib/vflow/directives/changes-controller.directive.d.ts +6 -0
- package/lib/vflow/directives/connection-controller.directive.d.ts +8 -0
- package/lib/vflow/interfaces/node.interface.d.ts +3 -4
- package/package.json +1 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Signal } from '@angular/core';
|
|
2
2
|
import { Node } from '../../interfaces/node.interface';
|
|
3
3
|
import { MapContextDirective } from '../../directives/map-context.directive';
|
|
4
4
|
import { NodeModel } from '../../models/node.model';
|
|
5
|
-
import { ViewportService } from '../../services/viewport.service';
|
|
6
5
|
import { Edge } from '../../interfaces/edge.interface';
|
|
7
6
|
import { EdgeModel } from '../../models/edge.model';
|
|
8
7
|
import { ConnectionTemplateDirective, EdgeLabelHtmlTemplateDirective, EdgeTemplateDirective, HandleTemplateDirective, NodeHtmlTemplateDirective } from '../../directives/template.directive';
|
|
@@ -10,10 +9,7 @@ import { HandlePositions } from '../../interfaces/handle-positions.interface';
|
|
|
10
9
|
import { FlowModel } from '../../models/flow.model';
|
|
11
10
|
import { Point } from '../../interfaces/point.interface';
|
|
12
11
|
import { ViewportState } from '../../interfaces/viewport.interface';
|
|
13
|
-
import { FlowEntitiesService } from '../../services/flow-entities.service';
|
|
14
12
|
import { ConnectionModel } from '../../models/connection.model';
|
|
15
|
-
import { NodesChangeService } from '../../services/node-changes.service';
|
|
16
|
-
import { EdgeChangesService } from '../../services/edge-changes.service';
|
|
17
13
|
import { NodeChange } from '../../types/node-change.type';
|
|
18
14
|
import { EdgeChange } from '../../types/edge-change.type';
|
|
19
15
|
import * as i0 from "@angular/core";
|
|
@@ -21,11 +17,11 @@ import * as i1 from "../../directives/connection-controller.directive";
|
|
|
21
17
|
import * as i2 from "../../directives/changes-controller.directive";
|
|
22
18
|
import * as i3 from "../../interfaces/connection-settings.interface";
|
|
23
19
|
export declare class VflowComponent {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
private viewportService;
|
|
21
|
+
private flowEntitiesService;
|
|
22
|
+
private nodesChangeService;
|
|
23
|
+
private edgesChangeService;
|
|
24
|
+
private injector;
|
|
29
25
|
/**
|
|
30
26
|
* Size for flow view
|
|
31
27
|
*
|
|
@@ -37,33 +33,99 @@ export declare class VflowComponent {
|
|
|
37
33
|
number,
|
|
38
34
|
number
|
|
39
35
|
] | 'auto');
|
|
36
|
+
/**
|
|
37
|
+
* Minimum zoom value
|
|
38
|
+
*/
|
|
40
39
|
minZoom: number;
|
|
40
|
+
/**
|
|
41
|
+
* Maximum zoom value
|
|
42
|
+
*/
|
|
41
43
|
maxZoom: number;
|
|
44
|
+
/**
|
|
45
|
+
* Object that controls flow direction.
|
|
46
|
+
*
|
|
47
|
+
* For example, if you want to archieve right to left direction
|
|
48
|
+
* then you need to pass these positions { source: 'left', target: 'right' }
|
|
49
|
+
*
|
|
50
|
+
* ! Be carefult using this field, it may depricate in future releases !
|
|
51
|
+
*/
|
|
42
52
|
set handlePositions(handlePositions: HandlePositions);
|
|
53
|
+
/**
|
|
54
|
+
* Background color for flow
|
|
55
|
+
*/
|
|
43
56
|
background: string;
|
|
57
|
+
/**
|
|
58
|
+
* Settings for connection (it renders when user tries to create edge between nodes)
|
|
59
|
+
*
|
|
60
|
+
* You need to pass `ConnectionSettings` in this input.
|
|
61
|
+
*/
|
|
44
62
|
set connection(connection: ConnectionModel);
|
|
45
63
|
get connection(): ConnectionModel;
|
|
64
|
+
/**
|
|
65
|
+
* Nodes to render
|
|
66
|
+
*/
|
|
46
67
|
set nodes(newNodes: Node[]);
|
|
47
|
-
get nodeModels(): NodeModel<unknown>[];
|
|
68
|
+
protected get nodeModels(): NodeModel<unknown>[];
|
|
69
|
+
/**
|
|
70
|
+
* Edges to render
|
|
71
|
+
*/
|
|
48
72
|
set edges(newEdges: Edge[]);
|
|
49
|
-
get edgeModels(): EdgeModel[];
|
|
73
|
+
protected get edgeModels(): EdgeModel[];
|
|
50
74
|
protected nodeHtmlDirective?: NodeHtmlTemplateDirective;
|
|
51
75
|
protected edgeTemplateDirective?: EdgeTemplateDirective;
|
|
52
76
|
protected edgeLabelHtmlDirective?: EdgeLabelHtmlTemplateDirective;
|
|
53
77
|
protected connectionTemplateDirective?: ConnectionTemplateDirective;
|
|
54
78
|
protected handleTemplateDirective?: HandleTemplateDirective;
|
|
55
79
|
protected mapContext: MapContextDirective;
|
|
80
|
+
/**
|
|
81
|
+
* Signal for reading viewport change
|
|
82
|
+
*/
|
|
56
83
|
readonly viewport: Signal<ViewportState>;
|
|
84
|
+
/**
|
|
85
|
+
* Signal for reading nodes change
|
|
86
|
+
*/
|
|
57
87
|
readonly nodesChange: Signal<NodeChange[]>;
|
|
88
|
+
/**
|
|
89
|
+
* Signal to reading edges change
|
|
90
|
+
*/
|
|
58
91
|
readonly edgesChange: Signal<EdgeChange[]>;
|
|
59
|
-
|
|
92
|
+
/**
|
|
93
|
+
* Observable with viewport change
|
|
94
|
+
*/
|
|
95
|
+
readonly viewportChange$: import("rxjs").Observable<ViewportState>;
|
|
96
|
+
/**
|
|
97
|
+
* Observable with nodes change
|
|
98
|
+
*/
|
|
60
99
|
readonly nodesChange$: import("rxjs").Observable<NodeChange[]>;
|
|
100
|
+
/**
|
|
101
|
+
* Observable with nodes change
|
|
102
|
+
*/
|
|
61
103
|
readonly edgesChange$: import("rxjs").Observable<EdgeChange[]>;
|
|
62
104
|
protected flowModel: FlowModel;
|
|
63
105
|
protected markers: Signal<Map<number, import("ngx-vflow").Marker>>;
|
|
106
|
+
/**
|
|
107
|
+
* Change viewport to specified state
|
|
108
|
+
*
|
|
109
|
+
* @param viewport viewport state
|
|
110
|
+
*/
|
|
64
111
|
viewportTo(viewport: ViewportState): void;
|
|
112
|
+
/**
|
|
113
|
+
* Change zoom
|
|
114
|
+
*
|
|
115
|
+
* @param zoom zoom value
|
|
116
|
+
*/
|
|
65
117
|
zoomTo(zoom: number): void;
|
|
118
|
+
/**
|
|
119
|
+
* Move to specified coordinate
|
|
120
|
+
*
|
|
121
|
+
* @param point point where to move
|
|
122
|
+
*/
|
|
66
123
|
panTo(point: Point): void;
|
|
124
|
+
/**
|
|
125
|
+
* Get node by id
|
|
126
|
+
*
|
|
127
|
+
* @param id node id
|
|
128
|
+
*/
|
|
67
129
|
getNode<T = unknown>(id: string): Node<T> | undefined;
|
|
68
130
|
protected trackNodes(idx: number, { node }: NodeModel): string;
|
|
69
131
|
protected trackEdges(idx: number, { edge }: EdgeModel): string;
|
|
@@ -7,7 +7,13 @@ import * as i0 from "@angular/core";
|
|
|
7
7
|
export declare class ChangesControllerDirective {
|
|
8
8
|
protected nodesChangeService: NodesChangeService;
|
|
9
9
|
protected edgesChangeService: EdgeChangesService;
|
|
10
|
+
/**
|
|
11
|
+
* Watch nodes change
|
|
12
|
+
*/
|
|
10
13
|
onNodesChange: EventEmitter<NodeChange[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Watch nodes change
|
|
16
|
+
*/
|
|
11
17
|
onEdgesChange: EventEmitter<EdgeChange[]>;
|
|
12
18
|
protected nodesChangeProxySubscription: import("rxjs").Subscription;
|
|
13
19
|
protected edgesChangeProxySubscription: import("rxjs").Subscription;
|
|
@@ -2,6 +2,14 @@ import { EventEmitter } from '@angular/core';
|
|
|
2
2
|
import { Connection } from '../interfaces/connection.interface';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
export declare class ConnectionControllerDirective {
|
|
5
|
+
/**
|
|
6
|
+
* This event fires when user tries to create new Edge.
|
|
7
|
+
*
|
|
8
|
+
* `Connection` is an entity that contains data about source and target nodes.
|
|
9
|
+
*
|
|
10
|
+
* Also it's important to note, that this event only fires when connection is valid by validator function in `ConnectionSettings`,
|
|
11
|
+
* by default without passing the validator every connection concidered valid.
|
|
12
|
+
*/
|
|
5
13
|
onConnect: EventEmitter<Connection>;
|
|
6
14
|
private statusService;
|
|
7
15
|
private flowEntitiesService;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { Point } from "./point.interface";
|
|
2
2
|
export type Node<T = unknown> = SharedNode & (DefaultNode | HtmlTemplateNode<T>);
|
|
3
|
-
interface SharedNode {
|
|
3
|
+
export interface SharedNode {
|
|
4
4
|
id: string;
|
|
5
5
|
point: Point;
|
|
6
6
|
draggable?: boolean;
|
|
7
7
|
}
|
|
8
|
-
interface DefaultNode {
|
|
8
|
+
export interface DefaultNode {
|
|
9
9
|
type: 'default';
|
|
10
10
|
text?: string;
|
|
11
11
|
}
|
|
12
|
-
interface HtmlTemplateNode<T = unknown> {
|
|
12
|
+
export interface HtmlTemplateNode<T = unknown> {
|
|
13
13
|
type: 'html-template';
|
|
14
14
|
data?: T;
|
|
15
15
|
}
|
|
16
|
-
export {};
|