Timeline.d.ts 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import { Dayjs } from 'dayjs';
  2. import { Event, IEvent } from './Event';
  3. import { Ressource, IRessource } from './Ressource';
  4. import { LitElement, TemplateResult } from 'lit-element';
  5. interface TimelineOptions {
  6. ressources?: Array<IRessource>;
  7. items?: Array<IEvent>;
  8. }
  9. interface TimelineContent {
  10. ressources: Array<Ressource>;
  11. items: Array<Event>;
  12. }
  13. declare type dayjsUnit = "y" | "M" | "d" | "h" | "m" | 's';
  14. declare type UnitLegend = {
  15. [k in dayjsUnit]: string;
  16. };
  17. declare class Timeline extends LitElement {
  18. static styles: import("lit-element").CSSResult;
  19. private rows;
  20. private items;
  21. private selectedList;
  22. private ressourceWidth;
  23. private _start;
  24. get start(): string;
  25. set start(value: string);
  26. private _end;
  27. get end(): string;
  28. set end(value: string);
  29. private _slotDuration;
  30. get slotDuration(): number;
  31. set slotDuration(value: number);
  32. private _legendSpan;
  33. get legendSpan(): number;
  34. set legendSpan(value: number);
  35. private rowHeight;
  36. private slotWidth;
  37. private rowsTitle;
  38. private legendUnitFormat;
  39. private legend;
  40. constructor(options?: TimelineOptions);
  41. set defaultBackground(value: string);
  42. get defaultBackground(): string;
  43. setLegendUnitFormatAll(legend: Partial<UnitLegend>): void;
  44. setLegendUnitFormat(unit: dayjsUnit, format: string): void;
  45. addRessources(list: Array<IRessource>): (IRessource | undefined)[];
  46. addRessource(ressource: IRessource): IRessource | undefined;
  47. removeRessourceById(id: string): TimelineContent;
  48. _removeRessourceById(id: string, depth?: number): TimelineContent;
  49. getRessources(): Array<Ressource>;
  50. getRessourceFromId(id: string): Ressource | null;
  51. setRowsTitle(title: string): void;
  52. addTimeSlots(list: Array<IEvent>): (Event | null)[];
  53. addTimeSlot(slot: IEvent): Event | null;
  54. removeTimeslotById(id: string): Array<Event>;
  55. updateTimeslotById(id: string): Event | null;
  56. private updateTimeslotPosition;
  57. getTimeSlots(): Array<Event>;
  58. updateLegend(): void;
  59. _handleResizeX(e: CustomEvent<number>): void;
  60. _grabHeader(e: MouseEvent): void;
  61. _getEventResizerHandler(slot: Event, direction: "end" | "start"): (evt: MouseEvent) => void;
  62. _getEventGrabHandler(slot: Event, editable: boolean, ressourceEditable: boolean, callback: (e: MouseEvent, wasModified: boolean) => void): (evt: MouseEvent) => void;
  63. private _clearSelectedItems;
  64. private _clearSelectionhandler;
  65. private _getEventClickHandler;
  66. firstUpdated(): void;
  67. renderTimeslot(slot: Event): TemplateResult;
  68. _getCollapseRessourceHandler(item: Ressource): (e: MouseEvent) => void;
  69. _onRessourceDragStart(item: Ressource): (event: DragEvent) => void;
  70. _onRessourceDragEnter(event: DragEvent): void;
  71. _onRessourceDragLeave(event: DragEvent): void;
  72. _onRessourceDrop(event: DragEvent): void;
  73. renderRessource(item: Ressource): TemplateResult;
  74. renderGridRow(columns: Array<Dayjs>, rowId?: number, height?: number): TemplateResult;
  75. render(): TemplateResult;
  76. }
  77. export default Timeline;