@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.
Files changed (75) hide show
  1. package/README.md +0 -0
  2. package/css/visuallyjs-angular.css +39 -0
  3. package/esm2022/index.mjs +34 -0
  4. package/esm2022/lib/base.group.component.mjs +43 -0
  5. package/esm2022/lib/base.node.component.mjs +41 -0
  6. package/esm2022/lib/base.port.component.mjs +71 -0
  7. package/esm2022/lib/base.vertex.component.mjs +75 -0
  8. package/esm2022/lib/browser-ui-angular.module.mjs +133 -0
  9. package/esm2022/lib/charts/area.chart.component.mjs +55 -0
  10. package/esm2022/lib/charts/bar.chart.component.mjs +55 -0
  11. package/esm2022/lib/charts/bubble.chart.component.mjs +55 -0
  12. package/esm2022/lib/charts/column.chart.component.mjs +55 -0
  13. package/esm2022/lib/charts/line.chart.component.mjs +55 -0
  14. package/esm2022/lib/charts/pie.chart.component.mjs +55 -0
  15. package/esm2022/lib/charts/sankey.chart.component.mjs +74 -0
  16. package/esm2022/lib/charts/scatter.chart.component.mjs +55 -0
  17. package/esm2022/lib/charts/xy.chart.component.mjs +39 -0
  18. package/esm2022/lib/color.tag.component.mjs +86 -0
  19. package/esm2022/lib/common.mjs +2 -0
  20. package/esm2022/lib/controls-component.mjs +164 -0
  21. package/esm2022/lib/decorator-component.mjs +52 -0
  22. package/esm2022/lib/default-group-component.mjs +18 -0
  23. package/esm2022/lib/default-node-component.mjs +18 -0
  24. package/esm2022/lib/diagram-component.mjs +53 -0
  25. package/esm2022/lib/diagram-palette-component.mjs +82 -0
  26. package/esm2022/lib/edge.type.picker.component.mjs +46 -0
  27. package/esm2022/lib/export-controls-component.mjs +75 -0
  28. package/esm2022/lib/inspector.component.mjs +77 -0
  29. package/esm2022/lib/miniview-component.mjs +63 -0
  30. package/esm2022/lib/model.mjs +8 -0
  31. package/esm2022/lib/overlay-component.mjs +18 -0
  32. package/esm2022/lib/palette.component.mjs +86 -0
  33. package/esm2022/lib/shape.component.mjs +85 -0
  34. package/esm2022/lib/shape.palette.component.mjs +78 -0
  35. package/esm2022/lib/surface-component.mjs +286 -0
  36. package/esm2022/lib/vjs-service.mjs +176 -0
  37. package/esm2022/visuallyjs-browser-ui-angular.mjs +2 -0
  38. package/fesm2022/visuallyjs-browser-ui-angular.mjs +2235 -0
  39. package/fesm2022/visuallyjs-browser-ui-angular.mjs.map +1 -0
  40. package/index.d.ts +40 -0
  41. package/lib/base.group.component.d.ts +60 -0
  42. package/lib/base.node.component.d.ts +55 -0
  43. package/lib/base.port.component.d.ts +74 -0
  44. package/lib/base.vertex.component.d.ts +111 -0
  45. package/lib/browser-ui-angular.module.d.ts +35 -0
  46. package/lib/charts/area.chart.component.d.ts +43 -0
  47. package/lib/charts/bar.chart.component.d.ts +40 -0
  48. package/lib/charts/bubble.chart.component.d.ts +40 -0
  49. package/lib/charts/column.chart.component.d.ts +40 -0
  50. package/lib/charts/line.chart.component.d.ts +39 -0
  51. package/lib/charts/pie.chart.component.d.ts +40 -0
  52. package/lib/charts/sankey.chart.component.d.ts +59 -0
  53. package/lib/charts/scatter.chart.component.d.ts +40 -0
  54. package/lib/charts/xy.chart.component.d.ts +32 -0
  55. package/lib/color.tag.component.d.ts +35 -0
  56. package/lib/common.d.ts +68 -0
  57. package/lib/controls-component.d.ts +71 -0
  58. package/lib/decorator-component.d.ts +25 -0
  59. package/lib/default-group-component.d.ts +11 -0
  60. package/lib/default-node-component.d.ts +11 -0
  61. package/lib/diagram-component.d.ts +52 -0
  62. package/lib/diagram-palette-component.d.ts +92 -0
  63. package/lib/edge.type.picker.component.d.ts +35 -0
  64. package/lib/export-controls-component.d.ts +59 -0
  65. package/lib/inspector.component.d.ts +96 -0
  66. package/lib/miniview-component.d.ts +45 -0
  67. package/lib/model.d.ts +8 -0
  68. package/lib/overlay-component.d.ts +59 -0
  69. package/lib/palette.component.d.ts +94 -0
  70. package/lib/shape.component.d.ts +70 -0
  71. package/lib/shape.palette.component.d.ts +73 -0
  72. package/lib/surface-component.d.ts +149 -0
  73. package/lib/vjs-service.d.ts +71 -0
  74. package/package.json +29 -0
  75. package/visuallyjs-browser-ui-angular.tgz +0 -0
