UNPKG

flowappplatform-appbuilder-graphs

Version:
56 lines (55 loc) 1.67 kB
/** * @class Connection */ import * as React from "react"; import { IComponent, IConnection } from "./interfaces/Component"; import { Text as KonvaText } from "konva"; import { IPort } from "./interfaces/ComponentDefinition"; export declare type ConnectionProps = { newConnection: false; fromComponent: IComponent; toComponent: IComponent | undefined; connection: IConnection; onClick(component: IComponent, connection: IConnection): void; index: number; connectionsSharingDirection: Array<IConnection | any>; connectionsSharingPath: Array<IConnection | any>; }; export declare type NewConnectionProps = { newConnection: true; fromComponent: IComponent; fromPort: IPort; mousePosition: { x: number; y: number; }; componentMousedOver: IComponent | null; }; export declare type Props = ConnectionProps | NewConnectionProps; export declare type State = { hovering: boolean; mouseX: number; mouseY: number; closeImageLoaded: boolean; }; export default class Connection extends React.Component<Props, State> { node: any; text: any; closeImage: HTMLImageElement; state: { hovering: boolean; mouseX: number; mouseY: number; closeImageLoaded: boolean; }; componentDidMount(): void; onNode: (node: any) => void; onHoverChange: (hovering: boolean) => void; getScaledPointerPosition: () => { x: number; y: number; }; onText: (text: KonvaText, i: number) => void; render(): JSX.Element | null; getTextExtension(index: number): string; }