@bpmn-io/element-templates-icons-renderer
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -9,2 +9,6 @@ # Changelog | ||
## 0.1.2 | ||
* `FIX`: move `modelerTemplateIcon` to property ([#3](https://github.com/bpmn-io/element-templates-icons-renderer/pull/3)) | ||
## 0.1.1 | ||
@@ -11,0 +15,0 @@ |
{ | ||
"name": "@bpmn-io/element-templates-icons-renderer", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "A bpmn-js extension to render element templates icons.", | ||
@@ -67,3 +67,3 @@ "main": "src/index.js", | ||
"webpack": "^5.70.0", | ||
"zeebe-bpmn-moddle": "^0.12.0" | ||
"zeebe-bpmn-moddle": "^0.12.1" | ||
}, | ||
@@ -70,0 +70,0 @@ "dependencies": { |
import { | ||
getBusinessObject, | ||
is | ||
getBusinessObject | ||
} from 'bpmn-js/lib/util/ModelUtil'; | ||
export function getModelerTemplateIcon(element) { | ||
var modelerTemplateIcon = findExtension(element, 'zeebe:ModelerTemplateIcon'); | ||
return modelerTemplateIcon && (modelerTemplateIcon.$body || modelerTemplateIcon.body); | ||
var modelerTemplateIcon = getBusinessObject(element).get('zeebe:modelerTemplateIcon'); | ||
return modelerTemplateIcon; | ||
} | ||
export function findExtension(element, type) { | ||
var businessObject = getBusinessObject(element); | ||
var extensionElements; | ||
if (is(businessObject, 'bpmn:ExtensionElements')) { | ||
extensionElements = businessObject; | ||
} else { | ||
extensionElements = businessObject.get('extensionElements'); | ||
} | ||
if (!extensionElements) { | ||
return null; | ||
} | ||
return extensionElements.get('values').find((value) => { | ||
// make sure we can read the model without moddle descriptors to be required | ||
return value && value.$type.toLowerCase() === type.toLowerCase(); | ||
}); | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6745
61
1