react-kggraph 0.0.1

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.
Files changed (92) hide show
  1. package/README.md +16 -0
  2. package/lib/components/Graph/CytoscapeReact.css +1 -0
  3. package/lib/components/Graph/components/ActionBar/index.css +1 -0
  4. package/lib/components/Graph/components/PathAnalysis/index.css +1 -0
  5. package/lib/components/Graph/components/PathAnalysisLevel/index.css +1 -0
  6. package/lib/components/Graph/components/SettingCircle/index.css +1 -0
  7. package/lib/favicon.svg +1 -0
  8. package/lib/icons.svg +24 -0
  9. package/lib/index.cjs.js +1 -0
  10. package/lib/index.esm.js +3 -0
  11. package/lib/index10.cjs.js +1 -0
  12. package/lib/index10.esm.js +4 -0
  13. package/lib/index11.cjs.js +1 -0
  14. package/lib/index11.esm.js +4 -0
  15. package/lib/index12.cjs.js +1 -0
  16. package/lib/index12.esm.js +4 -0
  17. package/lib/index13.cjs.js +1 -0
  18. package/lib/index13.esm.js +4 -0
  19. package/lib/index14.cjs.js +1 -0
  20. package/lib/index14.esm.js +4 -0
  21. package/lib/index15.cjs.js +1 -0
  22. package/lib/index15.esm.js +4 -0
  23. package/lib/index16.cjs.js +1 -0
  24. package/lib/index16.esm.js +25 -0
  25. package/lib/index17.cjs.js +1 -0
  26. package/lib/index17.esm.js +330 -0
  27. package/lib/index18.cjs.js +1 -0
  28. package/lib/index18.esm.js +5 -0
  29. package/lib/index19.cjs.js +1 -0
  30. package/lib/index19.esm.js +284 -0
  31. package/lib/index2.cjs.js +1 -0
  32. package/lib/index2.esm.js +16 -0
  33. package/lib/index21.cjs.js +1 -0
  34. package/lib/index21.esm.js +27 -0
  35. package/lib/index22.cjs.js +16 -0
  36. package/lib/index22.esm.js +453 -0
  37. package/lib/index23.cjs.js +1 -0
  38. package/lib/index23.esm.js +10 -0
  39. package/lib/index24.cjs.js +1 -0
  40. package/lib/index24.esm.js +70 -0
  41. package/lib/index26.cjs.js +1 -0
  42. package/lib/index26.esm.js +68 -0
  43. package/lib/index28.cjs.js +1 -0
  44. package/lib/index28.esm.js +72 -0
  45. package/lib/index29.cjs.js +1 -0
  46. package/lib/index29.esm.js +32 -0
  47. package/lib/index30.cjs.js +1 -0
  48. package/lib/index30.esm.js +828 -0
  49. package/lib/index32.cjs.js +1 -0
  50. package/lib/index32.esm.js +4 -0
  51. package/lib/index33.cjs.js +1 -0
  52. package/lib/index33.esm.js +161 -0
  53. package/lib/index34.cjs.js +1 -0
  54. package/lib/index34.esm.js +71 -0
  55. package/lib/index36.cjs.js +1 -0
  56. package/lib/index36.esm.js +100 -0
  57. package/lib/index37.cjs.js +1 -0
  58. package/lib/index37.esm.js +250 -0
  59. package/lib/index38.cjs.js +1 -0
  60. package/lib/index38.esm.js +47 -0
  61. package/lib/index39.cjs.js +1 -0
  62. package/lib/index39.esm.js +378 -0
  63. package/lib/index4.cjs.js +95 -0
  64. package/lib/index4.esm.js +12387 -0
  65. package/lib/index40.cjs.js +1 -0
  66. package/lib/index40.esm.js +6 -0
  67. package/lib/index5.cjs.js +1 -0
  68. package/lib/index5.esm.js +4 -0
  69. package/lib/index6.cjs.js +1 -0
  70. package/lib/index6.esm.js +4 -0
  71. package/lib/index7.cjs.js +1 -0
  72. package/lib/index7.esm.js +4 -0
  73. package/lib/index8.cjs.js +1 -0
  74. package/lib/index8.esm.js +4 -0
  75. package/lib/index9.cjs.js +1 -0
  76. package/lib/index9.esm.js +4 -0
  77. package/lib/src/components/Graph/api.d.ts +2 -0
  78. package/lib/src/components/Graph/components/ActionBar/index.d.ts +9 -0
  79. package/lib/src/components/Graph/components/KnowledgeCard/index.d.ts +3 -0
  80. package/lib/src/components/Graph/components/NodeInfoDrawer/index.d.ts +3 -0
  81. package/lib/src/components/Graph/components/PathAnalysis/index.d.ts +9 -0
  82. package/lib/src/components/Graph/components/PathAnalysisLevel/index.d.ts +5 -0
  83. package/lib/src/components/Graph/components/QueryNode/index.d.ts +8 -0
  84. package/lib/src/components/Graph/components/SettingCircle/index.d.ts +13 -0
  85. package/lib/src/components/Graph/context.d.ts +2 -0
  86. package/lib/src/components/Graph/index.d.ts +8 -0
  87. package/lib/src/components/Graph/types.d.ts +6 -0
  88. package/lib/src/components/Graph/utils/edge_node_styles.d.ts +3 -0
  89. package/lib/src/components/Graph/utils/layouts.d.ts +108 -0
  90. package/lib/src/components/Graph/utils/menuItems.d.ts +1 -0
  91. package/lib/src/components/Graph/utils/tools.d.ts +38 -0
  92. package/package.json +64 -0
