UNPKG

@progress/kendo-angular-treeview

Version:
130 lines (129 loc) 5.91 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { AfterContentInit, ElementRef, NgZone, OnDestroy } from '@angular/core'; import { Draggable } from '@progress/kendo-draggable'; import { DragClueService } from './drag-clue/drag-clue.service'; import { DropHintService } from './drop-hint/drop-hint.service'; import { DragClueTemplateDirective } from './drag-clue/drag-clue-template.directive'; import { DropHintTemplateDirective } from './drop-hint/drop-hint-template.directive'; import { TreeViewComponent } from '../treeview.component'; import { DragAndDropScrollSettings } from './models'; import * as i0 from "@angular/core"; /** * Represents the directive that enables you to drag and drop items inside the current TreeView or between multiple linked TreeView component instances * ([see example](slug:draganddrop_treeview)). * * Triggers the [`nodeDragStart`](slug:api_treeview_treeviewcomponent#nodedragstart), * [`nodeDrag`](slug:api_treeview_treeviewcomponent#nodedrag), * [`nodeDrop`](slug:api_treeview_treeviewcomponent#nodedrop), * [`nodeDragEnd`](slug:api_treeview_treeviewcomponent#nodedragend), * [`addItem`](slug:api_treeview_treeviewcomponent#additem) and * [`removeItem`](slug:api_treeview_treeviewcomponent#removeitem) * events when you perform the corresponding actions. * * @example * ```html * <kendo-treeview * kendoTreeViewDragAndDrop * [dropZoneTreeViews]="treeView" * > * </kendo-treeview> * ``` * * @remarks * Applied to: {@link TreeViewComponent} */ export declare class DragAndDropDirective implements AfterContentInit, OnDestroy { private element; private zone; private treeview; private dragClueService; private dropHintService; /** * Specifies whether the `removeItem` event fires after the user drops an item while pressing the `ctrl` key. * If enabled, the `removeItem` event does not fire on the source TreeView * ([see example](slug:draganddrop_treeview#multiple-treeviews)). * * @default false */ allowCopy: boolean; /** * Specifies the `TreeViewComponent` instances into which the user can drop dragged items from the current `TreeViewComponent` * ([see example](slug:draganddrop_treeview#multiple-treeviews)). */ dropZoneTreeViews: TreeViewComponent[]; /** * Specifies the distance in pixels from the initial item `pointerdown` event before dragging starts. * The `nodeDragStart` and all subsequent TreeView drag events do not fire until dragging begins. * * @default 5 */ startDragAfter: number; /** * Controls the auto-scrolling behavior during drag-and-drop ([see example](slug:draganddrop_treeview#auto-scrolling)). * Enabled by default. To turn off auto-scrolling, set this property to `false`. * * By default, scrolling occurs by 1 pixel every 1 millisecond when the dragged item reaches the top or bottom of the scrollable container. * You can override the `step` and `interval` by providing a `DragAndDropScrollSettings` object. * * @default true */ autoScroll: boolean | DragAndDropScrollSettings; /** * @hidden */ dragClueTemplate: DragClueTemplateDirective; /** * @hidden */ dropHintTemplate: DropHintTemplateDirective; /** * @hidden */ userSelectStyle: string; protected draggable: Draggable; protected draggedItem: HTMLElement; /** * The pointer event of the last successful item pointerdown event (the draggable `press` event). * Used for determining whether the `startDragAfter` distance is covered and for the `nodeDragStart` event args. * Used also as a flag for whether a drag attempt is pending. Should be set to `null` once the dragging begins. */ protected pendingDragStartEvent: PointerEvent; private get scrollSettings(); /** * Describes the offset of the parent element if the latter has the `transform` CSS prop applied. * Transformed parents create new stacking context and the fixed children must be position based on the transformed parent. * https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context */ private containerOffset; constructor(element: ElementRef<HTMLElement>, zone: NgZone, treeview: TreeViewComponent, dragClueService: DragClueService, dropHintService: DropHintService); ngAfterContentInit(): void; ngOnDestroy(): void; /** * @hidden */ handlePress({ originalEvent }: any): void; /** * @hidden */ handleDrag({ originalEvent, clientX, clientY }: any): void; /** * @hidden */ handleRelease({ originalEvent, clientY }: any): void; private updateDropHintState; private updateDragClueState; private initalizeDraggable; private notifyDragStart; private notifyDrag; private notifyDrop; private notifyDragEnd; private getTargetTreeView; private disableAnimationsForNextTick; private shouldInitiateDragStart; private initiateDragStart; static ɵfac: i0.ɵɵFactoryDeclaration<DragAndDropDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<DragAndDropDirective, "[kendoTreeViewDragAndDrop]", never, { "allowCopy": { "alias": "allowCopy"; "required": false; }; "dropZoneTreeViews": { "alias": "dropZoneTreeViews"; "required": false; }; "startDragAfter": { "alias": "startDragAfter"; "required": false; }; "autoScroll": { "alias": "autoScroll"; "required": false; }; }, {}, ["dragClueTemplate", "dropHintTemplate"], never, true, never>; }