react-kggraph 0.0.33 → 0.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.es3.js +207 -187
- package/package.json +1 -1
package/lib/index.es3.js
CHANGED
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { jsx as f, jsxs as ne } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as C, useState as m, useEffect as T } from "react";
|
|
3
|
+
import z from "cytoscape";
|
|
4
|
+
import Ee from "cytoscape-cose-bilkent";
|
|
5
|
+
import Pe from "cytoscape-cise";
|
|
6
|
+
import Ne from "cytoscape-fcose";
|
|
7
7
|
import je from "storm-layout";
|
|
8
8
|
import we from "./index.es7.js";
|
|
9
9
|
/* empty css */
|
|
10
|
-
import { handleCalcPath as Le, resDetailData as
|
|
11
|
-
import { fixNodesToEdges as Oe, coseBilkentLayout as
|
|
12
|
-
import { edgeNodeStyles as
|
|
13
|
-
import
|
|
14
|
-
import { message as
|
|
15
|
-
import { menuItemsConfig as
|
|
10
|
+
import { handleCalcPath as Le, resDetailData as Z } from "./index.es8.js";
|
|
11
|
+
import { fixNodesToEdges as Oe, coseBilkentLayout as De } from "./index.es9.js";
|
|
12
|
+
import { edgeNodeStyles as Re, defaultColors as se, nodeSize as Se } from "./index.es10.js";
|
|
13
|
+
import Te from "cytoscape-layout-utilities";
|
|
14
|
+
import { message as h } from "antd";
|
|
15
|
+
import { menuItemsConfig as $e } from "./index.es11.js";
|
|
16
16
|
import { jsonStringify as w } from "./index.es12.js";
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import { GraphProvider as
|
|
17
|
+
import Ie from "./index.es13.js";
|
|
18
|
+
import Be from "./index.es14.js";
|
|
19
|
+
import { GraphProvider as Me } from "./index.es15.js";
|
|
20
20
|
import Ae from "./index.es16.js";
|
|
21
|
-
import
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
data:
|
|
29
|
-
getAllGraphData:
|
|
30
|
-
highPathAnalysis:
|
|
21
|
+
import We from "./index.es17.js";
|
|
22
|
+
z.use(Te);
|
|
23
|
+
z.use(Pe);
|
|
24
|
+
z.use(Ne);
|
|
25
|
+
z.use(je);
|
|
26
|
+
z.use(Ee);
|
|
27
|
+
const ct = ({
|
|
28
|
+
data: E,
|
|
29
|
+
getAllGraphData: $,
|
|
30
|
+
highPathAnalysis: F = [],
|
|
31
31
|
graphInfo: g,
|
|
32
|
-
stepNextApi:
|
|
33
|
-
knowledgeCardApi:
|
|
34
|
-
colors:
|
|
35
|
-
actionBar:
|
|
32
|
+
stepNextApi: ae,
|
|
33
|
+
knowledgeCardApi: re,
|
|
34
|
+
colors: P,
|
|
35
|
+
actionBar: ie,
|
|
36
36
|
actionCircle: de,
|
|
37
|
-
queryStatisticsConfig:
|
|
38
|
-
className:
|
|
39
|
-
noDataDesc:
|
|
37
|
+
queryStatisticsConfig: le = [{ label: "实体", key: "entity" }, { label: "关系", key: "relation" }],
|
|
38
|
+
className: ce,
|
|
39
|
+
noDataDesc: He = "暂无数据"
|
|
40
40
|
}) => {
|
|
41
41
|
var V, G;
|
|
42
|
-
const L =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}, [
|
|
46
|
-
const [u,
|
|
42
|
+
const L = C(null), [v, X] = m([]), c = C(null), q = C(null), K = 1, [Ze, U] = m(!1), [b, I] = m({}), [O, B] = m({}), [pe, ge] = m("cose-bilkent"), Y = C(null), _ = C(null), [ue, J] = m(["", ""]), M = C(P);
|
|
43
|
+
T(() => {
|
|
44
|
+
M.current = P;
|
|
45
|
+
}, [P]);
|
|
46
|
+
const [u, N] = m({
|
|
47
47
|
visible: !1,
|
|
48
48
|
x: 0,
|
|
49
49
|
y: 0,
|
|
50
50
|
targetNode: null,
|
|
51
51
|
bgColor: ""
|
|
52
|
-
}), [
|
|
52
|
+
}), [D, Q] = m({
|
|
53
53
|
visible: !1,
|
|
54
54
|
x: 0,
|
|
55
55
|
y: 0,
|
|
56
56
|
content: ""
|
|
57
|
-
}),
|
|
58
|
-
|
|
59
|
-
const { nodes: e, links:
|
|
60
|
-
((e == null ? void 0 : e.length) > 0 || (
|
|
61
|
-
}, [w(
|
|
62
|
-
const e = [],
|
|
63
|
-
|
|
64
|
-
d.group === "nodes" ? e.push(d.data) : d.group === "edges" &&
|
|
65
|
-
}),
|
|
66
|
-
}, [w(
|
|
57
|
+
}), fe = $e({ cyRef: c, setContextMenu: N, onPathAnalysis: (V = q.current) == null ? void 0 : V.onPathAnalysis, setPathNodes: J, actionCircle: de });
|
|
58
|
+
T(() => {
|
|
59
|
+
const { nodes: e, links: t } = F || {};
|
|
60
|
+
((e == null ? void 0 : e.length) > 0 || (t == null ? void 0 : t.length) > 0) && Le(c, { nodes: e, links: t, isGrayed: !1 });
|
|
61
|
+
}, [w(F), w(v)]), T(() => {
|
|
62
|
+
const e = [], t = [];
|
|
63
|
+
v.forEach((d) => {
|
|
64
|
+
d.group === "nodes" ? e.push(d.data) : d.group === "edges" && t.push(d.data);
|
|
65
|
+
}), $ == null || $({ graphData: v, nodeStatic: b, relationStatic: O, data: { nodes: e, links: t }, paths: E.paths, data2: E.data2, logId: E.logId, costtime: E.costtime });
|
|
66
|
+
}, [w(v), w(b), w(O)]), T(() => {
|
|
67
67
|
var i;
|
|
68
68
|
if (!L.current || c.current) return;
|
|
69
|
-
const { elements: e, typeListObj:
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
const { elements: e, typeListObj: t, relationListObj: d } = Z(E, { typeObj: b, graphInfo: g });
|
|
70
|
+
I(t), X(e), B(d), document.addEventListener("contextmenu", function(a) {
|
|
71
|
+
a.preventDefault();
|
|
72
72
|
});
|
|
73
|
-
const
|
|
73
|
+
const s = z({
|
|
74
74
|
container: L.current,
|
|
75
75
|
elements: e,
|
|
76
|
-
style:
|
|
76
|
+
style: Re({ elements: e, colors: P }),
|
|
77
77
|
autounselectify: !1,
|
|
78
78
|
autolock: !1,
|
|
79
79
|
maxZoom: 1,
|
|
@@ -82,87 +82,92 @@ const lt = ({
|
|
|
82
82
|
// 使用预设布局,完全依赖 position
|
|
83
83
|
}
|
|
84
84
|
});
|
|
85
|
-
if (c.current =
|
|
85
|
+
if (c.current = s, ((i = g == null ? void 0 : g.searchNodes) == null ? void 0 : i.length) === 2)
|
|
86
86
|
Oe(
|
|
87
|
-
|
|
87
|
+
s,
|
|
88
88
|
g.searchNodes[0],
|
|
89
89
|
g.searchNodes[1]
|
|
90
90
|
);
|
|
91
91
|
else {
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
const a = s.layout(De());
|
|
93
|
+
a.run(), a.on("layoutstop", () => {
|
|
94
|
+
s.fit(void 0, 50), s.center();
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
|
-
return
|
|
98
|
-
var
|
|
99
|
-
const o =
|
|
97
|
+
return s.on("mouseover", "edge", (a) => {
|
|
98
|
+
var n;
|
|
99
|
+
const o = a.target;
|
|
100
100
|
if (!o.hasClass("path-edge")) {
|
|
101
|
-
const
|
|
101
|
+
const r = ((n = M.current) == null ? void 0 : n.edgeHoverColor) ?? se.edgeHoverColor;
|
|
102
102
|
o.style({
|
|
103
|
-
"line-color":
|
|
104
|
-
"target-arrow-color":
|
|
103
|
+
"line-color": r,
|
|
104
|
+
"target-arrow-color": r,
|
|
105
105
|
opacity: 0.8
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
|
-
}),
|
|
109
|
-
var
|
|
110
|
-
const o =
|
|
108
|
+
}), s.on("mouseout", "edge", (a) => {
|
|
109
|
+
var n;
|
|
110
|
+
const o = a.target;
|
|
111
111
|
if (!o.hasClass("path-edge")) {
|
|
112
|
-
const
|
|
112
|
+
const r = ((n = M.current) == null ? void 0 : n.edgeDefaultColor) ?? se.edgeDefaultColor;
|
|
113
113
|
o.style({
|
|
114
|
-
"line-color":
|
|
115
|
-
"target-arrow-color":
|
|
114
|
+
"line-color": r,
|
|
115
|
+
"target-arrow-color": r,
|
|
116
116
|
opacity: 1
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
|
-
}),
|
|
120
|
-
const o =
|
|
119
|
+
}), s.on("mouseover", "node", (a) => {
|
|
120
|
+
const o = a.target;
|
|
121
121
|
o.hasClass("selected") || o.addClass("hover");
|
|
122
|
-
}),
|
|
123
|
-
const o =
|
|
122
|
+
}), s.on("mouseover", "node", (a) => {
|
|
123
|
+
const o = a.target, n = o.renderedPosition(), r = o.data("name") || "";
|
|
124
124
|
o.addClass("hover"), Q({
|
|
125
125
|
visible: !0,
|
|
126
|
-
x:
|
|
127
|
-
y:
|
|
128
|
-
content:
|
|
126
|
+
x: n.x,
|
|
127
|
+
y: n.y - 60,
|
|
128
|
+
content: r
|
|
129
129
|
});
|
|
130
|
-
}),
|
|
131
|
-
|
|
132
|
-
}),
|
|
133
|
-
|
|
134
|
-
const o =
|
|
135
|
-
console.log("renderedPos:::", o.data(), o.style("background-color")),
|
|
130
|
+
}), s.on("mouseout", "node", (a) => {
|
|
131
|
+
a.target.removeClass("hover"), Q((n) => ({ ...n, visible: !1 }));
|
|
132
|
+
}), s.on("cxttap", "node", (a) => {
|
|
133
|
+
a.preventDefault(), a.stopPropagation(), a.stopImmediatePropagation(), a.originalEvent && (a.originalEvent.preventDefault(), a.originalEvent.stopPropagation(), a.originalEvent.stopImmediatePropagation());
|
|
134
|
+
const o = a.target, n = o.renderedPosition();
|
|
135
|
+
console.log("renderedPos:::", o.data(), o.style("background-color")), N({
|
|
136
136
|
visible: !0,
|
|
137
|
-
x:
|
|
138
|
-
y:
|
|
137
|
+
x: n.x - 90,
|
|
138
|
+
y: n.y - 90,
|
|
139
139
|
targetNode: o,
|
|
140
140
|
bgColor: o.style("background-color")
|
|
141
141
|
});
|
|
142
|
-
}), c.current =
|
|
143
|
-
const o =
|
|
144
|
-
|
|
145
|
-
const
|
|
146
|
-
console.log("cy.nodes().not(relatedNodes):::",
|
|
147
|
-
}),
|
|
148
|
-
|
|
142
|
+
}), c.current = s, s.on("click", "node", (a) => {
|
|
143
|
+
const o = a.target;
|
|
144
|
+
s.nodes().removeClass("selected grayed highlighted"), s.edges().removeClass("selected grayed highlighted"), o.addClass("selected");
|
|
145
|
+
const r = o.neighborhood().nodes().add(o), p = r.edgesWith(r);
|
|
146
|
+
console.log("cy.nodes().not(relatedNodes):::", r), s.nodes().not(r).addClass("grayed"), s.edges().not(p).addClass("grayed"), r.addClass("highlighted"), p.addClass("highlighted");
|
|
147
|
+
}), s.on("tap", (a) => {
|
|
148
|
+
a.target === s && (N((o) => ({ ...o, visible: !1 })), s.nodes().removeClass("grayed highlighted highlight selected correlationStyle path-node level-highlight level-selected level-grayed"), s.edges().removeClass("grayed highlighted highlight selected correlationStyle path-edge level-highlightedge level-grayed"));
|
|
149
149
|
}), () => {
|
|
150
150
|
c.current && (c.current.destroy(), c.current = null);
|
|
151
151
|
};
|
|
152
152
|
}, []);
|
|
153
|
-
const
|
|
153
|
+
const ye = ({ addedNodes: e, currentNode: t, cy: d, currentZoom: s }) => {
|
|
154
154
|
const i = e == null ? void 0 : e.length;
|
|
155
|
-
|
|
156
|
-
const
|
|
155
|
+
t.data("originalPosition") || t.data("originalPosition", { ...t.position() });
|
|
156
|
+
const a = Math.max(0.1, 18 / (i || 1)), o = d.layout({
|
|
157
157
|
name: "concentric",
|
|
158
|
-
spacingFactor:
|
|
158
|
+
spacingFactor: a,
|
|
159
159
|
// 节点越多间距越小,防止溢出
|
|
160
|
+
eles: e.union(t),
|
|
161
|
+
// 只布局新节点+当前节点,不重算全图
|
|
160
162
|
minNodeSpacing: 0,
|
|
161
163
|
// 最小间距设为0
|
|
162
|
-
|
|
163
|
-
|
|
164
|
+
fit: !1,
|
|
165
|
+
// 禁止自动适配视口,保持缩放
|
|
166
|
+
animate: !1,
|
|
167
|
+
concentric: function(n) {
|
|
168
|
+
return n.degree();
|
|
164
169
|
},
|
|
165
|
-
levelWidth: function(
|
|
170
|
+
levelWidth: function(n) {
|
|
166
171
|
return 2;
|
|
167
172
|
},
|
|
168
173
|
// 随机排序
|
|
@@ -170,88 +175,106 @@ const lt = ({
|
|
|
170
175
|
// return Math.random() - 0.5;
|
|
171
176
|
// },
|
|
172
177
|
// 添加随机偏移,打破完美圆环
|
|
173
|
-
transform: function(
|
|
174
|
-
const
|
|
178
|
+
transform: function(n, r) {
|
|
179
|
+
const p = (Math.random() - 0.5) * 40, x = (Math.random() - 0.5) * 10;
|
|
175
180
|
return {
|
|
176
|
-
x:
|
|
177
|
-
y:
|
|
181
|
+
x: r.x + p,
|
|
182
|
+
y: r.y + x
|
|
178
183
|
};
|
|
179
184
|
}
|
|
180
185
|
});
|
|
181
186
|
o.one("layoutstop", () => {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
187
|
+
e.forEach((p) => {
|
|
188
|
+
p.style("z-index", Math.floor(Math.random() * 500) + 1);
|
|
189
|
+
}), t.style("z-index", 1e3);
|
|
190
|
+
const n = t.data("originalPosition"), r = { ...t.position() };
|
|
191
|
+
n && (t.position(n), t.animate({
|
|
192
|
+
center: { eles: t },
|
|
193
|
+
position: r
|
|
194
|
+
}, {
|
|
195
|
+
duration: 900,
|
|
196
|
+
easing: "ease-out",
|
|
197
|
+
complete: () => {
|
|
198
|
+
e.animate({
|
|
199
|
+
style: { opacity: 1 }
|
|
200
|
+
}, {
|
|
201
|
+
duration: 900,
|
|
202
|
+
easing: "ease-out"
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
})), h.destroy();
|
|
206
|
+
}), o.run(), d.nodes().forEach((n) => n.unlock());
|
|
207
|
+
}, me = async (e) => {
|
|
208
|
+
const { id: t, kgId: d } = e, s = c.current;
|
|
209
|
+
if (!s) return;
|
|
210
|
+
const i = s.$id(t);
|
|
192
211
|
if (!i || i.length === 0) {
|
|
193
212
|
console.error("当前节点不存在");
|
|
194
213
|
return;
|
|
195
214
|
}
|
|
196
|
-
const
|
|
197
|
-
if (
|
|
198
|
-
const
|
|
199
|
-
(l) => l.data("source") ===
|
|
200
|
-
),
|
|
201
|
-
|
|
215
|
+
const a = s.nodes().filter((n) => n.data("parentId") ? (n.data("parentId") === t || n.data("idLabel") === `${t}-${n.data("name")}`) && n.data("zktype") === e.zktype : !1);
|
|
216
|
+
if (a.length > 0) {
|
|
217
|
+
const n = a.map((l) => l.id()), r = a.connectedEdges(), p = s.edges().filter(
|
|
218
|
+
(l) => l.data("source") === t && n.includes(l.data("target"))
|
|
219
|
+
), x = s.edges().filter((l) => l.data("appendedBy") === t), A = r.merge(p).merge(x).filter((l) => l.data().zktype === e.zktype);
|
|
220
|
+
a.animate({
|
|
202
221
|
style: { opacity: 0 }
|
|
203
222
|
}, {
|
|
204
223
|
duration: 200,
|
|
205
224
|
complete: () => {
|
|
206
|
-
|
|
207
|
-
const
|
|
208
|
-
var
|
|
209
|
-
const
|
|
210
|
-
if (
|
|
225
|
+
s.remove(a), s.remove(A), X((ee) => {
|
|
226
|
+
const j = ee.filter((k) => {
|
|
227
|
+
var te, oe;
|
|
228
|
+
const S = k.data.zktype;
|
|
229
|
+
if (k.group === "nodes" && n.includes((te = k.data) == null ? void 0 : te.id) && S && S === e.zktype)
|
|
211
230
|
return !1;
|
|
212
|
-
if (
|
|
213
|
-
const
|
|
214
|
-
const H =
|
|
231
|
+
if (k.group === "edges" && S && S === e.zktype) {
|
|
232
|
+
const xe = Array.from(x).map((ze) => {
|
|
233
|
+
const H = ze.data();
|
|
215
234
|
return `${H.source}-${H.target}-${H.label}`;
|
|
216
|
-
}), W =
|
|
217
|
-
return !
|
|
235
|
+
}), W = k.data, ke = xe.includes(`${W.source}-${W.target}-${W.label}`), Ce = ((oe = k.data) == null ? void 0 : oe.appendedBy) === t;
|
|
236
|
+
return !ke && !Ce;
|
|
218
237
|
}
|
|
219
238
|
return !0;
|
|
220
|
-
}), { typeListObj:
|
|
221
|
-
return
|
|
239
|
+
}), { typeListObj: y, relationListObj: R } = Z({}, { graphData: j, typeObj: {} });
|
|
240
|
+
return I(y), B(R), j;
|
|
222
241
|
}), i.data("appendedNodes", []), i.data("isExpanded", !1);
|
|
242
|
+
const l = i.data("originalPosition");
|
|
243
|
+
l && (i.animate({
|
|
244
|
+
position: l
|
|
245
|
+
}, { duration: 300 }), i.data("originalPosition", null));
|
|
223
246
|
}
|
|
224
247
|
}), setTimeout(() => {
|
|
225
248
|
i.removed() || (i.style("border-width", ""), i.style("border-color", ""));
|
|
226
249
|
}, 300);
|
|
227
250
|
} else {
|
|
228
251
|
try {
|
|
229
|
-
U(!0),
|
|
252
|
+
U(!0), h.open({
|
|
230
253
|
type: "loading",
|
|
231
254
|
content: "正在展开...",
|
|
232
255
|
duration: 0
|
|
233
256
|
});
|
|
234
|
-
const
|
|
235
|
-
if (
|
|
257
|
+
const n = await ae({ uri: t, queryType: 1, kgId: d, zktype: e.zktype }), { elements: r, typeListObj: p, relationListObj: x } = Z(n.data, { graphData: v, typeObj: b, relationObj: O, zktype: e.zktype });
|
|
258
|
+
if (I(p), B(x), !((r == null ? void 0 : r.length) > 0)) {
|
|
236
259
|
setTimeout(() => {
|
|
237
|
-
|
|
260
|
+
h.destroy(), h.warning("暂无数据");
|
|
238
261
|
}, 2e3);
|
|
239
262
|
return;
|
|
240
263
|
}
|
|
241
|
-
const
|
|
242
|
-
if ((
|
|
243
|
-
const l =
|
|
244
|
-
if (
|
|
245
|
-
const
|
|
264
|
+
const A = s.zoom();
|
|
265
|
+
if ((r == null ? void 0 : r.length) > 0) {
|
|
266
|
+
const l = r.map((y) => {
|
|
267
|
+
if (y.group === "nodes") {
|
|
268
|
+
const R = Se * K;
|
|
246
269
|
return {
|
|
247
|
-
...
|
|
270
|
+
...y,
|
|
248
271
|
// position,
|
|
249
|
-
style: { opacity:
|
|
272
|
+
style: { opacity: 0, width: R, height: R },
|
|
250
273
|
data: {
|
|
251
|
-
...
|
|
252
|
-
parentId:
|
|
253
|
-
appendedBy:
|
|
254
|
-
idLabel:
|
|
274
|
+
...y.data,
|
|
275
|
+
parentId: t,
|
|
276
|
+
appendedBy: t,
|
|
277
|
+
idLabel: t + "-" + y.data.label,
|
|
255
278
|
zktype: e.zktype,
|
|
256
279
|
isAppended: !0,
|
|
257
280
|
baseWidth: 80,
|
|
@@ -260,38 +283,35 @@ const lt = ({
|
|
|
260
283
|
};
|
|
261
284
|
}
|
|
262
285
|
return {
|
|
263
|
-
...
|
|
264
|
-
data: { ...
|
|
286
|
+
...y,
|
|
287
|
+
data: { ...y.data, appendedBy: t, zktype: e.zktype }
|
|
265
288
|
};
|
|
266
289
|
});
|
|
267
|
-
console.log(888, l),
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
});
|
|
271
|
-
const M = t.add(l).filter(":node");
|
|
272
|
-
fe({ addedNodes: M, currentNode: i, cy: t, currentZoom: B });
|
|
290
|
+
console.log(888, l), s.nodes().lock(), i.unlock();
|
|
291
|
+
const j = s.add(l).filter(":node");
|
|
292
|
+
j.style("opacity", 0), ye({ addedNodes: j, currentNode: i, cy: s, currentZoom: A });
|
|
273
293
|
} else
|
|
274
294
|
console.log("没有找到相关节点数据");
|
|
275
|
-
|
|
276
|
-
} catch (
|
|
277
|
-
|
|
295
|
+
h.destroy();
|
|
296
|
+
} catch (n) {
|
|
297
|
+
h.destroy(), h.error("请求接口失败"), console.error("22请求接口失败:", n);
|
|
278
298
|
}
|
|
279
299
|
U(!1);
|
|
280
300
|
}
|
|
281
|
-
|
|
282
|
-
},
|
|
301
|
+
N({ visible: !1 });
|
|
302
|
+
}, he = {
|
|
283
303
|
expanded: "typed-literal",
|
|
284
304
|
contract: "uri"
|
|
285
|
-
},
|
|
286
|
-
var
|
|
287
|
-
console.log("handleMenuAction:::", e,
|
|
288
|
-
const d =
|
|
305
|
+
}, ve = (e, t) => {
|
|
306
|
+
var s;
|
|
307
|
+
console.log("handleMenuAction:::", e, t);
|
|
308
|
+
const d = t || u.targetNode;
|
|
289
309
|
if (d) {
|
|
290
|
-
const i = e.ids,
|
|
310
|
+
const i = e.ids, a = d.data();
|
|
291
311
|
if (["expanded", "contract"].includes(i))
|
|
292
|
-
|
|
312
|
+
me({ kgId: g.kgId, ...a, zktype: he[i] });
|
|
293
313
|
else if (i === "nodeInfo") {
|
|
294
|
-
const o = d,
|
|
314
|
+
const o = d, n = {
|
|
295
315
|
id: o.id(),
|
|
296
316
|
data: o.data(),
|
|
297
317
|
position: o.position(),
|
|
@@ -301,19 +321,19 @@ const lt = ({
|
|
|
301
321
|
classes: o.classes(),
|
|
302
322
|
style: o.style()
|
|
303
323
|
};
|
|
304
|
-
Y.current.open(
|
|
324
|
+
Y.current.open(n);
|
|
305
325
|
} else i === "knowledgeCard" && _.current.open(d.data());
|
|
306
|
-
(
|
|
326
|
+
(s = e.onClick) == null || s.call(e, d), N({ visible: !1, x: 0, y: 0, targetNode: null });
|
|
307
327
|
}
|
|
308
|
-
},
|
|
328
|
+
}, be = () => {
|
|
309
329
|
const e = {};
|
|
310
|
-
return Object.keys(
|
|
311
|
-
|
|
330
|
+
return Object.keys(b).forEach((t) => {
|
|
331
|
+
t !== "_" && (e[t] = b[t]);
|
|
312
332
|
}), e;
|
|
313
333
|
};
|
|
314
|
-
return /* @__PURE__ */
|
|
315
|
-
/* @__PURE__ */
|
|
316
|
-
/* @__PURE__ */
|
|
334
|
+
return /* @__PURE__ */ f(Me, { value: { pathNodes: ue, setPathNodes: J, graphInfo: g, graphData: v, layoutType: pe, setLayoutType: ge, knowledgeCardApi: re, queryStatisticsConfig: le, actionBar: ie }, children: /* @__PURE__ */ ne("div", { className: We("cytoscape-container relative", ce), children: [
|
|
335
|
+
/* @__PURE__ */ f("div", { className: "btn-group" }),
|
|
336
|
+
/* @__PURE__ */ f(
|
|
317
337
|
we,
|
|
318
338
|
{
|
|
319
339
|
ref: q,
|
|
@@ -321,14 +341,14 @@ const lt = ({
|
|
|
321
341
|
graphInfo: g,
|
|
322
342
|
initNodeScale: K,
|
|
323
343
|
cyContainerRef: L,
|
|
324
|
-
typeObj:
|
|
344
|
+
typeObj: be(),
|
|
325
345
|
relationObj: O,
|
|
326
|
-
colors:
|
|
346
|
+
colors: P
|
|
327
347
|
}
|
|
328
348
|
),
|
|
329
|
-
/* @__PURE__ */
|
|
330
|
-
/* @__PURE__ */
|
|
331
|
-
u.visible && u.targetNode && /* @__PURE__ */
|
|
349
|
+
/* @__PURE__ */ ne("div", { className: "relative h-100", children: [
|
|
350
|
+
/* @__PURE__ */ f("div", { ref: L, className: "cy-container" }),
|
|
351
|
+
u.visible && u.targetNode && /* @__PURE__ */ f(
|
|
332
352
|
"div",
|
|
333
353
|
{
|
|
334
354
|
style: {
|
|
@@ -348,16 +368,16 @@ const lt = ({
|
|
|
348
368
|
overflow: "hidden"
|
|
349
369
|
},
|
|
350
370
|
onClick: (e) => e.stopPropagation(),
|
|
351
|
-
children: /* @__PURE__ */
|
|
371
|
+
children: /* @__PURE__ */ f(Ie, { items: fe, centerImage: (G = u == null ? void 0 : u.targetNode) == null ? void 0 : G.data().image, targetNode: u.targetNode, onClick: (e, t) => ve(e, t) })
|
|
352
372
|
}
|
|
353
373
|
),
|
|
354
|
-
|
|
374
|
+
D.visible && /* @__PURE__ */ f(
|
|
355
375
|
"div",
|
|
356
376
|
{
|
|
357
377
|
style: {
|
|
358
378
|
position: "absolute",
|
|
359
|
-
left: `${
|
|
360
|
-
top: `${
|
|
379
|
+
left: `${D.x}px`,
|
|
380
|
+
top: `${D.y}px`,
|
|
361
381
|
transform: "translateX(-50%)",
|
|
362
382
|
backgroundColor: "rgba(0, 0, 0, 0.85)",
|
|
363
383
|
color: "#fff",
|
|
@@ -371,14 +391,14 @@ const lt = ({
|
|
|
371
391
|
overflow: "hidden",
|
|
372
392
|
textOverflow: "ellipsis"
|
|
373
393
|
},
|
|
374
|
-
children:
|
|
394
|
+
children: D.content
|
|
375
395
|
}
|
|
376
396
|
)
|
|
377
397
|
] }),
|
|
378
|
-
/* @__PURE__ */
|
|
379
|
-
/* @__PURE__ */
|
|
398
|
+
/* @__PURE__ */ f(Be, { ref: Y, cyRef: c }),
|
|
399
|
+
/* @__PURE__ */ f(Ae, { ref: _ })
|
|
380
400
|
] }) });
|
|
381
401
|
};
|
|
382
402
|
export {
|
|
383
|
-
|
|
403
|
+
ct as default
|
|
384
404
|
};
|