A simple element template chooser for properties-panel >= 1
.
import BpmnModeler from 'bpmn-js/lib/Modeler';
import '@bpmn-io/element-template-chooser/dist/element-template-chooser.css';
import ElementTemplateChooserModule from '@bpmn-io/element-template-chooser';
const modeler = new BpmnModeler({
additionalModules: [
...
ElementTemplateChooserModule
],
...
});
// load templates
modeler.on('elementTemplates.errors', event => {
const { errors } = event;
showTemplateErrors(errors);
});
modeler.get('elementTemplatesLoader').setTemplates(ELEMENT_TEMPLATES_JSON);
// choose via the properties panel, _OR_
// open the chooser programmatically for a given element
const template = await (
modeler.get('elementTemplateChooser').open(element)
);
Checkout ./example
for a full featured integration example.
To run the example app, execute:
npm start
MIT