react-kggraph 0.0.29 → 0.0.31

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.es7.js CHANGED
@@ -1,22 +1,23 @@
1
1
  import { jsxs as g, Fragment as Z, jsx as t } from "react/jsx-runtime";
2
- import K, { forwardRef as Re, useContext as et, useState as v, useRef as tt, useImperativeHandle as ot, useEffect as nt } from "react";
2
+ import K, { forwardRef as nt, useContext as lt, useState as v, useRef as de, useImperativeHandle as st, useEffect as at } from "react";
3
3
  /* empty css */
4
- import { Dropdown as lt, Flex as y, Modal as st, Drawer as at, Tabs as ce, Form as f, Input as O, Select as u, ColorPicker as _, Button as ge, Row as rt, message as F } from "antd";
5
- import { utils as P, writeFile as it } from "./index.es21.js";
6
- import { textPositionConfig as pe, textLayout as ct, downloadData as dt, choiceConfig as ht, linkAnalysis as gt, layoutCongig as pt, handleCalcPath as mt, getCyData as de, donwnGraphData as ut } from "./index.es8.js";
7
- import { GraphContext as ft } from "./index.es15.js";
8
- import { layout as bt, fixNodesToEdges as wt } from "./index.es9.js";
4
+ import { Dropdown as rt, Flex as y, Modal as it, Drawer as ct, Tabs as he, Form as f, Input as O, Select as u, ColorPicker as _, Button as me, Row as dt, message as F } from "antd";
5
+ import { utils as P, writeFile as ht } from "./index.es21.js";
6
+ import { textPositionConfig as ue, textLayout as gt, downloadData as pt, choiceConfig as mt, linkAnalysis as ut, layoutCongig as ft, handleCalcPath as bt, getCyData as ge, donwnGraphData as wt } from "./index.es8.js";
7
+ import { GraphContext as yt } from "./index.es15.js";
8
+ import { layout as Ct, fixNodesToEdges as vt } from "./index.es9.js";
9
9
  import { defaultColors as H, nodeSize as q } from "./index.es10.js";
10
- import yt from "./index.es22.js";
11
- import Ct from "./index.es23.js";
12
- import vt from "./index.es24.js";
10
+ import xt from "./index.es22.js";
11
+ import St from "./index.es23.js";
12
+ import Nt from "./index.es24.js";
13
13
  import I from "./index.es17.js";
