feat(modeling): allow basic movement of DataInput / DataOutput

Allow moving DataInput / DataOutput as
long as they do not leave their original
container.

Related to #951
This commit is contained in:
Nico Rehwaldt 2019-03-29 11:20:45 +01:00 committed by merge-me[bot]
parent fe9d4ff06d
commit 8ca4c1d7b0
5 changed files with 240 additions and 0 deletions

View File

@ -460,6 +460,14 @@ function canDrop(element, target, position) {
return is(target, 'bpmn:Process') || is(target, 'bpmn:Collaboration');
}
// allow moving DataInput / DataOutput within its original container only
if (isAny(element, [ 'bpmn:DataInput', 'bpmn:DataOutput' ])) {
if (element.parent) {
return target === element.parent;
}
}
// allow creating lanes on participants and other lanes only
if (is(element, 'bpmn:Lane')) {
return is(target, 'bpmn:Participant') || is(target, 'bpmn:Lane');

View File

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<semantic:definitions xmlns:semantic="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:color="http://www.omg.org/spec/BPMN/non-normative/color/1.0" id="_af3cbf6a-9c69-460b-9a1d-276711d30213" name="Travel Booking with Event Subprocess" targetNamespace="http://www.trisotech.com/definitions/_af3cbf6a-9c69-460b-9a1d-276711d30213" exporter="BPMN Modeler" exporterVersion="6.1.22">
<semantic:collaboration id="Collaboration_0vimy52">
<semantic:participant id="Participant_A" name="A" processRef="Process_A" />
<semantic:participant id="Participant_B" name="B" processRef="Process_B" />
</semantic:collaboration>
<semantic:process id="Process_A" name="Simple Travel Booking" isClosed="false">
<semantic:ioSpecification>
<semantic:dataInput id="DataInput" name="Input" />
<semantic:dataOutput id="DataOutput" name="Output" />
<semantic:inputSet id="_9f9aea93-30cd-4899-bbe1-e62165c3dbc9">
<semantic:dataInputRefs>DataInput</semantic:dataInputRefs>
</semantic:inputSet>
<semantic:outputSet id="_8154d47e-5733-41c1-8125-29ff926b3cd2">
<semantic:dataOutputRefs>DataOutput</semantic:dataOutputRefs>
</semantic:outputSet>
</semantic:ioSpecification>
<semantic:sendTask id="Task" name="Process Data" implementation="##WebService">
<semantic:ioSpecification>
<semantic:dataInput id="_9628422b-85a6-4857-8c14-7289b9fd9a8a" />
<semantic:dataOutput id="_29b8c649-e2a0-4dd3-804b-567e8cc71718" />
<semantic:inputSet id="_1957232b-478c-49d4-b3a7-86da323a1629">
<semantic:dataInputRefs>_9628422b-85a6-4857-8c14-7289b9fd9a8a</semantic:dataInputRefs>
</semantic:inputSet>
<semantic:outputSet id="_eb462f09-2a8c-43fb-b398-09da73357dde">
<semantic:dataOutputRefs>_29b8c649-e2a0-4dd3-804b-567e8cc71718</semantic:dataOutputRefs>
</semantic:outputSet>
</semantic:ioSpecification>
<semantic:dataInputAssociation id="_82006a49-2cc8-4814-83e2-28c5a85a4c4a">
<semantic:sourceRef>DataInput</semantic:sourceRef>
<semantic:targetRef>Property_1wt0ffm</semantic:targetRef>
</semantic:dataInputAssociation>
<semantic:dataOutputAssociation id="_ef945053-2c76-4796-8d8b-afc6be8bbfec">
<semantic:sourceRef>_29b8c649-e2a0-4dd3-804b-567e8cc71718</semantic:sourceRef>
<semantic:targetRef>DataOutput</semantic:targetRef>
</semantic:dataOutputAssociation>
</semantic:sendTask>
</semantic:process>
<semantic:process id="Process_B" />
<bpmndi:BPMNDiagram id="_f1aecfc3-a3da-4bde-bece-87786e25273d" name="Simple Travel Booking">
<bpmndi:BPMNPlane id="_f1aecfc3-a3da-4bde-bece-87786e25273d_plane" bpmnElement="Collaboration_0vimy52">
<bpmndi:BPMNShape id="Participant_A_di" bpmnElement="Participant_A" isHorizontal="true">
<dc:Bounds x="111" y="110" width="426" height="234" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="DataInput_di" bpmnElement="DataInput">
<dc:Bounds x="209" y="130" width="34" height="40" />
<bpmndi:BPMNLabel labelStyle="LS_f1aecfc3-a3da-4bde-bece-87786e25273d_1">
<dc:Bounds x="211" y="180" width="26" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="DataOutput_di" bpmnElement="DataOutput">
<dc:Bounds x="394" y="180" width="34" height="40" />
<bpmndi:BPMNLabel labelStyle="LS_f1aecfc3-a3da-4bde-bece-87786e25273d_1">
<dc:Bounds x="392" y="225" width="34" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_8eb52f6a-0fd6-4fad-8ade-14bca1b066bf" bpmnElement="Task">
<dc:Bounds x="276" y="230" width="96" height="76" />
<bpmndi:BPMNLabel labelStyle="LS_f1aecfc3-a3da-4bde-bece-87786e25273d_1">
<dc:Bounds x="170.5" y="261.9739767206677" width="89" height="26" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="_fa1439cb-56e1-4399-bfe8-638b37a16866" bpmnElement="_82006a49-2cc8-4814-83e2-28c5a85a4c4a" targetElement="_8eb52f6a-0fd6-4fad-8ade-14bca1b066bf">
<di:waypoint x="244" y="143.99809778522484" />
<di:waypoint x="324" y="143.99809778522484" />
<di:waypoint x="324" y="230" />
<bpmndi:BPMNLabel labelStyle="LS_f1aecfc3-a3da-4bde-bece-87786e25273d_1" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="_9f83d262-8e6a-47f5-84b3-86f560fbfcec" bpmnElement="_ef945053-2c76-4796-8d8b-afc6be8bbfec" sourceElement="_8eb52f6a-0fd6-4fad-8ade-14bca1b066bf">
<di:waypoint x="339" y="230" />
<di:waypoint x="339" y="200" />
<di:waypoint x="394" y="200" />
<bpmndi:BPMNLabel labelStyle="LS_f1aecfc3-a3da-4bde-bece-87786e25273d_1" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="Participant_B_di" bpmnElement="Participant_B" isHorizontal="true">
<dc:Bounds x="111" y="391" width="423" height="160" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
<bpmndi:BPMNLabelStyle id="LS_f1aecfc3-a3da-4bde-bece-87786e25273d_0">
<dc:Font name="Arial" size="11" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" />
</bpmndi:BPMNLabelStyle>
<bpmndi:BPMNLabelStyle id="LS_f1aecfc3-a3da-4bde-bece-87786e25273d_1">
<dc:Font name="arial,helvetica,sans-serif" size="11" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" />
</bpmndi:BPMNLabelStyle>
</bpmndi:BPMNDiagram>
</semantic:definitions>

View File

@ -0,0 +1,74 @@
<semantic:definitions xmlns:semantic="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:color="http://www.omg.org/spec/BPMN/non-normative/color/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="_af3cbf6a-9c69-460b-9a1d-276711d30213" targetNamespace="http://www.trisotech.com/definitions/_af3cbf6a-9c69-460b-9a1d-276711d30213" expressionLanguage="http://www.w3.org/1999/XPath" exporter="BPMN Modeler" exporterVersion="6.1.22" name="Travel Booking with Event Subprocess">
<semantic:process id="Process" name="Simple Travel Booking" isClosed="false">
<semantic:ioSpecification>
<semantic:dataInput name="Input" isCollection="false" id="DataInput"/>
<semantic:dataOutput name="Output" isCollection="false" id="DataOutput"/>
<semantic:inputSet id="Process_InputSet">
<semantic:dataInputRefs>DataInput</semantic:dataInputRefs>
</semantic:inputSet>
<semantic:outputSet id="Process_OutputSet">
<semantic:dataOutputRefs>DataOutput</semantic:dataOutputRefs>
</semantic:outputSet>
</semantic:ioSpecification>
<semantic:sendTask id="Task" name="Process Data" implementation="##WebService">
<semantic:ioSpecification>
<semantic:dataInput id="Task_DataInput"/>
<semantic:dataOutput id="Task_DataOutput"/>
<semantic:inputSet id="Task_InputSet">
<semantic:dataInputRefs>Task_DataInput</semantic:dataInputRefs>
</semantic:inputSet>
<semantic:outputSet id="Task_OutputSet">
<semantic:dataOutputRefs>Task_DataOutput</semantic:dataOutputRefs>
</semantic:outputSet>
</semantic:ioSpecification>
<semantic:dataInputAssociation id="DataInputAssociation">
<semantic:sourceRef>DataInput</semantic:sourceRef>
<semantic:targetRef>Task_DataInput</semantic:targetRef>
</semantic:dataInputAssociation>
<semantic:dataOutputAssociation id="DataOutputAssociation">
<semantic:sourceRef>Task_DataOutput</semantic:sourceRef>
<semantic:targetRef>DataOutput</semantic:targetRef>
</semantic:dataOutputAssociation>
</semantic:sendTask>
</semantic:process>
<bpmndi:BPMNDiagram id="_f1aecfc3-a3da-4bde-bece-87786e25273d" name="Simple Travel Booking">
<bpmndi:BPMNPlane bpmnElement="Process" id="_f1aecfc3-a3da-4bde-bece-87786e25273d_plane">
<bpmndi:BPMNShape id="DataOutput_di" bpmnElement="DataOutput">
<dc:Bounds x="285" y="150" width="34" height="40"/>
<bpmndi:BPMNLabel labelStyle="LS_f1aecfc3-a3da-4bde-bece-87786e25273d_1">
<dc:Bounds height="12" width="30" x="285" y="195"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="DataInput_di" bpmnElement="DataInput">
<dc:Bounds x="100" y="100" width="34" height="40"/>
<bpmndi:BPMNLabel labelStyle="LS_f1aecfc3-a3da-4bde-bece-87786e25273d_1">
<dc:Bounds height="12" width="30" x="100" y="150"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Task_di" bpmnElement="Task">
<dc:Bounds x="167" y="200" width="96" height="76"/>
<bpmndi:BPMNLabel labelStyle="LS_f1aecfc3-a3da-4bde-bece-87786e25273d_1">
<dc:Bounds height="26" width="89" x="170.5" y="261.9739767206677"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="DataInputAssociation_di" bpmnElement="DataInputAssociation" targetElement="Task_di">
<di:waypoint x="135" y="113.99809778522484"/>
<di:waypoint x="215" y="113.99809778522484"/>
<di:waypoint x="215" y="200"/>
<bpmndi:BPMNLabel labelStyle="LS_f1aecfc3-a3da-4bde-bece-87786e25273d_1"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="DataOutputAssociation_di" bpmnElement="DataOutputAssociation" sourceElement="Task">
<di:waypoint x="230" y="200"/>
<di:waypoint x="230" y="170"/>
<di:waypoint x="285" y="170"/>
<bpmndi:BPMNLabel labelStyle="LS_f1aecfc3-a3da-4bde-bece-87786e25273d_1"/>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
<bpmndi:BPMNLabelStyle id="LS_f1aecfc3-a3da-4bde-bece-87786e25273d_0">
<dc:Font name="Arial" size="11" isBold="false" isItalic="false" isStrikeThrough="false" isUnderline="false"/>
</bpmndi:BPMNLabelStyle>
<bpmndi:BPMNLabelStyle id="LS_f1aecfc3-a3da-4bde-bece-87786e25273d_1">
<dc:Font name="arial,helvetica,sans-serif" size="11" isBold="false" isItalic="false" isStrikeThrough="false" isUnderline="false"/>
</bpmndi:BPMNLabelStyle>
</bpmndi:BPMNDiagram>
</semantic:definitions>

View File

@ -1702,6 +1702,76 @@ describe('features/modeling/rules - BpmnRules', function() {
});
describe('data input / output', function() {
describe('in process', function() {
var testXML = require('./BpmnRules.dataInputOutput.process.bpmn');
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
it('should move', inject(function(elementRegistry) {
// when
var elements = [
'Task',
'DataInput',
'DataOutput'
];
// then
expectCanDrop('DataInput', 'Process', true);
expectCanDrop('DataOutput', 'Process', true);
expectCanMove(elements, 'Process', {
attach: false,
move: true
});
}));
});
describe('in collaboration', function() {
var testXML = require('./BpmnRules.dataInputOutput.collaboration.bpmn');
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
it('should move', inject(function(elementRegistry) {
// when
var elements = [
'Task',
'DataInput',
'DataOutput'
];
// then
expectCanDrop('DataInput', 'Participant_A', true);
expectCanDrop('DataInput', 'Participant_B', false);
expectCanDrop('DataOutput', 'Participant_A', true);
expectCanDrop('DataOutput', 'Participant_B', false);
expectCanMove(elements, 'Participant_A', {
attach: false,
move: true
});
expectCanMove(elements, 'Participant_B', {
attach: false,
move: false
});
}));
});
});
describe('integration', function() {
describe('move Lane', function() {

View File

@ -61,6 +61,8 @@ export function expectCanMove(elements, target, rules) {
var results = {};
elements = elements.map(get);
getBpmnJS().invoke(function(bpmnRules) {
target = get(target);