@inseefr/lunatic 3.5.5 → 3.5.6
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/Duration/durationUtils.js +1 -1
- package/components/Duration/durationUtils.js.map +1 -1
- package/components/Sequence/Sequence.d.ts +1 -1
- package/components/Subsequence/Subsequence.d.ts +1 -1
- package/components/library.d.ts +2 -2
- package/components/type.d.ts +4 -3
- package/esm/components/Duration/durationUtils.js +1 -1
- package/esm/components/Duration/durationUtils.js.map +1 -1
- package/esm/components/Sequence/Sequence.d.ts +1 -1
- package/esm/components/Subsequence/Subsequence.d.ts +1 -1
- package/esm/components/library.d.ts +2 -2
- package/esm/components/type.d.ts +4 -3
- package/esm/use-lunatic/commons/fill-components/fill-component.spec.js +105 -0
- package/esm/use-lunatic/commons/fill-components/fill-component.spec.js.map +1 -1
- package/esm/use-lunatic/commons/fill-components/fill-components.d.ts +3 -2
- package/esm/use-lunatic/commons/fill-components/fill-components.js +12 -4
- package/esm/use-lunatic/commons/fill-components/fill-components.js.map +1 -1
- package/esm/use-lunatic/props/getComponentTypeProps.d.ts +3 -3
- package/esm/use-lunatic/props/getComponentTypeProps.js +1 -1
- package/esm/use-lunatic/props/getComponentTypeProps.js.map +1 -1
- package/esm/use-lunatic/props/propOptions.d.ts +3 -1
- package/esm/use-lunatic/props/propOptions.js +22 -24
- package/esm/use-lunatic/props/propOptions.js.map +1 -1
- package/esm/use-lunatic/props/propOptions.spec.js +46 -0
- package/esm/use-lunatic/props/propOptions.spec.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Duration/durationUtils.ts +1 -1
- package/src/components/type.ts +9 -2
- package/src/use-lunatic/commons/fill-components/fill-component.spec.ts +126 -0
- package/src/use-lunatic/commons/fill-components/fill-components.ts +19 -4
- package/src/use-lunatic/props/getComponentTypeProps.ts +6 -1
- package/src/use-lunatic/props/propOptions.spec.ts +64 -0
- package/src/use-lunatic/props/propOptions.ts +50 -22
- package/tsconfig.build.tsbuildinfo +1 -1
- package/use-lunatic/commons/fill-components/fill-component.spec.js +105 -0
- package/use-lunatic/commons/fill-components/fill-component.spec.js.map +1 -1
- package/use-lunatic/commons/fill-components/fill-components.d.ts +3 -2
- package/use-lunatic/commons/fill-components/fill-components.js +12 -4
- package/use-lunatic/commons/fill-components/fill-components.js.map +1 -1
- package/use-lunatic/props/getComponentTypeProps.d.ts +3 -3
- package/use-lunatic/props/getComponentTypeProps.js +1 -1
- package/use-lunatic/props/getComponentTypeProps.js.map +1 -1
- package/use-lunatic/props/propOptions.d.ts +3 -1
- package/use-lunatic/props/propOptions.js +22 -24
- package/use-lunatic/props/propOptions.js.map +1 -1
- package/use-lunatic/props/propOptions.spec.js +46 -0
- package/use-lunatic/props/propOptions.spec.js.map +1 -1
|
@@ -2,26 +2,15 @@ import { isNumber } from '../../utils/number';
|
|
|
2
2
|
/**
|
|
3
3
|
* Compute options for checkboxes / radios
|
|
4
4
|
*/
|
|
5
|
-
export function getOptionsProp(definition, variables, handleChanges, pagerIteration, value, logger, disableFilters) {
|
|
5
|
+
export function getOptionsProp(definition, variables, handleChanges, pagerIteration, value, logger, disableFilters, shouldParentBeFiltered) {
|
|
6
6
|
const iteration = isNumber(pagerIteration) ? [pagerIteration] : undefined;
|
|
7
|
-
//const iteration = pagerIteration ? [pagerIteration] : undefined;
|
|
8
7
|
if (definition.componentType === 'CheckboxGroup') {
|
|
9
8
|
return definition.responses
|
|
10
9
|
.filter((response) => {
|
|
11
10
|
if (disableFilters || !response.conditionFilter) {
|
|
12
11
|
return true;
|
|
13
12
|
}
|
|
14
|
-
|
|
15
|
-
return variables.run(response.conditionFilter.value, { iteration });
|
|
16
|
-
}
|
|
17
|
-
catch (e) {
|
|
18
|
-
// If there is an error interpreting a variable, we do not filter
|
|
19
|
-
logger({
|
|
20
|
-
type: 'ERROR',
|
|
21
|
-
error: e,
|
|
22
|
-
});
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
13
|
+
return !isFilteredOutOption(variables, iteration, logger, response.conditionFilter);
|
|
25
14
|
})
|
|
26
15
|
.map((response) => {
|
|
27
16
|
var _a, _b, _c;
|
|
@@ -45,6 +34,8 @@ export function getOptionsProp(definition, variables, handleChanges, pagerIterat
|
|
|
45
34
|
]);
|
|
46
35
|
}
|
|
47
36
|
: undefined,
|
|
37
|
+
shouldBeFiltered: shouldParentBeFiltered ||
|
|
38
|
+
isFilteredOutOption(variables, iteration, logger, response.conditionFilter),
|
|
48
39
|
});
|
|
49
40
|
});
|
|
50
41
|
}
|
|
@@ -58,17 +49,7 @@ export function getOptionsProp(definition, variables, handleChanges, pagerIterat
|
|
|
58
49
|
!option.conditionFilter) {
|
|
59
50
|
return true;
|
|
60
51
|
}
|
|
61
|
-
|
|
62
|
-
return variables.run(option.conditionFilter.value, { iteration });
|
|
63
|
-
}
|
|
64
|
-
catch (e) {
|
|
65
|
-
// If there is an error interpreting a variable, we do not filter
|
|
66
|
-
logger({
|
|
67
|
-
type: 'ERROR',
|
|
68
|
-
error: e,
|
|
69
|
-
});
|
|
70
|
-
return true;
|
|
71
|
-
}
|
|
52
|
+
return !isFilteredOutOption(variables, iteration, logger, option.conditionFilter);
|
|
72
53
|
})
|
|
73
54
|
.map((option) => {
|
|
74
55
|
var _a;
|
|
@@ -95,7 +76,24 @@ export function getOptionsProp(definition, variables, handleChanges, pagerIterat
|
|
|
95
76
|
handleChanges([{ name: option.detail.response.name, value }]);
|
|
96
77
|
}
|
|
97
78
|
: null,
|
|
79
|
+
shouldBeFiltered: shouldParentBeFiltered ||
|
|
80
|
+
('conditionFilter' in option &&
|
|
81
|
+
isFilteredOutOption(variables, iteration, logger, option.conditionFilter)),
|
|
98
82
|
});
|
|
99
83
|
});
|
|
100
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Check if an option should be filtered, depending on its conditionFilter.
|
|
87
|
+
*/
|
|
88
|
+
function isFilteredOutOption(variables, iteration, logger, conditionFilter) {
|
|
89
|
+
if (!conditionFilter)
|
|
90
|
+
return false;
|
|
91
|
+
try {
|
|
92
|
+
return !variables.run(conditionFilter.value, { iteration });
|
|
93
|
+
}
|
|
94
|
+
catch (e) {
|
|
95
|
+
logger({ type: 'ERROR', error: e });
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
101
99
|
//# sourceMappingURL=propOptions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propOptions.js","sourceRoot":"","sources":["../../../src/use-lunatic/props/propOptions.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"propOptions.js","sourceRoot":"","sources":["../../../src/use-lunatic/props/propOptions.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAkB9C;;GAEG;AACH,MAAM,UAAU,cAAc,CAC7B,UAA+D,EAC/D,SAAgC,EAChC,aAAoC,EACpC,cAAkD,EAClD,KAAc,EACd,MAAqB,EACrB,cAAwB,EACxB,sBAAgC;IAEhC,MAAM,SAAS,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAE1E,IAAI,UAAU,CAAC,aAAa,KAAK,eAAe,EAAE,CAAC;QAClD,OAAO,UAAU,CAAC,SAAS;aACzB,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE;YACpB,IAAI,cAAc,IAAI,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC;gBACjD,OAAO,IAAI,CAAC;YACb,CAAC;YACD,OAAO,CAAC,mBAAmB,CAC1B,SAAS,EACT,SAAS,EACT,MAAM,EACN,QAAQ,CAAC,eAAe,CACxB,CAAC;QACH,CAAC,CAAC;aACD,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;;YAAC,OAAA,CAAC;gBACnB,KAAK,EAAE,QAAQ,CAAC,KAAK;gBACrB,IAAI,EAA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C,KAAa,EAAE,EAAE;oBAClB,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;gBAChE,CAAC;gBACF,CAAC,CAAC,IAAI;YACR,gBAAgB,EACf,sBAAsB;gBACtB,CAAC,iBAAiB,IAAI,MAAM;oBAC3B,mBAAmB,CAClB,SAAS,EACT,SAAS,EACT,MAAM,EACN,MAAM,CAAC,eAAe,CACtB,CAAC;SACJ,CAAC,CAAA;KAAA,CAAC,CAAC;AACN,CAAC;AAED;;GAEG;AACH,SAAS,mBAAmB,CAC3B,SAAgC,EAChC,SAA+B,EAC/B,MAAqB,EACrB,eAA+B;IAE/B,IAAI,CAAC,eAAe;QAAE,OAAO,KAAK,CAAC;IACnC,IAAI,CAAC;QACJ,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;IAC7D,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACZ,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAU,EAAE,CAAC,CAAC;QAC7C,OAAO,KAAK,CAAC;IACd,CAAC;AACF,CAAC"}
|
|
@@ -131,6 +131,7 @@ describe('getOptionsProp()', () => {
|
|
|
131
131
|
const options = getOptionsProp(definition, variables, mockChange, undefined, undefined, mockLogger);
|
|
132
132
|
// Ensure the option is not filtered
|
|
133
133
|
expect(options).toHaveLength(1);
|
|
134
|
+
expect(options[0].shouldBeFiltered).toBe(false);
|
|
134
135
|
});
|
|
135
136
|
it('should not filter option (radio) when its conditionFilter evaluation fails', () => {
|
|
136
137
|
const definition = {
|
|
@@ -150,6 +151,7 @@ describe('getOptionsProp()', () => {
|
|
|
150
151
|
const options = getOptionsProp(definition, variables, mockChange, undefined, undefined, mockLogger);
|
|
151
152
|
// Ensure the option is not filtered
|
|
152
153
|
expect(options).toHaveLength(1);
|
|
154
|
+
expect(options[0].shouldBeFiltered).toBe(false);
|
|
153
155
|
});
|
|
154
156
|
it('should not filter any response (CheckboxGroup) when disableFilters is true', () => {
|
|
155
157
|
const definition = {
|
|
@@ -171,6 +173,8 @@ describe('getOptionsProp()', () => {
|
|
|
171
173
|
);
|
|
172
174
|
// Ensure the option is not filtered
|
|
173
175
|
expect(options).toHaveLength(1);
|
|
176
|
+
// the option should would have been filtered if we did not disable filters
|
|
177
|
+
expect(options[0].shouldBeFiltered).toBe(true);
|
|
174
178
|
});
|
|
175
179
|
it('should not filter any option (Radio) when disableFilters is true', () => {
|
|
176
180
|
const definition = {
|
|
@@ -189,7 +193,49 @@ describe('getOptionsProp()', () => {
|
|
|
189
193
|
});
|
|
190
194
|
const options = getOptionsProp(definition, variables, mockChange, undefined, undefined, mockLogger, true // disableFilters = true
|
|
191
195
|
);
|
|
196
|
+
// Ensure the option is not filtered
|
|
197
|
+
expect(options).toHaveLength(1);
|
|
198
|
+
// the option should would have been filtered if we did not disable filters
|
|
199
|
+
expect(options[0].shouldBeFiltered).toBe(true);
|
|
200
|
+
});
|
|
201
|
+
it('should set the response (CheckboxGroup) shouldBeFiltered=true when the parent component should be filtered', () => {
|
|
202
|
+
const definition = {
|
|
203
|
+
...checkboxGroupDefinition,
|
|
204
|
+
responses: [
|
|
205
|
+
{
|
|
206
|
+
label: 'Option 1',
|
|
207
|
+
response: { name: 'O1' },
|
|
208
|
+
id: 'id1',
|
|
209
|
+
conditionFilter: { type: 'VTL', value: 'expression' },
|
|
210
|
+
},
|
|
211
|
+
],
|
|
212
|
+
};
|
|
213
|
+
const options = getOptionsProp(definition, variables, mockChange, undefined, undefined, mockLogger, true, // disableFilters = true
|
|
214
|
+
true // parent component should be filtered
|
|
215
|
+
);
|
|
216
|
+
// Ensure the option is not filtered
|
|
217
|
+
expect(options).toHaveLength(1);
|
|
218
|
+
// the option would have been filtered if we did not disable filters because its parent would
|
|
219
|
+
expect(options[0].shouldBeFiltered).toBe(true);
|
|
220
|
+
});
|
|
221
|
+
it('should set the option (Radio) shouldBeFiltered=true when the parent component should be filtered', () => {
|
|
222
|
+
const definition = {
|
|
223
|
+
...radioDefinition,
|
|
224
|
+
options: [
|
|
225
|
+
{
|
|
226
|
+
label: 'Option 1',
|
|
227
|
+
value: 'id1',
|
|
228
|
+
conditionFilter: { type: 'VTL', value: 'expression' },
|
|
229
|
+
},
|
|
230
|
+
],
|
|
231
|
+
};
|
|
232
|
+
const options = getOptionsProp(definition, variables, mockChange, undefined, undefined, mockLogger, true, // disableFilters = true
|
|
233
|
+
true // parent component should be filtered
|
|
234
|
+
);
|
|
235
|
+
// Ensure the option is not filtered
|
|
192
236
|
expect(options).toHaveLength(1);
|
|
237
|
+
// the option would have been filtered if we did not disable filters because its parent would
|
|
238
|
+
expect(options[0].shouldBeFiltered).toBe(true);
|
|
193
239
|
});
|
|
194
240
|
});
|
|
195
241
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propOptions.spec.js","sourceRoot":"","sources":["../../../src/use-lunatic/props/propOptions.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAO/C,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IACjC,IAAI,SAAgC,CAAC;IACrC,MAAM,uBAAuB,GAAG;QAC/B,EAAE,EAAE,eAAe;QACnB,aAAa,EAAE,eAAe;QAC9B,SAAS,EAAE;YACV;gBACC,KAAK,EAAE,UAAU;gBACjB,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;gBACxB,EAAE,EAAE,KAAK;aACT;YACD;gBACC,KAAK,EAAE,UAAU;gBACjB,QAAQ,EAAE,EAAE,IAAI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AAK,EAAE,KAAK;wBACZ,eAAe,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE;qBACrD;iBACD;aAC6D,CAAC;YAEhE,MAAM,OAAO,GAAG,cAAc,CAC7B,UAAU,EACV,SAAS,EACT,UAAU,EACV,SAAS,EACT,SAAS,EACT,UAAU,EACV,IAAI,EAAE,wBAAwB;YAC9B,IAAI,CAAC,sCAAsC;aAC3C,CAAC;YAEF,oCAAoC;YACpC,MAAM,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YAChC,6FAA6F;YAC7F,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ export type DurationValue = {
|
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
export const propsByUnit = {
|
|
9
|
-
hours: { min: 0, max:
|
|
9
|
+
hours: { min: 0, max: Infinity, size: 2, style: { width: '2.5em' } },
|
|
10
10
|
minutes: { min: 0, max: 59, size: 2, style: { width: '2.5em' } },
|
|
11
11
|
months: { min: 0, max: 11, size: 2, style: { width: '2.5em' } },
|
|
12
12
|
years: { min: 0, size: 4, style: { width: '4em' } },
|
package/src/components/type.ts
CHANGED
|
@@ -35,6 +35,7 @@ export type LunaticBaseProps<ValueType = unknown> = {
|
|
|
35
35
|
className?: string;
|
|
36
36
|
style?: CSSProperties;
|
|
37
37
|
iteration?: number;
|
|
38
|
+
shouldBeFiltered?: boolean;
|
|
38
39
|
declarations?: {
|
|
39
40
|
id: string;
|
|
40
41
|
declarationType:
|
|
@@ -103,12 +104,17 @@ export type ComponentPropsByType = {
|
|
|
103
104
|
};
|
|
104
105
|
Sequence: Pick<
|
|
105
106
|
LunaticBaseProps<string>,
|
|
106
|
-
|
|
107
|
+
| 'id'
|
|
108
|
+
| 'label'
|
|
109
|
+
| 'style'
|
|
110
|
+
| 'declarations'
|
|
111
|
+
| 'description'
|
|
112
|
+
| 'shouldBeFiltered'
|
|
107
113
|
> &
|
|
108
114
|
LunaticExtraProps & { componentType?: 'Sequence' };
|
|
109
115
|
Subsequence: Pick<
|
|
110
116
|
LunaticBaseProps<string>,
|
|
111
|
-
'id' | 'label' | 'declarations' | 'description'
|
|
117
|
+
'id' | 'label' | 'declarations' | 'description' | 'shouldBeFiltered'
|
|
112
118
|
> &
|
|
113
119
|
LunaticExtraProps & { componentType?: 'Subsequence' };
|
|
114
120
|
Question: Pick<
|
|
@@ -121,6 +127,7 @@ export type ComponentPropsByType = {
|
|
|
121
127
|
| 'errors'
|
|
122
128
|
| 'disabled'
|
|
123
129
|
| 'readOnly'
|
|
130
|
+
| 'shouldBeFiltered'
|
|
124
131
|
> &
|
|
125
132
|
LunaticExtraProps & {
|
|
126
133
|
components: LunaticComponentProps[];
|
|
@@ -66,6 +66,7 @@ describe('fillComponents', () => {
|
|
|
66
66
|
expect(input.required).toBe(true);
|
|
67
67
|
expect(input.maxLength).toBe(15);
|
|
68
68
|
expect(input.conditionFilter).toBe(true);
|
|
69
|
+
expect(input.shouldBeFiltered).toBe(false);
|
|
69
70
|
});
|
|
70
71
|
|
|
71
72
|
it('should fill a Radio component correctly with options', () => {
|
|
@@ -136,6 +137,7 @@ describe('fillComponents', () => {
|
|
|
136
137
|
expect(radio.options[0].label).toBe('"oui"');
|
|
137
138
|
expect(radio.options[1].label).toBe('"non"');
|
|
138
139
|
expect(radio.conditionFilter).toBe(true);
|
|
140
|
+
expect(radio.shouldBeFiltered).toBe(false);
|
|
139
141
|
expect(radio.response.name).toBe('TESTRADIO');
|
|
140
142
|
});
|
|
141
143
|
|
|
@@ -187,6 +189,7 @@ describe('fillComponents', () => {
|
|
|
187
189
|
expect(question.id).toBe('question-m8ilvkbt');
|
|
188
190
|
expect(question.label).toBe('"Question label"');
|
|
189
191
|
expect(question.conditionFilter).toBe(true);
|
|
192
|
+
expect(question.shouldBeFiltered).toBe(false);
|
|
190
193
|
expect(question.components.length).toBe(1);
|
|
191
194
|
|
|
192
195
|
const input = question.components[0];
|
|
@@ -258,12 +261,16 @@ describe('fillComponents', () => {
|
|
|
258
261
|
expect(input.componentType).toBe('Input');
|
|
259
262
|
expect(input.response.name).toBe('TESTINPUT');
|
|
260
263
|
expect(input.maxLength).toBe(100);
|
|
264
|
+
expect(input.conditionFilter).toBe(true);
|
|
265
|
+
expect(input.shouldBeFiltered).toBe(false);
|
|
261
266
|
|
|
262
267
|
const radio = filledComponents[1];
|
|
263
268
|
expect(radio.componentType).toBe('Radio');
|
|
264
269
|
expect(radio.response.name).toBe('TESTRADIO');
|
|
265
270
|
expect(radio.options[0].label).toBe('"Yes"');
|
|
266
271
|
expect(radio.options[1].label).toBe('"No"');
|
|
272
|
+
expect(radio.conditionFilter).toBe(true);
|
|
273
|
+
expect(radio.shouldBeFiltered).toBe(false);
|
|
267
274
|
});
|
|
268
275
|
|
|
269
276
|
it('should filter out FilterDescription components if disableFiltersDescription is true', () => {
|
|
@@ -453,6 +460,7 @@ describe('fillComponents', () => {
|
|
|
453
460
|
const input = filledComponents[0];
|
|
454
461
|
expect(input.id).toBe('input1');
|
|
455
462
|
expect(input.conditionFilter).toBe(false);
|
|
463
|
+
expect(input.shouldBeFiltered).toBe(true);
|
|
456
464
|
});
|
|
457
465
|
|
|
458
466
|
it('should transform components into Text with empty label when conditionFilter is false and parentType is RosterForLoop', () => {
|
|
@@ -507,6 +515,8 @@ describe('fillComponents', () => {
|
|
|
507
515
|
expect(input.componentType).toBe('Text');
|
|
508
516
|
expect(input.label).toBe('');
|
|
509
517
|
expect(input.id).toBe('input1');
|
|
518
|
+
expect(input.conditionFilter).toBe(false);
|
|
519
|
+
expect(input.shouldBeFiltered).toBe(true);
|
|
510
520
|
|
|
511
521
|
// Check the second component that has conditionFilter: true
|
|
512
522
|
const radio = filledComponents[1];
|
|
@@ -569,6 +579,8 @@ describe('fillComponents', () => {
|
|
|
569
579
|
// The component should remain unchanged
|
|
570
580
|
expect(input.componentType).toBe('Input');
|
|
571
581
|
expect(input.label).toBe('"Input label"');
|
|
582
|
+
expect(input.conditionFilter).toBe(false);
|
|
583
|
+
expect(input.shouldBeFiltered).toBe(true);
|
|
572
584
|
|
|
573
585
|
// Check the second component that has conditionFilter: true
|
|
574
586
|
const radio = filledComponents[1];
|
|
@@ -578,4 +590,118 @@ describe('fillComponents', () => {
|
|
|
578
590
|
expect(radio.options[0].label).toBe('"Yes"');
|
|
579
591
|
expect(radio.options[1].label).toBe('"No"');
|
|
580
592
|
});
|
|
593
|
+
|
|
594
|
+
it('should tag children components with shouldBeFiltered=true if the parent component should be filtered', () => {
|
|
595
|
+
const components = [
|
|
596
|
+
{
|
|
597
|
+
id: 'question-m8ilvkbt',
|
|
598
|
+
componentType: 'Question',
|
|
599
|
+
page: '1',
|
|
600
|
+
label: {
|
|
601
|
+
value: '"Question label"',
|
|
602
|
+
type: 'VTL|MD',
|
|
603
|
+
},
|
|
604
|
+
conditionFilter: {
|
|
605
|
+
type: 'VTL',
|
|
606
|
+
// value should be string, but did not find how to execute correctly with mocks
|
|
607
|
+
// for having a false conditionFilter at the end
|
|
608
|
+
value: false,
|
|
609
|
+
},
|
|
610
|
+
components: [
|
|
611
|
+
{
|
|
612
|
+
id: 'm8ilvkbt',
|
|
613
|
+
componentType: 'Input',
|
|
614
|
+
page: '1',
|
|
615
|
+
maxLength: 249,
|
|
616
|
+
response: {
|
|
617
|
+
name: 'TESTTEXTE',
|
|
618
|
+
},
|
|
619
|
+
},
|
|
620
|
+
],
|
|
621
|
+
},
|
|
622
|
+
];
|
|
623
|
+
|
|
624
|
+
const mockVariables = LunaticVariablesStore.makeFromObject({
|
|
625
|
+
TESTTEXTE: 'some value',
|
|
626
|
+
});
|
|
627
|
+
|
|
628
|
+
const mockState = {
|
|
629
|
+
...defaultMockState,
|
|
630
|
+
disableFilters: true,
|
|
631
|
+
variables: mockVariables,
|
|
632
|
+
};
|
|
633
|
+
|
|
634
|
+
const filledComponents = fillComponents(
|
|
635
|
+
components as LunaticComponentDefinition[],
|
|
636
|
+
mockState as unknown as FillComponentArgs
|
|
637
|
+
) as any;
|
|
638
|
+
|
|
639
|
+
const question = filledComponents[0];
|
|
640
|
+
|
|
641
|
+
expect(question.componentType).toBe('Question');
|
|
642
|
+
expect(question.conditionFilter).toBe(false);
|
|
643
|
+
expect(question.shouldBeFiltered).toBe(true);
|
|
644
|
+
|
|
645
|
+
const input = question.components[0];
|
|
646
|
+
expect(input.componentType).toBe('Input');
|
|
647
|
+
expect(input.conditionFilter).toBe(undefined);
|
|
648
|
+
expect(input.shouldBeFiltered).toBe(true);
|
|
649
|
+
});
|
|
650
|
+
|
|
651
|
+
it('should tag options with shouldBeFiltered=true if the component should be filtered', () => {
|
|
652
|
+
const components = [
|
|
653
|
+
{
|
|
654
|
+
id: 'radio1',
|
|
655
|
+
componentType: 'Radio',
|
|
656
|
+
page: '1',
|
|
657
|
+
label: {
|
|
658
|
+
type: 'VTL|MD',
|
|
659
|
+
value: '"Radio label"',
|
|
660
|
+
},
|
|
661
|
+
options: [
|
|
662
|
+
{ value: 'yes', label: { value: '"Yes"', type: 'VTL|MD' } },
|
|
663
|
+
{ value: 'no', label: { value: '"No"', type: 'VTL|MD' } },
|
|
664
|
+
],
|
|
665
|
+
response: {
|
|
666
|
+
name: 'TESTRADIO',
|
|
667
|
+
},
|
|
668
|
+
conditionFilter: {
|
|
669
|
+
type: 'VTL',
|
|
670
|
+
// value should be string, but did not find how to execute correctly with mocks
|
|
671
|
+
// for having a false conditionFilter at the end
|
|
672
|
+
value: false,
|
|
673
|
+
},
|
|
674
|
+
},
|
|
675
|
+
];
|
|
676
|
+
|
|
677
|
+
const mockVariables = LunaticVariablesStore.makeFromObject({
|
|
678
|
+
TESTINPUT: 'Filled input',
|
|
679
|
+
TESTRADIO: 'yes',
|
|
680
|
+
});
|
|
681
|
+
|
|
682
|
+
const mockState = {
|
|
683
|
+
...defaultMockState,
|
|
684
|
+
disableFilters: true,
|
|
685
|
+
variables: mockVariables,
|
|
686
|
+
};
|
|
687
|
+
|
|
688
|
+
const filledComponents = fillComponents(
|
|
689
|
+
components as LunaticComponentDefinition[],
|
|
690
|
+
mockState as unknown as FillComponentArgs
|
|
691
|
+
) as any;
|
|
692
|
+
|
|
693
|
+
const radio = filledComponents[0];
|
|
694
|
+
|
|
695
|
+
expect(radio.componentType).toBe('Radio');
|
|
696
|
+
expect(radio.conditionFilter).toBe(false);
|
|
697
|
+
expect(radio.shouldBeFiltered).toBe(true);
|
|
698
|
+
|
|
699
|
+
expect(radio.options[0].label).toBe('"Yes"');
|
|
700
|
+
expect(radio.options[0].conditionFilter).toBe(undefined);
|
|
701
|
+
expect(radio.options[0].shouldBeFiltered).toBe(true);
|
|
702
|
+
|
|
703
|
+
expect(radio.options[1].label).toBe('"No"');
|
|
704
|
+
expect(radio.options[1].conditionFilter).toBe(undefined);
|
|
705
|
+
expect(radio.options[1].shouldBeFiltered).toBe(true);
|
|
706
|
+
});
|
|
581
707
|
});
|
|
@@ -13,6 +13,7 @@ import { getValueProp } from '../../props/propValue';
|
|
|
13
13
|
import { getIterationsProp } from '../../props/propIterations';
|
|
14
14
|
import { getOptionsProp } from '../../props/propOptions';
|
|
15
15
|
import { LunaticLogger } from '../../logger/type';
|
|
16
|
+
import { VTLScalarExpression } from '../../../type.source';
|
|
16
17
|
|
|
17
18
|
export type FillComponentArgs = {
|
|
18
19
|
disableFilters?: boolean;
|
|
@@ -35,9 +36,20 @@ export type FillComponentArgs = {
|
|
|
35
36
|
*/
|
|
36
37
|
export const fillComponent = (
|
|
37
38
|
component: LunaticComponentDefinition,
|
|
38
|
-
state: FillComponentArgs
|
|
39
|
+
state: FillComponentArgs,
|
|
40
|
+
// the given parentConditionFilter is typed as VTLScalarExpression, but it's actually a boolean or undefined
|
|
41
|
+
parentConditionFilter?: any
|
|
39
42
|
): LunaticComponentProps & { conditionFilter?: boolean } => {
|
|
40
43
|
const interpretedProps = fillComponentExpressions(component, state);
|
|
44
|
+
|
|
45
|
+
const shouldParentBeFiltered = parentConditionFilter === false;
|
|
46
|
+
|
|
47
|
+
const shouldBeFiltered =
|
|
48
|
+
shouldParentBeFiltered ||
|
|
49
|
+
('conditionFilter' in interpretedProps
|
|
50
|
+
? !interpretedProps.conditionFilter
|
|
51
|
+
: false);
|
|
52
|
+
|
|
41
53
|
const value = getValueProp(component, state);
|
|
42
54
|
return {
|
|
43
55
|
...interpretedProps,
|
|
@@ -48,6 +60,7 @@ export const fillComponent = (
|
|
|
48
60
|
shortcut: state.shortcut,
|
|
49
61
|
goNextPage: state.goNextPage,
|
|
50
62
|
goPreviousPage: state.goPreviousPage,
|
|
63
|
+
shouldBeFiltered: shouldBeFiltered,
|
|
51
64
|
iteration: state.pager.iteration,
|
|
52
65
|
required: 'isMandatory' in component ? component.isMandatory : false,
|
|
53
66
|
value: value,
|
|
@@ -61,7 +74,8 @@ export const fillComponent = (
|
|
|
61
74
|
state.pager.iteration,
|
|
62
75
|
value,
|
|
63
76
|
state.logger,
|
|
64
|
-
state.disableFilters
|
|
77
|
+
state.disableFilters,
|
|
78
|
+
shouldBeFiltered
|
|
65
79
|
),
|
|
66
80
|
...getComponentTypeProps(interpretedProps, state),
|
|
67
81
|
// This is too dynamic to be typed correctly, so we allow any here
|
|
@@ -74,7 +88,8 @@ export const fillComponent = (
|
|
|
74
88
|
export function fillComponents(
|
|
75
89
|
components: LunaticComponentDefinition[],
|
|
76
90
|
state: FillComponentArgs,
|
|
77
|
-
parentType?: LunaticComponentDefinition['componentType']
|
|
91
|
+
parentType?: LunaticComponentDefinition['componentType'],
|
|
92
|
+
parentConditionFilter?: VTLScalarExpression
|
|
78
93
|
): LunaticComponentProps[] {
|
|
79
94
|
// Flatmap to directly remove FilterDescription components if disableFiltersDescription is true
|
|
80
95
|
const filledComponents = components.flatMap((component) => {
|
|
@@ -85,7 +100,7 @@ export function fillComponents(
|
|
|
85
100
|
return [];
|
|
86
101
|
}
|
|
87
102
|
|
|
88
|
-
return [fillComponent(component, state)];
|
|
103
|
+
return [fillComponent(component, state, parentConditionFilter)];
|
|
89
104
|
});
|
|
90
105
|
|
|
91
106
|
if (state.disableFilters) {
|
|
@@ -45,7 +45,12 @@ function getChildComponents(
|
|
|
45
45
|
state: State
|
|
46
46
|
) {
|
|
47
47
|
return {
|
|
48
|
-
components: fillComponents(
|
|
48
|
+
components: fillComponents(
|
|
49
|
+
component.components,
|
|
50
|
+
state,
|
|
51
|
+
undefined,
|
|
52
|
+
component.conditionFilter
|
|
53
|
+
),
|
|
49
54
|
};
|
|
50
55
|
}
|
|
51
56
|
|
|
@@ -208,6 +208,7 @@ describe('getOptionsProp()', () => {
|
|
|
208
208
|
|
|
209
209
|
// Ensure the option is not filtered
|
|
210
210
|
expect(options).toHaveLength(1);
|
|
211
|
+
expect(options[0].shouldBeFiltered).toBe(false);
|
|
211
212
|
});
|
|
212
213
|
it('should not filter option (radio) when its conditionFilter evaluation fails', () => {
|
|
213
214
|
const definition = {
|
|
@@ -237,6 +238,7 @@ describe('getOptionsProp()', () => {
|
|
|
237
238
|
|
|
238
239
|
// Ensure the option is not filtered
|
|
239
240
|
expect(options).toHaveLength(1);
|
|
241
|
+
expect(options[0].shouldBeFiltered).toBe(false);
|
|
240
242
|
});
|
|
241
243
|
it('should not filter any response (CheckboxGroup) when disableFilters is true', () => {
|
|
242
244
|
const definition = {
|
|
@@ -268,6 +270,8 @@ describe('getOptionsProp()', () => {
|
|
|
268
270
|
|
|
269
271
|
// Ensure the option is not filtered
|
|
270
272
|
expect(options).toHaveLength(1);
|
|
273
|
+
// the option should would have been filtered if we did not disable filters
|
|
274
|
+
expect(options[0].shouldBeFiltered).toBe(true);
|
|
271
275
|
});
|
|
272
276
|
it('should not filter any option (Radio) when disableFilters is true', () => {
|
|
273
277
|
const definition = {
|
|
@@ -296,7 +300,67 @@ describe('getOptionsProp()', () => {
|
|
|
296
300
|
true // disableFilters = true
|
|
297
301
|
);
|
|
298
302
|
|
|
303
|
+
// Ensure the option is not filtered
|
|
304
|
+
expect(options).toHaveLength(1);
|
|
305
|
+
// the option should would have been filtered if we did not disable filters
|
|
306
|
+
expect(options[0].shouldBeFiltered).toBe(true);
|
|
307
|
+
});
|
|
308
|
+
it('should set the response (CheckboxGroup) shouldBeFiltered=true when the parent component should be filtered', () => {
|
|
309
|
+
const definition = {
|
|
310
|
+
...checkboxGroupDefinition,
|
|
311
|
+
responses: [
|
|
312
|
+
{
|
|
313
|
+
label: 'Option 1',
|
|
314
|
+
response: { name: 'O1' },
|
|
315
|
+
id: 'id1',
|
|
316
|
+
conditionFilter: { type: 'VTL', value: 'expression' },
|
|
317
|
+
},
|
|
318
|
+
],
|
|
319
|
+
} satisfies DeepTranslateExpression<LunaticComponentDefinition>;
|
|
320
|
+
|
|
321
|
+
const options = getOptionsProp(
|
|
322
|
+
definition,
|
|
323
|
+
variables,
|
|
324
|
+
mockChange,
|
|
325
|
+
undefined,
|
|
326
|
+
undefined,
|
|
327
|
+
mockLogger,
|
|
328
|
+
true, // disableFilters = true
|
|
329
|
+
true // parent component should be filtered
|
|
330
|
+
);
|
|
331
|
+
|
|
332
|
+
// Ensure the option is not filtered
|
|
333
|
+
expect(options).toHaveLength(1);
|
|
334
|
+
// the option would have been filtered if we did not disable filters because its parent would
|
|
335
|
+
expect(options[0].shouldBeFiltered).toBe(true);
|
|
336
|
+
});
|
|
337
|
+
it('should set the option (Radio) shouldBeFiltered=true when the parent component should be filtered', () => {
|
|
338
|
+
const definition = {
|
|
339
|
+
...radioDefinition,
|
|
340
|
+
options: [
|
|
341
|
+
{
|
|
342
|
+
label: 'Option 1',
|
|
343
|
+
value: 'id1',
|
|
344
|
+
conditionFilter: { type: 'VTL', value: 'expression' },
|
|
345
|
+
},
|
|
346
|
+
],
|
|
347
|
+
} as any as DeepTranslateExpression<LunaticComponentDefinition>;
|
|
348
|
+
|
|
349
|
+
const options = getOptionsProp(
|
|
350
|
+
definition,
|
|
351
|
+
variables,
|
|
352
|
+
mockChange,
|
|
353
|
+
undefined,
|
|
354
|
+
undefined,
|
|
355
|
+
mockLogger,
|
|
356
|
+
true, // disableFilters = true
|
|
357
|
+
true // parent component should be filtered
|
|
358
|
+
);
|
|
359
|
+
|
|
360
|
+
// Ensure the option is not filtered
|
|
299
361
|
expect(options).toHaveLength(1);
|
|
362
|
+
// the option would have been filtered if we did not disable filters because its parent would
|
|
363
|
+
expect(options[0].shouldBeFiltered).toBe(true);
|
|
300
364
|
});
|
|
301
365
|
});
|
|
302
366
|
});
|