@inseefr/lunatic 3.5.1 → 3.5.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/FilterDescription/FilterDescription.d.ts +5 -7
- package/components/FilterDescription/FilterDescription.js +10 -3
- package/components/FilterDescription/FilterDescription.js.map +1 -1
- package/components/InputNumber/InputNumber.js +2 -2
- package/components/InputNumber/InputNumber.js.map +1 -1
- package/components/InputNumber/InputNumberThousand.d.ts +2 -1
- package/components/InputNumber/InputNumberThousand.js +14 -6
- package/components/InputNumber/InputNumberThousand.js.map +1 -1
- package/components/library.d.ts +2 -4
- package/components/shared/HOC/slottableComponent.d.ts +2 -0
- package/components/shared/HOC/slottableComponent.js.map +1 -1
- package/esm/components/FilterDescription/FilterDescription.d.ts +5 -7
- package/esm/components/FilterDescription/FilterDescription.js +8 -1
- package/esm/components/FilterDescription/FilterDescription.js.map +1 -1
- package/esm/components/InputNumber/InputNumber.js +2 -2
- package/esm/components/InputNumber/InputNumber.js.map +1 -1
- package/esm/components/InputNumber/InputNumberThousand.d.ts +2 -1
- package/esm/components/InputNumber/InputNumberThousand.js +14 -6
- package/esm/components/InputNumber/InputNumberThousand.js.map +1 -1
- package/esm/components/library.d.ts +2 -4
- package/esm/components/shared/HOC/slottableComponent.d.ts +2 -0
- package/esm/components/shared/HOC/slottableComponent.js.map +1 -1
- package/esm/type.source.d.ts +5 -1
- package/esm/use-lunatic/commons/fill-components/fill-component.spec.d.ts +1 -0
- package/esm/use-lunatic/commons/fill-components/fill-component.spec.js +485 -0
- package/esm/use-lunatic/commons/fill-components/fill-component.spec.js.map +1 -0
- package/esm/use-lunatic/commons/fill-components/fill-components.d.ts +3 -3
- package/esm/use-lunatic/commons/fill-components/fill-components.js +29 -5
- package/esm/use-lunatic/commons/fill-components/fill-components.js.map +1 -1
- package/esm/use-lunatic/props/getComponentTypeProps.d.ts +4 -4
- 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 +1 -1
- package/esm/use-lunatic/props/propOptions.js +5 -3
- package/esm/use-lunatic/props/propOptions.js.map +1 -1
- package/esm/use-lunatic/props/propOptions.spec.js +100 -2
- package/esm/use-lunatic/props/propOptions.spec.js.map +1 -1
- package/esm/use-lunatic/reducer/reducerInitializer.d.ts +2 -1
- package/esm/use-lunatic/reducer/reducerInitializer.js +3 -3
- package/esm/use-lunatic/reducer/reducerInitializer.js.map +1 -1
- package/esm/use-lunatic/replace-component-sequence.d.ts +1 -1
- package/esm/use-lunatic/type.d.ts +3 -0
- package/esm/use-lunatic/use-lunatic.js +3 -1
- package/esm/use-lunatic/use-lunatic.js.map +1 -1
- package/package.json +8 -2
- package/src/components/FilterDescription/FilterDescription.tsx +24 -13
- package/src/components/InputNumber/InputNumber.tsx +2 -0
- package/src/components/InputNumber/InputNumberThousand.tsx +13 -5
- package/src/components/shared/HOC/slottableComponent.tsx +2 -0
- package/src/stories/behaviour/paste/test.stories.jsx +5 -0
- package/src/stories/filter-description/filter-description.stories.jsx +7 -3
- package/src/stories/loop/roster-for-loop.stories.jsx +1 -4
- package/src/stories/loop/source-roster.json +65 -2
- package/src/stories/utils/default-arg-types.js +1 -1
- package/src/stories/utils/orchestrator.jsx +3 -3
- package/src/type.source.ts +6 -1
- package/src/use-lunatic/commons/fill-components/fill-component.spec.ts +581 -0
- package/src/use-lunatic/commons/fill-components/fill-components.ts +39 -7
- package/src/use-lunatic/props/getComponentTypeProps.ts +15 -11
- package/src/use-lunatic/props/propOptions.spec.ts +140 -2
- package/src/use-lunatic/props/propOptions.ts +8 -3
- package/src/use-lunatic/reducer/reducerInitializer.tsx +4 -2
- package/src/use-lunatic/type.ts +5 -0
- package/src/use-lunatic/use-lunatic.ts +3 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/type.source.d.ts +5 -1
- package/use-lunatic/commons/fill-components/fill-component.spec.d.ts +1 -0
- package/use-lunatic/commons/fill-components/fill-component.spec.js +487 -0
- package/use-lunatic/commons/fill-components/fill-component.spec.js.map +1 -0
- package/use-lunatic/commons/fill-components/fill-components.d.ts +3 -3
- package/use-lunatic/commons/fill-components/fill-components.js +26 -5
- package/use-lunatic/commons/fill-components/fill-components.js.map +1 -1
- package/use-lunatic/props/getComponentTypeProps.d.ts +4 -4
- package/use-lunatic/props/getComponentTypeProps.js +1 -1
- package/use-lunatic/props/getComponentTypeProps.js.map +1 -1
- package/use-lunatic/props/propOptions.d.ts +1 -1
- package/use-lunatic/props/propOptions.js +5 -3
- package/use-lunatic/props/propOptions.js.map +1 -1
- package/use-lunatic/props/propOptions.spec.js +100 -2
- package/use-lunatic/props/propOptions.spec.js.map +1 -1
- package/use-lunatic/reducer/reducerInitializer.d.ts +2 -1
- package/use-lunatic/reducer/reducerInitializer.js +3 -3
- package/use-lunatic/reducer/reducerInitializer.js.map +1 -1
- package/use-lunatic/replace-component-sequence.d.ts +1 -1
- package/use-lunatic/type.d.ts +3 -0
- package/use-lunatic/use-lunatic.js +3 -1
- package/use-lunatic/use-lunatic.js.map +1 -1
- package/src/stories/loop/source-with-header.json +0 -128
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
+
import { fillComponents } from './fill-components';
|
|
3
|
+
import { LunaticVariablesStore } from '../variables/lunatic-variables-store';
|
|
4
|
+
const defaultMockVariables = LunaticVariablesStore.makeFromObject({
|
|
5
|
+
TESTTEXTE: 'Some test value',
|
|
6
|
+
});
|
|
7
|
+
const defaultMockState = {
|
|
8
|
+
handleChanges: vi.fn(),
|
|
9
|
+
executeExpression: (expression) => expression.value,
|
|
10
|
+
goToPage: vi.fn(),
|
|
11
|
+
goNextPage: vi.fn(),
|
|
12
|
+
goPreviousPage: vi.fn(),
|
|
13
|
+
logger: vi.fn(),
|
|
14
|
+
pager: { page: 1, maxPage: 1 },
|
|
15
|
+
variables: defaultMockVariables,
|
|
16
|
+
};
|
|
17
|
+
// in every test, filledComponents is forced to any type since the function
|
|
18
|
+
// fillComponent does not handle types well, returning object forced as any
|
|
19
|
+
describe('fillComponents', () => {
|
|
20
|
+
it('should fill an Input component correctly', () => {
|
|
21
|
+
const components = [
|
|
22
|
+
{
|
|
23
|
+
componentType: 'Input',
|
|
24
|
+
response: {
|
|
25
|
+
name: 'TESTINPUT',
|
|
26
|
+
},
|
|
27
|
+
conditionFilter: {
|
|
28
|
+
type: 'VTL',
|
|
29
|
+
value: 'true',
|
|
30
|
+
},
|
|
31
|
+
id: 'kfxn6f16',
|
|
32
|
+
page: '1',
|
|
33
|
+
label: {
|
|
34
|
+
type: 'VTL|MD',
|
|
35
|
+
value: '"Input label"',
|
|
36
|
+
},
|
|
37
|
+
mandatory: true,
|
|
38
|
+
maxLength: 15,
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
const mockVariables = LunaticVariablesStore.makeFromObject({
|
|
42
|
+
TESTINPUT: 'Some test value',
|
|
43
|
+
});
|
|
44
|
+
const mockState = {
|
|
45
|
+
...defaultMockState,
|
|
46
|
+
variables: mockVariables,
|
|
47
|
+
};
|
|
48
|
+
const filledComponents = fillComponents(components, mockState);
|
|
49
|
+
const input = filledComponents[0];
|
|
50
|
+
expect(input.componentType).toBe('Input');
|
|
51
|
+
expect(input.id).toBe('kfxn6f16');
|
|
52
|
+
expect(input.label).toBe('"Input label"');
|
|
53
|
+
expect(input.response.name).toBe('TESTINPUT');
|
|
54
|
+
expect(input.required).toBe(true);
|
|
55
|
+
expect(input.maxLength).toBe(15);
|
|
56
|
+
expect(input.conditionFilter).toBe(true);
|
|
57
|
+
});
|
|
58
|
+
it('should fill a Radio component correctly with options', () => {
|
|
59
|
+
const components = [
|
|
60
|
+
{
|
|
61
|
+
id: 'radio',
|
|
62
|
+
componentType: 'Radio',
|
|
63
|
+
mandatory: false,
|
|
64
|
+
page: '1',
|
|
65
|
+
label: {
|
|
66
|
+
value: '"Radio label"',
|
|
67
|
+
type: 'VTL|MD',
|
|
68
|
+
},
|
|
69
|
+
conditionFilter: {
|
|
70
|
+
type: 'VTL',
|
|
71
|
+
value: '"true"',
|
|
72
|
+
},
|
|
73
|
+
options: [
|
|
74
|
+
{
|
|
75
|
+
value: '1',
|
|
76
|
+
description: {
|
|
77
|
+
value: '"Déclaration oui"',
|
|
78
|
+
type: 'VTL|MD',
|
|
79
|
+
},
|
|
80
|
+
label: {
|
|
81
|
+
value: '"oui"',
|
|
82
|
+
type: 'VTL|MD',
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
value: '2',
|
|
87
|
+
description: {
|
|
88
|
+
value: '"Déclaration non"',
|
|
89
|
+
type: 'VTL|MD',
|
|
90
|
+
},
|
|
91
|
+
label: {
|
|
92
|
+
value: '"non"',
|
|
93
|
+
type: 'VTL|MD',
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
response: {
|
|
98
|
+
name: 'TESTRADIO',
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
];
|
|
102
|
+
const mockVariables = LunaticVariablesStore.makeFromObject({
|
|
103
|
+
TESTRADIO: '1',
|
|
104
|
+
});
|
|
105
|
+
const mockState = {
|
|
106
|
+
...defaultMockState,
|
|
107
|
+
variables: mockVariables,
|
|
108
|
+
};
|
|
109
|
+
const filledComponents = fillComponents(components, mockState);
|
|
110
|
+
const radio = filledComponents[0];
|
|
111
|
+
expect(radio.componentType).toBe('Radio');
|
|
112
|
+
expect(radio.id).toBe('radio');
|
|
113
|
+
expect(radio.label).toBe('"Radio label"');
|
|
114
|
+
expect(radio.options).toHaveLength(2);
|
|
115
|
+
expect(radio.options[0].label).toBe('"oui"');
|
|
116
|
+
expect(radio.options[1].label).toBe('"non"');
|
|
117
|
+
expect(radio.conditionFilter).toBe(true);
|
|
118
|
+
expect(radio.response.name).toBe('TESTRADIO');
|
|
119
|
+
});
|
|
120
|
+
it('should fill a Question component with a child Input correctly', () => {
|
|
121
|
+
const components = [
|
|
122
|
+
{
|
|
123
|
+
id: 'question-m8ilvkbt',
|
|
124
|
+
componentType: 'Question',
|
|
125
|
+
page: '1',
|
|
126
|
+
label: {
|
|
127
|
+
value: '"Question label"',
|
|
128
|
+
type: 'VTL|MD',
|
|
129
|
+
},
|
|
130
|
+
conditionFilter: {
|
|
131
|
+
type: 'VTL',
|
|
132
|
+
value: 'true',
|
|
133
|
+
},
|
|
134
|
+
components: [
|
|
135
|
+
{
|
|
136
|
+
id: 'm8ilvkbt',
|
|
137
|
+
componentType: 'Input',
|
|
138
|
+
page: '1',
|
|
139
|
+
maxLength: 249,
|
|
140
|
+
response: {
|
|
141
|
+
name: 'TESTTEXTE',
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
|
+
},
|
|
146
|
+
];
|
|
147
|
+
const mockVariables = LunaticVariablesStore.makeFromObject({
|
|
148
|
+
TESTTEXTE: 'some value',
|
|
149
|
+
});
|
|
150
|
+
const mockState = {
|
|
151
|
+
...defaultMockState,
|
|
152
|
+
variables: mockVariables,
|
|
153
|
+
};
|
|
154
|
+
const filledComponents = fillComponents(components, mockState);
|
|
155
|
+
const question = filledComponents[0];
|
|
156
|
+
expect(question.componentType).toBe('Question');
|
|
157
|
+
expect(question.id).toBe('question-m8ilvkbt');
|
|
158
|
+
expect(question.label).toBe('"Question label"');
|
|
159
|
+
expect(question.conditionFilter).toBe(true);
|
|
160
|
+
expect(question.components.length).toBe(1);
|
|
161
|
+
const input = question.components[0];
|
|
162
|
+
expect(input.componentType).toBe('Input');
|
|
163
|
+
expect(input.id).toBe('m8ilvkbt');
|
|
164
|
+
expect(input.maxLength).toBe(249);
|
|
165
|
+
expect(input.response.name).toBe('TESTTEXTE');
|
|
166
|
+
});
|
|
167
|
+
it('should fill multiple components correctly', () => {
|
|
168
|
+
const components = [
|
|
169
|
+
{
|
|
170
|
+
id: 'input1',
|
|
171
|
+
componentType: 'Input',
|
|
172
|
+
page: '1',
|
|
173
|
+
maxLength: 100,
|
|
174
|
+
response: {
|
|
175
|
+
name: 'TESTINPUT',
|
|
176
|
+
},
|
|
177
|
+
label: {
|
|
178
|
+
type: 'VTL|MD',
|
|
179
|
+
value: '"Input label"',
|
|
180
|
+
},
|
|
181
|
+
conditionFilter: {
|
|
182
|
+
type: 'VTL',
|
|
183
|
+
value: 'true',
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
id: 'radio1',
|
|
188
|
+
componentType: 'Radio',
|
|
189
|
+
page: '1',
|
|
190
|
+
label: {
|
|
191
|
+
type: 'VTL|MD',
|
|
192
|
+
value: '"Radio label"',
|
|
193
|
+
},
|
|
194
|
+
options: [
|
|
195
|
+
{ value: 'yes', label: { value: '"Yes"', type: 'VTL|MD' } },
|
|
196
|
+
{ value: 'no', label: { value: '"No"', type: 'VTL|MD' } },
|
|
197
|
+
],
|
|
198
|
+
response: {
|
|
199
|
+
name: 'TESTRADIO',
|
|
200
|
+
},
|
|
201
|
+
conditionFilter: {
|
|
202
|
+
type: 'VTL',
|
|
203
|
+
value: 'true',
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
];
|
|
207
|
+
const mockVariables = LunaticVariablesStore.makeFromObject({
|
|
208
|
+
TESTINPUT: 'Filled input',
|
|
209
|
+
TESTRADIO: 'yes',
|
|
210
|
+
});
|
|
211
|
+
const mockState = {
|
|
212
|
+
...defaultMockState,
|
|
213
|
+
variables: mockVariables,
|
|
214
|
+
};
|
|
215
|
+
const filledComponents = fillComponents(components, mockState);
|
|
216
|
+
expect(filledComponents).toHaveLength(2);
|
|
217
|
+
const input = filledComponents[0];
|
|
218
|
+
expect(input.componentType).toBe('Input');
|
|
219
|
+
expect(input.response.name).toBe('TESTINPUT');
|
|
220
|
+
expect(input.maxLength).toBe(100);
|
|
221
|
+
const radio = filledComponents[1];
|
|
222
|
+
expect(radio.componentType).toBe('Radio');
|
|
223
|
+
expect(radio.response.name).toBe('TESTRADIO');
|
|
224
|
+
expect(radio.options[0].label).toBe('"Yes"');
|
|
225
|
+
expect(radio.options[1].label).toBe('"No"');
|
|
226
|
+
});
|
|
227
|
+
it('should filter out FilterDescription components if disableFiltersDescription is true', () => {
|
|
228
|
+
const components = [
|
|
229
|
+
{
|
|
230
|
+
id: 'filter-desc',
|
|
231
|
+
componentType: 'FilterDescription',
|
|
232
|
+
page: '1',
|
|
233
|
+
label: {
|
|
234
|
+
type: 'VTL|MD',
|
|
235
|
+
value: '"filter description"',
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
id: 'input1',
|
|
240
|
+
componentType: 'Input',
|
|
241
|
+
page: '1',
|
|
242
|
+
maxLength: 100,
|
|
243
|
+
response: {
|
|
244
|
+
name: 'TESTINPUT',
|
|
245
|
+
},
|
|
246
|
+
label: {
|
|
247
|
+
type: 'VTL|MD',
|
|
248
|
+
value: '"Input label"',
|
|
249
|
+
},
|
|
250
|
+
conditionFilter: {
|
|
251
|
+
type: 'VTL',
|
|
252
|
+
value: 'true',
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
];
|
|
256
|
+
const mockVariables = LunaticVariablesStore.makeFromObject({
|
|
257
|
+
TESTINPUT: 'Filled input',
|
|
258
|
+
});
|
|
259
|
+
const mockState = {
|
|
260
|
+
...defaultMockState,
|
|
261
|
+
variables: mockVariables,
|
|
262
|
+
disableFiltersDescription: true,
|
|
263
|
+
};
|
|
264
|
+
const filledComponents = fillComponents(components, mockState);
|
|
265
|
+
expect(filledComponents).toHaveLength(1);
|
|
266
|
+
const input = filledComponents[0];
|
|
267
|
+
expect(input.componentType).toBe('Input');
|
|
268
|
+
});
|
|
269
|
+
it('should keep FilterDescription components if disableFiltersDescription is false', () => {
|
|
270
|
+
const components = [
|
|
271
|
+
{
|
|
272
|
+
id: 'filter-desc',
|
|
273
|
+
componentType: 'FilterDescription',
|
|
274
|
+
page: '1',
|
|
275
|
+
label: {
|
|
276
|
+
type: 'VTL|MD',
|
|
277
|
+
value: '"Some filter description"',
|
|
278
|
+
},
|
|
279
|
+
conditionFilter: {
|
|
280
|
+
type: 'VTL',
|
|
281
|
+
value: 'true',
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
id: 'input1',
|
|
286
|
+
componentType: 'Input',
|
|
287
|
+
page: '1',
|
|
288
|
+
maxLength: 100,
|
|
289
|
+
response: {
|
|
290
|
+
name: 'TESTINPUT',
|
|
291
|
+
},
|
|
292
|
+
label: {
|
|
293
|
+
type: 'VTL|MD',
|
|
294
|
+
value: '"Input label"',
|
|
295
|
+
},
|
|
296
|
+
conditionFilter: {
|
|
297
|
+
type: 'VTL',
|
|
298
|
+
value: 'true',
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
];
|
|
302
|
+
const mockVariables = LunaticVariablesStore.makeFromObject({
|
|
303
|
+
TESTINPUT: 'Filled input',
|
|
304
|
+
});
|
|
305
|
+
const mockState = {
|
|
306
|
+
...defaultMockState,
|
|
307
|
+
variables: mockVariables,
|
|
308
|
+
disableFiltersDescription: false,
|
|
309
|
+
};
|
|
310
|
+
const filledComponents = fillComponents(components, mockState);
|
|
311
|
+
expect(filledComponents).toHaveLength(2);
|
|
312
|
+
expect(filledComponents[0].componentType).toBe('FilterDescription');
|
|
313
|
+
expect(filledComponents[1].componentType).toBe('Input');
|
|
314
|
+
});
|
|
315
|
+
it('should filter out components with conditionFilter=false when disableFilters is false or undefined', () => {
|
|
316
|
+
const components = [
|
|
317
|
+
{
|
|
318
|
+
id: 'input1',
|
|
319
|
+
componentType: 'Input',
|
|
320
|
+
page: '1',
|
|
321
|
+
response: {
|
|
322
|
+
name: 'TESTINPUT',
|
|
323
|
+
},
|
|
324
|
+
label: {
|
|
325
|
+
type: 'VTL|MD',
|
|
326
|
+
value: '"Should be kept even with conditionFilter false"',
|
|
327
|
+
},
|
|
328
|
+
conditionFilter: {
|
|
329
|
+
type: 'VTL',
|
|
330
|
+
// value should be string, but did not find how to execute correctly with mocks
|
|
331
|
+
// for having a false conditionFilter at the end
|
|
332
|
+
value: false,
|
|
333
|
+
},
|
|
334
|
+
},
|
|
335
|
+
];
|
|
336
|
+
const mockVariables = LunaticVariablesStore.makeFromObject({
|
|
337
|
+
TESTINPUT: 'Some value',
|
|
338
|
+
});
|
|
339
|
+
const mockState = {
|
|
340
|
+
...defaultMockState,
|
|
341
|
+
variables: mockVariables,
|
|
342
|
+
disableFilters: false,
|
|
343
|
+
};
|
|
344
|
+
const filledComponents = fillComponents(components, mockState);
|
|
345
|
+
expect(filledComponents).toHaveLength(0);
|
|
346
|
+
});
|
|
347
|
+
it('should not filter out components with conditionFilter=false when disableFilters is true', () => {
|
|
348
|
+
const components = [
|
|
349
|
+
{
|
|
350
|
+
id: 'input1',
|
|
351
|
+
componentType: 'Input',
|
|
352
|
+
page: '1',
|
|
353
|
+
response: {
|
|
354
|
+
name: 'TESTINPUT',
|
|
355
|
+
},
|
|
356
|
+
label: {
|
|
357
|
+
type: 'VTL|MD',
|
|
358
|
+
value: '"Should be kept even with conditionFilter false"',
|
|
359
|
+
},
|
|
360
|
+
conditionFilter: {
|
|
361
|
+
type: 'VTL',
|
|
362
|
+
// value should be string, but did not find how to execute correctly with mocks
|
|
363
|
+
// for having a false conditionFilter at the end
|
|
364
|
+
value: false,
|
|
365
|
+
},
|
|
366
|
+
},
|
|
367
|
+
];
|
|
368
|
+
const mockVariables = LunaticVariablesStore.makeFromObject({
|
|
369
|
+
TESTINPUT: 'Some value',
|
|
370
|
+
});
|
|
371
|
+
const mockState = {
|
|
372
|
+
...defaultMockState,
|
|
373
|
+
variables: mockVariables,
|
|
374
|
+
disableFilters: true,
|
|
375
|
+
};
|
|
376
|
+
const filledComponents = fillComponents(components, mockState);
|
|
377
|
+
expect(filledComponents).toHaveLength(1);
|
|
378
|
+
const input = filledComponents[0];
|
|
379
|
+
expect(input.id).toBe('input1');
|
|
380
|
+
expect(input.conditionFilter).toBe(false);
|
|
381
|
+
});
|
|
382
|
+
it('should transform components into Text with empty label when conditionFilter is false and parentType is RosterForLoop', () => {
|
|
383
|
+
const components = [
|
|
384
|
+
{
|
|
385
|
+
id: 'input1',
|
|
386
|
+
componentType: 'Input',
|
|
387
|
+
page: '1',
|
|
388
|
+
label: { value: '"Input label"', type: 'VTL|MD' },
|
|
389
|
+
conditionFilter: {
|
|
390
|
+
type: 'VTL',
|
|
391
|
+
// value should be string, but did not find how to execute correctly with mocks
|
|
392
|
+
// for having a false conditionFilter at the end
|
|
393
|
+
value: false,
|
|
394
|
+
},
|
|
395
|
+
response: { name: 'TESTINPUT' },
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
id: 'radio1',
|
|
399
|
+
componentType: 'Radio',
|
|
400
|
+
page: '1',
|
|
401
|
+
label: { value: '"Radio label"', type: 'VTL|MD' },
|
|
402
|
+
options: [
|
|
403
|
+
{ value: 'yes', label: { value: '"Yes"', type: 'VTL|MD' } },
|
|
404
|
+
{ value: 'no', label: { value: '"No"', type: 'VTL|MD' } },
|
|
405
|
+
],
|
|
406
|
+
response: { name: 'TESTRADIO' },
|
|
407
|
+
},
|
|
408
|
+
];
|
|
409
|
+
const mockVariables = LunaticVariablesStore.makeFromObject({
|
|
410
|
+
TESTINPUT: 'Filled input',
|
|
411
|
+
TESTRADIO: 'yes',
|
|
412
|
+
});
|
|
413
|
+
const mockState = {
|
|
414
|
+
...defaultMockState,
|
|
415
|
+
variables: mockVariables,
|
|
416
|
+
};
|
|
417
|
+
const filledComponents = fillComponents(components, mockState, 'RosterForLoop');
|
|
418
|
+
expect(filledComponents).toHaveLength(2);
|
|
419
|
+
// Check the first component that has conditionFilter: false
|
|
420
|
+
const input = filledComponents[0];
|
|
421
|
+
// The component should be transformed into a Text without label
|
|
422
|
+
expect(input.componentType).toBe('Text');
|
|
423
|
+
expect(input.label).toBe('');
|
|
424
|
+
expect(input.id).toBe('input1');
|
|
425
|
+
// Check the second component that has conditionFilter: true
|
|
426
|
+
const radio = filledComponents[1];
|
|
427
|
+
// The component should remain unchanged
|
|
428
|
+
expect(radio.componentType).toBe('Radio');
|
|
429
|
+
expect(radio.label).toBe('"Radio label"');
|
|
430
|
+
expect(radio.options[0].label).toBe('"Yes"');
|
|
431
|
+
expect(radio.options[1].label).toBe('"No"');
|
|
432
|
+
});
|
|
433
|
+
it('should never transform components into Text when disableFilters is true', () => {
|
|
434
|
+
const components = [
|
|
435
|
+
{
|
|
436
|
+
id: 'input1',
|
|
437
|
+
componentType: 'Input',
|
|
438
|
+
page: '1',
|
|
439
|
+
label: { value: '"Input label"', type: 'VTL|MD' },
|
|
440
|
+
conditionFilter: {
|
|
441
|
+
type: 'VTL',
|
|
442
|
+
// value should be string, but did not find how to execute correctly with mocks
|
|
443
|
+
// for having a false conditionFilter at the end
|
|
444
|
+
value: false,
|
|
445
|
+
},
|
|
446
|
+
response: { name: 'TESTINPUT' },
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
id: 'radio1',
|
|
450
|
+
componentType: 'Radio',
|
|
451
|
+
page: '1',
|
|
452
|
+
label: { value: '"Radio label"', type: 'VTL|MD' },
|
|
453
|
+
options: [
|
|
454
|
+
{ value: 'yes', label: { value: '"Yes"', type: 'VTL|MD' } },
|
|
455
|
+
{ value: 'no', label: { value: '"No"', type: 'VTL|MD' } },
|
|
456
|
+
],
|
|
457
|
+
response: { name: 'TESTRADIO' },
|
|
458
|
+
},
|
|
459
|
+
];
|
|
460
|
+
const mockVariables = LunaticVariablesStore.makeFromObject({
|
|
461
|
+
TESTINPUT: 'Filled input',
|
|
462
|
+
TESTRADIO: 'yes',
|
|
463
|
+
});
|
|
464
|
+
const mockState = {
|
|
465
|
+
...defaultMockState,
|
|
466
|
+
disableFilters: true,
|
|
467
|
+
variables: mockVariables,
|
|
468
|
+
};
|
|
469
|
+
const filledComponents = fillComponents(components, mockState, 'RosterForLoop');
|
|
470
|
+
expect(filledComponents).toHaveLength(2);
|
|
471
|
+
// Check the first component that has conditionFilter: false
|
|
472
|
+
const input = filledComponents[0];
|
|
473
|
+
// The component should remain unchanged
|
|
474
|
+
expect(input.componentType).toBe('Input');
|
|
475
|
+
expect(input.label).toBe('"Input label"');
|
|
476
|
+
// Check the second component that has conditionFilter: true
|
|
477
|
+
const radio = filledComponents[1];
|
|
478
|
+
// The component should remain unchanged
|
|
479
|
+
expect(radio.componentType).toBe('Radio');
|
|
480
|
+
expect(radio.label).toBe('"Radio label"');
|
|
481
|
+
expect(radio.options[0].label).toBe('"Yes"');
|
|
482
|
+
expect(radio.options[1].label).toBe('"No"');
|
|
483
|
+
});
|
|
484
|
+
});
|
|
485
|
+
//# sourceMappingURL=fill-component.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fill-component.spec.js","sourceRoot":"","sources":["../../../../src/use-lunatic/commons/fill-components/fill-component.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAqB,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,MAAM,oBAAoB,GAAG,qBAAqB,CAAC,cAAc,CAAC;IACjE,SAAS,EAAE,iBAAiB;CAC5B,CAAC,CAAC;AAEH,MAAM,gBAAgB,GAAG;IACxB,aAAa,EAAE,EAAE,CAAC,EAAE,EAAE;IACtB,iBAAiB,EAAE,CAAC,UAAe,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK;IACxD,QAAQ,EAAE,EAAE,CAAC,EAAE,EAAE;IACjB,UAAU,EAAE,EAAE,CAAC,EAAE,EAAE;IACnB,cAAc,EAAE,EAAE,CAAC,EAAE,EAAE;IACvB,MAAM,EAAE,EAAE,CAAC,EAAE,EAAE;IACf,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE;IAC9B,SAAS,EAAE,oBAAoB;CAC/B,C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CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { LunaticChangesHandler, LunaticComponentDefinition, LunaticOptions, LunaticReducerState, LunaticState } from '../../type';
|
|
2
2
|
import type { LunaticComponentProps } from '../../../components/type';
|
|
3
3
|
import { LunaticLogger } from '../../logger/type';
|
|
4
|
-
type FillComponentArgs = {
|
|
4
|
+
export type FillComponentArgs = {
|
|
5
5
|
disableFilters?: boolean;
|
|
6
|
+
disableFiltersDescription?: true;
|
|
6
7
|
handleChanges: LunaticChangesHandler;
|
|
7
8
|
executeExpression: LunaticReducerState['executeExpression'];
|
|
8
9
|
goToPage: LunaticState['goToPage'];
|
|
@@ -24,5 +25,4 @@ export declare const fillComponent: (component: LunaticComponentDefinition, stat
|
|
|
24
25
|
/**
|
|
25
26
|
* Fill components with values coming from the state, and interpret VTL expression
|
|
26
27
|
*/
|
|
27
|
-
export declare function fillComponents(components: LunaticComponentDefinition[], state: FillComponentArgs): LunaticComponentProps[];
|
|
28
|
-
export {};
|
|
28
|
+
export declare function fillComponents(components: LunaticComponentDefinition[], state: FillComponentArgs, parentType?: LunaticComponentDefinition['componentType']): LunaticComponentProps[];
|
|
@@ -25,7 +25,7 @@ export const fillComponent = (component, state) => {
|
|
|
25
25
|
missingResponse: getMissingResponseProp(component, state),
|
|
26
26
|
management: state.management,
|
|
27
27
|
iterations: getIterationsProp(component, state),
|
|
28
|
-
options: getOptionsProp(interpretedProps, state.variables, state.handleChanges, state.pager.iteration, value, state.logger),
|
|
28
|
+
options: getOptionsProp(interpretedProps, state.variables, state.handleChanges, state.pager.iteration, value, state.logger, state.disableFilters),
|
|
29
29
|
...getComponentTypeProps(interpretedProps, state),
|
|
30
30
|
// This is too dynamic to be typed correctly, so we allow any here
|
|
31
31
|
};
|
|
@@ -33,9 +33,33 @@ export const fillComponent = (component, state) => {
|
|
|
33
33
|
/**
|
|
34
34
|
* Fill components with values coming from the state, and interpret VTL expression
|
|
35
35
|
*/
|
|
36
|
-
export function fillComponents(components, state) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
export function fillComponents(components, state, parentType) {
|
|
37
|
+
// Flatmap to directly remove FilterDescription components if disableFiltersDescription is true
|
|
38
|
+
const filledComponents = components.flatMap((component) => {
|
|
39
|
+
if (component.componentType === 'FilterDescription' &&
|
|
40
|
+
state.disableFiltersDescription) {
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
return [fillComponent(component, state)];
|
|
44
|
+
});
|
|
45
|
+
if (state.disableFilters) {
|
|
46
|
+
return filledComponents;
|
|
47
|
+
}
|
|
48
|
+
// For rosterForLoop we want empty cell when the component is filtered
|
|
49
|
+
if (parentType === 'RosterForLoop') {
|
|
50
|
+
return filledComponents.map((filledComponent) => {
|
|
51
|
+
var _a;
|
|
52
|
+
return ((_a = filledComponent.conditionFilter) !== null && _a !== void 0 ? _a : true)
|
|
53
|
+
? filledComponent
|
|
54
|
+
: // Replace the component by an empty text component
|
|
55
|
+
{
|
|
56
|
+
...filledComponent,
|
|
57
|
+
label: '',
|
|
58
|
+
componentType: 'Text',
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
// Remove filtered component (conditionFilter must be true to keep a component)
|
|
63
|
+
return filledComponents.filter(({ conditionFilter }) => conditionFilter !== null && conditionFilter !== void 0 ? conditionFilter : true);
|
|
40
64
|
}
|
|
41
65
|
//# sourceMappingURL=fill-components.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fill-components.js","sourceRoot":"","sources":["../../../../src/use-lunatic/commons/fill-components/fill-components.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"fill-components.js","sourceRoot":"","sources":["../../../../src/use-lunatic/commons/fill-components/fill-components.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAmBzD;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAC5B,SAAqC,EACrC,KAAwB,EACgC,EAAE;IAC1D,MAAM,gBAAgB,GAAG,wBAAwB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IACpE,MAAM,KAAK,GAAG,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAC7C,OAAO;QACN,GAAG,gBAAgB;QACnB,aAAa,EAAE,KAAK,CAAC,aAAa;QAClC,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;QAC1C,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,cAAc,EAAE,KAAK,CAAC,cAAc;QACpC,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS;QAChC,QAAQ,EAAE,WAAW,IAAI,SAAS,CAA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wBAClB,KAAK,EAAE,EAAE;wBACT,aAAa,EAAE,MAAM;qBACK,CAAA;SAAA,CAC7B,CAAC;IACH,CAAC;IAED,+EAA+E;IAC/E,OAAO,gBAAgB,CAAC,MAAM,CAC7B,CAAC,EAAE,eAAe,EAAE,EAAE,EAAE,CAAC,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,IAAI,CAChD,CAAC;AACH,CAAC"}
|
|
@@ -269,6 +269,10 @@ export declare function getComponentTypeProps(component: DeepTranslateExpression
|
|
|
269
269
|
}[];
|
|
270
270
|
} & {
|
|
271
271
|
conditionFilter?: boolean;
|
|
272
|
+
}) | (Pick<import("../../components/type").LunaticBaseProps<string>, "label" | "id"> & import("../..").LunaticExtraProps & {
|
|
273
|
+
componentType?: "FilterDescription";
|
|
274
|
+
} & {
|
|
275
|
+
conditionFilter?: boolean;
|
|
272
276
|
}) | (import("../../components/type").LunaticBaseProps<boolean> & import("../..").LunaticExtraProps & {
|
|
273
277
|
response: {
|
|
274
278
|
name: string;
|
|
@@ -280,10 +284,6 @@ export declare function getComponentTypeProps(component: DeepTranslateExpression
|
|
|
280
284
|
componentType?: "Switch";
|
|
281
285
|
} & {
|
|
282
286
|
conditionFilter?: boolean;
|
|
283
|
-
}) | (Pick<import("../../components/type").LunaticBaseProps<string>, "label" | "id"> & import("../..").LunaticExtraProps & {
|
|
284
|
-
componentType?: "FilterDescription";
|
|
285
|
-
} & {
|
|
286
|
-
conditionFilter?: boolean;
|
|
287
287
|
}) | {
|
|
288
288
|
label: unknown;
|
|
289
289
|
})[][];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getComponentTypeProps.js","sourceRoot":"","sources":["../../../src/use-lunatic/props/getComponentTypeProps.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EACN,aAAa,EACb,cAAc,GACd,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAA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K,WAAW;YACf,OAAO,iBAAiB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAC5C;YACC,OAAO,EAAE,CAAC;IACZ,CAAC;AACF,CAAC"}
|
|
@@ -17,7 +17,7 @@ export type InterpretedOption = {
|
|
|
17
17
|
/**
|
|
18
18
|
* Compute options for checkboxes / radios
|
|
19
19
|
*/
|
|
20
|
-
export declare function getOptionsProp(definition: DeepTranslateExpression<LunaticComponentDefinition>, variables: LunaticVariablesStore, handleChanges: LunaticChangesHandler, pagerIteration: LunaticState['pager']['iteration'], value: unknown, logger: LunaticLogger): {
|
|
20
|
+
export declare function getOptionsProp(definition: DeepTranslateExpression<LunaticComponentDefinition>, variables: LunaticVariablesStore, handleChanges: LunaticChangesHandler, pagerIteration: LunaticState['pager']['iteration'], value: unknown, logger: LunaticLogger, disableFilters?: boolean): {
|
|
21
21
|
label: ReactNode;
|
|
22
22
|
name: string;
|
|
23
23
|
id: string;
|