@xpyjs/gantt-core 0.0.1-alpha.1 → 0.0.1-alpha.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.
Files changed (54) hide show
  1. package/package.json +2 -2
  2. package/dist/style.css +0 -1
  3. package/dist/x-gantt.js +0 -5793
  4. package/dist/x-gantt.umd.cjs +0 -18
  5. package/types/GanttContext.d.ts +0 -33
  6. package/types/XGantt.d.ts +0 -243
  7. package/types/event/index.d.ts +0 -65
  8. package/types/index.d.ts +0 -12
  9. package/types/logo.d.ts +0 -2
  10. package/types/models/Task.d.ts +0 -67
  11. package/types/rendering/RenderScheduler.d.ts +0 -93
  12. package/types/rendering/Renderer.d.ts +0 -51
  13. package/types/rendering/chart/ChartBody.d.ts +0 -102
  14. package/types/rendering/chart/ChartGrid.d.ts +0 -37
  15. package/types/rendering/chart/ChartHeader.d.ts +0 -54
  16. package/types/rendering/chart/ChartHoliday.d.ts +0 -38
  17. package/types/rendering/chart/ChartLink.d.ts +0 -85
  18. package/types/rendering/chart/ChartRow.d.ts +0 -17
  19. package/types/rendering/chart/ChartSlider.d.ts +0 -54
  20. package/types/rendering/chart/ChartToday.d.ts +0 -31
  21. package/types/rendering/chart/ChartWeekend.d.ts +0 -43
  22. package/types/rendering/chart/Pattern.d.ts +0 -19
  23. package/types/rendering/chart/index.d.ts +0 -33
  24. package/types/rendering/other/GuideLine.d.ts +0 -50
  25. package/types/rendering/other/MiddleResizeLine.d.ts +0 -14
  26. package/types/rendering/scrollbar/index.d.ts +0 -131
  27. package/types/rendering/table/Checkbox.d.ts +0 -39
  28. package/types/rendering/table/TableBody.d.ts +0 -25
  29. package/types/rendering/table/TableCell.d.ts +0 -43
  30. package/types/rendering/table/TableHeader.d.ts +0 -13
  31. package/types/rendering/table/TableHeaderCell.d.ts +0 -20
  32. package/types/rendering/table/TableHeaderGroup.d.ts +0 -15
  33. package/types/rendering/table/TableRow.d.ts +0 -57
  34. package/types/rendering/table/index.d.ts +0 -15
  35. package/types/store/ColumnManager.d.ts +0 -75
  36. package/types/store/DataManager.d.ts +0 -119
  37. package/types/store/OptionManager.d.ts +0 -11
  38. package/types/store/TimeAxis.d.ts +0 -88
  39. package/types/store/index.d.ts +0 -21
  40. package/types/types/chart.d.ts +0 -59
  41. package/types/types/event.d.ts +0 -21
  42. package/types/types/global.d.ts +0 -9
  43. package/types/types/index.d.ts +0 -21
  44. package/types/types/link.d.ts +0 -23
  45. package/types/types/options.d.ts +0 -552
  46. package/types/types/render.d.ts +0 -26
  47. package/types/types/styles.d.ts +0 -37
  48. package/types/types/table.d.ts +0 -134
  49. package/types/utils/color.d.ts +0 -148
  50. package/types/utils/helpers.d.ts +0 -43
  51. package/types/utils/id.d.ts +0 -1
  52. package/types/utils/logger.d.ts +0 -88
  53. package/types/utils/size.d.ts +0 -7
  54. package/types/utils/time.d.ts +0 -9
