@inseefr/lunatic 3.7.7 → 3.8.0-rc.ucq-options-variable.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/esm/type.source.d.ts +18 -3
  2. package/esm/use-lunatic/commons/compile-controls.js +2 -16
  3. package/esm/use-lunatic/commons/compile-controls.js.map +1 -1
  4. package/esm/use-lunatic/commons/component.d.ts +33 -0
  5. package/esm/use-lunatic/commons/component.js +37 -0
  6. package/esm/use-lunatic/commons/component.js.map +1 -1
  7. package/esm/use-lunatic/commons/fill-components/fill-component-expressions.d.ts +1 -1
  8. package/esm/use-lunatic/commons/fill-components/fill-component-expressions.js.map +1 -1
  9. package/esm/use-lunatic/commons/fill-components/fill-components.js +10 -2
  10. package/esm/use-lunatic/commons/fill-components/fill-components.js.map +1 -1
  11. package/esm/use-lunatic/commons/variables/behaviours/cleaning-behaviour.js.map +1 -1
  12. package/esm/use-lunatic/commons/variables/global-variables.d.ts +5 -0
  13. package/esm/use-lunatic/commons/variables/global-variables.js +7 -0
  14. package/esm/use-lunatic/commons/variables/global-variables.js.map +1 -0
  15. package/esm/use-lunatic/commons/variables/lunatic-variables-store.d.ts +21 -9
  16. package/esm/use-lunatic/commons/variables/lunatic-variables-store.js +67 -49
  17. package/esm/use-lunatic/commons/variables/lunatic-variables-store.js.map +1 -1
  18. package/esm/use-lunatic/commons/variables/lunatic-variables-store.spec.js +137 -6
  19. package/esm/use-lunatic/commons/variables/lunatic-variables-store.spec.js.map +1 -1
  20. package/esm/use-lunatic/commons/variables/models.d.ts +1 -0
  21. package/esm/use-lunatic/commons/variables/models.js +2 -0
  22. package/esm/use-lunatic/commons/variables/models.js.map +1 -0
  23. package/esm/use-lunatic/commons/variables/pairwise-variables.d.ts +29 -0
  24. package/esm/use-lunatic/commons/variables/pairwise-variables.js +196 -0
  25. package/esm/use-lunatic/commons/variables/pairwise-variables.js.map +1 -0
  26. package/esm/use-lunatic/props/getComponentTypeProps.d.ts +1 -1
  27. package/esm/use-lunatic/props/propOptions.d.ts +9 -1
  28. package/esm/use-lunatic/props/propOptions.js +56 -1
  29. package/esm/use-lunatic/props/propOptions.js.map +1 -1
  30. package/esm/use-lunatic/props/propOptions.spec.js +220 -56
  31. package/esm/use-lunatic/props/propOptions.spec.js.map +1 -1
  32. package/esm/use-lunatic/reducer/reducerInitializer.js +5 -1
  33. package/esm/use-lunatic/reducer/reducerInitializer.js.map +1 -1
  34. package/package.json +26 -1
  35. package/src/stories/checkbox/checkbox.stories.tsx +13 -0
  36. package/src/stories/checkbox/sourceOneDynamicOptions.json +496 -0
  37. package/src/stories/dropdown/dropdown.stories.tsx +12 -0
  38. package/src/stories/dropdown/sourceDynamicOptions.json +496 -0
  39. package/src/stories/pairwise/pairwise.stories.tsx +7 -0
  40. package/src/stories/pairwise/sourceGlobalVariables.json +337 -0
  41. package/src/stories/radio/radio.stories.tsx +13 -0
  42. package/src/stories/radio/sourceDynamicOptions.json +496 -0
  43. package/src/type.source.ts +18 -3
  44. package/src/use-lunatic/commons/compile-controls.ts +10 -42
  45. package/src/use-lunatic/commons/component.ts +79 -0
  46. package/src/use-lunatic/commons/fill-components/fill-component-expressions.ts +2 -1
  47. package/src/use-lunatic/commons/fill-components/fill-components.ts +9 -10
  48. package/src/use-lunatic/commons/variables/behaviours/cleaning-behaviour.ts +2 -4
  49. package/src/use-lunatic/commons/variables/global-variables.ts +9 -0
  50. package/src/use-lunatic/commons/variables/lunatic-variables-store.spec.ts +149 -6
  51. package/src/use-lunatic/commons/variables/lunatic-variables-store.ts +113 -50
  52. package/src/use-lunatic/commons/variables/models.ts +1 -0
  53. package/src/use-lunatic/commons/variables/pairwise-variables.ts +251 -0
  54. package/src/use-lunatic/props/propOptions.spec.ts +217 -147
  55. package/src/use-lunatic/props/propOptions.ts +97 -8
  56. package/src/use-lunatic/reducer/reducerInitializer.tsx +5 -7
  57. package/tsconfig.build.tsbuildinfo +1 -1
  58. package/type.source.d.ts +18 -3
  59. package/use-lunatic/commons/compile-controls.js +4 -18
  60. package/use-lunatic/commons/compile-controls.js.map +1 -1
  61. package/use-lunatic/commons/component.d.ts +33 -0
  62. package/use-lunatic/commons/component.js +42 -0
  63. package/use-lunatic/commons/component.js.map +1 -1
  64. package/use-lunatic/commons/fill-components/fill-component-expressions.d.ts +1 -1
  65. package/use-lunatic/commons/fill-components/fill-component-expressions.js.map +1 -1
  66. package/use-lunatic/commons/fill-components/fill-components.js +9 -1
  67. package/use-lunatic/commons/fill-components/fill-components.js.map +1 -1
  68. package/use-lunatic/commons/variables/behaviours/cleaning-behaviour.js.map +1 -1
  69. package/use-lunatic/commons/variables/global-variables.d.ts +5 -0
  70. package/use-lunatic/commons/variables/global-variables.js +11 -0
  71. package/use-lunatic/commons/variables/global-variables.js.map +1 -0
  72. package/use-lunatic/commons/variables/lunatic-variables-store.d.ts +21 -9
  73. package/use-lunatic/commons/variables/lunatic-variables-store.js +72 -50
  74. package/use-lunatic/commons/variables/lunatic-variables-store.js.map +1 -1
  75. package/use-lunatic/commons/variables/lunatic-variables-store.spec.js +137 -6
  76. package/use-lunatic/commons/variables/lunatic-variables-store.spec.js.map +1 -1
  77. package/use-lunatic/commons/variables/models.d.ts +1 -0
  78. package/use-lunatic/commons/variables/models.js +3 -0
  79. package/use-lunatic/commons/variables/models.js.map +1 -0
  80. package/use-lunatic/commons/variables/pairwise-variables.d.ts +29 -0
  81. package/use-lunatic/commons/variables/pairwise-variables.js +199 -0
  82. package/use-lunatic/commons/variables/pairwise-variables.js.map +1 -0
  83. package/use-lunatic/props/getComponentTypeProps.d.ts +1 -1
  84. package/use-lunatic/props/propOptions.d.ts +9 -1
  85. package/use-lunatic/props/propOptions.js +57 -2
  86. package/use-lunatic/props/propOptions.js.map +1 -1
  87. package/use-lunatic/props/propOptions.spec.js +217 -55
  88. package/use-lunatic/props/propOptions.spec.js.map +1 -1
  89. package/use-lunatic/reducer/reducerInitializer.js +5 -1
  90. package/use-lunatic/reducer/reducerInitializer.js.map +1 -1
