<commit_before>﻿import {
    Directive,
    ElementRef,
    EventEmitter,
    HostBinding,
    HostListener,
    Inject,
    Input,
    NgModule,
    NgZone,
    OnDestroy,
    OnInit,
    Output,
    Renderer2,
    ChangeDetectorRef
} from '@angular/core';
import { animationFrameScheduler, fromEvent, interval, Subject } from 'rxjs';
import { takeUntil, throttle } from 'rxjs/operators';

export enum RestrictDrag {
    VERTICALLY,
    HORIZONTALLY,
    NONE
}

export class IgxDragCustomEventDetails {
    startX: number;
    startY: number;
    pageX: number;
    pageY: number;
    owner: IgxDragDirective;
}

export class IgxDropEnterEventArgs {
    owner: IgxDropDirective;
    drag: IgxDragDirective;
    dragData: any;
    startX: number;
    startY: number;
    pageX: number;
    pageY: number;
}

export class IgxDropLeaveEventArgs {
    owner: IgxDropDirective;
    drag: IgxDragDirective;
    dragData: any;
    startX: number;
    startY: number;
    pageX: number;
    pageY: number;
}

export class IgxDropEventArgs {
    owner: IgxDropDirective;
    drag: IgxDragDirective;
    cancel: boolean;
}

@Directive({
    selector: '[igxDrag]'
})
export class IgxDragDirective implements OnInit, OnDestroy {

    /**
     * @hidden
     */
    @Input('igxDrag')
    public data: any;

    /**
     * An @Input property that indicates when the drag should start
     * By default the drag starts after the draggable element is moved by 5px
     * ```html
     * <div igxDrag [dragTolerance]="100">
     *         <span>Drag Me!</span>
     * </div>
     * ```
     */
    @Input()
    public dragTolerance = 5;

    /**
     * @hidden
     */
    @Input()
    public ghostImageClass = '';

    /**
     * An @Input property that hides the draggable element.
     * By default it's set to false.
     * ```html
     * <div igxDrag [dragTolerance]="100" [hideBaseOnDrag]="'true'">
     *         <span>Drag Me!</span>
     * </div>
     * ```
     */
    @Input()
    public hideBaseOnDrag = false;

    /**
     * An @Input property that enables/disables the draggable element animation
     * when the element is released.
     * By default it's set to false.
     * ```html
     * <div igxDrag [animateOnRelease]="'true'">
     *         <span>Drag Me!</span>
     * </div>
     * ```
     */
    @Input()
    public animateOnRelease = false;

    /**
     * Emits an event when the draggable element drag starts.
     * ```html
     * <div igxDrag [animateOnRelease]="'true'" (dragStart)="onDragStart()">
     *         <span>Drag Me!</span>
     * </div>
     * ```
     * ```typescript
     * public onDragStart(){
     *      alert("The drag has stared!");
     * }
     * ```
     */
    @Output()
    public dragStart = new EventEmitter<any>();

    /**
     * Emits an event when the draggable element drag ends.
     * ```html
     * <div igxDrag [animateOnRelease]="'true'" (dragEnd)="onDragEnd()">
     *         <span>Drag Me!</span>
     * </div>
     * ```
     * ```typescript
     * public onDragEnd(){
     *      alert("The drag has ended!");
     * }
     * ```
     */
    @Output()
    public dragEnd = new EventEmitter<any>();

    /**
     * Emits an event when the draggable element move ends.
     * ```html
     * <div igxDrag [animateOnRelease]="'true'" (returnMoveEnd)="onMoveEnd()">
     *         <span>Drag Me!</span>
     * </div>
     * ```
     * ```typescript
     * public onMoveEnd(){
     *      alert("The move has ended!");
     * }
     * ```
     */
    @Output()
    public returnMoveEnd = new EventEmitter<any>();

    /**
     * Emits an event when the draggable element is clicked.
     * ```html
     * <div igxDrag [animateOnRelease]="'true'" (dragClicked)="dragClicked()">
     *         <span>Drag Me!</span>
     * </div>
     * ```
     * ```typescript
     * public dragClicked(){
     *      alert("The elemented has been clicked!");
     * }
     * ```
     */
    @Output()
    public dragClicked = new EventEmitter<any>();

    /**
     * @hidden
     */
    @HostBinding('style.touchAction')
    public touch = 'none';

    /**
     * @hidden
     */
    @HostBinding('style.transitionProperty')
    public transitionProperty = 'top, left';