@@ -1,54 +0,0 @@
1
- import Konva from "konva";
2
- import { IContext } from "@/types/render";
3
- export declare class HeaderLayer {
4
- private context;
5
- private stage;
6
- layer: Konva.Layer;
7
- private background;
8
- private groupHeader;
9
- private cellHeader;
10
- private cellCache;
11
- private width;
12
- private height;
13
- private offsetX;
14
- constructor(context: IContext, stage: Konva.Stage);
15
- /**
16
- * 调整表头大小
17
- */
18
- resize(width: number): void;
19
- /**
20
- * 设置偏移量 (响应滚动)
21
- * 表头只需要水平滚动,不需要垂直滚动
22
- */
23
- setOffset(x: number, y: number): void;
24
- /**
25
- * 注册事件监听
26
- */
27
- private registerEvents;
28
- /**
29
- * 渲染表头
30
- */
31
- render(): void;
32
- /**
33
- * 计算并绘制表头
34
- */
35
- private calculateHeader;
36
- private createCell;
37
- /**
38
- * 清除表头内容
39
- */
40
- private clearHeader;
41
- /**
42
- * 销毁表头层
43
- */
44
- destroy(): void;
45
- /**
46
- * 高亮日期
47
- */
48
- private highlightDate;
49
- /**
50
- * 取消高亮日期
51
- */
52
- private unhighlightDate;
53
- private handleHighlight;
54
- }
@@ -1,38 +0,0 @@
1
- import Konva from "konva";
2
- import { IContext } from "@/types/render";
3
- /**
4
- * 假期渲染
5
- * 用于在甘特图中标记假期区域
6
- */
7
- export declare class HolidayGroup {
8
- private context;
9
- private layer;
10
- private width;
11
- private height;
12
- private offsetX;
13
- private offsetY;
14
- private holidayGroup;
15
- private patternImage;
16
- constructor(context: IContext, layer: Konva.Layer);
17
- /**
18
- * 调整假期大小
19
- */
20
- resize(width: number, height: number): void;
21
- /**
22
- * 设置偏移量 (响应滚动)
23
- */
24
- setOffset(x: number, y: number): void;
25
- /**
26
- * 渲染假期
27
- */
28
- render(): void;
29
- /**
30
- * 销毁假期层
31
- */
32
- destroy(): void;
33
- private clearHoliday;
34
- /**
35
- * 计算假期
36
- */
37
- private calculateHoliday;
38
- }
@@ -1,85 +0,0 @@
1
- import Konva from "konva";
2
- import { IContext } from "@/types/render";
3
- import type { Task } from "@/models/Task";
4
- export declare class LinkGroup {
5
- private context;
6
- private stage;
7
- private layer;
8
- private tasks;
9
- private pointGroup;
10
- private linksGroup;
11
- private templateArrow;
12
- private isDragging;
13
- private selectedMap;
14
- private width;
15
- private height;
16
- private offsetX;
17
- private offsetY;
18
- constructor(context: IContext, stage: Konva.Stage, layer: Konva.Layer);
19
- /**
20
- * 注册事件
21
- */
22
- private registerEvents;
23
- /**
24
- * 调整关联线大小
25
- */
26
- resize(width: number, height: number): void;
27
- /**
28
- * 设置偏移量 (响应滚动)
29
- */
30
- setOffset(x: number, y: number): void;
31
- /**
32
- * 更新数据
33
- */
34
- update(): void;
35
- /**
36
- * 渲染关联线
37
- */
38
- render(tasks: Task[]): void;
39
- /**
40
- * 销毁关联线
41
- */
42
- destroy(): void;
43
- /**
44
- * 计算点组位置
45
- */
46
- private calculatePoints;
47
- /**
48
- * 计算关联线位置
49
- */
50
- private calculateLinks;
51
- /** 生成 FS 连线 */
52
- private createFS;
53
- /** 生成 FF 连线 */
54
- private createFF;
55
- /** 生成 SS 连线 */
56
- private createSS;
57
- /** 生成 SF 连线 */
58
- private createSF;
59
- /**
60
- * 处理连线被点击后的移动
61
- */
62
- private handleDrag;
63
- /**
64
- * 处理连线被点击后的移动
65
- */
66
- private createLink;
67
- /**
68
- * 按照位置获取任务
69
- */
70
- private getTaskByPosition;
71
- /**
72
- * 检查当前连接点是否可以被创建
73
- */
74
- private isAllowDrop;
75
- /**
76
- * 操作高亮关联线
77
- */
78
- private handleHighlight;
79
- /** 高亮创建点 */
80
- private highlightPoint;
81
- /** 取消高亮创建点 */
82
- private unhighlightPoint;
83
- /** 操作创建点的高亮 */
84
- private handlePointHighlight;
85
- }
@@ -1,17 +0,0 @@
1
- import Konva from "konva";
2
- import { ChartSlider } from "./ChartSlider";
3
- import { IContext } from "@/types/render";
4
- import type { Task } from "@/models/Task";
5
- export declare class ChartRow {
6
- private context;
7
- task: Task;
8
- private width;
9
- private height;
10
- row: Konva.Group;
11
- slider: ChartSlider;
12
- cacheKey: string;
13
- constructor(context: IContext, task: Task, id: string, x: number, y: number, width: number, height: number);
14
- update(x: number, y: number): void;
15
- setOffset(x: number, y: number): void;
16
- destroy(): void;
17
- }
@@ -1,54 +0,0 @@
1
- import Konva from "konva";
2
- import { IContext } from "@/types/render";
3
- import type { Task } from "@/models/Task";
4
- export declare class ChartSlider {
5
- private context;
6
- private x;
7
- private y;
8
- private task;
9
- private rowWidth;
10
- private offsetX;
11
- private offsetY;
12
- sliderGroup: Konva.Group;
13
- private slider;
14
- private sliderBg;
15
- private leftHandler;
16
- private rightHandler;
17
- private progressGroup;
18
- private handlerWidth;
19
- private autoMoveTimer;
20
- private autoScrollTimer;
21
- private autoExpandTimer;
22
- private readonly EDGE_THRESHOLD;
23
- private readonly SCROLL_STEP;
24
- private readonly MOVE_INTERVAL;
25
- private readonly AUTO_EXPAND_INTERVAL;
26
- private isDragging;
27
- private draggingDirection;
28
- private oldTasks;
29
- constructor(context: IContext, x: number, y: number, task: Task, rowWidth: number);
30
- update(x: number, y: number): void;
31
- setOffset(x: number, y: number): void;
32
- private updateSize;
33
- private render;
34
- private renderText;
35
- private renderProgress;
36
- private bindEvents;
37
- /**
38
- * 移动后更新任务时间
39
- */
40
- private emitUpdate;
41
- private handleDragStart;
42
- private handleDragMove;
43
- private handleDragEnd;
44
- private handleMove;
45
- private resizeMove;
46
- private startAutoExpand;
47
- private startAutoScroll;
48
- private stopAutoMove;
49
- private stopAutoScroll;
50
- private stopAutoExpand;
51
- private handleMouseEnter;
52
- private handleMouseLeave;
53
- private handleResizeHighlight;
54
- }
@@ -1,31 +0,0 @@
1
- import Konva from "konva";
2
- import { IContext } from "@/types/render";
3
- export declare class ChartToday {
4
- private context;
5
- private bgLayer;
6
- private headerLayer;
7
- private arrowAnimation?;
8
- private todayLine?;
9
- private triangle?;
10
- private width;
11
- private height;
12
- private offsetX;
13
- private offsetY;
14
- constructor(context: IContext, bgLayer: Konva.Layer, headerLayer: Konva.Layer);
15
- /**
16
- * 调整大小
17
- */
18
- resize(width: number, height: number): void;
19
- /**
20
- * 设置偏移量 (响应滚动)
21
- */
22
- setOffset(x: number, y: number): void;
23
- /**
24
- * 渲染今日线
25
- */
26
- render(): void;
27
- /**
28
- * 销毁今日线
29
- */
30
- destroy(): void;
31
- }
@@ -1,43 +0,0 @@
1
- import Konva from "konva";
2
- import dayjs from "../../utils/time";
3
- import { IContext } from "@/types/render";
4
- /**
5
- * 周末周末渲染
6
- * 用于在甘特图中标记周末区域
7
- */
8
- export declare class WeekendGroup {
9
- private context;
10
- private layer;
11
- private width;
12
- private height;
13
- private offsetX;
14
- private offsetY;
15
- private weekendGroup;
16
- private patternImage;
17
- constructor(context: IContext, layer: Konva.Layer);
18
- /**
19
- * 检查日期是否为周末
20
- */
21
- isWeekend(date: dayjs.Dayjs): boolean;
22
- /**
23
- * 调整周末大小
24
- */
25
- resize(width: number, height: number): void;
26
- /**
27
- * 设置偏移量 (响应滚动)
28
- */
29
- setOffset(x: number, y: number): void;
30
- /**
31
- * 渲染周末
32
- */
33
- render(): void;
34
- /**
35
- * 销毁周末层
36
- */
37
- destroy(): void;
38
- private clearWeekend;
39
- /**
40
- * 计算周末
41
- */
42
- private calculateWeekend;
43
- }
@@ -1,19 +0,0 @@
1
- import { IPattern } from "@/types/styles";
2
- export declare class Pattern {
3
- private constructor();
4
- static createPattern(pattern?: IPattern & {
5
- backgroundColor?: string;
6
- }): Promise<HTMLImageElement | null>;
7
- /**
8
- * 创建条纹图案
9
- */
10
- private static createStripePattern;
11
- /**
12
- * 创建圆点图案
13
- */
14
- private static createDotPattern;
15
- /**
16
- * 创建网格图案
17
- */
18
- private static createGridPattern;
19
- }
@@ -1,33 +0,0 @@
1
- import { IContext } from "@/types/render";
2
- import type { Task } from "@/models/Task";
3
- export declare class Chart {
4
- private context;
5
- private container;
6
- private stage;
7
- private headerLayer;
8
- private bodyGroup;
9
- private gridGroup;
10
- private weekendGroup;
11
- private holidayGroup;
12
- private todayLayer;
13
- private linkGroup;
14
- private bgLayer;
15
- private bodyLayer;
16
- private width;
17
- private height;
18
- constructor(context: IContext, container: HTMLDivElement);
19
- /**
20
- * 调整大小
21
- */
22
- resize(width: number, height: number): void;
23
- render(x: number, y: number, tasks: Task[]): void;
24
- /**
25
- * 刷新图表(用于滚动或局部更新时的高效渲染)
26
- */
27
- refresh(x: number, y: number, tasks: Task[]): void;
28
- /**
29
- * 更新任务
30
- */
31
- updateTask(task: Task): void;
32
- destroy(): void;
33
- }
@@ -1,50 +0,0 @@
1
- import { IContext } from "@/types/render";
2
- /**
3
- * 全局指示线类
4
- * 用于在拖拽调整大小时显示垂直参考线
5
- */
6
- export declare class GuideLine {
7
- private context;
8
- private element;
9
- private container;
10
- private visible;
11
- /**
12
- * @param container 指示线的容器元素
13
- */
14
- constructor(context: IContext, container: HTMLElement);
15
- /**
16
- * 初始化指示线元素
17
- */
18
- private initElement;
19
- /**
20
- * 初始化事件监听
21
- */
22
- private initEvents;
23
- /**
24
- * 设置指示线容器
25
- * @param container 新的容器元素
26
- */
27
- setContainer(container: HTMLElement): void;
28
- /**
29
- * 设置指示线左侧位置
30
- * @param left 左侧位置值,单位px
31
- */
32
- setLeft(left: number): void;
33
- /**
34
- * 显示指示线
35
- * @param left 可选参数,显示时设置的左侧位置
36
- */
37
- show(left?: number): void;
38
- /**
39
- * 隐藏指示线
40
- */
41
- hide(): void;
42
- /**
43
- * 检查指示线是否可见
44
- */
45
- isVisible(): boolean;
46
- /**
47
- * 获取当前位置
48
- */
49
- getLeft(): number;
50
- }
@@ -1,14 +0,0 @@
1
- import { IContext } from "@/types/render";
2
- export declare class MiddleResizeLine {
3
- private root;
4
- private container;
5
- private line;
6
- private initialX;
7
- private initialWidth;
8
- constructor(root: IContext, container: HTMLElement);
9
- setOffset(x: number): void;
10
- /**
11
- * 添加拖拽事件
12
- */
13
- private addDragEvents;
14
- }
@@ -1,131 +0,0 @@
1
- import { IGanttOptions } from "@/types/options";
2
- import { IContext } from "@/types/render";
3
- type ScrollbarOptions = NonNullable<IGanttOptions["scrollbar"]>;
4
- /**
5
- * 滚动事件数据
6
- */
7
- interface ScrollEventData {
8
- x: number;
9
- y: number;
10
- source: "drag" | "wheel" | "api" | "track";
11
- }
12
- /**
13
- * 自定义滚动区域,用于替代原生滚动条,提供更好的样式控制和交互体验。
14
- * 负责容器元素的滚动条显示、隐藏、拖拽滚动、程序化滚动等。
15
- * 监听整个根元素的滚动事件,实现平滑统一的滚动效果。
16
- *
17
- * @example
18
- * // 实例化
19
- * const scrollbar = new Scrollbar(rootElement, ganttInstance.events, options);
20
- *
21
- * // 当内容或视口尺寸变化时更新
22
- * scrollbar.updateSize(viewportWidth, viewportHeight, contentWidth, contentHeight);
23
- *
24
- * // 程序化滚动 (会平滑滚动)
25
- * scrollbar.scrollTo({x: 100, y: 100});
26
- *
27
- * // 获取当前滚动位置
28
- * const { x, y } = scrollbar.getScrollPosition();
29
- *
30
- * // 销毁
31
- * scrollbar.destroy();
32
- */
33
- export declare class Scrollbar {
34
- private root;
35
- private rootElement;
36
- private options;
37
- private hScrollbar;
38
- private vScrollbar;
39
- private hScrollThumb;
40
- private vScrollThumb;
41
- private scrollbarContainer;
42
- private viewportWidth;
43
- private viewportHeight;
44
- private contentWidth;
45
- private contentHeight;
46
- private scrollLeft;
47
- private scrollTop;
48
- private isDraggingHScroll;
49
- private isDraggingVScroll;
50
- private isMouseOverRoot;
51
- private isMouseOverScrollbar;
52
- private hideTimeout;
53
- private showTimeout;
54
- private isVisible;
55
- private dragStartX;
56
- private dragStartY;
57
- private thumbStartScrollLeft;
58
- private thumbStartScrollTop;
59
- private isAnimating;
60
- private animationFrameId;
61
- private animationStartTime;
62
- private animationStartScrollLeft;
63
- private animationStartScrollTop;
64
- private animationTargetScrollLeft;
65
- private animationTargetScrollTop;
66
- private animationSource;
67
- private throttledHandleMouseMove;
68
- private throttledHandleWheel;
69
- constructor(root: IContext, rootElement: HTMLElement, options?: Partial<ScrollbarOptions>);
70
- private createElements;
71
- private createScrollbarElement;
72
- private createScrollThumbElement;
73
- private applyStyles;
74
- private applyScrollbarStyles;
75
- private applyThumbStyles;
76
- private bindEvents;
77
- private unbindEvents;
78
- private handleRootMouseMove;
79
- private handleScrollbarMouseEnter;
80
- private handleScrollbarMouseLeave;
81
- private handleMouseEnter;
82
- private handleMouseLeave;
83
- private handleHorizontalThumbMouseDown;
84
- private handleVerticalThumbMouseDown;
85
- private handleHorizontalTrackMouseDown;
86
- private handleVerticalTrackMouseDown;
87
- private handleMouseMove;
88
- private handleMouseUp;
89
- private handleWheel;
90
- private animateWheelScroll;
91
- private clearTimeouts;
92
- private scheduleShow;
93
- private showScrollbars;
94
- private scheduleHide;
95
- private hideScrollbars;
96
- /**
97
- * 更新视口和内容尺寸,并重新计算滚动条状态。
98
- * @param viewportWidth 可见区域宽度
99
- * @param viewportHeight 可见区域高度
100
- * @param contentWidth 内容总宽度
101
- * @param contentHeight 内容总高度
102
- * @param tableWidth 左侧表格宽度 (用于调整水平滚动条的起始位置和宽度)
103
- * @param headerHeight 头部高度 (用于调整垂直滚动条的起始位置和高度)
104
- */
105
- updateSize(viewportWidth: number, viewportHeight: number, contentWidth: number, contentHeight: number, tableWidth?: number, // 甘特图左侧表格宽度
106
- headerHeight?: number): void;
107
- private updateThumbStyles;
108
- private canScrollHorizontal;
109
- private canScrollVertical;
110
- private clampScroll;
111
- /**
112
- * 滚动到指定位置
113
- * @param pos 目标滚动位置 {x, y}
114
- * @param source 滚动来源
115
- */
116
- scrollTo(pos: {
117
- x?: number;
118
- y?: number;
119
- }, source?: ScrollEventData["source"]): void;
120
- private animationStep;
121
- private cancelAnimation;
122
- /**
123
- * 获取当前滚动位置
124
- */
125
- getScrollPosition(): {
126
- x: number;
127
- y: number;
128
- };
129
- destroy(): void;
130
- }
131
- export {};
@@ -1,39 +0,0 @@
1
- import { IContext } from "@/types/render";
2
- import type { Task } from "@/models/Task";
3
- export declare enum CheckboxState {
4
- UNCHECKED = 0,// 未选中
5
- CHECKED = 1,// 选中
6
- INDETERMINATE = 2
7
- }
8
- export interface CheckboxOptions {
9
- initialState: CheckboxState;
10
- size: number;
11
- }
12
- export declare class Checkbox {
13
- private context;
14
- private container?;
15
- private task?;
16
- private element;
17
- private iconElement;
18
- private _state;
19
- private options;
20
- constructor(context: IContext, container?: HTMLDivElement | undefined, task?: Task | undefined);
21
- private createElement;
22
- private updateIcon;
23
- private bindEvents;
24
- private registerEvents;
25
- /** 获取元素 */
26
- getElement(): HTMLDivElement;
27
- /**
28
- * 设置状态
29
- */
30
- private setState;
31
- /**
32
- * 更新状态
33
- */
34
- private updateState;
35
- /**
36
- * 销毁组件
37
- */
38
- destroy(): void;
39
- }
@@ -1,25 +0,0 @@
1
- import { IContext } from "@/types/render";
2
- import type { Task } from "@/models/Task";
3
- export declare class TableBody {
4
- private context;
5
- private container;
6
- private element;
7
- private rows;
8
- private mergeRows;
9
- constructor(context: IContext, container: HTMLElement);
10
- render(top: number, tasks: Task[]): void;
11
- /**
12
- * 刷新所有行
13
- */
14
- refresh(top: number, tasks: Task[]): void;
15
- /**
16
- * 更新任务
17
- */
18
- updateTask(task: Task): void;
19
- /** 更新全部行 */
20
- update(): void;
21
- /**
22
- * 更新列宽
23
- */
24
- updateWidth(): void;
25
- }
@@ -1,43 +0,0 @@
1
- import { IContext } from "@/types/render";
2
- import { ITableColumnStandard } from "@/types/table";
3
- import type { Task } from "@/models/Task";
4
- import { IColumn } from "@/store/ColumnManager";
5
- export declare class TableCell {
6
- private context;
7
- private container;
8
- private column;
9
- private task;
10
- private rowIndex;
11
- private colIndex;
12
- private colspan;
13
- private rowspan;
14
- private element;
15
- private isEmpty;
16
- private isHandler;
17
- /**
18
- * 创建表格单元格
19
- * @param container 父容器(tr元素)
20
- * @param column 列配置
21
- * @param task 任务数据
22
- * @param level 任务层级
23
- * @param rowIndex 行索引
24
- * @param colIndex 列索引
25
- * @param colspan 横向合并的列数
26
- * @param rowspan 纵向合并的行数
27
- */
28
- constructor(context: IContext, container: HTMLDivElement, column: IColumn<ITableColumnStandard>, task: Task, rowIndex: number, colIndex: number, colspan?: number, rowspan?: number, type?: "empty" | "handler");
29
- private setContent;
30
- private setHandler;
31
- /**
32
- * 移除单元格
33
- */
34
- remove(): void;
35
- /**
36
- * 更新宽度
37
- */
38
- updateWidth(): void;
39
- /**
40
- * 更新高度
41
- */
42
- updateHeight(): void;
43
- }