@inseefr/lunatic 3.0.0-rc.25 → 3.0.0-rc.27
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/Loop/Loop.js +6 -1
- package/lib/components/Loop/Loop.js.map +1 -1
- package/lib/components/LunaticComponents.d.ts +7 -11
- package/lib/components/LunaticComponents.js +4 -1
- package/lib/components/LunaticComponents.js.map +1 -1
- package/lib/components/RosterForLoop/RosterForLoop.js +4 -3
- package/lib/components/RosterForLoop/RosterForLoop.js.map +1 -1
- package/lib/components/Table/Table.js +1 -1
- package/lib/components/Table/Table.js.map +1 -1
- package/lib/components/library.d.ts +1 -1
- package/lib/components/shared/HOC/slottableComponent.d.ts +2 -2
- package/lib/components/shared/MDLabel/MDLabel.js +4 -1
- package/lib/components/shared/MDLabel/MDLabel.js.map +1 -1
- package/lib/components/shared/MDLabel/MDLabel.spec.js +4 -1
- package/lib/components/shared/MDLabel/MDLabel.spec.js.map +1 -1
- package/lib/components/shared/Table/Table.js +1 -1
- package/lib/components/shared/Table/Table.js.map +1 -1
- package/lib/components/shared/Table/TableHeader.d.ts +1 -1
- package/lib/components/shared/Table/TableHeader.js +3 -3
- package/lib/components/shared/Table/TableHeader.js.map +1 -1
- package/lib/components/shared/Table/Tbody.d.ts +0 -1
- package/lib/components/shared/Table/Tbody.js +2 -2
- package/lib/components/shared/Table/Tbody.js.map +1 -1
- package/lib/components/shared/Table/Tbody.spec.js +1 -2
- package/lib/components/shared/Table/Tbody.spec.js.map +1 -1
- package/lib/components/shared/Table/Td.d.ts +0 -1
- package/lib/components/shared/Table/Td.js +2 -2
- package/lib/components/shared/Table/Td.js.map +1 -1
- package/lib/components/shared/Table/Td.spec.js +1 -2
- package/lib/components/shared/Table/Td.spec.js.map +1 -1
- package/lib/components/shared/Table/Th.d.ts +0 -1
- package/lib/components/shared/Table/Th.js +2 -2
- package/lib/components/shared/Table/Th.js.map +1 -1
- package/lib/components/shared/Table/Th.spec.js +0 -2
- package/lib/components/shared/Table/Th.spec.js.map +1 -1
- package/lib/components/shared/Table/Thead.d.ts +0 -1
- package/lib/components/shared/Table/Thead.js +2 -2
- package/lib/components/shared/Table/Thead.js.map +1 -1
- package/lib/components/shared/Table/Thead.spec.js +1 -6
- package/lib/components/shared/Table/Thead.spec.js.map +1 -1
- package/lib/components/shared/Table/Tr.d.ts +0 -1
- package/lib/components/shared/Table/Tr.js +2 -2
- package/lib/components/shared/Table/Tr.js.map +1 -1
- package/lib/components/shared/Table/Tr.spec.js +2 -3
- package/lib/components/shared/Table/Tr.spec.js.map +1 -1
- package/lib/components/type.d.ts +10 -10
- package/lib/index.d.ts +1 -1
- package/lib/use-lunatic/actions.d.ts +3 -52
- package/lib/use-lunatic/actions.js +0 -7
- package/lib/use-lunatic/actions.js.map +1 -1
- package/lib/use-lunatic/commons/check-loops.d.ts +2 -2
- package/lib/use-lunatic/commons/check-loops.js.map +1 -1
- package/lib/use-lunatic/commons/compile-controls.d.ts +2 -2
- package/lib/use-lunatic/commons/compile-controls.js +5 -3
- package/lib/use-lunatic/commons/compile-controls.js.map +1 -1
- package/lib/use-lunatic/commons/create-map-pages.d.ts +2 -2
- package/lib/use-lunatic/commons/create-map-pages.js.map +1 -1
- package/lib/use-lunatic/commons/execute-condition-filter.d.ts +2 -2
- package/lib/use-lunatic/commons/execute-condition-filter.js +3 -4
- package/lib/use-lunatic/commons/execute-condition-filter.js.map +1 -1
- package/lib/use-lunatic/commons/fill-components/fill-component-expressions.d.ts +614 -6
- package/lib/use-lunatic/commons/fill-components/fill-component-expressions.js +6 -13
- package/lib/use-lunatic/commons/fill-components/fill-component-expressions.js.map +1 -1
- package/lib/use-lunatic/commons/fill-components/fill-component-expressions.spec.js +1 -1
- package/lib/use-lunatic/commons/fill-components/fill-component-expressions.spec.js.map +1 -1
- package/lib/use-lunatic/commons/fill-components/fill-components.d.ts +19 -17
- package/lib/use-lunatic/commons/fill-components/fill-components.js +29 -29
- package/lib/use-lunatic/commons/fill-components/fill-components.js.map +1 -1
- package/lib/use-lunatic/commons/get-components-from-state.d.ts +2 -3
- package/lib/use-lunatic/commons/get-components-from-state.js +1 -2
- package/lib/use-lunatic/commons/get-components-from-state.js.map +1 -1
- package/lib/use-lunatic/commons/index.d.ts +0 -3
- package/lib/use-lunatic/commons/index.js +0 -3
- package/lib/use-lunatic/commons/index.js.map +1 -1
- package/lib/use-lunatic/commons/page.d.ts +2 -2
- package/lib/use-lunatic/commons/page.js +2 -1
- package/lib/use-lunatic/commons/page.js.map +1 -1
- package/lib/use-lunatic/hooks/use-loop-variables.d.ts +2 -2
- package/lib/use-lunatic/hooks/use-loop-variables.js.map +1 -1
- package/lib/use-lunatic/hooks/use-page-has-response.d.ts +2 -2
- package/lib/use-lunatic/hooks/use-page-has-response.js.map +1 -1
- package/lib/use-lunatic/hooks/useOverview.d.ts +2 -2
- package/lib/use-lunatic/hooks/useOverview.js.map +1 -1
- package/lib/use-lunatic/props/propComponentType.d.ts +9 -0
- package/lib/use-lunatic/{commons/fill-components/fill-specific-expression.js → props/propComponentType.js} +21 -27
- package/lib/use-lunatic/props/propComponentType.js.map +1 -0
- package/lib/use-lunatic/props/propIterations.d.ts +7 -0
- package/lib/use-lunatic/props/propIterations.js +26 -0
- package/lib/use-lunatic/props/propIterations.js.map +1 -0
- package/lib/use-lunatic/props/propMissingResponse.d.ts +9 -0
- package/lib/use-lunatic/props/propMissingResponse.js +13 -0
- package/lib/use-lunatic/props/propMissingResponse.js.map +1 -0
- package/lib/use-lunatic/props/propValue.d.ts +6 -0
- package/lib/use-lunatic/props/propValue.js +28 -0
- package/lib/use-lunatic/props/propValue.js.map +1 -0
- package/lib/use-lunatic/{commons/fill-components/fill-component-value.spec.js → props/propValue.spec.js} +6 -6
- package/lib/use-lunatic/props/propValue.spec.js.map +1 -0
- package/lib/use-lunatic/reducer/commons/auto-explore-loop.d.ts +2 -2
- package/lib/use-lunatic/reducer/commons/auto-explore-loop.js.map +1 -1
- package/lib/use-lunatic/reducer/commons/validate-condition-filter.d.ts +2 -2
- package/lib/use-lunatic/reducer/commons/validate-condition-filter.js.map +1 -1
- package/lib/use-lunatic/reducer/controls/check-base-control.d.ts +2 -2
- package/lib/use-lunatic/reducer/controls/check-base-control.js.map +1 -1
- package/lib/use-lunatic/reducer/controls/check-roundabout-control.d.ts +2 -2
- package/lib/use-lunatic/reducer/controls/check-roundabout-control.js.map +1 -1
- package/lib/use-lunatic/reducer/overview/overviewOnInit.d.ts +4 -105
- package/lib/use-lunatic/reducer/overview/overviewOnInit.js +1 -12
- package/lib/use-lunatic/reducer/overview/overviewOnInit.js.map +1 -1
- package/lib/use-lunatic/reducer/reduce-go-next-page.d.ts +2 -2
- package/lib/use-lunatic/reducer/reduce-go-next-page.js.map +1 -1
- package/lib/use-lunatic/reducer/reduce-go-previous-page.d.ts +2 -3
- package/lib/use-lunatic/reducer/reduce-go-previous-page.js +1 -2
- package/lib/use-lunatic/reducer/reduce-go-previous-page.js.map +1 -1
- package/lib/use-lunatic/reducer/reduce-go-to-page.d.ts +2 -3
- package/lib/use-lunatic/reducer/reduce-go-to-page.js +1 -2
- package/lib/use-lunatic/reducer/reduce-go-to-page.js.map +1 -1
- package/lib/use-lunatic/reducer/reduce-handle-change.d.ts +2 -2
- package/lib/use-lunatic/reducer/reduce-handle-change.js.map +1 -1
- package/lib/use-lunatic/reducer/reducer.d.ts +2 -3
- package/lib/use-lunatic/reducer/reducer.js +3 -10
- package/lib/use-lunatic/reducer/reducer.js.map +1 -1
- package/lib/use-lunatic/reducer/reducerInitializer.d.ts +10 -0
- package/lib/use-lunatic/reducer/{reduce-on-init.js → reducerInitializer.js} +70 -72
- package/lib/use-lunatic/reducer/reducerInitializer.js.map +1 -0
- package/lib/use-lunatic/type.d.ts +77 -49
- package/lib/use-lunatic/use-lunatic.d.ts +23 -69
- package/lib/use-lunatic/use-lunatic.js +69 -74
- package/lib/use-lunatic/use-lunatic.js.map +1 -1
- package/lib/utils/object.d.ts +1 -0
- package/lib/utils/object.js +6 -0
- package/lib/utils/object.js.map +1 -1
- package/package.json +2 -1
- package/lib/stories/behaviour/cleaning/source-loop.json +0 -130
- package/lib/stories/behaviour/resizing/source-resizing-cleaning.json +0 -171
- package/lib/stories/overview/dataLoop.json +0 -189
- package/lib/stories/overview/source.json +0 -28
- package/lib/stories/overview/sourceLoop.json +0 -1423
- package/lib/stories/questionnaires/logement/source.json +0 -31762
- package/lib/stories/questionnaires2023/simpsons/source.json +0 -4728
- package/lib/use-lunatic/commons/fill-components/fill-component-required.d.ts +0 -442
- package/lib/use-lunatic/commons/fill-components/fill-component-required.js +0 -13
- package/lib/use-lunatic/commons/fill-components/fill-component-required.js.map +0 -1
- package/lib/use-lunatic/commons/fill-components/fill-component-value.d.ts +0 -5
- package/lib/use-lunatic/commons/fill-components/fill-component-value.js +0 -34
- package/lib/use-lunatic/commons/fill-components/fill-component-value.js.map +0 -1
- package/lib/use-lunatic/commons/fill-components/fill-component-value.spec.js.map +0 -1
- package/lib/use-lunatic/commons/fill-components/fill-from-state.d.ts +0 -770
- package/lib/use-lunatic/commons/fill-components/fill-from-state.js +0 -18
- package/lib/use-lunatic/commons/fill-components/fill-from-state.js.map +0 -1
- package/lib/use-lunatic/commons/fill-components/fill-iterations.d.ts +0 -124
- package/lib/use-lunatic/commons/fill-components/fill-iterations.js +0 -36
- package/lib/use-lunatic/commons/fill-components/fill-iterations.js.map +0 -1
- package/lib/use-lunatic/commons/fill-components/fill-management.d.ts +0 -6
- package/lib/use-lunatic/commons/fill-components/fill-management.js +0 -9
- package/lib/use-lunatic/commons/fill-components/fill-management.js.map +0 -1
- package/lib/use-lunatic/commons/fill-components/fill-missing-response.d.ts +0 -12
- package/lib/use-lunatic/commons/fill-components/fill-missing-response.js +0 -20
- package/lib/use-lunatic/commons/fill-components/fill-missing-response.js.map +0 -1
- package/lib/use-lunatic/commons/fill-components/fill-pagination.d.ts +0 -9
- package/lib/use-lunatic/commons/fill-components/fill-pagination.js +0 -10
- package/lib/use-lunatic/commons/fill-components/fill-pagination.js.map +0 -1
- package/lib/use-lunatic/commons/fill-components/fill-specific-expression.d.ts +0 -1268
- package/lib/use-lunatic/commons/fill-components/fill-specific-expression.js.map +0 -1
- package/lib/use-lunatic/commons/fill-components/index.d.ts +0 -1
- package/lib/use-lunatic/commons/fill-components/index.js +0 -2
- package/lib/use-lunatic/commons/fill-components/index.js.map +0 -1
- package/lib/use-lunatic/commons/use-components-from-state.d.ts +0 -4
- package/lib/use-lunatic/commons/use-components-from-state.js +0 -15
- package/lib/use-lunatic/commons/use-components-from-state.js.map +0 -1
- package/lib/use-lunatic/initial-state.d.ts +0 -3
- package/lib/use-lunatic/initial-state.js +0 -39
- package/lib/use-lunatic/initial-state.js.map +0 -1
- package/lib/use-lunatic/reducer/index.d.ts +0 -1
- package/lib/use-lunatic/reducer/index.js +0 -2
- package/lib/use-lunatic/reducer/index.js.map +0 -1
- package/lib/use-lunatic/reducer/reduce-on-init.d.ts +0 -4
- package/lib/use-lunatic/reducer/reduce-on-init.js.map +0 -1
- package/lib/use-lunatic/reducer/reduce-on-set-waiting.d.ts +0 -4
- package/lib/use-lunatic/reducer/reduce-on-set-waiting.js +0 -8
- package/lib/use-lunatic/reducer/reduce-on-set-waiting.js.map +0 -1
- package/lib/use-lunatic/use-lunatic.test.d.ts +0 -1
- package/lib/use-lunatic/use-lunatic.test.js +0 -280
- package/lib/use-lunatic/use-lunatic.test.js.map +0 -1
- /package/lib/use-lunatic/{commons/fill-components/fill-component-value.spec.d.ts → props/propValue.spec.d.ts} +0 -0
package/lib/components/type.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CSSProperties, FunctionComponent, ReactNode } from 'react';
|
|
2
2
|
import useLunatic from '../use-lunatic';
|
|
3
|
-
import type { LunaticComponentDefinition, LunaticError, LunaticState } from '../use-lunatic/type';
|
|
3
|
+
import type { LunaticComponentDefinition, LunaticError, LunaticOptions, LunaticReducerState, LunaticState } from '../use-lunatic/type';
|
|
4
4
|
type Formats = 'PTnHnM' | 'PnYnM';
|
|
5
5
|
export type VtlExpression = {
|
|
6
6
|
value: string;
|
|
@@ -14,7 +14,7 @@ export type LunaticBaseProps<ValueType = unknown> = {
|
|
|
14
14
|
errors?: {
|
|
15
15
|
[id: string]: LunaticError[];
|
|
16
16
|
};
|
|
17
|
-
preferences?:
|
|
17
|
+
preferences?: LunaticOptions['preferences'];
|
|
18
18
|
label?: ReactNode;
|
|
19
19
|
disabled?: boolean;
|
|
20
20
|
missing?: unknown;
|
|
@@ -22,7 +22,7 @@ export type LunaticBaseProps<ValueType = unknown> = {
|
|
|
22
22
|
name: string;
|
|
23
23
|
value?: unknown;
|
|
24
24
|
};
|
|
25
|
-
management?:
|
|
25
|
+
management?: LunaticOptions['management'];
|
|
26
26
|
description?: ReactNode;
|
|
27
27
|
shortcut?: boolean;
|
|
28
28
|
required?: boolean;
|
|
@@ -97,7 +97,7 @@ export type ComponentPropsByType = {
|
|
|
97
97
|
};
|
|
98
98
|
iterations: number;
|
|
99
99
|
getComponents: (n: number) => LunaticComponentProps[];
|
|
100
|
-
executeExpression:
|
|
100
|
+
executeExpression: LunaticReducerState['executeExpression'];
|
|
101
101
|
value: Record<string, unknown[]>;
|
|
102
102
|
header?: Array<{
|
|
103
103
|
label: ReactNode;
|
|
@@ -114,7 +114,7 @@ export type ComponentPropsByType = {
|
|
|
114
114
|
};
|
|
115
115
|
iterations: number;
|
|
116
116
|
getComponents: (n: number) => LunaticComponentProps[];
|
|
117
|
-
executeExpression:
|
|
117
|
+
executeExpression: LunaticReducerState['executeExpression'];
|
|
118
118
|
value: Record<string, unknown[]>;
|
|
119
119
|
header?: Array<{
|
|
120
120
|
label: ReactNode;
|
|
@@ -133,7 +133,7 @@ export type ComponentPropsByType = {
|
|
|
133
133
|
colspan?: number;
|
|
134
134
|
rowspan?: number;
|
|
135
135
|
})[][];
|
|
136
|
-
executeExpression:
|
|
136
|
+
executeExpression: LunaticReducerState['executeExpression'];
|
|
137
137
|
iteration: LunaticState['pager']['iteration'];
|
|
138
138
|
componentType?: 'Table';
|
|
139
139
|
};
|
|
@@ -238,8 +238,8 @@ export type ComponentPropsByType = {
|
|
|
238
238
|
};
|
|
239
239
|
PairwiseLinks: Omit<LunaticBaseProps, 'value'> & {
|
|
240
240
|
components: LunaticComponentDefinition[];
|
|
241
|
-
features?:
|
|
242
|
-
executeExpression:
|
|
241
|
+
features?: LunaticOptions['features'];
|
|
242
|
+
executeExpression: LunaticReducerState['executeExpression'];
|
|
243
243
|
xAxisIterations: number;
|
|
244
244
|
yAxisIterations: number;
|
|
245
245
|
symLinks: Record<string, Record<string, string>>;
|
|
@@ -275,12 +275,12 @@ export type ComponentPropsByType = {
|
|
|
275
275
|
};
|
|
276
276
|
arbitraryValue?: string;
|
|
277
277
|
allowArbitrary?: boolean;
|
|
278
|
-
executeExpression:
|
|
278
|
+
executeExpression: LunaticReducerState['executeExpression'];
|
|
279
279
|
iteration: LunaticState['pager']['iteration'];
|
|
280
280
|
};
|
|
281
281
|
Summary: LunaticBaseProps<string | null> & {
|
|
282
282
|
componentType?: 'Summary';
|
|
283
|
-
executeExpression:
|
|
283
|
+
executeExpression: LunaticReducerState['executeExpression'];
|
|
284
284
|
sections: Array<{
|
|
285
285
|
id: string;
|
|
286
286
|
responses?: Array<{
|
package/lib/index.d.ts
CHANGED
|
@@ -7,7 +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 { default as useLunatic } from './use-lunatic';
|
|
10
|
-
export type { LunaticComponentDefinition, LunaticControl, LunaticData, LunaticValues, LunaticError, LunaticExpression, LunaticVariable, LunaticCollectedValue, LunaticStateVariable, LunaticState, } from './use-lunatic/type';
|
|
10
|
+
export type { LunaticComponentDefinition, LunaticControl, LunaticData, LunaticValues, LunaticError, LunaticExpression, LunaticVariable, LunaticCollectedValue, LunaticStateVariable, LunaticState, LunaticPager, } from './use-lunatic/type';
|
|
11
11
|
export type { LunaticComponentProps } from './components/type';
|
|
12
12
|
export type { LunaticSlotComponents } from './components/shared/HOC/slottableComponent';
|
|
13
13
|
export type { LunaticSource } from './use-lunatic/type-source';
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { LunaticSource } from './type-source';
|
|
1
|
+
import type { LunaticState, PageTag } from './type';
|
|
3
2
|
export declare enum ActionKind {
|
|
4
3
|
GO_PREVIOUS_PAGE = "use-lunatic/go-previous",
|
|
5
4
|
GO_NEXT_PAGE = "use-lunatic/go-next",
|
|
6
5
|
GO_TO_PAGE = "use-lunatic/go-to-page",
|
|
7
|
-
|
|
8
|
-
HANDLE_CHANGE = "use-lunatic/handle-change",
|
|
9
|
-
ON_SET_WAITING = "use-lunatic/on-set-waiting"
|
|
6
|
+
HANDLE_CHANGE = "use-lunatic/handle-change"
|
|
10
7
|
}
|
|
11
8
|
export type ActionHandleChange = {
|
|
12
9
|
type: ActionKind.HANDLE_CHANGE;
|
|
@@ -20,32 +17,6 @@ export type ActionGoToPage = {
|
|
|
20
17
|
type: ActionKind.GO_TO_PAGE;
|
|
21
18
|
payload: Parameters<LunaticState['goToPage']>[0];
|
|
22
19
|
};
|
|
23
|
-
export type ActionInit = {
|
|
24
|
-
type: ActionKind.ON_INIT;
|
|
25
|
-
payload: {
|
|
26
|
-
data: LunaticData;
|
|
27
|
-
source: LunaticSource;
|
|
28
|
-
initialPage: PageTag;
|
|
29
|
-
lastReachedPage?: PageTag;
|
|
30
|
-
features: LunaticState['features'];
|
|
31
|
-
preferences: LunaticState['preferences'];
|
|
32
|
-
savingType: LunaticState['savingType'];
|
|
33
|
-
shortcut: boolean;
|
|
34
|
-
management: boolean;
|
|
35
|
-
handleChange: LunaticState['handleChange'];
|
|
36
|
-
activeControls: boolean;
|
|
37
|
-
goToPage: (params: ActionGoToPage['payload']) => void;
|
|
38
|
-
goNextPage: () => void;
|
|
39
|
-
goPreviousPage: () => void;
|
|
40
|
-
withOverview: boolean;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
export type ActionOnSetWaiting = {
|
|
44
|
-
type: ActionKind.ON_SET_WAITING;
|
|
45
|
-
payload: {
|
|
46
|
-
status: boolean;
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
20
|
export type ActionGoNextPage = {
|
|
50
21
|
type: ActionKind.GO_NEXT_PAGE;
|
|
51
22
|
payload: {};
|
|
@@ -54,7 +25,7 @@ export type ActionGoPreviousPage = {
|
|
|
54
25
|
type: ActionKind.GO_PREVIOUS_PAGE;
|
|
55
26
|
payload: {};
|
|
56
27
|
};
|
|
57
|
-
export type Action = ActionGoNextPage | ActionGoPreviousPage | ActionGoToPage |
|
|
28
|
+
export type Action = ActionGoNextPage | ActionGoPreviousPage | ActionGoToPage | ActionHandleChange;
|
|
58
29
|
export type PayloadForAction<T extends Action['type']> = (Action & {
|
|
59
30
|
type: T;
|
|
60
31
|
})['payload'];
|
|
@@ -73,24 +44,4 @@ export declare const goToPage: (payload: {
|
|
|
73
44
|
}) => ActionGoToPage & {
|
|
74
45
|
type: ActionKind.GO_TO_PAGE;
|
|
75
46
|
};
|
|
76
|
-
export declare const onInit: (payload: {
|
|
77
|
-
data: LunaticData;
|
|
78
|
-
source: LunaticSource;
|
|
79
|
-
initialPage: PageTag;
|
|
80
|
-
lastReachedPage?: PageTag | undefined;
|
|
81
|
-
features: LunaticState['features'];
|
|
82
|
-
preferences: LunaticState['preferences'];
|
|
83
|
-
savingType: LunaticState['savingType'];
|
|
84
|
-
shortcut: boolean;
|
|
85
|
-
management: boolean;
|
|
86
|
-
handleChange: LunaticState['handleChange'];
|
|
87
|
-
activeControls: boolean;
|
|
88
|
-
goToPage: (params: ActionGoToPage['payload']) => void;
|
|
89
|
-
goNextPage: () => void;
|
|
90
|
-
goPreviousPage: () => void;
|
|
91
|
-
withOverview: boolean;
|
|
92
|
-
}) => ActionInit & {
|
|
93
|
-
type: ActionKind.ON_INIT;
|
|
94
|
-
};
|
|
95
47
|
export declare const handleChange: (name: ActionHandleChange['payload']['name'], value: ActionHandleChange['payload']['value'], iteration: ActionHandleChange['payload']['iteration']) => Action;
|
|
96
|
-
export declare const onSetWaiting: (status: boolean) => Action;
|
|
@@ -3,9 +3,7 @@ export var ActionKind;
|
|
|
3
3
|
ActionKind["GO_PREVIOUS_PAGE"] = "use-lunatic/go-previous";
|
|
4
4
|
ActionKind["GO_NEXT_PAGE"] = "use-lunatic/go-next";
|
|
5
5
|
ActionKind["GO_TO_PAGE"] = "use-lunatic/go-to-page";
|
|
6
|
-
ActionKind["ON_INIT"] = "use-lunatic/on-init";
|
|
7
6
|
ActionKind["HANDLE_CHANGE"] = "use-lunatic/handle-change";
|
|
8
|
-
ActionKind["ON_SET_WAITING"] = "use-lunatic/on-set-waiting";
|
|
9
7
|
})(ActionKind || (ActionKind = {}));
|
|
10
8
|
const actionCreator = (type) => (payload) => {
|
|
11
9
|
return {
|
|
@@ -19,13 +17,8 @@ export const goPreviousPage = () => ({
|
|
|
19
17
|
});
|
|
20
18
|
export const goNextPage = actionCreator(ActionKind.GO_NEXT_PAGE);
|
|
21
19
|
export const goToPage = actionCreator(ActionKind.GO_TO_PAGE);
|
|
22
|
-
export const onInit = actionCreator(ActionKind.ON_INIT);
|
|
23
20
|
export const handleChange = (name, value, iteration) => ({
|
|
24
21
|
type: ActionKind.HANDLE_CHANGE,
|
|
25
22
|
payload: { name, value, iteration },
|
|
26
23
|
});
|
|
27
|
-
export const onSetWaiting = (status) => ({
|
|
28
|
-
type: ActionKind.ON_SET_WAITING,
|
|
29
|
-
payload: { status },
|
|
30
|
-
});
|
|
31
24
|
//# sourceMappingURL=actions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../src/use-lunatic/actions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../src/use-lunatic/actions.ts"],"names":[],"mappings":"AAQA,MAAM,CAAN,IAAY,UAKX;AALD,WAAY,UAAU;IACrB,0DAA4C,CAAA;IAC5C,kDAAoC,CAAA;IACpC,mDAAqC,CAAA;IACrC,yDAA2C,CAAA;AAC5C,CAAC,EALW,UAAU,KAAV,UAAU,QAKrB;AAoCD,MAAM,aAAa,GAClB,CAAuB,IAAO,EAAE,EAAE,CAClC,CAAC,OAA0C,EAAE,EAAE;IAC9C,OAAO;QACN,IAAI;QACJ,OAAO;KACiB,CAAC;AAC3B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE,CAClC,CAAC;IACA,IAAI,EAAE,UAAU,CAAC,gBAAgB;IACjC,OAAO,EAAE,EAAE;CACX,CAAU,CAAC;AAEb,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;AACjE,MAAM,CAAC,MAAM,QAAQ,GAAG,aAAa,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;AAC7D,MAAM,CAAC,MAAM,YAAY,GAAG,CAC3B,IAA2C,EAC3C,KAA6C,EAC7C,SAAqD,EAC5C,EAAE,CACX,CAAC;IACA,IAAI,EAAE,UAAU,CAAC,aAAa;IAC9B,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE;CACnC,CAAU,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
declare function checkLoops(pages:
|
|
1
|
+
import type { LunaticReducerState } from '../type';
|
|
2
|
+
declare function checkLoops(pages: LunaticReducerState['pages']): {};
|
|
3
3
|
export default checkLoops;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-loops.js","sourceRoot":"","sources":["../../../src/use-lunatic/commons/check-loops.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,qBAAqB,CAAC;AAClD,OAAO,YAAY,MAAM,iBAAiB,CAAC;
|
|
1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gB,EAAE,gBAAgB,IAAI,SAAS;aAC/C,CAAC;QACH,CAAC;QACD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;IACrD,CAAC,EACD;QACC,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,SAAS;QACnB,UAAU,EAAE,SAAS;QACrB,gBAAgB,EAAE,SAAS;QAC3B,UAAU,EAAE,SAAS;KAOrB,CACD,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,KAAmC;IACtD,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,UAAU,GAAG,EAAE,OAAO;QACzD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;QAClC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAC1B,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;YAC/B,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,gBAAgB,EAAE,GACvD,WAAW,CAAC,UAAU,CAAC,CAAC;YAEzB,OAAO;gBACN,GAAG,GAAG;gBACN,CAAC,MAAM,CAAC,EAAE;oBACT,GAAG,OAAO;oBACV,MAAM;oBACN,QAAQ;oBACR,UAAU;oBACV,gBAAgB;iBAChB;aACD,CAAC;QACH,CAAC;QACD,OAAO,GAAG,CAAC;IACZ,CAAC,EAAE,EAAE,CAAC,CAAC;AACR,CAAC;AAED,eAAe,UAAU,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { LunaticError,
|
|
2
|
-
export type StateForControls = Pick<
|
|
1
|
+
import type { LunaticError, LunaticReducerState } from '../type';
|
|
2
|
+
export type StateForControls = Pick<LunaticReducerState, 'pager' | 'pages' | 'isInLoop' | 'executeExpression'>;
|
|
3
3
|
/**
|
|
4
4
|
* Check controls for currently visible components and output errors
|
|
5
5
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { replaceComponentSequence } from '../replace-component-sequence';
|
|
2
|
-
import fillComponentExpressions from './fill-components/fill-component-expressions';
|
|
3
|
-
import getComponentsFromState from './get-components-from-state';
|
|
2
|
+
import { fillComponentExpressions, } from './fill-components/fill-component-expressions';
|
|
4
3
|
import { checkRoundaboutControl } from '../reducer/controls/check-roundabout-control';
|
|
5
4
|
import { checkBaseControl } from '../reducer/controls/check-base-control';
|
|
5
|
+
import { getComponentsFromState } from './get-components-from-state';
|
|
6
6
|
const isLoopComponent = (component) => {
|
|
7
7
|
return ['Loop', 'RosterForLoop'].includes(component.componentType);
|
|
8
8
|
};
|
|
@@ -88,7 +88,9 @@ function checkComponentInLoop(state, component, errors) {
|
|
|
88
88
|
// The component is filtered on this iteration, skip it
|
|
89
89
|
if (
|
|
90
90
|
// conditionFilter can be the interpreted expression, or the object representing the expression
|
|
91
|
-
(
|
|
91
|
+
(component.conditionFilter &&
|
|
92
|
+
typeof component.conditionFilter == 'object' &&
|
|
93
|
+
'value' in component.conditionFilter &&
|
|
92
94
|
!state.executeExpression(component.conditionFilter.value, iterationPager)) ||
|
|
93
95
|
component.conditionFilter === false) {
|
|
94
96
|
continue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile-controls.js","sourceRoot":"","sources":["../../../src/use-lunatic/commons/compile-controls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"compile-controls.js","sourceRoot":"","sources":["../../../src/use-lunatic/commons/compile-controls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAQzE,OAAO,EACN,wBAAwB,GAExB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6B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AAE,CAAC;QACb,OAAO,KAAK,CAAC;IACd,CAAC;IACD,mDAAmD;IACnD,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;SACzC,IAAI,EAAE;SACN,IAAI,CACJ,CAAC,KAAK,EAAE,EAAE,CACT,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC;QACrC,KAAK,CAAC,aAAa,KAAK,QAAQ,CACjC,CAAC;IACH,OAAO,aAAa,KAAK,SAAS,CAAC;AACpC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,KAAuB;IACtD,MAAM,UAAU,GAAG,wBAAwB,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3E,MAAM,iBAAiB,GAAG,UAAU;SAClC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,wBAAwB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;SAC9D,MAAM,CAAC,CAAC,EAAE,eAAe,EAAE,EAAE,EAAE;QAC/B,OAAO,eAAe,IAAI,IAAI,CAAC;IAChC,CAAC,CAAC,CAAC;IACJ,IAAI,MAAM,GAAG,eAAe,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;IACvD,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1E,OAAO;QACN,aAAa;QACb,UAAU,EAAE,gBAAgB,CAAC,aAAa,CAAC;KAC3C,CAAC;AACH,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LunaticReducerState } from '../type';
|
|
2
2
|
import type { LunaticSource } from '../type-source';
|
|
3
3
|
/**
|
|
4
4
|
* Extract pages from questionnaire
|
|
5
5
|
*/
|
|
6
|
-
declare function createPages(questionnaire: LunaticSource):
|
|
6
|
+
declare function createPages(questionnaire: LunaticSource): LunaticReducerState['pages'];
|
|
7
7
|
export default createPages;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-map-pages.js","sourceRoot":"","sources":["../../../src/use-lunatic/commons/create-map-pages.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,qBAAqB,CAAC;AAClD,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAI3C,SAAS,aAAa,CAAC,aAAoC;IAC1D,MAAM,EAAE,OAAO,EAAE,GAAG,aAAa,CAAC;IAClC,OAAO,OAAO,KAAK,SAAS,CAAC;AAC9B,CAAC;AAED;;GAEG;AACH,SAAS,cAAc,CACtB,SAAqC,EACrC,IAAY,EACZ,
|
|
1
|
+
{"version":3,"file":"create-map-pages.js","sourceRoot":"","sources":["../../../src/use-lunatic/commons/create-map-pages.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,qBAAqB,CAAC;AAClD,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAI3C,SAAS,aAAa,CAAC,aAAoC;IAC1D,MAAM,EAAE,OAAO,EAAE,GAAG,aAAa,CAAC;IAClC,OAAO,OAAO,KAAK,SAAS,CAAC;AAC9B,CAAC;AAED;;GAEG;AACH,SAAS,cAAc,CACtB,SAAqC,EACrC,IAAY,EACZ,GAAiC;IAEjC,IAAI,CAAC,IAAI,EAAE,CAAC;QACX,IAAI,GAAG,SAAS,CAAC;IAClB,CAAC;IACD,IAAI,IAAI,IAAI,GAAG,EAAE,CAAC;QACjB,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;QAC1B,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;QAC/B,OAAO;YACN,GAAG,GAAG;YACN,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,CAAC,GAAG,UAAU,EAAE,SAAS,CAAC,EAAE;SAC9D,CAAC;IACH,CAAC;IACD,OAAO;QACN,GAAG,GAAG;QACN,CAAC,IAAI,CAAC,EAAE,EAAE,UAAU,EAAE,CAAC,SAAS,CAAC,EAAE;KACH,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,SAAS,qBAAqB,CAC7B,UAAwC,EACxC,GAAiC;IAEjC,OAAO,UAAU,CAAC,MAAM,CAAC,UAAU,OAAO,EAAE,SAAS;QACpD,MAAM,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC;QAC3B,IAAI,IAAI,EAAE,CAAC;YACV,OAAO,cAAc,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QACjD,CAAC;QAED,OAAO,OAAO,CAAC;IAChB,CAAC,EAAE,GAAG,CAAC,CAAC;AACT,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CACnB,aAA4B;IAE5B,MAAM,EAAE,UAAU,EAAE,GAAG,aAAa,CAAC;IACrC,yDAAyD;IACzD,IAAI,aAAa,CAAC,aAAa,CAAC,EAAE,CAAC;QAClC,OAAO,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;IAC3D,CAAC;IACD,OAAO,UAAU,CAAC,MAAM,CACvB,UAAU,OAAO,EAAE,SAAS;QAC3B,IAAI,eAAe,CAAC,SAAS,CAAC,IAAI,YAAY,CAAC,SAAS,CAAC,EAAE,CAAC;YAC3D,OAAO,cAAc,CACpB,SAAS,EACT,SAAS,CAAC,IAAI,EACd,qBAAqB,CAAC,SAAS,CAAC,UAAU,EAAE,OAAO,CAAC,CACpD,CAAC;QACH,CAAC;QAED,OAAO,cAAc,CAAC,SAAS,EAAE,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC,EACD,EAAkC,CAClC,CAAC;AACH,CAAC;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { LunaticExpression,
|
|
2
|
-
declare function executeConditionFilter(filter: LunaticExpression, execute:
|
|
1
|
+
import type { LunaticExpression, LunaticReducerState } from '../type';
|
|
2
|
+
declare function executeConditionFilter(filter: LunaticExpression, execute: LunaticReducerState['executeExpression'], iteration?: number): any;
|
|
3
3
|
export default executeConditionFilter;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import getCompatibleVTLExpression from './get-compatible-vtl-expression';
|
|
2
1
|
import { firstValueItem } from '../../utils/array';
|
|
2
|
+
import { getExpressionAsString } from '../../utils/vtl';
|
|
3
3
|
function executeConditionFilter(filter, execute, iteration) {
|
|
4
4
|
if (filter && typeof execute === 'function') {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
// Todo : replace this with a casting system on execute
|
|
5
|
+
const result = execute(getExpressionAsString(filter.value), { iteration });
|
|
6
|
+
// Handle some edge cases where the value is not what we expect
|
|
8
7
|
return Array.isArray(result) ? firstValueItem(result) : result;
|
|
9
8
|
}
|
|
10
9
|
return undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute-condition-filter.js","sourceRoot":"","sources":["../../../src/use-lunatic/commons/execute-condition-filter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"execute-condition-filter.js","sourceRoot":"","sources":["../../../src/use-lunatic/commons/execute-condition-filter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,SAAS,sBAAsB,CAC9B,MAAyB,EACzB,OAAiD,EACjD,SAAkB;IAElB,IAAI,MAAM,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;QAC7C,MAAM,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;QAC3E,+DAA+D;QAC/D,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAChE,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,eAAe,sBAAsB,CAAC"}
|