angular - 如何以角度为 bpmn-js 中的一个元素着色
问题描述
我在我的网站上使用 bpmn-js 查看器(使用角度开发)并将 xml 解析到数据库中。查看时如何为一个元素着色
import * as BpmnJS from 'bpmn-js/dist/bpmn-navigated-viewer.production.min.js';
.
.
.
private bpmnJS: BpmnJS;
.
.
.
constructor(private http: HttpClient, private route: ActivatedRoute,) {
this.url = "assets/bpmn/" + this.route.snapshot.queryParamMap.get('furl');
this.bpmnJS = new BpmnJS();
this.loadUrl(this.url);
this.bpmnJS.on('import.done', (error: any) => {
if (!error) {
this.bpmnJS.get('canvas').zoom('fit-viewport');
}
});
}
loadUrl(url: string): Subscription {
return (
this.http.get(url, { responseType: 'text' }).pipe(
switchMap((xml: string) => this.importDiagram(xml)),
map(result => result.warnings),
).subscribe(
(warnings) => {
this.importDone.emit({
type: 'success',
warnings
});
},
(err) => {
this.importDone.emit({
type: 'error',
error: err
});
}
)
);
}
private importDiagram(xml: string): Observable<{ warnings: Array<any> }> {
return from(this.bpmnJS.importXML(xml) as Promise<{ warnings: Array<any> }>);
}
如何通过 id 为一个元素着色(或指定),例如从数据库中检索的“Activity_1je8h8x”并在查看器中为其添加标题(标题也从数据库中检索)
解决方案
推荐阅读
- java - JAVA SWING - 使用 Swing Timer 创建动画
- regex - 带有 sed 的 Bash 正则表达式
- python - Python .cgi 脚本 - 动态创建 HTML 按钮 - 无法传递 onclick 函数参数
- c - 查找数组中出现次数最多的数字
- dialogflow-es - DialogFlow Conv 将用户状态显示为访客
- java - 如何将图像插入哈希图中
- json - Spark:为 JSON 字符串生成 JSON 模式
- node.js - 如何找到 HTTPS 请求库的 TLS 版本?
- flutter - Flutter:应用程序的 AndroidManifest.xml 中的位置包错误元数据标记不存在
- javascript - 找到数组中最大的 d 使得 a + b + c = d