///
import { CardProps } from '../container-menu';
export declare enum LayoutStyle {
Org = 0,
List = 1
}
export declare type CreateTreeNode = {
data: {
layoutStyle: LayoutStyle;
parent: string;
[key: string]: any;
};
};
export declare type TreeNode = {
data: {
id: string;
layoutStyle: LayoutStyle;
parent: string;
[key: string]: any;
};
};
export interface NodeProps {
actions?: UseDndTreeActionsProps;
isActive: boolean;
isDraggedNode: boolean;
treeModes: TreeModes;
node: TreeNode;
onNodeClicked: (nodeId: string) => void;
treeOptions?: TreeOptions;
DragHandle: React.FC;
}
export declare type TreeNodeUnflattened = (TreeNode & {
children: TreeNodeUnflattened[];
}) | null;
export declare type TreeNodesUnflattened = TreeNodeUnflattened[];
export declare type TreeNodes = TreeNode[];
export declare type TreeBranch = {
id: string;
children?: TreeBranch[];
};
export declare type TreeData = {
nodes: TreeNodes;
};
export declare type TreeDataUnflattened = {
nodes: TreeNodesUnflattened;
};
export interface NodeWrapperProps {
actions: UseDndTreeActionsProps;
treeOptions?: TreeOptions;
treeModes: TreeModes;
expanded?: boolean;
node: TreeNodeUnflattened;
isChildOfOrg: boolean;
isFirstChild: boolean;
isLastChild: boolean;
isList: boolean;
hasParent: boolean;
hasChildren: boolean;
}
export declare type AddChildNodeServerFn = (args: {
component: string;
newComponent?: string;
}) => void;
export declare type DeleteNodeServerFn = (nodeId: string) => void;
export declare type InsertSiblingBeforeServerFn = (args: {
component: string;
newComponent?: string;
}) => void;
export declare type InsertSiblingAfterServerFn = (args: {
component: string;
newComponent?: string;
}) => void;
export declare type InsertParentServerFn = (args: {
component: string;
newComponent?: string;
}) => void;
export declare type MoveNodeServerFn = (args: {
nodeKey: string;
index: number;
parentKey: string;
}) => void;
export declare type CreateNewNodeFn = (args: CreateTreeNode) => TreeNode;
export declare type AddChildNodeFn = (node: TreeNode | TreeNodeUnflattened) => void;
export declare type DeleteNodeFn = (nodeId: string) => void;
export declare type InsertSiblingBeforeFn = (beforeNode: TreeNode | TreeNodeUnflattened) => void;
export declare type InsertSiblingAfterFn = (afterNode: TreeNode | TreeNodeUnflattened) => void;
export declare type InsertParentFn = (nodeId: string) => void;
export declare type MoveNodeFn = (args: {
droppedNode: TreeNodeUnflattened;
parentContainerNode: TreeNodeUnflattened;
index: number;
}) => void;
export declare type SetNodeDraggingIdFn = (nodeId: string | null) => void;
export interface DnDTreesActionsProps {
addChildNode?: AddChildNodeServerFn;
createNewNode?: CreateNewNodeFn;
deleteNode?: DeleteNodeServerFn;
insertSiblingBefore?: InsertSiblingBeforeServerFn;
insertParent?: InsertParentServerFn;
insertSiblingAfter?: InsertSiblingAfterServerFn;
moveNode?: MoveNodeServerFn;
setNodeDraggingId?: SetNodeDraggingIdFn;
}
export interface UseDndTreeActionsProps {
collapseNode: (nodeId: string) => void;
expandNode: (nodeId: string) => void;
toggleNode: (nodeId: string) => void;
addChildNode: AddChildNodeFn;
createNewNode: CreateNewNodeFn;
deleteNode: DeleteNodeFn;
insertSiblingBefore: InsertSiblingBeforeFn;
insertParent: InsertParentFn;
insertSiblingAfter: InsertSiblingAfterFn;
moveNode: MoveNodeFn;
setNodeDraggingId: SetNodeDraggingIdFn;
}
export declare type TreeOptions = {
canExpandCollapse?: boolean;
canEditTreeStructure?: boolean;
};
export declare type TreeModes = {
dragDropMode: boolean;
};
export declare type Modes = {
treeModes: TreeModes;
actions: {
setDragDropMode: (dragDrop: boolean) => void;
};
};
export interface DnDTreesProps {
actions?: DnDTreesActionsProps;
treeData: TreeData;
components: {
TreeMenu?: {
Menu: React.FC;
cardProps?: CardProps;
};
Node: React.FC;
};
treeOptions?: TreeOptions;
onNodeClicked?: (nodeId: string) => void;
activeNode?: string;
}
export interface DragHandleWrapperProps {
isDraggedNode: boolean;
nodeId: string;
handle?: JSX.Element;
}