we can delete messages w/ burnettk cullerton

This commit is contained in:
jasquat 2022-08-24 12:22:41 -04:00
parent feb1d64a5a
commit 51aa461a04

View File

@ -1,5 +1,6 @@
import { useService } from 'bpmn-js-properties-panel';
import { TextFieldEntry } from '@bpmn-io/properties-panel';
import { without } from 'min-dash';
import {
findCorrelationKeys,
getRoot,
@ -28,6 +29,12 @@ export function MessageArray(props) {
translate,
}),
autoFocusEntry: id,
remove: removeFactory({
element,
messageElement,
commandStack,
moddle,
}),
};
});
@ -54,6 +61,27 @@ export function MessageArray(props) {
return { items, add };
}
function removeFactory(props) {
const { element, messageElement, moddle, commandStack } = props;
return function (event) {
event.stopPropagation();
const rootElement = getRoot(element.businessObject);
const { rootElements } = rootElement;
const messageElementIndex = rootElements.indexOf(messageElement);
if (messageElementIndex > -1) {
rootElements.splice(messageElementIndex, 1);
}
commandStack.execute('element.updateProperties', {
element,
moddleElement: moddle,
properties: {
messages: rootElements,
},
});
};
}
function messageGroup(props) {
const { messageElement, commandStack, translate } = props;
const id = `message-${messageElement.name}`;