@inseefr/lunatic 2.4.5-beta → 2.4.5-mvp-eap

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 (70) hide show
  1. package/lib/components/commons/components/combo-box/combo-box-content.js +2 -5
  2. package/lib/components/commons/components/combo-box/combo-box.js +16 -16
  3. package/lib/components/commons/components/combo-box/panel/panel.js +2 -4
  4. package/lib/components/commons/components/combo-box/state-management/reduce-on-init.js +4 -1
  5. package/lib/components/commons/components/orchestrated-component.js +2 -0
  6. package/lib/components/commons/create-row-orchestrator.js +2 -2
  7. package/lib/components/dropdown/lunatic-dropdown.js +1 -0
  8. package/lib/components/input-number/html/input-number.js +2 -1
  9. package/lib/components/input-number/html/input-number.scss +1 -1
  10. package/lib/components/input-number/lunatic-input-number.js +2 -0
  11. package/lib/components/loop/loop.js +6 -4
  12. package/lib/components/loop/roster-for-loop/roster-for-loop-orchestrator.js +1 -0
  13. package/lib/components/loop/roster-for-loop/roster-for-loop.js +45 -33
  14. package/lib/components/loop/roster-for-loop/roster-table.js +22 -18
  15. package/lib/components/loop/roster-for-loop/roster.scss +30 -37
  16. package/lib/components/loop/roster-for-loop/row.js +84 -31
  17. package/lib/components/pairwise-links/pairwise-links.js +2 -4
  18. package/lib/components/pairwise-links/row.js +1 -0
  19. package/lib/components/suggester/html/suggester.js +31 -12
  20. package/lib/components/suggester/idb-suggester/idb-suggester.js +10 -7
  21. package/lib/components/suggester/lunatic-suggester.js +31 -4
  22. package/lib/hooks/use-did-change.js +19 -0
  23. package/lib/src/components/commons/components/combo-box/combo-box.d.ts +4 -4
  24. package/lib/src/components/commons/components/combo-box/combo-box.stories.d.ts +2 -2
  25. package/lib/src/components/commons/components/combo-box/panel/panel.d.ts +1 -1
  26. package/lib/src/components/commons/components/combo-box/state-management/actions.d.ts +4 -4
  27. package/lib/src/components/commons/components/orchestrated-component.d.ts +3 -3
  28. package/lib/src/components/commons/create-row-orchestrator.d.ts +4 -3
  29. package/lib/src/components/dropdown/html/dropdown-writable/dropdown-writable.d.ts +1 -1
  30. package/lib/src/components/dropdown/html/dropdown.d.ts +2 -1
  31. package/lib/src/components/input-number/html/input-number.d.ts +1 -0
  32. package/lib/src/components/loop/block-for-loop/block-for-loop-ochestrator.d.ts +11 -3
  33. package/lib/src/components/loop/block-for-loop/block-for-loop.d.ts +5 -1
  34. package/lib/src/components/loop/roster-for-loop/roster-for-loop-orchestrator.d.ts +11 -3
  35. package/lib/src/components/loop/roster-for-loop/roster-for-loop.d.ts +8 -4
  36. package/lib/src/components/loop/roster-for-loop/roster-table.d.ts +3 -3
  37. package/lib/src/components/loop/roster-for-loop/row.d.ts +3 -2
  38. package/lib/src/components/suggester/html/suggester.d.ts +6 -4
  39. package/lib/src/components/suggester/idb-suggester/idb-suggester.d.ts +4 -3
  40. package/lib/src/components/suggester/lunatic-suggester.d.ts +1 -1
  41. package/lib/src/components/type.d.ts +25 -5
  42. package/lib/src/hooks/use-did-change.d.ts +4 -0
  43. package/lib/src/use-lunatic/commons/fill-components/fill-from-state.d.ts +61 -16
  44. package/lib/src/use-lunatic/commons/fill-components/fill-specific-expression.d.ts +36 -0
  45. package/lib/src/use-lunatic/reducer/commons/is-loop-component.d.ts +2 -2
  46. package/lib/src/use-lunatic/reducer/overview/overview-on-init.d.ts +1 -1
  47. package/lib/src/use-lunatic/reducer/reduce-update-state.d.ts +106 -1
  48. package/lib/src/use-lunatic/replace-component-sequence.d.ts +1 -1
  49. package/lib/src/use-lunatic/type-source.d.ts +11 -1
  50. package/lib/src/use-lunatic/type.d.ts +1 -1
  51. package/lib/stories/input-number/input-number.stories.js +8 -1
  52. package/lib/stories/input-number/source-dynamic.json +41 -0
  53. package/lib/stories/loop/block-for-loop.stories.js +1 -8
  54. package/lib/stories/loop/roster-for-loop.stories.js +8 -1
  55. package/lib/stories/loop/source-with-header.json +15 -3
  56. package/lib/stories/questionnaires/EAP/data-eap.json +46 -0
  57. package/lib/stories/questionnaires/EAP/eap.stories.js +71 -0
  58. package/lib/stories/questionnaires/EAP/source-eap.json +433 -0
  59. package/lib/stories/suggester/multipleResponses.json +100 -0
  60. package/lib/stories/suggester/suggester-workers.stories.js +1 -1
  61. package/lib/stories/suggester/suggester.stories.js +18 -6
  62. package/lib/use-lunatic/commons/fill-components/fill-component-expressions.js +1 -1
  63. package/lib/use-lunatic/commons/get-component-value/get-component-value.js +8 -0
  64. package/lib/use-lunatic/initial-state.js +1 -0
  65. package/lib/use-lunatic/reducer/reducer.js +1 -0
  66. package/package.json +1 -1
  67. package/lib/components/loop/roster-for-loop/body.js +0 -52
  68. package/lib/components/loop/roster-for-loop/header.js +0 -34
  69. package/lib/src/components/loop/roster-for-loop/body.d.ts +0 -12
  70. package/lib/src/components/loop/roster-for-loop/header.d.ts +0 -9
