UNPKG

react-easy-diagram

Version:

<img src="https://github.com/tokarchyn/react-easy-diagram/blob/main/repo/logo-with-name.png?raw=true" alt="React Easy Diagram logo" height="50">

108 lines 4.21 kB
import { Point } from "../utils/point"; import { DirectionWithDiagonals } from "../utils/position"; import { HtmlElementRefState } from "./htmlElementRefState"; import { LinkState } from "./linkState"; import { NodeState } from "./nodeState"; import { RootStore } from "./rootStore"; import { PortPosition } from "../hooks/useRelativePositionStyles"; export declare class PortState { private _id; private _label?; private _type?; private _data; private _linkDirection?; private _isConnectionEnabled?; private _position?; private _offsetFromNodeCenter?; private _offsetFromOrigin?; private _ref; private _dragging; private _hovered; private _validForConnection; private _offsetRecalculationRequested; private _triggerOffsetRecalculation; private _node; private _rootStore; constructor(rootStore: RootStore, node: NodeState, id: string, state?: IPortStateWithoutIds); get nodeComponentPortState(): IPortFinalState | undefined; get id(): string; get nodeId(): string; get fullId(): string; get ref(): HtmlElementRefState; get dragging(): boolean; set dragging(value: boolean); get hovered(): boolean; set hovered(value: boolean); get validForConnection(): boolean; set validForConnection(value: boolean); get label(): string | undefined; setLabel: (value: string | null | undefined) => void; get type(): string; setType: (value: string | null | undefined) => void; get position(): PortPosition | undefined; setPosition: (value: PortPosition | null | undefined) => void; get offsetFromNodeCenter(): number | undefined; setOffsetFromNodeCenter: (value: number | null | undefined) => void; get offsetFromOrigin(): Point | undefined; setOffsetFromOrigin: (value: Point | null | undefined) => void; /** * Update all properties. If some property missing in `state` parameter, the default one will be used. */ import: (state?: IPortStateWithoutIds | undefined) => void; /** * Update only those properties presented in `state` parameter */ update: (state?: IPortStateWithoutIds | undefined) => void; export: () => IPortExport; get data(): any; setData: (value: any) => void; get node(): NodeState; /** * Offset relative to parent node, helps us to calculate positions of link endpoints for example. * @returns offset excluding zoom */ get offsetRelativeToNode(): Point | null; recalculateOffset: () => void; recalculateOffsetImmediately: () => void; /** * Is used to trigger port rerendering and following offset recalculation */ get offsetRecalculationRequested(): number; get componentDefinition(): import("./visualComponentState").VisualComponentState<import("./portsSettings").IPortVisualComponentProps<any>, any>; get connectedLinks(): LinkState[]; get connectedPorts(): PortState[]; get linkDirection(): DirectionWithDiagonals | undefined; setLinkDirection: (value: DirectionWithDiagonals | undefined | null) => void; get isConnectionEnabled(): boolean; setIsConnectionEnabled: (value: boolean | null | undefined) => void; } export interface IPortFinalState { id: string; label?: string; type?: string; data?: any; linkDirection?: DirectionWithDiagonals; isConnectionEnabled?: boolean; position?: PortPosition; offsetFromNodeCenter?: number; offsetFromOrigin?: Point; } export interface IPortStateWithoutIds { label?: string | null; type?: string | null; data?: any; linkDirection?: DirectionWithDiagonals | null; isConnectionEnabled?: boolean | null; position?: PortPosition | null; offsetFromNodeCenter?: number | null; offsetFromOrigin?: Point | null; } export interface IPortState extends IPortStateWithoutIds { id: string; } export interface IPortExport extends IPortStateWithoutIds { id: string; nodeId: string; } export declare function createFullPortId(nodeId: string, portId: string): string; //# sourceMappingURL=portState.d.ts.map