20 lines
816 B
TypeScript
20 lines
816 B
TypeScript
|
import { ConfigurableDocument, MaybeRefOrGetter } from '@vueuse/core';
|
||
|
import { Options } from 'sortablejs';
|
||
|
|
||
|
interface UseSortableReturn {
|
||
|
/**
|
||
|
* start sortable instance
|
||
|
*/
|
||
|
start: () => void;
|
||
|
/**
|
||
|
* destroy sortable instance
|
||
|
*/
|
||
|
stop: () => void;
|
||
|
}
|
||
|
type UseSortableOptions = Options & ConfigurableDocument;
|
||
|
declare function useSortable<T>(selector: string, list: MaybeRefOrGetter<T[]>, options?: UseSortableOptions): UseSortableReturn;
|
||
|
declare function useSortable<T>(el: MaybeRefOrGetter<HTMLElement | null | undefined>, list: MaybeRefOrGetter<T[]>, options?: UseSortableOptions): UseSortableReturn;
|
||
|
declare function moveArrayElement<T>(list: MaybeRefOrGetter<T[]>, from: number, to: number): void;
|
||
|
|
||
|
export { UseSortableOptions, UseSortableReturn, moveArrayElement, useSortable };
|