@@ -0,0 +1,433 @@
1
+ {
2
+ "cleaning": {},
3
+ "suggesters": [
4
+ {
5
+ "name": "nomenclature-eap",
6
+ "fields": [
7
+ {
8
+ "name": "label",
9
+ "rules": ["[\\w]+"],
10
+ "language": "French",
11
+ "min": 2
12
+ },
13
+ { "name": "id" }
14
+ ],
15
+ "queryParser": {
16
+ "type": "tokenized",
17
+ "params": { "language": "French", "pattern": "[\\w.]+" }
18
+ },
19
+ "version": "1"
20
+ },
21
+ {
22
+ "name": "nomenclature-multiple",
23
+ "fields": [
24
+ {
25
+ "name": "label",
26
+ "rules": ["[\\w]+"],
27
+ "language": "French",
28
+ "min": 2
29
+ },
30
+ { "name": "id" }
31
+ ],
32
+ "queryParser": {
33
+ "type": "tokenized",
34
+ "params": { "language": "French", "pattern": "[\\w.]+" }
35
+ },
36
+ "version": "1"
37
+ }
38
+ ],
39
+ "variables": [
40
+ {
41
+ "variableType": "COLLECTED",
42
+ "values": {
43
+ "COLLECTED": null,
44
+ "EDITED": null,
45
+ "INPUTED": null,
46
+ "FORCED": null,
47
+ "PREVIOUS": null
48
+ },
49
+ "name": "COMMENT_QE"
50
+ },
51
+ {
52
+ "variableType": "COLLECTED",
53
+
54
+ "values": {
55
+ "COLLECTED": [null],
56
+ "EDITED": [null],
57
+ "INPUTED": [null],
58
+ "FORCED": [null],
59
+ "PREVIOUS": [null]
60
+ },
61
+ "name": "ID"
62
+ },
63
+ {
64
+ "variableType": "COLLECTED",
65
+ "values": {
66
+ "COLLECTED": [null],
67
+ "EDITED": [null],
68
+ "INPUTED": [null],
69
+ "FORCED": [null],
70
+ "PREVIOUS": [null]
71
+ },
72
+ "name": "LABEL"
73
+ },
74
+ {
75
+ "variableType": "COLLECTED",
76
+ "values": {
77
+ "COLLECTED": [null],
78
+ "EDITED": [null],
79
+ "INPUTED": [null],
80
+ "FORCED": [null],
81
+ "PREVIOUS": [null]
82
+ },
83
+ "name": "UNIT"
84
+ },
85
+ {
86
+ "variableType": "COLLECTED",
87
+
88
+ "values": {
89
+ "COLLECTED": [null],
90
+ "EDITED": [null],
91
+ "INPUTED": [null],
92
+ "FORCED": [null],
93
+ "PREVIOUS": [null]
94
+ },
95
+ "name": "ID_SIMPLE"
96
+ },
97
+ {
98
+ "variableType": "COLLECTED",
99
+ "values": {
100
+ "COLLECTED": [null],
101
+ "EDITED": [null],
102
+ "INPUTED": [null],
103
+ "FORCED": [null],
104
+ "PREVIOUS": [null]
105
+ },
106
+ "name": "LABEL_SIMPLE"
107
+ },
108
+ {
109
+ "variableType": "COLLECTED",
110
+ "values": {
111
+ "COLLECTED": [null],
112
+ "EDITED": [null],
113
+ "INPUTED": [null],
114
+ "FORCED": [null],
115
+ "PREVIOUS": [null]
116
+ },
117
+ "name": "UNIT_SIMPLE"
118
+ },
119
+ {
120
+ "variableType": "COLLECTED",
121
+ "values": {
122
+ "COLLECTED": [null],
123
+ "EDITED": [null],
124
+ "INPUTED": [null],
125
+ "FORCED": [null],
126
+ "PREVIOUS": [null]
127
+ },
128
+ "name": "FACTURATION"
129
+ },
130
+ {
131
+ "variableType": "COLLECTED",
132
+ "values": {
133
+ "COLLECTED": [null],
134
+ "EDITED": [null],
135
+ "INPUTED": [null],
136
+ "FORCED": [null],
137
+ "PREVIOUS": [null]
138
+ },
139
+ "name": "QUANTITE_PRODUITE"
140
+ },
141
+ {
142
+ "variableType": "COLLECTED",
143
+ "values": {
144
+ "COLLECTED": [null],
145
+ "EDITED": [null],
146
+ "INPUTED": [null],
147
+ "FORCED": [null],
148
+ "PREVIOUS": [null]
149
+ },
150
+ "name": "QUANTITE_FACTUREE"
151
+ }
152
+ ],
153
+ "components": [
154
+ {
155
+ "id": "sugg1",
156
+ "componentType": "Suggester",
157
+ "mandatory": false,
158
+ "label": {
159
+ "value": "\" Sélectionner un produit\"",
160
+ "type": "VTL|MD"
161
+ },
162
+ "storeName": "nomenclature-multiple",
163
+ "conditionFilter": {
164
+ "value": "true",
165
+ "type": "VTL"
166
+ },
167
+ "responses": [
168
+ {
169
+ "id": "id",
170
+ "response": { "name": "ID_SIMPLE" }
171
+ },
172
+
173
+ {
174
+ "id": "label",
175
+ "response": { "name": "LABEL_SIMPLE" }
176
+ },
177
+ {
178
+ "id": "unit",
179
+ "response": { "name": "UNIT_SIMPLE" }
180
+ }
181
+ ],
182
+ "page": "1"
183
+ },
184
+ {
185
+ "componentType": "RosterForLoop",
186
+ "bindingDependencies": [
187
+ "ID",
188
+ "LABEL",
189
+ "UNIT",
190
+ "FACTURATION",
191
+ "QUANTITE_PRODUITE",
192
+ "QUANTITE_FACTUREE"
193
+ ],
194
+ "controls": [
195
+ {
196
+ "criticality": "ERROR",
197
+ "errorMessage": {
198
+ "type": "VTL|MD",
199
+ "value": "\" La valeur doit être comprise entre 0 et 10000000.\""
200
+ },
201
+ "typeOfControl": "FORMAT",
202
+ "control": {
203
+ "type": "VTL",
204
+ "value": "not(not(isnull(FACTURATION)) and (0>FACTURATION or 10000000<FACTURATION))"
205
+ },
206
+ "id": "lh7pozh6-format-borne-inf-sup"
207
+ },
208
+ {
209
+ "criticality": "ERROR",
210
+ "errorMessage": {
211
+ "type": "VTL|MD",
212
+ "value": "\"Le nombre doit comporter au maximum 0 chiffre(s) après la virgule.\""
213
+ },
214
+ "typeOfControl": "FORMAT",
215
+ "control": {
216
+ "type": "VTL",
217
+ "value": "not(not(isnull(FACTURATION)) and round(FACTURATION,0)<>FACTURATION)"
218
+ },
219
+ "id": "lh7pozh6-format-decimal"
220
+ },
221
+ {
222
+ "criticality": "ERROR",
223
+ "errorMessage": {
224
+ "type": "VTL|MD",
225
+ "value": "\" La valeur doit être comprise entre 0 et 100000000.\""
226
+ },
227
+ "typeOfControl": "FORMAT",
228
+ "control": {
229
+ "type": "VTL",
230
+ "value": "not(not(isnull(QUANTITE_PRODUITE)) and (0>QUANTITE_PRODUITE or 100000000<QUANTITE_PRODUITE))"
231
+ },
232
+ "id": "lh7pozh6-format-borne-inf-sup"
233
+ },
234
+ {
235
+ "criticality": "ERROR",
236
+ "errorMessage": {
237
+ "type": "VTL|MD",
238
+ "value": "\"Le nombre doit comporter au maximum 0 chiffre(s) après la virgule.\""
239
+ },
240
+ "typeOfControl": "FORMAT",
241
+ "control": {
242
+ "type": "VTL",
243
+ "value": "not(not(isnull(QUANTITE_PRODUITE)) and round(QUANTITE_PRODUITE,0)<>QUANTITE_PRODUITE)"
244
+ },
245
+ "id": "lh7pozh6-format-decimal"
246
+ },
247
+ {
248
+ "criticality": "ERROR",
249
+ "errorMessage": {
250
+ "type": "VTL|MD",
251
+ "value": "\" La valeur doit être comprise entre 0 et 1000000000.\""
252
+ },
253
+ "typeOfControl": "FORMAT",
254
+ "control": {
255
+ "type": "VTL",
256
+ "value": "not(not(isnull(QUANTITE_FACTUREE)) and (0>QUANTITE_FACTUREE or 1000000000<QUANTITE_FACTUREE))"
257
+ },
258
+ "id": "lh7pozh6-format-borne-inf-sup"
259
+ },
260
+ {
261
+ "criticality": "ERROR",
262
+ "errorMessage": {
263
+ "type": "VTL|MD",
264
+ "value": "\"Le nombre doit comporter au maximum 0 chiffre(s) après la virgule.\""
265
+ },
266
+ "typeOfControl": "FORMAT",
267
+ "control": {
268
+ "type": "VTL",
269
+ "value": "not(not(isnull(QUANTITE_FACTUREE)) and round(QUANTITE_FACTUREE,0)<>QUANTITE_FACTUREE)"
270
+ },
271
+ "id": "lh7pozh6-format-decimal"
272
+ }
273
+ ],
274
+ "positioning": "HORIZONTAL",
275
+ "hierarchy": {
276
+ "sequence": {
277
+ "id": "la6i18y5",
278
+ "page": "1",
279
+ "label": {
280
+ "type": "VTL|MD",
281
+ "value": "\"I - \" || \"Votre production industrielle\""
282
+ }
283
+ }
284
+ },
285
+ "header": [
286
+ { "label": { "type": "VTL|MD", "value": "\"Produits\"" } },
287
+ { "label": { "type": "VTL|MD", "value": "\"Facturations\"" } },
288
+ { "label": { "type": "VTL|MD", "value": "\"Quantités produites\"" } },
289
+ {
290
+ "label": {
291
+ "type": "VTL|MD",
292
+ "value": "\"Quantités facturées\""
293
+ }
294
+ }
295
+ ],
296
+ "lines": {
297
+ "min": { "value": "1", "type": "VTL" },
298
+ "max": { "value": "300", "type": "VTL" }
299
+ },
300
+ "conditionFilter": { "type": "VTL", "value": "true" },
301
+ "id": "lh7pozh6",
302
+ "page": "2",
303
+ "label": {
304
+ "type": "VTL|MD",
305
+ "value": "\"➡ 1. \" || \"Les années précédentes, vous avez déclaré fabriquer les produits ci-dessous, veuillez remplir les informations correspondantes pour l’année 2022\""
306
+ },
307
+ "components": [
308
+ {
309
+ "id": "sugg1",
310
+ "componentType": "Suggester",
311
+ "mandatory": false,
312
+ "label": {
313
+ "value": "\" Sélectionner un produit\"",
314
+ "type": "VTL|MD"
315
+ },
316
+ "storeName": "nomenclature-eap",
317
+ "conditionFilter": {
318
+ "value": "true",
319
+ "type": "VTL"
320
+ },
321
+ "responses": [
322
+ {
323
+ "id": "id",
324
+ "response": { "name": "ID" }
325
+ },
326
+
327
+ {
328
+ "id": "label",
329
+ "response": { "name": "LABEL" }
330
+ },
331
+ {
332
+ "id": "unit",
333
+ "response": { "name": "UNIT" }
334
+ }
335
+ ]
336
+ },
337
+ {
338
+ "componentType": "InputNumber",
339
+ "dynamicUnit": {
340
+ "type": "VTL",
341
+ "value": "\"k\" || \"€\""
342
+ },
343
+ "bindingDependencies": ["FACTURATION"],
344
+ "min": 0,
345
+ "max": 10000000,
346
+ "response": { "name": "FACTURATION" },
347
+ "decimals": 0,
348
+ "id": "lh7pozh6-QOP-lh8v4mbu"
349
+ },
350
+ {
351
+ "componentType": "InputNumber",
352
+ "dynamicUnit": {
353
+ "type": "VTL",
354
+ "value": "UNIT"
355
+ },
356
+ "conditionFilter": {
357
+ "type": "VTL",
358
+ "value": "nvl(UNIT,\"\") <> \"\""
359
+ },
360
+ "bindingDependencies": ["QUANTITE_PRODUITE", "UNIT"],
361
+ "min": 0,
362
+ "max": 100000000,
363
+ "response": { "name": "QUANTITE_PRODUITE" },
364
+ "decimals": 0,
365
+ "id": "lh7pozh6-QOP-lh8viuae"
366
+ },
367
+ {
368
+ "componentType": "InputNumber",
369
+ "dynamicUnit": {
370
+ "type": "VTL",
371
+ "value": "UNIT"
372
+ },
373
+ "conditionFilter": {
374
+ "type": "VTL",
375
+ "value": "nvl(UNIT,\"\") <> \"\""
376
+ },
377
+ "bindingDependencies": ["QUANTITE_FACTUREE"],
378
+ "min": 0,
379
+ "max": 1000000000,
380
+ "response": { "name": "QUANTITE_FACTUREE" },
381
+ "decimals": 0,
382
+ "id": "lh7pozh6-QOP-lh8v3u73"
383
+ }
384
+ ],
385
+ "mandatory": false
386
+ },
387
+ {
388
+ "componentType": "Sequence",
389
+ "hierarchy": {
390
+ "sequence": {
391
+ "id": "COMMENT-SEQ",
392
+ "page": "3",
393
+ "label": { "type": "VTL|MD", "value": "\"Commentaire\"" }
394
+ }
395
+ },
396
+ "conditionFilter": { "type": "VTL", "value": "true" },
397
+ "id": "COMMENT-SEQ",
398
+ "page": "3",
399
+ "label": { "type": "VTL|MD", "value": "\"Commentaire\"" }
400
+ },
401
+ {
402
+ "componentType": "Textarea",
403
+ "bindingDependencies": ["COMMENT_QE"],
404
+ "response": { "name": "COMMENT_QE" },
405
+ "hierarchy": {
406
+ "sequence": {
407
+ "id": "COMMENT-SEQ",
408
+ "page": "3",
409
+ "label": { "type": "VTL|MD", "value": "\"Commentaire\"" }
410
+ }
411
+ },
412
+ "conditionFilter": { "type": "VTL", "value": "true" },
413
+ "id": "COMMENT-QUESTION",
414
+ "page": "4",
415
+ "label": {
416
+ "type": "VTL|MD",
417
+ "value": "\"Avez-vous des remarques concernant l'enquête ou des commentaires ?\""
418
+ },
419
+ "mandatory": false,
420
+ "maxLength": 2000
421
+ }
422
+ ],
423
+ "pagination": "question",
424
+ "resizing": {},
425
+ "label": { "type": "VTL|MD", "value": "Hackaton EAP Copie" },
426
+ "lunaticModelVersion": "2.3.1",
427
+ "modele": "HackEAP",
428
+ "enoCoreVersion": "2.4.1",
429
+ "generatingDate": "31-05-2023 11:51:48",
430
+ "missing": false,
431
+ "id": "libjk0lj",
432
+ "maxPage": "4"
433
+ }
@@ -0,0 +1,100 @@
1
+ {
2
+ "maxPage": "2",
3
+ "suggesters": [
4
+ {
5
+ "name": "nomenclature-multiple",
6
+ "fields": [
7
+ {
8
+ "name": "label",
9
+ "rules": ["[\\w]+"],
10
+ "language": "French",
11
+ "min": 2
12
+ },
13
+ { "name": "id" }
14
+ ],
15
+ "queryParser": {
16
+ "type": "tokenized",
17
+ "params": { "language": "French", "pattern": "[\\w.]+" }
18
+ },
19
+ "version": "1"
20
+ }
21
+ ],
22
+ "components": [
23
+ {
24
+ "id": "sugg1",
25
+ "componentType": "Suggester",
26
+ "mandatory": false,
27
+ "label": {
28
+ "value": "\" Sélectionner un produit\"",
29
+ "type": "VTL|MD"
30
+ },
31
+ "storeName": "nomenclature-multiple",
32
+ "conditionFilter": {
33
+ "value": "true",
34
+ "type": "VTL"
35
+ },
36
+ "responses": [
37
+ {
38
+ "id": "id",
39
+ "response": { "name": "ID" }
40
+ },
41
+
42
+ {
43
+ "id": "label",
44
+ "response": { "name": "LABEL" }
45
+ },
46
+ {
47
+ "id": "unit",
48
+ "response": { "name": "UNIT" }
49
+ }
50
+ ],
51
+
52
+ "page": "1"
53
+ },
54
+ {
55
+ "id": "kk",
56
+ "componentType": "Sequence",
57
+ "label": { "value": "\"END\"", "type": "VTL|MD" },
58
+ "conditionFilter": { "value": "true", "type": "VTL" },
59
+ "page": "2"
60
+ }
61
+ ],
62
+ "variables": [
63
+ {
64
+ "variableType": "COLLECTED",
65
+ "name": "ID",
66
+ "componentRef": "sugg1",
67
+ "values": {
68
+ "PREVIOUS": null,
69
+ "COLLECTED": null,
70
+ "FORCED": null,
71
+ "EDITED": null,
72
+ "INPUTED": null
73
+ }
74
+ },
75
+ {
76
+ "variableType": "COLLECTED",
77
+ "name": "LABEL",
78
+ "componentRef": "sugg1",
79
+ "values": {
80
+ "PREVIOUS": null,
81
+ "COLLECTED": null,
82
+ "FORCED": null,
83
+ "EDITED": null,
84
+ "INPUTED": null
85
+ }
86
+ },
87
+ {
88
+ "variableType": "COLLECTED",
89
+ "name": "UNIT",
90
+ "componentRef": "sugg1",
91
+ "values": {
92
+ "PREVIOUS": null,
93
+ "COLLECTED": null,
94
+ "FORCED": null,
95
+ "EDITED": null,
96
+ "INPUTED": null
97
+ }
98
+ }
99
+ ]
100
+ }
@@ -7,11 +7,11 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports["default"] = exports.Default = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
  var _orchestrator = _interopRequireDefault(require("../utils/orchestrator"));
