@abi-software/map-utilities 1.1.3-beta.4 → 1.1.3-beta.5
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/dist/map-utilities.js
CHANGED
|
@@ -28364,8 +28364,9 @@ Ea.warnings = function(t) {
|
|
|
28364
28364
|
};
|
|
28365
28365
|
Ea.version = ZL;
|
|
28366
28366
|
Ea.stylesheet = Ea.Stylesheet = o0;
|
|
28367
|
-
let jL = class {
|
|
28368
|
-
constructor(
|
|
28367
|
+
let jL = class extends EventTarget {
|
|
28368
|
+
constructor(r, n) {
|
|
28369
|
+
super();
|
|
28369
28370
|
Kr(this, "cyg", null);
|
|
28370
28371
|
Kr(this, "nodes", []);
|
|
28371
28372
|
Kr(this, "edges", []);
|
|
@@ -28373,16 +28374,16 @@ let jL = class {
|
|
|
28373
28374
|
Kr(this, "dendrites", []);
|
|
28374
28375
|
Kr(this, "labelCache", /* @__PURE__ */ new Map());
|
|
28375
28376
|
Kr(this, "graphCanvas", null);
|
|
28376
|
-
this.labelCache =
|
|
28377
|
-
}
|
|
28378
|
-
async addConnectivity(
|
|
28379
|
-
if (this.axons =
|
|
28380
|
-
for (const
|
|
28381
|
-
const
|
|
28382
|
-
this.nodes.push(
|
|
28383
|
-
id: `${
|
|
28384
|
-
source:
|
|
28385
|
-
target:
|
|
28377
|
+
this.labelCache = r, this.graphCanvas = n;
|
|
28378
|
+
}
|
|
28379
|
+
async addConnectivity(r) {
|
|
28380
|
+
if (this.axons = r.axons.map((n) => JSON.stringify(n)), this.dendrites = r.dendrites.map((n) => JSON.stringify(n)), r.connectivity.length)
|
|
28381
|
+
for (const n of r.connectivity) {
|
|
28382
|
+
const a = await this.graphNode(n[0]), i = await this.graphNode(n[1]);
|
|
28383
|
+
this.nodes.push(a), this.nodes.push(i), this.edges.push({
|
|
28384
|
+
id: `${a.id}_${i.id}`,
|
|
28385
|
+
source: a.id,
|
|
28386
|
+
target: i.id
|
|
28386
28387
|
});
|
|
28387
28388
|
}
|
|
28388
28389
|
else
|
|
@@ -28391,43 +28392,51 @@ let jL = class {
|
|
|
28391
28392
|
label: "NO PATHS"
|
|
28392
28393
|
});
|
|
28393
28394
|
}
|
|
28394
|
-
showConnectivity(
|
|
28395
|
-
this.cyg = new JL(this,
|
|
28395
|
+
showConnectivity(r) {
|
|
28396
|
+
this.cyg = new JL(this, r), this.cyg.on("tap-node", (n) => {
|
|
28397
|
+
const a = new CustomEvent("tap-node", {
|
|
28398
|
+
detail: n.detail
|
|
28399
|
+
});
|
|
28400
|
+
this.dispatchEvent(a);
|
|
28401
|
+
});
|
|
28396
28402
|
}
|
|
28397
28403
|
clearConnectivity() {
|
|
28398
|
-
var
|
|
28399
|
-
(
|
|
28404
|
+
var r;
|
|
28405
|
+
(r = this.cyg) != null && r.cy && (this.cyg.cy.remove(), this.cyg.cy = null);
|
|
28400
28406
|
}
|
|
28401
28407
|
reset() {
|
|
28402
|
-
var e;
|
|
28403
|
-
(e = this.cyg) != null && e.cy && this.cyg.cy.reset();
|
|
28404
|
-
}
|
|
28405
|
-
enableZoom(e) {
|
|
28406
28408
|
var r;
|
|
28407
|
-
(r = this.cyg) != null && r.cy && this.cyg.cy.
|
|
28409
|
+
(r = this.cyg) != null && r.cy && this.cyg.cy.reset();
|
|
28410
|
+
}
|
|
28411
|
+
enableZoom(r) {
|
|
28412
|
+
var n;
|
|
28413
|
+
(n = this.cyg) != null && n.cy && this.cyg.cy.userZoomingEnabled(r);
|
|
28408
28414
|
}
|
|
28409
28415
|
get elements() {
|
|
28410
28416
|
return [
|
|
28411
|
-
...this.nodes.map((
|
|
28412
|
-
...this.edges.map((
|
|
28417
|
+
...this.nodes.map((r) => ({ data: r })),
|
|
28418
|
+
...this.edges.map((r) => ({ data: r }))
|
|
28413
28419
|
];
|
|
28414
28420
|
}
|
|
28415
28421
|
get roots() {
|
|
28416
28422
|
return this.dendrites;
|
|
28417
28423
|
}
|
|
28418
|
-
async graphNode(
|
|
28419
|
-
const
|
|
28420
|
-
for (const
|
|
28421
|
-
const
|
|
28422
|
-
|
|
28424
|
+
async graphNode(r) {
|
|
28425
|
+
const n = JSON.stringify(r), a = [r[0], ...r[1]], i = [];
|
|
28426
|
+
for (const s of a) {
|
|
28427
|
+
const u = this.labelCache.has(s) ? this.labelCache.get(s) : "";
|
|
28428
|
+
i.push(u);
|
|
28423
28429
|
}
|
|
28424
|
-
|
|
28425
|
-
const
|
|
28426
|
-
id:
|
|
28427
|
-
label:
|
|
28430
|
+
a.push(...i);
|
|
28431
|
+
const o = {
|
|
28432
|
+
id: n,
|
|
28433
|
+
label: a.join(`
|
|
28428
28434
|
`)
|
|
28429
28435
|
};
|
|
28430
|
-
return this.axons.includes(
|
|
28436
|
+
return this.axons.includes(n) ? this.dendrites.includes(n) ? o["both-a-d"] = !0 : o.axon = !0 : this.dendrites.includes(n) && (o.dendrite = !0), o;
|
|
28437
|
+
}
|
|
28438
|
+
on(r, n) {
|
|
28439
|
+
this.addEventListener(r, n);
|
|
28431
28440
|
}
|
|
28432
28441
|
};
|
|
28433
28442
|
const QL = [
|
|
@@ -28471,44 +28480,54 @@ const QL = [
|
|
|
28471
28480
|
}
|
|
28472
28481
|
}
|
|
28473
28482
|
];
|
|
28474
|
-
class JL {
|
|
28475
|
-
constructor(
|
|
28483
|
+
class JL extends EventTarget {
|
|
28484
|
+
constructor(r, n) {
|
|
28485
|
+
var a;
|
|
28486
|
+
super();
|
|
28476
28487
|
Kr(this, "cy");
|
|
28477
28488
|
Kr(this, "tooltip");
|
|
28478
|
-
var n;
|
|
28479
28489
|
this.cy = Ea({
|
|
28480
|
-
container:
|
|
28481
|
-
elements:
|
|
28490
|
+
container: n,
|
|
28491
|
+
elements: r.elements,
|
|
28482
28492
|
layout: {
|
|
28483
28493
|
name: "breadthfirst",
|
|
28484
28494
|
circle: !1,
|
|
28485
|
-
roots:
|
|
28495
|
+
roots: r.roots
|
|
28486
28496
|
},
|
|
28487
28497
|
directed: !0,
|
|
28488
28498
|
style: QL,
|
|
28489
28499
|
minZoom: 0.5,
|
|
28490
28500
|
maxZoom: 10,
|
|
28491
28501
|
wheelSensitivity: 0.4
|
|
28492
|
-
}).on("mouseover", "node", this.overNode.bind(this)).on("mouseout", "node", this.exitNode.bind(this)).on("position", "node", this.moveNode.bind(this)), this.tooltip = document.createElement("div"), this.tooltip.className = "cy-graph-tooltip", this.tooltip.hidden = !0, (
|
|
28502
|
+
}).on("mouseover", "node", this.overNode.bind(this)).on("mouseout", "node", this.exitNode.bind(this)).on("position", "node", this.moveNode.bind(this)).on("tap", "node", this.tapNode.bind(this)), this.tooltip = document.createElement("div"), this.tooltip.className = "cy-graph-tooltip", this.tooltip.hidden = !0, (a = n == null ? void 0 : n.lastChild) == null || a.appendChild(this.tooltip);
|
|
28493
28503
|
}
|
|
28494
28504
|
remove() {
|
|
28495
28505
|
this.cy && this.cy.destroy();
|
|
28496
28506
|
}
|
|
28497
|
-
checkRightBoundary(
|
|
28498
|
-
var
|
|
28499
|
-
|
|
28507
|
+
checkRightBoundary(r) {
|
|
28508
|
+
var n;
|
|
28509
|
+
r + this.tooltip.offsetWidth >= ((n = this.tooltip.parentElement) == null ? void 0 : n.offsetWidth) && (this.tooltip.style.left = `${r - this.tooltip.offsetWidth}px`);
|
|
28500
28510
|
}
|
|
28501
|
-
overNode(
|
|
28502
|
-
const
|
|
28503
|
-
this.tooltip.innerText =
|
|
28511
|
+
overNode(r) {
|
|
28512
|
+
const n = r.target;
|
|
28513
|
+
this.tooltip.innerText = n.data().label, this.tooltip.style.left = `${r.renderedPosition.x}px`, this.tooltip.style.top = `${r.renderedPosition.y}px`, this.tooltip.hidden = !1, this.checkRightBoundary(r.renderedPosition.x);
|
|
28504
28514
|
}
|
|
28505
|
-
moveNode(
|
|
28506
|
-
const
|
|
28507
|
-
this.tooltip.style.left = `${
|
|
28515
|
+
moveNode(r) {
|
|
28516
|
+
const n = r.target;
|
|
28517
|
+
this.tooltip.style.left = `${n.renderedPosition().x}px`, this.tooltip.style.top = `${n.renderedPosition().y}px`, this.checkRightBoundary(n.renderedPosition().x);
|
|
28508
28518
|
}
|
|
28509
|
-
exitNode(
|
|
28519
|
+
exitNode(r) {
|
|
28510
28520
|
this.tooltip.hidden = !0;
|
|
28511
28521
|
}
|
|
28522
|
+
tapNode(r) {
|
|
28523
|
+
const a = r.target.data(), i = new CustomEvent("tap-node", {
|
|
28524
|
+
detail: a
|
|
28525
|
+
});
|
|
28526
|
+
this.dispatchEvent(i);
|
|
28527
|
+
}
|
|
28528
|
+
on(r, n) {
|
|
28529
|
+
this.addEventListener(r, n);
|
|
28530
|
+
}
|
|
28512
28531
|
}
|
|
28513
28532
|
const eF = 1.3, tF = 24 * 60 * 60 * 1e3, rF = "Reset position", fv = "Lock zoom (to scroll)", nF = "Unlock zoom", aF = "#8300bf", iF = {
|
|
28514
28533
|
name: "ConnectivityGraph",
|
|
@@ -28583,7 +28602,11 @@ const eF = 1.3, tF = 24 * 60 * 60 * 1e3, rF = "Reset position", fv = "Lock zoom
|
|
|
28583
28602
|
},
|
|
28584
28603
|
showGraph: async function(t) {
|
|
28585
28604
|
const e = this.$refs.graphCanvas;
|
|
28586
|
-
this.showSpinner(), this.connectivityGraph = new jL(this.labelCache, e), await this.connectivityGraph.addConnectivity(this.knowledgeByPath.get(t)), this.hideSpinner(), this.connectivityGraph.showConnectivity(e)
|
|
28605
|
+
this.showSpinner(), this.connectivityGraph = new jL(this.labelCache, e), await this.connectivityGraph.addConnectivity(this.knowledgeByPath.get(t)), this.hideSpinner(), this.connectivityGraph.showConnectivity(e), this.connectivityGraph.on("tap-node", (r) => {
|
|
28606
|
+
const { label: n } = r.detail, a = n.split(`
|
|
28607
|
+
`);
|
|
28608
|
+
this.$emit("tap-node", a);
|
|
28609
|
+
});
|
|
28587
28610
|
},
|
|
28588
28611
|
query: async function(t, e) {
|
|
28589
28612
|
const r = `${this.mapServer}knowledge/query/`, n = { sql: t, params: e };
|
|
@@ -28690,7 +28713,7 @@ const eF = 1.3, tF = 24 * 60 * 60 * 1e3, rF = "Reset position", fv = "Lock zoom
|
|
|
28690
28713
|
}, oF = { class: "connectivity-graph" }, sF = {
|
|
28691
28714
|
ref: "graphCanvas",
|
|
28692
28715
|
class: "graph-canvas"
|
|
28693
|
-
}, lF = { class: "control-panel" }, uF = /* @__PURE__ */ P0('<div class="node-key" data-v-
|
|
28716
|
+
}, lF = { class: "control-panel" }, uF = /* @__PURE__ */ P0('<div class="node-key" data-v-d620c023><div class="key-head" data-v-d620c023>Node type:</div><div data-v-d620c023><div data-v-d620c023><span data-v-d620c023>Node:</span><span class="key-box" style="background:#80F0F0;" data-v-d620c023></span></div><div data-v-d620c023><span data-v-d620c023>Axon:</span><span class="key-box" style="background:green;" data-v-d620c023></span></div><div data-v-d620c023><span data-v-d620c023>Dendrite:</span><span class="key-box" style="background:red;" data-v-d620c023></span></div><div data-v-d620c023><span data-v-d620c023>Both:</span><span class="key-box" style="background:gray;" data-v-d620c023></span></div></div></div>', 1), cF = { class: "tools" }, dF = { class: "visually-hidden" }, fF = { class: "visually-hidden" };
|
|
28694
28717
|
function vF(t, e, r, n, a, i) {
|
|
28695
28718
|
const o = Xb, s = Vt, u = pn, l = xo, c = g2, d = w2, v = tc;
|
|
28696
28719
|
return je(($(), Z("div", oF, [
|
|
@@ -28754,7 +28777,7 @@ function vF(t, e, r, n, a, i) {
|
|
|
28754
28777
|
[v, t.loading]
|
|
28755
28778
|
]);
|
|
28756
28779
|
}
|
|
28757
|
-
const CF = /* @__PURE__ */ rn(iF, [["render", vF], ["__scopeId", "data-v-
|
|
28780
|
+
const CF = /* @__PURE__ */ rn(iF, [["render", vF], ["__scopeId", "data-v-d620c023"]]);
|
|
28758
28781
|
export {
|
|
28759
28782
|
CF as ConnectivityGraph,
|
|
28760
28783
|
wF as CopyToClipboard,
|