How to use the bpmn-js-properties-panel/lib/helper/CmdHelper.addAndRemoveElementsFromList function in bpmn-js-properties-panel

To help you get started, we’ve selected a few bpmn-js-properties-panel 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 zeebe-io / zeebe-modeler / client / src / app / tabs / bpmn / custom / properties-provider / parts / implementation / MultiInstanceLoopCharacteristics.js View on Github external
function setProperties(element, values) {
    const loopCharacteristics = getLoopCharacteristics(element),
          commands = [];

    // ensure extensionElements
    let extensionElements = loopCharacteristics.get('extensionElements');
    if (!extensionElements) {
      extensionElements = elementHelper.createElement('bpmn:ExtensionElements', { values: [] }, loopCharacteristics, bpmnFactory);
      commands.push(cmdHelper.updateBusinessObject(element, loopCharacteristics, { extensionElements: extensionElements }));
    }

    // ensure zeebe:LoopCharacteristics
    let zeebeLoopCharacteristics = getZeebeLoopCharacteristics(loopCharacteristics);
    if (!zeebeLoopCharacteristics) {
      zeebeLoopCharacteristics = elementHelper.createElement('zeebe:LoopCharacteristics', { }, extensionElements, bpmnFactory);
      commands.push(cmdHelper.addAndRemoveElementsFromList(
        element,
        extensionElements,
        'values',
        'extensionElements',
        [ zeebeLoopCharacteristics ],
        []
      ));
    }

    commands.push(cmdHelper.updateBusinessObject(element, zeebeLoopCharacteristics, values));
    return commands;
  }
github zeebe-io / zeebe-modeler / client / src / app / tabs / bpmn / custom / properties-provider / parts / CallActivityProps.js View on Github external
const businessObject = getBusinessObject(element),
          commands = [];

    // ensure extensionElements
    let extensionElements = businessObject.get('extensionElements');
    if (!extensionElements) {
      extensionElements = elementHelper.createElement('bpmn:ExtensionElements', { values: [] }, businessObject, bpmnFactory);
      commands.push(cmdHelper.updateBusinessObject(element, businessObject, { extensionElements: extensionElements }));
    }

    // ensure zeebe:calledElement
    let calledElement = getCalledElement(businessObject);
    if (!calledElement) {
      calledElement = elementHelper.createElement('zeebe:CalledElement', { }, extensionElements, bpmnFactory);
      commands.push(cmdHelper.addAndRemoveElementsFromList(
        element,
        extensionElements,
        'values',
        'extensionElements',
        [ calledElement ],
        []
      ));
    }

    // update properties
    commands.push(cmdHelper.updateBusinessObject(element, calledElement, values));
    return commands;
  }
github zeebe-io / zeebe-modeler / client / src / app / tabs / bpmn / custom / properties-provider / parts / TaskDefinitionProps.js View on Github external
const bo = getBusinessObject(element);
      const commands = [];

      // create extensionElements
      let extensionElements = bo.get('extensionElements');
      if (!extensionElements) {
        extensionElements = elementHelper.createElement('bpmn:ExtensionElements', { values: [] }, bo, bpmnFactory);
        commands.push(cmdHelper.updateProperties(element, { extensionElements: extensionElements }));
      }

      // create taskDefinition
      let taskDefinition = getTaskDefinition(element);

      if (!taskDefinition) {
        taskDefinition = elementHelper.createElement('zeebe:TaskDefinition', { }, extensionElements, bpmnFactory);
        commands.push(cmdHelper.addAndRemoveElementsFromList(
          element,
          extensionElements,
          'values',
          'extensionElements',
          [ taskDefinition ],
          []
        ));
      }

      commands.push(cmdHelper.updateBusinessObject(element, taskDefinition, values));
      return commands;
    },