10
- var _defaultArgTypes = _interopRequireDefault(require("../utils/default-arg-types"));
11
10
  var _idbTools = require("../../utils/idb-tools");
12
11
  var _storeTools = require("../../utils/store-tools");
13
12
  var _appendToIndex = _interopRequireDefault(require("../../utils/suggester-workers/append-to-index"));
14
13
  var _searching = _interopRequireDefault(require("../../utils/suggester-workers/searching"));
14
+ var _defaultArgTypes = _interopRequireDefault(require("../utils/default-arg-types"));
15
15
  var _jsxRuntime = require("react/jsx-runtime");
16
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
17
  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); }
@@ -3,13 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports["default"] = exports.Simple = exports.Default = void 0;
6
+ exports["default"] = exports.Simple = exports.MultipleResponses = exports.Default = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
+ var _defaultArgTypes = _interopRequireDefault(require("../utils/default-arg-types"));
8
9
  var _orchestrator = _interopRequireDefault(require("../utils/orchestrator"));
9
- var _source = _interopRequireDefault(require("./source"));
10
+ var _multipleResponses = _interopRequireDefault(require("./multipleResponses"));
10
11
  var _simple = _interopRequireDefault(require("./simple"));
11
- var _defaultArgTypes = _interopRequireDefault(require("../utils/default-arg-types"));
12
- var _SuggesterNotification = require("./SuggesterNotification");
12
+ var _source = _interopRequireDefault(require("./source"));
13
13
  var _jsxRuntime = require("react/jsx-runtime");
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
15
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
@@ -42,7 +42,7 @@ function _getReferentiel() {
42
42
  while (1) switch (_context.prev = _context.next) {
43
43
  case 0:
44
44
  _context.t0 = name;
45
- _context.next = _context.t0 === 'naf-rev2-stop' ? 3 : _context.t0 === 'naf-rev2' ? 3 : _context.t0 === 'cog-communes' ? 4 : 5;
45
+ _context.next = _context.t0 === 'naf-rev2-stop' ? 3 : _context.t0 === 'naf-rev2' ? 3 : _context.t0 === 'cog-communes' ? 4 : _context.t0 === 'nomenclature-multiple' ? 5 : 6;
46
46
  break;
47
47
  case 3:
48
48
  return _context.abrupt("return", fetch('https://inseefr.github.io/Lunatic/storybook/naf-rev2.json').then(function (r) {
@@ -53,8 +53,12 @@ function _getReferentiel() {
53
53
  return r.json();
54
54
  }));
55
55
  case 5:
56
- throw new Error("Unkonw r\xE9f\xE9rentiel ".concat(name));
56
+ return _context.abrupt("return", fetch('/nomenclature-multiple.json').then(function (r) {
57
+ return r.json();
58
+ }));
57
59
  case 6:
60
+ throw new Error("Unkonw r\xE9f\xE9rentiel ".concat(name));
61
+ case 7:
58
62
  case "end":
59
63
  return _context.stop();
60
64
  }
@@ -82,4 +86,12 @@ Simple.args = {
82
86
  control: 'boolean',
83
87
  defaultValue: true
84
88
  }
89
+ };
90
+ var MultipleResponses = Template.bind({});
91
+ exports.MultipleResponses = MultipleResponses;
92
+ MultipleResponses.args = {
93
+ id: 'suggester-multiple',
94
+ source: _multipleResponses["default"],
95
+ getReferentiel: getReferentiel,
96
+ autoSuggesterLoading: true
85
97
  };
@@ -24,7 +24,7 @@ var VTL_ATTRIBUTES = ['label', 'options.label', 'responses.label', 'hierarchy.la
24
24
  // Disable controls compilation
25
25
  // 'controls.control',
26
26
  // 'controls.errorMessage',
27
- 'controls.iterations', 'lines.min', 'lines.max', 'iterations', 'xAxisIterations', 'yAxisIterations', 'conditionFilter', 'headers.label', 'header.label', 'questionContext', 'questionInformation'];
27
+ 'controls.iterations', 'lines.min', 'lines.max', 'iterations', 'xAxisIterations', 'yAxisIterations', 'conditionFilter', 'header.label', 'questionContext', 'questionInformation', 'dynamicUnit'];
28
28
 
