@reskin/bpmn 0.0.6 → 0.1.0
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 +141 -0
- package/bundles/reskin-bpmn.umd.js +1373 -1194
- package/bundles/reskin-bpmn.umd.js.map +1 -1
- package/esm2015/public-api.js +5 -1
- package/esm2015/src/base/bpmn-base.component.js +123 -0
- package/esm2015/src/bpmn-editor/bpmn-editor.component.js +153 -169
- package/esm2015/src/bpmn-viewer/bpmn-viewer.component.js +68 -97
- package/esm2015/src/config/defaultXML.js +22 -12
- package/esm2015/src/types/bpmn.types.js +2 -0
- package/esm2015/src/utils/bpmn.utils.js +51 -0
- package/fesm2015/reskin-bpmn.js +399 -267
- package/fesm2015/reskin-bpmn.js.map +1 -1
- package/package.json +2 -1
- package/public-api.d.ts +4 -0
- package/src/base/bpmn-base.component.d.ts +61 -0
- package/src/bpmn-editor/bpmn-editor.component.d.ts +61 -68
- package/src/bpmn-viewer/bpmn-viewer.component.d.ts +26 -27
- package/src/config/defaultXML.d.ts +6 -4
- package/src/types/bpmn.types.d.ts +58 -0
- package/src/utils/bpmn.utils.d.ts +17 -0
|
@@ -1,52 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
/// <reference types="library/bpmn/src/types/diagram-js" />
|
|
2
|
+
import { AfterViewInit, EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
|
|
3
|
+
import type Modeling from 'bpmn-js/lib/features/modeling/Modeling';
|
|
4
|
+
import type ElementRegistry from 'diagram-js/lib/core/ElementRegistry';
|
|
3
5
|
import { Observable } from 'rxjs';
|
|
6
|
+
import { RkBpmnBaseComponent } from '../base/bpmn-base.component';
|
|
7
|
+
import { RkBpmnAfterRenderEvent, RkBpmnImportResult } from '../types/bpmn.types';
|
|
4
8
|
import * as i0 from "@angular/core";
|
|
5
|
-
|
|
9
|
+
/**
|
|
10
|
+
* BPMN 流程图查看器组件
|
|
11
|
+
* 提供只读的 BPMN 2.0 流程图查看功能
|
|
12
|
+
*/
|
|
13
|
+
export declare class RkBpmnViewerComponent extends RkBpmnBaseComponent implements OnChanges, AfterViewInit {
|
|
6
14
|
/**
|
|
7
|
-
*
|
|
15
|
+
* BPMN XML 数据
|
|
8
16
|
*/
|
|
9
17
|
data: string;
|
|
10
18
|
/**
|
|
11
|
-
*
|
|
19
|
+
* 渲染完成事件
|
|
12
20
|
*/
|
|
13
|
-
afterRenderChange: EventEmitter<
|
|
14
|
-
constructor();
|
|
15
|
-
private el?;
|
|
16
|
-
private Viewer;
|
|
17
|
-
private scale;
|
|
18
|
-
ngOnInit(): void;
|
|
21
|
+
afterRenderChange: EventEmitter<RkBpmnAfterRenderEvent>;
|
|
19
22
|
ngOnChanges(changes: SimpleChanges): void;
|
|
20
|
-
|
|
21
|
-
ngOnDestroy(): void;
|
|
23
|
+
ngAfterViewInit(): void;
|
|
22
24
|
/**
|
|
23
|
-
* 初始化
|
|
25
|
+
* 初始化 BPMN 查看器
|
|
24
26
|
*/
|
|
25
|
-
private
|
|
27
|
+
private initViewer;
|
|
26
28
|
/**
|
|
27
|
-
*
|
|
29
|
+
* 注册事件监听
|
|
28
30
|
*/
|
|
29
31
|
private registerEvents;
|
|
30
32
|
/**
|
|
31
|
-
*
|
|
33
|
+
* 导入 BPMN XML
|
|
34
|
+
* @param xml BPMN XML 字符串
|
|
32
35
|
*/
|
|
33
|
-
|
|
36
|
+
importXML(xml: string): Observable<RkBpmnImportResult>;
|
|
34
37
|
/**
|
|
35
38
|
* 重置画板
|
|
36
39
|
*/
|
|
37
|
-
|
|
40
|
+
reset(): Observable<RkBpmnImportResult>;
|
|
38
41
|
/**
|
|
39
|
-
*
|
|
42
|
+
* 获取元素注册表
|
|
40
43
|
*/
|
|
41
|
-
|
|
44
|
+
getElementRegistry(): ElementRegistry | undefined;
|
|
42
45
|
/**
|
|
43
|
-
*
|
|
46
|
+
* 获取建模对象
|
|
44
47
|
*/
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* 重置位置
|
|
48
|
-
*/
|
|
49
|
-
zoomReset(): void;
|
|
48
|
+
getModeling(): Modeling | undefined;
|
|
50
49
|
static ɵfac: i0.ɵɵFactoryDeclaration<RkBpmnViewerComponent, never>;
|
|
51
50
|
static ɵcmp: i0.ɵɵComponentDeclaration<RkBpmnViewerComponent, "rk-bpmn-viewer", never, { "data": "data"; }, { "afterRenderChange": "afterRenderChange"; }, never, never>;
|
|
52
51
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 生成默认 BPMN XML 数据
|
|
3
|
+
* @returns 默认的 BPMN XML 字符串
|
|
3
4
|
*/
|
|
4
|
-
export declare
|
|
5
|
+
export declare function getDefaultBpmnXML(): string;
|
|
5
6
|
/**
|
|
6
|
-
*
|
|
7
|
+
* 默认 BPMN XML 数据(向后兼容)
|
|
8
|
+
* @deprecated 请使用 getDefaultBpmnXML() 函数
|
|
7
9
|
*/
|
|
8
|
-
export declare
|
|
10
|
+
export declare const defaultBpmnData: string;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { ImportXMLResult, SaveSVGResult, SaveXMLResult } from 'bpmn-js/lib/BaseViewer';
|
|
2
|
+
import type BaseViewer from 'bpmn-js/lib/BaseViewer';
|
|
3
|
+
import type Modeling from 'bpmn-js/lib/features/modeling/Modeling';
|
|
4
|
+
import type { Element } from 'bpmn-js/lib/model/Types';
|
|
5
|
+
/**
|
|
6
|
+
* BPMN 编辑器选中事件数据
|
|
7
|
+
*/
|
|
8
|
+
export interface RkBpmnSelectionChangeEvent {
|
|
9
|
+
/** BPMN 建模器实例 */
|
|
10
|
+
modeler: BaseViewer;
|
|
11
|
+
/** 建模操作对象 */
|
|
12
|
+
modeling: Modeling;
|
|
13
|
+
/** 选中的元素 */
|
|
14
|
+
element: Element;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* BPMN 查看器渲染完成事件数据
|
|
18
|
+
*/
|
|
19
|
+
export interface RkBpmnAfterRenderEvent {
|
|
20
|
+
/** 所有节点 */
|
|
21
|
+
nodes: Element[];
|
|
22
|
+
/** 建模操作对象 */
|
|
23
|
+
modeling: Modeling;
|
|
24
|
+
/** 查看器实例 */
|
|
25
|
+
viewer: BaseViewer;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* BPMN 缩放配置
|
|
29
|
+
*/
|
|
30
|
+
export interface RkBpmnZoomConfig {
|
|
31
|
+
/** 缩放比例 */
|
|
32
|
+
scale?: number;
|
|
33
|
+
/** 最小缩放比例 */
|
|
34
|
+
minScale?: number;
|
|
35
|
+
/** 最大缩放比例 */
|
|
36
|
+
maxScale?: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* BPMN 导出配置
|
|
40
|
+
*/
|
|
41
|
+
export interface RkBpmnExportConfig {
|
|
42
|
+
/** 是否格式化 XML */
|
|
43
|
+
format?: boolean;
|
|
44
|
+
/** 文件名(不含扩展名) */
|
|
45
|
+
filename?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* BPMN 导入结果
|
|
49
|
+
*/
|
|
50
|
+
export declare type RkBpmnImportResult = ImportXMLResult;
|
|
51
|
+
/**
|
|
52
|
+
* BPMN 保存 XML 结果
|
|
53
|
+
*/
|
|
54
|
+
export declare type RkBpmnSaveXMLResult = SaveXMLResult;
|
|
55
|
+
/**
|
|
56
|
+
* BPMN 保存 SVG 结果
|
|
57
|
+
*/
|
|
58
|
+
export declare type RkBpmnSaveSVGResult = SaveSVGResult;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 生成唯一 ID
|
|
3
|
+
* @returns 随机字符串
|
|
4
|
+
*/
|
|
5
|
+
export declare function generateUid(): string;
|
|
6
|
+
/**
|
|
7
|
+
* 下载文件
|
|
8
|
+
* @param content 文件内容或 Blob URL
|
|
9
|
+
* @param filename 文件名
|
|
10
|
+
*/
|
|
11
|
+
export declare function downloadFile(content: string | Blob, filename: string): void;
|
|
12
|
+
/**
|
|
13
|
+
* 读取文件内容
|
|
14
|
+
* @param file 文件对象
|
|
15
|
+
* @returns Promise<string>
|
|
16
|
+
*/
|
|
17
|
+
export declare function readFileAsText(file: File): Promise<string>;
|