github zeebe-io / zeebe-modeler / client / src / app / tabs / bpmn / custom / properties-provider / parts / implementation / ElementReferenceExtensionElementProperty.js View on Github external
const reference = definition.get(referenceProperty);
      const bo = getBusinessObject(reference);
      reference.businessObject = bo;
      const commands = [];
      let extensionElements = bo.get('extensionElements');
      if (!extensionElements) {
        extensionElements = elementHelper.createElement('bpmn:ExtensionElements', { values: [] }, bo, bpmnFactory);
        commands.push(cmdHelper.updateProperties(reference, { extensionElements: extensionElements }));
      }

      let extensionElement = getExtensionElement(reference);

      if (!extensionElement) {
        extensionElement = elementHelper.createElement(extensionElementKey, { }, extensionElements, bpmnFactory);
        commands.push(cmdHelper.addAndRemoveElementsFromList(
          element,
          extensionElements,
          'values',
          'extensionElements',
          [ extensionElement ],
          []
        ));
      }

      commands.push(cmdHelper.updateBusinessObject(element, extensionElement, values));
      return commands;
    },
github zeebe-io / zeebe-modeler / client / src / app / tabs / bpmn / custom / properties-provider / parts / implementation / InputOutput.js View on Github external
return (element, extensionElements, value) => {
      const commands = [];

      let inputOutput = getInputOutput(element);
      if (!inputOutput) {
        const parent = extensionElements;
        inputOutput = createInputOutput(parent, bpmnFactory, {
          inputParameters: [],
          outputParameters: []
        });

        commands.push(cmdHelper.addAndRemoveElementsFromList(
          element,
          extensionElements,
          'values',
          'extensionElements',
          [ inputOutput ],
          []
        ));
      }

      const newElem = createParameter(type, inputOutput, bpmnFactory, { source: 'sourceValue', target: 'targetValue' });
      commands.push(cmdHelper.addElementsTolist(element, inputOutput, prop, [ newElem ]));

      return commands;
    };
  };
github camunda-consulting / code / snippets / bpmnjs-custom-modeler / app / custom-modeler / custom / propertyprovider / SoftwareSettings.js View on Github external
var camundaProperties = findExtension(extensionElements, 'camunda:Properties');
    if (!camundaProperties) {
      camundaProperties = bpmnFactory.create('camunda:Properties');
      updates.push(cmdHelper.addElementsTolist(
        element, extensionElements, 'values', [ camundaProperties ]
      ));
    }
    var existingCamundaProperty = findCamundaProperty(camundaProperties,{'name':propertyName});
    if (values != null && values[propertyName] != null) {
      values = values[propertyName];
    }
    var camundaProperty = bpmnFactory.create('camunda:Property', {
      name: propertyName,
      value: values || ''
    });
    updates.push(cmdHelper.addAndRemoveElementsFromList(
      element,
      camundaProperties,
      'values',
      null,
      [ camundaProperty ],
      existingCamundaProperty ? [ existingCamundaProperty ] : []
    ));
    return updates;
  };
github zeebe-io / zeebe-modeler / client / src / app / tabs / bpmn / custom / properties-provider / parts / implementation / PayloadMappings.js View on Github external
return (element, extensionElements, value) => {
      const commands = [];

      let payloadMappings = getPayloadMappings(element);
      if (!payloadMappings) {
        const parent = extensionElements;
        payloadMappings = createPayloadMappings(parent, bpmnFactory, {
          mapping: []
        });

        commands.push(cmdHelper.addAndRemoveElementsFromList(
          element,
          extensionElements,
          'values',
          'extensionElements',
          [payloadMappings],
          []
        ));
      }

      const newElem = createMapping(type, payloadMappings, bpmnFactory, { source: 'sourceValue', target: 'targetValue', type: 'PUT' });
      commands.push(cmdHelper.addElementsTolist(element, payloadMappings, prop, [newElem]));

      return commands;
    };
  };

bpmn-js-properties-panel

A simple properties panel for bpmn-js

MIT
Latest version published 9 days ago

Package Health Score

90 / 100
Full package analysis