Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property Panel Undo/Redo Bugfix #413

Merged
merged 5 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
314 changes: 228 additions & 86 deletions src/helper-modules/bpmn-helper/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,92 +1,234 @@
declare const _exports: {
ensureExtensionElements: typeof proceedExtensions.ensureExtensionElements;
removeEmptyExtensionElements: typeof proceedExtensions.removeEmptyExtensionElements;
ensureContainerElement: typeof proceedExtensions.ensureContainerElement;
removeEmptyContainerElement: typeof proceedExtensions.removeEmptyContainerElement;
setMetaData: typeof proceedExtensions.setMetaData;
setProceedElement: typeof proceedExtensions.setProceedElement;
getExporterName: typeof proceedConstants.getExporterName;
getExporterVersion: typeof proceedConstants.getExporterVersion;
generateBpmnId: typeof proceedConstants.generateBpmnId;
generateDefinitionsId: typeof proceedConstants.generateDefinitionsId;
generateProcessId: typeof proceedConstants.generateProcessId;
generateUserTaskFileName: typeof proceedConstants.generateUserTaskFileName;
generateScriptTaskFileName: typeof proceedConstants.generateScriptTaskFileName;
getUserTaskImplementationString: typeof proceedConstants.getUserTaskImplementationString;
generateTargetNamespace: typeof proceedConstants.generateTargetNamespace;
initXml: typeof proceedConstants.initXml;
validateCalledProcess: typeof validators.validateCalledProcess;
setDefinitionsId: typeof setters.setDefinitionsId;
setDefinitionsName: typeof setters.setDefinitionsName;
setDefinitionsVersionInformation: typeof setters.setDefinitionsVersionInformation;
setProcessId: typeof setters.setProcessId;
setTemplateId: typeof setters.setTemplateId;
setTargetNamespace: typeof setters.setTargetNamespace;
setStandardDefinitions: typeof setters.setStandardDefinitions;
setDeploymentMethod: typeof setters.setDeploymentMethod;
setMachineInfo: typeof setters.setMachineInfo;
setUserTaskData: typeof setters.setUserTaskData;
addConstraintsToElementById: typeof setters.addConstraintsToElementById;
addCallActivityReference: typeof setters.addCallActivityReference;
removeCallActivityReference: typeof setters.removeCallActivityReference;
removeUnusedCallActivityReferences: typeof setters.removeUnusedCallActivityReferences;
removeColorFromAllElements: typeof setters.removeColorFromAllElements;
addDocumentation: typeof setters.addDocumentation;
addDocumentationToProcessObject: typeof setters.addDocumentationToProcessObject;
updatePerformersOnElement: typeof setters.updatePerformersOnElement;
updatePerformersOnElementById: typeof setters.updatePerformersOnElementById;
getDefinitionsId: typeof getters.getDefinitionsId;
getOriginalDefinitionsId: typeof getters.getOriginalDefinitionsId;
getDefinitionsName: typeof getters.getDefinitionsName;
getDefinitionsInfos: typeof getters.getDefinitionsInfos;
getImports: typeof getters.getImports;
getDefinitionsVersionInformation: typeof getters.getDefinitionsVersionInformation;
getProcessIds: typeof getters.getProcessIds;
getDeploymentMethod: typeof getters.getDeploymentMethod;
getProcessConstraints: typeof getters.getProcessConstraints;
getProcessDocumentation: typeof getters.getProcessDocumentation;
getProcessDocumentationByObject: typeof getters.getProcessDocumentationByObject;
getUserTaskFileNameMapping: typeof getters.getUserTaskFileNameMapping;
getAllUserTaskFileNamesAndUserTaskIdsMapping: typeof getters.getAllUserTaskFileNamesAndUserTaskIdsMapping;
getSubprocess: typeof getters.getSubprocess;
getSubprocessContent: typeof getters.getSubprocessContent;
getTargetDefinitionsAndProcessIdForCallActivityByObject: typeof getters.getTargetDefinitionsAndProcessIdForCallActivityByObject;
getDefinitionsAndProcessIdForEveryCallActivity: typeof getters.getDefinitionsAndProcessIdForEveryCallActivity;
getStartEvents: typeof getters.getStartEvents;
getAllBpmnFlowElements: typeof getters.getAllBpmnFlowElements;
getAllBpmnFlowNodeIds: typeof getters.getAllBpmnFlowNodeIds;
getAllBpmnFlowElementIds: typeof getters.getAllBpmnFlowElementIds;
getChildrenFlowElements: typeof getters.getChildrenFlowElements;
getElementMachineMapping: typeof getters.getElementMachineMapping;
getTaskConstraintMapping: typeof getters.getTaskConstraintMapping;
getIdentifyingInfos: typeof getters.getIdentifyingInfos;
getRootFromElement: typeof getters.getRootFromElement;
getMetaDataFromElement: typeof getters.getMetaDataFromElement;
getMetaData: typeof getters.getMetaData;
getMilestonesFromElement: typeof getters.getMilestonesFromElement;
getMilestonesFromElementById: typeof getters.getMilestonesFromElementById;
getResourcesFromElement: typeof getters.getResourcesFromElement;
getLocationsFromElement: typeof getters.getLocationsFromElement;
getPerformersFromElement: typeof getters.getPerformersFromElement;
getPerformersFromElementById: typeof getters.getPerformersFromElementById;
parseISODuration: typeof getters.parseISODuration;
convertISODurationToMiliseconds: typeof getters.convertISODurationToMiliseconds;
ensureExtensionElements(element: object): object;
removeEmptyExtensionElements(element: any): void;
ensureContainerElement(element: object, containerType: string): object;
removeEmptyContainerElement(element: any, containerType: any, containerElement: any): void;
setMetaData(bpmn: string | object, elId: string, metaValues: object): Promise<string | object>;
setProceedElement(
element: any,
proceedElementType: any,
value: any,
attributes?: {},
oldAttributes?: {},
): {};
getExporterName(): string;
getExporterVersion(): string;
generateBpmnId(prefix?: string): string;
generateDefinitionsId(): string;
generateProcessId(): string;
generateUserTaskFileName(): string;
generateScriptTaskFileName(): string;
getUserTaskImplementationString(): string;
generateTargetNamespace(id: any): string;
initXml(processId?: any, startEventId?: string): string;
validateCalledProcess(xml: string, processId: string): Promise<boolean>;
setDefinitionsId(bpmn: string | object, id: string): Promise<string | object>;
setDefinitionsName(bpmn: string | object, name: string): Promise<string | object>;
setDefinitionsVersionInformation(
bpmn: string | object,
{
versionId,
versionName,
versionDescription,
versionBasedOn,
versionCreatedOn,
}: {
versionId?: string;
versionName?: string;
versionDescription?: string;
versionBasedOn?: string;
versionCreatedOn?: string;
},
): Promise<string | object>;
setProcessId(bpmn: string, id: string): Promise<string | object>;
setTemplateId(bpmn: string, id: string): Promise<string | object>;
setTargetNamespace(bpmn: string | object, id: string): Promise<string | object>;
setStandardDefinitions(
bpmn: string | object,
exporterName: string,
exporterVersion: string,
): Promise<string | object>;
setDeploymentMethod(bpmn: string | object, method: string): Promise<string | object>;
setMachineInfo(
bpmn: string | object,
machineInfo: {
[elementId: string]: {
machineAddress?: string;
machineId?: string;
};
},
): Promise<string | object>;
setUserTaskData(
bpmn: string | object,
userTaskId: string,
newFileName: string,
newImplementation?: string,
): Promise<string | object>;
addConstraintsToElementById(
bpmn: string | object,
elementId: string,
constraints: object,
): Promise<string | object>;
addCallActivityReference(
bpmn: string | object,
callActivityId: string,
calledBpmn: string,
calledProcessLocation: string,
): Promise<string | object>;
removeCallActivityReference(
bpmn: string | object,
callActivityId: string,
): Promise<string | object>;
removeUnusedCallActivityReferences(bpmn: string | object): Promise<string | object>;
removeColorFromAllElements(bpmn: string | object): Promise<string | object>;
addDocumentation(bpmn: string | object, description?: string): Promise<string | object>;
addDocumentationToProcessObject(processObj: object, description?: string): void;
updatePerformersOnElement(element: object, performers: any[]): Promise<void>;
updatePerformersOnElementById(
bpmn: string | object,
elementId: string,
performers: any[],
): Promise<any>;
getDefinitionsId(bpmn: string | object): Promise<string>;
getOriginalDefinitionsId(bpmn: string | object): Promise<string>;
getDefinitionsName(bpmn: string | object): Promise<string>;
getDefinitionsInfos(bpmn: string | object): Promise<getters.DefinitionsInfos>;
getImports(bpmn: string | object): Promise<object[]>;
getDefinitionsVersionInformation(bpmn: string | object): Promise<{
versionId?: string;
name?: string;
description?: string;
versionBasedOn?: string;
versionCreatedOn: string;
}>;
getProcessIds(bpmn: string | object): Promise<string[]>;
getDeploymentMethod(bpmn: string | object): Promise<string>;
getProcessConstraints(bpmn: string | object): Promise<{
hardConstraints: any[];
softConstraints: any[];
}>;
getProcessDocumentation(bpmn: string | object): Promise<string>;
getProcessDocumentationByObject(processObject: object): string;
getUserTaskFileNameMapping(bpmn: string | object): Promise<{
[userTaskId: string]: {
fileName?: string;
implementation?: string;
};
}>;
getAllUserTaskFileNamesAndUserTaskIdsMapping(bpmn: string | object): Promise<{
[userTaskFileName: string]: string[];
}>;
getSubprocess(bpmn: string | object, subprocessId: string): Promise<string>;
getSubprocessContent(bpmn: string, subprocessId: string): Promise<string>;
getTargetDefinitionsAndProcessIdForCallActivityByObject(
bpmnObj: object,
callActivityId: string,
): {
definitionId: string;
processId: string;
versionId: string;
};
getDefinitionsAndProcessIdForEveryCallActivity(
bpmn: string | object,
dontThrow?: boolean,
): Promise<{
[callActivityId: string]: {
definitionId: string;
processId: string;
versionId: string;
};
}>;
getStartEvents(bpmn: string | object): Promise<string[]>;
getAllBpmnFlowElements(bpmn: string | object): Promise<object[]>;
getAllBpmnFlowNodeIds(bpmn: string | object): Promise<string[]>;
getAllBpmnFlowElementIds(bpmn: string | object): Promise<string[]>;
getChildrenFlowElements(bpmn: string | object, elementId: any): Promise<object[]>;
getElementMachineMapping(bpmn: string | object): Promise<{
[flowNodeId: string]: {
machineAddress?: string;
machineId?: string;
};
}>;
getTaskConstraintMapping(bpmn: string | object): Promise<{
[bpmnElementIds: string]: {
hardConstraints: any[];
softConstraints: any[];
};
}>;
getIdentifyingInfos(bpmn: string | object): Promise<{
id: string;
originalId?: string;
processIds: string[];
name: string;
description: string;
}>;
getRootFromElement(businessObject: object): object;
getMetaDataFromElement(element: object): {
[key: string]: any;
};
getMetaData(
bpmn: string | object,
elId: string,
): Promise<{
[key: string]: any;
}>;
getMilestonesFromElement(element: object): {
id: string;
name: string;
description?: string;
}[];
getMilestonesFromElementById(
bpmn: string | object,
elementId: string,
): {
id: string;
name: string;
description?: string;
}[];
getResourcesFromElement(element: object): {
consumableMaterial: getters.ResourceInfos[];
tool: getters.ResourceInfos[];
inspectionInstrument: getters.ResourceInfos[];
};
getLocationsFromElement(element: object): {
company: getters.CompanyInfos[];
factory: getters.FactoryInfos[];
building: getters.BuildingInfos[];
area: getters.AreaInfos[];
workingPlace: getters.WorkingPlaceInfos[];
};
getPerformersFromElement(element: object): any[];
getPerformersFromElementById(bpmn: string | object, elementId: string): any[];
parseISODuration(isoDuration: string): {
years: number;
months: number;
days: number;
hours: number;
minutes: number;
seconds: number;
};
convertISODurationToMiliseconds(isoDuration: string): number;
ensureCorrectProceedNamespace(xml: string): string;
toBpmnObject(xml: string, typename?: string): Promise<object>;
toBpmnXml(obj: any): Promise<string>;
deepCopyElementById(bpmn: string | object, elemId: any): Promise<object>;
getChildren(travObj: object): any[];
getElementsByTagName(travObj: object, tagname: string): any[];
getAllElements(travObj: object): any[];
getElementById(travObj: object, id: string): object;
getElementDI(element: object, definitions?: object): any;
manipulateElementById(
bpmn: string | object,
id: string,
manipFunc: util.manipulationFunction,
): Promise<string | object>;
manipulateElementsByTagName(
bpmn: string | object,
tagName: string,
manipFunc: util.manipulationFunction,
): Promise<string | object>;
moddle: any;
ensureCorrectProceedNamespace: typeof util.ensureCorrectProceedNamespace;
toBpmnObject: typeof util.toBpmnObject;
toBpmnXml: typeof util.toBpmnXml;
getChildren: typeof util.getChildren;
getElementsByTagName: typeof util.getElementsByTagName;
getAllElements: typeof util.getAllElements;
getElementById: typeof util.getElementById;
getElementDI: typeof util.getElementDI;
manipulateElementById: typeof util.manipulateElementById;
manipulateElementsByTagName: typeof util.manipulateElementsByTagName;
};
export = _exports;
import proceedExtensions = require('./src/proceedExtensions');
import proceedConstants = require('./src/PROCEED-CONSTANTS.js');
import validators = require('./src/validators.js');
import setters = require('./src/setters.js');
import getters = require('./src/getters.js');
import util = require('./src/util.js');
11 changes: 11 additions & 0 deletions src/helper-modules/bpmn-helper/src/util.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ export function toBpmnObject(xml: string, typename?: string): Promise<object>;
* @returns {Promise<string>} a xml representation of the given object
*/
export function toBpmnXml(obj: any): Promise<string>;
/**
* Creates a deep copy of an element
*
* @param {string|object} bpmn traversable object representation or bpmn XML
* @param {string} id the id of the element to be copied
* @returns {Promise<object|undefined>} - returns the copied object or undefined when no matching object was found
*/
export function deepCopyElementById(
bpmn: string | object,
elemId: any,
): Promise<object | undefined>;
/**
* Finds all kinds of childnodes in a given node
*
Expand Down
17 changes: 17 additions & 0 deletions src/helper-modules/bpmn-helper/src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,22 @@ async function toBpmnXml(obj) {
return xml;
}

/**
* Creates a deep copy of an element
*
* @param {string|object} bpmn traversable object representation or bpmn XML
* @param {string} id the id of the element to be copied
* @returns {Promise<object|undefined>} - returns the copied object or undefined when no matching object was found
*/
async function deepCopyElementById(bpmn, elemId) {
const bpmnObj =
typeof bpmn === 'string'
? await toBpmnObject(bpmn)
: await toBpmnXml(bpmn).then((bpmnXml) => toBpmnObject(bpmnXml));

return getElementById(bpmnObj, elemId);
}

/**
* Finds all kinds of childnodes in a given node
*
Expand Down Expand Up @@ -195,6 +211,7 @@ module.exports = {
ensureCorrectProceedNamespace,
toBpmnObject,
toBpmnXml,
deepCopyElementById,
getChildren,
getElementsByTagName,
getAllElements,
Expand Down
Loading
Loading