@bpmn-io/element-template-chooser
v3.0.0
Published
A simple element template chooser
Downloads
104,862
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, presetId } = await (
modeler.get('elementTemplateChooser').open(element)
);
// apply the chosen template (with the selected operation preset, if any)
modeler.get('elementTemplates').applyTemplate(element, template, { presetId });Checkout ./example for a full featured integration example.
Run locally
To run the example app, execute:
npm startLicense
MIT
