fix(edges): edges not reacting to hidden nodes

* Change getEdges to parse edges with source & target nodes and filter if one of them is missing
* add new type for Edges w sourceTargetNode called GraphEdge which is the return type of getEdges
*

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
Braks
2021-11-23 18:25:08 +01:00
parent cddf875b6d
commit d22e21041d
9 changed files with 76 additions and 107 deletions
+5 -4
View File
@@ -5,15 +5,16 @@ import {
ElementId,
Elements,
FitViewParams,
FlowOptions, Loading,
FlowOptions,
Loading,
Position,
XYPosition,
} from './flow'
import { Connection, ConnectionLineType, ConnectionMode } from './connection'
import { GraphNode, Node, NodeExtent, NodeTypes, TranslateExtent } from './node'
import { FlowStore } from '~/types/store'
import { EdgeTypes } from '~/types/edge'
import { KeyCode, PanOnScrollMode } from '~/types/zoom'
import { FlowStore } from './store'
import { EdgeTypes } from './edge'
import { KeyCode, PanOnScrollMode } from './zoom'
export type HandleType = 'source' | 'target'
+3 -3
View File
@@ -1,17 +1,17 @@
import { CSSProperties } from 'vue'
import { Edge, EdgeTypes, GraphEdge } from './edge'
import { Edge, EdgeTypes } from './edge'
import { NodeExtent, GraphNode, NodeTypes, TranslateExtent, Node } from './node'
import { ConnectionLineType, ConnectionMode } from './connection'
import { KeyCode, PanOnScrollMode } from './zoom'
import { FlowStore } from './store'
export type ElementId = string
export type FlowElement<T = any> = GraphNode<T> | GraphEdge<T>
export type FlowElement<T = any> = GraphNode<T> | Edge<T>
export type FlowElements<T = any> = FlowElement<T>[]
export type Elements<T = any> = (Node<T> | Edge<T>)[]
export type NextElements = {
nextNodes: GraphNode[]
nextEdges: GraphEdge[]
nextEdges: Edge[]
}
export type Transform = [number, number, number]
+2 -2
View File
@@ -21,7 +21,7 @@ import {
OnConnectStopFunc,
SetConnectionId,
} from './connection'
import { EdgeComponent, GraphEdge } from './edge'
import { Edge, EdgeComponent, GraphEdge } from './edge'
import { NodeComponent, NodeDiffUpdate, NodeDimensionUpdate, NodeExtent, GraphNode, NodePosUpdate, TranslateExtent } from './node'
import { D3Selection, D3Zoom, D3ZoomHandler, InitD3ZoomPayload } from './zoom'
import { FlowHooks } from './hooks'
@@ -29,7 +29,7 @@ import { FlowHooks } from './hooks'
export interface FlowState extends FlowOptions {
elements: FlowElements
nodes: GraphNode[]
edges: GraphEdge[]
edges: Edge[]
selectedElements?: FlowElements
selectedNodesBbox: Rect