/*
基于Vue2的关系图谱js
*/
(function() {
try {
var elementStyle = document.createElement('style');
elementStyle.appendChild(document.createTextNode(
".rg-icon{width:19px;height:19px;vertical-align:0px;fill:currentColor;overflow:hidden}.el-icon-remove,.el-icon-circle-plus{cursor:pointer}.rel-node-peel{clear:both;padding:8px;position:absolute;font-size:14px}.rel-node{text-align:center}.rel-node-shape-1{border-radius:5px}.c-node-text{height:100%;width:100%;display:flex;align-items:center;justify-content:center}.rel-node-shape-1 .c-node-text{padding-left:5px;padding-right:5px}.rel-node-shape-0{width:80px;height:80px;border-radius:50%}.rel-node-type-button{border-radius:25px;color:#00f;cursor:pointer}.rel-node-checked,.rel-node-selected{box-shadow:0 0 10px #fd8b37;animation-timing-function:linear;animation:ACTRGNodeInit 2s}.rel-node-vtree-2{transform-origin:0 0;transform:rotate(30deg) translate(0)}.rel-node-vtree{width:130px;height:45px;text-align:left}.c-btn-open-close{position:absolute;height:100%;width:19px;display:flex;align-items:center;justify-content:center;user-select:none;pointer-events:none}.c-btn-open-close span{width:19px;height:19px;display:inline-block;text-align:center;border-radius:15px;color:#fff;cursor:pointer;font-size:19px;line-height:16px;background-size:100% 100%;pointer-events:all}.c-expanded{background-image:url(data:image/svg+xml;%20charset=utf8,%3Csvg%20t=%221606310217820%22%20viewBox=%220%200%201024%201024%22%20version=%221.1%22%20xmlns=%22http://www.w3.org/2000/svg%22%20p-id=%223373%22%20width=%2232%22%20height=%2232%22%3E%3Cpath%20d=%22M853.333333%20480H544V170.666667c0-17.066667-14.933333-32-32-32s-32%2014.933333-32%2032v309.333333H170.666667c-17.066667%200-32%2014.933333-32%2032s14.933333%2032%2032%2032h309.333333V853.333333c0%2017.066667%2014.933333%2032%2032%2032s32-14.933333%2032-32V544H853.333333c17.066667%200%2032-14.933333%2032-32s-14.933333-32-32-32z%22%20p-id=%223374%22%20fill=%22white%22%3E%3C/path%3E%3C/svg%3E)}.c-collapsed{background-image:url(data:image/svg+xml;%20charset=utf8,%3Csvg%20t=%221606310454619%22%20class=%22icon%22%20viewBox=%220%200%201024%201024%22%20version=%221.1%22%20xmlns=%22http://www.w3.org/2000/svg%22%20p-id=%223662%22%20width=%22128%22%20height=%22128%22%3E%3Cpath%20d=%22M853.333333%20554.666667H170.666667c-23.466667%200-42.666667-19.2-42.666667-42.666667s19.2-42.666667%2042.666667-42.666667h682.666666c23.466667%200%2042.666667%2019.2%2042.666667%2042.666667s-19.2%2042.666667-42.666667%2042.666667z%22%20p-id=%223663%22%20fill=%22white%22%3E%3C/path%3E%3C/svg%3E)}.c-expand-positon-left{margin-top:-8px;margin-left:-25px}.c-expand-positon-right{height:100%;width:100%;justify-content:center}.c-expand-positon-right span{margin-top:-18px;margin-right:-18px;margin-left:100%}.c-expand-positon-bottom{height:100%;width:100%;margin-top:7px;margin-left:-8px;align-items:flex-end;justify-content:center}.c-expand-positon-top{height:18px;width:100%;margin-top:-20px;margin-left:-6px;align-items:flex-end;justify-content:center}@keyframes ACTRGNodeInit{0%{box-shadow:0 0 15px #fd8b37}15%{box-shadow:0 0 1px #2e4e8f}30%{box-shadow:0 0 15px #fd8b37}45%{box-shadow:0 0 1px #2e4e8f}60%{box-shadow:0 0 15px #fd8b37}to{box-shadow:0 0 1px #2e4e8f}}.rel-diy-node{padding:0}.c-rg-line-text[data-v-502a344c]{fill:#888;font-size:12px}.c-rg-line[data-v-502a344c]{z-index:1000;fill-rule:nonzero}.c-rg-line-tool[data-v-502a344c]{stroke-dasharray:5,5,5}.c-rg-line-flash[data-v-502a344c]{-moz-transform:rotate(-89deg) translateX(-190px);animation-timing-function:linear;animation:ACTRGLineChecked-data-v-502a344c 10s}@keyframes ACTRGLineInit-data-v-502a344c{0%{stroke-dashoffset:10px;stroke-dasharray:20,20,20}to{stroke-dashoffset:0;stroke-dasharray:0,0,0}}@keyframes ACTRGLineChecked-data-v-502a344c{0%{stroke-dashoffset:352px}to{stroke-dashoffset:0}}.c-rg-line-checked[data-v-502a344c]{stroke-width:2px;stroke-dasharray:5,5,5;stroke-dashoffset:3px;stroke-linecap:butt;stroke-linejoin:bevel;animation-timing-function:linear;animation:ACTRGLineChecked-data-v-502a344c 10s}.c-rg-line-text[data-v-5924ca84]{fill:#888;font-size:12px}.c-rg-line[data-v-5924ca84]{z-index:1000;fill-rule:nonzero}.c-rg-line-tool[data-v-5924ca84]{stroke-dasharray:5,5,5}.c-rg-line-flash[data-v-5924ca84]{-moz-transform:rotate(-89deg) translateX(-190px);animation-timing-function:linear;animation:ACTRGLineChecked-data-v-5924ca84 10s}@keyframes ACTRGLineInit-data-v-5924ca84{0%{stroke-dashoffset:10px;stroke-dasharray:20,20,20}to{stroke-dashoffset:0;stroke-dasharray:0,0,0}}@keyframes ACTRGLineChecked-data-v-5924ca84{0%{stroke-dashoffset:352px}to{stroke-dashoffset:0}}.rel-map[data-v-6e119aea]{background-color:#fff;overflow:hidden;cursor:default;user-select:none}.rel-map-background-norepeat[data-v-6e119aea]{background-repeat:no-repeat;background-position:right bottom}.rel-nodediv-for-webkit[data-v-6e119aea]{position:absolute;width:100%;top:0;left:0;z-index:1000}.rel-map-canvas[data-v-6e119aea]{position:relative;top:0;left:0;border:0px;z-index:3}svg[data-v-6e119aea]{height:100%;width:100%}.rel-linediv[data-v-6e119aea]{position:absolute;z-index:900;width:100%;top:0;left:0;--stroke:url(#lineStyle);--markerEnd:url(#arrow-default);--markerStart:url(#start-arrow-default);--markerEndChecked:url(#arrow-checked);--markerStartChecked:url(#start-arrow-checked)}.rel-linediv svg[data-v-6e119aea]{overflow:visible}.rel-map[data-v-6e119aea] img{-webkit-user-drag:none;-webkit-user-select:none}.c-setting-panel[data-v-f2fe86d4]{--height:300px;--width:200px;width:300px;height:200px;position:absolute;margin-left:10px;margin-top:5px;font-size:12px;color:#3a5bb2;padding:60px 10px 10px;overflow:hidden;box-shadow:0 0 5px #999;border-radius:5px;z-index:1000;background-color:#fff;border:#999999 solid 1px}.c-setting-panel-button[data-v-f2fe86d4]{height:35px;width:35px;font-size:8px;line-height:35px;text-align:center;border-radius:50%;position:absolute;margin-left:25px;margin-top:20px;background-color:#3a5bb2;color:#fff;cursor:pointer;z-index:1001;box-shadow:0 0 8px #999}.c-setting-panel-button[data-v-f2fe86d4]:hover{box-shadow:0 0 20px #ffa20a;border:#ffffff solid 1px;color:#ffa20a;-moz-transform:rotate(-89deg) translateX(-190px);animation-timing-function:linear;animation:flashButton-data-v-f2fe86d4 2s infinite}.c-fixedLayout[data-v-f2fe86d4]{position:fixed;top:125px}@keyframes flashButton-data-v-f2fe86d4{0%{box-shadow:0 0 8px #2e4e8f}30%{box-shadow:0 0 20px #ffa20a}to{box-shadow:0 0 8px #2e4e8f}}.c-debug-tools-row[data-v-f2fe86d4]{text-align:left}.c-mini-graph[data-v-4c48557a]{height:100px;width:100px;position:absolute;margin-left:60px;margin-top:100px;z-index:999}.c-fixedLayout[data-v-4c48557a]{position:fixed;top:100px}.c-mini-canvas[data-v-4c48557a]{background-color:#aacbff;border:#7BA8FF solid 1px;opacity:.8;position:relative}.c-mini-view[data-v-4c48557a]{background-color:#f5a565;border:#C03639 solid 1px;opacity:.5;color:#fff;font-size:14px;text-align:center;display:flex;align-items:center;justify-content:center;position:absolute}.c-mini-node[data-v-4c48557a]{position:absolute;width:2px;height:2px;background-color:#000;border-radius:1px}.rg-icon[data-v-0e337616]{width:16px;height:16px;vertical-align:-3px;fill:currentColor;overflow:hidden}.c-mini-toolbar[data-v-0e337616]{width:44px;position:absolute;margin-top:170px;margin-right:10px;z-index:999;border:#bbbbbb solid 1px;background-color:#fff;box-shadow:0 0 8px #ccc;box-sizing:border-box}.c-fixedLayout[data-v-0e337616]{position:fixed;top:100px}.c-mb-button[data-v-0e337616]{height:44px;width:42px;margin-top:0;background-color:#fff;border-top:#efefef solid 1px;opacity:1;text-align:center;padding-top:3px;cursor:pointer;color:#999;font-size:18px;float:left;box-sizing:border-box;line-height:21px}.c-mb-button .c-mb-text[data-v-0e337616]{display:inline-block;height:14px;width:42px;font-size:12px;line-height:12px;margin-top:24px;margin-left:-28px;position:absolute;color:#262626}.c-mb-button-on[data-v-0e337616]{background-color:#2e74b5;border-top:#2E4E8F solid 1px;color:#fff}.c-mb-button[data-v-0e337616]:hover{background-color:#2e4e8f;border-top:#2E4E8F solid 1px;color:#fff}.c-mb-button:hover .c-mb-text[data-v-0e337616],.c-mb-button-on .c-mb-text[data-v-0e337616]{color:#fff}.c-mb-button .c-mb-child-panel[data-v-0e337616]{height:46px;position:absolute;margin-top:-26px;background-color:#fff;display:none;border:#bbbbbb solid 1px;box-shadow:0 0 8px #ccc;box-sizing:border-box}.c-mb-button:hover .c-mb-child-panel[data-v-0e337616]{display:block}.c-mb-button .c-mb-button[data-v-0e337616]{height:44px;width:42px;margin:0;border:none}.c-mb-button-c .c-mb-text[data-v-0e337616]{color:#262626!important}.c-mb-button-c:hover .c-mb-text[data-v-0e337616],.c-mb-button-on .c-mb-text[data-v-0e337616]{color:#fff!important}.c-loading-icon[data-v-0e337616]{animation:turn-data-v-0e337616 1s linear infinite}@keyframes turn-data-v-0e337616{0%{-webkit-transform:rotate(0deg)}25%{-webkit-transform:rotate(90deg)}50%{-webkit-transform:rotate(180deg)}75%{-webkit-transform:rotate(270deg)}to{-webkit-transform:rotate(360deg)}}"
));
document.head.appendChild(elementStyle);
} catch (e) {
console.error('vite-plugin-css-injected-by-js', e);
}
})();
(function(k, S) {
typeof exports == "object" && typeof module != "undefined" ? S(exports, require("vue"), require("screenfull"),
require("html2canvas")) : typeof define == "function" && define.amd ? define(["exports", "vue",
"screenfull", "html2canvas"
], S) : (k = typeof globalThis != "undefined" ? globalThis : k || self, S(k.RelationGraph = {}, k.Vue, k
.screenfull, k.html2canvas))
})(this, function(k, S, $, Ie) {
"use strict";
var ho = Object.defineProperty,
fo = Object.defineProperties;
var uo = Object.getOwnPropertyDescriptors;
var Ee = Object.getOwnPropertySymbols;
var po = Object.prototype.hasOwnProperty,
_o = Object.prototype.propertyIsEnumerable;
var ie = (k, S, $) => S in k ? ho(k, S, {
enumerable: !0,
configurable: !0,
writable: !0,
value: $
}) : k[S] = $,
Re = (k, S) => {
for (var $ in S || (S = {})) po.call(S, $) && ie(k, $, S[$]);
if (Ee)
for (var $ of Ee(S)) _o.call(S, $) && ie(k, $, S[$]);
return k
},
Ae = (k, S) => fo(k, uo(S));
var p = (k, S, $) => (ie(k, typeof S != "symbol" ? S + "" : S, $), $);
const J = e => e && typeof e == "object" && "default" in e ? e : {
default: e
},
O = J(S),
T = J($),
se = J(Ie),
ae = "2.0.26";
(function(e) {
var o, t, n, i, s, a, l =
'',
r = (r = document.getElementsByTagName("script"))[r.length - 1].getAttribute("data-injectcss");
if (r && !e.__iconfont__svg__cssinject__) {
e.__iconfont__svg__cssinject__ = !0;
try {
document.write(
""
)
} catch (d) {
console && console.log(d)
}
}
function c() {
s || (s = !0, n())
}
o = function() {
var d, f, h, g;
(g = document.createElement("div")).innerHTML = l, l = null, (h = g.getElementsByTagName("svg")[
0]) && (h.setAttribute("aria-hidden", "true"), h.style.position = "absolute", h.style
.width = 0, h.style.height = 0, h.style.overflow = "hidden", d = h, (f = document.body)
.firstChild ? (g = d, (h = f.firstChild).parentNode.insertBefore(g, h)) : f.appendChild(
d))
}, document.addEventListener ? ~["complete", "loaded", "interactive"].indexOf(document.readyState) ?
setTimeout(o, 0) : (t = function() {
document.removeEventListener("DOMContentLoaded", t, !1), o()
}, document.addEventListener("DOMContentLoaded", t, !1)) : document.attachEvent && (n = o, i = e
.document, s = !1, (a = function() {
try {
i.documentElement.doScroll("left")
} catch (d) {
return void setTimeout(a, 50)
}
c()
})(), i.onreadystatechange = function() {
i.readyState == "complete" && (i.onreadystatechange = null, c())
})
})(window);
const Oe = () => window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document
.documentElement.clientWidth : screen.width,
Be = () => window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document
.documentElement.clientHeight : screen.height,
Fe = e => {
let o = 0;
for (const t of e) {
const n = t.charCodeAt(0);
n < 0 || n > 255 ? o += 2 : o++
}
return o
};
let D = !1;
(() => {
try {
document.createEvent("TouchEvent"), D = !0
} catch (e) {}
})();
const u = (...e) => {
typeof window != "undefined" && window.relationGraphDebug && console.log("[relation-graph:debug]", ...e)
},
re = 0,
x = {
getRectPoint(e, o, t, n, i, s, a, l) {
const r = e + i / 2,
c = o + s / 2,
d = t + a / 2,
f = n + l / 2,
h = r < d ? 1 : -1,
g = c < f ? 1 : -1;
if (f === c) return {
x: r + h * i / 2,
y: c
};
const _ = Math.abs((d - r) / (f - c)),
w = i / s;
let C = 0,
M = 0;
return _ < w ? (C = h * s / 2 * _, M = g * s / 2) : (C = h * i / 2, M = g * i / 2 / _), {
x: r + C,
y: c + M
}
},
getRectPointBasic(e, o, t, n, i, s, a, l) {
const r = e + i / 2,
c = o + s / 2,
d = t + a / 2,
f = n + l / 2;
let h = f === c ? 0 : (d - r) / (f - c);
h === 0 && (h = (d - r) / (f - c + 1));
const g = i / l;
let _ = 0,
w = 0,
C = "1";
return -1 * g < h && h < g ? (C = "2", c < f ? (_ = s / 2 * h, w = s / 2) : (_ = -1 * s / 2 * h,
w = -1 * s / 2)) : (r < d ? (_ = 1 * i / 2, w = 1 * i / 2 / h) : (_ = -1 * i / 2, w = -1 *
i / 2 / h), C = "3"), {
x: r + _,
y: c + w,
_case: C
}
},
getRectJoinPoint(e, o, t, n, i, s, a, l) {
const r = e + i / 2,
c = o + s / 2,
d = t + a / 2,
f = n + l / 2,
h = Math.round(Math.atan2(f - c, d - r) * 180 / 3.14) + 135;
return h >= 0 && h < 90 ? {
x: e + i / 2,
y: o - 5
} : h >= 90 && h < 180 ? {
x: e + i + 5,
y: o + s / 2
} : h >= 180 && h < 270 ? {
x: e + i / 2,
y: o + s + 5
} : {
x: e - 5,
y: o + s / 2
}
},
getRectHJoinPoint(e, o, t, n, i, s, a) {
const l = s / 2;
return e + i < t ? {
x: e + i + 5,
y: o + l
} : e + i < t + a ? {
x: e - 5,
y: o + l
} : {
x: e - 5,
y: o + l
}
},
getRectVJoinPoint(e, o, t, n, i, s, a, l) {
const r = i / 2;
return o + s < n ? {
y: o + s + 5,
x: e + r
} : o + s < n + l ? {
y: o - 5,
x: e + r
} : {
y: o - 5,
x: e + r
}
},
getBorderPoint(e, o, t, n, i, s, a, l, r) {
return r === 0 ? this.getCirclePoint(e, o, t, n, i, s, a, l) : this.getRectPoint(e, o, t, n, i, s,
a, l)
},
getBorderPoint4MultiLine(e, o, t, n, i, s, a, l, r, c, d, f) {
return r === 0 ? this.getCirclePoint4MultiLine(e, o, t, n, i, s, a, l, c, d, f) : this.getRectPoint(
e, o, t, n, i, s, a, l)
},
getCirclePoint(e, o, t, n, i, s, a, l) {
const r = t + a / 2,
c = n + l / 2,
d = e + i / 2,
f = o + s / 2,
h = r - d;
if (h === 0) return {
x: d,
y: f - s / 2 * (c < f ? 1 : -1)
};
const _ = (c - f) / h,
w = Math.sqrt(1 / (1 / (i / 2) ** 2 + _ ** 2 / (s / 2) ** 2)) * (r < d ? 1 : -1),
C = _ * w;
return {
x: d - w,
y: f - C
}
},
getCirclePoint4MultiLine(e, o, t, n, i, s, a, l, r, c, d) {
r && (d = c - d - 1);
const f = t + a / 2,
h = n + l / 2,
g = e + i / 2,
_ = o + s / 2,
w = f - g;
if (w === 0) return {
x: g,
y: _ - s / 2 * (h < _ ? 1 : -1)
};
const C = 40 / (c + 1) * (d + 1) - 20,
M = h - _,
z = Math.sqrt(w ** 2 + M ** 2) * C / w,
P = M / w,
y = i / 2,
E = s / 2,
m = f < g ? 1 : -1,
G = (-1 * y ** 2 * P * z + y * E * Math.sqrt(E ** 2 + P ** 2 * y ** 2 - z ** 2, 2) / m) / (E **
2 + y ** 2 * P ** 2),
j = P * G + z;
return {
x: g - G,
y: _ - j
}
},
getCirclePointBasic(e, o, t, n, i, s, a, l, r) {
const c = e + i / 2,
d = o + s / 2,
f = t + a / 2,
h = n + l / 2;
return this.h = f - c, this.s = h - d, this.c = Math.sqrt(this.h * this.h + this.s * this.s), this
.l = this.c - r, this.v = this.l * this.h / this.c * -1, this.t = this.l * this.s / this.c * -
1, {
x: f + this.v,
y: h + this.t
}
},
getCirclePointPlus(e, o, t, n, i, s, a, l) {
const r = e + i / 2,
c = o + s / 2,
d = t + a / 2,
f = n + l / 2;
return this.h = d - r, this.s = f - c, this.c = Math.sqrt(this.h * this.h + this.s * this.s), this
.v = (this.c - i / 2) * this.h / this.c * -1, this.t = (this.c - s / 2) * this.s / this.c * -
1, {
x: d + this.v,
y: f + this.t
}
},
getOvalPoint(e, o, t, n, i) {
return {
x: e + t * Math.sin((re + n * (360 / i) + 0) * Math.PI / 180),
y: o + t * Math.cos((re + n * (360 / i) + 0) * Math.PI / 180) * -1
}
},
getAngleType(e, o) {
if (e >= 0 && o >= 0) return 1;
if (e < 0 && o >= 0) return 2;
if (e < 0 && o < 0) return 3;
if (e >= 0 && o < 0) return 4
},
getTextAngle(e, o, t, n) {
let i = Math.atan(Math.abs((n - o) / (t - e))) * 180 / Math.PI;
return t > e && n > o || (t > e && n < o ? i = -i : t < e && n > o ? i = 180 - i : i = i - 180),
Math.abs(i) > 90 && (i = i + 180), Math.round(i)
},
getTreePointFromTop(e, o, t, n, i, s) {
return e ? {
x: e - 300 + Math.max(600 / ((i === 1 ? 2 : i) - 1), 80) * n,
y: o + t
} : {
x: (s.canvas_width - s.node_width) / 2,
y: (s.canvas_height - s.node_height) / 2 - 200
}
},
getTreePointFromRight(e, o, t, n, i, s) {
return e ? {
x: e - t,
y: o - 200 + Math.max(400 / ((i === 1 ? 2 : i) - 1), 80) * n
} : {
x: (s.canvas_width - s.node_width) / 2 + 300,
y: (s.canvas_height - s.node_height) / 2
}
},
getTreePointFromBottom(e, o, t, n, i, s) {
return e ? {
x: e - 300 + Math.max(600 / ((i === 1 ? 2 : i) - 1), 80) * n,
y: o - t
} : {
x: (s.canvas_width - s.node_width) / 2,
y: (s.canvas_height - s.node_height) / 2 + 200
}
},
getTreePointFromLeft(e, o, t, n, i, s) {
return e ? {
x: e + t,
y: o - 200 + Math.max(400 / ((i === 1 ? 2 : i) - 1), 80) * n
} : {
x: (s.canvas_width - s.node_width) / 2 - 300,
y: (s.canvas_height - s.node_height) / 2
}
},
analysisNodes(e, o, t, n, i) {
o.length > n.max_length && (n.max_length = o.length), t > n.max_deep && (n.max_deep = t);
const s = {
level: t,
all_size: o.length,
all_strength: 0
},
a = [];
o.forEach(r => {
r.lot || (r.lot = {}), r.lot.eached = !0, r.lot.subling = s, r.lot.level = t, e.push(r)
});
let l = 0;
o.forEach(r => {
let c = 0;
if (r.targetNodes) {
let d = 0;
r.targetNodes.forEach(f => {
f.lot || (f.lot = {
eached: !1
}), f.lot.eached || (x.isAllowShowNode(f) ? (f.lot.eached = !0, f
.lot.parent = r, f.lot.index_of_parent = d++, r.lot.childs
.push(f), a.push(f), c++) : r.lot.childs.push(f))
})
}
r.lot.strength = c > 0 ? c : 1, s.all_strength += r.lot.strength, r.lot.strength_plus =
s.all_strength, r.lot.index_of_level = l, r.lot.childs_size = c, l++
}), s.all_strength > n.max_strength && (n.max_strength = s.all_strength), a.length > 0 ? this
.analysisNodes(e, a, t + 1, n, i) : (e.forEach(r => {
r.lot.childs_size > 0 && (r.lot.strengthWithChilds = 0)
}), e.forEach(r => {
r.lot.childs_size === 0 && (r.lot.strengthWithChilds = 1, this
.conductStrengthToParents(r))
}), this.analysisDataTree([e[0]], 0))
},
analysisNodes4Didirectional(e, o, t, n, i) {
o.length > n.max_length && (n.max_length = o.length), t > n.max_deep && (n.max_deep = t);
const s = {
level: t,
all_size: o.length,
all_strength: 0
},
a = [];
o.forEach(r => {
r.lot || (r.lot = {}), r.lot.eached = !0, r.lot.subling = s, r.lot.level = t, e.push(r)
});
let l = 0;
o.forEach(r => {
let c = 0;
if (i === 0) {
let d = 0;
r.targetNodes.forEach(f => {
f.lot || (f.lot = {
eached: !1
}), f.lot.eached || (x.isAllowShowNode(f) ? (f.lot.eached = !0, f
.lot.parent = r, f.lot.index_of_parent = d++, r.lot.childs
.push(f), a.push(f), c++) : r.lot.childs.push(f))
})
} else if (i === -1) {
let d = 0;
r.targetFrom.forEach(f => {
f.lot || (f.lot = {
eached: !1
}), f.lot.eached || (x.isAllowShowNode(f) ? (f.lot.eached = !0, f
.lot.parent = r, f.lot.index_of_parent = d++, r.lot.childs
.push(f), a.push(f), c++) : r.lot.childs.push(f))
})
} else {
let d = 0;
r.targetTo.forEach(f => {
f.lot || (f.lot = {
eached: !1
}), f.lot.eached || (x.isAllowShowNode(f) ? (f.lot.eached = !0, f
.lot.parent = r, f.lot.index_of_parent = d++, r.lot.childs
.push(f), a.push(f), c++) : r.lot.childs.push(f))
})
}
r.lot.strength = c > 0 ? c : 1, s.all_strength += r.lot.strength, r.lot.strength_plus =
s.all_strength, r.lot.index_of_level = l, r.lot.childs_size = c, l++
}), s.all_strength > n.max_strength && (n.max_strength = s.all_strength), a.length > 0 ? x
.analysisNodes4Didirectional(e, a, t + (i === -1 ? -1 : 1), n, i) : (e.forEach(r => {
r.lot.childs_size > 0 && (r.lot.strengthWithChilds = 0)
}), e.forEach(r => {
r.lot.childs_size === 0 && (r.lot.strengthWithChilds = 1, x
.conductStrengthToParents(r))
}), x.analysisDataTree([e[0]], 0, i))
},
conductStrengthToParents(e) {
e.lot.parent && (e.lot.parent.lot.strengthWithChilds += 1, this.conductStrengthToParents(e.lot
.parent))
},
analysisDataTree(e, o, t) {
t === void 0 && (t = 1);
const n = [];
let i = 0;
e.forEach(s => {
(s.lot.level === 0 || t === (s.lot.level < 0 ? -1 : 1)) && (s.lot.childs_size > 0 && s
.lot.childs.forEach(a => {
n.push(a)
}), s.lot.parent && i < s.lot.parent.lot.strengthWithChilds_from && (i = s.lot
.parent.lot.strengthWithChilds_from), s.lot.strengthWithChilds_from = i, i += s
.lot.strengthWithChilds)
}), n.length > 0 && this.analysisDataTree(n, o + t, t)
},
isAllowShowNode(e) {
return e.isShow !== !1 && e.isHide !== !0 && (!e.lot.parent || this.isAllowShowNode(e.lot.parent, !
1) === !0)
}
},
He = (e, o, t, n) => {
const i = e - t,
s = o - n,
a = i ** 2,
l = s ** 2,
r = a + l;
return Math.sqrt(r)
},
U = e => {
if (e.from === void 0) throw new Error("error,line must has option[from]:", e);
if (e.to === void 0) throw new Error("error,line must has option[to]:", e);
if (typeof e.from != "string") throw new TypeError("error line from, must be string:", e);
if (typeof e.to != "string") throw new TypeError("error line to, must be string:", e);
const o = {
from: e.from,
to: e.to,
text: e.text !== void 0 ? e.text : "",
color: e.color !== void 0 ? e.color : void 0,
opacity: e.opacity !== void 0 ? e.opacity : 1,
fontColor: e.fontColor !== void 0 ? e.fontColor : void 0,
lineWidth: e.lineWidth !== void 0 ? e.lineWidth : void 0,
lineShape: e.lineShape !== void 0 ? e.lineShape : void 0,
styleClass: e.styleClass !== void 0 ? e.styleClass : void 0,
isHide: e.isHide !== void 0 ? e.isHide : !1,
arrow: e.arrow !== void 0 ? e.arrow : void 0,
disableDefaultClickEffect: e.disableDefaultClickEffect !== void 0 ? e
.disableDefaultClickEffect : !1,
showStartArrow: e.showStartArrow !== void 0 ? e.showStartArrow : !1,
showEndArrow: e.showEndArrow !== void 0 ? e.showEndArrow : !0,
useTextPath: e.useTextPath !== void 0 ? e.useTextPath : !1,
isHideArrow: e.isHideArrow !== void 0 ? e.isHideArrow : void 0,
hidden: e.hidden !== void 0 ? e.hidden : !1,
lineDirection: e.lineDirection !== void 0 ? e.lineDirection : void 0,
reverseText: e.reverseText !== void 0 ? e.reverseText : void 0,
data: e.data !== void 0 ? e.data : {}
};
return o.isHideArrow && (o.showEndArrow = !1, o.isHideArrow = !1), o
},
We = ["arrow", "id", "reverseText", "isReverse"],
Y = (e, o) => {
!e || e.relations.forEach(t => {
const n = {};
Object.keys(t).forEach(i => {
We.includes(i) || t[i] !== void 0 && (n[i] = t[i])
}), o.push(n)
})
},
V = {
border: "border",
ltrb: "ltrb",
tb: "tb",
lr: "lr"
},
De = Object.freeze(Object.defineProperty({
__proto__: null,
json2Line: U,
transLinkToJson: Y,
JUNCTION_POINT_STYLE: V,
default: {
json2Line: U,
transLinkToJson: Y
}
}, Symbol.toStringTag, {
value: "Module"
})),
le = e => {
const o = {
instanceId: "SeeksGraph",
debug: !0,
showDebugPanel: !1,
backgrounImage: "",
downloadImageFileName: "",
disableZoom: !1,
disableDragNode: !1,
moveToCenterWhenRefresh: !0,
zoomToFitWhenRefresh: !0,
useAnimationWhenRefresh: !0,
defaultFocusRootNode: !0,
disableNodeClickEffect: !1,
disableLineClickEffect: !1,
allowShowZoomMenu: !0,
allowAutoLayoutIfSupport: !0,
allowShowRefreshButton: !0,
allowShowDownloadButton: !0,
backgrounImageNoRepeat: !1,
allowShowMiniToolBar: !0,
allowSwitchLineShape: !1,
allowSwitchJunctionPoint: !1,
isMoveByParentNode: !1,
defaultExpandHolderPosition: "hide",
defaultNodeColor: "#67C23A",
checkedLineColor: "#FD8B37",
defaultNodeFontColor: "#ffffff",
defaultNodeBorderColor: "#90EE90",
defaultNodeBorderWidth: 5,
defaultLineColor: "#dddddd",
defaultLineWidth: 1,
defaultLineShape: 1,
defaultNodeShape: 0,
defaultNodeWidth: void 0,
defaultNodeHeight: void 0,
defaultShowLineLabel: !0,
hideNodeContentByZoom: !1,
defaultJunctionPoint: "border",
disableDragCanvas: !1,
placeSingleNode: !0,
lineUseTextPath: !1,
viewSize: {
width: 300,
height: 300
},
viewELSize: {
width: 1300,
height: 800,
left: 0,
top: 100
},
viewNVInfo: {
width: 1300,
height: 800,
x: 0,
y: 100
},
canvasNVInfo: {
width: 1300,
height: 800,
x: 0,
y: 100
},
defaultLineMarker: {
markerWidth: 12,
markerHeight: 12,
refX: 6,
refY: 6,
color: void 0,
data: "M2,2 L10,6 L2,10 L6,6 L2,2"
},
allowShowMiniView: !1,
allowShowSettingPanel: !1,
allowShowMiniNameFilter: !0,
fullscreen: !1,
checkedNodeId: "",
checkedLineId: "",
layouts: [],
layoutLabel: "",
layoutName: "tree",
layoutClassName: "",
layoutDirection: "h",
autoLayouting: !1,
layouter: void 0,
isNeedShowAutoLayoutButton: !1,
canvasZoom: 100,
showSingleNode: !0,
showNodeLabel: !0,
showNodeShortLabel: !0,
canvasSize: {
width: 2e3,
height: 2e3
},
canvasOffset: {
x: 25,
y: 27,
zoom_buff_x: 0,
zoom_buff_y: 0
}
},
t = e.debug === !0;
return t && u("RGOptions:user instance graphSetting:", e), window && (window.relationGraphDebug = t),
e && Object.keys(e).forEach(n => {
const i = e[n];
if (typeof i == "object") {
u("RGOptions:user setting object:", n, i);
const s = o[n];
if (s)
if (s && !Array.isArray(s) && i) Object.keys(s).forEach(a => {
s[a] = i[a]
});
else if (Array.isArray(s)) {
const a = [];
i.forEach(l => {
l && typeof l == "object" ? a.push(JSON.parse(JSON.stringify(l))) : a
.push(l)
}), o[n] = a
} else o[n] = i;
else u("ignore option:", n)
} else o[n] = i
}), (!o.layouts || o.layouts.length === 0) && (o.layouts = [{
label: "\u4E2D\u5FC3",
layoutName: "center",
layoutDirection: "v",
defaultExpandHolderPosition: "hide",
defaultNodeShape: 0,
defaultLineShape: 1,
defaultJunctionPoint: "border"
}]), Array.isArray(o.layouts) || (o.layouts = [o.layouts]), o.layouts.forEach(n => {
ce(n, o)
}), o.disableNodeClickEffect && (o.defaultFocusRootNode = !1), o
},
ce = (e, o) => {
e.useLayoutStyleOptions === void 0 && (e.useLayoutStyleOptions = !1), e.defaultNodeColor === void 0 && (
e.defaultNodeColor = "#FFC5A6"), e.defaultNodeFontColor === void 0 && (e.defaultNodeFontColor =
"#000000"), e.defaultNodeBorderColor === void 0 && (e.defaultNodeBorderColor = "#efefef"), e
.defaultNodeBorderWidth === void 0 && (e.defaultNodeBorderWidth = 1), e.defaultLineColor ===
void 0 && (e.defaultLineColor = "#FD8B37"), e.defaultLineWidth === void 0 && (e.defaultLineWidth =
1), e.defaultNodeWidth === void 0 && (e.defaultNodeWidth = void 0), e.defaultNodeHeight ===
void 0 && (e.defaultNodeHeight = void 0), e.defaultShowLineLabel === void 0 && (e
.defaultShowLineLabel = !0), e.defaultExpandHolderPosition === void 0 && (e
.defaultExpandHolderPosition = void 0), e.defaultJunctionPoint === void 0 && (e
.defaultJunctionPoint = void 0), e.defaultLineMarker === void 0 && (e.defaultLineMarker = {
markerWidth: 12,
markerHeight: 12,
refX: 6,
refY: 6,
color: void 0,
data: "M2,2 L10,6 L2,10 L6,6 L2,2"
}), e.layoutName === "SeeksCenterLayouter" || e.layoutName === "center" ? (e.label === void 0 && (e
.label = "\u4E2D\u5FC3"), e.layoutClassName === void 0 && (e.layoutClassName =
`seeks-layout-${e.layoutName}`), e.defaultNodeShape === void 0 && (e.defaultNodeShape = 0),
e.defaultLineShape === void 0 && (e.defaultLineShape = 1), e.defaultExpandHolderPosition ===
void 0 && (e.defaultExpandHolderPosition = "hide"), e.defaultJunctionPoint === void 0 && (e
.defaultJunctionPoint = "border"), e.layoutDirection === void 0 && (e.layoutDirection =
"h"), e.centerOffset_x === void 0 && (e.centerOffset_x = 0), e.centerOffset_y === void 0 && (e
.centerOffset_y = 0), e.levelDistance === void 0 && (e.levelDistance = ""), e
.min_per_width === void 0 && (e.min_per_width = 30), e.max_per_width === void 0 && (e
.max_per_width = 200), e.min_per_height === void 0 && (e.min_per_height = 100), e
.max_per_height === void 0 && (e.max_per_height = 500)) : e.layoutName ===
"SeeksBidirectionalTreeLayouter" || e.layoutName === "tree" ? (e.label === void 0 && (e.label =
"\u6811\u72B6"), e.layoutClassName === void 0 && (e.layoutClassName =
`seeks-layout-${e.layoutName}`), e.defaultNodeShape === void 0 && (e.defaultNodeShape = 1),
e.defaultLineShape === void 0 && (o.defaultLineShape = 4), e.defaultExpandHolderPosition ===
void 0 && (e.defaultExpandHolderPosition = "hide"), e.defaultJunctionPoint === void 0 && (e
.defaultJunctionPoint = "ltrb"), e.layoutDirection === void 0 && (e.layoutDirection = "h"),
e.centerOffset_x === void 0 && (e.centerOffset_x = 0), e.centerOffset_y === void 0 && (e
.centerOffset_y = 0), e.from === void 0 && (e.from = "top"), e.levelDistance === void 0 && (
e.levelDistance = ""), e.min_per_width === void 0 && (e.min_per_width = 30), e
.max_per_width === void 0 && (e.max_per_width = 200), e.min_per_height === void 0 && (e
.min_per_height = 100), e.max_per_height === void 0 && (e.max_per_height = 500), (e.from ===
"top" || e.from === "bottom") && (e.layoutDirection = "v", o.defaultJunctionPoint = "tb", u(
"set layoutDirection=v"), u("set defaultJunctionPoint=tb")), (e.from === "left" || e
.from === "right") && (o.defaultJunctionPoint = "lr", u("set defaultJunctionPoint=lr"))) : (
e.layoutName === "fixed" || e.layoutName === "force") && (o.moveToCenterWhenRefresh = !1, o
.zoomToFitWhenRefresh = !1)
};
let Ve = 0;
class X {
constructor(o) {
const t = le(o);
u("RGOptions:new RGOptions:by:", o), u("RGOptions:new RGOptions:by:", this), Object.assign(this, t),
this.instanceId = `RGIns-${Ve++}`
}
}
const Te = Object.freeze(Object.defineProperty({
__proto__: null,
createDefaultConfig: le,
appendDefaultOptions4Layout: ce,
default: X
}, Symbol.toStringTag, {
value: "Module"
})),
q = e => {
if (e.id === void 0) throw new Error("node must has option[id]:", e);
e.text = e.text || e.name;
const o = {
id: e.id,
text: e.text !== void 0 ? e.text : "",
type: e.type !== void 0 ? e.type : "node",
isShow: e.isShow !== void 0 ? e.isShow : !0,
isHide: e.isHide !== void 0 ? e.isHide : !1,
expanded: e.expanded !== void 0 ? e.expanded : !0,
junctionPoint: e.junctionPoint !== void 0 ? e.junctionPoint : void 0,
selected: e.selected !== void 0 ? e.selected : !1,
styleClass: e.styleClass !== void 0 ? e.styleClass : "",
targetNodes: e.targetNodes !== void 0 ? e.targetNodes : [],
targetFrom: e.targetFrom !== void 0 ? e.targetFrom : [],
targetTo: e.targetTo !== void 0 ? e.targetTo : [],
nodeShape: e.nodeShape !== void 0 ? e.nodeShape : void 0,
borderWidth: e.borderWidth !== void 0 ? e.borderWidth : void 0,
borderColor: e.borderColor !== void 0 ? e.borderColor : void 0,
fontColor: e.fontColor !== void 0 ? e.fontColor : void 0,
color: e.color !== void 0 ? e.color : void 0,
opacity: e.opacity !== void 0 ? e.opacity : 1,
fixed: e.fixed !== void 0 ? e.fixed : !1,
width: e.width !== void 0 ? e.width : void 0,
height: e.height !== void 0 ? e.height : void 0,
x: e.x !== void 0 ? e.x : 0,
y: e.y !== void 0 ? e.y : 0,
Fx: e.Fx !== void 0 ? e.Fx : 0,
Fy: e.Fy !== void 0 ? e.Fy : 0,
offset_x: e.offset_x !== void 0 ? e.offset_x : 0,
offset_y: e.offset_y !== void 0 ? e.offset_y : 0,
expandHolderPosition: e.expandHolderPosition !== void 0 ? e.expandHolderPosition : void 0,
innerHTML: e.innerHTML !== void 0 ? e.innerHTML : void 0,
html: e.html !== void 0 ? e.html : void 0,
disableDefaultClickEffect: e.disableDefaultClickEffect !== void 0 ? e
.disableDefaultClickEffect : void 0,
disableDrag: e.disableDrag !== void 0 ? e.disableDrag : !1,
singleNode: !1,
data: e.data !== void 0 ? e.data : {}
};
return o.lot === void 0 && (o.lot = {
childs: [],
parent: void 0,
eached: !1,
strength: 0
}), o.lot.childs === void 0 && (o.lot.childs = []), o.lot.parent === void 0 && (o.lot.parent =
void 0), o.lot.eached === void 0 && (o.lot.eached = !1), o.lot.strength === void 0 && (o.lot
.strength = 0), o.el === void 0 && (o.el = {
offsetWidth: 50,
offsetHeight: 50
}), o.width !== void 0 && (o.el.offsetWidth = o.width), o.height !== void 0 && (o.el.offsetHeight =
o.height), o
},
je = ["Fx", "Fy", "appended", "el", "targetFrom", "targetNodes", "targetTo", "type", "lot", "seeks_id"],
K = e => {
if (!e) return;
const o = {};
return Object.keys(e).forEach(t => {
je.includes(t) || e[t] !== void 0 && (o[t] = e[t])
}), o
},
Ze = Object.freeze(Object.defineProperty({
__proto__: null,
json2Node: q,
transNodeToJson: K,
default: {
json2Node: q,
transNodeToJson: K
}
}, Symbol.toStringTag, {
value: "Module"
}));
class he {
constructor(o, t) {
p(this, "graphSetting");
p(this, "config");
p(this, "rootNode", null);
p(this, "allNodes", []);
p(this, "__origin_nodes", []);
this.config = o, this.graphSetting = t, u("new SeeksBidirectionalTreeLayouter:", this.config), this
.config.from || (this.config.from = "left"), this.config.levelDistance && typeof this.config
.levelDistance == "string" && (this.config.levelDistanceArr = this.config.levelDistance.split(
",").map(n => Number.parseInt(n)))
}
refresh() {
u("SeeksBidirectionalTreeLayouter:refresh:nodes:", this.__origin_nodes.length), this.placeNodes(this
.__origin_nodes, this.rootNode)
}
analysisNodes4Didirectional(o, t, n, i, s) {
t.length > i.max_length && (i.max_length = t.length), n > i.max_deep && (i.max_deep = n);
const a = {
level: n,
all_size: t.length,
all_strength: 0
},
l = [];
t.forEach(c => {
c.lot || (c.lot = {}), c.lot.eached = !0, c.lot.subling = a, c.lot.level = n, o.push(c)
});
let r = 0;
t.forEach(c => {
let d = 0;
if (s === -1) {
let f = 0;
c.targetFrom.forEach(h => {
h.lot || (h.lot = {
eached: !1
}), h.lot.eached || (x.isAllowShowNode(h) ? (h.lot.eached = !0, h
.lot.parent = c, h.lot.index_of_parent = f++, c.lot.childs
.push(h), l.push(h), d++) : c.lot.childs.push(h))
})
} else {
let f = 0;
c.targetTo.forEach(h => {
h.lot || (h.lot = {
eached: !1
}), h.lot.eached || (x.isAllowShowNode(h) ? (h.lot.eached = !0, h
.lot.parent = c, h.lot.index_of_parent = f++, c.lot.childs
.push(h), l.push(h), d++) : c.lot.childs.push(h))
})
}
c.lot.strength = d > 0 ? d : 1, a.all_strength += c.lot.strength, c.lot.strength_plus =
a.all_strength, c.lot.index_of_level = r, c.lot.childs_size = d, r++
}), a.all_strength > i.max_strength && (i.max_strength = a.all_strength), l.length > 0 ? this
.analysisNodes4Didirectional(o, l, n + s, i, s) : (o.forEach(c => {
c.lot.childs_size > 0 && (c.lot.strengthWithChilds = 0)
}), o.forEach(c => {
c.lot.childs_size === 0 && (c.lot.strengthWithChilds = 1, x
.conductStrengthToParents(c))
}), x.analysisDataTree([o[0]], 0, s))
}
placeNodes(o, t) {
if (u("SeeksBidirectionalTreeLayouter:placeNodes"), t) u("layout by root:", t);
else {
console.error("root is null");
return
}
this.__origin_nodes = o, this.rootNode = t, o.forEach(i => {
i.lot.eached = !1, i.lot.notLeafNode = !1, i.lot.childs = [], i.lot.index_of_parent = 0,
i.lot.strength = 0, i.lot.strengthWithChilds_from = 0, i.lot.strengthWithChilds = 0,
i.lot.prevNode = void 0, i.lot.nextNode = void 0, i.lot.placed = !1
}), this.allNodes = [];
let n = {
max_deep: 1,
max_length: 1,
max_strength: 1
};
this.analysisNodes4Didirectional(this.allNodes, [this.rootNode], 0, n, -1), this.placeNodesPosition(
this.rootNode, this.allNodes, n), this.allNodes = [], n = {
max_deep: 1,
max_length: 1,
max_strength: 1
}, this.analysisNodes4Didirectional(this.allNodes, [this.rootNode], 0, n, 1), this
.placeNodesPosition(this.rootNode, this.allNodes, n)
}
placeNodesPosition(o, t, n) {
const i = this.graphSetting.viewSize.width,
s = this.graphSetting.viewSize.height,
a = 0,
l = 0;
if (o.fixed !== !0) {
const c = Number.parseInt(this.config.centerOffset_x) || 0,
d = Number.parseInt(this.config.centerOffset_y) || 0;
o.lot.x = -(o.el.offsetWidth || o.width) / 2 + c, o.lot.y = -(o.el.offsetHeight || o.height) /
2 + d, this.config.from === "top" ? o.lot.y -= this.graphSetting.viewSize.height / 2 - (o.el
.offsetHeight || o.height) - 100 : this.config.from === "bottom" ? o.lot.y += this
.graphSetting.viewSize.height / 2 - (o.el.offsetHeight || o.height) - 200 : this.config
.from === "right" ? o.lot.x += this.graphSetting.viewSize.width / 2 - (o.el.offsetWidth || o
.width) - 100 : o.lot.x -= this.graphSetting.viewSize.width / 2 - (o.el.offsetWidth || o
.width) - 100, u("graph offset:", c, d), u("create rootNode coordinates:", o.lot.x, o
.lot.y), o.x = o.lot.x + a, o.y = o.lot.y + l
} else u("\u56FA\u5B9A\u4F4D\u7F6E\u7684rootNode:", o.text, o.x, o.y), o.origin_x === void 0 && (o
.origin_x = o.x, o.origin_y = o.y), o.lot.x = o.origin_x, o.lot.y = o.origin_y, o.x = o.lot
.x + a, o.y = o.lot.y + l, u("\u56FA\u5B9A\u4F4D\u7F6E\u7684rootNode:", o.text, o.x, o.y);
o.lot.placed = !0;
const r = {
__mapWidth: i,
__mapHeight: s
};
this.placeRelativePosition(o, n, r), t.forEach(c => {
if (c.fixed === !0) {
c.lot.placed = !0;
return
}
if (!x.isAllowShowNode(c)) return;
const d = c.offset_x || 0,
f = c.offset_y || 0;
c.x = c.offset_x + c.lot.x + d, c.y = c.offset_y + c.lot.y + f, c.lot.placed = !0
})
}
placeRelativePosition(o, t, n) {
if (this.config.from === "left" || this.config.from === "right") {
const i = this.config.min_per_height || 80,
s = this.config.max_per_height || 400,
a = this.config.min_per_width || 430,
l = this.config.max_per_width || 650;
let r = Math.round((n.__mapWidth - 10) / (t.max_deep + 2));
r < a && (r = a), r > l && (r = l);
let c = Math.round(n.__mapHeight / (t.max_strength + 1));
c < i && (c = i), c > s && (c = s), this.allNodes.forEach(d => {
d.fixed !== !0 && d.lot.placed !== !0 && d !== o && (this.config.from === "right" ?
d.lot.x = o.lot.x - this.getLevelDistance(d, d.lot.subling.level, r) : d.lot
.x = o.lot.x + this.getLevelDistance(d, d.lot.subling.level, r))
}), this.allNodes.forEach(d => {
d.fixed !== !0 && d.lot.level !== 0 && (d.lot.y = o.lot.y + c * (t.max_strength / -
2 + d.lot.strengthWithChilds_from + d.lot.strengthWithChilds / 2))
})
} else {
const i = this.config.min_per_height || 250,
s = this.config.max_per_height || 400,
a = this.config.min_per_width || 250,
l = this.config.max_per_width || 500;
let r = Math.round((n.__mapWidth - 10) / (t.max_strength + 2));
r < a && (r = a), r > l && (r = l);
let c = Math.round((n.__mapHeight - 10) / (t.max_deep + 2));
c < i && (c = i), c > s && (c = s), this.allNodes.forEach(d => {
d.fixed !== !0 && d.lot.placed !== !0 && d !== o && (this.config.from === "bottom" ?
d.lot.y = o.lot.y - this.getLevelDistance(d, d.lot.subling.level, c) : d.lot
.y = o.lot.y + this.getLevelDistance(d, d.lot.subling.level, c))
}), this.allNodes.forEach(d => {
d.fixed !== !0 && d.lot.level !== 0 && (d.lot.x = o.lot.x + r * (t.max_strength / -
2 + d.lot.strengthWithChilds_from + d.lot.strengthWithChilds / 2))
})
}
}
getLevelDistance(o, t, n) {
const i = Math.abs(t);
if (this.config.levelDistanceArr && this.config.levelDistanceArr.length > 0) {
let s = 0;
for (let a = 0; a < i; a++) {
const l = this.config.levelDistanceArr[a] || 100;
s += l
}
return t > 0 ? s : s * -1
} else return t * n
}
}
class de {
constructor(o, t) {
p(this, "graphSetting");
p(this, "config");
p(this, "rootNode", null);
p(this, "allNodes", []);
p(this, "__origin_nodes", []);
p(this, "layoutTimes", 0);
this.config = o, this.graphSetting = t
}
refresh() {
u("SeeksCenterLayouter:refresh"), this.placeNodes(this.__origin_nodes, this.rootNode)
}
placeNodes(o, t) {
if (u("SeeksCenterLayouter:placeNodes"), !t) {
u("root is null:", t);
return
}
u("layout by root:", t), this.__origin_nodes = o, this.rootNode = t, o.forEach(i => {
i.lot.eached = !1, i.lot.notLeafNode = !1, i.lot.childs = [], i.lot.index_of_parent = 0,
i.lot.strength = 0, i.lot.prevNode = void 0, i.lot.nextNode = void 0, i.lot
.placed = !1
}), this.allNodes = [];
const n = {
max_deep: 1,
max_length: 1
};
x.analysisNodes4Didirectional(this.allNodes, [this.rootNode], 0, n, 0), t.lot.x = -(t.el
.offsetWidth || t.width) / 2, t.lot.y = -(t.el.offsetHeight || t.height) / 2, u(
"root position:", t.lot.x, t.lot.y), this.placeRelativePosition(this.rootNode, n), this
.allNodes.forEach(i => {
if (i.fixed === !0 || !x.isAllowShowNode(i)) return;
const s = i.offset_x || 0,
a = i.offset_y || 0;
i.x = i.lot.x + s, i.y = i.lot.y + a, i.lot.placed = !0
}), u("Start Auto Layout.....")
}
placeRelativePosition(o, t) {
const n = this.config.distance_coefficient === void 0 ? 1 : this.config.distance_coefficient;
let i = Math.round((this.graphSetting.viewSize.height + this.graphSetting.viewSize.width) / t
.max_deep * .2) * n;
u("analyticResult:", t, i, this.config.distance_coefficient), i < 150 * n && (i = 150 * n);
let s = 0;
this.allNodes.forEach(l => {
if (l.lot.subling.level === 1) {
s = Math.round(l.lot.subling.all_size * 50 / Math.PI / 2), s < i && (s = i);
const r = x.getOvalPoint(o.lot.x, o.lot.y, l.lot.subling.level * s, l.lot
.strength_plus - l.lot.strength / 2, l.lot.subling.all_strength);
l.lot.x = r.x, l.lot.y = r.y
}
});
const a = Math.round(300 * n);
this.allNodes.forEach(l => {
if (l.lot.subling.level > 1) {
const r = l.lot.parent.lot.strength_plus - l.lot.parent.lot.strength,
d = (l.lot.parent.lot.strength_plus - r) / (l.lot.parent.lot.childs_size + 1) *
(l.lot.index_of_parent + 1),
f = x.getOvalPoint(o.lot.x, o.lot.y, (l.lot.subling.level - 1) * a + s, r + d, l
.lot.parent.lot.subling.all_strength);
l.lot.x = f.x, l.lot.y = f.y
}
})
}
autoLayout(o) {
if (o && (this.layoutTimes = 0), u("this.layoutTimes:", this.layoutTimes), this.layoutTimes > 300) {
this.graphSetting.autoLayouting = !1;
return
}
this.layoutTimes++, this.__origin_nodes.forEach(t => {
t.Fx = 0, t.Fy = 0
});
for (const t in this.__origin_nodes) {
const n = this.__origin_nodes[t];
if (n.lot.placed === !0)
for (const i in this.__origin_nodes) {
const s = this.__origin_nodes[i];
s.lot.placed === !0 && t !== i && this.addGravityByNode(n, s)
}
}
for (const t in this.__origin_nodes) this.__origin_nodes[t].lot.parent && this.addElasticByLine(this
.__origin_nodes[t].lot.parent, this.__origin_nodes[t]);
for (const t in this.__origin_nodes) this.applyToNodePosition(this.__origin_nodes[t]);
window.setTimeout(() => {
this.autoLayout()
}, 30)
}
stop() {
this.layoutTimes = 1e3
}
addElasticByLine(o, t) {
let n = Math.sqrt((o.y - t.y) ** 2 + (o.x - t.x) ** 2);
n > 1e3 && (n = 1e3);
const i = n < 30 ? 0 : (n - 30) * .05,
s = i,
a = i,
l = (o.x - t.x) / n,
r = (o.y - t.y) / n;
this.addFtoNode(o, l * s * -1, r * s * -1, 1), this.addFtoNode(t, l * a, r * a, 1)
}
addGravityByNode(o, t) {
const n = Math.sqrt((o.y - t.y) ** 2 + (o.x - t.x) ** 2),
i = 300;
let s = n > i ? 0 : (i - n) * .03;
const a = (o.x - t.x) / n,
l = (o.y - t.y) / n;
this.addFtoNode(o, a * s, l * s, 0), this.addFtoNode(t, a * s * -1, l * s * -1, 0)
}
getNodeFWeight(o) {
let t = o.lot.level;
return t > 7 && (t = 7), t < 0 && (t = 0), (8 - t) / 8
}
addFtoNode(o, t, n) {
isNaN(t) || isNaN(n) || (t = t / o.lot.strength, n = n / o.lot.strength, t > 50 && (t = 50), n >
50 && (n = 50), t < -50 && (t = -50), n < -50 && (n = -50), o.Fx += t, o.Fy += n)
}
applyToNodePosition(o) {
const t = Math.round(o.Fx),
n = Math.round(o.Fy);
o.x = o.x + t, o.y = o.y + n, o.Fx = 0, o.Fy = 0
}
}
class fe {
constructor(o, t) {
p(this, "setting");
p(this, "config");
p(this, "rootNode", null);
p(this, "allNodes", []);
p(this, "__origin_nodes", []);
p(this, "__max_deep", 1);
p(this, "__max_length", 1);
p(this, "layoutTimes", 0);
this.config = o, this.setting = t
}
checkMaxDeepAndLength(o, t) {
o.length > this.__max_length && (this.__max_length = o.length), t > this.__max_deep && (this
.__max_deep = t);
const n = {
level: t,
all_size: o.length,
all_strength: 0
},
i = [];
o.forEach(l => {
l.lot || (l.lot = {}), l.lot.eached = !0, l.lot.subling = n, this.allNodes.push(l)
});
let s = 0,
a;
o.forEach(l => {
let r = 0;
l.targetNodes && (l.targetNodes.forEach(c => {
u("child node::", c.type, c.lot.eached), c.lot || (c.lot = {
eached: !1
}), c.type === "node" && c.targetNodes.length <= 1 ? c.lot.eached ||
(c.lot.parent = l, c.lot.index_of_p_childs = r, c.lot.prevNode = a,
a && (a.lot.nextNode = c), a = c, l.lot.childs.push(c), l.lot
.eached = !0, i.push(c), r++) : c.lot.notLeafNode = !0
}), l.targetNodes.forEach(c => {
c.lot.notLeafNode && (c.lot || (c.lot = {
eached: !1
}), c.lot.eached || (c.lot.parent = l, c.lot.index_of_p_childs =
r, c.lot.prevNode = a, a && (a.lot.nextNode = c), a = c, l
.lot.childs.push(c), l.lot.eached = !0, i.push(c), r++))
})), l.lot.strength = r > 0 ? r : 1, n.all_strength += l.lot.strength, l.lot
.strength_plus = n.all_strength, l.lot.level_index = s, l.lot.childs_size = r, s++
}), i.length > 0 && this.checkMaxDeepAndLength(i, t + 1)
}
refresh() {
this.placeNodes(this.__origin_nodes, this.rootNode)
}
placeNodes(o, t) {
if (t) u("layout by root:", t);
else {
u("root is null:", t);
return
}
this.__origin_nodes = o, this.rootNode = t, o.forEach(a => {
a.lot.eached = !1, a.lot.notLeafNode = !1, a.lot.childs = [], a.lot.parent = void 0, a
.lot.index_of_p_childs = 0, a.lot.strength = 0, a.lot.prevNode = void 0, a.lot
.nextNode = void 0
}), this.allNodes = o, u("max before:", this.__max_deep, this.__max_length), u("max after:",
this.__max_deep, this.__max_length);
const n = {
x: 0,
y: 0
},
i = this.allNodes.length;
let s = i * 90 / Math.PI / 2;
s < 200 && (s = 200), s > 800 && (s = 800), this.allNodes.forEach((a, l) => {
const r = x.getOvalPoint(n.x, n.y, s, l, i);
a.x = r.x, a.y = r.y
}), u("Start Auto Layout.....")
}
adjustLevel2Y(o) {
for (let t = 0; t < this.allNodes.length; t++) {
const n = this.allNodes[t];
if (n.lot.subling.level === 1 && n.lot.childs_size === 0) {
let i = Math.round(o / (n.lot.subling.all_size + 1));
i > 70 && (i = 70), u(i, o, n.lot.subling.all_size, n.lot.subling.all_strength, n.lot
.strength);
for (let s = 0; s < this.allNodes.length; s++) {
const a = this.allNodes[s];
if (a.lot.subling.level === 1 && a !== n) {
const l = Math.abs(n.y - a.y);
if (l < i - 2) {
u("__y_diff", n.name, a.name, l), n.y = a.y + i, t--;
break
}
}
}
}
}
}
autoLayout(o) {
if (o && (this.layoutTimes = 0), u("this.layoutTimes:", this.layoutTimes), this.layoutTimes > 300) {
this.setting.autoLayouting = !1;
return
}
this.layoutTimes++, this.allNodes.forEach(t => {
t.Fx = 0, t.Fy = 0
});
for (const t in this.allNodes)
for (const n in this.allNodes) t !== n && this.addGravityByNode(this.allNodes[t], this.allNodes[
n]);
for (const t in this.allNodes) this.allNodes[t].lot.parent && this.addElasticByLine(this.allNodes[t]
.lot.parent, this.allNodes[t]);
for (const t in this.allNodes) this.applyToNodePosition(this.allNodes[t]);
window.setTimeout(() => {
this.autoLayout()
}, 30)
}
stop() {
this.layoutTimes = 1e3
}
addElasticByLine(o, t) {
const n = Math.sqrt((o.y - t.y) ** 2 + (o.x - t.x) ** 2),
i = n < 30 ? 0 : (n - 30) * .01;
this.addFtoNode(o, (o.x - t.x) * i * -1, (o.y - t.y) * i * -1), this.addFtoNode(t, (t.x - o.x) * i *
-1, (t.y - o.y) * i * -1)
}
addGravityByNode(o, t) {
const n = Math.sqrt((o.y - t.y) ** 2 + (o.x - t.x) ** 2),
i = n > 300 ? 0 : (300 - n) * .02;
let s = o.x - t.x,
a = o.y - t.y;
s === 0 && (s = 1), a === 0 && (a = 1), this.addFtoNode(o, s * i, a * i), this.addFtoNode(t, s * -
1 * i, a * -1 * i)
}
addFtoNode(o, t, n) {
o.Fx += t, o.Fy += n
}
applyToNodePosition(o) {
if (this.rootNode === o) return;
o.Fx > 1e3 && (o.Fx = 3e3), o.Fy > 1e3 && (o.Fy = 3e3), o.Fx < -1e3 && (o.Fx = -3e3), o.Fy < -1e3 &&
(o.Fy = -3e3);
const t = Math.round(o.Fx * .02),
n = Math.round(o.Fy * .02);
o.x = o.x + t, o.y = o.y + n, o.Fx = 0, o.Fy = 0
}
}
class Q {
constructor(o, t) {
p(this, "graphOptions");
p(this, "config");
p(this, "rootNode", null);
p(this, "allNodes", []);
p(this, "__origin_nodes", []);
p(this, "layoutTimes", 0);
p(this, "maxLayoutTimes", 300);
p(this, "justLayoutSingleNode", !1);
p(this, "byNode", !0);
p(this, "byLine", !0);
this.config = o, this.graphOptions = t
}
refresh() {
this.placeNodes(this.__origin_nodes, this.rootNode)
}
placeNodes(o, t) {
if (t) u("layout by root:", t);
else {
u("root is null:", t);
return
}
this.__origin_nodes = o, this.rootNode = t;
let n = 0;
this.__origin_nodes.forEach(i => {
i.lot.placed && n++
}), this.analysisNodes(), n === 0 ? this.initNodesPosition() : this.__origin_nodes.forEach(
i => {
i.fixed !== !0 && (i.lot.placed || (i.x || (i.x = Math.floor(Math.random() * 200) -
100), i.x || (i.y = Math.floor(Math.random() * 200) - 100), i.lot.placed = !
0))
}), u("Start Auto Layout....."), this.autoLayout(!0)
}
analysisNodes() {
this.__origin_nodes.forEach(t => {
t.lot.eached = !1, t.lot.notLeafNode = !1, t.lot.childs = [], t.lot.index_of_parent = 0,
t.lot.strength = 0, t.lot.prevNode = void 0, t.lot.nextNode = void 0, t.lot
.placed = !1
}), this.allNodes = [];
const o = {
max_deep: 1,
max_length: 1
};
x.analysisNodes4Didirectional(this.allNodes, [this.rootNode], 0, o, 0)
}
initNodesPosition() {
this.rootNode.lot.x = -(this.rootNode.el.offsetWidth || this.rootNode.width) / 2, this.rootNode.lot
.y = -(this.rootNode.el.offsetHeight || this.rootNode.height) / 2, u("root position:", this
.rootNode.lot.x, this.rootNode.lot.y), u("[layout canvasOffset]", this.graphOptions
.viewSize, this.graphOptions.canvasSize), this.placeRelativePosition(this.rootNode), this
.__origin_nodes.forEach(o => {
o.fixed !== !0 && (!x.isAllowShowNode(o) || (o.x = o.lot.x, o.y = o.lot.y, o.lot
.placed = !0))
})
}
placeRelativePosition(o) {
let t = 80;
this.allNodes.forEach(n => {
if (n.lot.subling.level === 1) {
t = n.lot.subling.all_size * 20 / Math.PI / 2, t < 80 && (t = 80);
const i = x.getOvalPoint(o.lot.x, o.lot.y, n.lot.subling.level * t, n.lot
.strength_plus - n.lot.strength / 2, n.lot.subling.all_strength);
n.lot.x = i.x, n.lot.y = i.y
}
}), this.allNodes.forEach(n => {
if (n.lot.subling.level > 1) {
const i = n.lot.parent.lot.strength_plus - n.lot.parent.lot.strength,
a = (n.lot.parent.lot.strength_plus - i) / (n.lot.parent.lot.childs_size + 1) *
(n.lot.index_of_parent + 1),
l = x.getOvalPoint(o.lot.x, o.lot.y, (n.lot.subling.level - 1) * 80 + t, i + a,
n.lot.parent.lot.subling.all_strength);
n.lot.x = l.x, n.lot.y = l.y
}
})
}
autoLayout(o) {
if (o && (this.layoutTimes = 0), u("this.layoutTimes:", this.layoutTimes), this.layoutTimes > this
.maxLayoutTimes) {
this.graphOptions.autoLayouting = !1;
return
}
if (this.graphOptions.autoLayouting = !0, this.layoutTimes++, this.__origin_nodes.forEach(t => {
t.Fx = 0, t.Fy = 0
}), this.byNode)
for (const t in this.__origin_nodes) {
const n = this.__origin_nodes[t];
if (!(this.justLayoutSingleNode && !n.singleNode) && !n.fixed && n.lot.placed === !0)
for (const i in this.__origin_nodes) {
const s = this.__origin_nodes[i];
s.lot.placed === !0 && t !== i && this.addGravityByNode(n, s)
}
}
if (this.byLine)
for (const t in this.__origin_nodes) this.__origin_nodes[t].fixed || this.__origin_nodes[t].lot
.parent && this.addElasticByLine(this.__origin_nodes[t].lot.parent, this.__origin_nodes[t]);
for (const t in this.__origin_nodes) this.applyToNodePosition(this.__origin_nodes[t]);
window.setTimeout(() => {
this.autoLayout()
}, 30)
}
stop() {
this.layoutTimes = 1e3
}
addElasticByLine(o, t) {
let n = Math.sqrt((o.y - t.y) ** 2 + (o.x - t.x) ** 2);
n > 1e3 && (n = 1e3);
const i = n < 30 ? 0 : (n - 30) * .05,
s = i,
a = i,
l = (o.x - t.x) / n,
r = (o.y - t.y) / n;
this.addFtoNode(o, l * s * -1, r * s * -1, 1), this.addFtoNode(t, l * a, r * a, 1)
}
addGravityByNode(o, t) {
const n = Math.sqrt((o.y - t.y) ** 2 + (o.x - t.x) ** 2),
i = 300;
let s = n > i ? 0 : (i - n) * .03;
const a = (o.x - t.x) / n,
l = (o.y - t.y) / n;
this.addFtoNode(o, a * s, l * s, 0), this.addFtoNode(t, a * s * -1, l * s * -1, 0)
}
getNodeFWeight(o) {
let t = o.lot.level;
return t > 7 && (t = 7), t < 0 && (t = 0), (8 - t) / 8
}
addFtoNode(o, t, n) {
this.justLayoutSingleNode && !o.singleNode || Number.isNaN(t) || Number.isNaN(n) || (t = t / (o.lot
.strength || 1), n = n / (o.lot.strength || 1), t > 50 && (t = 50), n > 50 && (n = 50),
t < -50 && (t = -50), n < -50 && (n = -50), o.Fx += t, o.Fy += n)
}
applyToNodePosition(o) {
if (o.fixed) return;
const t = Math.round(o.Fx),
n = Math.round(o.Fy);
o.x = o.x + t, o.y = o.y + n, o.Fx = 0, o.Fy = 0
}
}
class ue {
constructor(o, t) {
p(this, "setting");
p(this, "config");
p(this, "rootNode", null);
p(this, "allNodes", []);
p(this, "__origin_nodes", []);
this.config = o, this.setting = t
}
refresh() {
this.placeNodes(this.__origin_nodes, this.rootNode)
}
placeNodes(o, t) {
if (t) u("layout by root:", t);
else {
u("root is null:", t);
return
}
this.__origin_nodes = o, this.rootNode = t, o.forEach(i => {
i.lot.eached = !1, i.lot.notLeafNode = !1, i.lot.childs = [], i.lot.index_of_parent = 0,
i.lot.strength = 0, i.lot.prevNode = void 0, i.lot.nextNode = void 0, i.lot
.placed = !1
}), this.allNodes = [];
const n = {
max_deep: 1,
max_length: 1
};
x.analysisNodes4Didirectional(this.allNodes, [this.rootNode], 0, n, 0), u("[layout canvasOffset]",
this.setting.viewSize, this.setting.canvasSize)
}
}
const pe = (e, o) => {
o.layoutClassName = e.layoutClassName, o.layoutLabel = e.label, o.layoutName = e.layoutName, o
.layoutDirection = e.layoutDirection, e.useLayoutStyleOptions === !0 && (o
.defaultExpandHolderPosition = e.defaultExpandHolderPosition, o.defaultJunctionPoint = e
.defaultJunctionPoint, o.defaultNodeColor = e.defaultNodeColor, o.defaultNodeFontColor = e
.defaultNodeFontColor, o.defaultNodeBorderColor = e.defaultNodeBorderColor, o
.defaultNodeBorderWidth = e.defaultNodeBorderWidth, o.defaultLineColor = e.defaultLineColor, o
.defaultLineWidth = e.defaultLineWidth, o.defaultLineShape = e.defaultLineShape, o
.defaultNodeShape = e.defaultNodeShape, o.defaultNodeWidth = e.defaultNodeWidth, o
.defaultNodeHeight = e.defaultNodeHeight, o.defaultLineMarker = e.defaultLineMarker, o
.defaultShowLineLabel = e.defaultShowLineLabel);
let t = null;
return e.layoutName === "SeeksBidirectionalTreeLayouter" || e.layoutName === "tree" ? t = new he(e, o) :
e.layoutName === "SeeksCenterLayouter" || e.layoutName === "center" ? t = new de(e, o) : e
.layoutName === "SeeksCircleLayouter" || e.layoutName === "circle" ? t = new fe(e, o) : e
.layoutName === "SeeksForceLayouter" || e.layoutName === "force" ? t = new Q(e, o) : (e
.layoutName === "SeeksFixedLayouter" || e.layoutName === "fixed") && (t = new ue(e, o)), o
.isNeedShowAutoLayoutButton = e.allowAutoLayoutIfSupport !== !1 && t.autoLayout !== void 0, t
},
Je = (e, o) => {
const t = o.layouter ? o.layouter.__origin_nodes : [],
n = o.layouter ? o.layouter.rootNode : null;
if (typeof e == "string") {
for (const i in o.layouts)
if (i.label === e) {
e = i;
break
}
}
u("[change layout]switchLayout"), o.layouter = pe(e, o), o.layouter.__origin_nodes = t, o.layouter
.rootNode = n
};
class Ue {
constructor(o, t) {
p(this, "instanceId", "");
p(this, "options");
p(this, "listeners");
this.listeners = t, this.options = new X(o), this.instanceId = this.options.instanceId, u(
"new RelationGraph:", this)
}
enableDebugLog(o) {
this.options.debug = o, window && (window.relationGraphDebug = o)
}
}
let B = {
x: 0,
y: 0
};
const F = {
x: 0,
y: 0
},
H = {
x: 0,
y: 0
};
let ee, te;
const _e = e => {
const o = {
clientX: 0,
clientY: 0
};
if (D) {
const t = e.touches || e.targetTouches;
if (!t) throw new Error("error targetTouches");
o.clientX = t[0].clientX, o.clientY = t[0].clientY
} else o.clientX = e.clientX, o.clientY = e.clientY;
return o
},
A = {
startDrag(e, o, t, n) {
n ? ee = (i, s, a) => {
const l = i - H.x,
r = s - H.y;
n(l, r, F, H, a)
} : ee = (i, s) => {
B.x = F.x + (i - H.x), B.y = F.y + (s - H.y)
}, te = t, B = o, F.x = B.x, F.y = B.y, u("[canvas]onDragStart...", D, e);
try {
const i = _e(e);
H.x = i.clientX, H.y = i.clientY, D ? (e.preventDefault(), document.body.addEventListener(
"touchmove", A.onNodeMove), document.body.addEventListener("touchend", A
.onNodeDragend)) : (document.body.addEventListener("mousemove", A.onNodeMove), document
.body.addEventListener("mouseup", A.onNodeDragend))
} catch (i) {
console.error(i.message)
}
},
onNodeMove(e) {
const o = _e(e);
ee(o.clientX, o.clientY, e)
},
onNodeDragend(e) {
D ? (document.body.removeEventListener("touchmove", A.onNodeMove), document.body
.removeEventListener("touchend", A.onNodeDragend)) : (document.body.removeEventListener(
"mousemove", A.onNodeMove), document.body.removeEventListener("mouseup", A
.onNodeDragend)), u("Node dragend"), te && te(B.x - F.x, B.y - F.y, e)
},
transName4Circle(e) {
let o = 0,
t = [];
const n = [];
for (const i of e) t.push(i), t.length === Ye[o] && (n.push(t.join("")), o++, t = []);
return t.length > 0 && n.push(t.join("")), n.join("
")
},
getColorId(e) {
return e = e.replace("#", ""), e = e.replace("(", ""), e = e.replace(")", ""), e = e.replace(/,/,
"-"), e
}
},
Ye = [4, 5, 6, 4, 2, 100];
class Xe extends Ue {
constructor(t, n) {
super(t, n);
p(this, "graphData", {
nodes: [],
lines: []
});
p(this, "tmpData", {
nodes: [],
lines: []
});
p(this, "seeksNodeIdIndex", 0);
p(this, "allLineColors", []);
p(this, "userLayouerClass", null)
}
ready() {
this.initLayouter(), this.resetViewSize(), this.refreshNVAnalysisInfo()
}
setOptions(t, n) {
this.options = new X(t), this.initLayouter(), this.resetViewSize(), this.doLayout(), this
.resetViewSize(), n && n(this)
}
setLayouter(t) {
u("setLayouterClass::", t), this.userLayouerClass = t
}
initLayouter() {
if (this.userLayouerClass) u("Use user layouter:", this.userLayouerClass), this.options.layouter =
this.userLayouerClass;
else if (this.options.layouts && this.options.layouts.length > 0) {
const t = this.options.layouts[0];
u("[change layout]Create default layouter\uFF1A", this.options.layoutName), t.layouter ? this
.options.layouter = t.layouter : this.options.layouter = pe(t, this.options)
} else u(
"\u4F60\u9700\u8981\u8BBE\u7F6Elayouts\u6765\u6307\u5B9A\u5F53\u524D\u56FE\u8C31\u53EF\u4EE5\u4F7F\u7528\u7684\u5E03\u5C40\u5668\uFF01"
);
u("Layouter instance:", this.options.layouter)
}
setJsonData(t, n, i) {
arguments.length === 2 && typeof n == "function" && (i = n, n = !0), this.nodeViewList = [], this
.lineViewList = [], this.graphData.nodes = [], this.graphData.links = [], this.tmpData
.nodes_map = {}, this.tmpData.lines_map = {}, this.graphData.rootNode = null, u("set jsonData:",
t);
const s = t.rootId;
this.loadGraphJsonData(t), s && (this.graphData.rootNode = this.tmpData.nodes_map[s]), !this
.graphData.rootNode && this.graphData.nodes.length > 0 && (this.graphData.rootNode = this
.graphData.nodes[0]), this.applyNewDataToCanvas(), n && (u("resetViewSize:", n), this
.resetViewSize()), setTimeout(() => {
this.doLayout(), i && i(this)
}, 500)
}
applyNewDataToCanvas() {
if (this.graphData.nodes.forEach(t => {
t.appended === !1 && (t.appended = !0, this.nodeViewList.push(t))
}), this.graphData.links.forEach(t => {
t.appended === !1 && (t.appended = !0, this.lineViewList.push(t))
}), this.graphData.rootNode) this.options.defaultFocusRootNode && this.setCheckedNode(this
.graphData.rootNode.id);
else throw new Error(
"\u6CA1\u6709\u8BBE\u7F6E\u6839\u8282\u70B9[rootId]\uFF01\u4E5F\u65E0\u6CD5\u83B7\u53D6\u6839\u8282\u70B9!"
)
}
appendJsonData(t, n, i) {
arguments.length === 2 && typeof n == "function" && (i = n, n = !0), u("appendData:", t), this
.loadGraphJsonData(t), this.applyNewDataToCanvas(), n && this.doLayout(), i && i(this)
}
loadNodes(t) {
t.forEach(n => {
let i = q(n),
s = !1;
this.tmpData.nodes_map[i.id] ? i = this.tmpData.nodes_map[i.id] : s = !0, s && (this
.tmpData.nodes_map[i.id] = i, this.graphData.nodes.push(i), i.seeks_id = this
.seeksNodeIdIndex++, i.appended = !1)
})
}
loadLines(t) {
t.forEach(n => {
let i = !1,
s, a;
if (typeof n.from == "object" ? s = n.from : s = this.tmpData.nodes_map[n.from],
typeof n.to == "object" ? a = n.to : a = this.tmpData.nodes_map[n.to], !s) {
console.error("\u627E\u4E0D\u5230from:", n);
return
}
if (!a) {
console.error("\u627E\u4E0D\u5230to:", n);
return
}
const l = `${s.seeks_id}-${a.seeks_id}`,
r = `${a.seeks_id}-${s.seeks_id}`,
c = U(n);
let d, f = !1;
this.tmpData.lines_map[l] ? d = this.tmpData.lines_map[l] : this.tmpData.lines_map[r] ?
(d = this.tmpData.lines_map[r], f = !0) : (i = !0, d = {
seeks_id: l,
fromNode: s,
toNode: a,
appended: !1,
relations: []
});
let h = c.arrow;
c.isHideArrow || (h = this.getLineArrow(c.color)), s.targetNodes || (s
.targetNodes = []), a.targetNodes || (a.targetNodes = []), s.targetNodes.includes(a) ||
s.targetNodes.push(a), a.targetNodes.includes(s) || a.targetNodes.push(s), s
.targetTo.includes(a) || s.targetTo.push(a), a.targetFrom.includes(s) || a
.targetFrom.push(s);
let g = !1;
for (let _ = 0; _ < d.relations.length; _++)
if (d.relations[_].id === c.id) {
g = !0;
break
} g === !1 && (c.id || (c.id = `${d.seeks_id}-${d.relations.length}`), c.isReverse =
f, c.arrow = h, c.textPositon = {
x: 0,
y: 0
}, d.relations.push(c)), i && (this.graphData.links.push(d), this.tmpData
.lines_map[l] = d, d.appended = !1)
})
}
flatNodeData(t, n, i, s) {
t.forEach(a => {
i.push(a), n && s.push({
from: n.id,
to: a.id
});
const l = a.childs || a.children;
l && l.length > 0 && this.flatNodeData(l, a, i, s)
})
}
loadGraphJsonData(t, n) {
t.lines || (t.lines = t.relations, console.warn(
"[relation-graph] For compatibility with older versionsm, Use jsonData.relations as jsonData.lines, It is recommended that you define your data using"
)), t.lines || (t.lines = t.links, console.warn(
"[relation-graph] For compatibility with older versionsm, Use jsonData.links as jsonData.lines, It is recommended that you define your data using"
));
const i = t.nodes,
s = [],
a = [];
this.flatNodeData(i, null, s, a), t.lines.forEach(l => {
a.push(l)
}), this.loadNodes(s), u("Nodes is initialized"), this.loadLines(a)
}
getLineArrow(t, n, i) {
const s = n ? "start-" : "";
if (i) return `${this.options.instanceId}-${s}arrow-checked`;
if (t) {
const a = A.getColorId(t);
return this.allLineColors.map(l => l.id).includes(a) || this.allLineColors.push({
id: a,
color: t
}), `${this.options.instanceId}-${s}arrow-${a}`
} else return `${this.options.instanceId}-${s}arrow-default`
}
getNodes() {
return this.graphData.nodes
}
getLinks() {
return this.graphData.links
}
getGraphJsonData() {
const t = [],
n = [];
return this.graphData.nodes.forEach(i => {
const s = K(i);
s && t.push(s)
}), this.graphData.links.forEach(i => {
Y(i, n)
}), {
rootId: this.graphData.rootNode ? this.graphData.rootNode.id : "",
nodes: t,
lines: n
}
}
getGraphJsonOptions() {
const t = {},
n = ["layouter", "autoLayouting", "canvasNVInfo", "canvasOffset", "canvasZoom", "fullscreen",
"instanceId", "layoutClassName", "layoutDirection", "layoutLabel", "layoutName",
"resetViewSize", "viewELSize", "viewNVInfo", "viewSize", "canvasSize"
];
return Object.keys(this.options).forEach(i => {
n.includes(i) || (t[i] = this.options[i])
}), t
}
printGraphJsonData() {
u("graph options:", JSON.stringify(this.getGraphJsonOptions())), u("graph json data:", JSON
.stringify(this.getGraphJsonData()))
}
getNodeById(t) {
for (let n = 0; n < this.graphData.nodes.length; n++)
if (this.graphData.nodes[n].id === t) return this.graphData.nodes[n]
}
addNodes(t, n) {
this.loadNodes(t), n && this.doLayout()
}
addLines(t, n) {
this.loadLines(t), n && this.doLayout()
}
removeNodeById(t) {
let n = 0;
for (let s = 0; s < this.graphData.links.length; s++) {
const a = this.graphData.links[s];
(a.fromNode.id === t || a.toNode.id === t) && (a.hidden = !0, this.graphData.links.splice(s, 1),
s--, n++)
}
u("\u5220\u9664\u5BF9\u5E94\u7684\u7EBF\u4E2A\u6570\uFF1A", t, n);
let i = 0;
for (let s = 0; s < this.graphData.nodes.length; s++)
if (this.graphData.nodes[s].id === t) {
const a = this.graphData.nodes[s];
a.targetNodes.forEach(l => {
const r = l.targetNodes.indexOf(a);
r !== -1 && l.targetNodes.splice(r, 1)
}), this.graphData.nodes.splice(s, 1), delete this.tmpData.nodes_map[a.id], i++;
break
} u("\u5220\u9664\u5BF9\u5E94\u7684\u8282\u70B9\u4E2A\u6570\uFF1A", t, i)
}
removeLinkById(t, n) {
for (let i = 0; i < this.graphData.links.length; i++) {
const s = this.graphData.links[i];
(s.fromNode.id === t || s.toNode.id === n) && (this.graphData.links.splice(i, 1), i--)
}
}
focusRootNode() {
u("relation-graph:focusRootNode"), this.handleSelect(this.graphData.rootNode)
}
setNodePosition(t, n, i) {
t.x = n, t.y = i
}
focusNodeById(t) {
this.graphData.nodes.forEach(n => {
n.id === t && this.handleSelect(n)
})
}
querySearchAsync(t, n) {
if (u("fetch-suggestions", t), t = t.trim(), t === "") return;
const i = [];
this.graphData.nodes.forEach(s => {
u("fetch:", s.text), s.text.includes(t) && i.push(s)
}), u("fetched:", i.length), n(i)
}
handleSelect(t) {
u("checked:", t), scrollTo({
top: this.$dom.offsetTop
}), this.animateToZoom(100, 300, () => {
const n = t.width || 50,
i = t.height || 50,
s = t.x * -1 + this.options.viewSize.width / 2 - n / 2,
a = t.y * -1 + this.options.viewSize.height / 2 - i / 2;
this.animateGoto(s, a, 500, () => {
this.options.checkedNodeId = t.id, this.refreshNVAnalysisInfo()
})
})
}
}
class qe extends Xe {
constructor(t, n) {
super(t, n);
p(this, "$dom");
p(this, "$canvasDom")
}
setDom(t) {
this.$dom = t
}
setCanvasDom(t) {
this.$canvasDom = t
}
fullscreen(t) {
t === void 0 ? (this.options.fullscreen = !this.options.fullscreen, T.default.toggle(this.$dom)
.then(() => {
setTimeout(() => {
this.refreshNVAnalysisInfo()
}, 1e3)
})) : (this.options.fullscreen = t, setTimeout(() => {
this.refreshNVAnalysisInfo()
}, 1e3))
}
}
class Ke extends qe {
constructor(t, n) {
super(t, n);
p(this, "zoomCenter_of_newSize", {
x: 0,
y: 0
})
}
zoom(t, n) {
if (this.options.canvasZoom + t < 10) return;
const i = this.options.canvasZoom + t,
s = this.showZoomCenter(n, t);
this.options.canvasOffset.x += s.buff_x, this.options.canvasOffset.y += s.buff_y, this.options
.canvasZoom = i, this.refreshNVAnalysisInfo()
}
setZoom(t, n) {
const i = Math.floor(t - this.options.canvasZoom);
this.zoom(i)
}
showZoomCenter(t, n) {
if (!this.$dom) return;
const i = this.options.canvasZoom / 100,
s = (this.options.canvasZoom + n) / 100;
this.currentZoomSet = this.analysisByZoom(i, t), this.newZoomSet = this.analysisByZoom(s, t);
const a = s / i,
l = 0,
r = 0,
c = s / i,
d = 0,
f = 0;
this.zoomCenter_of_newSize.x = a * this.currentZoomSet.NMViewBuff.x + r * this.currentZoomSet
.NMViewBuff.y + d, this.zoomCenter_of_newSize.y = l * this.currentZoomSet.NMViewBuff.x + c *
this.currentZoomSet.NMViewBuff.y + f;
const h = this.currentZoomSet.NMViewBuff.x - this.zoomCenter_of_newSize.x,
g = this.currentZoomSet.NMViewBuff.y - this.zoomCenter_of_newSize.y;
this.zoomCenter_of_newSize.x += this.currentZoomSet.NMCanvasCenter.x, this.zoomCenter_of_newSize
.y += this.currentZoomSet.NMCanvasCenter.y;
let _ = this.currentZoomSet.NMCanvasStart.x - this.currentZoomSet.NMCanvasCenter.x,
w = this.currentZoomSet.NMCanvasStart.y - this.currentZoomSet.NMCanvasCenter.y,
C = a * _ + r * w + d,
M = l * _ + c * w + f;
return this.newZoomSet.NMCanvasStart.x = h + this.currentZoomSet.NMCanvasCenter.x + C, this
.newZoomSet.NMCanvasStart.y = h + this.currentZoomSet.NMCanvasCenter.y + M, _ = this
.currentZoomSet.NMCanvasEnd.x - this.currentZoomSet.NMCanvasCenter.x, w = this.currentZoomSet
.NMCanvasEnd.y - this.currentZoomSet.NMCanvasCenter.y, C = a * _ + r * w + d, M = l * _ + c *
w + f, this.newZoomSet.NMCanvasEnd.x = h + this.currentZoomSet.NMCanvasCenter.x + C, this
.newZoomSet.NMCanvasEnd.y = h + this.currentZoomSet.NMCanvasCenter.y + M, this.currentZoomSet
.NMCanvasOffsetBuff.x = h, this.currentZoomSet.NMCanvasOffsetBuff.y = g, {
buff_x: h,
buff_y: g
}
}
analysisByZoom(t, n) {
const i = {
NMViewPosition: {
x: 0,
y: 0
},
NMViewCenter: {
x: 0,
y: 0
},
NMCanvasCenter: {
x: 0,
y: 0
},
NMCanvasStart: {
x: 0,
y: 0
},
NMCanvasEnd: {
x: 0,
y: 0
},
NMZoomCenter: {
x: 0,
y: 0
},
NMViewBuff: {
x: 0,
y: 0
},
NMCanvasOffsetBuff: {
x: 0,
y: 0
},
NMCanvasSize: {
width: 0,
height: 0
}
},
s = Oe(),
a = Be(),
l = this.$dom.getBoundingClientRect();
i.NMViewPosition.x = l.left, i.NMViewPosition.y = l.top, l.width + i.NMViewPosition.x > s ? i
.NMViewCenter.x = (s - l.left) / 2 : i.NMViewCenter.x = l.width / 2, l.height + i.NMViewPosition
.y > a ? i.NMViewCenter.y = (a - l.top) / 2 : i.NMViewCenter.y = l.height / 2;
const r = this.options.canvasSize.width * t,
c = this.options.canvasSize.height * t;
i.NMCanvasCenter.x = this.options.canvasOffset.x + this.options.canvasSize.width / 2, i
.NMCanvasCenter.y = this.options.canvasOffset.y + this.options.canvasSize.height / 2, i
.NMCanvasStart.x = i.NMCanvasCenter.x - r / 2, i.NMCanvasStart.y = i.NMCanvasCenter.y - c / 2, i
.NMCanvasEnd.x = i.NMCanvasCenter.x + r / 2, i.NMCanvasEnd.y = i.NMCanvasCenter.y + c / 2, i
.NMZoomCenter.x = i.NMViewCenter.x, i.NMZoomCenter.y = i.NMViewCenter.y, n && (i.NMZoomCenter
.x = n.x - i.NMViewPosition.x, i.NMZoomCenter.y = n.y - i.NMViewPosition.y);
let d = i.NMViewCenter.x - i.NMCanvasCenter.x,
f = i.NMViewCenter.y - i.NMCanvasCenter.y;
return n && (d = i.NMZoomCenter.x - i.NMCanvasCenter.x, f = i.NMZoomCenter.y - i.NMCanvasCenter.y),
i.NMViewBuff.x = d, i.NMViewBuff.y = f, i.NMCanvasSize.width = r, i.NMCanvasSize.height = c, i
}
}
class Qe extends Ke {
constructor(o, t) {
super(o, t)
}
doLayout() {
if (!this.options.layouter) {
u("no layouter");
return
}
if (!this.graphData.rootNode) {
u("Cant find rootNode!");
return
}
u("node size\uFF1A", this.graphData.nodes.length), this.options.layouter.placeNodes(this.graphData
.nodes, this.graphData.rootNode, this.graphSetting)
}
refresh(o) {
this.resetViewSize(), this.options.layouter.refresh(), this.playShowEffect(o)
}
resetViewSize() {
!this.options || (u("resetViewSize"), this.options.viewSize.width = this.$dom
.getBoundingClientRect().width, this.options.viewSize.height = this.$dom
.getBoundingClientRect().height, this.options.canvasZoom = 100, this.options.canvasOffset
.x = this.options.viewNVInfo.width / 2, this.options.canvasOffset.y = this.options
.viewNVInfo.height / 2, this.refreshNVAnalysisInfo())
}
dataUpdated() {
this.zoom(1), this.zoom(-1)
}
refreshNVAnalysisInfo() {
if (!this.$dom) {
console.error("cannot get view size !");
return
}
const o = {
NMCanvasCenter: {
x: 0,
y: 0
}
},
t = this.$dom.getBoundingClientRect();
this.options.viewNVInfo.x = t.left, this.options.viewNVInfo.y = t.top, this.options.viewNVInfo
.width = t.width, this.options.viewNVInfo.height = t.height;
const n = this.options.canvasSize.width * (this.options.canvasZoom / 100),
i = this.options.canvasSize.height * (this.options.canvasZoom / 100);
o.NMCanvasCenter.x = this.options.canvasOffset.x + this.options.canvasSize.width / 2, o
.NMCanvasCenter.y = this.options.canvasOffset.y + this.options.canvasSize.height / 2, this
.options.canvasNVInfo.x = o.NMCanvasCenter.x - n / 2, this.options.canvasNVInfo.y = o
.NMCanvasCenter.y - i / 2, this.options.canvasNVInfo.width = n, this.options.canvasNVInfo
.height = i, this.options.viewELSize.width = t.width, this.options.viewELSize.height = t.height,
this.options.viewELSize.left = t.left, this.options.viewELSize.top = t.top
}
getStuffSize() {
let o = 9999999,
t = 9999999,
n = 0,
i = 0;
this.graphData.nodes.forEach(r => {
r.x < o && (o = r.x), r.x > n && (n = r.x + r.el.offsetWidth), r.y < t && (t = r.y), r
.y > i && (i = r.y + r.el.offsetHeight)
});
const s = 100,
a = n - o + s,
l = i - t + s;
return {
width: a,
height: l,
minX: o,
maxX: n,
minY: t,
maxY: i
}
}
getNodesCenter() {
const o = this.getStuffSize();
u("getStuffSize:", o);
const t = o.minX + (o.width - 100) / 2,
n = o.minY + (o.height - 100) / 2;
return {
x: t,
y: n
}
}
setCanvasCenter(o, t) {
const n = this.options.viewSize.width / 2,
i = this.options.viewSize.height / 2;
this.setCanvasOffset(n - o, i - t)
}
setCanvasOffset(o, t) {
this.options.canvasOffset.x = o, this.options.canvasOffset.y = t
}
playShowEffect(o) {
if (this.graphData.nodes.length === 0) {
u("relation-graph:move to center: data not ready!");
return
}
if (u("playShowEffect:", this.options.moveToCenterWhenRefresh, this.options.zoomToFitWhenRefresh),
this.options.moveToCenterWhenRefresh)
if (this.options.useAnimationWhenRefresh) {
const t = this.getNodesCenter();
u("center:", t.x, t.y);
const n = this.options.viewSize.width / 2 - t.x,
i = this.options.viewSize.height / 2 - t.y;
this.animateGoto(n, i, 500, () => {
this.zoomToFitWhenRefresh(o)
})
} else {
const t = this.getNodesCenter();
this.setCanvasCenter(t.x, t.y), this.zoomToFitWhenRefresh(o)
}
else this.zoomToFitWhenRefresh(o);
if (Number.isNaN(this.graphData.rootNode.x)) {
u("rootNode.x is NaN, graph is currently hidden?");
return
}
this.options.placeSingleNode && this.options.layoutName !== "fixed" && this.placeSingleNode()
}
zoomToFitWhenRefresh(o) {
this.options.zoomToFitWhenRefresh ? this.zoomToFit(o) : o && o()
}
findChilds(o, t) {
t.push(o), o.targetNodes.forEach(n => {
t.includes(n) || this.findChilds(n, t)
})
}
placeSingleNode() {
const o = [];
this.findChilds(this.graphData.rootNode, o);
const t = [];
if (this.graphData.nodes.forEach(n => {
o.includes(n) || n.targetNodes && n.targetNodes.length === 0 && n.fixed !== !0 && (n.x =
Math.floor(Math.random() * 200) - 100, n.y = Math.floor(Math.random() * 200) -
100, n.lot || (n.lot = {
childs: []
}), n.lot.placed = !0, t.push(n))
}), t.length > 0) {
u("sigle nodes:", t.length);
const n = new Q({}, {});
n.__origin_nodes = this.graphData.nodes, n.justLayoutSingleNode = !0, n.maxLayoutTimes = 100, n
.byLine = !1, n.autoLayout()
}
}
zoomToFit(o) {
const t = this.getStuffSize(),
n = this.options.viewSize.width / t.width,
i = this.options.viewSize.height / t.height,
s = Math.min(n, i, 1);
u("animateToZoom:", {
stuffSize: t,
zoomPercent: s,
zoomPercentX: n,
zoomPercentY: i,
viewSize: this.options.viewSize
}), this.options.useAnimationWhenRefresh ? this.animateToZoom(s * 100, 300, o) : (this.setZoom(
s * 100, 300), o && o())
}
animateGoto(o, t, n, i) {
u("animateGoto:", o, t);
const s = o - this.options.canvasOffset.x,
a = t - this.options.canvasOffset.y,
l = n,
r = 5,
c = Math.round(s / r),
d = Math.round(a / r),
f = l / r;
this.animateStepAction(0, f, r, () => {
this.options.canvasOffset.x += c, this.options.canvasOffset.y += d
}, () => {
i && i()
})
}
animateToZoom(o, t, n) {
const i = o - this.options.canvasZoom,
s = t,
a = 5,
l = Math.round(i / a),
r = s / a;
u("animateToZoom:", i, l), this.animateStepAction(0, r, a, () => {
this.zoom(l)
}, () => {
this.setZoom(o), n && n()
})
}
animateStepAction(o, t, n, i, s) {
o < n ? (i(o, n), setTimeout(() => {
this.animateStepAction(o + 1, t, n, i, s)
}, t)) : s()
}
startAutoLayout() {
this.options.autoLayouting = !this.options.autoLayouting, this.options.autoLayouting ? this.options
.layouter.autoLayout ? this.options.layouter.autoLayout(!0) : console.log(
"\u5F53\u524D\u5E03\u5C40\u4E0D\u652F\u6301\u81EA\u52A8\u5E03\u5C40\uFF01") : this.options
.layouter.stop ? this.options.layouter.stop() : console.log(
"\u5F53\u524D\u5E03\u5C40\u4E0D\u652F\u6301\u81EA\u52A8\u5E03\u5C40stop\uFF01")
}
stopAutoLayout() {
this.options.autoLayouting = !1, this.options.layouter.stop ? this.options.layouter.stop() : console
.log("\u5F53\u524D\u5E03\u5C40\u4E0D\u652F\u6301\u81EA\u52A8\u5E03\u5C40stop\uFF01")
}
}
class et extends Qe {
constructor(o, t) {
super(o, t)
}
setDefaultLineShape(o) {
this.options.defaultLineShape = o
}
setDefaultJunctionPoint(o) {
this.options.defaultJunctionPoint = o
}
setCheckedNode(o) {
this.options.checkedNodeId = o
}
setCheckedLine(o) {
this.options.checkedLineId = o
}
selectNode(o, t) {
o.selected = t
}
updateNodeOffsetSize(o, t, n) {
o.el.offsetWidth = t, o.el.offsetHeight = n
}
onNodeClick(o, t) {
u("onNodeClick:", o), this.options.disableNodeClickEffect !== !0 && o.disableDefaultClickEffect !==
!0 && this.setCheckedNode(o.id), this.listeners.onNodeClick && this.listeners.onNodeClick(o, t)
}
onLineClick(o, t, n) {
u("onLineClick:", "line:", o, "link:", t), this.options.disableLineClickEffect !== !0 && o
.disableDefaultClickEffect !== !0 && (this.setCheckedLine(t.seeks_id), this.selectNode(t
.fromNode, !0), this.selectNode(t.toNode, !0), setTimeout(() => {
this.selectNode(t.fromNode, !1), this.selectNode(t.toNode, !1)
}, 2e3)), this.listeners.onLineClick && this.listeners.onLineClick(o, t, n)
}
expandOrCollapseNode(o, t) {
o.expanded === !1 ? this.expandNode(o, t) : this.collapseNode(o, t)
}
expandNode(o, t) {
u("onNodeExpand:", o), o.expanded = !0, o.lot.childs.forEach(n => {
n.isShow = !0
}), this.listeners.onNodeExpand && this.listeners.onNodeExpand(o, t)
}
collapseNode(o, t) {
u("onNodeCollapse:", o), o.expanded = !1, o.lot.childs.forEach(n => {
n.isShow = !1
}), this.listeners.onNodeCollapse && this.listeners.onNodeCollapse(o, t)
}
}
class tt extends et {
constructor(o, t) {
super(o, t)
}
dataURLToBlob(o) {
const t = o.split(","),
n = t[0].match(/:(.*?);/)[1],
i = atob(t[1]);
let s = i.length;
const a = new Uint8Array(s);
for (; s--;) a[s] = i.charCodeAt(s);
return new Blob([a], {
type: n
})
}
downloadAsImage(o, t) {
if (this.listeners.onImageDownload && this.listeners.onImageDownload(this.$canvasDom) === !1)
return;
if (this.graphData.nodes.length === 0) throw new Error(
"\u6CA1\u6709\u8282\u70B9\uFF0C\u6CA1\u6709\u5185\u5BB9\u9700\u8981\u5BFC\u51FA\uFF01");
o || (o = "png"), t || (t = this.options.downloadImageFileName), t || (t =
`SeeksRelationGraph-${(Math.random()*1e5).toFixed(0)}`), this.options.checkedNodeId = "";
const n = this.options.canvasZoom;
this.options.canvasZoom = 100;
const i = this.$canvasDom,
s = i.clientWidth,
a = i.clientHeight;
let l = 999999,
r = 999999,
c = 0,
d = 0;
const f = 100;
this.graphData.nodes.forEach(m => {
m.x < l && (l = m.x), m.x > c && (c = m.x + m.el.offsetWidth), m.y < r && (r = m.y), m
.y > d && (d = m.y + m.el.offsetHeight)
});
const h = l - f,
g = r - f;
this.graphData.nodes.forEach(m => {
m.x = m.x - h, m.y = m.y - g
});
const _ = this.options.canvasOffset.x,
w = this.options.canvasOffset.y;
this.options.canvasOffset.x = f * -1, this.options.canvasOffset.y = f * -1, u("offset:", {
_origin_offset_x: _,
_origin_offset_y: w,
_min_x: l,
_min_y: r,
_max_x: c,
_max_y: d
});
const C = c - l + 200 + f * 2,
M = d - r + 100 + f * 2,
z = window.devicePixelRatio;
this.options.canvasSize.width = C * z, this.options.canvasSize.height = M * z;
const P = {
left: this.$dom.offsetLeft - i.getBoundingClientRect().left,
top: this.$dom.offsetTop - i.getBoundingClientRect().top,
canvas_offsetLeft: i.offsetLeft,
canvas_offsetTop: i.offsetTop,
canvas_left: i.getBoundingClientRect().left,
canvas_top: i.getBoundingClientRect().top
};
window.scrollTo(0, 0), u("export image:", {
relationGraphPosition: P,
orign_width: s,
orign_height: a,
_image_width: C,
_image_height: M,
_min_x: l,
_min_y: r,
_max_x: c,
_max_y: d,
devicePixelRatio: window.devicePixelRatio
});
const y = document.createElement("canvas");
y.width = C * z, y.height = M * z, y.style.backgroundColor = getComputedStyle(i.parentElement, null)
.backgroundColor, u("canvas.style.backgroundColor:", y.style.backgroundColor), y.style.width =
`${C*z}px`, y.style.height = `${M*z}px`, y.getContext("2d").scale(1, 1);
const E = {
backgroundColor: y.style.backgroundColor,
scale: z,
canvas: y,
logging: !0,
width: C,
height: M,
useCORS: !0
};
setTimeout(() => {
this.createImage(i, E, o, t, m => {
u("downloadImageAsFile:", E, o, t), this.listeners.onImageSaveAsFile ? this
.listeners.onImageSaveAsFile(m, o, t) : this.downloadImageAsFile(m, o,
t), this.options.canvasSize.width = s, this.options.canvasSize
.height = a, this.options.canvasOffset.x = _, this.options.canvasOffset
.y = w, this.options.canvasZoom = n, this.graphData.nodes.forEach(G => {
G.x = G.x + h, G.y = G.y + g
})
})
}, 1e3)
}
createImage(o, t, n, i, s) {
u("createImage:", t), se.default(o, t).then(a => {
s && s(a)
})
}
downloadImageAsFile(o, t, n) {
const i = document.body.appendChild(o);
i.style.display = "none";
const s = this.dataURLToBlob(i.toDataURL(`image/${t}`));
document.body.removeChild(i);
const a = document.createElement("a");
a.style.display = "none";
try {
window.navigator.msSaveOrOpenBlob ? window.navigator.msSaveOrOpenBlob(s, `${n}.${t}`) : (a
.setAttribute("href", URL.createObjectURL(s)), a.setAttribute("download", `${n}.${t}`),
document.body.appendChild(a), a.click(), u("click ok!"), URL.revokeObjectURL(s), u(
"revokeObjectURL ok!"), document.body.removeChild(a), u("removeChild ok!"))
} catch (l) {
u("[SEEKS Graph]Create and download image error:", l)
}
}
}
class ot extends tt {
constructor(o, t) {
super(o, t)
}
createReturnValue(o, t) {
return {
path: o,
textPosition: t
}
}
createLinePath(o, t, n) {
const i = o.fromNode,
s = o.toNode;
n || (n = 0);
const a = t.lineShape || this.options.defaultLineShape || 1,
l = t.lineDirection || this.options.layoutDirection || "h";
let r = i.x,
c = i.y,
d = s.x,
f = s.y;
const h = {
x: 0,
y: 0,
rotate: 0
};
if (Number.isNaN(r) || Number.isNaN(c)) return u("error start node:", i), h.x = 50, h.y = 50, h
.rotate = 0, this.createReturnValue("M 0 0 L 100 100", h);
if (Number.isNaN(d) || Number.isNaN(f)) return u("error start point:", i), h.x = 50, h.y = 50, h
.rotate = 0, this.createReturnValue("M 0 0 L 100 100", h);
let g = i.el.offsetWidth || i.width || 60,
_ = i.el.offsetHeight || i.height || 60;
if (Number.isNaN(g) || Number.isNaN(_)) return h.x = 50, h.y = 50, h.rotate = 0, this
.createReturnValue("M 0 0 L 100 100", h);
let w = s.el.offsetWidth || s.width || 60,
C = s.el.offsetHeight || s.height || 60;
if (Number.isNaN(w) || Number.isNaN(C)) return h.x = 50, h.y = 50, h.rotate = 0, this
.createReturnValue("M 0 0 L 100 100", h);
t.isReverse && ([r, c, d, f, g, _, w, C] = [d, f, r, c, w, C, g, _]);
const M = [r, c, d, f, g, _, w, C, this.options.defaultNodeShape, t.isReverse, o.relations.length,
n],
z = [d, f, r, c, w, C, g, _, this.options.defaultNodeShape, !t.isReverse, o.relations.length,
n];
let P, y, E = this.options.defaultJunctionPoint;
if (E || (E = V.border), E === V.border ? (P = x.getBorderPoint4MultiLine(...M), y = x
.getBorderPoint4MultiLine(...z)) : E === V.ltrb ? (P = x.getRectJoinPoint(...M), y = x
.getRectJoinPoint(...z)) : E === V.tb ? (P = x.getRectVJoinPoint(...M), y = x
.getRectVJoinPoint(...z)) : E === V.lr && (P = x.getRectHJoinPoint(...M), y = x
.getRectHJoinPoint(...z)), !P || !y) return this.createReturnValue(
"Can not create start and end!", h);
const m = P.x,
G = P.y,
j = y.x,
ne = y.y;
if (Number.isNaN(m) || Number.isNaN(G)) return console.error("error start point:", i), h.x = 50, h
.y = 50, h.rotate = 0, this.createReturnValue("M 0 0 L 100 100", h);
if (Number.isNaN(j) || Number.isNaN(ne)) return console.error("error end point:", s), h.x = 50, h
.y = 50, h.rotate = 0, this.createReturnValue("M 0 0 L 100 100", h);
let b = y.x - P.x,
v = y.y - P.y,
N = y.x > P.x ? 1 : -1;
l === "v" && (N = y.y > P.y ? 1 : -1);
let R = "";
if (a === 4) {
const L = 60 / (o.relations.length + 1) * (n + 1) - 30;
l === "v" ? (v = v - (N * 33 + L), h.x = m + b + 5, h.y = G + N * 40 + L, h.rotate = 90, R =
`M ${m} ${G} v${N*33+L} h${b+L} v${v}`) : t.reverseText === !0 ? (h.x = m + N * 10 - (
N < 0 ? 30 : 0), h.y = G - 5, b = b - N * 120, R =
`M ${m} ${G} h${N*120} v${v} h${b}`) : (h.x = m + N * 50 - (N < 0 ? 30 : 0), h.y = G +
v - 5 + L, b = b - (N * 33 + L), v = v + N * L, R = `M ${m} ${G} h${N*33+L} v${v} h${b}`
)
} else if (a === 2) {
const L = y.y > P.y ? 1 : -1,
W = Math.abs(b) + Math.abs(v);
h.x = Math.round(y.x - b / W * 60 - 20), h.y = Math.round(y.y - v / W * 60 - 20 * L);
const Z = 1 / (o.relations.length + 1) * (n + 1) - .5 + .5;
l === "v" ? R = `M${m},${G} c${0},${N*30} ${b*Z},${N*-10} ${b},${v}` : R =
`M${m},${G} c${N*30},${0} ${N*-10},${v*Z} ${b},${v}`
} else if (a === 6) {
const L = y.y > P.y ? 1 : -1,
W = Math.abs(b) + Math.abs(v);
h.x = Math.round(y.x - b / W * 60 - 20), h.y = Math.round(y.y - v / W * 60 - 20 * L), l ===
"v" ? R = `M${m},${G} c${0},${v/2} ${b},${v/2} ${b},${v}` : R =
`M${m},${G} c${b/2},${0} ${b/2},${v} ${b},${v}`
} else if (a === 3) {
h.x = y.x - N * 63, h.y = y.y + 3;
const L = 1 / (o.relations.length + 1) * (n + 1) - .5 + .5;
l === "v" ? R = `M${m},${G} c${0},${v*L} ${0},${0} ${b},${v}` : R =
`M${m},${G} c${N*30},${0} ${N*-10},${v*L} ${b},${v}`
} else if (a === 5) {
h.x = y.x - N * 63, h.y = y.y + 3;
const L = 1 / (o.relations.length + 1) * (n + 1) - .5 + .5;
l === "v" ? R = `M${m},${G} c${0},${0} ${0},${v*L} ${b},${v}` : R =
`M${m},${G} c${0},${0} ${b*L},${0} ${b},${v}`
} else {
const L = x.getAngleType(b, v);
h.rotate = x.getTextAngle(m, G, j, ne);
const W = L === 2 || L === 4 ? -1 : 1,
Z = (v === 0 ? -50 : Math.sin(Math.atan(b / v)) * 10 / Math.sin(90)) * W,
co = b === 0 ? -50 : Math.sin(Math.atan(v / b)) * 10 / Math.sin(90);
h.x = Math.round(P.x + b / 2 - Z), h.y = Math.round(P.y + v / 2 - co), Number.isNaN(h.rotate) &&
(h.rotate = 0), R = `M ${m} ${G} L ${j} ${ne}`
}
return this.createReturnValue(R, h)
}
getTextTransform(o, t, n, i) {
if (Number.isNaN(t) || Number.isNaN(n)) return "translate(0,0)";
const s = o.lineShape === void 0 ? this.options.defaultLineShape : o.lineShape;
return s === 1 || s === 4 ? `translate(${t},${n})rotate(${i||0})` : `translate(${t},${n})`
}
getArrow(o, t, n) {
const i = t.seeks_id === this.options.checkedLineId;
return o.isHideArrow ? "none" : `url('#${this.getLineArrow(o.color,n,i)}')`
}
}
class me extends ot {
constructor(o, t) {
super(o, t)
}
}
var nt = function() {
var e = this,
o = e.$createElement,
t = e._self._c || o;
return t("div", {
directives: [{
name: "show",
rawName: "v-show",
value: e.isAllowShowNode(e.nodeProps),
expression: "isAllowShowNode(nodeProps)"
}],
ref: "seeksRGNode",
staticClass: "rel-node-peel",
style: {
left: e.nodeProps.x + "px",
top: e.nodeProps.y + "px",
opacity: e.nodeProps.opacity > 1 ? e.nodeProps.opacity / 100 : e.nodeProps.opacity
}
}, [e.nodeProps.expandHolderPosition && e.nodeProps.expandHolderPosition !== "hide" || e
.relationGraph.options.defaultExpandHolderPosition && e.relationGraph.options
.defaultExpandHolderPosition !== "hide" && e.nodeProps.lot.childs && e.nodeProps.lot.childs
.length > 0 ? t("div", {
staticClass: "c-btn-open-close",
class: ["c-expand-positon-" + (e.nodeProps.expandHolderPosition || e.relationGraph
.options.defaultExpandHolderPosition)]
}, [t("span", {
class: e.expandButtonClass,
style: {
"background-color": e.nodeProps.color || e.relationGraph.options
.defaultNodeColor
},
on: {
click: function(n) {
return n.stopPropagation(), e.expandOrCollapseNode.apply(null,
arguments)
}
}
})]) : e._e(), e.nodeProps.html ? t("div", {
domProps: {
innerHTML: e._s(e.nodeProps.html)
},
on: {
click: function(n) {
return n.stopPropagation(), e.onclick(n)
},
mousedown: function(n) {
return !n.type.indexOf("key") && e._k(n.keyCode, "left", 37, n.key, [
"Left", "ArrowLeft"
]) || "button" in n && n.button !== 0 ? null : (n.stopPropagation(),
e.onDragStart(n))
},
touchstart: function(n) {
return n.stopPropagation(), e.onDragStart(n)
},
mouseover: function(n) {
return n.stopPropagation(), e.onMouseHover(n)
},
mouseout: function(n) {
return n.stopPropagation(), e.onMouseOut(n)
}
}
}) : t("div", {
staticClass: "rel-node",
class: ["rel-node-shape-" + (e.nodeProps.nodeShape === void 0 ? e.relationGraph
.options.defaultNodeShape : e.nodeProps.nodeShape), "rel-node-type-" + e
.nodeProps.type, e.nodeProps.id === e.relationGraph.options.checkedNodeId ?
"rel-node-checked" : "", e.nodeProps.selected ? "rel-node-selected" : "", e
.nodeProps.styleClass, e.hovering ? "rel-node-hover" : "", e.nodeProps
.innerHTML ? "rel-diy-node" : ""
],
style: {
"background-color": e.nodeProps.color === void 0 ? e.relationGraph.options
.defaultNodeColor : e.nodeProps.color,
color: e.nodeProps.fontColor === void 0 ? e.relationGraph.options
.defaultNodeFontColor : e.nodeProps.fontColor,
border: (e.nodeProps.borderColor || e.relationGraph.options
.defaultNodeBorderColor) + " solid " + (e.nodeProps.borderWidth || e
.relationGraph.options.defaultNodeBorderWidth) + "px",
width: (e.nodeProps.width || e.relationGraph.options.defaultNodeWidth) + "px",
height: (e.nodeProps.height || e.relationGraph.options.defaultNodeHeight) + "px"
},
on: {
click: function(n) {
return n.stopPropagation(), e.onclick(n)
},
mousedown: function(n) {
return !n.type.indexOf("key") && e._k(n.keyCode, "left", 37, n.key, [
"Left", "ArrowLeft"
]) || "button" in n && n.button !== 0 ? null : (n.stopPropagation(),
e.onDragStart(n))
},
touchstart: function(n) {
return n.stopPropagation(), e.onDragStart(n)
},
mouseover: function(n) {
return n.stopPropagation(), e.onMouseHover(n)
},
mouseout: function(n) {
return n.stopPropagation(), e.onMouseOut(n)
}
}
}, [e.relationGraph.options.hideNodeContentByZoom === !0 && e.relationGraph.options
.canvasZoom < 40 ? e._e() : [e._t("node", function() {
return [e.nodeProps.innerHTML ? t("div", {
domProps: {
innerHTML: e._s(e.nodeProps.innerHTML)
}
}) : t("div", {
staticClass: "c-node-text",
style: {
color: e.nodeProps.fontColor || e.relationGraph
.options.defaultNodeFontColor
}
}, [t("span", {
domProps: {
innerHTML: e._s(e.nodeProps.text)
}
})])]
}, {
node: e.nodeProps
})]
], 2)
])
},
it = [];
const xo = "";
function I(e, o, t, n, i, s, a, l) {
var r = typeof e == "function" ? e.options : e;
o && (r.render = o, r.staticRenderFns = t, r._compiled = !0), n && (r.functional = !0), s && (r._scopeId =
"data-v-" + s);
var c;
if (a ? (c = function(h) {
h = h || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this
.parent.$vnode.ssrContext, !h && typeof __VUE_SSR_CONTEXT__ != "undefined" && (h =
__VUE_SSR_CONTEXT__), i && i.call(this, h), h && h._registeredComponents && h
._registeredComponents.add(a)
}, r._ssrRegister = c) : i && (c = l ? function() {
i.call(this, (r.functional ? this.parent : this).$root.$options.shadowRoot)
} : i), c)
if (r.functional) {
r._injectStyles = c;
var d = r.render;
r.render = function(g, _) {
return c.call(_), d(g, _)
}
} else {
var f = r.beforeCreate;
r.beforeCreate = f ? [].concat(f, c) : [c]
} return {
exports: e,
options: r
}
}
const st = {
name: "SeeksRGNode",
props: {
relationGraph: {
mustUseProp: !0,
default: () => ({}),
type: Object
},
nodeProps: {
mustUseProp: !0,
default: () => ({}),
type: Object
}
},
data() {
return {
hovering: !1,
borderColor: "",
dragging: !1
}
},
computed: {
expandButtonClass() {
return this.nodeProps.expanded === !1 ? "c-expanded" : "c-collapsed"
}
},
created() {},
mounted() {
this.refreshNodeProperties()
},
updated() {
this.refreshNodeProperties()
},
beforeDestroy() {
this.$refs.seeksRGNode.remove()
},
methods: {
refreshNodeProperties() {
(this.nodeProps.el.offsetWidth !== this.$refs.seeksRGNode.offsetWidth || this.nodeProps.el
.offsetHeight !== this.$refs.seeksRGNode.offsetHeight) && this.relationGraph
.updateNodeOffsetSize(this.nodeProps, this.$refs.seeksRGNode.offsetWidth, this.$refs
.seeksRGNode.offsetHeight)
},
expandOrCollapseNode(e) {
this.relationGraph.expandOrCollapseNode(this.nodeProps, e)
},
onDragStart(e) {
this.relationGraph.options.disableDragNode || this.nodeProps.disableDrag || (this.dragging = !0,
this.hovering = !1, A.startDrag(e, this.nodeProps, this.onNodeDraged, (o, t, n) => {
const i = o / (this.relationGraph.options.canvasZoom / 100) + n.x,
s = t / (this.relationGraph.options.canvasZoom / 100) + n.y;
this.relationGraph.setNodePosition(this.nodeProps, i, s)
}))
},
onNodeDraged(e, o, t) {
if (e === 0 && o === 0) {
this.relationGraph.onNodeClick(this.nodeProps, t);
return
}
this.relationGraph.options.isMoveByParentNode && this.nodeProps.lot.childs.forEach(n => {
n.x += e, n.y += o
}), Math.abs(e) + Math.abs(o) > 6 ? setTimeout(() => {
u("delay end dragging", this.dragging), this.dragging = !1
}, 100) : this.dragging = !1
},
onMouseHover() {
this.dragging || this.relationGraph.options.disableNodeClickEffect !== !0 && this.nodeProps
.disableDefaultClickEffect !== !0 && (this.hovering = !0)
},
onMouseOut() {
this.relationGraph.options.disableNodeClickEffect !== !0 && this.nodeProps
.disableDefaultClickEffect !== !0 && (this.hovering = !1)
},
onclick(e) {
this.dragging || this.relationGraph.onNodeClick(this.nodeProps, e)
},
isAllowShowNode(e) {
return e.isShow !== !1 && e.isHide !== !0 && (!e.lot.parent || this.isAllowShowNode(e.lot
.parent) === !0)
}
}
},
ge = {};
var at = I(st, nt, it, !1, rt, null, null, null);
function rt(e) {
for (let o in ge) this[o] = ge[o]
}
const lt = function() {
return at.exports
}();
var ct = function() {
var e = this,
o = e.$createElement,
t = e._self._c || o;
return t("g", [t("path", {
class: ["c-rg-line", e.relation.styleClass, e.checked ? "c-rg-line-checked" : ""],
style: {
opacity: e.relation.opacity,
"stroke-width": (e.relation.lineWidth ? e.relation.lineWidth : e.relationGraph
.options.defaultLineWidth) + "px"
},
attrs: {
d: e.pathData,
stroke: e.checked ? e.relationGraph.options.checkedLineColor : e.relation
.color ? e.relation.color : e.relationGraph.options.defaultLineColor,
"marker-start": e.relation.showStartArrow && e.relationGraph.getArrow(e
.relation, e.link, !0),
"marker-end": e.relation.showEndArrow && e.relationGraph.getArrow(e.relation, e
.link, !1),
fill: "none"
},
on: {
click: function(n) {
return e.onClick(e.relation, n)
}
}
}), e.relationGraph.options.defaultShowLineLabel && e.relationGraph.options.canvasZoom >
40 ? t("g", {
attrs: {
transform: e.textTransform
}
}, [t("text", {
key: "t-" + e.relation.seeks_id,
staticClass: "c-rg-line-text",
style: {
opacity: e.relation.opacity,
fill: e.checked ? e.relationGraph.options.checkedLineColor : e.relation
.fontColor ? e.relation.fontColor : e.relation.color ? e.relation
.color : void 0
},
attrs: {
x: 0,
y: 0
},
on: {
click: function(n) {
return e.onClick(e.relation, n)
}
}
}, [e._v(" " + e._s(e.relation.text) + " ")])]) : e._e()
])
},
ht = [];
const vo = "",
dt = {
name: "SeeksRGLine",
props: {
relationGraph: {
mustUseProp: !0,
default: () => ({}),
type: Object
},
link: {
mustUseProp: !0,
default: () => ({}),
type: Object
},
relation: {
mustUseProp: !0,
default: () => ({}),
type: Object
},
relationIndex: {
mustUseProp: !0,
default: () => 0,
type: Number
}
},
data() {
return {
is_flashing: !1
}
},
computed: {
checked() {
return this.link.seeks_id === this.relationGraph.options.checkedLineId
},
pathData() {
const {
path: e,
textPosition: o
} = this.relationGraph.createLinePath(this.link, this.relation, this.relationIndex);
return e
},
textTransform() {
const {
path: e,
textPosition: o
} = this.relationGraph.createLinePath(this.link, this.relation, this.relationIndex);
return this.relationGraph.getTextTransform(this.relation, o.x, o.y, o.rotate)
}
},
show() {
this.isShow = !0
},
watch: {},
methods: {
onClick(e, o) {
this.relationGraph.onLineClick(e, this.link, o)
},
isAllowShowNode(e) {
return e.isShow !== !1 && e.isHide !== !0 && (!e.lot.parent || this.isAllowShowNode(e.lot
.parent, !1) === !0)
}
}
},
ye = {};
var ft = I(dt, ct, ht, !1, ut, "502a344c", null, null);
function ut(e) {
for (let o in ye) this[o] = ye[o]
}
const pt = function() {
return ft.exports
}();
var _t = function() {
var e = this,
o = e.$createElement,
t = e._self._c || o;
return t("g", [t("use", {
class: ["c-rg-line", e.checked ? "c-rg-line-checked" : ""],
attrs: {
"xlink:href": "#" + e.relationGraph.options.instanceId + "-" + e.link.seeks_id +
"-" + e.relationIndex
},
on: {
click: function(n) {
return e.onClick(e.relation, n)
}
}
}), t("text", {
staticClass: "c-rg-line-text",
style: {
opacity: e.relation.opacity,
fill: e.checked ? e.relationGraph.options.checkedLineColor : e.relation
.fontColor ? e.relation.fontColor : e.relation.color ? e.relation.color :
void 0
},
attrs: {
x: e.textOffset,
y: "0"
},
on: {
click: function(n) {
return e.onClick(e.relation, n)
}
}
}, [t("textPath", {
attrs: {
"xlink:href": "#" + e.relationGraph.options.instanceId + "-" + e.link
.seeks_id + "-" + e.relationIndex,
startOffset: "0",
"text-anchor": "start",
method: "align",
spacing: "auto"
}
}, [e._v(" " + e._s(e.relation.text) + " ")])])])
},
mt = [];
const wo = "",
gt = {
name: "SeeksRGLine",
props: {
relationGraph: {
mustUseProp: !0,
default: () => ({}),
type: Object
},
link: {
mustUseProp: !0,
default: () => ({}),
type: Object
},
relation: {
mustUseProp: !0,
default: () => ({}),
type: Object
},
relationIndex: {
mustUseProp: !0,
default: () => 0,
type: Number
}
},
computed: {
checked() {
return this.link.seeks_id === this.relationGraph.options.checkedLineId
},
textOffset() {
const e = Fe(this.relation.text) * 10;
return (He(this.link.fromNode.x, this.link.fromNode.y, this.link.toNode.x, this.link.toNode.y) -
e) / 2
}
},
data() {
return {
is_flashing: !1
}
},
show() {
this.isShow = !0
},
watch: {},
mounted() {},
methods: {
onClick(e, o) {
this.relationGraph.onLineClick(e, this.link, o)
},
isAllowShowNode(e) {
return e.isShow !== !1 && e.isHide !== !0 && (!e.lot.parent || this.isAllowShowNode(e.lot
.parent, !1) === !0)
},
flash() {}
}
},
xe = {};
var yt = I(gt, _t, mt, !1, xt, "5924ca84", null, null);
function xt(e) {
for (let o in xe) this[o] = xe[o]
}
const vt = function() {
return yt.exports
}();
var wt = function() {
var e = this,
o = e.$createElement,
t = e._self._c || o;
return e.linkProps.isHide !== !0 && e.isAllowShowNode(e.linkProps.fromNode) && e.isAllowShowNode(e
.linkProps.toNode) ? t("g", {
ref: "seeksRGLink",
class: [e.relationGraph.options.checkedLineId == e.linkProps.seeks_id ?
"c-rg-link-checked" : ""
],
attrs: {
transform: "translate(0,0)"
}
}, [e._l(e.linkProps.relations, function(n, i) {
return [e._t("line", function() {
return [(e.relationGraph.options.lineUseTextPath || n
.useTextPath) && n.isHide === !1 ? t("RGLineTextByPath", {
key: "l-" + n.id,
attrs: {
"relation-graph": e.relationGraph,
link: e.linkProps,
relation: n,
"relation-index": i
}
}) : n.isHide === !1 ? t("RGLineSmart", {
key: "l-" + n.id,
attrs: {
"relation-graph": e.relationGraph,
link: e.linkProps,
relation: n,
"relation-index": i
}
}) : e._e()
]
}, {
line: n,
relationIndex: i
})]
})], 2) : e._e()
},
bt = [];
const bo = "",
Ct = {
name: "SeeksRGLink",
components: {
RGLineSmart: pt,
RGLineTextByPath: vt
},
props: {
relationGraph: {
mustUseProp: !0,
default: () => ({}),
type: Object
},
linkProps: {
mustUseProp: !0,
default: () => ({}),
type: Object
}
},
data() {
return {
is_flashing: !1
}
},
show() {
this.isShow = !0
},
watch: {},
mounted() {},
methods: {
onClick(e, o) {
this.relationGraph.onLineClick(e, this.linkProps, o)
},
isAllowShowNode(e) {
return e.isShow !== !1 && e.isHide !== !0 && (!e.lot.parent || this.isAllowShowNode(e.lot
.parent) === !0)
},
flash() {}
}
},
ve = {};
var kt = I(Ct, wt, bt, !1, Gt, "420b4e08", null, null);
function Gt(e) {
for (let o in ve) this[o] = ve[o]
}
const Mt = function() {
return kt.exports
}();
var St = function() {
var e = this,
o = e.$createElement,
t = e._self._c || o;
return t("path", {
class: [e.relation.styleClass, e.checked ? "c-rg-line-checked" : ""],
style: {
opacity: e.relation.opacity,
"stroke-width": (e.relation.lineWidth ? e.relation.lineWidth : e.relationGraph.options
.defaultLineWidth) + "px"
},
attrs: {
id: e.relationGraph.options.instanceId + "-" + e.link.seeks_id + "-" + e.relationIndex,
d: e.pathData,
stroke: e.checked ? e.relationGraph.options.checkedLineColor : e.relation.color ? e
.relation.color : e.relationGraph.options.defaultLineColor,
"marker-start": e.relation.showStartArrow && e.relationGraph.getArrow(e.relation, e
.link, !0),
"marker-end": e.relation.showEndArrow && e.relationGraph.getArrow(e.relation, e.link, !
1),
fill: "none"
}
})
},
Pt = [];
const Nt = {
name: "SeeksRGLink",
props: {
relationGraph: {
mustUseProp: !0,
default: () => ({}),
type: Object
},
link: {
mustUseProp: !0,
default: () => ({}),
type: Object
},
relation: {
mustUseProp: !0,
default: () => ({}),
type: Object
},
relationIndex: {
mustUseProp: !0,
default: () => 0,
type: Number
}
},
computed: {
checked() {
return this.link.seeks_id === this.relationGraph.options.checkedLineId
},
pathData() {
const {
path: e,
textPosition: o
} = this.relationGraph.createLinePath(this.link, this.relation, this.relationIndex);
return e
}
},
data() {
return {
is_flashing: !1
}
},
show() {
this.isShow = !0
},
methods: {}
},
we = {};
var Lt = I(Nt, St, Pt, !1, zt, null, null, null);
function zt(e) {
for (let o in we) this[o] = we[o]
}
const $t = function() {
return Lt.exports
}();
var Et = function() {
var e = this,
o = e.$createElement,
t = e._self._c || o;
return t("div", {
staticClass: "rel-map",
class: [e.relationGraph.options.layoutClassName, e.relationGraph.options
.backgrounImageNoRepeat ? "rel-map-background-norepeat" : ""
],
style: {
width: "100%",
height: "100%",
"background-image": "url(" + e.relationGraph.options.backgrounImage + ")"
},
on: {
mousedown: function(n) {
return !n.type.indexOf("key") && e._k(n.keyCode, "left", 37, n.key, ["Left",
"ArrowLeft"
]) || "button" in n && n.button !== 0 ? null : (n.stopPropagation(), e
.onDragStart(n))
},
touchstart: function(n) {
return n.stopPropagation(), e.onDragStart(n)
},
wheel: e.mouseListener
}
}, [t("div", {
ref: "seeksRGCanvas",
staticClass: "rel-map-canvas",
style: e.canvasSizeAndPosition
}, [e._t("canvas-plug"), t("div", {
ref: "rgCanvas",
staticClass: "rel-linediv",
staticStyle: {
overflow: "visible"
}
}, [t("svg", {
staticStyle: {
overflow: "visible"
},
style: {
width: e.relationGraph.options.canvasSize.width + "px",
height: e.relationGraph.options.canvasSize.height + "px"
},
attrs: {
xmlns: "http://www.w3.org/2000/svg",
version: "2.0"
}
}, [t("defs", [t("linearGradient", {
attrs: {
id: e.relationGraph.options.instanceId +
"-lineStyle",
x1: "1",
y1: "0",
x2: "0",
y2: "0"
}
}, [t("stop", {
attrs: {
offset: "0%",
"stop-color": "#e52c5c"
}
}), t("stop", {
attrs: {
offset: "100%",
"stop-color": "#FD8B37"
}
})], 1), t("marker", {
attrs: {
id: e.relationGraph.options.instanceId +
"-arrow-default",
markerWidth: e.relationGraph.options
.defaultLineMarker.markerWidth,
markerHeight: e.relationGraph.options
.defaultLineMarker.markerHeight,
refX: e.relationGraph.options.defaultLineMarker
.refX,
refY: e.relationGraph.options.defaultLineMarker
.refY,
"marker-units": "strokeWidth",
orient: "auto",
viewBox: "0 0 12 12"
}
}, [t("path", {
style: {
fill: e.relationGraph.options
.defaultLineColor
},
attrs: {
d: e.relationGraph.options
.defaultLineMarker.data
}
})]), t("marker", {
attrs: {
id: e.relationGraph.options.instanceId +
"-start-arrow-default",
markerWidth: e.relationGraph.options
.defaultLineMarker.markerWidth,
markerHeight: e.relationGraph.options
.defaultLineMarker.markerHeight,
refX: e.relationGraph.options.defaultLineMarker
.refX,
refY: e.relationGraph.options.defaultLineMarker
.refY,
"marker-units": "strokeWidth",
orient: "auto",
viewBox: "0 0 12 12"
}
}, [t("path", {
style: {
fill: e.relationGraph.options
.defaultLineColor
},
attrs: {
d: e.relationGraph.options
.defaultLineMarker.data,
transform: "translate(12,12)rotate(180)"
}
})]), t("marker", {
attrs: {
id: e.relationGraph.options.instanceId +
"-arrow-checked",
markerUnits: "strokeWidth",
markerWidth: "12",
markerHeight: "12",
viewBox: "0 0 12 12",
refX: "6",
refY: "6",
orient: "auto"
}
}, [t("path", {
style: {
fill: e.relationGraph.options
.checkedLineColor
},
attrs: {
d: "M2,2 L10,6 L2,10 L6,6 L2,2"
}
})]), t("marker", {
attrs: {
id: e.relationGraph.options.instanceId +
"-start-arrow-checked",
markerUnits: "strokeWidth",
markerWidth: "12",
markerHeight: "12",
viewBox: "0 0 12 12",
refX: "6",
refY: "6",
orient: "auto"
}
}, [t("path", {
style: {
fill: e.relationGraph.options
.checkedLineColor
},
attrs: {
d: "M2,2 L10,6 L2,10 L6,6 L2,2",
transform: "translate(12,12)rotate(180)"
}
})]), e._l(e.relationGraph.allLineColors, function(n) {
return t("marker", {
key: n.id,
attrs: {
id: e.relationGraph.options
.instanceId + "-arrow-" + n.id,
markerWidth: e.relationGraph.options
.defaultLineMarker.markerWidth,
markerHeight: e.relationGraph
.options.defaultLineMarker
.markerHeight,
refX: e.relationGraph.options
.defaultLineMarker.refX,
refY: e.relationGraph.options
.defaultLineMarker.refY,
"marker-units": "strokeWidth",
orient: "auto"
}
}, [t("path", {
attrs: {
fill: e.relationGraph
.options
.defaultLineMarker
.color || n.color,
d: e.relationGraph.options
.defaultLineMarker.data
}
})])
}), e._l(e.relationGraph.allLineColors, function(n) {
return t("marker", {
key: "start-" + n.id,
attrs: {
id: e.relationGraph.options
.instanceId + "-start-arrow-" +
n.id,
markerWidth: e.relationGraph.options
.defaultLineMarker.markerWidth,
markerHeight: e.relationGraph
.options.defaultLineMarker
.markerHeight,
refX: e.relationGraph.options
.defaultLineMarker.refX,
refY: e.relationGraph.options
.defaultLineMarker.refY,
"marker-units": "strokeWidth",
orient: "auto"
}
}, [t("path", {
attrs: {
fill: e.relationGraph
.options
.defaultLineMarker
.color || n.color,
d: e.relationGraph.options
.defaultLineMarker.data,
transform: "translate(12,12)rotate(180)"
}
})])
}), e._l(e.relationGraph.graphData.links, function(n) {
return [e._l(n.relations, function(i, s) {
return [e.relationGraph.options
.lineUseTextPath || i
.useTextPath ? t(
"SeeksRGLinePath", {
key: i.id,
attrs: {
"relation-graph": e
.relationGraph,
link: n,
relation: i,
"relation-index": s
}
}) : e._e()
]
})]
})], 2), e._l(e.relationGraph.graphData.links, function(n) {
return t("SeeksRGLink", {
key: n.seeks_id,
attrs: {
"link-props": n,
"relation-graph": e.relationGraph
},
scopedSlots: e._u([{
key: "line",
fn: function(i) {
var s = i.line;
return [e._t("line",
null, {
line: s,
link: n
})]
}
}], null, !0)
})
})], 2)]), t("div", {
staticClass: "rel-nodediv rel-nodediv-for-webkit"
}, e._l(e.relationGraph.graphData.nodes, function(n) {
return t("SeeksRGNode", {
key: n.seeks_id,
attrs: {
"node-props": n,
"relation-graph": e.relationGraph
},
scopedSlots: e._u([{
key: "node",
fn: function(i) {
var s = i.node;
return [e._t("node", null, {
node: s
})]
}
}], null, !0)
})
}), 1)], 2)])
},
Rt = [];
const Co = "",
At = {
name: "RelationGraphCanvas",
components: {
SeeksRGNode: lt,
SeeksRGLink: Mt,
SeeksRGLinePath: $t
},
props: {
relationGraph: {
mustUseProp: !1,
default: () => ({}),
type: Object
}
},
data() {
return {}
},
computed: {
canvasSizeAndPosition() {
return {
width: `${this.relationGraph.options.canvasSize.width}px`,
height: `${this.relationGraph.options.canvasSize.height}px`,
"margin-left": `${this.relationGraph.options.canvasOffset.x}px`,
"margin-top": `${this.relationGraph.options.canvasOffset.y}px`,
"background-color": "transparent",
transform: `scale(${this.relationGraph.options.canvasZoom/100},${this.relationGraph.options.canvasZoom/100})`
}
}
},
watch: {},
created() {
u("[RGCanvas created]")
},
mounted() {
u("[RGCanvas mounted]"), this.init(), this.relationGraph.setCanvasDom(this.$refs.seeksRGCanvas)
},
beforeDestroy() {},
methods: {
init() {
this.$refs.rgCanvas.style.setProperty("--stroke",
`url('#${this.relationGraph.options.instanceId}-lineStyle')`), this.$refs.rgCanvas.style
.setProperty("--markerEnd",
`url('#${this.relationGraph.options.instanceId}-start-arrow-default')`), this.$refs
.rgCanvas.style.setProperty("--markerStart",
`url('#${this.relationGraph.options.instanceId}-arrow-default')`), this.$refs.rgCanvas
.style.setProperty("--markerEndChecked",
`url('#${this.relationGraph.options.instanceId}-arrow-checked')`), this.$refs.rgCanvas
.style.setProperty("--markerStartChecked",
`url('#${this.relationGraph.options.instanceId}-start-arrow-checked')`)
},
mouseListener(e) {
if (this.relationGraph.options.disableZoom) return e.cancelBubble = !1, !0;
try {
e.cancelBubble = !0, e.preventDefault(), e.stopPropagation()
} catch (i) {}
const o = {
x: e.clientX,
y: e.clientY
};
let t = e.deltaY;
t === void 0 && (t = e.wheelDelta);
const n = -1;
t > 0 ? this.relationGraph.zoom(5 * n, o) : this.relationGraph.zoom(-5 * n, o)
},
onDragStart(e) {
if (this.relationGraph.options.disableDragCanvas) return;
let o;
if (D) {
let t = null,
n = null;
o = (i, s, a, l, r) => {
const c = r.touches || r.targetTouches,
d = c[0];
if (c && c.length > 1) {
r.preventDefault();
const f = c[1];
t || (t = {
x: f.clientX,
y: f.clientY
}, n = this.relationGraph.options.canvasZoom);
const h = {
x: d.clientX,
y: d.clientY
},
g = {
x: f.clientX,
y: f.clientY
},
_ = Math.hypot(t.x - l.x, t.y - l.y),
C = Math.hypot(g.x - h.x, g.y - h.y) / _,
M = n * C;
this.relationGraph.setZoom(M)
} else {
const f = d.clientX,
h = d.clientY,
g = a.x + (f - l.x),
_ = a.y + (h - l.y);
this.relationGraph.setCanvasOffset(g, _)
}
}
}
A.startDrag(e, this.relationGraph.options.canvasOffset, this.onDragEnd, o)
},
onDragEnd() {}
}
},
be = {};
var It = I(At, Et, Rt, !1, Ot, "6e119aea", null, null);
function Ot(e) {
for (let o in be) this[o] = be[o]
}
const Bt = function() {
return It.exports
}();
var Ft = function() {
var e = this,
o = e.$createElement,
t = e._self._c || o;
return t("div", [t("div", {
staticClass: "c-setting-panel-button",
class: [],
on: {
click: e.toggleSettingPanel
}
}, [e._v(" Debug ")]), e.showSettingPanel ? t("div", {
staticClass: "c-setting-panel",
class: []
}, [t("div", {
staticClass: "c-debug-tools-row"
}, [t("button", {
on: {
click: e.printOptions
}
}, [e._v("print options in console")])]), t("div", {
staticClass: "c-debug-tools-row"
}, [t("button", {
on: {
click: e.printData
}
}, [e._v("print json data in console")])]), t("div", {
staticClass: "c-debug-tools-row"
}, [e._v("debug log status: " + e._s(e.relationGraph.options.debug)), t(
"button", {
on: {
click: e.enableDevlog
}
}, [e._v(e._s(e.relationGraph.options.debug ? "disable" : "enable") +
" debug log")])])]) : e._e()])
},
Ht = [];
const ko = "",
Wt = {
name: "GraphSettingPanel",
props: {
relationGraph: {
mustUseProp: !0,
default: () => ({}),
type: Object
}
},
data() {
return {
search_text: "",
showSettingPanel: !1,
currentLayoutName: ""
}
},
methods: {
toggleSettingPanel() {
this.showSettingPanel = !this.showSettingPanel
},
printOptions() {
console.log("options:", this.relationGraph.getGraphJsonOptions())
},
printData() {
console.log("data:", this.relationGraph.getGraphJsonData())
},
enableDevlog() {
this.relationGraph.enableDebugLog(!this.relationGraph.options.debug), u("debugLog:", this
.relationGraph.options.debug)
}
}
},
Ce = {};
var Dt = I(Wt, Ft, Ht, !1, Vt, "f2fe86d4", null, null);
function Vt(e) {
for (let o in Ce) this[o] = Ce[o]
}
const Tt = function() {
return Dt.exports
}();
var jt = function() {
var e = this,
o = e.$createElement,
t = e._self._c || o;
return t("div", {
ref: "miniView",
staticClass: "c-mini-graph"
}, [t("div", {
staticClass: "c-mini-canvas",
style: {
width: e.viewWidth + "px",
height: e.miniViewHeight() + "px"
}
}, [e._l(e.relationGraph.graphData.nodes, function(n) {
return [e.isAllowShowNode(n) ? t("div", {
key: n.id,
staticClass: "c-mini-node",
style: {
left: (n.x - e.minX) * e.viewWidth / (e.maxX - e.minX) +
"px",
top: (n.y - e.minY) * e.viewHeight / (e.maxY - e.minY) +
"px"
}
}) : e._e()]
})], 2)])
},
Zt = [];
const Go = "",
Jt = {
name: "GraphMiniView",
props: {
relationGraph: {
mustUseProp: !0,
default: () => ({}),
type: Object
}
},
data() {
return {
viewWidth: 100,
viewHeight: 0,
minX: 0,
maxX: 0,
minY: 0,
maxY: 0,
zoom: 1
}
},
mounted() {},
methods: {
miniViewHeight() {
let e = 9999,
o = -9999,
t = 9999,
n = -9999;
for (let i = 0; i < this.relationGraph.graphData.nodes.length; i++) {
const s = this.relationGraph.graphData.nodes[i];
s.x < e && (e = s.x), s.x > o && (o = s.x), s.y < t && (t = s.y), s.y > n && (n = s.y)
}
return this.viewHeight = (n - t) * this.viewWidth / (o - e), this.minX = e, this.minY = t, this
.maxX = o, this.maxY = n, this.viewHeight
},
getPositionData() {
const e = this.viewWidth / this.relationGraph.options.canvasNVInfo.width,
o = this.relationGraph.options.viewNVInfo.width * e,
t = this.relationGraph.options.viewNVInfo.height * e;
let n = (this.relationGraph.options.viewNVInfo.x - this.relationGraph.options.canvasNVInfo.x) *
e * (this.relationGraph.options.canvasZoom / 100),
i = (this.relationGraph.options.viewNVInfo.y - this.relationGraph.options.canvasNVInfo.y) *
e * (this.relationGraph.options.canvasZoom / 100);
return n = n * 100 / o, i = i * 100 / o, {
width: o + "px",
height: t + "px",
left: n + "px",
top: i + "px"
}
},
isAllowShowNode(e) {
return x.isAllowShowNode(e)
}
}
},
ke = {};
var Ut = I(Jt, jt, Zt, !1, Yt, "4c48557a", null, null);
function Yt(e) {
for (let o in ke) this[o] = ke[o]
}
const Xt = function() {
return Ut.exports
}();
var qt = function() {
var e = this,
o = e.$createElement,
t = e._self._c || o;
return t("div", {
staticClass: "c-mini-toolbar",
style: {
"margin-left": e.relationGraph.options.viewELSize.width - 50 + "px",
"margin-top": (e.relationGraph.options.viewELSize.height - 260) / 2 + "px"
}
}, [t("div", {
staticClass: "c-mb-button",
staticStyle: {
"margin-top": "0px"
},
on: {
click: function(n) {
return e.relationGraph.fullscreen()
}
}
}, [t("svg", {
staticClass: "rg-icon",
attrs: {
"aria-hidden": "true"
}
}, [t("use", {
attrs: {
"xlink:href": "#icon-resize-"
}
})]), t("span", {
staticClass: "c-mb-text"
}, [e._v(e._s(e.relationGraph.options.fullscreen ? "\u9000\u51FA" :
"\u5168\u5C4F"))])]), e.relationGraph.options.allowShowZoomMenu ? t("div", {
staticClass: "c-mb-button",
on: {
click: function(n) {
return e.relationGraph.zoom(20)
}
}
}, [t("svg", {
staticClass: "rg-icon",
attrs: {
"aria-hidden": "true"
}
}, [t("use", {
attrs: {
"xlink:href": "#icon-fangda"
}
})]), t("span", {
staticClass: "c-mb-text"
}, [e._v("\u653E\u5927")])]) : e._e(), e.relationGraph.options.allowShowZoomMenu ? t(
"div", {
staticStyle: {
float: "left",
"margin-top": "0px",
height: "20px",
width: "40px",
"border-top": "0px",
"border-bottom": "0px",
"background-color": "#efefef",
color: "#262626",
"font-size": "10px",
"text-align": "center",
"line-height": "20px"
},
on: {
click: e.printGraphJsonData
}
}, [e._v(e._s(e.relationGraph.options.canvasZoom) + "%")]) : e._e(), e.relationGraph.options
.allowShowZoomMenu ? t("div", {
staticClass: "c-mb-button",
staticStyle: {
"margin-top": "0px"
},
on: {
click: function(n) {
return e.relationGraph.zoom(-20)
}
}
}, [t("svg", {
staticClass: "rg-icon",
attrs: {
"aria-hidden": "true"
}
}, [t("use", {
attrs: {
"xlink:href": "#icon-suoxiao"
}
})]), t("span", {
staticClass: "c-mb-text"
}, [e._v("\u7F29\u5C0F")])]) : e._e(), e.relationGraph.options.layouts.length > 1 ? t(
"div", {
staticClass: "c-mb-button"
}, [t("svg", {
staticClass: "rg-icon",
attrs: {
"aria-hidden": "true"
}
}, [t("use", {
attrs: {
"xlink:href": "#icon-yuanquanfenxiang"
}
})]), t("span", {
staticClass: "c-mb-text"
}, [e._v("\u5E03\u5C40")]), t("div", {
staticClass: "c-mb-child-panel",
style: {
width: e.relationGraph.options.layouts.length * 70 + 6 + "px",
"margin-left": e.relationGraph.options.layouts.length * -70 - 5 + "px"
}
}, e._l(e.relationGraph.options.layouts, function(n) {
return t("div", {
key: n.label,
staticClass: "c-mb-button c-mb-button-c",
class: {
"c-mb-button-on": e.relationGraph.options
.layoutLabel === n.label
},
staticStyle: {
width: "70px"
},
on: {
click: function(i) {
return e.switchLayout(n)
}
}
}, [t("svg", {
staticClass: "rg-icon",
attrs: {
"aria-hidden": "true"
}
}, [t("use", {
attrs: {
"xlink:href": "#icon-yuanquanfenxiang"
}
})]), t("span", {
staticClass: "c-mb-text"
}, [e._v(e._s(n.label))])])
}), 0)]) : e._e(), e.relationGraph.options.allowSwitchLineShape ? t("div", {
staticClass: "c-mb-button"
}, [t("svg", {
staticClass: "rg-icon",
attrs: {
"aria-hidden": "true"
}
}, [t("use", {
attrs: {
"xlink:href": "#icon-hj2"
}
})]), t("span", {
staticClass: "c-mb-text"
}, [e._v("\u7EBF\u6761")]), t("div", {
staticClass: "c-mb-child-panel",
staticStyle: {
width: "256px",
"margin-left": "-255px"
}
}, [t("div", {
staticClass: "c-mb-button c-mb-button-c",
class: {
"c-mb-button-on": e.relationGraph.options.defaultLineShape === 1
},
staticStyle: {
width: "50px"
},
on: {
click: function(n) {
return e.relationGraph.setDefaultLineShape(1)
}
}
}, [t("svg", {
staticClass: "rg-icon",
attrs: {
"aria-hidden": "true"
}
}, [t("use", {
attrs: {
"xlink:href": "#icon-hj2"
}
})]), t("span", {
staticClass: "c-mb-text"
}, [e._v("\u76F4\u7EBF")])]), t("div", {
staticClass: "c-mb-button c-mb-button-c",
class: {
"c-mb-button-on": e.relationGraph.options.defaultLineShape === 2
},
staticStyle: {
width: "50px"
},
on: {
click: function(n) {
return e.relationGraph.setDefaultLineShape(2)
}
}
}, [t("svg", {
staticClass: "rg-icon",
attrs: {
"aria-hidden": "true"
}
}, [t("use", {
attrs: {
"xlink:href": "#icon-lianjieliu"
}
})]), t("span", {
staticClass: "c-mb-text"
}, [e._v("\u7B80\u6D01")])]), t("div", {
staticClass: "c-mb-button c-mb-button-c",
class: {
"c-mb-button-on": e.relationGraph.options.defaultLineShape === 6
},
staticStyle: {
width: "50px"
},
on: {
click: function(n) {
return e.relationGraph.setDefaultLineShape(6)
}
}
}, [t("svg", {
staticClass: "rg-icon",
attrs: {
"aria-hidden": "true"
}
}, [t("use", {
attrs: {
"xlink:href": "#icon-lianjieliu"
}
})]), t("span", {
staticClass: "c-mb-text"
}, [e._v("\u751F\u52A8")])]), t("div", {
staticClass: "c-mb-button c-mb-button-c",
class: {
"c-mb-button-on": e.relationGraph.options.defaultLineShape === 5
},
staticStyle: {
width: "50px"
},
on: {
click: function(n) {
return e.relationGraph.setDefaultLineShape(5)
}
}
}, [t("svg", {
staticClass: "rg-icon",
attrs: {
"aria-hidden": "true"
}
}, [t("use", {
attrs: {
"xlink:href": "#icon-lianjieliu"
}
})]), t("span", {
staticClass: "c-mb-text"
}, [e._v("\u9C7C\u5C3E")])]), t("div", {
staticClass: "c-mb-button c-mb-button-c",
class: {
"c-mb-button-on": e.relationGraph.options.defaultLineShape === 4
},
staticStyle: {
width: "50px"
},
on: {
click: function(n) {
return e.relationGraph.setDefaultLineShape(4)
}
}
}, [t("svg", {
staticClass: "rg-icon",
attrs: {
"aria-hidden": "true"
}
}, [t("use", {
attrs: {
"xlink:href": "#icon-hj2"
}
})]), t("span", {
staticClass: "c-mb-text"
}, [e._v("\u6298\u7EBF")])])])]) : e._e(), e.relationGraph.options
.allowSwitchJunctionPoint ? t("div", {
staticClass: "c-mb-button"
}, [t("svg", {
staticClass: "rg-icon",
attrs: {
"aria-hidden": "true"
}
}, [t("use", {
attrs: {
"xlink:href": "#icon-lianjie_connecting5"
}
})]), t("span", {
staticClass: "c-mb-text"
}, [e._v("\u8FDE\u63A5\u70B9")]), t("div", {
staticClass: "c-mb-child-panel",
staticStyle: {
width: "206px",
"margin-left": "-205px"
}
}, [t("div", {
staticClass: "c-mb-button c-mb-button-c",
class: {
"c-mb-button-on": e.relationGraph.options
.defaultJunctionPoint === "border"
},
staticStyle: {
width: "50px"
},
on: {
click: function(n) {
return e.relationGraph.setDefaultJunctionPoint("border")
}
}
}, [t("svg", {
staticClass: "rg-icon",
attrs: {
"aria-hidden": "true"
}
}, [t("use", {
attrs: {
"xlink:href": "#icon-lianjie_connecting5"
}
})]), t("span", {
staticClass: "c-mb-text"
}, [e._v("\u8FB9\u7F18")])]), t("div", {
staticClass: "c-mb-button c-mb-button-c",
class: {
"c-mb-button-on": e.relationGraph.options
.defaultJunctionPoint === "ltrb"
},
staticStyle: {
width: "50px"
},
on: {
click: function(n) {
return e.relationGraph.setDefaultJunctionPoint("ltrb")
}
}
}, [t("svg", {
staticClass: "rg-icon",
attrs: {
"aria-hidden": "true"
}
}, [t("use", {
attrs: {
"xlink:href": "#icon-lianjie_connecting5"
}
})]), t("span", {
staticClass: "c-mb-text"
}, [e._v("\u56DB\u70B9")])]), t("div", {
staticClass: "c-mb-button c-mb-button-c",
class: {
"c-mb-button-on": e.relationGraph.options
.defaultJunctionPoint === "tb"
},
staticStyle: {
width: "50px"
},
on: {
click: function(n) {
return e.relationGraph.setDefaultJunctionPoint("tb")
}
}
}, [t("svg", {
staticClass: "rg-icon",
attrs: {
"aria-hidden": "true"
}
}, [t("use", {
attrs: {
"xlink:href": "#icon-lianjie_connecting5"
}
})]), t("span", {
staticClass: "c-mb-text"
}, [e._v("\u4E0A\u4E0B")])]), t("div", {
staticClass: "c-mb-button c-mb-button-c",
class: {
"c-mb-button-on": e.relationGraph.options
.defaultJunctionPoint === "lr"
},
staticStyle: {
width: "50px"
},
on: {
click: function(n) {
return e.relationGraph.setDefaultJunctionPoint("lr")
}
}
}, [t("svg", {
staticClass: "rg-icon",
attrs: {
"aria-hidden": "true"
}
}, [t("use", {
attrs: {
"xlink:href": "#icon-lianjie_connecting5"
}
})]), t("span", {
staticClass: "c-mb-text"
}, [e._v("\u5DE6\u53F3")])])])]) : e._e(), e.relationGraph.options
.allowAutoLayoutIfSupport && e.relationGraph.options.isNeedShowAutoLayoutButton ? t("div", {
staticClass: "c-mb-button",
class: {
"c-mb-button-on": e.relationGraph.options.autoLayouting
},
attrs: {
title: e.relationGraph.options.autoLayouting ?
"\u70B9\u51FB\u505C\u6B62\u81EA\u52A8\u5E03\u5C40" :
"\u70B9\u51FB\u5F00\u59CB\u81EA\u52A8\u8C03\u6574\u5E03\u5C40"
},
on: {
click: e.toggleAutoLayout
}
}, [e.relationGraph.options.autoLayouting ? t("svg", {
staticClass: "c-loading-icon rg-icon",
attrs: {
"aria-hidden": "true"
}
}, [t("use", {
attrs: {
"xlink:href": "#icon-lianjiezhong"
}
})]) : t("svg", {
staticClass: "rg-icon",
attrs: {
"aria-hidden": "true"
}
}, [t("use", {
attrs: {
"xlink:href": "#icon-zidong"
}
})]), t("span", {
staticClass: "c-mb-text"
}, [e._v("\u81EA\u52A8")])]) : e._e(), e.relationGraph.options.allowShowRefreshButton ? t(
"div", {
staticClass: "c-mb-button",
on: {
click: e.refresh
}
}, [t("svg", {
staticClass: "rg-icon",
attrs: {
"aria-hidden": "true"
}
}, [t("use", {
attrs: {
"xlink:href": "#icon-ico_reset"
}
})]), t("span", {
staticClass: "c-mb-text"
}, [e._v("\u5237\u65B0")])]) : e._e(), e.relationGraph.options.allowShowDownloadButton ?
t("div", {
staticClass: "c-mb-button"
}, [t("svg", {
staticClass: "rg-icon",
attrs: {
"aria-hidden": "true"
}
}, [t("use", {
attrs: {
"xlink:href": "#icon-ziyuan"
}
})]), t("span", {
staticClass: "c-mb-text"
}, [e._v("\u4E0B\u8F7D")]), t("div", {
staticClass: "c-mb-child-panel",
style: {
width: e.downloadPanelWidth + "px",
"margin-left": e.downloadPanelWidth * -1 + "px"
}
}, [t("div", {
staticClass: "c-mb-button c-mb-button-c",
staticStyle: {
width: "50px"
},
on: {
click: function(n) {
return e.relationGraph.downloadAsImage("png")
}
}
}, [t("svg", {
staticClass: "rg-icon",
attrs: {
"aria-hidden": "true"
}
}, [t("use", {
attrs: {
"xlink:href": "#icon-tupian"
}
})]), t("span", {
staticClass: "c-mb-text"
}, [e._v("PNG")])]), t("div", {
staticClass: "c-mb-button c-mb-button-c",
staticStyle: {
width: "50px"
},
on: {
click: function(n) {
return e.relationGraph.downloadAsImage("jpg")
}
}
}, [t("svg", {
staticClass: "rg-icon",
attrs: {
"aria-hidden": "true"
}
}, [t("use", {
attrs: {
"xlink:href": "#icon-tupian"
}
})]), t("span", {
staticClass: "c-mb-text"
}, [e._v("JPG")])]), e.relationGraph.listeners.onDownloadExcel ? t("div", {
staticClass: "c-mb-button c-mb-button-c",
staticStyle: {
width: "50px"
},
on: {
click: function(n) {
return e.onDownloadExcel()
}
}
}, [t("svg", {
staticClass: "rg-icon",
attrs: {
"aria-hidden": "true"
}
}, [t("use", {
attrs: {
"xlink:href": "#icon-ziyuan"
}
})]), t("span", {
staticClass: "c-mb-text"
}, [e._v("Excel")])]) : e._e()])]) : e._e()
])
},
Kt = [];
const Mo = "",
Qt = {
name: "GraphMiniToolBar",
props: {
relationGraph: {
mustUseProp: !0,
default: () => ({}),
type: Object
}
},
data() {
return {
height: 275,
hits: 0,
downloadPanelWidth: 106
}
},
mounted() {
this.relationGraph.listeners.onDownloadExcel !== null && (this.downloadPanelWidth += 50), this
.relationGraph.options.layouts.length > 1 && (this.height -= 40)
},
methods: {
refresh() {
this.relationGraph.refresh()
},
switchLayout(e) {
u("change layout:", e), Je(e, this.relationGraph.options), this.refresh()
},
toggleAutoLayout() {
this.relationGraph.startAutoLayout()
},
onDownloadExcel() {
this.relationGraph.listeners.onDownloadExcel()
},
printGraphJsonData() {
this.hits++, setTimeout(() => {
this.hits > 0 && this.hits--
}, 2e3), this.hits > 5 && (this.hits = 0, this.relationGraph.printGraphJsonData())
}
}
},
Ge = {};
var eo = I(Qt, qt, Kt, !1, to, "0e337616", null, null);
function to(e) {
for (let o in Ge) this[o] = Ge[o]
}
const oo = function() {
return eo.exports
}();
var no = function() {
var e = this,
o = e.$createElement,
t = e._self._c || o;
return t("div", {
ref: "seeksRelationGraph",
staticStyle: {
"box-sizing": "border-box"
},
style: {
width: "100%",
height: "100%"
}
}, [e.relationGraph && e.relationGraph.options ? [e.relationGraph.options.showDebugPanel ? t(
"GraphDebugPanel", {
attrs: {
"relation-graph": e.relationGraph
}
}) : e._e(), e.relationGraph.options.allowShowMiniToolBar === !0 ? e._t(
"miniToolBar",
function() {
return [t("GraphMiniToolBar", {
attrs: {
"relation-graph": e.relationGraph
}
})]
}, {
relationGraph: e.relationGraph
}) : e._e(), e.relationGraph.options.allowShowMiniView === !0 ? e._t(
"miniViewPanel",
function() {
return [t("GraphMiniView", {
attrs: {
"relation-graph": e.relationGraph
}
})]
}, {
relationGraph: e.relationGraph
}) : e._e(), e._t("graph-plug", null, {
relationGraph: e.relationGraph
}), t("RGCanvas", {
attrs: {
"relation-graph": e.relationGraph
},
scopedSlots: e._u([{
key: "node",
fn: function(n) {
var i = n.node;
return [e._t("node", null, {
node: i,
relationGraph: e.relationGraph
})]
}
}, {
key: "line",
fn: function(n) {
var i = n.line,
s = n.link;
return [e._t("line", null, {
line: i,
link: s,
relationGraph: e.relationGraph
})]
}
}, {
key: "canvas-plug",
fn: function() {
return [e._t("canvas-plug", null, {
relationGraph: e.relationGraph
})]
},
proxy: !0
}], null, !0)
})] : e._e()], 2)
},
io = [];
const So = "",
so = {
name: "SeeksRelationGraph",
components: {
GraphMiniToolBar: oo,
GraphMiniView: Xt,
RGCanvas: Bt,
GraphDebugPanel: Tt
},
props: {
options: {
mustUseProp: !1,
default: () => ({}),
type: Object
},
relationGraphCore: {
mustUseProp: !1,
default: null,
type: Function
},
onNodeClick: {
mustUseProp: !1,
default: () => () => {},
type: Function
},
onNodeExpand: {
mustUseProp: !1,
default: () => () => {},
type: Function
},
onNodeCollapse: {
mustUseProp: !1,
default: () => () => {},
type: Function
},
onLineClick: {
mustUseProp: !1,
default: () => () => {},
type: Function
},
onDownloadExcel: {
mustUseProp: !1,
default: null,
type: Function
},
onImageDownload: {
mustUseProp: !1,
default: null,
type: Function
},
onImageSaveAsFile: {
mustUseProp: !1,
default: null,
type: Function
}
},
data() {
return {
relationGraph: null,
graphSetting: null
}
},
created() {
window && (window.relationGraphDebug = this.options.debug), u(
"---------------------------graph created---------------------------", this), console.log(
`%c relation-graph %c Version v${ae} %c More info: https://github.com/seeksdream/relation-graph %c`,
"background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff",
"background:#41b883 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff",
"background:#fff ; padding: 1px; border-radius: 0 3px 3px 0; color: #41b883",
"background:transparent");
let e = !1;
if (!O.default || !O.default.version || O.default.version.startsWith("3")) {
console.error(
"\u5982\u679C\u60A8\u4F7F\u7528\u7684\u662Fvue3\u6216react\uFF0C\u4F60\u9700\u8981\u6CE8\u610Fimport\u65F6\u4F7F\u7528\u7684\u540D\u79F0\uFF1A"
), console.error("vue2:import RelationGraph from 'relation-graph'"), console.error(
"vue3:import RelationGraph from 'relation-graph/vue3'"), console.error(
"react:import RelationGraph from 'relation-graph/react'");
return
}
O.default.version.slice(0, 4) === "2.5." && (e = !0), O.default.version.slice(0, 4) === "2.6." &&
Number.parseInt(O.default.version.split(".")[2]) <= 12 && (e = !0), e && console.error(
`\u60A8\u7684Vue\u7248\u672C\uFF1A${O.default.version}\u6CE8\u610F\uFF1A\u5F53\u4F60\u4F7F\u7528\u7684vue\u7248\u672C\u7B49\u4E8E\u4F4E\u4E8E2.6.12\u65F6\uFF0C\u56FE\u8C31\u4F1A\u663E\u793A\u4E0D\u6B63\u5E38\uFF0C\u53C2\u8003\u8FD9\u4E2A\u8FDE\u63A5\u89E3\u51B3\u8FD9\u4E2A\u95EE\u9898\uFF1Ahttps://github.com/seeksdream/relation-graph/issues/113`
), T.default || console.error(
"[relation-graph]Please introduce component screenfull, for example:https://cdnjs.cloudflare.com/ajax/libs/screenfull.js/5.1.0/screenfull.min.js"
), se.default || console.error(
"[relation-graph]Please introduce component html2canvas, for example:https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"
)
},
mounted() {
u("---------------------------graph mounted---------------------------");
const e = {
onNodeClick: this.onNodeClick,
onNodeExpand: this.onNodeExpand,
onNodeCollapse: this.onNodeCollapse,
onLineClick: this.onLineClick,
onDownloadExcel: this.onDownloadExcel,
onImageDownload: this.onImageDownload,
onImageSaveAsFile: this.onImageSaveAsFile
},
o = this.relationGraphCore || new me(this.options, e);
o.setDom(this.$refs.seeksRelationGraph), o.ready(), this.relationGraph = o, this.graphSetting = this
.relationGraph.options, T.default.on("change", this.onFullscreen)
},
beforeUnmount() {
u("---------------------------graph beforeDestroy---------------------------"), T.default.off(
"change", this.onFullscreen), this.$refs.seeksRelationGraph.remove()
},
updated() {
u("---------------------------graph updated---------------------------")
},
methods: {
onFullscreen() {
this.relationGraph.fullscreen(T.default.isFullscreen)
},
getInstance() {
return this.relationGraph
},
setOptions(e, o) {
this.relationGraph.setOptions(e, o)
},
setJsonData(e, o, t) {
arguments.length === 2 && typeof o == "function" && (t = o, o = !0), this.relationGraph
.setJsonData(e, o, n => {
this.$nextTick(() => {
this.relationGraph.playShowEffect(() => {
t && t(n)
})
})
})
},
appendJsonData(e, o, t) {
arguments.length === 2 && typeof o == "function" && (t = o, o = !0), this.relationGraph
.appendJsonData(e, o, t)
},
setLayouter(e) {
this.relationGraph.setLayouter(e)
},
onGraphResize(e, o) {
this.relationGraph.refreshNVAnalysisInfo()
},
refresh() {
this.relationGraph.refresh()
},
focusRootNode() {
this.relationGraph.focusRootNode()
},
focusNodeById(e) {
return this.relationGraph.focusNodeById(e)
},
getNodeById(e) {
return this.relationGraph.getNodeById(e)
},
removeNodeById(e) {
return this.relationGraph.removeNodeById(e)
},
getNodes() {
return this.relationGraph.getNodes()
},
getLinks() {
return this.relationGraph.getLinks()
},
getGraphJsonData() {
return this.relationGraph.getGraphJsonData()
},
getGraphJsonOptions() {
return this.relationGraph.getGraphJsonOptions()
}
}
},
Me = {};
var ao = I(so, no, io, !1, ro, "5a08b328", null, null);
function ro(e) {
for (let o in Me) this[o] = Me[o]
}
const oe = function() {
return ao.exports
}(),
Se = me,
Pe = {
BidirectionalTreeLayouter: he,
CenterLayouter: de,
CircleLayouter: fe,
FixedLayouter: ue,
ForceLayouter: Q
},
Ne = Te,
Le = De,
ze = Ze,
$e = (e, o) => {
e.component("RelationGraph", oe), e.component("SeeksRelationGraph", oe)
};
typeof window != "undefined" && window.Vue && $e(window.Vue);
const lo = Ae(Re({}, oe), {
RelationGraphCore: Se,
Layout: Pe,
RGOptions: Ne,
RGLink: Le,
RGNode: ze,
version: ae,
install: $e
});
k.Layout = Pe, k.RGLink = Le, k.RGNode = ze, k.RGOptions = Ne, k.RelationGraphCore = Se, k.default = lo, Object
.defineProperties(k, {
__esModule: {
value: !0
},
[Symbol.toStringTag]: {
value: "Module"
}
})
});