camunda / camunda-modeler

An integrated modeling solution for BPMN, DMN and Forms based on bpmn.io.
https://camunda.com/products/modeler
MIT License
1.49k stars 479 forks source link

Add support for type definition in Form fields custom properties panel #3764

Open davismol opened 1 year ago

davismol commented 1 year ago

Problem you would like to solve

I would like to be able to define typed (boolean, number) custom properties for Form fields. At the moment, every custom props is rendered in the relevant JSON file as String.

Proposed solution

In addition to "key" and "value" fields, add the "type" field to specify the JSON supported type of the variable.

Alternatives considered

At the moment we implemented a solution based on a prefix added to the value key, for example boolean.myproperty and we convert the value from string to the required type before rendering the Form and we strip the type prefix from the name of the variable.

Additional context

No response

pinussilvestrus commented 1 year ago

Hi @davismol, thanks for sharing!

Can you maybe share a bit more about your use case? This will help us to understand why this is beneficial to add, especially because there are workarounds, as you described.

davismol commented 11 months ago

Hi @pinussilvestrus, sorry for the late reply... The idea is to have a way to define the JSON supported types for the custom properties of forms component. I mean, if I define something like this, in the relevatn JSON I get all the props as strings image

image

I would like to be able to define the type (boolean, number, ecc..) in the modeler and get the property valued accordingly in the JSON and not as strings: "properties": { "section": "anagraph-data", "format": "myFormat", "key3": true, "key4": 10 },