@jalez/react-flow-automated-layout
Version:
A React library for automated layout of nested node graphs with parent-child relationships using React Flow
30 lines (29 loc) • 1.47 kB
TypeScript
import { ReactNode } from 'react';
import { Edge, Node } from '@xyflow/react';
import { LayoutAlgorithm, LayoutDirection, LayoutEngine, ParentResizingOptions, useLayoutContext } from './LayoutContext';
interface LayoutProviderProps {
children: ReactNode;
initialDirection?: LayoutDirection;
initialAlgorithm?: LayoutAlgorithm;
initialAutoLayout?: boolean;
initialPadding?: number;
initialSpacing?: {
node?: number;
layer?: number;
};
initialNodeDimensions?: {
width?: number;
height?: number;
};
initialParentResizingOptions?: Partial<ParentResizingOptions>;
includeHidden?: boolean;
layoutEngines?: Record<string, LayoutEngine>;
updateNodes?: (nodes: Node[]) => void;
updateEdges?: (edges: Edge[]) => void;
nodeParentIdMapWithChildIdSet?: Map<string, Set<string>>;
nodeIdWithNode?: Map<string, Node>;
noParentKey?: string;
disableAutoLayoutEffect?: boolean;
}
export declare function LayoutProvider({ children, initialDirection, initialAlgorithm, initialAutoLayout, initialPadding, initialSpacing, initialNodeDimensions, initialParentResizingOptions, includeHidden, layoutEngines: customEngines, updateNodes, updateEdges, nodeParentIdMapWithChildIdSet: externalNodeParentIdMapWithChildIdSet, nodeIdWithNode: externalNodeIdWithNode, noParentKey, disableAutoLayoutEffect, }: LayoutProviderProps): import("react/jsx-runtime").JSX.Element;
export { useLayoutContext };