refactor(useReactFlow): pass generic nodedata and edgedata closes #1944
This commit is contained in:
@@ -100,12 +100,12 @@ function applyChanges(changes: NodeChange[] | EdgeChange[], elements: any[]): an
|
||||
}, initElements);
|
||||
}
|
||||
|
||||
export function applyNodeChanges(changes: NodeChange[], nodes: Node[]): Node[] {
|
||||
return applyChanges(changes, nodes) as Node[];
|
||||
export function applyNodeChanges<NodeData = any>(changes: NodeChange[], nodes: Node<NodeData>[]): Node<NodeData>[] {
|
||||
return applyChanges(changes, nodes) as Node<NodeData>[];
|
||||
}
|
||||
|
||||
export function applyEdgeChanges(changes: EdgeChange[], edges: Edge[]): Edge[] {
|
||||
return applyChanges(changes, edges) as Edge[];
|
||||
export function applyEdgeChanges<EdgeData = any>(changes: EdgeChange[], edges: Edge<EdgeData>[]): Edge<EdgeData>[] {
|
||||
return applyChanges(changes, edges) as Edge<EdgeData>[];
|
||||
}
|
||||
|
||||
export const createSelectionChange = (id: string, selected: boolean) => ({
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { Selection as D3Selection } from 'd3';
|
||||
import { boxToRect, clamp, getBoundsOfBoxes, rectToBox } from '../utils';
|
||||
|
||||
import { boxToRect, clamp, getBoundsOfBoxes, rectToBox } from '../utils';
|
||||
import { Node, Edge, Connection, EdgeMarkerType, Transform, XYPosition, Rect, NodeInternals } from '../types';
|
||||
|
||||
export const isEdge = (element: Node | Connection | Edge): element is Edge =>
|
||||
|
||||
Reference in New Issue
Block a user