@xpyjs/gantt-core 0.0.1-alpha.2 → 0.0.1-alpha.4

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 (57) hide show
  1. package/dist/style.css +1 -0
  2. package/dist/x-gantt.js +6442 -0
  3. package/dist/x-gantt.umd.cjs +18 -0
  4. package/package.json +1 -1
  5. package/types/GanttContext.d.ts +33 -0
  6. package/types/XGantt.d.ts +248 -0
  7. package/types/event/index.d.ts +75 -0
  8. package/types/index.d.ts +13 -0
  9. package/types/logo.d.ts +2 -0
  10. package/types/models/Baseline.d.ts +37 -0
  11. package/types/models/Task.d.ts +77 -0
  12. package/types/rendering/RenderScheduler.d.ts +93 -0
  13. package/types/rendering/Renderer.d.ts +52 -0
  14. package/types/rendering/chart/ChartBaseline.d.ts +50 -0
  15. package/types/rendering/chart/ChartBody.d.ts +102 -0
  16. package/types/rendering/chart/ChartGrid.d.ts +37 -0
  17. package/types/rendering/chart/ChartHeader.d.ts +54 -0
  18. package/types/rendering/chart/ChartHoliday.d.ts +38 -0
  19. package/types/rendering/chart/ChartLink.d.ts +87 -0
  20. package/types/rendering/chart/ChartRow.d.ts +17 -0
  21. package/types/rendering/chart/ChartSlider.d.ts +58 -0
  22. package/types/rendering/chart/ChartToday.d.ts +31 -0
  23. package/types/rendering/chart/ChartWeekend.d.ts +43 -0
  24. package/types/rendering/chart/Pattern.d.ts +19 -0
  25. package/types/rendering/chart/index.d.ts +34 -0
  26. package/types/rendering/other/GuideLine.d.ts +50 -0
  27. package/types/rendering/other/MiddleResizeLine.d.ts +15 -0
  28. package/types/rendering/scrollbar/index.d.ts +132 -0
  29. package/types/rendering/table/Checkbox.d.ts +39 -0
  30. package/types/rendering/table/TableBody.d.ts +25 -0
  31. package/types/rendering/table/TableCell.d.ts +43 -0
  32. package/types/rendering/table/TableHeader.d.ts +13 -0
  33. package/types/rendering/table/TableHeaderCell.d.ts +20 -0
  34. package/types/rendering/table/TableHeaderGroup.d.ts +15 -0
  35. package/types/rendering/table/TableRow.d.ts +57 -0
  36. package/types/rendering/table/index.d.ts +15 -0
  37. package/types/store/ColumnManager.d.ts +81 -0
  38. package/types/store/DataManager.d.ts +132 -0
  39. package/types/store/OptionManager.d.ts +12 -0
  40. package/types/store/TimeAxis.d.ts +88 -0
  41. package/types/store/index.d.ts +21 -0
  42. package/types/types/baseline.d.ts +16 -0
  43. package/types/types/chart.d.ts +59 -0
  44. package/types/types/event.d.ts +29 -0
  45. package/types/types/global.d.ts +9 -0
  46. package/types/types/index.d.ts +26 -0
  47. package/types/types/link.d.ts +23 -0
  48. package/types/types/options.d.ts +827 -0
  49. package/types/types/render.d.ts +26 -0
  50. package/types/types/styles.d.ts +37 -0
  51. package/types/types/table.d.ts +139 -0
  52. package/types/utils/color.d.ts +148 -0
  53. package/types/utils/helpers.d.ts +47 -0
  54. package/types/utils/id.d.ts +1 -0
  55. package/types/utils/logger.d.ts +88 -0
  56. package/types/utils/size.d.ts +7 -0
  57. package/types/utils/time.d.ts +9 -0
