How to use the dmn-js-shared/lib/util/ModelUtil.isInput function in dmn-js-shared

To help you get started, we’ve selected a few dmn-js-shared examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bpmn-io / dmn-js / packages / dmn-js-decision-table / src / features / allowed-values / behavior / AllowedValuesUpdateBehavior.js View on Github external
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);
      }
    });
  }
github bpmn-io / dmn-js / packages / dmn-js-decision-table / src / features / simple-string-edit / components / SimpleStringEditContextMenuComponent.js View on Github external
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();
      }
    }
  }
github bpmn-io / dmn-js / packages / dmn-js-decision-table / src / features / drag-and-drop / DragAndDrop.js View on Github external
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) ];
}
github bpmn-io / dmn-js / packages / dmn-js-decision-table / src / features / simple-string-edit / components / SimpleStringEditContextMenuComponent.js View on Github external
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,
github bpmn-io / dmn-js / packages / dmn-js-decision-table / src / features / simple-boolean-edit / SimpleBooleanEdit.js View on Github external
function getTypeRef(element) {
  if (isInput(element.col)) {
    return element.col && element.col.businessObject.inputExpression.typeRef;
  } else {
    return element.col && element.col.businessObject.typeRef;
  }
}
github bpmn-io / dmn-js / packages / dmn-js-decision-table / src / features / simple-string-edit / SimpleStringEdit.js View on Github external
function getTypeRef(element) {
  if (isInput(element.col)) {
    return element.col && element.col.businessObject.inputExpression.typeRef;
  } else {
    return element.col && element.col.businessObject.typeRef;
  }
}
github bpmn-io / dmn-js / packages / dmn-js-decision-table / src / features / simple-date-edit / SimpleDateEdit.js View on Github external
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;
          }

        }

      }
    });
  }