fix(store): Getter type
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import useState from './state'
|
import useState from './state'
|
||||||
|
import { ComputedGetters } from './getters'
|
||||||
import {
|
import {
|
||||||
Actions,
|
Actions,
|
||||||
ComputedGetters,
|
|
||||||
Connection,
|
Connection,
|
||||||
CoordinateExtent,
|
CoordinateExtent,
|
||||||
Edge,
|
Edge,
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
|
import { ComputedRef } from 'vue'
|
||||||
import { defaultEdgeTypes, defaultNodeTypes } from './state'
|
import { defaultEdgeTypes, defaultNodeTypes } from './state'
|
||||||
import { ComputedGetters, State, GraphEdge, GraphNode } from '~/types'
|
import { State, GraphEdge, GraphNode, Getters } from '~/types'
|
||||||
import { getNodesInside, isEdgeVisible } from '~/utils'
|
import { getNodesInside, isEdgeVisible } from '~/utils'
|
||||||
|
|
||||||
|
export type ComputedGetters<N = any, E = N> = { [key in keyof Getters<N, E>]: ComputedRef<Getters<N, E>[key]> }
|
||||||
|
|
||||||
export default (state: State): ComputedGetters => {
|
export default (state: State): ComputedGetters => {
|
||||||
const getEdgeTypes = computed(() => {
|
const getEdgeTypes = computed(() => {
|
||||||
const edgeTypes: Record<string, any> = {
|
const edgeTypes: Record<string, any> = {
|
||||||
|
|||||||
@@ -134,8 +134,6 @@ export interface Getters<N = any, E = N> {
|
|||||||
getSelectedEdges: GraphEdge<E>[]
|
getSelectedEdges: GraphEdge<E>[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ComputedGetters<N = any, E = N> = { [key in keyof Getters<N, E>]: ComputedRef<Getters<N, E>[key]> }
|
|
||||||
|
|
||||||
interface StoreBase<N = any, E = N> {
|
interface StoreBase<N = any, E = N> {
|
||||||
state: State<N, E>
|
state: State<N, E>
|
||||||
}
|
}
|
||||||
@@ -147,5 +145,5 @@ export type UseVueFlow<N = any, E = N> = {
|
|||||||
store: Store<N, E>
|
store: Store<N, E>
|
||||||
} & FlowHooksOn<N, E> &
|
} & FlowHooksOn<N, E> &
|
||||||
ToRefs<State<N, E>> &
|
ToRefs<State<N, E>> &
|
||||||
ComputedGetters<N, E> &
|
Getters<N, E> &
|
||||||
Actions<N, E>
|
Actions<N, E>
|
||||||
|
|||||||
Reference in New Issue
Block a user