ice-entity-designer 0.0.26 → 0.0.28
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 +26 -2
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/index.umd.js +2 -2
- package/dist/types/bpmn/BpmnSimulator.d.mts +92 -0
- package/dist/types/bpmn/BpmnSimulator.d.ts +92 -0
- package/dist/types/gantt/GanttDesigner.d.mts +19 -0
- package/dist/types/gantt/GanttDesigner.d.ts +19 -0
- package/dist/types/index.d.mts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,92 @@
|
|
|
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 { ICECircle } from '../ice-render/index.mjs';
|
|
9
|
+
/**
|
|
10
|
+
* 仿真令牌的点:一个普通的引擎圆,只是给了稳定的 `typeId`。
|
|
11
|
+
*
|
|
12
|
+
* 它挂在 `ice.toolNodes`(工具层)—— 工具层**不参与引擎序列化**,因此仿真不会污染文档、
|
|
13
|
+
* 快照与 BPMN XML 导出,一旦 `stop()` 就干净退场。
|
|
14
|
+
*/
|
|
15
|
+
export declare class SimTokenDot extends ICECircle {
|
|
16
|
+
static readonly typeId = "SimToken";
|
|
17
|
+
constructor(props?: any);
|
|
18
|
+
}
|
|
19
|
+
export declare type SimToken = {
|
|
20
|
+
id: string;
|
|
21
|
+
/** 当前所在节点 */
|
|
22
|
+
nodeId: string;
|
|
23
|
+
/** 正在走的连线(在节点上停留时为 null) */
|
|
24
|
+
edgeId: string | null;
|
|
25
|
+
/** 在连线上的进度 0..1 */
|
|
26
|
+
progress: number;
|
|
27
|
+
/** 世界坐标(画布上的位置,测试与渲染都用它) */
|
|
28
|
+
position: number[];
|
|
29
|
+
/** 在当前节点还要停留多少毫秒 */
|
|
30
|
+
dwellRemaining: number;
|
|
31
|
+
component: any;
|
|
32
|
+
};
|
|
33
|
+
export declare type BpmnSimulatorOptions = {
|
|
34
|
+
/** 任务/网关等节点上的默认停留时长(毫秒) */
|
|
35
|
+
nodeDuration?: number;
|
|
36
|
+
/** 走一条连线默认花多久(毫秒) */
|
|
37
|
+
edgeDuration?: number;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* @class BpmnSimulator BPMN 令牌仿真
|
|
41
|
+
*
|
|
42
|
+
* 把「流程怎么走」演示出来:令牌从开始事件出发,沿顺序流前进,在任务上停留,
|
|
43
|
+
* 在排他网关选一条分支、在并行网关一分为多,最终到达结束事件消失。
|
|
44
|
+
*
|
|
45
|
+
* 设计上刻意**不引入新的时间机制**:
|
|
46
|
+
* - 推进是显式的 `step(dtMs)`:浏览器里由引擎的帧事件驱动,测试里手动推进(确定性、可断言);
|
|
47
|
+
* - 令牌位置就在连线的**实际折点**上插值(`points`),因此令牌始终贴在画出来的线上;
|
|
48
|
+
* - 令牌是工具层组件:不写文档、不影响快照与导出。
|
|
49
|
+
*/
|
|
50
|
+
export default class BpmnSimulator {
|
|
51
|
+
private designer;
|
|
52
|
+
private tokens;
|
|
53
|
+
private visited;
|
|
54
|
+
private running;
|
|
55
|
+
private finished;
|
|
56
|
+
private started;
|
|
57
|
+
private nodeDurations;
|
|
58
|
+
private nodeDuration;
|
|
59
|
+
private edgeDuration;
|
|
60
|
+
private seq;
|
|
61
|
+
private lastFrameAt;
|
|
62
|
+
private frameHandler;
|
|
63
|
+
constructor(designer: any, options?: BpmnSimulatorOptions);
|
|
64
|
+
/** 单个节点上的停留时长(例如让某个任务看得清) */
|
|
65
|
+
setNodeDuration(nodeId: string, duration: number): void;
|
|
66
|
+
setEdgeDuration(duration: number): void;
|
|
67
|
+
isRunning(): boolean;
|
|
68
|
+
isFinished(): boolean;
|
|
69
|
+
getTokens(): SimToken[];
|
|
70
|
+
getVisitedNodeIds(): string[];
|
|
71
|
+
/** 开始:每个「开始事件」放一个令牌,并挂到帧循环上 */
|
|
72
|
+
start(): void;
|
|
73
|
+
stop(): void;
|
|
74
|
+
/** 清空令牌与访问记录(可重跑) */
|
|
75
|
+
reset(): void;
|
|
76
|
+
/**
|
|
77
|
+
* 推进 `dtMs` 毫秒。
|
|
78
|
+
*
|
|
79
|
+
* 令牌的状态机很直白:在节点上倒计时停留 → 到时选出口(可能分裂)→ 在连线上按进度前进
|
|
80
|
+
* → 到达目标节点。结束事件上不再有出口,令牌随之消失。
|
|
81
|
+
*/
|
|
82
|
+
step(dtMs: number): void;
|
|
83
|
+
/** 选中一条出口连线(排他网关优先选带条件的,其次是显式非默认的) */
|
|
84
|
+
private __pickExclusive;
|
|
85
|
+
private __spawn;
|
|
86
|
+
private __arriveAtNode;
|
|
87
|
+
/** 离开节点:选出口;并行/包容网关分裂成多条令牌 */
|
|
88
|
+
private __leaveNode;
|
|
89
|
+
private __syncPosition;
|
|
90
|
+
private __nodePosition;
|
|
91
|
+
private __removeComponent;
|
|
92
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
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 { ICECircle } from '../ice-render/index';
|
|
9
|
+
/**
|
|
10
|
+
* 仿真令牌的点:一个普通的引擎圆,只是给了稳定的 `typeId`。
|
|
11
|
+
*
|
|
12
|
+
* 它挂在 `ice.toolNodes`(工具层)—— 工具层**不参与引擎序列化**,因此仿真不会污染文档、
|
|
13
|
+
* 快照与 BPMN XML 导出,一旦 `stop()` 就干净退场。
|
|
14
|
+
*/
|
|
15
|
+
export declare class SimTokenDot extends ICECircle {
|
|
16
|
+
static readonly typeId = "SimToken";
|
|
17
|
+
constructor(props?: any);
|
|
18
|
+
}
|
|
19
|
+
export declare type SimToken = {
|
|
20
|
+
id: string;
|
|
21
|
+
/** 当前所在节点 */
|
|
22
|
+
nodeId: string;
|
|
23
|
+
/** 正在走的连线(在节点上停留时为 null) */
|
|
24
|
+
edgeId: string | null;
|
|
25
|
+
/** 在连线上的进度 0..1 */
|
|
26
|
+
progress: number;
|
|
27
|
+
/** 世界坐标(画布上的位置,测试与渲染都用它) */
|
|
28
|
+
position: number[];
|
|
29
|
+
/** 在当前节点还要停留多少毫秒 */
|
|
30
|
+
dwellRemaining: number;
|
|
31
|
+
component: any;
|
|
32
|
+
};
|
|
33
|
+
export declare type BpmnSimulatorOptions = {
|
|
34
|
+
/** 任务/网关等节点上的默认停留时长(毫秒) */
|
|
35
|
+
nodeDuration?: number;
|
|
36
|
+
/** 走一条连线默认花多久(毫秒) */
|
|
37
|
+
edgeDuration?: number;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* @class BpmnSimulator BPMN 令牌仿真
|
|
41
|
+
*
|
|
42
|
+
* 把「流程怎么走」演示出来:令牌从开始事件出发,沿顺序流前进,在任务上停留,
|
|
43
|
+
* 在排他网关选一条分支、在并行网关一分为多,最终到达结束事件消失。
|
|
44
|
+
*
|
|
45
|
+
* 设计上刻意**不引入新的时间机制**:
|
|
46
|
+
* - 推进是显式的 `step(dtMs)`:浏览器里由引擎的帧事件驱动,测试里手动推进(确定性、可断言);
|
|
47
|
+
* - 令牌位置就在连线的**实际折点**上插值(`points`),因此令牌始终贴在画出来的线上;
|
|
48
|
+
* - 令牌是工具层组件:不写文档、不影响快照与导出。
|
|
49
|
+
*/
|
|
50
|
+
export default class BpmnSimulator {
|
|
51
|
+
private designer;
|
|
52
|
+
private tokens;
|
|
53
|
+
private visited;
|
|
54
|
+
private running;
|
|
55
|
+
private finished;
|
|
56
|
+
private started;
|
|
57
|
+
private nodeDurations;
|
|
58
|
+
private nodeDuration;
|
|
59
|
+
private edgeDuration;
|
|
60
|
+
private seq;
|
|
61
|
+
private lastFrameAt;
|
|
62
|
+
private frameHandler;
|
|
63
|
+
constructor(designer: any, options?: BpmnSimulatorOptions);
|
|
64
|
+
/** 单个节点上的停留时长(例如让某个任务看得清) */
|
|
65
|
+
setNodeDuration(nodeId: string, duration: number): void;
|
|
66
|
+
setEdgeDuration(duration: number): void;
|
|
67
|
+
isRunning(): boolean;
|
|
68
|
+
isFinished(): boolean;
|
|
69
|
+
getTokens(): SimToken[];
|
|
70
|
+
getVisitedNodeIds(): string[];
|
|
71
|
+
/** 开始:每个「开始事件」放一个令牌,并挂到帧循环上 */
|
|
72
|
+
start(): void;
|
|
73
|
+
stop(): void;
|
|
74
|
+
/** 清空令牌与访问记录(可重跑) */
|
|
75
|
+
reset(): void;
|
|
76
|
+
/**
|
|
77
|
+
* 推进 `dtMs` 毫秒。
|
|
78
|
+
*
|
|
79
|
+
* 令牌的状态机很直白:在节点上倒计时停留 → 到时选出口(可能分裂)→ 在连线上按进度前进
|
|
80
|
+
* → 到达目标节点。结束事件上不再有出口,令牌随之消失。
|
|
81
|
+
*/
|
|
82
|
+
step(dtMs: number): void;
|
|
83
|
+
/** 选中一条出口连线(排他网关优先选带条件的,其次是显式非默认的) */
|
|
84
|
+
private __pickExclusive;
|
|
85
|
+
private __spawn;
|
|
86
|
+
private __arriveAtNode;
|
|
87
|
+
/** 离开节点:选出口;并行/包容网关分裂成多条令牌 */
|
|
88
|
+
private __leaveNode;
|
|
89
|
+
private __syncPosition;
|
|
90
|
+
private __nodePosition;
|
|
91
|
+
private __removeComponent;
|
|
92
|
+
}
|
|
@@ -19,6 +19,8 @@ export declare type GanttTaskInput = {
|
|
|
19
19
|
days?: number;
|
|
20
20
|
row?: number;
|
|
21
21
|
progress?: number;
|
|
22
|
+
/** 负责人 / 资源名(用于资源冲突检查;空表示不参与) */
|
|
23
|
+
resource?: string;
|
|
22
24
|
};
|
|
23
25
|
/**
|
|
24
26
|
* @class GanttDesigner 甘特图设计器(第三个 domain pack)
|
|
@@ -57,6 +59,23 @@ export default class GanttDesigner extends FlowDesigner {
|
|
|
57
59
|
createDependency(props?: any): any;
|
|
58
60
|
/** 改每日像素(时间轴缩放):所有任务与依赖一起重排 */
|
|
59
61
|
setDayWidth(dayWidth: number): void;
|
|
62
|
+
/** 改任务(属性面板 / 应用层用):走 setState,几何与框架自动跟着更新 */
|
|
63
|
+
updateTask(id: string, patch?: any): any;
|
|
64
|
+
/**
|
|
65
|
+
* **自动排程**:把每个任务推到「所有前置任务结束之后」(完成 → 开始,结束日不含当天)。
|
|
66
|
+
*
|
|
67
|
+
* 语义:任务占 `[start, start + days)`,因此后置任务最早在前置任务 `start + days` 那天开工。
|
|
68
|
+
* 只在**推后**时生效(不提前任何任务)—— 人力排期里"提前"通常意味着别处的约束被破坏。
|
|
69
|
+
* 依赖图必须先无环(有环时本方法不动,交给 `validateGantt()` 报错)。
|
|
70
|
+
*/
|
|
71
|
+
autoSchedule(): void;
|
|
72
|
+
/**
|
|
73
|
+
* **关键路径**:依赖图上「时长最长」的那条链(浮时为 0 的任务)。
|
|
74
|
+
*
|
|
75
|
+
* 用最早/最晚开工时间算总浮时:`float = 最晚开工 - 最早开工`,浮时为 0 的任务即在关键路径上。
|
|
76
|
+
* 有环时返回空数组(无关键路径可言)。
|
|
77
|
+
*/
|
|
78
|
+
criticalPath(): any[];
|
|
60
79
|
/** 项目起点 = 最早任务的开始日;没有任务时留空 */
|
|
61
80
|
computeOrigin(): string;
|
|
62
81
|
/** 项目区间(天数):至少 1 天,用于刻度与画布宽度 */
|
|
@@ -19,6 +19,8 @@ export declare type GanttTaskInput = {
|
|
|
19
19
|
days?: number;
|
|
20
20
|
row?: number;
|
|
21
21
|
progress?: number;
|
|
22
|
+
/** 负责人 / 资源名(用于资源冲突检查;空表示不参与) */
|
|
23
|
+
resource?: string;
|
|
22
24
|
};
|
|
23
25
|
/**
|
|
24
26
|
* @class GanttDesigner 甘特图设计器(第三个 domain pack)
|
|
@@ -57,6 +59,23 @@ export default class GanttDesigner extends FlowDesigner {
|
|
|
57
59
|
createDependency(props?: any): any;
|
|
58
60
|
/** 改每日像素(时间轴缩放):所有任务与依赖一起重排 */
|
|
59
61
|
setDayWidth(dayWidth: number): void;
|
|
62
|
+
/** 改任务(属性面板 / 应用层用):走 setState,几何与框架自动跟着更新 */
|
|
63
|
+
updateTask(id: string, patch?: any): any;
|
|
64
|
+
/**
|
|
65
|
+
* **自动排程**:把每个任务推到「所有前置任务结束之后」(完成 → 开始,结束日不含当天)。
|
|
66
|
+
*
|
|
67
|
+
* 语义:任务占 `[start, start + days)`,因此后置任务最早在前置任务 `start + days` 那天开工。
|
|
68
|
+
* 只在**推后**时生效(不提前任何任务)—— 人力排期里"提前"通常意味着别处的约束被破坏。
|
|
69
|
+
* 依赖图必须先无环(有环时本方法不动,交给 `validateGantt()` 报错)。
|
|
70
|
+
*/
|
|
71
|
+
autoSchedule(): void;
|
|
72
|
+
/**
|
|
73
|
+
* **关键路径**:依赖图上「时长最长」的那条链(浮时为 0 的任务)。
|
|
74
|
+
*
|
|
75
|
+
* 用最早/最晚开工时间算总浮时:`float = 最晚开工 - 最早开工`,浮时为 0 的任务即在关键路径上。
|
|
76
|
+
* 有环时返回空数组(无关键路径可言)。
|
|
77
|
+
*/
|
|
78
|
+
criticalPath(): any[];
|
|
60
79
|
/** 项目起点 = 最早任务的开始日;没有任务时留空 */
|
|
61
80
|
computeOrigin(): string;
|
|
62
81
|
/** 项目区间(天数):至少 1 天,用于刻度与画布宽度 */
|
package/dist/types/index.d.mts
CHANGED
|
@@ -23,6 +23,8 @@ export { FlowDiamond, FlowParallelogram } from './flow/flow_shapes.mjs';
|
|
|
23
23
|
export { default as BpmnDesigner } from './bpmn/BpmnDesigner.mjs';
|
|
24
24
|
export { validateBpmn } from './bpmn/bpmn_validate.mjs';
|
|
25
25
|
export type { BpmnIssue } from './bpmn/bpmn_validate.mjs';
|
|
26
|
+
export { default as BpmnSimulator } from './bpmn/BpmnSimulator.mjs';
|
|
27
|
+
export type { SimToken, BpmnSimulatorOptions } from './bpmn/BpmnSimulator.mjs';
|
|
26
28
|
export { toBpmnXml, fromBpmnXml } from './bpmn/bpmn_xml.mjs';
|
|
27
29
|
export type { BpmnImportResult } from './bpmn/bpmn_xml.mjs';
|
|
28
30
|
export { default as UmlClass } from './uml/UmlClass.mjs';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ export { FlowDiamond, FlowParallelogram } from './flow/flow_shapes';
|
|
|
23
23
|
export { default as BpmnDesigner } from './bpmn/BpmnDesigner';
|
|
24
24
|
export { validateBpmn } from './bpmn/bpmn_validate';
|
|
25
25
|
export type { BpmnIssue } from './bpmn/bpmn_validate';
|
|
26
|
+
export { default as BpmnSimulator } from './bpmn/BpmnSimulator';
|
|
27
|
+
export type { SimToken, BpmnSimulatorOptions } from './bpmn/BpmnSimulator';
|
|
26
28
|
export { toBpmnXml, fromBpmnXml } from './bpmn/bpmn_xml';
|
|
27
29
|
export type { BpmnImportResult } from './bpmn/bpmn_xml';
|
|
28
30
|
export { default as UmlClass } from './uml/UmlClass';
|