@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,2235 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, inject, ElementRef, Component, Input, ChangeDetectorRef, signal, computed, Directive, EventEmitter, ViewContainerRef, NgZone, reflectComponentType, Output, NgModule } from '@angular/core';
3
+ import * as i1 from '@angular/common';
4
+ import { CommonModule } from '@angular/common';
5
+ import { log, Surface, Paper, MiniviewPlugin, EVENT_PORT_UPDATED, BrowserUIModel, CustomOverlay, ELEMENT_DIV, isGroup, extend, renderSurface, EVENT_NODE_UPDATED, EVENT_PORT_ADDED, EVENT_GROUP_UPDATED, EVENT_DATA_LOAD_END, EVENT_EDGE_UPDATED, EVENT_INTERNAL_CONNECTION, ShapeLibraryDefaults, ShapePalette, DEFAULT_LABEL_FILL_RATIO, convertToMultilineText, LassoPlugin, EVENT_SURFACE_MODE_CHANGED, EVENT_UNDOREDO_UPDATE, TRUE, FALSE, EVENT_SELECT, EVENT_DESELECT, EVENT_SELECTION_CLEARED, SURFACE_MODE_PAN, SURFACE_MODE_SELECT, supportsPathEditing, PAN_VIEW_BOX, PAN_PATH, LASSO_VIEW_BOX, LASSO_PATH, ZOOM_TO_FIT_VIEW_BOX, ZOOM_TO_FIT_PATH, ZOOM_IN_OUT_VIEW_BOX, ZOOM_IN_PATH, ZOOM_OUT_PATH, CLASS_CONTROLS_RESET_SELECTION, RESET_SELECTION_VIEW_BOX, RESET_SELECTION_PATH, CLEAR_VIEW_BOX, CLEAR_PATH, INSPECTOR_CONTEXT_EDGE_PROPERTY_MAPPINGS, EdgeTypePicker, Palette, SvgExportUI, ImageExportUI, CLASS_CONTROLS, CLASS_EXPORT_CONTROLS, INSPECTOR_CONTEXT_RECENT_COLORS, EVENT_CONTEXT_UPDATE, CLASS_COLOR_PICKER, CLASS_COLOR_PICKER_SWATCHES, CLASS_COLOR_PICKER_SWATCH, createDiagram, ColumnChart, BarChart, DiagramPalette, CategoryValueChart, LineChart, AreaChart, PieChart, ScatterChart, BubbleChart, SankeyChart, Edge, Node, Group, Port, Inspector } from '@visuallyjs/browser-ui';
6
+
7
+
8
+ class VisuallyJsService {
9
+ constructor() {
10
+ this.inspectorListeners = [];
11
+ this.surfaceListeners = [];
12
+ this.paperListeners = [];
13
+ this.modelListeners = [];
14
+ this.diagramListeners = [];
15
+ this.uiListeners = [];
16
+ }
17
+ $setInspector(i) {
18
+ this.$inspector = i;
19
+ this.$notifyInspector();
20
+ }
21
+ $notifyInspector() {
22
+ this.inspectorListeners.forEach(sl => {
23
+ try {
24
+ sl(this.$inspector);
25
+ }
26
+ catch (e) {
27
+ log(`WARN: could not notify Inspector listener ${e}`);
28
+ }
29
+ });
30
+ this.inspectorListeners.length = 0;
31
+ }
32
+ $setSurface(s) {
33
+ // @ts-ignore
34
+ this.$setModel(s.model);
35
+ this.$surface = s;
36
+ this.$notifySurface();
37
+ }
38
+ $notifySurface() {
39
+ this.surfaceListeners.forEach(sl => {
40
+ try {
41
+ sl(this.$surface);
42
+ }
43
+ catch (e) {
44
+ log(`WARN: could not notify Surface listener ${e}`);
45
+ }
46
+ });
47
+ this.surfaceListeners.length = 0;
48
+ this.$notifyUI(this.$surface);
49
+ }
50
+
51
+ getSurface(cb) {
52
+ if (this.$surface != null) {
53
+ cb(this.$surface);
54
+ }
55
+ else {
56
+ this.surfaceListeners.push(cb);
57
+ }
58
+ }
59
+
60
+ getInspector(cb) {
61
+ if (this.$inspector != null) {
62
+ cb(this.$inspector);
63
+ }
64
+ else {
65
+ this.inspectorListeners.push(cb);
66
+ }
67
+ }
68
+ $setPaper(p) {
69
+ // @ts-ignore
70
+ this.$setModel(p.model);
71
+ this.$paper = p;
72
+ this.$notifyPaper();
73
+ }
74
+ $notifyPaper() {
75
+ this.paperListeners.forEach(sl => {
76
+ try {
77
+ sl(this.$paper);
78
+ }
79
+ catch (e) {
80
+ log(`WARN: could not notify Paper listener ${e}`);
81
+ }
82
+ });
83
+ this.paperListeners.length = 0;
84
+ this.$notifyUI(this.$paper);
85
+ }
86
+
87
+ getPaper(cb) {
88
+ if (this.$paper != null) {
89
+ cb(this.$paper);
90
+ }
91
+ else {
92
+ this.paperListeners.push(cb);
93
+ }
94
+ }
95
+ $setDiagram(d) {
96
+ this.$diagram = d;
97
+ if (d.$ui instanceof Surface) {
98
+ this.$setSurface(d.$ui);
99
+ }
100
+ if (d.$ui instanceof Paper) {
101
+ this.$setPaper(d.$ui);
102
+ }
103
+ this.$notifyDiagram();
104
+ }
105
+ $notifyDiagram() {
106
+ this.diagramListeners.forEach(sl => {
107
+ try {
108
+ sl(this.$diagram);
109
+ }
110
+ catch (e) {
111
+ log(`WARN: could not notify Diagram listener ${e}`);
112
+ }
113
+ });
114
+ this.diagramListeners.length = 0;
115
+ }
116
+
117
+ getDiagram(cb) {
118
+ if (this.$diagram != null) {
119
+ cb(this.$diagram);
120
+ }
121
+ else {
122
+ this.diagramListeners.push(cb);
123
+ }
124
+ }
125
+
126
+ getModel(cb) {
127
+ if (this.$model != null) {
128
+ cb(this.$model);
129
+ }
130
+ else {
131
+ this.modelListeners.push(cb);
132
+ }
133
+ }
134
+
135
+ $setModel(m) {
136
+ this.$model = m;
137
+ this.$notifyModel();
138
+ }
139
+ $notifyModel() {
140
+ this.modelListeners.forEach(sl => {
141
+ try {
142
+ sl(this.$model);
143
+ }
144
+ catch (e) {
145
+ log(`WARN: could not notify Model listener ${e}`);
146
+ }
147
+ });
148
+ this.modelListeners.length = 0;
149
+ }
150
+ $notifyUI(ui) {
151
+ this.uiListeners.forEach(sl => {
152
+ try {
153
+ sl(ui);
154
+ }
155
+ catch (e) {
156
+ log(`WARN: could not notify UI listener ${e}`);
157
+ }
158
+ });
159
+ this.uiListeners.length = 0;
160
+ }
161
+
162
+ getUI(cb) {
163
+ const ui = this.$surface || this.$paper;
164
+ if (ui != null) {
165
+ cb(ui);
166
+ }
167
+ else {
168
+ this.uiListeners.push(cb);
169
+ }
170
+ }
171
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: VisuallyJsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
172
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: VisuallyJsService, providedIn: 'root' }); }
173
+ }
174
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: VisuallyJsService, decorators: [{
175
+ type: Injectable,
176
+ args: [{
177
+ providedIn: 'root',
178
+ }]
179
+ }] });
180
+
181
+
182
+ class MiniviewComponent {
183
+ constructor(ngZone) {
184
+ this.ngZone = ngZone;
185
+
186
+ this.activeTracking = true;
187
+
188
+ this.clickToCenter = true;
189
+ this.$el = inject(ElementRef);
190
+ this.$vjs = inject(VisuallyJsService);
191
+ }
192
+
193
+ ngAfterViewInit() {
194
+ this.ngZone.runOutsideAngular(() => {
195
+ // this.$service.addMiniview(this.surfaceId, {
196
+ // container: this.el.nativeElement.childNodes[0],
197
+ // elementFilter: this.elementFilter,
198
+ // typeFunction: this.typeFunction,
199
+ // activeTracking: this.activeTracking,
200
+ // clickToCenter: this.clickToCenter !== false
201
+ // })
202
+ this.$vjs.getUI((b) => {
203
+ this.$miniview = b.addPlugin({
204
+ type: MiniviewPlugin.type,
205
+ options: {
206
+ container: this.$el.nativeElement.childNodes[0],
207
+ elementFilter: this.elementFilter,
208
+ typeFunction: this.typeFunction,
209
+ activeTracking: this.activeTracking,
210
+ clickToCenter: this.clickToCenter !== false
211
+ },
212
+ });
213
+ });
214
+ });
215
+ }
216
+
217
+ redraw() {
218
+ if (this.$miniview != null) {
219
+ this.$miniview.invalidate();
220
+ }
221
+ }
222
+ 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 }); }
223
+ 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 }); }
224
+ }
225
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MiniviewComponent, decorators: [{
226
+ type: Component,
227
+ args: [{
228
+ selector: 'vjs-miniview',
229
+ template: `<div></div>`
230
+ }]
231
+ }], ctorParameters: function () { return [{ type: i0.NgZone }]; }, propDecorators: { elementFilter: [{
232
+ type: Input
233
+ }], typeFunction: [{
234
+ type: Input
235
+ }], activeTracking: [{
236
+ type: Input
237
+ }], clickToCenter: [{
238
+ type: Input
239
+ }] } });
240
+
241
+
242
+ const AngularComponentOverlayType = "AngularComponent";
243
+
244
+ class BaseAngularOverlayComponent {
245
+ constructor() {
246
+
247
+ this.changeDetectorRef = inject(ChangeDetectorRef);
248
+ }
249
+
250
+ updateEdge(updates) {
251
+ this.model.updateEdge(this.edge, updates);
252
+ }
253
+
254
+ removeEdge() {
255
+ this.model.removeEdge(this.edge);
256
+ }
257
+ }
258
+
259
+
260
+ class BaseVertexComponent {
261
+ constructor() {
262
+
263
+ this.changeDetectorRef = inject(ChangeDetectorRef);
264
+
265
+ this.$data = signal(undefined);
266
+ }
267
+
268
+ ngOnInit() {
269
+ this.$data.set(this.data);
270
+ }
271
+
272
+ getVertex() {
273
+ return this._getVertex();
274
+ }
275
+
276
+ ngOnDestroy() {
277
+ delete this._el._visuallyJsNgComponent._el;
278
+ delete this._el;
279
+ delete this.model;
280
+ delete this.surface;
281
+ }
282
+
283
+ removeVertex() {
284
+ this.model.remove(this.getVertex());
285
+ }
286
+
287
+ addNewPort(type, data) {
288
+ this.model.addNewPort(this.getVertex(), type, data);
289
+ }
290
+
291
+ addPort(data) {
292
+ return this.model.addPort(this.getVertex(), data);
293
+ }
294
+
295
+ setAsSelection() {
296
+ this.model.setSelection(this.getVertex());
297
+ }
298
+
299
+ addToSelection() {
300
+ this.model.addToSelection(this.getVertex());
301
+ }
302
+
303
+ removeFromSelection() {
304
+ this.model.removeFromSelection(this.getVertex());
305
+ }
306
+
307
+ updateVertex(data) {
308
+ this.model.updateVertex(this.getVertex(), data);
309
+ }
310
+
311
+ cloneVertex(options) {
312
+ this.surface.cloneVertex(this.getVertex(), options);
313
+ }
314
+
315
+ flashVertex(duration, animName) {
316
+ this.surface.flashVertex(this.getVertex(), duration, animName);
317
+ }
318
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BaseVertexComponent, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
319
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BaseVertexComponent }); }
320
+ }
321
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BaseVertexComponent, decorators: [{
322
+ type: Injectable
323
+ }], propDecorators: { data: [{
324
+ type: Input
325
+ }], model: [{
326
+ type: Input
327
+ }], surface: [{
328
+ type: Input
329
+ }], modelObject: [{
330
+ type: Input
331
+ }] } });
332
+
333
+
334
+ class BaseGroupComponent extends BaseVertexComponent {
335
+
336
+ getGroup() { return this.model.getGroup(this.model.getGroupId(this.data)); }
337
+
338
+ getMembers() { return this.getGroup().getMembers(); }
339
+
340
+ _getVertex() {
341
+ return this.getGroup();
342
+ }
343
+
344
+ updateGroup(data) {
345
+ this.updateVertex(data);
346
+ }
347
+
348
+ removeGroup() {
349
+ this.removeVertex();
350
+ }
351
+
352
+ cloneGroup(options) {
353
+ this.cloneVertex(options);
354
+ }
355
+
356
+ flashGroup(duration, animName) {
357
+ this.flashVertex(duration, animName);
358
+ }
359
+
360
+ removePort(portId) {
361
+ this.model.removePort(this.getGroup(), portId);
362
+ }
363
+
364
+ getPort(portId) {
365
+ return this.getGroup().getPort(portId);
366
+ }
367
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BaseGroupComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
368
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BaseGroupComponent }); }
369
+ }
370
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BaseGroupComponent, decorators: [{
371
+ type: Injectable
372
+ }] });
373
+
374
+
375
+ class DefaultGroupComponent extends BaseGroupComponent {
376
+ constructor() {
377
+ super(...arguments);
378
+ this.label = computed(() => this.$data().label || "");
379
+ }
380
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DefaultGroupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
381
+ 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 }); }
382
+ }
383
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DefaultGroupComponent, decorators: [{
384
+ type: Component,
385
+ args: [{
386
+ template: `<div class="vjs-default-group">{{label()}}</div>`
387
+ }]
388
+ }] });
389
+
390
+
391
+ class BaseNodeComponent extends BaseVertexComponent {
392
+
393
+ getNode() { return this.model.getNode(this.model.getNodeId(this.data)); }
394
+
395
+ _getVertex() {
396
+ return this.getNode();
397
+ }
398
+
399
+ updateNode(data) {
400
+ this.updateVertex(data);
401
+ }
402
+
403
+ removeNode() {
404
+ this.removeVertex();
405
+ }
406
+
407
+ removePort(portId) {
408
+ this.model.removePort(this.getNode(), portId);
409
+ }
410
+
411
+ getPort(portId) {
412
+ return this.getNode().getPort(portId);
413
+ }
414
+
415
+ cloneNode(options) {
416
+ this.cloneVertex(options);
417
+ }
418
+
419
+ flashNode(duration, animName) {
420
+ this.flashVertex(duration, animName);
421
+ }
422
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BaseNodeComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
423
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BaseNodeComponent }); }
424
+ }
425
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BaseNodeComponent, decorators: [{
426
+ type: Injectable
427
+ }] });
428
+
429
+
430
+ class DefaultNodeComponent extends BaseNodeComponent {
431
+ constructor() {
432
+ super(...arguments);
433
+ this.label = computed(() => this.$data().label || "");
434
+ }
435
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DefaultNodeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
436
+ 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 }); }
437
+ }
438
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DefaultNodeComponent, decorators: [{
439
+ type: Component,
440
+ args: [{
441
+ template: `<div class="vjs-default-node">{{label()}}</div>`
442
+ }]
443
+ }] });
444
+
445
+
446
+ class BasePortComponent {
447
+ constructor(el) {
448
+ this.el = el;
449
+
450
+ this.changeDetectorRef = inject(ChangeDetectorRef);
451
+
452
+ this.$data = signal(undefined);
453
+ el.nativeElement._visuallyJsNgComponent = this;
454
+ }
455
+
456
+ _signalBinding(n) {
457
+ if (this.parent != null) {
458
+
459
+ if (n.vertex.id === this.parent.data.id && n.port.id === this.data["id"]) {
460
+ this.$data.set(this.data);
461
+ }
462
+ }
463
+ }
464
+
465
+ ngOnInit() {
466
+ if (this.data == null) {
467
+ log(`WARN: cannot instantiate port component; "data" not set`);
468
+ return;
469
+ }
470
+ if (this.parent == null) {
471
+ log(`WARN: cannot instantiate port component; "parent" not set (you need to set parent to be a BaseNodeComponent or BaseGroupComponent on this component in your template)`);
472
+ return;
473
+ }
474
+ this.$data.set(this.data);
475
+ this._signalBinder = this._signalBinding.bind(this);
476
+ this.parent.model.bind(EVENT_PORT_UPDATED, this._signalBinder);
477
+ }
478
+
479
+ getPort() {
480
+ return this.parent
481
+ .getVertex()
482
+ .getPort(this.parent.model.getPortId(this.data));
483
+ }
484
+
485
+ getPortId() {
486
+ return this.parent.model.getPortId(this.data);
487
+ }
488
+
489
+ updatePort(data) {
490
+ this.parent.model.updatePort(this.getPort(), data);
491
+ }
492
+
493
+ removePort() {
494
+ this.parent.model.removePort(this.parent.getVertex(), this.getPortId());
495
+ }
496
+
497
+ ngOnDestroy() {
498
+ this.parent.model.unbind(EVENT_PORT_UPDATED, this._signalBinder);
499
+ }
500
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BasePortComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
501
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: BasePortComponent, selector: "vjs-base-port", inputs: { parent: "parent", data: "data" }, ngImport: i0 }); }
502
+ }
503
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BasePortComponent, decorators: [{
504
+ type: Directive,
505
+ args: [{
506
+ selector: "vjs-base-port",
507
+ }]
508
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { parent: [{
509
+ type: Input
510
+ }], data: [{
511
+ type: Input
512
+ }] } });
513
+
514
+
515
+ class BrowserUIAngularModel extends BrowserUIModel {
516
+ render(container, options) {
517
+ log("render called directly on BrowserUIAngularModel class: should not happen. UI should use internal render.");
518
+ return null;
519
+ }
520
+ }
521
+
522
+
523
+ class SurfaceComponent {
524
+ constructor() {
525
+
526
+ this.vertexEvent = new EventEmitter();
527
+ this.$el = inject(ElementRef);
528
+ this.$viewContainerRef = inject(ViewContainerRef);
529
+ this.$ngZone = inject(NgZone);
530
+ this.$vjs = inject(VisuallyJsService);
531
+ }
532
+
533
+ getNativeElement(component) {
534
+ return component.location.nativeElement.childNodes[0];
535
+ }
536
+ _getComponent(el, tryParent) {
537
+ if (el == null) {
538
+ return null;
539
+ }
540
+ else {
541
+ let vjc = el._visuallyJsNgComponent;
542
+ if (vjc == null && tryParent && el.parentNode != null) {
543
+ vjc = el.parentNode._visuallyJsNgComponent;
544
+ }
545
+ return vjc;
546
+ }
547
+ }
548
+ _getComponentThen(el, then, tryParent) {
549
+ const c = this._getComponent(el, tryParent);
550
+ if (c != null) {
551
+ then(c);
552
+ }
553
+ }
554
+
555
+ nodeOrGroupUpdated(params) {
556
+ const info = this.surface.getObjectInfo(params.vertex, false);
557
+ this._getComponentThen(info.el, (component) => {
558
+ component.data = params.vertex.data;
559
+ component.$data?.set(component.data);
560
+ if (component.changeDetectorRef) {
561
+ component.changeDetectorRef.detectChanges();
562
+ }
563
+ }, false);
564
+ }
565
+ portUpdated(params) {
566
+ const info = this.surface.getObjectInfo(params.port, false);
567
+ this._getComponentThen(info.el, (component) => {
568
+ if (component instanceof BasePortComponent) {
569
+ component.data = params.port.data;
570
+ if (component.changeDetectorRef) {
571
+ component.changeDetectorRef.detectChanges();
572
+ }
573
+ }
574
+ }, true);
575
+ }
576
+
577
+ edgeUpdated(params) {
578
+ const connection = this.surface.getRenderedConnection(params.edge.id);
579
+ if (connection) {
580
+ for (let id in connection.overlays) {
581
+ const canvas = connection.overlays[id].contentElement;
582
+ this._getComponentThen(canvas, (component) => {
583
+ if (component.changeDetectorRef != null) {
584
+ component.changeDetectorRef.detectChanges();
585
+ }
586
+ }, false);
587
+ }
588
+ }
589
+ }
590
+
591
+ _processAngularOverlays(view) {
592
+ const self = this;
593
+ const edgeTypes = view.edges || {};
594
+ for (let edgeTypeId in edgeTypes) {
595
+ const edgeType = edgeTypes[edgeTypeId];
596
+ if (edgeType.overlays != null) {
597
+ edgeType.overlays = edgeType.overlays.map((o) => {
598
+ if (typeof o === "string") {
599
+ return o;
600
+ }
601
+ else {
602
+ const fo = o;
603
+ if (fo.type === AngularComponentOverlayType) {
604
+ const newSpec = Object.assign(fo, {
605
+ type: CustomOverlay.type,
606
+ });
607
+ newSpec.options = (newSpec.options || {});
608
+ newSpec.options.create = (connection) => {
609
+ const el = document.createElement(ELEMENT_DIV);
610
+ let createdComponent = self.$viewContainerRef.createComponent(newSpec.options.component);
611
+ let angularOverlayComponent = createdComponent.instance;
612
+ let nativeEl = createdComponent.location.nativeElement.childNodes[0];
613
+ el.appendChild(nativeEl);
614
+ el._visuallyJsNgComponent = angularOverlayComponent;
615
+
616
+ if (connection != null) {
617
+ const edge = connection.edge;
618
+ angularOverlayComponent.edge = edge;
619
+ angularOverlayComponent.data = edge.data;
620
+ }
621
+ angularOverlayComponent.model = self.model;
622
+ angularOverlayComponent.surface = self.surface;
623
+ createdComponent.changeDetectorRef.detectChanges();
624
+ return el;
625
+ };
626
+ return newSpec;
627
+ }
628
+ else {
629
+ return fo;
630
+ }
631
+ }
632
+ });
633
+ }
634
+ }
635
+ return view;
636
+ }
637
+
638
+ save(options) {
639
+ this.surface.save(options);
640
+ }
641
+
642
+ exportData(options) {
643
+ return this.surface.model.exportData(options);
644
+ }
645
+
646
+ dataLoadEnd() {
647
+ setTimeout(() => {
648
+ if (this.surface != null) {
649
+ this.surface.repaintEverything();
650
+ }
651
+ }, 0);
652
+ }
653
+ $removeNgElement(el) {
654
+ if (el._ref != null) {
655
+ el._ref.destroy();
656
+ }
657
+ if (el.parentNode != null) {
658
+ el.parentNode.removeChild(el);
659
+ }
660
+ }
661
+
662
+ ngAfterViewInit() {
663
+ this.$ngZone.runOutsideAngular(() => {
664
+ const view = this._processAngularOverlays(this.viewOptions || {});
665
+ const self = this;
666
+ this.renderOptions = this.renderOptions || {};
667
+ const render = (directiveId, data, instance, objectType, surface, def, modelObject, eventInfo) => {
668
+ let component;
669
+ if (def.component == null) {
670
+ if (isGroup(modelObject)) {
671
+ component = DefaultGroupComponent;
672
+ }
673
+ else {
674
+ component = DefaultNodeComponent;
675
+ }
676
+ }
677
+ else {
678
+ component = def.component;
679
+ }
680
+ let createdComponent = self.$viewContainerRef.createComponent(component);
681
+ let _componentRef = createdComponent.instance;
682
+ _componentRef.data = data || {};
683
+ _componentRef.model = model;
684
+ _componentRef.surface = surface;
685
+ _componentRef.modelObject = modelObject;
686
+ // get the reflection data for the component
687
+ const componentInfo = reflectComponentType(component);
688
+ // ..and populate any declared inputs from data
689
+ componentInfo.inputs.forEach((pt) => {
690
+ const pv = _componentRef.data[pt.propName];
691
+ if (pv != null) {
692
+ _componentRef[pt.propName] = pv;
693
+ }
694
+ });
695
+ // map to any outputs
696
+ componentInfo.outputs.forEach((pt) => {
697
+ _componentRef[pt.propName].subscribe((d) => self.vertexEvent.emit({
698
+ vertex: modelObject,
699
+ event: pt.propName,
700
+ payload: d,
701
+ component: createdComponent,
702
+ }));
703
+ });
704
+ // if angular def has 'inputs' set, set them on the component. this is different to the mechanism above, in which values are extracted from
705
+ // each node's backing data. here we inject values either as a string or from some arbitrary function.
706
+ if (def.inputs != null) {
707
+ for (let k in def.inputs) {
708
+ const v = def.inputs[k];
709
+ const value = typeof v === "string" ? v : v(modelObject);
710
+ _componentRef[k] = value;
711
+ }
712
+ }
713
+ createdComponent.changeDetectorRef.detectChanges();
714
+ // TODO this should not be necessary
715
+ const nativeElement = self.getNativeElement(createdComponent);
716
+ _componentRef._el = nativeElement;
717
+ _componentRef._el._visuallyJsNgComponent = _componentRef;
718
+ _componentRef._el._ref = createdComponent; // we store _ref so we can call `destroy` on it later if the node is removed.
719
+ surface.$vertexRendered(modelObject, nativeElement, def, eventInfo);
720
+ };
721
+ const templateRenderer = {
722
+ asynchronous: false,
723
+ reactive: true,
724
+ usesWrapperElement: false,
725
+ update: (el, data, v, renderer) => { },
726
+ render,
727
+ rerender: (directiveId, data, instance, objectType, surface, def, modelObject, eventInfo, originalElement) => {
728
+ this.$removeNgElement(originalElement);
729
+ render(directiveId, data, instance, objectType, surface, def, modelObject, eventInfo);
730
+ },
731
+ cleanupVertex: (objId, el) => {
732
+ this.$removeNgElement(el);
733
+ },
734
+ cleanupPort: (objId, el) => {
735
+ this.$removeNgElement(el);
736
+ },
737
+ };
738
+ const renderParams = extend(this.renderOptions || {}, {
739
+ view: view,
740
+ });
741
+ let model = new BrowserUIAngularModel(this.modelOptions);
742
+ this.model = model;
743
+ this.surface = renderSurface(model, self.$el.nativeElement, templateRenderer, renderParams);
744
+ //this.$service.addSurface(this.surfaceId, this.surface);
745
+ // new
746
+ this.$vjs.$setSurface(this.surface);
747
+ // ----------------
748
+ this.nodeUpdateFn = this.nodeOrGroupUpdated.bind(this);
749
+ model.bind(EVENT_NODE_UPDATED, this.nodeUpdateFn);
750
+ model.bind(EVENT_PORT_ADDED, this.nodeUpdateFn);
751
+ model.bind(EVENT_GROUP_UPDATED, this.nodeUpdateFn);
752
+ this.dataLoadEndFn = this.dataLoadEnd.bind(this);
753
+ model.bind(EVENT_DATA_LOAD_END, this.dataLoadEndFn);
754
+ this.portUpdateFn = this.portUpdated.bind(this);
755
+ model.bind(EVENT_PORT_UPDATED, this.portUpdateFn);
756
+ this.edgeUpdateFn = this.edgeUpdated.bind(this);
757
+ model.bind(EVENT_EDGE_UPDATED, this.edgeUpdateFn);
758
+ if (this.data) {
759
+ this.model.load({ data: this.data });
760
+ }
761
+ else if (this.url) {
762
+ this.model.load({ url: this.url });
763
+ }
764
+ });
765
+ }
766
+
767
+ ngOnDestroy() {
768
+ this.surface.destroy();
769
+ this.model.unbind(EVENT_NODE_UPDATED, this.nodeUpdateFn);
770
+ this.model.unbind(EVENT_GROUP_UPDATED, this.nodeUpdateFn);
771
+ this.model.unbind(EVENT_PORT_ADDED, this.nodeUpdateFn);
772
+ this.model.unbind(EVENT_PORT_UPDATED, this.portUpdateFn);
773
+ this.model.unbind(EVENT_EDGE_UPDATED, this.edgeUpdateFn);
774
+ this.model.unbind(EVENT_DATA_LOAD_END, this.dataLoadEndFn);
775
+ this.surface.unbind(EVENT_INTERNAL_CONNECTION, this.edgeAddFn);
776
+ }
777
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SurfaceComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
778
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: SurfaceComponent, selector: "vjs-surface", inputs: { viewOptions: "viewOptions", renderOptions: "renderOptions", modelOptions: "modelOptions", data: "data", url: "url" }, outputs: { vertexEvent: "vertexEvent" }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true }); }
779
+ }
780
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SurfaceComponent, decorators: [{
781
+ type: Component,
782
+ args: [{
783
+ selector: "vjs-surface",
784
+ template: `<ng-content></ng-content>`
785
+ }]
786
+ }], propDecorators: { viewOptions: [{
787
+ type: Input
788
+ }], renderOptions: [{
789
+ type: Input
790
+ }], modelOptions: [{
791
+ type: Input
792
+ }], data: [{
793
+ type: Input
794
+ }], url: [{
795
+ type: Input
796
+ }], vertexEvent: [{
797
+ type: Output
798
+ }] } });
799
+
800
+
801
+ class ShapePaletteComponent {
802
+ constructor() {
803
+
804
+ this.dragSize = { width: 150, height: 100 };
805
+
806
+ this.iconSize = { width: 150, height: 100 };
807
+
808
+ this.fill = ShapeLibraryDefaults.FILL;
809
+
810
+ this.outline = ShapeLibraryDefaults.STROKE;
811
+
812
+ this.showAllMessage = "Show all";
813
+
814
+ this.selectAfterDrop = true;
815
+
816
+ this.paletteStrokeWidth = 1;
817
+
818
+ this.dataGenerator = undefined;
819
+ this.$el = inject(ElementRef);
820
+ this.$vjs = inject(VisuallyJsService);
821
+ }
822
+ ngAfterViewInit() {
823
+ this.$vjs.getUI((ui) => {
824
+
825
+ new ShapePalette(ui, {
826
+ container: this.$el.nativeElement,
827
+ initialSet: this.initialSet,
828
+ dragSize: this.dragSize,
829
+ iconSize: this.iconSize,
830
+ fill: this.fill,
831
+ outline: this.outline,
832
+ shapeLibrary: ui.getShapeLibrary(),
833
+ showAllMessage: this.showAllMessage,
834
+ selectAfterDrop: this.selectAfterDrop,
835
+ paletteStrokeWidth: this.paletteStrokeWidth,
836
+ dataGenerator: this.dataGenerator,
837
+ onVertexAdded: this.onVertexAdded,
838
+ preparedShapes: this.preparedShapes
839
+ });
840
+ });
841
+ }
842
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ShapePaletteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
843
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ShapePaletteComponent, selector: "vjs-shape-palette", inputs: { initialSet: "initialSet", dragSize: "dragSize", iconSize: "iconSize", fill: "fill", outline: "outline", showAllMessage: "showAllMessage", selectAfterDrop: "selectAfterDrop", paletteStrokeWidth: "paletteStrokeWidth", onVertexAdded: "onVertexAdded", dataGenerator: "dataGenerator", preparedShapes: "preparedShapes" }, ngImport: i0, template: `<div></div>`, isInline: true }); }
844
+ }
845
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ShapePaletteComponent, decorators: [{
846
+ type: Component,
847
+ args: [{
848
+ template: `<div></div>`,
849
+ selector: `vjs-shape-palette`
850
+ }]
851
+ }], propDecorators: { initialSet: [{
852
+ type: Input
853
+ }], dragSize: [{
854
+ type: Input
855
+ }], iconSize: [{
856
+ type: Input
857
+ }], fill: [{
858
+ type: Input
859
+ }], outline: [{
860
+ type: Input
861
+ }], showAllMessage: [{
862
+ type: Input
863
+ }], selectAfterDrop: [{
864
+ type: Input
865
+ }], paletteStrokeWidth: [{
866
+ type: Input
867
+ }], onVertexAdded: [{
868
+ type: Input
869
+ }], dataGenerator: [{
870
+ type: Input
871
+ }], preparedShapes: [{
872
+ type: Input
873
+ }] } });
874
+
875
+
876
+ class ShapeComponent {
877
+ constructor() {
878
+
879
+ this.showLabels = false;
880
+
881
+ this.labelProperty = "label";
882
+
883
+ this.multilineLabels = true;
884
+
885
+ this.labelFillRatio = DEFAULT_LABEL_FILL_RATIO;
886
+ this.$el = inject(ElementRef);
887
+ this.$vjs = inject(VisuallyJsService);
888
+ }
889
+ _render() {
890
+ if (this.shapeLibrary != null) {
891
+ const svg = this.$el.nativeElement.childNodes[0];
892
+ const el = this.shapeLibrary.renderCompiledShape(this.obj, this.obj.outlineWidth || 2);
893
+ svg.replaceChildren(el);
894
+ if (this.showLabels) {
895
+ const lbl = this.shapeLibrary.renderShapeLabel(this.obj, this.labelProperty, this.labelStrokeWidth, this.label, this.obj.color || "#000000", this.obj.color || "#000000", this.font);
896
+ svg.appendChild(lbl);
897
+ if (this.multilineLabels !== false) {
898
+ convertToMultilineText(lbl, this.label || this.obj[this.labelProperty] || "", this.width * this.labelFillRatio);
899
+ }
900
+ }
901
+ }
902
+ }
903
+ ngAfterViewInit() {
904
+ this.$vjs.getUI((b) => {
905
+ this.shapeLibrary = b.getShapeLibrary();
906
+ this._render();
907
+ });
908
+ }
909
+ ngOnChanges(changes) {
910
+ this._render();
911
+ }
912
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ShapeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
913
+ 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
914
+ [attr.stroke-width]="obj.outlineWidth || 2"
915
+ attr.fill="{{ obj.fill }}"
916
+ attr.stroke="{{ obj.outline }}"
917
+ style="width:100%;height:100%;inset:0;position:absolute;"
918
+ preserveAspectRatio="none"
919
+ attr.viewBox="0 0 {{ width }} {{ height }}"
920
+ ></svg:svg>`, isInline: true }); }
921
+ }
922
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ShapeComponent, decorators: [{
923
+ type: Component,
924
+ args: [{
925
+ template: `<svg:svg
926
+ [attr.stroke-width]="obj.outlineWidth || 2"
927
+ attr.fill="{{ obj.fill }}"
928
+ attr.stroke="{{ obj.outline }}"
929
+ style="width:100%;height:100%;inset:0;position:absolute;"
930
+ preserveAspectRatio="none"
931
+ attr.viewBox="0 0 {{ width }} {{ height }}"
932
+ ></svg:svg>`,
933
+ selector: `vjs-shape`,
934
+ }]
935
+ }], propDecorators: { obj: [{
936
+ type: Input
937
+ }], width: [{
938
+ type: Input
939
+ }], height: [{
940
+ type: Input
941
+ }], showLabels: [{
942
+ type: Input
943
+ }], labelProperty: [{
944
+ type: Input
945
+ }], labelStrokeWidth: [{
946
+ type: Input
947
+ }], label: [{
948
+ type: Input
949
+ }], multilineLabels: [{
950
+ type: Input
951
+ }], labelFillRatio: [{
952
+ type: Input
953
+ }], font: [{
954
+ type: Input
955
+ }] } });
956
+
957
+ const ATTRIBUTE_CAN_UNDO = "can-undo";
958
+ const ATTRIBUTE_CAN_REDO = "can-redo";
959
+ const CLASS_SELECTED_MODE = "vjs-selected-mode";
960
+ const ATTRIBUTE_HAS_SELECTION = "vjs-controls-has-selection";
961
+
962
+ class ControlsComponent {
963
+ constructor() {
964
+
965
+ this.undoRedo = true;
966
+
967
+ this.zoomToExtents = true;
968
+
969
+ this.zoomButtons = false;
970
+
971
+ this.clear = true;
972
+
973
+ this.clearMessage = "Clear dataset?";
974
+
975
+ this.buttons = [];
976
+
977
+ this.orientation = "row";
978
+ this.showPanButton = true;
979
+ this.showLassoButton = true;
980
+ this.$vjs = inject(VisuallyJsService);
981
+ this.$el = inject(ElementRef);
982
+ this.$cdr = inject(ChangeDetectorRef);
983
+ }
984
+ updateSelectionState() {
985
+ const controls = this.getNativeElement(this.$el);
986
+ if (this.ui.model.getSelection().isEmpty()) {
987
+ controls.removeAttribute(ATTRIBUTE_HAS_SELECTION);
988
+ }
989
+ else {
990
+ controls.setAttribute(ATTRIBUTE_HAS_SELECTION, "true");
991
+ }
992
+ }
993
+ ngOnInit() {
994
+ this.modeButtons = this.buttons.filter((b) => b.mode != null);
995
+ this.otherButtons = this.buttons.filter((b) => b.mode == null);
996
+ this.$vjs.getUI((ui) => {
997
+ this.ui = ui;
998
+ this.showLassoButton = ui.getPlugin(LassoPlugin.type) != null;
999
+ this.showPanButton = this.showLassoButton === true;
1000
+ this.ui.bind(EVENT_SURFACE_MODE_CHANGED, (mode) => {
1001
+ const controls = this.getNativeElement(this.$el);
1002
+ const modeButtons = this.ui.$getSelector(controls, "[data-mode]");
1003
+ this.ui.removeClass(modeButtons, CLASS_SELECTED_MODE);
1004
+ this.ui.addClass(this.ui.$getSelector(controls, `[data-mode='${mode}']`), CLASS_SELECTED_MODE);
1005
+ });
1006
+ this.ui.model.bind(EVENT_UNDOREDO_UPDATE, (state) => {
1007
+ const controls = this.getNativeElement(this.$el);
1008
+ controls.setAttribute(ATTRIBUTE_CAN_UNDO, state.undoCount > 0 ? TRUE : FALSE);
1009
+ controls.setAttribute(ATTRIBUTE_CAN_REDO, state.redoCount > 0 ? TRUE : FALSE);
1010
+ });
1011
+ this.ui.model.bind(EVENT_SELECT, () => this.updateSelectionState());
1012
+ this.ui.model.bind(EVENT_DESELECT, () => this.updateSelectionState());
1013
+ this.ui.model.bind(EVENT_SELECTION_CLEARED, () => this.updateSelectionState());
1014
+ this.$cdr.detectChanges();
1015
+ });
1016
+ }
1017
+ getNativeElement(component) {
1018
+ return (component.nativeElement ||
1019
+ component._nativeElement ||
1020
+ component.location.nativeElement).childNodes[0];
1021
+ }
1022
+ panMode() {
1023
+ this.ui.setMode(SURFACE_MODE_PAN);
1024
+ }
1025
+ selectMode() {
1026
+ this.ui.setMode(SURFACE_MODE_SELECT);
1027
+ }
1028
+ zoomToFit() {
1029
+ this.ui.model.clearSelection();
1030
+ this.ui.zoomToFit();
1031
+ }
1032
+ zoomIn() {
1033
+ this.ui.zoomIn();
1034
+ }
1035
+ zoomOut() {
1036
+ this.ui.zoomOut();
1037
+ }
1038
+ resetSelection() {
1039
+ this.ui.model.clearSelection();
1040
+ if (supportsPathEditing(this.ui)) {
1041
+ this.ui.stopEditingPath();
1042
+ }
1043
+ }
1044
+ undo() {
1045
+ this.ui.model.undo();
1046
+ }
1047
+ redo() {
1048
+ this.ui.model.redo();
1049
+ }
1050
+ doClear() {
1051
+ const t = this.ui.model;
1052
+ if ((t.getNodeCount() === 0 && t.getGroupCount() === 0) ||
1053
+ confirm(this.clearMessage)) {
1054
+ t.clear();
1055
+ }
1056
+ }
1057
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ControlsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1058
+ 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"] }] }); }
1059
+ }
1060
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ControlsComponent, decorators: [{
1061
+ type: Component,
1062
+ args: [{
1063
+ selector: "vjs-controls",
1064
+ template: `<div class="vjs-controls" [attr.data-vjs-orientation]="orientation">
1065
+ <i *ngIf="showPanButton" class="vjs-pan-mode ${CLASS_SELECTED_MODE}" data-mode="${SURFACE_MODE_PAN}" title="Pan Mode" (click)="panMode()">
1066
+ <svg viewBox="${PAN_VIEW_BOX}" stroke="currentColor" fill="none">
1067
+ <path d="${PAN_PATH}"></path>
1068
+ </svg>
1069
+ </i>
1070
+ <i *ngIf="showLassoButton" class="vjs-select-mode" data-mode="${SURFACE_MODE_SELECT}" title="Select Mode" (click)="selectMode()">
1071
+ <svg fill="currentColor" viewBox="${LASSO_VIEW_BOX}" stroke="currentColor">
1072
+ <path d="${LASSO_PATH}"></path>
1073
+ </svg>
1074
+ </i>
1075
+
1076
+ <i *ngFor="let button of modeButtons" data-mode="{{ button.mode }}" class="{{ button.class }}" title="{{ button.title }}"></i>
1077
+
1078
+ <i *ngIf="zoomToExtents" class="vjs-zoom-to-fit" data-reset="true"title="Zoom To Fit" (click)="zoomToFit()">
1079
+ <svg viewBox="${ZOOM_TO_FIT_VIEW_BOX}" stroke="currentColor" fill="currentColor"><path d="${ZOOM_TO_FIT_PATH}"></path></svg>
1080
+ </i>
1081
+
1082
+ <i *ngIf="zoomButtons" class="vjs-zoom-in" data-zoom-in="true" title="Zoom In" (click)="zoomIn()">
1083
+ <svg viewBox="${ZOOM_IN_OUT_VIEW_BOX}" stroke="currentColor" fill="currentColor"><path d="${ZOOM_IN_PATH}"></path></svg>
1084
+ </i>
1085
+
1086
+ <i *ngIf="zoomButtons" class="vjs-zoom-out" data-zoom-out="true" title="Zoom Out" (click)="zoomOut()">
1087
+ <svg viewBox="${ZOOM_IN_OUT_VIEW_BOX}" stroke="currentColor" fill="currentColor"><path d="${ZOOM_OUT_PATH}"></path></svg>
1088
+ </i>
1089
+
1090
+ <i *ngIf="undoRedo" class="vjs-undo" data-undo="true" title="Undo last action" (click)="undo()"></i>
1091
+ <i *ngIf="undoRedo" class="vjs-redo" data-redo="true" title="Redo last action" (click)="redo()"></i>
1092
+ <i class="${CLASS_CONTROLS_RESET_SELECTION}" title="Clear selection" (click)="resetSelection()">
1093
+ <svg viewBox="${RESET_SELECTION_VIEW_BOX}" stroke="currentColor" fill="currentColor"><path d="${RESET_SELECTION_PATH}"></path></svg>
1094
+ </i>
1095
+ <i *ngIf="clear" class="vjs-clear-dataset" [title]="clearMessage" (click)="doClear()">
1096
+ <svg viewBox="${CLEAR_VIEW_BOX}" stroke="currentColor" fill="currentColor"><path d="${CLEAR_PATH}"></path></svg>
1097
+ </i>
1098
+ <i *ngFor="let button of otherButtons" class="{{ button.class }}" title="{{ button.title }}"></i>
1099
+ </div>`,
1100
+ }]
1101
+ }], propDecorators: { undoRedo: [{
1102
+ type: Input
1103
+ }], zoomToExtents: [{
1104
+ type: Input
1105
+ }], zoomButtons: [{
1106
+ type: Input
1107
+ }], clear: [{
1108
+ type: Input
1109
+ }], clearMessage: [{
1110
+ type: Input
1111
+ }], buttons: [{
1112
+ type: Input
1113
+ }], orientation: [{
1114
+ type: Input
1115
+ }] } });
1116
+
1117
+
1118
+ class EdgeTypePickerComponent {
1119
+ constructor(el) {
1120
+ this.el = el;
1121
+
1122
+ this.changeEvent = new EventEmitter();
1123
+ this.$vjs = inject(VisuallyJsService);
1124
+ }
1125
+ resolveMappings() {
1126
+ const mappings = this.edgeMappings || this.inspector.getFromContext(INSPECTOR_CONTEXT_EDGE_PROPERTY_MAPPINGS);
1127
+ return mappings || this.inspector.$ui.$getEdgePropertyMappings();
1128
+ }
1129
+ ngAfterViewInit() {
1130
+ this.$vjs.getInspector(inspector => {
1131
+ this.inspector = inspector;
1132
+ this.inspector.onChange(() => {
1133
+ this.edgeTypePicker.select(this.propertyName, this.inspector.getValue(this.propertyName));
1134
+ });
1135
+ const current = this.inspector.getValue(this.propertyName) || '';
1136
+ this.edgeTypePicker = new EdgeTypePicker(this.inspector.$ui, this.el.nativeElement, this.resolveMappings(), current, (p, v) => {
1137
+ this.inspector.setValue(this.propertyName, v);
1138
+ this.changeEvent.emit(v);
1139
+ });
1140
+ this.edgeTypePicker.render(this.propertyName, this.inspector._currentCommonData);
1141
+ });
1142
+ }
1143
+ 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 }); }
1144
+ 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 }); }
1145
+ }
1146
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EdgeTypePickerComponent, decorators: [{
1147
+ type: Component,
1148
+ args: [{
1149
+ selector: "vjs-edge-type",
1150
+ template: `<div [attr.vjs-att]="propertyName"></div>`
1151
+ }]
1152
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { propertyName: [{
1153
+ type: Input
1154
+ }], edgeMappings: [{
1155
+ type: Input
1156
+ }], changeEvent: [{
1157
+ type: Output
1158
+ }] } });
1159
+
1160
+
1161
+ class PaletteComponent {
1162
+ constructor() {
1163
+ this.$vjs = inject(VisuallyJsService);
1164
+ this.$el = inject(ElementRef);
1165
+ }
1166
+
1167
+ ngAfterViewInit() {
1168
+ this.$vjs.getSurface((surface) => {
1169
+ let self = this;
1170
+ let params = {
1171
+ source: self.$el.nativeElement,
1172
+ selector: self.selector,
1173
+ allowDropOnEdge: this.allowDropOnEdge,
1174
+ allowDropOnCanvas: this.allowDropOnCanvas,
1175
+ allowDropOnGroup: this.allowDropOnGroup,
1176
+ allowDropOnNode: this.allowDropOnNode,
1177
+ mode: this.mode,
1178
+ selectAfterAdd: this.selectAfterAdd,
1179
+ allowClickToAdd: this.allowClickToAdd,
1180
+ clickToAddOnly: this.clickToAddOnly
1181
+ };
1182
+ if (this.dataGenerator != null) {
1183
+ params.dataGenerator = this.dataGenerator;
1184
+ }
1185
+ if (this.typeGenerator != null) {
1186
+ params.typeGenerator = this.typeGenerator;
1187
+ }
1188
+ if (this.groupIdentifier != null) {
1189
+ params.groupIdentifier = this.groupIdentifier;
1190
+ }
1191
+ if (this.onVertexAdded != null) {
1192
+ params.onVertexAdded = this.onVertexAdded;
1193
+ }
1194
+ if (this.dragSize != null) {
1195
+ params.dragSize = this.dragSize;
1196
+ }
1197
+ if (this.canvasDropFilter != null) {
1198
+ params.canvasDropFilter = this.canvasDropFilter;
1199
+ }
1200
+ this.palette = new Palette(surface, params);
1201
+ });
1202
+ }
1203
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PaletteComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1204
+ 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 }); }
1205
+ }
1206
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PaletteComponent, decorators: [{
1207
+ type: Directive,
1208
+ args: [{
1209
+ selector: "[vjs-palette]",
1210
+ }]
1211
+ }], propDecorators: { selector: [{
1212
+ type: Input
1213
+ }], dataGenerator: [{
1214
+ type: Input
1215
+ }], typeGenerator: [{
1216
+ type: Input
1217
+ }], groupIdentifier: [{
1218
+ type: Input
1219
+ }], allowDropOnEdge: [{
1220
+ type: Input
1221
+ }], allowDropOnGroup: [{
1222
+ type: Input
1223
+ }], allowDropOnCanvas: [{
1224
+ type: Input
1225
+ }], allowDropOnNode: [{
1226
+ type: Input
1227
+ }], onVertexAdded: [{
1228
+ type: Input
1229
+ }], dragSize: [{
1230
+ type: Input
1231
+ }], canvasDropFilter: [{
1232
+ type: Input
1233
+ }], mode: [{
1234
+ type: Input
1235
+ }], selectAfterAdd: [{
1236
+ type: Input
1237
+ }], allowClickToAdd: [{
1238
+ type: Input
1239
+ }], clickToAddOnly: [{
1240
+ type: Input
1241
+ }] } });
1242
+
1243
+
1244
+ class ExportControlsComponent {
1245
+ constructor() {
1246
+
1247
+ this.showLabel = true;
1248
+
1249
+ this.label = "Export:";
1250
+
1251
+ this.allowSvgExport = true;
1252
+
1253
+ this.allowPngExport = true;
1254
+
1255
+ this.allowJpgExport = true;
1256
+ // new
1257
+ this.$vjs = inject(VisuallyJsService);
1258
+ this.$el = inject(ElementRef);
1259
+ }
1260
+ ngOnInit() {
1261
+ this.$vjs.getUI((b) => {
1262
+ this.ui = b;
1263
+ });
1264
+ }
1265
+ exportSVG() {
1266
+ new SvgExportUI(this.ui).export(this.svgOptions);
1267
+ }
1268
+ exportPNG() {
1269
+ new ImageExportUI(this.ui).export(this.imageOptions);
1270
+ }
1271
+ exportJPG() {
1272
+ new ImageExportUI(this.ui).export(Object.assign(this.imageOptions || {}, {
1273
+ type: "image/jpeg",
1274
+ }));
1275
+ }
1276
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ExportControlsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1277
+ 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"] }] }); }
1278
+ }
1279
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ExportControlsComponent, decorators: [{
1280
+ type: Component,
1281
+ args: [{
1282
+ selector: "vjs-export-controls",
1283
+ template: `<div class="${CLASS_CONTROLS} ${CLASS_EXPORT_CONTROLS}">
1284
+ <span *ngIf="showLabel">{{ label }}</span>
1285
+ <i *ngIf="allowSvgExport"
1286
+ ><a href="#" id="exportSvg" (click)="exportSVG()">SVG</a></i
1287
+ >
1288
+ <i *ngIf="allowPngExport"
1289
+ ><a href="#" id="exportPng" (click)="exportPNG()">PNG</a></i
1290
+ >
1291
+ <i *ngIf="allowJpgExport"
1292
+ ><a href="#" id="exportJpg" (click)="exportJPG()">JPG</a></i
1293
+ >
1294
+ </div>`,
1295
+ }]
1296
+ }], propDecorators: { showLabel: [{
1297
+ type: Input
1298
+ }], label: [{
1299
+ type: Input
1300
+ }], margins: [{
1301
+ type: Input
1302
+ }], svgOptions: [{
1303
+ type: Input
1304
+ }], imageOptions: [{
1305
+ type: Input
1306
+ }], allowSvgExport: [{
1307
+ type: Input
1308
+ }], allowPngExport: [{
1309
+ type: Input
1310
+ }], allowJpgExport: [{
1311
+ type: Input
1312
+ }] } });
1313
+
1314
+
1315
+ class ColorPickerComponent {
1316
+ constructor() {
1317
+
1318
+ this.maxColors = 10;
1319
+
1320
+ this.changeEvent = new EventEmitter();
1321
+ this.swatches = signal([]);
1322
+ this.$vjs = inject(VisuallyJsService);
1323
+ this.$el = inject(ElementRef);
1324
+ this.$cdr = inject(ChangeDetectorRef);
1325
+ }
1326
+ $getInspector(cb) {
1327
+ this.$vjs.getInspector(cb);
1328
+ }
1329
+ selectColor(color) {
1330
+ this.$getInspector(inspector => {
1331
+ inspector.setValue(this.propertyName, color);
1332
+ this.$el.nativeElement.querySelector("[type='color']").value = color;
1333
+ });
1334
+ }
1335
+ pushColor(color) {
1336
+ this.$getInspector(inspector => {
1337
+ const rc = inspector.getFromContext(INSPECTOR_CONTEXT_RECENT_COLORS);
1338
+ if (rc != null) {
1339
+ if (rc.find((c) => c === color) == null) {
1340
+ const cc = rc.slice();
1341
+ cc.unshift(color);
1342
+ if (cc.length >= this.maxColors) {
1343
+ cc.length = this.maxColors;
1344
+ }
1345
+ inspector.updateContext(INSPECTOR_CONTEXT_RECENT_COLORS, cc);
1346
+ }
1347
+ }
1348
+ });
1349
+ }
1350
+ ngAfterViewInit() {
1351
+ this.$getInspector(inspector => {
1352
+ this.swatches.set(inspector.ensureContext(INSPECTOR_CONTEXT_RECENT_COLORS, () => []));
1353
+ inspector.bind(EVENT_CONTEXT_UPDATE, (p) => {
1354
+ if (p.key === INSPECTOR_CONTEXT_RECENT_COLORS) {
1355
+ this.swatches.set(p.value);
1356
+ this.$cdr.detectChanges();
1357
+ }
1358
+ });
1359
+ const colorInput = this.$el.nativeElement.querySelector("[type='color']");
1360
+ colorInput.onchange = () => {
1361
+ const color = colorInput.value;
1362
+ this.pushColor(color);
1363
+ inspector.setValue(this.propertyName, color, true);
1364
+ };
1365
+ setTimeout(() => {
1366
+ // if there is a color, maybe push to context
1367
+ const v = inspector.getValue(this.propertyName);
1368
+ if (v != null) {
1369
+ this.pushColor(v);
1370
+ }
1371
+ });
1372
+ });
1373
+ }
1374
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ColorPickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1375
+ 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"] }] }); }
1376
+ }
1377
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ColorPickerComponent, decorators: [{
1378
+ type: Component,
1379
+ args: [{
1380
+ selector: "vjs-color",
1381
+ template: `<div class="${CLASS_COLOR_PICKER}">
1382
+ <input type="color" [attr.vjs-att]="propertyName"/>
1383
+ <div class="${CLASS_COLOR_PICKER_SWATCHES}">
1384
+ <div *ngFor="let swatch of swatches()" class="${CLASS_COLOR_PICKER_SWATCH}" attr.data-color="{{swatch}}" style="background-color:{{swatch}}" (click)="selectColor(swatch)"></div>
1385
+ </div>
1386
+ </div>`
1387
+ }]
1388
+ }], propDecorators: { propertyName: [{
1389
+ type: Input
1390
+ }], maxColors: [{
1391
+ type: Input
1392
+ }], changeEvent: [{
1393
+ type: Output
1394
+ }] } });
1395
+
1396
+
1397
+ class DiagramComponent {
1398
+ constructor() {
1399
+ this.$ngZone = inject(NgZone);
1400
+ this.$el = inject(ElementRef);
1401
+ this.$vjs = inject(VisuallyJsService);
1402
+ }
1403
+ ngAfterViewInit() {
1404
+ this.$ngZone.runOutsideAngular(() => {
1405
+ this.diagram = createDiagram(this.$el.nativeElement, this.options, this.modelOptions);
1406
+ this.$vjs.$setDiagram(this.diagram);
1407
+ if (this.data != null) {
1408
+ this.diagram.load({ data: this.data });
1409
+ }
1410
+ else if (this.url != null) {
1411
+ this.diagram.load({ url: this.url });
1412
+ }
1413
+ });
1414
+ }
1415
+ ngOnDestroy() {
1416
+ this.diagram.$destroy();
1417
+ //this.$service.removeDiagram(this.diagramId, this.diagram)
1418
+ }
1419
+
1420
+ save(options) {
1421
+ return this.diagram.save(options);
1422
+ }
1423
+
1424
+ saveToUrl(options) {
1425
+ this.diagram.saveToUrl(options);
1426
+ }
1427
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiagramComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1428
+ 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 }); }
1429
+ }
1430
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiagramComponent, decorators: [{
1431
+ type: Component,
1432
+ args: [{
1433
+ selector: "vjs-diagram",
1434
+ template: `<ng-content></ng-content>`
1435
+ }]
1436
+ }], propDecorators: { options: [{
1437
+ type: Input
1438
+ }], data: [{
1439
+ type: Input
1440
+ }], url: [{
1441
+ type: Input
1442
+ }], modelOptions: [{
1443
+ type: Input
1444
+ }] } });
1445
+
1446
+ class ColumnChartComponent {
1447
+ constructor() {
1448
+ this.$el = inject(ElementRef);
1449
+ this.$ngZone = inject(NgZone);
1450
+ this.$vjs = inject(VisuallyJsService);
1451
+ }
1452
+ _init(dataSource, data, url) {
1453
+ this.$ngZone.runOutsideAngular(() => {
1454
+ const o = Object.assign({}, this.options);
1455
+ Object.assign(o, { dataSource });
1456
+ this.chart = new ColumnChart(this.$el.nativeElement, o);
1457
+ if (data) {
1458
+ this.chart.load({ data });
1459
+ }
1460
+ else if (url) {
1461
+ this.chart.load({ url });
1462
+ }
1463
+ });
1464
+ }
1465
+
1466
+ ngAfterViewInit() {
1467
+ if (this.useModel) {
1468
+ this.$vjs.getModel((p) => {
1469
+ this._init(p, null, null);
1470
+ });
1471
+ }
1472
+ else {
1473
+ this._init(null, this.data, this.url);
1474
+ }
1475
+ }
1476
+ ngOnDestroy() {
1477
+ this.chart?.destroy();
1478
+ }
1479
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ColumnChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1480
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ColumnChartComponent, selector: "vjs-column-chart", inputs: { data: "data", url: "url", options: "options", useModel: "useModel" }, ngImport: i0, template: `<div></div>`, isInline: true }); }
1481
+ }
1482
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ColumnChartComponent, decorators: [{
1483
+ type: Component,
1484
+ args: [{
1485
+ selector: "vjs-column-chart",
1486
+ template: `<div></div>`
1487
+ }]
1488
+ }], propDecorators: { data: [{
1489
+ type: Input
1490
+ }], url: [{
1491
+ type: Input
1492
+ }], options: [{
1493
+ type: Input
1494
+ }], useModel: [{
1495
+ type: Input
1496
+ }] } });
1497
+
1498
+ class BarChartComponent {
1499
+ constructor() {
1500
+ this.$vjs = inject(VisuallyJsService);
1501
+ this.$el = inject(ElementRef);
1502
+ this.$ngZone = inject(NgZone);
1503
+ }
1504
+ _init(dataSource, data, url) {
1505
+ this.$ngZone.runOutsideAngular(() => {
1506
+ const o = Object.assign({}, this.options);
1507
+ Object.assign(o, { dataSource });
1508
+ this.chart = new BarChart(this.$el.nativeElement, o);
1509
+ if (data) {
1510
+ this.chart.load({ data });
1511
+ }
1512
+ else if (url) {
1513
+ this.chart.load({ url });
1514
+ }
1515
+ });
1516
+ }
1517
+
1518
+ ngAfterViewInit() {
1519
+ if (this.useModel) {
1520
+ this.$vjs.getModel((p) => {
1521
+ this._init(p, null, null);
1522
+ });
1523
+ }
1524
+ else {
1525
+ this._init(null, this.data, this.url);
1526
+ }
1527
+ }
1528
+ ngOnDestroy() {
1529
+ this.chart?.destroy();
1530
+ }
1531
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BarChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1532
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: BarChartComponent, selector: "vjs-bar-chart", inputs: { data: "data", url: "url", options: "options", useModel: "useModel" }, ngImport: i0, template: `<div></div>`, isInline: true }); }
1533
+ }
1534
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BarChartComponent, decorators: [{
1535
+ type: Component,
1536
+ args: [{
1537
+ selector: "vjs-bar-chart",
1538
+ template: `<div></div>`
1539
+ }]
1540
+ }], propDecorators: { data: [{
1541
+ type: Input
1542
+ }], url: [{
1543
+ type: Input
1544
+ }], options: [{
1545
+ type: Input
1546
+ }], useModel: [{
1547
+ type: Input
1548
+ }] } });
1549
+
1550
+ class DiagramPaletteComponent {
1551
+ constructor() {
1552
+ this.$el = inject(ElementRef);
1553
+ this.$vjs = inject(VisuallyJsService);
1554
+ }
1555
+ $init() {
1556
+
1557
+ new DiagramPalette(this.$el.nativeElement, this.diagram, {
1558
+ fill: this.fill,
1559
+ outline: this.outline,
1560
+ dragSize: this.dragSize,
1561
+ inspector: this.inspector,
1562
+ iconSize: this.iconSize,
1563
+ showLabels: this.showLabels,
1564
+ paletteStrokeWidth: this.paletteStrokeWidth,
1565
+ showAllMessage: this.showAllMessage,
1566
+ onCellAdded: this.onCellAdded,
1567
+ mode: this.mode,
1568
+ allowClickToAdd: this.allowClickToAdd,
1569
+ autoExitDrawMode: this.autoExitDrawMode,
1570
+ selectAfterAdd: this.selectAfterAdd,
1571
+ onVertexAdded: this.onVertexAdded,
1572
+ preparedShapes: this.preparedShapes
1573
+ });
1574
+ }
1575
+ ngAfterViewInit() {
1576
+ if (this.diagram != null) {
1577
+ this.$init();
1578
+ }
1579
+ else {
1580
+ this.$vjs.getDiagram((d) => {
1581
+ this.diagram = d;
1582
+ this.$init();
1583
+ });
1584
+ }
1585
+ }
1586
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiagramPaletteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1587
+ 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 }); }
1588
+ }
1589
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiagramPaletteComponent, decorators: [{
1590
+ type: Component,
1591
+ args: [{
1592
+ selector: "vjs-diagram-palette",
1593
+ template: `<div></div>`,
1594
+ }]
1595
+ }], propDecorators: { fill: [{
1596
+ type: Input
1597
+ }], outline: [{
1598
+ type: Input
1599
+ }], dragSize: [{
1600
+ type: Input
1601
+ }], inspector: [{
1602
+ type: Input
1603
+ }], iconSize: [{
1604
+ type: Input
1605
+ }], showLabels: [{
1606
+ type: Input
1607
+ }], paletteStrokeWidth: [{
1608
+ type: Input
1609
+ }], showAllMessage: [{
1610
+ type: Input
1611
+ }], onCellAdded: [{
1612
+ type: Input
1613
+ }], mode: [{
1614
+ type: Input
1615
+ }], allowClickToAdd: [{
1616
+ type: Input
1617
+ }], autoExitDrawMode: [{
1618
+ type: Input
1619
+ }], selectAfterAdd: [{
1620
+ type: Input
1621
+ }], diagram: [{
1622
+ type: Input
1623
+ }], onVertexAdded: [{
1624
+ type: Input
1625
+ }], preparedShapes: [{
1626
+ type: Input
1627
+ }] } });
1628
+
1629
+ class XYChartComponent {
1630
+ constructor() {
1631
+ this.$el = inject(ElementRef);
1632
+ this.$ngZone = inject(NgZone);
1633
+ }
1634
+
1635
+ ngAfterViewInit() {
1636
+ this.$ngZone.runOutsideAngular(() => {
1637
+ this.chart = new CategoryValueChart(this.$el.nativeElement, this.options);
1638
+ if (this.data) {
1639
+ this.chart.load({ data: this.data });
1640
+ }
1641
+ else if (this.url) {
1642
+ this.chart.load({ url: this.url });
1643
+ }
1644
+ });
1645
+ }
1646
+ ngOnDestroy() {
1647
+ this.chart?.destroy();
1648
+ }
1649
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: XYChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1650
+ 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 }); }
1651
+ }
1652
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: XYChartComponent, decorators: [{
1653
+ type: Component,
1654
+ args: [{
1655
+ selector: "vjs-xy-chart",
1656
+ template: `<div></div>`
1657
+ }]
1658
+ }], propDecorators: { data: [{
1659
+ type: Input
1660
+ }], url: [{
1661
+ type: Input
1662
+ }], options: [{
1663
+ type: Input
1664
+ }] } });
1665
+
1666
+ class LineChartComponent {
1667
+ constructor() {
1668
+ this.$el = inject(ElementRef);
1669
+ this.$ngZone = inject(NgZone);
1670
+ this.$vjs = inject(VisuallyJsService);
1671
+ }
1672
+ _init(dataSource, data, url) {
1673
+ this.$ngZone.runOutsideAngular(() => {
1674
+ const o = Object.assign({}, this.options);
1675
+ Object.assign(o, { dataSource });
1676
+ this.chart = new LineChart(this.$el.nativeElement, o);
1677
+ if (data) {
1678
+ this.chart.load({ data });
1679
+ }
1680
+ else if (url) {
1681
+ this.chart.load({ url });
1682
+ }
1683
+ });
1684
+ }
1685
+
1686
+ ngAfterViewInit() {
1687
+ if (this.useModel) {
1688
+ this.$vjs.getModel((p) => {
1689
+ this._init(p, null, null);
1690
+ });
1691
+ }
1692
+ else {
1693
+ this._init(null, this.data, this.url);
1694
+ }
1695
+ }
1696
+ ngOnDestroy() {
1697
+ this.chart?.destroy();
1698
+ }
1699
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LineChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1700
+ 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 }); }
1701
+ }
1702
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LineChartComponent, decorators: [{
1703
+ type: Component,
1704
+ args: [{
1705
+ selector: "vjs-line-chart",
1706
+ template: `<div></div>`
1707
+ }]
1708
+ }], propDecorators: { data: [{
1709
+ type: Input
1710
+ }], url: [{
1711
+ type: Input
1712
+ }], options: [{
1713
+ type: Input
1714
+ }], useModel: [{
1715
+ type: Input
1716
+ }] } });
1717
+
1718
+ class AreaChartComponent {
1719
+ constructor() {
1720
+ this.$vjs = inject(VisuallyJsService);
1721
+ this.$el = inject(ElementRef);
1722
+ this.$ngZone = inject(NgZone);
1723
+ }
1724
+ _init(dataSource, data, url) {
1725
+ this.$ngZone.runOutsideAngular(() => {
1726
+ const o = Object.assign({}, this.options);
1727
+ Object.assign(o, { dataSource });
1728
+ this.chart = new AreaChart(this.$el.nativeElement, o);
1729
+ if (data) {
1730
+ this.chart.load({ data });
1731
+ }
1732
+ else if (url) {
1733
+ this.chart.load({ url });
1734
+ }
1735
+ });
1736
+ }
1737
+
1738
+ ngAfterViewInit() {
1739
+ if (this.useModel) {
1740
+ this.$vjs.getModel((p) => {
1741
+ this._init(p, null, null);
1742
+ });
1743
+ }
1744
+ else {
1745
+ this._init(null, this.data, this.url);
1746
+ }
1747
+ }
1748
+ ngOnDestroy() {
1749
+ this.chart?.destroy();
1750
+ }
1751
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AreaChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1752
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: AreaChartComponent, selector: "vjs-area-chart", inputs: { data: "data", url: "url", options: "options", useModel: "useModel" }, ngImport: i0, template: `<div></div>`, isInline: true }); }
1753
+ }
1754
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AreaChartComponent, decorators: [{
1755
+ type: Component,
1756
+ args: [{
1757
+ selector: "vjs-area-chart",
1758
+ template: `<div></div>`
1759
+ }]
1760
+ }], propDecorators: { data: [{
1761
+ type: Input
1762
+ }], url: [{
1763
+ type: Input
1764
+ }], options: [{
1765
+ type: Input
1766
+ }], useModel: [{
1767
+ type: Input
1768
+ }] } });
1769
+
1770
+ class PieChartComponent {
1771
+ constructor() {
1772
+ this.$el = inject(ElementRef);
1773
+ this.$ngZone = inject(NgZone);
1774
+ this.$vjs = inject(VisuallyJsService);
1775
+ }
1776
+ _init(dataSource, data, url) {
1777
+ this.$ngZone.runOutsideAngular(() => {
1778
+ const o = Object.assign({}, this.options);
1779
+ Object.assign(o, { dataSource });
1780
+ this.chart = new PieChart(this.$el.nativeElement, o);
1781
+ if (data) {
1782
+ this.chart.load({ data });
1783
+ }
1784
+ else if (url) {
1785
+ this.chart.load({ url });
1786
+ }
1787
+ });
1788
+ }
1789
+
1790
+ ngAfterViewInit() {
1791
+ if (this.useModel) {
1792
+ this.$vjs.getModel((p) => {
1793
+ this._init(p, null, null);
1794
+ });
1795
+ }
1796
+ else {
1797
+ this._init(null, this.data, this.url);
1798
+ }
1799
+ }
1800
+ ngOnDestroy() {
1801
+ this.chart?.destroy();
1802
+ }
1803
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PieChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1804
+ 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 }); }
1805
+ }
1806
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PieChartComponent, decorators: [{
1807
+ type: Component,
1808
+ args: [{
1809
+ selector: "vjs-pie-chart",
1810
+ template: `<div></div>`
1811
+ }]
1812
+ }], propDecorators: { data: [{
1813
+ type: Input
1814
+ }], url: [{
1815
+ type: Input
1816
+ }], options: [{
1817
+ type: Input
1818
+ }], useModel: [{
1819
+ type: Input
1820
+ }] } });
1821
+
1822
+ class ScatterChartComponent {
1823
+ constructor() {
1824
+ this.$el = inject(ElementRef);
1825
+ this.$ngZone = inject(NgZone);
1826
+ this.$vjs = inject(VisuallyJsService);
1827
+ }
1828
+ _init(dataSource, data, url) {
1829
+ this.$ngZone.runOutsideAngular(() => {
1830
+ const o = Object.assign({}, this.options);
1831
+ Object.assign(o, { dataSource });
1832
+ this.chart = new ScatterChart(this.$el.nativeElement, o);
1833
+ if (data) {
1834
+ this.chart.load({ data });
1835
+ }
1836
+ else if (url) {
1837
+ this.chart.load({ url });
1838
+ }
1839
+ });
1840
+ }
1841
+
1842
+ ngAfterViewInit() {
1843
+ if (this.useModel) {
1844
+ this.$vjs.getModel((p) => {
1845
+ this._init(p, null, null);
1846
+ });
1847
+ }
1848
+ else {
1849
+ this._init(null, this.data, this.url);
1850
+ }
1851
+ }
1852
+ ngOnDestroy() {
1853
+ this.chart?.destroy();
1854
+ }
1855
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ScatterChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1856
+ 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 }); }
1857
+ }
1858
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ScatterChartComponent, decorators: [{
1859
+ type: Component,
1860
+ args: [{
1861
+ selector: "vjs-scatter-chart",
1862
+ template: `<div></div>`
1863
+ }]
1864
+ }], propDecorators: { data: [{
1865
+ type: Input
1866
+ }], url: [{
1867
+ type: Input
1868
+ }], options: [{
1869
+ type: Input
1870
+ }], useModel: [{
1871
+ type: Input
1872
+ }] } });
1873
+
1874
+ class BubbleChartComponent {
1875
+ constructor() {
1876
+ this.$el = inject(ElementRef);
1877
+ this.$ngZone = inject(NgZone);
1878
+ this.$vjs = inject(VisuallyJsService);
1879
+ }
1880
+ _init(dataSource, data, url) {
1881
+ this.$ngZone.runOutsideAngular(() => {
1882
+ const o = Object.assign({}, this.options);
1883
+ Object.assign(o, { dataSource });
1884
+ this.chart = new BubbleChart(this.$el.nativeElement, o);
1885
+ if (data) {
1886
+ this.chart.load({ data });
1887
+ }
1888
+ else if (url) {
1889
+ this.chart.load({ url });
1890
+ }
1891
+ });
1892
+ }
1893
+
1894
+ ngAfterViewInit() {
1895
+ if (this.useModel) {
1896
+ this.$vjs.getModel((p) => {
1897
+ this._init(p, null, null);
1898
+ });
1899
+ }
1900
+ else {
1901
+ this._init(null, this.data, this.url);
1902
+ }
1903
+ }
1904
+ ngOnDestroy() {
1905
+ this.chart?.destroy();
1906
+ }
1907
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BubbleChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1908
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: BubbleChartComponent, selector: "vjs-bubble-chart", inputs: { data: "data", url: "url", options: "options", useModel: "useModel" }, ngImport: i0, template: `<div></div>`, isInline: true }); }
1909
+ }
1910
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BubbleChartComponent, decorators: [{
1911
+ type: Component,
1912
+ args: [{
1913
+ selector: "vjs-bubble-chart",
1914
+ template: `<div></div>`
1915
+ }]
1916
+ }], propDecorators: { data: [{
1917
+ type: Input
1918
+ }], url: [{
1919
+ type: Input
1920
+ }], options: [{
1921
+ type: Input
1922
+ }], useModel: [{
1923
+ type: Input
1924
+ }] } });
1925
+
1926
+ class SankeyChartComponent {
1927
+ constructor() {
1928
+ this.$el = inject(ElementRef);
1929
+ this.$ngZone = inject(NgZone);
1930
+ this.$vjs = inject(VisuallyJsService);
1931
+ }
1932
+
1933
+ _init(dataSource, csvData, jsonData, url) {
1934
+ this.$ngZone.runOutsideAngular(() => {
1935
+ const options = Object.assign({}, this.options);
1936
+ if (this.interactive != null) {
1937
+ options.interactive = this.interactive;
1938
+ }
1939
+ if (this.pivot != null) {
1940
+ options.pivot = this.pivot;
1941
+ }
1942
+ Object.assign(options, {
1943
+ csvData,
1944
+ jsonData,
1945
+ dataSource,
1946
+ url
1947
+ });
1948
+ this.chart = new SankeyChart(this.$el.nativeElement, options);
1949
+ });
1950
+ }
1951
+
1952
+ ngAfterViewInit() {
1953
+ if (this.useModel) {
1954
+ this.$vjs.getModel((p) => {
1955
+ this._init(p, null, null, null);
1956
+ });
1957
+ }
1958
+ else {
1959
+ this._init(null, this.csvData, this.jsonData, this.url);
1960
+ }
1961
+ }
1962
+ ngOnChanges(changes) {
1963
+ // @ts-ignore
1964
+ if (changes['pivot'] && this.chart) {
1965
+ // @ts-ignore
1966
+ this.chart.pivot(changes['pivot'].currentValue);
1967
+ }
1968
+ }
1969
+ ngOnDestroy() {
1970
+ this.chart?.destroy();
1971
+ }
1972
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SankeyChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1973
+ 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 }); }
1974
+ }
1975
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SankeyChartComponent, decorators: [{
1976
+ type: Component,
1977
+ args: [{
1978
+ selector: "vjs-sankey-chart",
1979
+ template: `<div></div>`
1980
+ }]
1981
+ }], propDecorators: { csvData: [{
1982
+ type: Input
1983
+ }], jsonData: [{
1984
+ type: Input
1985
+ }], url: [{
1986
+ type: Input
1987
+ }], interactive: [{
1988
+ type: Input
1989
+ }], pivot: [{
1990
+ type: Input
1991
+ }], options: [{
1992
+ type: Input
1993
+ }], useModel: [{
1994
+ type: Input
1995
+ }] } });
1996
+
1997
+ class DecoratorComponent {
1998
+ constructor() {
1999
+
2000
+ this.placement = 'floating';
2001
+
2002
+ this.position = { x: 0, y: 0 };
2003
+ this.el = inject(ElementRef);
2004
+ this.service = inject(VisuallyJsService);
2005
+ }
2006
+ ngAfterViewInit() {
2007
+ this.service.getSurface(s => {
2008
+ const nativeElement = this.el.nativeElement.firstElementChild;
2009
+ if (this.placement === 'fixed') {
2010
+ s.fixElement(nativeElement, this.position, this.constraints);
2011
+ }
2012
+ else {
2013
+ s.floatElement(nativeElement, this.position);
2014
+ }
2015
+ });
2016
+ }
2017
+ ngOnDestroy() {
2018
+ if (this.surface && this.placement === 'fixed') {
2019
+ this.surface.unfixElement(this.el.nativeElement.firstElementChild);
2020
+ }
2021
+ }
2022
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DecoratorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2023
+ 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: `
2024
+ <div style="display:inline-block;">
2025
+ <ng-content></ng-content>
2026
+ </div>
2027
+ `, isInline: true }); }
2028
+ }
2029
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DecoratorComponent, decorators: [{
2030
+ type: Component,
2031
+ args: [{
2032
+ selector: "vjs-decorator",
2033
+ template: `
2034
+ <div style="display:inline-block;">
2035
+ <ng-content></ng-content>
2036
+ </div>
2037
+ `
2038
+ }]
2039
+ }], propDecorators: { placement: [{
2040
+ type: Input
2041
+ }], position: [{
2042
+ type: Input
2043
+ }], constraints: [{
2044
+ type: Input
2045
+ }] } });
2046
+
2047
+
2048
+ class VisuallyJsModule {
2049
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: VisuallyJsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2050
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: VisuallyJsModule, declarations: [DefaultNodeComponent,
2051
+ DefaultGroupComponent,
2052
+ BasePortComponent,
2053
+ MiniviewComponent,
2054
+ SurfaceComponent,
2055
+ PaletteComponent,
2056
+ ShapePaletteComponent,
2057
+ DiagramPaletteComponent,
2058
+ ShapeComponent,
2059
+ ControlsComponent,
2060
+ EdgeTypePickerComponent,
2061
+ PaletteComponent,
2062
+ ExportControlsComponent,
2063
+ ColorPickerComponent,
2064
+ DiagramComponent,
2065
+ ColumnChartComponent,
2066
+ BarChartComponent,
2067
+ XYChartComponent,
2068
+ LineChartComponent,
2069
+ AreaChartComponent,
2070
+ PieChartComponent,
2071
+ ScatterChartComponent,
2072
+ BubbleChartComponent,
2073
+ SankeyChartComponent,
2074
+ DecoratorComponent], imports: [CommonModule], exports: [MiniviewComponent,
2075
+ SurfaceComponent,
2076
+ PaletteComponent,
2077
+ DiagramPaletteComponent,
2078
+ ShapeComponent,
2079
+ ShapePaletteComponent,
2080
+ ControlsComponent,
2081
+ ExportControlsComponent,
2082
+ EdgeTypePickerComponent,
2083
+ ColorPickerComponent,
2084
+ DiagramComponent,
2085
+ ColumnChartComponent,
2086
+ BarChartComponent,
2087
+ XYChartComponent,
2088
+ LineChartComponent,
2089
+ AreaChartComponent,
2090
+ PieChartComponent,
2091
+ ScatterChartComponent,
2092
+ BubbleChartComponent,
2093
+ SankeyChartComponent,
2094
+ DecoratorComponent] }); }
2095
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: VisuallyJsModule, imports: [CommonModule] }); }
2096
+ }
2097
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: VisuallyJsModule, decorators: [{
2098
+ type: NgModule,
2099
+ args: [{
2100
+ imports: [CommonModule],
2101
+ declarations: [
2102
+ DefaultNodeComponent,
2103
+ DefaultGroupComponent,
2104
+ BasePortComponent,
2105
+ MiniviewComponent,
2106
+ SurfaceComponent,
2107
+ PaletteComponent,
2108
+ ShapePaletteComponent,
2109
+ DiagramPaletteComponent,
2110
+ ShapeComponent,
2111
+ ControlsComponent,
2112
+ EdgeTypePickerComponent,
2113
+ PaletteComponent,
2114
+ ExportControlsComponent,
2115
+ ColorPickerComponent,
2116
+ DiagramComponent,
2117
+ ColumnChartComponent,
2118
+ BarChartComponent,
2119
+ XYChartComponent,
2120
+ LineChartComponent,
2121
+ AreaChartComponent,
2122
+ PieChartComponent,
2123
+ ScatterChartComponent,
2124
+ BubbleChartComponent,
2125
+ SankeyChartComponent,
2126
+ DecoratorComponent
2127
+ ],
2128
+ exports: [
2129
+ MiniviewComponent,
2130
+ SurfaceComponent,
2131
+ PaletteComponent,
2132
+ DiagramPaletteComponent,
2133
+ ShapeComponent,
2134
+ ShapePaletteComponent,
2135
+ ControlsComponent,
2136
+ ExportControlsComponent,
2137
+ EdgeTypePickerComponent,
2138
+ ColorPickerComponent,
2139
+ DiagramComponent,
2140
+ ColumnChartComponent,
2141
+ BarChartComponent,
2142
+ XYChartComponent,
2143
+ LineChartComponent,
2144
+ AreaChartComponent,
2145
+ PieChartComponent,
2146
+ ScatterChartComponent,
2147
+ BubbleChartComponent,
2148
+ SankeyChartComponent,
2149
+ DecoratorComponent
2150
+ ]
2151
+ }]
2152
+ }] });
2153
+
2154
+ // ["view", "tags", "container", "directRender", "storePositionsInModel"]
2155
+
2156
+
2157
+ class InspectorComponent {
2158
+ constructor() {
2159
+
2160
+ this.currentType = "";
2161
+
2162
+ this.currentObjectType = "";
2163
+
2164
+ this.EDGE = Edge.objectType;
2165
+
2166
+ this.NODE = Node.objectType;
2167
+
2168
+ this.GROUP = Group.objectType;
2169
+
2170
+ this.PORT = Port.objectType;
2171
+
2172
+ this.context = {};
2173
+
2174
+ this.changeDetector = inject(ChangeDetectorRef);
2175
+
2176
+ this.el = inject(ElementRef);
2177
+ // new
2178
+ this.$vjs = inject(VisuallyJsService);
2179
+ }
2180
+
2181
+ ngAfterViewInit() {
2182
+ this.$vjs.getUI((ui) => {
2183
+ this.ui = ui;
2184
+ this.inspector = new Inspector({
2185
+ context: this.context,
2186
+ container: this.el.nativeElement,
2187
+ cssClass: this.cssClass,
2188
+ showCloseButton: this.showCloseButton,
2189
+ ui,
2190
+ renderEmptyContainer: () => {
2191
+ this.reset();
2192
+ this.changeDetector.detectChanges();
2193
+ },
2194
+ refresh: (obj, cb) => {
2195
+ this.currentObj = obj;
2196
+ this.refresh(obj);
2197
+ setTimeout(cb, 0);
2198
+ this.changeDetector.detectChanges();
2199
+ },
2200
+ afterUpdate: () => this.afterUpdate(ui),
2201
+ });
2202
+ this.$vjs.$setInspector(this.inspector);
2203
+ });
2204
+ }
2205
+
2206
+ refresh(obj) {
2207
+ this.currentType = obj.data.type;
2208
+ this.currentObjectType = obj.objectType;
2209
+ }
2210
+
2211
+ reset() {
2212
+ this.currentType = "";
2213
+ this.currentObjectType = '';
2214
+ }
2215
+
2216
+ afterUpdate(ui) { }
2217
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InspectorComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2218
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: InspectorComponent, inputs: { cssClass: "cssClass", showCloseButton: "showCloseButton", context: "context" }, ngImport: i0 }); }
2219
+ }
2220
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InspectorComponent, decorators: [{
2221
+ type: Directive
2222
+ }], propDecorators: { cssClass: [{
2223
+ type: Input
2224
+ }], showCloseButton: [{
2225
+ type: Input
2226
+ }], context: [{
2227
+ type: Input
2228
+ }] } });
2229
+
2230
+
2231
+
2232
+
2233
+
2234
+ export { AngularComponentOverlayType, AreaChartComponent, BarChartComponent, BaseAngularOverlayComponent, BaseGroupComponent, BaseNodeComponent, BasePortComponent, BaseVertexComponent, BrowserUIAngularModel, BubbleChartComponent, ColorPickerComponent, ColumnChartComponent, ControlsComponent, DecoratorComponent, DefaultGroupComponent, DefaultNodeComponent, DiagramComponent, DiagramPaletteComponent, EdgeTypePickerComponent, ExportControlsComponent, InspectorComponent, LineChartComponent, MiniviewComponent, PaletteComponent, PieChartComponent, SankeyChartComponent, ScatterChartComponent, ShapeComponent, ShapePaletteComponent, SurfaceComponent, VisuallyJsModule, VisuallyJsService, XYChartComponent };
2235
+ //# sourceMappingURL=visuallyjs-browser-ui-angular.mjs.map