project-booster-vue 10.18.2 → 10.19.0
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/package.json +1 -1
- package/src/components/rework/navigation/MPbNavigation.vue +31 -6
- package/src/components/rework/question/dimensions-input/MPbDimensionsInput.vue +5 -6
- package/src/components/rework/question/list-select/MPbListSelect.vue +0 -31
- package/src/components/rework/question/upload-document/MPbUploadDocument.vue +28 -21
- package/src/components/scenario/scenarii/estimator-floor.json +70 -57
package/package.json
CHANGED
|
@@ -21,12 +21,7 @@
|
|
|
21
21
|
<div class="m-pb-navigation__right column-full">
|
|
22
22
|
<m-button
|
|
23
23
|
:label="nextButtonLabel"
|
|
24
|
-
@click.prevent="
|
|
25
|
-
$emit('next-step', {
|
|
26
|
-
answers,
|
|
27
|
-
nextStep: payload.viewModel.nextStep,
|
|
28
|
-
})
|
|
29
|
-
"
|
|
24
|
+
@click.prevent="emitClickEvent(payload.viewModel.nextStep)"
|
|
30
25
|
icon="ArrowNext48"
|
|
31
26
|
iconPosition="right"
|
|
32
27
|
:data-cerberus="sanitizeCerberusAttribut('MPB-NAVIGATION', nextButtonLabel)"
|
|
@@ -56,10 +51,18 @@ import { MButton } from '@mozaic-ds/vue-3';
|
|
|
56
51
|
import { sanitizeCerberusAttribut } from '@/services/sanitize';
|
|
57
52
|
import { ScenarioStepAnswer } from '@/types/pb/Scenario';
|
|
58
53
|
import { PayloadAction } from '../types/genericPayload';
|
|
54
|
+
import { areConditionsValid } from '@/services/scenarioConditionals';
|
|
59
55
|
|
|
60
56
|
const $emit = defineEmits(['go-back', 'next-step']);
|
|
61
57
|
|
|
62
58
|
const props = defineProps({
|
|
59
|
+
/**
|
|
60
|
+
* The options provided at runtime to customize component behaviour
|
|
61
|
+
*/
|
|
62
|
+
runtimeOptions: {
|
|
63
|
+
type: Object,
|
|
64
|
+
default: () => ({}),
|
|
65
|
+
},
|
|
63
66
|
payload: {
|
|
64
67
|
type: Object,
|
|
65
68
|
default: () => ({}),
|
|
@@ -130,6 +133,28 @@ const props = defineProps({
|
|
|
130
133
|
default: EventTypeEnum.SUBMIT,
|
|
131
134
|
},
|
|
132
135
|
});
|
|
136
|
+
|
|
137
|
+
const emitClickEvent = (nextStep: any) => {
|
|
138
|
+
if (nextStep.code) {
|
|
139
|
+
$emit('next-step', {
|
|
140
|
+
answsers: props.answers,
|
|
141
|
+
nextStep: nextStep,
|
|
142
|
+
});
|
|
143
|
+
} else if (nextStep.conditionals) {
|
|
144
|
+
let toNextStep = null;
|
|
145
|
+
nextStep.conditionals.every((condition: any) => {
|
|
146
|
+
const valid = areConditionsValid(condition!, props.answers, props.runtimeOptions);
|
|
147
|
+
if (valid) {
|
|
148
|
+
toNextStep = condition.nextStep;
|
|
149
|
+
$emit('next-step', {
|
|
150
|
+
answsers: props.answers,
|
|
151
|
+
nextStep: toNextStep,
|
|
152
|
+
});
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
};
|
|
133
158
|
</script>
|
|
134
159
|
|
|
135
160
|
<style lang="scss">
|
|
@@ -186,18 +186,17 @@ const { length, width } = computeDefaultValue(props.runtimeOptions, props.answer
|
|
|
186
186
|
const validationSchema = initValidation(componentId, computedPayload);
|
|
187
187
|
const { handleSubmit } = useForm({ validationSchema: validationSchema.value });
|
|
188
188
|
|
|
189
|
-
const handleFormSubmit =
|
|
190
|
-
const elementLengthId = `text-input-length-${componentId}` as string;
|
|
191
|
-
const elementWidthId = `text-input-width-${componentId}` as string;
|
|
189
|
+
const handleFormSubmit = (params: any) => {
|
|
192
190
|
$emit(props.completedEventName, {
|
|
193
191
|
answers: [
|
|
194
192
|
{
|
|
195
|
-
length
|
|
196
|
-
width
|
|
193
|
+
length,
|
|
194
|
+
width,
|
|
197
195
|
},
|
|
198
196
|
],
|
|
197
|
+
nextStep: params.nextStep,
|
|
199
198
|
});
|
|
200
|
-
}
|
|
199
|
+
};
|
|
201
200
|
|
|
202
201
|
const skipQuestion = () => {
|
|
203
202
|
$emit(props.completedEventName, {
|
|
@@ -25,37 +25,6 @@
|
|
|
25
25
|
:items-per-page="itemsPerPage"
|
|
26
26
|
@update:model-value="handleSelectionChange"
|
|
27
27
|
/>
|
|
28
|
-
<!-- <div class="pb-list-select__actions-container" :style="`bottom: ${stickyBottomOffset};`">
|
|
29
|
-
<div class="pb-list-select__actions">
|
|
30
|
-
<div
|
|
31
|
-
ref="pbListSelectNextButtonContainer"
|
|
32
|
-
class="pb-list-select__next-button-container"
|
|
33
|
-
justify-content="center"
|
|
34
|
-
>
|
|
35
|
-
<m-button
|
|
36
|
-
v-if="payload.skippable && (!hasSelectedAnswers || payload.viewModel.alwaysDisplaySkippable)"
|
|
37
|
-
class="pb-list-select__next-button"
|
|
38
|
-
:label="payload.skippable.label"
|
|
39
|
-
:left-icon="payload.skippable.leftIcon"
|
|
40
|
-
:right-icon="payload.skippable.rightIcon"
|
|
41
|
-
size="m"
|
|
42
|
-
size-from-l="l"
|
|
43
|
-
@click="skipQuestion"
|
|
44
|
-
/>
|
|
45
|
-
<m-button
|
|
46
|
-
v-if="hasSelectedAnswers || payload.multiSelect?.alwaysDisplayMultiSelectButton"
|
|
47
|
-
class="pb-list-select__validate-button"
|
|
48
|
-
size="m"
|
|
49
|
-
size-from-l="l"
|
|
50
|
-
:disabled="!hasSelectedAnswers"
|
|
51
|
-
:label="validateButtonProps.label"
|
|
52
|
-
:left-icon="validateButtonProps.leftIcon"
|
|
53
|
-
:right-icon="validateButtonProps.rightIcon"
|
|
54
|
-
@click="submitAnswers"
|
|
55
|
-
/>
|
|
56
|
-
</div>
|
|
57
|
-
</div>
|
|
58
|
-
</div> -->
|
|
59
28
|
|
|
60
29
|
<m-pb-navigation
|
|
61
30
|
:answers="answers"
|
|
@@ -84,19 +84,15 @@
|
|
|
84
84
|
}}</m-link>
|
|
85
85
|
</div>
|
|
86
86
|
|
|
87
|
-
<
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
:iconPosition="button.iconPosition"
|
|
97
|
-
/>
|
|
98
|
-
</div>
|
|
99
|
-
</div>
|
|
87
|
+
<m-pb-navigation
|
|
88
|
+
:payload="payload"
|
|
89
|
+
:answers="answers"
|
|
90
|
+
:stepLocation="stepLocation"
|
|
91
|
+
:trackingStatus="true"
|
|
92
|
+
@go-back="$emit('go-back')"
|
|
93
|
+
@next-step="validMultiSelect(payload?.multiSelect?.actions?.VALIDATE)"
|
|
94
|
+
:step-number="stepNumber"
|
|
95
|
+
/>
|
|
100
96
|
|
|
101
97
|
<m-pb-media-upload
|
|
102
98
|
:payload="payload.viewModel.mediaPayload"
|
|
@@ -126,6 +122,7 @@ import {
|
|
|
126
122
|
import { ScenarioStepAnswer } from '@/types/pb/Scenario';
|
|
127
123
|
import { decorate, doEval } from '@/services/decorate';
|
|
128
124
|
import { EmitEventName } from '../../services/emit';
|
|
125
|
+
import MPbNavigation from '../../navigation/MPbNavigation.vue';
|
|
129
126
|
|
|
130
127
|
const BACK_ICON =
|
|
131
128
|
'https://storage.googleapis.com/project-booster-media/mozaic-icons/svg/Navigation_Arrow_Arrow--Left_16px.svg';
|
|
@@ -185,6 +182,20 @@ const props = defineProps({
|
|
|
185
182
|
type: String,
|
|
186
183
|
default: '',
|
|
187
184
|
},
|
|
185
|
+
/**
|
|
186
|
+
* Current step location
|
|
187
|
+
*/
|
|
188
|
+
stepLocation: {
|
|
189
|
+
type: String,
|
|
190
|
+
default: '',
|
|
191
|
+
},
|
|
192
|
+
/**
|
|
193
|
+
* Current step number
|
|
194
|
+
*/
|
|
195
|
+
stepNumber: {
|
|
196
|
+
type: Number,
|
|
197
|
+
default: 0,
|
|
198
|
+
},
|
|
188
199
|
});
|
|
189
200
|
|
|
190
201
|
const store = useStore();
|
|
@@ -227,14 +238,10 @@ const handleDisplayDialogEvent = (event: Event) => {
|
|
|
227
238
|
};
|
|
228
239
|
|
|
229
240
|
const validMultiSelect = (multiSelectOptions: UploadDocumentMultiSelectAction) => {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
answers: selectedDocuments.value.length ? selectedDocuments.value : null,
|
|
235
|
-
nextStep: multiSelectOptions.nextStep,
|
|
236
|
-
});
|
|
237
|
-
}
|
|
241
|
+
$emit(props.completedEventName, {
|
|
242
|
+
answers: null,
|
|
243
|
+
nextStep: multiSelectOptions.nextStep,
|
|
244
|
+
});
|
|
238
245
|
};
|
|
239
246
|
|
|
240
247
|
const skipQuestion = (button: UploadDocumentMultiSelectAction) => {
|
|
@@ -44,7 +44,8 @@
|
|
|
44
44
|
"component": "MPbProgress",
|
|
45
45
|
"totalStep": 9,
|
|
46
46
|
"currentStep": 1,
|
|
47
|
-
"sizeXlWidth": true
|
|
47
|
+
"sizeXlWidth": true,
|
|
48
|
+
"label": "Estimer le budget de votre revêtement de sol"
|
|
48
49
|
}
|
|
49
50
|
},
|
|
50
51
|
"payload": {
|
|
@@ -147,6 +148,7 @@
|
|
|
147
148
|
"beforeContent": {
|
|
148
149
|
"display": true,
|
|
149
150
|
"component": "MPbProgress",
|
|
151
|
+
"label": "Estimer le budget de votre revêtement de sol",
|
|
150
152
|
"totalStep": 9,
|
|
151
153
|
"currentStep": 2,
|
|
152
154
|
"sizeXlWidth": true
|
|
@@ -217,7 +219,7 @@
|
|
|
217
219
|
"totalStep": 9,
|
|
218
220
|
"currentStep": 2,
|
|
219
221
|
"sizeXlWidth": true,
|
|
220
|
-
"label": "
|
|
222
|
+
"label": "Estimer le budget de votre revêtement de sol"
|
|
221
223
|
}
|
|
222
224
|
},
|
|
223
225
|
"payload": {
|
|
@@ -345,7 +347,7 @@
|
|
|
345
347
|
"totalStep": 9,
|
|
346
348
|
"currentStep": 2,
|
|
347
349
|
"sizeXlWidth": true,
|
|
348
|
-
"label": "
|
|
350
|
+
"label": "Estimer le budget de votre revêtement de sol"
|
|
349
351
|
}
|
|
350
352
|
},
|
|
351
353
|
"payload": {
|
|
@@ -423,7 +425,7 @@
|
|
|
423
425
|
"totalStep": 9,
|
|
424
426
|
"currentStep": 3,
|
|
425
427
|
"sizeXlWidth": true,
|
|
426
|
-
"label": "Estimer
|
|
428
|
+
"label": "Estimer le budget de votre revêtement de sol"
|
|
427
429
|
}
|
|
428
430
|
},
|
|
429
431
|
"payload": {
|
|
@@ -443,6 +445,9 @@
|
|
|
443
445
|
"label": "Voir d'autres revêtements",
|
|
444
446
|
"minItemsDisplayed": 4,
|
|
445
447
|
"position": "start"
|
|
448
|
+
},
|
|
449
|
+
"nextStep": {
|
|
450
|
+
"code": "LMFR_FLOOR_QUESTION_DUMP"
|
|
446
451
|
}
|
|
447
452
|
},
|
|
448
453
|
"answers": {
|
|
@@ -573,9 +578,6 @@
|
|
|
573
578
|
"alignHorizontal": "center",
|
|
574
579
|
"alignText": "center"
|
|
575
580
|
},
|
|
576
|
-
"nextStep": {
|
|
577
|
-
"code": "LMFR_FLOOR_QUESTION_DUMP"
|
|
578
|
-
},
|
|
579
581
|
"meta": {
|
|
580
582
|
"ranking": 10
|
|
581
583
|
}
|
|
@@ -612,7 +614,8 @@
|
|
|
612
614
|
"component": "MPbProgress",
|
|
613
615
|
"totalStep": 9,
|
|
614
616
|
"currentStep": 4,
|
|
615
|
-
"sizeXlWidth": true
|
|
617
|
+
"sizeXlWidth": true,
|
|
618
|
+
"label": "Estimer le budget de votre revêtement de sol"
|
|
616
619
|
}
|
|
617
620
|
},
|
|
618
621
|
"payload": {
|
|
@@ -676,7 +679,8 @@
|
|
|
676
679
|
"component": "MPbProgress",
|
|
677
680
|
"totalStep": 9,
|
|
678
681
|
"currentStep": 4,
|
|
679
|
-
"sizeXlWidth": true
|
|
682
|
+
"sizeXlWidth": true,
|
|
683
|
+
"label": "Estimer le budget de votre revêtement de sol"
|
|
680
684
|
}
|
|
681
685
|
},
|
|
682
686
|
"payload": {
|
|
@@ -757,7 +761,7 @@
|
|
|
757
761
|
"totalStep": 9,
|
|
758
762
|
"currentStep": 5,
|
|
759
763
|
"sizeXlWidth": true,
|
|
760
|
-
"label": "
|
|
764
|
+
"label": "Estimer le budget de votre revêtement de sol"
|
|
761
765
|
}
|
|
762
766
|
},
|
|
763
767
|
"payload": {
|
|
@@ -811,49 +815,17 @@
|
|
|
811
815
|
"code": "LMFR_FLOOR_QUESTION_DIMENSION_WIDTH_LENGTH",
|
|
812
816
|
"type": "STEP",
|
|
813
817
|
"component": "MPbDimensionsInput",
|
|
814
|
-
"nextStep": {
|
|
815
|
-
"conditionals": [
|
|
816
|
-
{
|
|
817
|
-
"conditions": ["isAnswerMatching('LMFR_FLOOR_QUESTION_NEW', 'TILES')"],
|
|
818
|
-
"nextStep": {
|
|
819
|
-
"code": "LMFR_FLOOR_QUESTION_QUALITY_RANGE_TILES"
|
|
820
|
-
}
|
|
821
|
-
},
|
|
822
|
-
{
|
|
823
|
-
"conditions": ["isAnswerMatching('LMFR_FLOOR_QUESTION_NEW', 'LAMINATE')"],
|
|
824
|
-
"nextStep": {
|
|
825
|
-
"code": "LMFR_FLOOR_QUESTION_QUALITY_RANGE_LAMINATE"
|
|
826
|
-
}
|
|
827
|
-
},
|
|
828
|
-
{
|
|
829
|
-
"conditions": ["isAnswerMatching('LMFR_FLOOR_QUESTION_NEW', 'SOFT_FLOOR')"],
|
|
830
|
-
"nextStep": {
|
|
831
|
-
"code": "LMFR_FLOOR_QUESTION_QUALITY_RANGE_SOFT_FLOOR"
|
|
832
|
-
}
|
|
833
|
-
},
|
|
834
|
-
{
|
|
835
|
-
"conditions": ["isAnswerMatching('LMFR_FLOOR_QUESTION_NEW', 'PARQUET')"],
|
|
836
|
-
"nextStep": {
|
|
837
|
-
"code": "LMFR_FLOOR_QUESTION_QUALITY_RANGE_PARQUET"
|
|
838
|
-
}
|
|
839
|
-
},
|
|
840
|
-
{
|
|
841
|
-
"conditions": ["isAnswerMatching('LMFR_FLOOR_QUESTION_NEW', 'CARPET')"],
|
|
842
|
-
"nextStep": {
|
|
843
|
-
"code": "LMFR_FLOOR_QUESTION_QUALITY_RANGE_CARPET"
|
|
844
|
-
}
|
|
845
|
-
},
|
|
846
|
-
{
|
|
847
|
-
"conditions": ["isAnswerMatching('LMFR_FLOOR_QUESTION_NEW', 'UNKNOWN')"],
|
|
848
|
-
"nextStep": {
|
|
849
|
-
"code": "LMFR_FLOOR_QUESTION_QUALITY_RANGE_UNKNOWN"
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
]
|
|
853
|
-
},
|
|
854
818
|
"slots": {
|
|
855
819
|
"stickyBottom": {
|
|
856
820
|
"display": false
|
|
821
|
+
},
|
|
822
|
+
"beforeContent": {
|
|
823
|
+
"display": true,
|
|
824
|
+
"component": "MPbProgress",
|
|
825
|
+
"totalStep": 9,
|
|
826
|
+
"currentStep": 6,
|
|
827
|
+
"sizeXlWidth": true,
|
|
828
|
+
"label": "Estimer le budget de votre revêtement de sol"
|
|
857
829
|
}
|
|
858
830
|
},
|
|
859
831
|
"payload": {
|
|
@@ -863,7 +835,6 @@
|
|
|
863
835
|
},
|
|
864
836
|
"viewModel": {
|
|
865
837
|
"label": "Quelles sont les dimensions de cette pièce ?",
|
|
866
|
-
"image": "https://storage.googleapis.com/project-booster-media/bathroom/size/size-length_width.png",
|
|
867
838
|
"backLabel": "Question précédente",
|
|
868
839
|
"lengthPlaceholder": "Longueur",
|
|
869
840
|
"widthPlaceholder": "Largeur",
|
|
@@ -879,6 +850,46 @@
|
|
|
879
850
|
"widthMaxErrorMessage": "La largeur doit être comprise entre 1m et 10m",
|
|
880
851
|
"widthMinErrorMessage": "La largeur doit être comprise entre 1m et 10m",
|
|
881
852
|
"notValidNumberMessage": "Veuillez ne saisir que des chiffres"
|
|
853
|
+
},
|
|
854
|
+
"nextStep": {
|
|
855
|
+
"conditionals": [
|
|
856
|
+
{
|
|
857
|
+
"conditions": ["isAnswerMatching('LMFR_FLOOR_QUESTION_NEW', 'TILES')"],
|
|
858
|
+
"nextStep": {
|
|
859
|
+
"code": "LMFR_FLOOR_QUESTION_QUALITY_RANGE_TILES"
|
|
860
|
+
}
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
"conditions": ["isAnswerMatching('LMFR_FLOOR_QUESTION_NEW', 'LAMINATE')"],
|
|
864
|
+
"nextStep": {
|
|
865
|
+
"code": "LMFR_FLOOR_QUESTION_QUALITY_RANGE_LAMINATE"
|
|
866
|
+
}
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
"conditions": ["isAnswerMatching('LMFR_FLOOR_QUESTION_NEW', 'SOFT_FLOOR')"],
|
|
870
|
+
"nextStep": {
|
|
871
|
+
"code": "LMFR_FLOOR_QUESTION_QUALITY_RANGE_SOFT_FLOOR"
|
|
872
|
+
}
|
|
873
|
+
},
|
|
874
|
+
{
|
|
875
|
+
"conditions": ["isAnswerMatching('LMFR_FLOOR_QUESTION_NEW', 'PARQUET')"],
|
|
876
|
+
"nextStep": {
|
|
877
|
+
"code": "LMFR_FLOOR_QUESTION_QUALITY_RANGE_PARQUET"
|
|
878
|
+
}
|
|
879
|
+
},
|
|
880
|
+
{
|
|
881
|
+
"conditions": ["isAnswerMatching('LMFR_FLOOR_QUESTION_NEW', 'CARPET')"],
|
|
882
|
+
"nextStep": {
|
|
883
|
+
"code": "LMFR_FLOOR_QUESTION_QUALITY_RANGE_CARPET"
|
|
884
|
+
}
|
|
885
|
+
},
|
|
886
|
+
{
|
|
887
|
+
"conditions": ["isAnswerMatching('LMFR_FLOOR_QUESTION_NEW', 'UNKNOWN')"],
|
|
888
|
+
"nextStep": {
|
|
889
|
+
"code": "LMFR_FLOOR_QUESTION_QUALITY_RANGE_UNKNOWN"
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
]
|
|
882
893
|
}
|
|
883
894
|
}
|
|
884
895
|
}
|
|
@@ -898,7 +909,7 @@
|
|
|
898
909
|
"totalStep": 9,
|
|
899
910
|
"currentStep": 7,
|
|
900
911
|
"sizeXlWidth": true,
|
|
901
|
-
"label": "
|
|
912
|
+
"label": "Estimer le budget de votre revêtement de sol"
|
|
902
913
|
}
|
|
903
914
|
},
|
|
904
915
|
"payload": {
|
|
@@ -1016,7 +1027,7 @@
|
|
|
1016
1027
|
"totalStep": 9,
|
|
1017
1028
|
"currentStep": 6,
|
|
1018
1029
|
"sizeXlWidth": true,
|
|
1019
|
-
"label": "
|
|
1030
|
+
"label": "Estimer le budget de votre revêtement de sol"
|
|
1020
1031
|
}
|
|
1021
1032
|
},
|
|
1022
1033
|
"payload": {
|
|
@@ -1079,8 +1090,9 @@
|
|
|
1079
1090
|
"display": true,
|
|
1080
1091
|
"component": "MPbProgress",
|
|
1081
1092
|
"totalStep": 9,
|
|
1082
|
-
"currentStep":
|
|
1083
|
-
"sizeXlWidth": true
|
|
1093
|
+
"currentStep": 8,
|
|
1094
|
+
"sizeXlWidth": true,
|
|
1095
|
+
"label": "Estimer le budget de votre revêtement de sol"
|
|
1084
1096
|
}
|
|
1085
1097
|
},
|
|
1086
1098
|
"payload": {
|
|
@@ -1345,7 +1357,7 @@
|
|
|
1345
1357
|
"totalStep": 9,
|
|
1346
1358
|
"currentStep": 8,
|
|
1347
1359
|
"sizeXlWidth": true,
|
|
1348
|
-
"label": "
|
|
1360
|
+
"label": "Estimer le budget de votre revêtement de sol"
|
|
1349
1361
|
}
|
|
1350
1362
|
},
|
|
1351
1363
|
"payload": {
|
|
@@ -1408,7 +1420,8 @@
|
|
|
1408
1420
|
"component": "MPbProgress",
|
|
1409
1421
|
"totalStep": 9,
|
|
1410
1422
|
"currentStep": 9,
|
|
1411
|
-
"sizeXlWidth": true
|
|
1423
|
+
"sizeXlWidth": true,
|
|
1424
|
+
"label": "Estimer le budget de votre revêtement de sol"
|
|
1412
1425
|
}
|
|
1413
1426
|
},
|
|
1414
1427
|
"payload": {
|