@gravity-ui/graph
Version:
Modern graph editor component
27 lines (26 loc) • 1.08 kB
TypeScript
import React from "react";
import { TBlock } from "../../components/canvas/blocks/Block";
import { Graph } from "../../graph";
import { Layer, LayerContext, LayerProps } from "../../services/Layer";
import { ICamera } from "../../services/camera/CameraService";
export type TReactLayerProps = LayerProps & {
camera: ICamera;
root: HTMLDivElement;
blockListClassName?: string;
};
export type TReactLayerContext = LayerContext & {
graph: Graph;
camera: ICamera;
};
export declare class ReactLayer extends Layer<TReactLayerProps, TReactLayerContext> {
constructor(props: TReactLayerProps);
protected afterInit(): void;
protected propsChanged(nextProps: TReactLayerProps): void;
private applyBlockListClassName;
/**
* Renders React components inside the layer's HTML element using React Portal
* @param renderBlock Function to render a block component
* @returns React Portal with BlocksList component
*/
renderPortal(renderBlock: <T extends TBlock>(graphObject: Graph, block: T) => React.JSX.Element): React.ReactPortal;
}