@inseefr/lunatic 0.4.14-v2 → 0.4.17-v2
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/checkbox/checkbox-boolean/lunatic-checkbox-boolean.js +1 -1
- package/lib/components/checkbox/checkbox-group/lunatic-checkbox-group.js +1 -1
- package/lib/components/commons/components/combo-box/combo-box.scss +0 -4
- package/lib/components/input-number/input-number.js +4 -3
- package/lib/components/radio/lunatic-radio-group.js +2 -1
- package/lib/components/radio/radio.scss +1 -0
- package/lib/components/table/components/table.scss +1 -0
- package/lib/stories/questionnaires-test/test-dylan.json +90 -152
- package/lib/stories/questionnaires-test/test.stories.js +4 -0
- package/lib/use-lunatic/commons/execute-expression/create-execute-expression.js +32 -11
- package/lib/use-lunatic/reducer/reduce-go-next-page.js +8 -1
- package/lib/use-lunatic/reducer/reduce-on-init.js +4 -2
- package/package.json +2 -1
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
min-height: 30px;
|
|
39
39
|
min-width: 260px;
|
|
40
40
|
width: 100%;
|
|
41
|
-
height: 100%;
|
|
42
41
|
.lunatic-combo-box-content {
|
|
43
42
|
.lunatic-combo-box-selection {
|
|
44
43
|
border-radius: 5px;
|
|
@@ -172,8 +171,6 @@
|
|
|
172
171
|
}
|
|
173
172
|
|
|
174
173
|
width: 100%;
|
|
175
|
-
height: 100%;
|
|
176
|
-
/* */
|
|
177
174
|
}
|
|
178
175
|
|
|
179
176
|
.lunatic-combo-box-selected {
|
|
@@ -182,7 +179,6 @@
|
|
|
182
179
|
white-space: nowrap;
|
|
183
180
|
overflow-x: hidden;
|
|
184
181
|
width: 100%;
|
|
185
|
-
height: 100%;
|
|
186
182
|
display: none;
|
|
187
183
|
&.displayed {
|
|
188
184
|
display: block;
|
|
@@ -22,7 +22,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
22
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
23
|
|
|
24
24
|
function InputNumber(_ref) {
|
|
25
|
-
var
|
|
25
|
+
var id = _ref.id,
|
|
26
|
+
value = _ref.value,
|
|
26
27
|
onChange = _ref.onChange,
|
|
27
28
|
disabled = _ref.disabled,
|
|
28
29
|
readOnly = _ref.readOnly,
|
|
@@ -31,7 +32,6 @@ function InputNumber(_ref) {
|
|
|
31
32
|
max = _ref.max,
|
|
32
33
|
step = _ref.step,
|
|
33
34
|
unit = _ref.unit;
|
|
34
|
-
var valueEffective = value !== null && value !== void 0 ? value : NaN;
|
|
35
35
|
var handleChange = (0, _react.useCallback)(function (e) {
|
|
36
36
|
var val = e.target.valueAsNumber;
|
|
37
37
|
onChange(isNaN(val) ? null : val);
|
|
@@ -39,13 +39,14 @@ function InputNumber(_ref) {
|
|
|
39
39
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
40
40
|
className: "lunatic-input-number-container"
|
|
41
41
|
}, /*#__PURE__*/_react["default"].createElement("input", {
|
|
42
|
+
id: id,
|
|
42
43
|
className: (0, _classnames["default"])('lunatic-input-number', {
|
|
43
44
|
disabled: disabled,
|
|
44
45
|
readOnly: readOnly
|
|
45
46
|
}),
|
|
46
47
|
type: "number",
|
|
47
48
|
onChange: handleChange,
|
|
48
|
-
value:
|
|
49
|
+
value: value !== null && value !== void 0 ? value : '',
|
|
49
50
|
labelledby: labelId,
|
|
50
51
|
readOnly: readOnly,
|
|
51
52
|
disabled: disabled,
|
|
@@ -36,7 +36,8 @@ function LunaticRadioGroup(props) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
var _default = (0, _commons.createLunaticComponent)(LunaticRadioGroup, {
|
|
39
|
-
fieldset
|
|
39
|
+
// set it to true if you want to display a fieldset + legend on a component
|
|
40
|
+
fieldset: false,
|
|
40
41
|
inputId: 'lunatic-radio-group'
|
|
41
42
|
});
|
|
42
43
|
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"cleaning": {
|
|
3
|
-
"NB_MAJEUR": { "TEXTE": "(NB_MAJEUR > 0)" },
|
|
4
|
-
"IND_MAJEUR": { "TEXTE": "(NB_MAJEUR > 0)" },
|
|
5
|
-
"AGE": { "TEXTE": "(NB_MAJEUR > 0)" }
|
|
6
|
-
},
|
|
2
|
+
"cleaning": {},
|
|
7
3
|
"variables": [
|
|
8
4
|
{
|
|
9
5
|
"variableType": "COLLECTED",
|
|
@@ -60,17 +56,6 @@
|
|
|
60
56
|
},
|
|
61
57
|
"name": "DIVERS"
|
|
62
58
|
},
|
|
63
|
-
{
|
|
64
|
-
"variableType": "COLLECTED",
|
|
65
|
-
"values": {
|
|
66
|
-
"COLLECTED": null,
|
|
67
|
-
"EDITED": null,
|
|
68
|
-
"INPUTED": null,
|
|
69
|
-
"FORCED": null,
|
|
70
|
-
"PREVIOUS": null
|
|
71
|
-
},
|
|
72
|
-
"name": "TEXTE"
|
|
73
|
-
},
|
|
74
59
|
{
|
|
75
60
|
"variableType": "CALCULATED",
|
|
76
61
|
"expression": { "type": "VTL", "value": "true" },
|
|
@@ -87,18 +72,7 @@
|
|
|
87
72
|
{
|
|
88
73
|
"variableType": "CALCULATED",
|
|
89
74
|
"bindingDependencies": ["AGE"],
|
|
90
|
-
"expression": { "type": "VTL", "value": "
|
|
91
|
-
"name": "AGE_NUM",
|
|
92
|
-
"inFilter": "false",
|
|
93
|
-
"shapeFrom": "PRENOM"
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
"variableType": "CALCULATED",
|
|
97
|
-
"bindingDependencies": ["AGE"],
|
|
98
|
-
"expression": {
|
|
99
|
-
"type": "VTL",
|
|
100
|
-
"value": "if nvl(AGE,0)> 17 then 1 else 0"
|
|
101
|
-
},
|
|
75
|
+
"expression": { "type": "VTL", "value": "if AGE > 17 then 1 else 0" },
|
|
102
76
|
"name": "IND_MAJEUR",
|
|
103
77
|
"inFilter": "false",
|
|
104
78
|
"shapeFrom": "PRENOM"
|
|
@@ -116,40 +90,34 @@
|
|
|
116
90
|
"name": "FILTER_RESULT_DIVERS",
|
|
117
91
|
"inFilter": "false"
|
|
118
92
|
},
|
|
119
|
-
{
|
|
120
|
-
"variableType": "CALCULATED",
|
|
121
|
-
"bindingDependencies": ["NB_MAJEUR"],
|
|
122
|
-
"expression": { "type": "VTL", "value": "(NB_MAJEUR > 0)" },
|
|
123
|
-
"name": "FILTER_RESULT_TEXTE",
|
|
124
|
-
"inFilter": "false"
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
"variableType": "CALCULATED",
|
|
128
|
-
"bindingDependencies": ["AGE_NUM", "AGE"],
|
|
129
|
-
"expression": { "type": "VTL", "value": "sum(AGE_NUM)" },
|
|
130
|
-
"name": "SUM_AGE_NUM",
|
|
131
|
-
"inFilter": "false"
|
|
132
|
-
},
|
|
133
93
|
{
|
|
134
94
|
"variableType": "CALCULATED",
|
|
135
95
|
"bindingDependencies": ["IND_MAJEUR", "AGE"],
|
|
136
96
|
"expression": { "type": "VTL", "value": "sum(IND_MAJEUR)" },
|
|
137
|
-
"name": "
|
|
138
|
-
"inFilter": "
|
|
97
|
+
"name": "SUM_MAJEUR",
|
|
98
|
+
"inFilter": "false"
|
|
139
99
|
},
|
|
140
100
|
{
|
|
141
101
|
"variableType": "CALCULATED",
|
|
142
|
-
"bindingDependencies": ["
|
|
143
|
-
"expression": { "type": "VTL", "value": "min(
|
|
102
|
+
"bindingDependencies": ["AGE"],
|
|
103
|
+
"expression": { "type": "VTL", "value": "min(AGE)" },
|
|
144
104
|
"name": "MIN_AGE",
|
|
145
105
|
"inFilter": "false"
|
|
146
106
|
},
|
|
147
107
|
{
|
|
148
108
|
"variableType": "CALCULATED",
|
|
149
109
|
"bindingDependencies": ["AGE"],
|
|
150
|
-
"expression": { "type": "VTL", "value": "sum(
|
|
110
|
+
"expression": { "type": "VTL", "value": "sum(AGE)" },
|
|
151
111
|
"name": "SUM_AGE",
|
|
152
112
|
"inFilter": "false"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"variableType": "CALCULATED",
|
|
116
|
+
"bindingDependencies": ["AGE"],
|
|
117
|
+
"expression": { "type": "VTL", "value": "cast(AGE,number)" },
|
|
118
|
+
"name": "AGE_NUM",
|
|
119
|
+
"inFilter": "false",
|
|
120
|
+
"shapeFrom": "PRENOM"
|
|
153
121
|
}
|
|
154
122
|
],
|
|
155
123
|
"components": [
|
|
@@ -174,8 +142,9 @@
|
|
|
174
142
|
"criticality": "ERROR",
|
|
175
143
|
"errorMessage": {
|
|
176
144
|
"type": "VTL|MD",
|
|
177
|
-
"value": "La valeur doit être comprise entre 0 et 10
|
|
145
|
+
"value": "\" La valeur doit être comprise entre 0 et 10.\""
|
|
178
146
|
},
|
|
147
|
+
"typeOfControl": "FORMAT",
|
|
179
148
|
"control": {
|
|
180
149
|
"type": "VTL",
|
|
181
150
|
"value": "not(not(isnull(NB)) and (0>NB or 10<NB)))"
|
|
@@ -186,8 +155,9 @@
|
|
|
186
155
|
"criticality": "ERROR",
|
|
187
156
|
"errorMessage": {
|
|
188
157
|
"type": "VTL|MD",
|
|
189
|
-
"value": "Le nombre doit comporter au maximum 0 chiffre(s) après la virgule
|
|
158
|
+
"value": "\"Le nombre doit comporter au maximum 0 chiffre(s) après la virgule.\""
|
|
190
159
|
},
|
|
160
|
+
"typeOfControl": "FORMAT",
|
|
191
161
|
"control": {
|
|
192
162
|
"type": "VTL",
|
|
193
163
|
"value": "not(not(isnull(NB)) and trunc(NB,0)<>NB)"
|
|
@@ -242,6 +212,30 @@
|
|
|
242
212
|
{
|
|
243
213
|
"componentType": "Input",
|
|
244
214
|
"bindingDependencies": ["PRENOM", "NB"],
|
|
215
|
+
"controls": [
|
|
216
|
+
{
|
|
217
|
+
"bindingDependencies": ["PRENOM"],
|
|
218
|
+
"criticality": "WARN",
|
|
219
|
+
"errorMessage": {
|
|
220
|
+
"type": "VTL|MD",
|
|
221
|
+
"value": "\"Prenom est vide ?\""
|
|
222
|
+
},
|
|
223
|
+
"typeOfControl": "CONSISTENCY",
|
|
224
|
+
"control": { "type": "VTL", "value": "not(isnull(PRENOM))" },
|
|
225
|
+
"id": "ksyjvi40-CI-0"
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"bindingDependencies": ["PRENOM"],
|
|
229
|
+
"criticality": "WARN",
|
|
230
|
+
"errorMessage": {
|
|
231
|
+
"type": "VTL|MD",
|
|
232
|
+
"value": "\"Prénom vaut A\""
|
|
233
|
+
},
|
|
234
|
+
"typeOfControl": "CONSISTENCY",
|
|
235
|
+
"control": { "type": "VTL", "value": "not(PRENOM = \"A\")" },
|
|
236
|
+
"id": "ksyjvi40-CI-1"
|
|
237
|
+
}
|
|
238
|
+
],
|
|
245
239
|
"response": { "name": "PRENOM" },
|
|
246
240
|
"hierarchy": {
|
|
247
241
|
"sequence": {
|
|
@@ -260,7 +254,18 @@
|
|
|
260
254
|
"page": "3",
|
|
261
255
|
"label": { "type": "VTL|MD", "value": "\"➡ 2. \" || \"prénom\"" },
|
|
262
256
|
"mandatory": false,
|
|
263
|
-
"maxLength": 249
|
|
257
|
+
"maxLength": 249,
|
|
258
|
+
"declarations": [
|
|
259
|
+
{
|
|
260
|
+
"declarationType": "HELP",
|
|
261
|
+
"id": "ksyjvi40-l7uj49ok",
|
|
262
|
+
"label": {
|
|
263
|
+
"type": "VTL|MD",
|
|
264
|
+
"value": "\"Tester Prénom vide et Prénom = A\""
|
|
265
|
+
},
|
|
266
|
+
"position": "AFTER_QUESTION_TEXT"
|
|
267
|
+
}
|
|
268
|
+
]
|
|
264
269
|
}
|
|
265
270
|
],
|
|
266
271
|
"bindingDependencies": ["NB", "PRENOM"],
|
|
@@ -326,8 +331,9 @@
|
|
|
326
331
|
"criticality": "ERROR",
|
|
327
332
|
"errorMessage": {
|
|
328
333
|
"type": "VTL|MD",
|
|
329
|
-
"value": "La valeur doit être comprise entre 0 et 100
|
|
334
|
+
"value": "\" La valeur doit être comprise entre 0 et 100.\""
|
|
330
335
|
},
|
|
336
|
+
"typeOfControl": "FORMAT",
|
|
331
337
|
"control": {
|
|
332
338
|
"type": "VTL",
|
|
333
339
|
"value": "not(not(isnull(AGE)) and (0>AGE or 100<AGE)))"
|
|
@@ -338,13 +344,22 @@
|
|
|
338
344
|
"criticality": "ERROR",
|
|
339
345
|
"errorMessage": {
|
|
340
346
|
"type": "VTL|MD",
|
|
341
|
-
"value": "Le nombre doit comporter au maximum 0 chiffre(s) après la virgule
|
|
347
|
+
"value": "\"Le nombre doit comporter au maximum 0 chiffre(s) après la virgule.\""
|
|
342
348
|
},
|
|
349
|
+
"typeOfControl": "FORMAT",
|
|
343
350
|
"control": {
|
|
344
351
|
"type": "VTL",
|
|
345
352
|
"value": "not(not(isnull(AGE)) and trunc(AGE,0)<>AGE)"
|
|
346
353
|
},
|
|
347
354
|
"id": "ksyke448-formatDec"
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
"bindingDependencies": ["AGE"],
|
|
358
|
+
"criticality": "WARN",
|
|
359
|
+
"errorMessage": { "type": "VTL|MD", "value": "\"Age est vide\"" },
|
|
360
|
+
"typeOfControl": "CONSISTENCY",
|
|
361
|
+
"control": { "type": "VTL", "value": "not(isnull(AGE))" },
|
|
362
|
+
"id": "ksyke448-CI-0"
|
|
348
363
|
}
|
|
349
364
|
],
|
|
350
365
|
"max": 100,
|
|
@@ -363,7 +378,7 @@
|
|
|
363
378
|
"conditionFilter": { "type": "VTL", "value": "true" },
|
|
364
379
|
"label": {
|
|
365
380
|
"type": "VTL|MD",
|
|
366
|
-
"value": "\"➡ 3. \" || \"
|
|
381
|
+
"value": "\"➡ 3. \" || \"Age de l’individu : \" || PRENOM"
|
|
367
382
|
},
|
|
368
383
|
"mandatory": false,
|
|
369
384
|
"declarations": [
|
|
@@ -372,7 +387,7 @@
|
|
|
372
387
|
"id": "ksyke448-ktwsl4qu",
|
|
373
388
|
"label": {
|
|
374
389
|
"type": "VTL|MD",
|
|
375
|
-
"value": "\"
|
|
390
|
+
"value": "\"AGE vaut : \" || cast(AGE,string)"
|
|
376
391
|
},
|
|
377
392
|
"position": "AFTER_QUESTION_TEXT"
|
|
378
393
|
},
|
|
@@ -387,15 +402,15 @@
|
|
|
387
402
|
},
|
|
388
403
|
{
|
|
389
404
|
"declarationType": "HELP",
|
|
390
|
-
"id": "ksyke448-
|
|
405
|
+
"id": "ksyke448-l7uk2nvc",
|
|
391
406
|
"label": {
|
|
392
407
|
"type": "VTL|MD",
|
|
393
|
-
"value": "\"AGE
|
|
408
|
+
"value": "\"AGE NUM :\" || cast(AGE_NUM,string)"
|
|
394
409
|
},
|
|
395
410
|
"position": "AFTER_QUESTION_TEXT"
|
|
396
411
|
}
|
|
397
412
|
],
|
|
398
|
-
"bindingDependencies": ["
|
|
413
|
+
"bindingDependencies": ["AGE", "IND_MAJEUR", "AGE_NUM", "PRENOM"],
|
|
399
414
|
"min": 0,
|
|
400
415
|
"response": { "name": "AGE" },
|
|
401
416
|
"decimals": 0,
|
|
@@ -403,7 +418,7 @@
|
|
|
403
418
|
"page": "5.1"
|
|
404
419
|
}
|
|
405
420
|
],
|
|
406
|
-
"bindingDependencies": ["
|
|
421
|
+
"bindingDependencies": ["AGE", "IND_MAJEUR", "AGE_NUM", "PRENOM"],
|
|
407
422
|
"depth": 1,
|
|
408
423
|
"hierarchy": {
|
|
409
424
|
"sequence": {
|
|
@@ -420,7 +435,7 @@
|
|
|
420
435
|
},
|
|
421
436
|
{
|
|
422
437
|
"componentType": "Subsequence",
|
|
423
|
-
"bindingDependencies": ["
|
|
438
|
+
"bindingDependencies": ["SUM_AGE", "MIN_AGE", "SUM_MAJEUR"],
|
|
424
439
|
"goToPage": "6",
|
|
425
440
|
"hierarchy": {
|
|
426
441
|
"sequence": {
|
|
@@ -431,26 +446,20 @@
|
|
|
431
446
|
"subSequence": {
|
|
432
447
|
"id": "ku2pnlmr",
|
|
433
448
|
"page": "6",
|
|
434
|
-
"label": {
|
|
435
|
-
"type": "VTL|MD",
|
|
436
|
-
"value": "\"Affichage de qq var\" || cast(AGE,string)"
|
|
437
|
-
}
|
|
449
|
+
"label": { "type": "VTL|MD", "value": "\"Affichage de qq var\"" }
|
|
438
450
|
}
|
|
439
451
|
},
|
|
440
452
|
"conditionFilter": { "type": "VTL", "value": "true" },
|
|
441
453
|
"id": "ku2pnlmr",
|
|
442
454
|
"page": "6",
|
|
443
|
-
"label": {
|
|
444
|
-
"type": "VTL|MD",
|
|
445
|
-
"value": "\"Affichage de qq var\" || cast(AGE,string)"
|
|
446
|
-
},
|
|
455
|
+
"label": { "type": "VTL|MD", "value": "\"Affichage de qq var\"" },
|
|
447
456
|
"declarations": [
|
|
448
457
|
{
|
|
449
458
|
"declarationType": "HELP",
|
|
450
459
|
"id": "ku2pnlmr-kze7f245",
|
|
451
460
|
"label": {
|
|
452
461
|
"type": "VTL|MD",
|
|
453
|
-
"value": "\"Affichage de la somme des ages : \" || cast(
|
|
462
|
+
"value": "\"Affichage de la somme des ages : \" || cast(SUM_AGE,string)"
|
|
454
463
|
},
|
|
455
464
|
"position": "AFTER_QUESTION_TEXT"
|
|
456
465
|
},
|
|
@@ -465,10 +474,10 @@
|
|
|
465
474
|
},
|
|
466
475
|
{
|
|
467
476
|
"declarationType": "HELP",
|
|
468
|
-
"id": "ku2pnlmr-
|
|
477
|
+
"id": "ku2pnlmr-l7t4dzz2",
|
|
469
478
|
"label": {
|
|
470
479
|
"type": "VTL|MD",
|
|
471
|
-
"value": "\"Affichage
|
|
480
|
+
"value": "\"Affichage du nb de majeurs : \" || cast(SUM_MAJEUR,string)"
|
|
472
481
|
},
|
|
473
482
|
"position": "AFTER_QUESTION_TEXT"
|
|
474
483
|
}
|
|
@@ -487,10 +496,7 @@
|
|
|
487
496
|
"subSequence": {
|
|
488
497
|
"id": "ku2pnlmr",
|
|
489
498
|
"page": "6",
|
|
490
|
-
"label": {
|
|
491
|
-
"type": "VTL|MD",
|
|
492
|
-
"value": "\"Affichage de qq var\" || cast(AGE,string)"
|
|
493
|
-
}
|
|
499
|
+
"label": { "type": "VTL|MD", "value": "\"Affichage de qq var\"" }
|
|
494
500
|
}
|
|
495
501
|
},
|
|
496
502
|
"conditionFilter": { "type": "VTL", "value": "true" },
|
|
@@ -500,86 +506,18 @@
|
|
|
500
506
|
"mandatory": false,
|
|
501
507
|
"maxLength": 249
|
|
502
508
|
},
|
|
503
|
-
{
|
|
504
|
-
"componentType": "Subsequence",
|
|
505
|
-
"bindingDependencies": ["NB_MAJEUR"],
|
|
506
|
-
"goToPage": "8",
|
|
507
|
-
"hierarchy": {
|
|
508
|
-
"sequence": {
|
|
509
|
-
"id": "ksyniqzx",
|
|
510
|
-
"page": "4",
|
|
511
|
-
"label": { "type": "VTL|MD", "value": "\"II - \" || \"S1\"" }
|
|
512
|
-
},
|
|
513
|
-
"subSequence": {
|
|
514
|
-
"id": "ku2pqil5",
|
|
515
|
-
"page": "8",
|
|
516
|
-
"label": {
|
|
517
|
-
"type": "VTL|MD",
|
|
518
|
-
"value": "\"Affichage de la question suivante si au moins 1 majeur. Pour info : nb de majeurs calculé = \" || cast(NB_MAJEUR,string)"
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
},
|
|
522
|
-
"conditionFilter": { "type": "VTL", "value": "true" },
|
|
523
|
-
"id": "ku2pqil5",
|
|
524
|
-
"page": "8",
|
|
525
|
-
"label": {
|
|
526
|
-
"type": "VTL|MD",
|
|
527
|
-
"value": "\"Affichage de la question suivante si au moins 1 majeur. Pour info : nb de majeurs calculé = \" || cast(NB_MAJEUR,string)"
|
|
528
|
-
},
|
|
529
|
-
"declarations": [
|
|
530
|
-
{
|
|
531
|
-
"declarationType": "HELP",
|
|
532
|
-
"id": "ku2pqil5-kze7d4ia",
|
|
533
|
-
"label": {
|
|
534
|
-
"type": "VTL|MD",
|
|
535
|
-
"value": "Affichage de cette sous séquence systématique. Affichage question qui suit si au moins 1 majeur"
|
|
536
|
-
},
|
|
537
|
-
"position": "AFTER_QUESTION_TEXT"
|
|
538
|
-
}
|
|
539
|
-
]
|
|
540
|
-
},
|
|
541
|
-
{
|
|
542
|
-
"componentType": "Input",
|
|
543
|
-
"bindingDependencies": ["TEXTE"],
|
|
544
|
-
"response": { "name": "TEXTE" },
|
|
545
|
-
"hierarchy": {
|
|
546
|
-
"sequence": {
|
|
547
|
-
"id": "ksyniqzx",
|
|
548
|
-
"page": "4",
|
|
549
|
-
"label": { "type": "VTL|MD", "value": "\"II - \" || \"S1\"" }
|
|
550
|
-
},
|
|
551
|
-
"subSequence": {
|
|
552
|
-
"id": "ku2pqil5",
|
|
553
|
-
"page": "8",
|
|
554
|
-
"label": {
|
|
555
|
-
"type": "VTL|MD",
|
|
556
|
-
"value": "\"Affichage de la question suivante si au moins 1 majeur. Pour info : nb de majeurs calculé = \" || cast(NB_MAJEUR,string)"
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
},
|
|
560
|
-
"conditionFilter": {
|
|
561
|
-
"bindingDependencies": ["NB_MAJEUR", "IND_MAJEUR", "AGE"],
|
|
562
|
-
"type": "VTL",
|
|
563
|
-
"value": "(NB_MAJEUR > 0)"
|
|
564
|
-
},
|
|
565
|
-
"id": "ktwvc5zc",
|
|
566
|
-
"page": "9",
|
|
567
|
-
"label": { "type": "VTL|MD", "value": "\"➡ 5. \" || \"Texte\"" },
|
|
568
|
-
"mandatory": false,
|
|
569
|
-
"maxLength": 249
|
|
570
|
-
},
|
|
571
509
|
{
|
|
572
510
|
"componentType": "Sequence",
|
|
573
511
|
"hierarchy": {
|
|
574
512
|
"sequence": {
|
|
575
513
|
"id": "COMMENT-SEQ",
|
|
576
|
-
"page": "
|
|
514
|
+
"page": "8",
|
|
577
515
|
"label": { "type": "VTL|MD", "value": "\"Commentaire\"" }
|
|
578
516
|
}
|
|
579
517
|
},
|
|
580
518
|
"conditionFilter": { "type": "VTL", "value": "true" },
|
|
581
519
|
"id": "COMMENT-SEQ",
|
|
582
|
-
"page": "
|
|
520
|
+
"page": "8",
|
|
583
521
|
"label": { "type": "VTL|MD", "value": "\"Commentaire\"" }
|
|
584
522
|
},
|
|
585
523
|
{
|
|
@@ -589,13 +527,13 @@
|
|
|
589
527
|
"hierarchy": {
|
|
590
528
|
"sequence": {
|
|
591
529
|
"id": "COMMENT-SEQ",
|
|
592
|
-
"page": "
|
|
530
|
+
"page": "8",
|
|
593
531
|
"label": { "type": "VTL|MD", "value": "\"Commentaire\"" }
|
|
594
532
|
}
|
|
595
533
|
},
|
|
596
534
|
"conditionFilter": { "type": "VTL", "value": "true" },
|
|
597
535
|
"id": "COMMENT-QUESTION",
|
|
598
|
-
"page": "
|
|
536
|
+
"page": "9",
|
|
599
537
|
"label": {
|
|
600
538
|
"type": "VTL|MD",
|
|
601
539
|
"value": "\"Avez-vous des remarques concernant l'enquête ou des commentaires ?\""
|
|
@@ -608,13 +546,13 @@
|
|
|
608
546
|
"resizing": { "NB": { "variables": ["PRENOM", "AGE"], "size": "NB" } },
|
|
609
547
|
"label": {
|
|
610
548
|
"type": "VTL|MD",
|
|
611
|
-
"value": "
|
|
549
|
+
"value": "BUG sur sum, min dans une boucle et sur controle prénom"
|
|
612
550
|
},
|
|
613
|
-
"lunaticModelVersion": "2.2.
|
|
551
|
+
"lunaticModelVersion": "2.2.14-rc",
|
|
614
552
|
"modele": "TESTSURSUM",
|
|
615
|
-
"enoCoreVersion": "2.3.10",
|
|
616
|
-
"generatingDate": "
|
|
553
|
+
"enoCoreVersion": "2.3.10-controls-type",
|
|
554
|
+
"generatingDate": "09-09-2022 14:06:53",
|
|
617
555
|
"missing": false,
|
|
618
|
-
"id": "
|
|
619
|
-
"maxPage": "
|
|
556
|
+
"id": "l7t51pzu",
|
|
557
|
+
"maxPage": "9"
|
|
620
558
|
}
|
|
@@ -145,6 +145,27 @@ function createExecuteExpression(variables, features) {
|
|
|
145
145
|
}
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
*
|
|
150
|
+
* @param {*} variables
|
|
151
|
+
*/
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
function resetLoopBindings(variables) {
|
|
155
|
+
Object.entries(bindings).forEach(function (_ref5) {
|
|
156
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
|
157
|
+
k = _ref6[0],
|
|
158
|
+
v = _ref6[1];
|
|
159
|
+
|
|
160
|
+
var _variables$k2 = variables[k],
|
|
161
|
+
type = _variables$k2.type,
|
|
162
|
+
value = _variables$k2.value;
|
|
163
|
+
|
|
164
|
+
if (type === _constants.COLLECTED && Array.isArray(value) && !Array.isArray(v)) {
|
|
165
|
+
bindings[k] = value;
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
148
169
|
|
|
149
170
|
function getVariablesAndCach(expression) {
|
|
150
171
|
if (tokensMap.has(expression)) {
|
|
@@ -186,9 +207,9 @@ function createExecuteExpression(variables, features) {
|
|
|
186
207
|
return {};
|
|
187
208
|
}
|
|
188
209
|
|
|
189
|
-
function resolveUseContext(name,
|
|
190
|
-
var iteration =
|
|
191
|
-
linksIterations =
|
|
210
|
+
function resolveUseContext(name, _ref7) {
|
|
211
|
+
var iteration = _ref7.iteration,
|
|
212
|
+
linksIterations = _ref7.linksIterations;
|
|
192
213
|
var value = bindings[name];
|
|
193
214
|
|
|
194
215
|
if ([_constants.X_AXIS, _constants.Y_AXIS].includes(name) && linksIterations !== undefined) {
|
|
@@ -218,13 +239,13 @@ function createExecuteExpression(variables, features) {
|
|
|
218
239
|
return (0, _vtl["default"])(value);
|
|
219
240
|
}
|
|
220
241
|
|
|
221
|
-
function fillVariablesValues(map,
|
|
222
|
-
var iteration =
|
|
223
|
-
linksIterations =
|
|
224
|
-
return Object.entries(map).reduce(function (sub,
|
|
225
|
-
var
|
|
226
|
-
name =
|
|
227
|
-
_ =
|
|
242
|
+
function fillVariablesValues(map, _ref8) {
|
|
243
|
+
var iteration = _ref8.iteration,
|
|
244
|
+
linksIterations = _ref8.linksIterations;
|
|
245
|
+
return Object.entries(map).reduce(function (sub, _ref9) {
|
|
246
|
+
var _ref10 = _slicedToArray(_ref9, 2),
|
|
247
|
+
name = _ref10[0],
|
|
248
|
+
_ = _ref10[1];
|
|
228
249
|
|
|
229
250
|
return _objectSpread(_objectSpread({}, sub), {}, _defineProperty({}, name, resolveUseContext(name, {
|
|
230
251
|
iteration: iteration,
|
|
@@ -280,7 +301,7 @@ function createExecuteExpression(variables, features) {
|
|
|
280
301
|
return memoized;
|
|
281
302
|
}
|
|
282
303
|
|
|
283
|
-
return [execute, updateBindings, setLoopBindings];
|
|
304
|
+
return [execute, updateBindings, setLoopBindings, resetLoopBindings];
|
|
284
305
|
}
|
|
285
306
|
|
|
286
307
|
var _default = createExecuteExpression;
|
|
@@ -158,8 +158,9 @@ function reduceGoNextPage(state) {
|
|
|
158
158
|
var pages = state.pages,
|
|
159
159
|
isInLoop = state.isInLoop,
|
|
160
160
|
pager = state.pager,
|
|
161
|
+
variables = state.variables,
|
|
161
162
|
setLoopBindings = state.setLoopBindings,
|
|
162
|
-
|
|
163
|
+
resetLoopBindings = state.resetLoopBindings;
|
|
163
164
|
var iteration = pager.iteration,
|
|
164
165
|
nbIterations = pager.nbIterations,
|
|
165
166
|
subPage = pager.subPage,
|
|
@@ -171,6 +172,7 @@ function reduceGoNextPage(state) {
|
|
|
171
172
|
}
|
|
172
173
|
|
|
173
174
|
if (isInLoop && subPage === nbSubPages - 1 && iteration < nbIterations - 1) {
|
|
175
|
+
// New iteration, update loop bindings
|
|
174
176
|
setLoopBindings(variables, iteration + 1);
|
|
175
177
|
return validateChange(reduceNextIteration(state));
|
|
176
178
|
}
|
|
@@ -181,6 +183,11 @@ function reduceGoNextPage(state) {
|
|
|
181
183
|
iterations = _pages$next.iterations,
|
|
182
184
|
loopDependencies = _pages$next.loopDependencies;
|
|
183
185
|
|
|
186
|
+
if (isInLoop && !isLoop) {
|
|
187
|
+
//End of the loop, we reset bindings
|
|
188
|
+
resetLoopBindings(variables);
|
|
189
|
+
}
|
|
190
|
+
|
|
184
191
|
if (next === page) {
|
|
185
192
|
// TODO on devrait jamais en arriver là !
|
|
186
193
|
console.log("next === page, we shoudn't be there");
|
|
@@ -204,10 +204,11 @@ function reduceOnInit(state, action) {
|
|
|
204
204
|
var variables = createVariables(source, data); // map des variables
|
|
205
205
|
|
|
206
206
|
var _createExecuteExpress = (0, _commons.createExecuteExpression)(variables, features),
|
|
207
|
-
_createExecuteExpress2 = _slicedToArray(_createExecuteExpress,
|
|
207
|
+
_createExecuteExpress2 = _slicedToArray(_createExecuteExpress, 4),
|
|
208
208
|
executeExpression = _createExecuteExpress2[0],
|
|
209
209
|
updateBindings = _createExecuteExpress2[1],
|
|
210
|
-
setLoopBindings = _createExecuteExpress2[2]
|
|
210
|
+
setLoopBindings = _createExecuteExpress2[2],
|
|
211
|
+
resetLoopBindings = _createExecuteExpress2[3];
|
|
211
212
|
|
|
212
213
|
var pages = (0, _commons.checkLoops)((0, _commons.createMapPages)(source));
|
|
213
214
|
var maxPage = source.maxPage,
|
|
@@ -243,6 +244,7 @@ function reduceOnInit(state, action) {
|
|
|
243
244
|
executeExpression: executeExpression,
|
|
244
245
|
updateBindings: updateBindings,
|
|
245
246
|
setLoopBindings: setLoopBindings,
|
|
247
|
+
resetLoopBindings: resetLoopBindings,
|
|
246
248
|
handleChange: handleChange,
|
|
247
249
|
preferences: preferences,
|
|
248
250
|
management: management,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inseefr/lunatic",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.17-v2",
|
|
4
4
|
"workersVersion": "0.2.4-experimental",
|
|
5
5
|
"description": "Library of questionnaire components",
|
|
6
6
|
"repository": {
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"prop-types": "^15.7.2",
|
|
61
61
|
"react-keyboard-event-handler": "^1.5.4",
|
|
62
62
|
"react-markdown": "^8.0.3",
|
|
63
|
+
"react-number-format": "^5.0.0-beta.4",
|
|
63
64
|
"react-tooltip": "^4.2.15",
|
|
64
65
|
"remove-accents": "^0.4.2",
|
|
65
66
|
"sass": "^1.32.2",
|