ice-entity-designer 0.0.20 → 0.0.22
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 +122 -3
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/index.umd.js +2 -2
- package/dist/react.cjs +3 -3
- package/dist/react.mjs +3 -3
- package/dist/types/bpmn/BpmnDesigner.d.mts +50 -0
- package/dist/types/bpmn/BpmnDesigner.d.ts +50 -0
- package/dist/types/bpmn/bpmn_shapes.d.mts +61 -0
- package/dist/types/bpmn/bpmn_shapes.d.ts +61 -0
- package/dist/types/bpmn/bpmn_validate.d.mts +24 -0
- package/dist/types/bpmn/bpmn_validate.d.ts +24 -0
- package/dist/types/bpmn/bpmn_xml.d.mts +46 -0
- package/dist/types/bpmn/bpmn_xml.d.ts +46 -0
- package/dist/types/designer/EntityDesigner.d.mts +1 -1
- package/dist/types/designer/EntityDesigner.d.ts +1 -1
- package/dist/types/er-component/Entity.d.mts +5 -0
- package/dist/types/er-component/Entity.d.ts +5 -0
- package/dist/types/er-component/Relation.d.mts +2 -0
- package/dist/types/er-component/Relation.d.ts +2 -0
- package/dist/types/flow/FlowDesigner.d.mts +32 -14
- package/dist/types/flow/FlowDesigner.d.ts +32 -14
- package/dist/types/flow/FlowEdge.d.mts +10 -15
- package/dist/types/flow/FlowEdge.d.ts +10 -15
- package/dist/types/flow/FlowNode.d.mts +45 -18
- package/dist/types/flow/FlowNode.d.ts +45 -18
- package/dist/types/ice-render/graphic/ICEComponent.d.mts +12 -8
- package/dist/types/ice-render/graphic/ICEComponent.d.ts +12 -8
- package/dist/types/ice-render/graphic/container/ICEGroup.d.mts +10 -0
- package/dist/types/ice-render/graphic/container/ICEGroup.d.ts +10 -0
- package/dist/types/ice-render/index.d.mts +2 -0
- package/dist/types/ice-render/index.d.ts +2 -0
- package/dist/types/index.d.mts +7 -2
- package/dist/types/index.d.ts +7 -2
- package/dist/types/react/FlowDesignerCanvas.d.mts +14 -0
- package/dist/types/react/FlowDesignerCanvas.d.ts +14 -0
- package/dist/types/react/context.d.mts +18 -1
- package/dist/types/react/context.d.ts +18 -1
- package/dist/types/react/index.d.mts +8 -1
- package/dist/types/react/index.d.ts +8 -1
- package/dist/types/react/reportLoadError.d.mts +8 -0
- package/dist/types/react/reportLoadError.d.ts +8 -0
- package/dist/types/react/session.d.mts +22 -1
- package/dist/types/react/session.d.ts +22 -1
- package/dist/types/react/types.d.mts +59 -1
- package/dist/types/react/types.d.ts +59 -1
- package/dist/types/utils/project_codec.d.mts +66 -0
- package/dist/types/utils/project_codec.d.ts +66 -0
- package/package.json +1 -1
|
@@ -0,0 +1,50 @@
|
|
|
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 type { BpmnIssue } from './bpmn_validate.mjs';
|
|
10
|
+
/**
|
|
11
|
+
* BPMN 设计器:`FlowDesigner` 的薄扩展,只补两件 BPMN 特有的事:
|
|
12
|
+
*
|
|
13
|
+
* 1. **顺序流上的条件/默认标记**(BPMN 记法要求):标记是「派生装饰」,
|
|
14
|
+
* 放在 `ice.toolNodes`(工具层)里 —— 工具层不参与引擎序列化(我们上轮验证过),
|
|
15
|
+
* 所以文档仍然是纯粹的业务模型,标记由 `flowType/condition/isDefault` 推出来。
|
|
16
|
+
* 2. **BPMN 语义校验**:`validate()` 直接复用 `validateBpmn()`。
|
|
17
|
+
*
|
|
18
|
+
* 其余能力(建节点/连线、选择、增删改、撤销重做、快照存取、适应视图、订阅)
|
|
19
|
+
* 全部继承自 `FlowDesigner` —— 沿用同一套机制,不再造第二份。
|
|
20
|
+
*/
|
|
21
|
+
export default class BpmnDesigner extends FlowDesigner {
|
|
22
|
+
private __markers;
|
|
23
|
+
private __markerSyncing;
|
|
24
|
+
private __nesting;
|
|
25
|
+
constructor(ice: any);
|
|
26
|
+
/** BPMN 语义校验(事件/网关/池/连通性等,见 bpmn_validate.ts) */
|
|
27
|
+
validateBpmn(): BpmnIssue[];
|
|
28
|
+
/**
|
|
29
|
+
* 建节点:除常规流程元素外,**自动按几何把节点嵌进池/泳道**(用引擎的容器能力)。
|
|
30
|
+
*
|
|
31
|
+
* 为什么要真嵌套:外层容器(池)被拖动时,引擎的矩阵组合会让内部泳道与泳道里的节点
|
|
32
|
+
* 一起移动 —— 这正是「拖动池子,里面的东西跟着走」的正确实现;扁平结构做不到。
|
|
33
|
+
*
|
|
34
|
+
* 归属规则:取「面积最小的、包住节点中心的容器」(泳道比池小 → 优先落在泳道里)。
|
|
35
|
+
* 子组件坐标是**父容器左上角**为原点,因此嵌套时要做一次坐标换算。
|
|
36
|
+
*/
|
|
37
|
+
createNode(kind: any, props?: any): any;
|
|
38
|
+
/** 把(已经在 ice 根上的)节点嵌进最内层容器 */
|
|
39
|
+
private __nestByGeometry;
|
|
40
|
+
/**
|
|
41
|
+
* 容器的**内容区**(扣掉名称带)。
|
|
42
|
+
*
|
|
43
|
+
* 池的名称带在顶部、泳道在左侧,名称带属于标题区、不该被内部元素压住;
|
|
44
|
+
* 所以归属判定按内容区算,否则泳道会盖住池标题。
|
|
45
|
+
*/
|
|
46
|
+
private __contentBox;
|
|
47
|
+
/** 顺序流的条件/默认标记:按需创建、原位更新(放在工具层,不污染文档) */
|
|
48
|
+
syncFlowMarkers(): void;
|
|
49
|
+
dispose(): void;
|
|
50
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
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 type { BpmnIssue } from './bpmn_validate';
|
|
10
|
+
/**
|
|
11
|
+
* BPMN 设计器:`FlowDesigner` 的薄扩展,只补两件 BPMN 特有的事:
|
|
12
|
+
*
|
|
13
|
+
* 1. **顺序流上的条件/默认标记**(BPMN 记法要求):标记是「派生装饰」,
|
|
14
|
+
* 放在 `ice.toolNodes`(工具层)里 —— 工具层不参与引擎序列化(我们上轮验证过),
|
|
15
|
+
* 所以文档仍然是纯粹的业务模型,标记由 `flowType/condition/isDefault` 推出来。
|
|
16
|
+
* 2. **BPMN 语义校验**:`validate()` 直接复用 `validateBpmn()`。
|
|
17
|
+
*
|
|
18
|
+
* 其余能力(建节点/连线、选择、增删改、撤销重做、快照存取、适应视图、订阅)
|
|
19
|
+
* 全部继承自 `FlowDesigner` —— 沿用同一套机制,不再造第二份。
|
|
20
|
+
*/
|
|
21
|
+
export default class BpmnDesigner extends FlowDesigner {
|
|
22
|
+
private __markers;
|
|
23
|
+
private __markerSyncing;
|
|
24
|
+
private __nesting;
|
|
25
|
+
constructor(ice: any);
|
|
26
|
+
/** BPMN 语义校验(事件/网关/池/连通性等,见 bpmn_validate.ts) */
|
|
27
|
+
validateBpmn(): BpmnIssue[];
|
|
28
|
+
/**
|
|
29
|
+
* 建节点:除常规流程元素外,**自动按几何把节点嵌进池/泳道**(用引擎的容器能力)。
|
|
30
|
+
*
|
|
31
|
+
* 为什么要真嵌套:外层容器(池)被拖动时,引擎的矩阵组合会让内部泳道与泳道里的节点
|
|
32
|
+
* 一起移动 —— 这正是「拖动池子,里面的东西跟着走」的正确实现;扁平结构做不到。
|
|
33
|
+
*
|
|
34
|
+
* 归属规则:取「面积最小的、包住节点中心的容器」(泳道比池小 → 优先落在泳道里)。
|
|
35
|
+
* 子组件坐标是**父容器左上角**为原点,因此嵌套时要做一次坐标换算。
|
|
36
|
+
*/
|
|
37
|
+
createNode(kind: any, props?: any): any;
|
|
38
|
+
/** 把(已经在 ice 根上的)节点嵌进最内层容器 */
|
|
39
|
+
private __nestByGeometry;
|
|
40
|
+
/**
|
|
41
|
+
* 容器的**内容区**(扣掉名称带)。
|
|
42
|
+
*
|
|
43
|
+
* 池的名称带在顶部、泳道在左侧,名称带属于标题区、不该被内部元素压住;
|
|
44
|
+
* 所以归属判定按内容区算,否则泳道会盖住池标题。
|
|
45
|
+
*/
|
|
46
|
+
private __contentBox;
|
|
47
|
+
/** 顺序流的条件/默认标记:按需创建、原位更新(放在工具层,不污染文档) */
|
|
48
|
+
syncFlowMarkers(): void;
|
|
49
|
+
dispose(): void;
|
|
50
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
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 { ICEPath } from '../ice-render/index.mjs';
|
|
9
|
+
/**
|
|
10
|
+
* 事件(圆):开始 / 中间 / 结束 + 触发类型图标。
|
|
11
|
+
*
|
|
12
|
+
* state.eventKind: 'start' | 'intermediate' | 'end'
|
|
13
|
+
* state.trigger: 'none' | 'message' | 'timer' | 'error' | 'terminate'
|
|
14
|
+
*/
|
|
15
|
+
export declare class BpmnEventShape extends ICEPath {
|
|
16
|
+
static readonly typeId = "BpmnEventShape";
|
|
17
|
+
protected createPathObject(): any;
|
|
18
|
+
}
|
|
19
|
+
/** 网关(菱形 + 内部符号):排他 × / 并行 + / 包容 ○ / 事件网关(五边形) */
|
|
20
|
+
export declare class BpmnGatewayShape extends ICEPath {
|
|
21
|
+
static readonly typeId = "BpmnGatewayShape";
|
|
22
|
+
protected createPathObject(): any;
|
|
23
|
+
}
|
|
24
|
+
/** 任务类型角标(左上角小图标,尺寸固定 12×12,由节点定位) */
|
|
25
|
+
export declare class BpmnTaskIcon extends ICEPath {
|
|
26
|
+
static readonly typeId = "BpmnTaskIcon";
|
|
27
|
+
protected createPathObject(): any;
|
|
28
|
+
}
|
|
29
|
+
/** 子流程折叠标记(底部居中的「+」小方块) */
|
|
30
|
+
export declare class BpmnSubprocessMarker extends ICEPath {
|
|
31
|
+
static readonly typeId = "BpmnSubprocessMarker";
|
|
32
|
+
protected createPathObject(): any;
|
|
33
|
+
}
|
|
34
|
+
/** 数据对象:右上角折角矩形 */
|
|
35
|
+
export declare class BpmnDataObjectShape extends ICEPath {
|
|
36
|
+
static readonly typeId = "BpmnDataObjectShape";
|
|
37
|
+
protected createPathObject(): any;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* 文本注释:**完整矩形** + 左侧内嵌的括号竖线(bpmn.io / Camunda 的标准画法)。
|
|
41
|
+
*
|
|
42
|
+
* 曾经画成「左括号 + 上下两条线、右侧开口」—— 那样右侧没有边框,看起来像个残缺的框;
|
|
43
|
+
* BPMN 2.0 的文本注释是闭合矩形,左侧竖线只是括号装饰,四条边都要有。
|
|
44
|
+
*/
|
|
45
|
+
export declare class BpmnAnnotationShape extends ICEPath {
|
|
46
|
+
static readonly typeId = "BpmnAnnotationShape";
|
|
47
|
+
protected createPathObject(): any;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* 泳道 / 池:矩形 + 名称带分隔线。
|
|
51
|
+
* `band` = 'left'(横向泳道,默认)| 'top'(池标题带)
|
|
52
|
+
*/
|
|
53
|
+
export declare class BpmnLaneShape extends ICEPath {
|
|
54
|
+
static readonly typeId = "BpmnLaneShape";
|
|
55
|
+
protected createPathObject(): any;
|
|
56
|
+
}
|
|
57
|
+
/** 顺序流上的条件/默认标记(小菱形 / 斜杠),尺寸固定 14×14 */
|
|
58
|
+
export declare class BpmnFlowMarker extends ICEPath {
|
|
59
|
+
static readonly typeId = "BpmnFlowMarker";
|
|
60
|
+
protected createPathObject(): any;
|
|
61
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
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 { ICEPath } from '../ice-render/index';
|
|
9
|
+
/**
|
|
10
|
+
* 事件(圆):开始 / 中间 / 结束 + 触发类型图标。
|
|
11
|
+
*
|
|
12
|
+
* state.eventKind: 'start' | 'intermediate' | 'end'
|
|
13
|
+
* state.trigger: 'none' | 'message' | 'timer' | 'error' | 'terminate'
|
|
14
|
+
*/
|
|
15
|
+
export declare class BpmnEventShape extends ICEPath {
|
|
16
|
+
static readonly typeId = "BpmnEventShape";
|
|
17
|
+
protected createPathObject(): any;
|
|
18
|
+
}
|
|
19
|
+
/** 网关(菱形 + 内部符号):排他 × / 并行 + / 包容 ○ / 事件网关(五边形) */
|
|
20
|
+
export declare class BpmnGatewayShape extends ICEPath {
|
|
21
|
+
static readonly typeId = "BpmnGatewayShape";
|
|
22
|
+
protected createPathObject(): any;
|
|
23
|
+
}
|
|
24
|
+
/** 任务类型角标(左上角小图标,尺寸固定 12×12,由节点定位) */
|
|
25
|
+
export declare class BpmnTaskIcon extends ICEPath {
|
|
26
|
+
static readonly typeId = "BpmnTaskIcon";
|
|
27
|
+
protected createPathObject(): any;
|
|
28
|
+
}
|
|
29
|
+
/** 子流程折叠标记(底部居中的「+」小方块) */
|
|
30
|
+
export declare class BpmnSubprocessMarker extends ICEPath {
|
|
31
|
+
static readonly typeId = "BpmnSubprocessMarker";
|
|
32
|
+
protected createPathObject(): any;
|
|
33
|
+
}
|
|
34
|
+
/** 数据对象:右上角折角矩形 */
|
|
35
|
+
export declare class BpmnDataObjectShape extends ICEPath {
|
|
36
|
+
static readonly typeId = "BpmnDataObjectShape";
|
|
37
|
+
protected createPathObject(): any;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* 文本注释:**完整矩形** + 左侧内嵌的括号竖线(bpmn.io / Camunda 的标准画法)。
|
|
41
|
+
*
|
|
42
|
+
* 曾经画成「左括号 + 上下两条线、右侧开口」—— 那样右侧没有边框,看起来像个残缺的框;
|
|
43
|
+
* BPMN 2.0 的文本注释是闭合矩形,左侧竖线只是括号装饰,四条边都要有。
|
|
44
|
+
*/
|
|
45
|
+
export declare class BpmnAnnotationShape extends ICEPath {
|
|
46
|
+
static readonly typeId = "BpmnAnnotationShape";
|
|
47
|
+
protected createPathObject(): any;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* 泳道 / 池:矩形 + 名称带分隔线。
|
|
51
|
+
* `band` = 'left'(横向泳道,默认)| 'top'(池标题带)
|
|
52
|
+
*/
|
|
53
|
+
export declare class BpmnLaneShape extends ICEPath {
|
|
54
|
+
static readonly typeId = "BpmnLaneShape";
|
|
55
|
+
protected createPathObject(): any;
|
|
56
|
+
}
|
|
57
|
+
/** 顺序流上的条件/默认标记(小菱形 / 斜杠),尺寸固定 14×14 */
|
|
58
|
+
export declare class BpmnFlowMarker extends ICEPath {
|
|
59
|
+
static readonly typeId = "BpmnFlowMarker";
|
|
60
|
+
protected createPathObject(): any;
|
|
61
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
/**
|
|
9
|
+
* BPMN 2.0 语义校验(记法之外的那一层)。
|
|
10
|
+
*
|
|
11
|
+
* 只做「结构正确性」检查,不涉及具体引擎的扩展属性;返回问题列表供属性面板/工具条展示。
|
|
12
|
+
* 与 ER 侧的 `validateSchema()` 同一形态(`{ level, code, message, componentId }`)。
|
|
13
|
+
*
|
|
14
|
+
* 约定:**容器归属按几何判定**——节点落在哪个池/泳道矩形内就属于它。
|
|
15
|
+
* (真实 BPMN 里泳道是 `<laneSet>` 的显式归属;我们不做重父级,导出 XML 时按几何归类,
|
|
16
|
+
* 这样拖拽体验与文档模型都简单,且不会出现「跨容器拖动导致连线错乱」。)
|
|
17
|
+
*/
|
|
18
|
+
export declare type BpmnIssue = {
|
|
19
|
+
level: 'error' | 'warning';
|
|
20
|
+
code: string;
|
|
21
|
+
message: string;
|
|
22
|
+
componentId?: string;
|
|
23
|
+
};
|
|
24
|
+
export declare function validateBpmn(designer: any): BpmnIssue[];
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
/**
|
|
9
|
+
* BPMN 2.0 语义校验(记法之外的那一层)。
|
|
10
|
+
*
|
|
11
|
+
* 只做「结构正确性」检查,不涉及具体引擎的扩展属性;返回问题列表供属性面板/工具条展示。
|
|
12
|
+
* 与 ER 侧的 `validateSchema()` 同一形态(`{ level, code, message, componentId }`)。
|
|
13
|
+
*
|
|
14
|
+
* 约定:**容器归属按几何判定**——节点落在哪个池/泳道矩形内就属于它。
|
|
15
|
+
* (真实 BPMN 里泳道是 `<laneSet>` 的显式归属;我们不做重父级,导出 XML 时按几何归类,
|
|
16
|
+
* 这样拖拽体验与文档模型都简单,且不会出现「跨容器拖动导致连线错乱」。)
|
|
17
|
+
*/
|
|
18
|
+
export declare type BpmnIssue = {
|
|
19
|
+
level: 'error' | 'warning';
|
|
20
|
+
code: string;
|
|
21
|
+
message: string;
|
|
22
|
+
componentId?: string;
|
|
23
|
+
};
|
|
24
|
+
export declare function validateBpmn(designer: any): BpmnIssue[];
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
/**
|
|
9
|
+
* BPMN 2.0 XML 互操作(`<definitions>` / `<process>` / `<collaboration>` / DI 布局)。
|
|
10
|
+
*
|
|
11
|
+
* 覆盖范围(与我们支持的元素一一对应,够和 Camunda / Flowable / bpmn.io 互通):
|
|
12
|
+
* - 协作:`<collaboration><participant>`(池)、`<laneSet><lane>`(泳道)、`<messageFlow>`
|
|
13
|
+
* - 流程:`<startEvent>` / `<endEvent>` / `<intermediateThrowEvent>`、`<task>`(含
|
|
14
|
+
* `userTask` / `serviceTask` / `scriptTask` / `sendTask` / `receiveTask` / `manualTask`)、
|
|
15
|
+
* `<exclusiveGateway>` / `<parallelGateway>` / `<inclusiveGateway>` / `<eventBasedGateway>`、
|
|
16
|
+
* `<subProcess>`、`<dataObjectReference>`、`<textAnnotation>`
|
|
17
|
+
* - 连线:`<sequenceFlow>`(带 `<conditionExpression>` 与 `default` 属性)、`<messageFlow>`、
|
|
18
|
+
* `<association>`
|
|
19
|
+
* - 图形:`<bpmndi:BPMNDiagram><bpmndi:BPMNPlane>` + `<bpmndi:BPMNShape><dc:Bounds>` /
|
|
20
|
+
* `<bpmndi:BPMNEdge><di:waypoint>`
|
|
21
|
+
*
|
|
22
|
+
* 未识别的元素/属性会被忽略(导入时计入 `warnings`),不会让整份文件打不开 ——
|
|
23
|
+
* 与引擎 `Deserializer` 的容错语义保持一致。
|
|
24
|
+
*/
|
|
25
|
+
import type FlowDesigner from '../flow/FlowDesigner.mjs';
|
|
26
|
+
export declare type BpmnImportResult = {
|
|
27
|
+
nodes: number;
|
|
28
|
+
edges: number;
|
|
29
|
+
warnings: string[];
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* 导出 BPMN 2.0 XML。
|
|
33
|
+
*
|
|
34
|
+
* 容器归属按几何判定:节点落在哪个池矩形内就归到该池的 `<process>`;
|
|
35
|
+
* 池与池之间的连线导出为 `<messageFlow>`(并放进 `<collaboration>`),
|
|
36
|
+
* 池内部的顺序流导出为该 process 的 `<sequenceFlow>`。
|
|
37
|
+
*/
|
|
38
|
+
export declare function toBpmnXml(designer: FlowDesigner, options?: {
|
|
39
|
+
name?: string;
|
|
40
|
+
}): string;
|
|
41
|
+
/**
|
|
42
|
+
* 导入 BPMN 2.0 XML(覆盖范围见文件头注释)。
|
|
43
|
+
*
|
|
44
|
+
* 需要 `DOMParser`(浏览器 / jsdom 提供)。无法识别的元素会被忽略并计入 `warnings`。
|
|
45
|
+
*/
|
|
46
|
+
export declare function fromBpmnXml(xml: string, designer: FlowDesigner): BpmnImportResult;
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
/**
|
|
9
|
+
* BPMN 2.0 XML 互操作(`<definitions>` / `<process>` / `<collaboration>` / DI 布局)。
|
|
10
|
+
*
|
|
11
|
+
* 覆盖范围(与我们支持的元素一一对应,够和 Camunda / Flowable / bpmn.io 互通):
|
|
12
|
+
* - 协作:`<collaboration><participant>`(池)、`<laneSet><lane>`(泳道)、`<messageFlow>`
|
|
13
|
+
* - 流程:`<startEvent>` / `<endEvent>` / `<intermediateThrowEvent>`、`<task>`(含
|
|
14
|
+
* `userTask` / `serviceTask` / `scriptTask` / `sendTask` / `receiveTask` / `manualTask`)、
|
|
15
|
+
* `<exclusiveGateway>` / `<parallelGateway>` / `<inclusiveGateway>` / `<eventBasedGateway>`、
|
|
16
|
+
* `<subProcess>`、`<dataObjectReference>`、`<textAnnotation>`
|
|
17
|
+
* - 连线:`<sequenceFlow>`(带 `<conditionExpression>` 与 `default` 属性)、`<messageFlow>`、
|
|
18
|
+
* `<association>`
|
|
19
|
+
* - 图形:`<bpmndi:BPMNDiagram><bpmndi:BPMNPlane>` + `<bpmndi:BPMNShape><dc:Bounds>` /
|
|
20
|
+
* `<bpmndi:BPMNEdge><di:waypoint>`
|
|
21
|
+
*
|
|
22
|
+
* 未识别的元素/属性会被忽略(导入时计入 `warnings`),不会让整份文件打不开 ——
|
|
23
|
+
* 与引擎 `Deserializer` 的容错语义保持一致。
|
|
24
|
+
*/
|
|
25
|
+
import type FlowDesigner from '../flow/FlowDesigner';
|
|
26
|
+
export declare type BpmnImportResult = {
|
|
27
|
+
nodes: number;
|
|
28
|
+
edges: number;
|
|
29
|
+
warnings: string[];
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* 导出 BPMN 2.0 XML。
|
|
33
|
+
*
|
|
34
|
+
* 容器归属按几何判定:节点落在哪个池矩形内就归到该池的 `<process>`;
|
|
35
|
+
* 池与池之间的连线导出为 `<messageFlow>`(并放进 `<collaboration>`),
|
|
36
|
+
* 池内部的顺序流导出为该 process 的 `<sequenceFlow>`。
|
|
37
|
+
*/
|
|
38
|
+
export declare function toBpmnXml(designer: FlowDesigner, options?: {
|
|
39
|
+
name?: string;
|
|
40
|
+
}): string;
|
|
41
|
+
/**
|
|
42
|
+
* 导入 BPMN 2.0 XML(覆盖范围见文件头注释)。
|
|
43
|
+
*
|
|
44
|
+
* 需要 `DOMParser`(浏览器 / jsdom 提供)。无法识别的元素会被忽略并计入 `warnings`。
|
|
45
|
+
*/
|
|
46
|
+
export declare function fromBpmnXml(xml: string, designer: FlowDesigner): BpmnImportResult;
|
|
@@ -66,7 +66,7 @@ export default class EntityDesigner {
|
|
|
66
66
|
* @returns 载入报告(创建数量、被跳过的未知类型)
|
|
67
67
|
*/
|
|
68
68
|
loadProject(json: string): ProjectLoadReport;
|
|
69
|
-
|
|
69
|
+
/** 节点快照由共享 codec 的字段定义驱动(写与校验同一份定义,见 utils/project_codec.ts) */
|
|
70
70
|
private __entitySnapshot;
|
|
71
71
|
private __slotPoint;
|
|
72
72
|
private __relationSnapshot;
|
|
@@ -66,7 +66,7 @@ export default class EntityDesigner {
|
|
|
66
66
|
* @returns 载入报告(创建数量、被跳过的未知类型)
|
|
67
67
|
*/
|
|
68
68
|
loadProject(json: string): ProjectLoadReport;
|
|
69
|
-
|
|
69
|
+
/** 节点快照由共享 codec 的字段定义驱动(写与校验同一份定义,见 utils/project_codec.ts) */
|
|
70
70
|
private __entitySnapshot;
|
|
71
71
|
private __slotPoint;
|
|
72
72
|
private __relationSnapshot;
|
|
@@ -37,6 +37,11 @@ export default class Entity extends ICEGroup {
|
|
|
37
37
|
* 属性名默认不会被压缩,子类也会继承这个值。
|
|
38
38
|
*/
|
|
39
39
|
static readonly typeId = "Entity";
|
|
40
|
+
/**
|
|
41
|
+
* 表头背景 / 标题 / 分隔线 / 字段文本都是由 entityName、fields、各 style 派生的内部子组件,
|
|
42
|
+
* 构造函数会按 state 重建 → 不参与引擎序列化(避免往返重复挂载)。
|
|
43
|
+
*/
|
|
44
|
+
hasDerivedChildren(): boolean;
|
|
40
45
|
protected entityNameComponent: ICEText;
|
|
41
46
|
protected headerBackgroundComponent: ICERect;
|
|
42
47
|
protected deviderLine: ICEPolyLine;
|
|
@@ -37,6 +37,11 @@ export default class Entity extends ICEGroup {
|
|
|
37
37
|
* 属性名默认不会被压缩,子类也会继承这个值。
|
|
38
38
|
*/
|
|
39
39
|
static readonly typeId = "Entity";
|
|
40
|
+
/**
|
|
41
|
+
* 表头背景 / 标题 / 分隔线 / 字段文本都是由 entityName、fields、各 style 派生的内部子组件,
|
|
42
|
+
* 构造函数会按 state 重建 → 不参与引擎序列化(避免往返重复挂载)。
|
|
43
|
+
*/
|
|
44
|
+
hasDerivedChildren(): boolean;
|
|
40
45
|
protected entityNameComponent: ICEText;
|
|
41
46
|
protected headerBackgroundComponent: ICERect;
|
|
42
47
|
protected deviderLine: ICEPolyLine;
|
|
@@ -21,6 +21,8 @@ export default class Relation extends ICEVisioLink {
|
|
|
21
21
|
* 下游打包会 mangle 类名(实测 webpack 生产构建下 Relation → `Br`),基于类名的判断会静默失效。
|
|
22
22
|
*/
|
|
23
23
|
static readonly typeId = "Relation";
|
|
24
|
+
/** 连线没有子组件;声明派生以保证引擎序列化只持久化自身 state */
|
|
25
|
+
hasDerivedChildren(): boolean;
|
|
24
26
|
constructor(props?: any);
|
|
25
27
|
/**
|
|
26
28
|
* 根据关系类型推断箭头方向,默认指向 FK 所在的一端。
|
|
@@ -21,6 +21,8 @@ export default class Relation extends ICEVisioLink {
|
|
|
21
21
|
* 下游打包会 mangle 类名(实测 webpack 生产构建下 Relation → `Br`),基于类名的判断会静默失效。
|
|
22
22
|
*/
|
|
23
23
|
static readonly typeId = "Relation";
|
|
24
|
+
/** 连线没有子组件;声明派生以保证引擎序列化只持久化自身 state */
|
|
25
|
+
hasDerivedChildren(): boolean;
|
|
24
26
|
constructor(props?: any);
|
|
25
27
|
/**
|
|
26
28
|
* 根据关系类型推断箭头方向,默认指向 FK 所在的一端。
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
+
import type { ICE } from '../ice-render/index.mjs';
|
|
2
|
+
import type { FlowNodeKind } from './FlowNode.mjs';
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
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.
|
|
4
|
+
* 流程图文档。
|
|
6
5
|
*
|
|
6
|
+
* **直接复用引擎的序列化机制**:`scene` 是引擎 `Serializer` 的原生产物
|
|
7
|
+
* (`{ version, childNodes }`,只去掉 createTime/lastModifyTime 这类每次都会变的时间戳)。
|
|
8
|
+
* 于是「组件 state 上的一切」(含应用层自定义 `data`)自动往返,新字段不需要在任何清单里登记,
|
|
9
|
+
* 容错(未注册类型跳过 + unknownTypes)、版本迁移也全部沿用引擎那一套。
|
|
7
10
|
*/
|
|
8
|
-
import type { ICE } from '../ice-render/index.mjs';
|
|
9
|
-
import type { FlowNodeKind } from './FlowNode.mjs';
|
|
10
|
-
import type { FlowEdgeSnapshot } from './FlowEdge.mjs';
|
|
11
|
-
import type { FlowNodeSnapshot } from './FlowNode.mjs';
|
|
12
|
-
/** 流程图快照:只含流程图自身的语义数据,跨版本可读 */
|
|
13
11
|
export declare type FlowSnapshot = {
|
|
14
|
-
version:
|
|
12
|
+
version: 2;
|
|
15
13
|
kind: 'flowchart';
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
scene: {
|
|
15
|
+
/** 引擎的序列化格式版本(SERIALIZATION_VERSION) */
|
|
16
|
+
version: number;
|
|
17
|
+
childNodes: any[];
|
|
18
|
+
};
|
|
18
19
|
};
|
|
19
20
|
/** load() 的载入报告 */
|
|
20
21
|
export declare type FlowLoadReport = {
|
|
@@ -67,6 +68,13 @@ export default class FlowDesigner {
|
|
|
67
68
|
constructor(ice: ICE);
|
|
68
69
|
get nodes(): any[];
|
|
69
70
|
get edges(): any[];
|
|
71
|
+
/**
|
|
72
|
+
* 递归展开场景树(容器型节点 —— 如 BPMN 的池/泳道 —— 里面的子节点同样算流程的一部分)。
|
|
73
|
+
*
|
|
74
|
+
* 扁平场景(纯流程图/ER)与旧行为完全一致;嵌套场景下 nodes/edges 才看得到后代节点,
|
|
75
|
+
* 校验、统计、快照、连线端点查找都因此无需特判。
|
|
76
|
+
*/
|
|
77
|
+
protected __flatten(): any[];
|
|
70
78
|
get selected(): any;
|
|
71
79
|
/**
|
|
72
80
|
* 订阅流程变更(增删改 / 连线 / 载入 / undo / redo 之后触发)。
|
|
@@ -94,13 +102,23 @@ export default class FlowDesigner {
|
|
|
94
102
|
clear(): void;
|
|
95
103
|
serialize(): string;
|
|
96
104
|
toSnapshot(): FlowSnapshot;
|
|
105
|
+
/** 引擎 Serializer / Deserializer:ice 未 init 时 ice.serializer 不存在,这里按需构造(两者无状态) */
|
|
106
|
+
private __serializer;
|
|
107
|
+
private __deserializer;
|
|
97
108
|
/**
|
|
98
|
-
*
|
|
109
|
+
* 载入流程图文档(整体替换当前流程)。
|
|
110
|
+
*
|
|
111
|
+
* 支持两种格式:
|
|
112
|
+
* - **v2(当前)**:`scene` 为引擎序列化产物 → 直接交给引擎 `Deserializer` 重建,
|
|
113
|
+
* 未注册类型会被跳过并记入报告的 `skipped`(沿用引擎的容错语义);
|
|
114
|
+
* - **v1(历史)**:`nodes` / `edges` 数组 → 走兼容读取路径(迁移,不再作为写出格式)。
|
|
99
115
|
*
|
|
100
116
|
* @throws 结构非法时抛错;此时当前流程与历史栈都不会被改动。
|
|
101
117
|
*/
|
|
102
118
|
load(json: string): FlowLoadReport;
|
|
103
|
-
/**
|
|
119
|
+
/** v2:把引擎序列化产物交给引擎 Deserializer 重建(容错、类型分派全部复用引擎实现) */
|
|
120
|
+
private __applyEngineScene;
|
|
121
|
+
/** v1(历史格式)兼容读取:由 nodes / edges 数组重建(迁移路径,不参与写出) */
|
|
104
122
|
private __clearAndBuild;
|
|
105
123
|
/** 把整个流程缩放到画布可视区内 */
|
|
106
124
|
fitViewport(padding?: number): void;
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
+
import type { ICE } from '../ice-render/index';
|
|
2
|
+
import type { FlowNodeKind } from './FlowNode';
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
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.
|
|
4
|
+
* 流程图文档。
|
|
6
5
|
*
|
|
6
|
+
* **直接复用引擎的序列化机制**:`scene` 是引擎 `Serializer` 的原生产物
|
|
7
|
+
* (`{ version, childNodes }`,只去掉 createTime/lastModifyTime 这类每次都会变的时间戳)。
|
|
8
|
+
* 于是「组件 state 上的一切」(含应用层自定义 `data`)自动往返,新字段不需要在任何清单里登记,
|
|
9
|
+
* 容错(未注册类型跳过 + unknownTypes)、版本迁移也全部沿用引擎那一套。
|
|
7
10
|
*/
|
|
8
|
-
import type { ICE } from '../ice-render/index';
|
|
9
|
-
import type { FlowNodeKind } from './FlowNode';
|
|
10
|
-
import type { FlowEdgeSnapshot } from './FlowEdge';
|
|
11
|
-
import type { FlowNodeSnapshot } from './FlowNode';
|
|
12
|
-
/** 流程图快照:只含流程图自身的语义数据,跨版本可读 */
|
|
13
11
|
export declare type FlowSnapshot = {
|
|
14
|
-
version:
|
|
12
|
+
version: 2;
|
|
15
13
|
kind: 'flowchart';
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
scene: {
|
|
15
|
+
/** 引擎的序列化格式版本(SERIALIZATION_VERSION) */
|
|
16
|
+
version: number;
|
|
17
|
+
childNodes: any[];
|
|
18
|
+
};
|
|
18
19
|
};
|
|
19
20
|
/** load() 的载入报告 */
|
|
20
21
|
export declare type FlowLoadReport = {
|
|
@@ -67,6 +68,13 @@ export default class FlowDesigner {
|
|
|
67
68
|
constructor(ice: ICE);
|
|
68
69
|
get nodes(): any[];
|
|
69
70
|
get edges(): any[];
|
|
71
|
+
/**
|
|
72
|
+
* 递归展开场景树(容器型节点 —— 如 BPMN 的池/泳道 —— 里面的子节点同样算流程的一部分)。
|
|
73
|
+
*
|
|
74
|
+
* 扁平场景(纯流程图/ER)与旧行为完全一致;嵌套场景下 nodes/edges 才看得到后代节点,
|
|
75
|
+
* 校验、统计、快照、连线端点查找都因此无需特判。
|
|
76
|
+
*/
|
|
77
|
+
protected __flatten(): any[];
|
|
70
78
|
get selected(): any;
|
|
71
79
|
/**
|
|
72
80
|
* 订阅流程变更(增删改 / 连线 / 载入 / undo / redo 之后触发)。
|
|
@@ -94,13 +102,23 @@ export default class FlowDesigner {
|
|
|
94
102
|
clear(): void;
|
|
95
103
|
serialize(): string;
|
|
96
104
|
toSnapshot(): FlowSnapshot;
|
|
105
|
+
/** 引擎 Serializer / Deserializer:ice 未 init 时 ice.serializer 不存在,这里按需构造(两者无状态) */
|
|
106
|
+
private __serializer;
|
|
107
|
+
private __deserializer;
|
|
97
108
|
/**
|
|
98
|
-
*
|
|
109
|
+
* 载入流程图文档(整体替换当前流程)。
|
|
110
|
+
*
|
|
111
|
+
* 支持两种格式:
|
|
112
|
+
* - **v2(当前)**:`scene` 为引擎序列化产物 → 直接交给引擎 `Deserializer` 重建,
|
|
113
|
+
* 未注册类型会被跳过并记入报告的 `skipped`(沿用引擎的容错语义);
|
|
114
|
+
* - **v1(历史)**:`nodes` / `edges` 数组 → 走兼容读取路径(迁移,不再作为写出格式)。
|
|
99
115
|
*
|
|
100
116
|
* @throws 结构非法时抛错;此时当前流程与历史栈都不会被改动。
|
|
101
117
|
*/
|
|
102
118
|
load(json: string): FlowLoadReport;
|
|
103
|
-
/**
|
|
119
|
+
/** v2:把引擎序列化产物交给引擎 Deserializer 重建(容错、类型分派全部复用引擎实现) */
|
|
120
|
+
private __applyEngineScene;
|
|
121
|
+
/** v1(历史格式)兼容读取:由 nodes / edges 数组重建(迁移路径,不参与写出) */
|
|
104
122
|
private __clearAndBuild;
|
|
105
123
|
/** 把整个流程缩放到画布可视区内 */
|
|
106
124
|
fitViewport(padding?: number): void;
|
|
@@ -8,19 +8,6 @@
|
|
|
8
8
|
import { ICEVisioLink } from '../ice-render/index.mjs';
|
|
9
9
|
/** 连线端点所在的插槽位置(上 / 右 / 下 / 左 / 中心) */
|
|
10
10
|
export declare type FlowPort = 'T' | 'R' | 'B' | 'L' | 'C';
|
|
11
|
-
/** 连线在快照里的纯数据 */
|
|
12
|
-
export declare type FlowEdgeSnapshot = {
|
|
13
|
-
id: string;
|
|
14
|
-
typeId: string;
|
|
15
|
-
sourceId: string | null;
|
|
16
|
-
targetId: string | null;
|
|
17
|
-
sourcePort: FlowPort | null;
|
|
18
|
-
targetPort: FlowPort | null;
|
|
19
|
-
label: string;
|
|
20
|
-
linkShape: string;
|
|
21
|
-
startPoint: number[];
|
|
22
|
-
endPoint: number[];
|
|
23
|
-
};
|
|
24
11
|
/**
|
|
25
12
|
* @class FlowEdge 流程图连线
|
|
26
13
|
*
|
|
@@ -29,7 +16,15 @@ export declare type FlowEdgeSnapshot = {
|
|
|
29
16
|
*/
|
|
30
17
|
export default class FlowEdge extends ICEVisioLink {
|
|
31
18
|
static readonly typeId = "FlowEdge";
|
|
19
|
+
/** 连线没有子组件;声明派生可保证将来即使加了内部装饰也不会被重复序列化 */
|
|
20
|
+
hasDerivedChildren(): boolean;
|
|
32
21
|
constructor(props?: any);
|
|
33
|
-
/**
|
|
34
|
-
|
|
22
|
+
/**
|
|
23
|
+
* 改连线属性,并按 BPMN 语义重算派生样式(线型 / 虚线 / 箭头)。
|
|
24
|
+
*
|
|
25
|
+
* - sequence:实线 + 实心箭头
|
|
26
|
+
* - message:虚线 + 空心箭头(跨参与者通信)
|
|
27
|
+
* - association:点线 + 无箭头
|
|
28
|
+
*/
|
|
29
|
+
applyPatch(patch?: Record<string, any>): this;
|
|
35
30
|
}
|
|
@@ -8,19 +8,6 @@
|
|
|
8
8
|
import { ICEVisioLink } from '../ice-render/index';
|
|
9
9
|
/** 连线端点所在的插槽位置(上 / 右 / 下 / 左 / 中心) */
|
|
10
10
|
export declare type FlowPort = 'T' | 'R' | 'B' | 'L' | 'C';
|
|
11
|
-
/** 连线在快照里的纯数据 */
|
|
12
|
-
export declare type FlowEdgeSnapshot = {
|
|
13
|
-
id: string;
|
|
14
|
-
typeId: string;
|
|
15
|
-
sourceId: string | null;
|
|
16
|
-
targetId: string | null;
|
|
17
|
-
sourcePort: FlowPort | null;
|
|
18
|
-
targetPort: FlowPort | null;
|
|
19
|
-
label: string;
|
|
20
|
-
linkShape: string;
|
|
21
|
-
startPoint: number[];
|
|
22
|
-
endPoint: number[];
|
|
23
|
-
};
|
|
24
11
|
/**
|
|
25
12
|
* @class FlowEdge 流程图连线
|
|
26
13
|
*
|
|
@@ -29,7 +16,15 @@ export declare type FlowEdgeSnapshot = {
|
|
|
29
16
|
*/
|
|
30
17
|
export default class FlowEdge extends ICEVisioLink {
|
|
31
18
|
static readonly typeId = "FlowEdge";
|
|
19
|
+
/** 连线没有子组件;声明派生可保证将来即使加了内部装饰也不会被重复序列化 */
|
|
20
|
+
hasDerivedChildren(): boolean;
|
|
32
21
|
constructor(props?: any);
|
|
33
|
-
/**
|
|
34
|
-
|
|
22
|
+
/**
|
|
23
|
+
* 改连线属性,并按 BPMN 语义重算派生样式(线型 / 虚线 / 箭头)。
|
|
24
|
+
*
|
|
25
|
+
* - sequence:实线 + 实心箭头
|
|
26
|
+
* - message:虚线 + 空心箭头(跨参与者通信)
|
|
27
|
+
* - association:点线 + 无箭头
|
|
28
|
+
*/
|
|
29
|
+
applyPatch(patch?: Record<string, any>): this;
|
|
35
30
|
}
|