Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'dmn-js-shared' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.
function handleConnections(edges, element) {
function deferConnection(semantic, property) {
var id = parseID(property),
edge = find(edges, matchPattern({ source: id }));
if (edge) {
deferred.push(function() {
visit(semantic, edge);
});
}
}
if (is(element, 'dmn:Association')) {
return deferConnection(element, element.sourceRef);
}
forEach([
'informationRequirement',
'knowledgeRequirement',
'authorityRequirement'
], function(requirements) {
forEach(element[requirements], function(requirement) {
var properties = null;
// get the href
if (is(requirement, 'dmn:InformationRequirement')) {
properties = [ 'requiredDecision', 'requiredInput' ];
} else if (is(requirement, 'dmn:KnowledgeRequirement')) {
updateRoot(element, oldRoot) {
var newRoot = element.root;
var businessObject = element.businessObject;
if (is(element, 'dmn:DecisionRule')) {
// we're removing
if (oldRoot) {
let oldTable = oldRoot.businessObject;
let oldRules = oldTable.get('rule');
let oldIdx = oldRules.indexOf(businessObject);
// unwire Row <-> Table
oldRules.splice(oldIdx, 1);
businessObject.$parent = null;
}
// we're adding
if (newRoot) {
let newTable = newRoot.businessObject;
this.postExecuted('updateProperties', event => {
const {
element,
properties
} = event.context;
const actualProperties = isInput(element) ? properties.inputExpression : properties;
if (actualProperties
&& actualProperties.typeRef
&& actualProperties.typeRef !== 'string') {
const target = (
is(element, 'dmn:LiteralExpression') ?
element.$parent :
element
);
// delete allowed values
modeling.editAllowedValues(target, null);
}
});
}
onKeyDown({ isValid, event }) {
if (!isEnter(event.keyCode)) {
return;
}
const { element } = this.props.context;
const isInputClause = isInput(element.col);
// stop ENTER propagation (and ContextMenu close)
if (isInputClause || !isValid) {
event.stopPropagation();
event.preventDefault();
}
if (isValid) {
if (isInputClause) {
this.addUnaryTestsListItem();
} else {
this.onOutputValueInputClick();
}
}
}
getAllowedValuesTarget() {
const { element } = this.props.context;
if (is(element, 'dmn:LiteralExpression')) {
return element.$parent;
} else {
return element;
}
}
opens(element) {
return is(element, 'dmn:Decision') && element.literalExpression;
}
}
render() {
const root = this._sheet.getRoot();
if (!is(root, 'dmn:DMNElement')) {
return null;
}
const { id, name } = root.businessObject.$parent;
return (
<header>
<h3 title="Decision Name">{ name }</h3>
<h5 title="Decision Id">{ id }</h5>
</header>
);
}
}
function getLabelAttr(semantic) {
if (is(semantic, 'dmn:Decision') ||
is(semantic, 'dmn:BusinessKnowledgeModel') ||
is(semantic, 'dmn:InputData') ||
is(semantic, 'dmn:KnowledgeSource')) {
return 'name';
}
if (is(semantic, 'dmn:TextAnnotation')) {
return 'text';
}
}
function getRequirementType(source) {
if (is(source, 'dmn:BusinessKnowledgeModel')) {
return 'Knowledge';
} else if (is(source, 'dmn:Decision')) {
return 'Decision';
} else if (is(source, 'dmn:InputData')) {
return 'Input';
} else if (is(source, 'dmn:KnowledgeSource')) {
return 'Authority';
}
}
ElementFactory.prototype._getDefaultSize = function(semantic) {
if (is(semantic, 'dmn:Decision')) {
return { width: 180, height: 80 };
}
if (is(semantic, 'dmn:InputData')) {
return { width: 125, height: 45 };
}
if (is(semantic, 'dmn:KnowledgeSource')) {
return { width: 100, height: 63 };
}
if (is(semantic, 'dmn:BusinessKnowledgeModel')) {
return { width: 135, height: 46 };
}
return { width: 100, height: 80 };