    /**
     * @hidden
     */
    @HostBinding('style.top.px')<commit_msg>chore(API): add description for data and ghostImageClass<commit_after>﻿import {
    Directive,
    ElementRef,
    EventEmitter,
    HostBinding,
    HostListener,
    Inject,
    Input,
    NgModule,
    NgZone,
    OnDestroy,
    OnInit,
    Output,
    Renderer2,
    ChangeDetectorRef
} from '@angular/core';
import { animationFrameScheduler, fromEvent, interval, Subject } from 'rxjs';
import { takeUntil, throttle } from 'rxjs/operators';

export enum RestrictDrag {
    VERTICALLY,
    HORIZONTALLY,
    NONE
}

export class IgxDragCustomEventDetails {
    startX: number;
    startY: number;
    pageX: number;
    pageY: number;
    owner: IgxDragDirective;
}

export class IgxDropEnterEventArgs {
    owner: IgxDropDirective;
    drag: IgxDragDirective;
    dragData: any;
    startX: number;
    startY: number;
    pageX: number;
    pageY: number;
}

export class IgxDropLeaveEventArgs {
    owner: IgxDropDirective;
    drag: IgxDragDirective;
    dragData: any;
    startX: number;
    startY: number;
    pageX: number;
    pageY: number;
}

export class IgxDropEventArgs {
    owner: IgxDropDirective;
    drag: IgxDragDirective;
    cancel: boolean;
}

@Directive({
    selector: '[igxDrag]'
})
export class IgxDragDirective implements OnInit, OnDestroy {

    /**
     * - Save data inside the `igxDrag` directive. This can be set when instancing `igxDrag` on an element.
     * ```html
     * <div [igxDrag]="{ source: myElement }"></div>
     * ```
     */
    @Input('igxDrag')
    public data: any;

    /**
     * An @Input property that indicates when the drag should start
     * By default the drag starts after the draggable element is moved by 5px
     * ```html
     * <div igxDrag [dragTolerance]="100">
     *         <span>Drag Me!</span>
     * </div>
     * ```
     */
    @Input()
    public dragTolerance = 5;

    /**
     * Sets a custom class that will be added to the `dragGhost` element.
     * ```html
     * <div igxDrag [ghostImageClass]="'dragGhost'">
     *         <span>Drag Me!</span>
     * </div>
     * ```
     */
    @Input()
    public ghostImageClass = '';

    /**
     * An @Input property that hides the draggable element.
     * By default it's set to false.
     * ```html
     * <div igxDrag [dragTolerance]="100" [hideBaseOnDrag]="'true'">
     *         <span>Drag Me!</span>
     * </div>
     * ```
     */
    @Input()
    public hideBaseOnDrag = false;

    /**
     * An @Input property that enables/disables the draggable element animation
     * when the element is released.
     * By default it's set to false.
     * ```html
     * <div igxDrag [animateOnRelease]="'true'">
     *         <span>Drag Me!</span>
     * </div>
     * ```
     */
    @Input()
    public animateOnRelease = false;

    /**
     * Event triggered when the draggable element drag starts.
     * ```html
     * <div igxDrag [animateOnRelease]="'true'" (dragStart)="onDragStart()">
     *         <span>Drag Me!</span>
     * </div>
     * ```
     * ```typescript
     * public onDragStart(){
     *      alert("The drag has stared!");
     * }
     * ```
     */
    @Output()
    public dragStart = new EventEmitter<any>();

    /**
     * Event triggered when the draggable element is released.
     * ```html
     * <div igxDrag [animateOnRelease]="'true'" (dragEnd)="onDragEnd()">
     *         <span>Drag Me!</span>
     * </div>
     * ```
     * ```typescript
     * public onDragEnd(){
     *      alert("The drag has ended!");
     * }
     * ```
     */
    @Output()
    public dragEnd = new EventEmitter<any>();

    /**
     * Event triggered after the draggable element is released and after its animation has finished.
     * ```html
     * <div igxDrag [animateOnRelease]="'true'" (returnMoveEnd)="onMoveEnd()">
     *         <span>Drag Me!</span>
     * </div>
     * ```
     * ```typescript
     * public onMoveEnd(){
     *      alert("The move has ended!");
     * }
     * ```
     */
    @Output()
    public returnMoveEnd = new EventEmitter<any>();

    /**
     * Event triggered when the draggable element is clicked.
     * ```html
     * <div igxDrag [animateOnRelease]="'true'" (dragClicked)="dragClicked()">
     *         <span>Drag Me!</span>
     * </div>
     * ```
     * ```typescript
     * public dragClicked(){
     *      alert("The elemented has been clicked!");
     * }
     * ```
     */
    @Output()
    public dragClicked = new EventEmitter<any>();

    /**
     * @hidden
     */
    @HostBinding('style.touchAction')
    public touch = 'none';

    /**
     * @hidden
     */
    @HostBinding('style.transitionProperty')
    public transitionProperty = 'top, left';

    /**
     * @hidden
     */
    @HostBinding('style.top.px')
{'fraction_non_alphanumeric': 0.14279379157427938, 'fraction_numerical': 0.0019955654101995565, 'mean_word_length': 2.2519826964671954, 'pattern_counts': {'":': 0, '<': 73, '<?xml version=': 0, '>': 73, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4672526', 'n_tokens_mistral': 2949, 'n_tokens_neox': 2882, 'n_words': 706}