ngx-relationship-visualiser 2.0.4 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/projects/ngx-relationship-visualiser-lib/lib/db/graphDatabase.mjs +6 -2
- package/esm2022/projects/ngx-relationship-visualiser-lib/lib/visualiser/context-menus/context-menus.component.mjs +13 -24
- package/esm2022/projects/ngx-relationship-visualiser-lib/lib/visualiser/modals/abstract-modal-form-handler.mjs +3 -3
- package/esm2022/projects/ngx-relationship-visualiser-lib/lib/visualiser/modals/modals.component.mjs +17 -15
- package/esm2022/projects/ngx-relationship-visualiser-lib/lib/visualiser/services/dagre-layout.service.mjs +10 -4
- package/esm2022/projects/ngx-relationship-visualiser-lib/lib/visualiser/services/visualiser-graph.service.mjs +226 -203
- package/esm2022/projects/ngx-relationship-visualiser-lib/lib/visualiser/visualiser-graph/visualiser-graph.component.mjs +136 -90
- package/fesm2022/ngx-relationship-visualiser.mjs +404 -334
- package/fesm2022/ngx-relationship-visualiser.mjs.map +1 -1
- package/package.json +1 -1
- package/projects/ngx-relationship-visualiser-lib/lib/visualiser/context-menus/context-menus.component.d.ts +2 -4
- package/projects/ngx-relationship-visualiser-lib/lib/visualiser/modals/modals.component.d.ts +18 -7
- package/projects/ngx-relationship-visualiser-lib/lib/visualiser/services/dagre-layout.service.d.ts +1 -1
- package/projects/ngx-relationship-visualiser-lib/lib/visualiser/services/visualiser-graph.service.d.ts +31 -13
- package/projects/ngx-relationship-visualiser-lib/lib/visualiser/visualiser-graph/visualiser-graph.component.d.ts +23 -14
|
@@ -26,8 +26,6 @@ class ContextMenusComponent {
|
|
|
26
26
|
createLinkContextMenuEvent = new EventEmitter();
|
|
27
27
|
editLinkLabelContextMenuEvent = new EventEmitter();
|
|
28
28
|
editLinksContextMenuEvent = new EventEmitter();
|
|
29
|
-
currentMatchingLink = null;
|
|
30
|
-
currentItem = null;
|
|
31
29
|
editNode() {
|
|
32
30
|
this.editNodeContextMenuEvent.emit(true);
|
|
33
31
|
}
|
|
@@ -37,25 +35,26 @@ class ContextMenusComponent {
|
|
|
37
35
|
createNode() {
|
|
38
36
|
this.findCreateNodesContextMenuEvent.emit('createNode');
|
|
39
37
|
}
|
|
40
|
-
createLink() {
|
|
41
|
-
if (!
|
|
42
|
-
console.error('
|
|
38
|
+
createLink(item) {
|
|
39
|
+
if (!item || item.selectedNodes.length !== 2) {
|
|
40
|
+
console.error('Exactly two selected nodes are required to create a link.');
|
|
43
41
|
return;
|
|
44
42
|
}
|
|
45
43
|
const payload = {
|
|
46
44
|
open: true,
|
|
47
|
-
data:
|
|
45
|
+
data: item.selectedNodes
|
|
48
46
|
};
|
|
49
47
|
this.createLinkContextMenuEvent.emit(payload);
|
|
50
48
|
}
|
|
51
49
|
editLinkLabel() {
|
|
52
50
|
this.editLinkLabelContextMenuEvent.emit(true);
|
|
53
51
|
}
|
|
54
|
-
editLinks() {
|
|
55
|
-
|
|
52
|
+
editLinks(item) {
|
|
53
|
+
const matchingLink = this.checkLinkBetweenSelectedNodes(item);
|
|
54
|
+
if (matchingLink) {
|
|
56
55
|
this.editLinksContextMenuEvent.emit({
|
|
57
56
|
open: true,
|
|
58
|
-
data:
|
|
57
|
+
data: matchingLink
|
|
59
58
|
});
|
|
60
59
|
}
|
|
61
60
|
else {
|
|
@@ -63,19 +62,10 @@ class ContextMenusComponent {
|
|
|
63
62
|
}
|
|
64
63
|
}
|
|
65
64
|
linksExist = (item) => {
|
|
66
|
-
this.currentItem = item;
|
|
67
65
|
const matchingLink = this.checkLinkBetweenSelectedNodes(item);
|
|
68
|
-
|
|
69
|
-
this.currentMatchingLink = matchingLink;
|
|
70
|
-
return true;
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
this.currentMatchingLink = null;
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
66
|
+
return matchingLink !== null;
|
|
76
67
|
};
|
|
77
68
|
linksDoNotExist = (item) => {
|
|
78
|
-
this.currentItem = item;
|
|
79
69
|
const matchingLink = this.checkLinkBetweenSelectedNodes(item);
|
|
80
70
|
if (!matchingLink) {
|
|
81
71
|
return true;
|
|
@@ -85,8 +75,7 @@ class ContextMenusComponent {
|
|
|
85
75
|
}
|
|
86
76
|
};
|
|
87
77
|
checkLinkBetweenSelectedNodes(payload) {
|
|
88
|
-
if (!payload ||
|
|
89
|
-
console.warn("Payload or selectedNodes is undefined.");
|
|
78
|
+
if (!payload || payload.selectedNodes.length !== 2) {
|
|
90
79
|
return null;
|
|
91
80
|
}
|
|
92
81
|
const selectedNodes = payload.selectedNodes;
|
|
@@ -104,11 +93,11 @@ class ContextMenusComponent {
|
|
|
104
93
|
}
|
|
105
94
|
}
|
|
106
95
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ContextMenusComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
107
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: ContextMenusComponent, selector: "app-context-menus", outputs: { editNodeContextMenuEvent: "editNodeContextMenuEvent", findCreateNodesContextMenuEvent: "findCreateNodesContextMenuEvent", createLinkContextMenuEvent: "createLinkContextMenuEvent", editLinkLabelContextMenuEvent: "editLinkLabelContextMenuEvent", editLinksContextMenuEvent: "editLinksContextMenuEvent" }, viewQueries: [{ propertyName: "editNodeContextMenu", first: true, predicate: ["editNodeContextMenu"], descendants: true }, { propertyName: "findCreateNodesContextMenu", first: true, predicate: ["findCreateNodesContextMenu"], descendants: true }, { propertyName: "createEditLinkContextMenu", first: true, predicate: ["createEditLinkContextMenu"], descendants: true }, { propertyName: "editLinkLabelContextMenu", first: true, predicate: ["editLinkLabelContextMenu"], descendants: true }], ngImport: i0, template: "<context-menu #editNodeContextMenu>\n <ng-template contextMenuItem let-item (execute)=\"editNode()\">\n Edit Node...\n </ng-template>\n</context-menu>\n\n<context-menu #findCreateNodesContextMenu>\n <ng-template contextMenuItem let-item (execute)=\"findNodes()\">\n Search Nodes...\n </ng-template>\n <ng-template contextMenuItem let-item (execute)=\"createNode()\">\n Create Node...\n </ng-template>\n</context-menu>\n\n<context-menu #createEditLinkContextMenu>\n <ng-template [visible]=\"linksDoNotExist\" contextMenuItem let-item (execute)=\"createLink()\">\n Create Link...\n </ng-template>\n <ng-template [visible]=\"linksExist\" (execute)=\"editLinks()\" contextMenuItem let-item>\n Edit Links...\n </ng-template>\n</context-menu>\n\n<context-menu #editLinkLabelContextMenu>\n <ng-template contextMenuItem let-item (execute)=\"editLinkLabel()\">\n Edit Link label...\n </ng-template>\n</context-menu>", dependencies: [{ kind: "component", type: i2.ContextMenuComponent, selector: "context-menu", inputs: ["menuClass", "autoFocus", "useBootstrap4", "disabled"], outputs: ["close", "open"] }, { kind: "directive", type: i2.ContextMenuItemDirective, selector: "[contextMenuItem]", inputs: ["subMenu", "divider", "enabled", "passive", "visible"], outputs: ["execute"] }] });
|
|
96
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: ContextMenusComponent, selector: "app-context-menus", outputs: { editNodeContextMenuEvent: "editNodeContextMenuEvent", findCreateNodesContextMenuEvent: "findCreateNodesContextMenuEvent", createLinkContextMenuEvent: "createLinkContextMenuEvent", editLinkLabelContextMenuEvent: "editLinkLabelContextMenuEvent", editLinksContextMenuEvent: "editLinksContextMenuEvent" }, viewQueries: [{ propertyName: "editNodeContextMenu", first: true, predicate: ["editNodeContextMenu"], descendants: true }, { propertyName: "findCreateNodesContextMenu", first: true, predicate: ["findCreateNodesContextMenu"], descendants: true }, { propertyName: "createEditLinkContextMenu", first: true, predicate: ["createEditLinkContextMenu"], descendants: true }, { propertyName: "editLinkLabelContextMenu", first: true, predicate: ["editLinkLabelContextMenu"], descendants: true }], ngImport: i0, template: "<context-menu #editNodeContextMenu>\n <ng-template contextMenuItem let-item (execute)=\"editNode()\">\n Edit Node...\n </ng-template>\n</context-menu>\n\n<context-menu #findCreateNodesContextMenu>\n <ng-template contextMenuItem let-item (execute)=\"findNodes()\">\n Search Nodes...\n </ng-template>\n <ng-template contextMenuItem let-item (execute)=\"createNode()\">\n Create Node...\n </ng-template>\n</context-menu>\n\n<context-menu #createEditLinkContextMenu>\n <ng-template [visible]=\"linksDoNotExist\" contextMenuItem let-item (execute)=\"createLink($event.item)\">\n Create Link...\n </ng-template>\n <ng-template [visible]=\"linksExist\" (execute)=\"editLinks($event.item)\" contextMenuItem let-item>\n Edit Links...\n </ng-template>\n</context-menu>\n\n<context-menu #editLinkLabelContextMenu>\n <ng-template contextMenuItem let-item (execute)=\"editLinkLabel()\">\n Edit Link label...\n </ng-template>\n</context-menu>", dependencies: [{ kind: "component", type: i2.ContextMenuComponent, selector: "context-menu", inputs: ["menuClass", "autoFocus", "useBootstrap4", "disabled"], outputs: ["close", "open"] }, { kind: "directive", type: i2.ContextMenuItemDirective, selector: "[contextMenuItem]", inputs: ["subMenu", "divider", "enabled", "passive", "visible"], outputs: ["execute"] }] });
|
|
108
97
|
}
|
|
109
98
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ContextMenusComponent, decorators: [{
|
|
110
99
|
type: Component,
|
|
111
|
-
args: [{ selector: 'app-context-menus', template: "<context-menu #editNodeContextMenu>\n <ng-template contextMenuItem let-item (execute)=\"editNode()\">\n Edit Node...\n </ng-template>\n</context-menu>\n\n<context-menu #findCreateNodesContextMenu>\n <ng-template contextMenuItem let-item (execute)=\"findNodes()\">\n Search Nodes...\n </ng-template>\n <ng-template contextMenuItem let-item (execute)=\"createNode()\">\n Create Node...\n </ng-template>\n</context-menu>\n\n<context-menu #createEditLinkContextMenu>\n <ng-template [visible]=\"linksDoNotExist\" contextMenuItem let-item (execute)=\"createLink()\">\n Create Link...\n </ng-template>\n <ng-template [visible]=\"linksExist\" (execute)=\"editLinks()\" contextMenuItem let-item>\n Edit Links...\n </ng-template>\n</context-menu>\n\n<context-menu #editLinkLabelContextMenu>\n <ng-template contextMenuItem let-item (execute)=\"editLinkLabel()\">\n Edit Link label...\n </ng-template>\n</context-menu>" }]
|
|
100
|
+
args: [{ selector: 'app-context-menus', template: "<context-menu #editNodeContextMenu>\n <ng-template contextMenuItem let-item (execute)=\"editNode()\">\n Edit Node...\n </ng-template>\n</context-menu>\n\n<context-menu #findCreateNodesContextMenu>\n <ng-template contextMenuItem let-item (execute)=\"findNodes()\">\n Search Nodes...\n </ng-template>\n <ng-template contextMenuItem let-item (execute)=\"createNode()\">\n Create Node...\n </ng-template>\n</context-menu>\n\n<context-menu #createEditLinkContextMenu>\n <ng-template [visible]=\"linksDoNotExist\" contextMenuItem let-item (execute)=\"createLink($event.item)\">\n Create Link...\n </ng-template>\n <ng-template [visible]=\"linksExist\" (execute)=\"editLinks($event.item)\" contextMenuItem let-item>\n Edit Links...\n </ng-template>\n</context-menu>\n\n<context-menu #editLinkLabelContextMenu>\n <ng-template contextMenuItem let-item (execute)=\"editLinkLabel()\">\n Edit Link label...\n </ng-template>\n</context-menu>" }]
|
|
112
101
|
}], propDecorators: { editNodeContextMenu: [{
|
|
113
102
|
type: ViewChild,
|
|
114
103
|
args: ['editNodeContextMenu']
|
|
@@ -444,8 +433,8 @@ class AbstractModalFormHandler {
|
|
|
444
433
|
this.createNodeForm.setControl('label', this.fb.array(data.label.map(label => this.fb.group({ label: [label, Validators.required] }))));
|
|
445
434
|
}
|
|
446
435
|
iconOrImageValidator(control) {
|
|
447
|
-
const imageUrl = control.get('imageUrl')
|
|
448
|
-
const icon = control.get('icon')
|
|
436
|
+
const imageUrl = control.get('imageUrl')?.value;
|
|
437
|
+
const icon = control.get('icon')?.value;
|
|
449
438
|
if ((imageUrl && icon) || (!imageUrl && !icon)) {
|
|
450
439
|
return { 'iconOrImage': true };
|
|
451
440
|
}
|
|
@@ -474,7 +463,11 @@ class DexieService extends Dexie {
|
|
|
474
463
|
await this.graphData.put(data);
|
|
475
464
|
}
|
|
476
465
|
async getGraphData(dataId) {
|
|
477
|
-
|
|
466
|
+
const data = await this.graphData.get(dataId);
|
|
467
|
+
if (!data) {
|
|
468
|
+
throw new Error(`Graph data "${dataId}" was not found.`);
|
|
469
|
+
}
|
|
470
|
+
return data;
|
|
478
471
|
}
|
|
479
472
|
async deleteGraphData(dataId) {
|
|
480
473
|
await this.graphData.delete(dataId);
|
|
@@ -492,7 +485,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
492
485
|
class ModalsComponent extends AbstractModalFormHandler {
|
|
493
486
|
modalService;
|
|
494
487
|
dexieService;
|
|
495
|
-
editNodeData;
|
|
488
|
+
editNodeData = null;
|
|
496
489
|
editLinksData = null;
|
|
497
490
|
closeModalEvent = new EventEmitter();
|
|
498
491
|
createEditLinkEvent = new EventEmitter();
|
|
@@ -508,10 +501,10 @@ class ModalsComponent extends AbstractModalFormHandler {
|
|
|
508
501
|
fontAwesomeIcons = fontAwesomeIcons;
|
|
509
502
|
sourceLabels = [];
|
|
510
503
|
targetLabels = [];
|
|
511
|
-
sourceImageUrl;
|
|
512
|
-
targetImageUrl;
|
|
513
|
-
sourceIcon;
|
|
514
|
-
targetIcon;
|
|
504
|
+
sourceImageUrl = '';
|
|
505
|
+
targetImageUrl = '';
|
|
506
|
+
sourceIcon = '';
|
|
507
|
+
targetIcon = '';
|
|
515
508
|
// virtual scroll
|
|
516
509
|
loading = false;
|
|
517
510
|
iconsBuffer = [];
|
|
@@ -533,11 +526,14 @@ class ModalsComponent extends AbstractModalFormHandler {
|
|
|
533
526
|
this.populateEditNodeForm(this.editNodeData);
|
|
534
527
|
}
|
|
535
528
|
}
|
|
536
|
-
openModal(template) {
|
|
529
|
+
openModal(template, editLinksData) {
|
|
537
530
|
if (!template) {
|
|
538
531
|
console.error('Template is required to open a modal.');
|
|
539
532
|
return null;
|
|
540
533
|
}
|
|
534
|
+
if (editLinksData !== undefined) {
|
|
535
|
+
this.editLinksData = editLinksData;
|
|
536
|
+
}
|
|
541
537
|
if (template === this.editLinksModal &&
|
|
542
538
|
this.editLinksData &&
|
|
543
539
|
!Array.isArray(this.editLinksData)) {
|
|
@@ -545,8 +541,9 @@ class ModalsComponent extends AbstractModalFormHandler {
|
|
|
545
541
|
this.findEditLabelsAndImagesfromIDs();
|
|
546
542
|
this.populateEditLinkForm(this.editLinksData);
|
|
547
543
|
}
|
|
548
|
-
if (template === this.createLinkModal
|
|
544
|
+
if (template === this.createLinkModal) {
|
|
549
545
|
this.resetLinksForm();
|
|
546
|
+
void this.findEditLabelsAndImagesfromIDs();
|
|
550
547
|
}
|
|
551
548
|
if (template === this.createNodeModal) {
|
|
552
549
|
this.resetNodeForm();
|
|
@@ -598,10 +595,8 @@ class ModalsComponent extends AbstractModalFormHandler {
|
|
|
598
595
|
this.sourceIcon = '';
|
|
599
596
|
this.targetIcon = '';
|
|
600
597
|
}
|
|
601
|
-
closeModal(
|
|
602
|
-
|
|
603
|
-
this[modalRef].hide();
|
|
604
|
-
}
|
|
598
|
+
closeModal(_modalRef) {
|
|
599
|
+
this[_modalRef]?.hide();
|
|
605
600
|
}
|
|
606
601
|
createEditLink(source) {
|
|
607
602
|
if (this.createLinkForm.valid) {
|
|
@@ -645,7 +640,7 @@ class ModalsComponent extends AbstractModalFormHandler {
|
|
|
645
640
|
this.closeModal('modalRef');
|
|
646
641
|
}
|
|
647
642
|
clearImageUrl() {
|
|
648
|
-
this.createNodeForm.get('imageUrl')
|
|
643
|
+
this.createNodeForm.get('imageUrl')?.setValue('');
|
|
649
644
|
}
|
|
650
645
|
trackByFn(item) {
|
|
651
646
|
return item.id;
|
|
@@ -670,11 +665,11 @@ class ModalsComponent extends AbstractModalFormHandler {
|
|
|
670
665
|
this.iconsBuffer = this.iconsBuffer.concat(more);
|
|
671
666
|
}
|
|
672
667
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ModalsComponent, deps: [{ token: i1.BsModalService }, { token: i2$1.FormBuilder }, { token: DexieService }], target: i0.ɵɵFactoryTarget.Component });
|
|
673
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: ModalsComponent, selector: "app-modals", inputs: { editNodeData: "editNodeData", editLinksData: "editLinksData" }, outputs: { closeModalEvent: "closeModalEvent", createEditLinkEvent: "createEditLinkEvent", createEditNodeEvent: "createEditNodeEvent", deleteLinkEvent: "deleteLinkEvent", deleteNodeEvent: "deleteNodeEvent" }, viewQueries: [{ propertyName: "editNodeModal", first: true, predicate: ["editNodeModal"], descendants: true }, { propertyName: "createNodeModal", first: true, predicate: ["createNodeModal"], descendants: true }, { propertyName: "createLinkModal", first: true, predicate: ["createLinkModal"], descendants: true }, { propertyName: "editLinksModal", first: true, predicate: ["editLinksModal"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<!--EDIT NODE MODAL-->\n<ng-template #editNodeModal>\n <div class=\"modal-header\">\n <h4 class=\"modal-title pull-left\">Edit Node</h4>\n <button type=\"button\" class=\"btn-close close pull-right\" aria-label=\"Close\" (click)=\"closeModal('modalRef')\">\n <span aria-hidden=\"true\" class=\"visually-hidden\">×</span>\n </button>\n </div>\n <div class=\"modal-body\">\n <form [formGroup]=\"createNodeForm\">\n <div class=\"form-group\">\n <label for=\"iconType\">Icon Type</label>\n <div>\n <input type=\"radio\" id=\"imageUrl\" formControlName=\"iconType\" value=\"url\"> Image URL\n <input class=\"ml-5\" type=\"radio\" id=\"iconTypeSelect\" formControlName=\"iconType\" value=\"select\"> Choose Icon\n </div>\n </div>\n <div class=\"form-group\" *ngIf=\"createNodeForm.get('iconType').value === 'url'\">\n <label for=\"imageUrl\">Image URL</label>\n <div class=\"input-group\">\n <input type=\"text\" id=\"imageUrl\" formControlName=\"imageUrl\" class=\"form-control\" placeholder=\"Image URL\">\n <button type=\"button\" class=\"btn btn-outline-secondary\" (click)=\"clearImageUrl()\">Clear</button>\n </div>\n </div>\n <div class=\"form-group\" *ngIf=\"createNodeForm.get('iconType').value === 'select'\">\n <label for=\"nodeIcon\">Choose Icon</label>\n <ng-select\n formControlName=\"icon\"\n [items]=\"iconsBuffer\"\n [virtualScroll]=\"true\"\n [loading]=\"loading\"\n bindLabel=\"name\"\n bindValue=\"icon\"\n [editableSearchTerm]=\"true\"\n placeholder=\"Select icon\"\n appendTo=\"body\"\n [trackByFn]=\"trackByFn\"\n (scroll)=\"onScroll($event)\"\n (scrollToEnd)=\"onScrollToEnd()\"\n >\n <ng-template ng-header-tmp>\n <small class=\"form-text text-muted\"\n >Loaded {{ iconsBuffer.length }} of {{ fontAwesomeIcons.length }}</small\n >\n </ng-template>\n <ng-template ng-option-tmp let-item=\"item\">\n <i class=\"fa fa-light\">{{item.icon}}</i>\n <span class=\"ml-3\">{{ item.name }}</span>\n </ng-template>\n </ng-select>\n </div>\n <div *ngIf=\"createNodeForm.errors?.iconOrImage\" class=\"text-danger\">\n Please provide either an Image URL or choose an Icon, but not both.\n </div>\n <div class=\"form-group\">\n <label for=\"label\">Labels</label>\n <div formArrayName=\"label\">\n <div *ngFor=\"let label of nodeLabelArray.controls; let i = index\" [formGroupName]=\"i\"\n class=\"d-flex flex-column align-items-start\">\n <div class=\"d-flex align-items-center w-100\">\n <input formControlName=\"label\" class=\"form-control mb-2\" placeholder=\"Label\" [id]=\"'node-label-' + i\">\n <button type=\"button\" class=\"btn btn-danger ml-2\" (click)=\"removeNodeLabel(i)\" [disabled]=\"nodeLabelArray.length <= 1\">Remove</button>\n </div>\n </div>\n </div>\n <button type=\"button\" class=\"btn btn-secondary mt-2\" (click)=\"addNodeLabel()\">Add Label</button>\n </div>\n <div class=\"form-group\">\n <label for=\"nodeAdditionalIcon\">Additional icon</label>\n <ng-select\n formControlName=\"additionalIcon\"\n [items]=\"iconsBuffer\"\n [virtualScroll]=\"true\"\n [loading]=\"loading\"\n bindLabel=\"name\"\n bindValue=\"icon\"\n [editableSearchTerm]=\"true\"\n placeholder=\"Select icon\"\n appendTo=\"body\"\n [trackByFn]=\"trackByFn\"\n (scroll)=\"onScroll($event)\"\n (scrollToEnd)=\"onScrollToEnd()\"\n >\n <ng-template ng-header-tmp>\n <small class=\"form-text text-muted\"\n >Loaded {{ iconsBuffer.length }} of {{ fontAwesomeIcons.length }}</small\n >\n </ng-template>\n <ng-template ng-option-tmp let-item=\"item\">\n <i class=\"fa fa-light\">{{item.icon}}</i>\n <span class=\"ml-3\">{{ item.name }}</span>\n </ng-template>\n </ng-select>\n </div>\n </form>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"closeModal('modalRef')\">Cancel</button>\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"createEditNode('editNodeModal')\" [disabled]=\"!createNodeForm.valid\">Save Changes</button>\n <button type=\"button\" class=\"btn btn-danger\" (click)=\"deleteNode()\">Delete Node</button>\n </div>\n</ng-template>\n<!-- ./MODAL-->\n\n<!--CREATE NODE MODAL-->\n<ng-template #createNodeModal>\n <div class=\"modal-header\">\n <h4 class=\"modal-title pull-left\">Create Node</h4>\n <button type=\"button\" class=\"btn-close close pull-right\" aria-label=\"Close\" (click)=\"closeModal('modalRef')\">\n <span aria-hidden=\"true\" class=\"visually-hidden\">×</span>\n </button>\n </div>\n <div class=\"modal-body\">\n <form [formGroup]=\"createNodeForm\">\n <div class=\"form-group\">\n <label for=\"iconType\">Icon Type</label>\n <div>\n <input type=\"radio\" id=\"imageUrl\" formControlName=\"iconType\" value=\"url\"> Image URL\n <input class=\"ml-5\" type=\"radio\" id=\"iconTypeSelect\" formControlName=\"iconType\" value=\"select\"> Choose Icon\n </div>\n </div>\n <div class=\"form-group\" *ngIf=\"createNodeForm.get('iconType').value === 'url'\">\n <label for=\"imageUrl\">Image URL</label>\n <div class=\"input-group\">\n <input type=\"text\" id=\"imageUrl\" formControlName=\"imageUrl\" class=\"form-control\" placeholder=\"Image URL\">\n <button type=\"button\" class=\"btn btn-outline-secondary\" (click)=\"clearImageUrl()\">Clear</button>\n </div>\n </div>\n <div class=\"form-group\" *ngIf=\"createNodeForm.get('iconType').value === 'select'\">\n <label for=\"nodeIcon\">Choose Icon</label>\n <ng-select\n formControlName=\"icon\"\n [items]=\"iconsBuffer\"\n [virtualScroll]=\"true\"\n [loading]=\"loading\"\n bindLabel=\"name\"\n bindValue=\"icon\"\n [editableSearchTerm]=\"true\"\n placeholder=\"Select icon\"\n appendTo=\"body\"\n [trackByFn]=\"trackByFn\"\n (scroll)=\"onScroll($event)\"\n (scrollToEnd)=\"onScrollToEnd()\"\n >\n <ng-template ng-header-tmp>\n <small class=\"form-text text-muted\"\n >Loaded {{ iconsBuffer.length }} of {{ fontAwesomeIcons.length }}</small\n >\n </ng-template>\n <ng-template ng-option-tmp let-item=\"item\">\n <i class=\"fa fa-light\">{{item.icon}}</i>\n <span class=\"ml-3\">{{ item.name }}</span>\n </ng-template>\n </ng-select>\n </div>\n <div *ngIf=\"createNodeForm.errors?.iconOrImage\" class=\"text-danger\">\n Please provide either an Image URL or choose an Icon, but not both.\n </div>\n <div class=\"form-group\">\n <label for=\"label\">Labels</label>\n <div formArrayName=\"label\">\n <div *ngFor=\"let label of nodeLabelArray.controls; let i = index\" [formGroupName]=\"i\"\n class=\"d-flex flex-column align-items-start\">\n <div class=\"d-flex align-items-center w-100\">\n <input formControlName=\"label\" class=\"form-control mb-2\" placeholder=\"Label\" [id]=\"'node-label-' + i\">\n <button type=\"button\" class=\"btn btn-danger ml-2\" (click)=\"removeNodeLabel(i)\" [disabled]=\"nodeLabelArray.length <= 1\">Remove</button>\n </div>\n </div>\n </div>\n <button type=\"button\" class=\"btn btn-secondary mt-2\" (click)=\"addNodeLabel()\">Add Label</button>\n </div>\n <div class=\"form-group\">\n <label for=\"nodeAdditionalIcon\">Additional icon</label>\n <ng-select\n formControlName=\"additionalIcon\"\n [items]=\"iconsBuffer\"\n [virtualScroll]=\"true\"\n [loading]=\"loading\"\n bindLabel=\"name\"\n bindValue=\"icon\"\n [editableSearchTerm]=\"true\"\n placeholder=\"Select icon\"\n appendTo=\"body\"\n [trackByFn]=\"trackByFn\"\n (scroll)=\"onScroll($event)\"\n (scrollToEnd)=\"onScrollToEnd()\"\n >\n <ng-template ng-header-tmp>\n <small class=\"form-text text-muted\"\n >Loaded {{ iconsBuffer.length }} of {{ fontAwesomeIcons.length }}</small\n >\n </ng-template>\n <ng-template ng-option-tmp let-item=\"item\">\n <i class=\"fa fa-light\">{{item.icon}}</i>\n <span class=\"ml-3\">{{ item.name }}</span>\n </ng-template>\n </ng-select>\n </div>\n </form>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"closeModal('modalRef')\">Cancel</button>\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"createEditNode('createNodeModal')\" [disabled]=\"!createNodeForm.valid\">Create Node</button>\n </div>\n</ng-template>\n<!-- ./MODAL-->\n\n<!--EDIT LINKS MODAL-->\n<ng-template #editLinksModal>\n <div class=\"modal-header\">\n <h4 class=\"modal-title pull-left\">Edit Links</h4>\n <button type=\"button\" class=\"btn-close close pull-right\" aria-label=\"Close\" (click)=\"closeModal('modalRef')\">\n <span aria-hidden=\"true\" class=\"visually-hidden\">×</span>\n </button>\n </div>\n <div class=\"modal-body\">\n <form [formGroup]=\"createLinkForm\">\n <div class=\"col-sm-12 d-flex flex-column\">\n <div class=\"d-flex mb-3\">\n <div class=\"iconImage\">\n <span><i class=\"fas fa-arrow-left\"></i></span>\n <span class=\"arrow\">\n <input type=\"checkbox\" id=\"sourceArrow\" formControlName=\"sourceArrow\" class=\"form-check-input\">\n <label class=\"d-none form-check-label\" for=\"leftArrow\"></label>\n </span>\n </div>\n <div class=\"iconImage ml-3\">\n <ng-container *ngIf=\"targetImageUrl; else targetIconTemplate\">\n <img class=\"imageUrl\" [src]=\"targetImageUrl\" />\n </ng-container>\n <ng-template #targetIconTemplate>\n <i class=\"fa-solid fa-2x\">{{targetIcon}}</i>\n </ng-template>\n </div>\n <div\n [ngClass]=\"{\n 'link-line-solid': createLinkForm.get('lineStyle').value === 'Solid',\n 'link-line-dotted': createLinkForm.get('lineStyle').value === 'Dotted'\n }\"\n >\n </div>\n <div class=\"iconImage mr-3\">\n <ng-container *ngIf=\"sourceImageUrl; else sourceIconTemplate\">\n <img class=\"imageUrl\" [src]=\"sourceImageUrl\" />\n </ng-container>\n <ng-template #sourceIconTemplate>\n <i class=\"fa-solid fa-2x\">{{sourceIcon}}</i>\n </ng-template>\n </div>\n <div class=\"iconImage\">\n <span><i class=\"fas fa-arrow-right\"></i></span>\n <span class=\"arrow\">\n <input type=\"checkbox\" id=\"targetArrow\" formControlName=\"targetArrow\" class=\"form-check-input\">\n <label class=\"form-check-label\" for=\"rightArrow\"></label>\n </span>\n </div>\n </div>\n <div class=\"d-flex justify-content-between mb-3\">\n <div class=\"text-left d-block font-weight-bold\" style=\"font-size: 12px\">\n <span class=\"d-block\" *ngFor=\"let label of targetLabels\">{{ label }}</span>\n </div>\n <div class=\"text-right d-block font-weight-bold\" style=\"font-size: 12px\">\n <span class=\"d-block\" *ngFor=\"let label of sourceLabels\">{{ label }}</span>\n </div>\n </div>\n <div *ngIf=\"createLinkForm.get('label')?.value?.length\" class=\"labelPosition text-center\">\n <span *ngFor=\"let label of createLinkForm.get('label').value\">\n <span class=\"d-block\">{{ label.label }} <span style=\"color: #856404;\" *ngIf=\"label.linkIcon\"><i class=\"fas fa-link\"></i></span></span>\n </span>\n </div>\n </div>\n <div class=\"form-group\">\n <label for=\"lineStyle\">Line Style</label>\n <select id=\"lineStyle\" formControlName=\"lineStyle\" class=\"form-control\">\n <option value=\"Solid\">Solid</option>\n <option value=\"Dotted\">Dotted</option>\n </select>\n </div>\n\n <div class=\"form-group\">\n <label for=\"label\">Labels</label>\n <div formArrayName=\"label\">\n <div *ngFor=\"let label of labelArray.controls; let i = index\" [formGroupName]=\"i\"\n class=\"d-flex flex-column align-items-start\">\n <div class=\"d-flex align-items-center w-100\">\n <input formControlName=\"label\" class=\"form-control\" placeholder=\"Label\" [id]=\"'label-' + i\">\n <button type=\"button\" class=\"btn btn-danger ml-2\" (click)=\"removeLabel(i)\" [disabled]=\"labelArray.length <= 1\">Remove</button>\n </div>\n <div class=\"form-group form-check\">\n <input type=\"checkbox\" formControlName=\"linkIcon\" class=\"form-check-input\" [id]=\"'linkIcon-' + i\">\n <label [for]=\"'linkIcon-' + i\">Link Icon?</label>\n </div>\n </div>\n </div>\n <button type=\"button\" class=\"btn btn-secondary mt-2\" (click)=\"addLabel()\">Add Label</button>\n </div>\n </form>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"closeModal('modalRef')\">Cancel</button>\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"createEditLink('editLinkModal')\" [disabled]=\"!createLinkForm.valid\">Save Changes</button>\n <button type=\"button\" class=\"btn btn-danger\" (click)=\"deleteLink()\">Delete Link</button>\n </div>\n</ng-template>\n<!-- ./MODAL-->\n\n\n<!--CREATE LINK MODAL-->\n<ng-template #createLinkModal>\n <div class=\"modal-header\">\n <h4 class=\"modal-title pull-left\">Create Link</h4>\n <button type=\"button\" class=\"btn-close close pull-right\" aria-label=\"Close\" (click)=\"closeModal('modalRef')\">\n <span aria-hidden=\"true\" class=\"visually-hidden\">×</span>\n </button>\n </div>\n <div class=\"modal-body\">\n <form [formGroup]=\"createLinkForm\">\n <div class=\"col-sm-12 d-flex flex-column\">\n <div class=\"d-flex mb-3\">\n <div class=\"iconImage\">\n <span><i class=\"fas fa-arrow-left\"></i></span>\n <span class=\"arrow\">\n <input type=\"checkbox\" id=\"sourceArrow\" formControlName=\"sourceArrow\" class=\"form-check-input\">\n <label class=\"d-none form-check-label\" for=\"leftArrow\"></label>\n </span>\n </div>\n <div class=\"iconImage ml-3\">\n <ng-container *ngIf=\"targetImageUrl; else targetIconTemplate\">\n <img class=\"imageUrl\" [src]=\"targetImageUrl\" />\n </ng-container>\n <ng-template #targetIconTemplate>\n <i class=\"fa-solid fa-2x\">{{targetIcon}}</i>\n </ng-template>\n </div>\n <div\n [ngClass]=\"{\n 'link-line-solid': createLinkForm.get('lineStyle').value === 'Solid',\n 'link-line-dotted': createLinkForm.get('lineStyle').value === 'Dotted'\n }\"\n >\n </div>\n <div class=\"iconImage mr-3\">\n <ng-container *ngIf=\"sourceImageUrl; else sourceIconTemplate\">\n <img class=\"imageUrl\" [src]=\"sourceImageUrl\" />\n </ng-container>\n <ng-template #sourceIconTemplate>\n <i class=\"fa-solid fa-2x\">{{sourceIcon}}</i>\n </ng-template>\n </div>\n <div class=\"iconImage\">\n <span><i class=\"fas fa-arrow-right\"></i></span>\n <span class=\"arrow\">\n <input type=\"checkbox\" id=\"targetArrow\" formControlName=\"targetArrow\" class=\"form-check-input\">\n <label class=\"form-check-label\" for=\"rightArrow\"></label>\n </span>\n </div>\n </div>\n <div class=\"d-flex justify-content-between mb-3\">\n <div class=\"text-left d-block font-weight-bold\" style=\"font-size: 12px\">\n <span class=\"d-block\" *ngFor=\"let label of targetLabels\">{{ label }}</span>\n </div>\n <div class=\"text-right d-block font-weight-bold\" style=\"font-size: 12px\">\n <span class=\"d-block\" *ngFor=\"let label of sourceLabels\">{{ label }}</span>\n </div>\n </div>\n <div *ngIf=\"createLinkForm.get('label')?.value?.length\" class=\"labelPosition text-center\">\n <span *ngFor=\"let label of createLinkForm.get('label').value\">\n <span class=\"d-block\">{{ label.label }} <span style=\"color: #856404;\" *ngIf=\"label.linkIcon\"><i class=\"fas fa-link\"></i></span></span>\n </span>\n </div>\n </div>\n <div class=\"form-group\">\n <label for=\"lineStyle\">Line Style</label>\n <select id=\"lineStyle\" formControlName=\"lineStyle\" class=\"form-control\">\n <option value=\"Solid\">Solid</option>\n <option value=\"Dotted\">Dotted</option>\n </select>\n </div>\n\n <div class=\"form-group\">\n <label for=\"label\">Labels</label>\n <div formArrayName=\"label\">\n <div *ngFor=\"let label of labelArray.controls; let i = index\" [formGroupName]=\"i\"\n class=\"d-flex flex-column align-items-start\">\n <div class=\"d-flex align-items-center w-100\">\n <input formControlName=\"label\" class=\"form-control\" placeholder=\"Label\" [id]=\"'label-' + i\">\n <button type=\"button\" class=\"btn btn-danger ml-2\" (click)=\"removeLabel(i)\" [disabled]=\"labelArray.length <= 1\">Remove</button>\n </div>\n <div class=\"form-group form-check\">\n <input type=\"checkbox\" formControlName=\"linkIcon\" class=\"form-check-input\" [id]=\"'linkIcon-' + i\">\n <label [for]=\"'linkIcon-' + i\">Link Icon?</label>\n </div>\n </div>\n </div>\n <button type=\"button\" class=\"btn btn-secondary mt-2\" (click)=\"addLabel()\">Add Label</button>\n </div>\n </form>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"closeModal('modalRef')\">Cancel</button>\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"createEditLink('createLinkModal')\" [disabled]=\"!createLinkForm.valid\">Create Link</button>\n </div>\n</ng-template>\n<!-- ./MODAL-->", styles: [".imageUrl{max-width:30px}.labelPosition{position:relative;top:-55px;margin-right:30px;margin-left:30px}.link-line-solid{width:100%;position:relative;margin:15px;border-top:2px solid #777}.link-line-dotted{width:100%;position:relative;margin:15px;background-image:repeating-linear-gradient(to right,#cacaca,#cacaca 7px,transparent 7px,transparent 15px);height:2px}.iconImage{position:relative;top:4px}.arrow{position:absolute;top:20px;left:20px}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2$1.RadioControlValueAccessor, selector: "input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]", inputs: ["name", "formControlName", "value"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i2$1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i2$1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "component", type: i5.NgSelectComponent, selector: "ng-select", inputs: ["bindLabel", "bindValue", "markFirst", "placeholder", "notFoundText", "typeToSearchText", "addTagText", "loadingText", "clearAllText", "appearance", "dropdownPosition", "appendTo", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "openOnEnter", "maxSelectedItems", "groupBy", "groupValue", "bufferAmount", "virtualScroll", "selectableGroup", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "tabIndex", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "keyDownFn", "typeahead", "multiple", "addTag", "searchable", "clearable", "isOpen", "items", "compareWith", "clearSearchOnAdd", "deselectOnClick"], outputs: ["blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"] }, { kind: "directive", type: i5.NgOptionTemplateDirective, selector: "[ng-option-tmp]" }, { kind: "directive", type: i5.NgHeaderTemplateDirective, selector: "[ng-header-tmp]" }] });
|
|
668
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: ModalsComponent, selector: "app-modals", inputs: { editNodeData: "editNodeData", editLinksData: "editLinksData" }, outputs: { closeModalEvent: "closeModalEvent", createEditLinkEvent: "createEditLinkEvent", createEditNodeEvent: "createEditNodeEvent", deleteLinkEvent: "deleteLinkEvent", deleteNodeEvent: "deleteNodeEvent" }, viewQueries: [{ propertyName: "editNodeModal", first: true, predicate: ["editNodeModal"], descendants: true }, { propertyName: "createNodeModal", first: true, predicate: ["createNodeModal"], descendants: true }, { propertyName: "createLinkModal", first: true, predicate: ["createLinkModal"], descendants: true }, { propertyName: "editLinksModal", first: true, predicate: ["editLinksModal"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<!--EDIT NODE MODAL-->\n<ng-template #editNodeModal>\n <div class=\"modal-header\">\n <h4 class=\"modal-title pull-left\">Edit Node</h4>\n <button type=\"button\" class=\"btn-close close pull-right\" aria-label=\"Close\" (click)=\"closeModal('modalRef')\">\n <span aria-hidden=\"true\" class=\"visually-hidden\">×</span>\n </button>\n </div>\n <div class=\"modal-body\">\n <form [formGroup]=\"createNodeForm\">\n <div class=\"form-group\">\n <label for=\"iconType\">Icon Type</label>\n <div>\n <input type=\"radio\" id=\"imageUrl\" formControlName=\"iconType\" value=\"url\"> Image URL\n <input class=\"ml-5\" type=\"radio\" id=\"iconTypeSelect\" formControlName=\"iconType\" value=\"select\"> Choose Icon\n </div>\n </div>\n <div class=\"form-group\" *ngIf=\"createNodeForm.get('iconType')?.value === 'url'\">\n <label for=\"imageUrl\">Image URL</label>\n <div class=\"input-group\">\n <input type=\"text\" id=\"imageUrl\" formControlName=\"imageUrl\" class=\"form-control\" placeholder=\"Image URL\">\n <button type=\"button\" class=\"btn btn-outline-secondary\" (click)=\"clearImageUrl()\">Clear</button>\n </div>\n </div>\n <div class=\"form-group\" *ngIf=\"createNodeForm.get('iconType')?.value === 'select'\">\n <label for=\"nodeIcon\">Choose Icon</label>\n <ng-select\n formControlName=\"icon\"\n [items]=\"iconsBuffer\"\n [virtualScroll]=\"true\"\n [loading]=\"loading\"\n bindLabel=\"name\"\n bindValue=\"icon\"\n [editableSearchTerm]=\"true\"\n placeholder=\"Select icon\"\n appendTo=\"body\"\n [trackByFn]=\"trackByFn\"\n (scroll)=\"onScroll($event)\"\n (scrollToEnd)=\"onScrollToEnd()\"\n >\n <ng-template ng-header-tmp>\n <small class=\"form-text text-muted\"\n >Loaded {{ iconsBuffer.length }} of {{ fontAwesomeIcons.length }}</small\n >\n </ng-template>\n <ng-template ng-option-tmp let-item=\"item\">\n <i class=\"fa fa-light\">{{item.icon}}</i>\n <span class=\"ml-3\">{{ item.name }}</span>\n </ng-template>\n </ng-select>\n </div>\n <div *ngIf=\"createNodeForm.errors?.iconOrImage\" class=\"text-danger\">\n Please provide either an Image URL or choose an Icon, but not both.\n </div>\n <div class=\"form-group\">\n <label for=\"label\">Labels</label>\n <div formArrayName=\"label\">\n <div *ngFor=\"let label of nodeLabelArray.controls; let i = index\" [formGroupName]=\"i\"\n class=\"d-flex flex-column align-items-start\">\n <div class=\"d-flex align-items-center w-100\">\n <input formControlName=\"label\" class=\"form-control mb-2\" placeholder=\"Label\" [id]=\"'node-label-' + i\">\n <button type=\"button\" class=\"btn btn-danger ml-2\" (click)=\"removeNodeLabel(i)\" [disabled]=\"nodeLabelArray.length <= 1\">Remove</button>\n </div>\n </div>\n </div>\n <button type=\"button\" class=\"btn btn-secondary mt-2\" (click)=\"addNodeLabel()\">Add Label</button>\n </div>\n <div class=\"form-group\">\n <label for=\"nodeAdditionalIcon\">Additional icon</label>\n <ng-select\n formControlName=\"additionalIcon\"\n [items]=\"iconsBuffer\"\n [virtualScroll]=\"true\"\n [loading]=\"loading\"\n bindLabel=\"name\"\n bindValue=\"icon\"\n [editableSearchTerm]=\"true\"\n placeholder=\"Select icon\"\n appendTo=\"body\"\n [trackByFn]=\"trackByFn\"\n (scroll)=\"onScroll($event)\"\n (scrollToEnd)=\"onScrollToEnd()\"\n >\n <ng-template ng-header-tmp>\n <small class=\"form-text text-muted\"\n >Loaded {{ iconsBuffer.length }} of {{ fontAwesomeIcons.length }}</small\n >\n </ng-template>\n <ng-template ng-option-tmp let-item=\"item\">\n <i class=\"fa fa-light\">{{item.icon}}</i>\n <span class=\"ml-3\">{{ item.name }}</span>\n </ng-template>\n </ng-select>\n </div>\n </form>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"closeModal('modalRef')\">Cancel</button>\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"createEditNode('editNodeModal')\" [disabled]=\"!createNodeForm.valid\">Save Changes</button>\n <button type=\"button\" class=\"btn btn-danger\" (click)=\"deleteNode()\">Delete Node</button>\n </div>\n</ng-template>\n<!-- ./MODAL-->\n\n<!--CREATE NODE MODAL-->\n<ng-template #createNodeModal>\n <div class=\"modal-header\">\n <h4 class=\"modal-title pull-left\">Create Node</h4>\n <button type=\"button\" class=\"btn-close close pull-right\" aria-label=\"Close\" (click)=\"closeModal('modalRef')\">\n <span aria-hidden=\"true\" class=\"visually-hidden\">×</span>\n </button>\n </div>\n <div class=\"modal-body\">\n <form [formGroup]=\"createNodeForm\">\n <div class=\"form-group\">\n <label for=\"iconType\">Icon Type</label>\n <div>\n <input type=\"radio\" id=\"imageUrl\" formControlName=\"iconType\" value=\"url\"> Image URL\n <input class=\"ml-5\" type=\"radio\" id=\"iconTypeSelect\" formControlName=\"iconType\" value=\"select\"> Choose Icon\n </div>\n </div>\n <div class=\"form-group\" *ngIf=\"createNodeForm.get('iconType')?.value === 'url'\">\n <label for=\"imageUrl\">Image URL</label>\n <div class=\"input-group\">\n <input type=\"text\" id=\"imageUrl\" formControlName=\"imageUrl\" class=\"form-control\" placeholder=\"Image URL\">\n <button type=\"button\" class=\"btn btn-outline-secondary\" (click)=\"clearImageUrl()\">Clear</button>\n </div>\n </div>\n <div class=\"form-group\" *ngIf=\"createNodeForm.get('iconType')?.value === 'select'\">\n <label for=\"nodeIcon\">Choose Icon</label>\n <ng-select\n formControlName=\"icon\"\n [items]=\"iconsBuffer\"\n [virtualScroll]=\"true\"\n [loading]=\"loading\"\n bindLabel=\"name\"\n bindValue=\"icon\"\n [editableSearchTerm]=\"true\"\n placeholder=\"Select icon\"\n appendTo=\"body\"\n [trackByFn]=\"trackByFn\"\n (scroll)=\"onScroll($event)\"\n (scrollToEnd)=\"onScrollToEnd()\"\n >\n <ng-template ng-header-tmp>\n <small class=\"form-text text-muted\"\n >Loaded {{ iconsBuffer.length }} of {{ fontAwesomeIcons.length }}</small\n >\n </ng-template>\n <ng-template ng-option-tmp let-item=\"item\">\n <i class=\"fa fa-light\">{{item.icon}}</i>\n <span class=\"ml-3\">{{ item.name }}</span>\n </ng-template>\n </ng-select>\n </div>\n <div *ngIf=\"createNodeForm.errors?.iconOrImage\" class=\"text-danger\">\n Please provide either an Image URL or choose an Icon, but not both.\n </div>\n <div class=\"form-group\">\n <label for=\"label\">Labels</label>\n <div formArrayName=\"label\">\n <div *ngFor=\"let label of nodeLabelArray.controls; let i = index\" [formGroupName]=\"i\"\n class=\"d-flex flex-column align-items-start\">\n <div class=\"d-flex align-items-center w-100\">\n <input formControlName=\"label\" class=\"form-control mb-2\" placeholder=\"Label\" [id]=\"'node-label-' + i\">\n <button type=\"button\" class=\"btn btn-danger ml-2\" (click)=\"removeNodeLabel(i)\" [disabled]=\"nodeLabelArray.length <= 1\">Remove</button>\n </div>\n </div>\n </div>\n <button type=\"button\" class=\"btn btn-secondary mt-2\" (click)=\"addNodeLabel()\">Add Label</button>\n </div>\n <div class=\"form-group\">\n <label for=\"nodeAdditionalIcon\">Additional icon</label>\n <ng-select\n formControlName=\"additionalIcon\"\n [items]=\"iconsBuffer\"\n [virtualScroll]=\"true\"\n [loading]=\"loading\"\n bindLabel=\"name\"\n bindValue=\"icon\"\n [editableSearchTerm]=\"true\"\n placeholder=\"Select icon\"\n appendTo=\"body\"\n [trackByFn]=\"trackByFn\"\n (scroll)=\"onScroll($event)\"\n (scrollToEnd)=\"onScrollToEnd()\"\n >\n <ng-template ng-header-tmp>\n <small class=\"form-text text-muted\"\n >Loaded {{ iconsBuffer.length }} of {{ fontAwesomeIcons.length }}</small\n >\n </ng-template>\n <ng-template ng-option-tmp let-item=\"item\">\n <i class=\"fa fa-light\">{{item.icon}}</i>\n <span class=\"ml-3\">{{ item.name }}</span>\n </ng-template>\n </ng-select>\n </div>\n </form>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"closeModal('modalRef')\">Cancel</button>\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"createEditNode('createNodeModal')\" [disabled]=\"!createNodeForm.valid\">Create Node</button>\n </div>\n</ng-template>\n<!-- ./MODAL-->\n\n<!--EDIT LINKS MODAL-->\n<ng-template #editLinksModal>\n <div class=\"modal-header\">\n <h4 class=\"modal-title pull-left\">Edit Links</h4>\n <button type=\"button\" class=\"btn-close close pull-right\" aria-label=\"Close\" (click)=\"closeModal('modalRef')\">\n <span aria-hidden=\"true\" class=\"visually-hidden\">×</span>\n </button>\n </div>\n <div class=\"modal-body\">\n <form [formGroup]=\"createLinkForm\">\n <div class=\"col-sm-12 d-flex flex-column\">\n <div class=\"d-flex mb-3\">\n <div class=\"iconImage\">\n <span><i class=\"fas fa-arrow-left\"></i></span>\n <span class=\"arrow\">\n <input type=\"checkbox\" id=\"sourceArrow\" formControlName=\"sourceArrow\" class=\"form-check-input\">\n <label class=\"d-none form-check-label\" for=\"leftArrow\"></label>\n </span>\n </div>\n <div class=\"iconImage ml-3\">\n <ng-container *ngIf=\"targetImageUrl; else targetIconTemplate\">\n <img class=\"imageUrl\" [src]=\"targetImageUrl\" />\n </ng-container>\n <ng-template #targetIconTemplate>\n <i class=\"fa-solid fa-2x\">{{targetIcon}}</i>\n </ng-template>\n </div>\n <div\n [ngClass]=\"{\n 'link-line-solid': createLinkForm.get('lineStyle')?.value === 'Solid',\n 'link-line-dotted': createLinkForm.get('lineStyle')?.value === 'Dotted'\n }\"\n >\n </div>\n <div class=\"iconImage mr-3\">\n <ng-container *ngIf=\"sourceImageUrl; else sourceIconTemplate\">\n <img class=\"imageUrl\" [src]=\"sourceImageUrl\" />\n </ng-container>\n <ng-template #sourceIconTemplate>\n <i class=\"fa-solid fa-2x\">{{sourceIcon}}</i>\n </ng-template>\n </div>\n <div class=\"iconImage\">\n <span><i class=\"fas fa-arrow-right\"></i></span>\n <span class=\"arrow\">\n <input type=\"checkbox\" id=\"targetArrow\" formControlName=\"targetArrow\" class=\"form-check-input\">\n <label class=\"form-check-label\" for=\"rightArrow\"></label>\n </span>\n </div>\n </div>\n <div class=\"d-flex justify-content-between mb-3\">\n <div class=\"text-left d-block font-weight-bold\" style=\"font-size: 12px\">\n <span class=\"d-block\" *ngFor=\"let label of targetLabels\">{{ label }}</span>\n </div>\n <div class=\"text-right d-block font-weight-bold\" style=\"font-size: 12px\">\n <span class=\"d-block\" *ngFor=\"let label of sourceLabels\">{{ label }}</span>\n </div>\n </div>\n <div *ngIf=\"createLinkForm.get('label')?.value?.length\" class=\"labelPosition text-center\">\n <span *ngFor=\"let label of createLinkForm.get('label')?.value\">\n <span class=\"d-block\">{{ label.label }} <span style=\"color: #856404;\" *ngIf=\"label.linkIcon\"><i class=\"fas fa-link\"></i></span></span>\n </span>\n </div>\n </div>\n <div class=\"form-group\">\n <label for=\"lineStyle\">Line Style</label>\n <select id=\"lineStyle\" formControlName=\"lineStyle\" class=\"form-control\">\n <option value=\"Solid\">Solid</option>\n <option value=\"Dotted\">Dotted</option>\n </select>\n </div>\n\n <div class=\"form-group\">\n <label for=\"label\">Labels</label>\n <div formArrayName=\"label\">\n <div *ngFor=\"let label of labelArray.controls; let i = index\" [formGroupName]=\"i\"\n class=\"d-flex flex-column align-items-start\">\n <div class=\"d-flex align-items-center w-100\">\n <input formControlName=\"label\" class=\"form-control\" placeholder=\"Label\" [id]=\"'label-' + i\">\n <button type=\"button\" class=\"btn btn-danger ml-2\" (click)=\"removeLabel(i)\" [disabled]=\"labelArray.length <= 1\">Remove</button>\n </div>\n <div class=\"form-group form-check\">\n <input type=\"checkbox\" formControlName=\"linkIcon\" class=\"form-check-input\" [id]=\"'linkIcon-' + i\">\n <label [for]=\"'linkIcon-' + i\">Link Icon?</label>\n </div>\n </div>\n </div>\n <button type=\"button\" class=\"btn btn-secondary mt-2\" (click)=\"addLabel()\">Add Label</button>\n </div>\n </form>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"closeModal('modalRef')\">Cancel</button>\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"createEditLink('editLinkModal')\" [disabled]=\"!createLinkForm.valid\">Save Changes</button>\n <button type=\"button\" class=\"btn btn-danger\" (click)=\"deleteLink()\">Delete Link</button>\n </div>\n</ng-template>\n<!-- ./MODAL-->\n\n\n<!--CREATE LINK MODAL-->\n<ng-template #createLinkModal>\n <div class=\"modal-header\">\n <h4 class=\"modal-title pull-left\">Create Link</h4>\n <button type=\"button\" class=\"btn-close close pull-right\" aria-label=\"Close\" (click)=\"closeModal('modalRef')\">\n <span aria-hidden=\"true\" class=\"visually-hidden\">×</span>\n </button>\n </div>\n <div class=\"modal-body\">\n <form [formGroup]=\"createLinkForm\">\n <div class=\"col-sm-12 d-flex flex-column\">\n <div class=\"d-flex mb-3\">\n <div class=\"iconImage\">\n <span><i class=\"fas fa-arrow-left\"></i></span>\n <span class=\"arrow\">\n <input type=\"checkbox\" id=\"sourceArrow\" formControlName=\"sourceArrow\" class=\"form-check-input\">\n <label class=\"d-none form-check-label\" for=\"leftArrow\"></label>\n </span>\n </div>\n <div class=\"iconImage ml-3\">\n <ng-container *ngIf=\"targetImageUrl; else targetIconTemplate\">\n <img class=\"imageUrl\" [src]=\"targetImageUrl\" />\n </ng-container>\n <ng-template #targetIconTemplate>\n <i class=\"fa-solid fa-2x\">{{targetIcon}}</i>\n </ng-template>\n </div>\n <div\n [ngClass]=\"{\n 'link-line-solid': createLinkForm.get('lineStyle')?.value === 'Solid',\n 'link-line-dotted': createLinkForm.get('lineStyle')?.value === 'Dotted'\n }\"\n >\n </div>\n <div class=\"iconImage mr-3\">\n <ng-container *ngIf=\"sourceImageUrl; else sourceIconTemplate\">\n <img class=\"imageUrl\" [src]=\"sourceImageUrl\" />\n </ng-container>\n <ng-template #sourceIconTemplate>\n <i class=\"fa-solid fa-2x\">{{sourceIcon}}</i>\n </ng-template>\n </div>\n <div class=\"iconImage\">\n <span><i class=\"fas fa-arrow-right\"></i></span>\n <span class=\"arrow\">\n <input type=\"checkbox\" id=\"targetArrow\" formControlName=\"targetArrow\" class=\"form-check-input\">\n <label class=\"form-check-label\" for=\"rightArrow\"></label>\n </span>\n </div>\n </div>\n <div class=\"d-flex justify-content-between mb-3\">\n <div class=\"text-left d-block font-weight-bold\" style=\"font-size: 12px\">\n <span class=\"d-block\" *ngFor=\"let label of targetLabels\">{{ label }}</span>\n </div>\n <div class=\"text-right d-block font-weight-bold\" style=\"font-size: 12px\">\n <span class=\"d-block\" *ngFor=\"let label of sourceLabels\">{{ label }}</span>\n </div>\n </div>\n <div *ngIf=\"createLinkForm.get('label')?.value?.length\" class=\"labelPosition text-center\">\n <span *ngFor=\"let label of createLinkForm.get('label')?.value\">\n <span class=\"d-block\">{{ label.label }} <span style=\"color: #856404;\" *ngIf=\"label.linkIcon\"><i class=\"fas fa-link\"></i></span></span>\n </span>\n </div>\n </div>\n <div class=\"form-group\">\n <label for=\"lineStyle\">Line Style</label>\n <select id=\"lineStyle\" formControlName=\"lineStyle\" class=\"form-control\">\n <option value=\"Solid\">Solid</option>\n <option value=\"Dotted\">Dotted</option>\n </select>\n </div>\n\n <div class=\"form-group\">\n <label for=\"label\">Labels</label>\n <div formArrayName=\"label\">\n <div *ngFor=\"let label of labelArray.controls; let i = index\" [formGroupName]=\"i\"\n class=\"d-flex flex-column align-items-start\">\n <div class=\"d-flex align-items-center w-100\">\n <input formControlName=\"label\" class=\"form-control\" placeholder=\"Label\" [id]=\"'label-' + i\">\n <button type=\"button\" class=\"btn btn-danger ml-2\" (click)=\"removeLabel(i)\" [disabled]=\"labelArray.length <= 1\">Remove</button>\n </div>\n <div class=\"form-group form-check\">\n <input type=\"checkbox\" formControlName=\"linkIcon\" class=\"form-check-input\" [id]=\"'linkIcon-' + i\">\n <label [for]=\"'linkIcon-' + i\">Link Icon?</label>\n </div>\n </div>\n </div>\n <button type=\"button\" class=\"btn btn-secondary mt-2\" (click)=\"addLabel()\">Add Label</button>\n </div>\n </form>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"closeModal('modalRef')\">Cancel</button>\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"createEditLink('createLinkModal')\" [disabled]=\"!createLinkForm.valid\">Create Link</button>\n </div>\n</ng-template>\n<!-- ./MODAL-->", styles: [".imageUrl{max-width:30px}.labelPosition{position:relative;top:-55px;margin-right:30px;margin-left:30px}.link-line-solid{width:100%;position:relative;margin:15px;border-top:2px solid #777}.link-line-dotted{width:100%;position:relative;margin:15px;background-image:repeating-linear-gradient(to right,#cacaca,#cacaca 7px,transparent 7px,transparent 15px);height:2px}.iconImage{position:relative;top:4px}.arrow{position:absolute;top:20px;left:20px}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2$1.RadioControlValueAccessor, selector: "input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]", inputs: ["name", "formControlName", "value"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i2$1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i2$1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "component", type: i5.NgSelectComponent, selector: "ng-select", inputs: ["bindLabel", "bindValue", "markFirst", "placeholder", "notFoundText", "typeToSearchText", "addTagText", "loadingText", "clearAllText", "appearance", "dropdownPosition", "appendTo", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "openOnEnter", "maxSelectedItems", "groupBy", "groupValue", "bufferAmount", "virtualScroll", "selectableGroup", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "tabIndex", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "keyDownFn", "typeahead", "multiple", "addTag", "searchable", "clearable", "isOpen", "items", "compareWith", "clearSearchOnAdd", "deselectOnClick"], outputs: ["blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"] }, { kind: "directive", type: i5.NgOptionTemplateDirective, selector: "[ng-option-tmp]" }, { kind: "directive", type: i5.NgHeaderTemplateDirective, selector: "[ng-header-tmp]" }] });
|
|
674
669
|
}
|
|
675
670
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ModalsComponent, decorators: [{
|
|
676
671
|
type: Component,
|
|
677
|
-
args: [{ selector: 'app-modals', template: "<!--EDIT NODE MODAL-->\n<ng-template #editNodeModal>\n <div class=\"modal-header\">\n <h4 class=\"modal-title pull-left\">Edit Node</h4>\n <button type=\"button\" class=\"btn-close close pull-right\" aria-label=\"Close\" (click)=\"closeModal('modalRef')\">\n <span aria-hidden=\"true\" class=\"visually-hidden\">×</span>\n </button>\n </div>\n <div class=\"modal-body\">\n <form [formGroup]=\"createNodeForm\">\n <div class=\"form-group\">\n <label for=\"iconType\">Icon Type</label>\n <div>\n <input type=\"radio\" id=\"imageUrl\" formControlName=\"iconType\" value=\"url\"> Image URL\n <input class=\"ml-5\" type=\"radio\" id=\"iconTypeSelect\" formControlName=\"iconType\" value=\"select\"> Choose Icon\n </div>\n </div>\n <div class=\"form-group\" *ngIf=\"createNodeForm.get('iconType').value === 'url'\">\n <label for=\"imageUrl\">Image URL</label>\n <div class=\"input-group\">\n <input type=\"text\" id=\"imageUrl\" formControlName=\"imageUrl\" class=\"form-control\" placeholder=\"Image URL\">\n <button type=\"button\" class=\"btn btn-outline-secondary\" (click)=\"clearImageUrl()\">Clear</button>\n </div>\n </div>\n <div class=\"form-group\" *ngIf=\"createNodeForm.get('iconType').value === 'select'\">\n <label for=\"nodeIcon\">Choose Icon</label>\n <ng-select\n formControlName=\"icon\"\n [items]=\"iconsBuffer\"\n [virtualScroll]=\"true\"\n [loading]=\"loading\"\n bindLabel=\"name\"\n bindValue=\"icon\"\n [editableSearchTerm]=\"true\"\n placeholder=\"Select icon\"\n appendTo=\"body\"\n [trackByFn]=\"trackByFn\"\n (scroll)=\"onScroll($event)\"\n (scrollToEnd)=\"onScrollToEnd()\"\n >\n <ng-template ng-header-tmp>\n <small class=\"form-text text-muted\"\n >Loaded {{ iconsBuffer.length }} of {{ fontAwesomeIcons.length }}</small\n >\n </ng-template>\n <ng-template ng-option-tmp let-item=\"item\">\n <i class=\"fa fa-light\">{{item.icon}}</i>\n <span class=\"ml-3\">{{ item.name }}</span>\n </ng-template>\n </ng-select>\n </div>\n <div *ngIf=\"createNodeForm.errors?.iconOrImage\" class=\"text-danger\">\n Please provide either an Image URL or choose an Icon, but not both.\n </div>\n <div class=\"form-group\">\n <label for=\"label\">Labels</label>\n <div formArrayName=\"label\">\n <div *ngFor=\"let label of nodeLabelArray.controls; let i = index\" [formGroupName]=\"i\"\n class=\"d-flex flex-column align-items-start\">\n <div class=\"d-flex align-items-center w-100\">\n <input formControlName=\"label\" class=\"form-control mb-2\" placeholder=\"Label\" [id]=\"'node-label-' + i\">\n <button type=\"button\" class=\"btn btn-danger ml-2\" (click)=\"removeNodeLabel(i)\" [disabled]=\"nodeLabelArray.length <= 1\">Remove</button>\n </div>\n </div>\n </div>\n <button type=\"button\" class=\"btn btn-secondary mt-2\" (click)=\"addNodeLabel()\">Add Label</button>\n </div>\n <div class=\"form-group\">\n <label for=\"nodeAdditionalIcon\">Additional icon</label>\n <ng-select\n formControlName=\"additionalIcon\"\n [items]=\"iconsBuffer\"\n [virtualScroll]=\"true\"\n [loading]=\"loading\"\n bindLabel=\"name\"\n bindValue=\"icon\"\n [editableSearchTerm]=\"true\"\n placeholder=\"Select icon\"\n appendTo=\"body\"\n [trackByFn]=\"trackByFn\"\n (scroll)=\"onScroll($event)\"\n (scrollToEnd)=\"onScrollToEnd()\"\n >\n <ng-template ng-header-tmp>\n <small class=\"form-text text-muted\"\n >Loaded {{ iconsBuffer.length }} of {{ fontAwesomeIcons.length }}</small\n >\n </ng-template>\n <ng-template ng-option-tmp let-item=\"item\">\n <i class=\"fa fa-light\">{{item.icon}}</i>\n <span class=\"ml-3\">{{ item.name }}</span>\n </ng-template>\n </ng-select>\n </div>\n </form>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"closeModal('modalRef')\">Cancel</button>\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"createEditNode('editNodeModal')\" [disabled]=\"!createNodeForm.valid\">Save Changes</button>\n <button type=\"button\" class=\"btn btn-danger\" (click)=\"deleteNode()\">Delete Node</button>\n </div>\n</ng-template>\n<!-- ./MODAL-->\n\n<!--CREATE NODE MODAL-->\n<ng-template #createNodeModal>\n <div class=\"modal-header\">\n <h4 class=\"modal-title pull-left\">Create Node</h4>\n <button type=\"button\" class=\"btn-close close pull-right\" aria-label=\"Close\" (click)=\"closeModal('modalRef')\">\n <span aria-hidden=\"true\" class=\"visually-hidden\">×</span>\n </button>\n </div>\n <div class=\"modal-body\">\n <form [formGroup]=\"createNodeForm\">\n <div class=\"form-group\">\n <label for=\"iconType\">Icon Type</label>\n <div>\n <input type=\"radio\" id=\"imageUrl\" formControlName=\"iconType\" value=\"url\"> Image URL\n <input class=\"ml-5\" type=\"radio\" id=\"iconTypeSelect\" formControlName=\"iconType\" value=\"select\"> Choose Icon\n </div>\n </div>\n <div class=\"form-group\" *ngIf=\"createNodeForm.get('iconType').value === 'url'\">\n <label for=\"imageUrl\">Image URL</label>\n <div class=\"input-group\">\n <input type=\"text\" id=\"imageUrl\" formControlName=\"imageUrl\" class=\"form-control\" placeholder=\"Image URL\">\n <button type=\"button\" class=\"btn btn-outline-secondary\" (click)=\"clearImageUrl()\">Clear</button>\n </div>\n </div>\n <div class=\"form-group\" *ngIf=\"createNodeForm.get('iconType').value === 'select'\">\n <label for=\"nodeIcon\">Choose Icon</label>\n <ng-select\n formControlName=\"icon\"\n [items]=\"iconsBuffer\"\n [virtualScroll]=\"true\"\n [loading]=\"loading\"\n bindLabel=\"name\"\n bindValue=\"icon\"\n [editableSearchTerm]=\"true\"\n placeholder=\"Select icon\"\n appendTo=\"body\"\n [trackByFn]=\"trackByFn\"\n (scroll)=\"onScroll($event)\"\n (scrollToEnd)=\"onScrollToEnd()\"\n >\n <ng-template ng-header-tmp>\n <small class=\"form-text text-muted\"\n >Loaded {{ iconsBuffer.length }} of {{ fontAwesomeIcons.length }}</small\n >\n </ng-template>\n <ng-template ng-option-tmp let-item=\"item\">\n <i class=\"fa fa-light\">{{item.icon}}</i>\n <span class=\"ml-3\">{{ item.name }}</span>\n </ng-template>\n </ng-select>\n </div>\n <div *ngIf=\"createNodeForm.errors?.iconOrImage\" class=\"text-danger\">\n Please provide either an Image URL or choose an Icon, but not both.\n </div>\n <div class=\"form-group\">\n <label for=\"label\">Labels</label>\n <div formArrayName=\"label\">\n <div *ngFor=\"let label of nodeLabelArray.controls; let i = index\" [formGroupName]=\"i\"\n class=\"d-flex flex-column align-items-start\">\n <div class=\"d-flex align-items-center w-100\">\n <input formControlName=\"label\" class=\"form-control mb-2\" placeholder=\"Label\" [id]=\"'node-label-' + i\">\n <button type=\"button\" class=\"btn btn-danger ml-2\" (click)=\"removeNodeLabel(i)\" [disabled]=\"nodeLabelArray.length <= 1\">Remove</button>\n </div>\n </div>\n </div>\n <button type=\"button\" class=\"btn btn-secondary mt-2\" (click)=\"addNodeLabel()\">Add Label</button>\n </div>\n <div class=\"form-group\">\n <label for=\"nodeAdditionalIcon\">Additional icon</label>\n <ng-select\n formControlName=\"additionalIcon\"\n [items]=\"iconsBuffer\"\n [virtualScroll]=\"true\"\n [loading]=\"loading\"\n bindLabel=\"name\"\n bindValue=\"icon\"\n [editableSearchTerm]=\"true\"\n placeholder=\"Select icon\"\n appendTo=\"body\"\n [trackByFn]=\"trackByFn\"\n (scroll)=\"onScroll($event)\"\n (scrollToEnd)=\"onScrollToEnd()\"\n >\n <ng-template ng-header-tmp>\n <small class=\"form-text text-muted\"\n >Loaded {{ iconsBuffer.length }} of {{ fontAwesomeIcons.length }}</small\n >\n </ng-template>\n <ng-template ng-option-tmp let-item=\"item\">\n <i class=\"fa fa-light\">{{item.icon}}</i>\n <span class=\"ml-3\">{{ item.name }}</span>\n </ng-template>\n </ng-select>\n </div>\n </form>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"closeModal('modalRef')\">Cancel</button>\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"createEditNode('createNodeModal')\" [disabled]=\"!createNodeForm.valid\">Create Node</button>\n </div>\n</ng-template>\n<!-- ./MODAL-->\n\n<!--EDIT LINKS MODAL-->\n<ng-template #editLinksModal>\n <div class=\"modal-header\">\n <h4 class=\"modal-title pull-left\">Edit Links</h4>\n <button type=\"button\" class=\"btn-close close pull-right\" aria-label=\"Close\" (click)=\"closeModal('modalRef')\">\n <span aria-hidden=\"true\" class=\"visually-hidden\">×</span>\n </button>\n </div>\n <div class=\"modal-body\">\n <form [formGroup]=\"createLinkForm\">\n <div class=\"col-sm-12 d-flex flex-column\">\n <div class=\"d-flex mb-3\">\n <div class=\"iconImage\">\n <span><i class=\"fas fa-arrow-left\"></i></span>\n <span class=\"arrow\">\n <input type=\"checkbox\" id=\"sourceArrow\" formControlName=\"sourceArrow\" class=\"form-check-input\">\n <label class=\"d-none form-check-label\" for=\"leftArrow\"></label>\n </span>\n </div>\n <div class=\"iconImage ml-3\">\n <ng-container *ngIf=\"targetImageUrl; else targetIconTemplate\">\n <img class=\"imageUrl\" [src]=\"targetImageUrl\" />\n </ng-container>\n <ng-template #targetIconTemplate>\n <i class=\"fa-solid fa-2x\">{{targetIcon}}</i>\n </ng-template>\n </div>\n <div\n [ngClass]=\"{\n 'link-line-solid': createLinkForm.get('lineStyle').value === 'Solid',\n 'link-line-dotted': createLinkForm.get('lineStyle').value === 'Dotted'\n }\"\n >\n </div>\n <div class=\"iconImage mr-3\">\n <ng-container *ngIf=\"sourceImageUrl; else sourceIconTemplate\">\n <img class=\"imageUrl\" [src]=\"sourceImageUrl\" />\n </ng-container>\n <ng-template #sourceIconTemplate>\n <i class=\"fa-solid fa-2x\">{{sourceIcon}}</i>\n </ng-template>\n </div>\n <div class=\"iconImage\">\n <span><i class=\"fas fa-arrow-right\"></i></span>\n <span class=\"arrow\">\n <input type=\"checkbox\" id=\"targetArrow\" formControlName=\"targetArrow\" class=\"form-check-input\">\n <label class=\"form-check-label\" for=\"rightArrow\"></label>\n </span>\n </div>\n </div>\n <div class=\"d-flex justify-content-between mb-3\">\n <div class=\"text-left d-block font-weight-bold\" style=\"font-size: 12px\">\n <span class=\"d-block\" *ngFor=\"let label of targetLabels\">{{ label }}</span>\n </div>\n <div class=\"text-right d-block font-weight-bold\" style=\"font-size: 12px\">\n <span class=\"d-block\" *ngFor=\"let label of sourceLabels\">{{ label }}</span>\n </div>\n </div>\n <div *ngIf=\"createLinkForm.get('label')?.value?.length\" class=\"labelPosition text-center\">\n <span *ngFor=\"let label of createLinkForm.get('label').value\">\n <span class=\"d-block\">{{ label.label }} <span style=\"color: #856404;\" *ngIf=\"label.linkIcon\"><i class=\"fas fa-link\"></i></span></span>\n </span>\n </div>\n </div>\n <div class=\"form-group\">\n <label for=\"lineStyle\">Line Style</label>\n <select id=\"lineStyle\" formControlName=\"lineStyle\" class=\"form-control\">\n <option value=\"Solid\">Solid</option>\n <option value=\"Dotted\">Dotted</option>\n </select>\n </div>\n\n <div class=\"form-group\">\n <label for=\"label\">Labels</label>\n <div formArrayName=\"label\">\n <div *ngFor=\"let label of labelArray.controls; let i = index\" [formGroupName]=\"i\"\n class=\"d-flex flex-column align-items-start\">\n <div class=\"d-flex align-items-center w-100\">\n <input formControlName=\"label\" class=\"form-control\" placeholder=\"Label\" [id]=\"'label-' + i\">\n <button type=\"button\" class=\"btn btn-danger ml-2\" (click)=\"removeLabel(i)\" [disabled]=\"labelArray.length <= 1\">Remove</button>\n </div>\n <div class=\"form-group form-check\">\n <input type=\"checkbox\" formControlName=\"linkIcon\" class=\"form-check-input\" [id]=\"'linkIcon-' + i\">\n <label [for]=\"'linkIcon-' + i\">Link Icon?</label>\n </div>\n </div>\n </div>\n <button type=\"button\" class=\"btn btn-secondary mt-2\" (click)=\"addLabel()\">Add Label</button>\n </div>\n </form>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"closeModal('modalRef')\">Cancel</button>\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"createEditLink('editLinkModal')\" [disabled]=\"!createLinkForm.valid\">Save Changes</button>\n <button type=\"button\" class=\"btn btn-danger\" (click)=\"deleteLink()\">Delete Link</button>\n </div>\n</ng-template>\n<!-- ./MODAL-->\n\n\n<!--CREATE LINK MODAL-->\n<ng-template #createLinkModal>\n <div class=\"modal-header\">\n <h4 class=\"modal-title pull-left\">Create Link</h4>\n <button type=\"button\" class=\"btn-close close pull-right\" aria-label=\"Close\" (click)=\"closeModal('modalRef')\">\n <span aria-hidden=\"true\" class=\"visually-hidden\">×</span>\n </button>\n </div>\n <div class=\"modal-body\">\n <form [formGroup]=\"createLinkForm\">\n <div class=\"col-sm-12 d-flex flex-column\">\n <div class=\"d-flex mb-3\">\n <div class=\"iconImage\">\n <span><i class=\"fas fa-arrow-left\"></i></span>\n <span class=\"arrow\">\n <input type=\"checkbox\" id=\"sourceArrow\" formControlName=\"sourceArrow\" class=\"form-check-input\">\n <label class=\"d-none form-check-label\" for=\"leftArrow\"></label>\n </span>\n </div>\n <div class=\"iconImage ml-3\">\n <ng-container *ngIf=\"targetImageUrl; else targetIconTemplate\">\n <img class=\"imageUrl\" [src]=\"targetImageUrl\" />\n </ng-container>\n <ng-template #targetIconTemplate>\n <i class=\"fa-solid fa-2x\">{{targetIcon}}</i>\n </ng-template>\n </div>\n <div\n [ngClass]=\"{\n 'link-line-solid': createLinkForm.get('lineStyle').value === 'Solid',\n 'link-line-dotted': createLinkForm.get('lineStyle').value === 'Dotted'\n }\"\n >\n </div>\n <div class=\"iconImage mr-3\">\n <ng-container *ngIf=\"sourceImageUrl; else sourceIconTemplate\">\n <img class=\"imageUrl\" [src]=\"sourceImageUrl\" />\n </ng-container>\n <ng-template #sourceIconTemplate>\n <i class=\"fa-solid fa-2x\">{{sourceIcon}}</i>\n </ng-template>\n </div>\n <div class=\"iconImage\">\n <span><i class=\"fas fa-arrow-right\"></i></span>\n <span class=\"arrow\">\n <input type=\"checkbox\" id=\"targetArrow\" formControlName=\"targetArrow\" class=\"form-check-input\">\n <label class=\"form-check-label\" for=\"rightArrow\"></label>\n </span>\n </div>\n </div>\n <div class=\"d-flex justify-content-between mb-3\">\n <div class=\"text-left d-block font-weight-bold\" style=\"font-size: 12px\">\n <span class=\"d-block\" *ngFor=\"let label of targetLabels\">{{ label }}</span>\n </div>\n <div class=\"text-right d-block font-weight-bold\" style=\"font-size: 12px\">\n <span class=\"d-block\" *ngFor=\"let label of sourceLabels\">{{ label }}</span>\n </div>\n </div>\n <div *ngIf=\"createLinkForm.get('label')?.value?.length\" class=\"labelPosition text-center\">\n <span *ngFor=\"let label of createLinkForm.get('label').value\">\n <span class=\"d-block\">{{ label.label }} <span style=\"color: #856404;\" *ngIf=\"label.linkIcon\"><i class=\"fas fa-link\"></i></span></span>\n </span>\n </div>\n </div>\n <div class=\"form-group\">\n <label for=\"lineStyle\">Line Style</label>\n <select id=\"lineStyle\" formControlName=\"lineStyle\" class=\"form-control\">\n <option value=\"Solid\">Solid</option>\n <option value=\"Dotted\">Dotted</option>\n </select>\n </div>\n\n <div class=\"form-group\">\n <label for=\"label\">Labels</label>\n <div formArrayName=\"label\">\n <div *ngFor=\"let label of labelArray.controls; let i = index\" [formGroupName]=\"i\"\n class=\"d-flex flex-column align-items-start\">\n <div class=\"d-flex align-items-center w-100\">\n <input formControlName=\"label\" class=\"form-control\" placeholder=\"Label\" [id]=\"'label-' + i\">\n <button type=\"button\" class=\"btn btn-danger ml-2\" (click)=\"removeLabel(i)\" [disabled]=\"labelArray.length <= 1\">Remove</button>\n </div>\n <div class=\"form-group form-check\">\n <input type=\"checkbox\" formControlName=\"linkIcon\" class=\"form-check-input\" [id]=\"'linkIcon-' + i\">\n <label [for]=\"'linkIcon-' + i\">Link Icon?</label>\n </div>\n </div>\n </div>\n <button type=\"button\" class=\"btn btn-secondary mt-2\" (click)=\"addLabel()\">Add Label</button>\n </div>\n </form>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"closeModal('modalRef')\">Cancel</button>\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"createEditLink('createLinkModal')\" [disabled]=\"!createLinkForm.valid\">Create Link</button>\n </div>\n</ng-template>\n<!-- ./MODAL-->", styles: [".imageUrl{max-width:30px}.labelPosition{position:relative;top:-55px;margin-right:30px;margin-left:30px}.link-line-solid{width:100%;position:relative;margin:15px;border-top:2px solid #777}.link-line-dotted{width:100%;position:relative;margin:15px;background-image:repeating-linear-gradient(to right,#cacaca,#cacaca 7px,transparent 7px,transparent 15px);height:2px}.iconImage{position:relative;top:4px}.arrow{position:absolute;top:20px;left:20px}\n"] }]
|
|
672
|
+
args: [{ selector: 'app-modals', template: "<!--EDIT NODE MODAL-->\n<ng-template #editNodeModal>\n <div class=\"modal-header\">\n <h4 class=\"modal-title pull-left\">Edit Node</h4>\n <button type=\"button\" class=\"btn-close close pull-right\" aria-label=\"Close\" (click)=\"closeModal('modalRef')\">\n <span aria-hidden=\"true\" class=\"visually-hidden\">×</span>\n </button>\n </div>\n <div class=\"modal-body\">\n <form [formGroup]=\"createNodeForm\">\n <div class=\"form-group\">\n <label for=\"iconType\">Icon Type</label>\n <div>\n <input type=\"radio\" id=\"imageUrl\" formControlName=\"iconType\" value=\"url\"> Image URL\n <input class=\"ml-5\" type=\"radio\" id=\"iconTypeSelect\" formControlName=\"iconType\" value=\"select\"> Choose Icon\n </div>\n </div>\n <div class=\"form-group\" *ngIf=\"createNodeForm.get('iconType')?.value === 'url'\">\n <label for=\"imageUrl\">Image URL</label>\n <div class=\"input-group\">\n <input type=\"text\" id=\"imageUrl\" formControlName=\"imageUrl\" class=\"form-control\" placeholder=\"Image URL\">\n <button type=\"button\" class=\"btn btn-outline-secondary\" (click)=\"clearImageUrl()\">Clear</button>\n </div>\n </div>\n <div class=\"form-group\" *ngIf=\"createNodeForm.get('iconType')?.value === 'select'\">\n <label for=\"nodeIcon\">Choose Icon</label>\n <ng-select\n formControlName=\"icon\"\n [items]=\"iconsBuffer\"\n [virtualScroll]=\"true\"\n [loading]=\"loading\"\n bindLabel=\"name\"\n bindValue=\"icon\"\n [editableSearchTerm]=\"true\"\n placeholder=\"Select icon\"\n appendTo=\"body\"\n [trackByFn]=\"trackByFn\"\n (scroll)=\"onScroll($event)\"\n (scrollToEnd)=\"onScrollToEnd()\"\n >\n <ng-template ng-header-tmp>\n <small class=\"form-text text-muted\"\n >Loaded {{ iconsBuffer.length }} of {{ fontAwesomeIcons.length }}</small\n >\n </ng-template>\n <ng-template ng-option-tmp let-item=\"item\">\n <i class=\"fa fa-light\">{{item.icon}}</i>\n <span class=\"ml-3\">{{ item.name }}</span>\n </ng-template>\n </ng-select>\n </div>\n <div *ngIf=\"createNodeForm.errors?.iconOrImage\" class=\"text-danger\">\n Please provide either an Image URL or choose an Icon, but not both.\n </div>\n <div class=\"form-group\">\n <label for=\"label\">Labels</label>\n <div formArrayName=\"label\">\n <div *ngFor=\"let label of nodeLabelArray.controls; let i = index\" [formGroupName]=\"i\"\n class=\"d-flex flex-column align-items-start\">\n <div class=\"d-flex align-items-center w-100\">\n <input formControlName=\"label\" class=\"form-control mb-2\" placeholder=\"Label\" [id]=\"'node-label-' + i\">\n <button type=\"button\" class=\"btn btn-danger ml-2\" (click)=\"removeNodeLabel(i)\" [disabled]=\"nodeLabelArray.length <= 1\">Remove</button>\n </div>\n </div>\n </div>\n <button type=\"button\" class=\"btn btn-secondary mt-2\" (click)=\"addNodeLabel()\">Add Label</button>\n </div>\n <div class=\"form-group\">\n <label for=\"nodeAdditionalIcon\">Additional icon</label>\n <ng-select\n formControlName=\"additionalIcon\"\n [items]=\"iconsBuffer\"\n [virtualScroll]=\"true\"\n [loading]=\"loading\"\n bindLabel=\"name\"\n bindValue=\"icon\"\n [editableSearchTerm]=\"true\"\n placeholder=\"Select icon\"\n appendTo=\"body\"\n [trackByFn]=\"trackByFn\"\n (scroll)=\"onScroll($event)\"\n (scrollToEnd)=\"onScrollToEnd()\"\n >\n <ng-template ng-header-tmp>\n <small class=\"form-text text-muted\"\n >Loaded {{ iconsBuffer.length }} of {{ fontAwesomeIcons.length }}</small\n >\n </ng-template>\n <ng-template ng-option-tmp let-item=\"item\">\n <i class=\"fa fa-light\">{{item.icon}}</i>\n <span class=\"ml-3\">{{ item.name }}</span>\n </ng-template>\n </ng-select>\n </div>\n </form>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"closeModal('modalRef')\">Cancel</button>\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"createEditNode('editNodeModal')\" [disabled]=\"!createNodeForm.valid\">Save Changes</button>\n <button type=\"button\" class=\"btn btn-danger\" (click)=\"deleteNode()\">Delete Node</button>\n </div>\n</ng-template>\n<!-- ./MODAL-->\n\n<!--CREATE NODE MODAL-->\n<ng-template #createNodeModal>\n <div class=\"modal-header\">\n <h4 class=\"modal-title pull-left\">Create Node</h4>\n <button type=\"button\" class=\"btn-close close pull-right\" aria-label=\"Close\" (click)=\"closeModal('modalRef')\">\n <span aria-hidden=\"true\" class=\"visually-hidden\">×</span>\n </button>\n </div>\n <div class=\"modal-body\">\n <form [formGroup]=\"createNodeForm\">\n <div class=\"form-group\">\n <label for=\"iconType\">Icon Type</label>\n <div>\n <input type=\"radio\" id=\"imageUrl\" formControlName=\"iconType\" value=\"url\"> Image URL\n <input class=\"ml-5\" type=\"radio\" id=\"iconTypeSelect\" formControlName=\"iconType\" value=\"select\"> Choose Icon\n </div>\n </div>\n <div class=\"form-group\" *ngIf=\"createNodeForm.get('iconType')?.value === 'url'\">\n <label for=\"imageUrl\">Image URL</label>\n <div class=\"input-group\">\n <input type=\"text\" id=\"imageUrl\" formControlName=\"imageUrl\" class=\"form-control\" placeholder=\"Image URL\">\n <button type=\"button\" class=\"btn btn-outline-secondary\" (click)=\"clearImageUrl()\">Clear</button>\n </div>\n </div>\n <div class=\"form-group\" *ngIf=\"createNodeForm.get('iconType')?.value === 'select'\">\n <label for=\"nodeIcon\">Choose Icon</label>\n <ng-select\n formControlName=\"icon\"\n [items]=\"iconsBuffer\"\n [virtualScroll]=\"true\"\n [loading]=\"loading\"\n bindLabel=\"name\"\n bindValue=\"icon\"\n [editableSearchTerm]=\"true\"\n placeholder=\"Select icon\"\n appendTo=\"body\"\n [trackByFn]=\"trackByFn\"\n (scroll)=\"onScroll($event)\"\n (scrollToEnd)=\"onScrollToEnd()\"\n >\n <ng-template ng-header-tmp>\n <small class=\"form-text text-muted\"\n >Loaded {{ iconsBuffer.length }} of {{ fontAwesomeIcons.length }}</small\n >\n </ng-template>\n <ng-template ng-option-tmp let-item=\"item\">\n <i class=\"fa fa-light\">{{item.icon}}</i>\n <span class=\"ml-3\">{{ item.name }}</span>\n </ng-template>\n </ng-select>\n </div>\n <div *ngIf=\"createNodeForm.errors?.iconOrImage\" class=\"text-danger\">\n Please provide either an Image URL or choose an Icon, but not both.\n </div>\n <div class=\"form-group\">\n <label for=\"label\">Labels</label>\n <div formArrayName=\"label\">\n <div *ngFor=\"let label of nodeLabelArray.controls; let i = index\" [formGroupName]=\"i\"\n class=\"d-flex flex-column align-items-start\">\n <div class=\"d-flex align-items-center w-100\">\n <input formControlName=\"label\" class=\"form-control mb-2\" placeholder=\"Label\" [id]=\"'node-label-' + i\">\n <button type=\"button\" class=\"btn btn-danger ml-2\" (click)=\"removeNodeLabel(i)\" [disabled]=\"nodeLabelArray.length <= 1\">Remove</button>\n </div>\n </div>\n </div>\n <button type=\"button\" class=\"btn btn-secondary mt-2\" (click)=\"addNodeLabel()\">Add Label</button>\n </div>\n <div class=\"form-group\">\n <label for=\"nodeAdditionalIcon\">Additional icon</label>\n <ng-select\n formControlName=\"additionalIcon\"\n [items]=\"iconsBuffer\"\n [virtualScroll]=\"true\"\n [loading]=\"loading\"\n bindLabel=\"name\"\n bindValue=\"icon\"\n [editableSearchTerm]=\"true\"\n placeholder=\"Select icon\"\n appendTo=\"body\"\n [trackByFn]=\"trackByFn\"\n (scroll)=\"onScroll($event)\"\n (scrollToEnd)=\"onScrollToEnd()\"\n >\n <ng-template ng-header-tmp>\n <small class=\"form-text text-muted\"\n >Loaded {{ iconsBuffer.length }} of {{ fontAwesomeIcons.length }}</small\n >\n </ng-template>\n <ng-template ng-option-tmp let-item=\"item\">\n <i class=\"fa fa-light\">{{item.icon}}</i>\n <span class=\"ml-3\">{{ item.name }}</span>\n </ng-template>\n </ng-select>\n </div>\n </form>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"closeModal('modalRef')\">Cancel</button>\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"createEditNode('createNodeModal')\" [disabled]=\"!createNodeForm.valid\">Create Node</button>\n </div>\n</ng-template>\n<!-- ./MODAL-->\n\n<!--EDIT LINKS MODAL-->\n<ng-template #editLinksModal>\n <div class=\"modal-header\">\n <h4 class=\"modal-title pull-left\">Edit Links</h4>\n <button type=\"button\" class=\"btn-close close pull-right\" aria-label=\"Close\" (click)=\"closeModal('modalRef')\">\n <span aria-hidden=\"true\" class=\"visually-hidden\">×</span>\n </button>\n </div>\n <div class=\"modal-body\">\n <form [formGroup]=\"createLinkForm\">\n <div class=\"col-sm-12 d-flex flex-column\">\n <div class=\"d-flex mb-3\">\n <div class=\"iconImage\">\n <span><i class=\"fas fa-arrow-left\"></i></span>\n <span class=\"arrow\">\n <input type=\"checkbox\" id=\"sourceArrow\" formControlName=\"sourceArrow\" class=\"form-check-input\">\n <label class=\"d-none form-check-label\" for=\"leftArrow\"></label>\n </span>\n </div>\n <div class=\"iconImage ml-3\">\n <ng-container *ngIf=\"targetImageUrl; else targetIconTemplate\">\n <img class=\"imageUrl\" [src]=\"targetImageUrl\" />\n </ng-container>\n <ng-template #targetIconTemplate>\n <i class=\"fa-solid fa-2x\">{{targetIcon}}</i>\n </ng-template>\n </div>\n <div\n [ngClass]=\"{\n 'link-line-solid': createLinkForm.get('lineStyle')?.value === 'Solid',\n 'link-line-dotted': createLinkForm.get('lineStyle')?.value === 'Dotted'\n }\"\n >\n </div>\n <div class=\"iconImage mr-3\">\n <ng-container *ngIf=\"sourceImageUrl; else sourceIconTemplate\">\n <img class=\"imageUrl\" [src]=\"sourceImageUrl\" />\n </ng-container>\n <ng-template #sourceIconTemplate>\n <i class=\"fa-solid fa-2x\">{{sourceIcon}}</i>\n </ng-template>\n </div>\n <div class=\"iconImage\">\n <span><i class=\"fas fa-arrow-right\"></i></span>\n <span class=\"arrow\">\n <input type=\"checkbox\" id=\"targetArrow\" formControlName=\"targetArrow\" class=\"form-check-input\">\n <label class=\"form-check-label\" for=\"rightArrow\"></label>\n </span>\n </div>\n </div>\n <div class=\"d-flex justify-content-between mb-3\">\n <div class=\"text-left d-block font-weight-bold\" style=\"font-size: 12px\">\n <span class=\"d-block\" *ngFor=\"let label of targetLabels\">{{ label }}</span>\n </div>\n <div class=\"text-right d-block font-weight-bold\" style=\"font-size: 12px\">\n <span class=\"d-block\" *ngFor=\"let label of sourceLabels\">{{ label }}</span>\n </div>\n </div>\n <div *ngIf=\"createLinkForm.get('label')?.value?.length\" class=\"labelPosition text-center\">\n <span *ngFor=\"let label of createLinkForm.get('label')?.value\">\n <span class=\"d-block\">{{ label.label }} <span style=\"color: #856404;\" *ngIf=\"label.linkIcon\"><i class=\"fas fa-link\"></i></span></span>\n </span>\n </div>\n </div>\n <div class=\"form-group\">\n <label for=\"lineStyle\">Line Style</label>\n <select id=\"lineStyle\" formControlName=\"lineStyle\" class=\"form-control\">\n <option value=\"Solid\">Solid</option>\n <option value=\"Dotted\">Dotted</option>\n </select>\n </div>\n\n <div class=\"form-group\">\n <label for=\"label\">Labels</label>\n <div formArrayName=\"label\">\n <div *ngFor=\"let label of labelArray.controls; let i = index\" [formGroupName]=\"i\"\n class=\"d-flex flex-column align-items-start\">\n <div class=\"d-flex align-items-center w-100\">\n <input formControlName=\"label\" class=\"form-control\" placeholder=\"Label\" [id]=\"'label-' + i\">\n <button type=\"button\" class=\"btn btn-danger ml-2\" (click)=\"removeLabel(i)\" [disabled]=\"labelArray.length <= 1\">Remove</button>\n </div>\n <div class=\"form-group form-check\">\n <input type=\"checkbox\" formControlName=\"linkIcon\" class=\"form-check-input\" [id]=\"'linkIcon-' + i\">\n <label [for]=\"'linkIcon-' + i\">Link Icon?</label>\n </div>\n </div>\n </div>\n <button type=\"button\" class=\"btn btn-secondary mt-2\" (click)=\"addLabel()\">Add Label</button>\n </div>\n </form>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"closeModal('modalRef')\">Cancel</button>\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"createEditLink('editLinkModal')\" [disabled]=\"!createLinkForm.valid\">Save Changes</button>\n <button type=\"button\" class=\"btn btn-danger\" (click)=\"deleteLink()\">Delete Link</button>\n </div>\n</ng-template>\n<!-- ./MODAL-->\n\n\n<!--CREATE LINK MODAL-->\n<ng-template #createLinkModal>\n <div class=\"modal-header\">\n <h4 class=\"modal-title pull-left\">Create Link</h4>\n <button type=\"button\" class=\"btn-close close pull-right\" aria-label=\"Close\" (click)=\"closeModal('modalRef')\">\n <span aria-hidden=\"true\" class=\"visually-hidden\">×</span>\n </button>\n </div>\n <div class=\"modal-body\">\n <form [formGroup]=\"createLinkForm\">\n <div class=\"col-sm-12 d-flex flex-column\">\n <div class=\"d-flex mb-3\">\n <div class=\"iconImage\">\n <span><i class=\"fas fa-arrow-left\"></i></span>\n <span class=\"arrow\">\n <input type=\"checkbox\" id=\"sourceArrow\" formControlName=\"sourceArrow\" class=\"form-check-input\">\n <label class=\"d-none form-check-label\" for=\"leftArrow\"></label>\n </span>\n </div>\n <div class=\"iconImage ml-3\">\n <ng-container *ngIf=\"targetImageUrl; else targetIconTemplate\">\n <img class=\"imageUrl\" [src]=\"targetImageUrl\" />\n </ng-container>\n <ng-template #targetIconTemplate>\n <i class=\"fa-solid fa-2x\">{{targetIcon}}</i>\n </ng-template>\n </div>\n <div\n [ngClass]=\"{\n 'link-line-solid': createLinkForm.get('lineStyle')?.value === 'Solid',\n 'link-line-dotted': createLinkForm.get('lineStyle')?.value === 'Dotted'\n }\"\n >\n </div>\n <div class=\"iconImage mr-3\">\n <ng-container *ngIf=\"sourceImageUrl; else sourceIconTemplate\">\n <img class=\"imageUrl\" [src]=\"sourceImageUrl\" />\n </ng-container>\n <ng-template #sourceIconTemplate>\n <i class=\"fa-solid fa-2x\">{{sourceIcon}}</i>\n </ng-template>\n </div>\n <div class=\"iconImage\">\n <span><i class=\"fas fa-arrow-right\"></i></span>\n <span class=\"arrow\">\n <input type=\"checkbox\" id=\"targetArrow\" formControlName=\"targetArrow\" class=\"form-check-input\">\n <label class=\"form-check-label\" for=\"rightArrow\"></label>\n </span>\n </div>\n </div>\n <div class=\"d-flex justify-content-between mb-3\">\n <div class=\"text-left d-block font-weight-bold\" style=\"font-size: 12px\">\n <span class=\"d-block\" *ngFor=\"let label of targetLabels\">{{ label }}</span>\n </div>\n <div class=\"text-right d-block font-weight-bold\" style=\"font-size: 12px\">\n <span class=\"d-block\" *ngFor=\"let label of sourceLabels\">{{ label }}</span>\n </div>\n </div>\n <div *ngIf=\"createLinkForm.get('label')?.value?.length\" class=\"labelPosition text-center\">\n <span *ngFor=\"let label of createLinkForm.get('label')?.value\">\n <span class=\"d-block\">{{ label.label }} <span style=\"color: #856404;\" *ngIf=\"label.linkIcon\"><i class=\"fas fa-link\"></i></span></span>\n </span>\n </div>\n </div>\n <div class=\"form-group\">\n <label for=\"lineStyle\">Line Style</label>\n <select id=\"lineStyle\" formControlName=\"lineStyle\" class=\"form-control\">\n <option value=\"Solid\">Solid</option>\n <option value=\"Dotted\">Dotted</option>\n </select>\n </div>\n\n <div class=\"form-group\">\n <label for=\"label\">Labels</label>\n <div formArrayName=\"label\">\n <div *ngFor=\"let label of labelArray.controls; let i = index\" [formGroupName]=\"i\"\n class=\"d-flex flex-column align-items-start\">\n <div class=\"d-flex align-items-center w-100\">\n <input formControlName=\"label\" class=\"form-control\" placeholder=\"Label\" [id]=\"'label-' + i\">\n <button type=\"button\" class=\"btn btn-danger ml-2\" (click)=\"removeLabel(i)\" [disabled]=\"labelArray.length <= 1\">Remove</button>\n </div>\n <div class=\"form-group form-check\">\n <input type=\"checkbox\" formControlName=\"linkIcon\" class=\"form-check-input\" [id]=\"'linkIcon-' + i\">\n <label [for]=\"'linkIcon-' + i\">Link Icon?</label>\n </div>\n </div>\n </div>\n <button type=\"button\" class=\"btn btn-secondary mt-2\" (click)=\"addLabel()\">Add Label</button>\n </div>\n </form>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"closeModal('modalRef')\">Cancel</button>\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"createEditLink('createLinkModal')\" [disabled]=\"!createLinkForm.valid\">Create Link</button>\n </div>\n</ng-template>\n<!-- ./MODAL-->", styles: [".imageUrl{max-width:30px}.labelPosition{position:relative;top:-55px;margin-right:30px;margin-left:30px}.link-line-solid{width:100%;position:relative;margin:15px;border-top:2px solid #777}.link-line-dotted{width:100%;position:relative;margin:15px;background-image:repeating-linear-gradient(to right,#cacaca,#cacaca 7px,transparent 7px,transparent 15px);height:2px}.iconImage{position:relative;top:4px}.arrow{position:absolute;top:20px;left:20px}\n"] }]
|
|
678
673
|
}], ctorParameters: () => [{ type: i1.BsModalService }, { type: i2$1.FormBuilder }, { type: DexieService }], propDecorators: { editNodeData: [{
|
|
679
674
|
type: Input
|
|
680
675
|
}], editLinksData: [{
|
|
@@ -703,6 +698,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
703
698
|
args: ['editLinksModal']
|
|
704
699
|
}] } });
|
|
705
700
|
|
|
701
|
+
function endpointId(endpoint) {
|
|
702
|
+
return typeof endpoint === 'string' ? endpoint : endpoint.id;
|
|
703
|
+
}
|
|
704
|
+
function linkKey(link) {
|
|
705
|
+
return `${endpointId(link.source)}_${endpointId(link.target)}_${link.labelIndex ?? ''}`;
|
|
706
|
+
}
|
|
707
|
+
function edgeKey(link) {
|
|
708
|
+
return `${endpointId(link.source)}_${endpointId(link.target)}`;
|
|
709
|
+
}
|
|
706
710
|
class VisualiserGraphService {
|
|
707
711
|
dexieService;
|
|
708
712
|
constructor(dexieService) {
|
|
@@ -713,17 +717,17 @@ class VisualiserGraphService {
|
|
|
713
717
|
gBrush = null;
|
|
714
718
|
brushMode = false;
|
|
715
719
|
brushing = false;
|
|
716
|
-
shiftKey;
|
|
720
|
+
shiftKey = false;
|
|
717
721
|
extent = null;
|
|
718
722
|
zoom = false;
|
|
719
723
|
zoomToFit = false;
|
|
720
|
-
resetSearch;
|
|
724
|
+
resetSearch = false;
|
|
721
725
|
/** RxJS subject to listen for updates of the selection */
|
|
722
726
|
selectedNodesArray = new Subject();
|
|
723
727
|
dblClickNodePayload = new Subject();
|
|
724
728
|
dblClickLinkPayload = new Subject();
|
|
725
729
|
selectedLinkArray = new Subject();
|
|
726
|
-
saveGraphData = new ReplaySubject();
|
|
730
|
+
saveGraphData = new ReplaySubject(1);
|
|
727
731
|
update(data, element, zoom, zoomToFit) {
|
|
728
732
|
const svg = d3.select(element);
|
|
729
733
|
this.zoom = zoom;
|
|
@@ -732,6 +736,14 @@ class VisualiserGraphService {
|
|
|
732
736
|
}
|
|
733
737
|
ticked(link, node, edgepaths) {
|
|
734
738
|
link.each(function (d, i, n) {
|
|
739
|
+
if (typeof d.source === 'string' ||
|
|
740
|
+
typeof d.target === 'string' ||
|
|
741
|
+
d.source.x === undefined ||
|
|
742
|
+
d.source.y === undefined ||
|
|
743
|
+
d.target.x === undefined ||
|
|
744
|
+
d.target.y === undefined) {
|
|
745
|
+
return;
|
|
746
|
+
}
|
|
735
747
|
// Total difference in x and y from source to target
|
|
736
748
|
const diffX = d.target.x - d.source.x;
|
|
737
749
|
const diffY = d.target.y - d.source.y;
|
|
@@ -747,7 +759,7 @@ class VisualiserGraphService {
|
|
|
747
759
|
.attr('y2', d.target.y - offsetY);
|
|
748
760
|
});
|
|
749
761
|
node.attr('transform', function (d) {
|
|
750
|
-
return `translate(${d.x}, ${d.y + 50})`;
|
|
762
|
+
return `translate(${d.x ?? 0}, ${(d.y ?? 0) + 50})`;
|
|
751
763
|
});
|
|
752
764
|
// Sets a boundry for the nodes
|
|
753
765
|
// node.attr('cx', function (d) {
|
|
@@ -757,9 +769,23 @@ class VisualiserGraphService {
|
|
|
757
769
|
// return (d.y = Math.max(50, Math.min(600 - 40, d.y)));
|
|
758
770
|
// });
|
|
759
771
|
edgepaths.attr('d', function (d) {
|
|
772
|
+
if (typeof d.source === 'string' ||
|
|
773
|
+
typeof d.target === 'string' ||
|
|
774
|
+
d.source.x === undefined ||
|
|
775
|
+
d.source.y === undefined ||
|
|
776
|
+
d.target.x === undefined ||
|
|
777
|
+
d.target.y === undefined) {
|
|
778
|
+
return '';
|
|
779
|
+
}
|
|
760
780
|
return `M ${d.source.x} ${d.source.y} L ${d.target.x} ${d.target.y}`;
|
|
761
781
|
});
|
|
762
782
|
edgepaths.attr('transform', function (d) {
|
|
783
|
+
if (typeof d.source === 'string' ||
|
|
784
|
+
typeof d.target === 'string' ||
|
|
785
|
+
d.source.x === undefined ||
|
|
786
|
+
d.target.x === undefined) {
|
|
787
|
+
return null;
|
|
788
|
+
}
|
|
763
789
|
if (d.target.x < d.source.x) {
|
|
764
790
|
const bbox = this.getBBox();
|
|
765
791
|
const rx = bbox.x + bbox.width / 2;
|
|
@@ -794,29 +820,26 @@ class VisualiserGraphService {
|
|
|
794
820
|
return svg;
|
|
795
821
|
}
|
|
796
822
|
forceSimulation(_d3, { width, height }) {
|
|
797
|
-
|
|
798
|
-
.forceSimulation()
|
|
799
|
-
.velocityDecay(0.1)
|
|
800
|
-
.force('link', _d3
|
|
823
|
+
const linkForce = _d3
|
|
801
824
|
.forceLink()
|
|
802
|
-
.id(
|
|
803
|
-
return d.id;
|
|
804
|
-
})
|
|
825
|
+
.id((d) => d.id)
|
|
805
826
|
.distance(500)
|
|
806
|
-
.strength(1)
|
|
827
|
+
.strength(1);
|
|
828
|
+
const simulation = _d3
|
|
829
|
+
.forceSimulation()
|
|
830
|
+
.velocityDecay(0.1)
|
|
831
|
+
.force('link', linkForce)
|
|
807
832
|
.force('charge', _d3.forceManyBody().strength(0.1))
|
|
808
833
|
.force('center', _d3.forceCenter(width / 2, height / 2))
|
|
809
834
|
.force('collision', _d3.forceCollide().radius(15));
|
|
835
|
+
return { simulation, linkForce };
|
|
810
836
|
}
|
|
811
837
|
compareAndMarkNodesNew(nodes, old_nodes) {
|
|
812
838
|
// Create a map of ids to node objects for the old_nodes array
|
|
813
|
-
const oldMap = old_nodes.
|
|
814
|
-
map[node.id] = node;
|
|
815
|
-
return map;
|
|
816
|
-
}, {});
|
|
839
|
+
const oldMap = new Map(old_nodes.map((node) => [node.id, node]));
|
|
817
840
|
// Check each node in the nodes array to see if it's new or not
|
|
818
841
|
nodes.forEach((node) => {
|
|
819
|
-
if (!oldMap
|
|
842
|
+
if (!oldMap.has(node.id)) {
|
|
820
843
|
// Node is new, mark it with the newItem property
|
|
821
844
|
node.newItem = true;
|
|
822
845
|
// Remove the dagre coordinates from new nodes so we can set a random one in view
|
|
@@ -856,7 +879,11 @@ class VisualiserGraphService {
|
|
|
856
879
|
node.fy = crypto.getRandomValues(new Uint32Array(1))[0] % height;
|
|
857
880
|
canPlaceNode = !nodeData.some((otherNode) => {
|
|
858
881
|
if (otherNode.fx === null ||
|
|
882
|
+
otherNode.fx === undefined ||
|
|
859
883
|
otherNode.fy === null ||
|
|
884
|
+
otherNode.fy === undefined ||
|
|
885
|
+
node.fx === null ||
|
|
886
|
+
node.fy === null ||
|
|
860
887
|
otherNode === node) {
|
|
861
888
|
return false;
|
|
862
889
|
}
|
|
@@ -876,19 +903,28 @@ class VisualiserGraphService {
|
|
|
876
903
|
return nodeData;
|
|
877
904
|
}
|
|
878
905
|
async _update(_d3, svg, data) {
|
|
906
|
+
const isShiftKeyPressed = () => this.shiftKey;
|
|
879
907
|
const { nodes, links } = data;
|
|
880
908
|
this.nodes = nodes || [];
|
|
881
909
|
this.links = links || [];
|
|
882
910
|
// Disable the reset btn
|
|
883
911
|
const resetBtn = document.getElementById('reset_graph');
|
|
884
912
|
const saveBtn = document.getElementById('save_graph');
|
|
885
|
-
if (resetBtn) {
|
|
913
|
+
if (resetBtn && saveBtn) {
|
|
886
914
|
resetBtn.setAttribute('disabled', 'true');
|
|
887
915
|
saveBtn.setAttribute('disabled', 'true');
|
|
888
916
|
}
|
|
889
917
|
// Width/Height of canvas
|
|
890
|
-
const
|
|
891
|
-
|
|
918
|
+
const svgElement = svg.node();
|
|
919
|
+
if (!svgElement) {
|
|
920
|
+
throw new Error('The graph SVG element is unavailable.');
|
|
921
|
+
}
|
|
922
|
+
const parentElement = svgElement.parentElement;
|
|
923
|
+
if (!parentElement) {
|
|
924
|
+
throw new Error('The graph SVG element has no parent element.');
|
|
925
|
+
}
|
|
926
|
+
const parentWidth = parentElement.clientWidth;
|
|
927
|
+
const parentHeight = parentElement.clientHeight;
|
|
892
928
|
// Check to see if nodes are in Dexie
|
|
893
929
|
const oldData = await this.dexieService.getGraphData('nodes');
|
|
894
930
|
const oldNodes = oldData ? oldData.nodes : [];
|
|
@@ -907,7 +943,7 @@ class VisualiserGraphService {
|
|
|
907
943
|
// If nodes don't have a fx/fy coordinate we generate a random one - dagre nodes without links and new nodes added to canvas have null coordinates by design
|
|
908
944
|
this.nodes = this.randomiseNodePositions(this.nodes, parentWidth, parentHeight);
|
|
909
945
|
// Getting parents lineStyle and adding it to child objects
|
|
910
|
-
const relationshipsArray = this.links.map(({ lineStyle, targetArrow, sourceArrow, relationships }) => relationships.map((r) => ({
|
|
946
|
+
const relationshipsArray = this.links.map(({ lineStyle, targetArrow, sourceArrow, relationships }) => (relationships ?? []).map((r) => ({
|
|
911
947
|
parentLineStyle: lineStyle,
|
|
912
948
|
parentSourceArrow: sourceArrow,
|
|
913
949
|
parentTargetArrow: targetArrow,
|
|
@@ -925,7 +961,7 @@ class VisualiserGraphService {
|
|
|
925
961
|
d3.select('svg').append('g');
|
|
926
962
|
// Zoom Start
|
|
927
963
|
const zoomContainer = _d3.select('svg g');
|
|
928
|
-
let currentZoom = d3.zoomTransform(
|
|
964
|
+
let currentZoom = d3.zoomTransform(svgElement);
|
|
929
965
|
const updateZoomLevel = () => {
|
|
930
966
|
const currentScale = currentZoom.k;
|
|
931
967
|
const maxScale = zoom.scaleExtent()[1];
|
|
@@ -977,7 +1013,7 @@ class VisualiserGraphService {
|
|
|
977
1013
|
}
|
|
978
1014
|
}
|
|
979
1015
|
};
|
|
980
|
-
let zoomedInit;
|
|
1016
|
+
let zoomedInit = false;
|
|
981
1017
|
const zoomed = () => {
|
|
982
1018
|
const transform = d3.event.transform;
|
|
983
1019
|
zoomContainer.attr('transform', `translate(${transform.x}, ${transform.y}) scale(${transform.k})`);
|
|
@@ -989,17 +1025,21 @@ class VisualiserGraphService {
|
|
|
989
1025
|
.zoom()
|
|
990
1026
|
.scaleExtent([0.5, 1.5])
|
|
991
1027
|
.on('start', function () {
|
|
992
|
-
d3.select(this).style('cursor',
|
|
1028
|
+
d3.select(this).style('cursor', 'grabbing');
|
|
993
1029
|
})
|
|
994
|
-
.on('zoom', this.zoom ? zoomed : null)
|
|
995
1030
|
.on('end', function () {
|
|
996
1031
|
d3.select(this).style('cursor', 'grab');
|
|
997
1032
|
});
|
|
1033
|
+
if (this.zoom) {
|
|
1034
|
+
zoom.on('zoom', zoomed);
|
|
1035
|
+
}
|
|
998
1036
|
svg
|
|
999
1037
|
.call(zoom)
|
|
1000
1038
|
.style('cursor', 'grab')
|
|
1001
|
-
.on(this.zoom ? null : 'wheel.zoom', null)
|
|
1002
1039
|
.on('dblclick.zoom', null);
|
|
1040
|
+
if (!this.zoom) {
|
|
1041
|
+
svg.on('wheel.zoom', null);
|
|
1042
|
+
}
|
|
1003
1043
|
zoom.filter(() => !d3.event.shiftKey);
|
|
1004
1044
|
// Zoom button controls
|
|
1005
1045
|
d3.select('#zoom_in').on('click', function () {
|
|
@@ -1016,7 +1056,11 @@ class VisualiserGraphService {
|
|
|
1016
1056
|
});
|
|
1017
1057
|
// Zoom to fit function and Button
|
|
1018
1058
|
const handleZoomToFit = () => {
|
|
1019
|
-
const
|
|
1059
|
+
const zoomContainerElement = zoomContainer.node();
|
|
1060
|
+
if (!zoomContainerElement) {
|
|
1061
|
+
return;
|
|
1062
|
+
}
|
|
1063
|
+
const nodeBBox = zoomContainerElement.getBBox();
|
|
1020
1064
|
// Calculate scale and translate values to fit all nodes
|
|
1021
1065
|
const padding = 30;
|
|
1022
1066
|
const scaleX = (parentWidth - padding * 2) / nodeBBox.width;
|
|
@@ -1055,9 +1099,7 @@ class VisualiserGraphService {
|
|
|
1055
1099
|
// Update the currentZoom variable with the new transform
|
|
1056
1100
|
// zoomedInit - created because if zoomToFit is called before anything else it screws up the base transform - e.g. showCurrentMatch
|
|
1057
1101
|
if (zoomedInit) {
|
|
1058
|
-
currentZoom
|
|
1059
|
-
currentZoom.y = translateY;
|
|
1060
|
-
currentZoom.k = scale;
|
|
1102
|
+
currentZoom = d3.zoomIdentity.translate(translateX, translateY).scale(scale);
|
|
1061
1103
|
}
|
|
1062
1104
|
updateZoomLevel();
|
|
1063
1105
|
};
|
|
@@ -1182,8 +1224,18 @@ class VisualiserGraphService {
|
|
|
1182
1224
|
const searchBtn = document.getElementById('searchButton');
|
|
1183
1225
|
// Check to see if exists - control bool
|
|
1184
1226
|
if (searchBtn) {
|
|
1185
|
-
const
|
|
1186
|
-
const
|
|
1227
|
+
const searchInputElement = document.getElementById('searchInput');
|
|
1228
|
+
const clearButtonElement = document.getElementById('clearButton');
|
|
1229
|
+
const prevButton = document.getElementById('prevButton');
|
|
1230
|
+
const nextButton = document.getElementById('nextButton');
|
|
1231
|
+
if (!(searchInputElement instanceof HTMLInputElement) ||
|
|
1232
|
+
!(clearButtonElement instanceof HTMLButtonElement) ||
|
|
1233
|
+
!(prevButton instanceof HTMLButtonElement) ||
|
|
1234
|
+
!(nextButton instanceof HTMLButtonElement)) {
|
|
1235
|
+
throw new Error('Search controls are unavailable.');
|
|
1236
|
+
}
|
|
1237
|
+
const searchInput = searchInputElement;
|
|
1238
|
+
const clearButton = clearButtonElement;
|
|
1187
1239
|
const handleSearch = (event) => {
|
|
1188
1240
|
if (event.key === 'Enter') {
|
|
1189
1241
|
event.preventDefault();
|
|
@@ -1201,7 +1253,11 @@ class VisualiserGraphService {
|
|
|
1201
1253
|
return d3.select(this).attr('id') === matchingNode.id;
|
|
1202
1254
|
});
|
|
1203
1255
|
// Add a new background circle to the entire <g> node
|
|
1204
|
-
const
|
|
1256
|
+
const nodeWrapperElement = nodeWrapper.node();
|
|
1257
|
+
if (!nodeWrapperElement) {
|
|
1258
|
+
return;
|
|
1259
|
+
}
|
|
1260
|
+
const bbox = nodeWrapperElement.getBBox();
|
|
1205
1261
|
const centerX = bbox.x + bbox.width / 2;
|
|
1206
1262
|
const centerY = bbox.y + bbox.height / 2;
|
|
1207
1263
|
const radius = Math.max(bbox.width + 30, bbox.height) / 2;
|
|
@@ -1226,21 +1282,26 @@ class VisualiserGraphService {
|
|
|
1226
1282
|
.attr('r', radius)
|
|
1227
1283
|
.attr('opacity', '0.3');
|
|
1228
1284
|
// Zoom to the matching node
|
|
1229
|
-
const zoomTransform = d3.zoomTransform(
|
|
1285
|
+
const zoomTransform = d3.zoomTransform(svgElement);
|
|
1230
1286
|
const { k } = zoomTransform;
|
|
1231
1287
|
const { fx, fy } = matchingNode;
|
|
1288
|
+
if (fx === null || fy === null) {
|
|
1289
|
+
return;
|
|
1290
|
+
}
|
|
1232
1291
|
const newZoomTransform = d3.zoomIdentity
|
|
1233
1292
|
.translate(-fx * k + parentWidth / 2, -fy * k + parentHeight / 2)
|
|
1234
1293
|
.scale(k);
|
|
1235
|
-
|
|
1294
|
+
svg
|
|
1236
1295
|
.transition()
|
|
1237
1296
|
.duration(750)
|
|
1238
1297
|
.call(zoom.transform, newZoomTransform);
|
|
1239
1298
|
// Disable/Enable navigation buttons
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
nextButton
|
|
1299
|
+
if (prevButton) {
|
|
1300
|
+
prevButton.disabled = currentMatchIndex === 0;
|
|
1301
|
+
}
|
|
1302
|
+
if (nextButton) {
|
|
1303
|
+
nextButton.disabled = currentMatchIndex === matchingNodes.length - 1;
|
|
1304
|
+
}
|
|
1244
1305
|
};
|
|
1245
1306
|
const performSearch = () => {
|
|
1246
1307
|
// Remove any previously added background circle
|
|
@@ -1273,19 +1334,21 @@ class VisualiserGraphService {
|
|
|
1273
1334
|
const showNoMatches = () => {
|
|
1274
1335
|
// Reset zoom level
|
|
1275
1336
|
const newZoomTransform = d3.zoomIdentity.translate(0, 0).scale(1);
|
|
1276
|
-
|
|
1337
|
+
svg
|
|
1277
1338
|
.transition()
|
|
1278
1339
|
.duration(750)
|
|
1279
1340
|
.call(zoom.transform, newZoomTransform);
|
|
1280
1341
|
updateZoomLevel();
|
|
1281
1342
|
// Disable navigation buttons
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
nextButton
|
|
1343
|
+
if (prevButton) {
|
|
1344
|
+
prevButton.disabled = true;
|
|
1345
|
+
}
|
|
1346
|
+
if (nextButton) {
|
|
1347
|
+
nextButton.disabled = true;
|
|
1348
|
+
}
|
|
1286
1349
|
// Show "no matches found" text with fade-in transition
|
|
1287
1350
|
const noMatchesText = document.getElementById('noMatchesText');
|
|
1288
|
-
if (searchInput.value !== '') {
|
|
1351
|
+
if (noMatchesText && searchInput.value !== '') {
|
|
1289
1352
|
noMatchesText.classList.add('show');
|
|
1290
1353
|
// Fade away after a few seconds
|
|
1291
1354
|
setTimeout(() => {
|
|
@@ -1331,19 +1394,13 @@ class VisualiserGraphService {
|
|
|
1331
1394
|
searchInput.addEventListener('input', updateClearButton);
|
|
1332
1395
|
searchBtn.addEventListener('click', performSearch);
|
|
1333
1396
|
clearButton.addEventListener('click', clearSearchInput);
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
document
|
|
1338
|
-
.getElementById('nextButton')
|
|
1339
|
-
.addEventListener('click', navigateNext);
|
|
1340
|
-
document
|
|
1341
|
-
.getElementById('prevButton')
|
|
1342
|
-
.addEventListener('click', navigatePrevious);
|
|
1397
|
+
searchInput.addEventListener('keydown', handleSearch);
|
|
1398
|
+
nextButton.addEventListener('click', navigateNext);
|
|
1399
|
+
prevButton.addEventListener('click', navigatePrevious);
|
|
1343
1400
|
}
|
|
1344
1401
|
// For arrows
|
|
1345
1402
|
this.initDefinitions(svg);
|
|
1346
|
-
const simulation = this.forceSimulation(_d3, {
|
|
1403
|
+
const { simulation, linkForce } = this.forceSimulation(_d3, {
|
|
1347
1404
|
width: +svg.attr('width'),
|
|
1348
1405
|
height: +svg.attr('height'),
|
|
1349
1406
|
});
|
|
@@ -1367,21 +1424,25 @@ class VisualiserGraphService {
|
|
|
1367
1424
|
.style('fill-opacity', 0.4);
|
|
1368
1425
|
})
|
|
1369
1426
|
.on('brush', () => {
|
|
1370
|
-
|
|
1371
|
-
|
|
1427
|
+
const selection = d3.event.selection;
|
|
1428
|
+
this.extent = selection;
|
|
1429
|
+
if (!d3.event.sourceEvent || !selection || !this.brushMode)
|
|
1372
1430
|
return;
|
|
1373
1431
|
if (!currentZoom)
|
|
1374
1432
|
return;
|
|
1375
1433
|
nodeEnter
|
|
1376
1434
|
.classed('selected', (d) => {
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1435
|
+
if (d.x === undefined || d.y === undefined) {
|
|
1436
|
+
return false;
|
|
1437
|
+
}
|
|
1438
|
+
const isInSelection = selection[0][0] <= d.x * currentZoom.k + currentZoom.x &&
|
|
1439
|
+
d.x * currentZoom.k + currentZoom.x < selection[1][0] &&
|
|
1440
|
+
selection[0][1] <= d.y * currentZoom.k + currentZoom.y &&
|
|
1441
|
+
d.y * currentZoom.k + currentZoom.y < selection[1][1];
|
|
1381
1442
|
return (d.selected = Boolean(d.previouslySelected) !== isInSelection);
|
|
1382
1443
|
})
|
|
1383
1444
|
.select('.nodeText')
|
|
1384
|
-
.classed('selected', (d) => d.selected)
|
|
1445
|
+
.classed('selected', (d) => Boolean(d.selected))
|
|
1385
1446
|
.style('fill', (d) => (d.selected ? 'blue' : '#999'))
|
|
1386
1447
|
.style('font-weight', (d) => (d.selected ? 700 : 400));
|
|
1387
1448
|
this.extent = d3.event.selection;
|
|
@@ -1399,7 +1460,7 @@ class VisualiserGraphService {
|
|
|
1399
1460
|
nodeEnter
|
|
1400
1461
|
.select('.nodeText')
|
|
1401
1462
|
.filter(function () {
|
|
1402
|
-
return !
|
|
1463
|
+
return !this.parentElement?.classList.contains('selected');
|
|
1403
1464
|
})
|
|
1404
1465
|
.style('fill', '#212529')
|
|
1405
1466
|
.style('font-weight', 400);
|
|
@@ -1453,8 +1514,9 @@ class VisualiserGraphService {
|
|
|
1453
1514
|
this.shiftKey = true;
|
|
1454
1515
|
if (!this.gBrush) {
|
|
1455
1516
|
this.brushMode = true;
|
|
1456
|
-
|
|
1457
|
-
this.gBrush
|
|
1517
|
+
const brushSelection = gBrushHolder.append('g').attr('class', 'brush');
|
|
1518
|
+
this.gBrush = brushSelection;
|
|
1519
|
+
brushSelection.call(brush);
|
|
1458
1520
|
}
|
|
1459
1521
|
}
|
|
1460
1522
|
};
|
|
@@ -1466,10 +1528,9 @@ class VisualiserGraphService {
|
|
|
1466
1528
|
return (index ===
|
|
1467
1529
|
linksArray.findIndex((obj) => obj.source === source && obj.target === target));
|
|
1468
1530
|
});
|
|
1469
|
-
const link = zoomContainer
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
zoomContainer.selectAll('line').data(link).exit().remove();
|
|
1531
|
+
const link = zoomContainer
|
|
1532
|
+
.selectAll('line')
|
|
1533
|
+
.data(filteredLine, edgeKey);
|
|
1473
1534
|
const linkEnter = link
|
|
1474
1535
|
.join('line')
|
|
1475
1536
|
.style('stroke', function (d) {
|
|
@@ -1507,61 +1568,52 @@ class VisualiserGraphService {
|
|
|
1507
1568
|
}
|
|
1508
1569
|
return null;
|
|
1509
1570
|
});
|
|
1510
|
-
link
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1571
|
+
link
|
|
1572
|
+
.selectAll('title')
|
|
1573
|
+
.data((d) => [d])
|
|
1574
|
+
.join('title')
|
|
1575
|
+
.text((d) => Array.isArray(d.label) ? d.label.join(', ') : d.label ?? '');
|
|
1576
|
+
const edgepaths = zoomContainer
|
|
1577
|
+
.selectAll('path.edgepath')
|
|
1578
|
+
.data(this.links, linkKey);
|
|
1517
1579
|
const edgepathsEnter = edgepaths
|
|
1518
1580
|
.join('svg:path')
|
|
1519
1581
|
.attr('class', 'edgepath')
|
|
1520
1582
|
.attr('fill-opacity', 0)
|
|
1521
1583
|
.attr('stroke-opacity', 0)
|
|
1522
|
-
.attr('id',
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
return d.id;
|
|
1527
|
-
});
|
|
1528
|
-
zoomContainer.selectAll('text').data(edgelabels).exit().remove();
|
|
1584
|
+
.attr('id', (d) => `edgepath_${linkKey(d)}`);
|
|
1585
|
+
const edgelabels = zoomContainer
|
|
1586
|
+
.selectAll('text.edgelabel')
|
|
1587
|
+
.data(this.links, linkKey);
|
|
1529
1588
|
const edgelabelsEnter = edgelabels
|
|
1530
1589
|
.enter()
|
|
1531
1590
|
.append('text')
|
|
1591
|
+
.attr('class', 'edgelabel');
|
|
1592
|
+
const edgelabelsMerged = edgelabelsEnter.merge(edgelabels)
|
|
1532
1593
|
.attr('class', 'edgelabel')
|
|
1533
|
-
.attr('id',
|
|
1534
|
-
const suffix = '_text';
|
|
1535
|
-
const source = d.source ? d.source : '';
|
|
1536
|
-
const target = d.target ? d.target : '';
|
|
1537
|
-
return `${source}_${target}${suffix}`;
|
|
1538
|
-
})
|
|
1594
|
+
.attr('id', (d) => `${linkKey(d)}_text`)
|
|
1539
1595
|
.style('text-anchor', 'middle')
|
|
1540
1596
|
.attr('font-size', 14)
|
|
1541
1597
|
.attr('dy', function (d) {
|
|
1542
|
-
return d.dy;
|
|
1598
|
+
return d.dy ?? 0;
|
|
1543
1599
|
});
|
|
1544
1600
|
svg.selectAll('.edgelabel').on('dblclick', () => {
|
|
1545
1601
|
const dblClick = d3.select(_d3.event.currentTarget).data();
|
|
1546
1602
|
this.dblClickLinkPayload.next(dblClick);
|
|
1547
1603
|
});
|
|
1548
|
-
|
|
1549
|
-
.
|
|
1550
|
-
.
|
|
1551
|
-
|
|
1552
|
-
|
|
1604
|
+
const textPaths = edgelabelsMerged
|
|
1605
|
+
.selectAll('textPath')
|
|
1606
|
+
.data((d) => [d])
|
|
1607
|
+
.join('textPath')
|
|
1608
|
+
.attr('xlink:href', (d) => `#edgepath_${linkKey(d)}`)
|
|
1553
1609
|
.style('cursor', 'pointer')
|
|
1554
1610
|
.attr('dominant-baseline', 'bottom')
|
|
1555
1611
|
.attr('startOffset', '50%')
|
|
1556
|
-
.text(
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
.
|
|
1561
|
-
.filter(function (d) {
|
|
1562
|
-
return d.linkIcon;
|
|
1563
|
-
})
|
|
1564
|
-
.append('tspan')
|
|
1612
|
+
.text((d) => Array.isArray(d.label) ? d.label.join(', ') : d.label ?? '');
|
|
1613
|
+
textPaths
|
|
1614
|
+
.selectAll('tspan.fa')
|
|
1615
|
+
.data((d) => d.linkIcon ? [d] : [])
|
|
1616
|
+
.join('tspan')
|
|
1565
1617
|
.style('fill', '#856404')
|
|
1566
1618
|
.style('font-weight', '700')
|
|
1567
1619
|
.attr('class', 'fa')
|
|
@@ -1604,25 +1656,23 @@ class VisualiserGraphService {
|
|
|
1604
1656
|
const localSelectedLinkArray = d3.select(_d3.event.currentTarget).data();
|
|
1605
1657
|
this.selectedLinkArray.next(localSelectedLinkArray);
|
|
1606
1658
|
});
|
|
1607
|
-
const node = zoomContainer.selectAll().data(this.nodes, function (d) {
|
|
1659
|
+
const node = zoomContainer.selectAll('g.node-wrapper').data(this.nodes, function (d) {
|
|
1608
1660
|
return d.id;
|
|
1609
1661
|
});
|
|
1610
|
-
zoomContainer.selectAll('g').data(
|
|
1662
|
+
zoomContainer.selectAll('g.node-wrapper').data(this.nodes).exit().remove();
|
|
1611
1663
|
const nodeEnter = node
|
|
1612
1664
|
.join('g')
|
|
1613
1665
|
.call(_d3
|
|
1614
1666
|
.drag()
|
|
1615
1667
|
.on('start', function dragstarted(d) {
|
|
1616
1668
|
// Enable the save & reset btn
|
|
1617
|
-
if (resetBtn) {
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
.removeAttribute('disabled');
|
|
1621
|
-
document.getElementById('save_graph').removeAttribute('disabled');
|
|
1669
|
+
if (resetBtn && saveBtn) {
|
|
1670
|
+
resetBtn.removeAttribute('disabled');
|
|
1671
|
+
saveBtn.removeAttribute('disabled');
|
|
1622
1672
|
}
|
|
1623
1673
|
if (!_d3.event.active)
|
|
1624
1674
|
simulation.alphaTarget(0.9).restart();
|
|
1625
|
-
if (!d.selected && !
|
|
1675
|
+
if (!d.selected && !isShiftKeyPressed()) {
|
|
1626
1676
|
// if this node isn't selected, then we have to unselect every other node
|
|
1627
1677
|
nodeEnter.classed('selected', function (p) {
|
|
1628
1678
|
return (p.selected = p.previouslySelected = false);
|
|
@@ -1643,29 +1693,29 @@ class VisualiserGraphService {
|
|
|
1643
1693
|
});
|
|
1644
1694
|
nodeEnter
|
|
1645
1695
|
.filter(function (d) {
|
|
1646
|
-
return d.selected;
|
|
1696
|
+
return Boolean(d.selected);
|
|
1647
1697
|
})
|
|
1648
1698
|
.each(function (d) {
|
|
1649
|
-
d.fx = d.x;
|
|
1650
|
-
d.fy = d.y;
|
|
1699
|
+
d.fx = d.x ?? null;
|
|
1700
|
+
d.fy = d.y ?? null;
|
|
1651
1701
|
});
|
|
1652
1702
|
})
|
|
1653
1703
|
.on('drag', function dragged() {
|
|
1654
1704
|
nodeEnter
|
|
1655
1705
|
.filter(function (d) {
|
|
1656
|
-
return d.selected;
|
|
1706
|
+
return Boolean(d.selected);
|
|
1657
1707
|
})
|
|
1658
1708
|
.each(function (d) {
|
|
1659
|
-
d.fx
|
|
1660
|
-
d.fy
|
|
1709
|
+
d.fx = (d.fx ?? d.x ?? 0) + _d3.event.dx;
|
|
1710
|
+
d.fy = (d.fy ?? d.y ?? 0) + _d3.event.dy;
|
|
1661
1711
|
});
|
|
1662
1712
|
})
|
|
1663
1713
|
.on('end', (d) => {
|
|
1664
1714
|
if (!_d3.event.active) {
|
|
1665
1715
|
simulation.alphaTarget(0.3).restart();
|
|
1666
1716
|
}
|
|
1667
|
-
d.fx = d.x;
|
|
1668
|
-
d.fy = d.y;
|
|
1717
|
+
d.fx = d.x ?? null;
|
|
1718
|
+
d.fy = d.y ?? null;
|
|
1669
1719
|
// Subscribes to updated graph positions for save
|
|
1670
1720
|
this.saveGraphData.next(data);
|
|
1671
1721
|
}))
|
|
@@ -1769,14 +1819,22 @@ class VisualiserGraphService {
|
|
|
1769
1819
|
});
|
|
1770
1820
|
// Right click on a node highlights for context menu
|
|
1771
1821
|
svg.selectAll('.node-wrapper').on('contextmenu', () => {
|
|
1772
|
-
|
|
1773
|
-
const
|
|
1774
|
-
.selectAll('.selected')
|
|
1775
|
-
.
|
|
1776
|
-
|
|
1777
|
-
if (
|
|
1778
|
-
|
|
1779
|
-
|
|
1822
|
+
const target = _d3.event.currentTarget;
|
|
1823
|
+
const selectedNodes = svg
|
|
1824
|
+
.selectAll('.node-wrapper.selected')
|
|
1825
|
+
.data();
|
|
1826
|
+
const targetIsSelected = selectedNodes.some((selectedNode) => selectedNode.id === target.id);
|
|
1827
|
+
if (selectedNodes.length === 2 && targetIsSelected) {
|
|
1828
|
+
this.selectedNodesArray.next(selectedNodes);
|
|
1829
|
+
}
|
|
1830
|
+
else {
|
|
1831
|
+
// Clear any previous selection before showing the single-node context menu.
|
|
1832
|
+
svg.selectAll('.node-wrapper.selected')
|
|
1833
|
+
.classed('selected', false)
|
|
1834
|
+
.each((selectedNode) => {
|
|
1835
|
+
selectedNode.selected = false;
|
|
1836
|
+
selectedNode.previouslySelected = false;
|
|
1837
|
+
});
|
|
1780
1838
|
this.selectedNodesArray.next([]);
|
|
1781
1839
|
_d3
|
|
1782
1840
|
.selectAll('.edgelabel')
|
|
@@ -1795,7 +1853,7 @@ class VisualiserGraphService {
|
|
|
1795
1853
|
}
|
|
1796
1854
|
});
|
|
1797
1855
|
//click on canvas to remove selected nodes
|
|
1798
|
-
|
|
1856
|
+
svg.on('click', () => {
|
|
1799
1857
|
nodeEnter.each(function (d) {
|
|
1800
1858
|
d.selected = false;
|
|
1801
1859
|
d.previouslySelected = false;
|
|
@@ -1818,57 +1876,32 @@ class VisualiserGraphService {
|
|
|
1818
1876
|
}
|
|
1819
1877
|
});
|
|
1820
1878
|
nodeEnter
|
|
1821
|
-
.
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
return true;
|
|
1826
|
-
})
|
|
1827
|
-
.append('image')
|
|
1828
|
-
.attr('xlink:href', function (d) {
|
|
1829
|
-
return d.imageUrl;
|
|
1830
|
-
})
|
|
1879
|
+
.selectAll('image.node-image')
|
|
1880
|
+
.data((d) => d.imageUrl ? [d] : [])
|
|
1881
|
+
.join('image')
|
|
1882
|
+
.attr('xlink:href', (d) => d.imageUrl)
|
|
1831
1883
|
.attr('x', -15)
|
|
1832
1884
|
.attr('y', -60)
|
|
1833
|
-
.attr('class',
|
|
1834
|
-
|
|
1835
|
-
const id = d.id ? d.id : '';
|
|
1836
|
-
return `${id}_${suffix}`;
|
|
1837
|
-
})
|
|
1838
|
-
.attr('id', function (d) {
|
|
1839
|
-
const id = d.id ? d.id : '';
|
|
1840
|
-
return `${id}`;
|
|
1841
|
-
})
|
|
1885
|
+
.attr('class', 'image node-image')
|
|
1886
|
+
.attr('id', (d) => d.id)
|
|
1842
1887
|
.attr('width', 32)
|
|
1843
1888
|
.attr('height', 32)
|
|
1844
|
-
.attr('class', 'image')
|
|
1845
1889
|
.style('cursor', 'pointer');
|
|
1846
1890
|
nodeEnter
|
|
1847
|
-
.
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
return true;
|
|
1852
|
-
})
|
|
1853
|
-
.append('text')
|
|
1854
|
-
.text(function (d) {
|
|
1855
|
-
return d.icon;
|
|
1856
|
-
})
|
|
1891
|
+
.selectAll('text.node-icon')
|
|
1892
|
+
.data((d) => d.icon ? [d] : [])
|
|
1893
|
+
.join('text')
|
|
1894
|
+
.text((d) => d.icon)
|
|
1857
1895
|
.attr('x', -18)
|
|
1858
1896
|
.attr('y', -30)
|
|
1859
|
-
.attr('class',
|
|
1860
|
-
|
|
1861
|
-
const id = d.id ? d.id : '';
|
|
1862
|
-
return `${id}_${suffix} fa`;
|
|
1863
|
-
})
|
|
1864
|
-
.attr('id', function (d) {
|
|
1865
|
-
const id = d.id ? d.id : '';
|
|
1866
|
-
return `${id}`;
|
|
1867
|
-
})
|
|
1897
|
+
.attr('class', (d) => `${d.id}_icon fa node-icon`)
|
|
1898
|
+
.attr('id', (d) => d.id)
|
|
1868
1899
|
.style('font-size', '35px')
|
|
1869
1900
|
.style('cursor', 'pointer');
|
|
1870
1901
|
const nodeText = nodeEnter
|
|
1871
|
-
.
|
|
1902
|
+
.selectAll('text.nodeText')
|
|
1903
|
+
.data((d) => [d], (d) => d.id)
|
|
1904
|
+
.join('text')
|
|
1872
1905
|
.attr('id', 'nodeText')
|
|
1873
1906
|
.attr('class', 'nodeText')
|
|
1874
1907
|
.style('text-anchor', 'middle')
|
|
@@ -1881,10 +1914,9 @@ class VisualiserGraphService {
|
|
|
1881
1914
|
return `${id}_${suffix}`;
|
|
1882
1915
|
});
|
|
1883
1916
|
nodeText
|
|
1884
|
-
.selectAll('tspan.
|
|
1917
|
+
.selectAll('tspan.nodeTextTspan')
|
|
1885
1918
|
.data((d) => d.label)
|
|
1886
|
-
.
|
|
1887
|
-
.append('tspan')
|
|
1919
|
+
.join('tspan')
|
|
1888
1920
|
.attr('class', 'nodeTextTspan')
|
|
1889
1921
|
.text((d) => d)
|
|
1890
1922
|
.style('font-size', '14px')
|
|
@@ -1892,32 +1924,22 @@ class VisualiserGraphService {
|
|
|
1892
1924
|
.attr('dx', 10)
|
|
1893
1925
|
.attr('dy', 15);
|
|
1894
1926
|
nodeEnter
|
|
1895
|
-
.
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
}
|
|
1899
|
-
return true;
|
|
1900
|
-
})
|
|
1901
|
-
.append('text')
|
|
1902
|
-
.attr('id', function (d) {
|
|
1903
|
-
const suffix = 'additionalIcon';
|
|
1904
|
-
const id = d.id ? d.id : '';
|
|
1905
|
-
return `${id}_${suffix}`;
|
|
1906
|
-
})
|
|
1927
|
+
.selectAll('text.additional-icon')
|
|
1928
|
+
.data((d) => d.additionalIcon ? [d] : [])
|
|
1929
|
+
.join('text')
|
|
1930
|
+
.attr('id', (d) => `${d.id}_additionalIcon`)
|
|
1907
1931
|
.attr('width', 100)
|
|
1908
1932
|
.attr('height', 25)
|
|
1909
1933
|
.attr('x', 30)
|
|
1910
1934
|
.attr('y', -50)
|
|
1911
|
-
.attr('class', 'fa')
|
|
1935
|
+
.attr('class', 'fa additional-icon')
|
|
1912
1936
|
.style('fill', '#856404')
|
|
1913
|
-
.text(
|
|
1914
|
-
return d.additionalIcon;
|
|
1915
|
-
});
|
|
1937
|
+
.text((d) => d.additionalIcon);
|
|
1916
1938
|
// transition effects for new pulsating nodes
|
|
1917
1939
|
nodeEnter
|
|
1918
1940
|
.filter(function (d) {
|
|
1919
1941
|
if (!d.newItem) {
|
|
1920
|
-
return
|
|
1942
|
+
return false;
|
|
1921
1943
|
}
|
|
1922
1944
|
return true;
|
|
1923
1945
|
})
|
|
@@ -1951,14 +1973,11 @@ class VisualiserGraphService {
|
|
|
1951
1973
|
.duration(1000)
|
|
1952
1974
|
.attr('fill', '#212529')
|
|
1953
1975
|
.attr('font-weight', 400)
|
|
1954
|
-
.attr('fill-opacity', 1)
|
|
1955
|
-
.on('end', function () {
|
|
1956
|
-
return d3.select(this).call(_d3.transition);
|
|
1957
|
-
});
|
|
1976
|
+
.attr('fill-opacity', 1);
|
|
1958
1977
|
nodeEnter
|
|
1959
1978
|
.filter(function (d) {
|
|
1960
1979
|
if (!d.newItem) {
|
|
1961
|
-
return
|
|
1980
|
+
return false;
|
|
1962
1981
|
}
|
|
1963
1982
|
return true;
|
|
1964
1983
|
})
|
|
@@ -1986,15 +2005,14 @@ class VisualiserGraphService {
|
|
|
1986
2005
|
.transition()
|
|
1987
2006
|
.duration(1000)
|
|
1988
2007
|
.attr('width', 32)
|
|
1989
|
-
.attr('height', 32)
|
|
1990
|
-
.on('end', function () {
|
|
1991
|
-
return d3.select(this).call(d3.transition);
|
|
1992
|
-
});
|
|
2008
|
+
.attr('height', 32);
|
|
1993
2009
|
// Remove the newClass so they don't animate next time
|
|
1994
2010
|
this.nodes = this.removeNewItem(this.nodes);
|
|
1995
|
-
nodeEnter
|
|
1996
|
-
|
|
1997
|
-
|
|
2011
|
+
nodeEnter
|
|
2012
|
+
.selectAll('title')
|
|
2013
|
+
.data((d) => [d])
|
|
2014
|
+
.join('title')
|
|
2015
|
+
.text((d) => d.label.join(', '));
|
|
1998
2016
|
const maxTicks = 30;
|
|
1999
2017
|
let tickCount = 0;
|
|
2000
2018
|
let zoomToFitCalled = false;
|
|
@@ -2009,7 +2027,7 @@ class VisualiserGraphService {
|
|
|
2009
2027
|
tickCount++;
|
|
2010
2028
|
}
|
|
2011
2029
|
});
|
|
2012
|
-
|
|
2030
|
+
linkForce.links(this.links);
|
|
2013
2031
|
this.saveGraphData.next(data);
|
|
2014
2032
|
}
|
|
2015
2033
|
resetGraph(initialData, element, zoom, zoomToFit) {
|
|
@@ -2061,15 +2079,18 @@ class DagreNodesOnlyLayout {
|
|
|
2061
2079
|
acyclicer: undefined,
|
|
2062
2080
|
ranker: 'network-simplex',
|
|
2063
2081
|
};
|
|
2064
|
-
dagreGraph;
|
|
2065
|
-
dagreNodes;
|
|
2066
|
-
dagreEdges;
|
|
2082
|
+
dagreGraph = new dagre.graphlib.Graph();
|
|
2083
|
+
dagreNodes = [];
|
|
2084
|
+
dagreEdges = [];
|
|
2067
2085
|
renderLayout(graph) {
|
|
2068
2086
|
this.createDagreGraph(graph);
|
|
2069
2087
|
dagre.layout(this.dagreGraph);
|
|
2070
2088
|
for (const dagreNodeId of this.dagreGraph.nodes()) {
|
|
2071
2089
|
const dagreNode = this.dagreGraph.node(dagreNodeId);
|
|
2072
2090
|
const node = graph.nodes.find((n) => n.id === dagreNodeId);
|
|
2091
|
+
if (!node) {
|
|
2092
|
+
continue;
|
|
2093
|
+
}
|
|
2073
2094
|
if (node.fx === null && node.fy === null) {
|
|
2074
2095
|
// Check if the node has any associated edges
|
|
2075
2096
|
const hasAssociatedEdges = graph.links.some((link) => link.source === dagreNodeId || link.target === dagreNodeId);
|
|
@@ -2092,6 +2113,9 @@ class DagreNodesOnlyLayout {
|
|
|
2092
2113
|
for (const dagreNodeId of this.dagreGraph.nodes()) {
|
|
2093
2114
|
const dagreNode = this.dagreGraph.node(dagreNodeId);
|
|
2094
2115
|
const node = graph.nodes.find((n) => n.id === dagreNodeId);
|
|
2116
|
+
if (!node) {
|
|
2117
|
+
continue;
|
|
2118
|
+
}
|
|
2095
2119
|
// Check if the node has any associated edges
|
|
2096
2120
|
const hasAssociatedEdges = graph.links.some((link) => link.source === dagreNodeId || link.target === dagreNodeId);
|
|
2097
2121
|
if (hasAssociatedEdges) {
|
|
@@ -2188,16 +2212,16 @@ class VisualiserGraphComponent {
|
|
|
2188
2212
|
graphElement;
|
|
2189
2213
|
contextMenu;
|
|
2190
2214
|
saveGraphDataEvent = new EventEmitter();
|
|
2191
|
-
selectedNodesArray;
|
|
2192
|
-
selectedNodeId;
|
|
2193
|
-
selectedLinkArray;
|
|
2194
|
-
saveGraphData;
|
|
2195
|
-
width;
|
|
2215
|
+
selectedNodesArray = [];
|
|
2216
|
+
selectedNodeId = null;
|
|
2217
|
+
selectedLinkArray = [];
|
|
2218
|
+
saveGraphData = null;
|
|
2219
|
+
width = 0;
|
|
2196
2220
|
showSearch = false;
|
|
2197
|
-
savedGraphData;
|
|
2198
|
-
dataId;
|
|
2221
|
+
savedGraphData = null;
|
|
2222
|
+
dataId = '';
|
|
2199
2223
|
showConfirmation = false;
|
|
2200
|
-
buttonBarRightPosition;
|
|
2224
|
+
buttonBarRightPosition = '0';
|
|
2201
2225
|
editLinksData = null;
|
|
2202
2226
|
editNodeData = null;
|
|
2203
2227
|
readOnly = false;
|
|
@@ -2244,7 +2268,7 @@ class VisualiserGraphComponent {
|
|
|
2244
2268
|
});
|
|
2245
2269
|
// Subscribe to the double-click node payload
|
|
2246
2270
|
this.visualiserGraphService.dblClickNodePayload.subscribe((dblClickNodePayload) => {
|
|
2247
|
-
this.selectedNodeId = dblClickNodePayload[0]
|
|
2271
|
+
this.selectedNodeId = dblClickNodePayload[0]?.id ?? null;
|
|
2248
2272
|
if (!this.readOnly) {
|
|
2249
2273
|
this.handleEditNodesEvent(true);
|
|
2250
2274
|
}
|
|
@@ -2279,7 +2303,11 @@ class VisualiserGraphComponent {
|
|
|
2279
2303
|
this.updateWidth();
|
|
2280
2304
|
}
|
|
2281
2305
|
updateWidth() {
|
|
2282
|
-
|
|
2306
|
+
const page = document.getElementById('pageId');
|
|
2307
|
+
if (!page) {
|
|
2308
|
+
throw new Error('The graph page element is unavailable.');
|
|
2309
|
+
}
|
|
2310
|
+
this.width = page.offsetWidth;
|
|
2283
2311
|
}
|
|
2284
2312
|
async visualiserContextMenus(event) {
|
|
2285
2313
|
if (this.readOnly) {
|
|
@@ -2292,16 +2320,22 @@ class VisualiserGraphComponent {
|
|
|
2292
2320
|
let contextMenu;
|
|
2293
2321
|
let item;
|
|
2294
2322
|
const targetEl = event.target;
|
|
2323
|
+
if (!(targetEl instanceof Element)) {
|
|
2324
|
+
return;
|
|
2325
|
+
}
|
|
2295
2326
|
const localName = targetEl.localName;
|
|
2296
|
-
const
|
|
2297
|
-
const
|
|
2298
|
-
|
|
2299
|
-
|
|
2327
|
+
const parentElement = targetEl.parentElement;
|
|
2328
|
+
const parentNodeId = parentElement?.id ?? '';
|
|
2329
|
+
const data = parentElement?.__data__;
|
|
2330
|
+
this.selectedNodeId = targetEl.id || data?.id || null;
|
|
2331
|
+
let selectedNodesContext;
|
|
2332
|
+
if (this.selectedNodesArray.length === 2) {
|
|
2300
2333
|
contextMenu = this.contextMenu.createEditLinkContextMenu;
|
|
2301
|
-
|
|
2334
|
+
selectedNodesContext = {
|
|
2302
2335
|
graphData: this.savedGraphData,
|
|
2303
2336
|
selectedNodes: this.selectedNodesArray
|
|
2304
2337
|
};
|
|
2338
|
+
item = selectedNodesContext;
|
|
2305
2339
|
}
|
|
2306
2340
|
else {
|
|
2307
2341
|
if (localName === 'text' || localName === 'image' || parentNodeId === 'nodeText') {
|
|
@@ -2326,10 +2360,13 @@ class VisualiserGraphComponent {
|
|
|
2326
2360
|
event.preventDefault();
|
|
2327
2361
|
// Update context menu items based on data from Dexie
|
|
2328
2362
|
const updatedData = await this.dexieService.getGraphData(this.dataId);
|
|
2329
|
-
if (
|
|
2330
|
-
|
|
2363
|
+
if (selectedNodesContext) {
|
|
2364
|
+
selectedNodesContext.graphData = updatedData;
|
|
2331
2365
|
}
|
|
2332
2366
|
}
|
|
2367
|
+
dismissContextMenu(event) {
|
|
2368
|
+
this.contextMenuService.closeAllContextMenus({ eventType: 'cancel', event });
|
|
2369
|
+
}
|
|
2333
2370
|
findCreateNodesEvent(action) {
|
|
2334
2371
|
if (action === 'findNodes') {
|
|
2335
2372
|
this.toggleSearch();
|
|
@@ -2359,6 +2396,10 @@ class VisualiserGraphComponent {
|
|
|
2359
2396
|
this.visualiserGraphService.saveGraphData.subscribe((saveGraphData) => {
|
|
2360
2397
|
this.saveGraphData = saveGraphData;
|
|
2361
2398
|
});
|
|
2399
|
+
if (!this.saveGraphData) {
|
|
2400
|
+
console.error('Graph data is unavailable to save.');
|
|
2401
|
+
return;
|
|
2402
|
+
}
|
|
2362
2403
|
this.saveGraphDataEvent.emit(this.saveGraphData);
|
|
2363
2404
|
this.disableButtons(true);
|
|
2364
2405
|
this.data = this.saveGraphData;
|
|
@@ -2422,67 +2463,71 @@ class VisualiserGraphComponent {
|
|
|
2422
2463
|
return;
|
|
2423
2464
|
}
|
|
2424
2465
|
const { payload, source } = linkData;
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
labelIndex: item.labelIndex !== undefined ? item.labelIndex : nextIndex++,
|
|
2441
|
-
label: item.label,
|
|
2442
|
-
source: sourceNode.id,
|
|
2443
|
-
target: targetNode.id,
|
|
2444
|
-
linkIcon: item.linkIcon
|
|
2445
|
-
}));
|
|
2446
|
-
const newLink = {
|
|
2447
|
-
source: sourceNode.id,
|
|
2448
|
-
target: targetNode.id,
|
|
2449
|
-
lineStyle: payload.lineStyle,
|
|
2450
|
-
sourceArrow: payload.sourceArrow,
|
|
2451
|
-
targetArrow: payload.targetArrow,
|
|
2452
|
-
linkId: `${sourceNode.id}_${targetNode.id}`,
|
|
2453
|
-
relationships,
|
|
2454
|
-
};
|
|
2455
|
-
const isEditing = source === 'editLinkModal';
|
|
2456
|
-
Swal.fire({
|
|
2457
|
-
title: isEditing ? "Editing link" : "Creating link",
|
|
2458
|
-
text: "You won't be able to revert this!",
|
|
2459
|
-
icon: "warning",
|
|
2460
|
-
showCancelButton: true,
|
|
2461
|
-
confirmButtonColor: "#3085d6",
|
|
2462
|
-
cancelButtonColor: "#d33",
|
|
2463
|
-
confirmButtonText: isEditing ? "Update link" : "Create link",
|
|
2464
|
-
}).then((result) => {
|
|
2465
|
-
if (result.isConfirmed) {
|
|
2466
|
-
const existingLinkIndex = data.links.findIndex(link => link.linkId === `${sourceNode.id}_${targetNode.id}` || link.linkId === `${targetNode.id}_${sourceNode.id}`);
|
|
2467
|
-
if (existingLinkIndex !== -1) {
|
|
2468
|
-
data.links[existingLinkIndex] = newLink;
|
|
2469
|
-
}
|
|
2470
|
-
else {
|
|
2471
|
-
data.links.push(newLink);
|
|
2472
|
-
}
|
|
2473
|
-
this.data = data;
|
|
2474
|
-
this.saveGraphDataEvent.emit(data);
|
|
2475
|
-
Swal.fire({
|
|
2476
|
-
title: isEditing ? "Link updated" : "Link created",
|
|
2477
|
-
text: `Your link has been ${isEditing ? "edited" : "created"} and graph saved.`,
|
|
2478
|
-
icon: "success"
|
|
2479
|
-
});
|
|
2480
|
-
}
|
|
2481
|
-
});
|
|
2482
|
-
}
|
|
2483
|
-
else {
|
|
2484
|
-
console.error('Please select exactly two nodes to create a link.');
|
|
2466
|
+
const data = await this.dexieService.getGraphData(this.dataId);
|
|
2467
|
+
const editLinksData = this.editLinksData;
|
|
2468
|
+
let sourceNode;
|
|
2469
|
+
let targetNode;
|
|
2470
|
+
if (Array.isArray(editLinksData) && editLinksData.length === 2) {
|
|
2471
|
+
// The create-link dialog retains the exact nodes it was opened for.
|
|
2472
|
+
[sourceNode, targetNode] = [...editLinksData].sort((a, b) => Number(a.id) - Number(b.id));
|
|
2473
|
+
}
|
|
2474
|
+
else if (editLinksData && !Array.isArray(editLinksData)) {
|
|
2475
|
+
sourceNode = data.nodes.find(node => node.id === editLinksData.source);
|
|
2476
|
+
targetNode = data.nodes.find(node => node.id === editLinksData.target);
|
|
2477
|
+
}
|
|
2478
|
+
if (!sourceNode || !targetNode) {
|
|
2479
|
+
console.error('Exactly two valid nodes are required to create or edit a link.');
|
|
2480
|
+
return;
|
|
2485
2481
|
}
|
|
2482
|
+
// Find the next available labelIndex
|
|
2483
|
+
const allIndexes = data.links.reduce((acc, link) => {
|
|
2484
|
+
return acc.concat(link.relationships.map(rel => rel.labelIndex));
|
|
2485
|
+
}, []);
|
|
2486
|
+
let nextIndex = Math.max(...allIndexes, 0) + 1;
|
|
2487
|
+
// Map over the labels and linkIcon values, assuming each label has a corresponding linkIcon
|
|
2488
|
+
const relationships = payload.label.map((item) => ({
|
|
2489
|
+
labelIndex: item.labelIndex !== undefined ? item.labelIndex : nextIndex++,
|
|
2490
|
+
label: item.label,
|
|
2491
|
+
source: sourceNode.id,
|
|
2492
|
+
target: targetNode.id,
|
|
2493
|
+
linkIcon: item.linkIcon
|
|
2494
|
+
}));
|
|
2495
|
+
const newLink = {
|
|
2496
|
+
source: sourceNode.id,
|
|
2497
|
+
target: targetNode.id,
|
|
2498
|
+
lineStyle: payload.lineStyle,
|
|
2499
|
+
sourceArrow: payload.sourceArrow,
|
|
2500
|
+
targetArrow: payload.targetArrow,
|
|
2501
|
+
linkId: `${sourceNode.id}_${targetNode.id}`,
|
|
2502
|
+
relationships,
|
|
2503
|
+
};
|
|
2504
|
+
const isEditing = source === 'editLinkModal';
|
|
2505
|
+
Swal.fire({
|
|
2506
|
+
title: isEditing ? "Editing link" : "Creating link",
|
|
2507
|
+
text: "You won't be able to revert this!",
|
|
2508
|
+
icon: "warning",
|
|
2509
|
+
showCancelButton: true,
|
|
2510
|
+
confirmButtonColor: "#3085d6",
|
|
2511
|
+
cancelButtonColor: "#d33",
|
|
2512
|
+
confirmButtonText: isEditing ? "Update link" : "Create link",
|
|
2513
|
+
}).then((result) => {
|
|
2514
|
+
if (result.isConfirmed) {
|
|
2515
|
+
const existingLinkIndex = data.links.findIndex(link => link.linkId === `${sourceNode.id}_${targetNode.id}` || link.linkId === `${targetNode.id}_${sourceNode.id}`);
|
|
2516
|
+
if (existingLinkIndex !== -1) {
|
|
2517
|
+
data.links[existingLinkIndex] = newLink;
|
|
2518
|
+
}
|
|
2519
|
+
else {
|
|
2520
|
+
data.links.push(newLink);
|
|
2521
|
+
}
|
|
2522
|
+
this.data = data;
|
|
2523
|
+
this.saveGraphDataEvent.emit(data);
|
|
2524
|
+
Swal.fire({
|
|
2525
|
+
title: isEditing ? "Link updated" : "Link created",
|
|
2526
|
+
text: `Your link has been ${isEditing ? "edited" : "created"} and graph saved.`,
|
|
2527
|
+
icon: "success"
|
|
2528
|
+
});
|
|
2529
|
+
}
|
|
2530
|
+
});
|
|
2486
2531
|
}
|
|
2487
2532
|
async onDeleteNode() {
|
|
2488
2533
|
if (!this.savedGraphData) {
|
|
@@ -2549,7 +2594,20 @@ class VisualiserGraphComponent {
|
|
|
2549
2594
|
console.error('savedGraphData is not set');
|
|
2550
2595
|
return;
|
|
2551
2596
|
}
|
|
2552
|
-
const
|
|
2597
|
+
const selectedLink = this.selectedLinkArray[0];
|
|
2598
|
+
if (!selectedLink) {
|
|
2599
|
+
console.error('Selected link data is unavailable.');
|
|
2600
|
+
return;
|
|
2601
|
+
}
|
|
2602
|
+
const inputValue = Array.isArray(selectedLink.label)
|
|
2603
|
+
? selectedLink.label.join(', ')
|
|
2604
|
+
: selectedLink.label ?? '';
|
|
2605
|
+
const sourceId = typeof selectedLink.source === 'string'
|
|
2606
|
+
? selectedLink.source
|
|
2607
|
+
: selectedLink.source.id;
|
|
2608
|
+
const targetId = typeof selectedLink.target === 'string'
|
|
2609
|
+
? selectedLink.target
|
|
2610
|
+
: selectedLink.target.id;
|
|
2553
2611
|
Swal.fire({
|
|
2554
2612
|
title: "Editing a link label will save graph data, are you sure?",
|
|
2555
2613
|
input: "text",
|
|
@@ -2562,16 +2620,19 @@ class VisualiserGraphComponent {
|
|
|
2562
2620
|
confirmButtonText: "Update link label"
|
|
2563
2621
|
}).then(async (result) => {
|
|
2564
2622
|
if (result.isConfirmed) {
|
|
2565
|
-
|
|
2566
|
-
|
|
2623
|
+
if (typeof result.value !== 'string') {
|
|
2624
|
+
console.error('The updated link label is invalid.');
|
|
2625
|
+
return;
|
|
2626
|
+
}
|
|
2627
|
+
selectedLink.label = result.value;
|
|
2567
2628
|
// Retrieve the saved graph data from Dexie
|
|
2568
2629
|
const data = await this.dexieService.getGraphData(this.dataId);
|
|
2569
2630
|
// Find the link in the data using source and target IDs
|
|
2570
|
-
const link = data.links.find(link => (link.source ===
|
|
2571
|
-
(link.source ===
|
|
2631
|
+
const link = data.links.find(link => (link.source === sourceId && link.target === targetId) ||
|
|
2632
|
+
(link.source === targetId && link.target === sourceId));
|
|
2572
2633
|
if (link) {
|
|
2573
2634
|
// Find the relationship with the same labelIndex
|
|
2574
|
-
const relationship = link.relationships.find(rel => rel.labelIndex ===
|
|
2635
|
+
const relationship = link.relationships.find(rel => rel.labelIndex === selectedLink.labelIndex);
|
|
2575
2636
|
if (relationship) {
|
|
2576
2637
|
// Update the label in the matched object
|
|
2577
2638
|
relationship.label = result.value;
|
|
@@ -2593,7 +2654,7 @@ class VisualiserGraphComponent {
|
|
|
2593
2654
|
handleEditLinksEvent(event) {
|
|
2594
2655
|
if (event.open) {
|
|
2595
2656
|
this.editLinksData = { ...event.data, dataId: this.dataId };
|
|
2596
|
-
this.modalsComponent.openModal(this.modalsComponent.editLinksModal);
|
|
2657
|
+
this.modalsComponent.openModal(this.modalsComponent.editLinksModal, this.editLinksData);
|
|
2597
2658
|
}
|
|
2598
2659
|
}
|
|
2599
2660
|
handleCreateLinksEvent(event) {
|
|
@@ -2601,7 +2662,7 @@ class VisualiserGraphComponent {
|
|
|
2601
2662
|
// Make sure that the source is always the smaller ID
|
|
2602
2663
|
const sortedData = event.data.sort((a, b) => Number(a.id) - Number(b.id));
|
|
2603
2664
|
this.editLinksData = Object.assign(sortedData, { dataId: this.dataId });
|
|
2604
|
-
this.modalsComponent.openModal(this.modalsComponent.createLinkModal);
|
|
2665
|
+
this.modalsComponent.openModal(this.modalsComponent.createLinkModal, this.editLinksData);
|
|
2605
2666
|
}
|
|
2606
2667
|
}
|
|
2607
2668
|
async handleEditNodesEvent(event) {
|
|
@@ -2638,6 +2699,10 @@ class VisualiserGraphComponent {
|
|
|
2638
2699
|
enableButtons() {
|
|
2639
2700
|
const saveBtn = document.getElementById('save_graph');
|
|
2640
2701
|
const resetBtn = document.getElementById('reset_graph');
|
|
2702
|
+
if (!saveBtn || !resetBtn) {
|
|
2703
|
+
console.error('Graph action buttons are unavailable.');
|
|
2704
|
+
return;
|
|
2705
|
+
}
|
|
2641
2706
|
saveBtn.removeAttribute('disabled');
|
|
2642
2707
|
resetBtn.removeAttribute('disabled');
|
|
2643
2708
|
}
|
|
@@ -2646,6 +2711,10 @@ class VisualiserGraphComponent {
|
|
|
2646
2711
|
}
|
|
2647
2712
|
registerDragElement() {
|
|
2648
2713
|
const elmnt = document.getElementById('draggable');
|
|
2714
|
+
if (!elmnt) {
|
|
2715
|
+
console.error('Draggable graph controls are unavailable.');
|
|
2716
|
+
return;
|
|
2717
|
+
}
|
|
2649
2718
|
let pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
|
|
2650
2719
|
const dragMouseDown = (e) => {
|
|
2651
2720
|
// Prevent any default behavior
|
|
@@ -2680,9 +2749,10 @@ class VisualiserGraphComponent {
|
|
|
2680
2749
|
document.onmouseup = null;
|
|
2681
2750
|
document.onmousemove = null;
|
|
2682
2751
|
};
|
|
2683
|
-
|
|
2752
|
+
const handle = document.getElementById(`${elmnt.id}Handle`);
|
|
2753
|
+
if (handle) {
|
|
2684
2754
|
/* if present, the header is where you move the DIV from:*/
|
|
2685
|
-
|
|
2755
|
+
handle.onmousedown = dragMouseDown;
|
|
2686
2756
|
}
|
|
2687
2757
|
else {
|
|
2688
2758
|
/* otherwise, move the DIV from anywhere inside the DIV:*/
|
|
@@ -2699,11 +2769,11 @@ class VisualiserGraphComponent {
|
|
|
2699
2769
|
}
|
|
2700
2770
|
}
|
|
2701
2771
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: VisualiserGraphComponent, deps: [{ token: VisualiserGraphService }, { token: i2.ContextMenuService }, { token: DagreNodesOnlyLayout }, { token: DexieService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2702
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: VisualiserGraphComponent, selector: "visualiser-graph", inputs: { readOnly: "readOnly", zoom: "zoom", controls: "controls", zoomToFit: "zoomToFit", data: "data" }, outputs: { saveGraphDataEvent: "saveGraphDataEvent" }, viewQueries: [{ propertyName: "graphElement", first: true, predicate: ["svgId"], descendants: true }, { propertyName: "contextMenu", first: true, predicate: ContextMenusComponent, descendants: true }, { propertyName: "modalsComponent", first: true, predicate: ModalsComponent, descendants: true }], ngImport: i0, template: "<div class=\"page\" id=\"pageId\" (window:resize)=\"onResize()\">\n <div id=\"draggable\" class=\"buttonBar\" [style.right]=\"buttonBarRightPosition\">\n <div *ngIf=\"controls\">\n <div class=\"d-flex justify-content-end\">\n <div class=\"btn-group\" role=\"group\" aria-label=\"Controls\">\n <button type=\"button\" id=\"draggableHandle\" class=\"btn btn-light\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Move toolbar\">\n <i class=\"bi bi-grip-vertical\"></i>\n </button>\n\n <button type=\"button\" id=\"dagre_layout\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Dagre layout\" (click)=\"applyLayout()\">\n <i class=\"bi bi-diagram-3\"></i>\n </button>\n <button type=\"button\" id=\"save_graph\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Save data\" (click)=\"onConfirmSave()\">\n <i class=\"bi bi-save\"></i>\n </button>\n <button type=\"button\" id=\"reset_graph\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Reset data\" (click)=\"resetGraph()\">\n <i class=\"bi bi-skip-backward\"></i>\n </button>\n <button type=\"button\" *ngIf=\"zoom\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Zoom in\" id=\"zoom_in\">\n <i class=\"bi bi-zoom-in\"></i>\n </button>\n <button type=\"button\" *ngIf=\"zoom\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Zoom out\" id=\"zoom_out\">\n <i class=\"bi bi-zoom-out\"></i>\n </button>\n <button type=\"button\" *ngIf=\"zoom\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Zoom reset\" id=\"zoom_reset\" disabled=\"true\">\n <i class=\"bi bi-arrow-counterclockwise\"></i>\n </button>\n <button type=\"button\" *ngIf=\"zoom\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Zoom to fit\" id=\"zoom_to_fit\">\n <i class=\"bi bi-arrows-fullscreen\"></i>\n </button>\n <button type=\"button\" *ngIf=\"zoom\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Select all\" id=\"select_all\">\n <i class=\"bi bi-grid-fill\"></i>\n </button>\n <button type=\"button\" *ngIf=\"zoom\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Invert selection\" id=\"toggle_selection\">\n <i class=\"bi bi-ui-checks-grid\"></i>\n </button>\n <button type=\"button\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Toggle search\" id=\"toggle_search\"\n [ngClass]=\"{'searchButtonActive': showSearch, 'searchButtonInactive': !showSearch}\"\n (click)=\"toggleSearch()\">\n <i class=\"bi bi-search\"></i>\n </button>\n </div>\n </div>\n <div class=\"search float-right input-group mt-3 pr-0\" [hidden]=\"!showSearch\">\n <div class=\"input-group-prepend\">\n <button type=\"button\" id=\"prevButton\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Previous\" disabled>\n <i class=\"bi bi-arrow-left-square\"></i>\n </button>\n <button type=\"button\" id=\"nextButton\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Next\" disabled>\n <i class=\"bi bi-arrow-right-square\"></i>\n </button>\n </div>\n <input type=\"text\" id=\"searchInput\" class=\"form-control\" placeholder=\"Search\" aria-label=\"Search\"\n aria-describedby=\"search\" />\n <div class=\"input-group-append\">\n <button class=\"btn btn-outline-secondary\" type=\"button\" id=\"searchButton\" data-toggle=\"tooltip\"\n data-placement=\"top\" title=\"Search\">\n <i class=\"bi bi-search\"></i>\n </button>\n </div>\n <div class=\"input-group-append\">\n <button class=\"btn btn-outline-secondary\" type=\"button\" id=\"clearButton\" data-toggle=\"tooltip\"\n data-placement=\"top\" title=\"Clear\" disabled>\n clear\n </button>\n </div>\n </div>\n </div>\n <div [hidden]=\"!showSearch\" id=\"noMatchesText\" class=\"noMatchesText float-right\">No matches found</div>\n </div>\n <!-- Zoom indicator-->\n <div *ngIf=\"zoom\" class=\"zoomIndicator\">\n <span id=\"zoom_level\"></span>\n </div>\n\n <app-context-menus\n (editNodeContextMenuEvent)=\"handleEditNodesEvent($event)\"\n (findCreateNodesContextMenuEvent)=\"findCreateNodesEvent($event)\"\n (createLinkContextMenuEvent)=\"handleCreateLinksEvent($event)\"\n (editLinkLabelContextMenuEvent)=\"onEditLinkLabel()\"\n (editLinksContextMenuEvent)=\"handleEditLinksEvent($event)\">\n </app-context-menus>\n\n <app-modals\n [editNodeData]=\"editNodeData\"\n [editLinksData]=\"editLinksData\"\n (createEditLinkEvent)=\"onCreateEditLink($event)\"\n (createEditNodeEvent)=\"onCreateEditNode($event)\"\n (deleteLinkEvent)=\"onDeleteLink($event)\"\n (deleteNodeEvent)=\"onDeleteNode()\">\n </app-modals>\n\n <svg #svgId [attr.width]=\"width\" height=\"780\" (contextmenu)=\"visualiserContextMenus($event)\"></svg>\n</div>", styles: ["@import\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css\";@import\"https://cdnjs.cloudflare.com/ajax/libs/bootstrap/4.6.2/css/bootstrap.min.css\";@import\"https://cdn.jsdelivr.net/npm/bootstrap-icons@1.3.0/font/bootstrap-icons.css\";#zoom_level{position:relative;background-color:#000c;color:#fff;padding:5px;border-radius:5px;opacity:0;transition:opacity 1s ease-in-out}.buttonBar{position:absolute;padding:10px}.zoomIndicator{position:absolute;left:0;padding:10px}.noMatchesText{opacity:0;transition:opacity .5s;color:red}.noMatchesText.show{opacity:1}@keyframes floatInFromTop{0%{opacity:0;transform:translateY(-100%)}to{opacity:1;transform:translateY(0)}}.input-group{animation-name:floatInFromTop;animation-duration:.3s;animation-fill-mode:forwards;position:relative;width:407px}.searchButtonActive{outline:none;-webkit-box-shadow:inset 0px 0px 5px #323232;-moz-box-shadow:inset 0px 0px 5px #323232;box-shadow:inset 0 0 5px #323232}.searchButtonActive:focus,.searchButtonActive:active{outline:none;-webkit-box-shadow:inset 0px 0px 5px #323232;-moz-box-shadow:inset 0px 0px 5px #323232;box-shadow:inset 0 0 5px #323232}.searchButtonInactive{opacity:1;outline:none;box-shadow:none;background-color:#6c757d!important;border-color:#6c757d!important}#draggableHandle{cursor:move}@media (max-width: 768px){.buttonBar{flex-direction:column;align-items:flex-start}.btn-group{flex-direction:column}.btn-group .btn{width:100%;margin-bottom:5px}}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ContextMenusComponent, selector: "app-context-menus", outputs: ["editNodeContextMenuEvent", "findCreateNodesContextMenuEvent", "createLinkContextMenuEvent", "editLinkLabelContextMenuEvent", "editLinksContextMenuEvent"] }, { kind: "component", type: ModalsComponent, selector: "app-modals", inputs: ["editNodeData", "editLinksData"], outputs: ["closeModalEvent", "createEditLinkEvent", "createEditNodeEvent", "deleteLinkEvent", "deleteNodeEvent"] }] });
|
|
2772
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: VisualiserGraphComponent, selector: "visualiser-graph", inputs: { readOnly: "readOnly", zoom: "zoom", controls: "controls", zoomToFit: "zoomToFit", data: "data" }, outputs: { saveGraphDataEvent: "saveGraphDataEvent" }, viewQueries: [{ propertyName: "graphElement", first: true, predicate: ["svgId"], descendants: true }, { propertyName: "contextMenu", first: true, predicate: ContextMenusComponent, descendants: true }, { propertyName: "modalsComponent", first: true, predicate: ModalsComponent, descendants: true }], ngImport: i0, template: "<div class=\"page\" id=\"pageId\" (window:resize)=\"onResize()\">\n <div id=\"draggable\" class=\"buttonBar\" [style.right]=\"buttonBarRightPosition\">\n <div *ngIf=\"controls\">\n <div class=\"d-flex justify-content-end\">\n <div class=\"btn-group\" role=\"group\" aria-label=\"Controls\">\n <button type=\"button\" id=\"draggableHandle\" class=\"btn btn-light\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Move toolbar\">\n <i class=\"bi bi-grip-vertical\"></i>\n </button>\n\n <button type=\"button\" id=\"dagre_layout\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Dagre layout\" (click)=\"applyLayout()\">\n <i class=\"bi bi-diagram-3\"></i>\n </button>\n <button type=\"button\" id=\"save_graph\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Save data\" (click)=\"onConfirmSave()\">\n <i class=\"bi bi-save\"></i>\n </button>\n <button type=\"button\" id=\"reset_graph\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Reset data\" (click)=\"resetGraph()\">\n <i class=\"bi bi-skip-backward\"></i>\n </button>\n <button type=\"button\" *ngIf=\"zoom\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Zoom in\" id=\"zoom_in\">\n <i class=\"bi bi-zoom-in\"></i>\n </button>\n <button type=\"button\" *ngIf=\"zoom\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Zoom out\" id=\"zoom_out\">\n <i class=\"bi bi-zoom-out\"></i>\n </button>\n <button type=\"button\" *ngIf=\"zoom\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Zoom reset\" id=\"zoom_reset\" disabled=\"true\">\n <i class=\"bi bi-arrow-counterclockwise\"></i>\n </button>\n <button type=\"button\" *ngIf=\"zoom\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Zoom to fit\" id=\"zoom_to_fit\">\n <i class=\"bi bi-arrows-fullscreen\"></i>\n </button>\n <button type=\"button\" *ngIf=\"zoom\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Select all\" id=\"select_all\">\n <i class=\"bi bi-grid-fill\"></i>\n </button>\n <button type=\"button\" *ngIf=\"zoom\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Invert selection\" id=\"toggle_selection\">\n <i class=\"bi bi-ui-checks-grid\"></i>\n </button>\n <button type=\"button\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Toggle search\" id=\"toggle_search\"\n [ngClass]=\"{'searchButtonActive': showSearch, 'searchButtonInactive': !showSearch}\"\n (click)=\"toggleSearch()\">\n <i class=\"bi bi-search\"></i>\n </button>\n </div>\n </div>\n <div class=\"search float-right input-group mt-3 pr-0\" [hidden]=\"!showSearch\">\n <div class=\"input-group-prepend\">\n <button type=\"button\" id=\"prevButton\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Previous\" disabled>\n <i class=\"bi bi-arrow-left-square\"></i>\n </button>\n <button type=\"button\" id=\"nextButton\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Next\" disabled>\n <i class=\"bi bi-arrow-right-square\"></i>\n </button>\n </div>\n <input type=\"text\" id=\"searchInput\" class=\"form-control\" placeholder=\"Search\" aria-label=\"Search\"\n aria-describedby=\"search\" />\n <div class=\"input-group-append\">\n <button class=\"btn btn-outline-secondary\" type=\"button\" id=\"searchButton\" data-toggle=\"tooltip\"\n data-placement=\"top\" title=\"Search\">\n <i class=\"bi bi-search\"></i>\n </button>\n </div>\n <div class=\"input-group-append\">\n <button class=\"btn btn-outline-secondary\" type=\"button\" id=\"clearButton\" data-toggle=\"tooltip\"\n data-placement=\"top\" title=\"Clear\" disabled>\n clear\n </button>\n </div>\n </div>\n </div>\n <div [hidden]=\"!showSearch\" id=\"noMatchesText\" class=\"noMatchesText float-right\">No matches found</div>\n </div>\n <!-- Zoom indicator-->\n <div *ngIf=\"zoom\" class=\"zoomIndicator\">\n <span id=\"zoom_level\"></span>\n </div>\n\n <app-context-menus\n (editNodeContextMenuEvent)=\"handleEditNodesEvent($event)\"\n (findCreateNodesContextMenuEvent)=\"findCreateNodesEvent($event)\"\n (createLinkContextMenuEvent)=\"handleCreateLinksEvent($event)\"\n (editLinkLabelContextMenuEvent)=\"onEditLinkLabel()\"\n (editLinksContextMenuEvent)=\"handleEditLinksEvent($event)\">\n </app-context-menus>\n\n <app-modals\n [editNodeData]=\"editNodeData\"\n [editLinksData]=\"editLinksData\"\n (createEditLinkEvent)=\"onCreateEditLink($event)\"\n (createEditNodeEvent)=\"onCreateEditNode($event)\"\n (deleteLinkEvent)=\"onDeleteLink($event)\"\n (deleteNodeEvent)=\"onDeleteNode()\">\n </app-modals>\n\n <svg #svgId [attr.width]=\"width\" height=\"780\" (click)=\"dismissContextMenu($event)\" (contextmenu)=\"visualiserContextMenus($event)\"></svg>\n</div>", styles: ["@import\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css\";@import\"https://cdnjs.cloudflare.com/ajax/libs/bootstrap/4.6.2/css/bootstrap.min.css\";@import\"https://cdn.jsdelivr.net/npm/bootstrap-icons@1.3.0/font/bootstrap-icons.css\";#zoom_level{position:relative;background-color:#000c;color:#fff;padding:5px;border-radius:5px;opacity:0;transition:opacity 1s ease-in-out}.buttonBar{position:absolute;padding:10px}.zoomIndicator{position:absolute;left:0;padding:10px}.noMatchesText{opacity:0;transition:opacity .5s;color:red}.noMatchesText.show{opacity:1}@keyframes floatInFromTop{0%{opacity:0;transform:translateY(-100%)}to{opacity:1;transform:translateY(0)}}.input-group{animation-name:floatInFromTop;animation-duration:.3s;animation-fill-mode:forwards;position:relative;width:407px}.searchButtonActive{outline:none;-webkit-box-shadow:inset 0px 0px 5px #323232;-moz-box-shadow:inset 0px 0px 5px #323232;box-shadow:inset 0 0 5px #323232}.searchButtonActive:focus,.searchButtonActive:active{outline:none;-webkit-box-shadow:inset 0px 0px 5px #323232;-moz-box-shadow:inset 0px 0px 5px #323232;box-shadow:inset 0 0 5px #323232}.searchButtonInactive{opacity:1;outline:none;box-shadow:none;background-color:#6c757d!important;border-color:#6c757d!important}#draggableHandle{cursor:move}@media (max-width: 768px){.buttonBar{flex-direction:column;align-items:flex-start}.btn-group{flex-direction:column}.btn-group .btn{width:100%;margin-bottom:5px}}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ContextMenusComponent, selector: "app-context-menus", outputs: ["editNodeContextMenuEvent", "findCreateNodesContextMenuEvent", "createLinkContextMenuEvent", "editLinkLabelContextMenuEvent", "editLinksContextMenuEvent"] }, { kind: "component", type: ModalsComponent, selector: "app-modals", inputs: ["editNodeData", "editLinksData"], outputs: ["closeModalEvent", "createEditLinkEvent", "createEditNodeEvent", "deleteLinkEvent", "deleteNodeEvent"] }] });
|
|
2703
2773
|
}
|
|
2704
2774
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: VisualiserGraphComponent, decorators: [{
|
|
2705
2775
|
type: Component,
|
|
2706
|
-
args: [{ selector: 'visualiser-graph', template: "<div class=\"page\" id=\"pageId\" (window:resize)=\"onResize()\">\n <div id=\"draggable\" class=\"buttonBar\" [style.right]=\"buttonBarRightPosition\">\n <div *ngIf=\"controls\">\n <div class=\"d-flex justify-content-end\">\n <div class=\"btn-group\" role=\"group\" aria-label=\"Controls\">\n <button type=\"button\" id=\"draggableHandle\" class=\"btn btn-light\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Move toolbar\">\n <i class=\"bi bi-grip-vertical\"></i>\n </button>\n\n <button type=\"button\" id=\"dagre_layout\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Dagre layout\" (click)=\"applyLayout()\">\n <i class=\"bi bi-diagram-3\"></i>\n </button>\n <button type=\"button\" id=\"save_graph\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Save data\" (click)=\"onConfirmSave()\">\n <i class=\"bi bi-save\"></i>\n </button>\n <button type=\"button\" id=\"reset_graph\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Reset data\" (click)=\"resetGraph()\">\n <i class=\"bi bi-skip-backward\"></i>\n </button>\n <button type=\"button\" *ngIf=\"zoom\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Zoom in\" id=\"zoom_in\">\n <i class=\"bi bi-zoom-in\"></i>\n </button>\n <button type=\"button\" *ngIf=\"zoom\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Zoom out\" id=\"zoom_out\">\n <i class=\"bi bi-zoom-out\"></i>\n </button>\n <button type=\"button\" *ngIf=\"zoom\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Zoom reset\" id=\"zoom_reset\" disabled=\"true\">\n <i class=\"bi bi-arrow-counterclockwise\"></i>\n </button>\n <button type=\"button\" *ngIf=\"zoom\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Zoom to fit\" id=\"zoom_to_fit\">\n <i class=\"bi bi-arrows-fullscreen\"></i>\n </button>\n <button type=\"button\" *ngIf=\"zoom\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Select all\" id=\"select_all\">\n <i class=\"bi bi-grid-fill\"></i>\n </button>\n <button type=\"button\" *ngIf=\"zoom\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Invert selection\" id=\"toggle_selection\">\n <i class=\"bi bi-ui-checks-grid\"></i>\n </button>\n <button type=\"button\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Toggle search\" id=\"toggle_search\"\n [ngClass]=\"{'searchButtonActive': showSearch, 'searchButtonInactive': !showSearch}\"\n (click)=\"toggleSearch()\">\n <i class=\"bi bi-search\"></i>\n </button>\n </div>\n </div>\n <div class=\"search float-right input-group mt-3 pr-0\" [hidden]=\"!showSearch\">\n <div class=\"input-group-prepend\">\n <button type=\"button\" id=\"prevButton\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Previous\" disabled>\n <i class=\"bi bi-arrow-left-square\"></i>\n </button>\n <button type=\"button\" id=\"nextButton\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Next\" disabled>\n <i class=\"bi bi-arrow-right-square\"></i>\n </button>\n </div>\n <input type=\"text\" id=\"searchInput\" class=\"form-control\" placeholder=\"Search\" aria-label=\"Search\"\n aria-describedby=\"search\" />\n <div class=\"input-group-append\">\n <button class=\"btn btn-outline-secondary\" type=\"button\" id=\"searchButton\" data-toggle=\"tooltip\"\n data-placement=\"top\" title=\"Search\">\n <i class=\"bi bi-search\"></i>\n </button>\n </div>\n <div class=\"input-group-append\">\n <button class=\"btn btn-outline-secondary\" type=\"button\" id=\"clearButton\" data-toggle=\"tooltip\"\n data-placement=\"top\" title=\"Clear\" disabled>\n clear\n </button>\n </div>\n </div>\n </div>\n <div [hidden]=\"!showSearch\" id=\"noMatchesText\" class=\"noMatchesText float-right\">No matches found</div>\n </div>\n <!-- Zoom indicator-->\n <div *ngIf=\"zoom\" class=\"zoomIndicator\">\n <span id=\"zoom_level\"></span>\n </div>\n\n <app-context-menus\n (editNodeContextMenuEvent)=\"handleEditNodesEvent($event)\"\n (findCreateNodesContextMenuEvent)=\"findCreateNodesEvent($event)\"\n (createLinkContextMenuEvent)=\"handleCreateLinksEvent($event)\"\n (editLinkLabelContextMenuEvent)=\"onEditLinkLabel()\"\n (editLinksContextMenuEvent)=\"handleEditLinksEvent($event)\">\n </app-context-menus>\n\n <app-modals\n [editNodeData]=\"editNodeData\"\n [editLinksData]=\"editLinksData\"\n (createEditLinkEvent)=\"onCreateEditLink($event)\"\n (createEditNodeEvent)=\"onCreateEditNode($event)\"\n (deleteLinkEvent)=\"onDeleteLink($event)\"\n (deleteNodeEvent)=\"onDeleteNode()\">\n </app-modals>\n\n <svg #svgId [attr.width]=\"width\" height=\"780\" (contextmenu)=\"visualiserContextMenus($event)\"></svg>\n</div>", styles: ["@import\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css\";@import\"https://cdnjs.cloudflare.com/ajax/libs/bootstrap/4.6.2/css/bootstrap.min.css\";@import\"https://cdn.jsdelivr.net/npm/bootstrap-icons@1.3.0/font/bootstrap-icons.css\";#zoom_level{position:relative;background-color:#000c;color:#fff;padding:5px;border-radius:5px;opacity:0;transition:opacity 1s ease-in-out}.buttonBar{position:absolute;padding:10px}.zoomIndicator{position:absolute;left:0;padding:10px}.noMatchesText{opacity:0;transition:opacity .5s;color:red}.noMatchesText.show{opacity:1}@keyframes floatInFromTop{0%{opacity:0;transform:translateY(-100%)}to{opacity:1;transform:translateY(0)}}.input-group{animation-name:floatInFromTop;animation-duration:.3s;animation-fill-mode:forwards;position:relative;width:407px}.searchButtonActive{outline:none;-webkit-box-shadow:inset 0px 0px 5px #323232;-moz-box-shadow:inset 0px 0px 5px #323232;box-shadow:inset 0 0 5px #323232}.searchButtonActive:focus,.searchButtonActive:active{outline:none;-webkit-box-shadow:inset 0px 0px 5px #323232;-moz-box-shadow:inset 0px 0px 5px #323232;box-shadow:inset 0 0 5px #323232}.searchButtonInactive{opacity:1;outline:none;box-shadow:none;background-color:#6c757d!important;border-color:#6c757d!important}#draggableHandle{cursor:move}@media (max-width: 768px){.buttonBar{flex-direction:column;align-items:flex-start}.btn-group{flex-direction:column}.btn-group .btn{width:100%;margin-bottom:5px}}\n"] }]
|
|
2776
|
+
args: [{ selector: 'visualiser-graph', template: "<div class=\"page\" id=\"pageId\" (window:resize)=\"onResize()\">\n <div id=\"draggable\" class=\"buttonBar\" [style.right]=\"buttonBarRightPosition\">\n <div *ngIf=\"controls\">\n <div class=\"d-flex justify-content-end\">\n <div class=\"btn-group\" role=\"group\" aria-label=\"Controls\">\n <button type=\"button\" id=\"draggableHandle\" class=\"btn btn-light\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Move toolbar\">\n <i class=\"bi bi-grip-vertical\"></i>\n </button>\n\n <button type=\"button\" id=\"dagre_layout\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Dagre layout\" (click)=\"applyLayout()\">\n <i class=\"bi bi-diagram-3\"></i>\n </button>\n <button type=\"button\" id=\"save_graph\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Save data\" (click)=\"onConfirmSave()\">\n <i class=\"bi bi-save\"></i>\n </button>\n <button type=\"button\" id=\"reset_graph\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Reset data\" (click)=\"resetGraph()\">\n <i class=\"bi bi-skip-backward\"></i>\n </button>\n <button type=\"button\" *ngIf=\"zoom\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Zoom in\" id=\"zoom_in\">\n <i class=\"bi bi-zoom-in\"></i>\n </button>\n <button type=\"button\" *ngIf=\"zoom\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Zoom out\" id=\"zoom_out\">\n <i class=\"bi bi-zoom-out\"></i>\n </button>\n <button type=\"button\" *ngIf=\"zoom\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Zoom reset\" id=\"zoom_reset\" disabled=\"true\">\n <i class=\"bi bi-arrow-counterclockwise\"></i>\n </button>\n <button type=\"button\" *ngIf=\"zoom\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Zoom to fit\" id=\"zoom_to_fit\">\n <i class=\"bi bi-arrows-fullscreen\"></i>\n </button>\n <button type=\"button\" *ngIf=\"zoom\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Select all\" id=\"select_all\">\n <i class=\"bi bi-grid-fill\"></i>\n </button>\n <button type=\"button\" *ngIf=\"zoom\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Invert selection\" id=\"toggle_selection\">\n <i class=\"bi bi-ui-checks-grid\"></i>\n </button>\n <button type=\"button\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Toggle search\" id=\"toggle_search\"\n [ngClass]=\"{'searchButtonActive': showSearch, 'searchButtonInactive': !showSearch}\"\n (click)=\"toggleSearch()\">\n <i class=\"bi bi-search\"></i>\n </button>\n </div>\n </div>\n <div class=\"search float-right input-group mt-3 pr-0\" [hidden]=\"!showSearch\">\n <div class=\"input-group-prepend\">\n <button type=\"button\" id=\"prevButton\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Previous\" disabled>\n <i class=\"bi bi-arrow-left-square\"></i>\n </button>\n <button type=\"button\" id=\"nextButton\" class=\"btn btn-secondary\" data-toggle=\"tooltip\" data-placement=\"top\"\n title=\"Next\" disabled>\n <i class=\"bi bi-arrow-right-square\"></i>\n </button>\n </div>\n <input type=\"text\" id=\"searchInput\" class=\"form-control\" placeholder=\"Search\" aria-label=\"Search\"\n aria-describedby=\"search\" />\n <div class=\"input-group-append\">\n <button class=\"btn btn-outline-secondary\" type=\"button\" id=\"searchButton\" data-toggle=\"tooltip\"\n data-placement=\"top\" title=\"Search\">\n <i class=\"bi bi-search\"></i>\n </button>\n </div>\n <div class=\"input-group-append\">\n <button class=\"btn btn-outline-secondary\" type=\"button\" id=\"clearButton\" data-toggle=\"tooltip\"\n data-placement=\"top\" title=\"Clear\" disabled>\n clear\n </button>\n </div>\n </div>\n </div>\n <div [hidden]=\"!showSearch\" id=\"noMatchesText\" class=\"noMatchesText float-right\">No matches found</div>\n </div>\n <!-- Zoom indicator-->\n <div *ngIf=\"zoom\" class=\"zoomIndicator\">\n <span id=\"zoom_level\"></span>\n </div>\n\n <app-context-menus\n (editNodeContextMenuEvent)=\"handleEditNodesEvent($event)\"\n (findCreateNodesContextMenuEvent)=\"findCreateNodesEvent($event)\"\n (createLinkContextMenuEvent)=\"handleCreateLinksEvent($event)\"\n (editLinkLabelContextMenuEvent)=\"onEditLinkLabel()\"\n (editLinksContextMenuEvent)=\"handleEditLinksEvent($event)\">\n </app-context-menus>\n\n <app-modals\n [editNodeData]=\"editNodeData\"\n [editLinksData]=\"editLinksData\"\n (createEditLinkEvent)=\"onCreateEditLink($event)\"\n (createEditNodeEvent)=\"onCreateEditNode($event)\"\n (deleteLinkEvent)=\"onDeleteLink($event)\"\n (deleteNodeEvent)=\"onDeleteNode()\">\n </app-modals>\n\n <svg #svgId [attr.width]=\"width\" height=\"780\" (click)=\"dismissContextMenu($event)\" (contextmenu)=\"visualiserContextMenus($event)\"></svg>\n</div>", styles: ["@import\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css\";@import\"https://cdnjs.cloudflare.com/ajax/libs/bootstrap/4.6.2/css/bootstrap.min.css\";@import\"https://cdn.jsdelivr.net/npm/bootstrap-icons@1.3.0/font/bootstrap-icons.css\";#zoom_level{position:relative;background-color:#000c;color:#fff;padding:5px;border-radius:5px;opacity:0;transition:opacity 1s ease-in-out}.buttonBar{position:absolute;padding:10px}.zoomIndicator{position:absolute;left:0;padding:10px}.noMatchesText{opacity:0;transition:opacity .5s;color:red}.noMatchesText.show{opacity:1}@keyframes floatInFromTop{0%{opacity:0;transform:translateY(-100%)}to{opacity:1;transform:translateY(0)}}.input-group{animation-name:floatInFromTop;animation-duration:.3s;animation-fill-mode:forwards;position:relative;width:407px}.searchButtonActive{outline:none;-webkit-box-shadow:inset 0px 0px 5px #323232;-moz-box-shadow:inset 0px 0px 5px #323232;box-shadow:inset 0 0 5px #323232}.searchButtonActive:focus,.searchButtonActive:active{outline:none;-webkit-box-shadow:inset 0px 0px 5px #323232;-moz-box-shadow:inset 0px 0px 5px #323232;box-shadow:inset 0 0 5px #323232}.searchButtonInactive{opacity:1;outline:none;box-shadow:none;background-color:#6c757d!important;border-color:#6c757d!important}#draggableHandle{cursor:move}@media (max-width: 768px){.buttonBar{flex-direction:column;align-items:flex-start}.btn-group{flex-direction:column}.btn-group .btn{width:100%;margin-bottom:5px}}\n"] }]
|
|
2707
2777
|
}], ctorParameters: () => [{ type: VisualiserGraphService }, { type: i2.ContextMenuService }, { type: DagreNodesOnlyLayout }, { type: DexieService }], propDecorators: { graphElement: [{
|
|
2708
2778
|
type: ViewChild,
|
|
2709
2779
|
args: ['svgId']
|