@inseefr/lunatic 2.7.19 → 2.7.20-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/lib/components/commons/components/errors/errors.spec.js +6 -7
- package/lib/components/declarations/declarations-after-text.js +2 -1
- package/lib/components/declarations/declarations-before-text.js +2 -1
- package/lib/components/declarations/declarations-detachable.js +2 -1
- package/lib/components/index.js +7 -0
- package/lib/components/modal-controls/modal-controls.spec.js +8 -9
- package/lib/components/question/Question.js +49 -0
- package/lib/components/question/index.js +16 -0
- package/lib/index.js +8 -2
- package/lib/src/components/declarations/declarations-after-text.d.ts +3 -2
- package/lib/src/components/declarations/declarations-before-text.d.ts +3 -2
- package/lib/src/components/declarations/declarations-detachable.d.ts +3 -2
- package/lib/src/components/index.d.ts +1 -0
- package/lib/src/components/question/Question.d.ts +7 -0
- package/lib/src/components/question/index.d.ts +1 -0
- package/lib/src/components/type.d.ts +5 -1
- package/lib/src/index.d.ts +1 -0
- package/lib/src/use-lunatic/commons/fill-components/fill-component-required.d.ts +40 -20
- package/lib/src/use-lunatic/commons/fill-components/fill-from-state.d.ts +38 -0
- package/lib/src/use-lunatic/commons/fill-components/fill-iterations.d.ts +24 -18
- package/lib/src/use-lunatic/commons/fill-components/fill-specific-expression.d.ts +54 -4
- package/lib/src/use-lunatic/commons/use-components-from-state.d.ts +1 -1
- package/lib/src/use-lunatic/replace-component-sequence.d.ts +5 -1
- package/lib/src/use-lunatic/type-source.d.ts +24 -19
- package/lib/src/use-lunatic/use-lunatic.d.ts +11 -3
- package/lib/stories/behaviour/others/V2_QuestSimple_Boucles.json +4 -1
- package/lib/stories/question/question.stories.js +32 -0
- package/lib/stories/question/source.json +220 -0
- package/lib/use-lunatic/commons/compile-controls.js +4 -5
- package/lib/use-lunatic/commons/fill-components/fill-specific-expression.js +1 -0
- package/lib/use-lunatic/commons/variables/behaviours/resizing-behaviour.js +10 -5
- package/lib/use-lunatic/commons/variables/lunatic-variables-store.spec.js +43 -0
- package/lib/use-lunatic/replace-component-sequence.js +6 -3
- package/lib/use-lunatic/type-source.js +1 -22
- package/package.json +2 -9
|
@@ -31,7 +31,7 @@ declare function fillSpecificExpressions(component: DeepTranslateExpression<Luna
|
|
|
31
31
|
iterations: import("react").ReactNode;
|
|
32
32
|
locked: boolean;
|
|
33
33
|
} | {
|
|
34
|
-
components: import("./fill-components").FilledLunaticComponentProps<"CheckboxOne" | "ConfirmationModal" | "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxBoolean" | "Radio" | "FilterDescription" | "Dropdown" | "PairwiseLinks" | "Roundabout" | "Suggester" | "Input" | "Textarea" | "ComponentSet" | "QuestionExplication">[];
|
|
34
|
+
components: import("./fill-components").FilledLunaticComponentProps<"CheckboxOne" | "ConfirmationModal" | "Question" | "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxBoolean" | "Radio" | "FilterDescription" | "Dropdown" | "PairwiseLinks" | "Roundabout" | "Suggester" | "Input" | "Textarea" | "ComponentSet" | "QuestionExplication">[];
|
|
35
35
|
label: import("react").ReactNode;
|
|
36
36
|
declarations?: import("../../type-source").DeclarationType[] | undefined;
|
|
37
37
|
conditionFilter?: import("react").ReactNode;
|
|
@@ -54,7 +54,31 @@ declare function fillSpecificExpressions(component: DeepTranslateExpression<Luna
|
|
|
54
54
|
page: string;
|
|
55
55
|
componentType: "ComponentSet";
|
|
56
56
|
} | {
|
|
57
|
-
|
|
57
|
+
components: import("./fill-components").FilledLunaticComponentProps<"CheckboxOne" | "ConfirmationModal" | "Question" | "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxBoolean" | "Radio" | "FilterDescription" | "Dropdown" | "PairwiseLinks" | "Roundabout" | "Suggester" | "Input" | "Textarea" | "ComponentSet" | "QuestionExplication">[];
|
|
58
|
+
label: import("react").ReactNode;
|
|
59
|
+
declarations?: import("../../type-source").DeclarationType[] | undefined;
|
|
60
|
+
conditionFilter?: import("react").ReactNode;
|
|
61
|
+
controls?: import("../../type-source").ControlType[] | undefined;
|
|
62
|
+
id: string;
|
|
63
|
+
bindingDependencies?: string[] | undefined;
|
|
64
|
+
hierarchy?: {
|
|
65
|
+
sequence: {
|
|
66
|
+
label: import("react").ReactNode;
|
|
67
|
+
id: string;
|
|
68
|
+
page: string;
|
|
69
|
+
};
|
|
70
|
+
subSequence?: {
|
|
71
|
+
label: import("react").ReactNode;
|
|
72
|
+
id: string;
|
|
73
|
+
page: string;
|
|
74
|
+
} | undefined;
|
|
75
|
+
} | undefined;
|
|
76
|
+
mandatory?: boolean | undefined;
|
|
77
|
+
page: string;
|
|
78
|
+
componentType: "Question";
|
|
79
|
+
description: import("react").ReactNode;
|
|
80
|
+
} | {
|
|
81
|
+
getComponents: (iteration: number) => import("./fill-components").FilledLunaticComponentProps<"CheckboxOne" | "ConfirmationModal" | "Question" | "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxBoolean" | "Radio" | "FilterDescription" | "Dropdown" | "PairwiseLinks" | "Roundabout" | "Suggester" | "Input" | "Textarea" | "ComponentSet" | "QuestionExplication">[];
|
|
58
82
|
label: import("react").ReactNode;
|
|
59
83
|
declarations?: import("../../type-source").DeclarationType[] | undefined;
|
|
60
84
|
conditionFilter?: import("react").ReactNode;
|
|
@@ -102,7 +126,7 @@ declare function fillSpecificExpressions(component: DeepTranslateExpression<Luna
|
|
|
102
126
|
positioning: "HORIZONTAL";
|
|
103
127
|
value?: Record<string, unknown[]> | undefined;
|
|
104
128
|
} | {
|
|
105
|
-
getComponents: (iteration: number) => import("./fill-components").FilledLunaticComponentProps<"CheckboxOne" | "ConfirmationModal" | "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxBoolean" | "Radio" | "FilterDescription" | "Dropdown" | "PairwiseLinks" | "Roundabout" | "Suggester" | "Input" | "Textarea" | "ComponentSet" | "QuestionExplication">[];
|
|
129
|
+
getComponents: (iteration: number) => import("./fill-components").FilledLunaticComponentProps<"CheckboxOne" | "ConfirmationModal" | "Question" | "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxBoolean" | "Radio" | "FilterDescription" | "Dropdown" | "PairwiseLinks" | "Roundabout" | "Suggester" | "Input" | "Textarea" | "ComponentSet" | "QuestionExplication">[];
|
|
106
130
|
label: import("react").ReactNode;
|
|
107
131
|
declarations?: import("../../type-source").DeclarationType[] | undefined;
|
|
108
132
|
conditionFilter?: import("react").ReactNode;
|
|
@@ -136,7 +160,7 @@ declare function fillSpecificExpressions(component: DeepTranslateExpression<Luna
|
|
|
136
160
|
paginatedLoop: boolean;
|
|
137
161
|
value?: Record<string, unknown[]> | undefined;
|
|
138
162
|
} | {
|
|
139
|
-
getComponents: (x: number, y: number) => import("./fill-components").FilledLunaticComponentProps<"CheckboxOne" | "ConfirmationModal" | "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxBoolean" | "Radio" | "FilterDescription" | "Dropdown" | "PairwiseLinks" | "Roundabout" | "Suggester" | "Input" | "Textarea" | "ComponentSet" | "QuestionExplication">[];
|
|
163
|
+
getComponents: (x: number, y: number) => import("./fill-components").FilledLunaticComponentProps<"CheckboxOne" | "ConfirmationModal" | "Question" | "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxBoolean" | "Radio" | "FilterDescription" | "Dropdown" | "PairwiseLinks" | "Roundabout" | "Suggester" | "Input" | "Textarea" | "ComponentSet" | "QuestionExplication">[];
|
|
140
164
|
label: import("react").ReactNode;
|
|
141
165
|
declarations?: import("../../type-source").DeclarationType[] | undefined;
|
|
142
166
|
conditionFilter?: import("react").ReactNode;
|
|
@@ -770,6 +794,32 @@ declare function fillSpecificExpressions(component: DeepTranslateExpression<Luna
|
|
|
770
794
|
bgColor?: string | undefined;
|
|
771
795
|
} & import("./fill-management").FilledProps & import("./fill-component-value").FilledProps & import("./fill-missing-response").FilledProps & import("./fill-from-state").FilledProps & import("./fill-pagination").FilledProps & {
|
|
772
796
|
conditionFilter?: boolean | undefined;
|
|
797
|
+
}) | ({
|
|
798
|
+
label: import("react").ReactNode;
|
|
799
|
+
declarations?: import("../../type-source").DeclarationType[] | undefined;
|
|
800
|
+
conditionFilter?: import("react").ReactNode;
|
|
801
|
+
controls?: import("../../type-source").ControlType[] | undefined;
|
|
802
|
+
id: string;
|
|
803
|
+
bindingDependencies?: string[] | undefined;
|
|
804
|
+
hierarchy?: {
|
|
805
|
+
sequence: {
|
|
806
|
+
label: import("react").ReactNode;
|
|
807
|
+
id: string;
|
|
808
|
+
page: string;
|
|
809
|
+
};
|
|
810
|
+
subSequence?: {
|
|
811
|
+
label: import("react").ReactNode;
|
|
812
|
+
id: string;
|
|
813
|
+
page: string;
|
|
814
|
+
} | undefined;
|
|
815
|
+
} | undefined;
|
|
816
|
+
mandatory?: boolean | undefined;
|
|
817
|
+
page: string;
|
|
818
|
+
componentType: "Question";
|
|
819
|
+
components: import("../../type-source").ComponentType[];
|
|
820
|
+
description: import("react").ReactNode;
|
|
821
|
+
} & import("./fill-management").FilledProps & import("./fill-component-value").FilledProps & import("./fill-missing-response").FilledProps & import("./fill-from-state").FilledProps & import("./fill-pagination").FilledProps & {
|
|
822
|
+
conditionFilter?: boolean | undefined;
|
|
773
823
|
}) | {
|
|
774
824
|
label: unknown;
|
|
775
825
|
colspan?: number | undefined;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { LunaticState } from '../type';
|
|
2
|
-
declare function useComponentsFromState(state: LunaticState): import("./fill-components/fill-components").FilledLunaticComponentProps<"CheckboxOne" | "ConfirmationModal" | "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxBoolean" | "Radio" | "FilterDescription" | "Dropdown" | "PairwiseLinks" | "Roundabout" | "Suggester" | "Input" | "Textarea" | "ComponentSet" | "QuestionExplication">[];
|
|
2
|
+
declare function useComponentsFromState(state: LunaticState): import("./fill-components/fill-components").FilledLunaticComponentProps<"CheckboxOne" | "ConfirmationModal" | "Question" | "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxBoolean" | "Radio" | "FilterDescription" | "Dropdown" | "PairwiseLinks" | "Roundabout" | "Suggester" | "Input" | "Textarea" | "ComponentSet" | "QuestionExplication">[];
|
|
3
3
|
export default useComponentsFromState;
|
|
@@ -10,4 +10,8 @@ export declare function replaceComponentSequence(components: Array<LunaticCompon
|
|
|
10
10
|
componentType: "CheckboxOne";
|
|
11
11
|
}) | (import("./type-source").ComponentTypeBase & {
|
|
12
12
|
componentType: "ConfirmationModal";
|
|
13
|
-
}) | (import("./type-source").ComponentTypeBase & import("./type-source").ComponentComponentSetType) | (import("./type-source").ComponentTypeBase & import("./type-source").ComponentQuestionExplicationType))
|
|
13
|
+
}) | (import("./type-source").ComponentTypeBase & import("./type-source").ComponentComponentSetType) | (import("./type-source").ComponentTypeBase & import("./type-source").ComponentQuestionExplicationType) | (import("./type-source").ComponentTypeBase & {
|
|
14
|
+
componentType: "Question";
|
|
15
|
+
components: import("./type-source").ComponentType[];
|
|
16
|
+
description: import("./type-source").LabelType;
|
|
17
|
+
}))[];
|
|
@@ -28,28 +28,14 @@ export type DeclarationType = {
|
|
|
28
28
|
export type ConditionFilterType = LabelType & {
|
|
29
29
|
bindingDependencies?: string[];
|
|
30
30
|
};
|
|
31
|
-
export declare enum Criticality {
|
|
32
|
-
INFO = "INFO",
|
|
33
|
-
WARN = "WARN",
|
|
34
|
-
ERROR = "ERROR"
|
|
35
|
-
}
|
|
36
|
-
export declare enum TypeOfControl {
|
|
37
|
-
FORMAT = "FORMAT",
|
|
38
|
-
CONSISTENCY = "CONSISTENCY"
|
|
39
|
-
}
|
|
40
|
-
export declare enum ControlTypeEnum {
|
|
41
|
-
roundabout = "roundabout",
|
|
42
|
-
row = "ROW",
|
|
43
|
-
simple = "simple"
|
|
44
|
-
}
|
|
45
31
|
export type ControlType = {
|
|
46
32
|
id: string;
|
|
47
|
-
criticality:
|
|
48
|
-
typeOfControl:
|
|
33
|
+
criticality: 'INFO' | 'WARN' | 'ERROR';
|
|
34
|
+
typeOfControl: 'FORMAT' | 'CONSISTENCY';
|
|
49
35
|
control: LabelType;
|
|
50
36
|
errorMessage: LabelType;
|
|
51
37
|
bindingDependencies: string[];
|
|
52
|
-
type:
|
|
38
|
+
type: 'roundabout' | 'ROW' | 'simple';
|
|
53
39
|
iterations?: number;
|
|
54
40
|
};
|
|
55
41
|
export type ResponseType = {
|
|
@@ -79,7 +65,11 @@ export type ComponentType = (ComponentTypeBase & ComponentSequenceType) | (Compo
|
|
|
79
65
|
componentType: 'CheckboxOne';
|
|
80
66
|
}) | (ComponentTypeBase & {
|
|
81
67
|
componentType: 'ConfirmationModal';
|
|
82
|
-
}) | (ComponentTypeBase & ComponentComponentSetType) | (ComponentTypeBase & ComponentQuestionExplicationType)
|
|
68
|
+
}) | (ComponentTypeBase & ComponentComponentSetType) | (ComponentTypeBase & ComponentQuestionExplicationType) | (ComponentTypeBase & {
|
|
69
|
+
componentType: 'Question';
|
|
70
|
+
components: ComponentType[];
|
|
71
|
+
description: LabelType;
|
|
72
|
+
});
|
|
83
73
|
export type ComponentTypeEnum = ComponentType['componentType'];
|
|
84
74
|
export type ComponentInputOrTextareaType = {
|
|
85
75
|
componentType: 'Input' | 'Textarea';
|
|
@@ -205,6 +195,10 @@ export type ComponentPairWiseLinksType = {
|
|
|
205
195
|
};
|
|
206
196
|
components: ComponentType[];
|
|
207
197
|
};
|
|
198
|
+
export type ComponentQuestionType = {
|
|
199
|
+
componentType: 'Question';
|
|
200
|
+
components: ComponentType[];
|
|
201
|
+
};
|
|
208
202
|
export type ComponentComponentSetType = {
|
|
209
203
|
componentType: 'ComponentSet';
|
|
210
204
|
components: ComponentType[];
|
|
@@ -288,7 +282,18 @@ export type LunaticSource = {
|
|
|
288
282
|
size: string;
|
|
289
283
|
variables: string[];
|
|
290
284
|
} | {
|
|
291
|
-
sizeForLinksVariables: string
|
|
285
|
+
sizeForLinksVariables: [string, string] | {
|
|
286
|
+
xAxisSize: string;
|
|
287
|
+
yAxisSize: string;
|
|
288
|
+
};
|
|
289
|
+
linksVariables: string[];
|
|
290
|
+
} | {
|
|
291
|
+
size: string;
|
|
292
|
+
variables: string[];
|
|
293
|
+
sizeForLinksVariables: [string, string] | {
|
|
294
|
+
xAxisSize: string;
|
|
295
|
+
yAxisSize: string;
|
|
296
|
+
};
|
|
292
297
|
linksVariables: string[];
|
|
293
298
|
};
|
|
294
299
|
};
|
|
@@ -53,7 +53,11 @@ declare function useLunatic(source: LunaticSource, data: LunaticData | undefined
|
|
|
53
53
|
};
|
|
54
54
|
Sequence: Pick<import("../components/type").LunaticBaseProps<string>, "label" | "style" | "id" | "declarations">;
|
|
55
55
|
Subsequence: Pick<import("../components/type").LunaticBaseProps<string>, "label" | "id" | "declarations">;
|
|
56
|
-
Question: Pick<import("../components/type").LunaticBaseProps<unknown>, "label" | "description"
|
|
56
|
+
Question: Pick<import("../components/type").LunaticBaseProps<unknown>, "label" | "id" | "description" | "declarations"> & {
|
|
57
|
+
components: import("./commons/fill-components/fill-components").FilledLunaticComponentProps[];
|
|
58
|
+
};
|
|
59
|
+
QuestionContext: Pick<import("../components/type").LunaticBaseProps<unknown>, "label" | "description">;
|
|
60
|
+
QuestionInformation: Pick<import("../components/type").LunaticBaseProps<unknown>, "label" | "description">;
|
|
57
61
|
ComponentSet: import("../components/type").LunaticBaseProps<unknown> & {
|
|
58
62
|
components: import("./commons/fill-components/fill-components").FilledLunaticComponentProps[];
|
|
59
63
|
value: Record<string, unknown>;
|
|
@@ -301,7 +305,11 @@ declare function useLunatic(source: LunaticSource, data: LunaticData | undefined
|
|
|
301
305
|
};
|
|
302
306
|
Sequence: Pick<import("../components/type").LunaticBaseProps<string>, "label" | "style" | "id" | "declarations">;
|
|
303
307
|
Subsequence: Pick<import("../components/type").LunaticBaseProps<string>, "label" | "id" | "declarations">;
|
|
304
|
-
Question: Pick<import("../components/type").LunaticBaseProps<unknown>, "label" | "description"
|
|
308
|
+
Question: Pick<import("../components/type").LunaticBaseProps<unknown>, "label" | "id" | "description" | "declarations"> & {
|
|
309
|
+
components: import("./commons/fill-components/fill-components").FilledLunaticComponentProps[];
|
|
310
|
+
};
|
|
311
|
+
QuestionContext: Pick<import("../components/type").LunaticBaseProps<unknown>, "label" | "description">;
|
|
312
|
+
QuestionInformation: Pick<import("../components/type").LunaticBaseProps<unknown>, "label" | "description">;
|
|
305
313
|
ComponentSet: import("../components/type").LunaticBaseProps<unknown> & {
|
|
306
314
|
components: import("./commons/fill-components/fill-components").FilledLunaticComponentProps[];
|
|
307
315
|
value: Record<string, unknown>;
|
|
@@ -524,7 +532,7 @@ declare function useLunatic(source: LunaticSource, data: LunaticData | undefined
|
|
|
524
532
|
goPreviousPage: () => void;
|
|
525
533
|
};
|
|
526
534
|
})[] | undefined;
|
|
527
|
-
}) => import("./commons/fill-components/fill-components").FilledLunaticComponentProps<"CheckboxOne" | "ConfirmationModal" | "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxBoolean" | "Radio" | "FilterDescription" | "Dropdown" | "PairwiseLinks" | "Roundabout" | "Suggester" | "Input" | "Textarea" | "ComponentSet" | "QuestionExplication">[];
|
|
535
|
+
}) => import("./commons/fill-components/fill-components").FilledLunaticComponentProps<"CheckboxOne" | "ConfirmationModal" | "Question" | "Sequence" | "Subsequence" | "RosterForLoop" | "Loop" | "Table" | "InputNumber" | "Datepicker" | "CheckboxGroup" | "CheckboxBoolean" | "Radio" | "FilterDescription" | "Dropdown" | "PairwiseLinks" | "Roundabout" | "Suggester" | "Input" | "Textarea" | "ComponentSet" | "QuestionExplication">[];
|
|
528
536
|
goPreviousPage: () => void;
|
|
529
537
|
goNextPage: (payload?: {}) => void;
|
|
530
538
|
goToPage: (page: {
|
|
@@ -1773,7 +1773,10 @@
|
|
|
1773
1773
|
"mandatory": false,
|
|
1774
1774
|
"page": "28",
|
|
1775
1775
|
"positioning": "HORIZONTAL",
|
|
1776
|
-
"label": {
|
|
1776
|
+
"label": {
|
|
1777
|
+
"value": "\"➡ 3. \" || \"Tableau 2 axes\"",
|
|
1778
|
+
"type": "VTL|MD"
|
|
1779
|
+
},
|
|
1777
1780
|
"conditionFilter": {
|
|
1778
1781
|
"value": "(COCHECASE = true)",
|
|
1779
1782
|
"type": "VTL",
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = exports.Default = void 0;
|
|
7
|
+
var _orchestrator = _interopRequireDefault(require("../utils/orchestrator"));
|
|
8
|
+
var _source = _interopRequireDefault(require("./source.json"));
|
|
9
|
+
var _defaultArgTypes = _interopRequireDefault(require("../utils/default-arg-types"));
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
12
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
16
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
17
|
+
//import type { Meta, StoryObj } from '@storybook/react';
|
|
18
|
+
|
|
19
|
+
var meta = {
|
|
20
|
+
title: 'Components/Question',
|
|
21
|
+
component: _orchestrator["default"],
|
|
22
|
+
argTypes: _objectSpread({}, _defaultArgTypes["default"])
|
|
23
|
+
};
|
|
24
|
+
// } satisfies Meta<typeof Orchestrator>;
|
|
25
|
+
var _default = exports["default"] = meta; //type Story = StoryObj<typeof Orchestrator>
|
|
26
|
+
var Default = exports.Default = {
|
|
27
|
+
args: {
|
|
28
|
+
id: 'sequence-simple',
|
|
29
|
+
source: _source["default"]
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
// satisfies Story
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
{
|
|
2
|
+
"pagination": "question",
|
|
3
|
+
"maxPage": "2",
|
|
4
|
+
|
|
5
|
+
"variables": [
|
|
6
|
+
{
|
|
7
|
+
"variableType": "COLLECTED",
|
|
8
|
+
"name": "TESTTEXTE",
|
|
9
|
+
"values": {
|
|
10
|
+
"PREVIOUS": null,
|
|
11
|
+
"COLLECTED": null,
|
|
12
|
+
"FORCED": null,
|
|
13
|
+
"EDITED": null,
|
|
14
|
+
"INPUTED": null
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"variableType": "COLLECTED",
|
|
19
|
+
"name": "QNUM",
|
|
20
|
+
"values": {
|
|
21
|
+
"PREVIOUS": null,
|
|
22
|
+
"COLLECTED": null,
|
|
23
|
+
"FORCED": null,
|
|
24
|
+
"EDITED": null,
|
|
25
|
+
"INPUTED": null
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"components": [
|
|
30
|
+
{
|
|
31
|
+
"componentType": "Question",
|
|
32
|
+
"id": "idQuestion",
|
|
33
|
+
"page": "1",
|
|
34
|
+
"label": {
|
|
35
|
+
"type": "VTL|MD",
|
|
36
|
+
"value": "\"Question\""
|
|
37
|
+
},
|
|
38
|
+
"description": {
|
|
39
|
+
"type": "VTL|MD",
|
|
40
|
+
"value": "\"Description de la question\""
|
|
41
|
+
},
|
|
42
|
+
"declarations": [
|
|
43
|
+
{
|
|
44
|
+
"declarationType": "HELP",
|
|
45
|
+
"id": "idQuestion-help1",
|
|
46
|
+
"label": {
|
|
47
|
+
"type": "VTL|MD",
|
|
48
|
+
"value": "\"Contenu de la première déclaration avant (contexte)\""
|
|
49
|
+
},
|
|
50
|
+
"position": "BEFORE_QUESTION_TEXT"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"declarationType": "HELP",
|
|
54
|
+
"id": "idQuestion-help2",
|
|
55
|
+
"label": {
|
|
56
|
+
"type": "VTL|MD",
|
|
57
|
+
"value": "\"Contenu de la deuxième déclaration avant (contexte)\""
|
|
58
|
+
},
|
|
59
|
+
"position": "BEFORE_QUESTION_TEXT"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"declarationType": "HELP",
|
|
63
|
+
"id": "idQuestion-help3",
|
|
64
|
+
"label": {
|
|
65
|
+
"type": "VTL|MD",
|
|
66
|
+
"value": "\"Contenu de la première déclaration après (Information)\""
|
|
67
|
+
},
|
|
68
|
+
"position": "AFTER_QUESTION_TEXT"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"declarationType": "HELP",
|
|
72
|
+
"id": "idQuestion-help4",
|
|
73
|
+
"label": {
|
|
74
|
+
"type": "VTL|MD",
|
|
75
|
+
"value": "\"Contenu de la deuxième déclaration après (Information)\""
|
|
76
|
+
},
|
|
77
|
+
"position": "AFTER_QUESTION_TEXT"
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
"components": [
|
|
81
|
+
{
|
|
82
|
+
"componentType": "Input",
|
|
83
|
+
"bindingDependencies": ["TESTTEXTE"],
|
|
84
|
+
"controls": [
|
|
85
|
+
{
|
|
86
|
+
"bindingDependencies": ["TESTTEXTE"],
|
|
87
|
+
"criticality": "WARN",
|
|
88
|
+
"errorMessage": {
|
|
89
|
+
"type": "VTL|MD",
|
|
90
|
+
"value": "\"a ne peut pas valoir BLABLA\""
|
|
91
|
+
},
|
|
92
|
+
"typeOfControl": "CONSISTENCY",
|
|
93
|
+
"control": {
|
|
94
|
+
"type": "VTL",
|
|
95
|
+
"value": "not(nvl(TESTTEXTE,\"\") = \"BLABLA\")"
|
|
96
|
+
},
|
|
97
|
+
"id": "kfxn6f16-CI-0"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"bindingDependencies": ["TESTTEXTE"],
|
|
101
|
+
"criticality": "WARN",
|
|
102
|
+
"errorMessage": {
|
|
103
|
+
"type": "VTL|MD",
|
|
104
|
+
"value": "\"Cette phrase un peu longue s\u2019affiche si on a du vide pour la variable sur le texte inférieur à 255 caractères et voilà\""
|
|
105
|
+
},
|
|
106
|
+
"typeOfControl": "CONSISTENCY",
|
|
107
|
+
"control": {
|
|
108
|
+
"type": "VTL",
|
|
109
|
+
"value": "not(isnull(TESTTEXTE))"
|
|
110
|
+
},
|
|
111
|
+
"id": "kfxn6f16-CI-1"
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
"response": { "name": "TESTTEXTE" },
|
|
115
|
+
"hierarchy": {
|
|
116
|
+
"sequence": {
|
|
117
|
+
"id": "kfxmfvwj",
|
|
118
|
+
"page": "1",
|
|
119
|
+
"label": {
|
|
120
|
+
"type": "VTL|MD",
|
|
121
|
+
"value": "\"I - \" || \"TEST SUR BOOLEEN CODE DATE ET TEXTE\""
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"conditionFilter": {
|
|
126
|
+
"type": "VTL",
|
|
127
|
+
"value": "true"
|
|
128
|
+
},
|
|
129
|
+
"id": "kfxn6f16",
|
|
130
|
+
"page": "1",
|
|
131
|
+
"label": {
|
|
132
|
+
"type": "VTL|MD",
|
|
133
|
+
"value": "\"➡ 2. \" || \"Controle sur du texte < 255\""
|
|
134
|
+
},
|
|
135
|
+
"mandatory": false,
|
|
136
|
+
"maxLength": 15,
|
|
137
|
+
"declarations": [
|
|
138
|
+
{
|
|
139
|
+
"declarationType": "INSTRUCTION",
|
|
140
|
+
"id": "kfxn6f16-kfxn36ru",
|
|
141
|
+
"label": {
|
|
142
|
+
"type": "VTL|MD",
|
|
143
|
+
"value": "\"Tester la saisie de BLABLA\""
|
|
144
|
+
},
|
|
145
|
+
"position": "AFTER_QUESTION_TEXT"
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"componentType": "Question",
|
|
153
|
+
"id": "idQuestion2",
|
|
154
|
+
"page": "2",
|
|
155
|
+
"label": {
|
|
156
|
+
"type": "VTL|MD",
|
|
157
|
+
"value": "\"Question 2\""
|
|
158
|
+
},
|
|
159
|
+
"description": {
|
|
160
|
+
"type": "VTL|MD",
|
|
161
|
+
"value": "\"Description de la question 2\""
|
|
162
|
+
},
|
|
163
|
+
"components": [
|
|
164
|
+
{
|
|
165
|
+
"id": "k0dzbfek",
|
|
166
|
+
"componentType": "InputNumber",
|
|
167
|
+
"mandatory": false,
|
|
168
|
+
"page": "2",
|
|
169
|
+
"min": 0,
|
|
170
|
+
"max": 100,
|
|
171
|
+
"decimals": 0,
|
|
172
|
+
"label": {
|
|
173
|
+
"value": "\"➡ 1. \" || \"Test de supériorité stricte - Saisie d’un nombre compris entre 0 et 100 - Si valeur supérieure à 5 message d’info. si superieur à 6,5 autre message \"",
|
|
174
|
+
"type": "VTL|MD"
|
|
175
|
+
},
|
|
176
|
+
"declarations": [
|
|
177
|
+
{
|
|
178
|
+
"id": "k0dzbfek-kzgzg0bk",
|
|
179
|
+
"declarationType": "HELP",
|
|
180
|
+
"position": "AFTER_QUESTION_TEXT",
|
|
181
|
+
"label": {
|
|
182
|
+
"value": "\"Tester 2 et 20 (pour vérifier ordre numérique et lexico)\"",
|
|
183
|
+
"type": "VTL|MD"
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
],
|
|
187
|
+
"conditionFilter": { "value": "true", "type": "VTL" },
|
|
188
|
+
"controls": [
|
|
189
|
+
{
|
|
190
|
+
"id": "k0dzbfek-CI-0",
|
|
191
|
+
"criticality": "WARN",
|
|
192
|
+
"control": {
|
|
193
|
+
"value": "not(cast(nvl(QNUM,0),integer) > 5)",
|
|
194
|
+
"type": "VTL"
|
|
195
|
+
},
|
|
196
|
+
"errorMessage": { "value": "\"sup à 5\"", "type": "VTL|MD" },
|
|
197
|
+
"bindingDependencies": ["QNUM"]
|
|
198
|
+
},
|
|
199
|
+
|
|
200
|
+
{
|
|
201
|
+
"id": "k0dzbfek-CI-1",
|
|
202
|
+
"criticality": "WARN",
|
|
203
|
+
"control": {
|
|
204
|
+
"value": "not(cast(nvl(QNUM,0),integer) > 6.5)",
|
|
205
|
+
"type": "VTL"
|
|
206
|
+
},
|
|
207
|
+
"errorMessage": {
|
|
208
|
+
"value": "\"superieur à 6.5\"",
|
|
209
|
+
"type": "VTL|MD"
|
|
210
|
+
},
|
|
211
|
+
"bindingDependencies": ["QNUM"]
|
|
212
|
+
}
|
|
213
|
+
],
|
|
214
|
+
"bindingDependencies": ["QNUM"],
|
|
215
|
+
"response": { "name": "QNUM" }
|
|
216
|
+
}
|
|
217
|
+
]
|
|
218
|
+
}
|
|
219
|
+
]
|
|
220
|
+
}
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.compileControls = compileControls;
|
|
7
7
|
var _replaceComponentSequence = require("../replace-component-sequence");
|
|
8
|
-
var _typeSource = require("../type-source");
|
|
9
8
|
var _fillComponentExpressions = _interopRequireDefault(require("./fill-components/fill-component-expressions"));
|
|
10
9
|
var _getComponentsFromState = _interopRequireDefault(require("./get-components-from-state"));
|
|
11
10
|
var _checkRoundaboutControl = require("../reducer/controls/check-roundabout-control");
|
|
@@ -40,7 +39,7 @@ function checkComponents(state, components) {
|
|
|
40
39
|
// The component has global level controls
|
|
41
40
|
if (Array.isArray(controls)) {
|
|
42
41
|
var componentErrors = checkControls(controls.filter(function (c) {
|
|
43
|
-
return c.type !==
|
|
42
|
+
return c.type !== 'ROW';
|
|
44
43
|
}), state.executeExpression, state.pager);
|
|
45
44
|
if (componentErrors.length > 0) {
|
|
46
45
|
errors[id] = componentErrors;
|
|
@@ -51,7 +50,7 @@ function checkComponents(state, components) {
|
|
|
51
50
|
if (isLoopComponent(component)) {
|
|
52
51
|
var _component$controls;
|
|
53
52
|
var rowControls = (_component$controls = component.controls) === null || _component$controls === void 0 ? void 0 : _component$controls.filter(function (c) {
|
|
54
|
-
return c.type ===
|
|
53
|
+
return c.type === 'ROW';
|
|
55
54
|
});
|
|
56
55
|
if (rowControls !== null && rowControls !== void 0 && rowControls.length) {
|
|
57
56
|
errors = checkComponentInLoop(state, _objectSpread(_objectSpread({}, component), {}, {
|
|
@@ -82,7 +81,7 @@ function checkComponents(state, components) {
|
|
|
82
81
|
function checkControls(controls, executeExpression, pager) {
|
|
83
82
|
return controls.map(function (control) {
|
|
84
83
|
switch (control.type) {
|
|
85
|
-
case
|
|
84
|
+
case 'roundabout':
|
|
86
85
|
return (0, _checkRoundaboutControl.checkRoundaboutControl)(control, executeExpression);
|
|
87
86
|
default:
|
|
88
87
|
return (0, _checkBaseControl.checkBaseControl)(control, executeExpression, pager);
|
|
@@ -153,7 +152,7 @@ function hasCriticalError(errors) {
|
|
|
153
152
|
}
|
|
154
153
|
// Look for at least one critical error in the list
|
|
155
154
|
var criticalError = Object.values(errors).flat().find(function (error) {
|
|
156
|
-
return error.criticality.startsWith(
|
|
155
|
+
return error.criticality.startsWith('ERROR') || error.typeOfControl === 'FORMAT';
|
|
157
156
|
});
|
|
158
157
|
return criticalError !== undefined;
|
|
159
158
|
}
|
|
@@ -147,6 +147,7 @@ function fillSpecificExpressions(component, state) {
|
|
|
147
147
|
case 'Roundabout':
|
|
148
148
|
return fillRoundaboutProps(component, state);
|
|
149
149
|
case 'ComponentSet':
|
|
150
|
+
case 'Question':
|
|
150
151
|
return fillChildComponents(component, state);
|
|
151
152
|
case 'Loop':
|
|
152
153
|
case 'RosterForLoop':
|
|
@@ -36,7 +36,9 @@ function resizingBehaviour(store, resizing) {
|
|
|
36
36
|
// Pairwise resizing
|
|
37
37
|
if ('sizeForLinksVariables' in resizingInfo) {
|
|
38
38
|
resizePairwise(store, resizingInfo, e.detail);
|
|
39
|
-
|
|
39
|
+
if (!('size' in resizingInfo)) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
40
42
|
}
|
|
41
43
|
if (!resizingInfo.size) {
|
|
42
44
|
throw new Error("Cannot resize ".concat(e.detail.name, " missing \"size\" property"));
|
|
@@ -60,12 +62,15 @@ function resizingBehaviour(store, resizing) {
|
|
|
60
62
|
});
|
|
61
63
|
}
|
|
62
64
|
function resizePairwise(store, resizingInfo, args) {
|
|
63
|
-
|
|
65
|
+
// Handle expression being sent as an array or an object (ensure backward compatibility)
|
|
66
|
+
// Issue : https://github.com/InseeFr/Lunatic/issues/883
|
|
67
|
+
var sizeExpressions = Array.isArray(resizingInfo.sizeForLinksVariables) ? resizingInfo.sizeForLinksVariables : [resizingInfo.sizeForLinksVariables.xAxisSize, resizingInfo.sizeForLinksVariables.yAxisSize];
|
|
68
|
+
var _sizeExpressions$map = sizeExpressions.map(function (expression) {
|
|
64
69
|
return (0, _number.forceInt)(store.run((0, _vtl.getExpressionAsString)(expression)));
|
|
65
70
|
}),
|
|
66
|
-
|
|
67
|
-
xSize =
|
|
68
|
-
ySize =
|
|
71
|
+
_sizeExpressions$map2 = _slicedToArray(_sizeExpressions$map, 2),
|
|
72
|
+
xSize = _sizeExpressions$map2[0],
|
|
73
|
+
ySize = _sizeExpressions$map2[1];
|
|
69
74
|
resizingInfo.linksVariables.forEach(function (variable) {
|
|
70
75
|
var value = store.get(variable, args.iteration);
|
|
71
76
|
var resizedValue = (0, _array.resizeArray)(
|
|
@@ -252,6 +252,49 @@ var _lunaticVariablesStore = require("./lunatic-variables-store");
|
|
|
252
252
|
(0, _vitest.expect)(variables.get('PRENOM').length).toEqual(3);
|
|
253
253
|
(0, _vitest.expect)(variables.get('NOM').length).toEqual(3);
|
|
254
254
|
});
|
|
255
|
+
(0, _vitest.it)('should resize pairwise with the array syntax', function () {
|
|
256
|
+
variables.set('PRENOM', []);
|
|
257
|
+
variables.set('LINKS', [[]]);
|
|
258
|
+
(0, _resizingBehaviour.resizingBehaviour)(variables, {
|
|
259
|
+
PRENOM: {
|
|
260
|
+
sizeForLinksVariables: ['count(PRENOM)', 'count(PRENOM)'],
|
|
261
|
+
linksVariables: ['LINKS']
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
variables.set('PRENOM', ['John', 'Jane', 'Marc']);
|
|
265
|
+
(0, _vitest.expect)(variables.get('LINKS')).toEqual([[null, null, null], [null, null, null], [null, null, null]]);
|
|
266
|
+
});
|
|
267
|
+
(0, _vitest.it)('should resize pairwise with the object syntax', function () {
|
|
268
|
+
variables.set('PRENOM', []);
|
|
269
|
+
variables.set('LINKS', [[]]);
|
|
270
|
+
(0, _resizingBehaviour.resizingBehaviour)(variables, {
|
|
271
|
+
PRENOM: {
|
|
272
|
+
sizeForLinksVariables: {
|
|
273
|
+
xAxisSize: 'count(PRENOM)',
|
|
274
|
+
yAxisSize: 'count(PRENOM)'
|
|
275
|
+
},
|
|
276
|
+
linksVariables: ['LINKS']
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
variables.set('PRENOM', ['John', 'Jane', 'Marc']);
|
|
280
|
+
(0, _vitest.expect)(variables.get('LINKS')).toEqual([[null, null, null], [null, null, null], [null, null, null]]);
|
|
281
|
+
});
|
|
282
|
+
(0, _vitest.it)('should handle both pairwise and normal resize', function () {
|
|
283
|
+
variables.set('PRENOM', []);
|
|
284
|
+
variables.set('NOM', []);
|
|
285
|
+
variables.set('LINKS', [[]]);
|
|
286
|
+
(0, _resizingBehaviour.resizingBehaviour)(variables, {
|
|
287
|
+
PRENOM: {
|
|
288
|
+
sizeForLinksVariables: ['count(PRENOM)', 'count(PRENOM)'],
|
|
289
|
+
linksVariables: ['LINKS'],
|
|
290
|
+
size: 'count(PRENOM)',
|
|
291
|
+
variables: ['NOM']
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
variables.set('PRENOM', ['John', 'Jane', 'Marc']);
|
|
295
|
+
(0, _vitest.expect)(variables.get('LINKS')).toEqual([[null, null, null], [null, null, null], [null, null, null]]);
|
|
296
|
+
(0, _vitest.expect)(variables.get('NOM')).toEqual([null, null, null]);
|
|
297
|
+
});
|
|
255
298
|
});
|
|
256
299
|
(0, _vitest.describe)('cleaning', function () {
|
|
257
300
|
(0, _vitest.it)('should clean variables', function () {
|
|
@@ -20,9 +20,12 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
20
20
|
function replaceComponentSequence(components) {
|
|
21
21
|
return components.reduce(function (acc, component) {
|
|
22
22
|
var componentType = component.componentType;
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
switch (componentType) {
|
|
24
|
+
case 'Question':
|
|
25
|
+
case 'ComponentSet':
|
|
26
|
+
return [].concat(_toConsumableArray(acc), _toConsumableArray(component.components));
|
|
27
|
+
default:
|
|
28
|
+
return [].concat(_toConsumableArray(acc), [component]);
|
|
25
29
|
}
|
|
26
|
-
return [].concat(_toConsumableArray(acc), [component]);
|
|
27
30
|
}, []);
|
|
28
31
|
}
|