@types/sortablejs
Advanced tools
Comparing version 1.3.32 to 1.7.0
@@ -1,205 +0,329 @@ | ||
// Type definitions for Sortable.js 1.3 | ||
// Type definitions for Sortable.js 1.7 | ||
// Project: https://github.com/RubaXa/Sortable | ||
// Definitions by: Maw-Fox <https://github.com/Maw-Fox> | ||
// Maarten Staa <https://github.com/maartenstaa> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// TypeScript Version: 2.1 | ||
import Sortable = Sortablejs.Sortable; | ||
export = Sortable; | ||
export as namespace Sortable; | ||
declare namespace Sortablejs { | ||
interface SortableOptions { | ||
group?: any; | ||
sort?: boolean; | ||
declare class Sortable { | ||
public options: Sortable.Options; | ||
public el: HTMLElement; | ||
/** | ||
* Sortable's main constructor. | ||
* @param element Any variety of HTMLElement. | ||
* @param options Sortable options object. | ||
*/ | ||
constructor(element: HTMLElement, options: Sortable.Options); | ||
static active: Sortable; | ||
static utils: Sortable.Utils; | ||
/** | ||
* Creation of new instances. | ||
* @param element Any variety of HTMLElement. | ||
* @param options Sortable options object. | ||
*/ | ||
static create(element: HTMLElement, options: Sortable.Options): Sortable; | ||
/** | ||
* Options getter/setter | ||
* @param name a Sortable.Options property. | ||
* @param value a value. | ||
*/ | ||
option<K extends keyof Sortable.Options>(name: K, value: Sortable.Options[K]): void; | ||
option<K extends keyof Sortable.Options>(name: K): Sortable.Options[K]; | ||
/** | ||
* For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. | ||
* @param element an HTMLElement or selector string. | ||
* @param selector default: `options.draggable` | ||
*/ | ||
closest(element: HTMLElement, selector?: string): HTMLElement | null; | ||
/** | ||
* Sorts the elements according to the array. | ||
* @param order an array of strings to sort. | ||
*/ | ||
sort(order: ReadonlyArray<string>): void; | ||
/** | ||
* Saving and restoring of the sort. | ||
*/ | ||
save(): void; | ||
/** | ||
* Removes the sortable functionality completely. | ||
*/ | ||
destroy(): void; | ||
/** | ||
* Serializes the sortable's item data-id's (dataIdAttr option) into an array of string. | ||
*/ | ||
toArray(): string[]; | ||
} | ||
declare namespace Sortable { | ||
export interface SortableEvent extends Event { | ||
clone: HTMLElement; | ||
/** | ||
* previous list | ||
*/ | ||
from: HTMLElement; | ||
/** | ||
* dragged element | ||
*/ | ||
item: HTMLElement; | ||
/** | ||
* new index within parent | ||
*/ | ||
newIndex: number | undefined; | ||
/** | ||
* old index within parent | ||
*/ | ||
oldIndex: number | undefined; | ||
target: HTMLElement; | ||
/** | ||
* list, in which moved element. | ||
*/ | ||
to: HTMLElement; | ||
} | ||
export interface MoveEvent extends Event { | ||
dragged: HTMLElement; | ||
draggedRect: DOMRect; | ||
from: HTMLElement; | ||
/** | ||
* element on which have guided | ||
*/ | ||
related: HTMLElement; | ||
relatedRect: DOMRect; | ||
to: HTMLElement; | ||
willInsertAfter?: boolean; | ||
} | ||
export interface GroupOptions { | ||
/** | ||
* group name | ||
*/ | ||
name: string; | ||
/** | ||
* ability to move from the list. clone — copy the item, rather than move. | ||
*/ | ||
pull?: boolean | 'clone' | ((to: Sortable, from: Sortable) => boolean | string); | ||
/** | ||
* whether elements can be added from other lists, or an array of group names from which elements can be taken. | ||
*/ | ||
put?: boolean | string | ReadonlyArray<string> | ((to: Sortable) => boolean); | ||
/** | ||
* revert cloned element to initial position after moving to a another list. | ||
*/ | ||
revertClone?: boolean; | ||
} | ||
export interface Options { | ||
/** | ||
* ms, animation speed moving items when sorting, `0` — without animation | ||
*/ | ||
animation?: number; | ||
/** | ||
* Class name for the chosen item | ||
*/ | ||
chosenClass?: string; | ||
dataIdAttr?: string; | ||
/** | ||
* time in milliseconds to define when the sorting should start | ||
*/ | ||
delay?: number; | ||
/** | ||
* Disables the sortable if set to true. | ||
*/ | ||
disabled?: boolean; | ||
store?: { | ||
get: (sortable: Sortable) => any[]; | ||
set: (sortable: Sortable) => any; | ||
}; | ||
animation?: number; | ||
handle?: string; | ||
filter?: any; | ||
/** | ||
* Class name for the dragging item | ||
*/ | ||
dragClass?: string; | ||
/** | ||
* Specifies which items inside the element should be draggable | ||
*/ | ||
draggable?: string; | ||
ghostClass?: string; | ||
chosenClass?: string; | ||
dataIdAttr?: string; | ||
forceFallback?: boolean; | ||
dragoverBubble?: boolean; | ||
dropBubble?: boolean; | ||
/** | ||
* Class name for the cloned DOM Element when using forceFallback | ||
*/ | ||
fallbackClass?: string; | ||
/** | ||
* Appends the cloned DOM Element into the Document's Body | ||
*/ | ||
fallbackOnBody?: boolean; | ||
/** | ||
* Specify in pixels how far the mouse should move before it's considered as a drag. | ||
*/ | ||
fallbackTolerance?: number; | ||
fallbackOffset?: { x: number, y: number }; | ||
/** | ||
* Selectors that do not lead to dragging (String or Function) | ||
*/ | ||
filter?: string | ((this: Sortable, event: Event | TouchEvent, target: HTMLElement, sortable: Sortable) => boolean); | ||
/** | ||
* ignore the HTML5 DnD behaviour and force the fallback to kick in | ||
*/ | ||
forceFallback?: boolean; | ||
/** | ||
* Class name for the drop placeholder | ||
*/ | ||
ghostClass?: string; | ||
/** | ||
* To drag elements from one list into another, both lists must have the same group value. | ||
* You can also define whether lists can give away, give and keep a copy (clone), and receive elements. | ||
*/ | ||
group?: string | GroupOptions; | ||
/** | ||
* Drag handle selector within list items | ||
*/ | ||
handle?: string; | ||
ignore?: string; | ||
/** | ||
* Call `event.preventDefault()` when triggered `filter` | ||
*/ | ||
preventOnFilter?: boolean; | ||
scroll?: boolean; | ||
/** | ||
* if you have custom scrollbar scrollFn may be used for autoscrolling | ||
*/ | ||
scrollFn?: ((this: Sortable, offsetX: number, offsetY: number, event: MouseEvent) => void) | ||
/** | ||
* px, how near the mouse must be to an edge to start scrolling. | ||
*/ | ||
scrollSensitivity?: number; | ||
scrollSpeed?: number; | ||
setData?: (dataTransfer: any, draggedElement: any) => any; | ||
onStart?: (event: any) => any; | ||
onEnd?: (event: any) => any; | ||
onAdd?: (event: any) => any; | ||
onUpdate?: (event: any) => any; | ||
onSort?: (event: any) => any; | ||
onRemove?: (event: any) => any; | ||
onFilter?: (event: any) => any; | ||
onMove?: (event: any) => boolean; | ||
} | ||
interface SortableUtils { | ||
/** | ||
* Attach an event handler function | ||
* @param {HTMLElement} element an HTMLElement. | ||
* @param {string} event an Event context. | ||
* @param {Function} fn | ||
* px | ||
*/ | ||
on(element: any, event: string, fn: (event: any) => any): void; | ||
scrollSpeed?: number; | ||
/** | ||
* Remove an event handler function | ||
* @param {HTMLElement} element an HTMLElement. | ||
* @param {string} event an Event context. | ||
* @param {Function} fn a callback. | ||
* sorting inside list | ||
*/ | ||
off(element: any, event: string, fn: (event: any) => any): void; | ||
sort?: boolean; | ||
store?: { | ||
get: (sortable: Sortable) => string[]; | ||
set: (sortable: Sortable) => void; | ||
}; | ||
setData?: (dataTransfer: DataTransfer, draggedElement: HTMLElement) => void; | ||
/** | ||
* Get the values of all the CSS properties. | ||
* @param {HTMLElement} element an HTMLElement. | ||
* @returns {Object} | ||
* Element dragging started | ||
*/ | ||
css(element: any): any; | ||
onStart?: (event: SortableEvent) => void; | ||
/** | ||
* Get the value of style properties. | ||
* @param {HTMLElement} element an HTMLElement. | ||
* @param {string} prop a property key. | ||
* @returns {*} | ||
* Element dragging ended | ||
*/ | ||
css(element: any, prop: string): any; | ||
onEnd?: (event: SortableEvent) => void; | ||
/** | ||
* Set one CSS property. | ||
* @param {HTMLElement} element an HTMLElement. | ||
* @param {string} prop a property key. | ||
* @param {string} value a property value. | ||
* Element is dropped into the list from another list | ||
*/ | ||
css(element: any, prop: string, value: string): void; | ||
onAdd?: (event: SortableEvent) => void; | ||
/** | ||
* Set CSS properties. | ||
* @param {HTMLElement} element an HTMLElement. | ||
* @param {Object} props a properties object. | ||
* Changed sorting within list | ||
*/ | ||
css(element: any, props: any): void; | ||
onUpdate?: (event: SortableEvent) => void; | ||
/** | ||
* Get elements by tag name. | ||
* @param {HTMLElement} context an HTMLElement. | ||
* @param {string} tagName A tag name. | ||
* @param {function} [iterator] An iterator. | ||
* @returns {HTMLElement[]} | ||
* Called by any change to the list (add / update / remove) | ||
*/ | ||
find(context: any, tagName: string, iterator?: (value: any) => any): any[]; | ||
onSort?: (event: SortableEvent) => void; | ||
/** | ||
* Takes a function and returns a new one that will always have a particular context. | ||
* @param {*} context an HTMLElement. | ||
* @param {function} fn a function. | ||
* @returns {function} | ||
* Element is removed from the list into another list | ||
*/ | ||
bind(context: any, fn: () => any): () => any; | ||
onRemove?: (event: SortableEvent) => void; | ||
/** | ||
* Check the current matched set of elements against a selector. | ||
* @param {HTMLElement} element an HTMLElement. | ||
* @param {string} selector an element selector. | ||
* @returns {boolean} | ||
* Attempt to drag a filtered element | ||
*/ | ||
is(element: any, selector: string): boolean; | ||
onFilter?: (event: SortableEvent) => void; | ||
/** | ||
* For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. | ||
* @param {HTMLElement} element an HTMLElement. | ||
* @param {string} selector an element seletor. | ||
* @param {HTMLElement} [context] a specific element's context. | ||
* @returns {HTMLElement} | ||
* Event when you move an item in the list or between lists | ||
*/ | ||
closest(element: any, selector: string, context?: any): any; | ||
onMove?: (event: MoveEvent) => boolean; | ||
} | ||
interface Utils { | ||
/** | ||
* Add or remove one classes from each element | ||
* @param {HTMLElement} element an HTMLElement. | ||
* @param {string} name a class name. | ||
* @param {boolean} state a class's state. | ||
* Attach an event handler function | ||
* @param element an HTMLElement. | ||
* @param event an Event context. | ||
* @param fn | ||
*/ | ||
toggleClass(element: any, name: string, state: boolean): void; | ||
} | ||
on(element: HTMLElement, event: string, fn: EventListenerOrEventListenerObject): void; | ||
class DOMRect { | ||
public bottom: number; | ||
public height: number; | ||
public left: number; | ||
public right: number; | ||
public top: number; | ||
public width: number; | ||
public x: number; | ||
public y: number; | ||
} | ||
class Sortable { | ||
public options: SortableOptions; | ||
public el: any; | ||
/** | ||
* Sortable's main constructor. | ||
* @param {HTMLElement} element Any variety of HTMLElement. | ||
* @param {SortableOptions} options Sortable options object. | ||
* Remove an event handler function | ||
* @param element an HTMLElement. | ||
* @param event an Event context. | ||
* @param fn a callback. | ||
*/ | ||
constructor(element: any, options: SortableOptions); | ||
off(element: HTMLElement, event: string, fn: EventListenerOrEventListenerObject): void; | ||
static active: Sortable; | ||
static utils: SortableUtils; | ||
/** | ||
* Creation of new instances. | ||
* @param {HTMLElement} element Any variety of HTMLElement. | ||
* @param {SortableOptions} options Sortable options object. | ||
* @returns {Sortable} | ||
* Get the values of all the CSS properties. | ||
* @param element an HTMLElement. | ||
*/ | ||
static create(element: any, options: SortableOptions): Sortable; | ||
css(element: HTMLElement): CSSStyleDeclaration; | ||
/** | ||
* Options getter/setter | ||
* @param {string} name a SortableOptions property. | ||
* @param {*} [value] a Value. | ||
* @returns {*} | ||
* Get the value of style properties. | ||
* @param element an HTMLElement. | ||
* @param prop a property key. | ||
*/ | ||
option(name: string, value: any): any; | ||
option(name: string): any; | ||
css<K extends keyof CSSStyleDeclaration>(element: HTMLElement, prop: K): CSSStyleDeclaration[K]; | ||
/** | ||
* For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. | ||
* @param {string|HTMLElement} element an HTMLElement or selector string. | ||
* @returns {HTMLElement} | ||
* Set one CSS property. | ||
* @param element an HTMLElement. | ||
* @param prop a property key. | ||
* @param value a property value. | ||
*/ | ||
closest(element: any): any; | ||
css<K extends keyof CSSStyleDeclaration>(element: HTMLElement, prop: K, value: CSSStyleDeclaration[K]): void; | ||
/** | ||
* Sorts the elements according to the array. | ||
* @param {string[]} order an array of strings to sort. | ||
* Get elements by tag name. | ||
* @param context an HTMLElement. | ||
* @param tagName A tag name. | ||
* @param iterator An iterator. | ||
*/ | ||
sort(order: string[]): void; | ||
find(context: HTMLElement, tagName: string, iterator?: (value: HTMLElement, index: number) => void): NodeListOf<HTMLElement>; | ||
/** | ||
* Saving and restoring of the sort. | ||
* Check the current matched set of elements against a selector. | ||
* @param element an HTMLElement. | ||
* @param selector an element selector. | ||
*/ | ||
save(): void; | ||
is(element: HTMLElement, selector: string): boolean; | ||
/** | ||
* Removes the sortable functionality completely. | ||
* For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. | ||
* @param element an HTMLElement. | ||
* @param selector an element seletor. | ||
* @param context a specific element's context. | ||
*/ | ||
destroy(): void; | ||
closest(element: HTMLElement, selector: string, context?: HTMLElement): HTMLElement | null; | ||
/** | ||
* Serializes the sortable's item data-id's (dataIdAttr option) into an array of string. | ||
* @returns {string[]} | ||
* Add or remove one classes from each element | ||
* @param element an HTMLElement. | ||
* @param name a class name. | ||
* @param state a class's state. | ||
*/ | ||
toArray(): string[]; | ||
toggleClass(element: HTMLElement, name: string, state: boolean): void; | ||
} | ||
interface DOMRect { | ||
bottom: number; | ||
height: number; | ||
left: number; | ||
right: number; | ||
top: number; | ||
width: number; | ||
x: number; | ||
y: number; | ||
} | ||
} |
{ | ||
"name": "@types/sortablejs", | ||
"version": "1.3.32", | ||
"version": "1.7.0", | ||
"description": "TypeScript definitions for Sortable.js", | ||
@@ -9,3 +9,9 @@ "license": "MIT", | ||
"name": "Maw-Fox", | ||
"url": "https://github.com/Maw-Fox" | ||
"url": "https://github.com/Maw-Fox", | ||
"githubUsername": "Maw-Fox" | ||
}, | ||
{ | ||
"name": "Maarten Staa", | ||
"url": "https://github.com/maartenstaa", | ||
"githubUsername": "maartenstaa" | ||
} | ||
@@ -16,8 +22,8 @@ ], | ||
"type": "git", | ||
"url": "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git" | ||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git" | ||
}, | ||
"scripts": {}, | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "de4af3d701835d872216e972031293b7da24b3e79ca14329f9b506a8477c6baf", | ||
"typeScriptVersion": "2.0" | ||
"typesPublisherContentHash": "cf5acb2e69d8b1ece7e6be227d2cfa05820eb666c7d9f499d8d3c870e48aa8ef", | ||
"typeScriptVersion": "2.1" | ||
} |
@@ -8,10 +8,10 @@ # Installation | ||
# Details | ||
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sortablejs | ||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sortablejs | ||
Additional Details | ||
* Last updated: Mon, 21 Aug 2017 22:03:22 GMT | ||
* Last updated: Fri, 28 Sep 2018 23:59:40 GMT | ||
* Dependencies: none | ||
* Global values: Sortable | ||
* Global values: none | ||
# Credits | ||
These definitions were written by Maw-Fox <https://github.com/Maw-Fox>. | ||
These definitions were written by Maw-Fox <https://github.com/Maw-Fox>, Maarten Staa <https://github.com/maartenstaa>. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12876
304
1