From 4e6bf5b5f4670bda60a708caae614f7f77a4a7d8 Mon Sep 17 00:00:00 2001 From: Wayne Van Son Date: Fri, 20 Dec 2019 17:13:16 +1100 Subject: [PATCH] [sortablejs] adds some missing event properties (#41160) * [sortablejs] creates clear description for fake class * [sortablejs] add some swap and multidrag event options --- types/sortablejs/index.d.ts | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/types/sortablejs/index.d.ts b/types/sortablejs/index.d.ts index 9d0b53c118..51e9652c49 100644 --- a/types/sortablejs/index.d.ts +++ b/types/sortablejs/index.d.ts @@ -96,7 +96,7 @@ declare namespace Sortable { SwapOptions {} /** - * A class that all plugins inherit from for the sake of types + * A class that all plugins inherit from for the sake of type inference. */ export class Plugin extends SortablePlugin {} export class MultiDrag extends MultiDragPlugin {} @@ -139,6 +139,24 @@ declare namespace Sortable { * Pull mode if dragging into another sortable */ pullMode: 'clone' | boolean | undefined; + /** + * When MultiDrag is used to sort, this holds a HTMLElement and oldIndex for each item selected. + * + * `oldIndicies[number]` is directly related to `newIndicies[number]` + * + * If MultiDrag is not used to sort, this array will be empty. + */ + oldIndicies: { multiDragElement: HTMLElement; index: number }[]; + /** + * When MultiDrag is used to sort, this holds a HTMLElement and newIndex for each item. + * + * `oldIndicies[number]` is directly related to `newIndicies[number]` + * + * If MultiDrag is not used to sort, this array will be empty. + */ + newIndicies: { multiDragElement: HTMLElement; index: number }[]; + /** When Swap is used to sort, this will contain the dragging item that was dropped on.*/ + swapItem: HTMLElement | null; } export interface MoveEvent extends Event {