这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "antv-graphin-vue",
"version": "2.6.0",
"version": "2.6.3",
"description": "the vue toolkit for graph analysis based on g6, based on @antv/graphin",
"scripts": {
"prepare": "install-peers",
Expand All @@ -22,7 +22,7 @@
"vue-class-component": "^8.0.0-rc.1"
},
"dependencies": {
"@antv/graphin": "^2.6.0",
"@antv/graphin": "^2.6.3",
"@antv/graphin-icons": "^1.0.0",
"ant-design-vue": "^3.1.1"
},
Expand Down
10 changes: 9 additions & 1 deletion src/Graphin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,18 +255,25 @@ const Graphin = defineComponent({
watch(
() => props.data,
(v) => {
let newDragNodes: IUserNode[];

/** 数据变化 */
if (!deepEqual(toRaw(v), toRaw(self.data))) {
initData(v);

if (self.isTree) {
self.graph.changeData(self.data as TreeGraphData);
} else {
// 若 dragNodes 中的节点已经不存在,则从数组中删去
// @ts-ignore
newDragNodes = self.dragNodes.filter(
dNode => (self.data as GraphinData).nodes && (self.data as GraphinData).nodes.find(node => node.id === dNode.id),
);
// 更新拖拽后的节点的mass到data
// @ts-ignore
if (self.data.nodes && self.data.nodes.length > 0) {
self.data.nodes.forEach(node => {
const dragNode = contextRef.dragNodes.find(item => item.id === node.id);
const dragNode = newDragNodes.find(item => item.id === node.id);
if (dragNode) {
const { force={} } = dragNode.layout || {}
node.layout = {
Expand All @@ -292,6 +299,7 @@ const Graphin = defineComponent({

initStatus();
contextRef.apis = ApiController(self.graph as IGraph);
contextRef.dragNodes = self.dragNodes = newDragNodes || self.dragNodes
self.graph.emit('graphin:datachange');
}
},
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,10 @@
resolved "https://registry.yarnpkg.com/@antv/graphin-icons/-/graphin-icons-1.0.0.tgz#86ba9e9ab6565bfe2ea1096e8678e76c279053f1"
integrity sha512-2nogK6ZrDklnfIOJrqOAgD7iFLjfZIjLbA8pDUbeXN5c9b0Mu84oCfyqg8OmWwvi9Gt80eUzoplo73gKjZECJg==

"@antv/graphin@^2.6.0":
version "2.6.0"
resolved "https://registry.yarnpkg.com/@antv/graphin/-/graphin-2.6.0.tgz#5aa80858679fe5bd195469ce0bde1b44f1ecd553"
integrity sha512-0bD2aPSPYXxsPb5cmhmCCd5tgJqCaxF1DeM3LmszRp+KkE7utNw7tdR/+25Ta+K1dj1n5HI7QydagRQNTavxqw==
"@antv/graphin@^2.6.3":
version "2.6.3"
resolved "https://registry.yarnpkg.com/@antv/graphin/-/graphin-2.6.3.tgz#1ee3b6491aa7aada9bc9a8df77c84aab87b61000"
integrity sha512-go5xiIKtMhioS0yC2DSjBFsWih+69YTe3dALC6m7gRymLjUNW4SSdSy5GNDY8vZ7ZASfyGk8Nse1ILmlB8X+FA==
dependencies:
"@antv/g6" "^4.6.0-beta.3"
"@antv/util" "^2.0.10"
Expand Down