feat(modeling): assign ID when creating bpmn:LaneSet

This commit is contained in:
Nico Rehwaldt 2018-05-28 09:53:52 +02:00
parent a973665f6c
commit b1a4e08ddd
3 changed files with 29 additions and 14 deletions

View File

@ -6,6 +6,7 @@ All notable changes to [bpmn-js](https://github.com/bpmn-io/bpmn-js) are documen
___Note:__ Yet to be released changes appear here._
* `FEAT`: `bpmn:LaneSet` elements get an ID assigned on creation
* `FEAT`: external labels can be deleted, clearing the elements name ([#791](https://github.com/bpmn-io/bpmn-js/pull/791))
* `FEAT`: add ability to override default element colors ([#713](https://github.com/bpmn-io/bpmn-js/issues/713))
* `FEAT`: add ability to override font family and size of rendered labels ([`4bb270f1`](https://github.com/bpmn-io/bpmn-js/commit/4bb270f19279db40f9cc3c179e09ee3a9a114e7c))

View File

@ -4,6 +4,10 @@ import {
pick
} from 'min-dash';
import {
isAny
} from './util/ModelingUtil';
export default function BpmnFactory(moddle) {
this._model = moddle;
@ -13,20 +17,23 @@ BpmnFactory.$inject = [ 'moddle' ];
BpmnFactory.prototype._needsId = function(element) {
return element.$instanceOf('bpmn:RootElement') ||
element.$instanceOf('bpmn:FlowElement') ||
element.$instanceOf('bpmn:MessageFlow') ||
element.$instanceOf('bpmn:DataAssociation') ||
element.$instanceOf('bpmn:Artifact') ||
element.$instanceOf('bpmn:Participant') ||
element.$instanceOf('bpmn:Lane') ||
element.$instanceOf('bpmn:Process') ||
element.$instanceOf('bpmn:Collaboration') ||
element.$instanceOf('bpmndi:BPMNShape') ||
element.$instanceOf('bpmndi:BPMNEdge') ||
element.$instanceOf('bpmndi:BPMNDiagram') ||
element.$instanceOf('bpmndi:BPMNPlane') ||
element.$instanceOf('bpmn:Property');
return isAny(element, [
'bpmn:RootElement',
'bpmn:FlowElement',
'bpmn:MessageFlow',
'bpmn:DataAssociation',
'bpmn:Artifact',
'bpmn:Participant',
'bpmn:Lane',
'bpmn:LaneSet',
'bpmn:Process',
'bpmn:Collaboration',
'bpmndi:BPMNShape',
'bpmndi:BPMNEdge',
'bpmndi:BPMNDiagram',
'bpmndi:BPMNPlane',
'bpmn:Property'
]);
};
BpmnFactory.prototype._ensureId = function(element) {

View File

@ -41,6 +41,13 @@ describe('features - bpmn-factory', function() {
expect(plane.id).to.match(/^BPMNPlane_/g);
}));
it('should assign bpmn:LaneSet id', inject(function(bpmnFactory) {
var set = bpmnFactory.create('bpmn:LaneSet');
expect(set.id).to.exist;
}));
});