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.
- 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 +79 -78
- 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
|
|
4
|
-
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
|
+
import Ne from "cytoscape-cose-bilkent";
|
|
5
5
|
import ke from "cytoscape-cise";
|
|
6
|
-
import
|
|
6
|
+
import Ce from "cytoscape-fcose";
|
|
7
7
|
import ze from "storm-layout";
|
|
8
|
-
import
|
|
8
|
+
import Ee from "./index.es7.js";
|
|
9
9
|
/* empty css */
|
|
10
|
-
import { handleCalcPath as
|
|
11
|
-
import { fixNodesToEdges as
|
|
12
|
-
import { edgeNodeStyles as
|
|
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 {
|
|
15
|
-
import { menuItemsConfig as
|
|
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
|
|
19
|
-
import { GraphProvider as
|
|
20
|
-
import
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const
|
|
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:
|
|
30
|
-
graphInfo:
|
|
29
|
+
highPathAnalysis: z = [],
|
|
30
|
+
graphInfo: u,
|
|
31
31
|
stepNextApi: re,
|
|
32
32
|
knowledgeCardApi: ae,
|
|
33
|
-
colors:
|
|
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), [
|
|
40
|
-
|
|
41
|
-
H.current =
|
|
42
|
-
}, [
|
|
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
|
-
}), [$,
|
|
49
|
+
}), [$, Y] = v({
|
|
50
50
|
visible: !1,
|
|
51
51
|
x: 0,
|
|
52
52
|
y: 0,
|
|
53
53
|
content: ""
|
|
54
|
-
}),
|
|
55
|
-
|
|
56
|
-
(
|
|
57
|
-
}, [R(
|
|
58
|
-
I == null || I({ graphData:
|
|
59
|
-
}, [R(
|
|
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:
|
|
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 =
|
|
66
|
+
const e = C({
|
|
67
67
|
container: j.current,
|
|
68
68
|
elements: s,
|
|
69
|
-
style:
|
|
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
|
-
|
|
78
|
+
if (p.current = e, ((r = u == null ? void 0 : u.searchNodes) == null ? void 0 : r.length) === 2)
|
|
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 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"),
|
|
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();
|
|
@@ -142,7 +143,7 @@ const dt = ({
|
|
|
142
143
|
p.current && (p.current.destroy(), p.current = null);
|
|
143
144
|
};
|
|
144
145
|
}, []);
|
|
145
|
-
const
|
|
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
|
-
),
|
|
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
|
|
171
|
-
const A =
|
|
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,
|
|
174
|
-
return !
|
|
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
|
-
|
|
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:
|
|
192
|
-
if (B(x), W(
|
|
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
|
-
|
|
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 =
|
|
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([...
|
|
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
|
-
|
|
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 = {
|
|
285
286
|
expanded: "typed-literal",
|
|
286
287
|
contract: "uri"
|
|
287
|
-
},
|
|
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
|
-
|
|
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
|
-
|
|
307
|
-
} else r === "knowledgeCard" &&
|
|
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 =
|
|
312
|
-
/* @__PURE__ */
|
|
313
|
-
/* @__PURE__ */
|
|
314
|
-
|
|
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:
|
|
319
|
+
graphInfo: u,
|
|
319
320
|
initNodeScale: X,
|
|
320
321
|
cyContainerRef: j,
|
|
321
322
|
typeObj: w,
|
|
322
323
|
relationObj: T,
|
|
323
|
-
colors:
|
|
324
|
+
colors: E,
|
|
324
325
|
actionBar: ie
|
|
325
326
|
}
|
|
326
327
|
),
|
|
327
328
|
/* @__PURE__ */ oe("div", { className: "relative h-100", children: [
|
|
328
|
-
/* @__PURE__ */
|
|
329
|
-
g.visible && g.targetNode && /* @__PURE__ */
|
|
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__ */
|
|
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 dt = ({
|
|
|
373
374
|
}
|
|
374
375
|
)
|
|
375
376
|
] }),
|
|
376
|
-
/* @__PURE__ */
|
|
377
|
-
/* @__PURE__ */
|
|
378
|
-
] }) })
|
|
377
|
+
/* @__PURE__ */ h(Se, { ref: J }),
|
|
378
|
+
/* @__PURE__ */ h(Ie, { ref: Q })
|
|
379
|
+
] }) });
|
|
379
380
|
};
|
|
380
381
|
export {
|
|
381
|
-
|
|
382
|
+
st as default
|
|
382
383
|
};
|
package/lib/index.es35.js
CHANGED
|
@@ -1,6 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
|
|
65
|
+
R as default
|
|
6
66
|
};
|