internal.d.ts 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. import { Duration, CssDimValue } from '@fullcalendar/core';
  2. import { Splitter, DateSpan, EventDef, DateMarker, DateEnv, PositionCache, DateProfile, DateComponent, ViewProps, ChunkContentCallbackArgs, DateProfileGenerator, DayTableModel, Seg, DateRange, EventStore, EventUiHash, EventInteractionState, Slicer, ScrollRequest, Hit, DayTableCell, EventSegUiInteractionState } from '@fullcalendar/core/internal';
  3. import { RefObject, VNode, createElement } from '@fullcalendar/core/preact';
  4. declare class AllDaySplitter extends Splitter {
  5. getKeyInfo(): {
  6. allDay: {};
  7. timed: {};
  8. };
  9. getKeysForDateSpan(dateSpan: DateSpan): string[];
  10. getKeysForEventDef(eventDef: EventDef): string[];
  11. }
  12. interface TimeSlatMeta {
  13. date: DateMarker;
  14. time: Duration;
  15. key: string;
  16. isoTimeStr: string;
  17. isLabeled: boolean;
  18. }
  19. declare function buildSlatMetas(slotMinTime: Duration, slotMaxTime: Duration, explicitLabelInterval: Duration | null, slotDuration: Duration, dateEnv: DateEnv): TimeSlatMeta[];
  20. declare class TimeColsSlatsCoords {
  21. positions: PositionCache;
  22. private dateProfile;
  23. private slotDuration;
  24. constructor(positions: PositionCache, dateProfile: DateProfile, slotDuration: Duration);
  25. safeComputeTop(date: DateMarker): number;
  26. computeDateTop(when: DateMarker, startOfDayDate?: DateMarker): number;
  27. computeTimeTop(duration: Duration): number;
  28. }
  29. interface TimeColsViewState {
  30. slatCoords: TimeColsSlatsCoords | null;
  31. }
  32. declare abstract class TimeColsView extends DateComponent<ViewProps, TimeColsViewState> {
  33. protected allDaySplitter: AllDaySplitter;
  34. protected headerElRef: RefObject<HTMLTableCellElement>;
  35. private rootElRef;
  36. private scrollerElRef;
  37. state: {
  38. slatCoords: any;
  39. };
  40. renderSimpleLayout(headerRowContent: VNode | null, allDayContent: ((contentArg: ChunkContentCallbackArgs) => VNode) | null, timeContent: ((contentArg: ChunkContentCallbackArgs) => VNode) | null): createElement.JSX.Element;
  41. renderHScrollLayout(headerRowContent: VNode | null, allDayContent: ((contentArg: ChunkContentCallbackArgs) => VNode) | null, timeContent: ((contentArg: ChunkContentCallbackArgs) => VNode) | null, colCnt: number, dayMinWidth: number, slatMetas: TimeSlatMeta[], slatCoords: TimeColsSlatsCoords | null): createElement.JSX.Element;
  42. handleScrollTopRequest: (scrollTop: number) => void;
  43. getAllDayMaxEventProps(): {
  44. dayMaxEvents: number | boolean;
  45. dayMaxEventRows: number | false;
  46. };
  47. renderHeadAxis: (rowKey: 'day' | string, frameHeight?: CssDimValue) => createElement.JSX.Element;
  48. renderTableRowAxis: (rowHeight?: number) => createElement.JSX.Element;
  49. handleSlatCoords: (slatCoords: TimeColsSlatsCoords) => void;
  50. }
  51. declare class DayTimeColsView extends TimeColsView {
  52. private buildTimeColsModel;
  53. private buildSlatMetas;
  54. render(): createElement.JSX.Element;
  55. }
  56. declare function buildTimeColsModel(dateProfile: DateProfile, dateProfileGenerator: DateProfileGenerator): DayTableModel;
  57. interface TimeColsSeg extends Seg {
  58. col: number;
  59. start: DateMarker;
  60. end: DateMarker;
  61. }
  62. interface DayTimeColsProps {
  63. dateProfile: DateProfile;
  64. dayTableModel: DayTableModel;
  65. axis: boolean;
  66. slotDuration: Duration;
  67. slatMetas: TimeSlatMeta[];
  68. businessHours: EventStore;
  69. eventStore: EventStore;
  70. eventUiBases: EventUiHash;
  71. dateSelection: DateSpan | null;
  72. eventSelection: string;
  73. eventDrag: EventInteractionState | null;
  74. eventResize: EventInteractionState | null;
  75. tableColGroupNode: VNode;
  76. tableMinWidth: CssDimValue;
  77. clientWidth: number | null;
  78. clientHeight: number | null;
  79. expandRows: boolean;
  80. onScrollTopRequest?: (scrollTop: number) => void;
  81. forPrint: boolean;
  82. onSlatCoords?: (slatCoords: TimeColsSlatsCoords) => void;
  83. }
  84. declare class DayTimeCols extends DateComponent<DayTimeColsProps> {
  85. private buildDayRanges;
  86. private slicer;
  87. private timeColsRef;
  88. render(): createElement.JSX.Element;
  89. }
  90. declare function buildDayRanges(dayTableModel: DayTableModel, dateProfile: DateProfile, dateEnv: DateEnv): DateRange[];
  91. declare class DayTimeColsSlicer extends Slicer<TimeColsSeg, [DateRange[]]> {
  92. sliceRange(range: DateRange, dayRanges: DateRange[]): TimeColsSeg[];
  93. }
  94. interface TimeColsProps {
  95. cells: DayTableCell[];
  96. dateProfile: DateProfile;
  97. slotDuration: Duration;
  98. nowDate: DateMarker;
  99. todayRange: DateRange;
  100. businessHourSegs: TimeColsSeg[];
  101. bgEventSegs: TimeColsSeg[];
  102. fgEventSegs: TimeColsSeg[];
  103. dateSelectionSegs: TimeColsSeg[];
  104. eventSelection: string;
  105. eventDrag: EventSegUiInteractionState | null;
  106. eventResize: EventSegUiInteractionState | null;
  107. tableColGroupNode: VNode;
  108. tableMinWidth: CssDimValue;
  109. clientWidth: number | null;
  110. clientHeight: number | null;
  111. expandRows: boolean;
  112. nowIndicatorSegs: TimeColsSeg[];
  113. onScrollTopRequest?: (scrollTop: number) => void;
  114. forPrint: boolean;
  115. axis: boolean;
  116. slatMetas: TimeSlatMeta[];
  117. onSlatCoords?: (slatCoords: TimeColsSlatsCoords) => void;
  118. isHitComboAllowed?: (hit0: Hit, hit1: Hit) => boolean;
  119. }
  120. interface TimeColsState {
  121. slatCoords: TimeColsSlatsCoords | null;
  122. }
  123. declare class TimeCols extends DateComponent<TimeColsProps, TimeColsState> {
  124. private processSlotOptions;
  125. private scrollResponder;
  126. private colCoords;
  127. state: {
  128. slatCoords: any;
  129. };
  130. render(): createElement.JSX.Element;
  131. handleRootEl: (el: HTMLElement | null) => void;
  132. componentDidMount(): void;
  133. componentDidUpdate(prevProps: TimeColsProps): void;
  134. componentWillUnmount(): void;
  135. handleScrollRequest: (request: ScrollRequest) => boolean;
  136. handleColCoords: (colCoords: PositionCache | null) => void;
  137. handleSlatCoords: (slatCoords: TimeColsSlatsCoords | null) => void;
  138. queryHit(positionLeft: number, positionTop: number): Hit;
  139. }
  140. export { DayTimeCols, DayTimeColsSlicer, DayTimeColsView, TimeCols, TimeColsSeg, TimeColsSlatsCoords, TimeColsView, TimeSlatMeta, buildDayRanges, buildSlatMetas, buildTimeColsModel };