14
- import { downloadFile as he } from "./index.es12.js";
15
- import { actionList as xt, entityRelationList as St } from "./index.es4.js";
16
- import { DownOutlined as Nt, RightOutlined as Lt, UpOutlined as kt, LeftOutlined as Et } from "@ant-design/icons";
14
+ import { downloadFile as pe } from "./index.es12.js";
15
+ import { actionList as Lt, entityRelationList as kt } from "./index.es4.js";
16
+ import { DownOutlined as Dt, RightOutlined as Et, UpOutlined as It, LeftOutlined as Vt } from "@ant-design/icons";
17
+ import Pt from "./index.es25.js";
17
18
  const M = (b, c) => (k) => {
18
19
  k.stopPropagation(), b == null || b(c || "");
19
- }, Dt = (b) => {
20
+ }, Ot = (b) => {
20
21
  if (typeof b == "string")
21
22
  switch (b) {
22
23
  case "top":
@@ -31,32 +32,32 @@ const M = (b, c) => (k) => {
31
32
  return { bottom: 20, right: 20 };
32
33
  }
33
34
  return b;
34
- }, Qt = Re(({
35
+ }, Rt = nt(({
35
36
  graphInfo: b,
36
37
  cyRef: c,
37
38
  initNodeScale: k,
38
39
  typeObj: N,
39
40
  relationObj: V,
40
- colors: me
41
- }, ue) => {
42
- const W = { ...H, ...me }, { layoutType: fe, setLayoutType: be, queryStatisticsConfig: L, actionBar: x } = et(ft), Q = typeof x == "boolean" ? x : !0, J = (x == null ? void 0 : x.position) || "top-left", U = (x == null ? void 0 : x.actionList) ?? xt, [j, we] = v((x == null ? void 0 : x.isExpand) ?? !1), [D, ye] = v(""), [Ce, G] = v(!1), [X, ve] = v(k), [xe, A] = v(!1), [Se, z] = v(!1), [Y, Ne] = v(null), [Le, R] = v(!1), [ee, te] = v(!1), [ke, Ee] = v("node"), T = tt(null), De = Array.isArray(L) ? L.length > 0 : L, [oe, Ie] = v(De), [ne, Ve] = v(/* @__PURE__ */ new Set()), [le, Pe] = v(/* @__PURE__ */ new Set());
43
- ot(ue, () => ({
41
+ colors: fe
42
+ }, be) => {
43
+ const W = { ...H, ...fe }, { graphData: we, layoutType: ye, setLayoutType: Ce, queryStatisticsConfig: L, actionBar: x } = lt(yt), G = typeof x == "boolean" ? x : !0, J = (x == null ? void 0 : x.position) || "top-left", Q = (x == null ? void 0 : x.actionList) ?? Lt, [j, ve] = v((x == null ? void 0 : x.isExpand) ?? !1), [E, xe] = v(""), [Se, U] = v(!1), [X, Ne] = v(k), [Le, A] = v(!1), [ke, T] = v(!1), [Y, De] = v(null), [Ee, R] = v(!1), [ee, te] = v(!1), [Ie, Ve] = v("node"), z = de(null), oe = de(null), Pe = Array.isArray(L) ? L.length > 0 : L, [ne, Oe] = v(Pe), [le, je] = v(/* @__PURE__ */ new Set()), [se, Ae] = v(/* @__PURE__ */ new Set());
44
+ st(be, () => ({
44
45
  onPathAnalysis: () => {
45
- ae();
46
+ re();
46
47
  }
47
- })), nt(() => {
48
- se();
49
- }, [D]);
50
- const se = async (e) => {
48
+ })), at(() => {
49
+ ae();
50
+ }, [E]);
51
+ const ae = async (e) => {
51
52
  const o = c.current;
52
- if (!o || !D) {
53
+ if (!o || !E) {
53
54
  o == null || o.fit();
54
55
  return;
55
56
  }
56
57
  o == null || o.nodes().removeClass("highlight selected grayed highlighted path-node"), o.elements().removeClass("level-highlight level-selected grayed path-edge");
57
58
  const n = o.nodes().filter((l) => {
58
59
  const i = (l.data("name") || "").toLowerCase(), s = (l.data("role") || "").toLowerCase(), h = (l.data("dept") || "").toLowerCase(), m = String(l.data("id") || "").toLowerCase();
59
- return i.includes(D.toLowerCase()) || s.includes(D.toLowerCase()) || h.includes(D.toLowerCase()) || m.includes(D.toLowerCase());
60
+ return i.includes(E.toLowerCase()) || s.includes(E.toLowerCase()) || h.includes(E.toLowerCase()) || m.includes(E.toLowerCase());
60
61
  });
61
62
  o.nodes().removeClass("highlight"), n.addClass("highlight"), n.length === 1 ? (console.log("matchedNodes:::", n), o.animate({
62
63
  center: {
@@ -64,7 +65,7 @@ const M = (b, c) => (k) => {
64
65
  },
65
66
  duration: 500
66
67
  })) : alert("未找到对应节点");
67
- }, Oe = (e) => {
68
+ }, Te = (e) => {
68
69
  const o = c.current;
69
70
  if (!o) return;
70
71
  const n = o.zoom();
@@ -79,42 +80,42 @@ const M = (b, c) => (k) => {
79
80
  break;
80
81
  }
81
82
  o.zoom(l), o.center();
82
- }, je = () => {
83
- console.log("查询节点"), A(!0), z(!1), T.current.close();
84
- }, ae = () => {
85
- console.log("路径分析"), A(!1), z(!0), T.current.close();
86
- }, Ae = (e) => {
83
+ }, ze = () => {
84
+ console.log("查询节点"), A(!0), T(!1), z.current.close();
85
+ }, re = () => {
86
+ console.log("路径分析"), A(!1), T(!0), z.current.close();
87
+ }, Fe = (e) => {
87
88
  var n;
88
- be(e);
89
+ Ce(e);
89
90
  const o = c.current;
90
- o && (o.nodes().unlock(), bt(c, e), e === "cose-bilkent" && ((n = b == null ? void 0 : b.searchNodes) == null ? void 0 : n.length) === 2 && wt(
91
+ o && (o.nodes().unlock(), Ct(c, e), e === "cose-bilkent" && ((n = b == null ? void 0 : b.searchNodes) == null ? void 0 : n.length) === 2 && vt(
91
92
  o,
92
93
  b.searchNodes[0],
93
94
  b.searchNodes[1]
94
95
  ));
95
- }, ze = () => {
96
+ }, He = () => {
96
97
  const e = c.current;
97
- e && ut(e);
98
- }, Te = () => {
98
+ e && wt(e);
99
+ }, _e = () => {
99
100
  const e = c.current;
100
101
  if (!e) return;
101
- const o = de(e);
102
- Ne(o), R(!0);
103
- }, re = (e, o) => {
102
+ const o = ge(e);
103
+ De(o), R(!0);
104
+ }, ie = (e, o) => {
104
105
  const n = e.current;
105
106
  if (!n) return;
106
107
  const l = 2;
107
108
  if (o === "downloadPng") {
108
109
  const i = n.png({ scale: l, bg: "transparent", full: !0, quality: 1 });
109
- he(i, `graph_${Date.now()}.png`);
110
+ pe(i, `graph_${Date.now()}.png`);
110
111
  } else if (o === "downloadJpg") {
111
112
  const i = n.jpg({ scale: l, bg: "#ffffff", full: !0, quality: 1 });
112
- he(i, `graph_${Date.now()}.jpg`);
113
+ pe(i, `graph_${Date.now()}.jpg`);
113
114
  }
114
- }, Fe = () => {
115
+ }, We = () => {
115
116
  const e = c.current;
116
117
  if (!e) return;
117
- const o = de(e), { nodes: n = [], edges: l = [] } = o, i = n.map((m) => {
118
+ const o = ge(e), { nodes: n = [], edges: l = [] } = o, i = n.map((m) => {
118
119
  var p, r;
119
120
  const d = m.data || {}, S = d.properties || {};
120
121
  return {
@@ -132,8 +133,8 @@ const M = (b, c) => (k) => {
132
133
  属性值: S.value || ""
133
134
  };
134
135
  }), s = l.map((m) => {
135
- var r, a, w, E;
136
- const d = m.data || {}, S = ((a = (r = d.source) == null ? void 0 : r.split("/#")[0]) == null ? void 0 : a.split("/").pop()) || d.source, p = ((E = (w = d.target) == null ? void 0 : w.split("/#")[0]) == null ? void 0 : E.split("/").pop()) || d.target;
136
+ var r, a, w, D;
137
+ const d = m.data || {}, S = ((a = (r = d.source) == null ? void 0 : r.split("/#")[0]) == null ? void 0 : a.split("/").pop()) || d.source, p = ((D = (w = d.target) == null ? void 0 : w.split("/#")[0]) == null ? void 0 : D.split("/").pop()) || d.target;
137
138
  return {
138
139
  源节点: S,
139
140
  目标节点: p,
@@ -189,30 +190,30 @@ const M = (b, c) => (k) => {
189
190
  // 关系ID
190
191
  ], P.book_append_sheet(h, m, "关系");
191
192
  }
192
- it(h, `graph_${Date.now()}.xlsx`);
193
- }, He = (e, o) => {
193
+ ht(h, `graph_${Date.now()}.xlsx`);
194
+ }, Je = (e, o) => {
194
195
  switch (e.stopPropagation(), o) {
195
196
  case "downloadJson":
196
- ze();
197
+ He();
197
198
  break;
198
199
  case "previewJsonList":
199
- Te();
200
+ _e();
200
201
  break;
201
202
  case "downloadExcel":
202
- Fe();
203
+ We();
203
204
  break;
204
205
  case "previewDataList":
205
206
  break;
206
207
  case "downloadJpg":
207
- re(c, o);
208
+ ie(c, o);
208
209
  break;
209
210
  case "downloadPng":
210
- re(c, o);
211
+ ie(c, o);
211
212
  break;
212
213
  }
213
- }, _e = () => {
214
- A(!1), z(!1), T.current.open();
215
- }, We = (e) => {
214
+ }, $e = () => {
215
+ A(!1), T(!1), z.current.open();
216
+ }, Be = (e) => {
216
217
  const o = c.current;
217
218
  if (o)
218
219
  if (o.panningEnabled(!0), e === "all")
@@ -233,25 +234,25 @@ const M = (b, c) => (k) => {
233
234
  }), o.on("boxselectend", () => {
234
235
  console.log("框选结束"), o.zoomingEnabled(!0), o.panningEnabled(!0);
235
236
  }));
236
- }, Je = () => {
237
+ }, Ze = () => {
237
238
  const e = c.current;
238
- if (console.log("isShow::::"), Ce)
239
- G(!1), e.nodes('[types="typed-literal" ]').style("visibility", "visible"), e.edges().style("visibility", "visible");
239
+ if (console.log("isShow::::"), Se)
240
+ U(!1), e.nodes('[types="typed-literal" ]').style("visibility", "visible"), e.edges().style("visibility", "visible");
240
241
  else {
241
- G(!0);
242
+ U(!0);
242
243
  const o = e.nodes('[types="typed-literal" ]');
243
244
  o.style("visibility", "hidden"), o.connectedEdges().style("visibility", "hidden");
244
245
  }
245
- }, $e = (e) => {
246
+ }, Ke = (e) => {
246
247
  const o = c.current;
247
248
  if (!o) return;
248
249
  const n = e === "out" ? Math.max(X * 0.8, 0.1) : Math.min(X * 1.2, 5);
249
- ve(n);
250
+ Ne(n);
250
251
  const l = o.nodes();
251
252
  l.style("width", (i) => (i.data("baseWidth") || q) * n), l.style("height", (i) => (i.data("baseHeight") || q) * n);
252
- }, Be = (e) => {
253
- ye(e.content), se(e.content);
254
- }, Ze = (e = "刘强东", o = "1") => {
253
+ }, Me = (e) => {
254
+ xe(e.content), ae(e.content);
255
+ }, qe = (e = "刘强东", o = "1") => {
255
256
  const n = c.current;
256
257
  if (!n) return;
257
258
  n.elements().removeClass("level-highlight level-selected grayed path-edge");
@@ -269,12 +270,12 @@ const M = (b, c) => (k) => {
269
270
  a.add(w.id()), s.merge(w);
270
271
  }), h.push(r));
271
272
  for (let w = 2; w <= i; w++) {
272
- const E = n.collection();
273
+ const D = n.collection();
273
274
  r.forEach(($) => {
274
275
  $.neighborhood().nodes().forEach((B) => {
275
- a.has(B.id()) || (a.add(B.id()), E.merge(B));
276
+ a.has(B.id()) || (a.add(B.id()), D.merge(B));
276
277
  });
277
- }), E.forEach(($) => s.merge($)), h.push(E), r = E;
278
+ }), D.forEach(($) => s.merge($)), h.push(D), r = D;
278
279
  }
279
280
  }), h.forEach((p) => {
280
281
  p.addClass("level-highlight");
@@ -284,22 +285,22 @@ const M = (b, c) => (k) => {
284
285
  }).addClass("path-edge");
285
286
  const d = n.elements().filter(".level-selected, .level-highlight, .path-edge");
286
287
  n.elements().not(d).addClass("grayed"), F.success(`已高亮 "${e}" 及其 ${i} 度关联节点和连线`);
287
- }, Ke = (e) => {
288
+ }, Ge = (e) => {
288
289
  const o = c.current;
289
290
  if (!o) return;
290
- const n = new Set(ne);
291
- n.has(e) ? (n.delete(e), o.nodes().filter((l) => l.data("type") === e).show()) : (n.add(e), o.nodes().filter((l) => l.data("type") === e).hide()), Ve(n);
292
- }, Me = (e) => {
291
+ const n = new Set(le);
292
+ n.has(e) ? (n.delete(e), o.nodes().filter((l) => l.data("type") === e).show()) : (n.add(e), o.nodes().filter((l) => l.data("type") === e).hide()), je(n);
293
+ }, Qe = (e) => {
293
294
  const o = c.current;
294
295
  if (!o) return;
295
- const n = new Set(le);
296
- n.has(e) ? (n.delete(e), o.edges().filter((l) => l.data("name") === e).show()) : (n.add(e), o.edges().filter((l) => l.data("name") === e).hide()), Pe(n);
297
- }, qe = () => {
296
+ const n = new Set(se);
297
+ n.has(e) ? (n.delete(e), o.edges().filter((l) => l.data("name") === e).show()) : (n.add(e), o.edges().filter((l) => l.data("name") === e).hide()), Ae(n);
298
+ }, Ue = () => {
298
299
  const e = c.current;
299
300
  e.remove(e.elements());
300
- }, Qe = () => {
301
+ }, Xe = () => {
301
302
  te(!ee);
302
- }, Ue = (e) => {
303
+ }, Ye = (e) => {
303
304
  var i, s;
304
305
  const o = c.current;
305
306
  if (!o) return;
@@ -321,7 +322,9 @@ const M = (b, c) => (k) => {
321
322
  "text-opacity": m ? 1 : 0
322
323
  });
323
324
  }), F.success("节点配置保存成功");
324
- }, Ge = (e) => {
325
+ }, Re = () => {
326
+ oe.current.open(we);
327
+ }, et = (e) => {
325
328
  var h, m, d, S, p, r;
326
329
  const o = c.current;
327
330
  if (!o) return;
@@ -345,46 +348,49 @@ const M = (b, c) => (k) => {
345
348
  "text-background-padding": "2px"
346
349
  });
347
350
  }), F.success("连线配置保存成功");
348
- }, Xe = Dt(J), C = J === "left" || J === "right";
349
- if (console.log(1e3, Q, U), !Q) return null;
350
- const Ye = Array.isArray(L) && (L == null ? void 0 : L.length) > 0 ? L : St, ie = () => /* @__PURE__ */ g(rt, { justify: "center", align: "middle", className: I("cursor", {
351
+ }, tt = Ot(J), C = J === "left" || J === "right";
352
+ if (console.log(1e3, G, Q), !G) return null;
353
+ const ot = Array.isArray(L) && (L == null ? void 0 : L.length) > 0 ? L : kt, ce = () => /* @__PURE__ */ g(dt, { justify: "center", align: "middle", className: I("cursor", {
351
354
  "oprate-btn-vertical": C,
352
355
  "oprate-btn": !C
353
- }), onClick: () => we(!j), children: [
356
+ }), onClick: () => ve(!j), children: [
354
357
  "操作 ",
355
- j ? C ? /* @__PURE__ */ t(Nt, {}) : /* @__PURE__ */ t(Lt, {}) : C ? /* @__PURE__ */ t(kt, {}) : /* @__PURE__ */ t(Et, {})
358
+ j ? C ? /* @__PURE__ */ t(Dt, {}) : /* @__PURE__ */ t(Et, {}) : C ? /* @__PURE__ */ t(It, {}) : /* @__PURE__ */ t(Vt, {})
356
359
  ] });
357
360
  return /* @__PURE__ */ g(Z, { children: [
358
- /* @__PURE__ */ t("div", { className: I("graph-bar", { "graph-bar-vertical": C }), style: Xe, children: /* @__PURE__ */ g("div", { className: I("graph-bar-min", {
361
+ /* @__PURE__ */ t("div", { className: I("graph-bar", { "graph-bar-vertical": C }), style: tt, children: /* @__PURE__ */ g("div", { className: I("graph-bar-min", {
359
362
  "graph-bar-min-vertical": C
360
363
  }), children: [
361
- !C && ie(),
364
+ !C && ce(),
362
365
  /* @__PURE__ */ t("div", { className: I({
363
366
  "graph-bar-expand-wrapper-vertical": C,
364
367
  "graph-bar-expand-wrapper": !C,
365
368
  "collapsed-vertical": !j && C,
366
369
  collapsed: !j && !C
367
- }), children: U.map(({ key: e, title: o, icon: n, onClick: l }) => {
370
+ }), children: Q.map(({ key: e, title: o, icon: n, onClick: l }) => {
368
371
  var m, d, S, p;
369
372
  const i = () => n && n.length > 0 ? n.length > 1 ? /* @__PURE__ */ t(y, { gap: "5px", children: n.map((r, a) => e === "nodeZoom" ? K.cloneElement(r, {
370
- onClick: () => $e(a === 0 ? "in" : "out"),
373
+ onClick: () => Ke(a === 0 ? "in" : "out"),
371
374
  key: a
372
375
  }) : e === "canvasZoom" ? K.cloneElement(r, {
373
- onClick: () => Oe(a === 0 ? "in" : "out"),
376
+ onClick: () => Te(a === 0 ? "in" : "out"),
374
377
  key: a
375
378
  }) : K.cloneElement(r, { key: a })) }) : /* @__PURE__ */ t(y, { gap: "5px", children: n }) : null, s = (r) => {
376
379
  switch (console.log(444, e, r), e) {
377
380
  case "queryStatistics":
378
- Ie(!oe);
381
+ Oe(!ne);
379
382
  break;
380
383
  case "graphDisplaySettings":
381
- Qe();
384
+ Xe();
382
385
  break;
383
386
  case "hideAttributes":
384
- Je();
387
+ Ze();
385
388
  break;
386
389
  case "clearCanvas":
387
- qe();
390
+ Ue();
391
+ break;
392
+ case "tablelist":
393
+ Re();
388
394
  break;
389
395
  default:
390
396
  r == null || r(c);
@@ -394,40 +400,40 @@ const M = (b, c) => (k) => {
394
400
  let r = [];
395
401
  switch (e) {
396
402
  case "layout":
397
- r = (m = pt) == null ? void 0 : m.map((a) => ({
403
+ r = (m = ft) == null ? void 0 : m.map((a) => ({
398
404
  ...a,
399
- label: /* @__PURE__ */ t("div", { className: I({ "text-[#145afd]": fe === a.key }), onClick: M(Ae, a.key), children: a.label })
405
+ label: /* @__PURE__ */ t("div", { className: I({ "text-[#145afd]": ye === a.key }), onClick: M(Fe, a.key), children: a.label })
400
406
  }));
401
407
  break;
402
408
  case "analysis":
403
- r = gt.map((a) => ({
409
+ r = ut.map((a) => ({
404
410
  ...a,
405
411
  label: /* @__PURE__ */ t("div", { onClick: (w) => {
406
412
  switch (w.stopPropagation(), a.key) {
407
413
  case "query":
408
- je();
414
+ ze();
409
415
  break;
410
416
  case "link":
411
- _e();
417
+ $e();
412
418
  break;
413
419
  case "path":
414
- ae();
420
+ re();
415
421
  break;
416
422
  }
417
423
  }, children: a.label })
418
424
  }));
419
425
  break;
420
426
  case "select":
421
- r = (d = ht) == null ? void 0 : d.map((a) => ({ ...a, label: /* @__PURE__ */ t("div", { onClick: M(We, a.key), children: a.label }) }));
427
+ r = (d = mt) == null ? void 0 : d.map((a) => ({ ...a, label: /* @__PURE__ */ t("div", { onClick: M(Be, a.key), children: a.label }) }));
422
428
  break;
423
429
  case "downloadData":
424
- r = (S = dt) == null ? void 0 : S.map((a) => ({ ...a, label: /* @__PURE__ */ t("div", { onClick: (w) => He(w, a.key), children: a.label }) }));
430
+ r = (S = pt) == null ? void 0 : S.map((a) => ({ ...a, label: /* @__PURE__ */ t("div", { onClick: (w) => Je(w, a.key), children: a.label }) }));
425
431
  break;
426
432
  case "textPosition":
427
- r = (p = pe) == null ? void 0 : p.map((a) => ({ ...a, label: /* @__PURE__ */ t("div", { onClick: M(() => ct(c, a.key), a.key), children: a.label }) }));
433
+ r = (p = ue) == null ? void 0 : p.map((a) => ({ ...a, label: /* @__PURE__ */ t("div", { onClick: M(() => gt(c, a.key), a.key), children: a.label }) }));
428
434
  break;
429
435
  }
430
- return /* @__PURE__ */ t(lt, { trigger: ["hover"], placement: C ? "bottomRight" : "bottom", menu: { items: r }, children: /* @__PURE__ */ g(y, { wrap: !0, align: "center", justify: "center", className: "hove-active cursor bar-item", children: [
436
+ return /* @__PURE__ */ t(rt, { trigger: ["hover"], placement: C ? "bottomRight" : "bottom", menu: { items: r }, children: /* @__PURE__ */ g(y, { wrap: !0, align: "center", justify: "center", className: "hove-active cursor bar-item", children: [
431
437
  i(),
432
438
  /* @__PURE__ */ t(y, { className: "w-100", justify: "center", children: o })
433
439
  ] }) }, e);
@@ -437,16 +443,16 @@ const M = (b, c) => (k) => {
437
443
  /* @__PURE__ */ t(y, { className: "w-100", justify: "center", children: o })
438
444
  ] }, e);
439
445
  }) }),
440
- C && ie()
446
+ C && ce()
441
447
  ] }) }),
442
- /* @__PURE__ */ t(yt, { isVisible: xe, searchChange: (e) => Be(e), closeQuery: () => A(!1) }),
443
- /* @__PURE__ */ t(Ct, { isVisible: Se, analysis: (e) => mt(c, { nodes: e.map((o) => ({ id: o })) }), closePath: () => z(!1) }),
444
- /* @__PURE__ */ t(vt, { ref: T, onLevelClick: Ze }),
448
+ /* @__PURE__ */ t(xt, { isVisible: Le, searchChange: (e) => Me(e), closeQuery: () => A(!1) }),
449
+ /* @__PURE__ */ t(St, { isVisible: ke, analysis: (e) => bt(c, { nodes: e.map((o) => ({ id: o })) }), closePath: () => T(!1) }),
450
+ /* @__PURE__ */ t(Nt, { ref: z, onLevelClick: qe }),
445
451
  /* @__PURE__ */ t(
446
- st,
452
+ it,
447
453
  {
448
454
  title: "JSON预览",
449
- open: Le,
455
+ open: Ee,
450
456
  onCancel: () => R(!1),
451
457
  footer: null,
452
458
  width: 800,
@@ -454,7 +460,7 @@ const M = (b, c) => (k) => {
454
460
  }
455
461
  ),
456
462
  /* @__PURE__ */ t(
457
- at,
463
+ ct,
458
464
  {
459
465
  title: "图显示设置",
460
466
  placement: "right",
@@ -469,34 +475,35 @@ const M = (b, c) => (k) => {
469
475
  },
470
476
  getContainer: !1,
471
477
  children: /* @__PURE__ */ t(
472
- ce,
478
+ he,
473
479
  {
474
- activeKey: ke,
475
- onChange: Ee,
480
+ activeKey: Ie,
481
+ onChange: Ve,
476
482
  style: { flex: 1, overflow: "auto" },
477
483
  tabBarStyle: { padding: "0 16px", margin: 0, background: "#fff", position: "sticky", top: 0, zIndex: 10 },
478
484
  items: [
479
485
  {
480
486
  label: "节点设置",
481
487
  key: "node",
482
- children: /* @__PURE__ */ t(It, { onSave: Ue, colors: W })
488
+ children: /* @__PURE__ */ t(jt, { onSave: Ye, colors: W })
483
489
  },
484
490
  {
485
491
  label: "连线设置",
486
492
  key: "edge",
487
- children: /* @__PURE__ */ t(Vt, { onSave: Ge, colors: W })
493
+ children: /* @__PURE__ */ t(At, { onSave: et, colors: W })
488
494
  }
489
495
  ]
490
496
  }
491
497
  )
492
498
  }
493
499
  ),
500
+ /* @__PURE__ */ t(Pt, { ref: oe }),
494
501
  /* @__PURE__ */ t("div", { className: I("gtaph-statics absolute", {
495
- hidden: !oe
502
+ hidden: !ne
496
503
  }), children: /* @__PURE__ */ t(
497
- ce,
504
+ he,
498
505
  {
499
- items: Ye.map(({ key: e, label: o }) => {
506
+ items: ot.map(({ key: e, label: o }) => {
500
507
  var n, l, i;
501
508
  return e === "entity" ? {
502
509
  label: o,
@@ -510,7 +517,7 @@ const M = (b, c) => (k) => {
510
517
  /* @__PURE__ */ t("span", { children: "实体类型:" }),
511
518
  /* @__PURE__ */ t("span", { children: Object.keys(N).length })
512
519
  ] }),
513
- /* @__PURE__ */ t(y, { gap: "5px", justify: "start", className: "w-100 static-wraper", wrap: !0, children: Object.keys(N).map((s) => /* @__PURE__ */ g(y, { gap: "4px", justify: "space-between", className: `w-100 cursor ${ne.has(s) ? "opacity-30" : ""}`, onClick: () => Ke(s), children: [
520
+ /* @__PURE__ */ t(y, { gap: "5px", justify: "start", className: "w-100 static-wraper", wrap: !0, children: Object.keys(N).map((s) => /* @__PURE__ */ g(y, { gap: "4px", justify: "space-between", className: `w-100 cursor ${le.has(s) ? "opacity-30" : ""}`, onClick: () => Ge(s), children: [
514
521
  /* @__PURE__ */ g(y, { align: "center", gap: "2px", children: [
515
522
  /* @__PURE__ */ t("img", { className: "w-20px rounded-50", src: N[s].img, alt: "" }),
516
523
  s,
@@ -531,7 +538,7 @@ const M = (b, c) => (k) => {
531
538
  /* @__PURE__ */ t("span", { children: "关系类型:" }),
532
539
  /* @__PURE__ */ t("span", { children: (i = Object.values(V)) == null ? void 0 : i.reduce((s, h) => s + h, 0) })
533
540
  ] }),
534
- /* @__PURE__ */ t(y, { gap: "5px", justify: "start", className: "w-100 static-wraper", wrap: !0, children: Object.keys(V).map((s) => /* @__PURE__ */ g(y, { gap: "4px", justify: "space-between", className: `w-100 cursor ${le.has(s) ? "opacity-30" : ""}`, onClick: () => Me(s), children: [
541
+ /* @__PURE__ */ t(y, { gap: "5px", justify: "start", className: "w-100 static-wraper", wrap: !0, children: Object.keys(V).map((s) => /* @__PURE__ */ g(y, { gap: "4px", justify: "space-between", className: `w-100 cursor ${se.has(s) ? "opacity-30" : ""}`, onClick: () => Qe(s), children: [
535
542
  /* @__PURE__ */ g("span", { children: [
536
543
  s,
537
544
  ":"
@@ -544,7 +551,7 @@ const M = (b, c) => (k) => {
544
551
  }
545
552
  ) })
546
553
  ] });
547
- }), It = ({ onSave: b, colors: c }) => {
554
+ }), jt = ({ onSave: b, colors: c }) => {
548
555
  const [k] = f.useForm();
549
556
  return /* @__PURE__ */ g(f, { form: k, layout: "vertical", onFinish: b, className: "setting-form", children: [
550
557
  /* @__PURE__ */ g("div", { className: "setting-form-content", children: [
@@ -553,7 +560,7 @@ const M = (b, c) => (k) => {
553
560
  /* @__PURE__ */ t(u.Option, { value: "show", children: "显示" }),
554
561
  /* @__PURE__ */ t(u.Option, { value: "hide", children: "隐藏" })
555
562
  ] }) }),
556
- /* @__PURE__ */ t(f.Item, { label: "字体位置", name: "textPosition", initialValue: "bottom", children: /* @__PURE__ */ t(u, { children: pe.map((N) => /* @__PURE__ */ t(u.Option, { value: N.key, children: N.label }, N.key)) }) }),
563
+ /* @__PURE__ */ t(f.Item, { label: "字体位置", name: "textPosition", initialValue: "bottom", children: /* @__PURE__ */ t(u, { children: ue.map((N) => /* @__PURE__ */ t(u.Option, { value: N.key, children: N.label }, N.key)) }) }),
557
564
  /* @__PURE__ */ t(f.Item, { label: "字体偏移", name: "textOffset", initialValue: 5, children: /* @__PURE__ */ t(O, { type: "number", placeholder: "请输入字体偏移量" }) }),
558
565
  /* @__PURE__ */ t(f.Item, { label: "字体颜色", name: "fontColor", initialValue: c.nodeLabelColor, children: /* @__PURE__ */ t(_, { showText: !0 }) }),
559
566
  /* @__PURE__ */ t(f.Item, { label: "字体大小", name: "fontSize", initialValue: c.nodeLabelFontSize, children: /* @__PURE__ */ t(O, { type: "number", placeholder: "请输入字体大小" }) }),
@@ -567,9 +574,9 @@ const M = (b, c) => (k) => {
567
574
  /* @__PURE__ */ t(u.Option, { value: "italic", children: "斜体" })
568
575
  ] }) })
569
576
  ] }),
570
- /* @__PURE__ */ t("div", { className: "setting-form-footer", children: /* @__PURE__ */ t(f.Item, { children: /* @__PURE__ */ t(ge, { type: "primary", htmlType: "submit", block: !0, children: "保存节点配置" }) }) })
577
+ /* @__PURE__ */ t("div", { className: "setting-form-footer", children: /* @__PURE__ */ t(f.Item, { children: /* @__PURE__ */ t(me, { type: "primary", htmlType: "submit", block: !0, children: "保存节点配置" }) }) })
571
578
  ] });
572
- }, Vt = ({ onSave: b, colors: c }) => {
579
+ }, At = ({ onSave: b, colors: c }) => {
573
580
  const [k] = f.useForm();
574
581
  return /* @__PURE__ */ g(f, { form: k, layout: "vertical", onFinish: b, className: "setting-form", children: [
575
582
  /* @__PURE__ */ g("div", { className: "setting-form-content", children: [
@@ -595,10 +602,10 @@ const M = (b, c) => (k) => {
595
602
  ] }) }),
596
603
  /* @__PURE__ */ t(f.Item, { label: "标签背景色", name: "labelBgColor", initialValue: "#ffffff", children: /* @__PURE__ */ t(_, { showText: !0 }) })
597
604
  ] }),
598
- /* @__PURE__ */ t("div", { className: "setting-form-footer", children: /* @__PURE__ */ t(f.Item, { children: /* @__PURE__ */ t(ge, { type: "primary", htmlType: "submit", block: !0, children: "保存连线配置" }) }) })
605
+ /* @__PURE__ */ t("div", { className: "setting-form-footer", children: /* @__PURE__ */ t(f.Item, { children: /* @__PURE__ */ t(me, { type: "primary", htmlType: "submit", block: !0, children: "保存连线配置" }) }) })
599
606
  ] });
600
607
  };
601
608
  export {
602
- xt as actionList,
603
- Qt as default
609
+ Lt as actionList,
610
+ Rt as default
604
611
  };
package/lib/index.es8.js CHANGED
@@ -1,16 +1,16 @@
1
1
  import { message as v } from "antd";
2
- import O from "./index.es25.js";
3
- import j from "./index.es26.js";
4
- import I from "./index.es27.js";
5
- import P from "./index.es28.js";
6
- import D from "./index.es29.js";
7
- import $ from "./index.es30.js";
8
- import J from "./index.es31.js";
9
- import R from "./index.es32.js";
10
- import A from "./index.es33.js";
11
- import q from "./index.es34.js";
12
- import B from "./index.es35.js";
13
- import T from "./index.es36.js";
2
+ import O from "./index.es26.js";
3
+ import j from "./index.es27.js";
4
+ import I from "./index.es28.js";
5
+ import P from "./index.es29.js";
6
+ import D from "./index.es30.js";
7
+ import $ from "./index.es31.js";
8
+ import J from "./index.es32.js";
9
+ import R from "./index.es33.js";
10
+ import A from "./index.es34.js";
11
+ import q from "./index.es35.js";
12
+ import B from "./index.es36.js";
13
+ import T from "./index.es37.js";
14
14
  import { jsonStringifyParse as U } from "./index.es12.js";
15
15
  const N = [O, j, I, P, D, $, J, R, A, q], W = (s) => {
16
16
  let o = { _: { count: 0 } };
package/lib/index.es9.js CHANGED
@@ -43,32 +43,27 @@ const I = (e, n, r, o = 20) => {
43
43
  return console.log("fixNodesToEdges: 完成"), !0;
44
44
  }, c = () => ({
45
45
  name: "cose-bilkent",
46
- // 核心优化
47
- nodeRepulsion: 1005e3,
48
- // 大幅增加斥力,让节点分散
46
+ // 核心优化 — 降低迭代和斥力以大幅提速
47
+ nodeRepulsion: 5e5,
48
+ // 降低斥力(原1005000),迭代收敛更快
49
49
  idealEdgeLength: 100,
50
- // 拉长边长,避免拥挤
51
50
  edgeElasticity: 0.3,
52
- // 适度弹性,保持边距
53
- numIter: 2500,
54
- // 保持迭代次数
51
+ numIter: 500,
52
+ // 大幅减少迭代次数(原2500),5x提速
55
53
  // 布局对齐
56
54
  fit: !0,
57
55
  padding: 50,
58
- // 增加内边距
59
56
  randomize: !1,
60
- animate: "end",
61
- //fit、none
62
- animationDuration: 1e3,
57
+ animate: !1,
58
+ // 关闭动画,避免额外开销
59
+ animationDuration: 500,
63
60
  // 辅助优化
64
61
  nodeDimensionsIncludeLabels: !0,
65
- // 让节点自动适应标签长度
66
62
  tile: !0,
67
63
  tilingPaddingVertical: 15,
68
64
  tilingPaddingHorizontal: 15,
69
65
  gravity: 0.6,
70
- // 稍强的向心力,避免过于分散
71
- // 其他保持默认
66
+ // 其他
72
67
  nestingFactor: 0.1,
73
68
  gravityRange: 3,
74
69
  gravityRangeCompound: 1.5,
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ declare const GraphDataTable: React.FC;
3
+ export default GraphDataTable;
@@ -1,3 +1,6 @@
1
1
  import { default as React } from 'react';
2
- declare const _default: React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;
2
+ interface NodeInfoDrawerProps {
3
+ cyRef: React.MutableRefObject<any>;
4
+ }
5
+ declare const _default: React.ForwardRefExoticComponent<NodeInfoDrawerProps & React.RefAttributes<unknown>>;
3
6
  export default _default;
@@ -9,7 +9,7 @@ export declare const coseBilkentLayout: () => {
9
9
  fit: boolean;
10
10
  padding: number;
11
11
  randomize: boolean;
12
- animate: string;
12
+ animate: boolean;
13
13
  animationDuration: number;
14
14
  nodeDimensionsIncludeLabels: boolean;
15
15
  tile: boolean;