@ng-dnd/sortable
Version:
Sortable for Angular DnD
56 lines (55 loc) • 2.52 kB
TypeScript
import { AfterViewInit, ChangeDetectorRef, ElementRef, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
import { DndService, DropTarget } from '@ng-dnd/core';
import { Observable, Subscription } from 'rxjs';
import { DraggedItem, HoverTrigger, RenderContext, SortableSpec } from '../types';
import * as i0 from "@angular/core";
export declare class DndSortable<Data> implements OnChanges, OnInit, AfterViewInit, OnDestroy {
protected dnd: DndService;
protected el: ElementRef<HTMLElement>;
protected cdr: ChangeDetectorRef;
listId: any;
horizontal: boolean;
spec: SortableSpec<Data>;
children?: Iterable<Data>;
/**
* Possible values:
*
* - 'halfway' (default): triggers a reorder when you drag halfway over a neighbour
* - 'fixed': triggers as soon as you move over a neighbouring element. Does not work with variable size elements. */
hoverTrigger: HoverTrigger;
/** @ignore */
private childrenSubject$;
/** A handy way to subscribe to spec.getList(). */
children$: Observable<Iterable<Data>>;
/** @ignore */
subs: Subscription;
/** @ignore */
listSubs: Subscription;
/**
* This DropTarget is attached to the whole list.
*
* You may monitor it for information like 'is an item hovering over this entire list somewhere?'
*/
target: DropTarget<DraggedItem<Data>>;
/** @ignore */
constructor(dnd: DndService, el: ElementRef<HTMLElement>, cdr: ChangeDetectorRef);
contextFor(data: Data, index: number): RenderContext<Data>;
/** @ignore */
private updateSubscription;
/** @ignore */
private getCanDrop;
/** @ignore */
private callHover;
/** @ignore */
ngOnInit(): void;
getTargetType(): string | symbol | (string | symbol)[];
acceptsType(ty: string | symbol | null): boolean;
/** @ignore */
ngOnChanges({ spec, listId }: SimpleChanges): void;
/** @ignore */
ngAfterViewInit(): void;
/** @ignore */
ngOnDestroy(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<DndSortable<any>, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<DndSortable<any>, "[dndSortable]", ["dndSortable"], { "listId": { "alias": "listId"; "required": false; }; "horizontal": { "alias": "horizontal"; "required": false; }; "spec": { "alias": "spec"; "required": false; }; "children": { "alias": "children"; "required": false; }; "hoverTrigger": { "alias": "hoverTrigger"; "required": false; }; }, {}, never, never, true, never>;
}