gantt-canvas-chart 1.1.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export declare class DateUtils {
2
2
  static readonly ONE_DAY_MS: number;
3
3
  static format(date: Date, format?: string): string;
4
- static addDays(date: Date, days: number): Date;
5
- static addMonths(date: Date, months: number): Date;
4
+ static addDays(date: Date | string, days: number): Date;
5
+ static addMonths(date: Date | string, months: number): Date;
6
6
  static addYears(date: Date, years: number): Date;
7
7
  static diffDays(date1: Date, date2: Date): number;
8
8
  static diffDaysInclusive(date1: Date, date2: Date): number;
@@ -22,23 +22,26 @@ export declare function firstValidValue(...args: any[]): any;
22
22
 
23
23
  export declare class GanttChart {
24
24
  private rootContainer;
25
- private container;
25
+ container: HTMLElement;
26
26
  private data;
27
27
  private config;
28
28
  private headerCanvas;
29
29
  private mainCanvas;
30
30
  private scrollDummy;
31
31
  private tooltip;
32
+ private scrolling;
33
+ private showTooltip;
32
34
  private headerCtx;
33
35
  private mainCtx;
34
36
  private timelineStart;
35
37
  private timelineEnd;
36
- private minDate;
38
+ minDate: Date | null;
39
+ maxDate: Date | null;
37
40
  private pixelsPerDay;
38
41
  private scrollLeft;
39
42
  private scrollTop;
40
43
  private visibleDateRange;
41
- private today;
44
+ today: Date;
42
45
  private devicePixelRatio;
43
46
  private viewportWidth;
44
47
  private viewportHeight;
@@ -47,11 +50,17 @@ export declare class GanttChart {
47
50
  private resizeObserver;
48
51
  private taskPositions;
49
52
  private taskMap;
50
- private boundHandleMouseMove;
51
- private boundHandleMouseLeave;
52
- private boundHandleScroll;
53
+ private isLoadingData;
54
+ private hasMoreDataLeft;
55
+ private hasMoreDataRight;
56
+ private hasMoreDataBottom;
57
+ private lastScrollLeft;
58
+ private lastScrollTop;
59
+ private onDataLoad;
60
+ private scrollLoadTimer;
53
61
  constructor(rootContainer: HTMLElement, data: GanttData, config?: GanttConfig);
54
62
  private init;
63
+ private updateLoadMoreConf;
55
64
  private buildTaskMap;
56
65
  private setupEvents;
57
66
  updateConfig(newConfig: GanttConfig): void;
@@ -62,15 +71,23 @@ export declare class GanttChart {
62
71
  private dateToX;
63
72
  private xToDate;
64
73
  private handleResize;
74
+ setOnDataLoadCallback(callback: (direction: 'left' | 'right' | 'bottom', params?: any) => Promise<GanttData>): void;
65
75
  private handleScroll;
76
+ private checkScrollLoad;
77
+ resetScrollLoadingState(): void;
78
+ private loadMoreData;
79
+ private appendData;
80
+ private prependData;
81
+ private appendRows;
66
82
  setScrollTop(scrollTop: number): void;
67
83
  private updateVirtualRanges;
68
84
  private updateDimensions;
69
85
  private setupCanvas;
70
86
  private calculateAllTaskPositions;
71
87
  private getIterationStartDate;
72
- render(): void;
88
+ render(scrolling?: boolean): void;
73
89
  private renderHeader;
90
+ private groupConsecutiveBlocks;
74
91
  private renderMain;
75
92
  private drawArrow;
76
93
  private drawAllDependencies;
@@ -90,17 +107,27 @@ export declare class GanttChart {
90
107
  */
91
108
  static getTaskWidthPercent(diffMilliseconds: number, pixelsPerDay: number): number;
92
109
  /**
93
- * scroll to specified date position, default to minDate
110
+ * horizontal scroll to specified date position, default to minDate
94
111
  *
95
112
  * @param date
96
113
  */
97
- scrollToStartDate(date?: Date): void;
114
+ horizontalScrollTo(date?: Date): void;
115
+ /**
116
+ * vertical scroll to specified position
117
+ *
118
+ * @param params
119
+ */
120
+ verticalScrollTo(params: {
121
+ rowId: string;
122
+ rowIndex: number;
123
+ }): void;
98
124
  }
99
125
 
100
126
  export declare interface GanttConfig {
101
127
  viewMode?: 'Day' | 'Week' | 'Month' | 'Year';
102
128
  planBorderColor?: string;
103
129
  actualBgColor?: string;
130
+ headerBgColor?: string;
104
131
  rowHeight?: number;
105
132
  headerHeight?: number;
106
133
  showPlan?: boolean;
@@ -115,6 +142,7 @@ export declare interface GanttConfig {
115
142
  todayColor?: string;
116
143
  offsetTop?: number;
117
144
  offsetLeft?: number;
145
+ enabledLoadMore?: [LoadMoreDirection?, LoadMoreDirection?, LoadMoreDirection?];
118
146
  viewFactors?: {
119
147
  Day: number;
120
148
  Week: number;
@@ -126,6 +154,8 @@ export declare interface GanttConfig {
126
154
 
127
155
  export declare type GanttData = Row[];
128
156
 
157
+ export declare type LoadMoreDirection = 'left' | 'right' | 'bottom';
158
+
129
159
  export declare interface Row {
130
160
  id: string;
131
161
  name: string;