fix(node-toolbar): set default value for isVisible to undefined (#1785)
* fix(node-toolbar): set default value for isVisible to undefined Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com> * chore(changeset): add Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com> --------- Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
5
.changeset/olive-fishes-fetch.md
Normal file
5
.changeset/olive-fishes-fetch.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@vue-flow/node-toolbar": patch
|
||||
---
|
||||
|
||||
Set default value for `isVisible` to `undefined`
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed, inject, toRef } from 'vue'
|
||||
import { computed, inject } from 'vue'
|
||||
import type { GraphNode, Rect, ViewportTransform } from '@vue-flow/core'
|
||||
import { NodeIdInjection, Position, getRectOfNodes, useVueFlow } from '@vue-flow/core'
|
||||
|
||||
@@ -10,6 +10,7 @@ const props = withDefaults(defineProps<NodeToolbarProps>(), {
|
||||
position: Position.Top,
|
||||
offset: 10,
|
||||
align: 'center',
|
||||
isVisible: undefined,
|
||||
})
|
||||
|
||||
const contextNodeId = inject(NodeIdInjection, null)
|
||||
@@ -30,7 +31,7 @@ const nodes = computed(() => {
|
||||
}, [] as GraphNode[])
|
||||
})
|
||||
|
||||
const isActive = toRef(() =>
|
||||
const isActive = computed(() =>
|
||||
typeof props.isVisible === 'boolean'
|
||||
? props.isVisible
|
||||
: nodes.value.length === 1 && nodes.value[0].selected && getSelectedNodes.value.length === 1,
|
||||
|
||||
Reference in New Issue
Block a user