feat: Add instance to store
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -197,6 +197,7 @@ invoke(async () => {
|
|||||||
}
|
}
|
||||||
store.hooks.load.trigger(instance)
|
store.hooks.load.trigger(instance)
|
||||||
store.isReady = true
|
store.isReady = true
|
||||||
|
store.instance = instance
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ export default function flowStore(
|
|||||||
actions: {
|
actions: {
|
||||||
setElements(elements) {
|
setElements(elements) {
|
||||||
const { nextNodes, nextEdges } = parseElements(elements, this.nodes, this.edges, this.nodeExtent)
|
const { nextNodes, nextEdges } = parseElements(elements, this.nodes, this.edges, this.nodeExtent)
|
||||||
|
this.elements = elements
|
||||||
this.nodes = nextNodes
|
this.nodes = nextNodes
|
||||||
this.edges = nextEdges
|
this.edges = nextEdges
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ export const initialState = (): FlowState => ({
|
|||||||
isReady: false,
|
isReady: false,
|
||||||
hooks: createHooks(),
|
hooks: createHooks(),
|
||||||
storageKey: undefined,
|
storageKey: undefined,
|
||||||
|
instance: undefined,
|
||||||
|
|
||||||
vueFlowVersion: typeof __VUE_FLOW_VERSION__ !== 'undefined' ? __VUE_FLOW_VERSION__ : '-',
|
vueFlowVersion: typeof __VUE_FLOW_VERSION__ !== 'undefined' ? __VUE_FLOW_VERSION__ : '-',
|
||||||
})
|
})
|
||||||
|
|||||||
+13
-1
@@ -1,5 +1,16 @@
|
|||||||
import { Store } from 'pinia'
|
import { Store } from 'pinia'
|
||||||
import { Dimensions, ElementId, Elements, FlowOptions, Rect, SelectionRect, SnapGrid, Transform, XYPosition } from './types'
|
import {
|
||||||
|
Dimensions,
|
||||||
|
ElementId,
|
||||||
|
Elements,
|
||||||
|
FlowInstance,
|
||||||
|
FlowOptions,
|
||||||
|
Rect,
|
||||||
|
SelectionRect,
|
||||||
|
SnapGrid,
|
||||||
|
Transform,
|
||||||
|
XYPosition,
|
||||||
|
} from './types'
|
||||||
import { HandleType } from './handle'
|
import { HandleType } from './handle'
|
||||||
import { ConnectionMode, OnConnectEndFunc, OnConnectFunc, OnConnectStartFunc, OnConnectStopFunc } from './connection'
|
import { ConnectionMode, OnConnectEndFunc, OnConnectFunc, OnConnectStartFunc, OnConnectStopFunc } from './connection'
|
||||||
import { Edge, EdgeType } from './edge'
|
import { Edge, EdgeType } from './edge'
|
||||||
@@ -57,6 +68,7 @@ export interface FlowState extends FlowOptions {
|
|||||||
isReady: boolean
|
isReady: boolean
|
||||||
hooks: FlowHooks
|
hooks: FlowHooks
|
||||||
storageKey?: string
|
storageKey?: string
|
||||||
|
instance?: FlowInstance
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FlowGetters {
|
export interface FlowGetters {
|
||||||
|
|||||||
Reference in New Issue
Block a user