UNPKG

3.8 kBTypeScriptView Raw
1import { ChangeDetectorRef } from '@angular/core';
2import { ElementRef } from '@angular/core';
3import { DragDropConfig, DragImage } from './dnd.config';
4import { DragDropService } from './dnd.service';
5export declare abstract class AbstractComponent {
6 _dragDropService: DragDropService;
7 _config: DragDropConfig;
8 private _cdr;
9 _elem: HTMLElement;
10 _dragHandle: HTMLElement;
11 _dragHelper: HTMLElement;
12 _defaultCursor: string;
13 /**
14 * Last element that was mousedown'ed
15 */
16 _target: EventTarget;
17 /**
18 * Whether the object is draggable. Default is true.
19 */
20 private _dragEnabled;
21 set dragEnabled(enabled: boolean);
22 get dragEnabled(): boolean;
23 /**
24 * Allows drop on this element
25 */
26 dropEnabled: boolean;
27 /**
28 * Drag effect
29 */
30 effectAllowed: string;
31 /**
32 * Drag cursor
33 */
34 effectCursor: string;
35 /**
36 * Restrict places where a draggable element can be dropped. Either one of
37 * these two mechanisms can be used:
38 *
39 * - dropZones: an array of strings that permits to specify the drop zones
40 * associated with this component. By default, if the drop-zones attribute
41 * is not specified, the droppable component accepts drop operations by
42 * all the draggable components that do not specify the allowed-drop-zones
43 *
44 * - allowDrop: a boolean function for droppable components, that is checked
45 * when an item is dragged. The function is passed the dragData of this
46 * item.
47 * - if it returns true, the item can be dropped in this component
48 * - if it returns false, the item cannot be dropped here
49 */
50 allowDrop: (dropData: any) => boolean;
51 dropZones: string[];
52 /**
53 * Here is the property dragImage you can use:
54 * - The string value as url to the image
55 * <div class="panel panel-default"
56 * dnd-draggable [dragEnabled]="true"
57 * [dragImage]="/images/simpler.png">
58 * ...
59 * - The DragImage value with Image and optional offset by x and y:
60 * let myDragImage: DragImage = new DragImage("/images/simpler1.png", 0, 0);
61 * ...
62 * <div class="panel panel-default"
63 * dnd-draggable [dragEnabled]="true"
64 * [dragImage]="myDragImage">
65 * ...
66 * - The custom function to return the value of dragImage programmatically:
67 * <div class="panel panel-default"
68 * dnd-draggable [dragEnabled]="true"
69 * [dragImage]="getDragImage(someData)">
70 * ...
71 * getDragImage(value:any): string {
72 * return value ? "/images/simpler1.png" : "/images/simpler2.png"
73 * }
74 */
75 dragImage: string | DragImage | Function;
76 cloneItem: boolean;
77 constructor(elemRef: ElementRef, _dragDropService: DragDropService, _config: DragDropConfig, _cdr: ChangeDetectorRef);
78 setDragHandle(elem: HTMLElement): void;
79 /******* Change detection ******/
80 detectChanges(): void;
81 private _onDragEnter;
82 private _onDragOver;
83 private _onDragLeave;
84 private _onDrop;
85 private _isDropAllowed;
86 private _preventAndStop;
87 private _onDragStart;
88 private _onDragEnd;
89 _onDragEnterCallback(event: Event): void;
90 _onDragOverCallback(event: Event): void;
91 _onDragLeaveCallback(event: Event): void;
92 _onDropCallback(event: Event): void;
93 _onDragStartCallback(event: Event): void;
94 _onDragEndCallback(event: Event): void;
95}
96export declare class AbstractHandleComponent {
97 _dragDropService: DragDropService;
98 _config: DragDropConfig;
99 private _Component;
100 private _cdr;
101 _elem: HTMLElement;
102 constructor(elemRef: ElementRef, _dragDropService: DragDropService, _config: DragDropConfig, _Component: AbstractComponent, _cdr: ChangeDetectorRef);
103}