@@ -0,0 +1,132 @@
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 emit;
79
+ private handleRootMouseMove;
80
+ private handleScrollbarMouseEnter;
81
+ private handleScrollbarMouseLeave;
82
+ private handleMouseEnter;
83
+ private handleMouseLeave;
84
+ private handleHorizontalThumbMouseDown;
85
+ private handleVerticalThumbMouseDown;
86
+ private handleHorizontalTrackMouseDown;
87
+ private handleVerticalTrackMouseDown;
88
+ private handleMouseMove;
89
+ private handleMouseUp;
90
+ private handleWheel;
91
+ private animateWheelScroll;
92
+ private clearTimeouts;
93
+ private scheduleShow;
94
+ private showScrollbars;
95
+ private scheduleHide;
96
+ private hideScrollbars;
97
+ /**
98
+ * 更新视口和内容尺寸,并重新计算滚动条状态。
99
+ * @param viewportWidth 可见区域宽度
100
+ * @param viewportHeight 可见区域高度
101
+ * @param contentWidth 内容总宽度
102
+ * @param contentHeight 内容总高度
103
+ * @param tableWidth 左侧表格宽度 (用于调整水平滚动条的起始位置和宽度)
104
+ * @param headerHeight 头部高度 (用于调整垂直滚动条的起始位置和高度)
105
+ */
106
+ updateSize(viewportWidth: number, viewportHeight: number, contentWidth: number, contentHeight: number, tableWidth?: number, // 甘特图左侧表格宽度
107
+ headerHeight?: number): void;
108
+ private updateThumbStyles;
109
+ private canScrollHorizontal;
110
+ private canScrollVertical;
111
+ private clampScroll;
112
+ /**
113
+ * 滚动到指定位置
114
+ * @param pos 目标滚动位置 {x, y}
115
+ * @param source 滚动来源
116
+ */
117
+ scrollTo(pos: {
118
+ x?: number;
119
+ y?: number;
120
+ }, source?: ScrollEventData["source"]): void;
121
+ private animationStep;
122
+ private cancelAnimation;
123
+ /**
124
+ * 获取当前滚动位置
125
+ */
126
+ getScrollPosition(): {
127
+ x: number;
128
+ y: number;
129
+ };
130
+ destroy(): void;
131
+ }
132
+ export {};
@@ -0,0 +1,39 @@
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
+ }
@@ -0,0 +1,25 @@
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
+ }
@@ -0,0 +1,43 @@
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
+ }
@@ -0,0 +1,13 @@
1
+ import { IContext } from "@/types/render";
2
+ export declare class TableHeader {
3
+ private context;
4
+ private container;
5
+ private headerElement;
6
+ private headerColumns;
7
+ constructor(context: IContext, container: HTMLElement);
8
+ private initElement;
9
+ /**
10
+ * 渲染表头
11
+ */
12
+ render(): void;
13
+ }
@@ -0,0 +1,20 @@
1
+ import { ITableColumnStandard } from "@/types/table";
2
+ import { IContext } from "@/types/render";
3
+ import { IColumn } from "@/store/ColumnManager";
4
+ export declare class TableHeaderCell {
5
+ private context;
6
+ private root;
7
+ private container;
8
+ private column;
9
+ private columnElement;
10
+ constructor(context: IContext, root: HTMLElement, container: HTMLElement, column: IColumn<ITableColumnStandard>);
11
+ private initElement;
12
+ /**
13
+ * 设置列宽
14
+ */
15
+ private setWidth;
16
+ /**
17
+ * 添加拖拽把手
18
+ */
19
+ private addResizeHandle;
20
+ }
@@ -0,0 +1,15 @@
1
+ import { IContext } from "@/types/render";
2
+ import { IColumn } from "@/store/ColumnManager";
3
+ export declare class TableHeaderGroup {
4
+ private context;
5
+ private root;
6
+ private container;
7
+ private column;
8
+ private groupElement;
9
+ private titleContainer;
10
+ private childContainer;
11
+ private children;
12
+ constructor(context: IContext, root: HTMLElement, container: HTMLElement, column: IColumn);
13
+ private initElement;
14
+ private initChildren;
15
+ }
@@ -0,0 +1,57 @@
1
+ import { IContext } from "@/types/render";
2
+ import type { Task } from "@/models/Task";
3
+ export declare class TableRow {
4
+ private context;
5
+ private container;
6
+ private task;
7
+ private top;
8
+ element: HTMLDivElement;
9
+ private cells;
10
+ /**
11
+ * 创建表格行
12
+ * @param context 上下文
13
+ * @param container 父容器
14
+ * @param task 任务数据
15
+ */
16
+ constructor(context: IContext, container: HTMLDivElement, task: Task, top: number, raising?: boolean);
17
+ /**
18
+ * 绑定触发事件
19
+ */
20
+ private bindEvents;
21
+ /**
22
+ * 注册全局接收事件
23
+ */
24
+ private registerEvents;
25
+ /**
26
+ * 更新行样式
27
+ */
28
+ private updateStyles;
29
+ /**
30
+ * 对元素提级
31
+ */
32
+ raise(): void;
33
+ /**
34
+ * 更新 top 值
35
+ */
36
+ updateTop(top: number): void;
37
+ /**
38
+ * 创建单元格
39
+ */
40
+ create(): void;
41
+ /**
42
+ * 更新行
43
+ */
44
+ update(task: Task): void;
45
+ /**
46
+ * 更新宽度
47
+ */
48
+ updateWidth(): void;
49
+ /**
50
+ * 清除单元格
51
+ */
52
+ private clearCells;
53
+ /**
54
+ * 移除行
55
+ */
56
+ remove(): void;
57
+ }
@@ -0,0 +1,15 @@
1
+ import { IContext } from "@/types/render";
2
+ import type { Task } from "@/models/Task";
3
+ export declare class Table {
4
+ private context;
5
+ private container;
6
+ private tableContainer;
7
+ private tableHeader;
8
+ private tableBody;
9
+ constructor(context: IContext, container: HTMLElement);
10
+ render(top: number, tasks: Task[]): void;
11
+ refresh(top: number, tasks: Task[]): void;
12
+ updateWidth(): void;
13
+ updateTask(task: Task): void;
14
+ private listenEvents;
15
+ }
@@ -0,0 +1,81 @@
1
+ import { ITableColumn, ITableColumnStandard } from "@/types/table";
2
+ import { IContext } from "@/types/render";
3
+ import type { Task } from "@/models/Task";
4
+ /**
5
+ * 内部列数据结构
6
+ */
7
+ export interface IColumn<T extends ITableColumn = ITableColumn> {
8
+ /** 显示文本 */
9
+ label: string;
10
+ /** 层级,默认为1 */
11
+ level: number;
12
+ /** 当前列最大层级 */
13
+ maxLevel: number;
14
+ /** 原始列数据 */
15
+ column: T;
16
+ /** 子项 */
17
+ children: IColumn[];
18
+ /** 列标识符,用于查找 */
19
+ key: string;
20
+ /** 标识数组,用于查找。从根到当前列的路径 */
21
+ path: string[];
22
+ /** 是否为叶子节点 */
23
+ isLeaf: boolean;
24
+ /** 列宽度 */
25
+ width: number | "auto";
26
+ }
27
+ export interface MergeInfo {
28
+ task: Task;
29
+ originColumnIndex: number;
30
+ colspan: number;
31
+ rowspan: number;
32
+ }
33
+ export declare class ColumnManager {
34
+ private context;
35
+ /** 源列数据 */
36
+ private sourceColumns;
37
+ /** 处理后的所有列数据 */
38
+ private columns;
39
+ /** 叶子列数据,只包含最终显示的列 */
40
+ private leafColumns;
41
+ /** 临时叶子列数据,用于更新源数据,读取宽度等原信息 */
42
+ private temporaryLeafColumns;
43
+ /**
44
+ * 保存所有行列合并的信息
45
+ *
46
+ * Map<task_id, Map<col_index, object>>
47
+ */
48
+ private mergeInfo;
49
+ /**
50
+ * 收起表格
51
+ */
52
+ private collapseTable;
53
+ constructor(context: IContext);
54
+ /**
55
+ * 初始化列数据
56
+ */
57
+ init(columns?: ITableColumn[]): void;
58
+ /**
59
+ * 处理列数据,将源数据转换为内部数据结构
60
+ */
61
+ private processColumns;
62
+ /**
63
+ * 根据 key 查找列
64
+ */
65
+ private findColumnByKey;
66
+ update(columns: ITableColumn[]): void;
67
+ getColumns(): IColumn[];
68
+ getColumn(key: string): IColumn | undefined;
69
+ getLeafColumns(): IColumn<ITableColumnStandard>[];
70
+ getTotalWidth(): number;
71
+ getColumnWidth(key: string): number;
72
+ setColumnWidth(key: string, width: number): void;
73
+ isLastColumn(key: string): boolean;
74
+ addMergeInfo(id: string, colIndex: number, info: MergeInfo): void;
75
+ getMergeInfo(id: string, colIndex: number): MergeInfo | undefined;
76
+ clearMergeInfo(): void;
77
+ getHandlerColumn(): IColumn<ITableColumnStandard>;
78
+ isMultiHeader(): boolean;
79
+ collapse(): void;
80
+ isCollapsed(): boolean;
81
+ }
@@ -0,0 +1,132 @@
1
+ import type { Dayjs } from "dayjs";
2
+ import { type EventBus } from "../event";
3
+ import { Task } from "../models/Task";
4
+ import type { Store } from ".";
5
+ import { Baseline } from "../models/Baseline";
6
+ export declare class DataManager {
7
+ private store;
8
+ private event;
9
+ /**
10
+ * 原始数据
11
+ */
12
+ private rawData;
13
+ /**
14
+ * 任务列表。树形结构
15
+ */
16
+ private tasks;
17
+ /**
18
+ * 任务映射,使用ID作为键,便于快速查找
19
+ */
20
+ private taskMap;
21
+ /**
22
+ * 缓存扁平化的可视任务列表
23
+ * 用于提高性能,避免每次都遍历树形结构
24
+ */
25
+ private visibleTasksCache;
26
+ /** 标记缓存是否需要更新 */
27
+ private isDirty;
28
+ /** 缓存被折叠的任务 ID */
29
+ private collapsedTaskIds;
30
+ /** 存储当前选中的任务ID */
31
+ private selectedTaskId;
32
+ /** 选中列表 */
33
+ private checkedList;
34
+ /** 基线数据 */
35
+ private baselines;
36
+ /** 基线映射,使用ID作为键 */
37
+ private baselineMap;
38
+ /** 任务与基线映射,使用任务ID作为键。 一个任务可以对应多条基线 */
39
+ private baselineTaskMap;
40
+ /** 数据最大层级。 0 开始 */
41
+ dataLevel: number;
42
+ constructor(store: Store, event: EventBus);
43
+ /**
44
+ * 设置源数据并初始化任务
45
+ */
46
+ setData(data: any[], init?: boolean): void;
47
+ /**
48
+ * 初始化任务
49
+ */
50
+ private initTasks;
51
+ private createTask;
52
+ private updateTask;
53
+ /**
54
+ * 获取源数据
55
+ */
56
+ getData(): any[];
57
+ /**
58
+ * 获取所有任务
59
+ */
60
+ getTasks(asTree?: boolean): Task[];
61
+ /**
62
+ * 通过 ID 获取任务
63
+ */
64
+ getTaskById(id: string): Task | undefined;
65
+ /**
66
+ * 移动任务位置
67
+ */
68
+ /**
69
+ * 展开任务
70
+ */
71
+ expandTask(id: string, recursive?: boolean): boolean;
72
+ /**
73
+ * 按条件筛选任务
74
+ */
75
+ /**
76
+ * 排序任务
77
+ */
78
+ /**
79
+ * 获取扁平化的任务列表,包括已展开的子任务
80
+ * 使用缓存提高性能,只有在必要时才会重建列表
81
+ */
82
+ getVisibleTasks(): Task[];
83
+ /**
84
+ * 获取可展示任务数量
85
+ */
86
+ getVisibleSize(): number;
87
+ /** 检查任务是否可见 */
88
+ isTaskVisible(task: Task): boolean;
89
+ /**
90
+ * 清空所有数据
91
+ */
92
+ clear(): void;
93
+ /**
94
+ * 更新子任务的层级
95
+ */
96
+ /**
97
+ * 使缓存失效,标记需要重新生成扁平化任务列表
98
+ */
99
+ private invalidateCache;
100
+ /**
101
+ * 选择任务
102
+ * @param taskId 任务ID
103
+ * @returns 是否选择成功
104
+ */
105
+ selectTask(taskId: string): boolean;
106
+ /**
107
+ * 取消任务选择
108
+ */
109
+ unselectTask(): void;
110
+ /**
111
+ * 检查任务是否被选中
112
+ * @param taskId 任务ID
113
+ * @returns 是否被选中
114
+ */
115
+ isTaskSelected(taskId: string): boolean;
116
+ /**
117
+ * 获取当前选中的任务
118
+ * @returns 选中的任务,如果没有则返回undefined
119
+ */
120
+ getSelectedTask(): Task | undefined;
121
+ getCheckedList(): Task[];
122
+ updateCheckedList(checked: boolean, task: Task): void;
123
+ toggleAllChecked(checked: boolean): void;
124
+ isTaskChecked(task: Task): boolean;
125
+ updateTaskTime(task: Task, startTime: Dayjs, endTime: Dayjs, direction?: "left" | "right" | "both", oldTasks?: Task[]): void;
126
+ setBaselines(baselines: any[]): void;
127
+ getBaselines(): Baseline[];
128
+ /** 根据ID获取基线 */
129
+ getBaselineById(id: string): Baseline | undefined;
130
+ /** 根据任务ID获取基线 */
131
+ getBaselinesByTaskId(taskId: string): Baseline[];
132
+ }
@@ -0,0 +1,12 @@
1
+ import { Task } from "@/models/Task";
2
+ import { IOptionConfig, IOptions } from "@/types";
3
+ import { IGanttOptions } from "@/types/options";
4
+ export declare class OptionManager {
5
+ private options;
6
+ constructor();
7
+ getOptions(): IGanttOptions;
8
+ setOptions(options: IOptions, config?: IOptionConfig): void;
9
+ update(newOptions: IOptions): void;
10
+ getRowBackgroundColor(task: Task): string;
11
+ unpackFunc<T>(value: T | ((data: any) => T), task: Task): T;
12
+ }
@@ -0,0 +1,88 @@
1
+ import dayjs, { type Dayjs } from "../utils/time";
2
+ import { IGanttOptions } from "@/types/options";
3
+ /** 表头项 */
4
+ export interface TimelineItem {
5
+ /** 时间对象 */
6
+ date: Dayjs;
7
+ /** 展示的文本,支持自定义 */
8
+ label: string;
9
+ /** 子项内容 */
10
+ children?: TimelineItem[];
11
+ /** 是否隐藏 */
12
+ hide?: boolean;
13
+ }
14
+ export declare class TimeAxis {
15
+ private startTime;
16
+ private endTime;
17
+ /** 结束的标准时间。切换单位会影响结尾的扩展,需要单独记录一个标准时间 */
18
+ private targetEnd;
19
+ /** 固定起始日期 */
20
+ private strictStart;
21
+ /** 固定截止日期 */
22
+ private strictEnd;
23
+ /** 是否锁定时间范围 */
24
+ private isStrict;
25
+ /** 是否自适应宽度 */
26
+ private isAuto;
27
+ /** 表头的日期列表 */
28
+ private timeline;
29
+ private headerGroupFormat?;
30
+ private headerCellFormat?;
31
+ private isDirty;
32
+ /** 是否第一次赋值,如果第一次赋值,允许全部赋值 */
33
+ private isFirstTime;
34
+ /** 总宽度 */
35
+ private allWidth;
36
+ /** 每一格的宽度 */
37
+ private cellWidth;
38
+ /** 用户设定的单位 */
39
+ private unit;
40
+ constructor();
41
+ getStartTime(): dayjs.Dayjs;
42
+ getEndTime(): dayjs.Dayjs;
43
+ getCellWidth(): number;
44
+ getCellCount(): number;
45
+ getCellUnit(): "day" | "hour";
46
+ setAllWidth(width: number): void;
47
+ getTimeLeft(time: Dayjs): number;
48
+ /**
49
+ * 根据横向位置计算对应的时间
50
+ * @param left 横向位置
51
+ * @returns 对应的时间对象
52
+ */
53
+ getTimeByLeft(left: number): Dayjs;
54
+ init(options: IGanttOptions): void;
55
+ update(options: IGanttOptions): void;
56
+ setDate(start?: Dayjs, end?: Dayjs): void;
57
+ /** 获取表头的日期列表 */
58
+ getTimeline(): TimelineItem[];
59
+ clear(): void;
60
+ /**
61
+ * 缓存失效标记
62
+ */
63
+ private invalidateCache;
64
+ /** 获取细粒度单位 */
65
+ private getFinelyUnit;
66
+ /** 获取下层单位 */
67
+ private getChildUnit;
68
+ /** 获取上层单位 */
69
+ private getGroupUnit;
70
+ /** 格式化上层文本 */
71
+ private formatterGroupLabel;
72
+ /**
73
+ * 格式化下层文本
74
+ */
75
+ private formatterCellLabel;
76
+ /**
77
+ * 获取时间轴的总宽度
78
+ * @returns 时间轴总宽度(像素)
79
+ */
80
+ getTotalWidth(): number;
81
+ expand(type: "left" | "right" | "all", count?: number): void;
82
+ /**
83
+ * 判定一个时间是否在时间轴上
84
+ * @param time 时间
85
+ * @returns 是否在时间轴上
86
+ */
87
+ isInTimeAxis(time: Dayjs): boolean;
88
+ }