How to use the min-dash.assign 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 WPS / domain-story-modeler / app / domain-story-modeler / modeler / DomainStoryElementFactory.js View on Github external
}
      let id = attrs.id;
      attrs.businessObject.get = function(key) {
        if (key == 'id') {
          return id;
        }
      };
      attrs.businessObject.set = function(key, value) {
        if (key == 'id') {
          assign(attrs.businessObject, { id: value });
        }
      };

      // add width and height if shape
      if ((!/:activity$/.test(type) || !/:connection$/.test(type)) && !(/:group$/.test(type) && attrs.height || attrs.width)) {
        assign(attrs, self._getCustomElementSize(type));
      }

      if (!('$instanceOf' in attrs.businessObject)) {
        // ensure we can use ModelUtil#is for type checks
        Object.defineProperty(attrs.businessObject, '$instanceOf', {
          value: function(type) {
            return this.type === type;
          }
        });
      }

      return self.baseCreate(elementType, attrs);
    }

    return self.createBpmnElement(elementType, attrs);
  };
github bpmn-io / moddle-xml / lib / read.js View on Github external
}

  var newElement = childHandler.element;

  // child handles may decide to skip elements
  // by not returning anything
  if (newElement !== undefined) {

    if (propertyDesc.isMany) {
      element.get(propertyDesc.name).push(newElement);
    } else {
      element.set(propertyDesc.name, newElement);
    }

    if (propertyDesc.isReference) {
      assign(newElement, {
        element: element
      });

      this.context.addReference(newElement);
    } else {
      // establish child -> parent relationship
      newElement.$parent = element;
    }
  }

  return childHandler;
};
github zeebe-io / zeebe-modeler / app / lib / menu / menu-builder.js View on Github external
app.mainWindow.once('devtools-closed', () => {
            app.emit('menu:update', assign({}, this.options.state, {
              devtools: false
            }));
          });
          browserWindow.closeDevTools();
github bptlab / chor-js / lib / features / label-editing / LabelEditingProvider.js View on Github external
LabelEditingProvider.prototype.activate = function(element) {
  if (is(element, 'bpmn:Message')) {
    let context = {};

    context.text = element.businessObject.name || '';
    let messageBounds = this._canvas.getAbsoluteBBox(element);
    let bandBounds = this._canvas.getAbsoluteBBox(element.parent);
    context.bounds = assign(
      pick(messageBounds, ['y', 'height']),
      pick(bandBounds, ['x', 'width'])
    );

    return context;
  }
};
github WPS / domain-story-modeler / app / domain-story-modeler / features / context-pad / DomainStoryContextPadProvider.js View on Github external
click: function(event, element) {
            let position = assign(getReplaceMenuPosition(element), {
              cursor: { x: event.x, y: event.y }
            });
            popupMenu.open(element, 'ds-replace', position);
          }
        }
github bpmn-io / cmmn-js / lib / features / modeling / behavior / ReplaceElementBehavior.js View on Github external
target = host;
    }

    if (!cmmnRules.canCreate(shape, target, source, position)) {

      var canReplace = cmmnRules.canReplace([ shape ], target, position, source);

      if (canReplace && canReplace.replacements) {

        var replacement = canReplace.replacements[0],
            definition = getDefinition(shape),
            sentry = getSentry(shape),
            elementType = replacement.newElementType,
            definitionType = replacement.newDefinitionType || (definition && definition.$type);

        var attrs = assign({}, {
          type: elementType
        });

        if (definitionType) {
          assign(attrs, {
            definitionType: definitionType
          });
        }

        if (sentry) {
          assign(attrs, {
            sentryRef: sentry
          });
        }

        context.shape = elementFactory.createShape(attrs);
github bpmn-io / cmmn-js / lib / features / rules / CmmnRules.js View on Github external
});
      }
    }

    if (isPlanFragment(target) &&
        isDiscretionaryItem(element) &&
        self.canDrop(element, target) &&
        !self.canMoveDiscretionaryItem(element, elements, target)) {

      var replacement = {
        oldElementId: element.id,
        newElementType: 'cmmn:PlanItem'
      };

      if (isPlanFragment(element)) {
        assign(replacement, {
          newDefinitionType: 'cmmn:Stage'
        });
      }

      canExecute.replacements.push(replacement);

    }

  });
github bpmn-io / cmmn-js / lib / features / modeling / cmd / UpdatePropertiesHandler.js View on Github external
function unwrapBusinessObjects(properties) {

  var unwrappedProps = assign({}, properties);

  referencePropertyNames.forEach(function(name) {
    if (name in properties) {
      unwrappedProps[name] = getBusinessObject(unwrappedProps[name]);
    }
  });

  return unwrappedProps;
}
github bpmn-io / diagram-js / lib / features / overlays / Overlays.js View on Github external
function setPosition(el, x, y) {
  assign(el.style, { left: x + 'px', top: y + 'px' });
}