@inseefr/lunatic 3.6.15-rc.0 → 3.6.15-rc.2
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/Roundabout/Roundabout.js +8 -3
- package/components/Roundabout/Roundabout.js.map +1 -1
- package/esm/components/Roundabout/Roundabout.js +8 -3
- package/esm/components/Roundabout/Roundabout.js.map +1 -1
- package/esm/hooks/{useMultiMode.d.ts → useMultimode.d.ts} +2 -2
- package/esm/hooks/{useMultiMode.js → useMultimode.js} +5 -5
- package/esm/hooks/{useMultiMode.js.map → useMultimode.js.map} +1 -1
- package/esm/index.d.ts +2 -1
- package/esm/index.js +2 -1
- package/esm/index.js.map +1 -1
- package/esm/type.source.d.ts +2 -24
- package/esm/type.source.js +0 -1
- package/esm/type.source.js.map +1 -1
- package/esm/use-lunatic/reducer/reduce-go-next-page.js +2 -1
- package/esm/use-lunatic/reducer/reduce-go-next-page.js.map +1 -1
- package/esm/use-lunatic/type.d.ts +1 -1
- package/esm/use-lunatic/use-lunatic.js +3 -3
- package/{utils/getArticulation.d.ts → esm/utils/getArticulationState.d.ts} +8 -5
- package/esm/utils/{getArticulation.js → getArticulationState.js} +10 -6
- package/esm/utils/getArticulationState.js.map +1 -0
- package/hooks/{useMultiMode.d.ts → useMultimode.d.ts} +2 -2
- package/hooks/{useMultiMode.js → useMultimode.js} +7 -7
- package/hooks/{useMultiMode.js.map → useMultimode.js.map} +1 -1
- package/index.d.ts +2 -1
- package/index.js +5 -3
- package/index.js.map +1 -1
- package/package.json +15 -15
- package/src/components/Roundabout/Roundabout.tsx +8 -3
- package/src/hooks/{useMultiMode.ts → useMultimode.ts} +4 -4
- package/src/index.ts +2 -1
- package/src/stories/behaviour/articulation/articulation.stories.tsx +4 -4
- package/src/stories/utils/Orchestrator.tsx +2 -2
- package/src/stories/utils/OrchestratorSidebar.tsx +7 -7
- package/src/type.source.ts +2 -25
- package/src/use-lunatic/reducer/reduce-go-next-page.ts +2 -1
- package/src/use-lunatic/type.ts +1 -1
- package/src/use-lunatic/use-lunatic.ts +3 -3
- package/src/utils/{getArticulation.ts → getArticulationState.ts} +13 -6
- package/tsconfig.build.tsbuildinfo +1 -1
- package/type.source.d.ts +2 -24
- package/type.source.js +0 -1
- package/type.source.js.map +1 -1
- package/use-lunatic/reducer/reduce-go-next-page.js +2 -1
- package/use-lunatic/reducer/reduce-go-next-page.js.map +1 -1
- package/use-lunatic/type.d.ts +1 -1
- package/use-lunatic/use-lunatic.js +3 -3
- package/{esm/utils/getArticulation.d.ts → utils/getArticulationState.d.ts} +8 -5
- package/utils/{getArticulation.js → getArticulationState.js} +13 -7
- package/utils/getArticulationState.js.map +1 -0
- package/esm/utils/getArticulation.js.map +0 -1
- package/utils/getArticulation.js.map +0 -1
|
@@ -4,15 +4,20 @@ exports.Roundabout = Roundabout;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const CustomRoundabout_1 = require("./CustomRoundabout");
|
|
6
6
|
const ComponentErrors_1 = require("../shared/ComponentErrors/ComponentErrors");
|
|
7
|
+
const getArticulationState_1 = require("../../utils/getArticulationState");
|
|
7
8
|
/**
|
|
8
9
|
* Roundabout is a special loop component where the user can select the iteration to go to
|
|
9
10
|
*/
|
|
10
11
|
function Roundabout(props) {
|
|
11
12
|
const goToIteration = (iteration) => {
|
|
12
|
-
if (props.items[iteration].progress !==
|
|
13
|
-
props.items[iteration].progress !==
|
|
13
|
+
if (props.items[iteration].progress !== getArticulationState_1.ArticulationState.COMPLETED &&
|
|
14
|
+
props.items[iteration].progress !== getArticulationState_1.ArticulationState.STARTED) {
|
|
14
15
|
props.handleChanges([
|
|
15
|
-
{
|
|
16
|
+
{
|
|
17
|
+
name: props.progressVariable,
|
|
18
|
+
value: getArticulationState_1.ArticulationState.STARTED,
|
|
19
|
+
iteration: [iteration],
|
|
20
|
+
},
|
|
16
21
|
]);
|
|
17
22
|
}
|
|
18
23
|
props.goToPage({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Roundabout.js","sourceRoot":"","sources":["../../src/components/Roundabout/Roundabout.tsx"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"Roundabout.js","sourceRoot":"","sources":["../../src/components/Roundabout/Roundabout.tsx"],"names":[],"mappings":";;AAQA,gCAmCC;;AA3CD,yDAAsD;AAEtD,+EAA+E;AAC/E,2EAAqE;AAErE;;GAEG;AACH,SAAgB,UAAU,CAAC,KAA0C;IACpE,MAAM,aAAa,GAAG,CAAC,SAAiB,EAAE,EAAE;QAC3C,IACC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,QAAQ,KAAK,wCAAiB,CAAC,SAAS;YAC/D,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,QAAQ,KAAK,wCAAiB,CAAC,OAAO,EAC5D,CAAC;YACF,KAAK,CAAC,aAAa,CAAC;gBACnB;oBACC,IAAI,EAAE,KAAK,CAAC,gBAAgB;oBAC5B,KAAK,EAAE,wCAAiB,CAAC,OAAO;oBAChC,SAAS,EAAE,CAAC,SAAS,CAAC;iBACtB;aACD,CAAC,CAAC;QACJ,CAAC;QACD,KAAK,CAAC,QAAQ,CAAC;YACd,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,OAAO,EAAE,CAAC;YACV,SAAS;YACT,YAAY,EAAE,KAAK,CAAC,UAAU;SAC9B,CAAC,CAAC;IACJ,CAAC,CAAC;IAEF,MAAM,eAAe,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACrD,GAAG,IAAI;QACP,MAAM,EAAE,IAAA,oCAAkB,EAAC,KAAK,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC;KAC5D,CAAC,CAAC,CAAC;IAEJ,OAAO,CACN,uBAAC,mCAAgB,OACZ,KAAK,EACT,MAAM,EAAE,IAAA,oCAAkB,EAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,EAClD,KAAK,EAAE,eAAe,EACtB,aAAa,EAAE,aAAa,GAC3B,CACF,CAAC;AACH,CAAC"}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { CustomRoundabout } from './CustomRoundabout';
|
|
3
3
|
import { getComponentErrors } from '../shared/ComponentErrors/ComponentErrors';
|
|
4
|
+
import { ArticulationState } from '../../utils/getArticulationState';
|
|
4
5
|
/**
|
|
5
6
|
* Roundabout is a special loop component where the user can select the iteration to go to
|
|
6
7
|
*/
|
|
7
8
|
export function Roundabout(props) {
|
|
8
9
|
const goToIteration = (iteration) => {
|
|
9
|
-
if (props.items[iteration].progress !==
|
|
10
|
-
props.items[iteration].progress !==
|
|
10
|
+
if (props.items[iteration].progress !== ArticulationState.COMPLETED &&
|
|
11
|
+
props.items[iteration].progress !== ArticulationState.STARTED) {
|
|
11
12
|
props.handleChanges([
|
|
12
|
-
{
|
|
13
|
+
{
|
|
14
|
+
name: props.progressVariable,
|
|
15
|
+
value: ArticulationState.STARTED,
|
|
16
|
+
iteration: [iteration],
|
|
17
|
+
},
|
|
13
18
|
]);
|
|
14
19
|
}
|
|
15
20
|
props.goToPage({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Roundabout.js","sourceRoot":"","sources":["../../../src/components/Roundabout/Roundabout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"Roundabout.js","sourceRoot":"","sources":["../../../src/components/Roundabout/Roundabout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC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
* ```
|
|
44
44
|
*/
|
|
45
|
-
export declare function
|
|
46
|
-
|
|
45
|
+
export declare function useMultimode(source: LunaticSource, store: LunaticVariablesStore): {
|
|
46
|
+
getMultimode: () => {
|
|
47
47
|
[k: string]: boolean;
|
|
48
48
|
};
|
|
49
49
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
|
-
import { findComponentById } from '../utils/
|
|
2
|
+
import { findComponentById } from '../utils/getArticulationState';
|
|
3
3
|
import { forceInt } from '../utils/number';
|
|
4
4
|
/**
|
|
5
5
|
* Retrieve the multimode state
|
|
@@ -43,8 +43,8 @@ import { forceInt } from '../utils/number';
|
|
|
43
43
|
* }
|
|
44
44
|
* ```
|
|
45
45
|
*/
|
|
46
|
-
export function
|
|
47
|
-
const
|
|
46
|
+
export function useMultimode(source, store) {
|
|
47
|
+
const getMultimode = useCallback(() => {
|
|
48
48
|
var _a;
|
|
49
49
|
if (!source.multimode) {
|
|
50
50
|
return {};
|
|
@@ -77,7 +77,7 @@ export function useMultiMode(source, store) {
|
|
|
77
77
|
}));
|
|
78
78
|
}, [source, store]);
|
|
79
79
|
return {
|
|
80
|
-
|
|
80
|
+
getMultimode,
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
//# sourceMappingURL=
|
|
83
|
+
//# sourceMappingURL=useMultimode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
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,+BAA+B,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,UAAU,YAAY,CAC3B,MAAqB,E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CAAC;YAED,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
|
@@ -6,8 +6,9 @@ export { library as components } from './components/library';
|
|
|
6
6
|
export { ModalControls } from './components/shared/ModalControls/ModalControls';
|
|
7
7
|
export { Button } from './components/shared/Button/Button';
|
|
8
8
|
export { LunaticComponents } from './components/LunaticComponents';
|
|
9
|
+
export { LunaticVariablesStore } from './use-lunatic/commons/variables/lunatic-variables-store';
|
|
9
10
|
export { useLunatic } from './use-lunatic/use-lunatic';
|
|
10
|
-
export {
|
|
11
|
+
export { getArticulationState } from './utils/getArticulationState';
|
|
11
12
|
export { MDLabel } from './components/shared/MDLabel/MDLabel';
|
|
12
13
|
export type { LunaticComponentDefinition, LunaticControl, LunaticData, LunaticValues, LunaticError, LunaticExpression, LunaticVariable, LunaticCollectedValue, LunaticStateVariable, LunaticState, LunaticPager, LunaticOptions, LunaticChangesHandler, } from './use-lunatic/type';
|
|
13
14
|
export type { LunaticComponentProps, LunaticExtraProps, } from './components/type';
|
package/esm/index.js
CHANGED
|
@@ -6,8 +6,9 @@ export { library as components } from './components/library';
|
|
|
6
6
|
export { ModalControls } from './components/shared/ModalControls/ModalControls';
|
|
7
7
|
export { Button } from './components/shared/Button/Button';
|
|
8
8
|
export { LunaticComponents } from './components/LunaticComponents';
|
|
9
|
+
export { LunaticVariablesStore } from './use-lunatic/commons/variables/lunatic-variables-store';
|
|
9
10
|
export { useLunatic } from './use-lunatic/use-lunatic';
|
|
10
|
-
export {
|
|
11
|
+
export { getArticulationState } from './utils/getArticulationState';
|
|
11
12
|
export { MDLabel } from './components/shared/MDLabel/MDLabel';
|
|
12
13
|
// Export errors (useful for typeof)
|
|
13
14
|
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;AACvD,OAAO,EAAE,
|
|
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,qBAAqB,EAAE,MAAM,yDAAyD,CAAC;AAChG,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,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
|
@@ -300,13 +300,13 @@ export type LunaticSource = {
|
|
|
300
300
|
multimode?: {
|
|
301
301
|
questionnaire: {
|
|
302
302
|
rules: {
|
|
303
|
-
[k: string]:
|
|
303
|
+
[k: string]: VTLExpression;
|
|
304
304
|
};
|
|
305
305
|
};
|
|
306
306
|
leaf: {
|
|
307
307
|
source: string;
|
|
308
308
|
rules: {
|
|
309
|
-
[k: string]:
|
|
309
|
+
[k: string]: VTLExpression;
|
|
310
310
|
};
|
|
311
311
|
};
|
|
312
312
|
};
|
|
@@ -438,25 +438,3 @@ export type SuggesterDefinition = {
|
|
|
438
438
|
*/
|
|
439
439
|
stopWords?: string[];
|
|
440
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
|
-
};
|
package/esm/type.source.js
CHANGED
package/esm/type.source.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.source.js","sourceRoot":"","sources":["../src/type.source.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"type.source.js","sourceRoot":"","sources":["../src/type.source.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -4,6 +4,7 @@ import { getNextPager } from '../commons/page-navigation';
|
|
|
4
4
|
import { autoExploreLoop } from './commons/auto-explore-loop';
|
|
5
5
|
import { reduceHandleChanges } from './reduce-handle-changes';
|
|
6
6
|
import { ActionKind } from '../actions';
|
|
7
|
+
import { ArticulationState } from '../../utils/getArticulationState';
|
|
7
8
|
export function reduceGoNextPage(state) {
|
|
8
9
|
var _a;
|
|
9
10
|
const { pages, pager } = state;
|
|
@@ -41,7 +42,7 @@ export function reduceGoNextPage(state) {
|
|
|
41
42
|
responses: [
|
|
42
43
|
{
|
|
43
44
|
name: firstComponent.progressVariable,
|
|
44
|
-
value:
|
|
45
|
+
value: ArticulationState.COMPLETED,
|
|
45
46
|
iteration: [newState.previousPager.iteration],
|
|
46
47
|
},
|
|
47
48
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reduce-go-next-page.js","sourceRoot":"","sources":["../../../src/use-lunatic/reducer/reduce-go-next-page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"reduce-go-next-page.js","sourceRoot":"","sources":["../../../src/use-lunatic/reducer/reduce-go-next-page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAA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IAAI,KAAK,QAAQ,CAAC,aAAa,CAAC,IAAI;QACnD,QAAQ,CAAC,KAAK,CAAC,OAAO,KAAK,SAAS;QACpC,QAAQ,CAAC,aAAa,CAAC,SAAS,KAAK,SAAS;QAC9C,yBAAyB;QACzB,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EACxD,CAAC;QACF,6CAA6C;QAC7C,MAAM,cAAc,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACzE,IAAI,cAAc,CAAC,aAAa,KAAK,YAAY,EAAE,CAAC;YACnD,QAAQ,GAAG,mBAAmB,CAAC,QAAQ,EAAE;gBACxC,IAAI,EAAE,UAAU,CAAC,cAAc;gBAC/B,OAAO,EAAE;oBACR,SAAS,EAAE;wBACV;4BACC,IAAI,EAAE,cAAc,CAAC,gBAAgB;4BACrC,KAAK,EAAE,iBAAiB,CAAC,SAAS;4BAClC,SAAS,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC;yBAC7C;qBACD;iBACD;aACD,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;IAED,OAAO;QACN,GAAG,QAAQ;QACX,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS;QAChD,aAAa,EAAE,KAAK,CAAC,KAAK;QAC1B,KAAK,EAAE;YACN,GAAG,QAAQ,CAAC,KAAK;YACjB,eAAe,EAAE,iBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC;SAClD;KACD,CAAC;AACH,CAAC"}
|
|
@@ -330,7 +330,7 @@ export type LunaticState = {
|
|
|
330
330
|
*/
|
|
331
331
|
handleChanges: LunaticChangesHandler;
|
|
332
332
|
/** Return the multimode state **/
|
|
333
|
-
|
|
333
|
+
getMultimode: () => Record<string, boolean>;
|
|
334
334
|
};
|
|
335
335
|
/** Function taking as arguments the various changes the user has made. */
|
|
336
336
|
export type LunaticChangesHandler = (args: {
|
|
@@ -19,7 +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 {
|
|
22
|
+
import { useMultimode } from '../hooks/useMultimode';
|
|
23
23
|
const empty = {}; // Keep the same empty object (to avoid problem with useEffect dependencies)
|
|
24
24
|
const DEFAULT_DATA = empty;
|
|
25
25
|
const DEFAULT_FEATURES = ['VTL', 'MD'];
|
|
@@ -118,7 +118,7 @@ argOptions = empty) {
|
|
|
118
118
|
return getQuestionnaireData(state.variables, source.variables, withRefreshedCalculated, variableNames);
|
|
119
119
|
};
|
|
120
120
|
const { resetChangedData, getChangedData } = useTrackChanges(trackChanges, state.variables, (variableNames) => getData(false, variableNames));
|
|
121
|
-
const {
|
|
121
|
+
const { getMultimode } = useMultimode(source, state.variables);
|
|
122
122
|
const pageTag = getPageTag(state.pager);
|
|
123
123
|
const { isFirstPage, isLastPage } = isFirstLastPage(state.pager);
|
|
124
124
|
const components = fillComponents(getComponentsFromState(state), {
|
|
@@ -159,7 +159,7 @@ argOptions = empty) {
|
|
|
159
159
|
// Components
|
|
160
160
|
Provider,
|
|
161
161
|
handleChanges,
|
|
162
|
-
|
|
162
|
+
getMultimode,
|
|
163
163
|
};
|
|
164
164
|
}
|
|
165
165
|
//# sourceMappingURL=use-lunatic.js.map
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { ComponentDefinition, ComponentRoundaboutDefinition, LunaticSource } from '../type.source';
|
|
2
2
|
import type { LunaticData, PageTag } from '../use-lunatic/type';
|
|
3
3
|
import { type ReactNode } from 'react';
|
|
4
|
+
export declare enum ArticulationState {
|
|
5
|
+
COMPLETED = 1,
|
|
6
|
+
STARTED = 0,
|
|
7
|
+
NOT_STARTED = -1
|
|
8
|
+
}
|
|
4
9
|
type ArticulationItem = {
|
|
5
10
|
label: string;
|
|
6
11
|
value: string;
|
|
@@ -14,15 +19,13 @@ type Item = {
|
|
|
14
19
|
label: string;
|
|
15
20
|
value: ReactNode;
|
|
16
21
|
}[];
|
|
17
|
-
progress:
|
|
22
|
+
progress: ArticulationState;
|
|
18
23
|
page: PageTag;
|
|
19
24
|
};
|
|
20
25
|
/**
|
|
21
26
|
* Retrieve the articulation state
|
|
22
27
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* The goal of this hook is to provide insights about a roundabout using extra information inserted in the JSON source
|
|
28
|
+
* The goal of this function is to provide insights about a roundabout using extra information inserted in the JSON source
|
|
26
29
|
* provided to Lunatic.
|
|
27
30
|
*
|
|
28
31
|
* For instance
|
|
@@ -50,7 +53,7 @@ type Item = {
|
|
|
50
53
|
* - source is the ID of the roundabout component
|
|
51
54
|
* - items define the field to extract from the roundabout data
|
|
52
55
|
*/
|
|
53
|
-
export declare function
|
|
56
|
+
export declare function getArticulationState(source: LunaticSource & {
|
|
54
57
|
articulation: Articulation;
|
|
55
58
|
}, data: LunaticData): {
|
|
56
59
|
items: Item[];
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { reducerInitializer } from '../use-lunatic/reducer/reducerInitializer';
|
|
2
2
|
import { times } from './array';
|
|
3
3
|
import { forceInt } from './number';
|
|
4
|
+
export var ArticulationState;
|
|
5
|
+
(function (ArticulationState) {
|
|
6
|
+
ArticulationState[ArticulationState["COMPLETED"] = 1] = "COMPLETED";
|
|
7
|
+
ArticulationState[ArticulationState["STARTED"] = 0] = "STARTED";
|
|
8
|
+
ArticulationState[ArticulationState["NOT_STARTED"] = -1] = "NOT_STARTED";
|
|
9
|
+
})(ArticulationState || (ArticulationState = {}));
|
|
4
10
|
/**
|
|
5
11
|
* Retrieve the articulation state
|
|
6
12
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* The goal of this hook is to provide insights about a roundabout using extra information inserted in the JSON source
|
|
13
|
+
* The goal of this function is to provide insights about a roundabout using extra information inserted in the JSON source
|
|
10
14
|
* provided to Lunatic.
|
|
11
15
|
*
|
|
12
16
|
* For instance
|
|
@@ -34,7 +38,7 @@ import { forceInt } from './number';
|
|
|
34
38
|
* - source is the ID of the roundabout component
|
|
35
39
|
* - items define the field to extract from the roundabout data
|
|
36
40
|
*/
|
|
37
|
-
export function
|
|
41
|
+
export function getArticulationState(source, data) {
|
|
38
42
|
var _a;
|
|
39
43
|
const roundabout = findComponentById(source.components, source.articulation.source);
|
|
40
44
|
const { variables } = reducerInitializer({ source, data });
|
|
@@ -53,7 +57,7 @@ export function getArticulation(source, data) {
|
|
|
53
57
|
var _a;
|
|
54
58
|
return ({
|
|
55
59
|
cells: row,
|
|
56
|
-
progress: forceInt((_a = variables.get(roundabout.progressVariable, [k])) !== null && _a !== void 0 ? _a :
|
|
60
|
+
progress: forceInt((_a = variables.get(roundabout.progressVariable, [k])) !== null && _a !== void 0 ? _a : ArticulationState.NOT_STARTED),
|
|
57
61
|
page: (roundabout.page
|
|
58
62
|
? `${roundabout.page}.1#${k + 1}`
|
|
59
63
|
: '1'),
|
|
@@ -75,4 +79,4 @@ export function findComponentById(components, id) {
|
|
|
75
79
|
}
|
|
76
80
|
return null;
|
|
77
81
|
}
|
|
78
|
-
//# sourceMappingURL=
|
|
82
|
+
//# sourceMappingURL=getArticulationState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getArticulationState.js","sourceRoot":"","sources":["../../src/utils/getArticulationState.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;AAEpC,MAAM,CAAN,IAAY,iBAIX;AAJD,WAAY,iB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,CAAC,CAAC,CAAC,mCAC9C,iBAAiB,CAAC,WAAW,CAC9B;gBACD,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI;oBACrB,CAAC,CAAC,GAAG,UAAU,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE;oBACjC,CAAC,CAAC,GAAG,CAAY;aAClB,CAAC,CAAA;SAAA,CAAC;KACH,CAAC;AACH,CAAC;AAED,MAAM,UAAU,iBAAiB,CAChC,UAAiC,EACjC,EAAU;IAEV,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;QAC5B,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,aAAa,KAAK,YAAY,EAAE,CAAC;YAClE,OAAO,CAAC,CAAC;QACV,CAAC;QACD,IAAI,YAAY,IAAI,CAAC,EAAE,CAAC;YACvB,MAAM,KAAK,GAAG,iBAAiB,CAAC,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;YAClD,IAAI,KAAK,EAAE,CAAC;gBACX,OAAO,KAAK,CAAC;YACd,CAAC;QACF,CAAC;IACF,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC"}
|
|
@@ -42,8 +42,8 @@ import type { LunaticSource } from '../type.source';
|
|
|
42
42
|
* }
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
45
|
-
export declare function
|
|
46
|
-
|
|
45
|
+
export declare function useMultimode(source: LunaticSource, store: LunaticVariablesStore): {
|
|
46
|
+
getMultimode: () => {
|
|
47
47
|
[k: string]: boolean;
|
|
48
48
|
};
|
|
49
49
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.useMultimode = useMultimode;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
const
|
|
5
|
+
const getArticulationState_1 = require("../utils/getArticulationState");
|
|
6
6
|
const number_1 = require("../utils/number");
|
|
7
7
|
/**
|
|
8
8
|
* Retrieve the multimode state
|
|
@@ -46,12 +46,12 @@ const number_1 = require("../utils/number");
|
|
|
46
46
|
* }
|
|
47
47
|
* ```
|
|
48
48
|
*/
|
|
49
|
-
function
|
|
50
|
-
const
|
|
49
|
+
function useMultimode(source, store) {
|
|
50
|
+
const getMultimode = (0, react_1.useCallback)(() => {
|
|
51
51
|
if (!source.multimode) {
|
|
52
52
|
return {};
|
|
53
53
|
}
|
|
54
|
-
const roundabout = (0,
|
|
54
|
+
const roundabout = (0, getArticulationState_1.findComponentById)(source.components, source.multimode.leaf.source);
|
|
55
55
|
const keys = new Set([
|
|
56
56
|
...Object.keys(source.multimode.questionnaire.rules),
|
|
57
57
|
...Object.keys(source.multimode.leaf.rules),
|
|
@@ -78,7 +78,7 @@ function useMultiMode(source, store) {
|
|
|
78
78
|
}));
|
|
79
79
|
}, [source, store]);
|
|
80
80
|
return {
|
|
81
|
-
|
|
81
|
+
getMultimode,
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
|
-
//# sourceMappingURL=
|
|
84
|
+
//# sourceMappingURL=useMultimode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"useMultimode.js","sourceRoot":"","sources":["../src/hooks/useMultimode.ts"],"names":[],"mappings":";;AAgDA,oCAqDC;AAnGD,iCAAoC;AACpC,wEAAkE;AAClE,4CAA2C;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,SAAgB,YAAY,CAC3B,MAAqB,EACrB,KAA4B;IAE5B,MAAM,YAAY,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QACrC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;YACvB,OAAO,EAAE,CAAC;QACX,CAAC;QAED,MAAM,UAAU,GAAG,IAAA,wCAAiB,EACnC,MAAM,CAAC,UAAU,EACjB,MAAM,CA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AC,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/index.d.ts
CHANGED
|
@@ -6,8 +6,9 @@ export { library as components } from './components/library';
|
|
|
6
6
|
export { ModalControls } from './components/shared/ModalControls/ModalControls';
|
|
7
7
|
export { Button } from './components/shared/Button/Button';
|
|
8
8
|
export { LunaticComponents } from './components/LunaticComponents';
|
|
9
|
+
export { LunaticVariablesStore } from './use-lunatic/commons/variables/lunatic-variables-store';
|
|
9
10
|
export { useLunatic } from './use-lunatic/use-lunatic';
|
|
10
|
-
export {
|
|
11
|
+
export { getArticulationState } from './utils/getArticulationState';
|
|
11
12
|
export { MDLabel } from './components/shared/MDLabel/MDLabel';
|
|
12
13
|
export type { LunaticComponentDefinition, LunaticControl, LunaticData, LunaticValues, LunaticError, LunaticExpression, LunaticVariable, LunaticCollectedValue, LunaticStateVariable, LunaticState, LunaticPager, LunaticOptions, LunaticChangesHandler, } from './use-lunatic/type';
|
|
13
14
|
export type { LunaticComponentProps, LunaticExtraProps, } from './components/type';
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VTLInterpretationError = exports.VTLMissingDependency = exports.VTLExpressionError = exports.VTLMissingDependencies = exports.MDLabel = exports.
|
|
3
|
+
exports.VTLInterpretationError = exports.VTLMissingDependency = exports.VTLExpressionError = exports.VTLMissingDependencies = exports.MDLabel = exports.getArticulationState = exports.useLunatic = exports.LunaticVariablesStore = exports.LunaticComponents = exports.Button = exports.ModalControls = exports.components = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* We should remove this export to avoid `import * as lunatic from "@inseefr/lunatic"` in orchestrators
|
|
6
6
|
* but this is a breaking change
|
|
@@ -13,10 +13,12 @@ var Button_1 = require("./components/shared/Button/Button");
|
|
|
13
13
|
Object.defineProperty(exports, "Button", { enumerable: true, get: function () { return Button_1.Button; } });
|
|
14
14
|
var LunaticComponents_1 = require("./components/LunaticComponents");
|
|
15
15
|
Object.defineProperty(exports, "LunaticComponents", { enumerable: true, get: function () { return LunaticComponents_1.LunaticComponents; } });
|
|
16
|
+
var lunatic_variables_store_1 = require("./use-lunatic/commons/variables/lunatic-variables-store");
|
|
17
|
+
Object.defineProperty(exports, "LunaticVariablesStore", { enumerable: true, get: function () { return lunatic_variables_store_1.LunaticVariablesStore; } });
|
|
16
18
|
var use_lunatic_1 = require("./use-lunatic/use-lunatic");
|
|
17
19
|
Object.defineProperty(exports, "useLunatic", { enumerable: true, get: function () { return use_lunatic_1.useLunatic; } });
|
|
18
|
-
var
|
|
19
|
-
Object.defineProperty(exports, "
|
|
20
|
+
var getArticulationState_1 = require("./utils/getArticulationState");
|
|
21
|
+
Object.defineProperty(exports, "getArticulationState", { enumerable: true, get: function () { return getArticulationState_1.getArticulationState; } });
|
|
20
22
|
var MDLabel_1 = require("./components/shared/MDLabel/MDLabel");
|
|
21
23
|
Object.defineProperty(exports, "MDLabel", { enumerable: true, get: function () { return MDLabel_1.MDLabel; } });
|
|
22
24
|
// Export errors (useful for typeof)
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,gDAA6D;AAApD,qGAAA,OAAO,OAAc;AAC9B,iFAAgF;AAAvE,8GAAA,aAAa,OAAA;AACtB,4DAA2D;AAAlD,gGAAA,MAAM,OAAA;AAEf,oEAAmE;AAA1D,sHAAA,iBAAiB,OAAA;AAC1B,yDAAuD;AAA9C,yGAAA,UAAU,OAAA;AACnB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,gDAA6D;AAApD,qGAAA,OAAO,OAAc;AAC9B,iFAAgF;AAAvE,8GAAA,aAAa,OAAA;AACtB,4DAA2D;AAAlD,gGAAA,MAAM,OAAA;AAEf,oEAAmE;AAA1D,sHAAA,iBAAiB,OAAA;AAC1B,mGAAgG;AAAvF,gIAAA,qBAAqB,OAAA;AAC9B,yDAAuD;AAA9C,yGAAA,UAAU,OAAA;AACnB,qEAAoE;AAA3D,4HAAA,oBAAoB,OAAA;AAE7B,+DAA8D;AAArD,kGAAA,OAAO,OAAA;AAyBhB,oCAAoC;AACpC,iEAKgD;AAJ/C,gHAAA,sBAAsB,OAAA;AACtB,4GAAA,kBAAkB,OAAA;AAClB,8GAAA,oBAAoB,OAAA;AACpB,gHAAA,sBAAsB,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inseefr/lunatic",
|
|
3
|
-
"version": "3.6.15-rc.
|
|
3
|
+
"version": "3.6.15-rc.2",
|
|
4
4
|
"description": "Library of questionnaire components",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -225,7 +225,7 @@
|
|
|
225
225
|
"src/hooks/useKeyboardKey.ts",
|
|
226
226
|
"src/hooks/useListKeyboardHandler.ts",
|
|
227
227
|
"src/hooks/useLocalStorage.ts",
|
|
228
|
-
"src/hooks/
|
|
228
|
+
"src/hooks/useMultimode.ts",
|
|
229
229
|
"src/hooks/useRefSync.ts",
|
|
230
230
|
"src/i18n/build-dictionary.ts",
|
|
231
231
|
"src/i18n/dictionary.ts",
|
|
@@ -435,7 +435,7 @@
|
|
|
435
435
|
"src/utils/dom.ts",
|
|
436
436
|
"src/utils/env.ts",
|
|
437
437
|
"src/utils/function.ts",
|
|
438
|
-
"src/utils/
|
|
438
|
+
"src/utils/getArticulationState.ts",
|
|
439
439
|
"src/utils/is-element.ts",
|
|
440
440
|
"src/utils/logger.ts",
|
|
441
441
|
"src/utils/number.spec.ts",
|
|
@@ -1328,9 +1328,9 @@
|
|
|
1328
1328
|
"esm/hooks/useLocalStorage.d.ts",
|
|
1329
1329
|
"esm/hooks/useLocalStorage.js",
|
|
1330
1330
|
"esm/hooks/useLocalStorage.js.map",
|
|
1331
|
-
"esm/hooks/
|
|
1332
|
-
"esm/hooks/
|
|
1333
|
-
"esm/hooks/
|
|
1331
|
+
"esm/hooks/useMultimode.d.ts",
|
|
1332
|
+
"esm/hooks/useMultimode.js",
|
|
1333
|
+
"esm/hooks/useMultimode.js.map",
|
|
1334
1334
|
"esm/hooks/useRefSync.d.ts",
|
|
1335
1335
|
"esm/hooks/useRefSync.js",
|
|
1336
1336
|
"esm/hooks/useRefSync.js.map",
|
|
@@ -1585,9 +1585,9 @@
|
|
|
1585
1585
|
"esm/utils/function.d.ts",
|
|
1586
1586
|
"esm/utils/function.js",
|
|
1587
1587
|
"esm/utils/function.js.map",
|
|
1588
|
-
"esm/utils/
|
|
1589
|
-
"esm/utils/
|
|
1590
|
-
"esm/utils/
|
|
1588
|
+
"esm/utils/getArticulationState.d.ts",
|
|
1589
|
+
"esm/utils/getArticulationState.js",
|
|
1590
|
+
"esm/utils/getArticulationState.js.map",
|
|
1591
1591
|
"esm/utils/is-element.d.ts",
|
|
1592
1592
|
"esm/utils/is-element.js",
|
|
1593
1593
|
"esm/utils/is-element.js.map",
|
|
@@ -1660,9 +1660,9 @@
|
|
|
1660
1660
|
"hooks/useLocalStorage.d.ts",
|
|
1661
1661
|
"hooks/useLocalStorage.js",
|
|
1662
1662
|
"hooks/useLocalStorage.js.map",
|
|
1663
|
-
"hooks/
|
|
1664
|
-
"hooks/
|
|
1665
|
-
"hooks/
|
|
1663
|
+
"hooks/useMultimode.d.ts",
|
|
1664
|
+
"hooks/useMultimode.js",
|
|
1665
|
+
"hooks/useMultimode.js.map",
|
|
1666
1666
|
"hooks/useRefSync.d.ts",
|
|
1667
1667
|
"hooks/useRefSync.js",
|
|
1668
1668
|
"hooks/useRefSync.js.map",
|
|
@@ -1918,9 +1918,9 @@
|
|
|
1918
1918
|
"utils/function.d.ts",
|
|
1919
1919
|
"utils/function.js",
|
|
1920
1920
|
"utils/function.js.map",
|
|
1921
|
-
"utils/
|
|
1922
|
-
"utils/
|
|
1923
|
-
"utils/
|
|
1921
|
+
"utils/getArticulationState.d.ts",
|
|
1922
|
+
"utils/getArticulationState.js",
|
|
1923
|
+
"utils/getArticulationState.js.map",
|
|
1924
1924
|
"utils/is-element.d.ts",
|
|
1925
1925
|
"utils/is-element.js",
|
|
1926
1926
|
"utils/is-element.js.map",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CustomRoundabout } from './CustomRoundabout';
|
|
2
2
|
import type { LunaticComponentProps } from '../type';
|
|
3
3
|
import { getComponentErrors } from '../shared/ComponentErrors/ComponentErrors';
|
|
4
|
+
import { ArticulationState } from '../../utils/getArticulationState';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Roundabout is a special loop component where the user can select the iteration to go to
|
|
@@ -8,11 +9,15 @@ import { getComponentErrors } from '../shared/ComponentErrors/ComponentErrors';
|
|
|
8
9
|
export function Roundabout(props: LunaticComponentProps<'Roundabout'>) {
|
|
9
10
|
const goToIteration = (iteration: number) => {
|
|
10
11
|
if (
|
|
11
|
-
props.items[iteration].progress !==
|
|
12
|
-
props.items[iteration].progress !==
|
|
12
|
+
props.items[iteration].progress !== ArticulationState.COMPLETED &&
|
|
13
|
+
props.items[iteration].progress !== ArticulationState.STARTED
|
|
13
14
|
) {
|
|
14
15
|
props.handleChanges([
|
|
15
|
-
{
|
|
16
|
+
{
|
|
17
|
+
name: props.progressVariable,
|
|
18
|
+
value: ArticulationState.STARTED,
|
|
19
|
+
iteration: [iteration],
|
|
20
|
+
},
|
|
16
21
|
]);
|
|
17
22
|
}
|
|
18
23
|
props.goToPage({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { LunaticVariablesStore } from '../use-lunatic/commons/variables/lunatic-variables-store';
|
|
2
2
|
import type { LunaticSource } from '../type.source';
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
|
-
import { findComponentById } from '../utils/
|
|
4
|
+
import { findComponentById } from '../utils/getArticulationState';
|
|
5
5
|
import { forceInt } from '../utils/number';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -46,11 +46,11 @@ import { forceInt } from '../utils/number';
|
|
|
46
46
|
* }
|
|
47
47
|
* ```
|
|
48
48
|
*/
|
|
49
|
-
export function
|
|
49
|
+
export function useMultimode(
|
|
50
50
|
source: LunaticSource,
|
|
51
51
|
store: LunaticVariablesStore
|
|
52
52
|
) {
|
|
53
|
-
const
|
|
53
|
+
const getMultimode = useCallback(() => {
|
|
54
54
|
if (!source.multimode) {
|
|
55
55
|
return {};
|
|
56
56
|
}
|
|
@@ -97,6 +97,6 @@ export function useMultiMode(
|
|
|
97
97
|
}, [source, store]);
|
|
98
98
|
|
|
99
99
|
return {
|
|
100
|
-
|
|
100
|
+
getMultimode,
|
|
101
101
|
};
|
|
102
102
|
}
|
package/src/index.ts
CHANGED
|
@@ -7,8 +7,9 @@ export { ModalControls } from './components/shared/ModalControls/ModalControls';
|
|
|
7
7
|
export { Button } from './components/shared/Button/Button';
|
|
8
8
|
|
|
9
9
|
export { LunaticComponents } from './components/LunaticComponents';
|
|
10
|
+
export { LunaticVariablesStore } from './use-lunatic/commons/variables/lunatic-variables-store';
|
|
10
11
|
export { useLunatic } from './use-lunatic/use-lunatic';
|
|
11
|
-
export {
|
|
12
|
+
export { getArticulationState } from './utils/getArticulationState';
|
|
12
13
|
|
|
13
14
|
export { MDLabel } from './components/shared/MDLabel/MDLabel';
|
|
14
15
|
|