fix(core): correct return type of getIncomers & getOutgoers
Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -66,7 +66,6 @@ export default {
|
||||
width: `${width > 100 ? 100 : width}%`,
|
||||
}"
|
||||
>
|
||||
<!-- todo: rename to `pattern -->
|
||||
<slot :id="patternId" name="pattern-container">
|
||||
<pattern
|
||||
:id="patternId"
|
||||
|
||||
@@ -32,6 +32,12 @@ function createKeyPredicate(keyFilter: KeyFilter, pressedKeys: Set<string>): Key
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Reactive key press state
|
||||
*
|
||||
* @param keyFilter - Can be a boolean, a string or an array of strings. If it's a boolean, it will always return that value. If it's a string, it will return true if the key is pressed. If it's an array of strings, it will return true if any of the keys are pressed, or a combination is pressed (e.g. ['ctrl+a', 'ctrl+b'])
|
||||
* @param onChange - Callback function that will be called when the key state changes
|
||||
*/
|
||||
export default (keyFilter: MaybeRef<KeyFilter | null>, onChange?: (keyPressed: boolean) => void): Ref<boolean> => {
|
||||
const window = useWindow()
|
||||
|
||||
@@ -42,7 +48,9 @@ export default (keyFilter: MaybeRef<KeyFilter | null>, onChange?: (keyPressed: b
|
||||
const pressedKeys = $ref<Set<string>>(new Set())
|
||||
|
||||
watch($$(isPressed), () => {
|
||||
if (onChange && typeof onChange === 'function') onChange(isPressed)
|
||||
if (onChange && typeof onChange === 'function') {
|
||||
onChange(isPressed)
|
||||
}
|
||||
})
|
||||
|
||||
watchEffect(() => {
|
||||
|
||||
@@ -131,7 +131,7 @@ const getConnectedElements = (node: GraphNode, elements: Elements, dir: 'source'
|
||||
if (!isNode(node)) return []
|
||||
const origin = dir === 'source' ? 'target' : 'source'
|
||||
const ids = elements.filter((e) => isEdge(e) && e[origin] === node.id).map((e) => isEdge(e) && e[dir])
|
||||
return elements.filter((e) => ids.includes(e.id))
|
||||
return elements.filter((e) => ids.includes(e.id)) as GraphEdge[]
|
||||
}
|
||||
export const getOutgoers = (node: GraphNode, elements: Elements) => getConnectedElements(node, elements, 'target')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user