react-lineage-dag
Advanced tools
Comparing version
{ | ||
"name": "react-lineage-dag", | ||
"version": "2.0.20", | ||
"version": "2.0.21", | ||
"description": "表格/字段血缘React组件", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -41,3 +41,3 @@ 'use strict'; | ||
}; | ||
console.log(result); | ||
return result; | ||
@@ -44,0 +44,0 @@ }; |
@@ -9,2 +9,3 @@ import {Canvas, Layout} from 'butterfly-dag'; | ||
super(opts); | ||
this._renderPromise = Promise.resolve(); | ||
this._focusItem = null; | ||
@@ -278,2 +279,9 @@ this._enableHoverChain = opts.data.enableHoverChain; | ||
} | ||
addNodes(nodes, isNotEventEmit) { | ||
let _addNodes = super.addNodes(nodes, isNotEventEmit); | ||
_addNodes.forEach((node) => { | ||
node._canvas = this; | ||
}); | ||
return _addNodes; | ||
} | ||
} |
@@ -20,2 +20,4 @@ import {Node} from 'butterfly-dag'; | ||
this.titlesList = []; | ||
this._renderPromise = Promise.resolve() | ||
} | ||
@@ -140,23 +142,28 @@ mounted() { | ||
titleDom = $(`<div class="title"></div>`); | ||
ReactDOM.render(titleRender(title, this), titleDom[0], () => { | ||
if (this.height === 0 || this.width === 0) { | ||
this.width = this.options.width = $(this.dom).width(); | ||
this.height = this.options.height = $(this.dom).height(); | ||
this.endpoints.forEach((item) => item.updatePos()); | ||
this.emit('custom.edge.redraw', { | ||
node: this | ||
}) | ||
} else { | ||
let points = []; | ||
this.endpoints.forEach((item) => { | ||
if (item.options._isNodeSelf) { | ||
item.updatePos(); | ||
points.push(item); | ||
(this._canvas ? this._canvas._renderPromise : Promise.resolve()).then(() => { | ||
this._renderPromise = new Promise((resolve, reject) => { | ||
ReactDOM.render(titleRender(title, this), titleDom[0], () => { | ||
if (this.height === 0 || this.width === 0) { | ||
this.width = this.options.width = $(this.dom).width(); | ||
this.height = this.options.height = $(this.dom).height(); | ||
this.endpoints.forEach((item) => item.updatePos()); | ||
this.emit('custom.edge.redraw', { | ||
node: this | ||
}) | ||
} else { | ||
let points = []; | ||
this.endpoints.forEach((item) => { | ||
if (item.options._isNodeSelf) { | ||
item.updatePos(); | ||
points.push(item); | ||
} | ||
}); | ||
this.emit('custom.edge.redraw', { | ||
node: this, | ||
points | ||
}) | ||
} | ||
resolve(); | ||
}); | ||
this.emit('custom.edge.redraw', { | ||
node: this, | ||
points | ||
}) | ||
} | ||
}); | ||
}); | ||
@@ -163,0 +170,0 @@ } else if (title) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
261960
1.47%4633
1.27%