@inseefr/lunatic 3.6.13 → 3.6.15-rc.0
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/components/shared/Combobox/ComboboxContent.js +0 -3
- package/components/shared/Combobox/ComboboxContent.js.map +1 -1
- package/esm/components/shared/Combobox/ComboboxContent.js +1 -4
- package/esm/components/shared/Combobox/ComboboxContent.js.map +1 -1
- package/esm/hooks/useMultiMode.d.ts +49 -0
- package/esm/hooks/useMultiMode.js +83 -0
- package/esm/hooks/useMultiMode.js.map +1 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -1
- package/esm/type.source.d.ts +55 -1
- package/esm/use-lunatic/reducer/reducerInitializer.d.ts +2 -2
- package/esm/use-lunatic/reducer/reducerInitializer.js +31 -24
- package/esm/use-lunatic/reducer/reducerInitializer.js.map +1 -1
- package/esm/use-lunatic/type.d.ts +2 -0
- package/esm/use-lunatic/use-lunatic.js +3 -0
- package/esm/use-lunatic/use-lunatic.js.map +1 -1
- package/esm/utils/getArticulation.d.ts +61 -0
- package/esm/utils/getArticulation.js +78 -0
- package/esm/utils/getArticulation.js.map +1 -0
- package/hooks/useMultiMode.d.ts +49 -0
- package/hooks/useMultiMode.js +84 -0
- package/hooks/useMultiMode.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/package.json +19 -1
- package/src/components/shared/Combobox/ComboboxContent.tsx +6 -5
- package/src/hooks/useMultiMode.ts +102 -0
- package/src/index.ts +1 -0
- package/src/stories/behaviour/articulation/articulation.stories.tsx +90 -0
- package/src/stories/behaviour/articulation/multimode.stories.tsx +19 -0
- package/src/stories/behaviour/articulation/roundabout.json +413 -0
- package/src/stories/utils/Orchestrator.tsx +10 -0
- package/src/stories/utils/OrchestratorSidebar.tsx +25 -1
- package/src/type.source.ts +55 -1
- package/src/use-lunatic/reducer/reducerInitializer.tsx +40 -29
- package/src/use-lunatic/type.ts +2 -0
- package/src/use-lunatic/use-lunatic.ts +4 -0
- package/src/utils/getArticulation.ts +117 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/type.source.d.ts +55 -1
- package/use-lunatic/reducer/reducerInitializer.d.ts +2 -2
- package/use-lunatic/reducer/reducerInitializer.js +31 -24
- package/use-lunatic/reducer/reducerInitializer.js.map +1 -1
- package/use-lunatic/type.d.ts +2 -0
- package/use-lunatic/use-lunatic.js +3 -0
- package/use-lunatic/use-lunatic.js.map +1 -1
- package/utils/getArticulation.d.ts +61 -0
- package/utils/getArticulation.js +78 -0
- package/utils/getArticulation.js.map +1 -0
|
@@ -20,15 +20,12 @@ function ComboboxContent({ children, focused, onFocus, onBlur, onKeyDown, classN
|
|
|
20
20
|
(0, useDocumentEvent_1.default)('mousedown', onClick);
|
|
21
21
|
const handleKeyDown = (0, react_1.useCallback)(function (e) {
|
|
22
22
|
const { key } = e;
|
|
23
|
-
e.stopPropagation();
|
|
24
23
|
switch (key) {
|
|
25
24
|
case constants_1.KEYBOARD_KEY_CODES.Escape:
|
|
26
25
|
case constants_1.KEYBOARD_KEY_CODES.Enter:
|
|
27
26
|
case constants_1.KEYBOARD_KEY_CODES.Tab:
|
|
28
27
|
ref.current?.focus();
|
|
29
28
|
break;
|
|
30
|
-
default:
|
|
31
|
-
// e.preventDefault();
|
|
32
29
|
}
|
|
33
30
|
onKeyDown(key);
|
|
34
31
|
}, [onKeyDown]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboboxContent.js","sourceRoot":"","sources":["../../../src/components/shared/Combobox/ComboboxContent.tsx"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"ComboboxContent.js","sourceRoot":"","sources":["../../../src/components/shared/Combobox/ComboboxContent.tsx"],"names":[],"mappings":";;;;;AAmBA,0CAuDC;;AA1ED,iCAKe;AACf,4DAAoC;AACpC,2CAAiD;AACjD,6DAA0D;AAC1D,uFAA+D;AAU/D,SAAgB,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@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useRef } from 'react';
|
|
2
|
+
import { useCallback, useRef, } from 'react';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { KEYBOARD_KEY_CODES } from './constants';
|
|
5
5
|
import { ComboboxContentBox } from './ComboboxContentBox';
|
|
@@ -16,15 +16,12 @@ export function ComboboxContent({ children, focused, onFocus, onBlur, onKeyDown,
|
|
|
16
16
|
const handleKeyDown = useCallback(function (e) {
|
|
17
17
|
var _a;
|
|
18
18
|
const { key } = e;
|
|
19
|
-
e.stopPropagation();
|
|
20
19
|
switch (key) {
|
|
21
20
|
case KEYBOARD_KEY_CODES.Escape:
|
|
22
21
|
case KEYBOARD_KEY_CODES.Enter:
|
|
23
22
|
case KEYBOARD_KEY_CODES.Tab:
|
|
24
23
|
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
25
24
|
break;
|
|
26
|
-
default:
|
|
27
|
-
// e.preventDefault();
|
|
28
25
|
}
|
|
29
26
|
onKeyDown(key);
|
|
30
27
|
}, [onKeyDown]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboboxContent.js","sourceRoot":"","sources":["../../../../src/components/shared/Combobox/ComboboxContent.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"ComboboxContent.js","sourceRoot":"","sources":["../../../../src/components/shared/Combobox/ComboboxContent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGN,WAAW,EACX,MAAM,GACN,MAAM,OAAO,CAAC;AACf,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,gBAAgB,MAAM,iCAAiC,CAAC;AAU/D,MAAM,UAAU,eAAe,CAAC,EAC/B,QAAQ,EACR,OAAO,EAC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|
1
|
+
import type { LunaticVariablesStore } from '../use-lunatic/commons/variables/lunatic-variables-store';
|
|
2
|
+
import type { LunaticSource } from '../type.source';
|
|
3
|
+
/**
|
|
4
|
+
* Retrieve the multimode state
|
|
5
|
+
*
|
|
6
|
+
* ## Why this hook
|
|
7
|
+
*
|
|
8
|
+
* The goal of this hook is to provide insights about a roundabout using extra information inserted in the JSON source
|
|
9
|
+
* provided to Lunatic.
|
|
10
|
+
*
|
|
11
|
+
* For instance
|
|
12
|
+
*
|
|
13
|
+
* ```
|
|
14
|
+
* {
|
|
15
|
+
* "multimode": {
|
|
16
|
+
* "questionnaire": {
|
|
17
|
+
* "rules": {
|
|
18
|
+
* "IS_MOVED": {
|
|
19
|
+
* "type": "VTL",
|
|
20
|
+
* "value": "nvl(HABITEZ_VOUS_ICI, true)"
|
|
21
|
+
* },
|
|
22
|
+
* }
|
|
23
|
+
* },
|
|
24
|
+
* "leaf": {
|
|
25
|
+
* "source": "id-roundabout-in-questionnaire",
|
|
26
|
+
* "rules": {
|
|
27
|
+
* "IS_MOVED": {
|
|
28
|
+
* "type": "VTL",
|
|
29
|
+
* "value": "nvl(PRENOM_HABITE_PLUS_LA, false)"
|
|
30
|
+
* },
|
|
31
|
+
* }
|
|
32
|
+
* }
|
|
33
|
+
* },
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* Run the expression to check if rules are true or false. A rule is considered as true if at least one expression is evaluated to true
|
|
38
|
+
*
|
|
39
|
+
* ```
|
|
40
|
+
* {
|
|
41
|
+
* "IS_MOVED": true
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare function useMultiMode(source: LunaticSource, store: LunaticVariablesStore): {
|
|
46
|
+
getMultiMode: () => {
|
|
47
|
+
[k: string]: boolean;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { findComponentById } from '../utils/getArticulation';
|
|
3
|
+
import { forceInt } from '../utils/number';
|
|
4
|
+
/**
|
|
5
|
+
* Retrieve the multimode state
|
|
6
|
+
*
|
|
7
|
+
* ## Why this hook
|
|
8
|
+
*
|
|
9
|
+
* The goal of this hook is to provide insights about a roundabout using extra information inserted in the JSON source
|
|
10
|
+
* provided to Lunatic.
|
|
11
|
+
*
|
|
12
|
+
* For instance
|
|
13
|
+
*
|
|
14
|
+
* ```
|
|
15
|
+
* {
|
|
16
|
+
* "multimode": {
|
|
17
|
+
* "questionnaire": {
|
|
18
|
+
* "rules": {
|
|
19
|
+
* "IS_MOVED": {
|
|
20
|
+
* "type": "VTL",
|
|
21
|
+
* "value": "nvl(HABITEZ_VOUS_ICI, true)"
|
|
22
|
+
* },
|
|
23
|
+
* }
|
|
24
|
+
* },
|
|
25
|
+
* "leaf": {
|
|
26
|
+
* "source": "id-roundabout-in-questionnaire",
|
|
27
|
+
* "rules": {
|
|
28
|
+
* "IS_MOVED": {
|
|
29
|
+
* "type": "VTL",
|
|
30
|
+
* "value": "nvl(PRENOM_HABITE_PLUS_LA, false)"
|
|
31
|
+
* },
|
|
32
|
+
* }
|
|
33
|
+
* }
|
|
34
|
+
* },
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* Run the expression to check if rules are true or false. A rule is considered as true if at least one expression is evaluated to true
|
|
39
|
+
*
|
|
40
|
+
* ```
|
|
41
|
+
* {
|
|
42
|
+
* "IS_MOVED": true
|
|
43
|
+
* }
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export function useMultiMode(source, store) {
|
|
47
|
+
const getMultiMode = useCallback(() => {
|
|
48
|
+
var _a;
|
|
49
|
+
if (!source.multimode) {
|
|
50
|
+
return {};
|
|
51
|
+
}
|
|
52
|
+
const roundabout = findComponentById(source.components, source.multimode.leaf.source);
|
|
53
|
+
const keys = new Set([
|
|
54
|
+
...Object.keys(source.multimode.questionnaire.rules),
|
|
55
|
+
...Object.keys(source.multimode.leaf.rules),
|
|
56
|
+
]);
|
|
57
|
+
const iterations = forceInt(store.run((_a = roundabout === null || roundabout === void 0 ? void 0 : roundabout.iterations.value) !== null && _a !== void 0 ? _a : '0'));
|
|
58
|
+
return Object.fromEntries(Array.from(keys).map((key) => {
|
|
59
|
+
var _a, _b;
|
|
60
|
+
// Check the value at questionnaire level
|
|
61
|
+
const questionnaireExpression = (_a = source.multimode) === null || _a === void 0 ? void 0 : _a.questionnaire.rules[key];
|
|
62
|
+
if (questionnaireExpression &&
|
|
63
|
+
store.run(questionnaireExpression.value)) {
|
|
64
|
+
return [key, true];
|
|
65
|
+
}
|
|
66
|
+
const leafExpression = (_b = source.multimode) === null || _b === void 0 ? void 0 : _b.leaf.rules[key];
|
|
67
|
+
// There is no expression for the leaf
|
|
68
|
+
if (!leafExpression) {
|
|
69
|
+
return [key, false];
|
|
70
|
+
}
|
|
71
|
+
for (let i = 0; i < iterations; i++) {
|
|
72
|
+
if (store.run(leafExpression.value, { iteration: [i] })) {
|
|
73
|
+
return [key, true];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return [key, false];
|
|
77
|
+
}));
|
|
78
|
+
}, [source, store]);
|
|
79
|
+
return {
|
|
80
|
+
getMultiMode,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=useMultiMode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMultiMode.js","sourceRoot":"","sources":["../../src/hooks/useMultiMode.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,UAAU,YAAY,CAC3B,MAAqB,EACrB,KAA4B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KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,EAAE,CAAC,EAAE,EAAE,CAAC;gBACrC,IAAI,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;oBACzD,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;gBACpB,CAAC;YACF,CAAC;YAED,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACrB,CAAC,CAAC,CACF,CAAC;IACH,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;IAEpB,OAAO;QACN,YAAY;KACZ,CAAC;AACH,CAAC"}
|
package/esm/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { ModalControls } from './components/shared/ModalControls/ModalControls';
|
|
|
7
7
|
export { Button } from './components/shared/Button/Button';
|
|
8
8
|
export { LunaticComponents } from './components/LunaticComponents';
|
|
9
9
|
export { useLunatic } from './use-lunatic/use-lunatic';
|
|
10
|
+
export { getArticulation } from './utils/getArticulation';
|
|
10
11
|
export { MDLabel } from './components/shared/MDLabel/MDLabel';
|
|
11
12
|
export type { LunaticComponentDefinition, LunaticControl, LunaticData, LunaticValues, LunaticError, LunaticExpression, LunaticVariable, LunaticCollectedValue, LunaticStateVariable, LunaticState, LunaticPager, LunaticOptions, LunaticChangesHandler, } from './use-lunatic/type';
|
|
12
13
|
export type { LunaticComponentProps, LunaticExtraProps, } from './components/type';
|
package/esm/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export { ModalControls } from './components/shared/ModalControls/ModalControls';
|
|
|
7
7
|
export { Button } from './components/shared/Button/Button';
|
|
8
8
|
export { LunaticComponents } from './components/LunaticComponents';
|
|
9
9
|
export { useLunatic } from './use-lunatic/use-lunatic';
|
|
10
|
+
export { getArticulation } from './utils/getArticulation';
|
|
10
11
|
export { MDLabel } from './components/shared/MDLabel/MDLabel';
|
|
11
12
|
// Export errors (useful for typeof)
|
|
12
13
|
export { VTLMissingDependencies, VTLExpressionError, VTLMissingDependency, VTLInterpretationError, } from './use-lunatic/commons/variables/errors';
|
package/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAyB9D,oCAAoC;AACpC,OAAO,EACN,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,GACtB,MAAM,wCAAwC,CAAC"}
|
package/esm/type.source.d.ts
CHANGED
|
@@ -224,7 +224,7 @@ export type Variable = {
|
|
|
224
224
|
dimension?: number;
|
|
225
225
|
};
|
|
226
226
|
export type VariableValue = VariableScalarValue | unknown[];
|
|
227
|
-
export type VariableScalarValue = string | number | null;
|
|
227
|
+
export type VariableScalarValue = string | number | null | boolean;
|
|
228
228
|
/**
|
|
229
229
|
* Representation of a Lunatic questionnaire.
|
|
230
230
|
*/
|
|
@@ -278,6 +278,38 @@ export type LunaticSource = {
|
|
|
278
278
|
};
|
|
279
279
|
};
|
|
280
280
|
maxPage?: string;
|
|
281
|
+
articulation?: {
|
|
282
|
+
/**
|
|
283
|
+
* id du composant roundabout
|
|
284
|
+
*/
|
|
285
|
+
source: string;
|
|
286
|
+
/**
|
|
287
|
+
* Ligne du tableau d'articulation
|
|
288
|
+
*/
|
|
289
|
+
items: {
|
|
290
|
+
/**
|
|
291
|
+
* Libellé du champs
|
|
292
|
+
*/
|
|
293
|
+
label: string;
|
|
294
|
+
/**
|
|
295
|
+
* Expression VTL
|
|
296
|
+
*/
|
|
297
|
+
value: string;
|
|
298
|
+
}[];
|
|
299
|
+
};
|
|
300
|
+
multimode?: {
|
|
301
|
+
questionnaire: {
|
|
302
|
+
rules: {
|
|
303
|
+
[k: string]: VTLExpression1;
|
|
304
|
+
};
|
|
305
|
+
};
|
|
306
|
+
leaf: {
|
|
307
|
+
source: string;
|
|
308
|
+
rules: {
|
|
309
|
+
[k: string]: VTLExpression2;
|
|
310
|
+
};
|
|
311
|
+
};
|
|
312
|
+
};
|
|
281
313
|
};
|
|
282
314
|
export type VTLExpression = {
|
|
283
315
|
/**
|
|
@@ -406,3 +438,25 @@ export type SuggesterDefinition = {
|
|
|
406
438
|
*/
|
|
407
439
|
stopWords?: string[];
|
|
408
440
|
};
|
|
441
|
+
export type VTLExpression1 = {
|
|
442
|
+
/**
|
|
443
|
+
* Valid VTL Expression
|
|
444
|
+
*/
|
|
445
|
+
value: string;
|
|
446
|
+
/**
|
|
447
|
+
* Variables used in the expression
|
|
448
|
+
*/
|
|
449
|
+
bindingDependencies?: string[];
|
|
450
|
+
type: 'VTL' | 'VTL|MD' | 'TXT';
|
|
451
|
+
};
|
|
452
|
+
export type VTLExpression2 = {
|
|
453
|
+
/**
|
|
454
|
+
* Valid VTL Expression
|
|
455
|
+
*/
|
|
456
|
+
value: string;
|
|
457
|
+
/**
|
|
458
|
+
* Variables used in the expression
|
|
459
|
+
*/
|
|
460
|
+
bindingDependencies?: string[];
|
|
461
|
+
type: 'VTL' | 'VTL|MD' | 'TXT';
|
|
462
|
+
};
|
|
@@ -11,6 +11,6 @@ export declare function reducerInitializer({ source, data, features, initialPage
|
|
|
11
11
|
disableFilters?: LunaticOptions['disableFilters'];
|
|
12
12
|
disableFiltersDescription?: LunaticOptions['disableFiltersDescription'];
|
|
13
13
|
getReferentiel?: LunaticOptions['getReferentiel'];
|
|
14
|
-
onVariableChange
|
|
15
|
-
logger
|
|
14
|
+
onVariableChange?: RefObject<LunaticOptions['onVariableChange']>;
|
|
15
|
+
logger?: LunaticLogger;
|
|
16
16
|
}): LunaticReducerState;
|
|
@@ -29,7 +29,8 @@ const baseState = {
|
|
|
29
29
|
executeExpression: () => null,
|
|
30
30
|
options: { disableFilters: false, disableFiltersDescription: true },
|
|
31
31
|
};
|
|
32
|
-
|
|
32
|
+
const onChange = { current: () => { } };
|
|
33
|
+
export function reducerInitializer({ source, data, features = ['VTL'], initialPage = '1', lastReachedPage = undefined, withOverview = false, disableFilters = false, disableFiltersDescription = true, getReferentiel, onVariableChange = onChange, logger = console.error, }) {
|
|
33
34
|
var _a;
|
|
34
35
|
const variables = LunaticVariablesStore.makeFromSource(source, data, onVariableChange, disableFilters, source.pagination !== 'question');
|
|
35
36
|
const pages = checkLoops(createMapPages(source));
|
|
@@ -68,11 +69,13 @@ export function reducerInitializer({ source, data, features = ['VTL'], initialPa
|
|
|
68
69
|
return result;
|
|
69
70
|
}
|
|
70
71
|
catch (e) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
if (logger) {
|
|
73
|
+
// If there is an error interpreting a variable, return the raw expression
|
|
74
|
+
logger({
|
|
75
|
+
type: 'ERROR',
|
|
76
|
+
error: e,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
76
79
|
return expressionString;
|
|
77
80
|
}
|
|
78
81
|
};
|
|
@@ -83,9 +86,9 @@ export function reducerInitializer({ source, data, features = ['VTL'], initialPa
|
|
|
83
86
|
const pager = {
|
|
84
87
|
page: (_a = initialPager === null || initialPager === void 0 ? void 0 : initialPager.page) !== null && _a !== void 0 ? _a : 1,
|
|
85
88
|
maxPage: source.maxPage ? parseInt(source.maxPage, 10) : 1,
|
|
86
|
-
subPage:
|
|
89
|
+
subPage: initialPager === null || initialPager === void 0 ? void 0 : initialPager.subPage,
|
|
87
90
|
nbSubPages: undefined,
|
|
88
|
-
iteration:
|
|
91
|
+
iteration: initialPager === null || initialPager === void 0 ? void 0 : initialPager.iteration,
|
|
89
92
|
nbIterations: undefined,
|
|
90
93
|
lastReachedPage: lastReachedPage !== null && lastReachedPage !== void 0 ? lastReachedPage : initialPage,
|
|
91
94
|
};
|
|
@@ -94,7 +97,7 @@ export function reducerInitializer({ source, data, features = ['VTL'], initialPa
|
|
|
94
97
|
pager,
|
|
95
98
|
previousPager: pager,
|
|
96
99
|
pages,
|
|
97
|
-
isInLoop:
|
|
100
|
+
isInLoop: pager.subPage !== undefined,
|
|
98
101
|
updatedAt: Date.now(),
|
|
99
102
|
overview: withOverview ? buildOverview(source) : [],
|
|
100
103
|
updateBindings,
|
|
@@ -112,21 +115,25 @@ function fillPagerForLoop(state) {
|
|
|
112
115
|
return state;
|
|
113
116
|
}
|
|
114
117
|
const { isLoop, subPages, iterations, loopDependencies } = pages[pager.page];
|
|
115
|
-
if (
|
|
116
|
-
|
|
118
|
+
if (
|
|
119
|
+
// For loop, jump at the first page
|
|
120
|
+
isLoop ||
|
|
121
|
+
// For roundabout, jump at the desired iteration / subpage (only if defined)
|
|
122
|
+
((pager === null || pager === void 0 ? void 0 : pager.iteration) !== undefined && subPages)) {
|
|
123
|
+
return {
|
|
124
|
+
...state,
|
|
125
|
+
isInLoop: true,
|
|
126
|
+
pager: {
|
|
127
|
+
...pager,
|
|
128
|
+
subPage: (_a = pager === null || pager === void 0 ? void 0 : pager.subPage) !== null && _a !== void 0 ? _a : 1,
|
|
129
|
+
nbSubPages: (subPages !== null && subPages !== void 0 ? subPages : []).length,
|
|
130
|
+
iteration: (_b = pager === null || pager === void 0 ? void 0 : pager.iteration) !== null && _b !== void 0 ? _b : 0,
|
|
131
|
+
nbIterations: forceInt(state.executeExpression(iterations, {
|
|
132
|
+
deps: loopDependencies,
|
|
133
|
+
})),
|
|
134
|
+
},
|
|
135
|
+
};
|
|
117
136
|
}
|
|
118
|
-
return
|
|
119
|
-
...state,
|
|
120
|
-
isInLoop: true,
|
|
121
|
-
pager: {
|
|
122
|
-
...pager,
|
|
123
|
-
subPage: (_a = pager === null || pager === void 0 ? void 0 : pager.subPage) !== null && _a !== void 0 ? _a : 0,
|
|
124
|
-
nbSubPages: (subPages !== null && subPages !== void 0 ? subPages : []).length,
|
|
125
|
-
iteration: (_b = pager === null || pager === void 0 ? void 0 : pager.iteration) !== null && _b !== void 0 ? _b : 0,
|
|
126
|
-
nbIterations: forceInt(state.executeExpression(iterations, {
|
|
127
|
-
deps: loopDependencies,
|
|
128
|
-
})),
|
|
129
|
-
},
|
|
130
|
-
};
|
|
137
|
+
return state;
|
|
131
138
|
}
|
|
132
139
|
//# sourceMappingURL=reducerInitializer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reducerInitializer.js","sourceRoot":"","sources":["../../../src/use-lunatic/reducer/reducerInitializer.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAI3E,MAAM,SAAS,GAAG;IACjB,IAAI,EAAE,CAAC;IACP,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,SAAS;IAClB,UAAU,EAAE,SAAS;IACrB,SAAS,EAAE,SAAS;IACpB,gBAAgB,EAAE,SAAS;IAC3B,YAAY,EAAE,SAAS;CACvB,CAAC;AACF,MAAM,SAAS,GAAG;IACjB,SAAS,EAAE,IAAI,qBAAqB,EAAE;IACtC,KAAK,EAAE,SAAS;IAChB,aAAa,EAAE,SAAS;IACxB,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE,KAAK;IACf,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;IACrB,QAAQ,EAAE,EAAE;IACZ,cAAc,EAAE,GAAG,EAAE,GAAE,CAAC;IACxB,iBAAiB,EAAE,GAAO,EAAE,CAAC,IAAS;IACtC,OAAO,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,yBAAyB,EAAE,IAAI,EAAE;CACrC,CAAC;AAEhC,MAAM,UAAU,kBAAkB,CAAC,EAClC,MAAM,EACN,IAAI,EACJ,QAAQ,GAAG,CAAC,KAAK,CAAC,EAClB,WAAW,GAAG,GAAG,EACjB,eAAe,GAAG,SAAS,EAC3B,YAAY,GAAG,KAAK,EACpB,cAAc,GAAG,KAAK,EACtB,yBAAyB,GAAG,IAAI,EAChC,cAAc,EACd,gBAAgB,
|
|
1
|
+
{"version":3,"file":"reducerInitializer.js","sourceRoot":"","sources":["../../../src/use-lunatic/reducer/reducerInitializer.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA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CAAE,OAAO,mCAAI,CAAC;gBAC5B,UAAU,EAAE,CAAC,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,EAAE,CAAC,CAAC,MAAM;gBACnC,SAAS,EAAE,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,mCAAI,CAAC;gBAChC,YAAY,EAAE,QAAQ,CACrB,KAAK,CAAC,iBAAiB,CAAC,UAAU,EAAE;oBACnC,IAAI,EAAE,gBAAgB;iBACtB,CAAC,CACF;aACD;SACD,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACd,CAAC"}
|
|
@@ -329,6 +329,8 @@ export type LunaticState = {
|
|
|
329
329
|
* ])
|
|
330
330
|
*/
|
|
331
331
|
handleChanges: LunaticChangesHandler;
|
|
332
|
+
/** Return the multimode state **/
|
|
333
|
+
getMultiMode: () => Record<string, boolean>;
|
|
332
334
|
};
|
|
333
335
|
/** Function taking as arguments the various changes the user has made. */
|
|
334
336
|
export type LunaticChangesHandler = (args: {
|
|
@@ -19,6 +19,7 @@ import { useRefSync } from '../hooks/useRefSync';
|
|
|
19
19
|
import { ConsoleLogger } from './logger/ConsoleLogger';
|
|
20
20
|
import { useWarnDepChange } from './hooks/useWarnDepChange';
|
|
21
21
|
import { useCallbackOnNextRender } from './hooks/useCallbackOnNextRender';
|
|
22
|
+
import { useMultiMode } from '../hooks/useMultiMode';
|
|
22
23
|
const empty = {}; // Keep the same empty object (to avoid problem with useEffect dependencies)
|
|
23
24
|
const DEFAULT_DATA = empty;
|
|
24
25
|
const DEFAULT_FEATURES = ['VTL', 'MD'];
|
|
@@ -117,6 +118,7 @@ argOptions = empty) {
|
|
|
117
118
|
return getQuestionnaireData(state.variables, source.variables, withRefreshedCalculated, variableNames);
|
|
118
119
|
};
|
|
119
120
|
const { resetChangedData, getChangedData } = useTrackChanges(trackChanges, state.variables, (variableNames) => getData(false, variableNames));
|
|
121
|
+
const { getMultiMode } = useMultiMode(source, state.variables);
|
|
120
122
|
const pageTag = getPageTag(state.pager);
|
|
121
123
|
const { isFirstPage, isLastPage } = isFirstLastPage(state.pager);
|
|
122
124
|
const components = fillComponents(getComponentsFromState(state), {
|
|
@@ -157,6 +159,7 @@ argOptions = empty) {
|
|
|
157
159
|
// Components
|
|
158
160
|
Provider,
|
|
159
161
|
handleChanges,
|
|
162
|
+
getMultiMode,
|
|
160
163
|
};
|
|
161
164
|
}
|
|
162
165
|
//# sourceMappingURL=use-lunatic.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-lunatic.js","sourceRoot":"","sources":["../../src/use-lunatic/use-lunatic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,GACnB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAExD,OAAO,CAAC,MAAM,SAAS,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAS1D,OAAO,EAAE,eAAe,IAAI,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,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+
import type { LunaticData, PageTag } from '../use-lunatic/type';
|
|
3
|
+
import { type ReactNode } from 'react';
|
|
4
|
+
type ArticulationItem = {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string;
|
|
7
|
+
};
|
|
8
|
+
type Articulation = {
|
|
9
|
+
source: string;
|
|
10
|
+
items: ArticulationItem[];
|
|
11
|
+
};
|
|
12
|
+
type Item = {
|
|
13
|
+
cells: {
|
|
14
|
+
label: string;
|
|
15
|
+
value: ReactNode;
|
|
16
|
+
}[];
|
|
17
|
+
progress: number;
|
|
18
|
+
page: PageTag;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Retrieve the articulation state
|
|
22
|
+
*
|
|
23
|
+
* ## Why this hook
|
|
24
|
+
*
|
|
25
|
+
* The goal of this hook is to provide insights about a roundabout using extra information inserted in the JSON source
|
|
26
|
+
* provided to Lunatic.
|
|
27
|
+
*
|
|
28
|
+
* For instance
|
|
29
|
+
*
|
|
30
|
+
* ```
|
|
31
|
+
* "articulation": {
|
|
32
|
+
* "source": "roundabout",
|
|
33
|
+
* "items": [
|
|
34
|
+
* {
|
|
35
|
+
* "label": "Prénom",
|
|
36
|
+
* "value": "PRENOMS"
|
|
37
|
+
* },
|
|
38
|
+
* {
|
|
39
|
+
* "label": "Sexe",
|
|
40
|
+
* "value": "if SEXE = \"H\" then \"Homme\" else \"Femme\""
|
|
41
|
+
* },
|
|
42
|
+
* {
|
|
43
|
+
* "label": "Age",
|
|
44
|
+
* "value": "cast(AGE, string) || \" ans\""
|
|
45
|
+
* }
|
|
46
|
+
* ]
|
|
47
|
+
* },
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* - source is the ID of the roundabout component
|
|
51
|
+
* - items define the field to extract from the roundabout data
|
|
52
|
+
*/
|
|
53
|
+
export declare function getArticulation(source: LunaticSource & {
|
|
54
|
+
articulation: Articulation;
|
|
55
|
+
}, data: LunaticData): {
|
|
56
|
+
items: Item[];
|
|
57
|
+
};
|
|
58
|
+
export declare function findComponentById(components: ComponentDefinition[], id: string): (ComponentRoundaboutDefinition & {
|
|
59
|
+
page?: string;
|
|
60
|
+
}) | null;
|
|
61
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { reducerInitializer } from '../use-lunatic/reducer/reducerInitializer';
|
|
2
|
+
import { times } from './array';
|
|
3
|
+
import { forceInt } from './number';
|
|
4
|
+
/**
|
|
5
|
+
* Retrieve the articulation state
|
|
6
|
+
*
|
|
7
|
+
* ## Why this hook
|
|
8
|
+
*
|
|
9
|
+
* The goal of this hook is to provide insights about a roundabout using extra information inserted in the JSON source
|
|
10
|
+
* provided to Lunatic.
|
|
11
|
+
*
|
|
12
|
+
* For instance
|
|
13
|
+
*
|
|
14
|
+
* ```
|
|
15
|
+
* "articulation": {
|
|
16
|
+
* "source": "roundabout",
|
|
17
|
+
* "items": [
|
|
18
|
+
* {
|
|
19
|
+
* "label": "Prénom",
|
|
20
|
+
* "value": "PRENOMS"
|
|
21
|
+
* },
|
|
22
|
+
* {
|
|
23
|
+
* "label": "Sexe",
|
|
24
|
+
* "value": "if SEXE = \"H\" then \"Homme\" else \"Femme\""
|
|
25
|
+
* },
|
|
26
|
+
* {
|
|
27
|
+
* "label": "Age",
|
|
28
|
+
* "value": "cast(AGE, string) || \" ans\""
|
|
29
|
+
* }
|
|
30
|
+
* ]
|
|
31
|
+
* },
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* - source is the ID of the roundabout component
|
|
35
|
+
* - items define the field to extract from the roundabout data
|
|
36
|
+
*/
|
|
37
|
+
export function getArticulation(source, data) {
|
|
38
|
+
var _a;
|
|
39
|
+
const roundabout = findComponentById(source.components, source.articulation.source);
|
|
40
|
+
const { variables } = reducerInitializer({ source, data });
|
|
41
|
+
const iterations = forceInt(variables.run((_a = roundabout === null || roundabout === void 0 ? void 0 : roundabout.iterations.value) !== null && _a !== void 0 ? _a : '0'));
|
|
42
|
+
const rows = times(iterations, (k) => source.articulation.items.map((item) => ({
|
|
43
|
+
label: item.label,
|
|
44
|
+
value: variables.run(item.value, { iteration: [k] }),
|
|
45
|
+
})));
|
|
46
|
+
if (!roundabout) {
|
|
47
|
+
return {
|
|
48
|
+
items: [],
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
items: rows.map((row, k) => {
|
|
53
|
+
var _a;
|
|
54
|
+
return ({
|
|
55
|
+
cells: row,
|
|
56
|
+
progress: forceInt((_a = variables.get(roundabout.progressVariable, [k])) !== null && _a !== void 0 ? _a : -1),
|
|
57
|
+
page: (roundabout.page
|
|
58
|
+
? `${roundabout.page}.1#${k + 1}`
|
|
59
|
+
: '1'),
|
|
60
|
+
});
|
|
61
|
+
}),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
export function findComponentById(components, id) {
|
|
65
|
+
for (const c of components) {
|
|
66
|
+
if ('id' in c && c.id === id && c.componentType === 'Roundabout') {
|
|
67
|
+
return c;
|
|
68
|
+
}
|
|
69
|
+
if ('components' in c) {
|
|
70
|
+
const child = findComponentById(c.components, id);
|
|
71
|
+
if (child) {
|
|
72
|
+
return child;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=getArticulation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getArticulation.js","sourceRoot":"","sources":["../../src/utils/getArticulation.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAE/E,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAqBpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,UAAU,eAAe,CAC9B,MAAsD,EACtD,IAAiB;;IAEjB,MAAM,UAAU,GAAG,iBAAiB,CACnC,MAAM,CAA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