How to use the min-dash.flatten function in min-dash

To help you get started, we’ve selected a few min-dash examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bpmn-io / bpmn-js / test / spec / features / modeling / behavior / DropOnFlowBehaviorSpec.js View on Github external
endEventShape,
            dropPosition,
            sequenceFlow
          );

          // then

          // new incoming connection
          expect(newShape.incoming.length).to.equal(1);
          expect(newShape.incoming[0]).to.eql(sequenceFlow);

          // no outgoing edges
          expect(newShape.outgoing.length).to.equal(0);

          // split target at insertion point
          expect(sequenceFlow).to.have.waypoints(flatten([
            originalWaypoints.slice(0, 1),
            { x: 322, y: 120 }
          ]));
        }
      ));
github bptlab / chor-js / lib / features / modeling / behavior / CreateChoreoTaskBehavior.js View on Github external
initiator: allParticipants[0],
    receiver: allParticipants[1]
  };
  if (hints && hints.sourceShape) {
    let source = hints.sourceShape;
    const precedingActivities = getConnectedElements(hints.sourceShape, 'incoming', isChoreoActivity);

    if (isChoreoActivity(source) || precedingActivities.length === 1) {
      // We reverse the participants roles compared to the previous activity.
      const participants = isChoreoActivity(source) ? source.bandShapes : precedingActivities[0].bandShapes;
      recommended.receiver = participants.find(p => isInitiating(p)).businessObject;
      recommended.initiator = participants.find(p => !isInitiating(p)).businessObject;

    } else if (precedingActivities.length > 1) {
      // If there are more than two preceding activities, e.g., due to a join we select the most used participants.
      const participants = flatten(precedingActivities.map(p => p.bandShapes.map(bs => bs.businessObject)));
      const count = {};
      participants.forEach(bo => {
        count[bo.id] = (count[bo.id] || 0) + 1;
      });
      let list = allParticipants.map(bo => [bo, count[bo.id]]);
      list.sort((a, b) => b[1] - a[1]);

      recommended.initiator = list[0][0];
      recommended.receiver = list[1][0];
    }
  }
  return recommended;

}
github bptlab / chor-js / lib / util / DiagramWalkerUtil.js View on Github external
function traverse(node) {
    if (!node.flowElements) {
      // A FlowElementContainer might not contain any elements so we have to check for undefined here.
      return [];
    }
    const matches = node.flowElements.filter(fe => is(fe, type));
    return matches.concat(flatten(
      node.flowElements.filter(fe => is(fe, 'bpmn:FlowElementsContainer')).map(fc => traverse(fc))));
  }
  const found = flatten(choreos.map(choreo => traverse(choreo)));
github bpmn-io / diagram-js / lib / features / attach-support / AttachSupport.js View on Github external
function getAttachers(shapes) {
  return flatten(map(shapes, function(s) {
    return s.attachers || [];
  }));
}
github bpmn-io / cmmn-js / lib / features / modeling / behavior / SentryUpdater.js View on Github external
function getAttachers(shapes) {
  return flatten(map(shapes, function(s) {
    var attachers = [];

    if (s.attachers) {
      attachers = s.attachers;
    }
    else {
      var bo = getBusinessObject(s);

      var exitCriteria = bo.get('exitCriteria');
      forEach(exitCriteria, function(criterion) {
        attachers.push(criterion);
      });

      var entryCriteria = bo.get('entryCriteria');
      forEach(entryCriteria, function(criterion) {
        attachers.push(criterion);
github bpmn-io / cmmn-js / lib / features / modeling / cmd / UpdatePropertiesHandler.js View on Github external
var bo = element.businessObject || element;

  context.businessObject = bo;

  var changed = [];

  if (element.businessObject) {
    changed.push(element);
  }

  if (shape) {
    changed.push(shape);
  }

  context.changed = flatten(changed);
};
github bpmn-io / diagram-js / lib / features / move / MovePreview.js View on Github external
function getAllDraggedElements(shapes) {
    var allShapes = selfAndAllChildren(shapes, true);

    var allConnections = map(allShapes, function(shape) {
      return (shape.incoming || []).concat(shape.outgoing || []);
    });

    return flatten(allShapes.concat(allConnections));
  }