@configuratorware/configurator-frontendgui 1.34.2 → 1.35.1
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/App/Modules/Creator/Components/Option/index.js +42 -11
- package/App/Modules/Creator/Components/OptionsList/index.js +4 -1
- package/App/Modules/Creator/Components/ProductPart/index.js +19 -5
- package/App/Modules/Creator/Components/ProductPartsList/index.js +8 -4
- package/App/Modules/Creator/Containers/InvalidConfigurationNotice/index.js +6 -3
- package/App/Modules/Creator/Containers/OptionsList/index.js +5 -0
- package/App/Modules/Creator/Containers/ProductPartsList/index.js +8 -2
- package/App/Reducers/Configurator/Actions.js +80 -12
- package/App/Reducers/Configurator/Reducer.js +34 -1
- package/App/Services/ConfiguratorService.js +5 -0
- package/package.json +4 -4
- package/src/App/Modules/Creator/Components/Option/__snapshots__/index.test.js.snap +126 -67
- package/src/App/Modules/Creator/Components/Option/index.js +32 -3
- package/src/App/Modules/Creator/Components/Option/index.test.js +16 -0
- package/src/App/Modules/Creator/Components/OptionsList/index.js +3 -0
- package/src/App/Modules/Creator/Components/ProductPart/index.js +13 -5
- package/src/App/Modules/Creator/Components/ProductPartsList/index.js +4 -0
- package/src/App/Modules/Creator/Containers/InvalidConfigurationNotice/index.js +4 -1
- package/src/App/Modules/Creator/Containers/OptionsList/index.js +2 -0
- package/src/App/Modules/Creator/Containers/ProductPartsList/index.js +4 -1
- package/src/App/Reducers/Configurator/Actions.js +40 -0
- package/src/App/Reducers/Configurator/Reducer.js +31 -0
- package/src/App/Services/ConfiguratorService.js +4 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Option calls the children prop if provided 1`] = `
|
|
4
4
|
<div
|
|
5
|
-
class="Option-root-
|
|
5
|
+
class="Option-root-133 custom-css-option"
|
|
6
6
|
data-option="010002011000"
|
|
7
7
|
>
|
|
8
8
|
<div
|
|
@@ -23,44 +23,44 @@ exports[`Option calls the render prop if provided 1`] = `
|
|
|
23
23
|
|
|
24
24
|
exports[`Option renders with Delay link 1`] = `
|
|
25
25
|
<div
|
|
26
|
-
class="Option-root-
|
|
26
|
+
class="Option-root-85 custom-css-option"
|
|
27
27
|
data-option="010002011000"
|
|
28
28
|
>
|
|
29
29
|
<div
|
|
30
30
|
class="content 010002011000"
|
|
31
31
|
>
|
|
32
32
|
<div
|
|
33
|
-
class="Option-image-
|
|
33
|
+
class="Option-image-84"
|
|
34
34
|
/>
|
|
35
35
|
<div
|
|
36
|
-
class="Option-text-
|
|
36
|
+
class="Option-text-86"
|
|
37
37
|
>
|
|
38
38
|
<div
|
|
39
39
|
class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-12"
|
|
40
40
|
>
|
|
41
41
|
<div
|
|
42
|
-
class="MuiTypography-root Option-optionList-
|
|
42
|
+
class="MuiTypography-root Option-optionList-82 MuiTypography-body2"
|
|
43
43
|
>
|
|
44
44
|
<div
|
|
45
|
-
class="Option-title-
|
|
45
|
+
class="Option-title-83"
|
|
46
46
|
>
|
|
47
47
|
Argentina 1000
|
|
48
48
|
</div>
|
|
49
49
|
<div
|
|
50
|
-
class="Option-price-
|
|
50
|
+
class="Option-price-79"
|
|
51
51
|
>
|
|
52
52
|
€ 123.00
|
|
53
53
|
</div>
|
|
54
54
|
<div
|
|
55
|
-
class="Option-details-
|
|
55
|
+
class="Option-details-80"
|
|
56
56
|
>
|
|
57
57
|
<div>
|
|
58
58
|
<a
|
|
59
|
-
class="Option-iconWithText-
|
|
59
|
+
class="Option-iconWithText-81"
|
|
60
60
|
>
|
|
61
61
|
<svg
|
|
62
62
|
aria-hidden="true"
|
|
63
|
-
class="MuiSvgIcon-root Option-materialIcon-
|
|
63
|
+
class="MuiSvgIcon-root Option-materialIcon-78"
|
|
64
64
|
focusable="false"
|
|
65
65
|
viewBox="0 0 24 24"
|
|
66
66
|
>
|
|
@@ -84,51 +84,51 @@ exports[`Option renders with Delay link 1`] = `
|
|
|
84
84
|
|
|
85
85
|
exports[`Option renders with Incompatibility link 1`] = `
|
|
86
86
|
<div
|
|
87
|
-
class="Option-root-
|
|
87
|
+
class="Option-root-61 custom-css-option"
|
|
88
88
|
data-option="010002011000"
|
|
89
89
|
>
|
|
90
90
|
<div
|
|
91
91
|
class="content 010002011000"
|
|
92
92
|
>
|
|
93
93
|
<div
|
|
94
|
-
class="Option-image-
|
|
94
|
+
class="Option-image-60"
|
|
95
95
|
/>
|
|
96
96
|
<div
|
|
97
|
-
class="Option-text-
|
|
97
|
+
class="Option-text-62"
|
|
98
98
|
>
|
|
99
99
|
<div
|
|
100
100
|
class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-12"
|
|
101
101
|
>
|
|
102
102
|
<div
|
|
103
|
-
class="MuiTypography-root Option-optionList-
|
|
103
|
+
class="MuiTypography-root Option-optionList-58 MuiTypography-body2"
|
|
104
104
|
>
|
|
105
105
|
<div
|
|
106
|
-
class="Option-title-
|
|
106
|
+
class="Option-title-59"
|
|
107
107
|
>
|
|
108
108
|
Argentina 1000
|
|
109
109
|
</div>
|
|
110
110
|
<div
|
|
111
|
-
class="Option-price-
|
|
111
|
+
class="Option-price-55"
|
|
112
112
|
>
|
|
113
113
|
€ 123.00
|
|
114
114
|
</div>
|
|
115
115
|
<div
|
|
116
|
-
class="Option-description-
|
|
116
|
+
class="Option-description-53"
|
|
117
117
|
>
|
|
118
118
|
<p>
|
|
119
119
|
abstract
|
|
120
120
|
</p>
|
|
121
121
|
</div>
|
|
122
122
|
<div
|
|
123
|
-
class="Option-details-
|
|
123
|
+
class="Option-details-56"
|
|
124
124
|
>
|
|
125
125
|
<div>
|
|
126
126
|
<a
|
|
127
|
-
class="Option-iconWithText-
|
|
127
|
+
class="Option-iconWithText-57"
|
|
128
128
|
>
|
|
129
129
|
<svg
|
|
130
130
|
aria-hidden="true"
|
|
131
|
-
class="MuiSvgIcon-root Option-materialIcon-
|
|
131
|
+
class="MuiSvgIcon-root Option-materialIcon-54 custom-css-rule-info-icon-option"
|
|
132
132
|
focusable="false"
|
|
133
133
|
viewBox="0 0 24 24"
|
|
134
134
|
>
|
|
@@ -137,7 +137,7 @@ exports[`Option renders with Incompatibility link 1`] = `
|
|
|
137
137
|
/>
|
|
138
138
|
</svg>
|
|
139
139
|
<p
|
|
140
|
-
class="MuiTypography-root Option-iconWithText-
|
|
140
|
+
class="MuiTypography-root Option-iconWithText-57 MuiTypography-body2"
|
|
141
141
|
/>
|
|
142
142
|
</a>
|
|
143
143
|
</div>
|
|
@@ -151,43 +151,43 @@ exports[`Option renders with Incompatibility link 1`] = `
|
|
|
151
151
|
|
|
152
152
|
exports[`Option renders with Not Available link 1`] = `
|
|
153
153
|
<div
|
|
154
|
-
class="Option-root-
|
|
154
|
+
class="Option-root-73 custom-css-option"
|
|
155
155
|
data-option="010002011000"
|
|
156
156
|
>
|
|
157
157
|
<div
|
|
158
158
|
class="content 010002011000 disabled"
|
|
159
159
|
>
|
|
160
160
|
<div
|
|
161
|
-
class="Option-image-
|
|
161
|
+
class="Option-image-72"
|
|
162
162
|
/>
|
|
163
163
|
<div
|
|
164
|
-
class="Option-text-
|
|
164
|
+
class="Option-text-74"
|
|
165
165
|
>
|
|
166
166
|
<div
|
|
167
167
|
class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-12"
|
|
168
168
|
>
|
|
169
169
|
<div
|
|
170
|
-
class="MuiTypography-root Option-optionList-
|
|
170
|
+
class="MuiTypography-root Option-optionList-70 MuiTypography-body2"
|
|
171
171
|
>
|
|
172
172
|
<div
|
|
173
|
-
class="Option-title-
|
|
173
|
+
class="Option-title-71"
|
|
174
174
|
>
|
|
175
175
|
Argentina 1000
|
|
176
176
|
</div>
|
|
177
177
|
<div
|
|
178
|
-
class="Option-price-
|
|
178
|
+
class="Option-price-67"
|
|
179
179
|
>
|
|
180
180
|
€ 123.00
|
|
181
181
|
</div>
|
|
182
182
|
<div
|
|
183
|
-
class="Option-details-
|
|
183
|
+
class="Option-details-68"
|
|
184
184
|
>
|
|
185
185
|
<div
|
|
186
|
-
class="Option-iconWithText-
|
|
186
|
+
class="Option-iconWithText-69"
|
|
187
187
|
>
|
|
188
188
|
<svg
|
|
189
189
|
aria-hidden="true"
|
|
190
|
-
class="MuiSvgIcon-root Option-materialIcon-
|
|
190
|
+
class="MuiSvgIcon-root Option-materialIcon-66"
|
|
191
191
|
focusable="false"
|
|
192
192
|
viewBox="0 0 24 24"
|
|
193
193
|
>
|
|
@@ -210,36 +210,36 @@ exports[`Option renders with Not Available link 1`] = `
|
|
|
210
210
|
|
|
211
211
|
exports[`Option renders with Option Group button 1`] = `
|
|
212
212
|
<div
|
|
213
|
-
class="Option-root-
|
|
213
|
+
class="Option-root-97 custom-css-option"
|
|
214
214
|
data-option="010002011000"
|
|
215
215
|
>
|
|
216
216
|
<div
|
|
217
217
|
class="content 010002011000"
|
|
218
218
|
>
|
|
219
219
|
<div
|
|
220
|
-
class="Option-image-
|
|
220
|
+
class="Option-image-96"
|
|
221
221
|
/>
|
|
222
222
|
<div
|
|
223
|
-
class="Option-text-
|
|
223
|
+
class="Option-text-98"
|
|
224
224
|
>
|
|
225
225
|
<div
|
|
226
226
|
class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-12"
|
|
227
227
|
>
|
|
228
228
|
<div
|
|
229
|
-
class="MuiTypography-root Option-optionList-
|
|
229
|
+
class="MuiTypography-root Option-optionList-94 MuiTypography-body2"
|
|
230
230
|
>
|
|
231
231
|
<div
|
|
232
|
-
class="Option-title-
|
|
232
|
+
class="Option-title-95"
|
|
233
233
|
>
|
|
234
234
|
Argentina 1000
|
|
235
235
|
</div>
|
|
236
236
|
<div
|
|
237
|
-
class="Option-price-
|
|
237
|
+
class="Option-price-91"
|
|
238
238
|
>
|
|
239
239
|
€ 123.00
|
|
240
240
|
</div>
|
|
241
241
|
<div
|
|
242
|
-
class="Option-details-
|
|
242
|
+
class="Option-details-92"
|
|
243
243
|
>
|
|
244
244
|
<div>
|
|
245
245
|
<div
|
|
@@ -307,6 +307,65 @@ exports[`Option renders with Option Group button 1`] = `
|
|
|
307
307
|
</div>
|
|
308
308
|
`;
|
|
309
309
|
|
|
310
|
+
exports[`Option renders with TextInput 1`] = `
|
|
311
|
+
<div
|
|
312
|
+
class="Option-root-145 custom-css-option"
|
|
313
|
+
data-option="010002011000"
|
|
314
|
+
>
|
|
315
|
+
<div
|
|
316
|
+
class="content 010002011000"
|
|
317
|
+
>
|
|
318
|
+
<div
|
|
319
|
+
class="Option-image-144"
|
|
320
|
+
>
|
|
321
|
+
<img
|
|
322
|
+
src="/images/options/010002011000.png"
|
|
323
|
+
/>
|
|
324
|
+
</div>
|
|
325
|
+
<div
|
|
326
|
+
class="Option-text-146"
|
|
327
|
+
>
|
|
328
|
+
<div
|
|
329
|
+
class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-12"
|
|
330
|
+
>
|
|
331
|
+
<div
|
|
332
|
+
class="MuiTypography-root Option-optionList-142 MuiTypography-body2"
|
|
333
|
+
>
|
|
334
|
+
<div
|
|
335
|
+
class="Option-title-143"
|
|
336
|
+
>
|
|
337
|
+
Argentina 1000
|
|
338
|
+
</div>
|
|
339
|
+
<div
|
|
340
|
+
class="MuiFormControl-root MuiTextField-root Option-optionTextInput-148"
|
|
341
|
+
>
|
|
342
|
+
<div
|
|
343
|
+
class="MuiInputBase-root MuiInput-root MuiInput-underline Mui-disabled Mui-disabled MuiInputBase-formControl MuiInput-formControl"
|
|
344
|
+
>
|
|
345
|
+
<input
|
|
346
|
+
aria-invalid="false"
|
|
347
|
+
class="MuiInputBase-input MuiInput-input Mui-disabled Mui-disabled"
|
|
348
|
+
disabled=""
|
|
349
|
+
type="text"
|
|
350
|
+
value=""
|
|
351
|
+
/>
|
|
352
|
+
</div>
|
|
353
|
+
</div>
|
|
354
|
+
<div
|
|
355
|
+
class="Option-price-139"
|
|
356
|
+
>
|
|
357
|
+
€ 123.00
|
|
358
|
+
</div>
|
|
359
|
+
<div
|
|
360
|
+
class="Option-details-140"
|
|
361
|
+
/>
|
|
362
|
+
</div>
|
|
363
|
+
</div>
|
|
364
|
+
</div>
|
|
365
|
+
</div>
|
|
366
|
+
</div>
|
|
367
|
+
`;
|
|
368
|
+
|
|
310
369
|
exports[`Option renders with an available image 1`] = `
|
|
311
370
|
<div
|
|
312
371
|
class="Option-root-9 custom-css-option"
|
|
@@ -353,51 +412,51 @@ exports[`Option renders with an available image 1`] = `
|
|
|
353
412
|
|
|
354
413
|
exports[`Option renders with details 1`] = `
|
|
355
414
|
<div
|
|
356
|
-
class="Option-root-
|
|
415
|
+
class="Option-root-49 custom-css-option"
|
|
357
416
|
data-option="010002011000"
|
|
358
417
|
>
|
|
359
418
|
<div
|
|
360
419
|
class="content 010002011000"
|
|
361
420
|
>
|
|
362
421
|
<div
|
|
363
|
-
class="Option-image-
|
|
422
|
+
class="Option-image-48"
|
|
364
423
|
/>
|
|
365
424
|
<div
|
|
366
|
-
class="Option-text-
|
|
425
|
+
class="Option-text-50"
|
|
367
426
|
>
|
|
368
427
|
<div
|
|
369
428
|
class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-12"
|
|
370
429
|
>
|
|
371
430
|
<div
|
|
372
|
-
class="MuiTypography-root Option-optionList-
|
|
431
|
+
class="MuiTypography-root Option-optionList-46 MuiTypography-body2"
|
|
373
432
|
>
|
|
374
433
|
<div
|
|
375
|
-
class="Option-title-
|
|
434
|
+
class="Option-title-47"
|
|
376
435
|
>
|
|
377
436
|
Argentina 1000
|
|
378
437
|
</div>
|
|
379
438
|
<div
|
|
380
|
-
class="Option-price-
|
|
439
|
+
class="Option-price-43"
|
|
381
440
|
>
|
|
382
441
|
€ 123.00
|
|
383
442
|
</div>
|
|
384
443
|
<div
|
|
385
|
-
class="Option-description-
|
|
444
|
+
class="Option-description-41"
|
|
386
445
|
>
|
|
387
446
|
<p>
|
|
388
447
|
abstract
|
|
389
448
|
</p>
|
|
390
449
|
</div>
|
|
391
450
|
<div
|
|
392
|
-
class="Option-details-
|
|
451
|
+
class="Option-details-44"
|
|
393
452
|
>
|
|
394
453
|
<div>
|
|
395
454
|
<a
|
|
396
|
-
class="Option-iconWithText-
|
|
455
|
+
class="Option-iconWithText-45"
|
|
397
456
|
>
|
|
398
457
|
<svg
|
|
399
458
|
aria-hidden="true"
|
|
400
|
-
class="MuiSvgIcon-root Option-materialIcon-
|
|
459
|
+
class="MuiSvgIcon-root Option-materialIcon-42 custom-css-rule-info-icon-option"
|
|
401
460
|
focusable="false"
|
|
402
461
|
viewBox="0 0 24 24"
|
|
403
462
|
>
|
|
@@ -406,7 +465,7 @@ exports[`Option renders with details 1`] = `
|
|
|
406
465
|
/>
|
|
407
466
|
</svg>
|
|
408
467
|
<p
|
|
409
|
-
class="MuiTypography-root Option-iconWithText-
|
|
468
|
+
class="MuiTypography-root Option-iconWithText-45 MuiTypography-body2"
|
|
410
469
|
/>
|
|
411
470
|
</a>
|
|
412
471
|
</div>
|
|
@@ -420,46 +479,46 @@ exports[`Option renders with details 1`] = `
|
|
|
420
479
|
|
|
421
480
|
exports[`Option renders with selectable amount 1`] = `
|
|
422
481
|
<div
|
|
423
|
-
class="Option-root-
|
|
482
|
+
class="Option-root-33 custom-css-option"
|
|
424
483
|
data-option="010002011000"
|
|
425
484
|
>
|
|
426
485
|
<div
|
|
427
|
-
class="content 010002011000 Option-withAmount-
|
|
486
|
+
class="content 010002011000 Option-withAmount-35"
|
|
428
487
|
>
|
|
429
488
|
<div
|
|
430
|
-
class="Option-image-
|
|
489
|
+
class="Option-image-32"
|
|
431
490
|
/>
|
|
432
491
|
<div
|
|
433
|
-
class="Option-text-
|
|
492
|
+
class="Option-text-34"
|
|
434
493
|
>
|
|
435
494
|
<div
|
|
436
495
|
class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-12"
|
|
437
496
|
>
|
|
438
497
|
<div
|
|
439
|
-
class="MuiTypography-root Option-optionList-
|
|
498
|
+
class="MuiTypography-root Option-optionList-30 MuiTypography-body2"
|
|
440
499
|
>
|
|
441
500
|
<div
|
|
442
|
-
class="Option-title-
|
|
501
|
+
class="Option-title-31"
|
|
443
502
|
>
|
|
444
503
|
Argentina 1000
|
|
445
504
|
</div>
|
|
446
505
|
<div
|
|
447
|
-
class="Option-price-
|
|
506
|
+
class="Option-price-27"
|
|
448
507
|
>
|
|
449
508
|
€ 123.00
|
|
450
509
|
</div>
|
|
451
510
|
<div
|
|
452
|
-
class="Option-details-
|
|
511
|
+
class="Option-details-28"
|
|
453
512
|
/>
|
|
454
513
|
</div>
|
|
455
514
|
</div>
|
|
456
515
|
</div>
|
|
457
516
|
<div
|
|
458
|
-
class="OptionAmount-root-
|
|
517
|
+
class="OptionAmount-root-40"
|
|
459
518
|
>
|
|
460
519
|
<svg
|
|
461
520
|
aria-hidden="true"
|
|
462
|
-
class="MuiSvgIcon-root OptionAmount-plus-
|
|
521
|
+
class="MuiSvgIcon-root OptionAmount-plus-38"
|
|
463
522
|
focusable="false"
|
|
464
523
|
viewBox="0 0 24 24"
|
|
465
524
|
>
|
|
@@ -468,7 +527,7 @@ exports[`Option renders with selectable amount 1`] = `
|
|
|
468
527
|
/>
|
|
469
528
|
</svg>
|
|
470
529
|
<div
|
|
471
|
-
class="MuiFormControl-root MuiTextField-root OptionAmount-value-
|
|
530
|
+
class="MuiFormControl-root MuiTextField-root OptionAmount-value-39"
|
|
472
531
|
>
|
|
473
532
|
<div
|
|
474
533
|
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-formControl MuiInput-formControl"
|
|
@@ -483,7 +542,7 @@ exports[`Option renders with selectable amount 1`] = `
|
|
|
483
542
|
</div>
|
|
484
543
|
<svg
|
|
485
544
|
aria-hidden="true"
|
|
486
|
-
class="MuiSvgIcon-root OptionAmount-minus-
|
|
545
|
+
class="MuiSvgIcon-root OptionAmount-minus-37 disable"
|
|
487
546
|
focusable="false"
|
|
488
547
|
viewBox="0 0 24 24"
|
|
489
548
|
>
|
|
@@ -498,36 +557,36 @@ exports[`Option renders with selectable amount 1`] = `
|
|
|
498
557
|
|
|
499
558
|
exports[`Option renders without an available image 1`] = `
|
|
500
559
|
<div
|
|
501
|
-
class="Option-root-
|
|
560
|
+
class="Option-root-21 custom-css-option"
|
|
502
561
|
data-option="010002011000"
|
|
503
562
|
>
|
|
504
563
|
<div
|
|
505
564
|
class="content 010002011000"
|
|
506
565
|
>
|
|
507
566
|
<div
|
|
508
|
-
class="Option-image-
|
|
567
|
+
class="Option-image-20"
|
|
509
568
|
/>
|
|
510
569
|
<div
|
|
511
|
-
class="Option-text-
|
|
570
|
+
class="Option-text-22"
|
|
512
571
|
>
|
|
513
572
|
<div
|
|
514
573
|
class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-12"
|
|
515
574
|
>
|
|
516
575
|
<div
|
|
517
|
-
class="MuiTypography-root Option-optionList-
|
|
576
|
+
class="MuiTypography-root Option-optionList-18 MuiTypography-body2"
|
|
518
577
|
>
|
|
519
578
|
<div
|
|
520
|
-
class="Option-title-
|
|
579
|
+
class="Option-title-19"
|
|
521
580
|
>
|
|
522
581
|
Argentina 1000
|
|
523
582
|
</div>
|
|
524
583
|
<div
|
|
525
|
-
class="Option-price-
|
|
584
|
+
class="Option-price-15"
|
|
526
585
|
>
|
|
527
586
|
€ 123.00
|
|
528
587
|
</div>
|
|
529
588
|
<div
|
|
530
|
-
class="Option-details-
|
|
589
|
+
class="Option-details-16"
|
|
531
590
|
/>
|
|
532
591
|
</div>
|
|
533
592
|
</div>
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { get, has, isArray } from 'lodash';
|
|
3
|
+
import { get, has, isArray, find } from 'lodash';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import Grid from '@material-ui/core/Grid/Grid';
|
|
6
|
-
import
|
|
6
|
+
import useMediaQuery from '@material-ui/core/useMediaQuery';
|
|
7
|
+
import Typography from '@material-ui/core/Typography';
|
|
8
|
+
import TextField from '@material-ui/core/TextField';
|
|
7
9
|
import BlockRoundedIcon from '@material-ui/icons/BlockRounded';
|
|
8
10
|
import InfoRoundedIcon from '@material-ui/icons/InfoRounded';
|
|
9
11
|
import RestoreRoundedIcon from '@material-ui/icons/RestoreRounded';
|
|
@@ -136,6 +138,7 @@ const styles = theme => {
|
|
|
136
138
|
width: textWidthWithAmount,
|
|
137
139
|
},
|
|
138
140
|
},
|
|
141
|
+
optionTextInput: {},
|
|
139
142
|
};
|
|
140
143
|
};
|
|
141
144
|
|
|
@@ -145,6 +148,7 @@ const Option = ({ children, render, ...props }) => {
|
|
|
145
148
|
onClick,
|
|
146
149
|
onSelect,
|
|
147
150
|
onToggle,
|
|
151
|
+
onInputTextChange,
|
|
148
152
|
option,
|
|
149
153
|
optionclassification,
|
|
150
154
|
selected,
|
|
@@ -157,6 +161,10 @@ const Option = ({ children, render, ...props }) => {
|
|
|
157
161
|
} = props;
|
|
158
162
|
|
|
159
163
|
const [imageAvailable, setImageAvailable] = useState(true);
|
|
164
|
+
const { selectedoptions } = optionclassification;
|
|
165
|
+
const [inputText, setInputText] = useState(
|
|
166
|
+
get(find(selectedoptions, ['identifier', option.identifier]), 'inputText', '')
|
|
167
|
+
);
|
|
160
168
|
const query = new URLSearchParams(location.search);
|
|
161
169
|
const hidePrices = query.has('_hide_prices') && query.get('_hide_prices') === '1';
|
|
162
170
|
const smallerScreen = useMediaQuery('(min-device-width : 300px) and (max-device-width : 340px)');
|
|
@@ -167,6 +175,7 @@ const Option = ({ children, render, ...props }) => {
|
|
|
167
175
|
const resultStatus = get(option, 'check_results.status', true);
|
|
168
176
|
const optionIsMultiSelect = get(option, 'is_multiselect', false);
|
|
169
177
|
const optionAmount = get(option, 'amount', 0);
|
|
178
|
+
const hasTextinput = get(option, 'hasTextinput', false);
|
|
170
179
|
const translations = {
|
|
171
180
|
...t('common'),
|
|
172
181
|
...t('optionlistitem'),
|
|
@@ -214,7 +223,7 @@ const Option = ({ children, render, ...props }) => {
|
|
|
214
223
|
event.preventDefault();
|
|
215
224
|
event.stopPropagation();
|
|
216
225
|
|
|
217
|
-
if (isEnabled()) {
|
|
226
|
+
if (isEnabled() && !(hasTextinput && selected)) {
|
|
218
227
|
onOptionSelected();
|
|
219
228
|
onClick();
|
|
220
229
|
}
|
|
@@ -396,6 +405,7 @@ const Option = ({ children, render, ...props }) => {
|
|
|
396
405
|
<Grid item xs={12}>
|
|
397
406
|
<Typography component={'div'} className={classes.optionList} variant={'body2'}>
|
|
398
407
|
<div className={classes.title}>{option.title}</div>
|
|
408
|
+
{hasTextinput && renderTextInput()}
|
|
399
409
|
{!hidePrices && <div className={classes.price}>{option.priceFormatted}</div>}
|
|
400
410
|
{smallerScreen && renderControls('horizontal')}
|
|
401
411
|
{option.abstract && (
|
|
@@ -423,6 +433,23 @@ const Option = ({ children, render, ...props }) => {
|
|
|
423
433
|
}
|
|
424
434
|
};
|
|
425
435
|
|
|
436
|
+
const handleTextInputChange = event => {
|
|
437
|
+
setInputText(event.target.value);
|
|
438
|
+
onInputTextChange(option.identifier, event.target.value);
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
const renderTextInput = () => {
|
|
442
|
+
return (
|
|
443
|
+
<TextField
|
|
444
|
+
className={classes.optionTextInput}
|
|
445
|
+
label={''}
|
|
446
|
+
value={inputText}
|
|
447
|
+
onChange={handleTextInputChange}
|
|
448
|
+
disabled={!selected}
|
|
449
|
+
/>
|
|
450
|
+
);
|
|
451
|
+
};
|
|
452
|
+
|
|
426
453
|
const getRootClassName = () => clsx(classes.root, selected && 'selected', customClassName('option'));
|
|
427
454
|
|
|
428
455
|
const getContentClassName = () => {
|
|
@@ -493,6 +520,7 @@ Option.defaultProps = {
|
|
|
493
520
|
onClick: () => {},
|
|
494
521
|
onSelect: () => {},
|
|
495
522
|
onToggle: () => {},
|
|
523
|
+
onInputTextChange: () => {},
|
|
496
524
|
optionclassification: {},
|
|
497
525
|
option: {},
|
|
498
526
|
selected: false,
|
|
@@ -508,6 +536,7 @@ Option.propTypes = {
|
|
|
508
536
|
onClick: PropTypes.func,
|
|
509
537
|
onSelect: PropTypes.func,
|
|
510
538
|
onToggle: PropTypes.func,
|
|
539
|
+
onInputTextChange: PropTypes.func,
|
|
511
540
|
option: PropTypes.object,
|
|
512
541
|
optionclassification: PropTypes.object,
|
|
513
542
|
selected: PropTypes.bool,
|
|
@@ -205,4 +205,20 @@ describe('Option', () => {
|
|
|
205
205
|
);
|
|
206
206
|
expect(tree).toMatchSnapshot();
|
|
207
207
|
});
|
|
208
|
+
it('renders with TextInput', () => {
|
|
209
|
+
const testOption = {
|
|
210
|
+
identifier: '010002011000',
|
|
211
|
+
thumbnail: '/images/options/010002011000.png',
|
|
212
|
+
title: 'Argentina 1000',
|
|
213
|
+
priceFormatted: '€ 123.00',
|
|
214
|
+
amount_is_selectable: false,
|
|
215
|
+
hasTextinput: true,
|
|
216
|
+
inputText: null,
|
|
217
|
+
check_results: {
|
|
218
|
+
status: true,
|
|
219
|
+
},
|
|
220
|
+
};
|
|
221
|
+
const tree = render(createOption(testOption));
|
|
222
|
+
expect(tree).toMatchSnapshot();
|
|
223
|
+
});
|
|
208
224
|
});
|
|
@@ -72,6 +72,7 @@ const OptionsList = ({ render, ...props }) => {
|
|
|
72
72
|
LoadingComponent,
|
|
73
73
|
OptionComponent,
|
|
74
74
|
isAdminMode,
|
|
75
|
+
setOptionInputText,
|
|
75
76
|
} = props;
|
|
76
77
|
|
|
77
78
|
const classes = useStyles();
|
|
@@ -114,6 +115,7 @@ const OptionsList = ({ render, ...props }) => {
|
|
|
114
115
|
viewDetails={viewDetails}
|
|
115
116
|
viewStockInformation={viewStockInformation}
|
|
116
117
|
onClick={onOptionClicked}
|
|
118
|
+
onInputTextChange={setOptionInputText}
|
|
117
119
|
onToggle={onToggle}
|
|
118
120
|
isAdminMode={isAdminMode}
|
|
119
121
|
/>
|
|
@@ -183,6 +185,7 @@ OptionsList.propTypes = {
|
|
|
183
185
|
onClose: PropTypes.func,
|
|
184
186
|
onSelect: PropTypes.func,
|
|
185
187
|
onToggle: PropTypes.func,
|
|
188
|
+
setOptionInputText: PropTypes.func,
|
|
186
189
|
options: PropTypes.array,
|
|
187
190
|
optionclassification: PropTypes.object,
|
|
188
191
|
show: PropTypes.bool,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import get from 'lodash/get';
|
|
@@ -17,12 +17,19 @@ const ProductPart = ({
|
|
|
17
17
|
setAnchorRef,
|
|
18
18
|
classes,
|
|
19
19
|
optionListVisible,
|
|
20
|
+
onCloseSelected,
|
|
20
21
|
}) => {
|
|
21
|
-
const selected =
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
const selected = get(selectedOption, 'identifier', null) === get(optionclassification, 'identifier', '');
|
|
23
|
+
const selectedAndVisible = optionListVisible && selected;
|
|
24
|
+
|
|
24
25
|
const direction = verticalMode ? 'vertical' : 'horizontal';
|
|
25
26
|
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (!optionListVisible && selected) {
|
|
29
|
+
onCloseSelected(optionclassification);
|
|
30
|
+
}
|
|
31
|
+
}, [optionListVisible]);
|
|
32
|
+
|
|
26
33
|
const displayImage = () => {
|
|
27
34
|
const imageUrl =
|
|
28
35
|
displaySwitchedOptions && selectedOption
|
|
@@ -52,7 +59,7 @@ const ProductPart = ({
|
|
|
52
59
|
|
|
53
60
|
return (
|
|
54
61
|
<div className={clsx(classes.root, direction, customClassName('component'))} ref={setAnchorRef}>
|
|
55
|
-
<div className={`${classes.marker} ${direction} ${
|
|
62
|
+
<div className={`${classes.marker} ${direction} ${selectedAndVisible ? 'selected' : ''}`} />
|
|
56
63
|
<div className={`${classes.content} ${direction}`} onClick={onClick}>
|
|
57
64
|
{displayImage()}
|
|
58
65
|
{displayText()}
|
|
@@ -82,6 +89,7 @@ ProductPart.propTypes = {
|
|
|
82
89
|
setAnchorRef: PropTypes.func,
|
|
83
90
|
classes: PropTypes.object,
|
|
84
91
|
optionListVisible: PropTypes.bool,
|
|
92
|
+
onCloseSelected: PropTypes.func,
|
|
85
93
|
};
|
|
86
94
|
|
|
87
95
|
export const StyledProductPart = withStyles(
|