react-kggraph 0.0.21 → 0.0.23

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 (29) hide show
  1. package/lib/index.es10.js +20 -19
  2. package/lib/index.es14.js +39 -41
  3. package/lib/index.es16.js +19 -18
  4. package/lib/index.es22.js +2 -2
  5. package/lib/index.es3.js +79 -78
  6. package/lib/index.es35.js +64 -4
  7. package/lib/index.es36.js +4 -2
  8. package/lib/index.es37.js +4 -0
  9. package/lib/index.es4.js +1 -1
  10. package/lib/index.es41.js +21 -0
  11. package/lib/index.es42.js +43 -0
  12. package/lib/index.es43.js +42 -0
  13. package/lib/index.es44.js +91 -0
  14. package/lib/index.es45.js +58 -0
  15. package/lib/index.es46.js +33 -0
  16. package/lib/index.es48.js +72 -0
  17. package/lib/index.es7.js +125 -125
  18. package/lib/src/components/Graph/components/KnowledgeCard/components/AudioSection.d.ts +12 -0
  19. package/lib/src/components/Graph/components/KnowledgeCard/components/DocumentSection.d.ts +12 -0
  20. package/lib/src/components/Graph/components/KnowledgeCard/components/ImageSection.d.ts +12 -0
  21. package/lib/src/components/Graph/components/KnowledgeCard/components/ListCard.d.ts +14 -0
  22. package/lib/src/components/Graph/components/KnowledgeCard/components/PropertySection.d.ts +11 -0
  23. package/lib/src/components/Graph/components/KnowledgeCard/components/RelationSection.d.ts +13 -0
  24. package/lib/src/components/Graph/components/KnowledgeCard/components/SourceCard.d.ts +6 -0
  25. package/lib/src/components/Graph/components/KnowledgeCard/components/VideoSection.d.ts +12 -0
  26. package/lib/src/components/Graph/components/KnowledgeCard/data.d.ts +84 -0
  27. package/lib/src/components/Graph/utils/edge_node_styles.d.ts +1 -0
  28. package/lib/style.css +1 -1
  29. package/package.json +1 -1
