gantt-canvas-chart 1.0.1-alpha.0 → 1.0.2

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.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * gantt-canvas-chart v1.0.1-alpha.0
2
+ * gantt-canvas-chart v1.0.2
3
3
  * (c) 2025-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -147,8 +147,8 @@ class GanttChart {
147
147
  offsetTop: 0,
148
148
  offsetLeft: 0,
149
149
  viewFactors: { Day: 80, Week: 20, Month: 15, Year: 6 },
150
- planBorderColor: "#caeed2",
151
- actualBgColor: "#78c78f",
150
+ planBorderColor: "#C1EFCF",
151
+ actualBgColor: "#5AC989",
152
152
  ...config
153
153
  };
154
154
  this.headerCanvas = headerCanvas;
@@ -383,6 +383,7 @@ class GanttChart {
383
383
  ctx.fillStyle = "#f9f9f9";
384
384
  ctx.fillRect(this.scrollLeft, 0, this.viewportWidth, h);
385
385
  ctx.textBaseline = "middle";
386
+ ctx.textRendering = "optimizeLegibility";
386
387
  let currentDate = new Date(this.visibleDateRange.start);
387
388
  currentDate = this.getIterationStartDate(currentDate);
388
389
  let lastUpperText = "";
@@ -449,13 +450,14 @@ class GanttChart {
449
450
  const unitWidth = this.dateToX(nextDate) - x;
450
451
  if (upperText !== lastUpperText) {
451
452
  ctx.fillStyle = "#333";
452
- ctx.font = "bold 13px sans-serif";
453
+ ctx.font = 'bold 13px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif';
454
+ ctx.textRendering = "optimizeLegibility";
453
455
  ctx.textAlign = "left";
454
456
  ctx.fillText(upperText, x + 5, h * 0.35);
455
457
  lastUpperText = upperText;
456
458
  }
457
- ctx.fillStyle = "#666";
458
- ctx.font = "12px sans-serif";
459
+ ctx.fillStyle = "#000412";
460
+ ctx.font = '12px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif';
459
461
  ctx.textAlign = "center";
460
462
  ctx.fillText(lowerText, x + unitWidth / 2, h * 0.7);
461
463
  ctx.beginPath();
@@ -569,7 +571,9 @@ class GanttChart {
569
571
  }
570
572
  drawAllTasks(ctx) {
571
573
  ctx.textBaseline = "middle";
572
- ctx.font = "12px Arial";
574
+ ctx.font = '12px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif';
575
+ ctx.textRendering = "optimizeSpeed";
576
+ ctx.imageSmoothingEnabled = false;
573
577
  for (let i = 0; i < this.data.length; i++) {
574
578
  const row = this.data[i];
575
579
  const y = i * this.config.rowHeight;
@@ -586,7 +590,7 @@ class GanttChart {
586
590
  }
587
591
  }
588
592
  drawGrid(ctx, startDate, endDate) {
589
- ctx.strokeStyle = "#f0f0f0";
593
+ ctx.strokeStyle = "#e6e6e6";
590
594
  ctx.lineWidth = 1;
591
595
  ctx.beginPath();
592
596
  if (this.config.showRowLines) {
@@ -701,7 +705,7 @@ class GanttChart {
701
705
  ctx.lineTo(pos.x_plan_start + width * percent_plan, taskY);
702
706
  ctx.stroke();
703
707
  }
704
- ctx.fillStyle = "#333";
708
+ ctx.fillStyle = "#000";
705
709
  if (this.config.showLeftRemark && task.leftRemark) {
706
710
  ctx.textAlign = "right";
707
711
  ctx.fillText(task.leftRemark, Math.min(...[pos.x_plan_start, pos.x_actual_start].filter((val) => val !== null && val !== void 0)) - 8, textY);
@@ -810,3 +814,4 @@ class GanttChart {
810
814
  }
811
815
  exports.DateUtils = DateUtils;
812
816
  exports.GanttChart = GanttChart;
817
+ exports.firstValidValue = firstValidValue;
package/dist/index.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * gantt-canvas-chart v1.0.1-alpha.0
2
+ * gantt-canvas-chart v1.0.2
3
3
  * (c) 2025-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -10,6 +10,7 @@
10
10
  overflow: hidden;
11
11
  position: relative;
12
12
  background: white;
13
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
13
14
  }
14
15
 
15
16
  .__gantt-chart-container {
@@ -18,6 +19,7 @@
18
19
  position: relative;
19
20
  background: #ffffff;
20
21
  height: 100%;
22
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
21
23
  }
22
24
 
23
25
  .__gantt-scroll-dummy {
@@ -37,6 +39,7 @@
37
39
  z-index: 10;
38
40
  background: #f8fafc;
39
41
  border-bottom: 1px solid #e2e8f0;
42
+ text-rendering: optimizeSpeed;
40
43
  }
41
44
 
42
45
  .__gantt-main-canvas {
@@ -44,6 +47,26 @@
44
47
  top: 56px; /* Corresponds to header height */
45
48
  left: 0;
46
49
  z-index: 1;
50
+ text-rendering: optimizeSpeed;
51
+ }
52
+
53
+ /* Add to your CSS file or create a stylesheet */
54
+ .__gantt-chart-container {
55
+ transform: translateZ(0); /* Force hardware acceleration */
56
+ -webkit-font-smoothing: antialiased;
57
+ -moz-osx-font-smoothing: grayscale;
58
+ text-rendering: optimizeLegibility;
59
+ }
60
+
61
+ .__gantt-header-canvas,
62
+ .__gantt-main-canvas {
63
+ image-rendering: -webkit-optimize-contrast;
64
+ image-rendering: crisp-edges;
65
+ shape-rendering: crispEdges;
66
+ /* Add font rendering optimizations */
67
+ -webkit-font-smoothing: antialiased;
68
+ -moz-osx-font-smoothing: grayscale;
69
+ text-rendering: optimizeSpeed;
47
70
  }
48
71
 
49
72
  /* Tooltip */
package/dist/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * gantt-canvas-chart v1.0.1-alpha.0
2
+ * gantt-canvas-chart v1.0.2
3
3
  * (c) 2025-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -145,8 +145,8 @@ class GanttChart {
145
145
  offsetTop: 0,
146
146
  offsetLeft: 0,
147
147
  viewFactors: { Day: 80, Week: 20, Month: 15, Year: 6 },
148
- planBorderColor: "#caeed2",
149
- actualBgColor: "#78c78f",
148
+ planBorderColor: "#C1EFCF",
149
+ actualBgColor: "#5AC989",
150
150
  ...config
151
151
  };
152
152
  this.headerCanvas = headerCanvas;
@@ -381,6 +381,7 @@ class GanttChart {
381
381
  ctx.fillStyle = "#f9f9f9";
382
382
  ctx.fillRect(this.scrollLeft, 0, this.viewportWidth, h);
383
383
  ctx.textBaseline = "middle";
384
+ ctx.textRendering = "optimizeLegibility";
384
385
  let currentDate = new Date(this.visibleDateRange.start);
385
386
  currentDate = this.getIterationStartDate(currentDate);
386
387
  let lastUpperText = "";
@@ -447,13 +448,14 @@ class GanttChart {
447
448
  const unitWidth = this.dateToX(nextDate) - x;
448
449
  if (upperText !== lastUpperText) {
449
450
  ctx.fillStyle = "#333";
450
- ctx.font = "bold 13px sans-serif";
451
+ ctx.font = 'bold 13px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif';
452
+ ctx.textRendering = "optimizeLegibility";
451
453
  ctx.textAlign = "left";
452
454
  ctx.fillText(upperText, x + 5, h * 0.35);
453
455
  lastUpperText = upperText;
454
456
  }
455
- ctx.fillStyle = "#666";
456
- ctx.font = "12px sans-serif";
457
+ ctx.fillStyle = "#000412";
458
+ ctx.font = '12px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif';
457
459
  ctx.textAlign = "center";
458
460
  ctx.fillText(lowerText, x + unitWidth / 2, h * 0.7);
459
461
  ctx.beginPath();
@@ -567,7 +569,9 @@ class GanttChart {
567
569
  }
568
570
  drawAllTasks(ctx) {
569
571
  ctx.textBaseline = "middle";
570
- ctx.font = "12px Arial";
572
+ ctx.font = '12px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif';
573
+ ctx.textRendering = "optimizeSpeed";
574
+ ctx.imageSmoothingEnabled = false;
571
575
  for (let i = 0; i < this.data.length; i++) {
572
576
  const row = this.data[i];
573
577
  const y = i * this.config.rowHeight;
@@ -584,7 +588,7 @@ class GanttChart {
584
588
  }
585
589
  }
586
590
  drawGrid(ctx, startDate, endDate) {
587
- ctx.strokeStyle = "#f0f0f0";
591
+ ctx.strokeStyle = "#e6e6e6";
588
592
  ctx.lineWidth = 1;
589
593
  ctx.beginPath();
590
594
  if (this.config.showRowLines) {
@@ -699,7 +703,7 @@ class GanttChart {
699
703
  ctx.lineTo(pos.x_plan_start + width * percent_plan, taskY);
700
704
  ctx.stroke();
701
705
  }
702
- ctx.fillStyle = "#333";
706
+ ctx.fillStyle = "#000";
703
707
  if (this.config.showLeftRemark && task.leftRemark) {
704
708
  ctx.textAlign = "right";
705
709
  ctx.fillText(task.leftRemark, Math.min(...[pos.x_plan_start, pos.x_actual_start].filter((val) => val !== null && val !== void 0)) - 8, textY);
@@ -808,5 +812,6 @@ class GanttChart {
808
812
  }
809
813
  export {
810
814
  DateUtils,
811
- GanttChart
815
+ GanttChart,
816
+ firstValidValue
812
817
  };
package/dist/index.umd.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * gantt-canvas-chart v1.0.1-alpha.0
2
+ * gantt-canvas-chart v1.0.2
3
3
  * (c) 2025-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -149,8 +149,8 @@
149
149
  offsetTop: 0,
150
150
  offsetLeft: 0,
151
151
  viewFactors: { Day: 80, Week: 20, Month: 15, Year: 6 },
152
- planBorderColor: "#caeed2",
153
- actualBgColor: "#78c78f",
152
+ planBorderColor: "#C1EFCF",
153
+ actualBgColor: "#5AC989",
154
154
  ...config
155
155
  };
156
156
  this.headerCanvas = headerCanvas;
@@ -385,6 +385,7 @@
385
385
  ctx.fillStyle = "#f9f9f9";
386
386
  ctx.fillRect(this.scrollLeft, 0, this.viewportWidth, h);
387
387
  ctx.textBaseline = "middle";
388
+ ctx.textRendering = "optimizeLegibility";
388
389
  let currentDate = new Date(this.visibleDateRange.start);
389
390
  currentDate = this.getIterationStartDate(currentDate);
390
391
  let lastUpperText = "";
@@ -451,13 +452,14 @@
451
452
  const unitWidth = this.dateToX(nextDate) - x;
452
453
  if (upperText !== lastUpperText) {
453
454
  ctx.fillStyle = "#333";
454
- ctx.font = "bold 13px sans-serif";
455
+ ctx.font = 'bold 13px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif';
456
+ ctx.textRendering = "optimizeLegibility";
455
457
  ctx.textAlign = "left";
456
458
  ctx.fillText(upperText, x + 5, h * 0.35);
457
459
  lastUpperText = upperText;
458
460
  }
459
- ctx.fillStyle = "#666";
460
- ctx.font = "12px sans-serif";
461
+ ctx.fillStyle = "#000412";
462
+ ctx.font = '12px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif';
461
463
  ctx.textAlign = "center";
462
464
  ctx.fillText(lowerText, x + unitWidth / 2, h * 0.7);
463
465
  ctx.beginPath();
@@ -571,7 +573,9 @@
571
573
  }
572
574
  drawAllTasks(ctx) {
573
575
  ctx.textBaseline = "middle";
574
- ctx.font = "12px Arial";
576
+ ctx.font = '12px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif';
577
+ ctx.textRendering = "optimizeSpeed";
578
+ ctx.imageSmoothingEnabled = false;
575
579
  for (let i = 0; i < this.data.length; i++) {
576
580
  const row = this.data[i];
577
581
  const y = i * this.config.rowHeight;
@@ -588,7 +592,7 @@
588
592
  }
589
593
  }
590
594
  drawGrid(ctx, startDate, endDate) {
591
- ctx.strokeStyle = "#f0f0f0";
595
+ ctx.strokeStyle = "#e6e6e6";
592
596
  ctx.lineWidth = 1;
593
597
  ctx.beginPath();
594
598
  if (this.config.showRowLines) {
@@ -703,7 +707,7 @@
703
707
  ctx.lineTo(pos.x_plan_start + width * percent_plan, taskY);
704
708
  ctx.stroke();
705
709
  }
706
- ctx.fillStyle = "#333";
710
+ ctx.fillStyle = "#000";
707
711
  if (this.config.showLeftRemark && task.leftRemark) {
708
712
  ctx.textAlign = "right";
709
713
  ctx.fillText(task.leftRemark, Math.min(...[pos.x_plan_start, pos.x_actual_start].filter((val) => val !== null && val !== void 0)) - 8, textY);
@@ -812,5 +816,6 @@
812
816
  }
813
817
  exports2.DateUtils = DateUtils;
814
818
  exports2.GanttChart = GanttChart;
819
+ exports2.firstValidValue = firstValidValue;
815
820
  Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
816
821
  }));
package/dist/main.d.ts CHANGED
@@ -1,4 +1,148 @@
1
- import { GanttChart } from './core/ganttChart';
2
- import { DateUtils } from './core/dateUtils';
3
-
4
- export { GanttChart, DateUtils };
1
+ export declare class DateUtils {
2
+ static readonly ONE_DAY_MS: number;
3
+ static format(date: Date, format?: string): string;
4
+ static addDays(date: Date, days: number): Date;
5
+ static addMonths(date: Date, months: number): Date;
6
+ static addYears(date: Date, years: number): Date;
7
+ static diffDays(date1: Date, date2: Date): number;
8
+ static diffDaysInclusive(date1: Date, date2: Date): number;
9
+ static getDaysInMonth(year: number, month: number): number;
10
+ static getWeekNumber(d: Date): number;
11
+ static getStartOfWeek(d: Date): Date;
12
+ static getStartOfMonth(d: Date): Date;
13
+ static getStartOfYear(d: Date): Date;
14
+ }
15
+
16
+ /**
17
+ * 获取第一个有效值
18
+ * @param args 有效值可选项
19
+ * @returns
20
+ */
21
+ export declare function firstValidValue(...args: any[]): any;
22
+
23
+ export declare class GanttChart {
24
+ private rootContainer;
25
+ private container;
26
+ private data;
27
+ private config;
28
+ private headerCanvas;
29
+ private mainCanvas;
30
+ private scrollDummy;
31
+ private tooltip;
32
+ private headerCtx;
33
+ private mainCtx;
34
+ private timelineStart;
35
+ private timelineEnd;
36
+ private pixelsPerDay;
37
+ private scrollLeft;
38
+ private scrollTop;
39
+ private visibleDateRange;
40
+ private today;
41
+ private devicePixelRatio;
42
+ private viewportWidth;
43
+ private viewportHeight;
44
+ private totalWidth;
45
+ private totalHeight;
46
+ private resizeObserver;
47
+ private taskPositions;
48
+ private taskMap;
49
+ private boundHandleMouseMove;
50
+ private boundHandleMouseLeave;
51
+ private boundHandleScroll;
52
+ constructor(rootContainer: HTMLElement, data: GanttData, config?: GanttConfig);
53
+ private init;
54
+ private buildTaskMap;
55
+ private setupEvents;
56
+ updateConfig(newConfig: GanttConfig): void;
57
+ setData(newData: GanttData): void;
58
+ destroy(): void;
59
+ private calculateFullTimeline;
60
+ private updatePixelsPerDay;
61
+ private dateToX;
62
+ private xToDate;
63
+ private handleResize;
64
+ private handleScroll;
65
+ setScrollTop(scrollTop: number): void;
66
+ private updateVirtualRanges;
67
+ private updateDimensions;
68
+ private setupCanvas;
69
+ private calculateAllTaskPositions;
70
+ private getIterationStartDate;
71
+ render(): void;
72
+ private renderHeader;
73
+ private renderMain;
74
+ private drawArrow;
75
+ private drawAllDependencies;
76
+ private drawAllTasks;
77
+ private drawGrid;
78
+ private drawToday;
79
+ private drawTask;
80
+ private getTaskStyles;
81
+ private handleMouseMove;
82
+ private getTaskTooltipHtml;
83
+ private handleMouseLeave;
84
+ /**
85
+ * 计算任务宽度占的百分比(方便绘制精确到具体时间的每日任务)
86
+ * @param diffMilliseconds 距离目标日期时间的差异毫秒数
87
+ * @param pixelsPerDay 每日的像素数
88
+ * @returns
89
+ */
90
+ static getTaskWidthPercent(diffMilliseconds: number, pixelsPerDay: number): number;
91
+ }
92
+
93
+ declare interface GanttConfig {
94
+ viewMode?: 'Day' | 'Week' | 'Month' | 'Year';
95
+ planBorderColor?: string;
96
+ actualBgColor?: string;
97
+ rowHeight?: number;
98
+ headerHeight?: number;
99
+ showPlan?: boolean;
100
+ showActual?: boolean;
101
+ showRowLines?: boolean;
102
+ showColLines?: boolean;
103
+ showLeftRemark?: boolean;
104
+ showRightRemark?: boolean;
105
+ showCenterRemark?: boolean;
106
+ showTooltip?: boolean;
107
+ tooltipColor?: 'black' | 'white';
108
+ todayColor?: string;
109
+ offsetTop?: number;
110
+ offsetLeft?: number;
111
+ viewFactors?: {
112
+ Day: number;
113
+ Week: number;
114
+ Month: number;
115
+ Year: number;
116
+ };
117
+ tooltipFormat?: null | ((task: Row, date: Date, config: GanttConfig) => string);
118
+ }
119
+
120
+ declare type GanttData = Row[];
121
+
122
+ declare interface Row {
123
+ id: string;
124
+ name: string;
125
+ tasks: Task[];
126
+ }
127
+
128
+ declare interface Task {
129
+ id: string;
130
+ name: string;
131
+ type?: 'task' | 'leave';
132
+ planStart?: string;
133
+ planEnd?: string;
134
+ actualStart?: string;
135
+ actualEnd?: string;
136
+ dependencies?: string[];
137
+ leftRemark?: string;
138
+ rightRemark?: string;
139
+ centerRemark?: string;
140
+ styleClass?: string;
141
+ planBorderColor?: string;
142
+ actualBgColor?: string;
143
+ _data?: any;
144
+ planOffsetPercent?: [number, number];
145
+ actualOffsetPercent?: [number, number];
146
+ }
147
+
148
+ export { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gantt-canvas-chart",
3
- "version": "1.0.1-alpha.0",
3
+ "version": "1.0.2",
4
4
  "description": "High performance Gantt chart component based on Canvas, can be applied to any framework",
5
5
  "type": "module",
6
6
  "main": "dist/index.es.js",
@@ -10,10 +10,11 @@
10
10
  "jsdelivr": "dist/index.umd.js",
11
11
  "exports": {
12
12
  ".": {
13
+ "types": "./dist/types/main.d.ts",
13
14
  "import": "./dist/index.es.js",
14
15
  "require": "./dist/index.umd.cjs"
15
16
  },
16
- "./styles": "./dist/index.css"
17
+ "./style.css": "./dist/index.css"
17
18
  },
18
19
  "files": [
19
20
  "dist"
@@ -38,9 +39,9 @@
38
39
  },
39
40
  "devDependencies": {
40
41
  "@types/node": "^24.10.1",
41
- "typescript": "^5.0.0",
42
+ "typescript": "~5.8.0",
42
43
  "vite": "^7.2.2",
43
44
  "vite-plugin-banner": "^0.8.1",
44
- "vite-plugin-dts": "^3.0.0"
45
+ "vite-plugin-dts": "^4.5.4"
45
46
  }
46
47
  }
@@ -1,14 +0,0 @@
1
- export declare class DateUtils {
2
- static readonly ONE_DAY_MS: number;
3
- static format(date: Date, format?: string): string;
4
- static addDays(date: Date, days: number): Date;
5
- static addMonths(date: Date, months: number): Date;
6
- static addYears(date: Date, years: number): Date;
7
- static diffDays(date1: Date, date2: Date): number;
8
- static diffDaysInclusive(date1: Date, date2: Date): number;
9
- static getDaysInMonth(year: number, month: number): number;
10
- static getWeekNumber(d: Date): number;
11
- static getStartOfWeek(d: Date): Date;
12
- static getStartOfMonth(d: Date): Date;
13
- static getStartOfYear(d: Date): Date;
14
- }
@@ -1,71 +0,0 @@
1
- import { GanttData, GanttConfig } from './types';
2
-
3
- export declare class GanttChart {
4
- private rootContainer;
5
- private container;
6
- private data;
7
- private config;
8
- private headerCanvas;
9
- private mainCanvas;
10
- private scrollDummy;
11
- private tooltip;
12
- private headerCtx;
13
- private mainCtx;
14
- private timelineStart;
15
- private timelineEnd;
16
- private pixelsPerDay;
17
- private scrollLeft;
18
- private scrollTop;
19
- private visibleDateRange;
20
- private today;
21
- private devicePixelRatio;
22
- private viewportWidth;
23
- private viewportHeight;
24
- private totalWidth;
25
- private totalHeight;
26
- private resizeObserver;
27
- private taskPositions;
28
- private taskMap;
29
- private boundHandleMouseMove;
30
- private boundHandleMouseLeave;
31
- private boundHandleScroll;
32
- constructor(rootContainer: HTMLElement, data: GanttData, config?: GanttConfig);
33
- private init;
34
- private buildTaskMap;
35
- private setupEvents;
36
- updateConfig(newConfig: GanttConfig): void;
37
- setData(newData: GanttData): void;
38
- destroy(): void;
39
- private calculateFullTimeline;
40
- private updatePixelsPerDay;
41
- private dateToX;
42
- private xToDate;
43
- private handleResize;
44
- private handleScroll;
45
- setScrollTop(scrollTop: number): void;
46
- private updateVirtualRanges;
47
- private updateDimensions;
48
- private setupCanvas;
49
- private calculateAllTaskPositions;
50
- private getIterationStartDate;
51
- render(): void;
52
- private renderHeader;
53
- private renderMain;
54
- private drawArrow;
55
- private drawAllDependencies;
56
- private drawAllTasks;
57
- private drawGrid;
58
- private drawToday;
59
- private drawTask;
60
- private getTaskStyles;
61
- private handleMouseMove;
62
- private getTaskTooltipHtml;
63
- private handleMouseLeave;
64
- /**
65
- * 计算任务宽度占的百分比(方便绘制精确到具体时间的每日任务)
66
- * @param diffMilliseconds 距离目标日期时间的差异毫秒数
67
- * @param pixelsPerDay 每日的像素数
68
- * @returns
69
- */
70
- static getTaskWidthPercent(diffMilliseconds: number, pixelsPerDay: number): number;
71
- }
@@ -1,63 +0,0 @@
1
- export interface Task {
2
- id: string;
3
- name: string;
4
- type?: 'task' | 'leave';
5
- planStart?: string;
6
- planEnd?: string;
7
- actualStart?: string;
8
- actualEnd?: string;
9
- dependencies?: string[];
10
- leftRemark?: string;
11
- rightRemark?: string;
12
- centerRemark?: string;
13
- styleClass?: string;
14
- planBorderColor?: string;
15
- actualBgColor?: string;
16
- _data?: any;
17
- planOffsetPercent?: [number, number];
18
- actualOffsetPercent?: [number, number];
19
- }
20
- export interface Row {
21
- id: string;
22
- name: string;
23
- tasks: Task[];
24
- }
25
- export type GanttData = Row[];
26
- export interface GanttConfig {
27
- viewMode?: 'Day' | 'Week' | 'Month' | 'Year';
28
- planBorderColor?: string;
29
- actualBgColor?: string;
30
- rowHeight?: number;
31
- headerHeight?: number;
32
- showPlan?: boolean;
33
- showActual?: boolean;
34
- showRowLines?: boolean;
35
- showColLines?: boolean;
36
- showLeftRemark?: boolean;
37
- showRightRemark?: boolean;
38
- showCenterRemark?: boolean;
39
- showTooltip?: boolean;
40
- tooltipColor?: 'black' | 'white';
41
- todayColor?: string;
42
- offsetTop?: number;
43
- offsetLeft?: number;
44
- viewFactors?: {
45
- Day: number;
46
- Week: number;
47
- Month: number;
48
- Year: number;
49
- };
50
- tooltipFormat?: null | ((task: Row, date: Date, config: GanttConfig) => string);
51
- }
52
- export interface TaskPosition {
53
- x_plan_start: number;
54
- x_plan_end: number;
55
- x_actual_start: number | null;
56
- x_actual_end: number | null;
57
- y: number;
58
- row: number;
59
- }
60
- export interface VisibleDateRange {
61
- start: Date;
62
- end: Date;
63
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * 获取第一个有效值
3
- * @param args 有效值可选项
4
- * @returns
5
- */
6
- export declare function firstValidValue(...args: any[]): any;