UNPKG

@rr2/drag-n-drop

Version:

Angular directive that allows you to build any type of sortable array HTML structure using native JavaScript mouse events.

44 lines (43 loc) 1.47 kB
import { DragNDropItem } from './drag-n-drop-item'; import { ElementRef } from '@angular/core'; interface ItemPosition { id: number; previousPosition: ClientRect; currentPosition: ClientRect; element: HTMLElement; item: DragNDropItem; } interface PositionDifference { top: string; right: string; bottom: string; left: string; } export declare class AnimateReorder { private _animationContainer; private _items; container: ElementRef; newArray: any[]; previousArray: any[]; previousItems: DragNDropItem[]; newItems: DragNDropItem[]; /** * Calculates difference between element's previous and current positions **/ static getPositionDifference(item: ItemPosition): PositionDifference; prepareForAnimation(pickedElementsIndex: number): void; performAnimation(pickedElementsIndex: number): Promise<number>; /** * Saves old position and other important attributes of each element * in this class instance's _items attribute **/ protected parseItemsPosition(items: DragNDropItem[]): ItemPosition[]; /** * Updates _items attribute by populating each elements currentPosition attribute **/ protected parseNewItemsPosition(items: DragNDropItem[]): void; protected getItem(localId: number): ItemPosition; protected wait(delay: number): Promise<null>; private makeContainerCopy; } export {};