@@ -0,0 +1,496 @@
1
+ {
2
+ "id": "mkb7cgp3",
3
+ "label": {
4
+ "type": "VTL|MD",
5
+ "value": "feat: QCU basé sur une variable - QR"
6
+ },
7
+ "modele": "FEATQCUBAS",
8
+ "maxPage": "7",
9
+ "cleaning": {},
10
+ "resizing": {
11
+ "NBHAB": {
12
+ "size": "NBHAB",
13
+ "variables": ["PRENOM", "AGE"]
14
+ },
15
+ "PRENOM": {
16
+ "size": "count(PRENOM)",
17
+ "variables": ["QCUDANSBOU"]
18
+ }
19
+ },
20
+ "variables": [
21
+ {
22
+ "name": "NBHAB",
23
+ "values": {
24
+ "COLLECTED": null
25
+ },
26
+ "dimension": 0,
27
+ "variableType": "COLLECTED"
28
+ },
29
+ {
30
+ "name": "PRENOM",
31
+ "values": {
32
+ "COLLECTED": []
33
+ },
34
+ "dimension": 1,
35
+ "variableType": "COLLECTED",
36
+ "iterationReference": "mkb798x7"
37
+ },
38
+ {
39
+ "name": "AGE",
40
+ "values": {
41
+ "COLLECTED": []
42
+ },
43
+ "dimension": 1,
44
+ "variableType": "COLLECTED",
45
+ "iterationReference": "mkb798x7"
46
+ },
47
+ {
48
+ "name": "QCUHORSBOU",
49
+ "values": {
50
+ "COLLECTED": null
51
+ },
52
+ "dimension": 0,
53
+ "variableType": "COLLECTED"
54
+ },
55
+ {
56
+ "name": "QCUDANSBOU",
57
+ "values": {
58
+ "COLLECTED": []
59
+ },
60
+ "dimension": 1,
61
+ "variableType": "COLLECTED",
62
+ "iterationReference": "mkb798x7"
63
+ },
64
+ {
65
+ "name": "FILTER_RESULT_NBHAB",
66
+ "dimension": 0,
67
+ "expression": {
68
+ "type": "VTL",
69
+ "value": "true"
70
+ },
71
+ "variableType": "CALCULATED",
72
+ "isIgnoredByLunatic": true
73
+ },
74
+ {
75
+ "name": "FILTER_RESULT_PRENOM",
76
+ "dimension": 1,
77
+ "shapeFrom": ["PRENOM", "AGE"],
78
+ "expression": {
79
+ "type": "VTL",
80
+ "value": "true"
81
+ },
82
+ "variableType": "CALCULATED",
83
+ "isIgnoredByLunatic": true,
84
+ "iterationReference": "mkb798x7"
85
+ },
86
+ {
87
+ "name": "FILTER_RESULT_AGE",
88
+ "dimension": 1,
89
+ "shapeFrom": ["PRENOM", "AGE"],
90
+ "expression": {
91
+ "type": "VTL",
92
+ "value": "true"
93
+ },
94
+ "variableType": "CALCULATED",
95
+ "isIgnoredByLunatic": true,
96
+ "iterationReference": "mkb798x7"
97
+ },
98
+ {
99
+ "name": "FILTER_RESULT_QCUHORSBOU",
100
+ "dimension": 0,
101
+ "expression": {
102
+ "type": "VTL",
103
+ "value": "true"
104
+ },
105
+ "variableType": "CALCULATED",
106
+ "isIgnoredByLunatic": true
107
+ },
108
+ {
109
+ "name": "FILTER_RESULT_QCUDANSBOU",
110
+ "dimension": 1,
111
+ "shapeFrom": ["PRENOM", "AGE"],
112
+ "expression": {
113
+ "type": "VTL",
114
+ "value": "true"
115
+ },
116
+ "variableType": "CALCULATED",
117
+ "isIgnoredByLunatic": true,
118
+ "iterationReference": "mkb798x7"
119
+ }
120
+ ],
121
+ "components": [
122
+ {
123
+ "id": "mkb6zd6d",
124
+ "page": "1",
125
+ "label": {
126
+ "type": "VTL",
127
+ "value": "\"I - \" || \"S1\""
128
+ },
129
+ "componentType": "Sequence",
130
+ "conditionFilter": {
131
+ "type": "VTL",
132
+ "value": "true"
133
+ }
134
+ },
135
+ {
136
+ "id": "question-mkb7hxy8",
137
+ "page": "2",
138
+ "label": {
139
+ "type": "VTL|MD",
140
+ "value": "\"Nombre d'habitants\""
141
+ },
142
+ "components": [
143
+ {
144
+ "id": "mkb7hxy8",
145
+ "max": 10.0,
146
+ "min": 0.0,
147
+ "page": "2",
148
+ "controls": [
149
+ {
150
+ "id": "mkb7hxy8-format-borne-inf-sup",
151
+ "type": "SIMPLE",
152
+ "control": {
153
+ "type": "VTL",
154
+ "value": "not(not(isnull(NBHAB)) and (0>NBHAB or 10<NBHAB))"
155
+ },
156
+ "criticality": "ERROR",
157
+ "errorMessage": {
158
+ "type": "VTL|MD",
159
+ "value": "\" La valeur doit être comprise entre 0 et 10\""
160
+ },
161
+ "typeOfControl": "FORMAT"
162
+ },
163
+ {
164
+ "id": "mkb7hxy8-format-decimal",
165
+ "type": "SIMPLE",
166
+ "control": {
167
+ "type": "VTL",
168
+ "value": "not(not(isnull(NBHAB)) and round(NBHAB,0)<>NBHAB)"
169
+ },
170
+ "criticality": "ERROR",
171
+ "errorMessage": {
172
+ "type": "VTL|MD",
173
+ "value": "\"Le nombre doit comporter au maximum 0 chiffre(s) après la virgule\""
174
+ },
175
+ "typeOfControl": "FORMAT"
176
+ }
177
+ ],
178
+ "decimals": 0,
179
+ "response": {
180
+ "name": "NBHAB"
181
+ },
182
+ "description": {
183
+ "type": "TXT",
184
+ "value": "Format attendu : un nombre entre 0 et 10"
185
+ },
186
+ "isMandatory": false,
187
+ "componentType": "InputNumber"
188
+ }
189
+ ],
190
+ "componentType": "Question",
191
+ "conditionFilter": {
192
+ "type": "VTL",
193
+ "value": "true"
194
+ }
195
+ },
196
+ {
197
+ "id": "mkb798x7",
198
+ "page": "3",
199
+ "depth": 1,
200
+ "lines": {
201
+ "max": {
202
+ "type": "VTL",
203
+ "value": "NBHAB"
204
+ },
205
+ "min": {
206
+ "type": "VTL",
207
+ "value": "NBHAB"
208
+ }
209
+ },
210
+ "components": [
211
+ {
212
+ "id": "mkb6z1pv",
213
+ "page": "3",
214
+ "label": {
215
+ "type": "VTL",
216
+ "value": "\"II - \" || \"THL\"",
217
+ "shapeFrom": "PRENOM"
218
+ },
219
+ "componentType": "Sequence",
220
+ "conditionFilter": {
221
+ "type": "VTL",
222
+ "value": "true",
223
+ "shapeFrom": "PRENOM"
224
+ }
225
+ },
226
+ {
227
+ "id": "question-mkb7180z",
228
+ "page": "3",
229
+ "label": {
230
+ "type": "VTL|MD",
231
+ "value": "\"Prénom\""
232
+ },
233
+ "components": [
234
+ {
235
+ "id": "mkb7180z",
236
+ "page": "3",
237
+ "response": {
238
+ "name": "PRENOM"
239
+ },
240
+ "maxLength": 249,
241
+ "isMandatory": false,
242
+ "componentType": "Input"
243
+ }
244
+ ],
245
+ "componentType": "Question",
246
+ "conditionFilter": {
247
+ "type": "VTL",
248
+ "value": "true"
249
+ }
250
+ },
251
+ {
252
+ "id": "question-mkb7gox2",
253
+ "page": "3",
254
+ "label": {
255
+ "type": "VTL|MD",
256
+ "value": "\"Âge\""
257
+ },
258
+ "components": [
259
+ {
260
+ "id": "mkb7gox2",
261
+ "max": 100.0,
262
+ "min": 0.0,
263
+ "page": "3",
264
+ "controls": [
265
+ {
266
+ "id": "mkb7gox2-format-borne-inf-sup",
267
+ "type": "SIMPLE",
268
+ "control": {
269
+ "type": "VTL",
270
+ "value": "not(not(isnull(AGE)) and (0>AGE or 100<AGE))"
271
+ },
272
+ "criticality": "ERROR",
273
+ "errorMessage": {
274
+ "type": "VTL|MD",
275
+ "value": "\" La valeur doit être comprise entre 0 et 100\""
276
+ },
277
+ "typeOfControl": "FORMAT"
278
+ },
279
+ {
280
+ "id": "mkb7gox2-format-decimal",
281
+ "type": "SIMPLE",
282
+ "control": {
283
+ "type": "VTL",
284
+ "value": "not(not(isnull(AGE)) and round(AGE,0)<>AGE)"
285
+ },
286
+ "criticality": "ERROR",
287
+ "errorMessage": {
288
+ "type": "VTL|MD",
289
+ "value": "\"Le nombre doit comporter au maximum 0 chiffre(s) après la virgule\""
290
+ },
291
+ "typeOfControl": "FORMAT"
292
+ }
293
+ ],
294
+ "decimals": 0,
295
+ "response": {
296
+ "name": "AGE"
297
+ },
298
+ "description": {
299
+ "type": "TXT",
300
+ "value": "Format attendu : un nombre entre 0 et 100"
301
+ },
302
+ "isMandatory": false,
303
+ "componentType": "InputNumber"
304
+ }
305
+ ],
306
+ "componentType": "Question",
307
+ "conditionFilter": {
308
+ "type": "VTL",
309
+ "value": "true"
310
+ }
311
+ }
312
+ ],
313
+ "componentType": "Loop",
314
+ "paginatedLoop": false,
315
+ "conditionFilter": {
316
+ "type": "VTL",
317
+ "value": "(true)"
318
+ },
319
+ "loopDependencies": ["NBHAB"],
320
+ "isPaginatedByIterations": false
321
+ },
322
+ {
323
+ "id": "mkb7ed5t",
324
+ "page": "4",
325
+ "label": {
326
+ "type": "VTL",
327
+ "value": "\"III - \" || \"S2\""
328
+ },
329
+ "componentType": "Sequence",
330
+ "conditionFilter": {
331
+ "type": "VTL",
332
+ "value": "true"
333
+ }
334
+ },
335
+ {
336
+ "id": "question-mkb7ktxx",
337
+ "page": "5",
338
+ "label": {
339
+ "type": "VTL|MD",
340
+ "value": "\"QCU hors boucle\""
341
+ },
342
+ "components": [
343
+ {
344
+ "id": "mkb7ktxx",
345
+ "page": "5",
346
+ "optionSource": "PRENOM",
347
+ "optionFilter": {
348
+ "type": "VTL",
349
+ "value": "AGE >= 18",
350
+ "shapeFrom": "PRENOM"
351
+ },
352
+ "response": {
353
+ "name": "QCUHORSBOU"
354
+ },
355
+ "isMandatory": false,
356
+ "orientation": "vertical",
357
+ "componentType": "Radio"
358
+ }
359
+ ],
360
+ "declarations": [
361
+ {
362
+ "id": "mke55sef",
363
+ "label": {
364
+ "type": "VTL|MD",
365
+ "value": "\"Les modalités de réponse sont les prénoms des individus ayant 18 ans ou plus\""
366
+ },
367
+ "position": "AFTER_QUESTION_TEXT",
368
+ "declarationType": "HELP"
369
+ }
370
+ ],
371
+ "componentType": "Question",
372
+ "conditionFilter": {
373
+ "type": "VTL",
374
+ "value": "true"
375
+ }
376
+ },
377
+ {
378
+ "id": "mkb71vg8",
379
+ "page": "6",
380
+ "depth": 1,
381
+ "maxPage": "2",
382
+ "components": [
383
+ {
384
+ "id": "mkb76y5x",
385
+ "page": "6.1",
386
+ "label": {
387
+ "type": "VTL",
388
+ "value": "\"IV - \" || \"S3\"",
389
+ "shapeFrom": "PRENOM"
390
+ },
391
+ "componentType": "Sequence",
392
+ "conditionFilter": {
393
+ "type": "VTL",
394
+ "value": "true",
395
+ "shapeFrom": "PRENOM"
396
+ }
397
+ },
398
+ {
399
+ "id": "question-mkb73lyz",
400
+ "page": "6.2",
401
+ "label": {
402
+ "type": "VTL|MD",
403
+ "value": "\"QCU dans boucle\""
404
+ },
405
+ "components": [
406
+ {
407
+ "id": "mkb73lyz",
408
+ "page": "6.2",
409
+ "optionSource": "PRENOM",
410
+ "optionFilter": {
411
+ "type": "VTL",
412
+ "value": "AGE >= 18",
413
+ "shapeFrom": "PRENOM"
414
+ },
415
+ "response": {
416
+ "name": "QCUDANSBOU"
417
+ },
418
+ "isMandatory": false,
419
+ "orientation": "vertical",
420
+ "componentType": "Radio"
421
+ }
422
+ ],
423
+ "declarations": [
424
+ {
425
+ "id": "mke5bdkv",
426
+ "label": {
427
+ "type": "VTL|MD",
428
+ "value": "\"Les modalités de réponse sont les prénoms des individus ayant 18 ans ou plus\""
429
+ },
430
+ "position": "AFTER_QUESTION_TEXT",
431
+ "declarationType": "HELP"
432
+ }
433
+ ],
434
+ "componentType": "Question",
435
+ "conditionFilter": {
436
+ "type": "VTL",
437
+ "value": "true"
438
+ }
439
+ }
440
+ ],
441
+ "iterations": {
442
+ "type": "VTL",
443
+ "value": "count(PRENOM)"
444
+ },
445
+ "componentType": "Loop",
446
+ "paginatedLoop": true,
447
+ "conditionFilter": {
448
+ "type": "VTL",
449
+ "value": "(true)"
450
+ },
451
+ "loopDependencies": ["PRENOM"]
452
+ },
453
+ {
454
+ "id": "mkb7iuwp",
455
+ "page": "7",
456
+ "label": {
457
+ "type": "VTL",
458
+ "value": "\"V - \" || \"S4 - Fin\""
459
+ },
460
+ "componentType": "Sequence",
461
+ "conditionFilter": {
462
+ "type": "VTL",
463
+ "value": "true"
464
+ }
465
+ }
466
+ ],
467
+ "pagination": "question",
468
+ "suggesters": [
469
+ {
470
+ "name": "L_DIPLOMES-2-1-0",
471
+ "fields": [
472
+ {
473
+ "min": 3,
474
+ "name": "label",
475
+ "rules": ["[\\w-]+"],
476
+ "stemmer": false,
477
+ "language": "French"
478
+ }
479
+ ],
480
+ "version": 1,
481
+ "queryParser": {
482
+ "type": "tokenized",
483
+ "params": {
484
+ "min": 3,
485
+ "pattern": "[\\w.-]+",
486
+ "stemmer": false,
487
+ "language": "French"
488
+ }
489
+ }
490
+ }
491
+ ],
492
+ "componentType": "Questionnaire",
493
+ "enoCoreVersion": "3.59.0",
494
+ "generatingDate": "14-01-2026 14:51:23",
495
+ "lunaticModelVersion": "5.11.0"
496
+ }
@@ -159,7 +159,9 @@ export type ComponentCheckboxBooleanDefinition =
159
159
  export type ComponentRadioDefinition = ComponentDefinitionBaseWithResponse & {
160
160
  componentType: 'Radio';
161
161
  orientation?: 'horizontal' | 'vertical';
162
- options: OptionsWithDetail;
162
+ options?: OptionsWithDetail;
163
+ optionSource?: string;
164
+ optionFilter?: VTLExpression;
163
165
  };
