fix(nodes): clear all empty values before passing as props
Signed-off-by: bcakmakoglu <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -103,6 +103,8 @@ const updatePosition = (width: number, height: number) => {
|
|||||||
node.value.handleBounds = handleBounds
|
node.value.handleBounds = handleBounds
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const removeEmpty = (obj: Record<string, any>) => Object.fromEntries(Object.entries(obj).filter(([_, v]) => v != null))
|
||||||
|
|
||||||
store.updateNodePosition({ id: node.value.id, diff: { x: 0, y: 0 } })
|
store.updateNodePosition({ id: node.value.id, diff: { x: 0, y: 0 } })
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
const dimensions = ref(getDimensions(nodeElement.value))
|
const dimensions = ref(getDimensions(nodeElement.value))
|
||||||
@@ -166,57 +168,15 @@ export default {
|
|||||||
>
|
>
|
||||||
<slot
|
<slot
|
||||||
v-bind="{
|
v-bind="{
|
||||||
selected: node.selected,
|
|
||||||
connectable: props.connectable,
|
connectable: props.connectable,
|
||||||
sourcePosition: node.sourcePosition,
|
...removeEmpty(node),
|
||||||
targetPosition: node.targetPosition,
|
|
||||||
isValidTargetPos: node.isValidTargetPos,
|
|
||||||
isValidSourcePos: node.isValidSourcePos,
|
|
||||||
label: node.label,
|
|
||||||
class: node.class,
|
|
||||||
style: node.style,
|
|
||||||
hidden: node.hidden,
|
|
||||||
id: node.id,
|
|
||||||
type: node.type,
|
|
||||||
data: node.data,
|
|
||||||
dragging: node.dragging,
|
|
||||||
handleBounds: node.handleBounds,
|
|
||||||
parentNode: node.parentNode,
|
|
||||||
isParent: node.isParent,
|
|
||||||
computedPosition: node.computedPosition,
|
|
||||||
position: node.position,
|
|
||||||
draggable: props.draggable,
|
|
||||||
selectable: props.selectable,
|
|
||||||
children: node.children,
|
|
||||||
dimensions: node.dimensions,
|
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<component
|
<component
|
||||||
:is="props.component ?? node.type"
|
:is="props.component ?? node.type"
|
||||||
v-bind="{
|
v-bind="{
|
||||||
selected: node.selected,
|
|
||||||
connectable: props.connectable,
|
connectable: props.connectable,
|
||||||
sourcePosition: node.sourcePosition,
|
...removeEmpty(node),
|
||||||
targetPosition: node.targetPosition,
|
|
||||||
isValidTargetPos: node.isValidTargetPos,
|
|
||||||
isValidSourcePos: node.isValidSourcePos,
|
|
||||||
label: node.label,
|
|
||||||
class: node.class,
|
|
||||||
style: node.style,
|
|
||||||
hidden: node.hidden,
|
|
||||||
id: node.id,
|
|
||||||
type: node.type,
|
|
||||||
data: node.data,
|
|
||||||
dragging: node.dragging,
|
|
||||||
handleBounds: node.handleBounds,
|
|
||||||
parentNode: node.parentNode,
|
|
||||||
isParent: node.isParent,
|
|
||||||
computedPosition: node.computedPosition,
|
|
||||||
position: node.position,
|
|
||||||
draggable: props.draggable,
|
|
||||||
selectable: props.selectable,
|
|
||||||
children: node.children,
|
|
||||||
dimensions: node.dimensions,
|
|
||||||
}"
|
}"
|
||||||
/>
|
/>
|
||||||
</slot>
|
</slot>
|
||||||
|
|||||||
Reference in New Issue
Block a user