@progress/kendo-angular-utils
Version:
Kendo UI Angular utils component
148 lines (147 loc) • 6.69 kB
TypeScript
/**-----------------------------------------------------------------------------------------
* 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.
*/
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;
/**
* The number of pixels the pointer moves in any direction before the dragging starts ([see example]({% slug minimum_distance %})). Applicable when `manualDrag` is set to `false`.
*
* @default 0
*/
threshold: number;
/**
* Defines the automatic container scrolling behavior when close to the edge ([see example]({% slug auto_scroll %})).
*
* @default true
*/
autoScroll: boolean | AutoScrollOptions;
/**
* Defines a unique identifier for the dragTarget.
*/
dragTargetId: string | DragTargetIdFn;
/**
* Defines the delay in milliseconds after which the drag will begin ([see example]({% slug drag_delay %})).
*
* @default 0
*/
dragDelay: number;
/**
* Restricts the element to be dragged horizontally or vertically only ([see example]({% slug axis_lock %})). Applicable when `mode` is set to `auto`.
*/
restrictByAxis: DragAxis;
/**
* Specifies whether the default dragging behavior will be performed or the developer will manually handle the drag action.
*
* @default 'auto'
*/
mode: DragMode;
/**
* Defines a callback function used for attaching custom data to the dragTarget.
* The data will be 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;
/**
* Specifies 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 DragTarget element.
*/
onPress: EventEmitter<DragTargetPressEvent>;
/**
* Fires when the dragging of the DragTarget element begins.
*/
onDragStart: EventEmitter<DragTargetDragStartEvent>;
/**
* Fires while the user drags the DragTarget element.
*/
onDrag: EventEmitter<DragTargetDragEvent>;
/**
* Fires when the DragTarget's `dragDelay` has passed and the user is able to drag the element.
*/
onDragReady: EventEmitter<DragTargetDragReadyEvent>;
/**
* Fires when the user releases the DragTarget element after being pressed.
*/
onRelease: EventEmitter<DragTargetReleaseEvent>;
/**
* Fires when the dragging of the DragTarget 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>;
}