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.es8.js
CHANGED
|
@@ -1,324 +1,423 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} else if (d === "edges") {
|
|
24
|
-
const r = n.data, { label: l } = r;
|
|
25
|
-
s[l] ? s[l] = s[l] + 1 : s[l] = 1;
|
|
26
|
-
} else
|
|
27
|
-
console.log("nonono");
|
|
28
|
-
}), {
|
|
29
|
-
typeListArr: e,
|
|
30
|
-
typeListObj: o,
|
|
31
|
-
relationListObj: s
|
|
32
|
-
};
|
|
33
|
-
}, te = (c, { graphData: o = [], typeObj: s, zktype: e, graphInfo: n = {} }) => {
|
|
34
|
-
let d = U(s);
|
|
35
|
-
const a = Object.keys(s), r = n.searchNodes || [], l = new Set(
|
|
36
|
-
(o == null ? void 0 : o.map((g) => {
|
|
37
|
-
var t, m, h;
|
|
38
|
-
return g.group === "nodes" ? (t = g.data) == null ? void 0 : t.id : ((m = g.data) == null ? void 0 : m.source) + "-" + ((h = g.data) == null ? void 0 : h.target);
|
|
39
|
-
}).filter(Boolean)) || []
|
|
40
|
-
), { nodes: i = [], links: p = [] } = c || {}, y = [], k = (g) => {
|
|
41
|
-
g.forEach((t) => {
|
|
42
|
-
var m, h;
|
|
43
|
-
if (!l.has(t.id)) {
|
|
44
|
-
const v = (m = t.properties) == null ? void 0 : m.type, f = t.type, E = t.label.split("#").pop();
|
|
45
|
-
let w = -1;
|
|
46
|
-
if (!f && v === "uri")
|
|
47
|
-
w = t.image || L[0];
|
|
48
|
-
else if (!a.includes(f) && v === "uri") {
|
|
49
|
-
a.push(f);
|
|
50
|
-
const O = a.indexOf(f);
|
|
51
|
-
w = t.image || L[O] || L[0], d = { ...d, [f]: { ...d[f], img: w } };
|
|
52
|
-
} else v === "uri" && f && (w = (h = d[f]) == null ? void 0 : h.img);
|
|
53
|
-
const S = {
|
|
54
|
-
...t,
|
|
55
|
-
name: E,
|
|
56
|
-
"properties-type": v,
|
|
57
|
-
image: r.includes(E) ? B : w,
|
|
58
|
-
baseWidth: 80,
|
|
59
|
-
// 保存基础宽度
|
|
60
|
-
baseHeight: 80
|
|
61
|
-
// 保存基础高度
|
|
62
|
-
};
|
|
63
|
-
y.push({ group: "nodes", data: S });
|
|
64
|
-
}
|
|
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
|
+
});
|
|
65
23
|
});
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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,
|
|
71
37
|
});
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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();
|
|
92
86
|
break;
|
|
93
|
-
case "
|
|
94
|
-
|
|
95
|
-
...e,
|
|
96
|
-
"text-halign": "left",
|
|
97
|
-
"text-valign": "center",
|
|
98
|
-
"text-margin-x": "-5px"
|
|
99
|
-
};
|
|
87
|
+
case "concentric":
|
|
88
|
+
console.log("执行圆形布局"), o = L();
|
|
100
89
|
break;
|
|
101
|
-
case "
|
|
102
|
-
|
|
103
|
-
...e,
|
|
104
|
-
"text-halign": "right",
|
|
105
|
-
"text-valign": "center",
|
|
106
|
-
"text-margin-x": "5px"
|
|
107
|
-
};
|
|
90
|
+
case "grid":
|
|
91
|
+
console.log("执行网格布局"), o = D();
|
|
108
92
|
break;
|
|
109
|
-
case "
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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();
|
|
116
104
|
break;
|
|
117
|
-
case "
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
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
|
|
123
127
|
};
|
|
124
128
|
break;
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}, ne = async (c, { pathNodes: o, isGrayed: s = !0 }) => {
|
|
128
|
-
const e = c.current;
|
|
129
|
-
if (!e)
|
|
130
|
-
return;
|
|
131
|
-
if ((o == null ? void 0 : o.length) < 2) {
|
|
132
|
-
C.warning("请至少设置 2 个路径节点!");
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
if ([...new Set(o)].length !== o.length) {
|
|
136
|
-
C.warning("路径中存在重复节点,请检查!");
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
const d = [];
|
|
140
|
-
for (const a of o) {
|
|
141
|
-
const r = e.nodes().filter((l) => l.data("name") === a);
|
|
142
|
-
if (r.length > 0)
|
|
143
|
-
d.push(r.id());
|
|
144
|
-
else {
|
|
145
|
-
e.nodes().removeClass("path-node"), e.edges().removeClass("path-edge"), C.warning(`找不到节点:${a}`);
|
|
129
|
+
default:
|
|
130
|
+
console.warn("未知布局类型:", n);
|
|
146
131
|
return;
|
|
147
|
-
}
|
|
148
132
|
}
|
|
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
|
-
break;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
if (l && a.length > 0) {
|
|
179
|
-
const p = a.nodes(), y = a.edges();
|
|
180
|
-
p.addClass("path-node"), y.addClass("path-edge"), s && (e.nodes().not(p).addClass("grayed"), e.edges().not(y).addClass("grayed"));
|
|
181
|
-
} else
|
|
182
|
-
C.warning("无法找到完整的路径!");
|
|
183
|
-
} catch (a) {
|
|
184
|
-
console.error(2e3, "计算路径时出错:", a), C.warning("计算路径时出错,请重试!");
|
|
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;
|
|
150
|
+
},
|
|
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;
|
|
185
158
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
style: {
|
|
191
|
-
width: n.style("width"),
|
|
192
|
-
height: n.style("height"),
|
|
193
|
-
backgroundColor: n.style("background-color")
|
|
194
|
-
}
|
|
195
|
-
})), s = c.edges().map((n) => ({
|
|
196
|
-
data: n.data(),
|
|
197
|
-
style: {
|
|
198
|
-
width: n.style("width"),
|
|
199
|
-
"line-color": n.style("line-color"),
|
|
200
|
-
"target-arrow-color": n.style("target-arrow-color")
|
|
201
|
-
}
|
|
202
|
-
}));
|
|
203
|
-
return { nodes: o, edges: s };
|
|
204
|
-
}, ae = (c) => {
|
|
205
|
-
const o = T(c), s = new Blob([JSON.stringify(o, null, 2)], { type: "application/json" }), e = URL.createObjectURL(s), n = document.createElement("a");
|
|
206
|
-
n.href = e, n.download = `graph-data-${Date.now()}.json`, n.click(), URL.revokeObjectURL(e);
|
|
207
|
-
}, se = [
|
|
208
|
-
{
|
|
209
|
-
label: "网络布局",
|
|
210
|
-
key: "cose-bilkent"
|
|
159
|
+
// transform a given node position. Useful for changing flow direction in discrete layouts
|
|
160
|
+
}), k = () => ({
|
|
161
|
+
name: "cose",
|
|
162
|
+
ready: function() {
|
|
211
163
|
},
|
|
212
|
-
{
|
|
213
|
-
label: "弹性布局",
|
|
214
|
-
key: "fcose"
|
|
164
|
+
stop: function() {
|
|
215
165
|
},
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
166
|
+
animate: !0,
|
|
167
|
+
animationEasing: void 0,
|
|
168
|
+
animationDuration: void 0,
|
|
169
|
+
animateFilter: function(e, n) {
|
|
170
|
+
return !0;
|
|
219
171
|
},
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
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;
|
|
223
182
|
},
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
183
|
+
nodeOverlap: 4,
|
|
184
|
+
idealEdgeLength: function(e) {
|
|
185
|
+
return 32;
|
|
227
186
|
},
|
|
228
|
-
{
|
|
229
|
-
|
|
230
|
-
key: "concentric"
|
|
231
|
-
}
|
|
232
|
-
], le = [
|
|
233
|
-
{
|
|
234
|
-
label: "查询节点",
|
|
235
|
-
key: "query",
|
|
236
|
-
func: "queryNode"
|
|
187
|
+
edgeElasticity: function(e) {
|
|
188
|
+
return 32;
|
|
237
189
|
},
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
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;
|
|
242
228
|
},
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
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;
|
|
247
236
|
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
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();
|
|
252
268
|
},
|
|
253
|
-
{
|
|
254
|
-
|
|
255
|
-
key: "reverse"
|
|
269
|
+
levelWidth: function(e) {
|
|
270
|
+
return e.maxDegree() / 4;
|
|
256
271
|
},
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
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;
|
|
260
280
|
},
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
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;
|
|
264
288
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
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) {
|
|
277
345
|
},
|
|
278
|
-
// {
|
|
279
|
-
|
|
280
|
-
//
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
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;
|
|
285
357
|
},
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
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;
|
|
289
365
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
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;
|
|
306
401
|
},
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
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;
|
|
310
409
|
}
|
|
311
|
-
|
|
410
|
+
// transform a given node position. Useful for changing flow direction in discrete layouts
|
|
411
|
+
});
|
|
312
412
|
export {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
ce as textPositionConfig
|
|
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
|
|
324
423
|
};
|