Compare commits
8 Commits
@antv/x6@1
...
v1
Author | SHA1 | Date | |
---|---|---|---|
b7d0c0bd62 | |||
753bc29dcc | |||
9f200a272d | |||
556121d68d | |||
2a132a2c19 | |||
6d37943855 | |||
1ca2114005 | |||
032cce51df |
@ -27,7 +27,7 @@
|
||||
"package:inherit": "yarn package-inherit update",
|
||||
"prepare": "is-ci || husky install configs/husky-config",
|
||||
"precommit": "yarn lint-staged && lerna run --concurrency 1 --stream precommit",
|
||||
"publish:latest": "yarn build:dev && lerna publish --no-private --ignore-scripts"
|
||||
"publish:latest": "lerna publish from-package --no-private --ignore-scripts --dist-tag v1"
|
||||
},
|
||||
"lint-staged": {
|
||||
"**/*.{js,jsx,tsx,ts,less,md,json}": [
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@antv/x6-react-shape",
|
||||
"version": "1.6.4",
|
||||
"version": "1.6.6",
|
||||
"description": "X6 shape for rendering react components.",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -31,9 +31,8 @@
|
||||
"build:watch:esm": "yarn build:esm --w",
|
||||
"build:watch:cjs": "yarn build:cjs --w",
|
||||
"build": "run-p build:cjs build:esm build:umd",
|
||||
"prebuild": "run-s lint clean",
|
||||
"prepare": "yarn build",
|
||||
"precommit": "lint-staged"
|
||||
"prebuild": "run-s clean",
|
||||
"prepare": "yarn build"
|
||||
},
|
||||
"lint-staged": {
|
||||
"src/**/*.ts": [
|
||||
|
@ -6,17 +6,24 @@ import { Portal } from './portal'
|
||||
import { Wrap } from './wrap'
|
||||
|
||||
export class ReactShapeView extends NodeView<ReactShape> {
|
||||
protected targetId() {
|
||||
return `${this.graph.view.cid}:${this.cell.id}`
|
||||
}
|
||||
|
||||
protected init() {
|
||||
super.init()
|
||||
this.cell.on('removed', () => {
|
||||
Portal.disconnect(this.cell.id)
|
||||
Portal.disconnect(this.targetId())
|
||||
})
|
||||
}
|
||||
|
||||
getComponentContainer() {
|
||||
return this.cell.prop('useForeignObject') === false
|
||||
? (this.selectors.content as SVGElement)
|
||||
: (this.selectors.foContent as HTMLDivElement)
|
||||
return (
|
||||
this.selectors &&
|
||||
(this.cell.prop('useForeignObject') === false
|
||||
? (this.selectors.content as SVGElement)
|
||||
: (this.selectors.foContent as HTMLDivElement))
|
||||
)
|
||||
}
|
||||
|
||||
confirmUpdate(flag: number) {
|
||||
@ -42,7 +49,7 @@ export class ReactShapeView extends NodeView<ReactShape> {
|
||||
const component = this.graph.hook.getReactComponent(node)
|
||||
const elem = React.createElement(Wrap, { graph, node, component })
|
||||
if (Portal.isActive()) {
|
||||
Portal.connect(this.cell.id, ReactDOM.createPortal(elem, root))
|
||||
Portal.connect(this.targetId(), ReactDOM.createPortal(elem, root))
|
||||
} else {
|
||||
ReactDOM.render(elem, root)
|
||||
}
|
||||
@ -58,7 +65,7 @@ export class ReactShapeView extends NodeView<ReactShape> {
|
||||
}
|
||||
|
||||
unmount() {
|
||||
Portal.disconnect(this.cell.id)
|
||||
Portal.disconnect(this.targetId())
|
||||
this.unmountReactComponent()
|
||||
super.unmount()
|
||||
return this
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@antv/x6",
|
||||
"version": "1.34.14",
|
||||
"version": "1.35.0",
|
||||
"description": "JavaScript diagramming library that uses SVG and HTML for rendering.",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -521,6 +521,11 @@ export class Transform extends Widget<Transform.Options> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected onRemove() {
|
||||
this.stopListening()
|
||||
super.onRemove()
|
||||
}
|
||||
}
|
||||
|
||||
export namespace Transform {
|
||||
|
@ -77,7 +77,7 @@ export namespace HTML {
|
||||
}
|
||||
|
||||
protected renderHTMLComponent() {
|
||||
const container = this.selectors.foContent
|
||||
const container = this.selectors && this.selectors.foContent
|
||||
if (container) {
|
||||
const $wrap = this.$(container).empty()
|
||||
const component = this.graph.hook.getHTMLComponent(this.cell)
|
||||
|
Reference in New Issue
Block a user