project-booster-vue 9.31.0 → 9.31.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/package.json +1 -1
- package/src/components/media/PbMedia.vue +22 -12
- package/src/components/media/detail/PbMediaDetail.vue +20 -6
- package/src/components/media/list/PbMediaList.vue +15 -4
- package/src/components/media/upload/PbMediaUpload.vue +24 -13
- package/src/components/pedagogy/PbPedagogy.stories.mdx +1 -1
- package/src/components/pedagogy/__snapshots__/storyshots-puppeteer-test-puppeteer-ts-image-storyshots-project-booster-components-pedagogy-pb-pedagogy-/360/237/246/240-101-sandbox-1-snap.png +0 -0
- package/src/components/pedagogy/default-payload.json +0 -11
- package/src/components/question/incremental-amount-input/PbIncrementalAmountInput.vue +3 -1
- package/src/components/question/upload-document/PbUploadDocument.vue +10 -7
package/package.json
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
<div class="pb-media__header-upload-button" v-if="(!isLoadingMedia || mediaList.length > 0) && !mediaLoadError">
|
|
13
13
|
<pb-media-upload
|
|
14
14
|
v-if="!readOnly"
|
|
15
|
+
:store-module-name="storeModuleName"
|
|
15
16
|
:payload="uploadPayload"
|
|
16
17
|
@media-uploaded="handleMediaUploaded"
|
|
17
18
|
ref="pbMediaUpload"
|
|
@@ -37,12 +38,13 @@
|
|
|
37
38
|
subtitle-error="Voulez-vous relancer le chargement des photos"
|
|
38
39
|
retry-button-label="Réessayer"
|
|
39
40
|
:state="mediaLoadError ? 'error' : 'loading'"
|
|
40
|
-
@loader-click="$store.dispatch('
|
|
41
|
+
@loader-click="$store.dispatch(storeModuleName + '/loadMedia')"
|
|
41
42
|
/>
|
|
42
43
|
</m-flex>
|
|
43
44
|
<pb-media-list
|
|
44
45
|
v-else
|
|
45
46
|
ref="pbMediaList"
|
|
47
|
+
:store-module-name="storeModuleName"
|
|
46
48
|
:media-list="mediaList"
|
|
47
49
|
:has-still-media="hasStillMedia"
|
|
48
50
|
:is-loading-media="isLoadingMedia"
|
|
@@ -51,7 +53,7 @@
|
|
|
51
53
|
:read-only="readOnly"
|
|
52
54
|
@add-media="addMedia"
|
|
53
55
|
@click-on-delete="handleClickOnDelete"
|
|
54
|
-
@click-load-more="$store.dispatch('
|
|
56
|
+
@click-load-more="$store.dispatch(storeModuleName + '/loadMoreMedia')"
|
|
55
57
|
/>
|
|
56
58
|
</m-flex>
|
|
57
59
|
<m-notification
|
|
@@ -124,7 +126,7 @@
|
|
|
124
126
|
} » n'a pas pu être supprimée.`"
|
|
125
127
|
closable
|
|
126
128
|
:link-label="mediaDeletionError ? 'Réessayer' : null"
|
|
127
|
-
@link-click="$store.dispatch('
|
|
129
|
+
@link-click="$store.dispatch(storeModuleName + '/deleteMedia', currentMedia)"
|
|
128
130
|
@close="resetMediaDeletionError"
|
|
129
131
|
/>
|
|
130
132
|
<pb-sticky-footer
|
|
@@ -135,6 +137,7 @@
|
|
|
135
137
|
<pb-media-upload
|
|
136
138
|
ref="pbMediaUploadSticky"
|
|
137
139
|
class="pb-media__sticky-upload-button-content"
|
|
140
|
+
:store-module-name="storeModuleName"
|
|
138
141
|
:payload="uploadPayload"
|
|
139
142
|
@media-uploaded="handleMediaUploaded"
|
|
140
143
|
:read-only="readOnly"
|
|
@@ -189,6 +192,13 @@ export default defineComponent({
|
|
|
189
192
|
type: String,
|
|
190
193
|
default: 'Mes documents',
|
|
191
194
|
},
|
|
195
|
+
/**
|
|
196
|
+
* The store module name
|
|
197
|
+
*/
|
|
198
|
+
storeModuleName: {
|
|
199
|
+
type: String,
|
|
200
|
+
default: 'documents',
|
|
201
|
+
},
|
|
192
202
|
/**
|
|
193
203
|
* The detail component payload
|
|
194
204
|
*/
|
|
@@ -234,16 +244,16 @@ export default defineComponent({
|
|
|
234
244
|
const isDeletingMedia = ref(false);
|
|
235
245
|
const isMediaDeletionSuccess = ref(false);
|
|
236
246
|
|
|
237
|
-
const isLoadingMedia = computed(() => store.getters['
|
|
238
|
-
const hasStillMedia = computed(() => store.getters['
|
|
239
|
-
const mediaList = computed(() => store.getters['
|
|
240
|
-
const mediaLoadError = computed(() => store.getters['
|
|
241
|
-
const isAddPhotoDisabled = computed(() => store.getters['
|
|
242
|
-
const currentMedia = computed(() => store.getters['
|
|
247
|
+
const isLoadingMedia = computed(() => store.getters[props.storeModuleName + '/isLoadingMedia']);
|
|
248
|
+
const hasStillMedia = computed(() => store.getters[props.storeModuleName + '/hasStillMedia']);
|
|
249
|
+
const mediaList = computed(() => store.getters[props.storeModuleName + '/getMediaList']);
|
|
250
|
+
const mediaLoadError = computed(() => store.getters[props.storeModuleName + '/getMediaLoadError']);
|
|
251
|
+
const isAddPhotoDisabled = computed(() => store.getters[props.storeModuleName + '/isAddPhotoDisabled']);
|
|
252
|
+
const currentMedia = computed(() => store.getters[props.storeModuleName + '/getCurrentMedia']);
|
|
243
253
|
const project = computed(() => store.getters['projects/getProject']);
|
|
244
254
|
|
|
245
255
|
const handleMediaUploaded = () => {
|
|
246
|
-
store.dispatch('
|
|
256
|
+
store.dispatch(props.storeModuleName + '/refreshMediaList');
|
|
247
257
|
};
|
|
248
258
|
const handleClickOnDelete = (media: Media) => {
|
|
249
259
|
mediaToDelete.value = media;
|
|
@@ -269,10 +279,10 @@ export default defineComponent({
|
|
|
269
279
|
mediaDeletionError.value = null;
|
|
270
280
|
isDeletingMedia.value = true;
|
|
271
281
|
try {
|
|
272
|
-
await store.dispatch('
|
|
282
|
+
await store.dispatch(props.storeModuleName + '/deleteMedia', mediaToDelete.value);
|
|
273
283
|
isMediaDeletionSuccess.value = true;
|
|
274
284
|
if (currentMedia.value && currentMedia.value.id === mediaToDelete.value?.id) {
|
|
275
|
-
store.dispatch('
|
|
285
|
+
store.dispatch(props.storeModuleName + '/updateCurrentMedia', null);
|
|
276
286
|
}
|
|
277
287
|
setTimeout(() => {
|
|
278
288
|
isMediaDeletionSuccess.value = false;
|
|
@@ -16,7 +16,10 @@
|
|
|
16
16
|
<pb-media-loader class="hidden-on-mobile" />
|
|
17
17
|
</m-flex>
|
|
18
18
|
<div class="pb-media-detail__image" :style="`background-image: url(${mediaUrl});`" />
|
|
19
|
-
<div
|
|
19
|
+
<div
|
|
20
|
+
v-if="storeModuleName === 'documents' && media.fileType && media.fileType === 'PDF'"
|
|
21
|
+
class="pb-media-detail__image-download"
|
|
22
|
+
>
|
|
20
23
|
<m-button
|
|
21
24
|
label="Visualiser le PDF"
|
|
22
25
|
right-icon="https://storage.googleapis.com/project-booster-media/mozaic-icons/svg/Navigation_Display_ExternalLink_24px.svg"
|
|
@@ -222,6 +225,13 @@ export default defineComponent({
|
|
|
222
225
|
type: Object,
|
|
223
226
|
default: null,
|
|
224
227
|
},
|
|
228
|
+
/**
|
|
229
|
+
* The store module name to contextualize the store.
|
|
230
|
+
*/
|
|
231
|
+
storeModuleName: {
|
|
232
|
+
type: String,
|
|
233
|
+
default: 'documents',
|
|
234
|
+
},
|
|
225
235
|
/**
|
|
226
236
|
* Indicates whether the UI is read only
|
|
227
237
|
*/
|
|
@@ -275,18 +285,22 @@ export default defineComponent({
|
|
|
275
285
|
}
|
|
276
286
|
return error;
|
|
277
287
|
},
|
|
288
|
+
storePrefix() {
|
|
289
|
+
return this.storeModuleName ? this.storeModuleName + '/' : '';
|
|
290
|
+
},
|
|
278
291
|
mediaUrl() {
|
|
279
292
|
let mediaUrl;
|
|
280
293
|
// If document, check if pdf or image
|
|
281
294
|
if (this.media?.fileType === 'PDF') {
|
|
282
|
-
mediaUrl = this.$store.getters['
|
|
283
|
-
|
|
284
|
-
|
|
295
|
+
mediaUrl = this.$store.getters[this.storePrefix + 'getThumbnailUrl'].replace(
|
|
296
|
+
'@@PB_MEDIA_ID_FILLER@@',
|
|
297
|
+
this.media.id,
|
|
298
|
+
);
|
|
285
299
|
}
|
|
286
300
|
return mediaUrl;
|
|
287
301
|
},
|
|
288
302
|
pdfUrl() {
|
|
289
|
-
return this.$store.getters['
|
|
303
|
+
return this.$store.getters[this.storePrefix + 'getMediaUrl'].replace('@@PB_MEDIA_ID_FILLER@@', this.media.id);
|
|
290
304
|
},
|
|
291
305
|
},
|
|
292
306
|
|
|
@@ -411,7 +425,7 @@ export default defineComponent({
|
|
|
411
425
|
this.mediaNameSaveError = false;
|
|
412
426
|
this.isMediaNameSaved = false;
|
|
413
427
|
try {
|
|
414
|
-
await this.$store.dispatch('
|
|
428
|
+
await this.$store.dispatch(this.storePrefix + 'updateMediaName', { id: this.media.id, name: this.mediaName });
|
|
415
429
|
this.$emit('media-name-updated', this.mediaName);
|
|
416
430
|
this.isMediaNameSaved = true;
|
|
417
431
|
} catch (err: any) {
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
</m-flex>
|
|
68
68
|
<pb-media-detail
|
|
69
69
|
v-if="currentMedia"
|
|
70
|
+
:store-module-name="storeModuleName"
|
|
70
71
|
:payload="detailPayload"
|
|
71
72
|
:media="currentMedia"
|
|
72
73
|
:read-only="readOnly"
|
|
@@ -118,6 +119,13 @@ export default defineComponent({
|
|
|
118
119
|
type: Array,
|
|
119
120
|
default: () => [],
|
|
120
121
|
},
|
|
122
|
+
/**
|
|
123
|
+
* The store module name to contextualize the store.
|
|
124
|
+
*/
|
|
125
|
+
storeModuleName: {
|
|
126
|
+
type: String,
|
|
127
|
+
default: 'documents',
|
|
128
|
+
},
|
|
121
129
|
/**
|
|
122
130
|
* Indicates wheteher pagination controllers are active.
|
|
123
131
|
*/
|
|
@@ -162,14 +170,17 @@ export default defineComponent({
|
|
|
162
170
|
}),
|
|
163
171
|
|
|
164
172
|
computed: {
|
|
173
|
+
storePrefix() {
|
|
174
|
+
return this.storeModuleName ? this.storeModuleName + '/' : '';
|
|
175
|
+
},
|
|
165
176
|
thumbnailUrl() {
|
|
166
|
-
return this.$store.getters['
|
|
177
|
+
return this.$store.getters[this.storePrefix + 'getThumbnailUrl'];
|
|
167
178
|
},
|
|
168
179
|
addedMediaNumber() {
|
|
169
|
-
return this.$store.getters['
|
|
180
|
+
return this.$store.getters[this.storePrefix + 'getAddedMediaNumber'];
|
|
170
181
|
},
|
|
171
182
|
currentMedia() {
|
|
172
|
-
return this.$store.getters['
|
|
183
|
+
return this.$store.getters[this.storePrefix + 'getCurrentMedia'];
|
|
173
184
|
},
|
|
174
185
|
},
|
|
175
186
|
|
|
@@ -198,7 +209,7 @@ export default defineComponent({
|
|
|
198
209
|
|
|
199
210
|
handleClickOnClose() {
|
|
200
211
|
this.$store.dispatch('sendEventToBus', { code: 'mediaDetailExit', payload: {} });
|
|
201
|
-
this.$store.dispatch('
|
|
212
|
+
this.$store.dispatch(this.storePrefix + 'updateCurrentMedia', null);
|
|
202
213
|
this.$router.back();
|
|
203
214
|
},
|
|
204
215
|
|
|
@@ -238,6 +238,13 @@ export default defineComponent({
|
|
|
238
238
|
type: String,
|
|
239
239
|
default: 'image/jpeg, image/png, image/heif, image/heic, image/heif-sequence, image/heic-sequence',
|
|
240
240
|
},
|
|
241
|
+
/**
|
|
242
|
+
* The store module name to contextualize the store.
|
|
243
|
+
*/
|
|
244
|
+
storeModuleName: {
|
|
245
|
+
type: String,
|
|
246
|
+
default: 'documents',
|
|
247
|
+
},
|
|
241
248
|
/**
|
|
242
249
|
* Defines the payload
|
|
243
250
|
*/
|
|
@@ -269,32 +276,36 @@ export default defineComponent({
|
|
|
269
276
|
},
|
|
270
277
|
|
|
271
278
|
computed: {
|
|
279
|
+
storePrefix() {
|
|
280
|
+
return this.storeModuleName ? this.storeModuleName + '/' : '';
|
|
281
|
+
},
|
|
282
|
+
|
|
272
283
|
isAddPhotoDisabled() {
|
|
273
|
-
return this.$store.getters['
|
|
284
|
+
return this.$store.getters[this.storePrefix + 'isAddPhotoDisabled'];
|
|
274
285
|
},
|
|
275
286
|
|
|
276
287
|
isMediaUploaded() {
|
|
277
|
-
return this.$store.getters['
|
|
288
|
+
return this.$store.getters[this.storePrefix + 'isUploaded'];
|
|
278
289
|
},
|
|
279
290
|
|
|
280
291
|
isMediaUploading() {
|
|
281
|
-
return this.$store.getters['
|
|
292
|
+
return this.$store.getters[this.storePrefix + 'isUploading'];
|
|
282
293
|
},
|
|
283
294
|
|
|
284
295
|
mediaUploadError() {
|
|
285
|
-
return this.$store.getters['
|
|
296
|
+
return this.$store.getters[this.storePrefix + 'getUploadError'];
|
|
286
297
|
},
|
|
287
298
|
|
|
288
299
|
uploadedMediaId() {
|
|
289
|
-
return this.$store.getters['
|
|
300
|
+
return this.$store.getters[this.storePrefix + 'getUploadedId'];
|
|
290
301
|
},
|
|
291
302
|
|
|
292
303
|
isNameAlreadyUsed() {
|
|
293
|
-
return this.$store.getters['
|
|
304
|
+
return this.$store.getters[this.storePrefix + 'isNameAlreadyUsed'];
|
|
294
305
|
},
|
|
295
306
|
|
|
296
307
|
uploadProgress() {
|
|
297
|
-
return this.$store.getters['
|
|
308
|
+
return this.$store.getters[this.storePrefix + 'getUploadProgress'];
|
|
298
309
|
},
|
|
299
310
|
|
|
300
311
|
nameSaveError() {
|
|
@@ -349,7 +360,7 @@ export default defineComponent({
|
|
|
349
360
|
}
|
|
350
361
|
},
|
|
351
362
|
fileName() {
|
|
352
|
-
this.$store.dispatch('
|
|
363
|
+
this.$store.dispatch(this.storePrefix + 'nameChanged');
|
|
353
364
|
},
|
|
354
365
|
},
|
|
355
366
|
|
|
@@ -391,7 +402,7 @@ export default defineComponent({
|
|
|
391
402
|
this.isRoomPicture = false;
|
|
392
403
|
this.selectedType = null;
|
|
393
404
|
this.$refs?.pbMediaUploadForm?.reset();
|
|
394
|
-
this.$store.dispatch('
|
|
405
|
+
this.$store.dispatch(this.storePrefix + 'resetMediaUploadContext');
|
|
395
406
|
},
|
|
396
407
|
|
|
397
408
|
async upload() {
|
|
@@ -399,7 +410,7 @@ export default defineComponent({
|
|
|
399
410
|
if (this.selectedType === null) {
|
|
400
411
|
this.selectedType = this.payload.viewModel.dialog.defaultMediaType;
|
|
401
412
|
}
|
|
402
|
-
await this.$store.dispatch('
|
|
413
|
+
await this.$store.dispatch(this.storePrefix + 'uploadFile', {
|
|
403
414
|
formData: this.formData,
|
|
404
415
|
fileName: this.fileName,
|
|
405
416
|
isRoomPicture: this.isRoomPicture,
|
|
@@ -421,7 +432,7 @@ export default defineComponent({
|
|
|
421
432
|
async fileChange(event: Event) {
|
|
422
433
|
const fieldName: string = (event.target as HTMLInputElement).name;
|
|
423
434
|
const filesList = (event.target as HTMLInputElement).files;
|
|
424
|
-
this.$store.dispatch('
|
|
435
|
+
this.$store.dispatch(this.storePrefix + 'generateCorrelationId');
|
|
425
436
|
this.formData = new FormData();
|
|
426
437
|
|
|
427
438
|
if (!filesList?.length) {
|
|
@@ -433,7 +444,7 @@ export default defineComponent({
|
|
|
433
444
|
if (file['type'].split('/')[0] === 'image') {
|
|
434
445
|
const validationData = await this.validateMedia(file);
|
|
435
446
|
this.$store.dispatch('sendEventToBus', { code: 'documentUploadValidation', payload: validationData });
|
|
436
|
-
this.$store.dispatch('
|
|
447
|
+
this.$store.dispatch(this.storePrefix + 'validateFileData', validationData);
|
|
437
448
|
this.validationErrors = validationData.validation;
|
|
438
449
|
this.updateMediaPreviewUrl(file);
|
|
439
450
|
} else {
|
|
@@ -444,7 +455,7 @@ export default defineComponent({
|
|
|
444
455
|
this.mediaPreviewUrl = PDF_IMAGE;
|
|
445
456
|
this.displayAddDialog = true;
|
|
446
457
|
}
|
|
447
|
-
this.$store.dispatch('
|
|
458
|
+
this.$store.dispatch(this.storePrefix + 'sendEvent', {
|
|
448
459
|
eventName: 'qualify-by-the-front',
|
|
449
460
|
file: file,
|
|
450
461
|
} as MediaEventOptions);
|
|
@@ -15,17 +15,6 @@
|
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"cards": [
|
|
18
|
-
{
|
|
19
|
-
"code": "CARD-1",
|
|
20
|
-
"viewModel": {
|
|
21
|
-
"url": "https://www.leroymerlin.fr/produits/cuisine/cuisine-equipee-delinia-id/",
|
|
22
|
-
"image": "https://media.leroymerlin.fr/Capture/37/bc/a121f7e74212ad2d356fd3cf2c8a/estimer-mon-budget-cuisine5e5d20ae063b330009a4a372.jpg?width=500&auto=webp&crop=16:9",
|
|
23
|
-
"title": "Estimer votre budget cuisine en quelques clics",
|
|
24
|
-
"width": "full",
|
|
25
|
-
"widthFromM": "1of3",
|
|
26
|
-
"widthFromL": "1of3"
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
18
|
{
|
|
30
19
|
"code": "CARD-2",
|
|
31
20
|
"viewModel": {
|
|
@@ -265,15 +265,17 @@ $responsive-breakpoint: 'm';
|
|
|
265
265
|
@include set-font-scale('07', 's');
|
|
266
266
|
|
|
267
267
|
color: $color-grey-700;
|
|
268
|
+
margin-bottom: 10px;
|
|
268
269
|
max-width: 100%;
|
|
269
270
|
padding: 0 0 0 0;
|
|
271
|
+
text-align: center;
|
|
270
272
|
width: 384px;
|
|
271
273
|
|
|
272
274
|
@include set-from-screen($responsive-breakpoint) {
|
|
273
275
|
@include set-font-scale('08', 'm');
|
|
274
276
|
|
|
277
|
+
margin-bottom: 0;
|
|
275
278
|
padding: $mu250 $mu100 $mu100 $mu100;
|
|
276
|
-
text-align: center;
|
|
277
279
|
width: auto;
|
|
278
280
|
}
|
|
279
281
|
}
|
|
@@ -129,6 +129,7 @@
|
|
|
129
129
|
</pb-sticky-footer>
|
|
130
130
|
<pb-media-upload
|
|
131
131
|
:payload="payload.viewModel.mediaPayload"
|
|
132
|
+
:store-module-name="storeModuleName"
|
|
132
133
|
@display-dialog="handleDisplayDialogEvent"
|
|
133
134
|
@media-uploaded="handleMediaUploaded"
|
|
134
135
|
ref="pbMediaUpload"
|
|
@@ -237,6 +238,7 @@ export default defineComponent({
|
|
|
237
238
|
|
|
238
239
|
setup(props, { emit }) {
|
|
239
240
|
const store = useStore();
|
|
241
|
+
let storeModuleName = ref(props.payload.viewModel.mediaPayload.viewModel.type);
|
|
240
242
|
|
|
241
243
|
const pbMediaUpload = ref<ComponentCustomProperties>();
|
|
242
244
|
|
|
@@ -247,12 +249,12 @@ export default defineComponent({
|
|
|
247
249
|
const pageSize = ref(8);
|
|
248
250
|
const showMoreAnimation = ref('');
|
|
249
251
|
const showMoreButtonDisplayed = computed(
|
|
250
|
-
() => store.getters['
|
|
252
|
+
() => store.getters[storeModuleName.value + '/hasStillMedia'] && props.payload.viewModel.showMore,
|
|
251
253
|
);
|
|
252
|
-
const selectedDocuments = computed(() => store.getters['
|
|
253
|
-
const thumbnailUrl = computed(() => store.getters['
|
|
254
|
+
const selectedDocuments = computed(() => store.getters[storeModuleName.value + '/getMediaList']);
|
|
255
|
+
const thumbnailUrl = computed(() => store.getters[storeModuleName.value + '/getThumbnailUrl']);
|
|
254
256
|
onMounted(() => {
|
|
255
|
-
store.dispatch('
|
|
257
|
+
store.dispatch(storeModuleName.value + '/sendEvent', { eventName: 'start', file: null });
|
|
256
258
|
if (props.payload.viewModel.startOpened) {
|
|
257
259
|
pbMediaUpload.value?.$refs.pbMediaUploadFormInput.click();
|
|
258
260
|
}
|
|
@@ -295,12 +297,12 @@ export default defineComponent({
|
|
|
295
297
|
};
|
|
296
298
|
|
|
297
299
|
const handleMediaUploaded = () => {
|
|
298
|
-
store.dispatch('
|
|
300
|
+
store.dispatch(storeModuleName.value + '/refreshMediaList');
|
|
299
301
|
};
|
|
300
302
|
|
|
301
303
|
const handleShowMoreClick = () => {
|
|
302
|
-
store.dispatch('
|
|
303
|
-
store.dispatch('
|
|
304
|
+
store.dispatch(storeModuleName.value + '/updateMediaPerPageCount', 4);
|
|
305
|
+
store.dispatch(storeModuleName.value + '/loadMoreMedia');
|
|
304
306
|
showMoreAnimation.value = 'pb-upload-document__answers-animation';
|
|
305
307
|
};
|
|
306
308
|
|
|
@@ -309,6 +311,7 @@ export default defineComponent({
|
|
|
309
311
|
BACK_ICON,
|
|
310
312
|
INFO_ICON,
|
|
311
313
|
pbMediaUpload,
|
|
314
|
+
storeModuleName,
|
|
312
315
|
lastItemIndex,
|
|
313
316
|
pageSize,
|
|
314
317
|
showMoreAnimation,
|