ng-reorder
Version:
Sort elements within a list by using drag-n-drop interface without any restrictions by direction
20 lines (19 loc) • 815 B
TypeScript
/**
* @param array array to reorder
* @param begin the index which is moving in the array
* @param end the index where the array[begin] is moving to
*/
export declare function reorderItems<T = any>(array: T[], begin: number, end: number): T[];
/**
* @param array array to reorder
* @param a the index of first element
* @param b the index of second element
*/
export declare function swapItems<T = any>(array: T[], a: number, b: number): T[];
/** To ensure to get a number not less than zero and not greater than a given max value
* @param value number to check
* @param max max value
*/
export declare function fit(value: number, max: number): number;
/** Whether the event is touch or not */
export declare function isTouchEvent(event: MouseEvent | TouchEvent): event is TouchEvent;