The bpmn-js (and diagram-js) allows to include optional modules, that augment the current functionality.
Example: Modeler.js (from line 174, commit [ae96f37]1)
Modeler.prototype._interactionModules = [
// non-modeling components
require('diagram-js/lib/navigation/movecanvas'),
require('diagram-js/lib/navigation/touch'),
require('diagram-js/lib/navigation/zoomscroll')
];
Now in order to get an overview about the certain modules, I currently have to look at the folders of the both modules (bpmn-js
, diagram-js
in node_modules
) to see the whole list of possible modules:
Example 1: bpmn-js/lib/features/*
(commit: b03014f)
Example 2: diagram-js/lib/*
(commit: 7956c81)
However, if I want to have a more modular Modeler design (e.g. add / remove functionality, depending on user roles) I would require to have some functionality, that exposes the available modules to my application. Something like
Modeler.modules() // list all module names
Modeler.addModule(name) // adds this module
Modeler.removeModule(name) // removes this module
I have searched to code of the bpmn-js
repo so far but found no properties / methods / API that expose these modules.
I just found a way to search the directory of the node module in order to get the desired folders (/lib/*
) but that seems very odd to me, since this structure might change with the next version due to refactoring, redesign etc.
Am I really stuck to write my own implementation or did somebody successfully solve this already? (Any "hidden" properties that implicitly expose the available modules?)