angular-draggable.directive.d.ts 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. import { ElementRef, Renderer2, OnInit, EventEmitter, OnChanges, SimpleChanges, OnDestroy, AfterViewInit } from '@angular/core';
  2. import { IPosition } from './models/position';
  3. export declare class AngularDraggableDirective implements OnInit, OnDestroy, OnChanges, AfterViewInit {
  4. private el;
  5. private renderer;
  6. private allowDrag;
  7. private moving;
  8. private orignal;
  9. private oldTrans;
  10. private tempTrans;
  11. private currTrans;
  12. private oldZIndex;
  13. private _zIndex;
  14. private needTransform;
  15. private draggingSub;
  16. /**
  17. * Bugfix: iFrames, and context unrelated elements block all events, and are unusable
  18. * https://github.com/xieziyu/angular2-draggable/issues/84
  19. */
  20. private _helperBlock;
  21. started: EventEmitter<any>;
  22. stopped: EventEmitter<any>;
  23. edge: EventEmitter<any>;
  24. /** Make the handle HTMLElement draggable */
  25. handle: HTMLElement;
  26. /** Set the bounds HTMLElement */
  27. bounds: HTMLElement;
  28. /** List of allowed out of bounds edges **/
  29. outOfBounds: {
  30. top: boolean;
  31. right: boolean;
  32. bottom: boolean;
  33. left: boolean;
  34. };
  35. /** Round the position to nearest grid */
  36. gridSize: number;
  37. /** Set z-index when dragging */
  38. zIndexMoving: string;
  39. /** Set z-index when not dragging */
  40. zIndex: string;
  41. /** Whether to limit the element stay in the bounds */
  42. inBounds: boolean;
  43. /** Whether the element should use it's previous drag position on a new drag event. */
  44. trackPosition: boolean;
  45. /** Input css scale transform of element so translations are correct */
  46. scale: number;
  47. /** Whether to prevent default event */
  48. preventDefaultEvent: boolean;
  49. /** Set initial position by offsets */
  50. position: IPosition;
  51. /** Lock axis: 'x' or 'y' */
  52. lockAxis: string;
  53. /** Emit position offsets when moving */
  54. movingOffset: EventEmitter<IPosition>;
  55. /** Emit position offsets when put back */
  56. endOffset: EventEmitter<IPosition>;
  57. ngDraggable: any;
  58. constructor(el: ElementRef, renderer: Renderer2);
  59. ngOnInit(): void;
  60. ngOnDestroy(): void;
  61. ngOnChanges(changes: SimpleChanges): void;
  62. ngAfterViewInit(): void;
  63. private getDragEl;
  64. resetPosition(): void;
  65. private moveTo;
  66. private transform;
  67. private pickUp;
  68. private subscribeEvents;
  69. private unsubscribeEvents;
  70. boundsCheck(): {
  71. 'top': boolean;
  72. 'right': boolean;
  73. 'bottom': boolean;
  74. 'left': boolean;
  75. };
  76. /** Get current offset */
  77. getCurrentOffset(): IPosition;
  78. private putBack;
  79. checkHandleTarget(target: EventTarget, element: Element): boolean;
  80. onMouseDown(event: MouseEvent | TouchEvent): void;
  81. onMouseMove(event: MouseEvent | TouchEvent): void;
  82. }