project-booster-vue 9.34.0 → 9.35.2
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/projects/project-item-save/PbProjectItemSave.vue +2 -0
- package/src/components/projects/projects-list/PbProjectsList.vue +0 -4
- package/src/components/question/city-search/PbCitySearch.vue +10 -3
- package/src/components/question/incremental-amount-input/IncrementalAmount.ts +3 -1
- package/src/components/question/incremental-amount-input/PbIncrementalAmountInput.vue +28 -5
- package/src/components/warning-message/PbWarningMessage.vue +43 -6
- package/src/components/warning-message/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-components-warning-message-pb-warning-message-/360/237/246/240-with-modal-1-snap.png +0 -0
- package/src/components/warning-message/with-modal.json +4 -0
package/package.json
CHANGED
|
@@ -97,6 +97,8 @@ export const answerGettersMappers: Map<string, (param: any) => void> = new Map<s
|
|
|
97
97
|
return { width: parseFloat(width), length: parseFloat(length) };
|
|
98
98
|
},
|
|
99
99
|
PbListSelect: ({ value }: { value: string }): string => value,
|
|
100
|
+
PbCitySearch: ({ city }: { city: any }) => city.postalCode,
|
|
101
|
+
PbIncrementalAmountInput: ({ value }: { value: string }) => parseInt(value),
|
|
100
102
|
}),
|
|
101
103
|
);
|
|
102
104
|
|
|
@@ -229,7 +229,12 @@ export default defineComponent({
|
|
|
229
229
|
this?.computedPayload?.defaultDecoratorValue,
|
|
230
230
|
),
|
|
231
231
|
};
|
|
232
|
-
|
|
232
|
+
|
|
233
|
+
if (this.selectedCity.postalCode == 'undefined') {
|
|
234
|
+
this.selectedCity = null;
|
|
235
|
+
} else {
|
|
236
|
+
this.searchKeyword = this.selectedCityToKeyword();
|
|
237
|
+
}
|
|
233
238
|
this.forceHideSuggestions = true;
|
|
234
239
|
}
|
|
235
240
|
|
|
@@ -344,8 +349,7 @@ export default defineComponent({
|
|
|
344
349
|
region: selectedCity.address_components[2].short_name,
|
|
345
350
|
};
|
|
346
351
|
|
|
347
|
-
this.searchKeyword =
|
|
348
|
-
this.selectedCity.postalCode + ' ' + this.selectedCity.name + ', ' + this.selectedCity.region;
|
|
352
|
+
this.searchKeyword = this.selectedCityToKeyword();
|
|
349
353
|
this.$forceUpdate();
|
|
350
354
|
}
|
|
351
355
|
});
|
|
@@ -383,6 +387,9 @@ export default defineComponent({
|
|
|
383
387
|
name: placeData.data[0].nom,
|
|
384
388
|
};
|
|
385
389
|
},
|
|
390
|
+
selectedCityToKeyword(): string {
|
|
391
|
+
return this.selectedCity?.postalCode + ' ' + this.selectedCity?.name + ', ' + this.selectedCity?.region;
|
|
392
|
+
},
|
|
386
393
|
},
|
|
387
394
|
});
|
|
388
395
|
</script>
|
|
@@ -3,7 +3,6 @@ export interface IncrementalAmountValidation {
|
|
|
3
3
|
maxValue: number;
|
|
4
4
|
defaultValue: number;
|
|
5
5
|
requiredErrorMessage: string;
|
|
6
|
-
thresholdsIncluded: number;
|
|
7
6
|
minValueErrorMessage: string;
|
|
8
7
|
maxValueErrorMessage: string;
|
|
9
8
|
}
|
|
@@ -11,7 +10,9 @@ export interface IncrementalAmountValidation {
|
|
|
11
10
|
export interface IncrementalAmountViewModel {
|
|
12
11
|
backLabel: string;
|
|
13
12
|
label: string;
|
|
13
|
+
subtitle: string;
|
|
14
14
|
actionLabel: string;
|
|
15
|
+
image: string;
|
|
15
16
|
validation: IncrementalAmountValidation;
|
|
16
17
|
minValue: number;
|
|
17
18
|
maxValue: number;
|
|
@@ -20,5 +21,6 @@ export interface IncrementalAmountViewModel {
|
|
|
20
21
|
|
|
21
22
|
export interface IncrementalAmountPayload {
|
|
22
23
|
viewModel: IncrementalAmountViewModel;
|
|
24
|
+
value: { value: string };
|
|
23
25
|
defaultDecoratorValue: string;
|
|
24
26
|
}
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
|
|
41
41
|
<m-flex class="pb-incremental-amount-input__body" justify-content="start" align-items="start">
|
|
42
42
|
<m-quantity-selector
|
|
43
|
-
:value="
|
|
43
|
+
:value="quantitySelector"
|
|
44
44
|
:valuemin="computedPayload.viewModel.minValue"
|
|
45
45
|
:valuemax="computedPayload.viewModel.maxValue"
|
|
46
46
|
@input="handleQuantitySelector"
|
|
@@ -74,10 +74,27 @@ import { ref } from 'vue';
|
|
|
74
74
|
import { ScenarioStepAnswer } from '@/types/pb/Scenario';
|
|
75
75
|
import { decorate } from '@/components/question/PbQuestion.vue';
|
|
76
76
|
import MQuantitySelector from '../../mozaic/quantityselector/MQuantitySelector.vue';
|
|
77
|
+
import { IncrementalAmountPayload } from '@/components/question/incremental-amount-input/IncrementalAmount';
|
|
77
78
|
|
|
78
79
|
const BACK_ICON =
|
|
79
80
|
'https://storage.googleapis.com/project-booster-media/mozaic-icons/svg/Navigation_Arrow_Arrow--Left_16px.svg';
|
|
80
81
|
|
|
82
|
+
const computeDefaultValue = (
|
|
83
|
+
runtimeOptions: any,
|
|
84
|
+
answers: Map<string, ScenarioStepAnswer[]>,
|
|
85
|
+
computedPayload: ComputedRef<IncrementalAmountPayload>,
|
|
86
|
+
) => {
|
|
87
|
+
let amount;
|
|
88
|
+
if (computedPayload?.value?.value) {
|
|
89
|
+
amount = decorate(
|
|
90
|
+
answers,
|
|
91
|
+
runtimeOptions,
|
|
92
|
+
computedPayload?.value?.value?.value,
|
|
93
|
+
computedPayload?.value?.defaultDecoratorValue,
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
return amount;
|
|
97
|
+
};
|
|
81
98
|
export default defineComponent({
|
|
82
99
|
name: 'PbIncrementalAmountInput',
|
|
83
100
|
components: {
|
|
@@ -94,7 +111,7 @@ export default defineComponent({
|
|
|
94
111
|
* from the default ones.
|
|
95
112
|
*/
|
|
96
113
|
payload: {
|
|
97
|
-
type: Object
|
|
114
|
+
type: Object as PropType<IncrementalAmountPayload>,
|
|
98
115
|
default: () => ({}),
|
|
99
116
|
},
|
|
100
117
|
/**
|
|
@@ -136,11 +153,17 @@ export default defineComponent({
|
|
|
136
153
|
setup(props, { emit }) {
|
|
137
154
|
const componentId = uuidv4();
|
|
138
155
|
const computedPayload = computed(() => {
|
|
139
|
-
|
|
140
|
-
|
|
156
|
+
let tempPayload = cloneDeep(DEFAULT_PAYLOAD);
|
|
157
|
+
tempPayload = merge(tempPayload, props.payload);
|
|
158
|
+
tempPayload.viewModel.label = decorate(props.answers!, props.runtimeOptions, tempPayload.viewModel.label);
|
|
159
|
+
return tempPayload as IncrementalAmountPayload;
|
|
141
160
|
});
|
|
142
161
|
const pbIncrementalAmountInput = ref<HTMLElement>();
|
|
143
|
-
|
|
162
|
+
|
|
163
|
+
let quantitySelector = parseInt(computeDefaultValue(props.runtimeOptions, props.answers!, computedPayload)!);
|
|
164
|
+
if (!quantitySelector) {
|
|
165
|
+
quantitySelector = props.payload.viewModel.defaultValue || props.defaultValue;
|
|
166
|
+
}
|
|
144
167
|
|
|
145
168
|
const handleFormSubmit = () => {
|
|
146
169
|
emit(props.completedEventName, {
|
|
@@ -17,10 +17,19 @@
|
|
|
17
17
|
{{ payload.viewModel.label }}
|
|
18
18
|
</div>
|
|
19
19
|
|
|
20
|
-
<div class="pb-warning-
|
|
20
|
+
<div class="pb-warning-message__head" v-if="payload.viewModel.headBlock">
|
|
21
|
+
<div class="pb-warning-message__head__image">
|
|
22
|
+
<img :src="payload.viewModel.headBlock.image" alt="Icon" />
|
|
23
|
+
</div>
|
|
24
|
+
<div class="pb-warning-message__head__text">
|
|
25
|
+
<p>{{ payload.viewModel.headBlock.text }}</p>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<div class="pb-warning-message__container--background" v-if="payload">
|
|
21
30
|
<m-flex class="pb-warning-message__container__message">
|
|
22
31
|
<div class="pb-warning-message__container__message__left">
|
|
23
|
-
<img :data-src="injectIcon(
|
|
32
|
+
<img :data-src="injectIcon()" id="pb-warning-message-icon" alt="Icon" />
|
|
24
33
|
</div>
|
|
25
34
|
<div class="pb-warning-message__container__message__right">
|
|
26
35
|
<h3>{{ payload.viewModel.subtitle }}</h3>
|
|
@@ -100,6 +109,7 @@ import { ScenarioStepAnswer } from '@/types/pb/Scenario';
|
|
|
100
109
|
import SVGInjector from 'svg-injector';
|
|
101
110
|
import { WarningMessagePayloadAction } from '@/types/pb/WarningMessage';
|
|
102
111
|
import { DialogContent } from './dialogContent';
|
|
112
|
+
import { string } from 'yup';
|
|
103
113
|
const BACK_ICON =
|
|
104
114
|
'https://storage.googleapis.com/project-booster-media/mozaic-icons/svg/Navigation_Arrow_Arrow--Left_16px.svg';
|
|
105
115
|
const WARNING_ICON =
|
|
@@ -151,21 +161,31 @@ export default defineComponent({
|
|
|
151
161
|
type: Object as PropType<Map<string, ScenarioStepAnswer[]>>,
|
|
152
162
|
default: () => new Map<string, ScenarioStepAnswer[]>(),
|
|
153
163
|
},
|
|
164
|
+
/**
|
|
165
|
+
* Component icon
|
|
166
|
+
*/
|
|
167
|
+
icon: {
|
|
168
|
+
type: string,
|
|
169
|
+
default: () => WARNING_ICON,
|
|
170
|
+
},
|
|
154
171
|
},
|
|
155
172
|
methods: {
|
|
156
|
-
injectIcon(
|
|
173
|
+
injectIcon() {
|
|
157
174
|
this.$nextTick(() => {
|
|
158
|
-
const element = document.
|
|
175
|
+
const element = document.querySelector('#pb-warning-message-icon');
|
|
159
176
|
if (element) {
|
|
160
177
|
SVGInjector(element, {
|
|
161
178
|
each: function (svg) {
|
|
162
|
-
(svg
|
|
179
|
+
if (svg) {
|
|
180
|
+
console.log(svg);
|
|
181
|
+
(svg as any).setAttribute('fill', '#C65200');
|
|
182
|
+
}
|
|
163
183
|
},
|
|
164
184
|
});
|
|
165
185
|
}
|
|
166
186
|
});
|
|
167
187
|
|
|
168
|
-
return icon;
|
|
188
|
+
return this.icon;
|
|
169
189
|
},
|
|
170
190
|
callAction(action: WarningMessagePayloadAction) {
|
|
171
191
|
if (action.type === 'STEP') {
|
|
@@ -280,6 +300,23 @@ $responsive-breakpoint: 'm';
|
|
|
280
300
|
padding: 0 0 $mu250 0;
|
|
281
301
|
}
|
|
282
302
|
|
|
303
|
+
&__head {
|
|
304
|
+
&__image {
|
|
305
|
+
width: 240px;
|
|
306
|
+
|
|
307
|
+
img {
|
|
308
|
+
height: auto;
|
|
309
|
+
width: 100%;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
&__text {
|
|
314
|
+
@include set-font-face('semi-bold');
|
|
315
|
+
@include set-font-scale('05', 's');
|
|
316
|
+
text-align: center;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
283
320
|
&__container__message__right {
|
|
284
321
|
h3 {
|
|
285
322
|
@include set-font-face('semi-bold');
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
"contentHtml": "Mon contenu de modal ici"
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
+
},
|
|
17
|
+
"headBlock": {
|
|
18
|
+
"image": "https://storage.googleapis.com/project-booster-media/new-house/Estimation%20Construction%20Neuve%20-%20Localisation.png",
|
|
19
|
+
"text": "Isolation des combles perdus"
|
|
16
20
|
}
|
|
17
21
|
},
|
|
18
22
|
"callToActions": [
|