UNPKG

@progress/kendo-angular-utils

Version:

Kendo UI Angular utils component

149 lines (148 loc) 6.64 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { EventEmitter, AfterContentInit, ElementRef, Renderer2, NgZone, OnInit, OnDestroy, QueryList, ViewContainerRef } from "@angular/core"; import { DragHandleDirective } from "./draghandle.directive"; import { DragStateService } from "./drag-state.service"; import { AutoScrollOptions, DragTargetDataFn, HintSettings, DragAxis, DragMode } from './models'; import { DragTargetIdFn } from "./models/functions"; import { DragTargetDragEndEvent, DragTargetDragEvent, DragTargetDragStartEvent, DragTargetPressEvent } from "./events/drag-target"; import { DragTargetReleaseEvent } from "./events/drag-target/release-event"; import { DragTargetDragReadyEvent } from "./events/drag-target/dragready-event"; import * as i0 from "@angular/core"; /** * Represents the Kendo UI DragTarget directive for Angular. * Use this directive to make an element draggable. */ export declare class DragTargetDirective implements OnInit, AfterContentInit, OnDestroy { private element; private renderer; private ngZone; private service; private viewContainer; get touchActionStyle(): string; /** * Defines whether a hint will be used for dragging. By default, the hint is a copy of the drag target. ([see example]({% slug drag_hint %})). * * @default false */ hint: boolean | HintSettings; /** * Sets the number of pixels the pointer must move before dragging starts. Applies when `manualDrag` is `false`. [See example]({% slug minimum_distance %}). * * @default 0 */ threshold: number; /** * Sets the automatic container scrolling behavior when close to the edge. [See example]({% slug auto_scroll %}). * * @default true */ autoScroll: boolean | AutoScrollOptions; /** * Sets a unique identifier for the drag target. */ dragTargetId: string | DragTargetIdFn; /** * Sets the delay in milliseconds before dragging begins. [See example]({% slug drag_delay %}). * * @default 0 */ dragDelay: number; /** * Restricts dragging to horizontal or vertical only. Applies when `mode` is `auto`. [See example]({% slug axis_lock %}). */ restrictByAxis: DragAxis; /** * Specifies whether to use the default dragging behavior or handle it manually. * * @default 'auto' */ mode: DragMode; /** * Defines a callback function used for attaching custom data to the drag target. * The data is available in the events of the respective [`DropTarget`]({% slug api_utils_droptargetdirective %}) or [`DropTargetContainer`]({% slug api_utils_droptargetcontainerdirective %}) directives. * The current DragTarget HTML element and its `dragTargetId` will be available as arguments. */ set dragData(fn: DragTargetDataFn); get dragData(): DragTargetDataFn; /** * Sets the cursor style of the drag target. Accepts same values as the [CSS `cursor` property](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#values). * * @default 'move' */ cursorStyle: string; /** * Fires when the user presses the drag target element. */ onPress: EventEmitter<DragTargetPressEvent>; /** * Fires when dragging of the drag target element begins. */ onDragStart: EventEmitter<DragTargetDragStartEvent>; /** * Fires while the user drags the drag target element. */ onDrag: EventEmitter<DragTargetDragEvent>; /** * Fires when the drag target's `dragDelay` has passed and the user can drag the element. */ onDragReady: EventEmitter<DragTargetDragReadyEvent>; /** * Fires when `DragTarget` is released, either by dropping it on a drop target or by releasing the mouse button. */ onRelease: EventEmitter<DragTargetReleaseEvent>; /** * Fires when dragging of the drag target ends and the element is released. */ onDragEnd: EventEmitter<DragTargetDragEndEvent>; private dragTarget; private hintComponent; private dragStarted; private pressed; private dragReady; private dragTimeout; private initialPosition; private position; private scrollableParent; private defaultHint; private _dragData; private prevUserSelect; private get hintTemplate(); private get nativeElement(); private get hintElem(); private onPointerDown; private onTouchStart; private onPointerMove; private onTouchMove; private onPointerUp; private onContextMenu; dragHandles: QueryList<DragHandleDirective>; constructor(element: ElementRef, renderer: Renderer2, ngZone: NgZone, service: DragStateService, viewContainer: ViewContainerRef); ngOnInit(): void; ngAfterContentInit(): void; ngOnDestroy(): void; private handlePress; private handleDragStart; private handleDrag; private handleRelease; private handleDragEnd; private initializeDragTarget; private get supportPointerEvent(); private removeListeners; private attachDomHandlers; private isDragHandle; private getAutoScrollContainer; private createHint; private createDefaultHint; private createCustomHint; private destroyHint; private emitZoneAwareEvent; private get dragTargetIdResult(); private performDrag; private calculatePosition; private getStylesPerElement; static ɵfac: i0.ɵɵFactoryDeclaration<DragTargetDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<DragTargetDirective, "[kendoDragTarget]", ["kendoDragTarget"], { "hint": { "alias": "hint"; "required": false; }; "threshold": { "alias": "threshold"; "required": false; }; "autoScroll": { "alias": "autoScroll"; "required": false; }; "dragTargetId": { "alias": "dragTargetId"; "required": false; }; "dragDelay": { "alias": "dragDelay"; "required": false; }; "restrictByAxis": { "alias": "restrictByAxis"; "required": false; }; "mode": { "alias": "mode"; "required": false; }; "dragData": { "alias": "dragData"; "required": false; }; "cursorStyle": { "alias": "cursorStyle"; "required": false; }; }, { "onPress": "onPress"; "onDragStart": "onDragStart"; "onDrag": "onDrag"; "onDragReady": "onDragReady"; "onRelease": "onRelease"; "onDragEnd": "onDragEnd"; }, ["dragHandles"], never, true, never>; }