gantt-canvas-chart 1.2.0 → 1.3.1

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.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * gantt-canvas-chart v1.2.0
2
+ * gantt-canvas-chart v1.3.1
3
3
  * (c) 2025-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -80,7 +80,7 @@
80
80
  font-size: 13px;
81
81
  line-height: 1.6;
82
82
  pointer-events: none;
83
- z-index: 1000;
83
+ z-index: 2147483640;
84
84
  max-width: 300px;
85
85
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
86
86
  }
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;
@@ -29,6 +29,8 @@ export declare class GanttChart {
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;
@@ -39,7 +41,7 @@ export declare class GanttChart {
39
41
  private scrollLeft;
40
42
  private scrollTop;
41
43
  private visibleDateRange;
42
- private today;
44
+ today: Date;
43
45
  private devicePixelRatio;
44
46
  private viewportWidth;
45
47
  private viewportHeight;
@@ -48,11 +50,17 @@ export declare class GanttChart {
48
50
  private resizeObserver;
49
51
  private taskPositions;
50
52
  private taskMap;
51
- private boundHandleMouseMove;
52
- private boundHandleMouseLeave;
53
- 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;
54
61
  constructor(rootContainer: HTMLElement, data: GanttData, config?: GanttConfig);
55
62
  private init;
63
+ private updateLoadMoreConf;
56
64
  private buildTaskMap;
57
65
  private setupEvents;
58
66
  updateConfig(newConfig: GanttConfig): void;
@@ -63,15 +71,23 @@ export declare class GanttChart {
63
71
  private dateToX;
64
72
  private xToDate;
65
73
  private handleResize;
74
+ setOnDataLoadCallback(callback: (direction: 'left' | 'right' | 'bottom', params?: any) => Promise<GanttData>): void;
66
75
  private handleScroll;
76
+ private checkScrollLoad;
77
+ resetScrollLoadingState(): void;
78
+ private loadMoreData;
79
+ private appendData;
80
+ private prependData;
81
+ private appendRows;
67
82
  setScrollTop(scrollTop: number): void;
68
83
  private updateVirtualRanges;
69
84
  private updateDimensions;
70
85
  private setupCanvas;
71
86
  private calculateAllTaskPositions;
72
87
  private getIterationStartDate;
73
- render(): void;
88
+ render(scrolling?: boolean): void;
74
89
  private renderHeader;
90
+ private groupConsecutiveBlocks;
75
91
  private renderMain;
76
92
  private drawArrow;
77
93
  private drawAllDependencies;
@@ -91,17 +107,27 @@ export declare class GanttChart {
91
107
  */
92
108
  static getTaskWidthPercent(diffMilliseconds: number, pixelsPerDay: number): number;
93
109
  /**
94
- * scroll to specified date position, default to minDate
110
+ * horizontal scroll to specified date position, default to minDate
95
111
  *
96
112
  * @param date
97
113
  */
98
- 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;
99
124
  }
100
125
 
101
126
  export declare interface GanttConfig {
102
127
  viewMode?: 'Day' | 'Week' | 'Month' | 'Year';
103
128
  planBorderColor?: string;
104
129
  actualBgColor?: string;
130
+ headerBgColor?: string;
105
131
  rowHeight?: number;
106
132
  headerHeight?: number;
107
133
  showPlan?: boolean;
@@ -116,6 +142,7 @@ export declare interface GanttConfig {
116
142
  todayColor?: string;
117
143
  offsetTop?: number;
118
144
  offsetLeft?: number;
145
+ enabledLoadMore?: [LoadMoreDirection?, LoadMoreDirection?, LoadMoreDirection?];
119
146
  viewFactors?: {
120
147
  Day: number;
121
148
  Week: number;
@@ -127,6 +154,8 @@ export declare interface GanttConfig {
127
154
 
128
155
  export declare type GanttData = Row[];
129
156
 
157
+ export declare type LoadMoreDirection = 'left' | 'right' | 'bottom';
158
+
130
159
  export declare interface Row {
131
160
  id: string;
132
161
  name: string;
@@ -158,6 +187,12 @@ export declare interface TaskPosition {
158
187
  x_plan_end: number;
159
188
  x_actual_start: number | null;
160
189
  x_actual_end: number | null;
190
+ x_plan_width: number;
191
+ x_actual_width: number;
192
+ offset_x_plan_start: number;
193
+ offset_x_plan_end: number;
194
+ offset_x_actual_start: number | null;
195
+ offset_x_actual_end: number | null;
161
196
  y: number;
162
197
  row: number;
163
198
  }