mirror of
https://github.com/sartography/bpmn-js-spiffworkflow.git
synced 2025-02-23 04:58:08 +00:00
minor tweak for adding data objects to lanes/participants.
This commit is contained in:
parent
ada919e59d
commit
9e2a8f3848
@ -3,7 +3,7 @@ import {
|
|||||||
BpmnPropertiesPanelModule,
|
BpmnPropertiesPanelModule,
|
||||||
BpmnPropertiesProviderModule,
|
BpmnPropertiesProviderModule,
|
||||||
} from 'bpmn-js-properties-panel';
|
} from 'bpmn-js-properties-panel';
|
||||||
import diagramXML from '../test/spec/bpmn/basic_message.bpmn';
|
import diagramXML from '../test/spec/bpmn/empty_diagram.bpmn';
|
||||||
import spiffworkflow from './spiffworkflow';
|
import spiffworkflow from './spiffworkflow';
|
||||||
import setupFileOperations from './fileOperations';
|
import setupFileOperations from './fileOperations';
|
||||||
|
|
||||||
|
@ -29,20 +29,27 @@ export default class DataObjectInterceptor extends CommandInterceptor {
|
|||||||
* If a data object already has a parent, don't change it.
|
* If a data object already has a parent, don't change it.
|
||||||
*/
|
*/
|
||||||
bpmnUpdater.updateSemanticParent = (businessObject, parentBusinessObject) => {
|
bpmnUpdater.updateSemanticParent = (businessObject, parentBusinessObject) => {
|
||||||
|
// Special case for participant - which is a valid place to drop a data object, but it needs to be added
|
||||||
|
// to the particpant's Process (which isn't directly accessible in BPMN.io
|
||||||
|
let realParent = parentBusinessObject;
|
||||||
|
if (is(realParent, 'bpmn:Participant')) {
|
||||||
|
realParent = realParent.processRef;
|
||||||
|
}
|
||||||
|
|
||||||
if (is(businessObject, 'bpmn:DataObjectReference')) {
|
if (is(businessObject, 'bpmn:DataObjectReference')) {
|
||||||
// For data object references, always update the flowElements when a parent is provided
|
// For data object references, always update the flowElements when a parent is provided
|
||||||
// The parent could be null if it's being deleted, and I could probably handle that here instead of
|
// The parent could be null if it's being deleted, and I could probably handle that here instead of
|
||||||
// when the shape is deleted, but not interested in refactoring at the moment.
|
// when the shape is deleted, but not interested in refactoring at the moment.
|
||||||
if (parentBusinessObject != null) {
|
if (realParent != null) {
|
||||||
let flowElements = parentBusinessObject.get('flowElements');
|
const flowElements = realParent.get('flowElements');
|
||||||
flowElements.push(businessObject);
|
flowElements.push(businessObject);
|
||||||
}
|
}
|
||||||
} else if (is(businessObject, 'bpmn:DataObject')) {
|
} else if (is(businessObject, 'bpmn:DataObject')) {
|
||||||
// For data objects, only update the flowElements for new data objects, and set the parent so it doesn't get moved.
|
// For data objects, only update the flowElements for new data objects, and set the parent so it doesn't get moved.
|
||||||
if (typeof(businessObject.$parent) === 'undefined') {
|
if (typeof(businessObject.$parent) === 'undefined') {
|
||||||
let flowElements = parentBusinessObject.get('flowElements');
|
const flowElements = realParent.get('flowElements');
|
||||||
flowElements.push(businessObject);
|
flowElements.push(businessObject);
|
||||||
businessObject.$parent = parentBusinessObject;
|
businessObject.$parent = realParent;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
bpmnUpdater.__proto__.updateSemanticParent.call(this, businessObject, parentBusinessObject);
|
bpmnUpdater.__proto__.updateSemanticParent.call(this, businessObject, parentBusinessObject);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user