@xpyjs/gantt-core 0.0.1-beta.0 → 0.0.1-beta.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xpyjs/gantt-core",
3
3
  "private": false,
4
- "version": "0.0.1-beta.0",
4
+ "version": "0.0.1-beta.2",
5
5
  "description": "A powerful and flexible Gantt chart component library for modern web applications with TypeScript support",
6
6
  "type": "module",
7
7
  "main": "./dist/x-gantt.umd.cjs",
@@ -2,6 +2,7 @@ import { Store } from "./store";
2
2
  import { EventBus } from "./event";
3
3
  import { IOptionConfig, IOptions } from "./types";
4
4
  import { EventMap } from "./types/event";
5
+ import type { DataChain } from "./types/link";
5
6
  import { IContext } from "./types/render";
6
7
  export declare class XGanttContext implements IContext {
7
8
  private container;
@@ -23,6 +24,10 @@ export declare class XGanttContext implements IContext {
23
24
  * @return {boolean} 是否成功跳转
24
25
  */
25
26
  jumpTo(date?: any): boolean;
27
+ /**
28
+ * 获取指定任务的所有相关联的完整路径,包含所有连接线与任务节点
29
+ */
30
+ getDataChain(id: string): DataChain;
26
31
  /**
27
32
  * 触发事件
28
33
  * @param event 事件名称
package/types/XGantt.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { IOptionConfig, IOptions } from "./types";
2
2
  import { EventMap } from "./types/event";
3
+ import { DataChain } from "./types/link";
3
4
  /**
4
5
  * XGantt 甘特图组件的主要接口
5
6
  *
@@ -173,6 +174,10 @@ export declare class XGantt {
173
174
  * ```
174
175
  */
175
176
  jumpTo(date?: any): boolean;
177
+ /**
178
+ * 获取指定任务的所有相关联的完整路径,包含所有连接线与任务节点
179
+ */
180
+ getDataChain(id: string): DataChain;
176
181
  /**
177
182
  * 注册事件监听器
178
183
  *
@@ -181,7 +186,6 @@ export declare class XGantt {
181
186
  * @param cb - 事件回调函数
182
187
  *
183
188
  * @description 为甘特图注册事件监听器,支持监听各种用户交互和状态变化事件。
184
- * 同一个事件注册多个,只会执行最后一个监听器。
185
189
  *
186
190
  * 支持的事件类型包括:
187
191
  * - `loaded`: 加载完成事件,组件初始化完成后触发
@@ -198,6 +202,8 @@ export declare class XGantt {
198
202
  * - `contextmenu:slider`: 任务条右键菜单事件
199
203
  * - `move`: 任务移动事件
200
204
  *
205
+ * @see {@link EventMap} 查看所有可用事件及其参数类型
206
+ *
201
207
  * @example
202
208
  * ```typescript
203
209
  * // 监听任务选择事件
@@ -242,7 +248,32 @@ export declare class XGantt {
242
248
  * });
243
249
  * ```
244
250
  *
245
- * @see {@link EventMap} 查看所有可用事件及其参数类型
246
251
  */
247
252
  on<K extends keyof EventMap>(event: K, cb: EventMap[K]): void;
253
+ /**
254
+ * 移除事件监听器
255
+ *
256
+ * @template K - 事件名称的类型
257
+ * @param event - 要移除的事件名称
258
+ * @param cb - 可选,指定要移除的回调函数。如果不传入,则移除所有该事件的监听器
259
+ *
260
+ * @description 从甘特图中移除指定的事件监听器。
261
+ * 如果不传入回调函数,则会移除该事件的所有监听器。
262
+ *
263
+ * @example
264
+ * ```typescript
265
+ * // 移除特定的任务选择事件监听器
266
+ * const selectHandler = (data, checked, all) => {
267
+ * console.log('选择了任务:', data);
268
+ * };
269
+ * gantt.on('select', selectHandler);
270
+ *
271
+ * // 当不再需要时,可以移除该监听器
272
+ * gantt.off('select', selectHandler);
273
+ *
274
+ * // 移除所有任务选择事件监听器
275
+ * gantt.off('select');
276
+ * ```
277
+ */
278
+ off<K extends keyof EventMap>(event: K, cb?: EventMap[K]): void;
248
279
  }
@@ -54,6 +54,8 @@ export declare enum EventName {
54
54
  SLIDER_MOVING = "slider-moving",
55
55
  SLIDER_HOVER = "slider-hover",
56
56
  SLIDER_LEAVE = "slider-leave",
57
+ SLIDER_BLINK = "slider-blink",
58
+ LINK_BLINK = "link-blink",
57
59
  ROW_HIGHLIGHT = "row-highlight",
58
60
  ROW_UNHIGHLIGHT = "row-unhighlight",
59
61
  TASK_DRAG_START = "task-drag-start",
@@ -66,10 +68,18 @@ export declare enum EventName {
66
68
  ERROR = "error"
67
69
  }
68
70
  export declare enum ErrorType {
71
+ /** 无效类型 */
72
+ INVALID_TYPE = "INVALID_TYPE",
73
+ /** 任务不存在 */
74
+ TASK_NOT_FOUND = "TASK_NOT_FOUND",
69
75
  /** 连线不被允许 */
70
76
  LINK_NOT_ALLOWED = "LINK_NOT_ALLOWED",
71
77
  /** 相同节点 */
72
78
  LINK_SAME = "LINK_SAME",
73
79
  /** 当前关联已存在 */
74
- LINK_EXIST = "LINK_EXIST"
80
+ LINK_EXIST = "LINK_EXIST",
81
+ /** 无效参数 */
82
+ LINK_INVALID_ARG = "LINK_INVALID_ARG",
83
+ /** 检测到环 */
84
+ LINK_CYCLE = "LINK_CYCLE"
75
85
  }
package/types/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export { colorjs, type Colorjs } from "./utils/color";
7
7
  export declare const version: string;
8
8
  import type { IOptions, IOptionConfig, EmitData } from "./types";
9
9
  import type { EventMap } from "./types/event";
10
- import type { ILink } from "./types/link";
10
+ import type { ILink, DataChain, LinkType } from "./types/link";
11
11
  import type { ErrorType } from "./event";
12
12
  import type { XGanttUnit } from "./types/options";
13
- export type { IOptions, IOptionConfig, EmitData, EventMap, ILink, ErrorType, XGanttUnit };
13
+ export type { IOptions, IOptionConfig, EmitData, EventMap, ILink, ErrorType, XGanttUnit, DataChain, LinkType };
@@ -67,7 +67,7 @@ export declare class Task {
67
67
  constructor(store: Store, event: EventBus, data: any, parent?: Task, _id?: string);
68
68
  getField(field: string): any;
69
69
  /** 切换展示模式时,需要调整时间 */
70
- updateMode(): void;
70
+ updateMode(): boolean;
71
71
  updateData(data: any): void;
72
72
  updateTime(startTime: Dayjs, endTime: Dayjs): void;
73
73
  clone(): Task;
@@ -6,6 +6,7 @@ export declare class BodyGroup {
6
6
  private stage;
7
7
  private layer;
8
8
  private bgLayer;
9
+ private tasks;
9
10
  private rowsGroup;
10
11
  private rowsCache;
11
12
  private rowBgGroup;
@@ -2,8 +2,7 @@ import Konva from "konva";
2
2
  import { IContext } from "@/types/render";
3
3
  export declare class HeaderLayer {
4
4
  private context;
5
- private stage;
6
- layer: Konva.Layer;
5
+ private layer;
7
6
  private background;
8
7
  private groupHeader;
9
8
  private cellHeader;
@@ -11,7 +10,7 @@ export declare class HeaderLayer {
11
10
  private width;
12
11
  private height;
13
12
  private offsetX;
14
- constructor(context: IContext, stage: Konva.Stage);
13
+ constructor(context: IContext, layer: Konva.Layer);
15
14
  /**
16
15
  * 调整表头大小
17
16
  */
@@ -9,6 +9,7 @@ export declare class LinkGroup {
9
9
  private pointGroup;
10
10
  private linksGroup;
11
11
  private templateArrow;
12
+ private linkCache;
12
13
  private isDragging;
13
14
  private isSliderMoving;
14
15
  private selectedMap;
@@ -30,9 +31,9 @@ export declare class LinkGroup {
30
31
  */
31
32
  setOffset(x: number, y: number): void;
32
33
  /**
33
- * 更新数据
34
+ * 更新某一条数据
34
35
  */
35
- update(): void;
36
+ updateTask(task: Task): void;
36
37
  /**
37
38
  * 渲染关联线
38
39
  */
@@ -67,14 +68,26 @@ export declare class LinkGroup {
67
68
  * 处理连线被点击后的移动
68
69
  */
69
70
  private createLink;
71
+ /**
72
+ * 清理临时连线状态
73
+ */
74
+ private cleanupTempLink;
70
75
  /**
71
76
  * 按照位置获取任务
72
77
  */
73
78
  private getTaskByPosition;
74
79
  /**
75
- * 检查当前连接点是否可以被创建
80
+ * 检查当前连接线的起始点是否可以被连接
81
+ */
82
+ private isAllowStartDrop;
83
+ /**
84
+ * 检查当前连接点的结束点是否可以被连接
76
85
  */
77
- private isAllowDrop;
86
+ private isAllowEndDrop;
87
+ /**
88
+ * 校验连线创建是否合法
89
+ */
90
+ private validateChain;
78
91
  /**
79
92
  * 操作高亮关联线
80
93
  */
@@ -85,4 +98,8 @@ export declare class LinkGroup {
85
98
  private unhighlightPoint;
86
99
  /** 操作创建点的高亮 */
87
100
  private handlePointHighlight;
101
+ /**
102
+ * 高亮显示环中的节点
103
+ */
104
+ private highlightCycleNodes;
88
105
  }
@@ -26,12 +26,14 @@ export declare class ChartSlider {
26
26
  private readonly AUTO_EXPAND_INTERVAL;
27
27
  private isDragging;
28
28
  private draggingDirection;
29
+ private dragDiffX;
29
30
  private oldTasks;
30
31
  constructor(context: IContext, x: number, y: number, task: Task, rowWidth: number);
31
32
  update(x: number, y: number): void;
32
33
  setOffset(x: number, y: number): void;
33
34
  /** 太多需要 function 的判断,搞一个统一的转换 */
34
35
  private unpackFunc;
36
+ private registerEvents;
35
37
  private render;
36
38
  private renderText;
37
39
  private renderProgress;
@@ -55,4 +57,6 @@ export declare class ChartSlider {
55
57
  private handleResizeHighlight;
56
58
  /** 鼠标移入高亮 */
57
59
  private handleBarHighlight;
60
+ /** 闪烁 */
61
+ private handleBarBlink;
58
62
  }
@@ -13,6 +13,7 @@ export declare class Chart {
13
13
  private todayLayer;
14
14
  private linkGroup;
15
15
  private baselineGroup;
16
+ private axisLayer;
16
17
  private bgLayer;
17
18
  private bodyLayer;
18
19
  private width;
@@ -22,11 +23,11 @@ export declare class Chart {
22
23
  * 调整大小
23
24
  */
24
25
  resize(width: number, height: number): void;
25
- render(x: number, y: number, tasks: Task[]): void;
26
+ render(x: number, y: number, tasks: Task[], isRefresh?: boolean, isScroll?: boolean): void;
26
27
  /**
27
28
  * 刷新图表(用于滚动或局部更新时的高效渲染)
28
29
  */
29
- refresh(x: number, y: number, tasks: Task[]): void;
30
+ refresh(x: number, y: number, tasks: Task[], isScroll?: boolean): void;
30
31
  /**
31
32
  * 更新任务
32
33
  */
@@ -84,8 +84,6 @@ export declare class DataManager {
84
84
  * 获取可展示任务数量
85
85
  */
86
86
  getVisibleSize(): number;
87
- /** 检查任务是否可见 */
88
- isTaskVisible(task: Task): boolean;
89
87
  /**
90
88
  * 清空所有数据
91
89
  */
@@ -0,0 +1,225 @@
1
+ import { ErrorType, type EventBus } from "../event";
2
+ import { Task } from "../models/Task";
3
+ import type { Store } from ".";
4
+ import { ILink, LinkType, LinkStartType, LinkFinishType, DataChain } from "@/types/link";
5
+ /** 连线操作结果 */
6
+ type LinkOpResult = {
7
+ ok: true;
8
+ } | {
9
+ ok: false;
10
+ /** 失败原因编码 */
11
+ reason: ErrorType;
12
+ /** 友好提示(由上层决定是否展示) */
13
+ message?: string;
14
+ /** 当检测出环时,返回的环信息 */
15
+ cycleInfo?: CycleInfo;
16
+ };
17
+ /** 任务连线查询结果 */
18
+ interface TaskLinksResult {
19
+ incoming: ILink[];
20
+ outgoing: ILink[];
21
+ all: ILink[];
22
+ }
23
+ /** 任务连接关系结果 */
24
+ interface TaskConnectionResult {
25
+ tasks: Task[];
26
+ links: ILink[];
27
+ }
28
+ /** 批量校验结果 */
29
+ interface ValidationBatchResult {
30
+ invalid: Array<{
31
+ link: ILink;
32
+ reason: string;
33
+ message: string;
34
+ }>;
35
+ valid: ILink[];
36
+ totalCount: number;
37
+ }
38
+ /** 冲突检测结果 */
39
+ interface ConflictResult {
40
+ hasConflict: boolean;
41
+ conflicts: ILink[];
42
+ conflictTypes: string[];
43
+ }
44
+ /** 环检测信息 */
45
+ interface CycleInfo {
46
+ cycles: string[][];
47
+ nodes: string[];
48
+ sccs: string[][];
49
+ }
50
+ /** 环检测报告 */
51
+ interface CycleReport extends CycleInfo {
52
+ hasCycle: boolean;
53
+ }
54
+ /** 调试信息 */
55
+ interface LinkDebugInfo {
56
+ totalLinks: number;
57
+ totalTasks: number;
58
+ connectionComponents: number;
59
+ hasCycle: boolean;
60
+ topologicalOrder: string[] | null;
61
+ isolatedTasks: string[];
62
+ }
63
+ /**
64
+ * LinkManager - 甘特图连线/依赖关系管理器
65
+ *
66
+ * 核心职责:
67
+ * 1. 连线数据的集中管理和索引
68
+ * 2. 连线合法性校验(包括类型校验)
69
+ * 3. 环检测和拓扑排序
70
+ * 4. 任务连接关系查询
71
+ * 5. 为 ChartLink 提供高效的连线操作支持
72
+ */
73
+ export declare class LinkManager {
74
+ private store;
75
+ private event;
76
+ /** 原始连线数据集合 */
77
+ private links;
78
+ /** 以起点任务 id 为 key 的出边邻接表 */
79
+ private fromLinksMap;
80
+ /** 以终点任务 id 为 key 的入边邻接表 */
81
+ private toLinksMap;
82
+ /** 拓扑序(无环情况下才有效,懒计算) */
83
+ private topoOrder;
84
+ /** 节点 id -> 拓扑序索引 */
85
+ private topoIndex;
86
+ /** 最近一次全量环检测报告 */
87
+ private lastCycleReport;
88
+ /** 直接连接关系缓存(轻量级) */
89
+ private directConnectionCache;
90
+ /** 记忆化缓存(用于链路查询优化) */
91
+ private forwardMemo;
92
+ private backwardMemo;
93
+ /** 缓存依赖关系追踪 */
94
+ private cacheDependencies;
95
+ /** 缓存访问频率统计 */
96
+ private cacheAccessStats;
97
+ /** 缓存大小限制 */
98
+ private readonly MAX_CACHE_SIZE;
99
+ /** 缓存生存时间(毫秒) */
100
+ private readonly CACHE_TTL;
101
+ /** 是否启用环检测 */
102
+ private enableCycleDetection;
103
+ /** 连线类型映射表 */
104
+ private static readonly LINK_TYPE_MAP;
105
+ constructor(store: Store, event: EventBus);
106
+ /** 开启/关闭环检测 */
107
+ setCycleDetection(enabled: boolean): void;
108
+ /** 获取所有连线 */
109
+ getLinks(): ILink[];
110
+ /** 获取某个任务ID的连线 */
111
+ getLinksByTaskId(taskId: string): ILink[];
112
+ /** 批量设置连线(唯一的数据修改入口) */
113
+ setLinks(links: ILink[], detectAll?: boolean): void;
114
+ /** 更新各种缓存配置 */
115
+ update(): void;
116
+ /** 检查连线是否存在 */
117
+ isLinkExist(from: string, to: string, type?: string): boolean;
118
+ /** 校验连线类型是否合法 */
119
+ validateLinkType(type: string): boolean;
120
+ /** 将起止点转换为连线类型 */
121
+ convertPointsToLinkType(fromPoint: LinkStartType | LinkFinishType, toPoint: LinkStartType | LinkFinishType): LinkType;
122
+ /** 校验单条连线的基础合法性 */
123
+ validateLink(link: ILink): LinkOpResult;
124
+ /** 校验新增连线是否会产生环 */
125
+ validateChain(from: string, to: string, type?: string): LinkOpResult;
126
+ /** 批量校验连线 */
127
+ validateLinks(links: ILink[]): ValidationBatchResult;
128
+ /** 获取任务的所有连线(入边+出边) */
129
+ getTaskLinks(taskId: string): TaskLinksResult;
130
+ /** 获取任务的直接前驱任务 */
131
+ getTaskPredecessors(taskId: string): TaskConnectionResult;
132
+ /** 获取任务的直接后继任务 */
133
+ getTaskSuccessors(taskId: string): TaskConnectionResult;
134
+ /** 获取与指定任务直接连接的所有任务 */
135
+ getDirectlyConnectedTasks(taskId: string): Task[];
136
+ /** 检查两个任务间是否存在连接路径 */
137
+ hasConnectionPath(fromId: string, toId: string): boolean;
138
+ /**
139
+ * 枚举指定任务的所有前置完整路径与后置完整路径
140
+ *
141
+ * @param taskId 任务ID
142
+ * @returns 包含前置链路、后置链路和所有节点的完整信息
143
+ *
144
+ * 返回结构:
145
+ * - prev.chain: 所有源 -> 当前任务的完整路径(每条路径末尾为当前任务)
146
+ * - next.chain: 当前任务 -> 所有汇的完整路径(每条路径首元素为当前任务)
147
+ * - prev.nodes: 前置方向所有唯一节点
148
+ * - next.nodes: 后置方向所有唯一节点
149
+ * - allNodes: 前后方向去重后的全部节点
150
+ * - allLinks: 涉及的所有连线
151
+ */
152
+ getDataChain(taskId: string): DataChain;
153
+ /** 检查当前图是否存在环 */
154
+ hasCycle(): boolean;
155
+ /** 全量环检测(Tarjan 算法) */
156
+ detectAllCycles(sendErr?: boolean): CycleReport;
157
+ /** 获取最近一次环检测报告 */
158
+ getCycleReport(): CycleReport | null;
159
+ /** 检测同一对任务间是否存在冲突的连线类型 */
160
+ detectLinkConflicts(taskA: string, taskB: string): ConflictResult;
161
+ /** 检查是否存在业务逻辑冲突的连线 */
162
+ hasConflictingLinks(from: string, to: string): boolean;
163
+ /** 懒计算拓扑序(Kahn 算法) */
164
+ private computeTopo;
165
+ /** 增量环检测(基于拓扑序 + DFS) */
166
+ private willCreateCycle;
167
+ /** 构建/重建邻接表 */
168
+ private rebuildAdjacency;
169
+ /** 失效所有缓存 */
170
+ private invalidateAllCaches;
171
+ /** 失效直接连接缓存 */
172
+ private invalidateConnectionCache;
173
+ /** 快速查找连线的优化方法 */
174
+ private findLinkFast;
175
+ /** 根据任务 ID 获取任务对象 */
176
+ private getTask;
177
+ /** 检查节点是否存在自环 */
178
+ private hasSelfLoop;
179
+ /** 构造简单环信息 */
180
+ private buildSimpleCycleInfo;
181
+ /**
182
+ * 精细化缓存失效策略
183
+ * 根据操作类型和影响范围进行精确的缓存失效
184
+ */
185
+ private invalidateSmartCaches;
186
+ /** 处理添加连线的缓存失效 */
187
+ private handleAddLinkInvalidation;
188
+ /** 处理删除连线的缓存失效 */
189
+ private handleRemoveLinkInvalidation;
190
+ /** 处理更新连线的缓存失效 */
191
+ private handleUpdateLinkInvalidation;
192
+ /** 处理批量操作的缓存失效 */
193
+ private handleBatchOperationInvalidation;
194
+ /** 精确失效指定缓存 */
195
+ private invalidateSpecificCaches;
196
+ /** 获取递归上游任务(限制深度) */
197
+ private getUpstreamTasksRecursive;
198
+ /** 获取递归下游任务(限制深度) */
199
+ private getDownstreamTasksRecursive;
200
+ /** 获取连通分量 */
201
+ private getConnectedComponent;
202
+ /** 清理过期缓存 */
203
+ private cleanupExpiredCaches;
204
+ /** 限制缓存大小 */
205
+ private limitCacheSize;
206
+ /** 记录缓存访问 */
207
+ private recordCacheAccess;
208
+ /** 建立缓存依赖关系 */
209
+ private establishCacheDependency;
210
+ /** 为调试提供连线关系的可视化信息 */
211
+ getDebugInfo(): LinkDebugInfo;
212
+ /** 计算连通分量数量 */
213
+ private countConnectionComponents;
214
+ /** 获取缓存性能统计 */
215
+ getCachePerformanceStats(): {
216
+ totalCacheSize: number;
217
+ hitRate: number;
218
+ memoryUsage: string;
219
+ expiredEntries: number;
220
+ dependencyCount: number;
221
+ };
222
+ /** 估算内存使用量 */
223
+ private estimateMemoryUsage;
224
+ }
225
+ export {};
@@ -49,7 +49,7 @@ export declare class TimeAxis {
49
49
  * @returns 对应的时间对象
50
50
  */
51
51
  getTimeByLeft(left: number): Dayjs;
52
- init(options: IGanttOptions): void;
52
+ init(options: IGanttOptions, isFirstTime?: boolean): void;
53
53
  update(options: IGanttOptions): void;
54
54
  setDate(start?: Dayjs, end?: Dayjs): void;
55
55
  /** 获取表头的日期列表 */
@@ -1,6 +1,7 @@
1
1
  import { OptionManager } from "./OptionManager";
2
2
  import { DataManager } from "./DataManager";
3
3
  import { ColumnManager } from "./ColumnManager";
4
+ import { LinkManager } from './LinkManager';
4
5
  import { TimeAxis } from "./TimeAxis";
5
6
  import { Dayjs } from "dayjs";
6
7
  import { IContext } from "@/types/render";
@@ -10,11 +11,13 @@ export declare class Store {
10
11
  private optionManager;
11
12
  private dataManager;
12
13
  private columnManager;
14
+ private linkManager;
13
15
  private timeAxis;
14
16
  constructor(context: IContext, options?: IOptions);
15
17
  getOptionManager(): OptionManager;
16
18
  getDataManager(): DataManager;
17
19
  getColumnManager(): ColumnManager;
20
+ getLinkManager(): LinkManager;
18
21
  getTimeAxis(): TimeAxis;
19
22
  setOption(options: IOptions, config?: IOptionConfig): void;
20
23
  updateTime(start?: Dayjs, end?: Dayjs): void;
@@ -3,7 +3,7 @@ import { ILink } from "./link";
3
3
 
4
4
  export interface EventMap {
5
5
  loaded: () => void;
6
- error: (error: ErrorType) => void;
6
+ error: (error: ErrorType, msg?: string) => void;
7
7
  "update:link": (link: ILink) => void;
8
8
  "create:link": (link: ILink) => void;
9
9
  "select:link": (
@@ -1,3 +1,7 @@
1
+ export type LinkStartType = 'S';
2
+ export type LinkFinishType = 'F';
3
+ export type LinkType = `${LinkFinishType}${LinkStartType}` | `${LinkFinishType}${LinkFinishType}` | `${LinkStartType}${LinkStartType}` | `${LinkStartType}${LinkFinishType}`;
4
+
1
5
  export interface ILink {
2
6
  /** 起始任务 id */
3
7
  from: any;
@@ -18,6 +22,36 @@ export interface ILink {
18
22
  *
19
23
  * 无论如何配置,连线始终是 from - to 的方向,type 定义了连线在 from / to 任务中出现的位置,左侧定义为 Start,右侧定义为 Finish。
20
24
  */
21
- type?: "FS" | "FF" | "SS" | "SF";
25
+ type?: LinkType;
22
26
  [key: string]: any;
23
27
  }
28
+
29
+ /**
30
+ * 基于某个任务节点获取到的所有相关联的链路信息
31
+ */
32
+ export interface DataChain {
33
+ /** 前置链路信息 */
34
+ prev: {
35
+ /** 所有源 -> 当前任务的完整路径(每条路径末尾为当前节点) */
36
+ chain: any[][];
37
+ /** 前置方向所有唯一节点 */
38
+ nodes: any[];
39
+ /** 前置方向所有连线 */
40
+ links: ILink[];
41
+ };
42
+ /** 后置链路联系 */
43
+ next: {
44
+ /** 当前任务 -> 所有汇的完整路径(每条路径首元素为当前节点) */
45
+ chain: any[][];
46
+ /** 后置方向所有唯一节点 */
47
+ nodes: any[];
48
+ /** 后置方向所有连线 */
49
+ links: ILink[];
50
+ };
51
+ /** 所有相关联的节点 */
52
+ allNodes: any[];
53
+ /** 所有相关联的连线 */
54
+ allLinks: ILink[];
55
+ /** 当前任务 */
56
+ current: any | undefined;
57
+ }
@@ -112,7 +112,7 @@ export interface IGanttOptions {
112
112
  * @argument {"S"} - 允许以 S,也就是左侧起始点作为起点创建连线
113
113
  * @argument {"F"} - 允许以 F,也就是右侧结束点作为起点创建连线
114
114
  */
115
- from: boolean | "S" | "F" | ((row: EmitData) => boolean | "S" | "F");
115
+ from: boolean | "S" | "F" | ((row: EmitData, to?: EmitData) => boolean | "S" | "F");
116
116
  /**
117
117
  * 是否允许节点被链接。如果允许,可以将当前任务节点作为被连接点
118
118
  *
@@ -139,7 +139,7 @@ export interface IGanttOptions {
139
139
  distance: number;
140
140
  /** 线条的起点/终点位置与任务条的距离。 默认 5 */
141
141
  gap: number;
142
- /** 线条的虚线设定。 默认 [6, 3] */
142
+ /** 线条的虚线设定。 默认 [0],设为 0 即实线 */
143
143
  dash: number[];
144
144
  /** 线条的宽度。 默认 1 */
145
145
  width: number;
@@ -154,6 +154,14 @@ export interface IGanttOptions {
154
154
  };
155
155
  /** 原点大小。 默认 3 */
156
156
  radius: number;
157
+ /**
158
+ * 启用环检测。默认开启状态。
159
+ *
160
+ * 开启后,会自动检查每一条连线的构成,如果存在环链路,在创建、更新连线时,会发出 `LINK_CYCLE` 错误事件。
161
+ *
162
+ * @default true
163
+ */
164
+ enableCycleDetection: boolean;
157
165
  };
158
166
 
159
167
  /** 基线配置 */
@@ -0,0 +1 @@
1
+ export declare const HandlerIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"15\" height=\"15\" viewBox=\"0 0 15 15\"><path fill=\"currentColor\" fill-rule=\"evenodd\" d=\"M5.5 4.625a1.125 1.125 0 1 0 0-2.25a1.125 1.125 0 0 0 0 2.25m4 0a1.125 1.125 0 1 0 0-2.25a1.125 1.125 0 0 0 0 2.25M10.625 7.5a1.125 1.125 0 1 1-2.25 0a1.125 1.125 0 0 1 2.25 0M5.5 8.625a1.125 1.125 0 1 0 0-2.25a1.125 1.125 0 0 0 0 2.25m5.125 2.875a1.125 1.125 0 1 1-2.25 0a1.125 1.125 0 0 1 2.25 0M5.5 12.625a1.125 1.125 0 1 0 0-2.25a1.125 1.125 0 0 0 0 2.25\" clip-rule=\"evenodd\"/></svg>";