react-kggraph 0.0.22 → 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.
- package/lib/index.es10.js +20 -19
- package/lib/index.es14.js +39 -41
- package/lib/index.es16.js +19 -18
- package/lib/index.es22.js +2 -2
- package/lib/index.es3.js +80 -79
- package/lib/index.es35.js +64 -4
- package/lib/index.es36.js +4 -2
- package/lib/index.es37.js +4 -0
- package/lib/index.es4.js +1 -1
- package/lib/index.es41.js +21 -0
- package/lib/index.es42.js +43 -0
- package/lib/index.es43.js +42 -0
- package/lib/index.es44.js +91 -0
- package/lib/index.es45.js +58 -0
- package/lib/index.es46.js +33 -0
- package/lib/index.es48.js +72 -0
- package/lib/index.es7.js +125 -125
- package/lib/src/components/Graph/components/KnowledgeCard/components/AudioSection.d.ts +12 -0
- package/lib/src/components/Graph/components/KnowledgeCard/components/DocumentSection.d.ts +12 -0
- package/lib/src/components/Graph/components/KnowledgeCard/components/ImageSection.d.ts +12 -0
- package/lib/src/components/Graph/components/KnowledgeCard/components/ListCard.d.ts +14 -0
- package/lib/src/components/Graph/components/KnowledgeCard/components/PropertySection.d.ts +11 -0
- package/lib/src/components/Graph/components/KnowledgeCard/components/RelationSection.d.ts +13 -0
- package/lib/src/components/Graph/components/KnowledgeCard/components/SourceCard.d.ts +6 -0
- package/lib/src/components/Graph/components/KnowledgeCard/components/VideoSection.d.ts +12 -0
- package/lib/src/components/Graph/components/KnowledgeCard/data.d.ts +84 -0
- package/lib/src/components/Graph/utils/edge_node_styles.d.ts +1 -0
- package/lib/style.css +1 -1
- 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:
|
|
3
|
+
nodeLabelFontSize: 16,
|
|
4
4
|
edgeLabelColor: "#666",
|
|
5
|
-
edgeLabelFontSize:
|
|
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:
|
|
20
|
-
const e = { ...
|
|
21
|
-
|
|
22
|
-
var a, d
|
|
23
|
-
!
|
|
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
|
|
26
|
-
|
|
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:
|
|
33
|
-
height:
|
|
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
|
-
}),
|
|
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:
|
|
49
|
-
height:
|
|
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
|
|
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
|
|
187
|
+
return t.concat(n);
|
|
188
188
|
};
|
|
189
189
|
export {
|
|
190
|
-
|
|
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
|
|
3
|
-
import { Select as a, Form as
|
|
4
|
-
const { Option:
|
|
5
|
-
const [v,
|
|
6
|
-
return
|
|
7
|
-
open: (
|
|
8
|
-
var c, h, i, m, b,
|
|
9
|
-
|
|
10
|
-
name: (c =
|
|
11
|
-
type:
|
|
12
|
-
color: (h =
|
|
13
|
-
size: parseInt((i =
|
|
14
|
-
borderWidth: parseInt((m =
|
|
15
|
-
borderDash: ((b =
|
|
16
|
-
borderColor: (
|
|
17
|
-
textValign: ((
|
|
18
|
-
fontStyle: ((u =
|
|
19
|
-
fontColor: ((f =
|
|
20
|
-
textBackgroundColor: ((I =
|
|
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: () =>
|
|
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
|
-
|
|
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
|
-
|
|
36
|
+
r,
|
|
37
37
|
{
|
|
38
|
-
form:
|
|
38
|
+
form: d,
|
|
39
39
|
layout: "vertical",
|
|
40
40
|
disabled: !0,
|
|
41
41
|
children: [
|
|
42
|
-
/* @__PURE__ */ e(
|
|
43
|
-
/* @__PURE__ */ e(
|
|
44
|
-
/* @__PURE__ */ e(
|
|
45
|
-
/* @__PURE__ */ e(
|
|
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(
|
|
48
|
-
/* @__PURE__ */ e(
|
|
49
|
-
/* @__PURE__ */ e(
|
|
50
|
-
|
|
51
|
-
/* @__PURE__ */ e(
|
|
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(
|
|
55
|
-
/* @__PURE__ */ e(
|
|
56
|
-
/* @__PURE__ */ e(
|
|
57
|
-
/* @__PURE__ */ e(
|
|
58
|
-
/* @__PURE__ */ e(
|
|
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(
|
|
61
|
-
/* @__PURE__ */ e(
|
|
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
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { Drawer as
|
|
4
|
-
import { GraphContext as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
C(()
|
|
8
|
-
|
|
9
|
-
|
|
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),
|
|
12
|
+
a(!0), u(e), g(e);
|
|
12
13
|
},
|
|
13
14
|
close: () => a(!1)
|
|
14
15
|
}));
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
console.log(44, e),
|
|
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__ */
|
|
21
|
-
|
|
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__ */
|
|
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
|
-
|
|
37
|
+
G as default
|
|
37
38
|
};
|
package/lib/index.es22.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getDefaultExportFromCjs as u } from "./index.
|
|
2
|
-
import { __module as i } from "./index.
|
|
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
|
|
2
|
-
import { useRef as N, useState as v, useEffect as
|
|
3
|
-
import
|
|
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
4
|
import Ne from "cytoscape-cose-bilkent";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import ke from "cytoscape-cise";
|
|
6
|
+
import Ce from "cytoscape-fcose";
|
|
7
7
|
import ze from "storm-layout";
|
|
8
8
|
import Ee from "./index.es7.js";
|
|
9
9
|
/* empty css */
|
|
10
10
|
import { handleCalcPath as we, resDetailData as F } from "./index.es8.js";
|
|
11
11
|
import { fixNodesToEdges as Le, coseBilkentLayout as ne } from "./index.es9.js";
|
|
12
|
-
import { edgeNodeStyles as Re, defaultColors as se } from "./index.es10.js";
|
|
13
|
-
import
|
|
14
|
-
import { message as
|
|
15
|
-
import { menuItemsConfig as
|
|
12
|
+
import { edgeNodeStyles as Re, defaultColors as se, nodeSize as je } from "./index.es10.js";
|
|
13
|
+
import Te from "cytoscape-layout-utilities";
|
|
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
|
-
import
|
|
18
|
-
import
|
|
17
|
+
import De from "./index.es13.js";
|
|
18
|
+
import Se from "./index.es14.js";
|
|
19
19
|
import { GraphProvider as Oe } from "./index.es15.js";
|
|
20
|
-
import
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const
|
|
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
29
|
highPathAnalysis: z = [],
|
|
30
|
-
graphInfo:
|
|
30
|
+
graphInfo: u,
|
|
31
31
|
stepNextApi: re,
|
|
32
32
|
knowledgeCardApi: ae,
|
|
33
33
|
colors: E,
|
|
34
34
|
actionBar: ie,
|
|
35
35
|
actionCircle: le,
|
|
36
|
-
noDataDesc:
|
|
36
|
+
noDataDesc: Pe = "暂无数据"
|
|
37
37
|
}) => {
|
|
38
38
|
var _, G, ee;
|
|
39
|
-
const j = N(null), [c, P] = v([]), p = N(null), K = N(null), X = 1, [
|
|
40
|
-
|
|
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
41
|
H.current = E;
|
|
42
42
|
}, [E]);
|
|
43
|
-
const [
|
|
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
|
-
}), [$,
|
|
49
|
+
}), [$, Y] = v({
|
|
50
50
|
visible: !1,
|
|
51
51
|
x: 0,
|
|
52
52
|
y: 0,
|
|
53
53
|
content: ""
|
|
54
|
-
}), ge =
|
|
55
|
-
|
|
54
|
+
}), ge = $e({ cyRef: p, setContextMenu: L, onPathAnalysis: (_ = K.current) == null ? void 0 : _.onPathAnalysis, setPathNodes: V, actionCircle: le });
|
|
55
|
+
O(() => {
|
|
56
56
|
(z == null ? void 0 : z.length) > 1 && we(p, { pathNodes: z, isGrayed: !1 });
|
|
57
|
-
}, [R(z), R(c)]),
|
|
57
|
+
}, [R(z), R(c)]), O(() => {
|
|
58
58
|
I == null || I({ graphData: c, nodeStatic: w, relationStatic: T });
|
|
59
|
-
}, [R(c), R(w), R(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:
|
|
63
|
-
B(a), P(s), W(
|
|
62
|
+
const { elements: s, typeListObj: a, relationListObj: y } = F(de, { typeObj: w, graphInfo: u });
|
|
63
|
+
B(a), P(s), W(y), document.addEventListener("contextmenu", function(t) {
|
|
64
64
|
t.preventDefault();
|
|
65
65
|
});
|
|
66
|
-
const e =
|
|
66
|
+
const e = C({
|
|
67
67
|
container: j.current,
|
|
68
68
|
elements: s,
|
|
69
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 =
|
|
78
|
+
if (p.current = e, ((r = u == null ? void 0 : u.searchNodes) == null ? void 0 : r.length) === 2)
|
|
78
79
|
Le(
|
|
79
80
|
e,
|
|
80
|
-
|
|
81
|
-
|
|
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 nt = ({
|
|
|
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"),
|
|
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"),
|
|
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();
|
|
@@ -143,7 +144,7 @@ const nt = ({
|
|
|
143
144
|
};
|
|
144
145
|
}, []);
|
|
145
146
|
const ye = async (s) => {
|
|
146
|
-
const { id: a, kgId:
|
|
147
|
+
const { id: a, kgId: y } = s, e = p.current;
|
|
147
148
|
if (!e) return;
|
|
148
149
|
const r = e.$(`#${a}`);
|
|
149
150
|
if (!r || r.length === 0) {
|
|
@@ -161,21 +162,21 @@ const nt = ({
|
|
|
161
162
|
duration: 200,
|
|
162
163
|
complete: () => {
|
|
163
164
|
e.remove(t), e.remove(M), P((l) => {
|
|
164
|
-
const
|
|
165
|
+
const S = l.filter((m) => {
|
|
165
166
|
var b, te;
|
|
166
|
-
const i =
|
|
167
|
-
if (
|
|
167
|
+
const i = m.data.zktype;
|
|
168
|
+
if (m.group === "nodes" && n.includes((b = m.data) == null ? void 0 : b.id) && i && i === s.zktype)
|
|
168
169
|
return !1;
|
|
169
|
-
if (
|
|
170
|
+
if (m.group === "edges" && i && i === s.zktype) {
|
|
170
171
|
const he = Array.from(D).map((xe) => {
|
|
171
172
|
const A = xe.data();
|
|
172
173
|
return `${A.source}-${A.target}-${A.label}`;
|
|
173
|
-
}), q =
|
|
174
|
+
}), q = m.data, ve = he.includes(`${q.source}-${q.target}-${q.label}`), be = ((te = m.data) == null ? void 0 : te.appendedBy) === a;
|
|
174
175
|
return !ve && !be;
|
|
175
176
|
}
|
|
176
177
|
return !0;
|
|
177
|
-
}), { typeListObj:
|
|
178
|
-
return B(
|
|
178
|
+
}), { typeListObj: f, relationListObj: U } = F({}, { graphData: S, typeObj: {} });
|
|
179
|
+
return B(f), W(U), S;
|
|
179
180
|
}), r.data("appendedNodes", []), r.data("isExpanded", !1);
|
|
180
181
|
}
|
|
181
182
|
}), setTimeout(() => {
|
|
@@ -183,15 +184,15 @@ const nt = ({
|
|
|
183
184
|
}, 300);
|
|
184
185
|
} else {
|
|
185
186
|
try {
|
|
186
|
-
|
|
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:
|
|
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 });
|
|
192
193
|
if (B(x), W(D), !((d == null ? void 0 : d.length) > 0)) {
|
|
193
194
|
setTimeout(() => {
|
|
194
|
-
|
|
195
|
+
k.destroy(), k.warning("暂无数据");
|
|
195
196
|
}, 2e3);
|
|
196
197
|
return;
|
|
197
198
|
}
|
|
@@ -204,7 +205,7 @@ const nt = ({
|
|
|
204
205
|
// 随机偏移,避免完全重叠
|
|
205
206
|
}), l = d.map((i) => {
|
|
206
207
|
if (i.group === "nodes") {
|
|
207
|
-
const b =
|
|
208
|
+
const b = je * X;
|
|
208
209
|
return {
|
|
209
210
|
...i,
|
|
210
211
|
style: {
|
|
@@ -235,12 +236,12 @@ const nt = ({
|
|
|
235
236
|
zktype: s.zktype
|
|
236
237
|
}
|
|
237
238
|
};
|
|
238
|
-
}),
|
|
239
|
+
}), S = e.add(l);
|
|
239
240
|
P([...c, ...l]);
|
|
240
|
-
const
|
|
241
|
+
const f = S.filter(":node"), U = f.map((i) => i.id());
|
|
241
242
|
r.data("appendedNodes", U), r.data("isExpanded", !0);
|
|
242
|
-
const
|
|
243
|
-
|
|
243
|
+
const m = e.nodes().difference(f);
|
|
244
|
+
m.forEach((i) => i.lock()), M.placeNewNodes(f), e.layout({
|
|
244
245
|
name: "cose-bilkent",
|
|
245
246
|
randomize: !1,
|
|
246
247
|
// ⚠️ 这是关键!保持已有节点位置不变
|
|
@@ -256,8 +257,8 @@ const nt = ({
|
|
|
256
257
|
// 可以适当减少,因为只需要微调
|
|
257
258
|
gravity: 0.6
|
|
258
259
|
}).run(), setTimeout(() => {
|
|
259
|
-
|
|
260
|
-
}, 2e3),
|
|
260
|
+
m.forEach((i) => i.unlock());
|
|
261
|
+
}, 2e3), f.animate({
|
|
261
262
|
style: {
|
|
262
263
|
opacity: 1,
|
|
263
264
|
width: 20,
|
|
@@ -267,18 +268,18 @@ const nt = ({
|
|
|
267
268
|
duration: 400,
|
|
268
269
|
easing: "ease-out",
|
|
269
270
|
complete: () => {
|
|
270
|
-
|
|
271
|
+
f.style("opacity", ""), f.style("width", ""), f.style("height", "");
|
|
271
272
|
}
|
|
272
273
|
}), setTimeout(() => {
|
|
273
274
|
r.removed() || (r.style("border-width", ""), r.style("border-color", ""), e.center(r), e.zoom(e.zoom()));
|
|
274
275
|
}, 600);
|
|
275
276
|
} else
|
|
276
277
|
console.log("没有找到相关节点数据");
|
|
277
|
-
|
|
278
|
+
k.destroy();
|
|
278
279
|
} catch (n) {
|
|
279
|
-
|
|
280
|
+
k.destroy(), k.error("请求接口失败"), console.error("22请求接口失败:", n);
|
|
280
281
|
}
|
|
281
|
-
|
|
282
|
+
Z(!1);
|
|
282
283
|
}
|
|
283
284
|
L({ visible: !1 });
|
|
284
285
|
}, fe = {
|
|
@@ -287,13 +288,13 @@ const nt = ({
|
|
|
287
288
|
}, me = (s, a) => {
|
|
288
289
|
var e;
|
|
289
290
|
console.log("handleMenuAction:::", s, a);
|
|
290
|
-
const
|
|
291
|
-
if (
|
|
292
|
-
const r = s.ids, t =
|
|
291
|
+
const y = a || g.targetNode;
|
|
292
|
+
if (y) {
|
|
293
|
+
const r = s.ids, t = y.data();
|
|
293
294
|
if (["expanded", "contract"].includes(r))
|
|
294
|
-
ye({ kgId:
|
|
295
|
+
ye({ kgId: u.kgId, ...t, zktype: fe[r] });
|
|
295
296
|
else if (r === "nodeInfo") {
|
|
296
|
-
const o =
|
|
297
|
+
const o = y, n = {
|
|
297
298
|
id: o.id(),
|
|
298
299
|
data: o.data(),
|
|
299
300
|
position: o.position(),
|
|
@@ -303,19 +304,19 @@ const nt = ({
|
|
|
303
304
|
classes: o.classes(),
|
|
304
305
|
style: o.style()
|
|
305
306
|
};
|
|
306
|
-
|
|
307
|
-
} else r === "knowledgeCard" &&
|
|
308
|
-
(e = s.onClick) == null || e.call(s,
|
|
307
|
+
J.current.open(n);
|
|
308
|
+
} else r === "knowledgeCard" && Q.current.open(y.data());
|
|
309
|
+
(e = s.onClick) == null || e.call(s, y), L({ visible: !1, x: 0, y: 0, targetNode: null });
|
|
309
310
|
}
|
|
310
311
|
};
|
|
311
|
-
return console.log(111, !(((G = c == null ? void 0 : c.nodes) == null ? void 0 : G.length) > 0), c), /* @__PURE__ */
|
|
312
|
-
/* @__PURE__ */
|
|
313
|
-
/* @__PURE__ */
|
|
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(
|
|
314
315
|
Ee,
|
|
315
316
|
{
|
|
316
317
|
ref: K,
|
|
317
318
|
cyRef: p,
|
|
318
|
-
graphInfo:
|
|
319
|
+
graphInfo: u,
|
|
319
320
|
initNodeScale: X,
|
|
320
321
|
cyContainerRef: j,
|
|
321
322
|
typeObj: w,
|
|
@@ -325,14 +326,14 @@ const nt = ({
|
|
|
325
326
|
}
|
|
326
327
|
),
|
|
327
328
|
/* @__PURE__ */ oe("div", { className: "relative h-100", children: [
|
|
328
|
-
/* @__PURE__ */
|
|
329
|
-
|
|
329
|
+
/* @__PURE__ */ h("div", { ref: j, className: "cy-container" }),
|
|
330
|
+
g.visible && g.targetNode && /* @__PURE__ */ h(
|
|
330
331
|
"div",
|
|
331
332
|
{
|
|
332
333
|
style: {
|
|
333
334
|
position: "absolute",
|
|
334
|
-
left: `${
|
|
335
|
-
top: `${
|
|
335
|
+
left: `${g.x}px`,
|
|
336
|
+
top: `${g.y}px`,
|
|
336
337
|
// backgroundColor: 'white',
|
|
337
338
|
// border: '1px solid #ccc',
|
|
338
339
|
// borderRadius: '50%',
|
|
@@ -346,10 +347,10 @@ const nt = ({
|
|
|
346
347
|
overflow: "hidden"
|
|
347
348
|
},
|
|
348
349
|
onClick: (s) => s.stopPropagation(),
|
|
349
|
-
children: /* @__PURE__ */
|
|
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__ */
|
|
353
|
+
$.visible && /* @__PURE__ */ h(
|
|
353
354
|
"div",
|
|
354
355
|
{
|
|
355
356
|
style: {
|
|
@@ -373,10 +374,10 @@ const nt = ({
|
|
|
373
374
|
}
|
|
374
375
|
)
|
|
375
376
|
] }),
|
|
376
|
-
/* @__PURE__ */
|
|
377
|
-
/* @__PURE__ */
|
|
377
|
+
/* @__PURE__ */ h(Se, { ref: J }),
|
|
378
|
+
/* @__PURE__ */ h(Ie, { ref: Q })
|
|
378
379
|
] }) });
|
|
379
380
|
};
|
|
380
381
|
export {
|
|
381
|
-
|
|
382
|
+
st as default
|
|
382
383
|
};
|