@bpmn-io/element-template-chooser
v1.0.0
Published
A simple element template chooser
Downloads
15,755
Maintainers
Keywords
Readme
@bpmn-io/element-template-chooser
A simple element template chooser for properties-panel >= 1
.
Usage
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.
Run locally
To run the example app, execute:
npm start
License
MIT