tdesign-react
Version:
TDesign Component for React
40 lines (39 loc) • 1.39 kB
TypeScript
import TreeNode from '@tdesign/common-js/tree-v1/tree-node';
import TreeStore from '@tdesign/common-js/tree-v1/tree-store';
import type { TreeProps } from '../Tree';
import type { TdTreeProps } from '../type';
interface Value {
props: TreeProps;
store: TreeStore;
}
export type BaseDragContextType = {
node: TreeNode;
e: React.DragEvent<HTMLDivElement>;
};
export type DragContextType = BaseDragContextType & {
dropPosition: number;
};
export type DropContextType = BaseDragContextType & {
dropPosition: number;
allowDrop?: TdTreeProps['allowDrop'];
};
export declare const TreeDraggableContext: {
Provider: (props: import("react").PropsWithChildren<{
value: Value;
}>) => import("react").JSX.Element;
use: () => {
onDragStart: (context: BaseDragContextType) => void;
onDragEnd: (context: BaseDragContextType) => void;
onDragOver: (context: DragContextType) => void;
onDragLeave: (context: DragContextType) => void;
onDrop: (context: DropContextType) => void;
};
};
export declare const useTreeDraggableContext: () => {
onDragStart: (context: BaseDragContextType) => void;
onDragEnd: (context: BaseDragContextType) => void;
onDragOver: (context: DragContextType) => void;
onDragLeave: (context: DragContextType) => void;
onDrop: (context: DropContextType) => void;
};
export {};