react-layouts-builder
Version:
Lightweight and powerfull react layouts drag and drop
55 lines (54 loc) • 1.47 kB
TypeScript
import { ReactNode } from 'react';
export declare type OptionsDrop = {
item: LayoutType;
type?: string;
targetItemId: string;
position?: EnumPosition;
targetType?: string;
parentId?: string;
level?: number;
};
export declare type DropOptions = {
layouts: LayoutType;
target: LayoutType;
moved: LayoutType;
position?: string;
};
export declare type LayoutType = {
'@id'?: string;
'@type'?: string;
id?: string;
type?: string;
display?: Record<string, any>;
tag?: string;
childrens?: LayoutType[];
block?: Record<string, any>;
};
export declare type LayoutBuilderProps = {
layouts: LayoutType;
loading?: ReactNode;
renderComponent: (block: any) => ReactNode | JSX.Element;
onLayoutChange: (layouts: LayoutType) => void;
};
export declare enum EnumBlockType {
CONTAINER = "container",
CHILDREN = "row",
BLOCK = "block"
}
export declare enum EnumPosition {
TOP = "top",
BOTTOM = "bottom",
LEFT = "left",
RIGHT = "right"
}
export declare type CreateBlockOptions = {
layouts: LayoutType;
block: any;
targetedBlockId?: string;
};
export declare type CreateBlock = (options: CreateBlockOptions) => LayoutType;
export declare type CreateContainerOptions = {
layouts: LayoutType;
block: any;
};
export declare type CreateContainer = (options: CreateContainerOptions) => LayoutType;