@@ -0,0 +1,55 @@
1
+ import { Component, ElementRef, Input, NgZone, inject } from "@angular/core";
2
+ import { LineChart } from "@visuallyjs/browser-ui";
3
+ import { VisuallyJsService } from "../vjs-service";
4
+ import * as i0 from "@angular/core";
5
+ export class LineChartComponent {
6
+ constructor() {
7
+ this.$el = inject(ElementRef);
8
+ this.$ngZone = inject(NgZone);
9
+ this.$vjs = inject(VisuallyJsService);
10
+ }
11
+ _init(dataSource, data, url) {
12
+ this.$ngZone.runOutsideAngular(() => {
13
+ const o = Object.assign({}, this.options);
14
+ Object.assign(o, { dataSource });
15
+ this.chart = new LineChart(this.$el.nativeElement, o);
16
+ if (data) {
17
+ this.chart.load({ data });
18
+ }
19
+ else if (url) {
20
+ this.chart.load({ url });
21
+ }
22
+ });
23
+ }
24
+
25
+ ngAfterViewInit() {
26
+ if (this.useModel) {
27
+ this.$vjs.getModel((p) => {
28
+ this._init(p, null, null);
29
+ });
30
+ }
31
+ else {
32
+ this._init(null, this.data, this.url);
33
+ }
34
+ }
35
+ ngOnDestroy() {
36
+ this.chart?.destroy();
37
+ }
38
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LineChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
39
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: LineChartComponent, selector: "vjs-line-chart", inputs: { data: "data", url: "url", options: "options", useModel: "useModel" }, ngImport: i0, template: `<div></div>`, isInline: true }); }
40
+ }
41
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LineChartComponent, decorators: [{
42
+ type: Component,
43
+ args: [{
44
+ selector: "vjs-line-chart",
45
+ template: `<div></div>`
46
+ }]
47
+ }], propDecorators: { data: [{
48
+ type: Input
49
+ }], url: [{
50
+ type: Input
51
+ }], options: [{
52
+ type: Input
53
+ }], useModel: [{
54
+ type: Input
55
+ }] } });
@@ -0,0 +1,55 @@
1
+ import { Component, ElementRef, Input, NgZone, inject } from "@angular/core";
2
+ import { PieChart } from "@visuallyjs/browser-ui";
3
+ import { VisuallyJsService } from "../vjs-service";
4
+ import * as i0 from "@angular/core";
5
+ export class PieChartComponent {
6
+ constructor() {
7
+ this.$el = inject(ElementRef);
8
+ this.$ngZone = inject(NgZone);
9
+ this.$vjs = inject(VisuallyJsService);
10
+ }
11
+ _init(dataSource, data, url) {
12
+ this.$ngZone.runOutsideAngular(() => {
13
+ const o = Object.assign({}, this.options);
14
+ Object.assign(o, { dataSource });
15
+ this.chart = new PieChart(this.$el.nativeElement, o);
16
+ if (data) {
17
+ this.chart.load({ data });
18
+ }
19
+ else if (url) {
20
+ this.chart.load({ url });
21
+ }
22
+ });
23
+ }
24
+
25
+ ngAfterViewInit() {
26
+ if (this.useModel) {
27
+ this.$vjs.getModel((p) => {
28
+ this._init(p, null, null);
29
+ });
30
+ }
31
+ else {
32
+ this._init(null, this.data, this.url);
33
+ }
34
+ }
35
+ ngOnDestroy() {
36
+ this.chart?.destroy();
37
+ }
38
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PieChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
39
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: PieChartComponent, selector: "vjs-pie-chart", inputs: { data: "data", url: "url", options: "options", useModel: "useModel" }, ngImport: i0, template: `<div></div>`, isInline: true }); }
40
+ }
41
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PieChartComponent, decorators: [{
42
+ type: Component,
43
+ args: [{
44
+ selector: "vjs-pie-chart",
45
+ template: `<div></div>`
46
+ }]
47
+ }], propDecorators: { data: [{
48
+ type: Input
49
+ }], url: [{
50
+ type: Input
51
+ }], options: [{
52
+ type: Input
53
+ }], useModel: [{
54
+ type: Input
55
+ }] } });
@@ -0,0 +1,74 @@
1
+ import { Component, inject, ElementRef, Input, NgZone } from "@angular/core";
2
+ import { SankeyChart } from "@visuallyjs/browser-ui";
3
+ import { VisuallyJsService } from "../vjs-service";
4
+ import * as i0 from "@angular/core";
5
+ export class SankeyChartComponent {
6
+ constructor() {
7
+ this.$el = inject(ElementRef);
8
+ this.$ngZone = inject(NgZone);
9
+ this.$vjs = inject(VisuallyJsService);
10
+ }
11
+
12
+ _init(dataSource, csvData, jsonData, url) {
13
+ this.$ngZone.runOutsideAngular(() => {
14
+ const options = Object.assign({}, this.options);
15
+ if (this.interactive != null) {
16
+ options.interactive = this.interactive;
17
+ }
18
+ if (this.pivot != null) {
19
+ options.pivot = this.pivot;
20
+ }
21
+ Object.assign(options, {
22
+ csvData,
23
+ jsonData,
24
+ dataSource,
25
+ url
26
+ });
27
+ this.chart = new SankeyChart(this.$el.nativeElement, options);
28
+ });
29
+ }
30
+
31
+ ngAfterViewInit() {
32
+ if (this.useModel) {
33
+ this.$vjs.getModel((p) => {
34
+ this._init(p, null, null, null);
35
+ });
36
+ }
37
+ else {
38
+ this._init(null, this.csvData, this.jsonData, this.url);
39
+ }
40
+ }
41
+ ngOnChanges(changes) {
42
+ // @ts-ignore
43
+ if (changes['pivot'] && this.chart) {
44
+ // @ts-ignore
45
+ this.chart.pivot(changes['pivot'].currentValue);
46
+ }
47
+ }
48
+ ngOnDestroy() {
49
+ this.chart?.destroy();
50
+ }
51
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SankeyChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
52
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: SankeyChartComponent, selector: "vjs-sankey-chart", inputs: { csvData: "csvData", jsonData: "jsonData", url: "url", interactive: "interactive", pivot: "pivot", options: "options", useModel: "useModel" }, usesOnChanges: true, ngImport: i0, template: `<div></div>`, isInline: true }); }
53
+ }
54
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SankeyChartComponent, decorators: [{
55
+ type: Component,
56
+ args: [{
57
+ selector: "vjs-sankey-chart",
58
+ template: `<div></div>`
59
+ }]
60
+ }], propDecorators: { csvData: [{
61
+ type: Input
62
+ }], jsonData: [{
63
+ type: Input
64
+ }], url: [{
65
+ type: Input
66
+ }], interactive: [{
67
+ type: Input
68
+ }], pivot: [{
69
+ type: Input
70
+ }], options: [{
71
+ type: Input
72
+ }], useModel: [{
73
+ type: Input
74
+ }] } });
@@ -0,0 +1,55 @@
1
+ import { Component, ElementRef, inject, Input, NgZone } from "@angular/core";
2
+ import { ScatterChart } from "@visuallyjs/browser-ui";
3
+ import { VisuallyJsService } from "../vjs-service";
4
+ import * as i0 from "@angular/core";
5
+ export class ScatterChartComponent {
6
+ constructor() {
7
+ this.$el = inject(ElementRef);
8
+ this.$ngZone = inject(NgZone);
9
+ this.$vjs = inject(VisuallyJsService);
10
+ }
11
+ _init(dataSource, data, url) {
12
+ this.$ngZone.runOutsideAngular(() => {
13
+ const o = Object.assign({}, this.options);
14
+ Object.assign(o, { dataSource });
15
+ this.chart = new ScatterChart(this.$el.nativeElement, o);
16
+ if (data) {
17
+ this.chart.load({ data });
18
+ }
19
+ else if (url) {
20
+ this.chart.load({ url });
21
+ }
22
+ });
23
+ }
24
+
25
+ ngAfterViewInit() {
26
+ if (this.useModel) {
27
+ this.$vjs.getModel((p) => {
28
+ this._init(p, null, null);
29
+ });
30
+ }
31
+ else {
32
+ this._init(null, this.data, this.url);
33
+ }
34
+ }
35
+ ngOnDestroy() {
36
+ this.chart?.destroy();
37
+ }
38
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ScatterChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
39
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ScatterChartComponent, selector: "vjs-scatter-chart", inputs: { data: "data", url: "url", options: "options", useModel: "useModel" }, ngImport: i0, template: `<div></div>`, isInline: true }); }
40
+ }
41
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ScatterChartComponent, decorators: [{
42
+ type: Component,
43
+ args: [{
44
+ selector: "vjs-scatter-chart",
45
+ template: `<div></div>`
46
+ }]
47
+ }], propDecorators: { data: [{
48
+ type: Input
49
+ }], url: [{
50
+ type: Input
51
+ }], options: [{
52
+ type: Input
53
+ }], useModel: [{
54
+ type: Input
55
+ }] } });
@@ -0,0 +1,39 @@
1
+ import { Component, ElementRef, Input, NgZone, inject } from "@angular/core";
2
+ import { CategoryValueChart } from "@visuallyjs/browser-ui";
3
+ import * as i0 from "@angular/core";
4
+ export class XYChartComponent {
5
+ constructor() {
6
+ this.$el = inject(ElementRef);
7
+ this.$ngZone = inject(NgZone);
8
+ }
9
+
10
+ ngAfterViewInit() {
11
+ this.$ngZone.runOutsideAngular(() => {
12
+ this.chart = new CategoryValueChart(this.$el.nativeElement, this.options);
13
+ if (this.data) {
14
+ this.chart.load({ data: this.data });
15
+ }
16
+ else if (this.url) {
17
+ this.chart.load({ url: this.url });
18
+ }
19
+ });
20
+ }
21
+ ngOnDestroy() {
22
+ this.chart?.destroy();
23
+ }
24
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: XYChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
25
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: XYChartComponent, selector: "vjs-xy-chart", inputs: { data: "data", url: "url", options: "options" }, ngImport: i0, template: `<div></div>`, isInline: true }); }
26
+ }
27
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: XYChartComponent, decorators: [{
28
+ type: Component,
29
+ args: [{
30
+ selector: "vjs-xy-chart",
31
+ template: `<div></div>`
32
+ }]
33
+ }], propDecorators: { data: [{
34
+ type: Input
35
+ }], url: [{
36
+ type: Input
37
+ }], options: [{
38
+ type: Input
39
+ }] } });
@@ -0,0 +1,86 @@
1
+ import { Component, ElementRef, Input, Output, EventEmitter, signal, ChangeDetectorRef, inject } from "@angular/core";
2
+ import { CLASS_COLOR_PICKER, CLASS_COLOR_PICKER_SWATCH, CLASS_COLOR_PICKER_SWATCHES, EVENT_CONTEXT_UPDATE, INSPECTOR_CONTEXT_RECENT_COLORS } 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 ColorPickerComponent {
8
+ constructor() {
9
+
10
+ this.maxColors = 10;
11
+
12
+ this.changeEvent = new EventEmitter();
13
+ this.swatches = signal([]);
14
+ this.$vjs = inject(VisuallyJsService);
15
+ this.$el = inject(ElementRef);
16
+ this.$cdr = inject(ChangeDetectorRef);
17
+ }
18
+ $getInspector(cb) {
19
+ this.$vjs.getInspector(cb);
20
+ }
21
+ selectColor(color) {
22
+ this.$getInspector(inspector => {
23
+ inspector.setValue(this.propertyName, color);
24
+ this.$el.nativeElement.querySelector("[type='color']").value = color;
25
+ });
26
+ }
27
+ pushColor(color) {
28
+ this.$getInspector(inspector => {
29
+ const rc = inspector.getFromContext(INSPECTOR_CONTEXT_RECENT_COLORS);
30
+ if (rc != null) {
31
+ if (rc.find((c) => c === color) == null) {
32
+ const cc = rc.slice();
33
+ cc.unshift(color);
34
+ if (cc.length >= this.maxColors) {
35
+ cc.length = this.maxColors;
36
+ }
37
+ inspector.updateContext(INSPECTOR_CONTEXT_RECENT_COLORS, cc);
38
+ }
39
+ }
40
+ });
41
+ }
42
+ ngAfterViewInit() {
43
+ this.$getInspector(inspector => {
44
+ this.swatches.set(inspector.ensureContext(INSPECTOR_CONTEXT_RECENT_COLORS, () => []));
45
+ inspector.bind(EVENT_CONTEXT_UPDATE, (p) => {
46
+ if (p.key === INSPECTOR_CONTEXT_RECENT_COLORS) {
47
+ this.swatches.set(p.value);
48
+ this.$cdr.detectChanges();
49
+ }
50
+ });
51
+ const colorInput = this.$el.nativeElement.querySelector("[type='color']");
52
+ colorInput.onchange = () => {
53
+ const color = colorInput.value;
54
+ this.pushColor(color);
55
+ inspector.setValue(this.propertyName, color, true);
56
+ };
57
+ setTimeout(() => {
58
+ // if there is a color, maybe push to context
59
+ const v = inspector.getValue(this.propertyName);
60
+ if (v != null) {
61
+ this.pushColor(v);
62
+ }
63
+ });
64
+ });
65
+ }
66
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ColorPickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
67
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ColorPickerComponent, selector: "vjs-color", inputs: { propertyName: "propertyName", maxColors: "maxColors" }, outputs: { changeEvent: "changeEvent" }, ngImport: i0, template: "<div class=\"vjs-color-picker\">\n <input type=\"color\" [attr.vjs-att]=\"propertyName\"/>\n <div class=\"vjs-color-picker-swatches\">\n <div *ngFor=\"let swatch of swatches()\" class=\"vjs-color-picker-swatch\" attr.data-color=\"{{swatch}}\" style=\"background-color:{{swatch}}\" (click)=\"selectColor(swatch)\"></div>\n </div>\n </div>", isInline: true, dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] }); }
68
+ }
69
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ColorPickerComponent, decorators: [{
70
+ type: Component,
71
+ args: [{
72
+ selector: "vjs-color",
73
+ template: `<div class="${CLASS_COLOR_PICKER}">
74
+ <input type="color" [attr.vjs-att]="propertyName"/>
75
+ <div class="${CLASS_COLOR_PICKER_SWATCHES}">
76
+ <div *ngFor="let swatch of swatches()" class="${CLASS_COLOR_PICKER_SWATCH}" attr.data-color="{{swatch}}" style="background-color:{{swatch}}" (click)="selectColor(swatch)"></div>
77
+ </div>
78
+ </div>`
79
+ }]
80
+ }], propDecorators: { propertyName: [{
81
+ type: Input
82
+ }], maxColors: [{
83
+ type: Input
84
+ }], changeEvent: [{
85
+ type: Output
86
+ }] } });
@@ -0,0 +1,2 @@
1
+ export {};
2
+ // ["view", "tags", "container", "directRender", "storePositionsInModel"]
@@ -0,0 +1,164 @@
1
+ import { ChangeDetectorRef, Component, ElementRef, inject, Input, } from "@angular/core";
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
+ import { VisuallyJsService } from "./vjs-service";
4
+ import * as i0 from "@angular/core";
5
+ import * as i1 from "@angular/common";
6
+ const ATTRIBUTE_CAN_UNDO = "can-undo";
7
+ const ATTRIBUTE_CAN_REDO = "can-redo";
8
+ const CLASS_SELECTED_MODE = "vjs-selected-mode";
9
+ const ATTRIBUTE_HAS_SELECTION = "vjs-controls-has-selection";
10
+
11
+ export class ControlsComponent {
12
+ constructor() {
13
+
14
+ this.undoRedo = true;
15
+
16
+ this.zoomToExtents = true;
17
+
18
+ this.zoomButtons = false;
19
+
20
+ this.clear = true;
21
+
22
+ this.clearMessage = "Clear dataset?";
23
+
24
+ this.buttons = [];
25
+
26
+ this.orientation = "row";
27
+ this.showPanButton = true;
28
+ this.showLassoButton = true;
29
+ this.$vjs = inject(VisuallyJsService);
30
+ this.$el = inject(ElementRef);
31
+ this.$cdr = inject(ChangeDetectorRef);
32
+ }
33
+ updateSelectionState() {
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() {
43
+ this.modeButtons = this.buttons.filter((b) => b.mode != null);
44
+ this.otherButtons = this.buttons.filter((b) => b.mode == null);
45
+ this.$vjs.getUI((ui) => {
46
+ this.ui = ui;
47
+ this.showLassoButton = ui.getPlugin(LassoPlugin.type) != null;
48
+ this.showPanButton = this.showLassoButton === true;
49
+ this.ui.bind(EVENT_SURFACE_MODE_CHANGED, (mode) => {
50
+ const controls = this.getNativeElement(this.$el);
51
+ const modeButtons = this.ui.$getSelector(controls, "[data-mode]");
52
+ this.ui.removeClass(modeButtons, CLASS_SELECTED_MODE);
53
+ this.ui.addClass(this.ui.$getSelector(controls, `[data-mode='${mode}']`), CLASS_SELECTED_MODE);
54
+ });
55
+ this.ui.model.bind(EVENT_UNDOREDO_UPDATE, (state) => {
56
+ const controls = this.getNativeElement(this.$el);
57
+ controls.setAttribute(ATTRIBUTE_CAN_UNDO, state.undoCount > 0 ? TRUE : FALSE);
58
+ controls.setAttribute(ATTRIBUTE_CAN_REDO, state.redoCount > 0 ? TRUE : FALSE);
59
+ });
60
+ this.ui.model.bind(EVENT_SELECT, () => this.updateSelectionState());
61
+ this.ui.model.bind(EVENT_DESELECT, () => this.updateSelectionState());
62
+ this.ui.model.bind(EVENT_SELECTION_CLEARED, () => this.updateSelectionState());
63
+ this.$cdr.detectChanges();
64
+ });
65
+ }
66
+ getNativeElement(component) {
67
+ return (component.nativeElement ||
68
+ component._nativeElement ||
69
+ component.location.nativeElement).childNodes[0];
70
+ }
71
+ panMode() {
72
+ this.ui.setMode(SURFACE_MODE_PAN);
73
+ }
74
+ selectMode() {
75
+ this.ui.setMode(SURFACE_MODE_SELECT);
76
+ }
77
+ zoomToFit() {
78
+ this.ui.model.clearSelection();
79
+ this.ui.zoomToFit();
80
+ }
81
+ zoomIn() {
82
+ this.ui.zoomIn();
83
+ }
84
+ zoomOut() {
85
+ this.ui.zoomOut();
86
+ }
87
+ resetSelection() {
88
+ this.ui.model.clearSelection();
89
+ if (supportsPathEditing(this.ui)) {
90
+ this.ui.stopEditingPath();
91
+ }
92
+ }
93
+ undo() {
94
+ this.ui.model.undo();
95
+ }
96
+ redo() {
97
+ this.ui.model.redo();
98
+ }
99
+ doClear() {
100
+ const t = this.ui.model;
101
+ if ((t.getNodeCount() === 0 && t.getGroupCount() === 0) ||
102
+ confirm(this.clearMessage)) {
103
+ t.clear();
104
+ }
105
+ }
106
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ControlsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
107
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ControlsComponent, selector: "vjs-controls", inputs: { undoRedo: "undoRedo", zoomToExtents: "zoomToExtents", zoomButtons: "zoomButtons", clear: "clear", clearMessage: "clearMessage", buttons: "buttons", orientation: "orientation" }, ngImport: i0, template: "<div class=\"vjs-controls\" [attr.data-vjs-orientation]=\"orientation\">\n <i *ngIf=\"showPanButton\" class=\"vjs-pan-mode vjs-selected-mode\" data-mode=\"pan\" title=\"Pan Mode\" (click)=\"panMode()\">\n <svg viewBox=\"0 0 24 24\" stroke=\"currentColor\" fill=\"none\">\n <path d=\"M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5 M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5 M14 5.5a1.5 1.5 0 0 1 3 0v6.5 M17 7.5a1.5 1.5 0 0 1 3 0v8.5a6 6 0 0 1 -6 6h-2h.208a6 6 0 0 1 -5.012 -2.7a69.74 69.74 0 0 1 -.196 -.3c-.312 -.479 -1.407 -2.388 -3.286 -5.728a1.5 1.5 0 0 1 .536 -2.022a1.867 1.867 0 0 1 2.28 .28l1.47 1.47\"></path>\n </svg>\n </i>\n <i *ngIf=\"showLassoButton\" class=\"vjs-select-mode\" data-mode=\"select\" title=\"Select Mode\" (click)=\"selectMode()\">\n <svg fill=\"currentColor\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n <path d=\"M18.2848192,17.5777124 L20.8535534,20.1464466 C21.0488155,20.3417088 21.0488155,20.6582912 20.8535534,20.8535534 C20.6582912,21.0488155 20.3417088,21.0488155 20.1464466,20.8535534 L17.5777124,18.2848192 L15.9160251,20.7773501 C15.6899572,21.116452 15.1749357,21.0571624 15.0318354,20.6755617 L12.0318354,12.6755617 C11.8811067,12.2736185 12.2736185,11.8811067 12.6755617,12.0318354 L20.6755617,15.0318354 C21.0571624,15.1749357 21.116452,15.6899572 20.7773501,15.9160251 L18.2848192,17.5777124 L18.2848192,17.5777124 Z M17.2312404,17.0782479 L19.4104716,15.6254271 L13.3544004,13.3544004 L15.6254271,19.4104716 L17.0782479,17.2312404 C17.0974475,17.2011742 17.1201804,17.1727128 17.1464466,17.1464466 C17.1727128,17.1201804 17.2011742,17.0974475 17.2312404,17.0782479 L17.2312404,17.0782479 Z M5.5,3 C5.77614237,3 6,3.22385763 6,3.5 C6,3.77614237 5.77614237,4 5.5,4 C4.67157288,4 4,4.67157288 4,5.5 C4,5.77614237 3.77614237,6 3.5,6 C3.22385763,6 3,5.77614237 3,5.5 C3,4.11928813 4.11928813,3 5.5,3 Z M8.5,4 C8.22385763,4 8,3.77614237 8,3.5 C8,3.22385763 8.22385763,3 8.5,3 L10.5,3 C10.7761424,3 11,3.22385763 11,3.5 C11,3.77614237 10.7761424,4 10.5,4 L8.5,4 Z M13.5,4 C13.2238576,4 13,3.77614237 13,3.5 C13,3.22385763 13.2238576,3 13.5,3 L15.5,3 C15.7761424,3 16,3.22385763 16,3.5 C16,3.77614237 15.7761424,4 15.5,4 L13.5,4 Z M8.5,21 C8.22385763,21 8,20.7761424 8,20.5 C8,20.2238576 8.22385763,20 8.5,20 L10.5,20 C10.7761424,20 11,20.2238576 11,20.5 C11,20.7761424 10.7761424,21 10.5,21 L8.5,21 Z M3,8.5 C3,8.22385763 3.22385763,8 3.5,8 C3.77614237,8 4,8.22385763 4,8.5 L4,10.5 C4,10.7761424 3.77614237,11 3.5,11 C3.22385763,11 3,10.7761424 3,10.5 L3,8.5 Z M3,13.5 C3,13.2238576 3.22385763,13 3.5,13 C3.77614237,13 4,13.2238576 4,13.5 L4,15.5 C4,15.7761424 3.77614237,16 3.5,16 C3.22385763,16 3,15.7761424 3,15.5 L3,13.5 Z M3,18.5 C3,18.2238576 3.22385763,18 3.5,18 C3.77614237,18 4,18.2238576 4,18.5 C4,19.3284271 4.67157288,20 5.5,20 C5.77614237,20 6,20.2238576 6,20.5 C6,20.7761424 5.77614237,21 5.5,21 C4.11928813,21 3,19.8807119 3,18.5 Z M21,10.5 C21,10.7761424 20.7761424,11 20.5,11 C20.2238576,11 20,10.7761424 20,10.5 L20,8.5 C20,8.22385763 20.2238576,8 20.5,8 C20.7761424,8 21,8.22385763 21,8.5 L21,10.5 Z M21,5.5 C21,5.77614237 20.7761424,6 20.5,6 C20.2238576,6 20,5.77614237 20,5.5 C20,4.67157288 19.3284271,4 18.5,4 C18.2238576,4 18,3.77614237 18,3.5 C18,3.22385763 18.2238576,3 18.5,3 C19.8807119,3 21,4.11928813 21,5.5 Z\"></path>\n </svg>\n </i>\n\n <i *ngFor=\"let button of modeButtons\" data-mode=\"{{ button.mode }}\" class=\"{{ button.class }}\" title=\"{{ button.title }}\"></i>\n\n <i *ngIf=\"zoomToExtents\" class=\"vjs-zoom-to-fit\" data-reset=\"true\"title=\"Zoom To Fit\" (click)=\"zoomToFit()\">\n <svg viewBox=\"0 0 32 30\" stroke=\"currentColor\" fill=\"currentColor\"><path d=\"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z\"></path></svg>\n </i>\n\n <i *ngIf=\"zoomButtons\" class=\"vjs-zoom-in\" data-zoom-in=\"true\" title=\"Zoom In\" (click)=\"zoomIn()\">\n <svg viewBox=\"0 0 32 32\" stroke=\"currentColor\" fill=\"currentColor\"><path d=\"M 13 6 L 13 20 M 6 13 L 20 13 M 22,22 L 30,30 M1, 13 a 12,12 0 1,0 24,0 a 12,12 0 1,0 -24,0\"></path></svg>\n </i>\n\n <i *ngIf=\"zoomButtons\" class=\"vjs-zoom-out\" data-zoom-out=\"true\" title=\"Zoom Out\" (click)=\"zoomOut()\">\n <svg viewBox=\"0 0 32 32\" stroke=\"currentColor\" fill=\"currentColor\"><path d=\"M 6 13 L 20 13 M 22,22 L 30,30 M1, 13 a 12,12 0 1,0 24,0 a 12,12 0 1,0 -24,0\"></path></svg>\n </i>\n\n <i *ngIf=\"undoRedo\" class=\"vjs-undo\" data-undo=\"true\" title=\"Undo last action\" (click)=\"undo()\"></i>\n <i *ngIf=\"undoRedo\" class=\"vjs-redo\" data-redo=\"true\" title=\"Redo last action\" (click)=\"redo()\"></i>\n <i class=\"vjs-controls-reset-selection\" title=\"Clear selection\" (click)=\"resetSelection()\">\n <svg viewBox=\"0 0 24 24\" stroke=\"currentColor\" fill=\"currentColor\"><path d=\"M2,5 V2 H5 M9,2 H11 M13,2 H15 M19,2 H22 V5 M22,9 V11 M22,13 V15 M22,19 V22 H19 M15,22 H13 M11,22 H9 M5,22 H2 V19 M2,15 V13 M2,11 V9 M9,9 L15,15 M15,9 L9,15\"></path></svg>\n </i>\n <i *ngIf=\"clear\" class=\"vjs-clear-dataset\" [title]=\"clearMessage\" (click)=\"doClear()\">\n <svg viewBox=\"0 0 24 24\" stroke=\"currentColor\" fill=\"currentColor\"><path d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\"></path></svg>\n </i>\n <i *ngFor=\"let button of otherButtons\" class=\"{{ button.class }}\" title=\"{{ button.title }}\"></i>\n </div>", isInline: true, dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
108
+ }
109
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ControlsComponent, decorators: [{
110
+ type: Component,
111
+ args: [{
112
+ selector: "vjs-controls",
113
+ template: `<div class="vjs-controls" [attr.data-vjs-orientation]="orientation">
114
+ <i *ngIf="showPanButton" class="vjs-pan-mode ${CLASS_SELECTED_MODE}" data-mode="${SURFACE_MODE_PAN}" title="Pan Mode" (click)="panMode()">
115
+ <svg viewBox="${PAN_VIEW_BOX}" stroke="currentColor" fill="none">
116
+ <path d="${PAN_PATH}"></path>
117
+ </svg>
118
+ </i>
119
+ <i *ngIf="showLassoButton" class="vjs-select-mode" data-mode="${SURFACE_MODE_SELECT}" title="Select Mode" (click)="selectMode()">
120
+ <svg fill="currentColor" viewBox="${LASSO_VIEW_BOX}" stroke="currentColor">
121
+ <path d="${LASSO_PATH}"></path>
122
+ </svg>
123
+ </i>
124
+
125
+ <i *ngFor="let button of modeButtons" data-mode="{{ button.mode }}" class="{{ button.class }}" title="{{ button.title }}"></i>
126
+
127
+ <i *ngIf="zoomToExtents" class="vjs-zoom-to-fit" data-reset="true"title="Zoom To Fit" (click)="zoomToFit()">
128
+ <svg viewBox="${ZOOM_TO_FIT_VIEW_BOX}" stroke="currentColor" fill="currentColor"><path d="${ZOOM_TO_FIT_PATH}"></path></svg>
129
+ </i>
130
+
131
+ <i *ngIf="zoomButtons" class="vjs-zoom-in" data-zoom-in="true" title="Zoom In" (click)="zoomIn()">
132
+ <svg viewBox="${ZOOM_IN_OUT_VIEW_BOX}" stroke="currentColor" fill="currentColor"><path d="${ZOOM_IN_PATH}"></path></svg>
133
+ </i>
134
+
135
+ <i *ngIf="zoomButtons" class="vjs-zoom-out" data-zoom-out="true" title="Zoom Out" (click)="zoomOut()">
136
+ <svg viewBox="${ZOOM_IN_OUT_VIEW_BOX}" stroke="currentColor" fill="currentColor"><path d="${ZOOM_OUT_PATH}"></path></svg>
137
+ </i>
138
+
139
+ <i *ngIf="undoRedo" class="vjs-undo" data-undo="true" title="Undo last action" (click)="undo()"></i>
140
+ <i *ngIf="undoRedo" class="vjs-redo" data-redo="true" title="Redo last action" (click)="redo()"></i>
141
+ <i class="${CLASS_CONTROLS_RESET_SELECTION}" title="Clear selection" (click)="resetSelection()">
142
+ <svg viewBox="${RESET_SELECTION_VIEW_BOX}" stroke="currentColor" fill="currentColor"><path d="${RESET_SELECTION_PATH}"></path></svg>
143
+ </i>
144
+ <i *ngIf="clear" class="vjs-clear-dataset" [title]="clearMessage" (click)="doClear()">
145
+ <svg viewBox="${CLEAR_VIEW_BOX}" stroke="currentColor" fill="currentColor"><path d="${CLEAR_PATH}"></path></svg>
146
+ </i>
147
+ <i *ngFor="let button of otherButtons" class="{{ button.class }}" title="{{ button.title }}"></i>
148
+ </div>`,
149
+ }]
150
+ }], propDecorators: { undoRedo: [{
151
+ type: Input
152
+ }], zoomToExtents: [{
153
+ type: Input
154
+ }], zoomButtons: [{
155
+ type: Input
156
+ }], clear: [{
157
+ type: Input
158
+ }], clearMessage: [{
159
+ type: Input
160
+ }], buttons: [{
161
+ type: Input
162
+ }], orientation: [{
163
+ type: Input
164
+ }] } });
@@ -0,0 +1,52 @@
1
+ import { Component, Input, ElementRef, inject } from "@angular/core";
2
+ import { VisuallyJsService } from "./vjs-service";
3
+ import * as i0 from "@angular/core";
4
+ export class DecoratorComponent {
5
+ constructor() {
6
+
7
+ this.placement = 'floating';
8
+
9
+ this.position = { x: 0, y: 0 };
10
+ this.el = inject(ElementRef);
11
+ this.service = inject(VisuallyJsService);
12
+ }
13
+ ngAfterViewInit() {
14
+ this.service.getSurface(s => {
15
+ const nativeElement = this.el.nativeElement.firstElementChild;
16
+ if (this.placement === 'fixed') {
17
+ s.fixElement(nativeElement, this.position, this.constraints);
18
+ }
19
+ else {
20
+ s.floatElement(nativeElement, this.position);
21
+ }
22
+ });
23
+ }
24
+ ngOnDestroy() {
25
+ if (this.surface && this.placement === 'fixed') {
26
+ this.surface.unfixElement(this.el.nativeElement.firstElementChild);
27
+ }
28
+ }
29
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DecoratorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
30
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DecoratorComponent, selector: "vjs-decorator", inputs: { placement: "placement", position: "position", constraints: "constraints" }, ngImport: i0, template: `
31
+ <div style="display:inline-block;">
32
+ <ng-content></ng-content>
33
+ </div>
34
+ `, isInline: true }); }
35
+ }
36
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DecoratorComponent, decorators: [{
37
+ type: Component,
38
+ args: [{
39
+ selector: "vjs-decorator",
40
+ template: `
41
+ <div style="display:inline-block;">
42
+ <ng-content></ng-content>
43
+ </div>
44
+ `
45
+ }]
46
+ }], propDecorators: { placement: [{
47
+ type: Input
48
+ }], position: [{
49
+ type: Input
50
+ }], constraints: [{
51
+ type: Input
52
+ }] } });
@@ -0,0 +1,18 @@
1
+ import { Component, computed } from "@angular/core";
2
+ import { BaseGroupComponent } from "./base.group.component";
3
+ import * as i0 from "@angular/core";
4
+
5
+ export class DefaultGroupComponent extends BaseGroupComponent {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.label = computed(() => this.$data().label || "");
9
+ }
10
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DefaultGroupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
11
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DefaultGroupComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `<div class="vjs-default-group">{{label()}}</div>`, isInline: true }); }
12
+ }
13
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DefaultGroupComponent, decorators: [{
14
+ type: Component,
15
+ args: [{
16
+ template: `<div class="vjs-default-group">{{label()}}</div>`
17
+ }]
18
+ }] });
@@ -0,0 +1,18 @@
1
+ import { Component, computed } from "@angular/core";
2
+ import { BaseNodeComponent } from "./base.node.component";
3
+ import * as i0 from "@angular/core";
4
+
5
+ export class DefaultNodeComponent extends BaseNodeComponent {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.label = computed(() => this.$data().label || "");
9
+ }
10
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DefaultNodeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
11
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DefaultNodeComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `<div class="vjs-default-node">{{label()}}</div>`, isInline: true }); }
12
+ }
13
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DefaultNodeComponent, decorators: [{
14
+ type: Component,
15
+ args: [{
16
+ template: `<div class="vjs-default-node">{{label()}}</div>`
17
+ }]
18
+ }] });