InseeFr / Lunatic

Library of questionnaire components
https://inseefr.github.io/Lunatic/
MIT License
20 stars 21 forks source link

RosterForLoop - Support simple labels as component #911

Closed romaintailhurat closed 3 months ago

romaintailhurat commented 5 months ago

Feature Description

Pogues will provide a way to inject external values into a RosterForLoop (aka dynamic table) columns, see https://github.com/InseeFr/Pogues/issues/745. Lunatic must enable that by supporting a "Label" as a RosterForLoop component.

Use Case

Describe the specific use case or scenario where this feature would be beneficial.

Proposed Solution

Simple Tables support the use of labels, see this story.

Injecting such a label object in a RosterForLoop has no effect.

"components": [
        {
          "label": {
            "value": "Simple label",
            "type": "VTL|MD"
          }
        }
]

We may then have a proper text / label / typography component, and thus having this kind of structure:

"components": [
        {
          "componentType": "Label",
          "value": "\"A VTL expression\" || EXTERNAL_VAR"
          "type": "VTL|MD"
       }
]

Priority

Needed for some business surveys questionnaire.

Related Issues

Grafikart commented 3 months ago

We introduced a new component type for this kind of use case

{
    "componentType": "Text",
    "label": { "value": "\"Individu \" || cast(GLOBAL_ITERATION_INDEX, string)", "type": "VTL" }
},