OnChange Events
This commit is contained in:
parent
e355780619
commit
84d6e20ff8
|
@ -87,6 +87,7 @@ export default class DataObjectInterceptor extends CommandInterceptor {
|
|||
dataObject = existingDataObjects[0];
|
||||
} else {
|
||||
dataObject = bpmnFactory.create('bpmn:DataObject');
|
||||
dataObject.name = 'DataObject Name';
|
||||
}
|
||||
// set the reference to the DataObject
|
||||
shape.businessObject.dataObjectRef = dataObject;
|
||||
|
@ -107,7 +108,7 @@ export default class DataObjectInterceptor extends CommandInterceptor {
|
|||
element: shape,
|
||||
moddleElement: shape.businessObject,
|
||||
properties: {
|
||||
name: idToHumanReadableName(shape.businessObject.dataObjectRef.id),
|
||||
name: idToHumanReadableName(shape.businessObject.dataObjectRef.name),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ export function DataObjectArray(props) {
|
|||
const newDataObject = moddle.create('bpmn:DataObject');
|
||||
const newElements = process.get('flowElements');
|
||||
newDataObject.id = moddle.ids.nextPrefixed('DataObject_');
|
||||
newDataObject.name = 'DataObject Name';
|
||||
newDataObject.$parent = process;
|
||||
newElements.push(newDataObject);
|
||||
commandStack.execute('element.updateModdleProperties', {
|
||||
|
@ -153,11 +154,14 @@ function DataObjectNameTextField(props) {
|
|||
// Update references name
|
||||
const references = findDataObjectReferenceShapes(element.children, dataObject.id);
|
||||
for (const ref of references) {
|
||||
const stateName = ref.businessObject.dataState && ref.businessObject.dataState.name ? ref.businessObject.dataState.name : '';
|
||||
const newName = stateName ? `${value} [${stateName}]` : value;
|
||||
|
||||
commandStack.execute('element.updateProperties', {
|
||||
element: ref,
|
||||
moddleElement: ref.businessObject,
|
||||
properties: {
|
||||
name: idToHumanReadableName(value),
|
||||
name: newName,
|
||||
},
|
||||
changed: [ref],
|
||||
});
|
||||
|
|
|
@ -32,20 +32,26 @@ export function DataObjectSelect(props) {
|
|||
const setValue = value => {
|
||||
const businessObject = element.businessObject;
|
||||
const dataObjects = findDataObjects(businessObject.$parent)
|
||||
for (const flowElem of dataObjects) {
|
||||
if (flowElem.$type === 'bpmn:DataObject' && flowElem.id === value) {
|
||||
for (const dataObject of dataObjects) {
|
||||
if (dataObject.$type === 'bpmn:DataObject' && dataObject.id === value) {
|
||||
|
||||
commandStack.execute('element.updateModdleProperties', {
|
||||
element,
|
||||
element: element,
|
||||
moddleElement: businessObject,
|
||||
properties: {
|
||||
dataObjectRef: flowElem
|
||||
dataObjectRef: dataObject
|
||||
}
|
||||
});
|
||||
|
||||
// Construct the new name by : the dataObject name and the current state
|
||||
const stateName = businessObject.dataState && businessObject.dataState.name ? businessObject.dataState.name : '';
|
||||
const newName = stateName ? `${dataObject.name} [${stateName}]` : dataObject.name;
|
||||
|
||||
// Update the name property of the DataObjectReference
|
||||
commandStack.execute('element.updateProperties', {
|
||||
element,
|
||||
moddleElement: businessObject,
|
||||
element: element,
|
||||
properties: {
|
||||
'name': idToHumanReadableName(flowElem.id)
|
||||
name: newName
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue