@inseefr/lunatic 2.5.1-testRoundaboutFix → 2.5.2-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/commons/components/combo-box/combo-box-container.js +16 -7
- package/lib/components/commons/components/combo-box/combo-box-container.spec.js +5 -5
- package/lib/components/commons/components/combo-box/combo-box-content-box.js +25 -0
- package/lib/components/commons/components/combo-box/combo-box-content.js +11 -11
- package/lib/components/commons/components/combo-box/combo-box.js +26 -11
- package/lib/components/commons/components/combo-box/panel/panel-container.js +5 -2
- package/lib/components/commons/components/combo-box/panel/panel-container.spec.js +7 -6
- package/lib/components/commons/components/combo-box/panel/panel.js +2 -2
- package/lib/components/commons/components/combo-box/selection/selection-container.js +3 -2
- package/lib/components/commons/components/combo-box/selection/selection.js +3 -1
- package/lib/components/dropdown/lunatic-dropdown.js +3 -1
- package/lib/components/index.js +7 -0
- package/lib/components/modal/html/modal.js +88 -0
- package/lib/components/modal/html/modal.scss +43 -0
- package/lib/components/modal/index.js +13 -0
- package/lib/components/modal/lunatic-modal.js +38 -0
- package/lib/components/pairwise-links/orchestrator.js +2 -0
- package/lib/components/pairwise-links/pairwise-links.js +1 -1
- package/lib/components/pairwise-links/row.js +2 -0
- package/lib/components/suggester/html/suggester.js +10 -6
- package/lib/components/suggester/lunatic-suggester.js +3 -1
- package/lib/src/components/commons/components/combo-box/combo-box-container.d.ts +5 -2
- package/lib/src/components/commons/components/combo-box/combo-box-content-box.d.ts +8 -0
- package/lib/src/components/commons/components/combo-box/combo-box-content.d.ts +2 -1
- package/lib/src/components/commons/components/combo-box/combo-box.d.ts +1 -0
- package/lib/src/components/commons/components/combo-box/combo-box.stories.d.ts +2 -0
- package/lib/src/components/commons/components/combo-box/panel/panel-container.d.ts +2 -2
- package/lib/src/components/commons/components/combo-box/selection/selection-container.d.ts +2 -1
- package/lib/src/components/commons/components/combo-box/selection/selection.d.ts +2 -1
- package/lib/src/components/dropdown/lunatic-dropdown.d.ts +1 -1
- package/lib/src/components/index.d.ts +1 -0
- package/lib/src/components/modal/html/modal.d.ts +14 -0
- package/lib/src/components/modal/index.d.ts +1 -0
- package/lib/src/components/modal/lunatic-modal.d.ts +3 -0
- package/lib/src/components/pairwise-links/row.d.ts +1 -1
- package/lib/src/components/suggester/html/suggester.d.ts +1 -0
- package/lib/src/components/suggester/lunatic-suggester.d.ts +1 -1
- package/lib/src/components/type.d.ts +8 -0
- package/lib/src/use-lunatic/actions.d.ts +4 -0
- package/lib/src/use-lunatic/commons/fill-components/fill-from-state.d.ts +40 -0
- package/lib/src/use-lunatic/reducer/overview/overview-on-init.d.ts +2 -0
- package/lib/src/use-lunatic/type.d.ts +2 -0
- package/lib/src/use-lunatic/use-lunatic.d.ts +22 -0
- package/lib/stories/modal/modal.stories.js +34 -0
- package/lib/stories/modal/source.json +97 -0
- package/lib/stories/questionnaires/simpsons/simpsons.stories.js +33 -36
- package/lib/stories/suggester/simple.json +15 -0
- package/lib/use-lunatic/commons/fill-components/fill-from-state.js +6 -2
- package/lib/use-lunatic/commons/page-navigation.js +2 -2
- package/lib/use-lunatic/commons/page.js +0 -6
- package/lib/use-lunatic/initial-state.js +2 -0
- package/lib/use-lunatic/reducer/commons/auto-explore-loop.js +9 -3
- package/lib/use-lunatic/reducer/reduce-go-next-page.js +11 -4
- package/lib/use-lunatic/reducer/reduce-go-previous-page.js +13 -5
- package/lib/use-lunatic/reducer/reduce-go-to-page.js +7 -6
- package/lib/use-lunatic/reducer/reduce-handle-change/reduce-resizing.js +0 -3
- package/lib/use-lunatic/reducer/reduce-on-init.js +11 -7
- package/lib/use-lunatic/use-lunatic.js +3 -1
- package/package.json +1 -1
|
@@ -196,7 +196,9 @@ Filled.play = /*#__PURE__*/function () {
|
|
|
196
196
|
_context.next = 54;
|
|
197
197
|
return page.getByRole('combobox', {
|
|
198
198
|
name: '➡ In which state do The Simpsons reside?'
|
|
199
|
-
})
|
|
199
|
+
})
|
|
200
|
+
// .locator('div')
|
|
201
|
+
.click();
|
|
200
202
|
case 54:
|
|
201
203
|
_context.next = 56;
|
|
202
204
|
return page.getByText('Not in any state, you fool!').click();
|
|
@@ -410,9 +412,9 @@ Filled.play = /*#__PURE__*/function () {
|
|
|
410
412
|
return page.getByText('Calendar days').click();
|
|
411
413
|
case 132:
|
|
412
414
|
_context.next = 134;
|
|
413
|
-
return page.getByRole('
|
|
414
|
-
name:
|
|
415
|
-
}).
|
|
415
|
+
return page.getByRole('button', {
|
|
416
|
+
name: 'Next'
|
|
417
|
+
}).click();
|
|
416
418
|
case 134:
|
|
417
419
|
_context.next = 136;
|
|
418
420
|
return page.getByRole('button', {
|
|
@@ -420,35 +422,35 @@ Filled.play = /*#__PURE__*/function () {
|
|
|
420
422
|
}).click();
|
|
421
423
|
case 136:
|
|
422
424
|
_context.next = 138;
|
|
423
|
-
return page.
|
|
424
|
-
name: 'Next'
|
|
425
|
-
}).click();
|
|
425
|
+
return page.getByLabel('➡ How many characters from the Simpsons family could you precisely describe?').click();
|
|
426
426
|
case 138:
|
|
427
427
|
_context.next = 140;
|
|
428
|
-
return page.getByLabel('➡ How many characters from the Simpsons family could you precisely describe?').
|
|
428
|
+
return page.getByLabel('➡ How many characters from the Simpsons family could you precisely describe?').fill('2');
|
|
429
429
|
case 140:
|
|
430
430
|
_context.next = 142;
|
|
431
|
-
return page.getByLabel('➡ How many characters from the Simpsons family could you precisely describe?').fill('2');
|
|
432
|
-
case 142:
|
|
433
|
-
_context.next = 144;
|
|
434
431
|
return page.getByRole('button', {
|
|
435
432
|
name: 'Next'
|
|
436
433
|
}).click();
|
|
437
|
-
case
|
|
438
|
-
_context.next =
|
|
434
|
+
case 142:
|
|
435
|
+
_context.next = 144;
|
|
439
436
|
return page.getByLabel('➡ What is the first name of this character?', {
|
|
440
437
|
index: 0
|
|
441
438
|
}).fill('Bart');
|
|
442
|
-
case
|
|
443
|
-
_context.next =
|
|
439
|
+
case 144:
|
|
440
|
+
_context.next = 146;
|
|
444
441
|
return page.getByLabel('➡ How old is this character in the first episode of the Simpsons family?', {
|
|
445
442
|
index: 0
|
|
446
443
|
}).fill('14');
|
|
447
|
-
case
|
|
448
|
-
_context.next =
|
|
444
|
+
case 146:
|
|
445
|
+
_context.next = 148;
|
|
449
446
|
return page.getByLabel('➡ What is the first name of this character?', {
|
|
450
447
|
index: 1
|
|
451
448
|
}).fill('Bart');
|
|
449
|
+
case 148:
|
|
450
|
+
_context.next = 150;
|
|
451
|
+
return page.getByRole('button', {
|
|
452
|
+
name: 'Next'
|
|
453
|
+
}).click();
|
|
452
454
|
case 150:
|
|
453
455
|
_context.next = 152;
|
|
454
456
|
return page.getByRole('button', {
|
|
@@ -456,13 +458,13 @@ Filled.play = /*#__PURE__*/function () {
|
|
|
456
458
|
}).click();
|
|
457
459
|
case 152:
|
|
458
460
|
_context.next = 154;
|
|
459
|
-
return page.getByRole('
|
|
460
|
-
name: '
|
|
461
|
+
return page.getByRole('radio', {
|
|
462
|
+
name: '1 Yes'
|
|
461
463
|
}).click();
|
|
462
464
|
case 154:
|
|
463
465
|
_context.next = 156;
|
|
464
|
-
return page.getByRole('
|
|
465
|
-
name: '
|
|
466
|
+
return page.getByRole('button', {
|
|
467
|
+
name: 'Next'
|
|
466
468
|
}).click();
|
|
467
469
|
case 156:
|
|
468
470
|
_context.next = 158;
|
|
@@ -476,13 +478,13 @@ Filled.play = /*#__PURE__*/function () {
|
|
|
476
478
|
}).click();
|
|
477
479
|
case 160:
|
|
478
480
|
_context.next = 162;
|
|
479
|
-
return page.getByRole('
|
|
480
|
-
name: '
|
|
481
|
+
return page.getByRole('radio', {
|
|
482
|
+
name: '1 Yes'
|
|
481
483
|
}).click();
|
|
482
484
|
case 162:
|
|
483
485
|
_context.next = 164;
|
|
484
|
-
return page.getByRole('
|
|
485
|
-
name: '
|
|
486
|
+
return page.getByRole('button', {
|
|
487
|
+
name: 'Next'
|
|
486
488
|
}).click();
|
|
487
489
|
case 164:
|
|
488
490
|
_context.next = 166;
|
|
@@ -496,15 +498,15 @@ Filled.play = /*#__PURE__*/function () {
|
|
|
496
498
|
}).click();
|
|
497
499
|
case 168:
|
|
498
500
|
_context.next = 170;
|
|
499
|
-
return page.
|
|
500
|
-
name: 'Next'
|
|
501
|
-
}).click();
|
|
501
|
+
return page.getByLabel('➡ Do you have any comment about the survey?').click();
|
|
502
502
|
case 170:
|
|
503
503
|
_context.next = 172;
|
|
504
|
-
return page.
|
|
504
|
+
return page.keyPress('x');
|
|
505
505
|
case 172:
|
|
506
506
|
_context.next = 174;
|
|
507
|
-
return page.
|
|
507
|
+
return page.getByRole('button', {
|
|
508
|
+
name: 'Next'
|
|
509
|
+
}).click();
|
|
508
510
|
case 174:
|
|
509
511
|
_context.next = 176;
|
|
510
512
|
return page.getByRole('button', {
|
|
@@ -512,13 +514,8 @@ Filled.play = /*#__PURE__*/function () {
|
|
|
512
514
|
}).click();
|
|
513
515
|
case 176:
|
|
514
516
|
_context.next = 178;
|
|
515
|
-
return page.getByRole('button', {
|
|
516
|
-
name: 'Next'
|
|
517
|
-
}).click();
|
|
518
|
-
case 178:
|
|
519
|
-
_context.next = 180;
|
|
520
517
|
return page.getByText('PAGE: 39').shouldBeVisible();
|
|
521
|
-
case
|
|
518
|
+
case 178:
|
|
522
519
|
case "end":
|
|
523
520
|
return _context.stop();
|
|
524
521
|
}
|
|
@@ -46,6 +46,21 @@
|
|
|
46
46
|
"value": "true",
|
|
47
47
|
"type": "VTL"
|
|
48
48
|
},
|
|
49
|
+
"controls": [
|
|
50
|
+
{
|
|
51
|
+
"id": "age-controls",
|
|
52
|
+
"criticality": "ERROR",
|
|
53
|
+
"typeOfControl": "FORMAT",
|
|
54
|
+
"control": {
|
|
55
|
+
"value": "not(isnull(HELLO))",
|
|
56
|
+
"type": "VTL"
|
|
57
|
+
},
|
|
58
|
+
"errorMessage": {
|
|
59
|
+
"value": "\"Veuillez selectionner quelquechose\"",
|
|
60
|
+
"type": "VTL"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
],
|
|
49
64
|
"response": {
|
|
50
65
|
"name": "HELLO"
|
|
51
66
|
},
|
|
@@ -16,14 +16,18 @@ function fillFromState(component, state) {
|
|
|
16
16
|
preferences = state.preferences,
|
|
17
17
|
goToPage = state.goToPage,
|
|
18
18
|
shortcut = state.shortcut,
|
|
19
|
-
getSuggesterStatus = state.getSuggesterStatus
|
|
19
|
+
getSuggesterStatus = state.getSuggesterStatus,
|
|
20
|
+
goNextPage = state.goNextPage,
|
|
21
|
+
goPreviousPage = state.goPreviousPage;
|
|
20
22
|
return _objectSpread(_objectSpread({}, component), {}, {
|
|
21
23
|
handleChange: handleChange,
|
|
22
24
|
executeExpression: executeExpression,
|
|
23
25
|
preferences: preferences,
|
|
24
26
|
goToPage: goToPage,
|
|
25
27
|
shortcut: shortcut,
|
|
26
|
-
getSuggesterStatus: getSuggesterStatus
|
|
28
|
+
getSuggesterStatus: getSuggesterStatus,
|
|
29
|
+
goNextPage: goNextPage,
|
|
30
|
+
goPreviousPage: goPreviousPage
|
|
27
31
|
});
|
|
28
32
|
}
|
|
29
33
|
var _default = fillFromState;
|
|
@@ -42,7 +42,7 @@ function getNextPager(pager, parent) {
|
|
|
42
42
|
|
|
43
43
|
// We reached the end of the sequence
|
|
44
44
|
var isEndSequence = subPage && pager.nbSubPages ? subPage >= pager.nbSubPages : false;
|
|
45
|
-
var moveUpOnEnd = parent === 'Roundabout';
|
|
45
|
+
var moveUpOnEnd = parent === 'Roundabout' && pager.nbIterations && pager.nbIterations > 1;
|
|
46
46
|
// Move up at the end of a sequence (instead of going to the next Iteration)
|
|
47
47
|
if (isEndSequence && moveUpOnEnd) {
|
|
48
48
|
return _objectSpread(_objectSpread({}, pager), {}, {
|
|
@@ -74,7 +74,7 @@ function getPrevPager(pager, parent) {
|
|
|
74
74
|
page = _ref4[0],
|
|
75
75
|
subPage = _ref4[1];
|
|
76
76
|
var iteration = pager.iteration;
|
|
77
|
-
var moveUpOnStart = parent === 'Roundabout';
|
|
77
|
+
var moveUpOnStart = parent === 'Roundabout' && pager.nbIterations && pager.nbIterations > 1;
|
|
78
78
|
|
|
79
79
|
// We reached the start of the questionnaire
|
|
80
80
|
if (page <= 0) {
|
|
@@ -46,11 +46,5 @@ function isPageEmpty(state) {
|
|
|
46
46
|
if (visibleComponents.length === 0) {
|
|
47
47
|
return true;
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
// We have a roundabout with only one iteration
|
|
51
|
-
var firstComponent = visibleComponents[0];
|
|
52
|
-
if (visibleComponents.length === 1 && (firstComponent === null || firstComponent === void 0 ? void 0 : firstComponent.componentType) === 'Roundabout' && executeExpression(firstComponent.iterations) === 1) {
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
49
|
return false;
|
|
56
50
|
}
|
|
@@ -37,6 +37,8 @@ var INITIAL_STATE = {
|
|
|
37
37
|
goToPage: function goToPage() {
|
|
38
38
|
return undefined;
|
|
39
39
|
},
|
|
40
|
+
goNextPage: function goNextPage() {},
|
|
41
|
+
goPreviousPage: function goPreviousPage() {},
|
|
40
42
|
activeControls: false,
|
|
41
43
|
getSuggesterStatus: function getSuggesterStatus(name) {
|
|
42
44
|
return {
|
|
@@ -19,6 +19,7 @@ function autoExploreLoop(state) {
|
|
|
19
19
|
var newPager = _objectSpread({}, state.pager);
|
|
20
20
|
var pageId = (0, _page.getPageId)(newPager);
|
|
21
21
|
var page = state.pages[pageId];
|
|
22
|
+
var hasExploredLoop = false;
|
|
22
23
|
var isForward = direction === 'forward';
|
|
23
24
|
var goInsideSubpage = function goInsideSubpage(subPages, nbIteration) {
|
|
24
25
|
var maxSubPage = subPages.length;
|
|
@@ -26,8 +27,9 @@ function autoExploreLoop(state) {
|
|
|
26
27
|
newPager.page = firstSubPage[0].toString();
|
|
27
28
|
newPager.subPage = firstSubPage[1] - 1; // Subpage starts at 0
|
|
28
29
|
newPager.nbSubPages = maxSubPage;
|
|
29
|
-
newPager.nbIterations =
|
|
30
|
+
newPager.nbIterations = nbIteration;
|
|
30
31
|
newPager.iteration = isForward ? 0 : newPager.nbIterations - 1;
|
|
32
|
+
hasExploredLoop = true;
|
|
31
33
|
};
|
|
32
34
|
|
|
33
35
|
// The page is a loop
|
|
@@ -36,13 +38,17 @@ function autoExploreLoop(state) {
|
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
// The page contains a roundabout, go to the first iteration if it only has one iteration
|
|
39
|
-
|
|
40
|
-
if (page.components[0].componentType === 'Roundabout' && page.subPages && page.subPages.length > 0 && isForward) {
|
|
41
|
+
if (page.components[0].componentType === 'Roundabout' && page.subPages && page.subPages.length > 0) {
|
|
41
42
|
var nbIterations = state.executeExpression(page.iterations);
|
|
42
43
|
if (nbIterations === 1) {
|
|
43
44
|
goInsideSubpage(page.subPages, 1);
|
|
44
45
|
}
|
|
45
46
|
}
|
|
47
|
+
|
|
48
|
+
// No loop were explored, don't mutate the state
|
|
49
|
+
if (!hasExploredLoop) {
|
|
50
|
+
return state;
|
|
51
|
+
}
|
|
46
52
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
47
53
|
isInLoop: newPager.nbIterations !== undefined,
|
|
48
54
|
pager: newPager
|
|
@@ -27,17 +27,24 @@ function reduceGoNextPage(state) {
|
|
|
27
27
|
if (!pages[pageId]) {
|
|
28
28
|
throw new Error("Cannot reach next page ".concat(pageId));
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
// If we reached a loop, go inside
|
|
32
|
-
var newState = (0, _autoExploreLoop.autoExploreLoop)(_objectSpread(_objectSpread({}, state), {}, {
|
|
30
|
+
var newState = _objectSpread(_objectSpread({}, state), {}, {
|
|
33
31
|
pager: nextPager
|
|
34
|
-
})
|
|
32
|
+
});
|
|
35
33
|
|
|
36
34
|
// We reached an empty page, move forward
|
|
37
35
|
if ((0, _page.isPageEmpty)(newState)) {
|
|
38
36
|
return reduceGoNextPage(newState);
|
|
39
37
|
}
|
|
38
|
+
|
|
39
|
+
// If we reached a loop, go inside
|
|
40
|
+
newState = (0, _autoExploreLoop.autoExploreLoop)(newState, 'forward');
|
|
41
|
+
|
|
42
|
+
// We explored a loop, check if we reached an empty page, move forward
|
|
43
|
+
if (newState.pager !== nextPager && (0, _page.isPageEmpty)(newState)) {
|
|
44
|
+
return reduceGoNextPage(newState);
|
|
45
|
+
}
|
|
40
46
|
return _objectSpread(_objectSpread({}, newState), {}, {
|
|
47
|
+
isInLoop: newState.pager.iteration !== undefined,
|
|
41
48
|
pager: _objectSpread(_objectSpread({}, newState.pager), {}, {
|
|
42
49
|
lastReachedPage: (0, _commons.getNewReachedPage)(newState.pager)
|
|
43
50
|
})
|
|
@@ -24,17 +24,25 @@ function reduceGoPreviousPage(state) {
|
|
|
24
24
|
if (!prevPage) {
|
|
25
25
|
throw new Error("Cannot reach previous page ".concat(pageId));
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
// If we reached a loop, go to the last iteration / sequence
|
|
29
|
-
var newState = (0, _autoExploreLoop.autoExploreLoop)(_objectSpread(_objectSpread({}, state), {}, {
|
|
27
|
+
var newState = _objectSpread(_objectSpread({}, state), {}, {
|
|
30
28
|
pager: prevPager
|
|
31
|
-
})
|
|
29
|
+
});
|
|
32
30
|
|
|
33
31
|
// We reached an empty page, keep going backward
|
|
34
32
|
if ((0, _page.isPageEmpty)(newState)) {
|
|
35
33
|
return reduceGoPreviousPage(newState);
|
|
36
34
|
}
|
|
37
|
-
|
|
35
|
+
|
|
36
|
+
// If we reached a loop, go to the last iteration / sequence
|
|
37
|
+
newState = (0, _autoExploreLoop.autoExploreLoop)(newState, 'backward');
|
|
38
|
+
|
|
39
|
+
// We explored a loop, check if we reached an empty page, move forward
|
|
40
|
+
if (newState.pager !== prevPager && (0, _page.isPageEmpty)(newState)) {
|
|
41
|
+
return reduceGoPreviousPage(newState);
|
|
42
|
+
}
|
|
43
|
+
return _objectSpread(_objectSpread({}, newState), {}, {
|
|
44
|
+
isInLoop: newState.pager.iteration !== undefined
|
|
45
|
+
});
|
|
38
46
|
}
|
|
39
47
|
var _default = reduceGoPreviousPage;
|
|
40
48
|
exports["default"] = _default;
|
|
@@ -60,16 +60,17 @@ function reduceGoToPage(state, action) {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
// Move forward if the page is empty
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
var newState = _objectSpread(_objectSpread({}, state), {}, {
|
|
64
|
+
isInLoop: newPager.nbIterations !== undefined,
|
|
65
|
+
pager: newPager
|
|
66
|
+
});
|
|
67
|
+
if ((0, _page.isPageEmpty)(newState)) {
|
|
68
|
+
return (0, _reduceGoNextPage["default"])(newState, {
|
|
65
69
|
type: _actions.ActionKind.GO_NEXT_PAGE,
|
|
66
70
|
payload: {}
|
|
67
71
|
});
|
|
68
72
|
}
|
|
69
|
-
return
|
|
70
|
-
isInLoop: newPager.nbIterations !== undefined,
|
|
71
|
-
pager: newPager
|
|
72
|
-
});
|
|
73
|
+
return newState;
|
|
73
74
|
}
|
|
74
75
|
var _default = reduceGoToPage;
|
|
75
76
|
exports["default"] = _default;
|
|
@@ -19,9 +19,6 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
19
19
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
20
20
|
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); }
|
|
21
21
|
function refillValue(size, precSize, value) {
|
|
22
|
-
if (precSize > size) {
|
|
23
|
-
return new Array(size).fill(null);
|
|
24
|
-
}
|
|
25
22
|
return (0, _commons2.resizeArrayVariable)(value, size, null);
|
|
26
23
|
}
|
|
27
24
|
function reduceResizingVariables(_ref) {
|
|
@@ -38,11 +38,11 @@ function getInitalValueFromCollected(variable, data) {
|
|
|
38
38
|
fromData = COLLECTED !== null && COLLECTED !== void 0 ? COLLECTED : FORCED;
|
|
39
39
|
}
|
|
40
40
|
if ('values' in variable && variable.values) {
|
|
41
|
-
var _fromData;
|
|
41
|
+
var _ref, _fromData;
|
|
42
42
|
var _variable$values = variable.values,
|
|
43
43
|
_COLLECTED = _variable$values.COLLECTED,
|
|
44
44
|
_FORCED = _variable$values.FORCED;
|
|
45
|
-
return (_fromData = fromData) !== null && _fromData !== void 0 ? _fromData : _FORCED !== null &&
|
|
45
|
+
return (_ref = (_fromData = fromData) !== null && _fromData !== void 0 ? _fromData : _FORCED) !== null && _ref !== void 0 ? _ref : _COLLECTED;
|
|
46
46
|
}
|
|
47
47
|
return undefined;
|
|
48
48
|
}
|
|
@@ -100,10 +100,10 @@ function appendToObjectMap(map, variable, value) {
|
|
|
100
100
|
function createVariables(source, data) {
|
|
101
101
|
var _source$variables = source.variables,
|
|
102
102
|
variables = _source$variables === void 0 ? [] : _source$variables;
|
|
103
|
-
var _variables$reduce = variables.reduce(function (
|
|
104
|
-
var
|
|
105
|
-
mapType =
|
|
106
|
-
mapVar =
|
|
103
|
+
var _variables$reduce = variables.reduce(function (_ref2, variable) {
|
|
104
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
105
|
+
mapType = _ref3[0],
|
|
106
|
+
mapVar = _ref3[1];
|
|
107
107
|
var type = variable.variableType;
|
|
108
108
|
return [appendToArrayMap(mapType, type, variable), appendToObjectMap(mapVar, variable, getInitialValue(variable, data))];
|
|
109
109
|
}, [{
|
|
@@ -179,7 +179,9 @@ function reduceOnInit(state, action) {
|
|
|
179
179
|
management = payload.management,
|
|
180
180
|
shortcut = payload.shortcut,
|
|
181
181
|
activeControls = payload.activeControls,
|
|
182
|
-
goToPage = payload.goToPage
|
|
182
|
+
goToPage = payload.goToPage,
|
|
183
|
+
goNextPage = payload.goNextPage,
|
|
184
|
+
goPreviousPage = payload.goPreviousPage;
|
|
183
185
|
if (source && data) {
|
|
184
186
|
var _initialPager$page;
|
|
185
187
|
var variables = createVariables(source, data); // map des variables
|
|
@@ -225,6 +227,8 @@ function reduceOnInit(state, action) {
|
|
|
225
227
|
savingType: savingType,
|
|
226
228
|
activeControls: activeControls,
|
|
227
229
|
goToPage: goToPage,
|
|
230
|
+
goNextPage: goNextPage,
|
|
231
|
+
goPreviousPage: goPreviousPage,
|
|
228
232
|
shortcut: shortcut
|
|
229
233
|
}), initialPager);
|
|
230
234
|
}
|
|
@@ -177,9 +177,11 @@ function useLunatic(source) {
|
|
|
177
177
|
handleChange: handleChange,
|
|
178
178
|
activeControls: activeControls,
|
|
179
179
|
goToPage: goToPage,
|
|
180
|
+
goNextPage: goNextPage,
|
|
181
|
+
goPreviousPage: goPreviousPage,
|
|
180
182
|
withOverview: withOverview
|
|
181
183
|
}));
|
|
182
|
-
}, [source, data, initialPage, features, preferences, savingType, management, shortcut, handleChange, activeControls, withOverview, goToPage, lastReachedPage]);
|
|
184
|
+
}, [source, data, initialPage, features, preferences, savingType, management, shortcut, handleChange, activeControls, withOverview, goToPage, goNextPage, goPreviousPage, lastReachedPage]);
|
|
183
185
|
(0, _react.useEffect)(function () {
|
|
184
186
|
dispatch(actions.updateState({
|
|
185
187
|
getSuggesterStatus: getSuggesterStatus
|