29
29
  // Utility type to replace all expression from an object into a translated version
30
30
 
@@ -106,6 +106,7 @@ function collecteComponentResponse(_ref5) {
106
106
  });
107
107
  }
108
108
  if ('response' in component) {
109
+ // @ts-ignore
109
110
  return mergeResponse({
110
111
  map: map,
111
112
  response: component.response,
@@ -119,6 +120,13 @@ function collecteComponentResponse(_ref5) {
119
120
  map: map
120
121
  });
121
122
  }
123
+ if ('responses' in component && component.componentType === 'Suggester') {
124
+ return collecteArrayResponses({
125
+ components: component.responses,
126
+ variables: variables,
127
+ map: map
128
+ });
129
+ }
122
130
  if ('responses' in component) {
123
131
  // TODO : Understand this cause types doesn't match
124
132
  return collecteArrayResponses({
@@ -38,6 +38,7 @@ var INITIAL_STATE = {
38
38
  return undefined;
39
39
  },
40
40
  activeControls: false,
41
+ // @ts-ignore
41
42
  getSuggesterStatus: function getSuggesterStatus(name) {
42
43
  return {
43
44
  status: _useSuggesters.SuggesterStatus.unused,
@@ -28,6 +28,7 @@ function reducer(state, action) {
28
28
  case _actions.ActionKind.ON_SET_WAITING:
29
29
  return (0, _reduceOnSetWaiting["default"])(state, action);
30
30
  case _actions.ActionKind.UPDATE_STATE:
31
+ // @ts-ignore
31
32
  return (0, _reduceUpdateState.reduceUpdateState)(state, action);
32
33
  default:
33
34
  return state;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inseefr/lunatic",
3
- "version": "2.4.5-beta",
3
+ "version": "2.4.5-mvp-eap",
4
4
  "workersVersion": "0.2.5-experimental",
5
5
  "description": "Library of questionnaire components",
6
6
  "repository": {