@inseefr/lunatic 3.0.0-rc.29 → 3.0.0-rc.30

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 (44) hide show
  1. package/lib/components/shared/HOC/slottableComponent.d.ts +1 -1
  2. package/lib/components/shared/MDLabel/MDLabel.d.ts +1 -3
  3. package/lib/components/shared/MDLabel/MDLabel.js +8 -10
  4. package/lib/components/shared/MDLabel/MDLabel.js.map +1 -1
  5. package/lib/components/shared/MDLabel/MDLabel.spec.js +21 -6
  6. package/lib/components/shared/MDLabel/MDLabel.spec.js.map +1 -1
  7. package/lib/components/shared/MDLabel/MDLabelLink.js +3 -3
  8. package/lib/components/shared/MDLabel/MDLabelLink.js.map +1 -1
  9. package/lib/components/type.d.ts +1 -1
  10. package/lib/hooks/useDebounce.d.ts +1 -1
  11. package/lib/tests/setup.d.ts +1 -0
  12. package/lib/tests/setup.js +18 -0
  13. package/lib/tests/setup.js.map +1 -0
  14. package/lib/tests/utils/lunatic.d.ts +19 -0
  15. package/lib/tests/utils/lunatic.js +31 -0
  16. package/lib/tests/utils/lunatic.js.map +1 -0
  17. package/lib/tests/utils/timer.d.ts +1 -0
  18. package/lib/tests/utils/timer.js +4 -0
  19. package/lib/tests/utils/timer.js.map +1 -0
  20. package/lib/use-lunatic/commons/compose.d.ts +1 -1
  21. package/lib/use-lunatic/commons/fill-components/fill-component-expressions.d.ts +20 -611
  22. package/lib/use-lunatic/commons/fill-components/fill-component-expressions.js +108 -91
  23. package/lib/use-lunatic/commons/fill-components/fill-component-expressions.js.map +1 -1
  24. package/lib/use-lunatic/commons/fill-components/fill-component-expressions.spec.js +71 -11
  25. package/lib/use-lunatic/commons/fill-components/fill-component-expressions.spec.js.map +1 -1
  26. package/lib/use-lunatic/hooks/use-page-has-response.js +1 -1
  27. package/lib/use-lunatic/hooks/use-page-has-response.js.map +1 -1
  28. package/lib/use-lunatic/hooks/useOverview.js +20 -19
  29. package/lib/use-lunatic/hooks/useOverview.js.map +1 -1
  30. package/lib/use-lunatic/reducer/overview/overviewOnInit.js +1 -1
  31. package/lib/use-lunatic/reducer/overview/overviewOnInit.js.map +1 -1
  32. package/lib/use-lunatic/reducer/reducerInitializer.js +3 -2
  33. package/lib/use-lunatic/reducer/reducerInitializer.js.map +1 -1
  34. package/lib/use-lunatic/replace-component-sequence.d.ts +3 -3
  35. package/lib/use-lunatic/type-source.d.ts +1 -1
  36. package/lib/use-lunatic/type.d.ts +2 -2
  37. package/lib/utils/array.d.ts +1 -1
  38. package/lib/utils/array.js +1 -1
  39. package/lib/utils/constants/features.d.ts +1 -0
  40. package/lib/utils/constants/features.js +1 -0
  41. package/lib/utils/constants/features.js.map +1 -1
  42. package/lib/utils/vtl.js +2 -2
  43. package/lib/utils/vtl.js.map +1 -1
  44. package/package.json +34 -43
@@ -6,618 +6,27 @@ export type DeepTranslateExpression<T> = T extends LunaticExpression ? ReactNode
6
6
  [key in keyof T]: DeepTranslateExpression<T[key]>;
7
7
  } : T;
8
8
  /**
9
- * Fill props interpreting VTL expression
9
+ * Interpret every VTL expression inside a component
10
+ *
11
+ * ## Example
12
+ *
13
+ * For instance a component like this :
14
+ *
15
+ * ```json
16
+ * {
17
+ * "label": {"value": "\"Hello world\"", "type": "VTL"}
18
+ * }
19
+ * ```
20
+ *
21
+ * Would see its expression interpreted like this
22
+ *
23
+ * ```json
24
+ * {
25
+ * "label": "Hello world"
26
+ * }
27
+ * ```
10
28
  */
