react-kggraph 0.0.32 → 0.0.34
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/{src/components → components}/Graph/components/KnowledgeCard/components/ListCard.d.ts +1 -1
- package/lib/{src/components → components}/Graph/components/KnowledgeCard/data.d.ts +1 -1
- package/lib/{src/components → components}/Graph/types.d.ts +7 -6
- package/lib/{src/components → components}/Graph/utils/layouts.d.ts +14 -14
- package/lib/{src/components → components}/Graph/utils/tools.d.ts +2 -2
- package/lib/index.es3.js +245 -232
- package/lib/index.es7.js +217 -217
- package/lib/index.es8.js +0 -1
- package/lib/index.es9.js +10 -10
- package/package.json +1 -1
- /package/lib/{src/components → components}/Graph/api.d.ts +0 -0
- /package/lib/{src/components → components}/Graph/components/ActionBar/actionList.d.ts +0 -0
- /package/lib/{src/components → components}/Graph/components/ActionBar/index.d.ts +0 -0
- /package/lib/{src/components → components}/Graph/components/GraphListData/index.d.ts +0 -0
- /package/lib/{src/components → components}/Graph/components/KnowledgeCard/components/AudioSection.d.ts +0 -0
- /package/lib/{src/components → components}/Graph/components/KnowledgeCard/components/DocumentSection.d.ts +0 -0
- /package/lib/{src/components → components}/Graph/components/KnowledgeCard/components/ImageSection.d.ts +0 -0
- /package/lib/{src/components → components}/Graph/components/KnowledgeCard/components/PropertySection.d.ts +0 -0
- /package/lib/{src/components → components}/Graph/components/KnowledgeCard/components/RelationSection.d.ts +0 -0
- /package/lib/{src/components → components}/Graph/components/KnowledgeCard/components/SourceCard.d.ts +0 -0
- /package/lib/{src/components → components}/Graph/components/KnowledgeCard/components/VideoSection.d.ts +0 -0
- /package/lib/{src/components → components}/Graph/components/KnowledgeCard/index.d.ts +0 -0
- /package/lib/{src/components → components}/Graph/components/NodeInfoDrawer/index.d.ts +0 -0
- /package/lib/{src/components → components}/Graph/components/PathAnalysis/index.d.ts +0 -0
- /package/lib/{src/components → components}/Graph/components/PathAnalysisLevel/index.d.ts +0 -0
- /package/lib/{src/components → components}/Graph/components/QueryNode/index.d.ts +0 -0
- /package/lib/{src/components → components}/Graph/components/SettingCircle/index.d.ts +0 -0
- /package/lib/{src/components → components}/Graph/context.d.ts +0 -0
- /package/lib/{src/components → components}/Graph/index.d.ts +0 -0
- /package/lib/{src/components → components}/Graph/utils/edge_node_styles.d.ts +0 -0
- /package/lib/{src/components → components}/Graph/utils/menuItems.d.ts +0 -0
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 y, 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 Ne from "cytoscape-cise";
|
|
6
|
+
import Pe 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
|
|
11
|
-
import { fixNodesToEdges as
|
|
12
|
-
import { edgeNodeStyles as Re, defaultColors 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
21
|
import We from "./index.es17.js";
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
data:
|
|
29
|
-
getAllGraphData:
|
|
30
|
-
highPathAnalysis:
|
|
22
|
+
z.use(Te);
|
|
23
|
+
z.use(Ne);
|
|
24
|
+
z.use(Pe);
|
|
25
|
+
z.use(je);
|
|
26
|
+
z.use(Ee);
|
|
27
|
+
const ct = ({
|
|
28
|
+
data: E,
|
|
29
|
+
getAllGraphData: $,
|
|
30
|
+
highPathAnalysis: F = [],
|
|
31
31
|
graphInfo: u,
|
|
32
32
|
stepNextApi: ae,
|
|
33
|
-
knowledgeCardApi:
|
|
34
|
-
colors:
|
|
33
|
+
knowledgeCardApi: re,
|
|
34
|
+
colors: N,
|
|
35
35
|
actionBar: ie,
|
|
36
|
-
actionCircle:
|
|
37
|
-
queryStatisticsConfig:
|
|
38
|
-
className:
|
|
39
|
-
noDataDesc:
|
|
36
|
+
actionCircle: de,
|
|
37
|
+
queryStatisticsConfig: le = [{ label: "实体", key: "entity" }, { label: "关系", key: "relation" }],
|
|
38
|
+
className: ce,
|
|
39
|
+
noDataDesc: He = "暂无数据"
|
|
40
40
|
}) => {
|
|
41
|
-
var
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}, [
|
|
46
|
-
const [f,
|
|
41
|
+
var V, G;
|
|
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(N);
|
|
43
|
+
T(() => {
|
|
44
|
+
M.current = N;
|
|
45
|
+
}, [N]);
|
|
46
|
+
const [f, P] = 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:
|
|
60
|
-
((
|
|
61
|
-
}, [w(
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}),
|
|
66
|
-
}, [w(
|
|
67
|
-
var
|
|
68
|
-
if (!
|
|
69
|
-
const { elements:
|
|
70
|
-
|
|
71
|
-
|
|
57
|
+
}), fe = $e({ cyRef: c, setContextMenu: P, onPathAnalysis: (V = q.current) == null ? void 0 : V.onPathAnalysis, setPathNodes: J, actionCircle: de });
|
|
58
|
+
T(() => {
|
|
59
|
+
const { nodes: t, links: e } = F || {};
|
|
60
|
+
((t == null ? void 0 : t.length) > 0 || (e == null ? void 0 : e.length) > 0) && Le(c, { nodes: t, links: e, isGrayed: !1 });
|
|
61
|
+
}, [w(F), w(v)]), T(() => {
|
|
62
|
+
const t = [], e = [];
|
|
63
|
+
v.forEach((d) => {
|
|
64
|
+
d.group === "nodes" ? t.push(d.data) : d.group === "edges" && e.push(d.data);
|
|
65
|
+
}), $ == null || $({ graphData: v, nodeStatic: b, relationStatic: O, data: { nodes: t, links: e }, paths: E.paths, data2: E.data2, logId: E.logId, costtime: E.costtime });
|
|
66
|
+
}, [w(v), w(b), w(O)]), T(() => {
|
|
67
|
+
var i;
|
|
68
|
+
if (!L.current || c.current) return;
|
|
69
|
+
const { elements: t, typeListObj: e, relationListObj: d } = Z(E, { typeObj: b, graphInfo: u });
|
|
70
|
+
I(e), X(t), B(d), document.addEventListener("contextmenu", function(a) {
|
|
71
|
+
a.preventDefault();
|
|
72
72
|
});
|
|
73
|
-
const
|
|
74
|
-
container:
|
|
75
|
-
elements:
|
|
76
|
-
style: Re({ elements:
|
|
73
|
+
const s = z({
|
|
74
|
+
container: L.current,
|
|
75
|
+
elements: t,
|
|
76
|
+
style: Re({ elements: t, colors: N }),
|
|
77
77
|
autounselectify: !1,
|
|
78
78
|
autolock: !1,
|
|
79
79
|
maxZoom: 1,
|
|
@@ -82,142 +82,196 @@ const lt = ({
|
|
|
82
82
|
// 使用预设布局,完全依赖 position
|
|
83
83
|
}
|
|
84
84
|
});
|
|
85
|
-
if (
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
if (c.current = s, ((i = u == null ? void 0 : u.searchNodes) == null ? void 0 : i.length) === 2)
|
|
86
|
+
Oe(
|
|
87
|
+
s,
|
|
88
88
|
u.searchNodes[0],
|
|
89
89
|
u.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 =
|
|
124
|
-
o.addClass("hover"),
|
|
122
|
+
}), s.on("mouseover", "node", (a) => {
|
|
123
|
+
const o = a.target, n = o.renderedPosition(), r = o.data("name") || "";
|
|
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")), P({
|
|
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
|
-
}),
|
|
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), g = r.edgesWith(r);
|
|
146
|
+
console.log("cy.nodes().not(relatedNodes):::", r), s.nodes().not(r).addClass("grayed"), s.edges().not(g).addClass("grayed"), r.addClass("highlighted"), g.addClass("highlighted");
|
|
147
|
+
}), s.on("tap", (a) => {
|
|
148
|
+
a.target === s && (P((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
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
const
|
|
157
|
-
|
|
153
|
+
const ye = ({ addedNodes: t, currentNode: e, cy: d, currentZoom: s }) => {
|
|
154
|
+
const i = t == null ? void 0 : t.length;
|
|
155
|
+
e.data("originalPosition") || e.data("originalPosition", { ...e.position() });
|
|
156
|
+
const a = Math.max(0.1, 18 / (i || 1)), o = d.layout({
|
|
157
|
+
name: "concentric",
|
|
158
|
+
spacingFactor: a,
|
|
159
|
+
// 节点越多间距越小,防止溢出
|
|
160
|
+
minNodeSpacing: 0,
|
|
161
|
+
// 最小间距设为0
|
|
162
|
+
animate: !1,
|
|
163
|
+
concentric: function(n) {
|
|
164
|
+
return n.degree();
|
|
165
|
+
},
|
|
166
|
+
levelWidth: function(n) {
|
|
167
|
+
return 2;
|
|
168
|
+
},
|
|
169
|
+
// 随机排序
|
|
170
|
+
// sort: function(a, b) {
|
|
171
|
+
// return Math.random() - 0.5;
|
|
172
|
+
// },
|
|
173
|
+
// 添加随机偏移,打破完美圆环
|
|
174
|
+
transform: function(n, r) {
|
|
175
|
+
const g = (Math.random() - 0.5) * 40, x = (Math.random() - 0.5) * 10;
|
|
176
|
+
return {
|
|
177
|
+
x: r.x + g,
|
|
178
|
+
y: r.y + x
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
o.one("layoutstop", () => {
|
|
183
|
+
t.forEach((g) => {
|
|
184
|
+
g.style("z-index", Math.floor(Math.random() * 500) + 1);
|
|
185
|
+
}), e.style("z-index", 1e3);
|
|
186
|
+
const n = e.data("originalPosition"), r = { ...e.position() };
|
|
187
|
+
n && (e.position(n), e.animate({
|
|
188
|
+
center: { eles: e },
|
|
189
|
+
position: r
|
|
190
|
+
}, {
|
|
191
|
+
duration: 900,
|
|
192
|
+
easing: "ease-out",
|
|
193
|
+
complete: () => {
|
|
194
|
+
t.animate({
|
|
195
|
+
style: { opacity: 1 }
|
|
196
|
+
}, {
|
|
197
|
+
duration: 900,
|
|
198
|
+
easing: "ease-out"
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
})), h.destroy();
|
|
202
|
+
}), o.run(), d.nodes().forEach((n) => n.unlock());
|
|
203
|
+
}, me = async (t) => {
|
|
204
|
+
const { id: e, kgId: d } = t, s = c.current;
|
|
205
|
+
if (!s) return;
|
|
206
|
+
const i = s.$id(e);
|
|
207
|
+
if (!i || i.length === 0) {
|
|
158
208
|
console.error("当前节点不存在");
|
|
159
209
|
return;
|
|
160
210
|
}
|
|
161
|
-
const
|
|
162
|
-
if (
|
|
163
|
-
const
|
|
164
|
-
(
|
|
165
|
-
),
|
|
166
|
-
|
|
211
|
+
const a = s.nodes().filter((n) => n.data("parentId") ? (n.data("parentId") === e || n.data("idLabel") === `${e}-${n.data("name")}`) && n.data("zktype") === t.zktype : !1);
|
|
212
|
+
if (a.length > 0) {
|
|
213
|
+
const n = a.map((l) => l.id()), r = a.connectedEdges(), g = s.edges().filter(
|
|
214
|
+
(l) => l.data("source") === e && n.includes(l.data("target"))
|
|
215
|
+
), x = s.edges().filter((l) => l.data("appendedBy") === e), A = r.merge(g).merge(x).filter((l) => l.data().zktype === t.zktype);
|
|
216
|
+
a.animate({
|
|
167
217
|
style: { opacity: 0 }
|
|
168
218
|
}, {
|
|
169
219
|
duration: 200,
|
|
170
220
|
complete: () => {
|
|
171
|
-
|
|
172
|
-
const
|
|
173
|
-
var
|
|
174
|
-
const
|
|
175
|
-
if (
|
|
221
|
+
s.remove(a), s.remove(A), X((ee) => {
|
|
222
|
+
const j = ee.filter((k) => {
|
|
223
|
+
var te, oe;
|
|
224
|
+
const S = k.data.zktype;
|
|
225
|
+
if (k.group === "nodes" && n.includes((te = k.data) == null ? void 0 : te.id) && S && S === t.zktype)
|
|
176
226
|
return !1;
|
|
177
|
-
if (
|
|
178
|
-
const
|
|
179
|
-
const
|
|
180
|
-
return `${
|
|
181
|
-
}),
|
|
182
|
-
return !
|
|
227
|
+
if (k.group === "edges" && S && S === t.zktype) {
|
|
228
|
+
const xe = Array.from(x).map((ze) => {
|
|
229
|
+
const H = ze.data();
|
|
230
|
+
return `${H.source}-${H.target}-${H.label}`;
|
|
231
|
+
}), W = k.data, ke = xe.includes(`${W.source}-${W.target}-${W.label}`), Ce = ((oe = k.data) == null ? void 0 : oe.appendedBy) === e;
|
|
232
|
+
return !ke && !Ce;
|
|
183
233
|
}
|
|
184
234
|
return !0;
|
|
185
|
-
}), { typeListObj:
|
|
186
|
-
return
|
|
187
|
-
}),
|
|
235
|
+
}), { typeListObj: p, relationListObj: R } = Z({}, { graphData: j, typeObj: {} });
|
|
236
|
+
return I(p), B(R), j;
|
|
237
|
+
}), i.data("appendedNodes", []), i.data("isExpanded", !1);
|
|
238
|
+
const l = i.data("originalPosition");
|
|
239
|
+
l && (i.animate({
|
|
240
|
+
position: l
|
|
241
|
+
}, { duration: 300 }), i.data("originalPosition", null));
|
|
188
242
|
}
|
|
189
243
|
}), setTimeout(() => {
|
|
190
|
-
|
|
244
|
+
i.removed() || (i.style("border-width", ""), i.style("border-color", ""));
|
|
191
245
|
}, 300);
|
|
192
246
|
} else {
|
|
193
247
|
try {
|
|
194
|
-
|
|
248
|
+
U(!0), h.open({
|
|
195
249
|
type: "loading",
|
|
196
250
|
content: "正在展开...",
|
|
197
251
|
duration: 0
|
|
198
252
|
});
|
|
199
|
-
const
|
|
200
|
-
if (
|
|
253
|
+
const n = await ae({ uri: e, queryType: 1, kgId: d, zktype: t.zktype }), { elements: r, typeListObj: g, relationListObj: x } = Z(n.data, { graphData: v, typeObj: b, relationObj: O, zktype: t.zktype });
|
|
254
|
+
if (I(g), B(x), !((r == null ? void 0 : r.length) > 0)) {
|
|
201
255
|
setTimeout(() => {
|
|
202
|
-
|
|
256
|
+
h.destroy(), h.warning("暂无数据");
|
|
203
257
|
}, 2e3);
|
|
204
258
|
return;
|
|
205
259
|
}
|
|
206
|
-
const A =
|
|
207
|
-
if (
|
|
208
|
-
const
|
|
209
|
-
if (
|
|
210
|
-
const
|
|
260
|
+
const A = s.zoom();
|
|
261
|
+
if ((r == null ? void 0 : r.length) > 0) {
|
|
262
|
+
const l = r.map((p) => {
|
|
263
|
+
if (p.group === "nodes") {
|
|
264
|
+
const R = Se * K;
|
|
211
265
|
return {
|
|
212
|
-
...
|
|
266
|
+
...p,
|
|
213
267
|
// position,
|
|
214
|
-
style: { opacity:
|
|
268
|
+
style: { opacity: 0, width: R, height: R },
|
|
215
269
|
data: {
|
|
216
|
-
...
|
|
217
|
-
parentId:
|
|
218
|
-
appendedBy:
|
|
219
|
-
idLabel:
|
|
220
|
-
zktype:
|
|
270
|
+
...p.data,
|
|
271
|
+
parentId: e,
|
|
272
|
+
appendedBy: e,
|
|
273
|
+
idLabel: e + "-" + p.data.label,
|
|
274
|
+
zktype: t.zktype,
|
|
221
275
|
isAppended: !0,
|
|
222
276
|
baseWidth: 80,
|
|
223
277
|
baseHeight: 80
|
|
@@ -225,77 +279,38 @@ const lt = ({
|
|
|
225
279
|
};
|
|
226
280
|
}
|
|
227
281
|
return {
|
|
228
|
-
...
|
|
229
|
-
data: { ...
|
|
282
|
+
...p,
|
|
283
|
+
data: { ...p.data, appendedBy: e, zktype: t.zktype }
|
|
230
284
|
};
|
|
231
285
|
});
|
|
232
|
-
console.log(888,
|
|
233
|
-
if (
|
|
234
|
-
return
|
|
235
|
-
});
|
|
236
|
-
const M = e.add(c).filter(":node"), ne = d.position(), y = e.layout({
|
|
237
|
-
name: "concentric",
|
|
238
|
-
// ✅ 使用 concentric 实现多层
|
|
239
|
-
eles: M,
|
|
240
|
-
fit: !1,
|
|
241
|
-
animate: !0,
|
|
242
|
-
animationDuration: 500,
|
|
243
|
-
avoidOverlap: !1,
|
|
244
|
-
// 允许重叠
|
|
245
|
-
spacingFactor: 3,
|
|
246
|
-
// 层间距因子
|
|
247
|
-
minNodeSpacing: 100,
|
|
248
|
-
// radius: 120,
|
|
249
|
-
// ✅ 决定节点在哪个层(返回相同值=同层,不同值=不同层)
|
|
250
|
-
concentric: function(i) {
|
|
251
|
-
return i.degree();
|
|
252
|
-
},
|
|
253
|
-
// ✅ 每层最少节点数(决定层数)
|
|
254
|
-
levelWidth: function(i) {
|
|
255
|
-
return 2;
|
|
256
|
-
},
|
|
257
|
-
// 随机排序
|
|
258
|
-
// sort: function(a, b) {
|
|
259
|
-
// return Math.random() - 0.5;
|
|
260
|
-
// },
|
|
261
|
-
// 添加随机偏移,打破完美圆环
|
|
262
|
-
transform: function(i, h) {
|
|
263
|
-
const S = (Math.random() - 0.5) * 20, H = (Math.random() - 0.5) * 20;
|
|
264
|
-
return {
|
|
265
|
-
x: h.x + S,
|
|
266
|
-
y: h.y + H
|
|
267
|
-
};
|
|
268
|
-
}
|
|
286
|
+
console.log(888, l), s.nodes().forEach((p) => {
|
|
287
|
+
if (p.data("id") !== e)
|
|
288
|
+
return p.lock();
|
|
269
289
|
});
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
center: { eles: d },
|
|
273
|
-
zoom: A,
|
|
274
|
-
duration: 400
|
|
275
|
-
}), b.destroy();
|
|
276
|
-
}), y.run();
|
|
290
|
+
const j = s.add(l).filter(":node");
|
|
291
|
+
j.style("opacity", 0), ye({ addedNodes: j, currentNode: i, cy: s, currentZoom: A });
|
|
277
292
|
} else
|
|
278
293
|
console.log("没有找到相关节点数据");
|
|
279
|
-
|
|
280
|
-
} catch (
|
|
281
|
-
|
|
294
|
+
h.destroy();
|
|
295
|
+
} catch (n) {
|
|
296
|
+
h.destroy(), h.error("请求接口失败"), console.error("22请求接口失败:", n);
|
|
282
297
|
}
|
|
283
|
-
|
|
298
|
+
U(!1);
|
|
284
299
|
}
|
|
285
|
-
|
|
300
|
+
P({ visible: !1 });
|
|
286
301
|
}, he = {
|
|
287
302
|
expanded: "typed-literal",
|
|
288
303
|
contract: "uri"
|
|
289
|
-
}, ve = (
|
|
290
|
-
var
|
|
291
|
-
console.log("handleMenuAction:::",
|
|
292
|
-
const
|
|
293
|
-
if (
|
|
294
|
-
const
|
|
295
|
-
if (["expanded", "contract"].includes(
|
|
296
|
-
me({ kgId: u.kgId, ...
|
|
297
|
-
else if (
|
|
298
|
-
const o =
|
|
304
|
+
}, ve = (t, e) => {
|
|
305
|
+
var s;
|
|
306
|
+
console.log("handleMenuAction:::", t, e);
|
|
307
|
+
const d = e || f.targetNode;
|
|
308
|
+
if (d) {
|
|
309
|
+
const i = t.ids, a = d.data();
|
|
310
|
+
if (["expanded", "contract"].includes(i))
|
|
311
|
+
me({ kgId: u.kgId, ...a, zktype: he[i] });
|
|
312
|
+
else if (i === "nodeInfo") {
|
|
313
|
+
const o = d, n = {
|
|
299
314
|
id: o.id(),
|
|
300
315
|
data: o.data(),
|
|
301
316
|
position: o.position(),
|
|
@@ -305,36 +320,34 @@ const lt = ({
|
|
|
305
320
|
classes: o.classes(),
|
|
306
321
|
style: o.style()
|
|
307
322
|
};
|
|
308
|
-
|
|
309
|
-
} else
|
|
310
|
-
(
|
|
323
|
+
Y.current.open(n);
|
|
324
|
+
} else i === "knowledgeCard" && _.current.open(d.data());
|
|
325
|
+
(s = t.onClick) == null || s.call(t, d), P({ visible: !1, x: 0, y: 0, targetNode: null });
|
|
311
326
|
}
|
|
327
|
+
}, be = () => {
|
|
328
|
+
const t = {};
|
|
329
|
+
return Object.keys(b).forEach((e) => {
|
|
330
|
+
e !== "_" && (t[e] = b[e]);
|
|
331
|
+
}), t;
|
|
312
332
|
};
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
return Object.keys(x).forEach((s) => {
|
|
317
|
-
s !== "_" && (n[s] = x[s]);
|
|
318
|
-
}), n;
|
|
319
|
-
};
|
|
320
|
-
return /* @__PURE__ */ m(Be, { value: { pathNodes: fe, setPathNodes: V, graphInfo: u, graphData: g, layoutType: ge, setLayoutType: ue, knowledgeCardApi: de, queryStatisticsConfig: ce, actionBar: ie }, children: /* @__PURE__ */ se("div", { className: We("cytoscape-container relative", pe), children: [
|
|
321
|
-
/* @__PURE__ */ m("div", { className: "btn-group" }),
|
|
322
|
-
/* @__PURE__ */ m(
|
|
333
|
+
return /* @__PURE__ */ y(Me, { value: { pathNodes: ue, setPathNodes: J, graphInfo: u, graphData: v, layoutType: pe, setLayoutType: ge, knowledgeCardApi: re, queryStatisticsConfig: le, actionBar: ie }, children: /* @__PURE__ */ ne("div", { className: We("cytoscape-container relative", ce), children: [
|
|
334
|
+
/* @__PURE__ */ y("div", { className: "btn-group" }),
|
|
335
|
+
/* @__PURE__ */ y(
|
|
323
336
|
we,
|
|
324
337
|
{
|
|
325
|
-
ref:
|
|
326
|
-
cyRef:
|
|
338
|
+
ref: q,
|
|
339
|
+
cyRef: c,
|
|
327
340
|
graphInfo: u,
|
|
328
|
-
initNodeScale:
|
|
329
|
-
cyContainerRef:
|
|
341
|
+
initNodeScale: K,
|
|
342
|
+
cyContainerRef: L,
|
|
330
343
|
typeObj: be(),
|
|
331
|
-
relationObj:
|
|
332
|
-
colors:
|
|
344
|
+
relationObj: O,
|
|
345
|
+
colors: N
|
|
333
346
|
}
|
|
334
347
|
),
|
|
335
|
-
/* @__PURE__ */
|
|
336
|
-
/* @__PURE__ */
|
|
337
|
-
f.visible && f.targetNode && /* @__PURE__ */
|
|
348
|
+
/* @__PURE__ */ ne("div", { className: "relative h-100", children: [
|
|
349
|
+
/* @__PURE__ */ y("div", { ref: L, className: "cy-container" }),
|
|
350
|
+
f.visible && f.targetNode && /* @__PURE__ */ y(
|
|
338
351
|
"div",
|
|
339
352
|
{
|
|
340
353
|
style: {
|
|
@@ -353,17 +366,17 @@ const lt = ({
|
|
|
353
366
|
height: "200px",
|
|
354
367
|
overflow: "hidden"
|
|
355
368
|
},
|
|
356
|
-
onClick: (
|
|
357
|
-
children: /* @__PURE__ */
|
|
369
|
+
onClick: (t) => t.stopPropagation(),
|
|
370
|
+
children: /* @__PURE__ */ y(Ie, { items: fe, centerImage: (G = f == null ? void 0 : f.targetNode) == null ? void 0 : G.data().image, targetNode: f.targetNode, onClick: (t, e) => ve(t, e) })
|
|
358
371
|
}
|
|
359
372
|
),
|
|
360
|
-
|
|
373
|
+
D.visible && /* @__PURE__ */ y(
|
|
361
374
|
"div",
|
|
362
375
|
{
|
|
363
376
|
style: {
|
|
364
377
|
position: "absolute",
|
|
365
|
-
left: `${
|
|
366
|
-
top: `${
|
|
378
|
+
left: `${D.x}px`,
|
|
379
|
+
top: `${D.y}px`,
|
|
367
380
|
transform: "translateX(-50%)",
|
|
368
381
|
backgroundColor: "rgba(0, 0, 0, 0.85)",
|
|
369
382
|
color: "#fff",
|
|
@@ -377,14 +390,14 @@ const lt = ({
|
|
|
377
390
|
overflow: "hidden",
|
|
378
391
|
textOverflow: "ellipsis"
|
|
379
392
|
},
|
|
380
|
-
children:
|
|
393
|
+
children: D.content
|
|
381
394
|
}
|
|
382
395
|
)
|
|
383
396
|
] }),
|
|
384
|
-
/* @__PURE__ */
|
|
385
|
-
/* @__PURE__ */
|
|
397
|
+
/* @__PURE__ */ y(Be, { ref: Y, cyRef: c }),
|
|
398
|
+
/* @__PURE__ */ y(Ae, { ref: _ })
|
|
386
399
|
] }) });
|
|
387
400
|
};
|
|
388
401
|
export {
|
|
389
|
-
|
|
402
|
+
ct as default
|
|
390
403
|
};
|