react-kggraph 0.0.17 → 0.0.18
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/README.md +46 -0
- package/lib/index.es.js +8 -6
- package/lib/index.es10.js +186 -69
- package/lib/index.es11.js +71 -28
- package/lib/index.es12.js +29 -69
- package/lib/index.es13.js +70 -224
- package/lib/index.es14.js +224 -4
- package/lib/index.es15.js +4 -35
- package/lib/index.es16.js +37 -0
- package/lib/index.es18.js +15462 -49
- package/lib/index.es19.js +50 -56
- package/lib/index.es20.js +57 -66
- package/lib/index.es21.js +68 -39
- package/lib/index.es22.js +40 -2
- 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 +173 -155
- package/lib/index.es30.js +1 -1
- package/lib/index.es31.js +1 -1
- package/lib/index.es32.js +2 -2
- package/lib/index.es33.js +4 -0
- package/lib/index.es35.js +4 -2
- package/lib/index.es36.js +4 -0
- package/lib/index.es4.js +17 -6
- package/lib/index.es5.js +6 -2
- package/lib/index.es6.js +2 -599
- package/lib/index.es7.js +580 -312
- package/lib/index.es8.js +294 -393
- package/lib/index.es9.js +408 -173
- package/lib/src/components/Graph/components/ActionBar/actionList.d.ts +10 -0
- package/lib/src/components/Graph/components/ActionBar/index.d.ts +15 -0
- package/lib/src/components/Graph/types.d.ts +51 -0
- package/lib/src/components/Graph/utils/edge_node_styles.d.ts +5 -2
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/lib/index.es17.js +0 -15469
- package/lib/index.es34.js +0 -6
package/lib/index.es9.js
CHANGED
|
@@ -1,188 +1,423 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
const I = (e, n, r, o = 20) => {
|
|
2
|
+
const u = e.nodes(), i = u.filter((t) => t.data("name") === n), a = u.filter((t) => t.data("name") === r);
|
|
3
|
+
if (console.log(111, !i.data() || !a.data(), i.data(), a.data()), !i.data() || !a.data()) {
|
|
4
|
+
console.warn("fixNodesToEdges: 未找到左右节点", n, r);
|
|
5
|
+
const t = e.layout(c());
|
|
6
|
+
return t.run(), t.on("layoutstop", () => {
|
|
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;
|
|
7
150
|
},
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
}
|
|
151
|
+
// 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
|
|
152
|
+
ready: void 0,
|
|
153
|
+
// callback on layoutready
|
|
154
|
+
stop: void 0,
|
|
155
|
+
// callback on layoutstop
|
|
156
|
+
transform: function(e, n) {
|
|
157
|
+
return n;
|
|
158
|
+
}
|
|
159
|
+
// transform a given node position. Useful for changing flow direction in discrete layouts
|
|
160
|
+
}), k = () => ({
|
|
161
|
+
name: "cose",
|
|
162
|
+
ready: function() {
|
|
40
163
|
},
|
|
41
|
-
{
|
|
42
|
-
selector: ".highlight",
|
|
43
|
-
style: {
|
|
44
|
-
"border-color": "rgba(174, 255, 45, 0.2)",
|
|
45
|
-
"border-width": 4
|
|
46
|
-
}
|
|
164
|
+
stop: function() {
|
|
47
165
|
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
166
|
+
animate: !0,
|
|
167
|
+
animationEasing: void 0,
|
|
168
|
+
animationDuration: void 0,
|
|
169
|
+
animateFilter: function(e, n) {
|
|
170
|
+
return !0;
|
|
54
171
|
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
172
|
+
animationThreshold: 250,
|
|
173
|
+
refresh: 20,
|
|
174
|
+
fit: !0,
|
|
175
|
+
padding: 30,
|
|
176
|
+
boundingBox: void 0,
|
|
177
|
+
nodeDimensionsIncludeLabels: !1,
|
|
178
|
+
randomize: !1,
|
|
179
|
+
componentSpacing: 40,
|
|
180
|
+
nodeRepulsion: function(e) {
|
|
181
|
+
return 2048;
|
|
62
182
|
},
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
opacity: 0.15,
|
|
67
|
-
"text-opacity": 0.15
|
|
68
|
-
}
|
|
183
|
+
nodeOverlap: 4,
|
|
184
|
+
idealEdgeLength: function(e) {
|
|
185
|
+
return 32;
|
|
69
186
|
},
|
|
70
|
-
{
|
|
71
|
-
|
|
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
|
-
}
|
|
187
|
+
edgeElasticity: function(e) {
|
|
188
|
+
return 32;
|
|
78
189
|
},
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
190
|
+
nestingFactor: 1.2,
|
|
191
|
+
gravity: 1,
|
|
192
|
+
numIter: 8e3,
|
|
193
|
+
initialTemp: 1e3,
|
|
194
|
+
coolingFactor: 0.99,
|
|
195
|
+
minTemp: 1
|
|
196
|
+
}), E = () => ({
|
|
197
|
+
name: "circle",
|
|
198
|
+
fit: !0,
|
|
199
|
+
// whether to fit the viewport to the graph
|
|
200
|
+
padding: 30,
|
|
201
|
+
// the padding on fit
|
|
202
|
+
boundingBox: void 0,
|
|
203
|
+
// constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
|
|
204
|
+
avoidOverlap: !0,
|
|
205
|
+
// prevents node overlap, may overflow boundingBox and radius if not enough space
|
|
206
|
+
nodeDimensionsIncludeLabels: !1,
|
|
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;
|
|
96
228
|
},
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
229
|
+
// 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
|
|
230
|
+
ready: void 0,
|
|
231
|
+
// callback on layoutready
|
|
232
|
+
stop: void 0,
|
|
233
|
+
// callback on layoutstop
|
|
234
|
+
transform: function(e, n) {
|
|
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();
|
|
103
268
|
},
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
selector: ".level-selected",
|
|
107
|
-
style: {
|
|
108
|
-
"background-color": "#f8bbd0",
|
|
109
|
-
"border-color": "#e91e63",
|
|
110
|
-
"border-width": 4,
|
|
111
|
-
color: "#880e4f"
|
|
112
|
-
}
|
|
269
|
+
levelWidth: function(e) {
|
|
270
|
+
return e.maxDegree() / 4;
|
|
113
271
|
},
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
272
|
+
animate: !0,
|
|
273
|
+
// whether to transition the node positions
|
|
274
|
+
animationDuration: 500,
|
|
275
|
+
// duration of animation in ms if enabled
|
|
276
|
+
animationEasing: void 0,
|
|
277
|
+
// easing of animation if enabled
|
|
278
|
+
animateFilter: function(e, n) {
|
|
279
|
+
return !0;
|
|
123
280
|
},
|
|
124
|
-
//
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
281
|
+
// 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
|
|
282
|
+
ready: void 0,
|
|
283
|
+
// callback on layoutready
|
|
284
|
+
stop: void 0,
|
|
285
|
+
// callback on layoutstop
|
|
286
|
+
transform: function(e, n) {
|
|
287
|
+
return n;
|
|
288
|
+
}
|
|
289
|
+
// transform a given node position. Useful for changing flow direction in discrete layouts
|
|
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) {
|
|
133
345
|
},
|
|
134
|
-
//
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
346
|
+
// returns { row, col } for element
|
|
347
|
+
sort: void 0,
|
|
348
|
+
// a sorting function to order the nodes; e.g. function(a, b){ return a.data('weight') - b.data('weight') }
|
|
349
|
+
animate: !0,
|
|
350
|
+
// whether to transition the node positions
|
|
351
|
+
animationDuration: 500,
|
|
352
|
+
// duration of animation in ms if enabled
|
|
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;
|
|
141
365
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
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;
|
|
409
|
+
}
|
|
410
|
+
// transform a given node position. Useful for changing flow direction in discrete layouts
|
|
411
|
+
});
|
|
186
412
|
export {
|
|
187
|
-
|
|
413
|
+
F as breadthfirstLayout,
|
|
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
|
|
188
423
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface ActionBarItem {
|
|
3
|
+
key: string;
|
|
4
|
+
title: string;
|
|
5
|
+
/** 图标,可以是单个或多个 antd icon 组件 */
|
|
6
|
+
icon?: React.ReactNode[];
|
|
7
|
+
onClick?: (params?: any) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const actionList: ActionBarItem[];
|
|
10
|
+
export { actionList as default };
|
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { default as actionList, ActionBarItem } from './actionList.tsx';
|
|
3
|
+
export type { ActionBarItem };
|
|
4
|
+
export { actionList };
|
|
2
5
|
interface ActionBarProps {
|
|
3
6
|
cyRef: any;
|
|
4
7
|
graphInfo: any;
|
|
5
8
|
initNodeScale: number;
|
|
6
9
|
cyContainerRef: any;
|
|
10
|
+
colors?: any;
|
|
11
|
+
typeObj?: any;
|
|
12
|
+
relationObj?: any;
|
|
13
|
+
actionBar?: {
|
|
14
|
+
position?: 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | {
|
|
15
|
+
top?: string | number;
|
|
16
|
+
right?: string | number;
|
|
17
|
+
bottom?: string | number;
|
|
18
|
+
left?: string | number;
|
|
19
|
+
};
|
|
20
|
+
actionList?: ActionBarItem[];
|
|
21
|
+
};
|
|
7
22
|
}
|
|
8
23
|
declare const _default: React.ForwardRefExoticComponent<ActionBarProps & React.RefAttributes<unknown>>;
|
|
9
24
|
export default _default;
|