react-kggraph 0.0.11 → 0.0.12
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 +6 -4
- package/lib/index.es16.js +0 -38
- package/lib/index.es33.js +0 -4
- package/lib/index.es36.js +0 -4
package/lib/index.es9.js
CHANGED
|
@@ -1,423 +1,188 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
e.fit(void 0, 50);
|
|
8
|
-
}), !1;
|
|
9
|
-
}
|
|
10
|
-
const l = e.width();
|
|
11
|
-
if (l === 0)
|
|
12
|
-
return !1;
|
|
13
|
-
const g = i.width() || 60, d = e.height() / 2, f = g / 2 + o, m = l - g / 2 - o;
|
|
14
|
-
i.position({ x: f, y: d }), a.position({ x: m, y: d }), i.lock(), a.lock();
|
|
15
|
-
const s = e.nodes().difference(i).difference(a);
|
|
16
|
-
if (s.length > 0) {
|
|
17
|
-
s.forEach((v) => {
|
|
18
|
-
const p = v.position().x, h = Math.min(f, p), b = Math.max(m, p);
|
|
19
|
-
v.position({
|
|
20
|
-
x: h + (b - h) * 0.5,
|
|
21
|
-
y: d
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
const t = e.layout({
|
|
25
|
-
// name: 'cose-bilkent',
|
|
26
|
-
...c(),
|
|
27
|
-
nodes: s
|
|
28
|
-
// 只布局中间节点
|
|
29
|
-
// animate: true,
|
|
30
|
-
// animationDuration: 500,
|
|
31
|
-
// randomize: false,
|
|
32
|
-
// fit: false, // 不自动适应视图
|
|
33
|
-
// nodeRepulsion: 1500000,
|
|
34
|
-
// idealEdgeLength: 120,
|
|
35
|
-
// gravity: 0.3,
|
|
36
|
-
// padding: 50,
|
|
37
|
-
});
|
|
38
|
-
t.run(), t.on("layoutstop", () => {
|
|
39
|
-
e.fit(void 0, 50), i.unlock(), a.unlock(), console.log("布局完成");
|
|
40
|
-
});
|
|
41
|
-
} else
|
|
42
|
-
e.fit(void 0, 50);
|
|
43
|
-
return console.log("fixNodesToEdges: 完成"), !0;
|
|
44
|
-
}, c = () => ({
|
|
45
|
-
name: "cose-bilkent",
|
|
46
|
-
// 核心优化
|
|
47
|
-
nodeRepulsion: 1005e3,
|
|
48
|
-
// 大幅增加斥力,让节点分散
|
|
49
|
-
idealEdgeLength: 100,
|
|
50
|
-
// 拉长边长,避免拥挤
|
|
51
|
-
edgeElasticity: 0.3,
|
|
52
|
-
// 适度弹性,保持边距
|
|
53
|
-
numIter: 2500,
|
|
54
|
-
// 保持迭代次数
|
|
55
|
-
// 布局对齐
|
|
56
|
-
fit: !0,
|
|
57
|
-
padding: 50,
|
|
58
|
-
// 增加内边距
|
|
59
|
-
randomize: !1,
|
|
60
|
-
animate: "end",
|
|
61
|
-
//fit、none
|
|
62
|
-
animationDuration: 1e3,
|
|
63
|
-
// 辅助优化
|
|
64
|
-
nodeDimensionsIncludeLabels: !0,
|
|
65
|
-
// 让节点自动适应标签长度
|
|
66
|
-
tile: !0,
|
|
67
|
-
tilingPaddingVertical: 15,
|
|
68
|
-
tilingPaddingHorizontal: 15,
|
|
69
|
-
gravity: 0.6,
|
|
70
|
-
// 稍强的向心力,避免过于分散
|
|
71
|
-
// 其他保持默认
|
|
72
|
-
nestingFactor: 0.1,
|
|
73
|
-
gravityRange: 3,
|
|
74
|
-
gravityRangeCompound: 1.5,
|
|
75
|
-
gravityCompound: 1,
|
|
76
|
-
initialEnergyOnIncremental: 0.5,
|
|
77
|
-
refresh: 30
|
|
78
|
-
}), w = (e, n) => {
|
|
79
|
-
console.log(111, n);
|
|
80
|
-
const r = e.current;
|
|
81
|
-
if (!r) return;
|
|
82
|
-
let o = {};
|
|
83
|
-
switch (n) {
|
|
84
|
-
case "circle":
|
|
85
|
-
o = E();
|
|
86
|
-
break;
|
|
87
|
-
case "concentric":
|
|
88
|
-
console.log("执行圆形布局"), o = L();
|
|
89
|
-
break;
|
|
90
|
-
case "grid":
|
|
91
|
-
console.log("执行网格布局"), o = D();
|
|
92
|
-
break;
|
|
93
|
-
case "breadthfirst":
|
|
94
|
-
console.log("执行树型布局"), o = F();
|
|
95
|
-
break;
|
|
96
|
-
case "random":
|
|
97
|
-
console.log("执行随机布局"), o = y();
|
|
98
|
-
break;
|
|
99
|
-
case "cose":
|
|
100
|
-
console.log("执行 cose 布局"), o = k();
|
|
101
|
-
break;
|
|
102
|
-
case "cose-bilkent":
|
|
103
|
-
console.log("执行 cose-bilkent 布局"), o = c();
|
|
104
|
-
break;
|
|
105
|
-
case "fcose":
|
|
106
|
-
console.log("执行 fcose 布局"), o = x();
|
|
107
|
-
break;
|
|
108
|
-
case "cise":
|
|
109
|
-
console.log("执行 cise 布局"), o = {
|
|
110
|
-
name: "cise",
|
|
111
|
-
// 聚类分组(必须定义才能生效)
|
|
112
|
-
clusters: [],
|
|
113
|
-
// 关闭动画,避免抖动
|
|
114
|
-
animate: !1,
|
|
115
|
-
// 布局完成后适应画布
|
|
116
|
-
fit: !0,
|
|
117
|
-
// 内边距
|
|
118
|
-
padding: 30,
|
|
119
|
-
// 节点间距
|
|
120
|
-
nodeSeparation: 80,
|
|
121
|
-
// 理想边长
|
|
122
|
-
idealEdgeLength: 80,
|
|
123
|
-
// 聚类间边长度系数
|
|
124
|
-
idealInterClusterEdgeLengthCoefficient: 1.5,
|
|
125
|
-
// 最大迭代次数
|
|
126
|
-
maxIteration: 500
|
|
127
|
-
};
|
|
128
|
-
break;
|
|
129
|
-
default:
|
|
130
|
-
console.warn("未知布局类型:", n);
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
r.layout(o).run();
|
|
134
|
-
}, y = () => ({
|
|
135
|
-
name: "random",
|
|
136
|
-
fit: !0,
|
|
137
|
-
// whether to fit to viewport
|
|
138
|
-
padding: 30,
|
|
139
|
-
// fit padding
|
|
140
|
-
boundingBox: void 0,
|
|
141
|
-
// constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
|
|
142
|
-
animate: !0,
|
|
143
|
-
// whether to transition the node positions
|
|
144
|
-
animationDuration: 500,
|
|
145
|
-
// duration of animation in ms if enabled
|
|
146
|
-
animationEasing: void 0,
|
|
147
|
-
// easing of animation if enabled
|
|
148
|
-
animateFilter: function(e, n) {
|
|
149
|
-
return !0;
|
|
1
|
+
const i = [
|
|
2
|
+
{
|
|
3
|
+
selector: "node",
|
|
4
|
+
style: {
|
|
5
|
+
"text-margin-y": "5px"
|
|
6
|
+
}
|
|
150
7
|
},
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
8
|
+
{
|
|
9
|
+
selector: "edge",
|
|
10
|
+
style: {
|
|
11
|
+
// 核心:默认链接线颜色(和 hover 区分开)
|
|
12
|
+
"line-color": "#a29e9e",
|
|
13
|
+
// 核心:默认箭头颜色(和 hover 区分开)
|
|
14
|
+
"target-arrow-color": "#a29e9e",
|
|
15
|
+
// 核心:默认透明度(和 hover 区分开)
|
|
16
|
+
opacity: 1,
|
|
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"
|
|
39
|
+
}
|
|
163
40
|
},
|
|
164
|
-
|
|
41
|
+
{
|
|
42
|
+
selector: ".highlight",
|
|
43
|
+
style: {
|
|
44
|
+
"border-color": "rgba(174, 255, 45, 0.2)",
|
|
45
|
+
"border-width": 4
|
|
46
|
+
}
|
|
165
47
|
},
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
48
|
+
{
|
|
49
|
+
selector: ".path-node",
|
|
50
|
+
style: {
|
|
51
|
+
"background-color": "#145AFD",
|
|
52
|
+
"border-color": "#FFEB3B"
|
|
53
|
+
}
|
|
171
54
|
},
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
componentSpacing: 40,
|
|
180
|
-
nodeRepulsion: function(e) {
|
|
181
|
-
return 2048;
|
|
55
|
+
{
|
|
56
|
+
selector: ".path-edge",
|
|
57
|
+
style: {
|
|
58
|
+
"line-color": "#145AFD",
|
|
59
|
+
"target-arrow-color": "#145AFD",
|
|
60
|
+
width: 4
|
|
61
|
+
}
|
|
182
62
|
},
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
63
|
+
{
|
|
64
|
+
selector: ".grayed",
|
|
65
|
+
style: {
|
|
66
|
+
opacity: 0.15,
|
|
67
|
+
"text-opacity": 0.15
|
|
68
|
+
}
|
|
186
69
|
},
|
|
187
|
-
|
|
188
|
-
|
|
70
|
+
{
|
|
71
|
+
selector: "node.selected, edge.selected",
|
|
72
|
+
// 选中状态的样式
|
|
73
|
+
style: {
|
|
74
|
+
// 'line-color': 'rgba(66, 133, 244, 0.5)', // 选中边的颜色
|
|
75
|
+
"border-color": "rgba(174, 255, 45, 0.2)",
|
|
76
|
+
"border-width": 4
|
|
77
|
+
}
|
|
189
78
|
},
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
// Excludes the label when calculating node bounding boxes for the layout algorithm
|
|
208
|
-
spacingFactor: 1.2,
|
|
209
|
-
// 节点间距系数,值越大连线越长
|
|
210
|
-
radius: void 0,
|
|
211
|
-
// the radius of the circle
|
|
212
|
-
startAngle: 1.5 * Math.PI,
|
|
213
|
-
// where nodes start in radians
|
|
214
|
-
sweep: void 0,
|
|
215
|
-
// how many radians should be between the first and last node (defaults to full circle)
|
|
216
|
-
clockwise: !0,
|
|
217
|
-
// whether the layout should go clockwise (true) or counterclockwise/anticlockwise (false)
|
|
218
|
-
sort: void 0,
|
|
219
|
-
// a sorting function to order the nodes; e.g. function(a, b){ return a.data('weight') - b.data('weight') }
|
|
220
|
-
animate: !0,
|
|
221
|
-
// whether to transition the node positions
|
|
222
|
-
animationDuration: 500,
|
|
223
|
-
// duration of animation in ms if enabled
|
|
224
|
-
animationEasing: void 0,
|
|
225
|
-
// easing of animation if enabled
|
|
226
|
-
animateFilter: function(e, n) {
|
|
227
|
-
return !0;
|
|
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
|
+
}
|
|
228
96
|
},
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
return n;
|
|
236
|
-
}
|
|
237
|
-
// transform a given node position. Useful for changing flow direction in discrete layouts
|
|
238
|
-
}), L = () => ({
|
|
239
|
-
name: "concentric",
|
|
240
|
-
fit: !0,
|
|
241
|
-
// whether to fit the viewport to the graph
|
|
242
|
-
padding: 30,
|
|
243
|
-
// the padding on fit
|
|
244
|
-
startAngle: 1.5 * Math.PI,
|
|
245
|
-
// where nodes start in radians
|
|
246
|
-
sweep: void 0,
|
|
247
|
-
// how many radians should be between the first and last node (defaults to full circle)
|
|
248
|
-
clockwise: !0,
|
|
249
|
-
// whether the layout should go clockwise (true) or counterclockwise/anticlockwise (false)
|
|
250
|
-
equidistant: !1,
|
|
251
|
-
// whether levels have an equal radial distance betwen them, may cause bounding box overflow
|
|
252
|
-
minNodeSpacing: 10,
|
|
253
|
-
// min spacing between outside of nodes (used for radius adjustment)
|
|
254
|
-
boundingBox: void 0,
|
|
255
|
-
// constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
|
|
256
|
-
avoidOverlap: !0,
|
|
257
|
-
// prevents node overlap, may overflow boundingBox if not enough space
|
|
258
|
-
nodeDimensionsIncludeLabels: !1,
|
|
259
|
-
// Excludes the label when calculating node bounding boxes for the layout algorithm
|
|
260
|
-
height: void 0,
|
|
261
|
-
// height of layout area (overrides container height)
|
|
262
|
-
width: void 0,
|
|
263
|
-
// width of layout area (overrides container width)
|
|
264
|
-
spacingFactor: 3,
|
|
265
|
-
// Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up
|
|
266
|
-
concentric: function(e) {
|
|
267
|
-
return e.degree();
|
|
97
|
+
{
|
|
98
|
+
selector: ".hover",
|
|
99
|
+
style: {
|
|
100
|
+
"border-width": 3,
|
|
101
|
+
"border-color": "#0d6ac2"
|
|
102
|
+
}
|
|
268
103
|
},
|
|
269
|
-
|
|
270
|
-
|
|
104
|
+
// 层级分析样式 - 目标节点
|
|
105
|
+
{
|
|
106
|
+
selector: ".level-selected",
|
|
107
|
+
style: {
|
|
108
|
+
"background-color": "#f8bbd0",
|
|
109
|
+
"border-color": "#e91e63",
|
|
110
|
+
"border-width": 4,
|
|
111
|
+
color: "#880e4f"
|
|
112
|
+
}
|
|
271
113
|
},
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
114
|
+
// 层级分析样式 - 关联节点
|
|
115
|
+
{
|
|
116
|
+
selector: ".level-highlight",
|
|
117
|
+
style: {
|
|
118
|
+
"background-color": "#bbdefb",
|
|
119
|
+
"border-color": "#2196f3",
|
|
120
|
+
"border-width": 3,
|
|
121
|
+
color: "#0d47a1"
|
|
122
|
+
}
|
|
280
123
|
},
|
|
281
|
-
//
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
}), x = () => ({
|
|
291
|
-
name: "fcose",
|
|
292
|
-
// 节点布局 - 防止重叠
|
|
293
|
-
idealEdgeLength: 50,
|
|
294
|
-
// 较小的边长
|
|
295
|
-
edgeElasticity: 80,
|
|
296
|
-
// 边的弹性
|
|
297
|
-
nodeRepulsion: 12e3,
|
|
298
|
-
// 增强斥力,防止重叠
|
|
299
|
-
nodeOverlap: 0,
|
|
300
|
-
// 不允许重叠
|
|
301
|
-
spacingFactor: 2,
|
|
302
|
-
// 间距
|
|
303
|
-
nestingFactor: 5,
|
|
304
|
-
// 嵌套因子
|
|
305
|
-
gravity: 0,
|
|
306
|
-
// 无中心引力
|
|
307
|
-
numIter: 3e3,
|
|
308
|
-
// 增加迭代次数
|
|
309
|
-
tile: !0,
|
|
310
|
-
// 平铺布局
|
|
311
|
-
animate: "end",
|
|
312
|
-
// 动画时机
|
|
313
|
-
animationDuration: 1e3,
|
|
314
|
-
// 动画时长
|
|
315
|
-
randomize: !0,
|
|
316
|
-
// 随机初始位置
|
|
317
|
-
fit: !0,
|
|
318
|
-
// 是否适应画布
|
|
319
|
-
padding: 50,
|
|
320
|
-
// 内边距
|
|
321
|
-
nodeDimensionsIncludeLabels: !0
|
|
322
|
-
}), D = () => ({
|
|
323
|
-
name: "grid",
|
|
324
|
-
fit: !0,
|
|
325
|
-
// whether to fit the viewport to the graph
|
|
326
|
-
padding: 30,
|
|
327
|
-
// padding used on fit
|
|
328
|
-
boundingBox: void 0,
|
|
329
|
-
// constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
|
|
330
|
-
avoidOverlap: !0,
|
|
331
|
-
// prevents node overlap, may overflow boundingBox if not enough space
|
|
332
|
-
avoidOverlapPadding: 10,
|
|
333
|
-
// extra spacing around nodes when avoidOverlap: true
|
|
334
|
-
nodeDimensionsIncludeLabels: !1,
|
|
335
|
-
// Excludes the label when calculating node bounding boxes for the layout algorithm
|
|
336
|
-
spacingFactor: void 0,
|
|
337
|
-
// Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up
|
|
338
|
-
condense: !1,
|
|
339
|
-
// uses all available space on false, uses minimal space on true
|
|
340
|
-
rows: void 0,
|
|
341
|
-
// force num of rows in the grid
|
|
342
|
-
cols: void 0,
|
|
343
|
-
// force num of columns in the grid
|
|
344
|
-
position: function(e) {
|
|
124
|
+
// 层级分析样式 - 边高亮
|
|
125
|
+
{
|
|
126
|
+
selector: ".level-highlightedge",
|
|
127
|
+
style: {
|
|
128
|
+
"line-color": "#1976d2",
|
|
129
|
+
"target-arrow-color": "#1976d2",
|
|
130
|
+
width: 3,
|
|
131
|
+
opacity: 1
|
|
132
|
+
}
|
|
345
133
|
},
|
|
346
|
-
//
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
animationEasing: void 0,
|
|
354
|
-
// easing of animation if enabled
|
|
355
|
-
animateFilter: function(e, n) {
|
|
356
|
-
return !0;
|
|
357
|
-
},
|
|
358
|
-
// a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts
|
|
359
|
-
ready: void 0,
|
|
360
|
-
// callback on layoutready
|
|
361
|
-
stop: void 0,
|
|
362
|
-
// callback on layoutstop
|
|
363
|
-
transform: function(e, n) {
|
|
364
|
-
return n;
|
|
365
|
-
}
|
|
366
|
-
// transform a given node position. Useful for changing flow direction in discrete layouts
|
|
367
|
-
}), F = () => ({
|
|
368
|
-
name: "breadthfirst",
|
|
369
|
-
fit: !0,
|
|
370
|
-
// whether to fit the viewport to the graph
|
|
371
|
-
directed: !1,
|
|
372
|
-
// whether the tree is directed downwards (or edges can point in any direction if false)
|
|
373
|
-
direction: "downward",
|
|
374
|
-
// determines the direction in which the tree structure is drawn. The possible values are 'downward', 'upward', 'rightward', or 'leftward'.
|
|
375
|
-
padding: 30,
|
|
376
|
-
// padding on fit
|
|
377
|
-
circle: !1,
|
|
378
|
-
// put depths in concentric circles if true, put depths top down if false
|
|
379
|
-
grid: !1,
|
|
380
|
-
// whether to create an even grid into which the DAG is placed (circle:false only)
|
|
381
|
-
spacingFactor: 1,
|
|
382
|
-
// 值越小连线越短
|
|
383
|
-
boundingBox: void 0,
|
|
384
|
-
// constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
|
|
385
|
-
avoidOverlap: !0,
|
|
386
|
-
// prevents node overlap, may overflow boundingBox if not enough space
|
|
387
|
-
nodeDimensionsIncludeLabels: !1,
|
|
388
|
-
// Excludes the label when calculating node bounding boxes for the layout algorithm
|
|
389
|
-
roots: void 0,
|
|
390
|
-
// the roots of the trees
|
|
391
|
-
depthSort: void 0,
|
|
392
|
-
// a sorting function to order nodes at equal depth. e.g. function(a, b){ return a.data('weight') - b.data('weight') }
|
|
393
|
-
animate: !0,
|
|
394
|
-
// whether to transition the node positions
|
|
395
|
-
animationDuration: 500,
|
|
396
|
-
// duration of animation in ms if enabled
|
|
397
|
-
animationEasing: void 0,
|
|
398
|
-
// easing of animation if enabled,
|
|
399
|
-
animateFilter: function(e, n) {
|
|
400
|
-
return !0;
|
|
401
|
-
},
|
|
402
|
-
// a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts
|
|
403
|
-
ready: void 0,
|
|
404
|
-
// callback on layoutready
|
|
405
|
-
stop: void 0,
|
|
406
|
-
// callback on layoutstop
|
|
407
|
-
transform: function(e, n) {
|
|
408
|
-
return n;
|
|
134
|
+
// 层级分析样式 - 置灰
|
|
135
|
+
{
|
|
136
|
+
selector: ".level-grayed",
|
|
137
|
+
style: {
|
|
138
|
+
opacity: 0.15,
|
|
139
|
+
"text-opacity": 0.15
|
|
140
|
+
}
|
|
409
141
|
}
|
|
410
|
-
|
|
411
|
-
|
|
142
|
+
], n = ({ elements: c }) => {
|
|
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
|
+
};
|
|
412
186
|
export {
|
|
413
|
-
|
|
414
|
-
E as circle,
|
|
415
|
-
L as concentricLayout,
|
|
416
|
-
c as coseBilkentLayout,
|
|
417
|
-
k as coseLayout,
|
|
418
|
-
x as fcoseLayout,
|
|
419
|
-
I as fixNodesToEdges,
|
|
420
|
-
D as gridLayout,
|
|
421
|
-
w as layout,
|
|
422
|
-
y as randomLayout
|
|
187
|
+
n as edgeNodeStyles
|
|
423
188
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SearchType } from './types';
|
|
2
|
-
declare const CytoscapeReact: ({ data, getAllGraphData, searchType, highPathAnalysis, graphInfo }: {
|
|
2
|
+
declare const CytoscapeReact: ({ data, getAllGraphData, searchType, highPathAnalysis, graphInfo, stepNextApi, knowledgeCardApi }: {
|
|
3
3
|
data: any;
|
|
4
4
|
getAllGraphData: any;
|
|
5
5
|
searchType?: SearchType;
|
package/package.json
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-kggraph",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "A knowledge graph visualization component based on Cytoscape",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.es.js",
|
|
7
7
|
"module": "./lib/index.es.js",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"import": "./lib/index.es.js"
|
|
10
|
+
"import": "./lib/index.es.js",
|
|
11
|
+
"style": "./lib/react-kggraph.css"
|
|
11
12
|
},
|
|
12
|
-
"./
|
|
13
|
+
"./react-kggraph.css": "./lib/react-kggraph.css",
|
|
14
|
+
"./lib/components/Graph/react-kggraph.css": "./lib/react-kggraph.css"
|
|
13
15
|
},
|
|
14
16
|
"files": [
|
|
15
17
|
"lib"
|
|
16
18
|
],
|
|
17
|
-
"style": "lib/
|
|
19
|
+
"style": "lib/components/Graph/CytoscapeReact.css",
|
|
18
20
|
"keywords": [
|
|
19
21
|
"knowledge-graph",
|
|
20
22
|
"cytoscape",
|
package/lib/index.es16.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as u, useContext as g, useState as o, useRef as m, useEffect as w, useImperativeHandle as C } from "react";
|
|
3
|
-
import { Drawer as h } from "antd";
|
|
4
|
-
import { fullSearchDetail as x } from "./index.es7.js";
|
|
5
|
-
import { GraphContext as y } from "./index.es15.js";
|
|
6
|
-
const G = u((D, l) => {
|
|
7
|
-
const { graphInfo: f } = g(y), [t, a] = o(!1), [I, s] = o(!1), [k, c] = o(!1), [v, d] = o({ style: {}, data: {} }), r = m(null);
|
|
8
|
-
w(() => {
|
|
9
|
-
t && r.current && (r.current.scrollTop = 0);
|
|
10
|
-
}, [t]), C(l, () => ({
|
|
11
|
-
open: (e) => {
|
|
12
|
-
a(!0), d(e), i(e);
|
|
13
|
-
},
|
|
14
|
-
close: () => a(!1)
|
|
15
|
-
}));
|
|
16
|
-
const i = async (e) => {
|
|
17
|
-
s(!0);
|
|
18
|
-
const p = await x({ kgId: f.kgId, uri: e.id });
|
|
19
|
-
console.log(44, e), c(p.data), s(!1);
|
|
20
|
-
};
|
|
21
|
-
return /* @__PURE__ */ n(
|
|
22
|
-
h,
|
|
23
|
-
{
|
|
24
|
-
title: "知识卡片",
|
|
25
|
-
onClose: () => {
|
|
26
|
-
a(!1);
|
|
27
|
-
},
|
|
28
|
-
open: t,
|
|
29
|
-
getContainer: !1,
|
|
30
|
-
className: "knowledge-card-drawer",
|
|
31
|
-
bodyStyle: { padding: "0 20px", overflow: "auto" },
|
|
32
|
-
children: /* @__PURE__ */ n("div", { ref: r, style: { height: "100%" } })
|
|
33
|
-
}
|
|
34
|
-
);
|
|
35
|
-
});
|
|
36
|
-
export {
|
|
37
|
-
G as default
|
|
38
|
-
};
|