UNPKG

1.47 kBTypeScriptView Raw
1declare module 'vuedraggable' {
2 import Vue, { VueConstructor } from 'vue';
3
4 type CombinedVueInstance<
5 Instance extends Vue,
6 Data,
7 Methods,
8 Computed,
9 Props
10 > = Data & Methods & Computed & Props & Instance;
11
12 type ExtendedVue<
13 Instance extends Vue,
14 Data,
15 Methods,
16 Computed,
17 Props
18 > = VueConstructor<
19 CombinedVueInstance<Instance, Data, Methods, Computed, Props> & Vue
20 >;
21
22 export type DraggedContext<T> = {
23 index: number;
24 futureIndex: number;
25 element: T;
26 };
27
28 export type DropContext<T> = {
29 index: number;
30 component: Vue;
31 element: T;
32 };
33
34 export type Rectangle = {
35 top: number;
36 right: number;
37 bottom: number;
38 left: number;
39 width: number;
40 height: number;
41 };
42
43 export type MoveEvent<T> = {
44 originalEvent: DragEvent;
45 dragged: Element;
46 draggedContext: DraggedContext<T>;
47 draggedRect: Rectangle;
48 related: Element;
49 relatedContext: DropContext<T>;
50 relatedRect: Rectangle;
51 from: Element;
52 to: Element;
53 willInsertAfter: boolean;
54 isTrusted: boolean;
55 };
56
57 const draggable: ExtendedVue<
58 Vue,
59 {},
60 {},
61 {},
62 {
63 options: any;
64 list: any[];
65 value: any[];
66 noTransitionOnDrag?: boolean;
67 clone: any;
68 tag?: string | null;
69 move: any;
70 componentData: any;
71 }
72 >;
73
74 export default draggable;
75}