@visuallyjs/browser-ui-angular 1.0.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/README.md +0 -0
- package/css/visuallyjs-angular.css +39 -0
- package/esm2022/index.mjs +34 -0
- package/esm2022/lib/base.group.component.mjs +43 -0
- package/esm2022/lib/base.node.component.mjs +41 -0
- package/esm2022/lib/base.port.component.mjs +71 -0
- package/esm2022/lib/base.vertex.component.mjs +75 -0
- package/esm2022/lib/browser-ui-angular.module.mjs +133 -0
- package/esm2022/lib/charts/area.chart.component.mjs +55 -0
- package/esm2022/lib/charts/bar.chart.component.mjs +55 -0
- package/esm2022/lib/charts/bubble.chart.component.mjs +55 -0
- package/esm2022/lib/charts/column.chart.component.mjs +55 -0
- package/esm2022/lib/charts/line.chart.component.mjs +55 -0
- package/esm2022/lib/charts/pie.chart.component.mjs +55 -0
- package/esm2022/lib/charts/sankey.chart.component.mjs +74 -0
- package/esm2022/lib/charts/scatter.chart.component.mjs +55 -0
- package/esm2022/lib/charts/xy.chart.component.mjs +39 -0
- package/esm2022/lib/color.tag.component.mjs +86 -0
- package/esm2022/lib/common.mjs +2 -0
- package/esm2022/lib/controls-component.mjs +164 -0
- package/esm2022/lib/decorator-component.mjs +52 -0
- package/esm2022/lib/default-group-component.mjs +18 -0
- package/esm2022/lib/default-node-component.mjs +18 -0
- package/esm2022/lib/diagram-component.mjs +53 -0
- package/esm2022/lib/diagram-palette-component.mjs +82 -0
- package/esm2022/lib/edge.type.picker.component.mjs +46 -0
- package/esm2022/lib/export-controls-component.mjs +75 -0
- package/esm2022/lib/inspector.component.mjs +77 -0
- package/esm2022/lib/miniview-component.mjs +63 -0
- package/esm2022/lib/model.mjs +8 -0
- package/esm2022/lib/overlay-component.mjs +18 -0
- package/esm2022/lib/palette.component.mjs +86 -0
- package/esm2022/lib/shape.component.mjs +85 -0
- package/esm2022/lib/shape.palette.component.mjs +78 -0
- package/esm2022/lib/surface-component.mjs +286 -0
- package/esm2022/lib/vjs-service.mjs +176 -0
- package/esm2022/visuallyjs-browser-ui-angular.mjs +2 -0
- package/fesm2022/visuallyjs-browser-ui-angular.mjs +2235 -0
- package/fesm2022/visuallyjs-browser-ui-angular.mjs.map +1 -0
- package/index.d.ts +40 -0
- package/lib/base.group.component.d.ts +60 -0
- package/lib/base.node.component.d.ts +55 -0
- package/lib/base.port.component.d.ts +74 -0
- package/lib/base.vertex.component.d.ts +111 -0
- package/lib/browser-ui-angular.module.d.ts +35 -0
- package/lib/charts/area.chart.component.d.ts +43 -0
- package/lib/charts/bar.chart.component.d.ts +40 -0
- package/lib/charts/bubble.chart.component.d.ts +40 -0
- package/lib/charts/column.chart.component.d.ts +40 -0
- package/lib/charts/line.chart.component.d.ts +39 -0
- package/lib/charts/pie.chart.component.d.ts +40 -0
- package/lib/charts/sankey.chart.component.d.ts +59 -0
- package/lib/charts/scatter.chart.component.d.ts +40 -0
- package/lib/charts/xy.chart.component.d.ts +32 -0
- package/lib/color.tag.component.d.ts +35 -0
- package/lib/common.d.ts +68 -0
- package/lib/controls-component.d.ts +71 -0
- package/lib/decorator-component.d.ts +25 -0
- package/lib/default-group-component.d.ts +11 -0
- package/lib/default-node-component.d.ts +11 -0
- package/lib/diagram-component.d.ts +52 -0
- package/lib/diagram-palette-component.d.ts +92 -0
- package/lib/edge.type.picker.component.d.ts +35 -0
- package/lib/export-controls-component.d.ts +59 -0
- package/lib/inspector.component.d.ts +96 -0
- package/lib/miniview-component.d.ts +45 -0
- package/lib/model.d.ts +8 -0
- package/lib/overlay-component.d.ts +59 -0
- package/lib/palette.component.d.ts +94 -0
- package/lib/shape.component.d.ts +70 -0
- package/lib/shape.palette.component.d.ts +73 -0
- package/lib/surface-component.d.ts +149 -0
- package/lib/vjs-service.d.ts +71 -0
- package/package.json +29 -0
- package/visuallyjs-browser-ui-angular.tgz +0 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Component, ElementRef, inject, Input, NgZone } from "@angular/core";
|
|
2
|
+
import { createDiagram } from "@visuallyjs/browser-ui";
|
|
3
|
+
import { VisuallyJsService } from "./vjs-service";
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
|
|
6
|
+
export class DiagramComponent {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.$ngZone = inject(NgZone);
|
|
9
|
+
this.$el = inject(ElementRef);
|
|
10
|
+
this.$vjs = inject(VisuallyJsService);
|
|
11
|
+
}
|
|
12
|
+
ngAfterViewInit() {
|
|
13
|
+
this.$ngZone.runOutsideAngular(() => {
|
|
14
|
+
this.diagram = createDiagram(this.$el.nativeElement, this.options, this.modelOptions);
|
|
15
|
+
this.$vjs.$setDiagram(this.diagram);
|
|
16
|
+
if (this.data != null) {
|
|
17
|
+
this.diagram.load({ data: this.data });
|
|
18
|
+
}
|
|
19
|
+
else if (this.url != null) {
|
|
20
|
+
this.diagram.load({ url: this.url });
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
ngOnDestroy() {
|
|
25
|
+
this.diagram.$destroy();
|
|
26
|
+
//this.$service.removeDiagram(this.diagramId, this.diagram)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
save(options) {
|
|
30
|
+
return this.diagram.save(options);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
saveToUrl(options) {
|
|
34
|
+
this.diagram.saveToUrl(options);
|
|
35
|
+
}
|
|
36
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiagramComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
37
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DiagramComponent, selector: "vjs-diagram", inputs: { options: "options", data: "data", url: "url", modelOptions: "modelOptions" }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true }); }
|
|
38
|
+
}
|
|
39
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiagramComponent, decorators: [{
|
|
40
|
+
type: Component,
|
|
41
|
+
args: [{
|
|
42
|
+
selector: "vjs-diagram",
|
|
43
|
+
template: `<ng-content></ng-content>`
|
|
44
|
+
}]
|
|
45
|
+
}], propDecorators: { options: [{
|
|
46
|
+
type: Input
|
|
47
|
+
}], data: [{
|
|
48
|
+
type: Input
|
|
49
|
+
}], url: [{
|
|
50
|
+
type: Input
|
|
51
|
+
}], modelOptions: [{
|
|
52
|
+
type: Input
|
|
53
|
+
}] } });
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { DiagramPalette } from "@visuallyjs/browser-ui";
|
|
2
|
+
import { Component, ElementRef, inject, Input } from "@angular/core";
|
|
3
|
+
import { VisuallyJsService } from "./vjs-service";
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export class DiagramPaletteComponent {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.$el = inject(ElementRef);
|
|
8
|
+
this.$vjs = inject(VisuallyJsService);
|
|
9
|
+
}
|
|
10
|
+
$init() {
|
|
11
|
+
|
|
12
|
+
new DiagramPalette(this.$el.nativeElement, this.diagram, {
|
|
13
|
+
fill: this.fill,
|
|
14
|
+
outline: this.outline,
|
|
15
|
+
dragSize: this.dragSize,
|
|
16
|
+
inspector: this.inspector,
|
|
17
|
+
iconSize: this.iconSize,
|
|
18
|
+
showLabels: this.showLabels,
|
|
19
|
+
paletteStrokeWidth: this.paletteStrokeWidth,
|
|
20
|
+
showAllMessage: this.showAllMessage,
|
|
21
|
+
onCellAdded: this.onCellAdded,
|
|
22
|
+
mode: this.mode,
|
|
23
|
+
allowClickToAdd: this.allowClickToAdd,
|
|
24
|
+
autoExitDrawMode: this.autoExitDrawMode,
|
|
25
|
+
selectAfterAdd: this.selectAfterAdd,
|
|
26
|
+
onVertexAdded: this.onVertexAdded,
|
|
27
|
+
preparedShapes: this.preparedShapes
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
ngAfterViewInit() {
|
|
31
|
+
if (this.diagram != null) {
|
|
32
|
+
this.$init();
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
this.$vjs.getDiagram((d) => {
|
|
36
|
+
this.diagram = d;
|
|
37
|
+
this.$init();
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiagramPaletteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
42
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DiagramPaletteComponent, selector: "vjs-diagram-palette", inputs: { fill: "fill", outline: "outline", dragSize: "dragSize", inspector: "inspector", iconSize: "iconSize", showLabels: "showLabels", paletteStrokeWidth: "paletteStrokeWidth", showAllMessage: "showAllMessage", onCellAdded: "onCellAdded", mode: "mode", allowClickToAdd: "allowClickToAdd", autoExitDrawMode: "autoExitDrawMode", selectAfterAdd: "selectAfterAdd", diagram: "diagram", onVertexAdded: "onVertexAdded", preparedShapes: "preparedShapes" }, ngImport: i0, template: `<div></div>`, isInline: true }); }
|
|
43
|
+
}
|
|
44
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiagramPaletteComponent, decorators: [{
|
|
45
|
+
type: Component,
|
|
46
|
+
args: [{
|
|
47
|
+
selector: "vjs-diagram-palette",
|
|
48
|
+
template: `<div></div>`,
|
|
49
|
+
}]
|
|
50
|
+
}], propDecorators: { fill: [{
|
|
51
|
+
type: Input
|
|
52
|
+
}], outline: [{
|
|
53
|
+
type: Input
|
|
54
|
+
}], dragSize: [{
|
|
55
|
+
type: Input
|
|
56
|
+
}], inspector: [{
|
|
57
|
+
type: Input
|
|
58
|
+
}], iconSize: [{
|
|
59
|
+
type: Input
|
|
60
|
+
}], showLabels: [{
|
|
61
|
+
type: Input
|
|
62
|
+
}], paletteStrokeWidth: [{
|
|
63
|
+
type: Input
|
|
64
|
+
}], showAllMessage: [{
|
|
65
|
+
type: Input
|
|
66
|
+
}], onCellAdded: [{
|
|
67
|
+
type: Input
|
|
68
|
+
}], mode: [{
|
|
69
|
+
type: Input
|
|
70
|
+
}], allowClickToAdd: [{
|
|
71
|
+
type: Input
|
|
72
|
+
}], autoExitDrawMode: [{
|
|
73
|
+
type: Input
|
|
74
|
+
}], selectAfterAdd: [{
|
|
75
|
+
type: Input
|
|
76
|
+
}], diagram: [{
|
|
77
|
+
type: Input
|
|
78
|
+
}], onVertexAdded: [{
|
|
79
|
+
type: Input
|
|
80
|
+
}], preparedShapes: [{
|
|
81
|
+
type: Input
|
|
82
|
+
}] } });
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Component, Input, Output, EventEmitter, inject } from "@angular/core";
|
|
2
|
+
import { INSPECTOR_CONTEXT_EDGE_PROPERTY_MAPPINGS, EdgeTypePicker } from "@visuallyjs/browser-ui";
|
|
3
|
+
import { VisuallyJsService } from "./vjs-service";
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
|
|
6
|
+
export class EdgeTypePickerComponent {
|
|
7
|
+
constructor(el) {
|
|
8
|
+
this.el = el;
|
|
9
|
+
|
|
10
|
+
this.changeEvent = new EventEmitter();
|
|
11
|
+
this.$vjs = inject(VisuallyJsService);
|
|
12
|
+
}
|
|
13
|
+
resolveMappings() {
|
|
14
|
+
const mappings = this.edgeMappings || this.inspector.getFromContext(INSPECTOR_CONTEXT_EDGE_PROPERTY_MAPPINGS);
|
|
15
|
+
return mappings || this.inspector.$ui.$getEdgePropertyMappings();
|
|
16
|
+
}
|
|
17
|
+
ngAfterViewInit() {
|
|
18
|
+
this.$vjs.getInspector(inspector => {
|
|
19
|
+
this.inspector = inspector;
|
|
20
|
+
this.inspector.onChange(() => {
|
|
21
|
+
this.edgeTypePicker.select(this.propertyName, this.inspector.getValue(this.propertyName));
|
|
22
|
+
});
|
|
23
|
+
const current = this.inspector.getValue(this.propertyName) || '';
|
|
24
|
+
this.edgeTypePicker = new EdgeTypePicker(this.inspector.$ui, this.el.nativeElement, this.resolveMappings(), current, (p, v) => {
|
|
25
|
+
this.inspector.setValue(this.propertyName, v);
|
|
26
|
+
this.changeEvent.emit(v);
|
|
27
|
+
});
|
|
28
|
+
this.edgeTypePicker.render(this.propertyName, this.inspector._currentCommonData);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EdgeTypePickerComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
32
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: EdgeTypePickerComponent, selector: "vjs-edge-type", inputs: { propertyName: "propertyName", edgeMappings: "edgeMappings" }, outputs: { changeEvent: "changeEvent" }, ngImport: i0, template: `<div [attr.vjs-att]="propertyName"></div>`, isInline: true }); }
|
|
33
|
+
}
|
|
34
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EdgeTypePickerComponent, decorators: [{
|
|
35
|
+
type: Component,
|
|
36
|
+
args: [{
|
|
37
|
+
selector: "vjs-edge-type",
|
|
38
|
+
template: `<div [attr.vjs-att]="propertyName"></div>`
|
|
39
|
+
}]
|
|
40
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { propertyName: [{
|
|
41
|
+
type: Input
|
|
42
|
+
}], edgeMappings: [{
|
|
43
|
+
type: Input
|
|
44
|
+
}], changeEvent: [{
|
|
45
|
+
type: Output
|
|
46
|
+
}] } });
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Component, ElementRef, inject, Input, } from "@angular/core";
|
|
2
|
+
import { CLASS_CONTROLS, CLASS_EXPORT_CONTROLS, ImageExportUI, SvgExportUI, } from "@visuallyjs/browser-ui";
|
|
3
|
+
import { VisuallyJsService } from "./vjs-service";
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
import * as i1 from "@angular/common";
|
|
6
|
+
|
|
7
|
+
export class ExportControlsComponent {
|
|
8
|
+
constructor() {
|
|
9
|
+
|
|
10
|
+
this.showLabel = true;
|
|
11
|
+
|
|
12
|
+
this.label = "Export:";
|
|
13
|
+
|
|
14
|
+
this.allowSvgExport = true;
|
|
15
|
+
|
|
16
|
+
this.allowPngExport = true;
|
|
17
|
+
|
|
18
|
+
this.allowJpgExport = true;
|
|
19
|
+
// new
|
|
20
|
+
this.$vjs = inject(VisuallyJsService);
|
|
21
|
+
this.$el = inject(ElementRef);
|
|
22
|
+
}
|
|
23
|
+
ngOnInit() {
|
|
24
|
+
this.$vjs.getUI((b) => {
|
|
25
|
+
this.ui = b;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
exportSVG() {
|
|
29
|
+
new SvgExportUI(this.ui).export(this.svgOptions);
|
|
30
|
+
}
|
|
31
|
+
exportPNG() {
|
|
32
|
+
new ImageExportUI(this.ui).export(this.imageOptions);
|
|
33
|
+
}
|
|
34
|
+
exportJPG() {
|
|
35
|
+
new ImageExportUI(this.ui).export(Object.assign(this.imageOptions || {}, {
|
|
36
|
+
type: "image/jpeg",
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ExportControlsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
40
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ExportControlsComponent, selector: "vjs-export-controls", inputs: { showLabel: "showLabel", label: "label", margins: "margins", svgOptions: "svgOptions", imageOptions: "imageOptions", allowSvgExport: "allowSvgExport", allowPngExport: "allowPngExport", allowJpgExport: "allowJpgExport" }, ngImport: i0, template: "<div class=\"vjs-controls vjs-export-controls\">\n <span *ngIf=\"showLabel\">{{ label }}</span>\n <i *ngIf=\"allowSvgExport\"\n ><a href=\"#\" id=\"exportSvg\" (click)=\"exportSVG()\">SVG</a></i\n >\n <i *ngIf=\"allowPngExport\"\n ><a href=\"#\" id=\"exportPng\" (click)=\"exportPNG()\">PNG</a></i\n >\n <i *ngIf=\"allowJpgExport\"\n ><a href=\"#\" id=\"exportJpg\" (click)=\"exportJPG()\">JPG</a></i\n >\n </div>", isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
41
|
+
}
|
|
42
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ExportControlsComponent, decorators: [{
|
|
43
|
+
type: Component,
|
|
44
|
+
args: [{
|
|
45
|
+
selector: "vjs-export-controls",
|
|
46
|
+
template: `<div class="${CLASS_CONTROLS} ${CLASS_EXPORT_CONTROLS}">
|
|
47
|
+
<span *ngIf="showLabel">{{ label }}</span>
|
|
48
|
+
<i *ngIf="allowSvgExport"
|
|
49
|
+
><a href="#" id="exportSvg" (click)="exportSVG()">SVG</a></i
|
|
50
|
+
>
|
|
51
|
+
<i *ngIf="allowPngExport"
|
|
52
|
+
><a href="#" id="exportPng" (click)="exportPNG()">PNG</a></i
|
|
53
|
+
>
|
|
54
|
+
<i *ngIf="allowJpgExport"
|
|
55
|
+
><a href="#" id="exportJpg" (click)="exportJPG()">JPG</a></i
|
|
56
|
+
>
|
|
57
|
+
</div>`,
|
|
58
|
+
}]
|
|
59
|
+
}], propDecorators: { showLabel: [{
|
|
60
|
+
type: Input
|
|
61
|
+
}], label: [{
|
|
62
|
+
type: Input
|
|
63
|
+
}], margins: [{
|
|
64
|
+
type: Input
|
|
65
|
+
}], svgOptions: [{
|
|
66
|
+
type: Input
|
|
67
|
+
}], imageOptions: [{
|
|
68
|
+
type: Input
|
|
69
|
+
}], allowSvgExport: [{
|
|
70
|
+
type: Input
|
|
71
|
+
}], allowPngExport: [{
|
|
72
|
+
type: Input
|
|
73
|
+
}], allowJpgExport: [{
|
|
74
|
+
type: Input
|
|
75
|
+
}] } });
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { ChangeDetectorRef, ElementRef, Input, inject, Directive, } from "@angular/core";
|
|
2
|
+
import { Inspector, Edge, Node, Group, Port } from "@visuallyjs/browser-ui";
|
|
3
|
+
import { VisuallyJsService } from "./vjs-service";
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
|
|
6
|
+
export class InspectorComponent {
|
|
7
|
+
constructor() {
|
|
8
|
+
|
|
9
|
+
this.currentType = "";
|
|
10
|
+
|
|
11
|
+
this.currentObjectType = "";
|
|
12
|
+
|
|
13
|
+
this.EDGE = Edge.objectType;
|
|
14
|
+
|
|
15
|
+
this.NODE = Node.objectType;
|
|
16
|
+
|
|
17
|
+
this.GROUP = Group.objectType;
|
|
18
|
+
|
|
19
|
+
this.PORT = Port.objectType;
|
|
20
|
+
|
|
21
|
+
this.context = {};
|
|
22
|
+
|
|
23
|
+
this.changeDetector = inject(ChangeDetectorRef);
|
|
24
|
+
|
|
25
|
+
this.el = inject(ElementRef);
|
|
26
|
+
// new
|
|
27
|
+
this.$vjs = inject(VisuallyJsService);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
ngAfterViewInit() {
|
|
31
|
+
this.$vjs.getUI((ui) => {
|
|
32
|
+
this.ui = ui;
|
|
33
|
+
this.inspector = new Inspector({
|
|
34
|
+
context: this.context,
|
|
35
|
+
container: this.el.nativeElement,
|
|
36
|
+
cssClass: this.cssClass,
|
|
37
|
+
showCloseButton: this.showCloseButton,
|
|
38
|
+
ui,
|
|
39
|
+
renderEmptyContainer: () => {
|
|
40
|
+
this.reset();
|
|
41
|
+
this.changeDetector.detectChanges();
|
|
42
|
+
},
|
|
43
|
+
refresh: (obj, cb) => {
|
|
44
|
+
this.currentObj = obj;
|
|
45
|
+
this.refresh(obj);
|
|
46
|
+
setTimeout(cb, 0);
|
|
47
|
+
this.changeDetector.detectChanges();
|
|
48
|
+
},
|
|
49
|
+
afterUpdate: () => this.afterUpdate(ui),
|
|
50
|
+
});
|
|
51
|
+
this.$vjs.$setInspector(this.inspector);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
refresh(obj) {
|
|
56
|
+
this.currentType = obj.data.type;
|
|
57
|
+
this.currentObjectType = obj.objectType;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
reset() {
|
|
61
|
+
this.currentType = "";
|
|
62
|
+
this.currentObjectType = '';
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
afterUpdate(ui) { }
|
|
66
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InspectorComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
67
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: InspectorComponent, inputs: { cssClass: "cssClass", showCloseButton: "showCloseButton", context: "context" }, ngImport: i0 }); }
|
|
68
|
+
}
|
|
69
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InspectorComponent, decorators: [{
|
|
70
|
+
type: Directive
|
|
71
|
+
}], propDecorators: { cssClass: [{
|
|
72
|
+
type: Input
|
|
73
|
+
}], showCloseButton: [{
|
|
74
|
+
type: Input
|
|
75
|
+
}], context: [{
|
|
76
|
+
type: Input
|
|
77
|
+
}] } });
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Component, ElementRef, inject, Input } from "@angular/core";
|
|
2
|
+
import { MiniviewPlugin } from "@visuallyjs/browser-ui";
|
|
3
|
+
import { VisuallyJsService } from "./vjs-service";
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
|
|
6
|
+
export class MiniviewComponent {
|
|
7
|
+
constructor(ngZone) {
|
|
8
|
+
this.ngZone = ngZone;
|
|
9
|
+
|
|
10
|
+
this.activeTracking = true;
|
|
11
|
+
|
|
12
|
+
this.clickToCenter = true;
|
|
13
|
+
this.$el = inject(ElementRef);
|
|
14
|
+
this.$vjs = inject(VisuallyJsService);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
ngAfterViewInit() {
|
|
18
|
+
this.ngZone.runOutsideAngular(() => {
|
|
19
|
+
// this.$service.addMiniview(this.surfaceId, {
|
|
20
|
+
// container: this.el.nativeElement.childNodes[0],
|
|
21
|
+
// elementFilter: this.elementFilter,
|
|
22
|
+
// typeFunction: this.typeFunction,
|
|
23
|
+
// activeTracking: this.activeTracking,
|
|
24
|
+
// clickToCenter: this.clickToCenter !== false
|
|
25
|
+
// })
|
|
26
|
+
this.$vjs.getUI((b) => {
|
|
27
|
+
this.$miniview = b.addPlugin({
|
|
28
|
+
type: MiniviewPlugin.type,
|
|
29
|
+
options: {
|
|
30
|
+
container: this.$el.nativeElement.childNodes[0],
|
|
31
|
+
elementFilter: this.elementFilter,
|
|
32
|
+
typeFunction: this.typeFunction,
|
|
33
|
+
activeTracking: this.activeTracking,
|
|
34
|
+
clickToCenter: this.clickToCenter !== false
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
redraw() {
|
|
42
|
+
if (this.$miniview != null) {
|
|
43
|
+
this.$miniview.invalidate();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MiniviewComponent, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
47
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: MiniviewComponent, selector: "vjs-miniview", inputs: { elementFilter: "elementFilter", typeFunction: "typeFunction", activeTracking: "activeTracking", clickToCenter: "clickToCenter" }, ngImport: i0, template: `<div></div>`, isInline: true }); }
|
|
48
|
+
}
|
|
49
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MiniviewComponent, decorators: [{
|
|
50
|
+
type: Component,
|
|
51
|
+
args: [{
|
|
52
|
+
selector: 'vjs-miniview',
|
|
53
|
+
template: `<div></div>`
|
|
54
|
+
}]
|
|
55
|
+
}], ctorParameters: function () { return [{ type: i0.NgZone }]; }, propDecorators: { elementFilter: [{
|
|
56
|
+
type: Input
|
|
57
|
+
}], typeFunction: [{
|
|
58
|
+
type: Input
|
|
59
|
+
}], activeTracking: [{
|
|
60
|
+
type: Input
|
|
61
|
+
}], clickToCenter: [{
|
|
62
|
+
type: Input
|
|
63
|
+
}] } });
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BrowserUIModel, log } from "@visuallyjs/browser-ui";
|
|
2
|
+
|
|
3
|
+
export class BrowserUIAngularModel extends BrowserUIModel {
|
|
4
|
+
render(container, options) {
|
|
5
|
+
log("render called directly on BrowserUIAngularModel class: should not happen. UI should use internal render.");
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ChangeDetectorRef, inject } from "@angular/core";
|
|
2
|
+
|
|
3
|
+
export const AngularComponentOverlayType = "AngularComponent";
|
|
4
|
+
|
|
5
|
+
export class BaseAngularOverlayComponent {
|
|
6
|
+
constructor() {
|
|
7
|
+
|
|
8
|
+
this.changeDetectorRef = inject(ChangeDetectorRef);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
updateEdge(updates) {
|
|
12
|
+
this.model.updateEdge(this.edge, updates);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
removeEdge() {
|
|
16
|
+
this.model.removeEdge(this.edge);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Directive, ElementRef, inject, Input } from "@angular/core";
|
|
2
|
+
import { Palette, } from "@visuallyjs/browser-ui";
|
|
3
|
+
import { VisuallyJsService } from "./vjs-service";
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
|
|
6
|
+
export class PaletteComponent {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.$vjs = inject(VisuallyJsService);
|
|
9
|
+
this.$el = inject(ElementRef);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
ngAfterViewInit() {
|
|
13
|
+
this.$vjs.getSurface((surface) => {
|
|
14
|
+
let self = this;
|
|
15
|
+
let params = {
|
|
16
|
+
source: self.$el.nativeElement,
|
|
17
|
+
selector: self.selector,
|
|
18
|
+
allowDropOnEdge: this.allowDropOnEdge,
|
|
19
|
+
allowDropOnCanvas: this.allowDropOnCanvas,
|
|
20
|
+
allowDropOnGroup: this.allowDropOnGroup,
|
|
21
|
+
allowDropOnNode: this.allowDropOnNode,
|
|
22
|
+
mode: this.mode,
|
|
23
|
+
selectAfterAdd: this.selectAfterAdd,
|
|
24
|
+
allowClickToAdd: this.allowClickToAdd,
|
|
25
|
+
clickToAddOnly: this.clickToAddOnly
|
|
26
|
+
};
|
|
27
|
+
if (this.dataGenerator != null) {
|
|
28
|
+
params.dataGenerator = this.dataGenerator;
|
|
29
|
+
}
|
|
30
|
+
if (this.typeGenerator != null) {
|
|
31
|
+
params.typeGenerator = this.typeGenerator;
|
|
32
|
+
}
|
|
33
|
+
if (this.groupIdentifier != null) {
|
|
34
|
+
params.groupIdentifier = this.groupIdentifier;
|
|
35
|
+
}
|
|
36
|
+
if (this.onVertexAdded != null) {
|
|
37
|
+
params.onVertexAdded = this.onVertexAdded;
|
|
38
|
+
}
|
|
39
|
+
if (this.dragSize != null) {
|
|
40
|
+
params.dragSize = this.dragSize;
|
|
41
|
+
}
|
|
42
|
+
if (this.canvasDropFilter != null) {
|
|
43
|
+
params.canvasDropFilter = this.canvasDropFilter;
|
|
44
|
+
}
|
|
45
|
+
this.palette = new Palette(surface, params);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PaletteComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
49
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: PaletteComponent, selector: "[vjs-palette]", inputs: { selector: "selector", dataGenerator: "dataGenerator", typeGenerator: "typeGenerator", groupIdentifier: "groupIdentifier", allowDropOnEdge: "allowDropOnEdge", allowDropOnGroup: "allowDropOnGroup", allowDropOnCanvas: "allowDropOnCanvas", allowDropOnNode: "allowDropOnNode", onVertexAdded: "onVertexAdded", dragSize: "dragSize", canvasDropFilter: "canvasDropFilter", mode: "mode", selectAfterAdd: "selectAfterAdd", allowClickToAdd: "allowClickToAdd", clickToAddOnly: "clickToAddOnly" }, ngImport: i0 }); }
|
|
50
|
+
}
|
|
51
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PaletteComponent, decorators: [{
|
|
52
|
+
type: Directive,
|
|
53
|
+
args: [{
|
|
54
|
+
selector: "[vjs-palette]",
|
|
55
|
+
}]
|
|
56
|
+
}], propDecorators: { selector: [{
|
|
57
|
+
type: Input
|
|
58
|
+
}], dataGenerator: [{
|
|
59
|
+
type: Input
|
|
60
|
+
}], typeGenerator: [{
|
|
61
|
+
type: Input
|
|
62
|
+
}], groupIdentifier: [{
|
|
63
|
+
type: Input
|
|
64
|
+
}], allowDropOnEdge: [{
|
|
65
|
+
type: Input
|
|
66
|
+
}], allowDropOnGroup: [{
|
|
67
|
+
type: Input
|
|
68
|
+
}], allowDropOnCanvas: [{
|
|
69
|
+
type: Input
|
|
70
|
+
}], allowDropOnNode: [{
|
|
71
|
+
type: Input
|
|
72
|
+
}], onVertexAdded: [{
|
|
73
|
+
type: Input
|
|
74
|
+
}], dragSize: [{
|
|
75
|
+
type: Input
|
|
76
|
+
}], canvasDropFilter: [{
|
|
77
|
+
type: Input
|
|
78
|
+
}], mode: [{
|
|
79
|
+
type: Input
|
|
80
|
+
}], selectAfterAdd: [{
|
|
81
|
+
type: Input
|
|
82
|
+
}], allowClickToAdd: [{
|
|
83
|
+
type: Input
|
|
84
|
+
}], clickToAddOnly: [{
|
|
85
|
+
type: Input
|
|
86
|
+
}] } });
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Component, ElementRef, inject, Input, } from "@angular/core";
|
|
2
|
+
import { DEFAULT_LABEL_FILL_RATIO, convertToMultilineText } from "@visuallyjs/browser-ui";
|
|
3
|
+
import { VisuallyJsService } from "./vjs-service";
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
|
|
6
|
+
export class ShapeComponent {
|
|
7
|
+
constructor() {
|
|
8
|
+
|
|
9
|
+
this.showLabels = false;
|
|
10
|
+
|
|
11
|
+
this.labelProperty = "label";
|
|
12
|
+
|
|
13
|
+
this.multilineLabels = true;
|
|
14
|
+
|
|
15
|
+
this.labelFillRatio = DEFAULT_LABEL_FILL_RATIO;
|
|
16
|
+
this.$el = inject(ElementRef);
|
|
17
|
+
this.$vjs = inject(VisuallyJsService);
|
|
18
|
+
}
|
|
19
|
+
_render() {
|
|
20
|
+
if (this.shapeLibrary != null) {
|
|
21
|
+
const svg = this.$el.nativeElement.childNodes[0];
|
|
22
|
+
const el = this.shapeLibrary.renderCompiledShape(this.obj, this.obj.outlineWidth || 2);
|
|
23
|
+
svg.replaceChildren(el);
|
|
24
|
+
if (this.showLabels) {
|
|
25
|
+
const lbl = this.shapeLibrary.renderShapeLabel(this.obj, this.labelProperty, this.labelStrokeWidth, this.label, this.obj.color || "#000000", this.obj.color || "#000000", this.font);
|
|
26
|
+
svg.appendChild(lbl);
|
|
27
|
+
if (this.multilineLabels !== false) {
|
|
28
|
+
convertToMultilineText(lbl, this.label || this.obj[this.labelProperty] || "", this.width * this.labelFillRatio);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
ngAfterViewInit() {
|
|
34
|
+
this.$vjs.getUI((b) => {
|
|
35
|
+
this.shapeLibrary = b.getShapeLibrary();
|
|
36
|
+
this._render();
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
ngOnChanges(changes) {
|
|
40
|
+
this._render();
|
|
41
|
+
}
|
|
42
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ShapeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
43
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ShapeComponent, selector: "vjs-shape", inputs: { obj: "obj", width: "width", height: "height", showLabels: "showLabels", labelProperty: "labelProperty", labelStrokeWidth: "labelStrokeWidth", label: "label", multilineLabels: "multilineLabels", labelFillRatio: "labelFillRatio", font: "font" }, usesOnChanges: true, ngImport: i0, template: `<svg:svg
|
|
44
|
+
[attr.stroke-width]="obj.outlineWidth || 2"
|
|
45
|
+
attr.fill="{{ obj.fill }}"
|
|
46
|
+
attr.stroke="{{ obj.outline }}"
|
|
47
|
+
style="width:100%;height:100%;inset:0;position:absolute;"
|
|
48
|
+
preserveAspectRatio="none"
|
|
49
|
+
attr.viewBox="0 0 {{ width }} {{ height }}"
|
|
50
|
+
></svg:svg>`, isInline: true }); }
|
|
51
|
+
}
|
|
52
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ShapeComponent, decorators: [{
|
|
53
|
+
type: Component,
|
|
54
|
+
args: [{
|
|
55
|
+
template: `<svg:svg
|
|
56
|
+
[attr.stroke-width]="obj.outlineWidth || 2"
|
|
57
|
+
attr.fill="{{ obj.fill }}"
|
|
58
|
+
attr.stroke="{{ obj.outline }}"
|
|
59
|
+
style="width:100%;height:100%;inset:0;position:absolute;"
|
|
60
|
+
preserveAspectRatio="none"
|
|
61
|
+
attr.viewBox="0 0 {{ width }} {{ height }}"
|
|
62
|
+
></svg:svg>`,
|
|
63
|
+
selector: `vjs-shape`,
|
|
64
|
+
}]
|
|
65
|
+
}], propDecorators: { obj: [{
|
|
66
|
+
type: Input
|
|
67
|
+
}], width: [{
|
|
68
|
+
type: Input
|
|
69
|
+
}], height: [{
|
|
70
|
+
type: Input
|
|
71
|
+
}], showLabels: [{
|
|
72
|
+
type: Input
|
|
73
|
+
}], labelProperty: [{
|
|
74
|
+
type: Input
|
|
75
|
+
}], labelStrokeWidth: [{
|
|
76
|
+
type: Input
|
|
77
|
+
}], label: [{
|
|
78
|
+
type: Input
|
|
79
|
+
}], multilineLabels: [{
|
|
80
|
+
type: Input
|
|
81
|
+
}], labelFillRatio: [{
|
|
82
|
+
type: Input
|
|
83
|
+
}], font: [{
|
|
84
|
+
type: Input
|
|
85
|
+
}] } });
|