feat(ElementFactory): add #isFrame property on group creation

This allows basic support for diagram-js frame elements.

Closes #959
Closes #960
This commit is contained in:
Niklas Kiefer 2019-05-02 10:38:33 +02:00
parent 13f1e05ee7
commit 89886d7c12
3 changed files with 67 additions and 0 deletions

View File

@ -83,6 +83,12 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
}
}
if (is(businessObject, 'bpmn:Group')) {
attrs = assign({
isFrame: true
}, attrs);
}
if (attrs.colors) {
assign(businessObject.di, attrs.colors);

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="sid-0fcc2144-457b-4505-9e44-ff673663e3bc" targetNamespace="http://www.signavio.com/bpmn20" exporter="Camunda Modeler" exporterVersion="3.0.1" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL http://www.omg.org/spec/BPMN/2.0/20100501/BPMN20.xsd">
<category id="Category_1">
<categoryValue id="CategoryValue_1" value="my group" />
</category>
<process id="Process_1" processType="None" isExecutable="false">
<group id="Group_1" categoryValueRef="CategoryValue_1" />
<group id="Group_2" categoryValueRef="CategoryValue_1" />
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
<bpmndi:BPMNShape id="Group_1di" bpmnElement="Group_1">
<omgdc:Bounds x="180" y="105" width="188" height="154" />
<bpmndi:BPMNLabel>
<omgdc:Bounds x="184" y="107" width="58.28571319580078" height="15" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Group_2di" bpmnElement="Group_2">
<omgdc:Bounds x="180" y="279" width="188" height="154" />
<bpmndi:BPMNLabel>
<omgdc:Bounds x="184" y="107" width="58.28571319580078" height="15" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>

View File

@ -0,0 +1,35 @@
import {
bootstrapModeler,
inject
} from 'test/TestHelper';
describe('import - groups', function() {
describe('should import groups', function() {
it('with frame property set', function(done) {
var xml = require('./Groups.bpmn');
// given
bootstrapModeler(xml)(function(err) {
// when
inject(function(elementRegistry) {
// then
var groupElement = elementRegistry.get('Group_1');
expect(groupElement).to.exist;
expect(groupElement.isFrame).to.be.true;
done(err);
})();
});
});
});
});