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
|
@@ -6,8 +6,18 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
import { ICEGroup } from '../ice-render/index.mjs';
|
|
9
|
-
/**
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* 节点类型词汇表。
|
|
11
|
+
*
|
|
12
|
+
* - 流程图:`terminator` / `process` / `decision` / `io`
|
|
13
|
+
* - BPMN 2.0:`bpmnEvent` / `bpmnTask` / `bpmnGateway` / `bpmnSubprocess` /
|
|
14
|
+
* `bpmnDataObject` / `bpmnAnnotation` / `bpmnPool` / `bpmnLane`
|
|
15
|
+
*
|
|
16
|
+
* BPMN 复用同一套节点/连线/历史/快照机制(都是 `FlowNode`),语义差异由 `kind`
|
|
17
|
+
* 与 BPMN 专属属性(eventKind / trigger / gatewayType / taskType / band)承载,
|
|
18
|
+
* 因此文档、React 绑定、DSL 都不需要第二套实现。
|
|
19
|
+
*/
|
|
20
|
+
export declare type FlowNodeKind = 'terminator' | 'process' | 'decision' | 'io' | 'bpmnEvent' | 'bpmnTask' | 'bpmnGateway' | 'bpmnSubprocess' | 'bpmnDataObject' | 'bpmnAnnotation' | 'bpmnPool' | 'bpmnLane';
|
|
11
21
|
export declare type FlowNodePreset = {
|
|
12
22
|
label: string;
|
|
13
23
|
width: number;
|
|
@@ -15,23 +25,28 @@ export declare type FlowNodePreset = {
|
|
|
15
25
|
fill: string;
|
|
16
26
|
stroke: string;
|
|
17
27
|
radius?: number;
|
|
18
|
-
shape: 'rect' | 'diamond' | 'parallelogram';
|
|
28
|
+
shape: 'rect' | 'diamond' | 'parallelogram' | 'event' | 'gateway' | 'dataObject' | 'annotation' | 'lane';
|
|
29
|
+
/** 外框线宽(BPMN 结束事件用粗圈) */
|
|
30
|
+
lineWidth?: number;
|
|
31
|
+
/** 虚线(注释框) */
|
|
32
|
+
lineDash?: number[];
|
|
33
|
+
/** 名称带:泳道在左、池在顶 */
|
|
34
|
+
band?: 'left' | 'top';
|
|
35
|
+
bandSize?: number;
|
|
36
|
+
/** 标题摆放:居中(图元)或左上(池/泳道/注释) */
|
|
37
|
+
labelPlacement?: 'center' | 'top-left';
|
|
38
|
+
/** 背景透明(泳道用:相邻泳道共享边界时,填充会盖住邻居的边框) */
|
|
39
|
+
transparent?: boolean;
|
|
40
|
+
/** 默认的任务类型角标(bpmnTask 用) */
|
|
41
|
+
taskType?: string;
|
|
42
|
+
/** 默认事件种类 / 触发(bpmnEvent 用) */
|
|
43
|
+
eventKind?: string;
|
|
44
|
+
trigger?: string;
|
|
45
|
+
/** 默认网关类型(bpmnGateway 用) */
|
|
46
|
+
gatewayType?: string;
|
|
19
47
|
};
|
|
20
48
|
/** 各类型节点的默认尺寸与配色(同时作为属性面板的预设) */
|
|
21
49
|
export declare const FLOW_NODE_KINDS: Record<FlowNodeKind, FlowNodePreset>;
|
|
22
|
-
/** 流程图节点在快照里的纯数据(不含引擎内部状态) */
|
|
23
|
-
export declare type FlowNodeSnapshot = {
|
|
24
|
-
id: string;
|
|
25
|
-
typeId: string;
|
|
26
|
-
kind: FlowNodeKind;
|
|
27
|
-
title: string;
|
|
28
|
-
left: number;
|
|
29
|
-
top: number;
|
|
30
|
-
width: number;
|
|
31
|
-
height: number;
|
|
32
|
-
fillColor: string;
|
|
33
|
-
strokeColor: string;
|
|
34
|
-
};
|
|
35
50
|
/**
|
|
36
51
|
* @class FlowNode 流程图节点
|
|
37
52
|
*
|
|
@@ -44,11 +59,23 @@ export default class FlowNode extends ICEGroup {
|
|
|
44
59
|
static readonly typeId = "FlowNode";
|
|
45
60
|
protected shapeComponent: any;
|
|
46
61
|
protected labelComponent: any;
|
|
62
|
+
/** BPMN 装饰件(任务角标 / 子流程标记),随形状一起重建 */
|
|
63
|
+
protected decorationComponents: any[];
|
|
64
|
+
/**
|
|
65
|
+
* 内部子组件(形状 + 标题)由 kind/尺寸/配色派生,构造函数会重建 →
|
|
66
|
+
* 不参与引擎序列化(否则往返会重复挂载,且子组件 zIndex 抖动,见 ICEComponent.hasDerivedChildren)。
|
|
67
|
+
*/
|
|
68
|
+
hasDerivedChildren(): boolean;
|
|
47
69
|
constructor(props?: any);
|
|
48
70
|
/** 按当前 kind / 尺寸 / 配色重建形状与标题(切换类型或改样式时调用) */
|
|
49
71
|
private __buildShape;
|
|
72
|
+
/**
|
|
73
|
+
* BPMN 装饰件(任务类型角标、子流程折叠标记)。
|
|
74
|
+
*
|
|
75
|
+
* 它们与形状/标题一样由节点 state 派生,因此不需要单独序列化
|
|
76
|
+
* (见 hasDerivedChildren:整个内部子树都是派生的)。
|
|
77
|
+
*/
|
|
78
|
+
private __buildDecorations;
|
|
50
79
|
/** 改节点属性(标题 / 类型 / 配色 / 尺寸),必要时重建形状 */
|
|
51
80
|
applyPatch(patch?: Record<string, any>): this;
|
|
52
|
-
/** 流程快照用的纯数据 */
|
|
53
|
-
toFlowObject(): FlowNodeSnapshot;
|
|
54
81
|
}
|
|
@@ -6,8 +6,18 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
import { ICEGroup } from '../ice-render/index';
|
|
9
|
-
/**
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* 节点类型词汇表。
|
|
11
|
+
*
|
|
12
|
+
* - 流程图:`terminator` / `process` / `decision` / `io`
|
|
13
|
+
* - BPMN 2.0:`bpmnEvent` / `bpmnTask` / `bpmnGateway` / `bpmnSubprocess` /
|
|
14
|
+
* `bpmnDataObject` / `bpmnAnnotation` / `bpmnPool` / `bpmnLane`
|
|
15
|
+
*
|
|
16
|
+
* BPMN 复用同一套节点/连线/历史/快照机制(都是 `FlowNode`),语义差异由 `kind`
|
|
17
|
+
* 与 BPMN 专属属性(eventKind / trigger / gatewayType / taskType / band)承载,
|
|
18
|
+
* 因此文档、React 绑定、DSL 都不需要第二套实现。
|
|
19
|
+
*/
|
|
20
|
+
export declare type FlowNodeKind = 'terminator' | 'process' | 'decision' | 'io' | 'bpmnEvent' | 'bpmnTask' | 'bpmnGateway' | 'bpmnSubprocess' | 'bpmnDataObject' | 'bpmnAnnotation' | 'bpmnPool' | 'bpmnLane';
|
|
11
21
|
export declare type FlowNodePreset = {
|
|
12
22
|
label: string;
|
|
13
23
|
width: number;
|
|
@@ -15,23 +25,28 @@ export declare type FlowNodePreset = {
|
|
|
15
25
|
fill: string;
|
|
16
26
|
stroke: string;
|
|
17
27
|
radius?: number;
|
|
18
|
-
shape: 'rect' | 'diamond' | 'parallelogram';
|
|
28
|
+
shape: 'rect' | 'diamond' | 'parallelogram' | 'event' | 'gateway' | 'dataObject' | 'annotation' | 'lane';
|
|
29
|
+
/** 外框线宽(BPMN 结束事件用粗圈) */
|
|
30
|
+
lineWidth?: number;
|
|
31
|
+
/** 虚线(注释框) */
|
|
32
|
+
lineDash?: number[];
|
|
33
|
+
/** 名称带:泳道在左、池在顶 */
|
|
34
|
+
band?: 'left' | 'top';
|
|
35
|
+
bandSize?: number;
|
|
36
|
+
/** 标题摆放:居中(图元)或左上(池/泳道/注释) */
|
|
37
|
+
labelPlacement?: 'center' | 'top-left';
|
|
38
|
+
/** 背景透明(泳道用:相邻泳道共享边界时,填充会盖住邻居的边框) */
|
|
39
|
+
transparent?: boolean;
|
|
40
|
+
/** 默认的任务类型角标(bpmnTask 用) */
|
|
41
|
+
taskType?: string;
|
|
42
|
+
/** 默认事件种类 / 触发(bpmnEvent 用) */
|
|
43
|
+
eventKind?: string;
|
|
44
|
+
trigger?: string;
|
|
45
|
+
/** 默认网关类型(bpmnGateway 用) */
|
|
46
|
+
gatewayType?: string;
|
|
19
47
|
};
|
|
20
48
|
/** 各类型节点的默认尺寸与配色(同时作为属性面板的预设) */
|
|
21
49
|
export declare const FLOW_NODE_KINDS: Record<FlowNodeKind, FlowNodePreset>;
|
|
22
|
-
/** 流程图节点在快照里的纯数据(不含引擎内部状态) */
|
|
23
|
-
export declare type FlowNodeSnapshot = {
|
|
24
|
-
id: string;
|
|
25
|
-
typeId: string;
|
|
26
|
-
kind: FlowNodeKind;
|
|
27
|
-
title: string;
|
|
28
|
-
left: number;
|
|
29
|
-
top: number;
|
|
30
|
-
width: number;
|
|
31
|
-
height: number;
|
|
32
|
-
fillColor: string;
|
|
33
|
-
strokeColor: string;
|
|
34
|
-
};
|
|
35
50
|
/**
|
|
36
51
|
* @class FlowNode 流程图节点
|
|
37
52
|
*
|
|
@@ -44,11 +59,23 @@ export default class FlowNode extends ICEGroup {
|
|
|
44
59
|
static readonly typeId = "FlowNode";
|
|
45
60
|
protected shapeComponent: any;
|
|
46
61
|
protected labelComponent: any;
|
|
62
|
+
/** BPMN 装饰件(任务角标 / 子流程标记),随形状一起重建 */
|
|
63
|
+
protected decorationComponents: any[];
|
|
64
|
+
/**
|
|
65
|
+
* 内部子组件(形状 + 标题)由 kind/尺寸/配色派生,构造函数会重建 →
|
|
66
|
+
* 不参与引擎序列化(否则往返会重复挂载,且子组件 zIndex 抖动,见 ICEComponent.hasDerivedChildren)。
|
|
67
|
+
*/
|
|
68
|
+
hasDerivedChildren(): boolean;
|
|
47
69
|
constructor(props?: any);
|
|
48
70
|
/** 按当前 kind / 尺寸 / 配色重建形状与标题(切换类型或改样式时调用) */
|
|
49
71
|
private __buildShape;
|
|
72
|
+
/**
|
|
73
|
+
* BPMN 装饰件(任务类型角标、子流程折叠标记)。
|
|
74
|
+
*
|
|
75
|
+
* 它们与形状/标题一样由节点 state 派生,因此不需要单独序列化
|
|
76
|
+
* (见 hasDerivedChildren:整个内部子树都是派生的)。
|
|
77
|
+
*/
|
|
78
|
+
private __buildDecorations;
|
|
50
79
|
/** 改节点属性(标题 / 类型 / 配色 / 尺寸),必要时重建形状 */
|
|
51
80
|
applyPatch(patch?: Record<string, any>): this;
|
|
52
|
-
/** 流程快照用的纯数据 */
|
|
53
|
-
toFlowObject(): FlowNodeSnapshot;
|
|
54
81
|
}
|
|
@@ -10,14 +10,6 @@ import EventBus from '../event/EventBus.mjs';
|
|
|
10
10
|
import ICEEventTarget from '../event/ICEEventTarget.mjs';
|
|
11
11
|
import ICEBoundingBox from '../geometry/ICEBoundingBox.mjs';
|
|
12
12
|
import ICE from '../ICE.mjs';
|
|
13
|
-
/**
|
|
14
|
-
* @class ICEComponent
|
|
15
|
-
*
|
|
16
|
-
* 最顶级的抽象类,Canvas 内部所有可见的组件都是它的子类。
|
|
17
|
-
*
|
|
18
|
-
* @abstract
|
|
19
|
-
* @author 大漠穷秋<damoqiongqiu@126.com>
|
|
20
|
-
*/
|
|
21
13
|
declare abstract class ICEComponent extends ICEEventTarget {
|
|
22
14
|
ice: ICE;
|
|
23
15
|
root: any;
|
|
@@ -337,6 +329,18 @@ declare abstract class ICEComponent extends ICEEventTarget {
|
|
|
337
329
|
protected doRender(): void;
|
|
338
330
|
/** 判断两个边界盒是否在视觉上重合(用于避免重复绘制几乎相同的 min/max 框)。 */
|
|
339
331
|
private __areBoundingBoxesNearlyEqual;
|
|
332
|
+
/**
|
|
333
|
+
* 内部子组件是否为「由自身 state 派生」的。
|
|
334
|
+
*
|
|
335
|
+
* 复合组件(构造时按 state 建立内部子组件的组件,如「卡片 = 底框 + 标题」)应当返回 true:
|
|
336
|
+
* 这些子组件在反序列化时会被构造函数重建,序列化它们只会造成**重复挂载**
|
|
337
|
+
* (先由构造函数建一份、再由 Deserializer 挂一份)、并且子组件的自动 zIndex 每次都会变,
|
|
338
|
+
* 让同一份数据的两次序列化结果不稳定。返回 true 后,Serializer / Deserializer 都会跳过
|
|
339
|
+
* 该组件的 childNodes —— 只持久化它自己的 state(真相源),子组件视为派生结果。
|
|
340
|
+
*
|
|
341
|
+
* 默认为 false(普通容器/叶子组件的子节点是「真数据」,必须序列化)。
|
|
342
|
+
*/
|
|
343
|
+
hasDerivedChildren(): boolean;
|
|
340
344
|
/**
|
|
341
345
|
* 获取组件的最小包围盒,此盒子的变换矩阵与组件自身完全相同。
|
|
342
346
|
* 此方法需要在 render() 之后调用,组件没有渲染时无法计算最小包围盒。
|
|
@@ -10,14 +10,6 @@ import EventBus from '../event/EventBus';
|
|
|
10
10
|
import ICEEventTarget from '../event/ICEEventTarget';
|
|
11
11
|
import ICEBoundingBox from '../geometry/ICEBoundingBox';
|
|
12
12
|
import ICE from '../ICE';
|
|
13
|
-
/**
|
|
14
|
-
* @class ICEComponent
|
|
15
|
-
*
|
|
16
|
-
* 最顶级的抽象类,Canvas 内部所有可见的组件都是它的子类。
|
|
17
|
-
*
|
|
18
|
-
* @abstract
|
|
19
|
-
* @author 大漠穷秋<damoqiongqiu@126.com>
|
|
20
|
-
*/
|
|
21
13
|
declare abstract class ICEComponent extends ICEEventTarget {
|
|
22
14
|
ice: ICE;
|
|
23
15
|
root: any;
|
|
@@ -337,6 +329,18 @@ declare abstract class ICEComponent extends ICEEventTarget {
|
|
|
337
329
|
protected doRender(): void;
|
|
338
330
|
/** 判断两个边界盒是否在视觉上重合(用于避免重复绘制几乎相同的 min/max 框)。 */
|
|
339
331
|
private __areBoundingBoxesNearlyEqual;
|
|
332
|
+
/**
|
|
333
|
+
* 内部子组件是否为「由自身 state 派生」的。
|
|
334
|
+
*
|
|
335
|
+
* 复合组件(构造时按 state 建立内部子组件的组件,如「卡片 = 底框 + 标题」)应当返回 true:
|
|
336
|
+
* 这些子组件在反序列化时会被构造函数重建,序列化它们只会造成**重复挂载**
|
|
337
|
+
* (先由构造函数建一份、再由 Deserializer 挂一份)、并且子组件的自动 zIndex 每次都会变,
|
|
338
|
+
* 让同一份数据的两次序列化结果不稳定。返回 true 后,Serializer / Deserializer 都会跳过
|
|
339
|
+
* 该组件的 childNodes —— 只持久化它自己的 state(真相源),子组件视为派生结果。
|
|
340
|
+
*
|
|
341
|
+
* 默认为 false(普通容器/叶子组件的子节点是「真数据」,必须序列化)。
|
|
342
|
+
*/
|
|
343
|
+
hasDerivedChildren(): boolean;
|
|
340
344
|
/**
|
|
341
345
|
* 获取组件的最小包围盒,此盒子的变换矩阵与组件自身完全相同。
|
|
342
346
|
* 此方法需要在 render() 之后调用,组件没有渲染时无法计算最小包围盒。
|
|
@@ -79,6 +79,16 @@ declare class ICEGroup extends ICERect {
|
|
|
79
79
|
*/
|
|
80
80
|
addChild(child: ICEComponent, markDirty?: boolean): void;
|
|
81
81
|
addChildren(arr: Array<ICEComponent>): void;
|
|
82
|
+
/**
|
|
83
|
+
* 把某个组件迁移到本容器下(**不销毁**它)。
|
|
84
|
+
*
|
|
85
|
+
* 为什么需要单独的 API:`removeChild()` 末尾会调用 `child.destory()`(清事件、清子节点),
|
|
86
|
+
* 所以「先 removeChild 再 addChild」式的重父级会把组件连同内部子树一起毁掉
|
|
87
|
+
* (BPMN 池/泳道里嵌节点时就踩到这个坑:标题、角标全没了)。
|
|
88
|
+
* 本方法只从旧父级的 childNodes / 去重集合里摘除,再挂到本容器,组件本体与子树保持完好。
|
|
89
|
+
* **坐标不换算**:调用方若要保持世界位置,请自行换算 left/top。
|
|
90
|
+
*/
|
|
91
|
+
adoptChild(child: ICEComponent, markDirty?: boolean): void;
|
|
82
92
|
removeChild(child: ICEComponent, markDirty?: boolean): void;
|
|
83
93
|
removeChildren(arr: Array<ICEComponent>): void;
|
|
84
94
|
/**
|
|
@@ -79,6 +79,16 @@ declare class ICEGroup extends ICERect {
|
|
|
79
79
|
*/
|
|
80
80
|
addChild(child: ICEComponent, markDirty?: boolean): void;
|
|
81
81
|
addChildren(arr: Array<ICEComponent>): void;
|
|
82
|
+
/**
|
|
83
|
+
* 把某个组件迁移到本容器下(**不销毁**它)。
|
|
84
|
+
*
|
|
85
|
+
* 为什么需要单独的 API:`removeChild()` 末尾会调用 `child.destory()`(清事件、清子节点),
|
|
86
|
+
* 所以「先 removeChild 再 addChild」式的重父级会把组件连同内部子树一起毁掉
|
|
87
|
+
* (BPMN 池/泳道里嵌节点时就踩到这个坑:标题、角标全没了)。
|
|
88
|
+
* 本方法只从旧父级的 childNodes / 去重集合里摘除,再挂到本容器,组件本体与子树保持完好。
|
|
89
|
+
* **坐标不换算**:调用方若要保持世界位置,请自行换算 left/top。
|
|
90
|
+
*/
|
|
91
|
+
adoptChild(child: ICEComponent, markDirty?: boolean): void;
|
|
82
92
|
removeChild(child: ICEComponent, markDirty?: boolean): void;
|
|
83
93
|
removeChildren(arr: Array<ICEComponent>): void;
|
|
84
94
|
/**
|
|
@@ -51,5 +51,7 @@ export { default as ICE } from './ICE.mjs';
|
|
|
51
51
|
export { default as CanvasRenderer } from './renderer/CanvasRenderer.mjs';
|
|
52
52
|
export { default as PluginHost } from './plugin/PluginHost.mjs';
|
|
53
53
|
export type { ICEPlugin, ICEPluginTool, ICERenderHook, ICERenderFrame } from './plugin/PluginHost.mjs';
|
|
54
|
+
export { default as Serializer, SERIALIZATION_VERSION } from './persistence/Serializer.mjs';
|
|
55
|
+
export { default as Deserializer, SERIALIZATION_MIGRATIONS } from './persistence/Deserializer.mjs';
|
|
54
56
|
export { buildAccessibilityTree } from './a11y/accessibility.mjs';
|
|
55
57
|
export type { ICEAccessibleNode, ICEAccessibleRole, ICEAccessibilityOptions } from './a11y/accessibility.mjs';
|
|
@@ -51,5 +51,7 @@ export { default as ICE } from './ICE';
|
|
|
51
51
|
export { default as CanvasRenderer } from './renderer/CanvasRenderer';
|
|
52
52
|
export { default as PluginHost } from './plugin/PluginHost';
|
|
53
53
|
export type { ICEPlugin, ICEPluginTool, ICERenderHook, ICERenderFrame } from './plugin/PluginHost';
|
|
54
|
+
export { default as Serializer, SERIALIZATION_VERSION } from './persistence/Serializer';
|
|
55
|
+
export { default as Deserializer, SERIALIZATION_MIGRATIONS } from './persistence/Deserializer';
|
|
54
56
|
export { buildAccessibilityTree } from './a11y/accessibility';
|
|
55
57
|
export type { ICEAccessibleNode, ICEAccessibleRole, ICEAccessibilityOptions } from './a11y/accessibility';
|
package/dist/types/index.d.mts
CHANGED
|
@@ -14,12 +14,17 @@ export { toSchemaObject, toSchemaString } from './utils/serialization_util.mjs';
|
|
|
14
14
|
export { validateSchema } from './utils/schema_validator.mjs';
|
|
15
15
|
export { PROJECT_SCHEMA_VERSION, validateProjectSnapshot } from './utils/project_schema.mjs';
|
|
16
16
|
export { default as FlowNode, FLOW_NODE_KINDS } from './flow/FlowNode.mjs';
|
|
17
|
-
export type { FlowNodeKind, FlowNodePreset
|
|
17
|
+
export type { FlowNodeKind, FlowNodePreset } from './flow/FlowNode.mjs';
|
|
18
18
|
export { default as FlowEdge } from './flow/FlowEdge.mjs';
|
|
19
|
-
export type { FlowPort
|
|
19
|
+
export type { FlowPort } from './flow/FlowEdge.mjs';
|
|
20
20
|
export { default as FlowDesigner, validateFlowSnapshot } from './flow/FlowDesigner.mjs';
|
|
21
21
|
export type { FlowSnapshot, FlowLoadReport, FlowSnapshotValidationResult } from './flow/FlowDesigner.mjs';
|
|
22
22
|
export { FlowDiamond, FlowParallelogram } from './flow/flow_shapes.mjs';
|
|
23
|
+
export { default as BpmnDesigner } from './bpmn/BpmnDesigner.mjs';
|
|
24
|
+
export { validateBpmn } from './bpmn/bpmn_validate.mjs';
|
|
25
|
+
export type { BpmnIssue } from './bpmn/bpmn_validate.mjs';
|
|
26
|
+
export { toBpmnXml, fromBpmnXml } from './bpmn/bpmn_xml.mjs';
|
|
27
|
+
export type { BpmnImportResult } from './bpmn/bpmn_xml.mjs';
|
|
23
28
|
/**
|
|
24
29
|
* 引擎内核(ice-render)在构建时已被打包进本包,这里一并导出。
|
|
25
30
|
*
|
package/dist/types/index.d.ts
CHANGED
|
@@ -14,12 +14,17 @@ export { toSchemaObject, toSchemaString } from './utils/serialization_util';
|
|
|
14
14
|
export { validateSchema } from './utils/schema_validator';
|
|
15
15
|
export { PROJECT_SCHEMA_VERSION, validateProjectSnapshot } from './utils/project_schema';
|
|
16
16
|
export { default as FlowNode, FLOW_NODE_KINDS } from './flow/FlowNode';
|
|
17
|
-
export type { FlowNodeKind, FlowNodePreset
|
|
17
|
+
export type { FlowNodeKind, FlowNodePreset } from './flow/FlowNode';
|
|
18
18
|
export { default as FlowEdge } from './flow/FlowEdge';
|
|
19
|
-
export type { FlowPort
|
|
19
|
+
export type { FlowPort } from './flow/FlowEdge';
|
|
20
20
|
export { default as FlowDesigner, validateFlowSnapshot } from './flow/FlowDesigner';
|
|
21
21
|
export type { FlowSnapshot, FlowLoadReport, FlowSnapshotValidationResult } from './flow/FlowDesigner';
|
|
22
22
|
export { FlowDiamond, FlowParallelogram } from './flow/flow_shapes';
|
|
23
|
+
export { default as BpmnDesigner } from './bpmn/BpmnDesigner';
|
|
24
|
+
export { validateBpmn } from './bpmn/bpmn_validate';
|
|
25
|
+
export type { BpmnIssue } from './bpmn/bpmn_validate';
|
|
26
|
+
export { toBpmnXml, fromBpmnXml } from './bpmn/bpmn_xml';
|
|
27
|
+
export type { BpmnImportResult } from './bpmn/bpmn_xml';
|
|
23
28
|
/**
|
|
24
29
|
* 引擎内核(ice-render)在构建时已被打包进本包,这里一并导出。
|
|
25
30
|
*
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { FlowDesignerCanvasProps } from './types.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* <FlowDesignerCanvas> —— 在 React 中承载流程图编辑器的画布组件。
|
|
4
|
+
*
|
|
5
|
+
* 与 <EntityDesignerCanvas> 同构:挂载创建 ICE + FlowDesigner 会话、卸载销毁;
|
|
6
|
+
* 支持受控 value / 非受控 defaultValue、onChange(含画布拖拽节点)、onError 与命令式 ref。
|
|
7
|
+
*
|
|
8
|
+
* ```tsx
|
|
9
|
+
* const ref = useRef<FlowDesignerHandle>(null);
|
|
10
|
+
* <FlowDesignerCanvas ref={ref} defaultValue={flowJson} onChange={({ snapshot }) => save(snapshot)} />
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
declare const FlowDesignerCanvas: import("react").ForwardRefExoticComponent<FlowDesignerCanvasProps & import("react").RefAttributes<any>>;
|
|
14
|
+
export default FlowDesignerCanvas;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { FlowDesignerCanvasProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* <FlowDesignerCanvas> —— 在 React 中承载流程图编辑器的画布组件。
|
|
4
|
+
*
|
|
5
|
+
* 与 <EntityDesignerCanvas> 同构:挂载创建 ICE + FlowDesigner 会话、卸载销毁;
|
|
6
|
+
* 支持受控 value / 非受控 defaultValue、onChange(含画布拖拽节点)、onError 与命令式 ref。
|
|
7
|
+
*
|
|
8
|
+
* ```tsx
|
|
9
|
+
* const ref = useRef<FlowDesignerHandle>(null);
|
|
10
|
+
* <FlowDesignerCanvas ref={ref} defaultValue={flowJson} onChange={({ snapshot }) => save(snapshot)} />
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
declare const FlowDesignerCanvas: import("react").ForwardRefExoticComponent<FlowDesignerCanvasProps & import("react").RefAttributes<any>>;
|
|
14
|
+
export default FlowDesignerCanvas;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EntityDesigner } from '../index.mjs';
|
|
1
|
+
import type { EntityDesigner, FlowDesigner } from '../index.mjs';
|
|
2
2
|
/**
|
|
3
3
|
* React 绑定层上下文:承载当前画布对应的 EntityDesigner 实例。
|
|
4
4
|
* 由 <EntityDesignerCanvas>(或 <EntityDesignerProvider>)提供,供子树内的 useEntityDesigner() 读取。
|
|
@@ -23,3 +23,20 @@ export declare function EntityDesignerProvider(props: EntityDesignerProviderProp
|
|
|
23
23
|
* 只能在 <EntityDesignerCanvas> / <EntityDesignerProvider> 的子树中使用;未就绪或不在树中时返回 null。
|
|
24
24
|
*/
|
|
25
25
|
export declare function useEntityDesigner(): EntityDesigner | null;
|
|
26
|
+
/**
|
|
27
|
+
* 流程图上下文:承载当前画布对应的 FlowDesigner 实例。
|
|
28
|
+
* 由 <FlowDesignerCanvas>(或 <FlowDesignerProvider>)提供,供子树内的 useFlowDesigner() 读取。
|
|
29
|
+
*/
|
|
30
|
+
export declare const FlowDesignerContext: import("react").Context<FlowDesigner>;
|
|
31
|
+
export declare type FlowDesignerProviderProps = {
|
|
32
|
+
/** 要共享的 FlowDesigner 实例(通常来自 createFlowSession) */
|
|
33
|
+
designer: FlowDesigner | null;
|
|
34
|
+
children?: any;
|
|
35
|
+
};
|
|
36
|
+
/** 手动提供流程图上下文。适用于「自己创建会话」的场景。 */
|
|
37
|
+
export declare function FlowDesignerProvider(props: FlowDesignerProviderProps): import("react").FunctionComponentElement<import("react").ProviderProps<FlowDesigner>>;
|
|
38
|
+
/**
|
|
39
|
+
* 读取当前画布的 FlowDesigner 实例。
|
|
40
|
+
* 只能在 <FlowDesignerCanvas> / <FlowDesignerProvider> 的子树中使用;未就绪或不在树中时返回 null。
|
|
41
|
+
*/
|
|
42
|
+
export declare function useFlowDesigner(): FlowDesigner | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EntityDesigner } from '../index';
|
|
1
|
+
import type { EntityDesigner, FlowDesigner } from '../index';
|
|
2
2
|
/**
|
|
3
3
|
* React 绑定层上下文:承载当前画布对应的 EntityDesigner 实例。
|
|
4
4
|
* 由 <EntityDesignerCanvas>(或 <EntityDesignerProvider>)提供,供子树内的 useEntityDesigner() 读取。
|
|
@@ -23,3 +23,20 @@ export declare function EntityDesignerProvider(props: EntityDesignerProviderProp
|
|
|
23
23
|
* 只能在 <EntityDesignerCanvas> / <EntityDesignerProvider> 的子树中使用;未就绪或不在树中时返回 null。
|
|
24
24
|
*/
|
|
25
25
|
export declare function useEntityDesigner(): EntityDesigner | null;
|
|
26
|
+
/**
|
|
27
|
+
* 流程图上下文:承载当前画布对应的 FlowDesigner 实例。
|
|
28
|
+
* 由 <FlowDesignerCanvas>(或 <FlowDesignerProvider>)提供,供子树内的 useFlowDesigner() 读取。
|
|
29
|
+
*/
|
|
30
|
+
export declare const FlowDesignerContext: import("react").Context<FlowDesigner>;
|
|
31
|
+
export declare type FlowDesignerProviderProps = {
|
|
32
|
+
/** 要共享的 FlowDesigner 实例(通常来自 createFlowSession) */
|
|
33
|
+
designer: FlowDesigner | null;
|
|
34
|
+
children?: any;
|
|
35
|
+
};
|
|
36
|
+
/** 手动提供流程图上下文。适用于「自己创建会话」的场景。 */
|
|
37
|
+
export declare function FlowDesignerProvider(props: FlowDesignerProviderProps): import("react").FunctionComponentElement<import("react").ProviderProps<FlowDesigner>>;
|
|
38
|
+
/**
|
|
39
|
+
* 读取当前画布的 FlowDesigner 实例。
|
|
40
|
+
* 只能在 <FlowDesignerCanvas> / <FlowDesignerProvider> 的子树中使用;未就绪或不在树中时返回 null。
|
|
41
|
+
*/
|
|
42
|
+
export declare function useFlowDesigner(): FlowDesigner | null;
|
|
@@ -14,4 +14,11 @@ export type { EntityDesignerProviderProps } from './context.mjs';
|
|
|
14
14
|
export { createDesignerSession, shouldApplyControlledValue } from './session.mjs';
|
|
15
15
|
export type { DesignerSession, DesignerSessionOptions } from './session.mjs';
|
|
16
16
|
export type { EntityDesignerCanvasProps, EntityDesignerChangePayload, EntityDesignerHandle } from './types.mjs';
|
|
17
|
-
export {
|
|
17
|
+
export { default as FlowDesignerCanvas } from './FlowDesignerCanvas.mjs';
|
|
18
|
+
export { FlowDesignerContext, FlowDesignerProvider, useFlowDesigner } from './context.mjs';
|
|
19
|
+
export type { FlowDesignerProviderProps } from './context.mjs';
|
|
20
|
+
export { createFlowSession } from './session.mjs';
|
|
21
|
+
export type { FlowSession, FlowSessionOptions } from './session.mjs';
|
|
22
|
+
export type { FlowDesignerCanvasProps, FlowDesignerChangePayload, FlowDesignerHandle } from './types.mjs';
|
|
23
|
+
export { Entity, Relation, FlowNode, FlowEdge, FlowDesigner, FLOW_NODE_KINDS, toSchemaObject, toSchemaString, validateSchema, } from '../index.mjs';
|
|
24
|
+
export type { FlowNodeKind, FlowNodePreset, FlowPort, FlowSnapshot, FlowLoadReport } from '../index.mjs';
|
|
@@ -14,4 +14,11 @@ export type { EntityDesignerProviderProps } from './context';
|
|
|
14
14
|
export { createDesignerSession, shouldApplyControlledValue } from './session';
|
|
15
15
|
export type { DesignerSession, DesignerSessionOptions } from './session';
|
|
16
16
|
export type { EntityDesignerCanvasProps, EntityDesignerChangePayload, EntityDesignerHandle } from './types';
|
|
17
|
-
export {
|
|
17
|
+
export { default as FlowDesignerCanvas } from './FlowDesignerCanvas';
|
|
18
|
+
export { FlowDesignerContext, FlowDesignerProvider, useFlowDesigner } from './context';
|
|
19
|
+
export type { FlowDesignerProviderProps } from './context';
|
|
20
|
+
export { createFlowSession } from './session';
|
|
21
|
+
export type { FlowSession, FlowSessionOptions } from './session';
|
|
22
|
+
export type { FlowDesignerCanvasProps, FlowDesignerChangePayload, FlowDesignerHandle } from './types';
|
|
23
|
+
export { Entity, Relation, FlowNode, FlowEdge, FlowDesigner, FLOW_NODE_KINDS, toSchemaObject, toSchemaString, validateSchema, } from '../index';
|
|
24
|
+
export type { FlowNodeKind, FlowNodePreset, FlowPort, FlowSnapshot, FlowLoadReport } from '../index';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { EntityDesignerErrorPayload } from './types.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* 载入快照失败时上报给 onError(默认 console.error)。
|
|
4
|
+
*
|
|
5
|
+
* React 绑定层的两处 loadProject / load 都走这里兜底:非法 / 版本不兼容的快照
|
|
6
|
+
* 只会被上报,不会把异常抛进 React 渲染树(挂载期抛错会直接崩掉整棵子树)。
|
|
7
|
+
*/
|
|
8
|
+
export declare function reportLoadError(handler: ((payload: EntityDesignerErrorPayload) => void) | undefined, phase: EntityDesignerErrorPayload['phase'], snapshot: string, error: unknown): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { EntityDesignerErrorPayload } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* 载入快照失败时上报给 onError(默认 console.error)。
|
|
4
|
+
*
|
|
5
|
+
* React 绑定层的两处 loadProject / load 都走这里兜底:非法 / 版本不兼容的快照
|
|
6
|
+
* 只会被上报,不会把异常抛进 React 渲染树(挂载期抛错会直接崩掉整棵子树)。
|
|
7
|
+
*/
|
|
8
|
+
export declare function reportLoadError(handler: ((payload: EntityDesignerErrorPayload) => void) | undefined, phase: EntityDesignerErrorPayload['phase'], snapshot: string, error: unknown): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EntityDesigner } from '../index.mjs';
|
|
1
|
+
import { EntityDesigner, FlowDesigner } from '../index.mjs';
|
|
2
2
|
export declare type DesignerSessionOptions = {
|
|
3
3
|
/** 渲染模式,默认 dirty-rect */
|
|
4
4
|
renderMode?: 'dirty-rect' | 'full';
|
|
@@ -28,3 +28,24 @@ export declare function createDesignerSession(canvas: any, options?: DesignerSes
|
|
|
28
28
|
* 此时 lastApplied 已经等于该值,因此这里返回 false,避免「onChange → setState → 再 loadProject」的回环。
|
|
29
29
|
*/
|
|
30
30
|
export declare function shouldApplyControlledValue(value: string | undefined, lastApplied: string | null | undefined): boolean;
|
|
31
|
+
export declare type FlowSessionOptions = {
|
|
32
|
+
/** 渲染模式,默认 dirty-rect */
|
|
33
|
+
renderMode?: 'dirty-rect' | 'full';
|
|
34
|
+
/** 初始流程图快照,等价于 load(initialFlow) */
|
|
35
|
+
initialFlow?: string;
|
|
36
|
+
/** 流程变更回调(含画布拖动节点) */
|
|
37
|
+
onChange?: (snapshot: string) => void;
|
|
38
|
+
};
|
|
39
|
+
export declare type FlowSession = {
|
|
40
|
+
ice: any;
|
|
41
|
+
designer: FlowDesigner;
|
|
42
|
+
/** 销毁会话:退订 + dispose designer + destroy ICE(可重复调用) */
|
|
43
|
+
destroy(): void;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* 在给定的 canvas 元素上创建「ICE + FlowDesigner」会话。
|
|
47
|
+
*
|
|
48
|
+
* 与 createDesignerSession 同构:挂载即初始化、卸载即销毁;ICE.init() 幂等、
|
|
49
|
+
* ICE.destroy() 会解绑全局监听与事件总线,因此 StrictMode 双挂载不会累积监听。
|
|
50
|
+
*/
|
|
51
|
+
export declare function createFlowSession(canvas: any, options?: FlowSessionOptions): FlowSession;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EntityDesigner } from '../index';
|
|
1
|
+
import { EntityDesigner, FlowDesigner } from '../index';
|
|
2
2
|
export declare type DesignerSessionOptions = {
|
|
3
3
|
/** 渲染模式,默认 dirty-rect */
|
|
4
4
|
renderMode?: 'dirty-rect' | 'full';
|
|
@@ -28,3 +28,24 @@ export declare function createDesignerSession(canvas: any, options?: DesignerSes
|
|
|
28
28
|
* 此时 lastApplied 已经等于该值,因此这里返回 false,避免「onChange → setState → 再 loadProject」的回环。
|
|
29
29
|
*/
|
|
30
30
|
export declare function shouldApplyControlledValue(value: string | undefined, lastApplied: string | null | undefined): boolean;
|
|
31
|
+
export declare type FlowSessionOptions = {
|
|
32
|
+
/** 渲染模式,默认 dirty-rect */
|
|
33
|
+
renderMode?: 'dirty-rect' | 'full';
|
|
34
|
+
/** 初始流程图快照,等价于 load(initialFlow) */
|
|
35
|
+
initialFlow?: string;
|
|
36
|
+
/** 流程变更回调(含画布拖动节点) */
|
|
37
|
+
onChange?: (snapshot: string) => void;
|
|
38
|
+
};
|
|
39
|
+
export declare type FlowSession = {
|
|
40
|
+
ice: any;
|
|
41
|
+
designer: FlowDesigner;
|
|
42
|
+
/** 销毁会话:退订 + dispose designer + destroy ICE(可重复调用) */
|
|
43
|
+
destroy(): void;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* 在给定的 canvas 元素上创建「ICE + FlowDesigner」会话。
|
|
47
|
+
*
|
|
48
|
+
* 与 createDesignerSession 同构:挂载即初始化、卸载即销毁;ICE.init() 幂等、
|
|
49
|
+
* ICE.destroy() 会解绑全局监听与事件总线,因此 StrictMode 双挂载不会累积监听。
|
|
50
|
+
*/
|
|
51
|
+
export declare function createFlowSession(canvas: any, options?: FlowSessionOptions): FlowSession;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* React 绑定层的类型定义。
|
|
3
3
|
*/
|
|
4
|
-
import type { EntityDesigner, ProjectLoadReport } from '../index.mjs';
|
|
4
|
+
import type { EntityDesigner, FlowDesigner, FlowLoadReport, FlowNodeKind, ProjectLoadReport } from '../index.mjs';
|
|
5
5
|
export declare type EntityDesignerChangePayload = {
|
|
6
6
|
/** 项目快照,等价于 designer.serializeProject() 的结果 */
|
|
7
7
|
snapshot: string;
|
|
@@ -62,3 +62,61 @@ export declare type EntityDesignerCanvasProps = {
|
|
|
62
62
|
/** 子节点渲染在上下文内部,可直接使用 useEntityDesigner() */
|
|
63
63
|
children?: any;
|
|
64
64
|
};
|
|
65
|
+
export declare type FlowDesignerChangePayload = {
|
|
66
|
+
/** 流程图快照,等价于 designer.serialize() 的结果 */
|
|
67
|
+
snapshot: string;
|
|
68
|
+
/** 当前节点 / 连线条数,便于直接渲染统计信息 */
|
|
69
|
+
counts: {
|
|
70
|
+
nodes: number;
|
|
71
|
+
edges: number;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
export declare type FlowDesignerHandle = {
|
|
75
|
+
/** 底层 ICE 实例(卸载后为 null) */
|
|
76
|
+
ice: any;
|
|
77
|
+
/** 底层 FlowDesigner 实例(卸载后为 null) */
|
|
78
|
+
designer: FlowDesigner | null;
|
|
79
|
+
addNode(kind: FlowNodeKind, props?: any): any;
|
|
80
|
+
connect(props: any): any;
|
|
81
|
+
updateNode(id: string, patch: any): any;
|
|
82
|
+
updateEdge(id: string, patch: any): any;
|
|
83
|
+
remove(id: string): void;
|
|
84
|
+
load(json: string): FlowLoadReport;
|
|
85
|
+
undo(): void;
|
|
86
|
+
redo(): void;
|
|
87
|
+
serialize(): string;
|
|
88
|
+
toSnapshot(): any;
|
|
89
|
+
fitViewport(padding?: number): void;
|
|
90
|
+
};
|
|
91
|
+
export declare type FlowDesignerCanvasProps = {
|
|
92
|
+
/**
|
|
93
|
+
* 受控模式:流程图快照。变化时会同步进画布(内部变更通过 onChange 上报,带循环保护)。
|
|
94
|
+
* 与 defaultValue 互斥,value 优先。
|
|
95
|
+
*/
|
|
96
|
+
value?: string;
|
|
97
|
+
/** 非受控模式:初始流程图快照(等价于 load(defaultValue)) */
|
|
98
|
+
defaultValue?: string;
|
|
99
|
+
/** 渲染模式,默认 dirty-rect */
|
|
100
|
+
renderMode?: 'dirty-rect' | 'full';
|
|
101
|
+
/**
|
|
102
|
+
* 流程变更回调(建节点 / 连线 / 改属性 / 画布拖动 / 载入 / undo / redo 之后触发)。
|
|
103
|
+
* 注意:画布上拖动节点也会触发(FlowDesigner 订阅了引擎的 BEFORE_MOVE / AFTER_MOVE),
|
|
104
|
+
* 因此依赖它的自动保存能拿到拖拽后的最新坐标。
|
|
105
|
+
*/
|
|
106
|
+
onChange?: (payload: FlowDesignerChangePayload) => void;
|
|
107
|
+
/**
|
|
108
|
+
* 快照载入失败回调(非法 / 结构不合法)。不传时默认 console.error;
|
|
109
|
+
* 组件内部已捕获,不会把错误抛进 React 渲染树。
|
|
110
|
+
*/
|
|
111
|
+
onError?: (payload: EntityDesignerErrorPayload) => void;
|
|
112
|
+
/** 实例就绪回调,回调里拿到命令式句柄 */
|
|
113
|
+
onReady?: (handle: FlowDesignerHandle) => void;
|
|
114
|
+
className?: string;
|
|
115
|
+
/** 容器内联样式(与 width/height 合并) */
|
|
116
|
+
style?: any;
|
|
117
|
+
/** 画布宽高(像素),同时作为容器尺寸,默认 1200 x 800 */
|
|
118
|
+
width?: number;
|
|
119
|
+
height?: number;
|
|
120
|
+
/** 子节点渲染在上下文内部,可直接使用 useFlowDesigner() */
|
|
121
|
+
children?: any;
|
|
122
|
+
};
|