-
Notifications
You must be signed in to change notification settings - Fork 148
/
index.ts
43 lines (34 loc) · 1.31 KB
/
index.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
import * as constants from './src/constants';
import container from './src/container';
import * as dropHandlers from './src/dropHandlers';
import { SmoothDnDCreator, ContainerOptions } from './src/exportTypes';
import { ElementX } from './src/interfaces';
export * from './src/exportTypes';
export {
container as smoothDnD,
constants,
dropHandlers,
};
function delegateProperty(from: any, to:any, propName: string) {
Object.defineProperty(from, propName, {
set: (val?: boolean) => {
to[propName] = val;
},
get: () => to[propName]
})
}
const deprecetedDefaultExport: SmoothDnDCreator = function(element: ElementX, options?: ContainerOptions) {
console.warn('default export is deprecated. please use named export "smoothDnD"');
return container(element, options);
};
deprecetedDefaultExport.cancelDrag = function () {
container.cancelDrag();
}
deprecetedDefaultExport.isDragging = function () {
return container.isDragging();
}
delegateProperty(deprecetedDefaultExport, container, 'useTransformForGhost');
delegateProperty(deprecetedDefaultExport, container, 'maxScrollSpeed');
delegateProperty(deprecetedDefaultExport, container, 'wrapChild');
delegateProperty(deprecetedDefaultExport, container, 'dropHandler');
export default deprecetedDefaultExport;