forked from react-grid-layout/react-draggable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
62 lines (52 loc) · 1.5 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import * as React from 'react';
export interface DraggableBounds {
left: number
right: number
top: number
bottom: number
}
export interface DraggableProps extends DraggableCoreProps {
axis: 'both' | 'x' | 'y' | 'none',
bounds: DraggableBounds | string | false ,
defaultClassName: string,
defaultClassNameDragging: string,
defaultClassNameDragged: string,
defaultPosition: ControlPosition,
position: ControlPosition
}
// eslint-disable-next-line no-use-before-define
export type DraggableEventHandler = (e: MouseEvent, data: DraggableData) => void | false;
export interface DraggableData {
node: HTMLElement,
x: number, y: number,
deltaX: number, deltaY: number,
lastX: number, lastY: number
}
export type Bounds = {
left: number, top: number, right: number, bottom: number
};
export type ControlPosition = {x: number, y: number};
export type EventHandler<T> = (e: T) => void | false;
export interface DraggableCoreProps {
allowAnyClick: boolean,
cancel: string,
disabled: boolean,
enableUserSelectHack: boolean,
offsetParent: HTMLElement,
grid: [number, number],
handle: string,
onStart: DraggableEventHandler,
onDrag: DraggableEventHandler,
onStop: DraggableEventHandler,
onMouseDown: (e: MouseEvent) => void
}
class Draggable extends React.Component<Partial<DraggableProps>, DraggableState> {
}
class DraggableCore extends React.Component<Partial<DraggableCoreProps>, DraggableState> {
}
declare module 'react-draggable' {
export {
Draggable,
DraggableCore
}
}