fix(core,nodes): unwrap refs and pass props
Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -73,9 +73,9 @@ const NodeWrapper = defineComponent({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const getClass = computed(() => (node.class instanceof Function ? node.class(node) : node.class))
|
const getClass = $computed(() => (node.class instanceof Function ? node.class(node) : node.class))
|
||||||
|
|
||||||
const getStyle = computed(() => {
|
const getStyle = $computed(() => {
|
||||||
const styles = (node.style instanceof Function ? node.style(node) : node.style) || {}
|
const styles = (node.style instanceof Function ? node.style(node) : node.style) || {}
|
||||||
|
|
||||||
const width = node.width instanceof Function ? node.width(node) : node.width
|
const width = node.width instanceof Function ? node.width(node) : node.width
|
||||||
@@ -88,7 +88,7 @@ const NodeWrapper = defineComponent({
|
|||||||
return styles
|
return styles
|
||||||
})
|
})
|
||||||
|
|
||||||
const zIndex = computed(() => Number(node.zIndex ?? getStyle.value.zIndex ?? 0))
|
const zIndex = computed(() => Number(node.zIndex ?? getStyle.zIndex ?? 0))
|
||||||
|
|
||||||
onUpdateNodeInternals((updateIds) => {
|
onUpdateNodeInternals((updateIds) => {
|
||||||
if (updateIds.includes(props.id)) {
|
if (updateIds.includes(props.id)) {
|
||||||
@@ -176,14 +176,14 @@ const NodeWrapper = defineComponent({
|
|||||||
`vue-flow__node-${props.type === false ? 'default' : props.name}`,
|
`vue-flow__node-${props.type === false ? 'default' : props.name}`,
|
||||||
{
|
{
|
||||||
[noPanClassName]: props.draggable,
|
[noPanClassName]: props.draggable,
|
||||||
dragging,
|
dragging: dragging?.value,
|
||||||
selected: node.selected,
|
selected: node.selected,
|
||||||
selectable: props.selectable,
|
selectable: props.selectable,
|
||||||
},
|
},
|
||||||
getClass,
|
getClass,
|
||||||
],
|
],
|
||||||
'style': {
|
'style': {
|
||||||
zIndex: node.computedPosition.z ?? zIndex,
|
zIndex: node.computedPosition.z ?? zIndex.value,
|
||||||
transform: `translate(${node.computedPosition.x}px,${node.computedPosition.y}px)`,
|
transform: `translate(${node.computedPosition.x}px,${node.computedPosition.y}px)`,
|
||||||
pointerEvents: props.selectable || props.draggable ? 'all' : 'none',
|
pointerEvents: props.selectable || props.draggable ? 'all' : 'none',
|
||||||
visibility: node.initialized ? 'visible' : 'hidden',
|
visibility: node.initialized ? 'visible' : 'hidden',
|
||||||
@@ -209,13 +209,13 @@ const NodeWrapper = defineComponent({
|
|||||||
events: { ...node.events, ...on },
|
events: { ...node.events, ...on },
|
||||||
selected: !!node.selected,
|
selected: !!node.selected,
|
||||||
resizing: !!node.resizing,
|
resizing: !!node.resizing,
|
||||||
dragging,
|
dragging: dragging?.value,
|
||||||
connectable: props.connectable,
|
connectable: props.connectable,
|
||||||
position: node.position,
|
position: node.position,
|
||||||
dimensions: node.dimensions,
|
dimensions: node.dimensions,
|
||||||
isValidTargetPos: node.isValidTargetPos,
|
isValidTargetPos: node.isValidTargetPos,
|
||||||
isValidSourcePos: node.isValidSourcePos,
|
isValidSourcePos: node.isValidSourcePos,
|
||||||
parentNode: node.parentNode,
|
parentFoo: node.parentNode,
|
||||||
zIndex: node.computedPosition.z,
|
zIndex: node.computedPosition.z,
|
||||||
targetPosition: node.targetPosition,
|
targetPosition: node.targetPosition,
|
||||||
sourcePosition: node.sourcePosition,
|
sourcePosition: node.sourcePosition,
|
||||||
|
|||||||
Reference in New Issue
Block a user