bpmn-io / bpmn-js-properties-panel

A properties panel for bpmn-js.
MIT License
290 stars 196 forks source link

Cannot set empty value to the field #928

Closed ghost closed 1 year ago

ghost commented 1 year ago

Describe the Bug

The modelerer doesn't set an empty value to the field after being set.

Steps to Reproduce

The 1st case

The first case with all constraints on the field: notEmpty: false, pattern for numbers and maxLength. As You can see the value isn't set as empty

Steps to reproduce

  1. Load element-templateV1.txt
  2. In authentication section choose type Bearer Token and enter some value (Doesn't matter what it'll be as it's only for not empty constraint)
  3. Select operation Create Worksheet
  4. In operation details block enter some spreadsheet ID and worksheet name (Doesn't matter what it'll be as it's only for not empty constraint)
  5. Set in worksheet index some value and deploy.
  6. Set in worksheet index empty value and deploy.

The 2st case

The second case with constraints on the field: notEmpty: false, pattern for numbers and. As You can see I cannot set empty index despite pattern is ^([0-9]*$)

Steps to reproduce

  1. Load element-templateV2.txt
  2. In authentication section choose type Bearer Token and enter some value (Doesn't matter what it'll be as it's only for not empty constraint)
  3. Select operation Create Worksheet
  4. In operation details block enter some spreadsheet ID and worksheet name (Doesn't matter what it'll be as it's only for not empty constraint)
  5. Set in worksheet index some value and deploy.
  6. Set in worksheet index empty value and deploy.

The 3st case

The third case with only one constraint: notEmpty: false. As You can see in this case I'm able to set empty value.

Steps to reproduce

  1. Load element-templateV3.txt
  2. In authentication section choose type Bearer Token and enter some value (Doesn't matter what it'll be as it's only for not empty constraint)
  3. Select operation Create Worksheet
  4. In operation details block enter some spreadsheet ID and worksheet name (Doesn't matter what it'll be as it's only for not empty constraint)
  5. Set in worksheet index some value and deploy.
  6. Set in worksheet index empty value and deploy.

Expected Behavior

In all cases I'm able to set an empty value

Environment

marstamm commented 1 year ago

Hi @mrebrii , thank you for opening this issue. The way element templates currently work. invalid entries are not committed to the diagram. So when you safe or switch elements, the last valid value is kept.

I agree that this is unexpected behavior and invalid values might be wanted (e.g. empty values). I will move this item to the backlog. This behavior is expected to change with the implementation of https://github.com/camunda/camunda-modeler/issues/3357

marstamm commented 1 year ago

closed via https://github.com/bpmn-io/bpmn-js-properties-panel/pull/938