react-kggraph 0.0.11 → 0.0.13
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 +49 -165
- package/lib/index.es11.js +28 -68
- package/lib/index.es12.js +69 -29
- package/lib/index.es13.js +224 -70
- package/lib/index.es14.js +4 -224
- package/lib/index.es15.js +35 -4
- package/lib/index.es17.js +15469 -0
- package/lib/index.es18.js +49 -15462
- package/lib/index.es19.js +56 -50
- package/lib/index.es20.js +66 -57
- package/lib/index.es21.js +39 -68
- package/lib/index.es22.js +2 -40
- package/lib/index.es23.js +1 -1
- package/lib/index.es24.js +2 -2
- package/lib/index.es25.js +1 -1
- package/lib/index.es26.js +1 -1
- package/lib/index.es27.js +1 -1
- package/lib/index.es28.js +1 -1
- package/lib/index.es29.js +1 -1
- package/lib/index.es3.js +58 -59
- package/lib/index.es30.js +1 -1
- package/lib/index.es31.js +1 -1
- package/lib/index.es32.js +2 -2
- package/lib/index.es34.js +6 -0
- package/lib/index.es35.js +2 -4
- package/lib/index.es6.js +9 -9
- package/lib/index.es7.js +322 -5
- package/lib/index.es8.js +393 -294
- package/lib/index.es9.js +173 -408
- package/lib/src/components/Graph/index.d.ts +1 -1
- package/package.json +1 -1
- package/lib/index.es16.js +0 -38
- package/lib/index.es33.js +0 -4
- package/lib/index.es36.js +0 -4
package/lib/index.es10.js
CHANGED
|
@@ -1,188 +1,72 @@
|
|
|
1
|
-
const i = [
|
|
1
|
+
const i = ({ cyRef: n, setContextMenu: t, onPathAnalysis: l, setPathNodes: a }) => [
|
|
2
2
|
{
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
label: "展收实体",
|
|
4
|
+
ids: "contract",
|
|
5
|
+
action: (e) => {
|
|
6
|
+
const o = n.current;
|
|
7
|
+
console.log("新增属性", o);
|
|
6
8
|
}
|
|
7
9
|
},
|
|
8
10
|
{
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
// 箭头形状(必须配置才会显示箭头)
|
|
18
|
-
"target-arrow-shape": "triangle",
|
|
19
|
-
// 链接线宽度
|
|
20
|
-
width: 2,
|
|
21
|
-
// 曲线样式
|
|
22
|
-
"curve-style": "bezier",
|
|
23
|
-
// 可选:过渡动画(颜色变化更丝滑)
|
|
24
|
-
"transition-property": "line-color, target-arrow-color, opacity",
|
|
25
|
-
"transition-duration": "0.2s",
|
|
26
|
-
label: "data(name)",
|
|
27
|
-
"z-index": 9999,
|
|
28
|
-
// 连线文字设置
|
|
29
|
-
"text-opacity": 1,
|
|
30
|
-
"font-size": 18,
|
|
31
|
-
color: "#666",
|
|
32
|
-
"text-background-color": "#fff",
|
|
33
|
-
"text-background-opacity": 1,
|
|
34
|
-
"text-background-shape": "roundrectangle",
|
|
35
|
-
// 'text-border-width': 2,
|
|
36
|
-
// 'text-border-opacity':1,
|
|
37
|
-
// 'text-border-color': '#e9e7e7',
|
|
38
|
-
"text-background-padding": "3px"
|
|
11
|
+
label: "展收属性",
|
|
12
|
+
ids: "expanded",
|
|
13
|
+
action: (e) => {
|
|
14
|
+
if (console.log("展开", e), !n.current) {
|
|
15
|
+
console.error("Cytoscape instance is not available");
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
console.log("New node and edge added");
|
|
39
19
|
}
|
|
40
20
|
},
|
|
41
21
|
{
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
22
|
+
label: "节点信息",
|
|
23
|
+
ids: "nodeInfo",
|
|
24
|
+
action: (e) => {
|
|
25
|
+
console.log("节点信息:", e);
|
|
46
26
|
}
|
|
47
27
|
},
|
|
48
28
|
{
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
29
|
+
label: "知识卡片",
|
|
30
|
+
ids: "knowledgeCard",
|
|
31
|
+
action: (e) => {
|
|
32
|
+
const o = n.current;
|
|
33
|
+
console.log("知识卡片", o);
|
|
53
34
|
}
|
|
54
35
|
},
|
|
36
|
+
// {
|
|
37
|
+
// label: '新增关系',
|
|
38
|
+
// action: (node) => {
|
|
39
|
+
// const cy = cyRef.current;
|
|
40
|
+
// console.log('新增关系', cy)
|
|
41
|
+
// },
|
|
42
|
+
// },
|
|
55
43
|
{
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
44
|
+
label: "选中关联",
|
|
45
|
+
ids: "selRelate",
|
|
46
|
+
action: (e) => {
|
|
47
|
+
const o = n.current;
|
|
48
|
+
if (!o || !e || e.removed()) {
|
|
49
|
+
console.error("节点或Cytoscape实例无效"), t((r) => ({ ...r, visible: !1 }));
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const s = e, c = s.neighborhood().nodes().add(s);
|
|
53
|
+
c.edgesWith(c), o.nodes().not(c).removeClass("correlationStyle"), c.addClass("correlationStyle"), t((r) => ({ ...r, visible: !1 }));
|
|
61
54
|
}
|
|
62
55
|
},
|
|
63
56
|
{
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"text-opacity": 0.15
|
|
57
|
+
label: "路径分析",
|
|
58
|
+
action: (e) => {
|
|
59
|
+
n.current, console.log(11, e.data("name")), l == null || l(), a([e.data("name"), ""]);
|
|
68
60
|
}
|
|
69
61
|
},
|
|
70
62
|
{
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"border-color": "rgba(174, 255, 45, 0.2)",
|
|
76
|
-
"border-width": 4
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
selector: ".correlationStyle",
|
|
81
|
-
style: {
|
|
82
|
-
width: 60,
|
|
83
|
-
height: 60,
|
|
84
|
-
// 'background-color': '#fff',
|
|
85
|
-
// 核心:outline(外边框)+ blur滤镜实现发光
|
|
86
|
-
"outline-width": "10px",
|
|
87
|
-
"outline-color": "rgba(188, 220, 255, 0.4)",
|
|
88
|
-
"outline-style": "solid",
|
|
89
|
-
"line-opacity": "0.2",
|
|
90
|
-
"outline-offset": "2px",
|
|
91
|
-
// 偏移避免遮挡节点
|
|
92
|
-
filter: "blur(20px)",
|
|
93
|
-
// 模糊outline,模拟发光
|
|
94
|
-
"z-index": 9999
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
selector: ".hover",
|
|
99
|
-
style: {
|
|
100
|
-
"border-width": 3,
|
|
101
|
-
"border-color": "#0d6ac2"
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
// 层级分析样式 - 目标节点
|
|
105
|
-
{
|
|
106
|
-
selector: ".level-selected",
|
|
107
|
-
style: {
|
|
108
|
-
"background-color": "#f8bbd0",
|
|
109
|
-
"border-color": "#e91e63",
|
|
110
|
-
"border-width": 4,
|
|
111
|
-
color: "#880e4f"
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
// 层级分析样式 - 关联节点
|
|
115
|
-
{
|
|
116
|
-
selector: ".level-highlight",
|
|
117
|
-
style: {
|
|
118
|
-
"background-color": "#bbdefb",
|
|
119
|
-
"border-color": "#2196f3",
|
|
120
|
-
"border-width": 3,
|
|
121
|
-
color: "#0d47a1"
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
// 层级分析样式 - 边高亮
|
|
125
|
-
{
|
|
126
|
-
selector: ".level-highlightedge",
|
|
127
|
-
style: {
|
|
128
|
-
"line-color": "#1976d2",
|
|
129
|
-
"target-arrow-color": "#1976d2",
|
|
130
|
-
width: 3,
|
|
131
|
-
opacity: 1
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
|
-
// 层级分析样式 - 置灰
|
|
135
|
-
{
|
|
136
|
-
selector: ".level-grayed",
|
|
137
|
-
style: {
|
|
138
|
-
opacity: 0.15,
|
|
139
|
-
"text-opacity": 0.15
|
|
63
|
+
label: "删除节点",
|
|
64
|
+
action: (e) => {
|
|
65
|
+
const o = n.current;
|
|
66
|
+
console.log("删除节点cy::::", o), e && !e.removed() && e.remove();
|
|
140
67
|
}
|
|
141
68
|
}
|
|
142
|
-
]
|
|
143
|
-
const o = [];
|
|
144
|
-
c.map((e) => {
|
|
145
|
-
var r, l, a;
|
|
146
|
-
!o.includes((r = e == null ? void 0 : e.data) == null ? void 0 : r.type) && ((l = e == null ? void 0 : e.data) != null && l.type) && o.push((a = e.data) == null ? void 0 : a.type);
|
|
147
|
-
});
|
|
148
|
-
const t = [];
|
|
149
|
-
return t.push({
|
|
150
|
-
selector: '[properties-type="uri"]',
|
|
151
|
-
style: {
|
|
152
|
-
"background-color": "#f7de63",
|
|
153
|
-
// 黄色
|
|
154
|
-
"background-image": "data(image)",
|
|
155
|
-
// 'background-image': sticon1,
|
|
156
|
-
"background-fit": "cover",
|
|
157
|
-
width: 80,
|
|
158
|
-
height: 80,
|
|
159
|
-
label: "data(name)",
|
|
160
|
-
color: "black",
|
|
161
|
-
"text-valign": "bottom",
|
|
162
|
-
"font-size": 18,
|
|
163
|
-
"text-max-width": "250px",
|
|
164
|
-
"text-wrap": "ellipsis",
|
|
165
|
-
"text-overflow-wrap": "anywhere"
|
|
166
|
-
}
|
|
167
|
-
}), t.push({
|
|
168
|
-
selector: '[properties-type!="uri"]',
|
|
169
|
-
style: {
|
|
170
|
-
"background-color": "#1890FF",
|
|
171
|
-
// 蓝色
|
|
172
|
-
"background-image": "data(image)",
|
|
173
|
-
"background-fit": "cover",
|
|
174
|
-
width: 80,
|
|
175
|
-
height: 80,
|
|
176
|
-
label: "data(name)",
|
|
177
|
-
color: "black",
|
|
178
|
-
"text-valign": "bottom",
|
|
179
|
-
"font-size": 18,
|
|
180
|
-
"text-max-width": "250px",
|
|
181
|
-
"text-wrap": "ellipsis",
|
|
182
|
-
"text-overflow-wrap": "anywhere"
|
|
183
|
-
}
|
|
184
|
-
}), t.concat(i);
|
|
185
|
-
};
|
|
69
|
+
];
|
|
186
70
|
export {
|
|
187
|
-
|
|
71
|
+
i as menuItemsConfig
|
|
188
72
|
};
|
package/lib/index.es11.js
CHANGED
|
@@ -1,72 +1,32 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
console.log("新增属性", o);
|
|
1
|
+
const t = (r) => {
|
|
2
|
+
if (n(r) || Array.isArray(r))
|
|
3
|
+
try {
|
|
4
|
+
return JSON.stringify(r);
|
|
5
|
+
} catch (e) {
|
|
6
|
+
console.log("JSON.stringify", e);
|
|
8
7
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
console.log("New node and edge added");
|
|
8
|
+
else
|
|
9
|
+
return r;
|
|
10
|
+
}, c = (r) => {
|
|
11
|
+
if (n(r) || Array.isArray(r))
|
|
12
|
+
try {
|
|
13
|
+
return JSON.parse(JSON.stringify(r));
|
|
14
|
+
} catch (e) {
|
|
15
|
+
console.log("JSON.stringify-JSON.parse", e);
|
|
19
16
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
ids: "knowledgeCard",
|
|
31
|
-
action: (e) => {
|
|
32
|
-
const o = n.current;
|
|
33
|
-
console.log("知识卡片", o);
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
// {
|
|
37
|
-
// label: '新增关系',
|
|
38
|
-
// action: (node) => {
|
|
39
|
-
// const cy = cyRef.current;
|
|
40
|
-
// console.log('新增关系', cy)
|
|
41
|
-
// },
|
|
42
|
-
// },
|
|
43
|
-
{
|
|
44
|
-
label: "选中关联",
|
|
45
|
-
ids: "selRelate",
|
|
46
|
-
action: (e) => {
|
|
47
|
-
const o = n.current;
|
|
48
|
-
if (!o || !e || e.removed()) {
|
|
49
|
-
console.error("节点或Cytoscape实例无效"), t((r) => ({ ...r, visible: !1 }));
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
const s = e, c = s.neighborhood().nodes().add(s);
|
|
53
|
-
c.edgesWith(c), o.nodes().not(c).removeClass("correlationStyle"), c.addClass("correlationStyle"), t((r) => ({ ...r, visible: !1 }));
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
label: "路径分析",
|
|
58
|
-
action: (e) => {
|
|
59
|
-
n.current, console.log(11, e.data("name")), l == null || l(), a([e.data("name"), ""]);
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
label: "删除节点",
|
|
64
|
-
action: (e) => {
|
|
65
|
-
const o = n.current;
|
|
66
|
-
console.log("删除节点cy::::", o), e && !e.removed() && e.remove();
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
];
|
|
17
|
+
else
|
|
18
|
+
return r;
|
|
19
|
+
};
|
|
20
|
+
function n(r) {
|
|
21
|
+
return r !== null && typeof r == "object" && !Array.isArray(r);
|
|
22
|
+
}
|
|
23
|
+
const i = (r, e) => {
|
|
24
|
+
const o = document.createElement("a");
|
|
25
|
+
o.href = r, o.download = e, document.body.appendChild(o), o.click(), document.body.removeChild(o);
|
|
26
|
+
};
|
|
70
27
|
export {
|
|
71
|
-
i as
|
|
28
|
+
i as downloadFile,
|
|
29
|
+
n as isObject,
|
|
30
|
+
t as jsonStringify,
|
|
31
|
+
c as jsonStringifyParse
|
|
72
32
|
};
|
package/lib/index.es12.js
CHANGED
|
@@ -1,32 +1,72 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
import { jsxs as d, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as b } from "react";
|
|
3
|
+
/* empty css */
|
|
4
|
+
const L = ({
|
|
5
|
+
items: h = [
|
|
6
|
+
// { label: '知识卡片' },
|
|
7
|
+
// { label: '选中关联' },
|
|
8
|
+
// { label: '路径分析' },
|
|
9
|
+
// { label: '展收实体' },
|
|
10
|
+
// { label: '展收属性' },
|
|
11
|
+
// { label: '节点配置' },
|
|
12
|
+
],
|
|
13
|
+
centerImage: f,
|
|
14
|
+
size: c = 200,
|
|
15
|
+
onClick: $
|
|
16
|
+
}) => {
|
|
17
|
+
const t = c / 2, a = c / 2 - 10, s = 30, o = 360 / h.length, p = b(() => h.map((n, r) => {
|
|
18
|
+
const l = (r * o - 90) * (Math.PI / 180), i = ((r + 1) * o - 90) * (Math.PI / 180), m = ((r + 0.5) * o - 90) * (Math.PI / 180), y = t + a * Math.cos(l), v = t + a * Math.sin(l), w = t + a * Math.cos(i), A = t + a * Math.sin(i), N = t + s * Math.cos(i), k = t + s * Math.sin(i), u = t + s * Math.cos(l), x = t + s * Math.sin(l), g = o > 180 ? 1 : 0, I = `M ${u} ${x} L ${y} ${v} A ${a} ${a} 0 ${g} 1 ${w} ${A} L ${N} ${k} A ${s} ${s} 0 ${g} 0 ${u} ${x}`, M = (a + s) / 2 + 5, P = t + M * Math.cos(m), R = t + M * Math.sin(m);
|
|
19
|
+
return {
|
|
20
|
+
...n,
|
|
21
|
+
path: I,
|
|
22
|
+
textX: P,
|
|
23
|
+
textY: R,
|
|
24
|
+
rotation: (r + 0.5) * o - 90
|
|
25
|
+
};
|
|
26
|
+
}), [h, o, t, a, s]);
|
|
27
|
+
return /* @__PURE__ */ d("div", { className: "radial-menu", style: { width: c, height: c }, children: [
|
|
28
|
+
/* @__PURE__ */ d("svg", { width: c, height: c, className: "radial-svg", children: [
|
|
29
|
+
/* @__PURE__ */ e("defs", { children: /* @__PURE__ */ e("filter", { id: "shadow", x: "-20%", y: "-20%", width: "140%", height: "140%", children: /* @__PURE__ */ e("feDropShadow", { dx: "0", dy: "2", stdDeviation: "3", floodOpacity: "0.3" }) }) }),
|
|
30
|
+
/* @__PURE__ */ e("circle", { cx: t, cy: t, r: a, fill: "#f5f5f5", stroke: "#ddd", strokeWidth: "1" }),
|
|
31
|
+
p.map((n, r) => /* @__PURE__ */ d("g", { onClick: () => $(n), className: "sector-group", children: [
|
|
32
|
+
/* @__PURE__ */ e(
|
|
33
|
+
"path",
|
|
34
|
+
{
|
|
35
|
+
d: n.path,
|
|
36
|
+
fill: "#333",
|
|
37
|
+
stroke: "rgb(185, 185, 185)",
|
|
38
|
+
strokeWidth: "1",
|
|
39
|
+
filter: "url(#shadow)",
|
|
40
|
+
className: "sector-path"
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
/* @__PURE__ */ e(
|
|
44
|
+
"text",
|
|
45
|
+
{
|
|
46
|
+
x: n.textX,
|
|
47
|
+
y: n.textY,
|
|
48
|
+
textAnchor: "middle",
|
|
49
|
+
dominantBaseline: "middle",
|
|
50
|
+
fill: "#fff",
|
|
51
|
+
fontSize: "12",
|
|
52
|
+
fontWeight: "500",
|
|
53
|
+
className: "sector-label",
|
|
54
|
+
children: n.label
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
] }, r)),
|
|
58
|
+
/* @__PURE__ */ e("circle", { cx: t, cy: t, r: s + 2, fill: "#fff" })
|
|
59
|
+
] }),
|
|
60
|
+
/* @__PURE__ */ e(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
className: "center-avatar",
|
|
64
|
+
style: { width: s * 2, height: s * 2 },
|
|
65
|
+
children: f ? /* @__PURE__ */ e("img", { src: f, alt: "avatar" }) : /* @__PURE__ */ e("span", { className: "center-text", children: "菜单" })
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
] });
|
|
26
69
|
};
|
|
27
70
|
export {
|
|
28
|
-
|
|
29
|
-
n as isObject,
|
|
30
|
-
t as jsonStringify,
|
|
31
|
-
c as jsonStringifyParse
|
|
71
|
+
L as default
|
|
32
72
|
};
|