igniteui-react-grids
Version: 
Ignite UI React grid components.
107 lines (106 loc) • 2.83 kB
JavaScript
import { IgrRowType } from "./igr-row-type";
import { RowDragStartEventArgsDetail as RowDragStartEventArgsDetail_internal } from "./RowDragStartEventArgsDetail";
import { ensureBool } from "igniteui-react-core";
/**
 * Emitted when a dragging operation is starting (when the row is "picked")
 * The event is cancelable
*/
export class IgrRowDragStartEventArgsDetail {
    createImplementation() {
        return new RowDragStartEventArgsDetail_internal();
    }
    get nativeElement() {
        return this._implementation.nativeElement;
    }
    /**
     * @hidden
     */
    get i() {
        return this._implementation;
    }
    onImplementationCreated() {
    }
    constructor() {
        this.mounted = false;
        this._implementation = this.createImplementation();
        this._implementation.externalObject = this;
        this.onImplementationCreated();
        if (this._initializeAdapters) {
            this._initializeAdapters();
        }
    }
    _provideImplementation(i) {
        this._implementation = i;
        this._implementation.externalObject = this;
        this.onImplementationCreated();
        if (this._initializeAdapters) {
            this._initializeAdapters();
        }
    }
    /**
     * Represents the drag directive or information associated with the drag operation
    */
    get dragDirective() {
        return this.i.f;
    }
    set dragDirective(v) {
        this.i.f = v;
    }
    /**
     * Represents the information of the row that is being dragged.
    */
    get dragData() {
        const r = this.i.a;
        if (r == null) {
            return null;
        }
        if (!r.externalObject) {
            let e = new IgrRowType();
            if (r.$type) {
                e._implementation = r;
            }
            else {
                if (e.i.setNativeElement) {
                    e.i.setNativeElement(r);
                }
            }
            r.externalObject = e;
        }
        return r.externalObject;
    }
    set dragData(v) {
        v == null ? this.i.a = null : this.i.a = v.i;
    }
    /**
     * Provides the ability to cancel the event.
    */
    get cancel() {
        return this.i.d;
    }
    set cancel(v) {
        this.i.d = ensureBool(v);
    }
    /**
     * Provides reference to the owner component.
    */
    get owner() {
        return this.i.h;
    }
    set owner(v) {
        this.i.h = v;
    }
    findByName(name) {
        if (this.findEphemera) {
            if (name && name.indexOf("@@e:") == 0) {
                return this.findEphemera(name);
            }
        }
        if (this.dragData && this.dragData.name && this.dragData.name == name) {
            return this.dragData;
        }
        return null;
    }
    setNativeElement(element) {
        this.i.setNativeElement(element);
    }
}