@@ -0,0 +1,828 @@
1
+ import { __toESM as e } from "./index2.esm.js";
2
+ /* empty css */
3
+ import { utils as t, writeFileSync as n } from "./index4.esm.js";
4
+ import { downloadFile as r } from "./index16.esm.js";
5
+ import { choiceConfig as i, donwnGraphData as a, downloadData as o, getCyData as s, handleCalcPath as c, layoutCongig as l, linkAnalysis as u, textLayout as ee, textPositionConfig as d } from "./index17.esm.js";
6
+ import { GraphContext as te } from "./index18.esm.js";
7
+ import { fixNodesToEdges as ne, layout as f } from "./index19.esm.js";
8
+ import { require_jsx_runtime as p } from "./index23.esm.js";
9
+ import m from "./index24.esm.js";
10
+ import h from "./index26.esm.js";
11
+ import g from "./index28.esm.js";
12
+ import { require_classnames as _ } from "./index29.esm.js";
13
+ import { forwardRef as v, useContext as y, useEffect as re, useImperativeHandle as ie, useRef as ae, useState as b } from "react";
14
+ import { AppstoreOutlined as oe, BorderOuterOutlined as se, ClearOutlined as x, LineChartOutlined as S, LineHeightOutlined as ce, MinusCircleOutlined as le, MinusSquareOutlined as ue, PlusCircleOutlined as de, PlusSquareOutlined as fe, RobotOutlined as pe, SaveOutlined as me, SelectOutlined as he, TableOutlined as ge } from "@ant-design/icons";
15
+ import { Button as C, Drawer as _e, Dropdown as w, Flex as T, Form as E, Input as D, Modal as O, Select as k, Tabs as A, message as j } from "antd";
16
+ //#region src/components/Graph/components/ActionBar/index.tsx
17
+ var M = /* @__PURE__ */ e(_(), 1), N = p(), P = (e, t) => (n) => {
18
+ n.stopPropagation(), e?.(t || "");
19
+ }, F = v(({ graphInfo: e, cyRef: p, initNodeScale: _, typeObj: v, relationObj: C }, E) => {
20
+ let { layoutType: D, setLayoutType: k } = y(te), [F, ye] = b(""), [be, L] = b(!1), [R, xe] = b(_), [Se, z] = b(!1), [Ce, B] = b(!1), [V, H] = b(null), [we, U] = b(!1), [Te, W] = b(!1), [Ee, De] = b("node"), G = ae(null), [K, Oe] = b(!0), [q, ke] = b(/* @__PURE__ */ new Set()), [J, Ae] = b(/* @__PURE__ */ new Set());
21
+ ie(E, () => ({ onPathAnalysis: () => {
22
+ Z();
23
+ } })), re(() => {
24
+ Y(F);
25
+ }, [F]);
26
+ let Y = async (e) => {
27
+ let t = p.current;
28
+ if (!t || !F) {
29
+ t?.nodes().removeClass("highlight"), t?.fit();
30
+ return;
31
+ }
32
+ let n = t.nodes().filter((e) => {
33
+ let t = (e.data("name") || "").toLowerCase(), n = (e.data("role") || "").toLowerCase(), r = (e.data("dept") || "").toLowerCase(), i = String(e.data("id") || "").toLowerCase();
34
+ return t.includes(F.toLowerCase()) || n.includes(F.toLowerCase()) || r.includes(F.toLowerCase()) || i.includes(F.toLowerCase());
35
+ });
36
+ t.nodes().removeClass("highlight"), n.addClass("highlight"), n.length === 1 ? (console.log("matchedNodes:::", n), t.animate({
37
+ center: { eles: n },
38
+ duration: 500
39
+ })) : alert("未找到对应节点");
40
+ }, X = (e) => {
41
+ let t = p.current;
42
+ if (!t) return;
43
+ let n = t.zoom();
44
+ console.log(999, n);
45
+ let r = 0;
46
+ switch (e) {
47
+ case "out":
48
+ r = Math.max(n * .8, .1);
49
+ break;
50
+ case "in":
51
+ r = Math.min(n * 1.2, 3);
52
+ break;
53
+ }
54
+ t.zoom(r), t.center();
55
+ }, je = () => {
56
+ console.log("查询节点"), z(!0), B(!1), G.current.close();
57
+ }, Z = () => {
58
+ console.log("路径分析"), z(!1), B(!0), G.current.close();
59
+ }, Me = (t) => {
60
+ k(t);
61
+ let n = p.current;
62
+ n && (n.nodes().unlock(), f(p, t), t === "cose-bilkent" && e?.searchNodes?.length === 2 && ne(n, e.searchNodes[0], e.searchNodes[1]));
63
+ }, Ne = () => {
64
+ let e = p.current;
65
+ e && a(e);
66
+ }, Pe = () => {
67
+ let e = p.current;
68
+ e && (H(s(e)), U(!0));
69
+ }, Q = (e, t) => {
70
+ let n = e.current;
71
+ n && (t === "downloadPng" ? r(n.png({
72
+ scale: 2,
73
+ bg: "transparent",
74
+ full: !0,
75
+ quality: 1
76
+ }), `graph_${Date.now()}.png`) : t === "downloadJpg" && r(n.jpg({
77
+ scale: 2,
78
+ bg: "#ffffff",
79
+ full: !0,
80
+ quality: 1
81
+ }), `graph_${Date.now()}.jpg`));
82
+ }, Fe = () => {
83
+ let e = p.current;
84
+ if (!e) return;
85
+ let { nodes: r = [], edges: i = [] } = s(e), a = r.map((e) => {
86
+ let t = e.data || {}, n = t.properties || {};
87
+ return {
88
+ 节点名称: t.name || t.label || "",
89
+ 节点ID: t.id || "",
90
+ 节点类型: t.types || "",
91
+ URI: t.label || "",
92
+ X坐标: e.position?.x || "",
93
+ Y坐标: e.position?.y || "",
94
+ 层级: t.level || "",
95
+ 宽度: t.baseWidth || "",
96
+ 高度: t.baseHeight || "",
97
+ 图片: t.image || "",
98
+ 属性ID: n.id || "",
99
+ 属性值: n.value || ""
100
+ };
101
+ }), o = i.map((e) => {
102
+ let t = e.data || {};
103
+ return {
104
+ 源节点: t.source?.split("/#")[0]?.split("/").pop() || t.source,
105
+ 目标节点: t.target?.split("/#")[0]?.split("/").pop() || t.target,
106
+ 源URI: t.source || "",
107
+ 目标URI: t.target || "",
108
+ 关系名称: t.name || t.label || "",
109
+ 关系ID: t.id || ""
110
+ };
111
+ }), c = t.book_new();
112
+ if (a.length > 0) {
113
+ let e = t.json_to_sheet(a);
114
+ e["!cols"] = [
115
+ { wch: 30 },
116
+ { wch: 60 },
117
+ { wch: 15 },
118
+ { wch: 50 },
119
+ { wch: 12 },
120
+ { wch: 12 },
121
+ { wch: 8 },
122
+ { wch: 8 },
123
+ { wch: 8 },
124
+ { wch: 40 },
125
+ { wch: 50 },
126
+ { wch: 40 }
127
+ ], t.book_append_sheet(c, e, "节点");
128
+ }
129
+ if (o.length > 0) {
130
+ let e = t.json_to_sheet(o);
131
+ e["!cols"] = [
132
+ { wch: 30 },
133
+ { wch: 30 },
134
+ { wch: 60 },
135
+ { wch: 60 },
136
+ { wch: 15 },
137
+ { wch: 40 }
138
+ ], t.book_append_sheet(c, e, "关系");
139
+ }
140
+ n(c, `graph_${Date.now()}.xlsx`);
141
+ }, Ie = (e, t) => {
142
+ switch (e.stopPropagation(), t) {
143
+ case "downloadJson":
144
+ Ne();
145
+ break;
146
+ case "previewJsonList":
147
+ Pe();
148
+ break;
149
+ case "downloadExcel":
150
+ Fe();
151
+ break;
152
+ case "previewDataList": break;
153
+ case "downloadJpg":
154
+ Q(p, t);
155
+ break;
156
+ case "downloadPng":
157
+ Q(p, t);
158
+ break;
159
+ }
160
+ }, Le = () => {
161
+ z(!1), B(!1), G.current.open();
162
+ }, Re = (e) => {
163
+ let t = p.current;
164
+ if (t) if (t.panningEnabled(!0), e === "all") t.nodes().addClass("selected"), t.nodes().select(), t.elements().select();
165
+ else if (e === "reverse") {
166
+ let e = t.elements().filter(":selected"), n = t.elements().not(":selected");
167
+ e.length > 0 ? (e.unselect(), n.select(), e.removeClass("selected"), n.addClass("selected")) : (t.elements().select(), t.elements().addClass("selected"));
168
+ } else e === "click" ? (t.off("click", "node"), t.on("click", "node", (e) => {
169
+ let n = e.target;
170
+ t.nodes().removeClass("selected grayed highlighted"), t.edges().removeClass("selected grayed highlighted"), n.addClass("selected");
171
+ let r = n.neighborhood().nodes().add(n), i = r.edgesWith(r);
172
+ console.log("cy.nodes().not(relatedNodes):::", r), t.nodes().not(r).addClass("grayed"), t.edges().not(i).addClass("grayed"), r.addClass("highlighted"), i.addClass("highlighted");
173
+ })) : e === "box" && (console.log("进入框选模式"), t.nodes().removeClass("selected"), t.nodes().unselect(), t.elements().unselect(), t.boxSelectionEnabled(!0), t.panningEnabled(!1), t.on("boxselectstart", () => {
174
+ console.log("开始框选...");
175
+ }), t.on("boxselect", (e) => {
176
+ let n = t.elements(":selected");
177
+ console.log("框选完成,选中元素数:", n.length), t.elements().removeClass("selected"), n.addClass("selected");
178
+ }), t.on("boxselectend", () => {
179
+ console.log("框选结束"), t.zoomingEnabled(!0), t.panningEnabled(!0);
180
+ }));
181
+ }, ze = () => {
182
+ let e = p.current;
183
+ if (console.log("isShow::::"), be) L(!1), e.nodes("[types=\"typed-literal\" ]").style("visibility", "visible"), e.edges().style("visibility", "visible");
184
+ else {
185
+ L(!0);
186
+ let t = e.nodes("[types=\"typed-literal\" ]");
187
+ t.style("visibility", "hidden"), t.connectedEdges().style("visibility", "hidden");
188
+ }
189
+ }, $ = (e) => {
190
+ let t = p.current;
191
+ if (!t) return;
192
+ let n = e === "out" ? Math.max(R * .8, .1) : Math.min(R * 1.2, 5);
193
+ xe(n);
194
+ let r = t.nodes();
195
+ r.style("width", (e) => (e.data("baseWidth") || 80) * n), r.style("height", (e) => (e.data("baseHeight") || 80) * n);
196
+ }, Be = (e) => {
197
+ ye(e.content), Y(e.content);
198
+ }, Ve = (e = "刘强东", t = "1") => {
199
+ let n = p.current;
200
+ if (!n) return;
201
+ n.elements().removeClass("level-highlight level-selected level-grayed level-highlightedge");
202
+ let r = n.nodes().filter((t) => (t.data("name") || t.data("id") || "").toString().includes(e));
203
+ if (r.length === 0) {
204
+ j.warning(`未找到节点: ${e}`);
205
+ return;
206
+ }
207
+ let i = parseInt(t) || 1, a = n.collection(), o = [];
208
+ r.forEach((e) => {
209
+ e.addClass("level-selected"), a.merge(e);
210
+ let t = n.collection(), r = /* @__PURE__ */ new Set();
211
+ r.add(e.id()), i >= 1 && (t = e.neighborhood().nodes(), t.forEach((e) => {
212
+ r.add(e.id()), a.merge(e);
213
+ }), o.push(t));
214
+ for (let e = 2; e <= i; e++) {
215
+ let e = n.collection();
216
+ t.forEach((t) => {
217
+ t.neighborhood().nodes().forEach((t) => {
218
+ r.has(t.id()) || (r.add(t.id()), e.merge(t));
219
+ });
220
+ }), e.forEach((e) => a.merge(e)), o.push(e), t = e;
221
+ }
222
+ }), o.forEach((e) => {
223
+ e.addClass("level-highlight");
224
+ }), n.edges().filter((e) => {
225
+ let t = e.source(), n = e.target();
226
+ return a.contains(t) && a.contains(n);
227
+ }).addClass("level-highlightedge");
228
+ let s = n.elements().filter(".level-selected, .level-highlight, .level-highlightedge");
229
+ n.elements().not(s).addClass("level-grayed"), j.success(`已高亮 "${e}" 及其 ${i} 度关联节点和连线`);
230
+ }, He = (e) => {
231
+ let t = p.current;
232
+ if (!t) return;
233
+ let n = new Set(q);
234
+ n.has(e) ? (n.delete(e), t.nodes().filter((t) => t.data("type") === e).show()) : (n.add(e), t.nodes().filter((t) => t.data("type") === e).hide()), ke(n);
235
+ }, Ue = (e) => {
236
+ let t = p.current;
237
+ if (!t) return;
238
+ let n = new Set(J);
239
+ n.has(e) ? (n.delete(e), t.edges().filter((t) => t.data("name") === e).show()) : (n.add(e), t.edges().filter((t) => t.data("name") === e).hide()), Ae(n);
240
+ }, We = () => {
241
+ let e = p.current;
242
+ e.remove(e.elements());
243
+ }, Ge = () => {
244
+ W(!0);
245
+ };
246
+ return /* @__PURE__ */ (0, N.jsxs)(N.Fragment, { children: [
247
+ /* @__PURE__ */ (0, N.jsx)("div", {
248
+ className: "graph-bar",
249
+ children: /* @__PURE__ */ (0, N.jsxs)("div", {
250
+ className: "graph-bar-min",
251
+ children: [
252
+ /* @__PURE__ */ (0, N.jsxs)(T, {
253
+ wrap: !0,
254
+ align: "center",
255
+ justify: "center",
256
+ className: "hover:text-[#145afd] cursor",
257
+ onClick: () => Oe(!K),
258
+ children: [/* @__PURE__ */ (0, N.jsx)(oe, {}), /* @__PURE__ */ (0, N.jsx)(T, {
259
+ className: "w-100% ",
260
+ justify: "center",
261
+ children: "查询统计"
262
+ })]
263
+ }),
264
+ /* @__PURE__ */ (0, N.jsx)(w, {
265
+ menu: { items: l?.map((e) => ({
266
+ ...e,
267
+ label: /* @__PURE__ */ (0, N.jsx)("div", {
268
+ className: (0, M.default)({ "text-[#145afd]": D === e.key }),
269
+ onClick: P(Me, e.key),
270
+ children: e.label
271
+ })
272
+ })) },
273
+ children: /* @__PURE__ */ (0, N.jsxs)(T, {
274
+ wrap: !0,
275
+ align: "center",
276
+ justify: "center",
277
+ className: "hover:text-[#145afd] cursor",
278
+ children: [/* @__PURE__ */ (0, N.jsx)(ge, {}), /* @__PURE__ */ (0, N.jsx)(T, {
279
+ className: "w-100% ",
280
+ justify: "center",
281
+ children: "布局"
282
+ })]
283
+ })
284
+ }),
285
+ /* @__PURE__ */ (0, N.jsxs)(T, {
286
+ wrap: !0,
287
+ align: "center",
288
+ justify: "center",
289
+ className: "hover:text-[#145afd] cursor",
290
+ onClick: () => Ge(),
291
+ children: [/* @__PURE__ */ (0, N.jsx)(pe, {}), /* @__PURE__ */ (0, N.jsx)(T, {
292
+ className: "w-100% ",
293
+ justify: "center",
294
+ children: "图显示设置"
295
+ })]
296
+ }),
297
+ /* @__PURE__ */ (0, N.jsx)(w, {
298
+ menu: { items: u.map((e) => ({
299
+ ...e,
300
+ label: /* @__PURE__ */ (0, N.jsx)("div", {
301
+ onClick: (t) => {
302
+ switch (t.stopPropagation(), e.key) {
303
+ case "query":
304
+ je();
305
+ break;
306
+ case "link":
307
+ Le();
308
+ break;
309
+ case "path":
310
+ Z();
311
+ break;
312
+ }
313
+ },
314
+ children: e.label
315
+ })
316
+ })) },
317
+ children: /* @__PURE__ */ (0, N.jsxs)(T, {
318
+ wrap: !0,
319
+ align: "center",
320
+ justify: "center",
321
+ className: "hover:text-[#145afd] cursor",
322
+ children: [/* @__PURE__ */ (0, N.jsx)(S, {}), /* @__PURE__ */ (0, N.jsx)(T, {
323
+ className: "w-100% ",
324
+ justify: "center",
325
+ children: "分析"
326
+ })]
327
+ })
328
+ }),
329
+ /* @__PURE__ */ (0, N.jsx)(w, {
330
+ menu: { items: i?.map((e) => ({
331
+ ...e,
332
+ label: /* @__PURE__ */ (0, N.jsx)("div", {
333
+ onClick: P(Re, e.key),
334
+ children: e.label
335
+ })
336
+ })) },
337
+ children: /* @__PURE__ */ (0, N.jsxs)(T, {
338
+ wrap: !0,
339
+ align: "center",
340
+ justify: "center",
341
+ className: "hover:text-[#145afd] cursor",
342
+ children: [/* @__PURE__ */ (0, N.jsx)(he, {}), /* @__PURE__ */ (0, N.jsx)(T, {
343
+ className: "w-100% ",
344
+ justify: "center",
345
+ children: "选择"
346
+ })]
347
+ })
348
+ }),
349
+ /* @__PURE__ */ (0, N.jsx)(w, {
350
+ menu: { items: o?.map((e) => ({
351
+ ...e,
352
+ label: /* @__PURE__ */ (0, N.jsx)("div", {
353
+ onClick: (t) => Ie(t, e.key),
354
+ children: e.label
355
+ })
356
+ })) },
357
+ children: /* @__PURE__ */ (0, N.jsxs)(T, {
358
+ wrap: !0,
359
+ align: "center",
360
+ justify: "center",
361
+ className: "hover:text-[#145afd] cursor",
362
+ children: [/* @__PURE__ */ (0, N.jsx)(me, {}), /* @__PURE__ */ (0, N.jsx)(T, {
363
+ className: "w-100% ",
364
+ justify: "center",
365
+ children: "下载数据"
366
+ })]
367
+ })
368
+ }),
369
+ /* @__PURE__ */ (0, N.jsxs)(T, {
370
+ wrap: !0,
371
+ align: "center",
372
+ justify: "center",
373
+ className: "hover:text-[#145afd] cursor",
374
+ onClick: () => ze(),
375
+ children: [/* @__PURE__ */ (0, N.jsx)(se, {}), /* @__PURE__ */ (0, N.jsx)(T, {
376
+ className: "w-100% ",
377
+ justify: "center",
378
+ children: "隐藏属性"
379
+ })]
380
+ }),
381
+ /* @__PURE__ */ (0, N.jsx)(w, {
382
+ menu: { items: d?.map((e) => ({
383
+ ...e,
384
+ label: /* @__PURE__ */ (0, N.jsx)("div", {
385
+ onClick: P(() => ee(p, e.key), e.key),
386
+ children: e.label
387
+ })
388
+ })) },
389
+ children: /* @__PURE__ */ (0, N.jsxs)(T, {
390
+ wrap: !0,
391
+ align: "center",
392
+ justify: "center",
393
+ className: "hover:text-[#145afd] cursor",
394
+ children: [/* @__PURE__ */ (0, N.jsx)(ce, {}), /* @__PURE__ */ (0, N.jsx)(T, {
395
+ className: "w-100% ",
396
+ justify: "center",
397
+ children: "文字位置"
398
+ })]
399
+ })
400
+ }),
401
+ /* @__PURE__ */ (0, N.jsxs)(T, {
402
+ wrap: !0,
403
+ align: "center",
404
+ justify: "center",
405
+ className: "hover:text-[#145afd] cursor",
406
+ onClick: () => We(),
407
+ children: [/* @__PURE__ */ (0, N.jsx)(x, {}), /* @__PURE__ */ (0, N.jsx)(T, {
408
+ className: "w-100% ",
409
+ justify: "center",
410
+ children: "清空画布"
411
+ })]
412
+ }),
413
+ /* @__PURE__ */ (0, N.jsxs)(T, {
414
+ wrap: !0,
415
+ align: "center",
416
+ justify: "center",
417
+ className: "hover:text-[#145afd] cursor",
418
+ children: [/* @__PURE__ */ (0, N.jsxs)(T, {
419
+ gap: "5px",
420
+ children: [/* @__PURE__ */ (0, N.jsx)(de, { onClick: () => $("in") }), /* @__PURE__ */ (0, N.jsx)(le, { onClick: () => $("out") })]
421
+ }), /* @__PURE__ */ (0, N.jsx)(T, {
422
+ className: "w-100% ",
423
+ justify: "center",
424
+ children: "节点缩放"
425
+ })]
426
+ }),
427
+ /* @__PURE__ */ (0, N.jsxs)(T, {
428
+ wrap: !0,
429
+ align: "center",
430
+ justify: "center",
431
+ className: "hover:text-[#145afd] cursor",
432
+ children: [/* @__PURE__ */ (0, N.jsxs)(T, {
433
+ gap: "5px",
434
+ children: [/* @__PURE__ */ (0, N.jsx)(fe, { onClick: () => X("in") }), /* @__PURE__ */ (0, N.jsx)(ue, { onClick: () => X("out") })]
435
+ }), /* @__PURE__ */ (0, N.jsx)(T, {
436
+ className: "w-100% ",
437
+ justify: "center",
438
+ children: "画布缩放"
439
+ })]
440
+ })
441
+ ]
442
+ })
443
+ }),
444
+ /* @__PURE__ */ (0, N.jsx)(m, {
445
+ isVisible: Se,
446
+ searchChange: (e) => Be(e),
447
+ closeQuery: () => z(!1)
448
+ }),
449
+ /* @__PURE__ */ (0, N.jsx)(h, {
450
+ isVisible: Ce,
451
+ analysis: (e) => c(p, { pathNodes: e }),
452
+ closePath: () => B(!1)
453
+ }),
454
+ /* @__PURE__ */ (0, N.jsx)(g, {
455
+ ref: G,
456
+ onLevelClick: Ve
457
+ }),
458
+ /* @__PURE__ */ (0, N.jsx)(O, {
459
+ title: "JSON预览",
460
+ open: we,
461
+ onCancel: () => U(!1),
462
+ footer: null,
463
+ width: 800,
464
+ children: /* @__PURE__ */ (0, N.jsx)("pre", {
465
+ style: {
466
+ maxHeight: "60vh",
467
+ overflow: "auto",
468
+ background: "#f5f5f5",
469
+ padding: "16px",
470
+ borderRadius: "4px"
471
+ },
472
+ children: V ? JSON.stringify(V, null, 2) : "暂无数据"
473
+ })
474
+ }),
475
+ /* @__PURE__ */ (0, N.jsx)(_e, {
476
+ title: "图显示设置",
477
+ placement: "right",
478
+ open: Te,
479
+ onClose: () => W(!1),
480
+ mask: !1,
481
+ width: 350,
482
+ getContainer: !1,
483
+ children: /* @__PURE__ */ (0, N.jsx)(A, {
484
+ activeKey: Ee,
485
+ onChange: De,
486
+ items: [{
487
+ label: "节点设置",
488
+ key: "node",
489
+ children: /* @__PURE__ */ (0, N.jsx)(I, { onSave: (e) => {
490
+ let t = p.current;
491
+ t && (t.nodes().forEach((t) => {
492
+ t.style({
493
+ width: e.nodeSize,
494
+ height: e.nodeSize,
495
+ "font-size": e.fontSize,
496
+ color: e.fontColor,
497
+ "font-weight": e.fontWeight,
498
+ "font-style": e.fontStyle,
499
+ "text-valign": e.textPosition,
500
+ "text-halign": "center",
501
+ "text-margin-y": e.textOffset,
502
+ label: e.showLabel === "show" ? t.data("name") || t.data("label") : ""
503
+ });
504
+ }), j.success("节点配置保存成功"));
505
+ } })
506
+ }, {
507
+ label: "连线设置",
508
+ key: "edge",
509
+ children: /* @__PURE__ */ (0, N.jsx)(ve, { onSave: (e) => {
510
+ let t = p.current;
511
+ t && (t.edges().forEach((t) => {
512
+ t.style({
513
+ width: e.edgeWidth,
514
+ "line-color": e.edgeColorType === "custom" ? e.customColor : "#a29e9e",
515
+ "target-arrow-color": e.edgeColorType === "custom" ? e.customColor : "#a29e9e",
516
+ "target-arrow-shape": e.showArrow === "show" ? "triangle" : "none",
517
+ "font-size": e.fontSize,
518
+ color: e.fontColor,
519
+ "font-weight": e.fontWeight,
520
+ "font-style": e.fontStyle,
521
+ label: e.showLabel === "show" ? t.data("label") || t.data("name") : "",
522
+ "text-background-color": e.labelBgColor || "transparent",
523
+ "text-background-opacity": +!!e.labelBgColor,
524
+ "text-background-padding": "2px"
525
+ });
526
+ }), j.success("连线配置保存成功"));
527
+ } })
528
+ }]
529
+ })
530
+ }),
531
+ /* @__PURE__ */ (0, N.jsx)("div", {
532
+ className: (0, M.default)("absolute right-0px z-1 bg-#fff p-10px rounded-10px shadow-[0_4px_20px_0px_rgba(12,95,218,0.33)] w-200px", { hidden: !K }),
533
+ children: /* @__PURE__ */ (0, N.jsx)(A, { items: [{
534
+ label: "实体",
535
+ key: "entity",
536
+ children: /* @__PURE__ */ (0, N.jsx)(N.Fragment, { children: Object.keys(v).length > 0 ? /* @__PURE__ */ (0, N.jsxs)("div", { children: [
537
+ /* @__PURE__ */ (0, N.jsxs)("p", { children: ["实体数量:", Object.values(v).reduce((e, t) => e + t.count, 0)] }),
538
+ /* @__PURE__ */ (0, N.jsxs)("p", {
539
+ className: "my-4px",
540
+ children: ["实体类型:", Object.keys(v).length]
541
+ }),
542
+ /* @__PURE__ */ (0, N.jsx)(T, {
543
+ gap: "5px",
544
+ justify: "start",
545
+ className: "w-100%",
546
+ wrap: !0,
547
+ children: Object.keys(v).map((e) => /* @__PURE__ */ (0, N.jsxs)(T, {
548
+ gap: "4px",
549
+ justify: "start",
550
+ className: `w-100% cursor ${q.has(e) ? "opacity-30" : ""}`,
551
+ onClick: () => He(e),
552
+ children: [
553
+ /* @__PURE__ */ (0, N.jsx)("img", {
554
+ className: "w-20px rounded-50%",
555
+ src: v[e].img,
556
+ alt: ""
557
+ }),
558
+ e,
559
+ ":",
560
+ v[e].count
561
+ ]
562
+ }, e))
563
+ })
564
+ ] }) : /* @__PURE__ */ (0, N.jsx)("span", {
565
+ className: "text-[#666]",
566
+ children: "暂无实体统计!"
567
+ }) })
568
+ }, {
569
+ label: "关系",
570
+ key: "relation",
571
+ children: /* @__PURE__ */ (0, N.jsx)(N.Fragment, { children: Object.keys(C)?.length > 0 ? /* @__PURE__ */ (0, N.jsxs)("div", { children: [
572
+ /* @__PURE__ */ (0, N.jsxs)("div", { children: ["关系数量:", Object.keys(C)?.length] }),
573
+ /* @__PURE__ */ (0, N.jsxs)("div", {
574
+ className: "my-4px",
575
+ children: ["关系类型:", Object.values(C)?.reduce((e, t) => e + t, 0)]
576
+ }),
577
+ /* @__PURE__ */ (0, N.jsx)(T, {
578
+ gap: "5px",
579
+ justify: "start",
580
+ className: "w-100%",
581
+ wrap: !0,
582
+ children: Object.keys(C).map((e) => /* @__PURE__ */ (0, N.jsxs)(T, {
583
+ gap: "4px",
584
+ className: `w-100% cursor ${J.has(e) ? "opacity-30" : ""}`,
585
+ onClick: () => Ue(e),
586
+ children: [
587
+ e,
588
+ ":",
589
+ C[e]
590
+ ]
591
+ }, e))
592
+ })
593
+ ] }) : /* @__PURE__ */ (0, N.jsx)("span", {
594
+ className: "text-[#666]",
595
+ children: "暂无关系统计!"
596
+ }) })
597
+ }] })
598
+ })
599
+ ] });
600
+ }), I = ({ onSave: e }) => {
601
+ let [t] = E.useForm();
602
+ return /* @__PURE__ */ (0, N.jsxs)(E, {
603
+ form: t,
604
+ layout: "vertical",
605
+ onFinish: e,
606
+ children: [
607
+ /* @__PURE__ */ (0, N.jsx)(E.Item, {
608
+ label: "节点大小",
609
+ name: "nodeSize",
610
+ initialValue: 80,
611
+ children: /* @__PURE__ */ (0, N.jsx)(D, {
612
+ type: "number",
613
+ placeholder: "请输入节点大小"
614
+ })
615
+ }),
616
+ /* @__PURE__ */ (0, N.jsx)(E.Item, {
617
+ label: "显示标签",
618
+ name: "showLabel",
619
+ initialValue: "show",
620
+ children: /* @__PURE__ */ (0, N.jsxs)(k, { children: [/* @__PURE__ */ (0, N.jsx)(k.Option, {
621
+ value: "show",
622
+ children: "显示"
623
+ }), /* @__PURE__ */ (0, N.jsx)(k.Option, {
624
+ value: "hide",
625
+ children: "隐藏"
626
+ })] })
627
+ }),
628
+ /* @__PURE__ */ (0, N.jsx)(E.Item, {
629
+ label: "字体位置",
630
+ name: "textPosition",
631
+ initialValue: "bottom",
632
+ children: /* @__PURE__ */ (0, N.jsx)(k, { children: d.map((e) => /* @__PURE__ */ (0, N.jsx)(k.Option, {
633
+ value: e.key,
634
+ children: e.label
635
+ }, e.item)) })
636
+ }),
637
+ /* @__PURE__ */ (0, N.jsx)(E.Item, {
638
+ label: "字体偏移",
639
+ name: "textOffset",
640
+ initialValue: 5,
641
+ children: /* @__PURE__ */ (0, N.jsx)(D, {
642
+ type: "number",
643
+ placeholder: "请输入字体偏移量"
644
+ })
645
+ }),
646
+ /* @__PURE__ */ (0, N.jsx)(E.Item, {
647
+ label: "字体颜色",
648
+ name: "fontColor",
649
+ initialValue: "rgb(50,50,50)",
650
+ children: /* @__PURE__ */ (0, N.jsx)(D, { placeholder: "请输入字体颜色" })
651
+ }),
652
+ /* @__PURE__ */ (0, N.jsx)(E.Item, {
653
+ label: "字体大小",
654
+ name: "fontSize",
655
+ initialValue: 18,
656
+ children: /* @__PURE__ */ (0, N.jsx)(D, {
657
+ type: "number",
658
+ placeholder: "请输入字体大小"
659
+ })
660
+ }),
661
+ /* @__PURE__ */ (0, N.jsx)(E.Item, {
662
+ label: "字体粗细",
663
+ name: "fontWeight",
664
+ initialValue: "normal",
665
+ children: /* @__PURE__ */ (0, N.jsxs)(k, { children: [
666
+ /* @__PURE__ */ (0, N.jsx)(k.Option, {
667
+ value: "normal",
668
+ children: "常规"
669
+ }),
670
+ /* @__PURE__ */ (0, N.jsx)(k.Option, {
671
+ value: "bold",
672
+ children: "粗体"
673
+ }),
674
+ /* @__PURE__ */ (0, N.jsx)(k.Option, {
675
+ value: "lighter",
676
+ children: "细体"
677
+ })
678
+ ] })
679
+ }),
680
+ /* @__PURE__ */ (0, N.jsx)(E.Item, {
681
+ label: "字体样式",
682
+ name: "fontStyle",
683
+ initialValue: "normal",
684
+ children: /* @__PURE__ */ (0, N.jsxs)(k, { children: [/* @__PURE__ */ (0, N.jsx)(k.Option, {
685
+ value: "normal",
686
+ children: "默认"
687
+ }), /* @__PURE__ */ (0, N.jsx)(k.Option, {
688
+ value: "italic",
689
+ children: "斜体"
690
+ })] })
691
+ }),
692
+ /* @__PURE__ */ (0, N.jsx)(E.Item, { children: /* @__PURE__ */ (0, N.jsx)(C, {
693
+ type: "primary",
694
+ htmlType: "submit",
695
+ block: !0,
696
+ children: "保存节点配置"
697
+ }) })
698
+ ]
699
+ });
700
+ }, ve = ({ onSave: e }) => {
701
+ let [t] = E.useForm(), [n, r] = b("default");
702
+ return /* @__PURE__ */ (0, N.jsxs)(E, {
703
+ form: t,
704
+ layout: "vertical",
705
+ onFinish: e,
706
+ children: [
707
+ /* @__PURE__ */ (0, N.jsx)(E.Item, {
708
+ label: "类型",
709
+ name: "edgeType",
710
+ initialValue: "straight",
711
+ children: /* @__PURE__ */ (0, N.jsxs)(k, { children: [/* @__PURE__ */ (0, N.jsx)(k.Option, {
712
+ value: "straight",
713
+ children: "直线"
714
+ }), /* @__PURE__ */ (0, N.jsx)(k.Option, {
715
+ value: "curve",
716
+ children: "曲线"
717
+ })] })
718
+ }),
719
+ /* @__PURE__ */ (0, N.jsx)(E.Item, {
720
+ label: "连线宽度",
721
+ name: "edgeWidth",
722
+ initialValue: 2,
723
+ children: /* @__PURE__ */ (0, N.jsx)(D, {
724
+ type: "number",
725
+ placeholder: "请输入连线宽度"
726
+ })
727
+ }),
728
+ /* @__PURE__ */ (0, N.jsx)(E.Item, {
729
+ label: "连线箭头",
730
+ name: "showArrow",
731
+ initialValue: "show",
732
+ children: /* @__PURE__ */ (0, N.jsxs)(k, { children: [/* @__PURE__ */ (0, N.jsx)(k.Option, {
733
+ value: "show",
734
+ children: "显示"
735
+ }), /* @__PURE__ */ (0, N.jsx)(k.Option, {
736
+ value: "hide",
737
+ children: "隐藏"
738
+ })] })
739
+ }),
740
+ /* @__PURE__ */ (0, N.jsx)(E.Item, {
741
+ label: "连线颜色",
742
+ name: "edgeColorType",
743
+ initialValue: "default",
744
+ children: /* @__PURE__ */ (0, N.jsxs)(k, {
745
+ onChange: r,
746
+ children: [/* @__PURE__ */ (0, N.jsx)(k.Option, {
747
+ value: "default",
748
+ children: "默认"
749
+ }), /* @__PURE__ */ (0, N.jsx)(k.Option, {
750
+ value: "custom",
751
+ children: "自定义色"
752
+ })]
753
+ })
754
+ }),
755
+ n === "custom" && /* @__PURE__ */ (0, N.jsx)(E.Item, {
756
+ label: "自定义颜色",
757
+ name: "customColor",
758
+ initialValue: "rgb(20,20,20)",
759
+ children: /* @__PURE__ */ (0, N.jsx)(D, { placeholder: "请输入自定义颜色" })
760
+ }),
761
+ /* @__PURE__ */ (0, N.jsx)(E.Item, {
762
+ label: "显示标签",
763
+ name: "showLabel",
764
+ initialValue: "show",
765
+ children: /* @__PURE__ */ (0, N.jsxs)(k, { children: [/* @__PURE__ */ (0, N.jsx)(k.Option, {
766
+ value: "show",
767
+ children: "显示"
768
+ }), /* @__PURE__ */ (0, N.jsx)(k.Option, {
769
+ value: "hide",
770
+ children: "隐藏"
771
+ })] })
772
+ }),
773
+ /* @__PURE__ */ (0, N.jsx)(E.Item, {
774
+ label: "字体大小",
775
+ name: "fontSize",
776
+ initialValue: 14,
777
+ children: /* @__PURE__ */ (0, N.jsx)(D, {
778
+ type: "number",
779
+ placeholder: "请输入字体大小"
780
+ })
781
+ }),
782
+ /* @__PURE__ */ (0, N.jsx)(E.Item, {
783
+ label: "字体粗细",
784
+ name: "fontWeight",
785
+ initialValue: "normal",
786
+ children: /* @__PURE__ */ (0, N.jsxs)(k, { children: [/* @__PURE__ */ (0, N.jsx)(k.Option, {
787
+ value: "normal",
788
+ children: "常规"
789
+ }), /* @__PURE__ */ (0, N.jsx)(k.Option, {
790
+ value: "bold",
791
+ children: "粗体"
792
+ })] })
793
+ }),
794
+ /* @__PURE__ */ (0, N.jsx)(E.Item, {
795
+ label: "字体样式",
796
+ name: "fontStyle",
797
+ initialValue: "normal",
798
+ children: /* @__PURE__ */ (0, N.jsxs)(k, { children: [/* @__PURE__ */ (0, N.jsx)(k.Option, {
799
+ value: "normal",
800
+ children: "默认"
801
+ }), /* @__PURE__ */ (0, N.jsx)(k.Option, {
802
+ value: "italic",
803
+ children: "斜体"
804
+ })] })
805
+ }),
806
+ /* @__PURE__ */ (0, N.jsx)(E.Item, {
807
+ label: "字体颜色",
808
+ name: "fontColor",
809
+ initialValue: "rgb(50,50,50)",
810
+ children: /* @__PURE__ */ (0, N.jsx)(D, { placeholder: "请输入字体颜色" })
811
+ }),
812
+ /* @__PURE__ */ (0, N.jsx)(E.Item, {
813
+ label: "标签背色",
814
+ name: "labelBgColor",
815
+ initialValue: "",
816
+ children: /* @__PURE__ */ (0, N.jsx)(D, { placeholder: "请选择颜色" })
817
+ }),
818
+ /* @__PURE__ */ (0, N.jsx)(E.Item, { children: /* @__PURE__ */ (0, N.jsx)(C, {
819
+ type: "primary",
820
+ htmlType: "submit",
821
+ block: !0,
822
+ children: "保存连线配置"
823
+ }) })
824
+ ]
825
+ });
826
+ };
827
+ //#endregion
828
+ export { F as default };