@inseefr/lunatic 2.4.10 → 2.5.0-fast-forward
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.
- package/lib/components/commons/components/orchestrated-component.js +10 -30
- package/lib/components/commons/create-row-orchestrator.js +7 -2
- package/lib/components/component-set/html/component-set-components.js +16 -25
- package/lib/components/component-set/lunatic-component-set.js +23 -37
- package/lib/components/index.js +14 -0
- package/lib/components/loop/block-for-loop/block-for-loop.js +4 -2
- package/lib/components/loop/block-for-loop/row.js +4 -2
- package/lib/components/loop/loop.js +6 -3
- package/lib/components/loop/roster-for-loop/body.js +4 -2
- package/lib/components/loop/roster-for-loop/roster-for-loop.js +2 -0
- package/lib/components/loop/roster-for-loop/roster-table.js +4 -2
- package/lib/components/loop/roster-for-loop/row.js +3 -1
- package/lib/components/question-explication/html/question-explication.js +53 -0
- package/lib/components/question-explication/html/question-explication.scss +35 -0
- package/lib/components/question-explication/index.js +13 -0
- package/lib/components/question-explication/lunatic-question-explication.js +32 -0
- package/lib/components/question-explication/question-explication.spec.js +49 -0
- package/lib/components/roundabout/lunatic-roundabout.js +2 -4
- package/lib/components/subsequence/subsequence.js +0 -2
- package/lib/components/subsequence/subsequence.spec.js +2 -2
- package/lib/components/summary/html/summary-container.js +14 -0
- package/lib/components/summary/html/summary-responses.js +53 -0
- package/lib/components/summary/html/summary-title.js +20 -0
- package/lib/components/summary/index.js +12 -0
- package/lib/components/summary/lunatic-summary.js +99 -0
- package/lib/src/components/commons/components/orchestrated-component.d.ts +4 -5
- package/lib/src/components/commons/create-row-orchestrator.d.ts +3 -2
- package/lib/src/components/component-set/html/component-set-components.d.ts +2 -2
- package/lib/src/components/component-set/lunatic-component-set.d.ts +2 -1
- package/lib/src/components/index.d.ts +2 -0
- package/lib/src/components/loop/block-for-loop/block-for-loop-ochestrator.d.ts +3 -2
- package/lib/src/components/loop/block-for-loop/row.d.ts +2 -1
- package/lib/src/components/loop/roster-for-loop/body.d.ts +2 -2
- package/lib/src/components/loop/roster-for-loop/roster-for-loop-orchestrator.d.ts +3 -2
- package/lib/src/components/loop/roster-for-loop/roster-table.d.ts +2 -2
- package/lib/src/components/loop/roster-for-loop/row.d.ts +2 -1
- package/lib/src/components/question-explication/html/question-explication.d.ts +7 -0
- package/lib/src/components/question-explication/index.d.ts +1 -0
- package/lib/src/components/question-explication/lunatic-question-explication.d.ts +3 -0
- package/lib/src/components/question-explication/question-explication.spec.d.ts +1 -0
- package/lib/src/components/subsequence/subsequence.d.ts +2 -2
- package/lib/src/components/summary/html/summary-container.d.ts +2 -0
- package/lib/src/components/summary/html/summary-responses.d.ts +12 -0
- package/lib/src/components/summary/html/summary-title.d.ts +5 -0
- package/lib/src/components/summary/index.d.ts +1 -0
- package/lib/src/components/summary/lunatic-summary.d.ts +7 -0
- package/lib/src/components/type.d.ts +18 -0
- package/lib/src/index.d.ts +1 -0
- package/lib/src/use-lunatic/actions.d.ts +8 -169
- package/lib/src/use-lunatic/commons/fill-components/fill-from-state.d.ts +137 -112
- package/lib/src/use-lunatic/commons/fill-components/fill-missing-response.d.ts +2 -1
- package/lib/src/use-lunatic/commons/fill-components/fill-specific-expression.d.ts +115 -94
- package/lib/src/use-lunatic/commons/page-navigation.d.ts +7 -0
- package/lib/src/use-lunatic/commons/page-navigation.spec.d.ts +1 -0
- package/lib/src/use-lunatic/commons/page.d.ts +11 -0
- package/lib/src/use-lunatic/commons/use-components-from-state.d.ts +1 -1
- package/lib/src/use-lunatic/reducer/commons/auto-explore-loop.d.ts +5 -0
- package/lib/src/use-lunatic/reducer/commons/index.d.ts +0 -1
- package/lib/src/use-lunatic/reducer/commons/is-loop-component.d.ts +2 -2
- package/lib/src/use-lunatic/reducer/overview/overview-on-init.d.ts +1 -7
- package/lib/src/use-lunatic/reducer/reduce-on-init.d.ts +1 -1
- package/lib/src/use-lunatic/replace-component-sequence.d.ts +3 -3
- package/lib/src/use-lunatic/type-source.d.ts +27 -13
- package/lib/src/use-lunatic/type.d.ts +4 -12
- package/lib/src/use-lunatic/use-lunatic.d.ts +475 -10
- package/lib/src/utils/store-tools/worker-path.d.ts +1 -0
- package/lib/stories/component-set/component-set.stories.js +2 -1
- package/lib/stories/loop/block-for-loop.stories.js +8 -1
- package/lib/stories/loop/roster-for-loop.stories.js +92 -2
- package/lib/{use-lunatic/reducer/reduce-roundabout.js → stories/question-explication/question-explication.stories.js} +21 -17
- package/lib/stories/question-explication/source.json +17 -0
- package/lib/stories/roundabout/roundabout.stories.js +2 -1
- package/lib/stories/suggester/source-component-set.json +67 -0
- package/lib/stories/suggester/suggester.stories.js +9 -1
- package/lib/stories/summary/data.json +32 -0
- package/lib/stories/summary/source.json +353 -0
- package/lib/stories/summary/summary.stories.js +37 -0
- package/lib/stories/utils/orchestrator.js +21 -6
- package/lib/use-lunatic/commons/check-pager.js +1 -2
- package/lib/use-lunatic/commons/fill-components/fill-missing-response.js +14 -12
- package/lib/use-lunatic/commons/page-navigation.js +109 -0
- package/lib/use-lunatic/commons/page-navigation.spec.js +129 -0
- package/lib/use-lunatic/commons/page.js +44 -0
- package/lib/use-lunatic/reducer/commons/auto-explore-loop.js +37 -0
- package/lib/use-lunatic/reducer/commons/index.js +0 -8
- package/lib/use-lunatic/reducer/reduce-go-next-page.js +25 -159
- package/lib/use-lunatic/reducer/reduce-go-previous-page.js +21 -127
- package/lib/use-lunatic/reducer/reduce-go-to-page.js +51 -55
- package/lib/use-lunatic/reducer/reduce-on-init.js +8 -10
- package/lib/use-lunatic/reducer/resolve-component-controls/resolve-roundabout-control.js +1 -1
- package/lib/use-lunatic/reducer/resolve-component-controls/resolve-simple-control.js +1 -1
- package/lib/use-lunatic/type-source.js +0 -2
- package/lib/use-lunatic/use-lunatic.js +22 -4
- package/lib/use-lunatic/use-lunatic.test.js +9 -7
- package/lib/utils/store-tools/auto-load.js +2 -2
- package/lib/utils/store-tools/worker-path.js +13 -0
- package/lib/utils/suggester-workers/append-to-index/create-append-task.js +2 -2
- package/package.json +3 -4
- package/lib/components/button/__snapshots__/lunatic-button.spec.jsx.snap +0 -80
- package/lib/components/commons/components/combo-box/selection/__snapshots__/selection.spec.jsx.snap +0 -81
- package/lib/src/use-lunatic/reducer/commons/is-empty-on-empty-page.d.ts +0 -3
- package/lib/src/use-lunatic/reducer/reduce-roundabout.d.ts +0 -2
- package/lib/use-lunatic/reducer/commons/is-empty-on-empty-page.js +0 -32
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
{
|
|
2
|
+
"maxPage": "5",
|
|
3
|
+
"components": [
|
|
4
|
+
{
|
|
5
|
+
"id": "seq",
|
|
6
|
+
"componentType": "Sequence",
|
|
7
|
+
"label": {
|
|
8
|
+
"value": "\"Description des individus de votre logement\"",
|
|
9
|
+
"type": "VTL|MD"
|
|
10
|
+
},
|
|
11
|
+
"conditionFilter": { "value": "true", "type": "VTL" },
|
|
12
|
+
"page": "1"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"id": "how",
|
|
16
|
+
"componentType": "InputNumber",
|
|
17
|
+
"mandatory": false,
|
|
18
|
+
"page": "2",
|
|
19
|
+
"min": 1,
|
|
20
|
+
"max": 10,
|
|
21
|
+
"decimals": 0,
|
|
22
|
+
"label": {
|
|
23
|
+
"value": "\"Combien de personnes vivent habituellement à votre adresse ?\"",
|
|
24
|
+
"type": "VTL|MD"
|
|
25
|
+
},
|
|
26
|
+
"conditionFilter": { "value": "true", "type": "VTL" },
|
|
27
|
+
"response": { "name": "NB_HAB" }
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"id": "hoew",
|
|
31
|
+
"componentType": "InputNumber",
|
|
32
|
+
"mandatory": false,
|
|
33
|
+
"page": "2",
|
|
34
|
+
"min": 42,
|
|
35
|
+
"max": 42,
|
|
36
|
+
"decimals": 0,
|
|
37
|
+
"label": {
|
|
38
|
+
"value": "\"Qu'est-ce que zéro divisé par zéro ?\"",
|
|
39
|
+
"type": "VTL|MD"
|
|
40
|
+
},
|
|
41
|
+
"conditionFilter": { "value": "true", "type": "VTL" },
|
|
42
|
+
"response": { "name": "ZERO" }
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"id": "loop",
|
|
46
|
+
"componentType": "Loop",
|
|
47
|
+
"page": "3",
|
|
48
|
+
"depth": 1,
|
|
49
|
+
"paginatedLoop": false,
|
|
50
|
+
"conditionFilter": { "value": "true", "type": "VTL" },
|
|
51
|
+
"loopDependencies": ["NHAB"],
|
|
52
|
+
"lines": {
|
|
53
|
+
"min": { "value": "NB_HAB", "type": "VTL" },
|
|
54
|
+
"max": { "value": "NB_HAB", "type": "VTL" }
|
|
55
|
+
},
|
|
56
|
+
"components": [
|
|
57
|
+
{
|
|
58
|
+
"id": "prenom",
|
|
59
|
+
"componentType": "Input",
|
|
60
|
+
"mandatory": false,
|
|
61
|
+
"maxLength": 20,
|
|
62
|
+
"label": {
|
|
63
|
+
"value": "\"Prénom\"))",
|
|
64
|
+
"type": "VTL|MD"
|
|
65
|
+
},
|
|
66
|
+
"conditionFilter": {
|
|
67
|
+
"value": "true",
|
|
68
|
+
"type": "VTL"
|
|
69
|
+
},
|
|
70
|
+
"response": { "name": "PRENOMS" }
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"id": "age",
|
|
74
|
+
"componentType": "InputNumber",
|
|
75
|
+
"maxLength": 3,
|
|
76
|
+
"label": {
|
|
77
|
+
"value": "\"Age\"))",
|
|
78
|
+
"type": "VTL|MD"
|
|
79
|
+
},
|
|
80
|
+
"conditionFilter": {
|
|
81
|
+
"value": "true",
|
|
82
|
+
"type": "VTL"
|
|
83
|
+
},
|
|
84
|
+
"response": { "name": "AGE" }
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"id": "roundabout",
|
|
90
|
+
"componentType": "Roundabout",
|
|
91
|
+
"page": "4",
|
|
92
|
+
"conditionFilter": { "value": "true", "type": "VTL" },
|
|
93
|
+
"iterations": { "value": "NB_HAB", "type": "VTL" },
|
|
94
|
+
"label": { "value": "\"Libellé du rondpoint\"", "type": "VTL" },
|
|
95
|
+
"locked": true,
|
|
96
|
+
"expressions": {
|
|
97
|
+
"unnecessary": {
|
|
98
|
+
"value": "AGE < 13",
|
|
99
|
+
"type": "VTL"
|
|
100
|
+
},
|
|
101
|
+
"complete": {
|
|
102
|
+
"value": "not(isnull(KNOWREC)) and not(isnull(SEXE)) and not(isnull(SOMETHING))",
|
|
103
|
+
"type": "VTL"
|
|
104
|
+
},
|
|
105
|
+
"partial": {
|
|
106
|
+
"value": "not(isnull(KNOWREC)) or not(isnull(SEXE)) or not(isnull(SOMETHING))",
|
|
107
|
+
"type": "VTL"
|
|
108
|
+
},
|
|
109
|
+
"label": {
|
|
110
|
+
"value": "\"Série de question pour \" || PRENOMS",
|
|
111
|
+
"type": "VTL"
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"controls": [
|
|
115
|
+
{
|
|
116
|
+
"id": "roundabout-Carefull",
|
|
117
|
+
"criticality": "WARN",
|
|
118
|
+
"control": {
|
|
119
|
+
"value": "not(isnull(KNOWREC)) and not(isnull(SEXE)) and not(isnull(SOMETHING))",
|
|
120
|
+
"type": "VTL"
|
|
121
|
+
},
|
|
122
|
+
"type": "roundabout",
|
|
123
|
+
"iterations": { "value": "NB_HAB", "type": "VTL" },
|
|
124
|
+
"errorMessage": {
|
|
125
|
+
"value": "\"Le formulaire n'est pas complet pour \" || PRENOMS",
|
|
126
|
+
"type": "VTL|MD"
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
"components": [
|
|
131
|
+
{
|
|
132
|
+
"id": "radio",
|
|
133
|
+
"componentType": "Radio",
|
|
134
|
+
"mandatory": false,
|
|
135
|
+
"page": "4.1",
|
|
136
|
+
"label": {
|
|
137
|
+
"value": "\"Connaissez-vous le recensement de la population ?\"",
|
|
138
|
+
"type": "VTL|MD"
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
"conditionFilter": { "value": "true", "type": "VTL" },
|
|
142
|
+
|
|
143
|
+
"options": [
|
|
144
|
+
{ "value": "1", "label": { "value": "\"oui\"", "type": "VTL|MD" } },
|
|
145
|
+
|
|
146
|
+
{ "value": "2", "label": { "value": "\"non\"", "type": "VTL|MD" } }
|
|
147
|
+
],
|
|
148
|
+
"response": { "name": "KNOWREC" }
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"id": "jsygk7m7",
|
|
152
|
+
"componentType": "Subsequence",
|
|
153
|
+
"page": "4.2",
|
|
154
|
+
"label": {
|
|
155
|
+
"value": "\"Deuxième page de questions pour \"|| PRENOMS",
|
|
156
|
+
"type": "VTL|MD"
|
|
157
|
+
},
|
|
158
|
+
"conditionFilter": { "value": "true", "type": "VTL" }
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"id": "sexe",
|
|
162
|
+
"componentType": "Radio",
|
|
163
|
+
"page": "4.2",
|
|
164
|
+
"label": {
|
|
165
|
+
"value": "\"Sexe\"",
|
|
166
|
+
"type": "VTL"
|
|
167
|
+
},
|
|
168
|
+
"conditionFilter": {
|
|
169
|
+
"value": "true",
|
|
170
|
+
"type": "VTL"
|
|
171
|
+
},
|
|
172
|
+
"options": [
|
|
173
|
+
{
|
|
174
|
+
"value": "1",
|
|
175
|
+
"label": { "value": "\"Homme\"", "type": "VTL|MD" }
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"value": "2",
|
|
179
|
+
"label": { "value": "\"Femme\"", "type": "VTL|MD" }
|
|
180
|
+
}
|
|
181
|
+
],
|
|
182
|
+
"response": { "name": "SEXE" }
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"id": "jsygk7m7",
|
|
186
|
+
"componentType": "Subsequence",
|
|
187
|
+
"page": "4.3",
|
|
188
|
+
"label": {
|
|
189
|
+
"value": "\"Troisième page de questions \" || PRENOMS",
|
|
190
|
+
"type": "VTL|MD"
|
|
191
|
+
},
|
|
192
|
+
"conditionFilter": { "value": "true", "type": "VTL" }
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"id": "kmno1n7m",
|
|
196
|
+
"componentType": "Input",
|
|
197
|
+
"maxLength": 30,
|
|
198
|
+
"page": "4.3",
|
|
199
|
+
"label": {
|
|
200
|
+
"value": "\"Dites quelque chose.\"))",
|
|
201
|
+
"type": "VTL|MD"
|
|
202
|
+
},
|
|
203
|
+
"conditionFilter": {
|
|
204
|
+
"value": "true",
|
|
205
|
+
"type": "VTL"
|
|
206
|
+
},
|
|
207
|
+
"response": { "name": "SOMETHING" }
|
|
208
|
+
}
|
|
209
|
+
]
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
{
|
|
213
|
+
"id": "Summary",
|
|
214
|
+
"componentType": "Summary",
|
|
215
|
+
"label": {
|
|
216
|
+
"value": "\"## Vos réponses.\"",
|
|
217
|
+
"type": "VTL|MD"
|
|
218
|
+
},
|
|
219
|
+
"sections": [
|
|
220
|
+
{
|
|
221
|
+
"iterations": { "value": "NB_HAB", "type": "VTL" },
|
|
222
|
+
"title": {
|
|
223
|
+
"value": "\"### Le bulletin individuel de \" || PRENOMS",
|
|
224
|
+
"type": "VTL|MD"
|
|
225
|
+
},
|
|
226
|
+
"responses": [
|
|
227
|
+
{
|
|
228
|
+
"label": { "value": "\"L'age de \" || PRENOMS", "type": "VTL" },
|
|
229
|
+
"value": { "value": "cast(AGE,string) || \" ans\"", "type": "VTL" }
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"label": { "value": "\"Le sexe de \" || PRENOMS", "type": "VTL" },
|
|
233
|
+
"value": {
|
|
234
|
+
"value": "if(SEXE = \"1\") then \"Masculin\" else \"Féminin\"",
|
|
235
|
+
"type": "VTL"
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
]
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"title": {
|
|
242
|
+
"value": "\"### La feuille logement\"",
|
|
243
|
+
"type": "VTL|MD"
|
|
244
|
+
},
|
|
245
|
+
"responses": [
|
|
246
|
+
{
|
|
247
|
+
"label": { "value": "\"Zéro divisé par zéro \"", "type": "VTL" },
|
|
248
|
+
"value": { "value": "cast(ZERO,string) || \", mais ça tu savais déjà !\"", "type": "VTL" }
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
"label": { "value": "\"Nombre d'habitants \"", "type": "VTL" },
|
|
252
|
+
"value": { "value": "cast(NB_HAB,string) || \" personnes\"", "type": "VTL" }
|
|
253
|
+
}
|
|
254
|
+
]
|
|
255
|
+
}
|
|
256
|
+
],
|
|
257
|
+
"conditionFilter": { "value": "true", "type": "VTL" },
|
|
258
|
+
"page": "5"
|
|
259
|
+
}
|
|
260
|
+
],
|
|
261
|
+
"variables": [
|
|
262
|
+
{
|
|
263
|
+
"variableType": "COLLECTED",
|
|
264
|
+
"name": "NB_HAB",
|
|
265
|
+
"values": {
|
|
266
|
+
"PREVIOUS": null,
|
|
267
|
+
"COLLECTED": 2,
|
|
268
|
+
"FORCED": null,
|
|
269
|
+
"EDITED": null,
|
|
270
|
+
"INPUTED": null
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
"variableType": "COLLECTED",
|
|
275
|
+
"name": "ZERO",
|
|
276
|
+
"values": {
|
|
277
|
+
"PREVIOUS": null,
|
|
278
|
+
"COLLECTED": null,
|
|
279
|
+
"FORCED": null,
|
|
280
|
+
"EDITED": null,
|
|
281
|
+
"INPUTED": null
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
"variableType": "COLLECTED",
|
|
286
|
+
"name": "SOMETHING",
|
|
287
|
+
"values": {
|
|
288
|
+
"PREVIOUS": [null],
|
|
289
|
+
"COLLECTED": [null],
|
|
290
|
+
"FORCED": [null],
|
|
291
|
+
"EDITED": [null],
|
|
292
|
+
"INPUTED": [null]
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
"variableType": "COLLECTED",
|
|
297
|
+
"name": "AGE",
|
|
298
|
+
"values": {
|
|
299
|
+
"PREVIOUS": [null],
|
|
300
|
+
"COLLECTED": [null],
|
|
301
|
+
"FORCED": [null],
|
|
302
|
+
"EDITED": [null],
|
|
303
|
+
"INPUTED": [null]
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"variableType": "COLLECTED",
|
|
308
|
+
"name": "SEXE",
|
|
309
|
+
"values": {
|
|
310
|
+
"PREVIOUS": [null],
|
|
311
|
+
"COLLECTED": [null],
|
|
312
|
+
"FORCED": [null],
|
|
313
|
+
"EDITED": [null],
|
|
314
|
+
"INPUTED": [null]
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
"variableType": "COLLECTED",
|
|
319
|
+
"name": "PRENOMS",
|
|
320
|
+
"values": {
|
|
321
|
+
"PREVIOUS": [null],
|
|
322
|
+
"COLLECTED": [null],
|
|
323
|
+
"FORCED": [null],
|
|
324
|
+
"EDITED": [null],
|
|
325
|
+
"INPUTED": [null]
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
"variableType": "COLLECTED",
|
|
330
|
+
"name": "KNOWREC",
|
|
331
|
+
"values": {
|
|
332
|
+
"PREVIOUS": [null],
|
|
333
|
+
"COLLECTED": [null],
|
|
334
|
+
"FORCED": [null],
|
|
335
|
+
"EDITED": [null],
|
|
336
|
+
"INPUTED": [null]
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
"variableType": "CALCULATED",
|
|
341
|
+
"name": "PRENOMREF",
|
|
342
|
+
"expression": { "value": "first_value(PRENOMS over())", "type": "VTL" },
|
|
343
|
+
"bindingDependencies": ["PRENOMS"],
|
|
344
|
+
"inFilter": "true"
|
|
345
|
+
}
|
|
346
|
+
],
|
|
347
|
+
"resizing": {
|
|
348
|
+
"NB_HAB": {
|
|
349
|
+
"size": "NB_HAB",
|
|
350
|
+
"variables": ["PRENOMS", "AGE", "SEXE", "SOMETHING", "DATNAIS"]
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = exports.Default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _orchestrator = _interopRequireDefault(require("../utils/orchestrator"));
|
|
9
|
+
var _source = _interopRequireDefault(require("./source"));
|
|
10
|
+
var _data = _interopRequireDefault(require("./data.json"));
|
|
11
|
+
var _defaultArgTypes = _interopRequireDefault(require("../utils/default-arg-types"));
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
14
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
15
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
16
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
17
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
18
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
19
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
20
|
+
var stories = {
|
|
21
|
+
title: 'Components/Summary',
|
|
22
|
+
component: _orchestrator["default"],
|
|
23
|
+
argTypes: _defaultArgTypes["default"]
|
|
24
|
+
};
|
|
25
|
+
var _default = stories;
|
|
26
|
+
exports["default"] = _default;
|
|
27
|
+
var Template = function Template(args) {
|
|
28
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_orchestrator["default"], _objectSpread({}, args));
|
|
29
|
+
};
|
|
30
|
+
var Default = Template.bind({});
|
|
31
|
+
exports.Default = Default;
|
|
32
|
+
Default.args = {
|
|
33
|
+
id: 'Summary',
|
|
34
|
+
source: _source["default"],
|
|
35
|
+
data: _data["default"],
|
|
36
|
+
pagination: true
|
|
37
|
+
};
|
|
@@ -9,11 +9,11 @@ require("./custom-lunatic.scss");
|
|
|
9
9
|
require("./orchestrator.scss");
|
|
10
10
|
var lunatic = _interopRequireWildcard(require("../.."));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _logger = require("../../utils/logger");
|
|
12
13
|
var _overview = require("./overview");
|
|
13
14
|
var _waiting = _interopRequireDefault(require("./waiting"));
|
|
14
|
-
var _logger = require("../../utils/logger");
|
|
15
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
-
var _excluded = ["source", "data", "management", "shortcut", "activeControls", "features", "initialPage", "getStoreInfo", "missing", "missingStrategy", "missingShortcut", "autoSuggesterLoading", "addExternal", "preferences", "custom", "showOverview", "filterDescription", "getReferentiel", "dontKnowButton", "refusedButton"],
|
|
16
|
+
var _excluded = ["source", "data", "management", "shortcut", "activeControls", "features", "initialPage", "getStoreInfo", "missing", "missingStrategy", "missingShortcut", "autoSuggesterLoading", "addExternal", "preferences", "custom", "showOverview", "filterDescription", "getReferentiel", "dontKnowButton", "refusedButton", "readOnly"],
|
|
17
17
|
_excluded2 = ["id", "componentType", "response", "storeName", "conditionFilter"];
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
19
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -36,7 +36,8 @@ function getStoreInfoRequired() {
|
|
|
36
36
|
}
|
|
37
37
|
function DevOptions(_ref) {
|
|
38
38
|
var goToPage = _ref.goToPage,
|
|
39
|
-
getData = _ref.getData
|
|
39
|
+
getData = _ref.getData,
|
|
40
|
+
lastReachedPage = _ref.lastReachedPage;
|
|
40
41
|
var _useState = (0, _react.useState)(1),
|
|
41
42
|
_useState2 = _slicedToArray(_useState, 2),
|
|
42
43
|
toPage = _useState2[0],
|
|
@@ -63,7 +64,14 @@ function DevOptions(_ref) {
|
|
|
63
64
|
});
|
|
64
65
|
},
|
|
65
66
|
children: "Go to page ".concat(toPage)
|
|
66
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(lunatic.
|
|
67
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(lunatic.Button, {
|
|
68
|
+
onClick: function onClick() {
|
|
69
|
+
return goToPage({
|
|
70
|
+
page: "".concat(lastReachedPage)
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
children: "Go to lastReachedPage : ".concat(lastReachedPage)
|
|
74
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(lunatic.Input, {
|
|
67
75
|
id: "page-to-jump",
|
|
68
76
|
value: toPage,
|
|
69
77
|
handleChange: handleChange,
|
|
@@ -78,6 +86,7 @@ function Pager(_ref2) {
|
|
|
78
86
|
var goPrevious = _ref2.goPrevious,
|
|
79
87
|
goNext = _ref2.goNext,
|
|
80
88
|
goToPage = _ref2.goToPage,
|
|
89
|
+
lastReachedPage = _ref2.lastReachedPage,
|
|
81
90
|
isLast = _ref2.isLast,
|
|
82
91
|
isFirst = _ref2.isFirst,
|
|
83
92
|
pageTag = _ref2.pageTag,
|
|
@@ -101,7 +110,8 @@ function Pager(_ref2) {
|
|
|
101
110
|
children: ["PAGE: ", pageTag]
|
|
102
111
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(DevOptions, {
|
|
103
112
|
goToPage: goToPage,
|
|
104
|
-
getData: getData
|
|
113
|
+
getData: getData,
|
|
114
|
+
lastReachedPage: lastReachedPage
|
|
105
115
|
})]
|
|
106
116
|
});
|
|
107
117
|
}
|
|
@@ -147,6 +157,7 @@ function OrchestratorForStories(_ref3) {
|
|
|
147
157
|
getReferentiel = _ref3.getReferentiel,
|
|
148
158
|
dontKnowButton = _ref3.dontKnowButton,
|
|
149
159
|
refusedButton = _ref3.refusedButton,
|
|
160
|
+
readOnly = _ref3.readOnly,
|
|
150
161
|
rest = _objectWithoutProperties(_ref3, _excluded);
|
|
151
162
|
var maxPage = source.maxPage;
|
|
152
163
|
var _lunatic$useLunatic = lunatic.useLunatic(source, data, {
|
|
@@ -171,6 +182,7 @@ function OrchestratorForStories(_ref3) {
|
|
|
171
182
|
goPreviousPage = _lunatic$useLunatic.goPreviousPage,
|
|
172
183
|
goNextPage = _lunatic$useLunatic.goNextPage,
|
|
173
184
|
goToPage = _lunatic$useLunatic.goToPage,
|
|
185
|
+
pager = _lunatic$useLunatic.pager,
|
|
174
186
|
pageTag = _lunatic$useLunatic.pageTag,
|
|
175
187
|
isFirstPage = _lunatic$useLunatic.isFirstPage,
|
|
176
188
|
isLastPage = _lunatic$useLunatic.isLastPage,
|
|
@@ -180,6 +192,7 @@ function OrchestratorForStories(_ref3) {
|
|
|
180
192
|
getData = _lunatic$useLunatic.getData,
|
|
181
193
|
Provider = _lunatic$useLunatic.Provider;
|
|
182
194
|
var components = getComponents();
|
|
195
|
+
var lastReachedPage = pager.lastReachedPage;
|
|
183
196
|
var _useState3 = (0, _react.useState)({}),
|
|
184
197
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
185
198
|
errorActive = _useState4[0],
|
|
@@ -229,7 +242,8 @@ function OrchestratorForStories(_ref3) {
|
|
|
229
242
|
}, other), rest), component), storeInfo), {}, {
|
|
230
243
|
// fill error when needed
|
|
231
244
|
errors: errorActive[pageTag],
|
|
232
|
-
filterDescription: filterDescription
|
|
245
|
+
filterDescription: filterDescription,
|
|
246
|
+
disabled: readOnly
|
|
233
247
|
}))
|
|
234
248
|
}, "component-".concat(id));
|
|
235
249
|
})
|
|
@@ -237,6 +251,7 @@ function OrchestratorForStories(_ref3) {
|
|
|
237
251
|
goPrevious: goPreviousPage,
|
|
238
252
|
goNext: handleGoNext,
|
|
239
253
|
goToPage: goToPage,
|
|
254
|
+
lastReachedPage: lastReachedPage,
|
|
240
255
|
isLast: isLastPage,
|
|
241
256
|
isFirst: isFirstPage,
|
|
242
257
|
pageTag: pageTag,
|
|
@@ -14,20 +14,22 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
14
14
|
* Inject the value for the missingResponse variable
|
|
15
15
|
*/
|
|
16
16
|
function fillMissingResponse(component, state) {
|
|
17
|
+
// Component does not have a missing response
|
|
18
|
+
if (!('missingResponse' in component) || !component.missingResponse) {
|
|
19
|
+
return component;
|
|
20
|
+
}
|
|
17
21
|
var missingResponse = component.missingResponse;
|
|
18
22
|
var variables = state.variables,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
});
|
|
30
|
-
}
|
|
23
|
+
pager = state.pager;
|
|
24
|
+
var name = missingResponse.name;
|
|
25
|
+
if (name in variables) {
|
|
26
|
+
var value = variables[name].value;
|
|
27
|
+
var missingValue = pager.iteration === undefined ? value : value[pager.iteration];
|
|
28
|
+
return _objectSpread(_objectSpread({}, component), {}, {
|
|
29
|
+
missingResponse: _objectSpread(_objectSpread({}, missingResponse), {}, {
|
|
30
|
+
value: missingValue
|
|
31
|
+
})
|
|
32
|
+
});
|
|
31
33
|
}
|
|
32
34
|
return component;
|
|
33
35
|
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getNextPager = getNextPager;
|
|
8
|
+
exports.getPrevPager = getPrevPager;
|
|
9
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
13
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
14
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
15
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
16
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
17
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
18
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
19
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
|
+
var resetIteration = {
|
|
21
|
+
subPage: undefined,
|
|
22
|
+
nbSubPages: undefined,
|
|
23
|
+
iteration: undefined,
|
|
24
|
+
nbIterations: undefined
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Increment the pager to reach the next page or iteration
|
|
29
|
+
*/
|
|
30
|
+
function getNextPager(pager, parent) {
|
|
31
|
+
// Increment the page or subPage
|
|
32
|
+
var _ref = pager.subPage !== undefined ? [parseInt(pager.page, 10), pager.subPage + 1] : [parseInt(pager.page, 10) + 1, undefined],
|
|
33
|
+
_ref2 = _slicedToArray(_ref, 2),
|
|
34
|
+
page = _ref2[0],
|
|
35
|
+
subPage = _ref2[1];
|
|
36
|
+
var iteration = pager.iteration;
|
|
37
|
+
|
|
38
|
+
// We reached the end of the questionnaire
|
|
39
|
+
if (page > parseInt(pager.maxPage, 10)) {
|
|
40
|
+
return pager;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// We reached the end of the sequence
|
|
44
|
+
var isEndSequence = subPage && pager.nbSubPages ? subPage >= pager.nbSubPages : false;
|
|
45
|
+
var moveUpOnEnd = parent === 'Roundabout';
|
|
46
|
+
// Move up at the end of a sequence (instead of going to the next Iteration)
|
|
47
|
+
if (isEndSequence && moveUpOnEnd) {
|
|
48
|
+
return _objectSpread(_objectSpread({}, pager), {}, {
|
|
49
|
+
page: page.toString()
|
|
50
|
+
}, resetIteration);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Move to the next parent page (for loops)
|
|
54
|
+
if (isEndSequence && iteration !== undefined) {
|
|
55
|
+
subPage = 0;
|
|
56
|
+
iteration++;
|
|
57
|
+
}
|
|
58
|
+
// We reached the end of an iteration, move up
|
|
59
|
+
if (iteration !== undefined && pager.nbIterations && iteration >= pager.nbIterations) {
|
|
60
|
+
return getNextPager(_objectSpread(_objectSpread({}, pager), {}, {
|
|
61
|
+
page: page.toString()
|
|
62
|
+
}, resetIteration), parent);
|
|
63
|
+
}
|
|
64
|
+
return _objectSpread(_objectSpread({}, pager), {}, {
|
|
65
|
+
page: page.toString(),
|
|
66
|
+
subPage: subPage,
|
|
67
|
+
iteration: iteration
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function getPrevPager(pager, parent) {
|
|
71
|
+
// Decrement the page or subPage
|
|
72
|
+
var _ref3 = pager.subPage !== undefined ? [parseInt(pager.page, 10), pager.subPage - 1] : [parseInt(pager.page, 10) - 1, undefined],
|
|
73
|
+
_ref4 = _slicedToArray(_ref3, 2),
|
|
74
|
+
page = _ref4[0],
|
|
75
|
+
subPage = _ref4[1];
|
|
76
|
+
var iteration = pager.iteration;
|
|
77
|
+
var moveUpOnStart = parent === 'Roundabout';
|
|
78
|
+
|
|
79
|
+
// We reached the start of the questionnaire
|
|
80
|
+
if (page <= 0) {
|
|
81
|
+
return pager;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// We reached the start of the sequence, move up
|
|
85
|
+
if (subPage !== undefined && pager.nbSubPages !== undefined && subPage < 0) {
|
|
86
|
+
var _iteration;
|
|
87
|
+
// Move up at the start of an iteration (for roundabout)
|
|
88
|
+
if (moveUpOnStart) {
|
|
89
|
+
return _objectSpread(_objectSpread({}, pager), {}, {
|
|
90
|
+
page: page.toString()
|
|
91
|
+
}, resetIteration);
|
|
92
|
+
}
|
|
93
|
+
subPage = pager.nbSubPages - 1;
|
|
94
|
+
iteration = ((_iteration = iteration) !== null && _iteration !== void 0 ? _iteration : 0) - 1;
|
|
95
|
+
}
|
|
96
|
+
var isStartSequence = iteration !== undefined && iteration < 0;
|
|
97
|
+
|
|
98
|
+
// We reached the start of an iteration, keep going backward
|
|
99
|
+
if (isStartSequence) {
|
|
100
|
+
return getPrevPager(_objectSpread(_objectSpread({}, pager), {}, {
|
|
101
|
+
page: page.toString()
|
|
102
|
+
}, resetIteration), parent);
|
|
103
|
+
}
|
|
104
|
+
return _objectSpread(_objectSpread({}, pager), {}, {
|
|
105
|
+
page: page.toString(),
|
|
106
|
+
subPage: subPage,
|
|
107
|
+
iteration: iteration
|
|
108
|
+
});
|
|
109
|
+
}
|