ngx-vflow 0.2.2 → 0.3.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-label/edge-label.component.mjs +13 -10
- package/esm2022/lib/vflow/components/handle/handle.component.mjs +22 -25
- package/esm2022/lib/vflow/components/node/node.component.mjs +57 -22
- package/esm2022/lib/vflow/components/vflow/vflow.component.mjs +3 -3
- package/esm2022/lib/vflow/decorators/microtask.decorator.mjs +11 -0
- package/esm2022/lib/vflow/decorators/run-in-injection-context.decorator.mjs +26 -0
- package/esm2022/lib/vflow/directives/handle-size-controller.directive.mjs +38 -0
- package/esm2022/lib/vflow/models/edge.model.mjs +15 -11
- package/esm2022/lib/vflow/models/handle.model.mjs +32 -3
- package/esm2022/lib/vflow/models/node.model.mjs +3 -22
- package/esm2022/lib/vflow/services/edge-changes.service.mjs +2 -2
- package/esm2022/lib/vflow/services/flow-entities.service.mjs +2 -2
- package/esm2022/lib/vflow/services/handle.service.mjs +3 -4
- package/esm2022/lib/vflow/utils/add-nodes-to-edges.mjs +3 -3
- package/esm2022/lib/vflow/utils/resizable.mjs +11 -0
- package/esm2022/lib/vflow/vflow.module.mjs +5 -2
- package/fesm2022/ngx-vflow.mjs +262 -142
- package/fesm2022/ngx-vflow.mjs.map +1 -1
- package/lib/vflow/components/handle/handle.component.d.ts +5 -4
- package/lib/vflow/components/node/node.component.d.ts +7 -6
- package/lib/vflow/components/vflow/vflow.component.d.ts +2 -2
- package/lib/vflow/decorators/microtask.decorator.d.ts +1 -0
- package/lib/vflow/decorators/run-in-injection-context.decorator.d.ts +8 -0
- package/lib/vflow/directives/handle-size-controller.directive.d.ts +10 -0
- package/lib/vflow/models/edge.model.d.ts +2 -2
- package/lib/vflow/models/handle.model.d.ts +30 -2
- package/lib/vflow/models/node.model.d.ts +2 -2
- package/lib/vflow/services/handle.service.d.ts +3 -6
- package/lib/vflow/utils/resizable.d.ts +3 -0
- package/lib/vflow/vflow.module.d.ts +4 -3
- package/package.json +1 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { OnDestroy, OnInit } from '@angular/core';
|
|
1
|
+
import { OnDestroy, OnInit, TemplateRef } from '@angular/core';
|
|
2
2
|
import { Position } from '../../types/position.type';
|
|
3
3
|
import { HandleModel } from '../../models/handle.model';
|
|
4
|
+
import { WithInjectorDirective } from '../../decorators/run-in-injection-context.decorator';
|
|
4
5
|
import * as i0 from "@angular/core";
|
|
5
|
-
export declare class HandleComponent implements OnInit, OnDestroy {
|
|
6
|
+
export declare class HandleComponent extends WithInjectorDirective implements OnInit, OnDestroy {
|
|
6
7
|
private handleService;
|
|
7
8
|
private element;
|
|
8
9
|
/**
|
|
@@ -17,10 +18,10 @@ export declare class HandleComponent implements OnInit, OnDestroy {
|
|
|
17
18
|
* Should be used if node has more than one source/target
|
|
18
19
|
*/
|
|
19
20
|
id?: string;
|
|
21
|
+
template?: TemplateRef<any>;
|
|
20
22
|
model: HandleModel;
|
|
21
23
|
ngOnInit(): void;
|
|
22
24
|
ngOnDestroy(): void;
|
|
23
|
-
private parentRect;
|
|
24
25
|
static ɵfac: i0.ɵɵFactoryDeclaration<HandleComponent, never>;
|
|
25
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<HandleComponent, "handle", never, { "position": { "alias": "position"; "required": true; }; "type": { "alias": "type"; "required": true; }; "id": { "alias": "id"; "required": false; }; }, {}, never, never, false, never>;
|
|
26
|
+
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>;
|
|
26
27
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { AfterViewInit, ElementRef,
|
|
1
|
+
import { AfterViewInit, ElementRef, 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 { WithInjectorDirective } from '../../decorators/run-in-injection-context.decorator';
|
|
5
6
|
import * as i0 from "@angular/core";
|
|
6
7
|
export type HandleState = 'valid' | 'invalid' | 'idle';
|
|
7
|
-
export declare class NodeComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
8
|
+
export declare class NodeComponent extends WithInjectorDirective implements OnInit, AfterViewInit, OnDestroy {
|
|
8
9
|
protected handleService: HandleService;
|
|
9
|
-
protected
|
|
10
|
+
protected zone: NgZone;
|
|
10
11
|
nodeModel: NodeModel;
|
|
11
12
|
nodeHtmlTemplate?: TemplateRef<any>;
|
|
12
13
|
nodeContentRef: ElementRef<SVGGraphicsElement>;
|
|
@@ -16,8 +17,7 @@ export declare class NodeComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
16
17
|
private flowEntitiesService;
|
|
17
18
|
private hostRef;
|
|
18
19
|
protected showMagnet: import("@angular/core").Signal<boolean>;
|
|
19
|
-
private
|
|
20
|
-
private targetHandleState;
|
|
20
|
+
private subscription;
|
|
21
21
|
ngOnInit(): void;
|
|
22
22
|
ngAfterViewInit(): void;
|
|
23
23
|
ngOnDestroy(): void;
|
|
@@ -30,7 +30,8 @@ export declare class NodeComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
|
30
30
|
/**
|
|
31
31
|
* TODO srp
|
|
32
32
|
*/
|
|
33
|
-
protected resetValidateTargetHandle(): void;
|
|
33
|
+
protected resetValidateTargetHandle(targetHandle: HandleModel): void;
|
|
34
|
+
private setInitialHandles;
|
|
34
35
|
static ɵfac: i0.ɵɵFactoryDeclaration<NodeComponent, never>;
|
|
35
36
|
static ɵcmp: i0.ɵɵComponentDeclaration<NodeComponent, "g[node]", never, { "nodeModel": { "alias": "nodeModel"; "required": false; }; "nodeHtmlTemplate": { "alias": "nodeHtmlTemplate"; "required": false; }; }, {}, never, never, false, never>;
|
|
36
37
|
}
|
|
@@ -130,8 +130,8 @@ export declare class VflowComponent {
|
|
|
130
130
|
* Sync method to get detached edges
|
|
131
131
|
*/
|
|
132
132
|
getDetachedEdges(): Edge[];
|
|
133
|
-
protected trackNodes(idx: number, { node }: NodeModel):
|
|
134
|
-
protected trackEdges(idx: number, { edge }: EdgeModel):
|
|
133
|
+
protected trackNodes(idx: number, { node }: NodeModel): Node<unknown>;
|
|
134
|
+
protected trackEdges(idx: number, { edge }: EdgeModel): Edge<unknown>;
|
|
135
135
|
static ɵfac: i0.ɵɵFactoryDeclaration<VflowComponent, never>;
|
|
136
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"; }; }]>;
|
|
137
137
|
static ngAcceptInputType_connection: i3.ConnectionSettings;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Microtask(target: any, key: string, descriptor: TypedPropertyDescriptor<(...args: any[]) => void>): TypedPropertyDescriptor<(...args: any[]) => void>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Injector } from "@angular/core";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare function InjectionContext(target: any, key: string, descriptor: PropertyDescriptor): PropertyDescriptor;
|
|
4
|
+
export declare abstract class WithInjectorDirective {
|
|
5
|
+
readonly injector: Injector;
|
|
6
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WithInjectorDirective, never>;
|
|
7
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<WithInjectorDirective, never, never, {}, {}, never, never, false, never>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AfterViewInit } from '@angular/core';
|
|
2
|
+
import { HandleModel } from '../models/handle.model';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class HandleSizeControllerDirective implements AfterViewInit {
|
|
5
|
+
handleModel: HandleModel;
|
|
6
|
+
private handleWrapper;
|
|
7
|
+
ngAfterViewInit(): void;
|
|
8
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HandleSizeControllerDirective, never>;
|
|
9
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<HandleSizeControllerDirective, "[handleSizeController]", never, { "handleModel": { "alias": "handleSizeController"; "required": true; }; }, {}, never, never, false, never>;
|
|
10
|
+
}
|
|
@@ -4,8 +4,8 @@ import { EdgeLabelModel } from "./edge-label.model";
|
|
|
4
4
|
import { NodeModel } from "./node.model";
|
|
5
5
|
export declare class EdgeModel {
|
|
6
6
|
edge: Edge;
|
|
7
|
-
source: NodeModel
|
|
8
|
-
target: NodeModel
|
|
7
|
+
source: import("@angular/core").WritableSignal<NodeModel<unknown> | undefined>;
|
|
8
|
+
target: import("@angular/core").WritableSignal<NodeModel<unknown> | undefined>;
|
|
9
9
|
curve: Curve;
|
|
10
10
|
type: EdgeType;
|
|
11
11
|
detached: import("@angular/core").Signal<boolean>;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { NodeHandle } from "../services/handle.service";
|
|
2
2
|
import { NodeModel } from "./node.model";
|
|
3
|
+
export type HandleState = 'valid' | 'invalid' | 'idle';
|
|
3
4
|
export declare class HandleModel {
|
|
4
5
|
rawHandle: NodeHandle;
|
|
5
6
|
private parentNode;
|
|
6
7
|
readonly strokeWidth = 2;
|
|
8
|
+
/**
|
|
9
|
+
* Pre-computed size for default handle, changed dynamically
|
|
10
|
+
* for custom handles
|
|
11
|
+
*/
|
|
7
12
|
size: import("@angular/core").WritableSignal<{
|
|
8
13
|
width: number;
|
|
9
14
|
height: number;
|
|
@@ -20,10 +25,33 @@ export declare class HandleModel {
|
|
|
20
25
|
x: number;
|
|
21
26
|
y: number;
|
|
22
27
|
}>;
|
|
23
|
-
|
|
28
|
+
state: import("@angular/core").WritableSignal<HandleState>;
|
|
29
|
+
private updateParentSizeAndPosition$;
|
|
30
|
+
parentSize: import("@angular/core").Signal<{
|
|
24
31
|
width: number;
|
|
25
32
|
height: number;
|
|
33
|
+
} | {
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
}>;
|
|
37
|
+
parentPosition: import("@angular/core").Signal<{
|
|
38
|
+
x: number;
|
|
39
|
+
y: number;
|
|
40
|
+
} | {
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
26
43
|
}>;
|
|
27
|
-
|
|
44
|
+
parentReference: HTMLElement;
|
|
45
|
+
template: import("@angular/core").TemplateRef<any> | undefined;
|
|
46
|
+
templateContext: {
|
|
47
|
+
$implicit: {
|
|
48
|
+
point: import("@angular/core").Signal<{
|
|
49
|
+
x: number;
|
|
50
|
+
y: number;
|
|
51
|
+
}>;
|
|
52
|
+
state: import("@angular/core").WritableSignal<HandleState>;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
28
55
|
constructor(rawHandle: NodeHandle, parentNode: NodeModel);
|
|
56
|
+
updateParent(): void;
|
|
29
57
|
}
|
|
@@ -18,8 +18,8 @@ export declare class NodeModel<T = unknown> {
|
|
|
18
18
|
pointTransform: import("@angular/core").Signal<string>;
|
|
19
19
|
sourcePosition: import("@angular/core").Signal<import("ngx-vflow").Position>;
|
|
20
20
|
targetPosition: import("@angular/core").Signal<import("ngx-vflow").Position>;
|
|
21
|
-
handles: import("@angular/core").
|
|
22
|
-
|
|
21
|
+
handles: import("@angular/core").WritableSignal<HandleModel[]>;
|
|
22
|
+
handles$: import("rxjs").Observable<HandleModel[]>;
|
|
23
23
|
draggable: boolean;
|
|
24
24
|
readonly magnetRadius = 20;
|
|
25
25
|
private flow;
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
+
import { TemplateRef } from '@angular/core';
|
|
1
2
|
import { Position } from '../types/position.type';
|
|
2
3
|
import { HandleType } from '../types/handle-type.type';
|
|
3
|
-
import { Point } from '../interfaces/point.interface';
|
|
4
4
|
import { NodeModel } from '../models/node.model';
|
|
5
5
|
import { HandleModel } from '../models/handle.model';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
7
7
|
export interface NodeHandle {
|
|
8
8
|
position: Position;
|
|
9
9
|
type: HandleType;
|
|
10
|
-
parentPosition: Point;
|
|
11
|
-
parentSize: {
|
|
12
|
-
width: number;
|
|
13
|
-
height: number;
|
|
14
|
-
};
|
|
15
10
|
id?: string;
|
|
11
|
+
parentReference?: HTMLElement;
|
|
12
|
+
template?: TemplateRef<any>;
|
|
16
13
|
}
|
|
17
14
|
export declare class HandleService {
|
|
18
15
|
readonly node: import("@angular/core").WritableSignal<NodeModel<unknown> | null>;
|
|
@@ -10,10 +10,11 @@ import * as i8 from "./directives/space-point-context.directive";
|
|
|
10
10
|
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
|
-
import * as i12 from "./directives/
|
|
14
|
-
import * as i13 from "
|
|
13
|
+
import * as i12 from "./directives/handle-size-controller.directive";
|
|
14
|
+
import * as i13 from "./directives/template.directive";
|
|
15
|
+
import * as i14 from "@angular/common";
|
|
15
16
|
export declare class VflowModule {
|
|
16
17
|
static ɵfac: i0.ɵɵFactoryDeclaration<VflowModule, never>;
|
|
17
|
-
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.NodeHtmlTemplateDirective, typeof
|
|
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 i13.EdgeLabelHtmlTemplateDirective, typeof i13.EdgeTemplateDirective, typeof i13.ConnectionTemplateDirective, typeof i13.HandleTemplateDirective], [typeof i14.CommonModule], [typeof i1.VflowComponent, typeof i6.HandleComponent, typeof i13.NodeHtmlTemplateDirective, typeof i13.EdgeLabelHtmlTemplateDirective, typeof i13.EdgeTemplateDirective, typeof i13.ConnectionTemplateDirective, typeof i13.HandleTemplateDirective]>;
|
|
18
19
|
static ɵinj: i0.ɵɵInjectorDeclaration<VflowModule>;
|
|
19
20
|
}
|