package/lib/index.es10.js CHANGED
@@ -1,8 +1,8 @@
1
- const g = {
1
+ const g = 60, s = {
2
2
  nodeLabelColor: "#000",
3
- nodeLabelFontSize: 18,
3
+ nodeLabelFontSize: 16,
4
4
  edgeLabelColor: "#666",
5
- edgeLabelFontSize: 18,
5
+ edgeLabelFontSize: 16,
6
6
  uriNodeColor: "#f7de63",
7
7
  // 节点类型为uri的节点颜色,默认节点颜色
8
8
  normalNodeColor: "#1890FF",
@@ -16,21 +16,21 @@ const g = {
16
16
  //路径高亮颜色
17
17
  pathNodeColor: "#145AFD"
18
18
  //路径节点颜色-不生效
19
- }, h = ({ elements: c, colors: n = {} }) => {
20
- const e = { ...g, ...n }, l = [], t = 80;
21
- c.map((o) => {
22
- var a, d, i;
23
- !l.includes((a = o == null ? void 0 : o.data) == null ? void 0 : a.type) && ((d = o == null ? void 0 : o.data) != null && d.type) && l.push((i = o.data) == null ? void 0 : i.type);
19
+ }, h = ({ elements: i, colors: c = {} }) => {
20
+ const e = { ...s, ...c }, r = [];
21
+ i.map((o) => {
22
+ var l, a, d;
23
+ !r.includes((l = o == null ? void 0 : o.data) == null ? void 0 : l.type) && ((a = o == null ? void 0 : o.data) != null && a.type) && r.push((d = o.data) == null ? void 0 : d.type);
24
24
  });
25
- const r = [];
26
- r.push({
25
+ const t = [];
26
+ t.push({
27
27
  selector: '[properties-type="uri"]',
28
28
  style: {
29
29
  "background-color": e.uriNodeColor,
30
30
  "background-image": "data(image)",
31
31
  "background-fit": "cover",
32
- width: t,
33
- height: t,
32
+ width: 60,
33
+ height: 60,
34
34
  label: "data(name)",
35
35
  color: e.nodeLabelColor,
36
36
  "text-valign": "bottom",
@@ -39,14 +39,14 @@ const g = {
39
39
  "text-wrap": "ellipsis",
40
40
  "text-overflow-wrap": "anywhere"
41
41
  }
42
- }), r.push({
42
+ }), t.push({
43
43
  selector: '[properties-type!="uri"]',
44
44
  style: {
45
45
  "background-color": e.normalNodeColor,
46
46
  "background-image": "data(image)",
47
47
  "background-fit": "cover",
48
- width: t,
49
- height: t,
48
+ width: 60,
49
+ height: 60,
50
50
  label: "data(name)",
51
51
  color: e.nodeLabelColor,
52
52
  "text-valign": "bottom",
@@ -56,7 +56,7 @@ const g = {
56
56
  "text-overflow-wrap": "anywhere"
57
57
  }
58
58
  });
59
- const s = [
59
+ const n = [
60
60
  {
61
61
  selector: "node",
62
62
  style: {
@@ -184,9 +184,10 @@ const g = {
184
184
  }
185
185
  }
186
186
  ];
187
- return r.concat(s);
187
+ return t.concat(n);
188
188
  };
189
189
  export {
190
- g as defaultColors,
191
- h as edgeNodeStyles
190
+ s as defaultColors,
191
+ h as edgeNodeStyles,
192
+ g as nodeSize
192
193
  };
package/lib/index.es14.js CHANGED
@@ -1,65 +1,63 @@
1
1
  import { jsx as e, jsxs as n } from "react/jsx-runtime";
2
- import { forwardRef as w, useState as C, useImperativeHandle as D } from "react";
3
- import { Select as a, Form as l, Drawer as F, Input as r } from "antd";
4
- const { Option: o } = a, z = w((S, g) => {
5
- const [v, d] = C(!1), [B, x] = C({ style: {}, data: {} }), [s] = l.useForm();
6
- return D(g, () => ({
7
- open: (t) => {
8
- var c, h, i, m, b, y, p, u, f, I;
9
- d(!0), x(t), s.setFieldsValue({
10
- name: (c = t.data) == null ? void 0 : c.name,
11
- type: t.type || "圆形",
12
- color: (h = t.style) == null ? void 0 : h.color,
13
- size: parseInt((i = t.style) == null ? void 0 : i.height) || 30,
14
- borderWidth: parseInt((m = t.style) == null ? void 0 : m.borderWidth) || 2,
15
- borderDash: ((b = t.style) == null ? void 0 : b.borderDash) === [5, 5] ? "是" : "否",
16
- borderColor: (y = t.style) == null ? void 0 : y.borderColor,
17
- textValign: ((p = t.style) == null ? void 0 : p.textValign) || "center",
18
- fontStyle: ((u = t.style) == null ? void 0 : u.fontStyle) || "normal",
19
- fontColor: ((f = t.style) == null ? void 0 : f["font-color"]) || "#000000",
20
- textBackgroundColor: ((I = t.style) == null ? void 0 : I.textBackgroundColor) || "transparent"
2
+ import { forwardRef as D, useState as C, useImperativeHandle as w } from "react";
3
+ import { Select as a, Form as r, Drawer as F, Input as o } from "antd";
4
+ const { Option: t } = a, z = D((S, g) => {
5
+ const [v, s] = C(!1), [V, x] = C({ style: {}, data: {} }), [d] = r.useForm();
6
+ return w(g, () => ({
7
+ open: (l) => {
8
+ var c, h, i, m, b, p, y, u, f, I;
9
+ s(!0), x(l), d.setFieldsValue({
10
+ name: (c = l.data) == null ? void 0 : c.name,
11
+ type: l.type || "圆形",
12
+ color: (h = l.style) == null ? void 0 : h.color,
13
+ size: parseInt((i = l.style) == null ? void 0 : i.height) || 30,
14
+ borderWidth: parseInt((m = l.style) == null ? void 0 : m.borderWidth) || 2,
15
+ borderDash: ((b = l.style) == null ? void 0 : b.borderDash) === [5, 5] ? "是" : "否",
16
+ borderColor: (p = l.style) == null ? void 0 : p.borderColor,
17
+ textValign: ((y = l.style) == null ? void 0 : y.textValign) || "center",
18
+ fontStyle: ((u = l.style) == null ? void 0 : u.fontStyle) || "normal",
19
+ fontColor: ((f = l.style) == null ? void 0 : f["font-color"]) || "#000000",
20
+ textBackgroundColor: ((I = l.style) == null ? void 0 : I.textBackgroundColor) || "transparent"
21
21
  });
22
22
  },
23
- close: () => d(!1)
23
+ close: () => s(!1)
24
24
  })), /* @__PURE__ */ e(
25
25
  F,
26
26
  {
27
27
  title: "节点配置",
28
28
  closable: { "aria-label": "Close Button" },
29
29
  onClose: () => {
30
- d(!1), s.resetFields();
30
+ s(!1), d.resetFields();
31
31
  },
32
32
  open: v,
33
33
  getContainer: !1,
34
34
  width: 360,
35
35
  children: /* @__PURE__ */ n(
36
- l,
36
+ r,
37
37
  {
38
- form: s,
38
+ form: d,
39
39
  layout: "vertical",
40
40
  disabled: !0,
41
41
  children: [
42
- /* @__PURE__ */ e(l.Item, { label: "名称", name: "name", children: /* @__PURE__ */ e(r, {}) }),
43
- /* @__PURE__ */ e(l.Item, { label: "类型", name: "type", children: /* @__PURE__ */ n(a, { children: [
44
- /* @__PURE__ */ e(o, { value: "圆形", children: "圆形" }),
45
- /* @__PURE__ */ e(o, { value: "矩形", children: "矩形" })
42
+ /* @__PURE__ */ e(r.Item, { label: "名称", name: "name", children: /* @__PURE__ */ e(o, {}) }),
43
+ /* @__PURE__ */ e(r.Item, { label: "类型", name: "type", children: /* @__PURE__ */ n(a, { children: [
44
+ /* @__PURE__ */ e(t, { value: "圆形", children: "圆形" }),
45
+ /* @__PURE__ */ e(t, { value: "矩形", children: "矩形" })
46
46
  ] }) }),
47
- /* @__PURE__ */ e(l.Item, { label: "颜色", name: "color", children: /* @__PURE__ */ e(r, { type: "color", style: { width: "100%", height: 32 } }) }),
48
- /* @__PURE__ */ e(l.Item, { label: "大小", name: "size", children: /* @__PURE__ */ e(r, { type: "number" }) }),
49
- /* @__PURE__ */ e(l.Item, { label: "边框宽度", name: "borderWidth", children: /* @__PURE__ */ e(r, { type: "number" }) }),
50
- /* @__PURE__ */ e(l.Item, { label: "边框虚线", name: "borderDash", children: /* @__PURE__ */ n(a, { children: [
51
- /* @__PURE__ */ e(o, { value: "", children: "" }),
52
- /* @__PURE__ */ e(o, { value: "是", children: "是" })
47
+ /* @__PURE__ */ e(r.Item, { label: "大小", name: "size", children: /* @__PURE__ */ e(o, { type: "number" }) }),
48
+ /* @__PURE__ */ e(r.Item, { label: "边框宽度", name: "borderWidth", children: /* @__PURE__ */ e(o, { type: "number" }) }),
49
+ /* @__PURE__ */ e(r.Item, { label: "边框虚线", name: "borderDash", children: /* @__PURE__ */ n(a, { children: [
50
+ /* @__PURE__ */ e(t, { value: "", children: "" }),
51
+ /* @__PURE__ */ e(t, { value: "", children: "" })
53
52
  ] }) }),
54
- /* @__PURE__ */ e(l.Item, { label: "边框颜色", name: "borderColor", children: /* @__PURE__ */ e(r, { type: "color", style: { width: "100%", height: 32 } }) }),
55
- /* @__PURE__ */ e(l.Item, { label: "字体位置", name: "textValign", children: /* @__PURE__ */ n(a, { children: [
56
- /* @__PURE__ */ e(o, { value: "center", children: "居中" }),
57
- /* @__PURE__ */ e(o, { value: "bottom", children: "底部" }),
58
- /* @__PURE__ */ e(o, { value: "top", children: "顶部" })
53
+ /* @__PURE__ */ e(r.Item, { label: "边框颜色", name: "borderColor", children: /* @__PURE__ */ e(o, { type: "color", style: { width: "100%", height: 32 } }) }),
54
+ /* @__PURE__ */ e(r.Item, { label: "字体位置", name: "textValign", children: /* @__PURE__ */ n(a, { children: [
55
+ /* @__PURE__ */ e(t, { value: "center", children: "居中" }),
56
+ /* @__PURE__ */ e(t, { value: "bottom", children: "底部" }),
57
+ /* @__PURE__ */ e(t, { value: "top", children: "顶部" })
59
58
  ] }) }),
60
- /* @__PURE__ */ e(l.Item, { label: "字体样式", name: "fontStyle", children: /* @__PURE__ */ e(r, {}) }),
61
- /* @__PURE__ */ e(l.Item, { label: "字体颜色", name: "fontColor", children: /* @__PURE__ */ e(r, { type: "color", style: { width: "100%", height: 32 } }) }),
62
- /* @__PURE__ */ e(l.Item, { label: "字体背色", name: "textBackgroundColor", children: /* @__PURE__ */ e(r, {}) })
59
+ /* @__PURE__ */ e(r.Item, { label: "字体样式", name: "fontStyle", children: /* @__PURE__ */ e(o, {}) }),
60
+ /* @__PURE__ */ e(r.Item, { label: "字体颜色", name: "fontColor", children: /* @__PURE__ */ e(o, { type: "color", style: { width: "100%", height: 32 } }) })
63
61
  ]
64
62
  }
65
63
  )
package/lib/index.es16.js CHANGED
@@ -1,24 +1,25 @@
1
- import { jsx as n } from "react/jsx-runtime";
2
- import { forwardRef as g, useContext as m, useState as o, useRef as w, useEffect as C, useImperativeHandle as h } from "react";
3
- import { Drawer as x } from "antd";
4
- import { GraphContext as y } from "./index.es15.js";
5
- const F = g((I, l) => {
6
- const { graphInfo: d, knowledgeCardApi: f } = m(y), [t, a] = o(!1), [k, r] = o(!1), [D, c] = o(!1), [v, p] = o({ style: {}, data: {} }), s = w(null);
7
- C(() => {
8
- t && s.current && (s.current.scrollTop = 0);
9
- }, [t]), h(l, () => ({
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import { forwardRef as w, useContext as C, useState as o, useRef as h, useEffect as I, useImperativeHandle as x } from "react";
3
+ import { Drawer as y } from "antd";
4
+ import { GraphContext as D } from "./index.es15.js";
5
+ import k from "./index.es35.js";
6
+ const G = w((v, d) => {
7
+ const { graphInfo: n, knowledgeCardApi: f } = C(D), [t, a] = o(!1), [c, l] = o(!1), [i, p] = o(!1), [R, u] = o({ style: {}, data: {} }), r = h(null);
8
+ I(() => {
9
+ t && r.current && (r.current.scrollTop = 0);
10
+ }, [t]), x(d, () => ({
10
11
  open: (e) => {
11
- a(!0), p(e), i(e);
12
+ a(!0), u(e), g(e);
12
13
  },
13
14
  close: () => a(!1)
14
15
  }));
15
- const i = async (e) => {
16
- r(!0);
17
- const u = await f({ kgId: d.kgId, uri: e.id });
18
- console.log(44, e), c(u.data), r(!1);
16
+ const g = async (e) => {
17
+ l(!0);
18
+ const m = await f({ kgId: n.kgId, uri: e.id });
19
+ console.log(44, e), p(m.data), l(!1);
19
20
  };
20
- return /* @__PURE__ */ n(
21
- x,
21
+ return /* @__PURE__ */ s(
22
+ y,
22
23
  {
23
24
  title: "知识卡片",
24
25
  onClose: () => {
@@ -28,10 +29,10 @@ const F = g((I, l) => {
28
29
  getContainer: !1,
29
30
  className: "knowledge-card-drawer",
30
31
  styles: { body: { padding: "0 20px", overflow: "auto" } },
31
- children: /* @__PURE__ */ n("div", { ref: s, style: { height: "100%" } })
32
+ children: /* @__PURE__ */ s("div", { ref: r, style: { height: "100%" }, children: /* @__PURE__ */ s(k, { detailData: i, drawerInfo: n, loading: c }) })
32
33
  }
33
34
  );
34
35
  });
35
36
  export {
36
- F as default
37
+ G as default
37
38
  };
package/lib/index.es22.js CHANGED
@@ -1,5 +1,5 @@
1
- import { getDefaultExportFromCjs as u } from "./index.es35.js";
2
- import { __module as i } from "./index.es36.js";
1
+ import { getDefaultExportFromCjs as u } from "./index.es36.js";
2
+ import { __module as i } from "./index.es37.js";
3
3
  /*!
4
4
  Copyright (c) 2018 Jed Watson.
5
5
  Licensed under the MIT License (MIT), see
package/lib/index.es3.js CHANGED
@@ -1,84 +1,85 @@
1
- import { jsx as c, jsxs as oe } from "react/jsx-runtime";
2
- import { useRef as N, useState as v, useEffect as D } from "react";
3
- import k from "cytoscape";
4
- import Ce from "cytoscape-cose-bilkent";
1
+ import { jsx as h, jsxs as oe } from "react/jsx-runtime";
2
+ import { useRef as N, useState as v, useEffect as O } from "react";
3
+ import C from "cytoscape";
4
+ import Ne from "cytoscape-cose-bilkent";
5
5
  import ke from "cytoscape-cise";
6
- import Ee from "cytoscape-fcose";
6
+ import Ce from "cytoscape-fcose";
7
7
  import ze from "storm-layout";
8
- import we from "./index.es7.js";
8
+ import Ee from "./index.es7.js";
9
9
  /* empty css */
10
- import { handleCalcPath as Le, resDetailData as F } from "./index.es8.js";
11
- import { fixNodesToEdges as Re, coseBilkentLayout as ne } from "./index.es9.js";
12
- import { edgeNodeStyles as je, defaultColors as se } from "./index.es10.js";
10
+ import { handleCalcPath as we, resDetailData as F } from "./index.es8.js";
11
+ import { fixNodesToEdges as Le, coseBilkentLayout as ne } from "./index.es9.js";
12
+ import { edgeNodeStyles as Re, defaultColors as se, nodeSize as je } from "./index.es10.js";
13
13
  import Te from "cytoscape-layout-utilities";
14
- import { Row as $e, Empty as Oe, message as C } from "antd";
15
- import { menuItemsConfig as Se } from "./index.es11.js";
14
+ import { message as k } from "antd";
15
+ import { menuItemsConfig as $e } from "./index.es11.js";
16
16
  import { jsonStringify as R } from "./index.es12.js";
17
17
  import De from "./index.es13.js";
18
- import Ie from "./index.es14.js";
19
- import { GraphProvider as Pe } from "./index.es15.js";
20
- import Be from "./index.es16.js";
21
- k.use(Te);
22
- k.use(ke);
23
- k.use(Ee);
24
- k.use(ze);
25
- k.use(Ce);
26
- const dt = ({
18
+ import Se from "./index.es14.js";
19
+ import { GraphProvider as Oe } from "./index.es15.js";
20
+ import Ie from "./index.es16.js";
21
+ C.use(Te);
22
+ C.use(ke);
23
+ C.use(Ce);
24
+ C.use(ze);
25
+ C.use(Ne);
26
+ const st = ({
27
27
  data: de,
28
28
  getAllGraphData: I,
29
- highPathAnalysis: E = [],
30
- graphInfo: h,
29
+ highPathAnalysis: z = [],
30
+ graphInfo: u,
31
31
  stepNextApi: re,
32
32
  knowledgeCardApi: ae,
33
- colors: z,
33
+ colors: E,
34
34
  actionBar: ie,
35
35
  actionCircle: le,
36
- noDataDesc: ce = "暂无数据"
36
+ noDataDesc: Pe = "暂无数据"
37
37
  }) => {
38
38
  var _, G, ee;
39
- const j = N(null), [u, P] = v([]), p = N(null), K = N(null), X = 1, [We, J] = v(!1), [w, B] = v({}), [T, W] = v({}), [pe, ue] = v("cose-bilkent"), Q = N(null), V = N(null), [ge, Y] = v(["", ""]), H = N(z);
40
- D(() => {
41
- H.current = z;
42
- }, [z]);
39
+ const j = N(null), [c, P] = v([]), p = N(null), K = N(null), X = 1, [Be, Z] = v(!1), [w, B] = v({}), [T, W] = v({}), [ce, pe] = v("cose-bilkent"), J = N(null), Q = N(null), [ue, V] = v(["", ""]), H = N(E);
40
+ O(() => {
41
+ H.current = E;
42
+ }, [E]);
43
43
  const [g, L] = v({
44
44
  visible: !1,
45
45
  x: 0,
46
46
  y: 0,
47
47
  targetNode: null,
48
48
  bgColor: ""
49
- }), [$, Z] = v({
49
+ }), [$, Y] = v({
50
50
  visible: !1,
51
51
  x: 0,
52
52
  y: 0,
53
53
  content: ""
54
- }), ye = Se({ cyRef: p, setContextMenu: L, onPathAnalysis: (_ = K.current) == null ? void 0 : _.onPathAnalysis, setPathNodes: Y, actionCircle: le });
55
- D(() => {
56
- (E == null ? void 0 : E.length) > 1 && Le(p, { pathNodes: E, isGrayed: !1 });
57
- }, [R(E), R(u)]), D(() => {
58
- I == null || I({ graphData: u, nodeStatic: w, relationStatic: T });
59
- }, [R(u), R(w), R(T)]), D(() => {
54
+ }), ge = $e({ cyRef: p, setContextMenu: L, onPathAnalysis: (_ = K.current) == null ? void 0 : _.onPathAnalysis, setPathNodes: V, actionCircle: le });
55
+ O(() => {
56
+ (z == null ? void 0 : z.length) > 1 && we(p, { pathNodes: z, isGrayed: !1 });
57
+ }, [R(z), R(c)]), O(() => {
58
+ I == null || I({ graphData: c, nodeStatic: w, relationStatic: T });
59
+ }, [R(c), R(w), R(T)]), O(() => {
60
60
  var r;
61
61
  if (!j.current || p.current) return;
62
- const { elements: s, typeListObj: a, relationListObj: y } = F(de, { typeObj: w, graphInfo: h });
62
+ const { elements: s, typeListObj: a, relationListObj: y } = F(de, { typeObj: w, graphInfo: u });
63
63
  B(a), P(s), W(y), document.addEventListener("contextmenu", function(t) {
64
64
  t.preventDefault();
65
65
  });
66
- const e = k({
66
+ const e = C({
67
67
  container: j.current,
68
68
  elements: s,
69
- style: je({ elements: s, colors: z }),
69
+ style: Re({ elements: s, colors: E }),
70
70
  autounselectify: !1,
71
71
  autolock: !1,
72
+ maxZoom: 1,
72
73
  layout: {
73
74
  name: "preset"
74
75
  // 使用预设布局,完全依赖 position
75
76
  }
76
77
  });
77
- if (p.current = e, ((r = h == null ? void 0 : h.searchNodes) == null ? void 0 : r.length) === 2)
78
- Re(
78
+ if (p.current = e, ((r = u == null ? void 0 : u.searchNodes) == null ? void 0 : r.length) === 2)
79
+ Le(
79
80
  e,
80
- h.searchNodes[0],
81
- h.searchNodes[1]
81
+ u.searchNodes[0],
82
+ u.searchNodes[1]
82
83
  );
83
84
  else {
84
85
  const t = e.layout(ne());
@@ -113,14 +114,14 @@ const dt = ({
113
114
  o.hasClass("selected") || o.addClass("hover");
114
115
  }), e.on("mouseover", "node", (t) => {
115
116
  const o = t.target, n = o.renderedPosition(), d = o.data("name") || "";
116
- o.addClass("hover"), Z({
117
+ o.addClass("hover"), Y({
117
118
  visible: !0,
118
119
  x: n.x,
119
120
  y: n.y - 60,
120
121
  content: d
121
122
  });
122
123
  }), e.on("mouseout", "node", (t) => {
123
- t.target.removeClass("hover"), Z((n) => ({ ...n, visible: !1 }));
124
+ t.target.removeClass("hover"), Y((n) => ({ ...n, visible: !1 }));
124
125
  }), e.on("cxttap", "node", (t) => {
125
126
  t.preventDefault(), t.stopPropagation(), t.stopImmediatePropagation(), t.originalEvent && (t.originalEvent.preventDefault(), t.originalEvent.stopPropagation(), t.originalEvent.stopImmediatePropagation());
126
127
  const o = t.target, n = o.renderedPosition();
@@ -142,7 +143,7 @@ const dt = ({
142
143
  p.current && (p.current.destroy(), p.current = null);
143
144
  };
144
145
  }, []);
145
- const fe = async (s) => {
146
+ const ye = async (s) => {
146
147
  const { id: a, kgId: y } = s, e = p.current;
147
148
  if (!e) return;
148
149
  const r = e.$(`#${a}`);
@@ -154,7 +155,7 @@ const dt = ({
154
155
  if (t.length > 0) {
155
156
  const n = t.map((l) => l.id()), d = t.connectedEdges(), x = e.edges().filter(
156
157
  (l) => l.data("source") === a && n.includes(l.data("target"))
157
- ), O = e.edges().filter((l) => l.data("appendedBy") === a), M = d.merge(x).merge(O).filter((l) => l.data().zktype === s.zktype);
158
+ ), D = e.edges().filter((l) => l.data("appendedBy") === a), M = d.merge(x).merge(D).filter((l) => l.data().zktype === s.zktype);
158
159
  t.animate({
159
160
  style: { opacity: 0 }
160
161
  }, {
@@ -167,11 +168,11 @@ const dt = ({
167
168
  if (m.group === "nodes" && n.includes((b = m.data) == null ? void 0 : b.id) && i && i === s.zktype)
168
169
  return !1;
169
170
  if (m.group === "edges" && i && i === s.zktype) {
170
- const ve = Array.from(O).map((Ne) => {
171
- const A = Ne.data();
171
+ const he = Array.from(D).map((xe) => {
172
+ const A = xe.data();
172
173
  return `${A.source}-${A.target}-${A.label}`;
173
- }), q = m.data, be = ve.includes(`${q.source}-${q.target}-${q.label}`), xe = ((te = m.data) == null ? void 0 : te.appendedBy) === a;
174
- return !be && !xe;
174
+ }), q = m.data, ve = he.includes(`${q.source}-${q.target}-${q.label}`), be = ((te = m.data) == null ? void 0 : te.appendedBy) === a;
175
+ return !ve && !be;
175
176
  }
176
177
  return !0;
177
178
  }), { typeListObj: f, relationListObj: U } = F({}, { graphData: S, typeObj: {} });
@@ -183,15 +184,15 @@ const dt = ({
183
184
  }, 300);
184
185
  } else {
185
186
  try {
186
- J(!0), C.open({
187
+ Z(!0), k.open({
187
188
  type: "loading",
188
189
  content: "正在展开...",
189
190
  duration: 0
190
191
  });
191
- const n = await re({ uri: a, queryType: 1, kgId: y, zktype: s.zktype }), { elements: d, typeListObj: x, relationListObj: O } = F(n.data, { graphData: u, typeObj: w, relationObj: T, zktype: s.zktype });
192
- if (B(x), W(O), !((d == null ? void 0 : d.length) > 0)) {
192
+ const n = await re({ uri: a, queryType: 1, kgId: y, zktype: s.zktype }), { elements: d, typeListObj: x, relationListObj: D } = F(n.data, { graphData: c, typeObj: w, relationObj: T, zktype: s.zktype });
193
+ if (B(x), W(D), !((d == null ? void 0 : d.length) > 0)) {
193
194
  setTimeout(() => {
194
- C.destroy(), C.warning("暂无数据");
195
+ k.destroy(), k.warning("暂无数据");
195
196
  }, 2e3);
196
197
  return;
197
198
  }
@@ -204,7 +205,7 @@ const dt = ({
204
205
  // 随机偏移,避免完全重叠
205
206
  }), l = d.map((i) => {
206
207
  if (i.group === "nodes") {
207
- const b = 80 * X;
208
+ const b = je * X;
208
209
  return {
209
210
  ...i,
210
211
  style: {
@@ -236,7 +237,7 @@ const dt = ({
236
237
  }
237
238
  };
238
239
  }), S = e.add(l);
239
- P([...u, ...l]);
240
+ P([...c, ...l]);
240
241
  const f = S.filter(":node"), U = f.map((i) => i.id());
241
242
  r.data("appendedNodes", U), r.data("isExpanded", !0);
242
243
  const m = e.nodes().difference(f);
@@ -274,24 +275,24 @@ const dt = ({
274
275
  }, 600);
275
276
  } else
276
277
  console.log("没有找到相关节点数据");
277
- C.destroy();
278
+ k.destroy();
278
279
  } catch (n) {
279
- C.destroy(), C.error("请求接口失败"), console.error("22请求接口失败:", n);
280
+ k.destroy(), k.error("请求接口失败"), console.error("22请求接口失败:", n);
280
281
  }
281
- J(!1);
282
+ Z(!1);
282
283
  }
283
284
  L({ visible: !1 });
284
- }, me = {
285
+ }, fe = {
285
286
  expanded: "typed-literal",
286
287
  contract: "uri"
287
- }, he = (s, a) => {
288
+ }, me = (s, a) => {
288
289
  var e;
289
290
  console.log("handleMenuAction:::", s, a);
290
291
  const y = a || g.targetNode;
291
292
  if (y) {
292
293
  const r = s.ids, t = y.data();
293
294
  if (["expanded", "contract"].includes(r))
294
- fe({ kgId: 3, ...t, zktype: me[r] });
295
+ ye({ kgId: u.kgId, ...t, zktype: fe[r] });
295
296
  else if (r === "nodeInfo") {
296
297
  const o = y, n = {
297
298
  id: o.id(),
@@ -303,30 +304,30 @@ const dt = ({
303
304
  classes: o.classes(),
304
305
  style: o.style()
305
306
  };
306
- Q.current.open(n);
307
- } else r === "knowledgeCard" && V.current.open(y.data());
307
+ J.current.open(n);
308
+ } else r === "knowledgeCard" && Q.current.open(y.data());
308
309
  (e = s.onClick) == null || e.call(s, y), L({ visible: !1, x: 0, y: 0, targetNode: null });
309
310
  }
310
311
  };
311
- return ((G = u == null ? void 0 : u.nodes) == null ? void 0 : G.length) > 0 ? /* @__PURE__ */ c(Pe, { value: { pathNodes: ge, setPathNodes: Y, graphInfo: h, graphData: u, layoutType: pe, setLayoutType: ue, knowledgeCardApi: ae }, children: /* @__PURE__ */ oe("div", { className: "cytoscape-container relative", children: [
312
- /* @__PURE__ */ c("div", { className: "btn-group" }),
313
- /* @__PURE__ */ c(
314
- we,
312
+ return console.log(111, !(((G = c == null ? void 0 : c.nodes) == null ? void 0 : G.length) > 0), c), /* @__PURE__ */ h(Oe, { value: { pathNodes: ue, setPathNodes: V, graphInfo: u, graphData: c, layoutType: ce, setLayoutType: pe, knowledgeCardApi: ae }, children: /* @__PURE__ */ oe("div", { className: "cytoscape-container relative", children: [
313
+ /* @__PURE__ */ h("div", { className: "btn-group" }),
314
+ /* @__PURE__ */ h(
315
+ Ee,
315
316
  {
316
317
  ref: K,
317
318
  cyRef: p,
318
- graphInfo: h,
319
+ graphInfo: u,
319
320
  initNodeScale: X,
320
321
  cyContainerRef: j,
321
322
  typeObj: w,
322
323
  relationObj: T,
323
- colors: z,
324
+ colors: E,
324
325
  actionBar: ie
325
326
  }
326
327
  ),
327
328
  /* @__PURE__ */ oe("div", { className: "relative h-100", children: [
328
- /* @__PURE__ */ c("div", { ref: j, className: "cy-container" }),
329
- g.visible && g.targetNode && /* @__PURE__ */ c(
329
+ /* @__PURE__ */ h("div", { ref: j, className: "cy-container" }),
330
+ g.visible && g.targetNode && /* @__PURE__ */ h(
330
331
  "div",
331
332
  {
332
333
  style: {
@@ -346,10 +347,10 @@ const dt = ({
346
347
  overflow: "hidden"
347
348
  },
348
349
  onClick: (s) => s.stopPropagation(),
349
- children: /* @__PURE__ */ c(De, { items: ye, centerImage: (ee = g == null ? void 0 : g.targetNode) == null ? void 0 : ee.data().image, targetNode: g.targetNode, onClick: (s, a) => he(s, a) })
350
+ children: /* @__PURE__ */ h(De, { items: ge, centerImage: (ee = g == null ? void 0 : g.targetNode) == null ? void 0 : ee.data().image, targetNode: g.targetNode, onClick: (s, a) => me(s, a) })
350
351
  }
351
352
  ),
352
- $.visible && /* @__PURE__ */ c(
353
+ $.visible && /* @__PURE__ */ h(
353
354
  "div",
354
355
  {
355
356
  style: {
@@ -373,10 +374,10 @@ const dt = ({
373
374
  }
374
375
  )
375
376
  ] }),
376
- /* @__PURE__ */ c(Ie, { ref: Q }),
377
- /* @__PURE__ */ c(Be, { ref: V })
378
- ] }) }) : /* @__PURE__ */ c($e, { className: "h-100", align: "middle", justify: "center", children: /* @__PURE__ */ c(Oe, { description: ce }) });
377
+ /* @__PURE__ */ h(Se, { ref: J }),
378
+ /* @__PURE__ */ h(Ie, { ref: Q })
379
+ ] }) });
379
380
  };
380
381
  export {
381
- dt as default
382
+ st as default
382
383
  };
package/lib/index.es35.js CHANGED
@@ -1,6 +1,66 @@
1
- function e(t) {
2
- return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
3
- }
1
+ import { jsxs as c, jsx as e, Fragment as o } from "react/jsx-runtime";
2
+ import h from "./index.es41.js";
3
+ import u from "./index.es42.js";
4
+ import g from "./index.es43.js";
5
+ import w from "./index.es44.js";
6
+ import f from "./index.es45.js";
7
+ import N from "./index.es46.js";
8
+ import { Row as k, Col as p, Empty as y } from "antd";
9
+ /* empty css */
10
+ const i = (r) => {
11
+ const n = document.getElementById(r);
12
+ if (n) {
13
+ const d = n.closest(".knowledge-card-content");
14
+ d && d.scrollTo({
15
+ top: n.offsetTop - 20,
16
+ behavior: "smooth"
17
+ });
18
+ }
19
+ }, R = ({ detailData: r = {}, drawerInfo: n = {}, loading: d }) => {
20
+ var t, l, s, a, m;
21
+ return /* @__PURE__ */ c(k, { className: "knowledge-card-click", wrap: !1, children: [
22
+ /* @__PURE__ */ c(p, { flex: "80px", className: "card-item-click", children: [
23
+ /* @__PURE__ */ e("p", { className: "drawer-card-title2", onClick: () => i("section-property"), children: "知识详情" }),
24
+ /* @__PURE__ */ e("p", { className: "drawer-card-title2", onClick: () => i("section-document"), children: "关联文档" }),
25
+ /* @__PURE__ */ e("p", { className: "drawer-card-title2", onClick: () => i("section-image"), children: "关联图片" }),
26
+ /* @__PURE__ */ e("p", { className: "drawer-card-title2", onClick: () => i("section-video"), children: "关联视频" }),
27
+ /* @__PURE__ */ e("p", { className: "drawer-card-title2", onClick: () => i("section-audio"), children: "关联音频" }),
28
+ /* @__PURE__ */ e("p", { className: "drawer-card-title2", onClick: () => i("section-relation"), children: "关联知识" })
29
+ ] }),
30
+ /* @__PURE__ */ c(p, { flex: "auto", className: "knowledge-card-content", children: [
31
+ r.property ? /* @__PURE__ */ c(o, { children: [
32
+ /* @__PURE__ */ e("p", { className: "drawer-card-title", id: "section-property", children: "知识详情" }),
33
+ /* @__PURE__ */ e(
34
+ h,
35
+ {
36
+ properties: r.property || [],
37
+ excludedKeys: ["id"]
38
+ }
39
+ )
40
+ ] }) : !d && /* @__PURE__ */ e(y, {}),
41
+ ((t = r.document) == null ? void 0 : t.length) > 0 && /* @__PURE__ */ c(o, { children: [
42
+ /* @__PURE__ */ e("p", { className: "drawer-card-title", id: "section-document", children: "关联文档" }),
43
+ /* @__PURE__ */ e(u, { documents: r.document, source: "qa-card" })
44
+ ] }),
45
+ ((l = r.image) == null ? void 0 : l.length) > 0 && /* @__PURE__ */ c(o, { children: [
46
+ /* @__PURE__ */ e("p", { className: "drawer-card-title", id: "section-image", children: "关联图片" }),
47
+ /* @__PURE__ */ e(g, { images: r.image, source: "qa-card" })
48
+ ] }),
49
+ ((s = r.video) == null ? void 0 : s.length) > 0 && /* @__PURE__ */ c(o, { children: [
50
+ /* @__PURE__ */ e("p", { className: "drawer-card-title", id: "section-video", children: "关联视频" }),
51
+ /* @__PURE__ */ e(w, { videos: r.video, source: "qa-card" })
52
+ ] }),
53
+ ((a = r.audio) == null ? void 0 : a.length) > 0 && /* @__PURE__ */ c(o, { children: [
54
+ /* @__PURE__ */ e("p", { className: "drawer-card-title", id: "section-audio", children: "关联音频" }),
55
+ /* @__PURE__ */ e(f, { audios: r.audio, source: "qa-card" })
56
+ ] }),
57
+ ((m = r.relation) == null ? void 0 : m.length) > 0 && /* @__PURE__ */ c(o, { children: [
58
+ /* @__PURE__ */ e("p", { className: "drawer-card-title", id: "section-relation", children: "关联知识" }),
59
+ /* @__PURE__ */ e(N, { relations: r.relation, kgIds: n.kgId, source: "qa-card" })
60
+ ] })
61
+ ] })
62
+ ] });
63
+ };
4
64
  export {
5
- e as getDefaultExportFromCjs
65
+ R as default
6
66
  };