@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": "Dropdown"
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": "Dropdown"
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
+ }
@@ -4,6 +4,7 @@ import {
4
4
  type OrchestratorStory,
5
5
  } from '../utils/Orchestrator';
6
6
  import source from './source.json';
7
+ import sourceGlobalVariables from './sourceGlobalVariables.json';
7
8
 
8
9
  import { Meta } from '@storybook/react';
9
10
 
@@ -28,3 +29,9 @@ export const Default: OrchestratorStory = {
28
29
  initialPage: '3',
29
30
  },
30
31
  };
32
+
33
+ export const GlobalVariables: OrchestratorStory = {
34
+ args: {
35
+ source: sourceGlobalVariables,
36
+ },
37
+ };