feat(store, flow)!: Add apply changes handlers

* flow will not update changes unless a handler to apply changes is passed
* a default handler is available in the useVueFlow composable
* removeElements export removed
This commit is contained in:
Braks
2021-12-20 19:29:52 +01:00
parent f6007d026c
commit 81c8145f3a
19 changed files with 173 additions and 184 deletions
@@ -33,6 +33,7 @@ onMounted(() => {
store.hooks.nodesChange.trigger(nodeChanges)
store.hooks.edgesChange.trigger(edgeChanges)
store.nodesSelectionActive = false
store.resetSelectedElements()
}
})
@@ -56,9 +57,8 @@ export default {
<template>
<UserSelection v-if="store.selectionActive" :key="`user-selection-${store.id}`" />
<NodesSelection
v-if="store.selectedNodes.length && !store.selectionActive && store.nodesSelectionActive"
v-if="store.getSelectedNodes.length && !store.selectionActive && store.nodesSelectionActive"
:key="`nodes-selction-${store.id}`"
:nodes="store.selectedNodes"
/>
<div
:key="`flow-pane-${store.id}`"
+1 -1
View File
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import { createHooks, initFlow } from '../../composables'
import { createHooks, initFlow } from '../../store'
import type { FlowProps } from '../../types/flow'
import ZoomPane from '../ZoomPane/ZoomPane.vue'
+1
View File
@@ -212,6 +212,7 @@ nextTick(async () => {
}
store.hooks.paneReady.trigger(instance)
store.instance = instance
store.fitViewOnInit && instance.fitView()
})
</script>
<script lang="ts">