@inseefr/lunatic 3.6.1 → 3.6.3
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/PairwiseLinks/PairwiseLinks.js +2 -0
- package/components/PairwiseLinks/PairwiseLinks.js.map +1 -1
- package/components/shared/Checkbox/CheckboxOption.d.ts +1 -0
- package/components/shared/Checkbox/CheckboxOption.js +2 -2
- package/components/shared/Checkbox/CheckboxOption.js.map +1 -1
- package/components/shared/Radio/RadioOption.js +2 -2
- package/components/shared/Radio/RadioOption.js.map +1 -1
- package/components/type.d.ts +4 -1
- package/esm/components/PairwiseLinks/PairwiseLinks.js +2 -0
- package/esm/components/PairwiseLinks/PairwiseLinks.js.map +1 -1
- package/esm/components/shared/Checkbox/CheckboxOption.d.ts +1 -0
- package/esm/components/shared/Checkbox/CheckboxOption.js +2 -2
- package/esm/components/shared/Checkbox/CheckboxOption.js.map +1 -1
- package/esm/components/shared/Radio/RadioOption.js +2 -2
- package/esm/components/shared/Radio/RadioOption.js.map +1 -1
- package/esm/components/type.d.ts +4 -1
- package/esm/type.source.d.ts +3 -0
- package/esm/use-lunatic/commons/variables/behaviours/cleaning-behaviour.d.ts +7 -2
- package/esm/use-lunatic/commons/variables/behaviours/cleaning-behaviour.js +106 -33
- package/esm/use-lunatic/commons/variables/behaviours/cleaning-behaviour.js.map +1 -1
- package/esm/use-lunatic/commons/variables/get-questionnaire-data.js +2 -1
- package/esm/use-lunatic/commons/variables/get-questionnaire-data.js.map +1 -1
- package/esm/use-lunatic/commons/variables/lunatic-variables-store.js +8 -1
- package/esm/use-lunatic/commons/variables/lunatic-variables-store.js.map +1 -1
- package/esm/use-lunatic/commons/variables/lunatic-variables-store.spec.js +76 -2
- package/esm/use-lunatic/commons/variables/lunatic-variables-store.spec.js.map +1 -1
- package/esm/use-lunatic/props/getComponentTypeProps.d.ts +4 -1
- package/esm/use-lunatic/props/propOptions.d.ts +6 -2
- package/esm/use-lunatic/props/propOptions.js +9 -7
- package/esm/use-lunatic/props/propOptions.js.map +1 -1
- package/esm/use-lunatic/props/propOptions.spec.js +68 -0
- package/esm/use-lunatic/props/propOptions.spec.js.map +1 -1
- package/package.json +1 -1
- package/src/components/PairwiseLinks/PairwiseLinks.tsx +1 -0
- package/src/components/shared/Checkbox/CheckboxOption.tsx +3 -0
- package/src/components/shared/Radio/RadioOption.tsx +2 -0
- package/src/components/type.ts +4 -1
- package/src/stories/pairwise/source.json +4 -1
- package/src/stories/questionnaires/simpsons/source.json +6 -0
- package/src/type.source.ts +3 -0
- package/src/use-lunatic/commons/variables/behaviours/cleaning-behaviour.ts +120 -30
- package/src/use-lunatic/commons/variables/get-questionnaire-data.ts +4 -1
- package/src/use-lunatic/commons/variables/lunatic-variables-store.spec.ts +87 -2
- package/src/use-lunatic/commons/variables/lunatic-variables-store.ts +9 -1
- package/src/use-lunatic/props/propOptions.spec.ts +88 -0
- package/src/use-lunatic/props/propOptions.ts +10 -5
- package/tsconfig.build.tsbuildinfo +1 -1
- package/type.source.d.ts +3 -0
- package/use-lunatic/commons/variables/behaviours/cleaning-behaviour.d.ts +7 -2
- package/use-lunatic/commons/variables/behaviours/cleaning-behaviour.js +105 -32
- package/use-lunatic/commons/variables/behaviours/cleaning-behaviour.js.map +1 -1
- package/use-lunatic/commons/variables/get-questionnaire-data.js +2 -1
- package/use-lunatic/commons/variables/get-questionnaire-data.js.map +1 -1
- package/use-lunatic/commons/variables/lunatic-variables-store.js +8 -1
- package/use-lunatic/commons/variables/lunatic-variables-store.js.map +1 -1
- package/use-lunatic/commons/variables/lunatic-variables-store.spec.js +76 -2
- package/use-lunatic/commons/variables/lunatic-variables-store.spec.js.map +1 -1
- package/use-lunatic/props/getComponentTypeProps.d.ts +4 -1
- package/use-lunatic/props/propOptions.d.ts +6 -2
- package/use-lunatic/props/propOptions.js +6 -4
- package/use-lunatic/props/propOptions.js.map +1 -1
- package/use-lunatic/props/propOptions.spec.js +68 -0
- package/use-lunatic/props/propOptions.spec.js.map +1 -1
|
@@ -18,13 +18,15 @@ export type InterpretedOption = {
|
|
|
18
18
|
description?: ReactNode;
|
|
19
19
|
detailLabel?: ReactNode;
|
|
20
20
|
detailValue?: string | null;
|
|
21
|
+
detailMaxLength?: number;
|
|
22
|
+
shouldBeFiltered?: boolean;
|
|
21
23
|
onDetailChange?: (value: string) => void;
|
|
22
24
|
onCheck?: () => void;
|
|
23
25
|
onUncheck?: () => void;
|
|
24
26
|
};
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
|
-
* Compute options for checkboxes / radios
|
|
29
|
+
* Compute options for checkboxes / radios / dropdown
|
|
28
30
|
*/
|
|
29
31
|
export function getOptionsProp(
|
|
30
32
|
definition: DeepTranslateExpression<LunaticComponentDefinition>,
|
|
@@ -61,6 +63,7 @@ export function getOptionsProp(
|
|
|
61
63
|
detailValue: response.detail?.response
|
|
62
64
|
? variables.get(response.detail.response.name, iteration)
|
|
63
65
|
: undefined,
|
|
66
|
+
detailMaxLength: response.detail?.maxLength,
|
|
64
67
|
onCheck: (checked: boolean) => {
|
|
65
68
|
handleChanges([{ name: response.response.name, value: checked }]);
|
|
66
69
|
},
|
|
@@ -108,6 +111,12 @@ export function getOptionsProp(
|
|
|
108
111
|
value: option.value,
|
|
109
112
|
checked: value === option.value,
|
|
110
113
|
detailLabel: 'detail' in option ? option.detail?.label : undefined,
|
|
114
|
+
detailValue:
|
|
115
|
+
'detail' in option && option.detail
|
|
116
|
+
? variables.get(option.detail.response.name, iteration)
|
|
117
|
+
: null,
|
|
118
|
+
detailMaxLength:
|
|
119
|
+
'detail' in option ? option.detail?.maxLength : undefined,
|
|
111
120
|
onCheck: () => {
|
|
112
121
|
handleChanges([
|
|
113
122
|
{ name: definition.response.name, value: option.value },
|
|
@@ -117,10 +126,6 @@ export function getOptionsProp(
|
|
|
117
126
|
onUncheck: () => {
|
|
118
127
|
handleChanges([{ name: definition.response.name, value: null }]);
|
|
119
128
|
},
|
|
120
|
-
detailValue:
|
|
121
|
-
'detail' in option && option.detail
|
|
122
|
-
? variables.get(option.detail.response.name, iteration)
|
|
123
|
-
: null,
|
|
124
129
|
onDetailChange:
|
|
125
130
|
'detail' in option && option.detail
|
|
126
131
|
? (value: string) => {
|