11
29
  export declare function fillComponentExpressions(component: LunaticComponentDefinition, state: {
12
30
  executeExpression: LunaticReducerState['executeExpression'];
13
31
  pager: Pick<LunaticReducerState['pager'], 'iteration' | 'linksIterations'>;
14
- }): {
15
- label: ReactNode;
16
- description?: ReactNode;
17
- declarations?: import("../../type-source").DeclarationType[] | undefined;
18
- conditionFilter?: ReactNode;
19
- controls?: import("../../type-source").ControlType[] | undefined;
20
- id: string;
21
- bindingDependencies?: string[] | undefined;
22
- hierarchy?: {
23
- sequence: {
24
- label: ReactNode;
25
- id: string;
26
- page: string;
27
- };
28
- subSequence?: {
29
- label: ReactNode;
30
- id: string;
31
- page: string;
32
- } | undefined;
33
- } | undefined;
34
- mandatory?: boolean | undefined;
35
- page: string;
36
- componentType: "Sequence";
37
- goToPage?: string | undefined;
38
- } | {
39
- label: ReactNode;
40
- description?: ReactNode;
41
- declarations?: import("../../type-source").DeclarationType[] | undefined;
42
- conditionFilter?: ReactNode;
43
- controls?: import("../../type-source").ControlType[] | undefined;
44
- id: string;
45
- bindingDependencies?: string[] | undefined;
46
- hierarchy?: {
47
- sequence: {
48
- label: ReactNode;
49
- id: string;
50
- page: string;
51
- };
52
- subSequence?: {
53
- label: ReactNode;
54
- id: string;
55
- page: string;
56
- } | undefined;
57
- } | undefined;
58
- mandatory?: boolean | undefined;
59
- page: string;
60
- componentType: "Subsequence";
61
- goToPage?: string | undefined;
62
- } | {
63
- label: ReactNode;
64
- description?: ReactNode;
65
- declarations?: import("../../type-source").DeclarationType[] | undefined;
66
- conditionFilter?: ReactNode;
67
- controls?: import("../../type-source").ControlType[] | undefined;
68
- id: string;
69
- bindingDependencies?: string[] | undefined;
70
- hierarchy?: {
71
- sequence: {
72
- label: ReactNode;
73
- id: string;
74
- page: string;
75
- };
76
- subSequence?: {
77
- label: ReactNode;
78
- id: string;
79
- page: string;
80
- } | undefined;
81
- } | undefined;
82
- mandatory?: boolean | undefined;
83
- page: string;
84
- componentType: "RosterForLoop";
85
- components: import("../../type-source").ComponentType[];
86
- lines: {
87
- min: ReactNode;
88
- max: ReactNode;
89
- };
90
- header?: {
91
- value: string;
92
- label: string | import("../../type-source").LabelType<"VTL" | "VTL|MD">;
93
- options: {
94
- value: string;
95
- label: import("../../type-source").LabelType<"VTL" | "VTL|MD">;
96
- description?: import("../../type-source").LabelType<"VTL" | "VTL|MD"> | undefined;
97
- }[];
98
- colspan?: number | undefined;
99
- rowspan?: number | undefined;
100
- }[] | undefined;
101
- positioning: "HORIZONTAL";
102
- } | {
103
- label: ReactNode;
104
- description?: ReactNode;
105
- declarations?: import("../../type-source").DeclarationType[] | undefined;
106
- conditionFilter?: ReactNode;
107
- controls?: import("../../type-source").ControlType[] | undefined;
108
- id: string;
109
- bindingDependencies?: string[] | undefined;
110
- hierarchy?: {
111
- sequence: {
112
- label: ReactNode;
113
- id: string;
114
- page: string;
115
- };
116
- subSequence?: {
117
- label: ReactNode;
118
- id: string;
119
- page: string;
120
- } | undefined;
121
- } | undefined;
122
- mandatory?: boolean | undefined;
123
- page: string;
124
- componentType: "Loop";
125
- loopDependencies: string[];
126
- components: import("../../type-source").ComponentType[];
127
- depth: number;
128
- paginatedLoop: true;
129
- maxPage: string;
130
- iterations: ReactNode;
131
- } | {
132
- label: ReactNode;
133
- description?: ReactNode;
134
- declarations?: import("../../type-source").DeclarationType[] | undefined;
135
- conditionFilter?: ReactNode;
136
- controls?: import("../../type-source").ControlType[] | undefined;
137
- id: string;
138
- bindingDependencies?: string[] | undefined;
139
- hierarchy?: {
140
- sequence: {
141
- label: ReactNode;
142
- id: string;
143
- page: string;
144
- };
145
- subSequence?: {
146
- label: ReactNode;
147
- id: string;
148
- page: string;
149
- } | undefined;
150
- } | undefined;
151
- mandatory?: boolean | undefined;
152
- page: string;
153
- componentType: "Loop";
154
- loopDependencies: string[];
155
- components: import("../../type-source").ComponentType[];
156
- depth: number;
157
- paginatedLoop: false;
158
- lines: {
159
- min: ReactNode;
160
- max: ReactNode;
161
- };
162
- } | {
163
- label: ReactNode;
164
- description?: ReactNode;
165
- declarations?: import("../../type-source").DeclarationType[] | undefined;
166
- conditionFilter?: ReactNode;
167
- controls?: import("../../type-source").ControlType[] | undefined;
168
- id: string;
169
- bindingDependencies?: string[] | undefined;
170
- hierarchy?: {
171
- sequence: {
172
- label: ReactNode;
173
- id: string;
174
- page: string;
175
- };
176
- subSequence?: {
177
- label: ReactNode;
178
- id: string;
179
- page: string;
180
- } | undefined;
181
- } | undefined;
182
- mandatory?: boolean | undefined;
183
- page: string;
184
- componentType: "Table";
185
- header: {
186
- value: string;
187
- label: string | import("../../type-source").LabelType<"VTL" | "VTL|MD">;
188
- options: {
189
- value: string;
190
- label: import("../../type-source").LabelType<"VTL" | "VTL|MD">;
191
- description?: import("../../type-source").LabelType<"VTL" | "VTL|MD"> | undefined;
192
- }[];
193
- colspan?: number | undefined;
194
- rowspan?: number | undefined;
195
- }[] | undefined;
196
- body: ({
197
- label: import("../../type-source").LabelType<"VTL" | "VTL|MD">;
198
- colspan?: number | undefined;
199
- rowspan?: number | undefined;
200
- } | (import("../../type-source").ComponentType & {
201
- colspan?: number | undefined;
202
- rowspan?: number | undefined;
203
- }))[][];
204
- } | {
205
- label: ReactNode;
206
- description?: ReactNode;
207
- declarations?: import("../../type-source").DeclarationType[] | undefined;
208
- conditionFilter?: ReactNode;
209
- controls?: import("../../type-source").ControlType[] | undefined;
210
- id: string;
211
- bindingDependencies?: string[] | undefined;
212
- hierarchy?: {
213
- sequence: {
214
- label: ReactNode;
215
- id: string;
216
- page: string;
217
- };
218
- subSequence?: {
219
- label: ReactNode;
220
- id: string;
221
- page: string;
222
- } | undefined;
223
- } | undefined;
224
- mandatory?: boolean | undefined;
225
- page: string;
226
- componentType: "InputNumber";
227
- unit?: string | undefined;
228
- response: {
229
- name: string;
230
- };
231
- min?: number | undefined;
232
- max?: number | undefined;
233
- decimals?: number | undefined;
234
- } | {
235
- label: ReactNode;
236
- description?: ReactNode;
237
- declarations?: import("../../type-source").DeclarationType[] | undefined;
238
- conditionFilter?: ReactNode;
239
- controls?: import("../../type-source").ControlType[] | undefined;
240
- id: string;
241
- bindingDependencies?: string[] | undefined;
242
- hierarchy?: {
243
- sequence: {
244
- label: ReactNode;
245
- id: string;
246
- page: string;
247
- };
248
- subSequence?: {
249
- label: ReactNode;
250
- id: string;
251
- page: string;
252
- } | undefined;
253
- } | undefined;
254
- mandatory?: boolean | undefined;
255
- page: string;
256
- componentType: "Datepicker";
257
- dateFormat: "YYYY-MM-DD" | "YYYY" | "YYYY-MM";
258
- response: {
259
- name: string;
260
- };
261
- min?: string | undefined;
262
- max?: string | undefined;
263
- } | {
264
- label: ReactNode;
265
- description?: ReactNode;
266
- declarations?: import("../../type-source").DeclarationType[] | undefined;
267
- conditionFilter?: ReactNode;
268
- controls?: import("../../type-source").ControlType[] | undefined;
269
- id: string;
270
- bindingDependencies?: string[] | undefined;
271
- hierarchy?: {
272
- sequence: {
273
- label: ReactNode;
274
- id: string;
275
- page: string;
276
- };
277
- subSequence?: {
278
- label: ReactNode;
279
- id: string;
280
- page: string;
281
- } | undefined;
282
- } | undefined;
283
- mandatory?: boolean | undefined;
284
- page: string;
285
- componentType: "Duration";
286
- format: "PnYnM" | "PTnHnM";
287
- response: {
288
- name: string;
289
- };
290
- } | {
291
- label: ReactNode;
292
- description?: ReactNode;
293
- declarations?: import("../../type-source").DeclarationType[] | undefined;
294
- conditionFilter?: ReactNode;
295
- controls?: import("../../type-source").ControlType[] | undefined;
296
- id: string;
297
- bindingDependencies?: string[] | undefined;
298
- hierarchy?: {
299
- sequence: {
300
- label: ReactNode;
301
- id: string;
302
- page: string;
303
- };
304
- subSequence?: {
305
- label: ReactNode;
306
- id: string;
307
- page: string;
308
- } | undefined;
309
- } | undefined;
310
- mandatory?: boolean | undefined;
311
- page: string;
312
- componentType: "CheckboxGroup";
313
- responses: {
314
- label: import("../../type-source").LabelType<"VTL" | "VTL|MD">;
315
- description?: import("../../type-source").LabelType<"VTL" | "VTL|MD"> | undefined;
316
- response: import("../../type-source").ResponseType;
317
- id: string;
318
- }[];
319
- } | {
320
- label: ReactNode;
321
- description?: ReactNode;
322
- declarations?: import("../../type-source").DeclarationType[] | undefined;
323
- conditionFilter?: ReactNode;
324
- controls?: import("../../type-source").ControlType[] | undefined;
325
- id: string;
326
- bindingDependencies?: string[] | undefined;
327
- hierarchy?: {
328
- sequence: {
329
- label: ReactNode;
330
- id: string;
331
- page: string;
332
- };
333
- subSequence?: {
334
- label: ReactNode;
335
- id: string;
336
- page: string;
337
- } | undefined;
338
- } | undefined;
339
- mandatory?: boolean | undefined;
340
- page: string;
341
- componentType: "CheckboxBoolean";
342
- response: {
343
- name: string;
344
- };
345
- missingResponse?: {
346
- name: string;
347
- } | undefined;
348
- } | {
349
- label: ReactNode;
350
- description?: ReactNode;
351
- declarations?: import("../../type-source").DeclarationType[] | undefined;
352
- conditionFilter?: ReactNode;
353
- controls?: import("../../type-source").ControlType[] | undefined;
354
- id: string;
355
- bindingDependencies?: string[] | undefined;
356
- hierarchy?: {
357
- sequence: {
358
- label: ReactNode;
359
- id: string;
360
- page: string;
361
- };
362
- subSequence?: {
363
- label: ReactNode;
364
- id: string;
365
- page: string;
366
- } | undefined;
367
- } | undefined;
368
- mandatory?: boolean | undefined;
369
- page: string;
370
- componentType: "Radio";
371
- options: {
372
- value: string;
373
- label: import("../../type-source").LabelType<"VTL" | "VTL|MD">;
374
- description?: import("../../type-source").LabelType<"VTL" | "VTL|MD"> | undefined;
375
- }[];
376
- response: {
377
- name: string;
378
- };
379
- missingResponse?: {
380
- name: string;
381
- } | undefined;
382
- } | {
383
- label: ReactNode;
384
- description?: ReactNode;
385
- declarations?: import("../../type-source").DeclarationType[] | undefined;
386
- conditionFilter?: ReactNode;
387
- controls?: import("../../type-source").ControlType[] | undefined;
388
- id: string;
389
- bindingDependencies?: string[] | undefined;
390
- hierarchy?: {
391
- sequence: {
392
- label: ReactNode;
393
- id: string;
394
- page: string;
395
- };
396
- subSequence?: {
397
- label: ReactNode;
398
- id: string;
399
- page: string;
400
- } | undefined;
401
- } | undefined;
402
- mandatory?: boolean | undefined;
403
- page: string;
404
- componentType: "FilterDescription";
405
- filterDescription: boolean;
406
- } | {
407
- label: ReactNode;
408
- description?: ReactNode;
409
- declarations?: import("../../type-source").DeclarationType[] | undefined;
410
- conditionFilter?: ReactNode;
411
- controls?: import("../../type-source").ControlType[] | undefined;
412
- id: string;
413
- bindingDependencies?: string[] | undefined;
414
- hierarchy?: {
415
- sequence: {
416
- label: ReactNode;
417
- id: string;
418
- page: string;
419
- };
420
- subSequence?: {
421
- label: ReactNode;
422
- id: string;
423
- page: string;
424
- } | undefined;
425
- } | undefined;
426
- mandatory?: boolean | undefined;
427
- page: string;
428
- componentType: "Dropdown";
429
- options: {
430
- value: string;
431
- label: import("../../type-source").LabelType<"VTL" | "VTL|MD">;
432
- description?: import("../../type-source").LabelType<"VTL" | "VTL|MD"> | undefined;
433
- }[];
434
- response: {
435
- name: string;
436
- };
437
- missingResponse?: {
438
- name: string;
439
- } | undefined;
440
- } | {
441
- description?: ReactNode;
442
- declarations?: import("../../type-source").DeclarationType[] | undefined;
443
- conditionFilter?: ReactNode;
444
- controls?: import("../../type-source").ControlType[] | undefined;
445
- id: string;
446
- bindingDependencies?: string[] | undefined;
447
- hierarchy?: {
448
- sequence: {
449
- label: ReactNode;
450
- id: string;
451
- page: string;
452
- };
453
- subSequence?: {
454
- label: ReactNode;
455
- id: string;
456
- page: string;
457
- } | undefined;
458
- } | undefined;
459
- mandatory?: boolean | undefined;
460
- page: string;
461
- componentType: "PairwiseLinks";
462
- xAxisIterations: ReactNode;
463
- yAxisIterations: ReactNode;
464
- symLinks: {
465
- [x: string]: {
466
- [x: string]: string | null;
467
- };
468
- };
469
- components: import("../../type-source").ComponentType[];
470
- } | {
471
- label: ReactNode;
472
- description?: ReactNode;
473
- declarations?: import("../../type-source").DeclarationType[] | undefined;
474
- conditionFilter?: ReactNode;
475
- controls?: import("../../type-source").ControlType[] | undefined;
476
- id: string;
477
- bindingDependencies?: string[] | undefined;
478
- hierarchy?: {
479
- sequence: {
480
- label: ReactNode;
481
- id: string;
482
- page: string;
483
- };
484
- subSequence?: {
485
- label: ReactNode;
486
- id: string;
487
- page: string;
488
- } | undefined;
489
- } | undefined;
490
- mandatory?: boolean | undefined;
491
- page: string;
492
- componentType: "Roundabout";
493
- components: import("../../type-source").ComponentType[];
494
- iterations: ReactNode;
495
- locked: boolean;
496
- expressions: {
497
- [x: string]: ReactNode;
498
- };
499
- } | {
500
- label: ReactNode;
501
- description?: ReactNode;
502
- declarations?: import("../../type-source").DeclarationType[] | undefined;
503
- conditionFilter?: ReactNode;
504
- controls?: import("../../type-source").ControlType[] | undefined;
505
- id: string;
506
- bindingDependencies?: string[] | undefined;
507
- hierarchy?: {
508
- sequence: {
509
- label: ReactNode;
510
- id: string;
511
- page: string;
512
- };
513
- subSequence?: {
514
- label: ReactNode;
515
- id: string;
516
- page: string;
517
- } | undefined;
518
- } | undefined;
519
- mandatory?: boolean | undefined;
520
- page: string;
521
- componentType: "Suggester";
522
- storeName: string;
523
- response: {
524
- name: string;
525
- };
526
- arbitrary?: {
527
- response: {
528
- name: string;
529
- };
530
- } | undefined;
531
- optionResponses: {
532
- name: string;
533
- attribute: string;
534
- }[];
535
- } | {
536
- label: ReactNode;
537
- description?: ReactNode;
538
- declarations?: import("../../type-source").DeclarationType[] | undefined;
539
- conditionFilter?: ReactNode;
540
- controls?: import("../../type-source").ControlType[] | undefined;
541
- id: string;
542
- bindingDependencies?: string[] | undefined;
543
- hierarchy?: {
544
- sequence: {
545
- label: ReactNode;
546
- id: string;
547
- page: string;
548
- };
549
- subSequence?: {
550
- label: ReactNode;
551
- id: string;
552
- page: string;
553
- } | undefined;
554
- } | undefined;
555
- mandatory?: boolean | undefined;
556
- page: string;
557
- componentType: "Input" | "Textarea";
558
- maxLength: number;
559
- missingResponse?: {
560
- name: string;
561
- } | undefined;
562
- response: {
563
- name: string;
564
- };
565
- } | {
566
- label: ReactNode;
567
- description?: ReactNode;
568
- declarations?: import("../../type-source").DeclarationType[] | undefined;
569
- conditionFilter?: ReactNode;
570
- controls?: import("../../type-source").ControlType[] | undefined;
571
- id: string;
572
- bindingDependencies?: string[] | undefined;
573
- hierarchy?: {
574
- sequence: {
575
- label: ReactNode;
576
- id: string;
577
- page: string;
578
- };
579
- subSequence?: {
580
- label: ReactNode;
581
- id: string;
582
- page: string;
583
- } | undefined;
584
- } | undefined;
585
- mandatory?: boolean | undefined;
586
- page: string;
587
- componentType: "CheckboxOne";
588
- response: {
589
- name: string;
590
- };
591
- missingResponse?: {
592
- name: string;
593
- } | undefined;
594
- options: {
595
- value: string;
596
- label: import("../../type-source").LabelType<"VTL" | "VTL|MD">;
597
- description?: import("../../type-source").LabelType<"VTL" | "VTL|MD"> | undefined;
598
- }[];
599
- } | {
600
- label: ReactNode;
601
- description: ReactNode;
602
- declarations?: import("../../type-source").DeclarationType[] | undefined;
603
- conditionFilter?: ReactNode;
604
- controls?: import("../../type-source").ControlType[] | undefined;
605
- id: string;
606
- bindingDependencies?: string[] | undefined;
607
- hierarchy?: {
608
- sequence: {
609
- label: ReactNode;
610
- id: string;
611
- page: string;
612
- };
613
- subSequence?: {
614
- label: ReactNode;
615
- id: string;
616
- page: string;
617
- } | undefined;
618
- } | undefined;
619
- mandatory?: boolean | undefined;
620
- page: string;
621
- componentType: "Question";
622
- components: import("../../type-source").ComponentType[];
623
- };
32
+ }): DeepTranslateExpression<LunaticComponentDefinition>;