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">
107 lines • 4.32 kB
TypeScript
import { HtmlElementRefState } from "./htmlElementRefState";
import { LinkState } from "./linkState";
import { INodeComponentSettings } from "./nodesSettings";
import { IPortExport, IPortState, PortState } from "./portState";
import { RootStore } from "./rootStore";
import { Dictionary } from "../utils/common";
import { Point } from "../utils/point";
import { SuccessOrErrorResult } from "../utils/result";
import { PropertyChange } from "./callbacks";
export declare class NodeState {
private _id;
private _label?;
private _position;
private _ports;
private _ref;
private _type?;
private _selected;
private _hovered;
private _data?;
private _isSelectionEnabled?;
private _isDragEnabled?;
private _isDragActive;
private _rootStore;
constructor(rootStore: RootStore, id: string, state?: INodeStateWithoutId);
import: (newState?: INodeStateWithoutId | undefined) => void;
export: () => INodeExport;
get id(): string;
get label(): string | undefined;
setLabel: (value?: string | null | undefined) => PropertyChange<string | undefined> | undefined;
private _setLabel;
get position(): Point;
/**
* @param newPosition - new position
* @param ignoreSnapping - do not take into account snapping to grid
* @returns `undefined` if position did not change
*/
setPosition: (newPosition: Point, ignoreSnapping?: boolean) => PropertyChange<Point> | undefined;
private _setPosition;
/**
* @param vector - vector to move node by
* @param ignoreSnapping - do not take into account snapping to grid
* @returns remainder in case snap to grid is turned on. For example if vector
* would be [3,9], node current position [10,10] and snap [5,5],
* the node position would be set to [10,15] and remainder equals [3,4]
*/
moveBy: (vector: Point, ignoreSnapping?: boolean) => Point | undefined;
get type(): string;
setType: (value: string | null | undefined) => PropertyChange<string | undefined> | undefined;
private _setType;
get hovered(): boolean;
set hovered(value: boolean);
get data(): any;
setData: (value?: any) => PropertyChange<any> | undefined;
private _setData;
get ref(): HtmlElementRefState;
get ports(): ReadonlyMap<string, PortState>;
setPorts: (nodePorts?: IPortState[] | undefined) => void;
getPort: (portId: string) => PortState | undefined;
addPort: (port: IPortState) => SuccessOrErrorResult<PortState>;
removePort: (portId: string) => boolean;
getPortOrThrowException: (portId: string) => PortState;
private _createPortState;
get connectedExternalPorts(): Dictionary<PortState[]>;
get connectedLinks(): LinkState[];
recalculatePortsOffset: () => void;
get transformString(): string;
get componentDefinition(): import("./visualComponentState").VisualComponentState<import("./nodesSettings").INodeVisualComponentProps<INodeComponentSettings>, INodeComponentSettings>;
get selected(): boolean;
set selected(value: boolean);
get isSelectionEnabled(): boolean;
setIsSelectionEnabled: (value: boolean | null | undefined) => PropertyChange<boolean | undefined> | undefined;
private _setIsSelectionEnabled;
get isDragEnabled(): boolean;
setIsDragEnabled: (value: boolean | null | undefined) => PropertyChange<boolean | undefined> | undefined;
private _setIsDragEnabled;
get isDragActive(): boolean;
set isDragActive(value: boolean);
}
export interface INodeStateWithoutId {
label?: string;
position: Point;
type?: string;
data?: any;
isSelectionEnabled?: boolean;
isDragEnabled?: boolean;
ports?: IPortState[];
}
export interface INodeStateWithId extends INodeStateWithoutId {
id: string;
}
export interface INodeExport extends INodeStateWithId {
id: string;
ports: IPortExport[];
}
export interface INodeState extends INodeStateWithoutId {
id?: string;
}
export interface INodeStateDiff {
label?: string | null;
position?: Point;
type?: string;
data?: any;
isSelectionEnabled?: boolean;
isDragEnabled?: boolean;
ports?: IPortState[];
}
//# sourceMappingURL=nodeState.d.ts.map