refactor(edges): add BaseEdge

This commit is contained in:
moklick
2022-03-14 16:27:44 +01:00
parent b362c11851
commit bc5d1df10e
9 changed files with 124 additions and 162 deletions
+18 -1
View File
@@ -4,7 +4,6 @@ import { HandleElement } from './handles';
import { Node } from './nodes';
import { Position } from './utils';
// interface for the user edge items
export interface Edge<T = any> {
id: string;
@@ -65,6 +64,23 @@ export interface EdgeProps<T = any> {
curvature?: number;
}
export type BaseEdgeProps = Pick<
EdgeProps,
| 'label'
| 'labelStyle'
| 'labelShowBg'
| 'labelBgStyle'
| 'labelBgPadding'
| 'labelBgBorderRadius'
| 'style'
| 'markerStart'
| 'markerEnd'
> & {
centerX: number;
centerY: number;
path: string;
};
export type EdgeMouseHandler = (event: React.MouseEvent, edge: Edge) => void;
export interface WrapEdgeProps<T = any> {
@@ -127,6 +143,7 @@ export enum ConnectionLineType {
Straight = 'straight',
Step = 'step',
SmoothStep = 'smoothstep',
SimpleBezier = 'simplebezier',
}
export type ConnectionLineComponentProps = {