@inseefr/lunatic 2.4.8-dynamicArray → 2.4.9-beta
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/index.js +7 -7
- package/lib/components/loop/loop.js +2 -2
- package/lib/components/loop/roster-for-loop/body.js +52 -0
- package/lib/components/loop/roster-for-loop/header.js +34 -0
- package/lib/components/loop/roster-for-loop/roster-for-loop.js +32 -35
- package/lib/components/loop/roster-for-loop/roster-table.js +16 -17
- package/lib/components/loop/roster-for-loop/roster.scss +34 -32
- package/lib/components/loop/roster-for-loop/row.js +19 -48
- package/lib/components/subsequence/subsequence.js +0 -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/index.d.ts +1 -1
- package/lib/src/components/loop/block-for-loop/block-for-loop-ochestrator.d.ts +1 -1
- package/lib/src/components/loop/block-for-loop/block-for-loop.d.ts +1 -1
- package/lib/src/components/loop/roster-for-loop/body.d.ts +12 -0
- package/lib/src/components/loop/roster-for-loop/header.d.ts +9 -0
- package/lib/src/components/loop/roster-for-loop/roster-for-loop-orchestrator.d.ts +1 -1
- package/lib/src/components/loop/roster-for-loop/roster-for-loop.d.ts +4 -4
- package/lib/src/components/loop/roster-for-loop/roster-table.d.ts +2 -2
- 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 +16 -9
- package/lib/stories/loop/block-for-loop.stories.js +8 -1
- package/lib/stories/loop/roster-for-loop.stories.js +1 -8
- package/lib/stories/loop/source-with-header.json +4 -16
- package/lib/stories/questionnaires/simpsons/simpsons.stories.js +1 -1
- package/lib/stories/summary/data.json +32 -0
- package/lib/stories/summary/source.json +353 -0
- package/lib/stories/{duration/duration.stories.js → summary/summary.stories.js} +11 -15
- package/lib/use-lunatic/commons/fill-components/fill-component-expressions.js +1 -1
- package/package.json +1 -1
- package/lib/components/duration/duration.js +0 -117
- package/lib/components/duration/duration.scss +0 -16
- package/lib/components/duration/duration.spec.js +0 -49
- package/lib/components/duration/index.js +0 -13
- package/lib/components/duration/useDurationValues.js +0 -124
- package/lib/hooks/use-did-change.js +0 -19
- package/lib/src/components/duration/duration.d.ts +0 -4
- package/lib/src/components/duration/duration.spec.d.ts +0 -1
- package/lib/src/components/duration/index.d.ts +0 -1
- package/lib/src/components/duration/useDurationValues.d.ts +0 -43
- package/lib/src/hooks/use-did-change.d.ts +0 -4
- package/lib/stories/duration/source.json +0 -32
- package/lib/stories/duration/source1.json +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
|
+
}
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports["default"] = exports.
|
|
6
|
+
exports["default"] = exports.Default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _defaultArgTypes = _interopRequireDefault(require("../utils/default-arg-types"));
|
|
9
8
|
var _orchestrator = _interopRequireDefault(require("../utils/orchestrator"));
|
|
10
9
|
var _source = _interopRequireDefault(require("./source"));
|
|
11
|
-
var
|
|
10
|
+
var _data = _interopRequireDefault(require("./data.json"));
|
|
11
|
+
var _defaultArgTypes = _interopRequireDefault(require("../utils/default-arg-types"));
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
14
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); }
|
|
@@ -18,7 +18,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
18
18
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
19
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
20
|
var stories = {
|
|
21
|
-
title: 'Components/
|
|
21
|
+
title: 'Components/Summary',
|
|
22
22
|
component: _orchestrator["default"],
|
|
23
23
|
argTypes: _defaultArgTypes["default"]
|
|
24
24
|
};
|
|
@@ -27,15 +27,11 @@ exports["default"] = _default;
|
|
|
27
27
|
var Template = function Template(args) {
|
|
28
28
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_orchestrator["default"], _objectSpread({}, args));
|
|
29
29
|
};
|
|
30
|
-
var
|
|
31
|
-
exports.
|
|
32
|
-
|
|
33
|
-
id: '
|
|
34
|
-
source: _source["default"]
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
exports.PTnHnM = PTnHnM;
|
|
38
|
-
PTnHnM.args = {
|
|
39
|
-
id: 'durationHeureMinute',
|
|
40
|
-
source: _source2["default"]
|
|
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
|
|
41
37
|
};
|
|
@@ -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', 'header.label'];
|
|
27
|
+
'controls.iterations', 'lines.min', 'lines.max', 'iterations', 'xAxisIterations', 'yAxisIterations', 'conditionFilter', 'headers.label', 'header.label'];
|
|
28
28
|
|
|
29
29
|
// Utility type to replace all expression from an object into a translated version
|
|
30
30
|
|
package/package.json
CHANGED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
require("./duration.scss");
|
|
9
|
-
var _useDurationValues2 = require("./useDurationValues");
|
|
10
|
-
var _commons = require("../commons");
|
|
11
|
-
var _lunaticComponentWithoutLabel = _interopRequireDefault(require("../commons/components/lunatic-component-without-label"));
|
|
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
|
-
function Duration(props) {
|
|
21
|
-
var value = props.value,
|
|
22
|
-
label = props.label,
|
|
23
|
-
format = props.format,
|
|
24
|
-
handleChange = props.handleChange,
|
|
25
|
-
response = props.response,
|
|
26
|
-
id = props.id,
|
|
27
|
-
preferences = props.preferences,
|
|
28
|
-
declarations = props.declarations,
|
|
29
|
-
missing = props.missing,
|
|
30
|
-
missingResponse = props.missingResponse,
|
|
31
|
-
management = props.management,
|
|
32
|
-
description = props.description;
|
|
33
|
-
var onChange = (0, _commons.useOnHandleChange)({
|
|
34
|
-
handleChange: handleChange,
|
|
35
|
-
response: response,
|
|
36
|
-
value: value
|
|
37
|
-
});
|
|
38
|
-
var _useDurationValues = (0, _useDurationValues2.useDurationValues)(value, format, onChange),
|
|
39
|
-
propsHours = _useDurationValues.propsHours,
|
|
40
|
-
propsMinutes = _useDurationValues.propsMinutes,
|
|
41
|
-
propsYears = _useDurationValues.propsYears,
|
|
42
|
-
propsMonths = _useDurationValues.propsMonths;
|
|
43
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_lunaticComponentWithoutLabel["default"], {
|
|
44
|
-
id: id,
|
|
45
|
-
preferences: preferences,
|
|
46
|
-
declarations: declarations,
|
|
47
|
-
value: value,
|
|
48
|
-
missing: missing,
|
|
49
|
-
missingResponse: missingResponse,
|
|
50
|
-
management: management,
|
|
51
|
-
description: description,
|
|
52
|
-
handleChange: handleChange,
|
|
53
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
54
|
-
className: "container",
|
|
55
|
-
children: [label, /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {}), format === 'PTnHnM' && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
56
|
-
className: "field-group",
|
|
57
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
58
|
-
className: "input-field-group",
|
|
59
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
60
|
-
htmlFor: "hoursInput",
|
|
61
|
-
className: "input-label",
|
|
62
|
-
children: "Heures:"
|
|
63
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", _objectSpread(_objectSpread({
|
|
64
|
-
id: "hoursInput",
|
|
65
|
-
type: "number"
|
|
66
|
-
}, propsHours), {}, {
|
|
67
|
-
className: "input-field"
|
|
68
|
-
}))]
|
|
69
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
70
|
-
className: "input-field-group",
|
|
71
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
72
|
-
htmlFor: "minutesInput",
|
|
73
|
-
className: "input-label",
|
|
74
|
-
children: "Minutes:"
|
|
75
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", _objectSpread(_objectSpread({
|
|
76
|
-
id: "minutesInput",
|
|
77
|
-
type: "number"
|
|
78
|
-
}, propsMinutes), {}, {
|
|
79
|
-
min: "0",
|
|
80
|
-
className: "input-field"
|
|
81
|
-
}))]
|
|
82
|
-
})]
|
|
83
|
-
}), format === 'PnYnM' && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
84
|
-
className: "field-group",
|
|
85
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
86
|
-
className: "input-field-group",
|
|
87
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
88
|
-
htmlFor: "yearsInput",
|
|
89
|
-
className: "input-label",
|
|
90
|
-
children: "Ann\xE9es:"
|
|
91
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", _objectSpread(_objectSpread({
|
|
92
|
-
id: "yearsInput",
|
|
93
|
-
type: "number"
|
|
94
|
-
}, propsYears), {}, {
|
|
95
|
-
min: "0",
|
|
96
|
-
className: "input-field"
|
|
97
|
-
}))]
|
|
98
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
99
|
-
className: "input-field-group",
|
|
100
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
101
|
-
htmlFor: "monthsInput",
|
|
102
|
-
className: "input-label",
|
|
103
|
-
children: "Mois:"
|
|
104
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", _objectSpread(_objectSpread({
|
|
105
|
-
id: "monthsInput",
|
|
106
|
-
type: "number"
|
|
107
|
-
}, propsMonths), {}, {
|
|
108
|
-
min: "0",
|
|
109
|
-
className: "input-field"
|
|
110
|
-
}))]
|
|
111
|
-
})]
|
|
112
|
-
})]
|
|
113
|
-
})
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
var _default = Duration;
|
|
117
|
-
exports["default"] = _default;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _react = _interopRequireDefault(require("react"));
|
|
4
|
-
var _react2 = require("@testing-library/react");
|
|
5
|
-
var _vitest = require("vitest");
|
|
6
|
-
var _duration = _interopRequireDefault(require("./duration"));
|
|
7
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
9
|
-
(0, _vitest.describe)('Duration component', function () {
|
|
10
|
-
var handleChange = _vitest.vi.fn();
|
|
11
|
-
(0, _vitest.it)('should render with hours and minutes inputs when format is "PTnHnM"', function () {
|
|
12
|
-
var _render = (0, _react2.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_duration["default"], {
|
|
13
|
-
format: "PTnHnM",
|
|
14
|
-
handleChange: handleChange,
|
|
15
|
-
id: '',
|
|
16
|
-
value: null,
|
|
17
|
-
executeExpression: function executeExpression(expression, args) {
|
|
18
|
-
throw new Error('Function not implemented.');
|
|
19
|
-
},
|
|
20
|
-
response: {
|
|
21
|
-
name: ''
|
|
22
|
-
}
|
|
23
|
-
})),
|
|
24
|
-
getByLabelText = _render.getByLabelText;
|
|
25
|
-
var hoursInput = getByLabelText('Heures:');
|
|
26
|
-
var minutesInput = getByLabelText('Minutes:');
|
|
27
|
-
(0, _vitest.expect)(hoursInput).toBeInTheDocument();
|
|
28
|
-
(0, _vitest.expect)(minutesInput).toBeInTheDocument();
|
|
29
|
-
});
|
|
30
|
-
(0, _vitest.it)('should render with years and months inputs when format is "PnYnM"', function () {
|
|
31
|
-
var _render2 = (0, _react2.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_duration["default"], {
|
|
32
|
-
format: "PnYnM",
|
|
33
|
-
handleChange: handleChange,
|
|
34
|
-
id: '',
|
|
35
|
-
value: null,
|
|
36
|
-
executeExpression: function executeExpression(expression, args) {
|
|
37
|
-
throw new Error('Function not implemented.');
|
|
38
|
-
},
|
|
39
|
-
response: {
|
|
40
|
-
name: ''
|
|
41
|
-
}
|
|
42
|
-
})),
|
|
43
|
-
getByLabelText = _render2.getByLabelText;
|
|
44
|
-
var yearsInput = getByLabelText('Années:');
|
|
45
|
-
var monthsInput = getByLabelText('Mois:');
|
|
46
|
-
(0, _vitest.expect)(yearsInput).toBeInTheDocument();
|
|
47
|
-
(0, _vitest.expect)(monthsInput).toBeInTheDocument();
|
|
48
|
-
});
|
|
49
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "default", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _duration["default"];
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
var _duration = _interopRequireDefault(require("./duration"));
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|