mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
add dragula definition
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import dragula = require("dragula");
|
||||
|
||||
// containers
|
||||
var d1 = dragula([document.querySelector('#left'), document.querySelector('#right')]);
|
||||
|
||||
// all options
|
||||
var d2 = dragula({
|
||||
isContainer: function (el) {
|
||||
return false;
|
||||
},
|
||||
moves: function (el, container, handle) {
|
||||
return true;
|
||||
},
|
||||
accepts: function (el, target, source, sibling) {
|
||||
return true;
|
||||
},
|
||||
invalid: function (el, target) {
|
||||
return el.tagName === 'A' || el.tagName === 'BUTTON';
|
||||
},
|
||||
direction: 'vertical',
|
||||
copy: false,
|
||||
revertOnSpill: false,
|
||||
removeOnSpill: false,
|
||||
delay: false,
|
||||
mirrorContainer: document.body
|
||||
});
|
||||
|
||||
// empty call
|
||||
var d3 = dragula();
|
||||
|
||||
|
||||
// drake API
|
||||
var drake = dragula({
|
||||
copy: true
|
||||
});
|
||||
|
||||
drake.containers.push(document.querySelector('#container'));
|
||||
@@ -0,0 +1 @@
|
||||
--experimentalDecorators --target ES5 --module amd
|
||||
@@ -0,0 +1,31 @@
|
||||
/// <reference path="dragula.d.ts" />
|
||||
|
||||
var d1 = dragula([document.querySelector('#left'), document.querySelector('#right')]);
|
||||
|
||||
var d2 = dragula({
|
||||
isContainer: function (el) {
|
||||
return false;
|
||||
},
|
||||
moves: function (el, container, handle) {
|
||||
return true;
|
||||
},
|
||||
accepts: function (el, target, source, sibling) {
|
||||
return true;
|
||||
},
|
||||
invalid: function (el, target) {
|
||||
return el.tagName === 'A' || el.tagName === 'BUTTON';
|
||||
},
|
||||
direction: 'vertical',
|
||||
copy: false,
|
||||
revertOnSpill: false,
|
||||
removeOnSpill: false,
|
||||
delay: false,
|
||||
mirrorContainer: document.body
|
||||
});
|
||||
|
||||
var d3 = dragula();
|
||||
|
||||
var drake = dragula({
|
||||
copy: true
|
||||
});
|
||||
drake.containers.push(document.querySelector('#container'));
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
Vendored
+46
@@ -0,0 +1,46 @@
|
||||
// Type definitions for dragula v2.1.2
|
||||
// Project: http://bevacqua.github.io/dragula/
|
||||
// Definitions by: Paul Welter <https://github.com/pwelter34/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module dragula {
|
||||
interface DragulaOptions {
|
||||
containers?: Element[];
|
||||
isContainer?: (el?: Element) => boolean;
|
||||
moves?: (el?: Element, container?: Element, handle?: Element) => boolean;
|
||||
accepts?: (el?: Element, target?: Element, source?: Element, sibling?: Element) => boolean;
|
||||
invalid?: (el?: Element, target?: Element) => boolean;
|
||||
direction?: string;
|
||||
copy?: boolean;
|
||||
revertOnSpill?: boolean;
|
||||
removeOnSpill?: boolean;
|
||||
delay?: boolean | number;
|
||||
mirrorContainer?: Element;
|
||||
}
|
||||
|
||||
interface Drake {
|
||||
containers: Element[];
|
||||
dragging: boolean;
|
||||
start(item:Element): void;
|
||||
end(): void;
|
||||
cancel(revert:boolean): void;
|
||||
cancel(): void;
|
||||
remove(): void;
|
||||
on(events: string, callback: Function): void;
|
||||
destroy(): void;
|
||||
}
|
||||
|
||||
interface Dragula {
|
||||
(containers: Element[], options: DragulaOptions): Drake;
|
||||
(containers: Element, options: DragulaOptions): Drake;
|
||||
(containers: Element[]): Drake;
|
||||
(options: DragulaOptions): Drake;
|
||||
(): Drake;
|
||||
}
|
||||
}
|
||||
|
||||
declare var dragula: dragula.Dragula;
|
||||
|
||||
declare module "dragula" {
|
||||
export = dragula;
|
||||
}
|
||||
Reference in New Issue
Block a user