Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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();
}
}
}
function getColRight(col, cols) {
const index = cols.indexOf(col);
if (isInput(col)) {
const inputs = cols.filter(col => isInput(col));
const lastInput = inputs[ inputs.length - 1 ];
const lastInputIndex = cols.indexOf(lastInput);
return cols[ Math.min(lastInputIndex, index + 1) ];
}
return cols[ Math.min(cols.length - 1, index + 1) ];
}
if (!parsedString) {
parsedString = {
values: [],
type: DISJUNCTION
};
}
const inputOrOutputValues = getInputOrOutputValues(
props.context.element.col.businessObject
);
const filteredValues = parsedString.values.filter(value => {
return !includes(inputOrOutputValues, value);
});
const isInputClause = isInput(props.context.element.col);
let items = inputOrOutputValues.map(value => {
return {
value,
isChecked: includes(parsedString.values, value),
isRemovable: false,
group: isInputClause ? INPUT_VALUES_LABEL : OUTPUT_VALUES_LABEL
};
});
if (isInputClause) {
items = items.concat(filteredValues.map(value => {
return {
value,
isChecked: true,
isRemovable: true,
function getTypeRef(element) {
if (isInput(element.col)) {
return element.col && element.col.businessObject.inputExpression.typeRef;
} else {
return element.col && element.col.businessObject.typeRef;
}
}
function getTypeRef(element) {
if (isInput(element.col)) {
return element.col && element.col.businessObject.inputExpression.typeRef;
} else {
return element.col && element.col.businessObject.typeRef;
}
}
components.onGetComponent('context-menu', (context = {}) => {
if (context.contextMenuType && context.contextMenuType === 'simple-mode-edit') {
if (!context.element) {
return;
}
const typeRef = getTypeRef(context.element);
if (isDate(typeRef)) {
if (isInput(context.element.col)) {
return InputDateEdit;
} else if (isOutput(context.element.col)) {
return OutputDateEdit;
}
}
}
});
}