@duoduo-oba/ng-devui
Version:
DevUI components based on Angular
148 lines (147 loc) • 5.67 kB
TypeScript
/**
* 2020.03.23-Modified from https://github.com/Bernardo-Castilho/dragdroptouch, license: MIT,reason:Converting .js file to .ts file
* Huawei Technologies Co.,Ltd.<devcloudmobile@huawei.com>
*/
export declare class DragDropTouch {
static readonly THRESHOLD = 5;
static readonly OPACITY = 0.5;
static readonly DBLCLICK = 500;
static readonly DRAG_OVER_TIME = 300;
static readonly CTX_MENU = 900;
static readonly IS_PRESS_HOLD_MODE = true;
static readonly PRESS_HOLD_AWAIT = 400;
static readonly PRESS_HOLD_MARGIN = 25;
static readonly PRESS_HOLD_THRESHOLD = 0;
static readonly DRAG_HANDLE_ATTR = "data-drag-handle-selector";
static readonly rmvAttrs: string[];
static readonly kbdProps: string[];
static readonly ptProps: string[];
private static instance;
dataTransfer: DataTransfer;
lastClick: number;
lastTouch: TouchEvent;
lastTarget: HTMLElement;
dragSource: HTMLElement;
ptDown: {
x: number;
y: number;
};
isDragEnabled: boolean;
isDropZone: boolean;
pressHoldInterval: any;
img: any;
imgCustom: any;
imgOffset: any;
dragoverTimer: any;
touchTarget: EventTarget;
touchmoveListener: EventListener;
touchendListener: EventListener;
listenerOpt: boolean | EventListenerOptions;
constructor();
/**
* Gets a reference to the @see:DragDropTouch singleton.
*/
static getInstance(): DragDropTouch;
static isTouchDevice(): any;
bindTouchmoveTouchend(e: TouchEvent): void;
removeTouchmoveTouchend(): void;
touchstart: (e: TouchEvent) => void;
touchmoveOnDocument: (e: any) => void;
touchmove: (e: TouchEvent) => void;
touchendOnDocument: (e: any) => void;
touchend: (e: any) => void;
shouldHandle(e: any): boolean;
shouldHandleMove(e: any): boolean;
shouldHandlePressHoldMove(e: any): any;
shouldCancelPressHoldMove(e: any): boolean;
shouldStartDragging(e: any): boolean;
getDragHandle(): string;
matchSelector(element: any, selector: any): any;
reset(): void;
getPoint(e: any, page?: any): {
x: any;
y: any;
};
getDelta(e: any): number;
getTarget(e: TouchEvent): HTMLElement;
createImage(e: any): void;
destroyImage(): void;
moveImage(e: any): void;
copyProps(dst: any, src: any, props: any): void;
copyStyle(src: any, dst: any): void;
dispatchEvent(e: any, type: any, target: any): boolean;
closestDraggable(e: any): any;
setDragoverInterval(e: any): void;
clearDragoverInterval(): void;
}
export declare namespace DragDropTouch {
/**
* Object used to hold the data that is being dragged during drag and drop operations.
*
* It may hold one or more data items of different types. For more information about
* drag and drop operations and data transfer objects, see
* <a href="https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer">HTML Drag and Drop API</a>.
*
* This object is created automatically by the @see:DragDropTouch singleton and is
* accessible through the @see:dataTransfer property of all drag events.
*/
class DataTransfer implements DataTransfer {
files: any;
items: any;
private _data;
/**
* Gets or sets the type of drag-and-drop operation currently selected.
* The value must be 'none', 'copy', 'link', or 'move'.
*/
private _dropEffect;
dropEffect: any;
/**
* Gets or sets the types of operations that are possible.
* Must be one of 'none', 'copy', 'copyLink', 'copyMove', 'link',
* 'linkMove', 'move', 'all' or 'uninitialized'.
*/
private _effectAllowed;
effectAllowed: any;
/**
* Gets an array of strings giving the formats that were set in the @see:dragstart event.
*/
private _types;
readonly types: string[];
constructor();
/**
* Removes the data associated with a given type.
*
* The type argument is optional. If the type is empty or not specified, the data
* associated with all types is removed. If data for the specified type does not exist,
* or the data transfer contains no data, this method will have no effect.
*
* @param type Type of data to remove.
*/
clearData(type: any): void;
/**
* Retrieves the data for a given type, or an empty string if data for that type does
* not exist or the data transfer contains no data.
*
* @param type Type of data to retrieve.
*/
getData(type: any): any;
/**
* Set the data for a given type.
*
* For a list of recommended drag types, please see
* https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Recommended_Drag_Types.
*
* @param type Type of data to add.
* @param value Data to add.
*/
setData(type: any, value: any): void;
/**
* Set the image to be used for dragging if a custom one is desired.
*
* @param img An image element to use as the drag feedback image.
* @param offsetX The horizontal offset within the image.
* @param offsetY The vertical offset within the image.
*/
setDragImage(img: any, offsetX: any, offsetY: any): void;
}
}