@visuallyjs/browser-ui-angular 1.1.3 → 1.2.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/index.mjs +3 -0
- package/esm2022/lib/charts/area.chart.component.mjs +8 -36
- package/esm2022/lib/charts/bar.chart.component.mjs +8 -36
- package/esm2022/lib/charts/bubble.chart.component.mjs +8 -36
- package/esm2022/lib/charts/column.chart.component.mjs +8 -36
- package/esm2022/lib/charts/line.chart.component.mjs +8 -36
- package/esm2022/lib/charts/pie.chart.component.mjs +8 -36
- package/esm2022/lib/charts/sankey.chart.component.mjs +12 -8
- package/esm2022/lib/charts/scatter.chart.component.mjs +8 -36
- package/esm2022/lib/charts/series.based.chart.component.mjs +54 -0
- package/esm2022/lib/charts/xy.chart.component.mjs +10 -22
- package/esm2022/lib/color.tag.component.mjs +33 -27
- package/esm2022/lib/controls-component.mjs +48 -44
- package/esm2022/lib/diagram-palette-component.mjs +37 -32
- package/esm2022/lib/edge.type.picker.component.mjs +23 -18
- package/esm2022/lib/export-controls-component.mjs +7 -9
- package/esm2022/lib/hooks/use-visuallyjs-update.mjs +21 -0
- package/esm2022/lib/hooks/use-zoom.mjs +24 -0
- package/esm2022/lib/inspector.component.mjs +29 -27
- package/esm2022/lib/miniview-component.mjs +33 -25
- package/esm2022/lib/palette.component.mjs +42 -37
- package/esm2022/lib/shape.component.mjs +20 -18
- package/esm2022/lib/shape.palette.component.mjs +25 -21
- package/esm2022/lib/surface-component.mjs +7 -5
- package/esm2022/lib/vjs-service.mjs +35 -1
- package/fesm2022/visuallyjs-browser-ui-angular.mjs +466 -503
- package/fesm2022/visuallyjs-browser-ui-angular.mjs.map +1 -1
- package/index.d.ts +3 -0
- package/lib/charts/area.chart.component.d.ts +10 -15
- package/lib/charts/bar.chart.component.d.ts +9 -15
- package/lib/charts/bubble.chart.component.d.ts +12 -15
- package/lib/charts/column.chart.component.d.ts +12 -15
- package/lib/charts/line.chart.component.d.ts +16 -17
- package/lib/charts/pie.chart.component.d.ts +9 -15
- package/lib/charts/sankey.chart.component.d.ts +5 -0
- package/lib/charts/scatter.chart.component.d.ts +9 -15
- package/lib/charts/series.based.chart.component.d.ts +44 -0
- package/lib/charts/xy.chart.component.d.ts +13 -11
- package/lib/color.tag.component.d.ts +5 -5
- package/lib/controls-component.d.ts +6 -4
- package/lib/diagram-palette-component.d.ts +8 -2
- package/lib/edge.type.picker.component.d.ts +5 -5
- package/lib/export-controls-component.d.ts +6 -6
- package/lib/hooks/use-visuallyjs-update.d.ts +21 -0
- package/lib/hooks/use-zoom.d.ts +6 -0
- package/lib/inspector.component.d.ts +6 -7
- package/lib/miniview-component.d.ts +17 -9
- package/lib/palette.component.d.ts +5 -6
- package/lib/shape.component.d.ts +5 -5
- package/lib/shape.palette.component.d.ts +5 -3
- package/lib/surface-component.d.ts +5 -1
- package/lib/vjs-service.d.ts +41 -0
- package/package.json +2 -2
- package/visuallyjs-browser-ui-angular.tgz +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChangeDetectorRef, Component, ElementRef, inject, Input
|
|
1
|
+
import { ChangeDetectorRef, Component, computed, effect, ElementRef, inject, Input } from "@angular/core";
|
|
2
2
|
import { EVENT_UNDOREDO_UPDATE, EVENT_SURFACE_MODE_CHANGED, FALSE, TRUE, SURFACE_MODE_PAN, SURFACE_MODE_SELECT, LASSO_PATH, LASSO_VIEW_BOX, PAN_PATH, PAN_VIEW_BOX, LassoPlugin, ZOOM_TO_FIT_VIEW_BOX, ZOOM_TO_FIT_PATH, ZOOM_IN_OUT_VIEW_BOX, ZOOM_IN_PATH, ZOOM_OUT_PATH, RESET_SELECTION_PATH, RESET_SELECTION_VIEW_BOX, CLEAR_PATH, CLEAR_VIEW_BOX, CLASS_CONTROLS_RESET_SELECTION, EVENT_SELECT, EVENT_DESELECT, EVENT_SELECTION_CLEARED, supportsPathEditing } from "@visuallyjs/browser-ui";
|
|
3
3
|
import { VisuallyJsService } from "./vjs-service";
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
@@ -9,6 +9,15 @@ const CLASS_SELECTED_MODE = "vjs-selected-mode";
|
|
|
9
9
|
const ATTRIBUTE_HAS_SELECTION = "vjs-controls-has-selection";
|
|
10
10
|
|
|
11
11
|
export class ControlsComponent {
|
|
12
|
+
updateSelectionState() {
|
|
13
|
+
const controls = this.getNativeElement(this.$el);
|
|
14
|
+
if (this.ui().model.getSelection().isEmpty()) {
|
|
15
|
+
controls.removeAttribute(ATTRIBUTE_HAS_SELECTION);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
controls.setAttribute(ATTRIBUTE_HAS_SELECTION, "true");
|
|
19
|
+
}
|
|
20
|
+
}
|
|
12
21
|
constructor() {
|
|
13
22
|
|
|
14
23
|
this.undoRedo = true;
|
|
@@ -24,43 +33,37 @@ export class ControlsComponent {
|
|
|
24
33
|
this.buttons = [];
|
|
25
34
|
|
|
26
35
|
this.orientation = "row";
|
|
36
|
+
this.initialized = false;
|
|
27
37
|
this.showPanButton = true;
|
|
28
38
|
this.showLassoButton = true;
|
|
29
39
|
this.$vjs = inject(VisuallyJsService);
|
|
30
40
|
this.$el = inject(ElementRef);
|
|
31
41
|
this.$cdr = inject(ChangeDetectorRef);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const controls = this.getNativeElement(this.$el);
|
|
35
|
-
if (this.ui.model.getSelection().isEmpty()) {
|
|
36
|
-
controls.removeAttribute(ATTRIBUTE_HAS_SELECTION);
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
controls.setAttribute(ATTRIBUTE_HAS_SELECTION, "true");
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
ngOnInit() {
|
|
42
|
+
this.ui = this.$vjs.ui;
|
|
43
|
+
this.model = computed(() => this.ui()?.model);
|
|
43
44
|
this.modeButtons = this.buttons.filter((b) => b.mode != null);
|
|
44
45
|
this.otherButtons = this.buttons.filter((b) => b.mode == null);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
this.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
46
|
+
effect(() => {
|
|
47
|
+
const ui = this.ui();
|
|
48
|
+
if (!this.initialized && ui) {
|
|
49
|
+
this.showLassoButton = ui.getPlugin(LassoPlugin.type) != null;
|
|
50
|
+
this.showPanButton = this.showLassoButton === true;
|
|
51
|
+
this.ui.bind(EVENT_SURFACE_MODE_CHANGED, (mode) => {
|
|
52
|
+
const controls = this.getNativeElement(this.$el);
|
|
53
|
+
const modeButtons = ui.$getSelector(controls, "[data-mode]");
|
|
54
|
+
ui.removeClass(modeButtons, CLASS_SELECTED_MODE);
|
|
55
|
+
ui.addClass(ui.$getSelector(controls, `[data-mode='${mode}']`), CLASS_SELECTED_MODE);
|
|
56
|
+
});
|
|
57
|
+
ui.model.bind(EVENT_UNDOREDO_UPDATE, (state) => {
|
|
58
|
+
const controls = this.getNativeElement(this.$el);
|
|
59
|
+
controls.setAttribute(ATTRIBUTE_CAN_UNDO, state.undoCount > 0 ? TRUE : FALSE);
|
|
60
|
+
controls.setAttribute(ATTRIBUTE_CAN_REDO, state.redoCount > 0 ? TRUE : FALSE);
|
|
61
|
+
});
|
|
62
|
+
ui.model.bind(EVENT_SELECT, () => this.updateSelectionState());
|
|
63
|
+
ui.model.bind(EVENT_DESELECT, () => this.updateSelectionState());
|
|
64
|
+
ui.model.bind(EVENT_SELECTION_CLEARED, () => this.updateSelectionState());
|
|
65
|
+
this.$cdr.detectChanges();
|
|
66
|
+
}
|
|
64
67
|
});
|
|
65
68
|
}
|
|
66
69
|
getNativeElement(component) {
|
|
@@ -69,35 +72,36 @@ export class ControlsComponent {
|
|
|
69
72
|
component.location.nativeElement).childNodes[0];
|
|
70
73
|
}
|
|
71
74
|
panMode() {
|
|
72
|
-
this.ui.setMode(SURFACE_MODE_PAN);
|
|
75
|
+
this.ui().setMode(SURFACE_MODE_PAN);
|
|
73
76
|
}
|
|
74
77
|
selectMode() {
|
|
75
|
-
this.ui.setMode(SURFACE_MODE_SELECT);
|
|
78
|
+
this.ui().setMode(SURFACE_MODE_SELECT);
|
|
76
79
|
}
|
|
77
80
|
zoomToFit() {
|
|
78
|
-
this.
|
|
79
|
-
this.ui.zoomToFit();
|
|
81
|
+
this.model().clearSelection();
|
|
82
|
+
this.ui().zoomToFit();
|
|
80
83
|
}
|
|
81
84
|
zoomIn() {
|
|
82
|
-
this.ui.zoomIn();
|
|
85
|
+
this.ui().zoomIn();
|
|
83
86
|
}
|
|
84
87
|
zoomOut() {
|
|
85
|
-
this.ui.zoomOut();
|
|
88
|
+
this.ui().zoomOut();
|
|
86
89
|
}
|
|
87
90
|
resetSelection() {
|
|
88
|
-
this.ui
|
|
89
|
-
|
|
90
|
-
|
|
91
|
+
const ui = this.ui();
|
|
92
|
+
this.model().clearSelection();
|
|
93
|
+
if (supportsPathEditing(ui)) {
|
|
94
|
+
ui.stopEditingPath();
|
|
91
95
|
}
|
|
92
96
|
}
|
|
93
97
|
undo() {
|
|
94
|
-
this.
|
|
98
|
+
this.model()?.undo();
|
|
95
99
|
}
|
|
96
100
|
redo() {
|
|
97
|
-
this.
|
|
101
|
+
this.model()?.redo();
|
|
98
102
|
}
|
|
99
103
|
doClear() {
|
|
100
|
-
const t = this.
|
|
104
|
+
const t = this.model();
|
|
101
105
|
if ((t.getNodeCount() === 0 && t.getGroupCount() === 0) ||
|
|
102
106
|
confirm(this.clearMessage)) {
|
|
103
107
|
t.clear();
|
|
@@ -147,7 +151,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
147
151
|
<i *ngFor="let button of otherButtons" class="{{ button.class }}" title="{{ button.title }}"></i>
|
|
148
152
|
</div>`,
|
|
149
153
|
}]
|
|
150
|
-
}], propDecorators: { undoRedo: [{
|
|
154
|
+
}], ctorParameters: function () { return []; }, propDecorators: { undoRedo: [{
|
|
151
155
|
type: Input
|
|
152
156
|
}], zoomToExtents: [{
|
|
153
157
|
type: Input
|
|
@@ -1,45 +1,49 @@
|
|
|
1
1
|
import { DiagramPalette } from "@visuallyjs/browser-ui";
|
|
2
|
-
import { Component, ElementRef, inject, Input } from "@angular/core";
|
|
2
|
+
import { Component, effect, ElementRef, inject, Input } from "@angular/core";
|
|
3
3
|
import { VisuallyJsService } from "./vjs-service";
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
|
+
|
|
5
6
|
export class DiagramPaletteComponent {
|
|
7
|
+
$init(diagram) {
|
|
8
|
+
if (!this.initialized) {
|
|
9
|
+
|
|
10
|
+
new DiagramPalette(this.$el.nativeElement, diagram, {
|
|
11
|
+
fill: this.fill,
|
|
12
|
+
outline: this.outline,
|
|
13
|
+
dragSize: this.dragSize,
|
|
14
|
+
inspector: this.inspector,
|
|
15
|
+
iconSize: this.iconSize,
|
|
16
|
+
showLabels: this.showLabels,
|
|
17
|
+
paletteStrokeWidth: this.paletteStrokeWidth,
|
|
18
|
+
showAllMessage: this.showAllMessage,
|
|
19
|
+
onCellAdded: this.onCellAdded,
|
|
20
|
+
mode: this.mode,
|
|
21
|
+
allowClickToAdd: this.allowClickToAdd,
|
|
22
|
+
autoExitDrawMode: this.autoExitDrawMode,
|
|
23
|
+
selectAfterAdd: this.selectAfterAdd,
|
|
24
|
+
onVertexAdded: this.onVertexAdded,
|
|
25
|
+
preparedShapes: this.preparedShapes
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
6
29
|
constructor() {
|
|
7
30
|
this.$el = inject(ElementRef);
|
|
8
31
|
this.$vjs = inject(VisuallyJsService);
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
|
32
|
+
this.initialized = false;
|
|
33
|
+
effect(() => {
|
|
34
|
+
const d = this.$vjs.diagram();
|
|
35
|
+
if (d != null) {
|
|
36
|
+
this.$init(d);
|
|
37
|
+
}
|
|
28
38
|
});
|
|
29
39
|
}
|
|
30
40
|
ngAfterViewInit() {
|
|
31
|
-
if (this.
|
|
32
|
-
this.$init();
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
this.$vjs.getDiagram((d) => {
|
|
36
|
-
this.diagram = d;
|
|
37
|
-
this.$init();
|
|
38
|
-
});
|
|
41
|
+
if (this.inputDiagram != null) {
|
|
42
|
+
this.$init(this.inputDiagram);
|
|
39
43
|
}
|
|
40
44
|
}
|
|
41
45
|
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",
|
|
46
|
+
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", inputDiagram: ["diagram", "inputDiagram"], onVertexAdded: "onVertexAdded", preparedShapes: "preparedShapes" }, ngImport: i0, template: `<div></div>`, isInline: true }); }
|
|
43
47
|
}
|
|
44
48
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiagramPaletteComponent, decorators: [{
|
|
45
49
|
type: Component,
|
|
@@ -47,7 +51,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
47
51
|
selector: "vjs-diagram-palette",
|
|
48
52
|
template: `<div></div>`,
|
|
49
53
|
}]
|
|
50
|
-
}], propDecorators: { fill: [{
|
|
54
|
+
}], ctorParameters: function () { return []; }, propDecorators: { fill: [{
|
|
51
55
|
type: Input
|
|
52
56
|
}], outline: [{
|
|
53
57
|
type: Input
|
|
@@ -73,8 +77,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
73
77
|
type: Input
|
|
74
78
|
}], selectAfterAdd: [{
|
|
75
79
|
type: Input
|
|
76
|
-
}],
|
|
77
|
-
type: Input
|
|
80
|
+
}], inputDiagram: [{
|
|
81
|
+
type: Input,
|
|
82
|
+
args: [{ alias: "diagram" }]
|
|
78
83
|
}], onVertexAdded: [{
|
|
79
84
|
type: Input
|
|
80
85
|
}], preparedShapes: [{
|
|
@@ -1,31 +1,36 @@
|
|
|
1
|
-
import { Component, Input, Output, EventEmitter, inject } from "@angular/core";
|
|
1
|
+
import { Component, Input, Output, EventEmitter, inject, effect } from "@angular/core";
|
|
2
2
|
import { INSPECTOR_CONTEXT_EDGE_PROPERTY_MAPPINGS, EdgeTypePicker } from "@visuallyjs/browser-ui";
|
|
3
3
|
import { VisuallyJsService } from "./vjs-service";
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
|
|
6
6
|
export class EdgeTypePickerComponent {
|
|
7
|
+
resolveMappings() {
|
|
8
|
+
const mappings = this.edgeMappings || this._inspector().getFromContext(INSPECTOR_CONTEXT_EDGE_PROPERTY_MAPPINGS);
|
|
9
|
+
return mappings || this._inspector().$ui.$getEdgePropertyMappings();
|
|
10
|
+
}
|
|
7
11
|
constructor(el) {
|
|
8
12
|
this.el = el;
|
|
9
13
|
|
|
10
14
|
this.changeEvent = new EventEmitter();
|
|
11
15
|
this.$vjs = inject(VisuallyJsService);
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
this._inspector = this.$vjs.inspector;
|
|
17
|
+
this.initialised = false;
|
|
18
|
+
effect(() => {
|
|
19
|
+
if (!this.initialised) {
|
|
20
|
+
const inspector = this._inspector();
|
|
21
|
+
if (inspector != null) {
|
|
22
|
+
this.initialised = true;
|
|
23
|
+
inspector.onChange(() => {
|
|
24
|
+
this.edgeTypePicker.select(this.propertyName, inspector.getValue(this.propertyName));
|
|
25
|
+
});
|
|
26
|
+
const current = inspector.getValue(this.propertyName) || '';
|
|
27
|
+
this.edgeTypePicker = new EdgeTypePicker(inspector.$ui, this.el.nativeElement, this.resolveMappings(), current, (p, v) => {
|
|
28
|
+
inspector.setValue(this.propertyName, v);
|
|
29
|
+
this.changeEvent.emit(v);
|
|
30
|
+
});
|
|
31
|
+
this.edgeTypePicker.render(this.propertyName, inspector._currentCommonData);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
29
34
|
});
|
|
30
35
|
}
|
|
31
36
|
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 }); }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, ElementRef, inject, Input, } from "@angular/core";
|
|
1
|
+
import { Component, computed, ElementRef, inject, Input, } from "@angular/core";
|
|
2
2
|
import { CLASS_CONTROLS, CLASS_EXPORT_CONTROLS, ImageExportUI, SvgExportUI, } from "@visuallyjs/browser-ui";
|
|
3
3
|
import { VisuallyJsService } from "./vjs-service";
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
@@ -19,20 +19,18 @@ export class ExportControlsComponent {
|
|
|
19
19
|
// new
|
|
20
20
|
this.$vjs = inject(VisuallyJsService);
|
|
21
21
|
this.$el = inject(ElementRef);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
this
|
|
25
|
-
this.ui = b;
|
|
26
|
-
});
|
|
22
|
+
|
|
23
|
+
this.ui = this.$vjs.ui;
|
|
24
|
+
this.model = computed(() => this.ui()?.model);
|
|
27
25
|
}
|
|
28
26
|
exportSVG() {
|
|
29
|
-
new SvgExportUI(this.ui).export(this.svgOptions);
|
|
27
|
+
new SvgExportUI(this.ui()).export(this.svgOptions);
|
|
30
28
|
}
|
|
31
29
|
exportPNG() {
|
|
32
|
-
new ImageExportUI(this.ui).export(this.imageOptions);
|
|
30
|
+
new ImageExportUI(this.ui()).export(this.imageOptions);
|
|
33
31
|
}
|
|
34
32
|
exportJPG() {
|
|
35
|
-
new ImageExportUI(this.ui).export(Object.assign(this.imageOptions || {}, {
|
|
33
|
+
new ImageExportUI(this.ui()).export(Object.assign(this.imageOptions || {}, {
|
|
36
34
|
type: "image/jpeg",
|
|
37
35
|
}));
|
|
38
36
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { EVENT_DATA_UPDATED, EVENT_GRAPH_CLEARED } from "@visuallyjs/browser-ui";
|
|
2
|
+
import { effect, inject } from "@angular/core";
|
|
3
|
+
import { VisuallyJsService } from "../vjs-service";
|
|
4
|
+
|
|
5
|
+
export function useVisuallyJsUpdate(callback) {
|
|
6
|
+
const $vjs = inject(VisuallyJsService);
|
|
7
|
+
effect(() => {
|
|
8
|
+
const m = $vjs.model();
|
|
9
|
+
if (m != null) {
|
|
10
|
+
const fn = () => callback(m);
|
|
11
|
+
m.bind(EVENT_DATA_UPDATED, fn);
|
|
12
|
+
m.bind(EVENT_GRAPH_CLEARED, fn);
|
|
13
|
+
fn();
|
|
14
|
+
return (() => {
|
|
15
|
+
m.unbind(EVENT_DATA_UPDATED, fn);
|
|
16
|
+
m.unbind(EVENT_GRAPH_CLEARED, fn);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { EVENT_ZOOM } from "@visuallyjs/browser-ui";
|
|
2
|
+
import { effect, signal, inject } from "@angular/core";
|
|
3
|
+
import { VisuallyJsService } from "../vjs-service";
|
|
4
|
+
|
|
5
|
+
export function useZoom() {
|
|
6
|
+
const $vjs = inject(VisuallyJsService);
|
|
7
|
+
const surface = $vjs.surface;
|
|
8
|
+
const zoom = signal(1);
|
|
9
|
+
effect(() => {
|
|
10
|
+
const s = surface();
|
|
11
|
+
if (s != null) {
|
|
12
|
+
const zoomListener = (p) => {
|
|
13
|
+
zoom.set(p.zoom);
|
|
14
|
+
};
|
|
15
|
+
s.bind(EVENT_ZOOM, zoomListener);
|
|
16
|
+
zoom.set(s.getZoom());
|
|
17
|
+
return () => {
|
|
18
|
+
s.unbind(EVENT_ZOOM, zoomListener);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
return;
|
|
22
|
+
});
|
|
23
|
+
return zoom;
|
|
24
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChangeDetectorRef, ElementRef, Input, inject, Directive, } from "@angular/core";
|
|
1
|
+
import { ChangeDetectorRef, ElementRef, Input, inject, Directive, computed, effect, } from "@angular/core";
|
|
2
2
|
import { Inspector, Edge, Node, Group, Port } from "@visuallyjs/browser-ui";
|
|
3
3
|
import { VisuallyJsService } from "./vjs-service";
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
@@ -23,32 +23,34 @@ export class InspectorComponent {
|
|
|
23
23
|
this.changeDetector = inject(ChangeDetectorRef);
|
|
24
24
|
|
|
25
25
|
this.el = inject(ElementRef);
|
|
26
|
-
// new
|
|
27
26
|
this.$vjs = inject(VisuallyJsService);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
this.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
27
|
+
this.ui = this.$vjs.ui;
|
|
28
|
+
this.model = computed(() => this.ui()?.model);
|
|
29
|
+
this.initialized = false;
|
|
30
|
+
effect(() => {
|
|
31
|
+
const ui = this.ui();
|
|
32
|
+
if (!this.initialized && ui != null) {
|
|
33
|
+
this.initialized = true;
|
|
34
|
+
this.inspector = new Inspector({
|
|
35
|
+
context: this.context,
|
|
36
|
+
container: this.el.nativeElement,
|
|
37
|
+
cssClass: this.cssClass,
|
|
38
|
+
showCloseButton: this.showCloseButton,
|
|
39
|
+
ui,
|
|
40
|
+
renderEmptyContainer: () => {
|
|
41
|
+
this.reset();
|
|
42
|
+
this.changeDetector.detectChanges();
|
|
43
|
+
},
|
|
44
|
+
refresh: (obj, cb) => {
|
|
45
|
+
this.currentObj = obj;
|
|
46
|
+
this.refresh(obj);
|
|
47
|
+
setTimeout(cb, 0);
|
|
48
|
+
this.changeDetector.detectChanges();
|
|
49
|
+
},
|
|
50
|
+
afterUpdate: () => this.afterUpdate(ui),
|
|
51
|
+
});
|
|
52
|
+
this.$vjs.$setInspector(this.inspector);
|
|
53
|
+
}
|
|
52
54
|
});
|
|
53
55
|
}
|
|
54
56
|
|
|
@@ -68,7 +70,7 @@ export class InspectorComponent {
|
|
|
68
70
|
}
|
|
69
71
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InspectorComponent, decorators: [{
|
|
70
72
|
type: Directive
|
|
71
|
-
}], propDecorators: { cssClass: [{
|
|
73
|
+
}], ctorParameters: function () { return []; }, propDecorators: { cssClass: [{
|
|
72
74
|
type: Input
|
|
73
75
|
}], showCloseButton: [{
|
|
74
76
|
type: Input
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, ElementRef, inject, Input } from "@angular/core";
|
|
1
|
+
import { Component, effect, ElementRef, inject, Input } from "@angular/core";
|
|
2
2
|
import { MiniviewPlugin } from "@visuallyjs/browser-ui";
|
|
3
3
|
import { VisuallyJsService } from "./vjs-service";
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
@@ -10,31 +10,35 @@ export class MiniviewComponent {
|
|
|
10
10
|
this.activeTracking = true;
|
|
11
11
|
|
|
12
12
|
this.clickToCenter = true;
|
|
13
|
+
|
|
14
|
+
this.showLasso = true;
|
|
15
|
+
|
|
16
|
+
this.trackSelection = true;
|
|
13
17
|
this.$el = inject(ElementRef);
|
|
14
18
|
this.$vjs = inject(VisuallyJsService);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
19
|
+
this.$ui = this.$vjs.ui;
|
|
20
|
+
this.initialized = false;
|
|
21
|
+
effect(() => {
|
|
22
|
+
if (!this.initialized) {
|
|
23
|
+
const ui = this.$ui();
|
|
24
|
+
if (ui != null) {
|
|
25
|
+
this.initialized = true;
|
|
26
|
+
this.ngZone.runOutsideAngular(() => {
|
|
27
|
+
this.$miniview = ui.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,
|
|
35
|
+
showLasso: this.showLasso,
|
|
36
|
+
trackSelection: this.trackSelection
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
38
42
|
});
|
|
39
43
|
}
|
|
40
44
|
|
|
@@ -44,7 +48,7 @@ export class MiniviewComponent {
|
|
|
44
48
|
}
|
|
45
49
|
}
|
|
46
50
|
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 }); }
|
|
51
|
+
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", showLasso: "showLasso", trackSelection: "trackSelection" }, ngImport: i0, template: `<div></div>`, isInline: true }); }
|
|
48
52
|
}
|
|
49
53
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MiniviewComponent, decorators: [{
|
|
50
54
|
type: Component,
|
|
@@ -60,4 +64,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
60
64
|
type: Input
|
|
61
65
|
}], clickToCenter: [{
|
|
62
66
|
type: Input
|
|
67
|
+
}], showLasso: [{
|
|
68
|
+
type: Input
|
|
69
|
+
}], trackSelection: [{
|
|
70
|
+
type: Input
|
|
63
71
|
}] } });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Directive, ElementRef, inject, Input } from "@angular/core";
|
|
1
|
+
import { Directive, effect, ElementRef, inject, Input } from "@angular/core";
|
|
2
2
|
import { Palette, } from "@visuallyjs/browser-ui";
|
|
3
3
|
import { VisuallyJsService } from "./vjs-service";
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
@@ -7,42 +7,47 @@ export class PaletteComponent {
|
|
|
7
7
|
constructor() {
|
|
8
8
|
this.$vjs = inject(VisuallyJsService);
|
|
9
9
|
this.$el = inject(ElementRef);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
10
|
+
this.$surface = this.$vjs.surface;
|
|
11
|
+
this.initialized = false;
|
|
12
|
+
effect(() => {
|
|
13
|
+
if (!this.initialized) {
|
|
14
|
+
const surface = this.$surface();
|
|
15
|
+
if (surface != null) {
|
|
16
|
+
this.initialized = true;
|
|
17
|
+
let self = this;
|
|
18
|
+
let params = {
|
|
19
|
+
source: self.$el.nativeElement,
|
|
20
|
+
selector: self.selector,
|
|
21
|
+
allowDropOnEdge: this.allowDropOnEdge,
|
|
22
|
+
allowDropOnCanvas: this.allowDropOnCanvas,
|
|
23
|
+
allowDropOnGroup: this.allowDropOnGroup,
|
|
24
|
+
allowDropOnNode: this.allowDropOnNode,
|
|
25
|
+
mode: this.mode,
|
|
26
|
+
selectAfterAdd: this.selectAfterAdd,
|
|
27
|
+
allowClickToAdd: this.allowClickToAdd,
|
|
28
|
+
clickToAddOnly: this.clickToAddOnly
|
|
29
|
+
};
|
|
30
|
+
if (this.dataGenerator != null) {
|
|
31
|
+
params.dataGenerator = this.dataGenerator;
|
|
32
|
+
}
|
|
33
|
+
if (this.typeGenerator != null) {
|
|
34
|
+
params.typeGenerator = this.typeGenerator;
|
|
35
|
+
}
|
|
36
|
+
if (this.groupIdentifier != null) {
|
|
37
|
+
params.groupIdentifier = this.groupIdentifier;
|
|
38
|
+
}
|
|
39
|
+
if (this.onVertexAdded != null) {
|
|
40
|
+
params.onVertexAdded = this.onVertexAdded;
|
|
41
|
+
}
|
|
42
|
+
if (this.dragSize != null) {
|
|
43
|
+
params.dragSize = this.dragSize;
|
|
44
|
+
}
|
|
45
|
+
if (this.canvasDropFilter != null) {
|
|
46
|
+
params.canvasDropFilter = this.canvasDropFilter;
|
|
47
|
+
}
|
|
48
|
+
this.palette = new Palette(surface, params);
|
|
49
|
+
}
|
|
44
50
|
}
|
|
45
|
-
this.palette = new Palette(surface, params);
|
|
46
51
|
});
|
|
47
52
|
}
|
|
48
53
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PaletteComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
@@ -53,7 +58,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
53
58
|
args: [{
|
|
54
59
|
selector: "[vjs-palette]",
|
|
55
60
|
}]
|
|
56
|
-
}], propDecorators: { selector: [{
|
|
61
|
+
}], ctorParameters: function () { return []; }, propDecorators: { selector: [{
|
|
57
62
|
type: Input
|
|
58
63
|
}], dataGenerator: [{
|
|
59
64
|
type: Input
|