InseeFr / Eno

Questionnaire generator
MIT License
13 stars 24 forks source link

Enhancing Polymorphism with Text Display #996

Open ddecrulle opened 7 months ago

ddecrulle commented 7 months ago

Problem Statement:

We've introduced a new component type, componentType: Text, in Lunatic to improve polymorphism and simplify text display within components. This component should be utilized when we only need to display text within Lunatic components.

Current State:

Currently, in the Table component, text can be displayed by adding the following structure in the body:

{ 
    "label": { 
        "value": "\"The VALUE\"", 
        "type": "VTL|MD" 
    } 
}

This approach lacks polymorphism and can lead to inconsistency in component usage.

Proposed Solution:

We propose leveraging the new componentType: Text for displaying text in both Table and RosterForLoop components. The updated structure would look like this:

{
    "componentType": "Text",
    "label": {
        "value": "THE VALUE",
        "type": "TXT" // We also support VTL and MD
    },
    "conditionFilter": { 
        "value": "true", 
        "type": "VTL" 
    },
    "id": "id"
}
nsenave commented 2 weeks ago

Really nice, the previous model, with isolated labels hanging around in tables, was a hindrance to polymorphism on cells.

I add this on the list of things to do when I have some time.