Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
simpleMode.registerProvider(element => {
const typeRef = getTypeRef(element);
return (isInput(element.col) || isOutput(element.col))
&& isDate(typeRef);
});
simpleMode.registerProvider(element => {
const typeRef = getTypeRef(element);
return (isInput(element.col) || isOutput(element.col))
&& (typeRef === 'integer' || typeRef === 'long' || typeRef === 'double');
});
const firstOutput = cols.filter(col => isOutput(col))[0];
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;
}
}
}
});
}
this.addRule('col.remove', HIGH_PRIORITY, ({ col }) => {
const { cols } = this._sheet.getRoot();
if (isOutput(col)) {
return cols.filter(c => isOutput(c)).length > 1;
}
return true;
});
element
} = this.props.context;
const actualElement = is(element, 'dmn:LiteralExpression')
? element.$parent
: element;
let newProperties;
if (isInput(actualElement)) {
newProperties = {
inputExpression: {
typeRef: value
}
};
} else if (isOutput(actualElement)) {
newProperties = {
typeRef: value
};
}
this._modeling.updateProperties(actualElement, newProperties);
}
function getColLeft(col, cols) {
const index = cols.indexOf(col);
if (isOutput(col)) {
const firstOutput = cols.filter(col => isOutput(col))[0];
const firstOutputIndex = cols.indexOf(firstOutput);
return cols[ Math.max(firstOutputIndex, index - 1) ];
}
return cols[ Math.max(0, index - 1) ];
}
components.onGetComponent('context-menu', (context = {}) => {
if (context.contextMenuType && context.contextMenuType === 'simple-mode-edit') {
if (!context.element) {
return;
}
const typeRef = getTypeRef(context.element);
if (isNumber(typeRef)) {
if (isInput(context.element.col)) {
return InputNumberEdit;
} else if (isOutput(context.element.col)) {
return OutputNumberEdit;
}
}
}
});
}
simpleMode.registerProvider(element => {
return (isInput(element.col) || isOutput(element.col))
&& getTypeRef(element) === 'boolean';
});
function getDefaultExpressionLanguage(cell, expressionLanguages) {
if (isInput(cell.col)) {
return expressionLanguages.getDefault('inputCell').value;
} else if (isOutput(cell.col)) {
return expressionLanguages.getDefault('outputCell').value;
}
}