We are proud to announce the latest version of dmn-js. In this release we introduce a Viewer for Decision Requirements Diagrams (DRDs). DRDs show elements involved in the decision-making process and the dependencies between them. The elements modeled are decisions, areas of business knowledge, sources of business knowledge, and input data. We also introduce an editor for decisions that have a literal expression instead of a decision table and support switching between multiple decision tables within the same dmn file.
Decision Requirements Diagrams
In this release, we add a viewer for DRDs. When you create a new instance of the dmn-js Viewer and parse a dmn file that contains a DRD, you will see the decisions and relationships as a diagram. Like in the other bpmn.io libraries bpmn-js and cmmn-js, you can also instantiate the Navigated Viewer and be able to zoom and scroll through the diagram with your mouse.
If your dmn file contains only one decision, you will see the table for that decision instead.
Navigating the DRD
A dmn file can contain many decisions in addition to the DRD. To switch between the decision table view and the DRD view, you can call methods on the dmn-js instance or use the default user interaction behavior.
Default User Interaction
If you are using the dmn-js library, there is a default user interaction to switch between the table and the drd view. While in DRD view, double-clicking on a decision opens the table view. In the table view, clicking the Show DRD button next to the Advanced Mode button returns to the DRD view. You can disable that behavior by setting
disableDrdInteraction to true in the dmn-js configuration.
If you are integrating the dmn-js library in your application, you can create your own interactions. The dmn-js instance provides two functions
getDecisions method returns an array of all decisions that are loaded as part of the current dmn file. The decision object contains information such as the name or the id of the decision. With
showDecision you can then set one decision of this array to show.
A decision does not have to contain a decision table. It can also contain a literal expression that is evaluated with the inputs and returns the result. In this release, we add an editor for literal expressions so that you can access even those decisions in your dmn.
With this release, we support the official new namespace of DMN 1.1. If you have trouble opening your dmn files, check that you use the correct namespace:
Adding support for DRDs means that we had to change some interactions with the library. Instantiating dmn-js returns an instance of the drd viewer. Accessing properties like the eventBus or elementRegistry therefore will work in the context of the drd, not in the context of a decision table. You can access the
tableViewer property of the dmn-js instance to retrieve the viewer instance for the table view.
Modeling a single table
In this release, we only provide the viewer component for DRDs. If you want to make changes to a decision table and model that, you need to instantiate the
Modeler.js in the
lib/table directory. It is currently not possible to model DRDs.
Besides fixing several bugs, we also made several improvements to the simple mode. We improved the parsing for numeric expressions in simple mode so that you should get less unexpected [expression] fields in simple mode. We also improved how the Simple Mode deals with Output cells.
See all changes from this dmn-js release here.
What is next?
This dmn-js release provides a read-only viewer for Decision Requirements Diagrams. Our next steps will focus on the modeling of DRDs.
Give us your feedback on this release via our forums. Make sure to follow us to stay up to date, too.
As always, get the latest dmn-js release via npm or bower.
Join Camunda and build modeling tools people .