diff --git a/src/Loop.tsx b/src/Loop.tsx
index 60a78545..3c7aff8a 100644
--- a/src/Loop.tsx
+++ b/src/Loop.tsx
@@ -12,22 +12,34 @@ export const Loop: LunaticSlotComponents["Loop"] = props => {
console.error("Only declaration in Question are displayed");
}
+ const hasErrors = errors && errors.length > 0;
+
return (
<>
- {errors?.map(error =>
- error.errorMessage ? (
-
- ) : null,
+ {hasErrors && (
+
+ <>
{hasErrors && (
-
+
{errors.map(error => {
if (!error.errorMessage) {
//TODO throw error
@@ -32,10 +32,14 @@ export const Table: LunaticSlotComponents["Table"] = props => {
})}
)}
-
-
+
+ >
);
};
diff --git a/src/stories/Orchestrator.tsx b/src/stories/Orchestrator.tsx
index 6c415d29..88c3cab7 100644
--- a/src/stories/Orchestrator.tsx
+++ b/src/stories/Orchestrator.tsx
@@ -65,9 +65,8 @@ export const Orchestrator: (props: OrchestratorProps) => JSX.Element = ({
const { currentErrors } = compileControls();
setErrorActive({ ...errorActive, [pageTag]: currentErrors || {} });
if (!currentErrors) {
- //goNextPage();
+ goNextPage();
}
- goNextPage();
};
return (
diff --git a/src/stories/table/default.ts b/src/stories/table/default.ts
index df6eaeec..cc040168 100644
--- a/src/stories/table/default.ts
+++ b/src/stories/table/default.ts
@@ -127,7 +127,7 @@ export const source: LunaticSource = {
"criticality": "INFO",
"errorMessage": {
"type": "VTL|MD",
- "value": '" La valeur doit être comprise entre 0 et 9999."',
+ "value": '"GLOBAL: La valeur de TABLEAUCLA33 doit être comprise entre 0 et 10."',
},
"typeOfControl": "FORMAT",
"control": {
@@ -155,13 +155,13 @@ export const source: LunaticSource = {
"criticality": "INFO",
"errorMessage": {
"type": "VTL|MD",
- "value": '" La valeur doit être comprise entre 0 et 9999."',
+ "value": '" La valeur doit être comprise entre 0 et 10."',
},
"typeOfControl": "FORMAT",
"control": {
"type": "VTL",
"value":
- "not(not(isnull(TABLEAUCLA23)) and (0>TABLEAUCLA23 or 9999
TABLEAUCLA23 or 10TABLEAUCLA13 or 9999TABLEAUCLA13 or 10TABLEAUCLA33 or 10TABLEAUCLA33 or 10TABLEAUCLA33)"
- },
- "id": "luwhnbxk-RDOP-luwhcilc-format-decimal"
- },
- {
- "criticality": "INFO",
- "errorMessage": {
- "type": "VTL|MD",
- "value": "\" La valeur doit être comprise entre 0 et 9999.\""
- },
- "typeOfControl": "FORMAT",
- "control": {
- "type": "VTL",
- "value": "not(not(isnull(TABLEAUCLA23)) and (0>TABLEAUCLA23 or 9999TABLEAUCLA23)"
- },
- "id": "luwhnbxk-RDOP-luwh4tva-format-decimal"
- },
- {
- "criticality": "INFO",
- "errorMessage": {
- "type": "VTL|MD",
- "value": "\" La valeur doit être comprise entre 0 et 9999.\""
- },
- "typeOfControl": "FORMAT",
- "control": {
- "type": "VTL",
- "value": "not(not(isnull(TABLEAUCLA13)) and (0>TABLEAUCLA13 or 9999TABLEAUCLA13)"
- },
- "id": "luwhnbxk-RDOP-luwh7btb-format-decimal"
- }
- ],
- "positioning": "HORIZONTAL",
- "header": [
- {
- "label": {
- "type": "VTL|MD",
- "value": ""
- }
- },
- {
- "label": {
- "type": "VTL|MD",
- "value": "\"Domaines\""
- }
- },
- {
- "label": {
- "type": "VTL|MD",
- "value": "\"Activité\""
- }
- },
- {
- "label": {
- "type": "VTL|MD",
- "value": "\"Chiffre d'affaire\""
- }
- }
- ],
- "conditionFilter": {
- "type": "VTL",
- "value": "true"
- },
- "id": "luwhnbxk",
- "page": "1",
- "label": {
- "type": "VTL|MD",
- "value": "\"Tableau classique\""
- },
- "body": [
- [
- {
- "label": {
- "type": "VTL|MD",
- "value": "\"Libelle 1\""
- }
- },
- {
- "componentType": "Input",
- "response": {
- "name": "TABLEAUCLA11"
- },
- "id": "luwhnbxk-RDOP-luwhcrpg",
- "maxLength": 249,
- "controls": [
- {
- "criticality": "ERROR",
- "errorMessage": {
- "type": "VTL",
- "value": "\"Le domaine ne doit pas être vide\""
- },
- "typeOfControl": "",
- "control": {
- "type": "VTL",
- "value": "not(isnull(TABLEAUCLA11))"
- }
- }
- ]
- },
- {
- "componentType": "Input",
- "response": {
- "name": "TABLEAUCLA12"
- },
- "id": "luwhnbxk-RDOP-luwhnkls",
- "maxLength": 249
- },
- {
- "componentType": "InputNumber",
- "unit": "€",
- "min": 0.0,
- "max": 9999.0,
- "response": {
- "name": "TABLEAUCLA13"
- },
- "decimals": 0,
- "id": "luwhnbxk-RDOP-luwh7btb"
- }
- ],
- [
- {
- "label": {
- "type": "VTL|MD",
- "value": "\"Libelle 2\""
- },
- "value": "2"
- },
- {
- "componentType": "Input",
- "response": {
- "name": "TABLEAUCLA21"
- },
- "id": "luwhnbxk-RDOP-luwhmbp1",
- "maxLength": 249
- },
- {
- "componentType": "Input",
- "response": {
- "name": "TABLEAUCLA22"
- },
- "id": "luwhnbxk-RDOP-luwhlejc",
- "maxLength": 249
- },
- {
- "componentType": "InputNumber",
- "unit": "€",
- "min": 0.0,
- "max": 9999.0,
- "response": {
- "name": "TABLEAUCLA23"
- },
- "decimals": 0,
- "id": "luwhnbxk-RDOP-luwh4tva"
- }
- ],
- [
- {
- "label": {
- "type": "VTL|MD",
- "value": "\"Libelle 3\""
- },
- "value": "3"
- },
- {
- "componentType": "Input",
- "response": {
- "name": "TABLEAUCLA31"
- },
- "id": "luwhnbxk-RDOP-luwhalhn",
- "maxLength": 249
- },
- {
- "componentType": "Input",
- "response": {
- "name": "TABLEAUCLA32"
- },
- "id": "luwhnbxk-RDOP-luwhd3mk",
- "maxLength": 249
- },
- {
- "componentType": "InputNumber",
- "unit": "€",
- "min": 0.0,
- "max": 9999.0,
- "response": {
- "name": "TABLEAUCLA33"
- },
- "decimals": 0,
- "id": "luwhnbxk-RDOP-luwhcilc"
- }
- ]
- ],
- "mandatory": false
- },
- {
- "id": "seq",
- "componentType": "Sequence",
- "label": {
- "value": "\"Bye!\"",
- "type": "VTL|MD"
- },
- "conditionFilter": { "value": "true", "type": "VTL" },
- "page": "2"
- }
- ],
- "pagination": "question",
- "lunaticModelVersion": "3.5.1",
- "modele": "TESTDYLAN",
- "enoCoreVersion": "3.18.5",
- "generatingDate": "12-04-2024 10:52:10",
- "resizing": {},
- "id": "luv7k9hw2",
- "label": {
- "type": "VTL|MD",
- "value": "Test Dylan"
- },
- "maxPage": "2"
-}
diff --git a/src/stories/table/test.ts b/src/stories/table/test.ts
deleted file mode 100644
index 6472a858..00000000
--- a/src/stories/table/test.ts
+++ /dev/null
@@ -1,132 +0,0 @@
-import type { LunaticSource } from "@inseefr/lunatic";
-
-export const source: LunaticSource = {
- "maxPage": "4",
- "components": [
- {
- "componentType": "RosterForLoop",
- "id": "nb",
- "page": "1",
- "label": {
- "type": "VTL",
- "value": '"Ajouter un habitant"',
- },
- "headers": [
- {
- "headerCell": true,
- "label": '"Prénom"',
- },
- {
- "headerCell": true,
- "label": '"Age"',
- },
- ],
- "controls": [
- {
- "type": "ROW",
- "criticality": "ERROR",
- "errorMessage": {
- "type": "VTL|MD",
- "value": '"Row level : Age doit être > 18 "',
- },
- "typeOfControl": "FORMAT",
- "control": {
- "type": "VTL",
- "value": "AGES > 18",
- },
- "id": "kfxmjupm-CI-0",
- },
- {
- "criticality": "ERROR",
- "errorMessage": {
- "type": "VTL|MD",
- "value": '"Global level : Vous devez entrer 3 personnes min "',
- },
- "typeOfControl": "FORMAT",
- "control": {
- "type": "VTL",
- "value": "NB >= 3",
- },
- "id": "kfxmjupm-CI-1",
- },
- ],
- "components": [
- {
- "componentType": "Input",
- "maxLength": 30,
- "id": "prenoms",
- "response": {
- "name": "PRENOMS",
- },
- },
- {
- "componentType": "InputNumber",
- "maxLength": 30,
- "id": "ages",
- "controls": [
- {
- "criticality": "ERROR",
- "errorMessage": {
- "type": "VTL|MD",
- "value": '"Age doit être > 18 "',
- },
- "typeOfControl": "FORMAT",
- "control": {
- "type": "VTL",
- "value": "AGES > 18",
- },
- "id": "kfxmjupm-CI-0",
- },
- ],
- "response": {
- "name": "AGES",
- },
- },
- ],
- },
- {
- "componentType": "Sequence",
- "response": {
- "name": "NB",
- },
- "id": "nb",
- "page": "2",
- "label": {
- "type": "VTL",
- "value": '"Fin"',
- },
- },
- ],
- "variables": [
- {
- "variableType": "CALCULATED",
- "expression": {
- "type": "VTL",
- "value": "count(PRENOMS)",
- },
- "name": "NB",
- },
- {
- "variableType": "COLLECTED",
- "values": {
- "COLLECTED": ["John", "Jane"],
- "EDITED": null,
- "INPUTTED": null,
- "FORCED": null,
- "PREVIOUS": null,
- },
- "name": "PRENOMS",
- },
- {
- "variableType": "COLLECTED",
- "values": {
- "COLLECTED": [10, 12],
- "EDITED": null,
- "INPUTTED": null,
- "FORCED": null,
- "PREVIOUS": null,
- },
- "name": "AGES",
- },
- ],
-} as any;