-
Notifications
You must be signed in to change notification settings - Fork 0
/
bpmn-viewer.html
64 lines (52 loc) · 1.42 KB
/
bpmn-viewer.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<link rel="import" href="../polymer/polymer.html">
<!--
`bpmn-viewer`
Displays a BPMN2 model
@demo demo/index.html
-->
<dom-module id="bpmn-viewer">
<template>
<style>
:host {
display: block;
}
</style>
<div id="jscanvas"></div>
</template>
<script src="../jquery/dist/jquery.js"></script>
<script src="../bpmn-js/dist/bpmn-navigated-viewer.js"></script>
<script>
Polymer({
is: 'bpmn-viewer',
attached: function() {
// access a local DOM element by ID using this.$
var BpmnViewer = window.BpmnJS;
var height = this.offsetHeight
if (this.style != null) {
height = this.style.height;
}
var width = this.offsetWidth
if (this.style != null) {
width = this.style.width;
}
var viewer = new BpmnViewer({ container: this.$.jscanvas, height: height, width: width });
var url = this.src;
$.ajax(url, { dataType : 'text' }).done(function(xml) {
viewer.importXML(xml, function(err) {
if (err) {
console.error(err);
} else {
viewer.get('canvas').zoom('fit-viewport');
}
});
});
},
properties: {
src: {
type: String,
value: 'bpmn-viewer',
},
},
});
</script>
</dom-module>