mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
[sortablejs] adds 5 missing properties in interfaces (#41045)
* [sortablejs] create checkPull and checkPut options * [sortablejs] create oldDraggableIndex, newDraggableIndex and pullMode options * [sortablejs] recreate put function again * remove from in pull function * [sortablejs] add plugin class to exports.
This commit is contained in:
Vendored
+37
-3
@@ -36,9 +36,9 @@ declare class Sortable {
|
||||
/**
|
||||
* Mounts a plugin to Sortable
|
||||
* @param sortablePlugin a sortable plugin.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
*
|
||||
*
|
||||
* Sortable.mount(new MultiDrag(), new AutoScroll())
|
||||
*/
|
||||
static mount(...sortablePlugins: SortablePlugin[]): void;
|
||||
@@ -95,6 +95,10 @@ declare namespace Sortable {
|
||||
OnSpillOptions,
|
||||
SwapOptions {}
|
||||
|
||||
/**
|
||||
* A class that all plugins inherit from for the sake of types
|
||||
*/
|
||||
export class Plugin extends SortablePlugin {}
|
||||
export class MultiDrag extends MultiDragPlugin {}
|
||||
export class AutoScroll extends AutoScrollPlugin {}
|
||||
export class Swap extends SwapPlugin {}
|
||||
@@ -123,6 +127,18 @@ declare namespace Sortable {
|
||||
* list, in which moved element.
|
||||
*/
|
||||
to: HTMLElement;
|
||||
/**
|
||||
* Old index within parent, only counting draggable elements
|
||||
*/
|
||||
oldDraggableIndex: number | undefined;
|
||||
/**
|
||||
* New index within parent, only counting draggable elements
|
||||
*/
|
||||
newDraggableIndex: number | undefined;
|
||||
/**
|
||||
* Pull mode if dragging into another sortable
|
||||
*/
|
||||
pullMode: 'clone' | boolean | undefined;
|
||||
}
|
||||
|
||||
export interface MoveEvent extends Event {
|
||||
@@ -152,7 +168,25 @@ declare namespace Sortable {
|
||||
/**
|
||||
* whether elements can be added from other lists, or an array of group names from which elements can be taken.
|
||||
*/
|
||||
put?: ((to: Sortable) => PutResult) | PutResult;
|
||||
put?: PutResult | ((to: Sortable) => PullResult);
|
||||
/**
|
||||
* a canonical version of pull, created by Sortable
|
||||
*/
|
||||
checkPull?: (
|
||||
sortable: Sortable,
|
||||
activeSortable: Sortable,
|
||||
dragEl: HTMLElement,
|
||||
event: SortableEvent,
|
||||
) => boolean | string | Array<string>;
|
||||
/**
|
||||
* a canonical version of put, created by Sortable
|
||||
*/
|
||||
checkPut?: (
|
||||
sortable: Sortable,
|
||||
activeSortable: Sortable,
|
||||
dragEl: HTMLElement,
|
||||
event: SortableEvent,
|
||||
) => boolean | string | 'clone' | Array<string>;
|
||||
/**
|
||||
* revert cloned element to initial position after moving to a another list.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user