all files / bpmn-js/lib/features/distribute-elements/ BpmnDistributeElements.js

100% Statements 5/5
100% Branches 2/2
100% Functions 3/3
100% Lines 5/5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35                              56× 57×                       57×        
import {
  filter
} from 'min-dash';
 
import {
  isAny
} from '../modeling/util/ModelingUtil';
 
 
/**
 * Registers element exclude filters for elements that
 * currently do not support distribution.
 */
export default function BpmnDistributeElements(distributeElements) {
 
  distributeElements.registerFilter(function(elements) {
    return filter(elements, function(element) {
      var cannotDistribute = isAny(element, [
        'bpmn:Association',
        'bpmn:BoundaryEvent',
        'bpmn:DataInputAssociation',
        'bpmn:DataOutputAssociation',
        'bpmn:Lane',
        'bpmn:MessageFlow',
        'bpmn:Participant',
        'bpmn:SequenceFlow',
        'bpmn:TextAnnotation'
      ]);
 
      return !(element.labelTarget || cannotDistribute);
    });
  });
}
 
BpmnDistributeElements.$inject = [ 'distributeElements' ];