import { assign, forEach, has, isDefined, isObject, omit } from 'min-dash'; import inherits from 'inherits-browser'; import { getBusinessObject, getDi, is } from '../../util/ModelUtil'; import { isAny } from '../modeling/util/ModelingUtil'; import { isExpanded } from '../../util/DiUtil'; import BaseElementFactory from 'diagram-js/lib/core/ElementFactory'; import { DEFAULT_LABEL_SIZE } from '../../util/LabelUtil'; import { ensureCompatDiRef } from '../../util/CompatibilityUtil'; /** * @typedef {import('diagram-js/lib/util/Types').Dimensions} Dimensions * * @typedef {import('./BpmnFactory').default} BpmnFactory * * @typedef {import('../../model/Types').BpmnAttributes} BpmnAttributes * @typedef {import('../../model/Types').Connection} Connection * @typedef {import('../../model/Types').Element} Element * @typedef {import('../../model/Types').Label} Label * @typedef {import('../../model/Types').Root} Root * @typedef {import('../../model/Types').Shape} Shape * @typedef {import('../../model/Types').Moddle} Moddle * @typedef {import('../../model/Types').ModdleElement} ModdleElement */ /** * A BPMN-specific element factory. * * @template {Connection} [T=Connection] * @template {Label} [U=Label] * @template {Root} [V=Root] * @template {Shape} [W=Shape] * * @extends {BaseElementFactory} * * @param {BpmnFactory} bpmnFactory * @param {Moddle} moddle */ export default function ElementFactory(bpmnFactory, moddle) { BaseElementFactory.call(this); this._bpmnFactory = bpmnFactory; this._moddle = moddle; } inherits(ElementFactory, BaseElementFactory); ElementFactory.$inject = [ 'bpmnFactory', 'moddle' ]; ElementFactory.prototype._baseCreate = BaseElementFactory.prototype.create; /** * Create a root element. * * @overlord * @param {'root'} elementType * @param {Partial & Partial} [attrs] * @return {V} */ /** * Create a shape. * * @overlord * @param {'shape'} elementType * @param {Partial & Partial} [attrs] * @return {W} */ /** * Create a connection. * * @overlord * @param {'connection'} elementType * @param {Partial & Partial} [attrs] * @return {T} */ /** * Create a label. * * @param {'label'} elementType * @param {Partial