sortable.component.d.ts 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import { EventEmitter, TemplateRef } from '@angular/core';
  2. import { ControlValueAccessor } from '@angular/forms';
  3. import { DraggableItem } from './draggable-item';
  4. import { DraggableItemService } from './draggable-item.service';
  5. export declare class SortableComponent implements ControlValueAccessor {
  6. private static globalZoneIndex;
  7. /** field name if input array consists of objects */
  8. fieldName: string;
  9. /** class name for items wrapper */
  10. wrapperClass: string;
  11. /** style object for items wrapper */
  12. wrapperStyle: {
  13. [key: string]: string;
  14. };
  15. /** class name for item */
  16. itemClass: string;
  17. /** style object for item */
  18. itemStyle: {
  19. [key: string]: string;
  20. };
  21. /** class name for active item */
  22. itemActiveClass: string;
  23. /** style object for active item */
  24. itemActiveStyle: {
  25. [key: string]: string;
  26. };
  27. /** class name for placeholder */
  28. placeholderClass: string;
  29. /** style object for placeholder */
  30. placeholderStyle: {
  31. [key: string]: string;
  32. };
  33. /** placeholder item which will be shown if collection is empty */
  34. placeholderItem: string;
  35. /** used to specify a custom item template. Template variables: item and index; */
  36. itemTemplate: TemplateRef<any>;
  37. /** fired on array change (reordering, insert, remove), same as <code>ngModelChange</code>.
  38. * Returns new items collection as a payload.
  39. */
  40. onChange: EventEmitter<any[]>;
  41. showPlaceholder: boolean;
  42. activeItem: number;
  43. items: SortableItem[];
  44. onTouched: any;
  45. onChanged: any;
  46. private transfer;
  47. private currentZoneIndex;
  48. private _items;
  49. constructor(transfer: DraggableItemService);
  50. onItemDragstart(event: DragEvent, item: SortableItem, i: number): void;
  51. onItemDragover(event: DragEvent, i: number): void;
  52. cancelEvent(event: DragEvent): void;
  53. onDrop(item: DraggableItem): void;
  54. resetActiveItem(event: DragEvent): void;
  55. registerOnChange(callback: () => void): void;
  56. registerOnTouched(callback: () => void): void;
  57. writeValue(value: any[]): void;
  58. updatePlaceholderState(): void;
  59. getItemStyle(isActive: boolean): {};
  60. private initDragstartEvent;
  61. }
  62. export declare interface SortableItem {
  63. id: number;
  64. value: string;
  65. initData: any;
  66. }