react-easy-diagram
Version:
<img src="https://github.com/tokarchyn/react-easy-diagram/blob/main/repo/logo-with-name.png?raw=true" alt="React Easy Diagram logo" height="50">
44 lines • 1.58 kB
TypeScript
import { RootStore } from "../../states/rootStore";
import { Point } from "../../utils/point";
import { INodeState } from "../../index";
interface DragAndDropBaseEvent {
/**
* Position of mouse or finger on the screen.
*/
pointerPosition: Point;
store: RootStore;
}
export interface DragAndDropEvent extends DragAndDropBaseEvent {
/**
* Position in diagram coordinates system (including zoom). Undefined if pointer is not above a diagram.
*/
position?: Point;
}
export interface DragAndDropStartEvent extends DragAndDropBaseEvent {
}
export interface DragAndDropItemProps {
/**
* Callback that will be called on drop.
*/
onDrop: (event: DragAndDropEvent) => any;
/**
* Callback that will be called on drag start. Return false to cancel drag.
*/
onDragStart?: (state: DragAndDropStartEvent) => false | any;
/**
* Callback that will be called during pointer movement.
*/
onDrag?: (event: DragAndDropEvent) => any;
/**
* Represents element to drag. It will be wrapped in another element with disabled user-select and touch-action.
*/
draggable: JSX.Element;
/**
* Element to render while dragging. Same as draggable if not provided.
*/
droppable?: JSX.Element;
}
export declare function DragAndDropItem(props: DragAndDropItemProps): JSX.Element;
export declare function createNodeOnDrop(node: Omit<INodeState, 'position'>): (event: DragAndDropEvent) => void;
export {};
//# sourceMappingURL=DragAndDropItem.d.ts.map