UNPKG

nxt-sortablejs

Version:
55 lines (51 loc) 2.77 kB
import * as _angular_core from '@angular/core'; import { Provider, OnChanges, OnDestroy, AfterViewInit, SimpleChange } from '@angular/core'; import Sortable, { Options } from 'sortablejs'; import { AbstractControl, FormArray } from '@angular/forms'; declare function provideGlobalSortableOptions(globalOptions: Options): Provider[]; type SortableData<T> = [T] extends [AbstractControl] ? (FormArray<T> | T[]) : T[]; type CloneFunction<T> = (item: T) => T; declare class SortablejsDirective<T> implements OnChanges, OnDestroy, AfterViewInit { private readonly globalConfig; private readonly service; private readonly element; private readonly cdRef; private readonly zone; private readonly renderer; /** Input data, can be Array or FormArray */ readonly data: _angular_core.InputSignal<SortableData<T> | undefined>; /** * CSS selector for the sortable container * * Mostly required when used with custom components which wrap items in multiple containers. In that case, * this should be the selector for the direct HTML parent of sortable items. */ readonly sortablejsContainer: _angular_core.InputSignal<string | undefined>; /** Sortablejs configuration */ readonly config: _angular_core.InputSignal<Sortable.Options | undefined>; /** A function invoked when cloning items from template dataset into target dataset */ readonly cloneFunction: _angular_core.InputSignal<CloneFunction<T> | undefined>; /** Initialised a new Sortablejs instance */ readonly init: _angular_core.OutputEmitterRef<Sortable>; private sortableInstance?; private readonly bindings; private readonly optionsWithoutEvents; private readonly overridenOptions; private readonly options; /** @internal */ ngAfterViewInit(): void; /** @internal */ ngOnChanges(changes: { [prop in keyof SortablejsDirective<T>]: SimpleChange; }): void; /** @internal */ ngOnDestroy(): void; private create; private proxyEvent; private get isCloning(); private clone; static ɵfac: _angular_core.ɵɵFactoryDeclaration<SortablejsDirective<any>, never>; static ɵdir: _angular_core.ɵɵDirectiveDeclaration<SortablejsDirective<any>, "[nxtSortablejs]", never, { "data": { "alias": "nxtSortablejs"; "required": false; "isSignal": true; }; "sortablejsContainer": { "alias": "sortablejsContainer"; "required": false; "isSignal": true; }; "config": { "alias": "config"; "required": false; "isSignal": true; }; "cloneFunction": { "alias": "cloneFunction"; "required": false; "isSignal": true; }; }, { "init": "init"; }, never, never, true, never>; } export { SortablejsDirective, provideGlobalSortableOptions }; export type { CloneFunction, SortableData };