Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
formEl = document.getElementById('form'),
warningEl = document.getElementById('warning');
// hide quality assurance if user clicks outside
window.addEventListener('click', (event) => {
const { target } = event;
if (target === qualityAssuranceEl || qualityAssuranceEl.contains(target)) {
return;
}
qualityAssuranceEl.classList.add('hidden');
});
// create modeler
const bpmnModeler = new BpmnModeler({
container: containerEl,
additionalModules: [
customModule
],
moddleExtensions: {
qa: qaExtension
}
});
// import XML
bpmnModeler.importXML(diagramXML, (err) => {
if (err) {
console.error(err);
}
const moddle = bpmnModeler.get('moddle'),
import BpmnModeler from 'bpmn-js/lib/Modeler';
import customTranslate from './customTranslate/customTranslate';
import diagramXML from '../resources/newDiagram.bpmn';
// Our custom translation module
// We need to use the array syntax that is used by bpmn-js internally
// 'value' tells bmpn-js to use the function instead of trying to instanciate it
var customTranslateModule = {
translate: [ 'value', customTranslate ]
};
// Spin up an instance of the modeler that uses our custom translation module
var modeler = new BpmnModeler({
container: '#canvas',
additionalModules: [
customTranslateModule
]
});
// Import our diagram
modeler.importXML(diagramXML, function(err) {
if (err) {
console.error(err);
} else {
console.log('Success!');
}
});
mounted () {
// 获取到属性ref为“content”的dom节点
this.container = this.$refs.content
// 获取到属性ref为“canvas”的dom节点
const canvas = this.$refs.canvas
// 建模,官方文档这里讲的很详细
this.bpmnModeler = new BpmnModeler({
container: canvas,
// 添加控制板
propertiesPanel: {
parent: '#js-properties-panel'
},
additionalModules: [
// 左边工具栏以及节点
propertiesProviderModule,
// 右边的工具栏
propertiesPanelModule
],
moddleExtensions: {
camunda: camundaModdleDescriptor
}
})
async initBPMN (data) {
let plugins = await modelBpmnplugin.get()
let types = _.map(plugins, plug => {
return {
'name': plug.pluginType,
'isAbstract': true,
'superClass': [
'bpmn:FlowNode'
]
}
})
if (types !== undefined) {
camundaModdleDescriptor.types = _.concat(camundaModdleDescriptor.types, types)
document.getElementById('js-canvas').innerHTML = ''
this.bpmnModeler = new BpmnModeler({
container: '#js-canvas',
propertiesPanel: {
parent: '#js-properties-panel',
data: data
},
additionalPlugins: plugins,
additionalModules: [
propertiesPanelModule,
propertiesProviderModule,
customPaletteModule
],
moddleExtensions: {
// flowz: {
// 'name': 'Camunda',
// 'uri': 'http://camunda.org/schema/1.0/bpmn',
// 'prefix': 'camunda',
return function(done) {
var modeler = new Modeler(config);
modeler.attachTo('body');
modeler.importXML(diagram, function(err) {
if (err) {
done(err);
}
modeler.invoke(fn);
done();
});
};
}
import propertiesPanelModule from 'bpmn-js-properties-panel';
import propertiesProviderModule from 'bpmn-js-properties-panel/lib/provider/camunda';
import camundaModdleDescriptor from 'camunda-bpmn-moddle/resources/camunda.json';
import {
debounce
} from 'min-dash';
import diagramXML from '../resources/newDiagram.bpmn';
var container = $('#js-drop-zone');
var canvas = $('#js-canvas');
var bpmnModeler = new BpmnModeler({
container: canvas,
propertiesPanel: {
parent: '#js-properties-panel'
},
additionalModules: [
propertiesPanelModule,
propertiesProviderModule
],
moddleExtensions: {
camunda: camundaModdleDescriptor
}
});
container.removeClass('with-diagram');
function createNewDiagram() {
openDiagram(diagramXML);
import lintModule from 'bpmn-js-bpmnlint';
import BpmnModeler from 'bpmn-js/lib/Modeler';
import bpmnlintConfig from '../.bpmnlintrc';
import defaultDiagramXML from '../diagrams/example.bpmn';
import fileDrop from 'file-drops';
import download from 'downloadjs';
var diagramXML = window.localStorage.getItem('diagramXML');
var modeler = new BpmnModeler({
container: '#canvas',
additionalModules: [
lintModule
],
linting: {
bpmnlint: bpmnlintConfig,
active: getUrlParam('linting')
},
keyboard: {
bindTo: document
}
});
modeler.importXML(diagramXML || defaultDiagramXML);
import BpmnModeler from 'bpmn-js/lib/Modeler';
import propertiesPanelModule from 'bpmn-js-properties-panel';
import propertiesProviderModule from './provider/magic';
import magicModdleDescriptor from './descriptors/magic';
import {
debounce
} from 'min-dash';
import diagramXML from '../resources/newDiagram.bpmn';
var container = $('#js-drop-zone');
var bpmnModeler = new BpmnModeler({
container: '#js-canvas',
propertiesPanel: {
parent: '#js-properties-panel'
},
additionalModules: [
propertiesPanelModule,
propertiesProviderModule
],
moddleExtensions: {
magic: magicModdleDescriptor
}
});
function createNewDiagram() {
openDiagram(diagramXML);
}
import BpmnModeler from 'bpmn-js/lib/Modeler';
import {
debounce
} from 'min-dash';
import transactionBoundariesModule from 'bpmn-js-transaction-boundaries';
import diagramXML from '../resources/transaction-boundaries.bpmn';
var container = $('#js-drop-zone');
var canvas = $('#js-canvas');
var bpmnModeler = new BpmnModeler({
container: canvas,
additionalModules: [
transactionBoundariesModule
]
});
function createNewDiagram() {
openDiagram(diagramXML);
}
function openDiagram(xml) {
bpmnModeler.importXML(xml, function(err) {
if (err) {
container
import Modeler from 'bpmn-js/lib/Modeler';
import PropertiesPanel from './properties-panel';
import customModdleExtension from './moddle/custom.json';
import diagramXML from './diagram.bpmn';
const $modelerContainer = document.querySelector('#modeler-container');
const $propertiesContainer = document.querySelector('#properties-container');
const modeler = new Modeler({
container: $modelerContainer,
moddleExtensions: {
custom: customModdleExtension
},
keyboard: {
bindTo: document.body
}
});
const propertiesPanel = new PropertiesPanel({
container: $propertiesContainer,
modeler
});
modeler.importXML(diagramXML);