@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,337 @@
1
+ {
2
+ "id": "mkdupypp",
3
+ "label": { "type": "VTL|MD", "value": "Pairwise global variables" },
4
+ "modele": "PAIRWISEGL",
5
+ "maxPage": "5",
6
+ "cleaning": {
7
+ "PRENOM": {
8
+ "LIENS_HABITANTS": [
9
+ {
10
+ "shapeFrom": "PRENOM",
11
+ "expression": "nvl(PRENOM, \"\") <> \"\"",
12
+ "isAggregatorUsed": false
13
+ }
14
+ ]
15
+ }
16
+ },
17
+ "resizing": {
18
+ "PRENOM": {
19
+ "size": "count(PRENOM)",
20
+ "variables": ["VERIF"],
21
+ "linksVariables": ["LIENS_HABITANTS"],
22
+ "sizeForLinksVariables": {
23
+ "xAxisSize": "count(PRENOM)",
24
+ "yAxisSize": "count(PRENOM)"
25
+ }
26
+ }
27
+ },
28
+ "variables": [
29
+ {
30
+ "name": "PRENOM",
31
+ "values": { "COLLECTED": [] },
32
+ "dimension": 1,
33
+ "variableType": "COLLECTED",
34
+ "iterationReference": "mkdulmx2"
35
+ },
36
+ {
37
+ "name": "SEXE",
38
+ "values": { "COLLECTED": [] },
39
+ "dimension": 1,
40
+ "variableType": "COLLECTED",
41
+ "iterationReference": "mkdulmx2"
42
+ },
43
+ {
44
+ "name": "LIENS_HABITANTS",
45
+ "values": { "COLLECTED": [[]] },
46
+ "dimension": 2,
47
+ "variableType": "COLLECTED",
48
+ "iterationReference": "mkdulmx2"
49
+ },
50
+ {
51
+ "name": "VERIF",
52
+ "values": { "COLLECTED": [] },
53
+ "dimension": 1,
54
+ "variableType": "COLLECTED",
55
+ "iterationReference": "mkdulmx2"
56
+ },
57
+ {
58
+ "name": "xAxis",
59
+ "shapeFrom": ["PRENOM"],
60
+ "expression": { "type": "VTL", "value": "PRENOM" },
61
+ "variableType": "CALCULATED",
62
+ "bindingDependencies": ["PRENOM"]
63
+ },
64
+ {
65
+ "name": "yAxis",
66
+ "shapeFrom": ["PRENOM"],
67
+ "expression": { "type": "VTL", "value": "PRENOM" },
68
+ "variableType": "CALCULATED",
69
+ "bindingDependencies": ["PRENOM"]
70
+ },
71
+ {
72
+ "name": "FILTER_RESULT_PRENOM",
73
+ "dimension": 1,
74
+ "shapeFrom": ["PRENOM", "SEXE"],
75
+ "expression": { "type": "VTL", "value": "true" },
76
+ "variableType": "CALCULATED",
77
+ "isIgnoredByLunatic": true,
78
+ "iterationReference": "mkdulmx2"
79
+ },
80
+ {
81
+ "name": "FILTER_RESULT_SEXE",
82
+ "dimension": 1,
83
+ "shapeFrom": ["PRENOM", "SEXE"],
84
+ "expression": { "type": "VTL", "value": "true" },
85
+ "variableType": "CALCULATED",
86
+ "isIgnoredByLunatic": true,
87
+ "iterationReference": "mkdulmx2"
88
+ },
89
+ {
90
+ "name": "FILTER_RESULT_LIENS_HABITANTS",
91
+ "dimension": 2,
92
+ "shapeFrom": ["PRENOM", "SEXE"],
93
+ "expression": {
94
+ "type": "VTL",
95
+ "value": "(nvl(xAxis, \"\") <> \"\") and (nvl(yAxis, \"\") <> \"\")"
96
+ },
97
+ "variableType": "CALCULATED",
98
+ "isIgnoredByLunatic": true,
99
+ "iterationReference": "mkdulmx2"
100
+ },
101
+ {
102
+ "name": "FILTER_RESULT_VERIF",
103
+ "dimension": 1,
104
+ "shapeFrom": ["PRENOM", "SEXE"],
105
+ "expression": { "type": "VTL", "value": "true" },
106
+ "variableType": "CALCULATED",
107
+ "isIgnoredByLunatic": true,
108
+ "iterationReference": "mkdulmx2"
109
+ }
110
+ ],
111
+ "components": [
112
+ {
113
+ "id": "mkdulmx2",
114
+ "page": "1",
115
+ "depth": 1,
116
+ "label": { "type": "VTL|MD", "value": "Ajouter un habitant" },
117
+ "lines": {
118
+ "max": { "type": "VTL", "value": "10" },
119
+ "min": { "type": "VTL", "value": "1" }
120
+ },
121
+ "components": [
122
+ {
123
+ "id": "mkdumm9l",
124
+ "page": "1",
125
+ "label": {
126
+ "type": "VTL",
127
+ "value": "\"I - \" || \"Habitants du logement\"",
128
+ "shapeFrom": "PRENOM"
129
+ },
130
+ "componentType": "Sequence",
131
+ "conditionFilter": {
132
+ "type": "VTL",
133
+ "value": "true",
134
+ "shapeFrom": "PRENOM"
135
+ }
136
+ },
137
+ {
138
+ "id": "question-mkduvzxm",
139
+ "page": "1",
140
+ "label": { "type": "VTL|MD", "value": "\"Prénom:\"" },
141
+ "components": [
142
+ {
143
+ "id": "mkduvzxm",
144
+ "page": "1",
145
+ "response": { "name": "PRENOM" },
146
+ "maxLength": 249,
147
+ "isMandatory": false,
148
+ "componentType": "Input"
149
+ }
150
+ ],
151
+ "componentType": "Question",
152
+ "conditionFilter": { "type": "VTL", "value": "true" }
153
+ },
154
+ {
155
+ "id": "question-mkdujzn9",
156
+ "page": "1",
157
+ "label": { "type": "VTL|MD", "value": "\"Sexe:\"" },
158
+ "components": [
159
+ {
160
+ "id": "mkdujzn9",
161
+ "page": "1",
162
+ "options": [
163
+ {
164
+ "label": { "type": "VTL|MD", "value": "\"Homme\"" },
165
+ "value": "1"
166
+ },
167
+ {
168
+ "label": { "type": "VTL|MD", "value": "\"Femme\"" },
169
+ "value": "2"
170
+ }
171
+ ],
172
+ "response": { "name": "SEXE" },
173
+ "isMandatory": false,
174
+ "orientation": "vertical",
175
+ "componentType": "Radio"
176
+ }
177
+ ],
178
+ "componentType": "Question",
179
+ "conditionFilter": { "type": "VTL", "value": "true" }
180
+ }
181
+ ],
182
+ "componentType": "Loop",
183
+ "paginatedLoop": false,
184
+ "conditionFilter": { "type": "VTL", "value": "(true)" }
185
+ },
186
+ {
187
+ "id": "mkdus3wr",
188
+ "page": "2",
189
+ "label": {
190
+ "type": "VTL",
191
+ "value": "\"II - \" || \"Liens entre les habitants du logement\"",
192
+ "shapeFrom": "PRENOM"
193
+ },
194
+ "componentType": "Sequence",
195
+ "conditionFilter": {
196
+ "type": "VTL",
197
+ "value": "true",
198
+ "shapeFrom": "PRENOM"
199
+ }
200
+ },
201
+ {
202
+ "id": "question-mkdv8ihy",
203
+ "page": "3",
204
+ "components": [
205
+ {
206
+ "id": "mkdv8ihy",
207
+ "page": "3",
208
+ "symLinks": {
209
+ "LIENS_HABITANTS": {
210
+ "1": "1",
211
+ "2": "3",
212
+ "3": "2",
213
+ "4": "4",
214
+ "5": "6",
215
+ "6": "5",
216
+ "7": "8",
217
+ "8": "7",
218
+ "9": "10",
219
+ "10": "9",
220
+ "11": "13",
221
+ "12": "12",
222
+ "13": "11",
223
+ "14": null,
224
+ "15": "15",
225
+ "16": "16",
226
+ "17": "17",
227
+ "18": "18"
228
+ }
229
+ },
230
+ "components": [
231
+ {
232
+ "id": "mkdv8ihy-pairwise-dropdown",
233
+ "page": "3",
234
+ "label": {
235
+ "type": "VTL|MD",
236
+ "value": "\"Qui est \" || yAxis || \" pour \" || xAxis || \" ?\""
237
+ },
238
+ "options": [
239
+ {
240
+ "label": { "type": "VTL", "value": "\"Conjoint\"" },
241
+ "value": "1"
242
+ },
243
+ {
244
+ "label": { "type": "VTL", "value": "\"Parent\"" },
245
+ "value": "2"
246
+ },
247
+ {
248
+ "label": { "type": "VTL", "value": "\"Enfant\"" },
249
+ "value": "3"
250
+ },
251
+ {
252
+ "label": { "type": "VTL", "value": "\"Autre\"" },
253
+ "value": "4"
254
+ }
255
+ ],
256
+ "response": { "name": "LIENS_HABITANTS" },
257
+ "isMandatory": false,
258
+ "componentType": "Dropdown",
259
+ "conditionFilter": {
260
+ "type": "VTL",
261
+ "value": "(nvl(xAxis, \"\") <> \"\") and (nvl(yAxis, \"\") <> \"\")"
262
+ }
263
+ }
264
+ ],
265
+ "sourceVariables": {
266
+ "name": "PRENOM",
267
+ "gender": "SEXE"
268
+ },
269
+ "componentType": "PairwiseLinks",
270
+ "xAxisIterations": { "type": "VTL", "value": "count(PRENOM)" },
271
+ "yAxisIterations": { "type": "VTL", "value": "count(PRENOM)" }
272
+ }
273
+ ],
274
+ "componentType": "Question",
275
+ "conditionFilter": { "type": "VTL", "value": "true" }
276
+ },
277
+ {
278
+ "id": "mkduz03e",
279
+ "page": "4",
280
+ "depth": 1,
281
+ "maxPage": "2",
282
+ "components": [
283
+ {
284
+ "id": "mkdusamd",
285
+ "page": "4.1",
286
+ "label": {
287
+ "type": "VTL",
288
+ "value": "\"III - \" || \"Variables globales\"",
289
+ "shapeFrom": "PRENOM"
290
+ },
291
+ "componentType": "Sequence",
292
+ "conditionFilter": {
293
+ "type": "VTL",
294
+ "value": "true",
295
+ "shapeFrom": "PRENOM"
296
+ }
297
+ },
298
+ {
299
+ "id": "question-mkdvcykn",
300
+ "page": "4.2",
301
+ "label": {
302
+ "type": "VTL|MD",
303
+ "value": "PRENOM || \": votre premier parent est \" || GLOBAL_PARENT1_PRENOM || \" (\" || GLOBAL_PARENT1_SEXE || \"), votre second parent est \" || GLOBAL_PARENT2_PRENOM || \" (\" || GLOBAL_PARENT2_SEXE || \"), votre partenaire est \" || GLOBAL_CONJOINT_PRENOM || \", vos enfants sont \" || GLOBAL_ENFANTS_PRENOMS"
304
+ },
305
+ "components": [
306
+ {
307
+ "id": "mkdvcykn",
308
+ "page": "4.2",
309
+ "response": { "name": "VERIF" },
310
+ "isMandatory": false,
311
+ "componentType": "CheckboxBoolean"
312
+ }
313
+ ],
314
+ "componentType": "Question",
315
+ "conditionFilter": { "type": "VTL", "value": "true" }
316
+ }
317
+ ],
318
+ "iterations": { "type": "VTL", "value": "count(PRENOM)" },
319
+ "componentType": "Loop",
320
+ "paginatedLoop": true,
321
+ "conditionFilter": { "type": "VTL", "value": "(true)" },
322
+ "loopDependencies": ["PRENOM"]
323
+ },
324
+ {
325
+ "id": "mkdvgmn0",
326
+ "page": "5",
327
+ "label": { "type": "VTL", "value": "\"IV - \" || \"Fin\"" },
328
+ "componentType": "Sequence",
329
+ "conditionFilter": { "type": "VTL", "value": "true" }
330
+ }
331
+ ],
332
+ "pagination": "question",
333
+ "componentType": "Questionnaire",
334
+ "enoCoreVersion": "3.59.0",
335
+ "generatingDate": "14-01-2026 10:14:03",
336
+ "lunaticModelVersion": "5.11.0"
337
+ }
@@ -7,8 +7,10 @@ import source from './source.json';
7
7
  import sourceHorizontal from './sourceHorizontal.json';
8
8
  import sourceDetail from './sourceDetail.json';
9
9
  import sourceCondition from './sourceCondition.json';
10
+ import sourceDynamicOptions from './sourceDynamicOptions.json';
10
11
 
11
12
  import { Meta } from '@storybook/react';
13
+ import { dataFromObject } from '../../utils/object';
12
14
 
13
15
  const meta: Meta<typeof Orchestrator> = {
14
16
  title: 'Components/Radio',
@@ -51,3 +53,14 @@ export const WithDetail: OrchestratorStory = {
51
53
  source: sourceDetail,
52
54
  },
53
55
  };
56
+
57
+ export const DynamicOptions: OrchestratorStory = {
58
+ args: {
59
+ source: sourceDynamicOptions,
60
+ data: dataFromObject({
61
+ NBHAB: 3,
62
+ PRENOM: ['Verso', 'Maëlle', 'Aline'],
63
+ AGE: [30, 16, 50],
64
+ }),
65
+ },
66
+ };