diff --git a/lunatic-schema.json b/lunatic-schema.json index 273a4ae46..a2f8895a9 100644 --- a/lunatic-schema.json +++ b/lunatic-schema.json @@ -347,6 +347,9 @@ }, { "$ref": "#/$defs/ComponentSummaryDefinition" + }, + { + "$ref": "#/$defs/ComponentText" } ] }, @@ -979,6 +982,19 @@ } ] }, + "ComponentText": { + "type": "object", + "properties": { + "componentType": { + "type": "string", + "const": "Text" + }, + "label": { + "$ref": "#/$defs/VTLExpression" + } + }, + "required": ["componentType", "label"] + }, "Variable": { "discriminator": { "propertyName": "variableType" diff --git a/src/stories/loop/source-with-header.json b/src/stories/loop/source-with-header.json index 4aa64e6d0..96dad9a16 100644 --- a/src/stories/loop/source-with-header.json +++ b/src/stories/loop/source-with-header.json @@ -16,8 +16,9 @@ "id": "loop-prenom", "componentType": "RosterForLoop", "header": [ - { "headerCell": true, "label": { "value": "Prénom", "type": "VTL" } }, - { "headerCell": true, "label": { "value": "Age", "type": "VTL" } } + { "headerCell": true, "label": { "value": "", "type": "TXT" } }, + { "headerCell": true, "label": { "value": "Prénom", "type": "TXT" } }, + { "headerCell": true, "label": { "value": "Age", "type": "TXT" } } ], "label": { "value": "\"Ajouter un individu\"", "type": "VTL|MD" }, "conditionFilter": { "value": "true", "type": "VTL" }, @@ -28,6 +29,10 @@ }, "page": "1", "components": [ + { + "componentType": "Text", + "label": { "value": "\"Individu \" || cast(GLOBAL_ITERATION_INDEX, string)", "type": "VTL" } + }, { "componentType": "Input", "conditionFilter": { "value": "true", "type": "VTL" }, diff --git a/src/type.source.ts b/src/type.source.ts index 1a3a0d991..631934c26 100644 --- a/src/type.source.ts +++ b/src/type.source.ts @@ -32,7 +32,8 @@ export type ComponentDefinition = | ComponentCheckboxOneDefinition | ComponentSuggesterDefinition | ComponentPairWiseLinksDefinition - | ComponentSummaryDefinition; + | ComponentSummaryDefinition + | ComponentText; export type ComponentInputDefinition = ComponentInputDefinition1 & { componentType: 'Input' | 'Textarea'; maxLength?: number; @@ -371,6 +372,10 @@ export interface ControlDefinition { export interface ResponseDefinition { name: string; } +export interface ComponentText { + componentType: 'Text'; + label: VTLExpression; +} export interface SuggesterDefinition { /** * Name of the list (will be used as storeName for suggester)