Skip to content

Commit

Permalink
doc: add Text type to components
Browse files Browse the repository at this point in the history
Fix #911
  • Loading branch information
Grafikart committed May 13, 2024
1 parent f1a51f2 commit 5d7fba6
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
16 changes: 16 additions & 0 deletions lunatic-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,9 @@
},
{
"$ref": "#/$defs/ComponentSummaryDefinition"
},
{
"$ref": "#/$defs/ComponentText"
}
]
},
Expand Down Expand Up @@ -979,6 +982,19 @@
}
]
},
"ComponentText": {
"type": "object",
"properties": {
"componentType": {
"type": "string",
"const": "Text"
},
"label": {
"$ref": "#/$defs/VTLExpression"
}
},
"required": ["componentType", "label"]
},
"Variable": {
"discriminator": {
"propertyName": "variableType"
Expand Down
9 changes: 7 additions & 2 deletions src/stories/loop/source-with-header.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand All @@ -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" },
Expand Down
7 changes: 6 additions & 1 deletion src/type.source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export type ComponentDefinition =
| ComponentCheckboxOneDefinition
| ComponentSuggesterDefinition
| ComponentPairWiseLinksDefinition
| ComponentSummaryDefinition;
| ComponentSummaryDefinition
| ComponentText;
export type ComponentInputDefinition = ComponentInputDefinition1 & {
componentType: 'Input' | 'Textarea';
maxLength?: number;
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 5d7fba6

Please sign in to comment.