How to use the min-dash.forEach 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 / diagram-js / test / spec / features / keyboard / MoveCanvasSpec.js View on Github external
y: 0
    }, {
      desc: 'up arrow',
      keys: KEYS.UP,
      shiftKey: false,
      x: 0,
      y: -50
    }, {
      desc: 'down arrow',
      keys: KEYS.DOWN,
      shiftKey: false,
      x: 0,
      y: 50
    }];

    forEach(decisionTable, function(testCase) {

      forEach(testCase.keys, function(key) {

        it('should handle ' + testCase.desc, inject(function(canvas, keyboard) {

          // given
          var event = createKeyEvent(key, { shiftKey: testCase.shiftKey });

          // when
          keyboard._keyHandler(event);

          // then
          expect(canvas.viewbox().x).to.eql(testCase.x);
          expect(canvas.viewbox().y).to.eql(testCase.y);
        }));
github bpmn-io / diagram-js / lib / features / move / MovePreview.js View on Github external
previewSupport.addDragger(shape, context.dragGroup);
    });

    // cache all dragged elements / gfx
    // so that we can quickly undo their state changes later
    if (!allDraggedElements) {
      allDraggedElements = getAllDraggedElements(dragShapes);
    } else {
      allDraggedElements = flatten([
        allDraggedElements,
        getAllDraggedElements(dragShapes)
      ]);
    }

    // add dragging marker
    forEach(allDraggedElements, function(e) {
      canvas.addMarker(e, MARKER_DRAGGING);
    });

    context.allDraggedElements = allDraggedElements;

    // determine, if any of the dragged elements have different parents
    context.differentParents = haveDifferentParents(dragShapes);
  });
github bpmn-io / diagram-js / lib / features / move / MovePreview.js View on Github external
eventBus.on('shape.move.cleanup', function(event) {

    var context = event.context,
        allDraggedElements = context.allDraggedElements,
        dragGroup = context.dragGroup;


    // remove dragging marker
    forEach(allDraggedElements, function(e) {
      canvas.removeMarker(e, MARKER_DRAGGING);
    });

    if (dragGroup) {
      svgRemove(dragGroup);
    }
  });
github bpmn-io / bpmn-js / test / spec / features / copy-paste / BpmnCopyPasteSpec.js View on Github external
function expectCollection(collA, collB, contains) {
  expect(collA).to.have.length(collB.length);

  forEach(collB, function(element) {
    if (!element.parent) {
      return;
    }

    if (contains) {
      expect(collA).to.contain(element);
    } else {
      expect(collA).not.to.contain(element);
    }
  });
}
github bpmn-io / cmmn-js / lib / features / popup-menu / ReplaceMenuProvider.js View on Github external
ReplaceMenuProvider.prototype._createEntries = function(element, replaceOptions) {
  var menuEntries = [];

  var self = this;

  forEach(replaceOptions, function(definition) {
    var entry = self._createMenuEntry(definition, element);

    menuEntries.push(entry);
  });

  return menuEntries;
};
github bpmn-io / bpmn-js / lib / util / DiUtil.js View on Github external
export function hasEventDefinition(element, eventType) {
  var bo = getBusinessObject(element),
      hasEventDefinition = false;

  if (bo.eventDefinitions) {
    forEach(bo.eventDefinitions, function(event) {
      if (is(event, eventType)) {
        hasEventDefinition = true;
      }
    });
  }

  return hasEventDefinition;
}
github bpmn-io / bpmn-js / lib / features / modeling / ElementFactory.js View on Github external
function applyAttributes(element, attrs, attributeNames) {

  forEach(attributeNames, function(property) {
    if (attrs[property] !== undefined) {
      applyAttribute(element, attrs, property);
    }
  });
}
github bpmn-io / diagram-js / lib / features / bendpoints / Bendpoints.js View on Github external
function clearSegmentDraggers(gfx) {
    forEach(domQueryAll('.' + SEGMENT_DRAGGER_CLS, gfx), function(node) {
      svgRemove(node);
    });
  }
github bpmn-io / cmmn-js / lib / features / rules / CmmnRules.js View on Github external
if (!target) {
    return false;
  }

  if (isSame(source, target)) {
    return false;
  }

  var canExecute = {
    replacements: []
  };

  var self = this;

  forEach(elements, function(element) {

    if (isEntryCriterion(element) && !self.canAttachEntryCriterion(element, target, position, source)) {
      if (self.canAttachExitCriterion(element, target, position, source)) {
        canExecute.replacements.push({
          oldElementId: element.id,
          newElementType: 'cmmn:ExitCriterion'
        });
      }
    }

    if (isExitCriterion(element) && !self.canAttachExitCriterion(element, target, position, source)) {
      if (self.canAttachEntryCriterion(element, target, position, source)) {
        canExecute.replacements.push({
          oldElementId: element.id,
          newElementType: 'cmmn:EntryCriterion'
        });
github bpmn-io / bpmn-js / lib / features / snapping / BpmnSnapping.js View on Github external
}
      });

      return;
    }

    snapPoints.add('mid', mid(sibling));

    if (is(sibling, 'bpmn:Participant')) {
      snapPoints.add('top-left', topLeft(sibling));
      snapPoints.add('bottom-right', bottomRight(sibling));
    }
  });


  forEach(shape.incoming, function(c) {

    if (siblings.indexOf(c.source) === -1) {
      snapPoints.add('mid', mid(c.source));
    }

    var docking = c.waypoints[0];
    snapPoints.add(c.id + '-docking', docking.original || docking);
  });


  forEach(shape.outgoing, function(c) {

    if (siblings.indexOf(c.target) === -1) {
      snapPoints.add('mid', mid(c.target));
    }