import { DragSourceMonitor, DropTargetMonitor } from '@ng-dnd/core'; import { Observable } from 'rxjs'; import { DraggedItem, SortableSpec } from './types'; export declare enum SortableEvents { BeginDrag = "BeginDrag", Hover = "Hover", Drop = "Drop", EndDrag = "EndDrag" } export declare class BeginDragAction { readonly type: AT; readonly item: DraggedItem; readonly event = SortableEvents.BeginDrag; constructor(type: AT, item: DraggedItem); } export declare class HoverAction { readonly type: AT; readonly item: DraggedItem; readonly event = SortableEvents.Hover; constructor(type: AT, item: DraggedItem); } export declare class DropAction { readonly type: AT; readonly item: DraggedItem; readonly event = SortableEvents.Drop; constructor(type: AT, item: DraggedItem); } export declare class EndDragAction { readonly type: AT; readonly item: DraggedItem; readonly event = SortableEvents.EndDrag; constructor(type: AT, item: DraggedItem); } export type SortableAction = BeginDragAction | HoverAction | DropAction | EndDragAction; /** Intended to be your NgRx Store object */ export interface Dispatcher { dispatch: (action: SortableAction) => void; } export interface NgRxSortableConfiguration { type: string | symbol; accepts?: string | symbol | (string | symbol)[]; trackBy: (data: D) => any; getList: (listId: any) => Observable>; canDrop?: (item: DraggedItem, monitor: DropTargetMonitor>) => boolean; canDrag?: (data: D, listId: any, monitor: DragSourceMonitor) => boolean; isDragging?: (ground: D, inFlight: DraggedItem) => boolean; createData?: () => D; } export declare class NgRxSortable implements SortableSpec { protected store: Dispatcher; protected actionType: string; type: string | symbol; accepts?: string | symbol | (string | symbol)[]; trackBy: (data: D) => any; getList: (listId: any) => Observable>; canDrop?: (item: DraggedItem, monitor: DropTargetMonitor>) => boolean; canDrag?: (data: D, listId: any, monitor: DragSourceMonitor) => boolean; isDragging?: (ground: D, inFlight: DraggedItem) => boolean; createData?: () => D; /** * @param store An @ngrx store instance. * @param actionType The type in your own @ngrx/store `ActionTypes` enum you want the sortable actions to use. * @param configure You must provide `trackBy` and `getList` functions here. Hopefully your `getList` will select from the store you passed! */ constructor(store: Dispatcher, actionType: string, configure: NgRxSortableConfiguration); beginDrag: (item: DraggedItem, _monitor: DragSourceMonitor) => void; hover: (item: DraggedItem, _monitor: DropTargetMonitor>) => void; drop: (item: DraggedItem, _monitor: DropTargetMonitor>) => void; endDrag: (item: DraggedItem, _monitor: DragSourceMonitor>) => void; }