164
166
  export type OptionsWithDetail = {
165
167
  value: string | boolean;
@@ -176,7 +178,9 @@ export type OptionsWithDetail = {
176
178
  export type ComponentDropdownDefinition =
177
179
  ComponentDefinitionBaseWithResponse & {
178
180
  componentType: 'Dropdown';
179
- options: Options;
181
+ options?: Options;
182
+ optionSource?: string;
183
+ optionFilter?: VTLExpression;
180
184
  };
181
185
  export type ComponentQuestionDefinition = ComponentDefinitionBase & {
182
186
  componentType: 'Question';
@@ -185,7 +189,9 @@ export type ComponentQuestionDefinition = ComponentDefinitionBase & {
185
189
  export type ComponentCheckboxOneDefinition =
186
190
  ComponentDefinitionBaseWithResponse & {
187
191
  componentType: 'CheckboxOne';
188
- options: OptionsWithDetail;
192
+ options?: OptionsWithDetail;
193
+ optionSource?: string;
194
+ optionFilter?: VTLExpression;
189
195
  };
190
196
  export type ComponentSuggesterDefinition =
191
197
  ComponentDefinitionBaseWithResponse & {
@@ -223,6 +229,15 @@ export type ComponentPairWiseLinksDefinition = ComponentDefinitionBase & {
223
229
  [k: string]: string | null;
224
230
  };
225
231
  };
232
+ sourceVariables?: {
233
+ /** Name of the variable containing the name of the respondent */
234
+ name?: string;
235
+ /**
236
+ * Name of the variable containing the gender of the respondent
237
+ * (value of variable -> 1:male, 2: female)
238
+ */
239
+ gender?: string;
240
+ };
226
241
  components: ComponentDefinition[];
227
242
  };
228
243
  export type ComponentSummaryDefinition = ComponentDefinitionBase & {
@@ -1,59 +1,27 @@
1
1
  import type {
2
- LunaticComponentDefinition,
3
2
  LunaticControl,
4
3
  LunaticError,
5
4
  LunaticReducerState,
6
5
  } from '../type';
7
- import {
8
- fillComponentExpressions,
9
- type DeepTranslateExpression,
10
- } from './fill-components/fill-component-expressions';
6
+ import { fillComponentExpressions } from './fill-components/fill-component-expressions';
11
7
  import { checkRoundaboutControl } from '../reducer/controls/check-roundabout-control';
12
8
  import { checkBaseControl } from '../reducer/controls/check-base-control';
13
9
  import { getComponentsFromState } from './get-components-from-state';
10
+ import {
11
+ InterpretedLoopComponent,
12
+ InterpretedRoundaboutComponent,
13
+ isLoopComponent,
14
+ isQuestionComponent,
15
+ isRoundaboutComponent,
16
+ type ComponentDefinition,
17
+ type InterpretedComponent,
18
+ } from './component';
14
19
 
15
20
  export type StateForControls = Pick<
16
21
  LunaticReducerState,
17
22
  'pager' | 'pages' | 'isInLoop' | 'executeExpression'
18
23
  >;
19
24
 
20
- type ComponentDefinition = LunaticComponentDefinition;
21
- type InterpretedComponent = DeepTranslateExpression<LunaticComponentDefinition>;
22
- type InterpretedLoopComponent = DeepTranslateExpression<
23
- ComponentDefinition & {
24
- componentType: 'Loop' | 'RosterForLoop';
25
- }
26
- >;
27
- type InterpretedRoundaboutComponent = DeepTranslateExpression<
28
- ComponentDefinition & {
29
- componentType: 'Roundabout';
30
- }
31
- >;
32
-
33
- /**
34
- * Check if the component is a Loop or a RosterForLoop
35
- */
36
- const isLoopComponent = (
37
- component: ComponentDefinition | InterpretedComponent
38
- ): component is InterpretedLoopComponent => {
39
- return ['Loop', 'RosterForLoop'].includes(component.componentType);
40
- };
41
-
42
- /**
43
- * Check if the component is a Roundabout
44
- */
45
- const isRoundaboutComponent = (
46
- component: ComponentDefinition | InterpretedComponent
47
- ): component is InterpretedRoundaboutComponent => {
48
- return component.componentType === 'Roundabout';
49
- };
50
-
51
- const isQuestionComponent = (
52
- component: ComponentDefinition | InterpretedComponent
53
- ) => {
54
- return 'Question' === component.componentType;
55
- };
56
-
57
25
  /**
58
26
  * Check if components of the current page have errors, and return a map of
59
27
  * errors (indexed by component ID).