react-kggraph 0.0.8 → 0.0.9
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.es.js +8 -4
- package/lib/index.es10.js +188 -0
- package/lib/index.es11.js +72 -0
- package/lib/index.es12.js +32 -0
- package/lib/index.es13.js +72 -0
- package/lib/index.es14.js +226 -0
- package/lib/index.es15.js +6 -0
- package/lib/index.es16.js +38 -0
- package/lib/index.es18.js +15469 -0
- package/lib/index.es19.js +56 -0
- package/lib/index.es20.js +62 -0
- package/lib/index.es21.js +71 -0
- package/lib/index.es22.js +42 -0
- package/lib/index.es23.js +4 -0
- package/lib/index.es24.js +4 -0
- package/lib/index.es25.js +4 -0
- package/lib/index.es26.js +4 -0
- package/lib/index.es27.js +4 -0
- package/lib/index.es28.js +4 -0
- package/lib/index.es29.js +4 -0
- package/lib/index.es3.js +356 -0
- package/lib/index.es30.js +4 -0
- package/lib/index.es31.js +4 -0
- package/lib/index.es32.js +4 -0
- package/lib/index.es33.js +4 -0
- package/lib/index.es35.js +6 -0
- package/lib/index.es36.js +4 -0
- package/lib/index.es4.js +8 -0
- package/lib/index.es5.js +4 -0
- package/lib/index.es6.js +601 -0
- package/lib/index.es7.js +7 -0
- package/lib/index.es8.js +324 -0
- package/lib/index.es9.js +423 -0
- package/lib/style.css +1 -0
- package/package.json +2 -3
- package/lib/index10.es.js +0 -4
- package/lib/index11.es.js +0 -4
- package/lib/index12.es.js +0 -4
- package/lib/index13.es.js +0 -4
- package/lib/index14.es.js +0 -4
- package/lib/index15.es.js +0 -4
- package/lib/index16.es.js +0 -4
- package/lib/index17.es.js +0 -25
- package/lib/index18.es.js +0 -330
- package/lib/index19.es.js +0 -5
- package/lib/index2.es.js +0 -13
- package/lib/index20.es.js +0 -284
- package/lib/index22.es.js +0 -70
- package/lib/index24.es.js +0 -68
- package/lib/index26.es.js +0 -72
- package/lib/index27.es.js +0 -32
- package/lib/index28.es.js +0 -828
- package/lib/index29.es.js +0 -4
- package/lib/index30.es.js +0 -161
- package/lib/index31.es.js +0 -71
- package/lib/index33.es.js +0 -100
- package/lib/index34.es.js +0 -250
- package/lib/index35.es.js +0 -47
- package/lib/index36.es.js +0 -376
- package/lib/index37.es.js +0 -12
- package/lib/index38.es.js +0 -6
- package/lib/index5.es.js +0 -12387
- package/lib/index6.es.js +0 -4
- package/lib/index7.es.js +0 -4
- package/lib/index8.es.js +0 -4
- package/lib/index9.es.js +0 -4
- package/lib/react-kggraph.css +0 -2
package/lib/index.es6.js
ADDED
|
@@ -0,0 +1,601 @@
|
|
|
1
|
+
import { jsxs as o, Fragment as A, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Me, useContext as qe, useState as w, useRef as Be, useImperativeHandle as Qe, useEffect as Ze } from "react";
|
|
3
|
+
import { AppstoreOutlined as Ge, TableOutlined as Ke, RobotOutlined as Ue, LineChartOutlined as Xe, SelectOutlined as Ye, SaveOutlined as Re, BorderOuterOutlined as et, LineHeightOutlined as tt, ClearOutlined as nt, PlusCircleOutlined as lt, MinusCircleOutlined as st, PlusSquareOutlined as ot, MinusSquareOutlined as at } from "@ant-design/icons";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { Flex as i, Dropdown as j, Modal as it, Drawer as rt, Tabs as se, Form as c, Input as C, Select as a, Button as re, message as P } from "antd";
|
|
6
|
+
import { utils as E, writeFile as ct } from "./index.es18.js";
|
|
7
|
+
import { layoutCongig as dt, linkAnalysis as ht, choiceConfig as ut, downloadData as mt, textPositionConfig as ce, textLayout as gt, handleCalcPath as pt, getCyData as oe, donwnGraphData as ft } from "./index.es8.js";
|
|
8
|
+
import { GraphContext as wt } from "./index.es15.js";
|
|
9
|
+
import { layout as bt, fixNodesToEdges as yt } from "./index.es9.js";
|
|
10
|
+
import vt from "./index.es19.js";
|
|
11
|
+
import Ct from "./index.es20.js";
|
|
12
|
+
import Nt from "./index.es21.js";
|
|
13
|
+
import ae from "./index.es22.js";
|
|
14
|
+
import { downloadFile as ie } from "./index.es12.js";
|
|
15
|
+
const z = (f, r) => (y) => {
|
|
16
|
+
y.stopPropagation(), f == null || f(r || "");
|
|
17
|
+
}, Wt = Me(({
|
|
18
|
+
graphInfo: f,
|
|
19
|
+
cyRef: r,
|
|
20
|
+
initNodeScale: y,
|
|
21
|
+
typeObj: N,
|
|
22
|
+
relationObj: O
|
|
23
|
+
}, de) => {
|
|
24
|
+
var X, Y, R, ee, te, ne, le;
|
|
25
|
+
const { layoutType: he, setLayoutType: ue } = qe(wt), [k, me] = w(""), [ge, F] = w(!1), [H, pe] = w(y), [fe, I] = w(!1), [we, D] = w(!1), [W, be] = w(null), [ye, J] = w(!1), [ve, $] = w(!1), [Ce, Ne] = w("node"), V = Be(null), [M, xe] = w(!0), [q, Se] = w(/* @__PURE__ */ new Set()), [B, ke] = w(/* @__PURE__ */ new Set());
|
|
26
|
+
Qe(de, () => ({
|
|
27
|
+
onPathAnalysis: () => {
|
|
28
|
+
G();
|
|
29
|
+
}
|
|
30
|
+
})), Ze(() => {
|
|
31
|
+
Q();
|
|
32
|
+
}, [k]);
|
|
33
|
+
const Q = async (e) => {
|
|
34
|
+
const n = r.current;
|
|
35
|
+
if (!n || !k) {
|
|
36
|
+
n == null || n.nodes().removeClass("highlight"), n == null || n.fit();
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const l = n.nodes().filter((s) => {
|
|
40
|
+
const u = (s.data("name") || "").toLowerCase(), h = (s.data("role") || "").toLowerCase(), b = (s.data("dept") || "").toLowerCase(), g = String(s.data("id") || "").toLowerCase();
|
|
41
|
+
return u.includes(k.toLowerCase()) || h.includes(k.toLowerCase()) || b.includes(k.toLowerCase()) || g.includes(k.toLowerCase());
|
|
42
|
+
});
|
|
43
|
+
n.nodes().removeClass("highlight"), l.addClass("highlight"), l.length === 1 ? (console.log("matchedNodes:::", l), n.animate({
|
|
44
|
+
center: {
|
|
45
|
+
eles: l
|
|
46
|
+
},
|
|
47
|
+
duration: 500
|
|
48
|
+
})) : alert("未找到对应节点");
|
|
49
|
+
}, Z = (e) => {
|
|
50
|
+
const n = r.current;
|
|
51
|
+
if (!n) return;
|
|
52
|
+
const l = n.zoom();
|
|
53
|
+
console.log(999, l);
|
|
54
|
+
let s = 0;
|
|
55
|
+
switch (e) {
|
|
56
|
+
case "out":
|
|
57
|
+
s = Math.max(l * 0.8, 0.1);
|
|
58
|
+
break;
|
|
59
|
+
case "in":
|
|
60
|
+
s = Math.min(l * 1.2, 3);
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
n.zoom(s), n.center();
|
|
64
|
+
}, Oe = () => {
|
|
65
|
+
console.log("查询节点"), I(!0), D(!1), V.current.close();
|
|
66
|
+
}, G = () => {
|
|
67
|
+
console.log("路径分析"), I(!1), D(!0), V.current.close();
|
|
68
|
+
}, Le = (e) => {
|
|
69
|
+
var l;
|
|
70
|
+
ue(e);
|
|
71
|
+
const n = r.current;
|
|
72
|
+
n && (n.nodes().unlock(), bt(r, e), e === "cose-bilkent" && ((l = f == null ? void 0 : f.searchNodes) == null ? void 0 : l.length) === 2 && yt(
|
|
73
|
+
n,
|
|
74
|
+
f.searchNodes[0],
|
|
75
|
+
f.searchNodes[1]
|
|
76
|
+
));
|
|
77
|
+
}, je = () => {
|
|
78
|
+
const e = r.current;
|
|
79
|
+
e && ft(e);
|
|
80
|
+
}, Ee = () => {
|
|
81
|
+
const e = r.current;
|
|
82
|
+
if (!e) return;
|
|
83
|
+
const n = oe(e);
|
|
84
|
+
be(n), J(!0);
|
|
85
|
+
}, K = (e, n) => {
|
|
86
|
+
const l = e.current;
|
|
87
|
+
if (!l) return;
|
|
88
|
+
const s = 2;
|
|
89
|
+
if (n === "downloadPng") {
|
|
90
|
+
const u = l.png({ scale: s, bg: "transparent", full: !0, quality: 1 });
|
|
91
|
+
ie(u, `graph_${Date.now()}.png`);
|
|
92
|
+
} else if (n === "downloadJpg") {
|
|
93
|
+
const u = l.jpg({ scale: s, bg: "#ffffff", full: !0, quality: 1 });
|
|
94
|
+
ie(u, `graph_${Date.now()}.jpg`);
|
|
95
|
+
}
|
|
96
|
+
}, Ie = () => {
|
|
97
|
+
const e = r.current;
|
|
98
|
+
if (!e) return;
|
|
99
|
+
const n = oe(e), { nodes: l = [], edges: s = [] } = n, u = l.map((g) => {
|
|
100
|
+
var m, p;
|
|
101
|
+
const d = g.data || {}, L = d.properties || {};
|
|
102
|
+
return {
|
|
103
|
+
节点名称: d.name || d.label || "",
|
|
104
|
+
节点ID: d.id || "",
|
|
105
|
+
节点类型: d.types || "",
|
|
106
|
+
URI: d.label || "",
|
|
107
|
+
X坐标: ((m = g.position) == null ? void 0 : m.x) || "",
|
|
108
|
+
Y坐标: ((p = g.position) == null ? void 0 : p.y) || "",
|
|
109
|
+
层级: d.level || "",
|
|
110
|
+
宽度: d.baseWidth || "",
|
|
111
|
+
高度: d.baseHeight || "",
|
|
112
|
+
图片: d.image || "",
|
|
113
|
+
属性ID: L.id || "",
|
|
114
|
+
属性值: L.value || ""
|
|
115
|
+
};
|
|
116
|
+
}), h = s.map((g) => {
|
|
117
|
+
var p, v, x, S;
|
|
118
|
+
const d = g.data || {}, L = ((v = (p = d.source) == null ? void 0 : p.split("/#")[0]) == null ? void 0 : v.split("/").pop()) || d.source, m = ((S = (x = d.target) == null ? void 0 : x.split("/#")[0]) == null ? void 0 : S.split("/").pop()) || d.target;
|
|
119
|
+
return {
|
|
120
|
+
源节点: L,
|
|
121
|
+
目标节点: m,
|
|
122
|
+
源URI: d.source || "",
|
|
123
|
+
目标URI: d.target || "",
|
|
124
|
+
关系名称: d.name || d.label || "",
|
|
125
|
+
关系ID: d.id || ""
|
|
126
|
+
};
|
|
127
|
+
}), b = E.book_new();
|
|
128
|
+
if (u.length > 0) {
|
|
129
|
+
const g = E.json_to_sheet(u);
|
|
130
|
+
g["!cols"] = [
|
|
131
|
+
{ wch: 30 },
|
|
132
|
+
// 节点名称
|
|
133
|
+
{ wch: 60 },
|
|
134
|
+
// 节点ID
|
|
135
|
+
{ wch: 15 },
|
|
136
|
+
// 节点类型
|
|
137
|
+
{ wch: 50 },
|
|
138
|
+
// URI
|
|
139
|
+
{ wch: 12 },
|
|
140
|
+
// X坐标
|
|
141
|
+
{ wch: 12 },
|
|
142
|
+
// Y坐标
|
|
143
|
+
{ wch: 8 },
|
|
144
|
+
// 层级
|
|
145
|
+
{ wch: 8 },
|
|
146
|
+
// 宽度
|
|
147
|
+
{ wch: 8 },
|
|
148
|
+
// 高度
|
|
149
|
+
{ wch: 40 },
|
|
150
|
+
// 图片
|
|
151
|
+
{ wch: 50 },
|
|
152
|
+
// 属性ID
|
|
153
|
+
{ wch: 40 }
|
|
154
|
+
// 属性值
|
|
155
|
+
], E.book_append_sheet(b, g, "节点");
|
|
156
|
+
}
|
|
157
|
+
if (h.length > 0) {
|
|
158
|
+
const g = E.json_to_sheet(h);
|
|
159
|
+
g["!cols"] = [
|
|
160
|
+
{ wch: 30 },
|
|
161
|
+
// 源节点
|
|
162
|
+
{ wch: 30 },
|
|
163
|
+
// 目标节点
|
|
164
|
+
{ wch: 60 },
|
|
165
|
+
// 源URI
|
|
166
|
+
{ wch: 60 },
|
|
167
|
+
// 目标URI
|
|
168
|
+
{ wch: 15 },
|
|
169
|
+
// 关系名称
|
|
170
|
+
{ wch: 40 }
|
|
171
|
+
// 关系ID
|
|
172
|
+
], E.book_append_sheet(b, g, "关系");
|
|
173
|
+
}
|
|
174
|
+
ct(b, `graph_${Date.now()}.xlsx`);
|
|
175
|
+
}, De = (e, n) => {
|
|
176
|
+
switch (e.stopPropagation(), n) {
|
|
177
|
+
case "downloadJson":
|
|
178
|
+
je();
|
|
179
|
+
break;
|
|
180
|
+
case "previewJsonList":
|
|
181
|
+
Ee();
|
|
182
|
+
break;
|
|
183
|
+
case "downloadExcel":
|
|
184
|
+
Ie();
|
|
185
|
+
break;
|
|
186
|
+
case "previewDataList":
|
|
187
|
+
break;
|
|
188
|
+
case "downloadJpg":
|
|
189
|
+
K(r, n);
|
|
190
|
+
break;
|
|
191
|
+
case "downloadPng":
|
|
192
|
+
K(r, n);
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
}, Ve = () => {
|
|
196
|
+
I(!1), D(!1), V.current.open();
|
|
197
|
+
}, Pe = (e) => {
|
|
198
|
+
const n = r.current;
|
|
199
|
+
if (n)
|
|
200
|
+
if (n.panningEnabled(!0), e === "all")
|
|
201
|
+
n.nodes().addClass("selected"), n.nodes().select(), n.elements().select();
|
|
202
|
+
else if (e === "reverse") {
|
|
203
|
+
const l = n.elements().filter(":selected"), s = n.elements().not(":selected");
|
|
204
|
+
l.length > 0 ? (l.unselect(), s.select(), l.removeClass("selected"), s.addClass("selected")) : (n.elements().select(), n.elements().addClass("selected"));
|
|
205
|
+
} else e === "click" ? (n.off("click", "node"), n.on("click", "node", (l) => {
|
|
206
|
+
const s = l.target;
|
|
207
|
+
n.nodes().removeClass("selected grayed highlighted"), n.edges().removeClass("selected grayed highlighted"), s.addClass("selected");
|
|
208
|
+
const h = s.neighborhood().nodes().add(s), b = h.edgesWith(h);
|
|
209
|
+
console.log("cy.nodes().not(relatedNodes):::", h), n.nodes().not(h).addClass("grayed"), n.edges().not(b).addClass("grayed"), h.addClass("highlighted"), b.addClass("highlighted");
|
|
210
|
+
})) : e === "box" && (console.log("进入框选模式"), n.nodes().removeClass("selected"), n.nodes().unselect(), n.elements().unselect(), n.boxSelectionEnabled(!0), n.panningEnabled(!1), n.on("boxselectstart", () => {
|
|
211
|
+
console.log("开始框选...");
|
|
212
|
+
}), n.on("boxselect", (l) => {
|
|
213
|
+
const s = n.elements(":selected");
|
|
214
|
+
console.log("框选完成,选中元素数:", s.length), n.elements().removeClass("selected"), s.addClass("selected");
|
|
215
|
+
}), n.on("boxselectend", () => {
|
|
216
|
+
console.log("框选结束"), n.zoomingEnabled(!0), n.panningEnabled(!0);
|
|
217
|
+
}));
|
|
218
|
+
}, Te = () => {
|
|
219
|
+
const e = r.current;
|
|
220
|
+
if (console.log("isShow::::"), ge)
|
|
221
|
+
F(!1), e.nodes('[types="typed-literal" ]').style("visibility", "visible"), e.edges().style("visibility", "visible");
|
|
222
|
+
else {
|
|
223
|
+
F(!0);
|
|
224
|
+
const n = e.nodes('[types="typed-literal" ]');
|
|
225
|
+
n.style("visibility", "hidden"), n.connectedEdges().style("visibility", "hidden");
|
|
226
|
+
}
|
|
227
|
+
}, U = (e) => {
|
|
228
|
+
const n = r.current;
|
|
229
|
+
if (!n) return;
|
|
230
|
+
const l = e === "out" ? Math.max(H * 0.8, 0.1) : Math.min(H * 1.2, 5);
|
|
231
|
+
pe(l);
|
|
232
|
+
const s = n.nodes();
|
|
233
|
+
s.style("width", (u) => (u.data("baseWidth") || 80) * l), s.style("height", (u) => (u.data("baseHeight") || 80) * l);
|
|
234
|
+
}, _e = (e) => {
|
|
235
|
+
me(e.content), Q(e.content);
|
|
236
|
+
}, Ae = (e = "刘强东", n = "1") => {
|
|
237
|
+
const l = r.current;
|
|
238
|
+
if (!l) return;
|
|
239
|
+
l.elements().removeClass("level-highlight level-selected level-grayed level-highlightedge");
|
|
240
|
+
const s = l.nodes().filter((m) => (m.data("name") || m.data("id") || "").toString().includes(e));
|
|
241
|
+
if (s.length === 0) {
|
|
242
|
+
P.warning(`未找到节点: ${e}`);
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
const u = parseInt(n) || 1, h = l.collection(), b = [];
|
|
246
|
+
s.forEach((m) => {
|
|
247
|
+
m.addClass("level-selected"), h.merge(m);
|
|
248
|
+
let p = l.collection();
|
|
249
|
+
const v = /* @__PURE__ */ new Set();
|
|
250
|
+
v.add(m.id()), u >= 1 && (p = m.neighborhood().nodes(), p.forEach((x) => {
|
|
251
|
+
v.add(x.id()), h.merge(x);
|
|
252
|
+
}), b.push(p));
|
|
253
|
+
for (let x = 2; x <= u; x++) {
|
|
254
|
+
const S = l.collection();
|
|
255
|
+
p.forEach((T) => {
|
|
256
|
+
T.neighborhood().nodes().forEach((_) => {
|
|
257
|
+
v.has(_.id()) || (v.add(_.id()), S.merge(_));
|
|
258
|
+
});
|
|
259
|
+
}), S.forEach((T) => h.merge(T)), b.push(S), p = S;
|
|
260
|
+
}
|
|
261
|
+
}), b.forEach((m) => {
|
|
262
|
+
m.addClass("level-highlight");
|
|
263
|
+
}), l.edges().filter((m) => {
|
|
264
|
+
const p = m.source(), v = m.target();
|
|
265
|
+
return h.contains(p) && h.contains(v);
|
|
266
|
+
}).addClass("level-highlightedge");
|
|
267
|
+
const d = l.elements().filter(".level-selected, .level-highlight, .level-highlightedge");
|
|
268
|
+
l.elements().not(d).addClass("level-grayed"), P.success(`已高亮 "${e}" 及其 ${u} 度关联节点和连线`);
|
|
269
|
+
}, ze = (e) => {
|
|
270
|
+
const n = r.current;
|
|
271
|
+
if (!n) return;
|
|
272
|
+
const l = new Set(q);
|
|
273
|
+
l.has(e) ? (l.delete(e), n.nodes().filter((s) => s.data("type") === e).show()) : (l.add(e), n.nodes().filter((s) => s.data("type") === e).hide()), Se(l);
|
|
274
|
+
}, Fe = (e) => {
|
|
275
|
+
const n = r.current;
|
|
276
|
+
if (!n) return;
|
|
277
|
+
const l = new Set(B);
|
|
278
|
+
l.has(e) ? (l.delete(e), n.edges().filter((s) => s.data("name") === e).show()) : (l.add(e), n.edges().filter((s) => s.data("name") === e).hide()), ke(l);
|
|
279
|
+
}, He = () => {
|
|
280
|
+
const e = r.current;
|
|
281
|
+
e.remove(e.elements());
|
|
282
|
+
}, We = () => {
|
|
283
|
+
$(!0);
|
|
284
|
+
}, Je = (e) => {
|
|
285
|
+
const n = r.current;
|
|
286
|
+
n && (n.nodes().forEach((l) => {
|
|
287
|
+
l.style({
|
|
288
|
+
width: e.nodeSize,
|
|
289
|
+
height: e.nodeSize,
|
|
290
|
+
"font-size": e.fontSize,
|
|
291
|
+
color: e.fontColor,
|
|
292
|
+
"font-weight": e.fontWeight,
|
|
293
|
+
"font-style": e.fontStyle,
|
|
294
|
+
"text-valign": e.textPosition,
|
|
295
|
+
"text-halign": "center",
|
|
296
|
+
"text-margin-y": e.textOffset,
|
|
297
|
+
label: e.showLabel === "show" ? l.data("name") || l.data("label") : ""
|
|
298
|
+
});
|
|
299
|
+
}), P.success("节点配置保存成功"));
|
|
300
|
+
}, $e = (e) => {
|
|
301
|
+
const n = r.current;
|
|
302
|
+
n && (n.edges().forEach((l) => {
|
|
303
|
+
l.style({
|
|
304
|
+
width: e.edgeWidth,
|
|
305
|
+
"line-color": e.edgeColorType === "custom" ? e.customColor : "#a29e9e",
|
|
306
|
+
"target-arrow-color": e.edgeColorType === "custom" ? e.customColor : "#a29e9e",
|
|
307
|
+
"target-arrow-shape": e.showArrow === "show" ? "triangle" : "none",
|
|
308
|
+
"font-size": e.fontSize,
|
|
309
|
+
color: e.fontColor,
|
|
310
|
+
"font-weight": e.fontWeight,
|
|
311
|
+
"font-style": e.fontStyle,
|
|
312
|
+
label: e.showLabel === "show" ? l.data("label") || l.data("name") : "",
|
|
313
|
+
"text-background-color": e.labelBgColor || "transparent",
|
|
314
|
+
"text-background-opacity": e.labelBgColor ? 1 : 0,
|
|
315
|
+
"text-background-padding": "2px"
|
|
316
|
+
});
|
|
317
|
+
}), P.success("连线配置保存成功"));
|
|
318
|
+
};
|
|
319
|
+
return /* @__PURE__ */ o(A, { children: [
|
|
320
|
+
/* @__PURE__ */ t("div", { className: "graph-bar", children: /* @__PURE__ */ o("div", { className: "graph-bar-min", children: [
|
|
321
|
+
/* @__PURE__ */ o(i, { wrap: !0, align: "center", justify: "center", className: "hover:text-[#145afd] cursor", onClick: () => xe(!M), children: [
|
|
322
|
+
/* @__PURE__ */ t(Ge, {}),
|
|
323
|
+
/* @__PURE__ */ t(i, { className: "w-100% ", justify: "center", children: "查询统计" })
|
|
324
|
+
] }),
|
|
325
|
+
/* @__PURE__ */ t(
|
|
326
|
+
j,
|
|
327
|
+
{
|
|
328
|
+
menu: {
|
|
329
|
+
items: (X = dt) == null ? void 0 : X.map((e) => ({
|
|
330
|
+
...e,
|
|
331
|
+
label: /* @__PURE__ */ t("div", { className: ae({
|
|
332
|
+
"text-[#145afd]": he === e.key
|
|
333
|
+
}), onClick: z(Le, e.key), children: e.label })
|
|
334
|
+
}))
|
|
335
|
+
},
|
|
336
|
+
children: /* @__PURE__ */ o(i, { wrap: !0, align: "center", justify: "center", className: "hover:text-[#145afd] cursor", children: [
|
|
337
|
+
/* @__PURE__ */ t(Ke, {}),
|
|
338
|
+
/* @__PURE__ */ t(i, { className: "w-100% ", justify: "center", children: "布局" })
|
|
339
|
+
] })
|
|
340
|
+
}
|
|
341
|
+
),
|
|
342
|
+
/* @__PURE__ */ o(i, { wrap: !0, align: "center", justify: "center", className: "hover:text-[#145afd] cursor", onClick: () => We(), children: [
|
|
343
|
+
/* @__PURE__ */ t(Ue, {}),
|
|
344
|
+
/* @__PURE__ */ t(i, { className: "w-100% ", justify: "center", children: "图显示设置" })
|
|
345
|
+
] }),
|
|
346
|
+
/* @__PURE__ */ t(
|
|
347
|
+
j,
|
|
348
|
+
{
|
|
349
|
+
menu: {
|
|
350
|
+
items: ht.map((e) => ({
|
|
351
|
+
...e,
|
|
352
|
+
label: /* @__PURE__ */ t(
|
|
353
|
+
"div",
|
|
354
|
+
{
|
|
355
|
+
onClick: (n) => {
|
|
356
|
+
switch (n.stopPropagation(), e.key) {
|
|
357
|
+
case "query":
|
|
358
|
+
Oe();
|
|
359
|
+
break;
|
|
360
|
+
case "link":
|
|
361
|
+
Ve();
|
|
362
|
+
break;
|
|
363
|
+
case "path":
|
|
364
|
+
G();
|
|
365
|
+
break;
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
children: e.label
|
|
369
|
+
}
|
|
370
|
+
)
|
|
371
|
+
}))
|
|
372
|
+
},
|
|
373
|
+
children: /* @__PURE__ */ o(i, { wrap: !0, align: "center", justify: "center", className: "hover:text-[#145afd] cursor", children: [
|
|
374
|
+
/* @__PURE__ */ t(Xe, {}),
|
|
375
|
+
/* @__PURE__ */ t(i, { className: "w-100% ", justify: "center", children: "分析" })
|
|
376
|
+
] })
|
|
377
|
+
}
|
|
378
|
+
),
|
|
379
|
+
/* @__PURE__ */ t(
|
|
380
|
+
j,
|
|
381
|
+
{
|
|
382
|
+
menu: {
|
|
383
|
+
items: (Y = ut) == null ? void 0 : Y.map((e) => ({
|
|
384
|
+
...e,
|
|
385
|
+
label: /* @__PURE__ */ t("div", { onClick: z(Pe, e.key), children: e.label })
|
|
386
|
+
}))
|
|
387
|
+
},
|
|
388
|
+
children: /* @__PURE__ */ o(i, { wrap: !0, align: "center", justify: "center", className: "hover:text-[#145afd] cursor", children: [
|
|
389
|
+
/* @__PURE__ */ t(Ye, {}),
|
|
390
|
+
/* @__PURE__ */ t(i, { className: "w-100% ", justify: "center", children: "选择" })
|
|
391
|
+
] })
|
|
392
|
+
}
|
|
393
|
+
),
|
|
394
|
+
/* @__PURE__ */ t(
|
|
395
|
+
j,
|
|
396
|
+
{
|
|
397
|
+
menu: {
|
|
398
|
+
items: (R = mt) == null ? void 0 : R.map((e) => ({
|
|
399
|
+
...e,
|
|
400
|
+
label: /* @__PURE__ */ t("div", { onClick: (n) => De(n, e.key), children: e.label })
|
|
401
|
+
}))
|
|
402
|
+
},
|
|
403
|
+
children: /* @__PURE__ */ o(i, { wrap: !0, align: "center", justify: "center", className: "hover:text-[#145afd] cursor", children: [
|
|
404
|
+
/* @__PURE__ */ t(Re, {}),
|
|
405
|
+
/* @__PURE__ */ t(i, { className: "w-100% ", justify: "center", children: "下载数据" })
|
|
406
|
+
] })
|
|
407
|
+
}
|
|
408
|
+
),
|
|
409
|
+
/* @__PURE__ */ o(i, { wrap: !0, align: "center", justify: "center", className: "hover:text-[#145afd] cursor", onClick: () => Te(), children: [
|
|
410
|
+
/* @__PURE__ */ t(et, {}),
|
|
411
|
+
/* @__PURE__ */ t(i, { className: "w-100% ", justify: "center", children: "隐藏属性" })
|
|
412
|
+
] }),
|
|
413
|
+
/* @__PURE__ */ t(
|
|
414
|
+
j,
|
|
415
|
+
{
|
|
416
|
+
menu: {
|
|
417
|
+
items: (ee = ce) == null ? void 0 : ee.map((e) => ({
|
|
418
|
+
...e,
|
|
419
|
+
label: /* @__PURE__ */ t("div", { onClick: z(() => gt(r, e.key), e.key), children: e.label })
|
|
420
|
+
}))
|
|
421
|
+
},
|
|
422
|
+
children: /* @__PURE__ */ o(i, { wrap: !0, align: "center", justify: "center", className: "hover:text-[#145afd] cursor", children: [
|
|
423
|
+
/* @__PURE__ */ t(tt, {}),
|
|
424
|
+
/* @__PURE__ */ t(i, { className: "w-100% ", justify: "center", children: "文字位置" })
|
|
425
|
+
] })
|
|
426
|
+
}
|
|
427
|
+
),
|
|
428
|
+
/* @__PURE__ */ o(i, { wrap: !0, align: "center", justify: "center", className: "hover:text-[#145afd] cursor", onClick: () => He(), children: [
|
|
429
|
+
/* @__PURE__ */ t(nt, {}),
|
|
430
|
+
/* @__PURE__ */ t(i, { className: "w-100% ", justify: "center", children: "清空画布" })
|
|
431
|
+
] }),
|
|
432
|
+
/* @__PURE__ */ o(i, { wrap: !0, align: "center", justify: "center", className: "hover:text-[#145afd] cursor", children: [
|
|
433
|
+
/* @__PURE__ */ o(i, { gap: "5px", children: [
|
|
434
|
+
/* @__PURE__ */ t(lt, { onClick: () => U("in") }),
|
|
435
|
+
/* @__PURE__ */ t(st, { onClick: () => U("out") })
|
|
436
|
+
] }),
|
|
437
|
+
/* @__PURE__ */ t(i, { className: "w-100% ", justify: "center", children: "节点缩放" })
|
|
438
|
+
] }),
|
|
439
|
+
/* @__PURE__ */ o(i, { wrap: !0, align: "center", justify: "center", className: "hover:text-[#145afd] cursor", children: [
|
|
440
|
+
/* @__PURE__ */ o(i, { gap: "5px", children: [
|
|
441
|
+
/* @__PURE__ */ t(ot, { onClick: () => Z("in") }),
|
|
442
|
+
/* @__PURE__ */ t(at, { onClick: () => Z("out") })
|
|
443
|
+
] }),
|
|
444
|
+
/* @__PURE__ */ t(i, { className: "w-100% ", justify: "center", children: "画布缩放" })
|
|
445
|
+
] })
|
|
446
|
+
] }) }),
|
|
447
|
+
/* @__PURE__ */ t(vt, { isVisible: fe, searchChange: (e) => _e(e), closeQuery: () => I(!1) }),
|
|
448
|
+
/* @__PURE__ */ t(Ct, { isVisible: we, analysis: (e) => pt(r, { pathNodes: e }), closePath: () => D(!1) }),
|
|
449
|
+
/* @__PURE__ */ t(Nt, { ref: V, onLevelClick: Ae }),
|
|
450
|
+
/* @__PURE__ */ t(
|
|
451
|
+
it,
|
|
452
|
+
{
|
|
453
|
+
title: "JSON预览",
|
|
454
|
+
open: ye,
|
|
455
|
+
onCancel: () => J(!1),
|
|
456
|
+
footer: null,
|
|
457
|
+
width: 800,
|
|
458
|
+
children: /* @__PURE__ */ t("pre", { style: { maxHeight: "60vh", overflow: "auto", background: "#f5f5f5", padding: "16px", borderRadius: "4px" }, children: W ? JSON.stringify(W, null, 2) : "暂无数据" })
|
|
459
|
+
}
|
|
460
|
+
),
|
|
461
|
+
/* @__PURE__ */ t(
|
|
462
|
+
rt,
|
|
463
|
+
{
|
|
464
|
+
title: "图显示设置",
|
|
465
|
+
placement: "right",
|
|
466
|
+
open: ve,
|
|
467
|
+
onClose: () => $(!1),
|
|
468
|
+
mask: !1,
|
|
469
|
+
width: 350,
|
|
470
|
+
getContainer: !1,
|
|
471
|
+
children: /* @__PURE__ */ t(
|
|
472
|
+
se,
|
|
473
|
+
{
|
|
474
|
+
activeKey: Ce,
|
|
475
|
+
onChange: Ne,
|
|
476
|
+
items: [
|
|
477
|
+
{
|
|
478
|
+
label: "节点设置",
|
|
479
|
+
key: "node",
|
|
480
|
+
children: /* @__PURE__ */ t(xt, { onSave: Je })
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
label: "连线设置",
|
|
484
|
+
key: "edge",
|
|
485
|
+
children: /* @__PURE__ */ t(St, { onSave: $e })
|
|
486
|
+
}
|
|
487
|
+
]
|
|
488
|
+
}
|
|
489
|
+
)
|
|
490
|
+
}
|
|
491
|
+
),
|
|
492
|
+
/* @__PURE__ */ t("div", { className: ae("absolute right-0px z-1 bg-#fff p-10px rounded-10px shadow-[0_4px_20px_0px_rgba(12,95,218,0.33)] w-200px", {
|
|
493
|
+
hidden: !M
|
|
494
|
+
}), children: /* @__PURE__ */ t(
|
|
495
|
+
se,
|
|
496
|
+
{
|
|
497
|
+
items: [
|
|
498
|
+
{
|
|
499
|
+
label: "实体",
|
|
500
|
+
key: "entity",
|
|
501
|
+
children: /* @__PURE__ */ t(A, { children: Object.keys(N).length > 0 ? /* @__PURE__ */ o("div", { children: [
|
|
502
|
+
/* @__PURE__ */ o("p", { children: [
|
|
503
|
+
"实体数量:",
|
|
504
|
+
Object.values(N).reduce((e, n) => e + n.count, 0)
|
|
505
|
+
] }),
|
|
506
|
+
/* @__PURE__ */ o("p", { className: "my-4px", children: [
|
|
507
|
+
"实体类型:",
|
|
508
|
+
Object.keys(N).length
|
|
509
|
+
] }),
|
|
510
|
+
/* @__PURE__ */ t(i, { gap: "5px", justify: "start", className: "w-100%", wrap: !0, children: Object.keys(N).map((e) => /* @__PURE__ */ o(i, { gap: "4px", justify: "start", className: `w-100% cursor ${q.has(e) ? "opacity-30" : ""}`, onClick: () => ze(e), children: [
|
|
511
|
+
/* @__PURE__ */ t("img", { className: "w-20px rounded-50%", src: N[e].img, alt: "" }),
|
|
512
|
+
e,
|
|
513
|
+
":",
|
|
514
|
+
N[e].count
|
|
515
|
+
] }, e)) })
|
|
516
|
+
] }) : /* @__PURE__ */ t("span", { className: "text-[#666]", children: "暂无实体统计!" }) })
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
label: "关系",
|
|
520
|
+
key: "relation",
|
|
521
|
+
children: /* @__PURE__ */ t(A, { children: ((te = Object.keys(O)) == null ? void 0 : te.length) > 0 ? /* @__PURE__ */ o("div", { children: [
|
|
522
|
+
/* @__PURE__ */ o("div", { children: [
|
|
523
|
+
"关系数量:",
|
|
524
|
+
(ne = Object.keys(O)) == null ? void 0 : ne.length
|
|
525
|
+
] }),
|
|
526
|
+
/* @__PURE__ */ o("div", { className: "my-4px", children: [
|
|
527
|
+
"关系类型:",
|
|
528
|
+
(le = Object.values(O)) == null ? void 0 : le.reduce((e, n) => e + n, 0)
|
|
529
|
+
] }),
|
|
530
|
+
/* @__PURE__ */ t(i, { gap: "5px", justify: "start", className: "w-100%", wrap: !0, children: Object.keys(O).map((e) => /* @__PURE__ */ o(i, { gap: "4px", className: `w-100% cursor ${B.has(e) ? "opacity-30" : ""}`, onClick: () => Fe(e), children: [
|
|
531
|
+
e,
|
|
532
|
+
":",
|
|
533
|
+
O[e]
|
|
534
|
+
] }, e)) })
|
|
535
|
+
] }) : /* @__PURE__ */ t("span", { className: "text-[#666]", children: "暂无关系统计!" }) })
|
|
536
|
+
}
|
|
537
|
+
]
|
|
538
|
+
}
|
|
539
|
+
) })
|
|
540
|
+
] });
|
|
541
|
+
}), xt = ({ onSave: f }) => {
|
|
542
|
+
const [r] = c.useForm();
|
|
543
|
+
return /* @__PURE__ */ o(c, { form: r, layout: "vertical", onFinish: f, children: [
|
|
544
|
+
/* @__PURE__ */ t(c.Item, { label: "节点大小", name: "nodeSize", initialValue: 80, children: /* @__PURE__ */ t(C, { type: "number", placeholder: "请输入节点大小" }) }),
|
|
545
|
+
/* @__PURE__ */ t(c.Item, { label: "显示标签", name: "showLabel", initialValue: "show", children: /* @__PURE__ */ o(a, { children: [
|
|
546
|
+
/* @__PURE__ */ t(a.Option, { value: "show", children: "显示" }),
|
|
547
|
+
/* @__PURE__ */ t(a.Option, { value: "hide", children: "隐藏" })
|
|
548
|
+
] }) }),
|
|
549
|
+
/* @__PURE__ */ t(c.Item, { label: "字体位置", name: "textPosition", initialValue: "bottom", children: /* @__PURE__ */ t(a, { children: ce.map((y) => /* @__PURE__ */ t(a.Option, { value: y.key, children: y.label }, y.item)) }) }),
|
|
550
|
+
/* @__PURE__ */ t(c.Item, { label: "字体偏移", name: "textOffset", initialValue: 5, children: /* @__PURE__ */ t(C, { type: "number", placeholder: "请输入字体偏移量" }) }),
|
|
551
|
+
/* @__PURE__ */ t(c.Item, { label: "字体颜色", name: "fontColor", initialValue: "rgb(50,50,50)", children: /* @__PURE__ */ t(C, { placeholder: "请输入字体颜色" }) }),
|
|
552
|
+
/* @__PURE__ */ t(c.Item, { label: "字体大小", name: "fontSize", initialValue: 18, children: /* @__PURE__ */ t(C, { type: "number", placeholder: "请输入字体大小" }) }),
|
|
553
|
+
/* @__PURE__ */ t(c.Item, { label: "字体粗细", name: "fontWeight", initialValue: "normal", children: /* @__PURE__ */ o(a, { children: [
|
|
554
|
+
/* @__PURE__ */ t(a.Option, { value: "normal", children: "常规" }),
|
|
555
|
+
/* @__PURE__ */ t(a.Option, { value: "bold", children: "粗体" }),
|
|
556
|
+
/* @__PURE__ */ t(a.Option, { value: "lighter", children: "细体" })
|
|
557
|
+
] }) }),
|
|
558
|
+
/* @__PURE__ */ t(c.Item, { label: "字体样式", name: "fontStyle", initialValue: "normal", children: /* @__PURE__ */ o(a, { children: [
|
|
559
|
+
/* @__PURE__ */ t(a.Option, { value: "normal", children: "默认" }),
|
|
560
|
+
/* @__PURE__ */ t(a.Option, { value: "italic", children: "斜体" })
|
|
561
|
+
] }) }),
|
|
562
|
+
/* @__PURE__ */ t(c.Item, { children: /* @__PURE__ */ t(re, { type: "primary", htmlType: "submit", block: !0, children: "保存节点配置" }) })
|
|
563
|
+
] });
|
|
564
|
+
}, St = ({ onSave: f }) => {
|
|
565
|
+
const [r] = c.useForm(), [y, N] = w("default");
|
|
566
|
+
return /* @__PURE__ */ o(c, { form: r, layout: "vertical", onFinish: f, children: [
|
|
567
|
+
/* @__PURE__ */ t(c.Item, { label: "类型", name: "edgeType", initialValue: "straight", children: /* @__PURE__ */ o(a, { children: [
|
|
568
|
+
/* @__PURE__ */ t(a.Option, { value: "straight", children: "直线" }),
|
|
569
|
+
/* @__PURE__ */ t(a.Option, { value: "curve", children: "曲线" })
|
|
570
|
+
] }) }),
|
|
571
|
+
/* @__PURE__ */ t(c.Item, { label: "连线宽度", name: "edgeWidth", initialValue: 2, children: /* @__PURE__ */ t(C, { type: "number", placeholder: "请输入连线宽度" }) }),
|
|
572
|
+
/* @__PURE__ */ t(c.Item, { label: "连线箭头", name: "showArrow", initialValue: "show", children: /* @__PURE__ */ o(a, { children: [
|
|
573
|
+
/* @__PURE__ */ t(a.Option, { value: "show", children: "显示" }),
|
|
574
|
+
/* @__PURE__ */ t(a.Option, { value: "hide", children: "隐藏" })
|
|
575
|
+
] }) }),
|
|
576
|
+
/* @__PURE__ */ t(c.Item, { label: "连线颜色", name: "edgeColorType", initialValue: "default", children: /* @__PURE__ */ o(a, { onChange: N, children: [
|
|
577
|
+
/* @__PURE__ */ t(a.Option, { value: "default", children: "默认" }),
|
|
578
|
+
/* @__PURE__ */ t(a.Option, { value: "custom", children: "自定义色" })
|
|
579
|
+
] }) }),
|
|
580
|
+
y === "custom" && /* @__PURE__ */ t(c.Item, { label: "自定义颜色", name: "customColor", initialValue: "rgb(20,20,20)", children: /* @__PURE__ */ t(C, { placeholder: "请输入自定义颜色" }) }),
|
|
581
|
+
/* @__PURE__ */ t(c.Item, { label: "显示标签", name: "showLabel", initialValue: "show", children: /* @__PURE__ */ o(a, { children: [
|
|
582
|
+
/* @__PURE__ */ t(a.Option, { value: "show", children: "显示" }),
|
|
583
|
+
/* @__PURE__ */ t(a.Option, { value: "hide", children: "隐藏" })
|
|
584
|
+
] }) }),
|
|
585
|
+
/* @__PURE__ */ t(c.Item, { label: "字体大小", name: "fontSize", initialValue: 14, children: /* @__PURE__ */ t(C, { type: "number", placeholder: "请输入字体大小" }) }),
|
|
586
|
+
/* @__PURE__ */ t(c.Item, { label: "字体粗细", name: "fontWeight", initialValue: "normal", children: /* @__PURE__ */ o(a, { children: [
|
|
587
|
+
/* @__PURE__ */ t(a.Option, { value: "normal", children: "常规" }),
|
|
588
|
+
/* @__PURE__ */ t(a.Option, { value: "bold", children: "粗体" })
|
|
589
|
+
] }) }),
|
|
590
|
+
/* @__PURE__ */ t(c.Item, { label: "字体样式", name: "fontStyle", initialValue: "normal", children: /* @__PURE__ */ o(a, { children: [
|
|
591
|
+
/* @__PURE__ */ t(a.Option, { value: "normal", children: "默认" }),
|
|
592
|
+
/* @__PURE__ */ t(a.Option, { value: "italic", children: "斜体" })
|
|
593
|
+
] }) }),
|
|
594
|
+
/* @__PURE__ */ t(c.Item, { label: "字体颜色", name: "fontColor", initialValue: "rgb(50,50,50)", children: /* @__PURE__ */ t(C, { placeholder: "请输入字体颜色" }) }),
|
|
595
|
+
/* @__PURE__ */ t(c.Item, { label: "标签背色", name: "labelBgColor", initialValue: "", children: /* @__PURE__ */ t(C, { placeholder: "请选择颜色" }) }),
|
|
596
|
+
/* @__PURE__ */ t(c.Item, { children: /* @__PURE__ */ t(re, { type: "primary", htmlType: "submit", block: !0, children: "保存连线配置" }) })
|
|
597
|
+
] });
|
|
598
|
+
};
|
|
599
|
+
export {
|
|
600
|
+
Wt as default
|
|
601
|
+
};
|