mirror of
https://github.com/bpmn-io/bpmn-js.git
synced 2025-08-26 04:32:44 +08:00
fix(ElementFactory): fix @extend
This commit is contained in:
@ -50,7 +50,14 @@ import {
|
||||
*/
|
||||
|
||||
/**
|
||||
* A BPMN-aware factory for diagram elements.
|
||||
* A BPMN-specific element factory.
|
||||
*
|
||||
* @template {BpmnConnection} [T=BpmnConnection]
|
||||
* @template {BpmnLabel} [U=BpmnLabel]
|
||||
* @template {BpmnRoot} [V=BpmnRoot]
|
||||
* @template {BpmnShape} [W=BpmnShape]
|
||||
*
|
||||
* @extends {BaseElementFactory<T, U, V, W>}
|
||||
*
|
||||
* @param {BpmnFactory} bpmnFactory
|
||||
* @param {Moddle} moddle
|
||||
@ -80,7 +87,7 @@ ElementFactory.prototype._baseCreate = BaseElementFactory.prototype.create;
|
||||
* @overlord
|
||||
* @param {'root'} type
|
||||
* @param {Partial<BpmnRoot> & Partial<BpmnAttributes>} [attrs]
|
||||
* @return {BpmnRoot}
|
||||
* @return {V}
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -89,7 +96,7 @@ ElementFactory.prototype._baseCreate = BaseElementFactory.prototype.create;
|
||||
* @overlord
|
||||
* @param {'shape'} type
|
||||
* @param {Partial<BpmnShape> & Partial<BpmnAttributes>} [attrs]
|
||||
* @return {BpmnShape}
|
||||
* @return {W}
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -98,7 +105,7 @@ ElementFactory.prototype._baseCreate = BaseElementFactory.prototype.create;
|
||||
* @overlord
|
||||
* @param {'connection'} type
|
||||
* @param {Partial<BpmnConnection> & Partial<BpmnAttributes>} [attrs]
|
||||
* @return {BpmnConnection}
|
||||
* @return {T}
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -106,7 +113,7 @@ ElementFactory.prototype._baseCreate = BaseElementFactory.prototype.create;
|
||||
*
|
||||
* @param {'label'} type
|
||||
* @param {Partial<BpmnLabel> & Partial<BpmnAttributes>} [attrs]
|
||||
* @return {BpmnLabel}
|
||||
* @return {U}
|
||||
*/
|
||||
ElementFactory.prototype.create = function(elementType, attrs) {
|
||||
|
||||
@ -127,7 +134,7 @@ ElementFactory.prototype.create = function(elementType, attrs) {
|
||||
* @overlord
|
||||
* @param {'root'} elementType
|
||||
* @param {Partial<BpmnRoot> & Partial<BpmnAttributes>} [attrs]
|
||||
* @return {BpmnRoot}
|
||||
* @return {V}
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -136,7 +143,7 @@ ElementFactory.prototype.create = function(elementType, attrs) {
|
||||
* @overlord
|
||||
* @param {'shape'} elementType
|
||||
* @param {Partial<BpmnShape> & Partial<BpmnAttributes>} [attrs]
|
||||
* @return {BpmnShape}
|
||||
* @return {W}
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -144,7 +151,7 @@ ElementFactory.prototype.create = function(elementType, attrs) {
|
||||
*
|
||||
* @param {'connection'} elementType
|
||||
* @param {Partial<BpmnConnection> & Partial<BpmnAttributes>} [attrs]
|
||||
* @return {BpmnConnection}
|
||||
* @return {T}
|
||||
*/
|
||||
ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
|
||||
var size,
|
||||
@ -316,10 +323,10 @@ ElementFactory.prototype.getDefaultSize = function(element, di) {
|
||||
/**
|
||||
* Create participant.
|
||||
*
|
||||
* @param {boolean|Partial<BpmnShape> & Partial<BpmnAttributes>} [attrs] Attributes or whether the participant is
|
||||
* expanded.
|
||||
* @param {boolean|Partial<BpmnShape> & Partial<BpmnAttributes>} [attrs]
|
||||
* Attributes or whether the participant is expanded.
|
||||
*
|
||||
* @return {BpmnShape} The created participant.
|
||||
* @return {W} The created participant.
|
||||
*/
|
||||
ElementFactory.prototype.createParticipantShape = function(attrs) {
|
||||
|
||||
@ -341,10 +348,10 @@ ElementFactory.prototype.createParticipantShape = function(attrs) {
|
||||
// helpers //////////////////////
|
||||
|
||||
/**
|
||||
* Apply attributes from a map to the given element,
|
||||
* remove attribute from the map on application.
|
||||
* Apply attributes from a map to the given element, remove attribute from the
|
||||
* map on application.
|
||||
*
|
||||
* @param {Element} element
|
||||
* @param {BpmnElement} element
|
||||
* @param {Object} attrs (in/out map of attributes)
|
||||
* @param {string[]} attributeNames name of attributes to apply
|
||||
*
|
||||
@ -360,10 +367,9 @@ function applyAttributes(element, attrs, attributeNames) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply named property to element and drain it from the attrs
|
||||
* collection.
|
||||
* Apply named property to element and drain it from the attrs collection.
|
||||
*
|
||||
* @param {Element} element
|
||||
* @param {BpmnElement} element
|
||||
* @param {Object} attrs (in/out map of attributes)
|
||||
* @param {string} attributeName to apply
|
||||
*
|
||||
@ -379,7 +385,11 @@ function applyAttribute(element, attrs, attributeName) {
|
||||
return omit(attrs, [ attributeName ]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param {BpmnElement} element
|
||||
*
|
||||
* @return {boolean}
|
||||
*/
|
||||
function isModdleDi(element) {
|
||||
return isAny(element, [
|
||||
'bpmndi:BPMNShape',
|
||||
|
Reference in New Issue
Block a user