fix(modeling): fix Modeling types

This commit is contained in:
Philipp
2023-04-06 09:09:40 +02:00
committed by Philipp Fromme
parent adea40e78d
commit bd1fa49de0
4 changed files with 97 additions and 42 deletions

View File

@ -20,22 +20,29 @@ import UpdateLabelHandler from '../label-editing/cmd/UpdateLabelHandler';
* @typedef {import('./ElementFactory').default} ElementFactory
* @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
*
* @typedef {import('diagram-js/lib/model').Element} Element
* @typedef {import('diagram-js/lib/model').Root} Root
* @typedef {import('diagram-js/lib/model').Shape} Shape
* @typedef {import('diagram-js/lib/features/modeling/Modeling').ModelingHints} ModelingHints
*
* @typedef {import('../../model/Types').BpmnConnection} BpmnConnection
* @typedef {import('../../model/Types').BpmnElement} BpmnElement
* @typedef {import('../../model/Types').BpmnLabel} BpmnLabel
* @typedef {import('../../model/Types').BpmnRoot} BpmnRoot
* @typedef {import('../../model/Types').BpmnShape} BpmnShape
* @typedef {import('../../model/Types').ModdleElement} ModdleElement
*
* @typedef {import('diagram-js/lib/util/Types').Rect} Rect
*
* @typedef {import('../../BaseViewer').ModdleElement} ModdleElement
*
* @typedef {import('./Modeling').UpdateLabelHints} UpdateLabelHints
*
* @typedef {import('../../util/Types').Colors} Colors
*
* @typedef { {
* removeShape?: boolean;
* } } UpdateLabelHints
*/
/**
* The BPMN 2.0 modeling entry point.
*
* @extends {BaseModeling<BpmnConnection, BpmnElement, BpmnLabel, BpmnRoot, BpmnShape>}
*
* @param {EventBus} eventBus
* @param {ElementFactory} elementFactory
* @param {CommandStack} commandStack
@ -83,7 +90,7 @@ Modeling.prototype.getHandlers = function() {
/**
* Update an element's label.
*
* @param {Element} element The element.
* @param {BpmnElement} element The element.
* @param {string} newLabel The new label.
* @param {Rect} [newBounds] The optional bounds of the label.
* @param {UpdateLabelHints} [hints] The optional hints.
@ -97,7 +104,14 @@ Modeling.prototype.updateLabel = function(element, newLabel, newBounds, hints) {
});
};
/**
* @param {BpmnElement} source
* @param {BpmnElement} target
* @param {Partial<BpmnConnection>} attrs
* @param {ModelingHints} [hints]
*
* @returns {BpmnConnection}
*/
Modeling.prototype.connect = function(source, target, attrs, hints) {
var bpmnRules = this._bpmnRules;
@ -116,7 +130,7 @@ Modeling.prototype.connect = function(source, target, attrs, hints) {
/**
* Update a model element's properties.
*
* @param {Element} element The element.
* @param {BpmnElement} element The element.
* @param {ModdleElement} moddleElement The model element.
* @param {Object} properties The updated properties.
*/
@ -131,7 +145,7 @@ Modeling.prototype.updateModdleProperties = function(element, moddleElement, pro
/**
* Update an element's properties.
*
* @param {Element} element The element.
* @param {BpmnElement} element The element.
* @param {Object} properties The updated properties.
*/
Modeling.prototype.updateProperties = function(element, properties) {
@ -144,7 +158,7 @@ Modeling.prototype.updateProperties = function(element, properties) {
/**
* Resize a lane.
*
* @param {Shape} laneShape The lane.
* @param {BpmnShape} laneShape The lane.
* @param {Rect} newBounds The new bounds of the lane.
* @param {boolean} [balanced] Wether to resize neighboring lanes.
*/
@ -159,10 +173,10 @@ Modeling.prototype.resizeLane = function(laneShape, newBounds, balanced) {
/**
* Add a lane.
*
* @param {Shape} targetLaneShape The shape to add the lane to.
* @param {BpmnShape} targetLaneShape The shape to add the lane to.
* @param {string} location The location.
*
* @return {Shape} The added lane.
* @return {BpmnShape} The added lane.
*/
Modeling.prototype.addLane = function(targetLaneShape, location) {
var context = {
@ -178,7 +192,7 @@ Modeling.prototype.addLane = function(targetLaneShape, location) {
/**
* Split a lane.
*
* @param {Shape} targetLane The lane to split.
* @param {BpmnShape} targetLane The lane to split.
* @param {number} count The number of lanes to split the lane into. Must not
* exceed the number of existing lanes.
*/
@ -192,7 +206,7 @@ Modeling.prototype.splitLane = function(targetLane, count) {
/**
* Turn a process into a collaboration.
*
* @return {Root} The root of the collaboration.
* @return {BpmnRoot} The root of the collaboration.
*/
Modeling.prototype.makeCollaboration = function() {
@ -212,7 +226,7 @@ Modeling.prototype.makeCollaboration = function() {
/**
* Transform a collaboration into a process.
*
* @return {Root} The root of the process.
* @return {BpmnRoot} The root of the process.
*/
Modeling.prototype.makeProcess = function() {
@ -230,8 +244,8 @@ Modeling.prototype.makeProcess = function() {
/**
* Update the referenced lanes of each flow node.
*
* @param {Shape[]} flowNodeShapes The flow nodes to update.
* @param {Shape[]} laneShapes The lanes.
* @param {BpmnShape[]} flowNodeShapes The flow nodes to update.
* @param {BpmnShape[]} laneShapes The lanes.
*/
Modeling.prototype.updateLaneRefs = function(flowNodeShapes, laneShapes) {
@ -271,7 +285,7 @@ Modeling.prototype.unclaimId = function(id, moddleElement) {
/**
* Set the color(s) of one or many elements.
*
* @param {Base[]} elements The elements to set the color(s) for.
* @param {BpmnElement[]} elements The elements to set the color(s) for.
* @param {Colors} colors The color(s) to set.
*/
Modeling.prototype.setColor = function(elements, colors) {