How to use the min-dash.matchPattern 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 / lib / features / modeling / behavior / ReplaceConnectionBehavior.js View on Github external
this.postExecuted('element.updateProperties', function(event) {
    var context = event.context,
        properties = context.properties,
        element = context.element,
        businessObject = element.businessObject,
        connection;

    // remove condition on change to default
    if (properties.default) {
      connection = find(
        element.outgoing,
        matchPattern({ id: element.businessObject.default.id })
      );

      if (connection) {
        modeling.updateProperties(connection, { conditionExpression: undefined });
      }
    }

    // remove default from source on change to conditional
    if (properties.conditionExpression && businessObject.sourceRef.default === businessObject) {
      modeling.updateProperties(element.source, { default: undefined });
    }
  });
}
github bpmn-io / bpmn-moddle / test / spec / adapter / cmof / builder.js View on Github external
function alter(elementName, extension) {

    var elementParts = elementName.split('#');

    var elementsById = desc.byId;

    var element = elementsById[elementParts[0]];

    if (!element) {
      throw new Error('[transform] element <' + elementParts[0] + '> does not exist');
    }

    if (elementParts[1]) {
      var property = find(element.properties, matchPattern({
        name: elementParts[1]
      }));

      if (!property) {
        throw new Error('[transform] property <' + elementParts[0] + '#' + elementParts[1] + '> does not exist');
      }

      if (isFunction(extension)) {
        extension.call(element, property);
      } else {
        assign(property, extension);
      }
    } else {
      if (isFunction(extension)) {
        extension.call(element, element);
      } else {
github bpmn-io / dmn-js / packages / dmn-js-drd / src / import / DrdTreeWalker.js View on Github external
function deferConnection(semantic, property) {
      var id = parseID(property),
          edge = find(edges, matchPattern({ source: id }));

      if (edge) {
        deferred.push(function() {
          visit(semantic, edge);
        });
      }
    }
github nikku / camunda-playground / packages / client / src / components / viewer / features / ProcessInstance.js View on Github external
function isFinished(activity) {
      return find(processInstance.trace, matchPattern({ activityId: activity.id })).endTime !== null;
    }
github bpmn-io / diagram-js / lib / features / move / MovePreview.js View on Github external
var filteredElements = filter(elements, function(element) {

    if (!isConnection(element)) {
      return true;
    } else {

      return (
        find(elements, matchPattern({ id: element.source.id })) &&
        find(elements, matchPattern({ id: element.target.id }))
      );
    }
  });
github nikku / camunda-playground / packages / client / src / components / viewer / features / ProcessInstance.js View on Github external
const outgoing = filter(activity.outgoing, connection => {
        const found = find(activities, matchPattern({ id: connection.target.id }));

        const finished = isFinished(activity);

        return found && finished;
      });
github bpmn-io / diagram-js / lib / features / copy-paste / CopyPaste.js View on Github external
CopyPaste.prototype.hasRelations = function(element, elements) {
  var labelTarget,
      source,
      target;

  if (isConnection(element)) {
    source = find(elements, matchPattern({ id: element.source.id }));
    target = find(elements, matchPattern({ id: element.target.id }));

    if (!source || !target) {
      return false;
    }
  }

  if (isLabel(element)) {
    labelTarget = find(elements, matchPattern({ id: element.labelTarget.id }));

    if (!labelTarget) {
      return false;
    }
  }

  return true;
};
github bpmn-io / diagram-js / lib / features / auto-resize / AutoResize.js View on Github external
elements = elements.filter(function(element) {
          return find(autoResize, matchPattern({ id: element.id }));
        });
      }
github bpmn-io / diagram-js / lib / features / popup-menu / PopupMenu.js View on Github external
PopupMenu.prototype._getEntry = function(entryId) {

  var search = matchPattern({ id: entryId });

  var entry = find(this._current.entries, search) || find(this._current.headerEntries, search);

  if (!entry) {
    throw new Error('entry not found');
  }

  return entry;
};