ice-entity-designer 0.0.24 → 0.0.26
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/README.md +38 -2
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/index.umd.js +2 -2
- package/dist/react.cjs +2 -2
- package/dist/react.mjs +2 -2
- package/dist/types/gantt/GanttDependency.d.mts +18 -0
- package/dist/types/gantt/GanttDependency.d.ts +18 -0
- package/dist/types/gantt/GanttDesigner.d.mts +80 -0
- package/dist/types/gantt/GanttDesigner.d.ts +80 -0
- package/dist/types/gantt/GanttRuler.d.mts +42 -0
- package/dist/types/gantt/GanttRuler.d.ts +42 -0
- package/dist/types/gantt/GanttTask.d.mts +41 -0
- package/dist/types/gantt/GanttTask.d.ts +41 -0
- package/dist/types/gantt/gantt_date.d.mts +12 -0
- package/dist/types/gantt/gantt_date.d.ts +12 -0
- package/dist/types/ice-render/graphic/link/ICEPolyLine.d.mts +7 -0
- package/dist/types/ice-render/graphic/link/ICEPolyLine.d.ts +7 -0
- package/dist/types/index.d.mts +12 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/statechart/StateNode.d.mts +43 -0
- package/dist/types/statechart/StateNode.d.ts +43 -0
- package/dist/types/statechart/StateTransition.d.mts +32 -0
- package/dist/types/statechart/StateTransition.d.ts +32 -0
- package/dist/types/statechart/StatechartDesigner.d.mts +46 -0
- package/dist/types/statechart/StatechartDesigner.d.ts +46 -0
- package/package.json +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022 大漠穷秋.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import { ICEPolyLine } from '../ice-render/index.mjs';
|
|
9
|
+
/**
|
|
10
|
+
* @class GanttDependency 甘特任务之间的依赖(完成 → 开始)
|
|
11
|
+
*
|
|
12
|
+
* 记法:实线 + 实心箭头,从「前置任务的右端」指向「后置任务的左端」,走正交路由(`visio`)。
|
|
13
|
+
* 依赖只表达约束,不改变条的位置(自动排程是后续能力,不属于本包 v1)。
|
|
14
|
+
*/
|
|
15
|
+
export default class GanttDependency extends ICEPolyLine {
|
|
16
|
+
static readonly typeId = "GanttDependency";
|
|
17
|
+
constructor(props?: any);
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022 大漠穷秋.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import { ICEPolyLine } from '../ice-render/index';
|
|
9
|
+
/**
|
|
10
|
+
* @class GanttDependency 甘特任务之间的依赖(完成 → 开始)
|
|
11
|
+
*
|
|
12
|
+
* 记法:实线 + 实心箭头,从「前置任务的右端」指向「后置任务的左端」,走正交路由(`visio`)。
|
|
13
|
+
* 依赖只表达约束,不改变条的位置(自动排程是后续能力,不属于本包 v1)。
|
|
14
|
+
*/
|
|
15
|
+
export default class GanttDependency extends ICEPolyLine {
|
|
16
|
+
static readonly typeId = "GanttDependency";
|
|
17
|
+
constructor(props?: any);
|
|
18
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022 大漠穷秋.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import FlowDesigner from '../flow/FlowDesigner.mjs';
|
|
9
|
+
import GanttRuler from './GanttRuler.mjs';
|
|
10
|
+
export declare type GanttIssue = {
|
|
11
|
+
level: 'error' | 'warning';
|
|
12
|
+
message: string;
|
|
13
|
+
id?: string;
|
|
14
|
+
};
|
|
15
|
+
export declare type GanttTaskInput = {
|
|
16
|
+
title?: string;
|
|
17
|
+
/** `YYYY-MM-DD` */
|
|
18
|
+
start: string;
|
|
19
|
+
days?: number;
|
|
20
|
+
row?: number;
|
|
21
|
+
progress?: number;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* @class GanttDesigner 甘特图设计器(第三个 domain pack)
|
|
25
|
+
*
|
|
26
|
+
* 与前两个包同一套结构(`FlowDesigner` 薄扩展 + 类型过滤 + 语义校验 + 复用快照/导出),
|
|
27
|
+
* 额外引入两件甘特特有的东西:
|
|
28
|
+
*
|
|
29
|
+
* 1. **时间轴**:日期 ↔ 像素的统一换算(`dayWidth` / `originDate` / `labelColumnWidth`),
|
|
30
|
+
* 框架(左列任务名 + 日期刻度 + 行线)由一个派生的 `GanttRuler` 组件渲染并在模型变化时重建;
|
|
31
|
+
* 2. **吸附**:任务条的拖拽按「整天」吸附(见 `GanttTask.setPosition`),排期不会出现小数天。
|
|
32
|
+
*/
|
|
33
|
+
export default class GanttDesigner extends FlowDesigner {
|
|
34
|
+
/** 左列(任务名)宽度 */
|
|
35
|
+
labelColumnWidth: number;
|
|
36
|
+
/** 时间轴顶部标尺高度 */
|
|
37
|
+
headerHeight: number;
|
|
38
|
+
/** 行高 */
|
|
39
|
+
rowHeight: number;
|
|
40
|
+
/** 每天像素 */
|
|
41
|
+
dayWidth: number;
|
|
42
|
+
/** 项目起点(自动取最早任务开始日) */
|
|
43
|
+
originDate: string;
|
|
44
|
+
ruler: GanttRuler;
|
|
45
|
+
private __syncing;
|
|
46
|
+
constructor(ice: any);
|
|
47
|
+
get nodes(): any[];
|
|
48
|
+
get edges(): any[];
|
|
49
|
+
/**
|
|
50
|
+
* 建一条任务(条):坐标由「起始日期 × 每日像素」算出,不接受任意 left/top
|
|
51
|
+
* —— 甘特的横轴是时间,不是自由画布。
|
|
52
|
+
*/
|
|
53
|
+
createTask(props: GanttTaskInput & {
|
|
54
|
+
id?: string;
|
|
55
|
+
}): any;
|
|
56
|
+
/** 建一条依赖(完成 → 开始),两端必须都是任务 */
|
|
57
|
+
createDependency(props?: any): any;
|
|
58
|
+
/** 改每日像素(时间轴缩放):所有任务与依赖一起重排 */
|
|
59
|
+
setDayWidth(dayWidth: number): void;
|
|
60
|
+
/** 项目起点 = 最早任务的开始日;没有任务时留空 */
|
|
61
|
+
computeOrigin(): string;
|
|
62
|
+
/** 项目区间(天数):至少 1 天,用于刻度与画布宽度 */
|
|
63
|
+
dayCount(): number;
|
|
64
|
+
/**
|
|
65
|
+
* 重建图表框架(左列任务名 + 日期刻度 + 行线)并同步所有任务的几何。
|
|
66
|
+
*
|
|
67
|
+
* 模型任何变化(增删任务、改日期、改每日像素)都要走这里 —— 时间轴是**派生**的,
|
|
68
|
+
* 不允许任务自己维护「我在哪一天的哪一像素上」。
|
|
69
|
+
*/
|
|
70
|
+
syncChrome(): void;
|
|
71
|
+
/**
|
|
72
|
+
* 甘特语义校验:
|
|
73
|
+
* - **依赖成环**(排期不成立);
|
|
74
|
+
* - 进度越界(0..1);
|
|
75
|
+
* - 持续天数非法(<1);
|
|
76
|
+
* - 任务早于项目起点(起点是自动取最早的,因此这条主要防手工改坐标)。
|
|
77
|
+
*/
|
|
78
|
+
validateGantt(): GanttIssue[];
|
|
79
|
+
private __anchor;
|
|
80
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022 大漠穷秋.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import FlowDesigner from '../flow/FlowDesigner';
|
|
9
|
+
import GanttRuler from './GanttRuler';
|
|
10
|
+
export declare type GanttIssue = {
|
|
11
|
+
level: 'error' | 'warning';
|
|
12
|
+
message: string;
|
|
13
|
+
id?: string;
|
|
14
|
+
};
|
|
15
|
+
export declare type GanttTaskInput = {
|
|
16
|
+
title?: string;
|
|
17
|
+
/** `YYYY-MM-DD` */
|
|
18
|
+
start: string;
|
|
19
|
+
days?: number;
|
|
20
|
+
row?: number;
|
|
21
|
+
progress?: number;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* @class GanttDesigner 甘特图设计器(第三个 domain pack)
|
|
25
|
+
*
|
|
26
|
+
* 与前两个包同一套结构(`FlowDesigner` 薄扩展 + 类型过滤 + 语义校验 + 复用快照/导出),
|
|
27
|
+
* 额外引入两件甘特特有的东西:
|
|
28
|
+
*
|
|
29
|
+
* 1. **时间轴**:日期 ↔ 像素的统一换算(`dayWidth` / `originDate` / `labelColumnWidth`),
|
|
30
|
+
* 框架(左列任务名 + 日期刻度 + 行线)由一个派生的 `GanttRuler` 组件渲染并在模型变化时重建;
|
|
31
|
+
* 2. **吸附**:任务条的拖拽按「整天」吸附(见 `GanttTask.setPosition`),排期不会出现小数天。
|
|
32
|
+
*/
|
|
33
|
+
export default class GanttDesigner extends FlowDesigner {
|
|
34
|
+
/** 左列(任务名)宽度 */
|
|
35
|
+
labelColumnWidth: number;
|
|
36
|
+
/** 时间轴顶部标尺高度 */
|
|
37
|
+
headerHeight: number;
|
|
38
|
+
/** 行高 */
|
|
39
|
+
rowHeight: number;
|
|
40
|
+
/** 每天像素 */
|
|
41
|
+
dayWidth: number;
|
|
42
|
+
/** 项目起点(自动取最早任务开始日) */
|
|
43
|
+
originDate: string;
|
|
44
|
+
ruler: GanttRuler;
|
|
45
|
+
private __syncing;
|
|
46
|
+
constructor(ice: any);
|
|
47
|
+
get nodes(): any[];
|
|
48
|
+
get edges(): any[];
|
|
49
|
+
/**
|
|
50
|
+
* 建一条任务(条):坐标由「起始日期 × 每日像素」算出,不接受任意 left/top
|
|
51
|
+
* —— 甘特的横轴是时间,不是自由画布。
|
|
52
|
+
*/
|
|
53
|
+
createTask(props: GanttTaskInput & {
|
|
54
|
+
id?: string;
|
|
55
|
+
}): any;
|
|
56
|
+
/** 建一条依赖(完成 → 开始),两端必须都是任务 */
|
|
57
|
+
createDependency(props?: any): any;
|
|
58
|
+
/** 改每日像素(时间轴缩放):所有任务与依赖一起重排 */
|
|
59
|
+
setDayWidth(dayWidth: number): void;
|
|
60
|
+
/** 项目起点 = 最早任务的开始日;没有任务时留空 */
|
|
61
|
+
computeOrigin(): string;
|
|
62
|
+
/** 项目区间(天数):至少 1 天,用于刻度与画布宽度 */
|
|
63
|
+
dayCount(): number;
|
|
64
|
+
/**
|
|
65
|
+
* 重建图表框架(左列任务名 + 日期刻度 + 行线)并同步所有任务的几何。
|
|
66
|
+
*
|
|
67
|
+
* 模型任何变化(增删任务、改日期、改每日像素)都要走这里 —— 时间轴是**派生**的,
|
|
68
|
+
* 不允许任务自己维护「我在哪一天的哪一像素上」。
|
|
69
|
+
*/
|
|
70
|
+
syncChrome(): void;
|
|
71
|
+
/**
|
|
72
|
+
* 甘特语义校验:
|
|
73
|
+
* - **依赖成环**(排期不成立);
|
|
74
|
+
* - 进度越界(0..1);
|
|
75
|
+
* - 持续天数非法(<1);
|
|
76
|
+
* - 任务早于项目起点(起点是自动取最早的,因此这条主要防手工改坐标)。
|
|
77
|
+
*/
|
|
78
|
+
validateGantt(): GanttIssue[];
|
|
79
|
+
private __anchor;
|
|
80
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022 大漠穷秋.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import { ICEGroup } from '../ice-render/index.mjs';
|
|
9
|
+
export declare type GanttRulerOptions = {
|
|
10
|
+
dayWidth: number;
|
|
11
|
+
labelColumnWidth: number;
|
|
12
|
+
headerHeight: number;
|
|
13
|
+
rowHeight: number;
|
|
14
|
+
originDate: string;
|
|
15
|
+
dayCount: number;
|
|
16
|
+
tasks: Array<{
|
|
17
|
+
title: string;
|
|
18
|
+
row: number;
|
|
19
|
+
}>;
|
|
20
|
+
totalWidth: number;
|
|
21
|
+
totalHeight: number;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* @class GanttRuler 甘特的「图表框架」:左列任务名 + 日期刻度 + 行分隔线
|
|
25
|
+
*
|
|
26
|
+
* 它是**派生装饰**(由设计器按任务模型重建),不是业务图元 —— 因此:
|
|
27
|
+
* - 不进 `designer.nodes`(类型过滤按 typeId 认 GanttTask);
|
|
28
|
+
* - 但仍然进文档与导出(它是画布内容的一部分,和任务条一起被截图/导出 SVG)。
|
|
29
|
+
*
|
|
30
|
+
* 时间轴刻度是「一次性画完」的:40 天以内每天一个刻度,超过就按周一/每月聚合,
|
|
31
|
+
* 避免长排期把画布画满文字(这也是甘特工具通行做法)。
|
|
32
|
+
*/
|
|
33
|
+
export default class GanttRuler extends ICEGroup {
|
|
34
|
+
static readonly typeId = "GanttRuler";
|
|
35
|
+
constructor();
|
|
36
|
+
hasDerivedChildren(): boolean;
|
|
37
|
+
/** 按当前任务模型重建框架 */
|
|
38
|
+
sync(options: GanttRulerOptions): void;
|
|
39
|
+
/** 只给日期字符串加天数(保持与 gantt_date 同一套 UTC 口径) */
|
|
40
|
+
private __addDays;
|
|
41
|
+
private __text;
|
|
42
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022 大漠穷秋.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import { ICEGroup } from '../ice-render/index';
|
|
9
|
+
export declare type GanttRulerOptions = {
|
|
10
|
+
dayWidth: number;
|
|
11
|
+
labelColumnWidth: number;
|
|
12
|
+
headerHeight: number;
|
|
13
|
+
rowHeight: number;
|
|
14
|
+
originDate: string;
|
|
15
|
+
dayCount: number;
|
|
16
|
+
tasks: Array<{
|
|
17
|
+
title: string;
|
|
18
|
+
row: number;
|
|
19
|
+
}>;
|
|
20
|
+
totalWidth: number;
|
|
21
|
+
totalHeight: number;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* @class GanttRuler 甘特的「图表框架」:左列任务名 + 日期刻度 + 行分隔线
|
|
25
|
+
*
|
|
26
|
+
* 它是**派生装饰**(由设计器按任务模型重建),不是业务图元 —— 因此:
|
|
27
|
+
* - 不进 `designer.nodes`(类型过滤按 typeId 认 GanttTask);
|
|
28
|
+
* - 但仍然进文档与导出(它是画布内容的一部分,和任务条一起被截图/导出 SVG)。
|
|
29
|
+
*
|
|
30
|
+
* 时间轴刻度是「一次性画完」的:40 天以内每天一个刻度,超过就按周一/每月聚合,
|
|
31
|
+
* 避免长排期把画布画满文字(这也是甘特工具通行做法)。
|
|
32
|
+
*/
|
|
33
|
+
export default class GanttRuler extends ICEGroup {
|
|
34
|
+
static readonly typeId = "GanttRuler";
|
|
35
|
+
constructor();
|
|
36
|
+
hasDerivedChildren(): boolean;
|
|
37
|
+
/** 按当前任务模型重建框架 */
|
|
38
|
+
sync(options: GanttRulerOptions): void;
|
|
39
|
+
/** 只给日期字符串加天数(保持与 gantt_date 同一套 UTC 口径) */
|
|
40
|
+
private __addDays;
|
|
41
|
+
private __text;
|
|
42
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022 大漠穷秋.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import { ICEGroup, ICERect, ICEText } from '../ice-render/index.mjs';
|
|
9
|
+
/**
|
|
10
|
+
* @class GanttTask 甘特图的一条任务(= 时间轴上的那个条)
|
|
11
|
+
*
|
|
12
|
+
* 复合组件(`hasDerivedChildren`):条、进度覆盖、文字都由 state 派生。
|
|
13
|
+
*
|
|
14
|
+
* **拖拽吸附**是排期语义的核心:`setPosition()` 会把 x 吸附到「整天」的格子上,
|
|
15
|
+
* 并据此反推起始日期 —— 拖动不会产生「3 月 5 日的 13:47 开工」这种排期。
|
|
16
|
+
*/
|
|
17
|
+
export default class GanttTask extends ICEGroup {
|
|
18
|
+
static readonly typeId = "GanttTask";
|
|
19
|
+
protected barComponent: ICERect | null;
|
|
20
|
+
protected progressComponent: ICERect | null;
|
|
21
|
+
protected labelComponent: ICEText | null;
|
|
22
|
+
hasDerivedChildren(): boolean;
|
|
23
|
+
constructor(props?: any);
|
|
24
|
+
protected static arrangeParam(props?: any): any;
|
|
25
|
+
private static readonly __shapeKeys;
|
|
26
|
+
setState(patch: any): void;
|
|
27
|
+
applyPatch(patch?: any): void;
|
|
28
|
+
/**
|
|
29
|
+
* @overwrite
|
|
30
|
+
* 拖拽吸附:x 吸附到整天网格并反推起始日期(y 吸附到行网格)。
|
|
31
|
+
*/
|
|
32
|
+
setPosition(left: number, top: number, evt?: any): void;
|
|
33
|
+
/** 时间轴上的左边缘(= state.left,设计器负责由日期算出它) */
|
|
34
|
+
barLeft(): number;
|
|
35
|
+
/** 进度覆盖条宽度 */
|
|
36
|
+
progressWidth(): number;
|
|
37
|
+
/** 由 start/days 反推几何(日期改了、或设计器换了 dayWidth/origin 时调用) */
|
|
38
|
+
syncGeometry(): void;
|
|
39
|
+
protected syncBar(): void;
|
|
40
|
+
private __clearDerivedChildren;
|
|
41
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022 大漠穷秋.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import { ICEGroup, ICERect, ICEText } from '../ice-render/index';
|
|
9
|
+
/**
|
|
10
|
+
* @class GanttTask 甘特图的一条任务(= 时间轴上的那个条)
|
|
11
|
+
*
|
|
12
|
+
* 复合组件(`hasDerivedChildren`):条、进度覆盖、文字都由 state 派生。
|
|
13
|
+
*
|
|
14
|
+
* **拖拽吸附**是排期语义的核心:`setPosition()` 会把 x 吸附到「整天」的格子上,
|
|
15
|
+
* 并据此反推起始日期 —— 拖动不会产生「3 月 5 日的 13:47 开工」这种排期。
|
|
16
|
+
*/
|
|
17
|
+
export default class GanttTask extends ICEGroup {
|
|
18
|
+
static readonly typeId = "GanttTask";
|
|
19
|
+
protected barComponent: ICERect | null;
|
|
20
|
+
protected progressComponent: ICERect | null;
|
|
21
|
+
protected labelComponent: ICEText | null;
|
|
22
|
+
hasDerivedChildren(): boolean;
|
|
23
|
+
constructor(props?: any);
|
|
24
|
+
protected static arrangeParam(props?: any): any;
|
|
25
|
+
private static readonly __shapeKeys;
|
|
26
|
+
setState(patch: any): void;
|
|
27
|
+
applyPatch(patch?: any): void;
|
|
28
|
+
/**
|
|
29
|
+
* @overwrite
|
|
30
|
+
* 拖拽吸附:x 吸附到整天网格并反推起始日期(y 吸附到行网格)。
|
|
31
|
+
*/
|
|
32
|
+
setPosition(left: number, top: number, evt?: any): void;
|
|
33
|
+
/** 时间轴上的左边缘(= state.left,设计器负责由日期算出它) */
|
|
34
|
+
barLeft(): number;
|
|
35
|
+
/** 进度覆盖条宽度 */
|
|
36
|
+
progressWidth(): number;
|
|
37
|
+
/** 由 start/days 反推几何(日期改了、或设计器换了 dayWidth/origin 时调用) */
|
|
38
|
+
syncGeometry(): void;
|
|
39
|
+
protected syncBar(): void;
|
|
40
|
+
private __clearDerivedChildren;
|
|
41
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** `YYYY-MM-DD` → UTC 时间戳(非法输入返回 NaN) */
|
|
2
|
+
export declare function parseDate(iso: string): number;
|
|
3
|
+
/** UTC 时间戳 → `YYYY-MM-DD` */
|
|
4
|
+
export declare function formatDate(timestamp: number): string;
|
|
5
|
+
/** 加天数 */
|
|
6
|
+
export declare function addDays(iso: string, days: number): string;
|
|
7
|
+
/** 相差天数(to - from) */
|
|
8
|
+
export declare function diffDays(from: string, to: string): number;
|
|
9
|
+
/** 两个日期之间(含)的每一天,用于渲染刻度 */
|
|
10
|
+
export declare function eachDay(from: string, to: string, limit?: number): string[];
|
|
11
|
+
/** 刻度文案:`03-02`(月-日);月初额外给出月份,便于阅读 */
|
|
12
|
+
export declare function tickLabel(iso: string): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** `YYYY-MM-DD` → UTC 时间戳(非法输入返回 NaN) */
|
|
2
|
+
export declare function parseDate(iso: string): number;
|
|
3
|
+
/** UTC 时间戳 → `YYYY-MM-DD` */
|
|
4
|
+
export declare function formatDate(timestamp: number): string;
|
|
5
|
+
/** 加天数 */
|
|
6
|
+
export declare function addDays(iso: string, days: number): string;
|
|
7
|
+
/** 相差天数(to - from) */
|
|
8
|
+
export declare function diffDays(from: string, to: string): number;
|
|
9
|
+
/** 两个日期之间(含)的每一天,用于渲染刻度 */
|
|
10
|
+
export declare function eachDay(from: string, to: string, limit?: number): string[];
|
|
11
|
+
/** 刻度文案:`03-02`(月-日);月初额外给出月份,便于阅读 */
|
|
12
|
+
export declare function tickLabel(iso: string): string;
|
|
@@ -232,6 +232,13 @@ declare class ICEPolyLine extends ICEDotPath {
|
|
|
232
232
|
* 先绘制折线,再绘制连线标签(若 label 非空)。
|
|
233
233
|
*/
|
|
234
234
|
protected doRender(): void;
|
|
235
|
+
/**
|
|
236
|
+
* 用「线色」把端点箭头三角形填实(`arrowStyle: 'filled'`,默认)。
|
|
237
|
+
*
|
|
238
|
+
* 面顶点由 `getArrowFaces()` 提供 —— 与 SVG 导出共用同一份口径(导出器也读它),
|
|
239
|
+
* 避免「画布填了、导出没填」(实心箭头在导出里变空心)。
|
|
240
|
+
*/
|
|
241
|
+
getArrowFaces(): number[][][];
|
|
235
242
|
/**
|
|
236
243
|
* 用「线色」把端点箭头三角形填实(`arrowStyle: 'filled'`,默认)。
|
|
237
244
|
*
|
|
@@ -232,6 +232,13 @@ declare class ICEPolyLine extends ICEDotPath {
|
|
|
232
232
|
* 先绘制折线,再绘制连线标签(若 label 非空)。
|
|
233
233
|
*/
|
|
234
234
|
protected doRender(): void;
|
|
235
|
+
/**
|
|
236
|
+
* 用「线色」把端点箭头三角形填实(`arrowStyle: 'filled'`,默认)。
|
|
237
|
+
*
|
|
238
|
+
* 面顶点由 `getArrowFaces()` 提供 —— 与 SVG 导出共用同一份口径(导出器也读它),
|
|
239
|
+
* 避免「画布填了、导出没填」(实心箭头在导出里变空心)。
|
|
240
|
+
*/
|
|
241
|
+
getArrowFaces(): number[][][];
|
|
235
242
|
/**
|
|
236
243
|
* 用「线色」把端点箭头三角形填实(`arrowStyle: 'filled'`,默认)。
|
|
237
244
|
*
|
package/dist/types/index.d.mts
CHANGED
|
@@ -31,6 +31,18 @@ export { default as UmlRelation, UML_RELATION_KINDS, UML_RELATION_STYLE } from '
|
|
|
31
31
|
export type { UmlRelationKind, UmlMarker } from './uml/UmlRelation.mjs';
|
|
32
32
|
export { default as UmlDesigner } from './uml/UmlDesigner.mjs';
|
|
33
33
|
export type { UmlIssue } from './uml/UmlDesigner.mjs';
|
|
34
|
+
export { default as StateNode, STATECHART_NODE_KINDS } from './statechart/StateNode.mjs';
|
|
35
|
+
export type { StatechartNodeKind } from './statechart/StateNode.mjs';
|
|
36
|
+
export { default as StateTransition } from './statechart/StateTransition.mjs';
|
|
37
|
+
export { default as StatechartDesigner } from './statechart/StatechartDesigner.mjs';
|
|
38
|
+
export type { StatechartIssue } from './statechart/StatechartDesigner.mjs';
|
|
39
|
+
export { default as GanttTask } from './gantt/GanttTask.mjs';
|
|
40
|
+
export { default as GanttDependency } from './gantt/GanttDependency.mjs';
|
|
41
|
+
export { default as GanttRuler } from './gantt/GanttRuler.mjs';
|
|
42
|
+
export type { GanttRulerOptions } from './gantt/GanttRuler.mjs';
|
|
43
|
+
export { default as GanttDesigner } from './gantt/GanttDesigner.mjs';
|
|
44
|
+
export type { GanttIssue, GanttTaskInput } from './gantt/GanttDesigner.mjs';
|
|
45
|
+
export { parseDate, formatDate, addDays, diffDays, eachDay, tickLabel } from './gantt/gantt_date.mjs';
|
|
34
46
|
export { toPlantUml, fromPlantUml, arrowOf, detectUmlDialect } from './uml/uml_text.mjs';
|
|
35
47
|
export type { UmlTextImportResult } from './uml/uml_text.mjs';
|
|
36
48
|
/**
|
package/dist/types/index.d.ts
CHANGED
|
@@ -31,6 +31,18 @@ export { default as UmlRelation, UML_RELATION_KINDS, UML_RELATION_STYLE } from '
|
|
|
31
31
|
export type { UmlRelationKind, UmlMarker } from './uml/UmlRelation';
|
|
32
32
|
export { default as UmlDesigner } from './uml/UmlDesigner';
|
|
33
33
|
export type { UmlIssue } from './uml/UmlDesigner';
|
|
34
|
+
export { default as StateNode, STATECHART_NODE_KINDS } from './statechart/StateNode';
|
|
35
|
+
export type { StatechartNodeKind } from './statechart/StateNode';
|
|
36
|
+
export { default as StateTransition } from './statechart/StateTransition';
|
|
37
|
+
export { default as StatechartDesigner } from './statechart/StatechartDesigner';
|
|
38
|
+
export type { StatechartIssue } from './statechart/StatechartDesigner';
|
|
39
|
+
export { default as GanttTask } from './gantt/GanttTask';
|
|
40
|
+
export { default as GanttDependency } from './gantt/GanttDependency';
|
|
41
|
+
export { default as GanttRuler } from './gantt/GanttRuler';
|
|
42
|
+
export type { GanttRulerOptions } from './gantt/GanttRuler';
|
|
43
|
+
export { default as GanttDesigner } from './gantt/GanttDesigner';
|
|
44
|
+
export type { GanttIssue, GanttTaskInput } from './gantt/GanttDesigner';
|
|
45
|
+
export { parseDate, formatDate, addDays, diffDays, eachDay, tickLabel } from './gantt/gantt_date';
|
|
34
46
|
export { toPlantUml, fromPlantUml, arrowOf, detectUmlDialect } from './uml/uml_text';
|
|
35
47
|
export type { UmlTextImportResult } from './uml/uml_text';
|
|
36
48
|
/**
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022 大漠穷秋.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import { ICEGroup, ICEText } from '../ice-render/index.mjs';
|
|
9
|
+
export declare const STATECHART_NODE_KINDS: readonly ["initial", "final", "state", "composite"];
|
|
10
|
+
export declare type StatechartNodeKind = (typeof STATECHART_NODE_KINDS)[number];
|
|
11
|
+
/**
|
|
12
|
+
* @class StateNode 状态机的节点(伪状态 / 状态 / 复合状态)
|
|
13
|
+
*
|
|
14
|
+
* 复合组件(`hasDerivedChildren() === true`):内部形状与名字由 state 派生、不进文档。
|
|
15
|
+
* 四种记法:
|
|
16
|
+
* - `initial` 初始伪状态:实心圆
|
|
17
|
+
* - `final` 终止伪状态:同心圆(外圈 + 实心内圈)
|
|
18
|
+
* - `state` 普通状态:圆角矩形 + 居中名字
|
|
19
|
+
* - `composite` 复合状态:**容器** —— 名字靠左上,框里留给子状态;拖动它子状态一起走(引擎容器能力)
|
|
20
|
+
*/
|
|
21
|
+
export default class StateNode extends ICEGroup {
|
|
22
|
+
static readonly typeId = "StateNode";
|
|
23
|
+
protected shapeComponent: any;
|
|
24
|
+
protected innerRingComponent: any;
|
|
25
|
+
protected labelComponent: ICEText | null;
|
|
26
|
+
hasDerivedChildren(): boolean;
|
|
27
|
+
constructor(props?: any);
|
|
28
|
+
protected static arrangeParam(props?: any): any;
|
|
29
|
+
/** 只有这些键变化才需要重建内部形状(拖动位置、选中态都不该重建) */
|
|
30
|
+
private static readonly __shapeKeys;
|
|
31
|
+
setState(patch: any): void;
|
|
32
|
+
applyPatch(patch?: any): void;
|
|
33
|
+
/** 伪状态(初始/终止)不显示名字 */
|
|
34
|
+
isPseudoState(): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* 按 kind 重建内部形状与名字。
|
|
37
|
+
*
|
|
38
|
+
* zIndex 必须显式给:引擎在**构造时**分配自增 zIndex,后构造的会盖住先构造的
|
|
39
|
+
* (UML 那边就踩过「底色带盖住类名」),这里统一「形状在下、文字在上」。
|
|
40
|
+
*/
|
|
41
|
+
protected syncShape(): void;
|
|
42
|
+
private __clearDerivedChildren;
|
|
43
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022 大漠穷秋.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import { ICEGroup, ICEText } from '../ice-render/index';
|
|
9
|
+
export declare const STATECHART_NODE_KINDS: readonly ["initial", "final", "state", "composite"];
|
|
10
|
+
export declare type StatechartNodeKind = (typeof STATECHART_NODE_KINDS)[number];
|
|
11
|
+
/**
|
|
12
|
+
* @class StateNode 状态机的节点(伪状态 / 状态 / 复合状态)
|
|
13
|
+
*
|
|
14
|
+
* 复合组件(`hasDerivedChildren() === true`):内部形状与名字由 state 派生、不进文档。
|
|
15
|
+
* 四种记法:
|
|
16
|
+
* - `initial` 初始伪状态:实心圆
|
|
17
|
+
* - `final` 终止伪状态:同心圆(外圈 + 实心内圈)
|
|
18
|
+
* - `state` 普通状态:圆角矩形 + 居中名字
|
|
19
|
+
* - `composite` 复合状态:**容器** —— 名字靠左上,框里留给子状态;拖动它子状态一起走(引擎容器能力)
|
|
20
|
+
*/
|
|
21
|
+
export default class StateNode extends ICEGroup {
|
|
22
|
+
static readonly typeId = "StateNode";
|
|
23
|
+
protected shapeComponent: any;
|
|
24
|
+
protected innerRingComponent: any;
|
|
25
|
+
protected labelComponent: ICEText | null;
|
|
26
|
+
hasDerivedChildren(): boolean;
|
|
27
|
+
constructor(props?: any);
|
|
28
|
+
protected static arrangeParam(props?: any): any;
|
|
29
|
+
/** 只有这些键变化才需要重建内部形状(拖动位置、选中态都不该重建) */
|
|
30
|
+
private static readonly __shapeKeys;
|
|
31
|
+
setState(patch: any): void;
|
|
32
|
+
applyPatch(patch?: any): void;
|
|
33
|
+
/** 伪状态(初始/终止)不显示名字 */
|
|
34
|
+
isPseudoState(): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* 按 kind 重建内部形状与名字。
|
|
37
|
+
*
|
|
38
|
+
* zIndex 必须显式给:引擎在**构造时**分配自增 zIndex,后构造的会盖住先构造的
|
|
39
|
+
* (UML 那边就踩过「底色带盖住类名」),这里统一「形状在下、文字在上」。
|
|
40
|
+
*/
|
|
41
|
+
protected syncShape(): void;
|
|
42
|
+
private __clearDerivedChildren;
|
|
43
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022 大漠穷秋.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import { ICEPolyLine } from '../ice-render/index.mjs';
|
|
9
|
+
/**
|
|
10
|
+
* @class StateTransition 状态机的一次转移
|
|
11
|
+
*
|
|
12
|
+
* 记法:实线 + **实心箭头**,标签是 `事件 [守卫] / 动作`(UML 状态机与 PlantUML 状态图的通行写法)。
|
|
13
|
+
* 复用引擎折线(插槽吸附 / 正交·贝塞尔路由 / 跟随宿主 / 矢量导出),只把标签的三个部分拼好。
|
|
14
|
+
*
|
|
15
|
+
* 之所以单独一个类而不是直接用 ICEPolyLine:给一个**稳定 typeId**,
|
|
16
|
+
* 判型与序列化都靠它(应用层不要用 constructor.name,打包会 mangle)。
|
|
17
|
+
*/
|
|
18
|
+
export default class StateTransition extends ICEPolyLine {
|
|
19
|
+
static readonly typeId = "StateTransition";
|
|
20
|
+
constructor(props?: any);
|
|
21
|
+
protected static arrangeParam(props?: any): any;
|
|
22
|
+
/**
|
|
23
|
+
* 标签拼装:`事件 [守卫] / 动作` —— 缺哪个省哪个(不会出现空括号或光秃秃的斜杠)。
|
|
24
|
+
*/
|
|
25
|
+
static composeLabel(parts: {
|
|
26
|
+
event?: string;
|
|
27
|
+
guard?: string;
|
|
28
|
+
action?: string;
|
|
29
|
+
}): string;
|
|
30
|
+
setState(patch: any): void;
|
|
31
|
+
applyPatch(patch?: any): void;
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022 大漠穷秋.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import { ICEPolyLine } from '../ice-render/index';
|
|
9
|
+
/**
|
|
10
|
+
* @class StateTransition 状态机的一次转移
|
|
11
|
+
*
|
|
12
|
+
* 记法:实线 + **实心箭头**,标签是 `事件 [守卫] / 动作`(UML 状态机与 PlantUML 状态图的通行写法)。
|
|
13
|
+
* 复用引擎折线(插槽吸附 / 正交·贝塞尔路由 / 跟随宿主 / 矢量导出),只把标签的三个部分拼好。
|
|
14
|
+
*
|
|
15
|
+
* 之所以单独一个类而不是直接用 ICEPolyLine:给一个**稳定 typeId**,
|
|
16
|
+
* 判型与序列化都靠它(应用层不要用 constructor.name,打包会 mangle)。
|
|
17
|
+
*/
|
|
18
|
+
export default class StateTransition extends ICEPolyLine {
|
|
19
|
+
static readonly typeId = "StateTransition";
|
|
20
|
+
constructor(props?: any);
|
|
21
|
+
protected static arrangeParam(props?: any): any;
|
|
22
|
+
/**
|
|
23
|
+
* 标签拼装:`事件 [守卫] / 动作` —— 缺哪个省哪个(不会出现空括号或光秃秃的斜杠)。
|
|
24
|
+
*/
|
|
25
|
+
static composeLabel(parts: {
|
|
26
|
+
event?: string;
|
|
27
|
+
guard?: string;
|
|
28
|
+
action?: string;
|
|
29
|
+
}): string;
|
|
30
|
+
setState(patch: any): void;
|
|
31
|
+
applyPatch(patch?: any): void;
|
|
32
|
+
}
|