Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
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);
};
}
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;
};
app.mainWindow.once('devtools-closed', () => {
app.emit('menu:update', assign({}, this.options.state, {
devtools: false
}));
});
browserWindow.closeDevTools();
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;
}
};
click: function(event, element) {
let position = assign(getReplaceMenuPosition(element), {
cursor: { x: event.x, y: event.y }
});
popupMenu.open(element, 'ds-replace', position);
}
}
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);
});
}
}
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);
}
});
function unwrapBusinessObjects(properties) {
var unwrappedProps = assign({}, properties);
referencePropertyNames.forEach(function(name) {
if (name in properties) {
unwrappedProps[name] = getBusinessObject(unwrappedProps[name]);
}
});
return unwrappedProps;
}
function copy(obj) {
return assign({}, obj);
}
function setPosition(el, x, y) {
assign(el.style, { left: x + 'px', top: y + 'px' });
}