project-booster-vue 9.2.3 → 9.3.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/package.json
CHANGED
|
@@ -137,6 +137,46 @@
|
|
|
137
137
|
/>
|
|
138
138
|
</div>
|
|
139
139
|
</m-flex>
|
|
140
|
+
<m-flex
|
|
141
|
+
v-if="areProjectAttributesDisplayed && projectAttributes && Object.keys(projectAttributes).length > 0"
|
|
142
|
+
class="pb-project-hub__section"
|
|
143
|
+
direction="column"
|
|
144
|
+
full-width
|
|
145
|
+
>
|
|
146
|
+
<div class="pb-project-hub__section-header">
|
|
147
|
+
<div class="pb-project-hub__section-title" ref="pbProjectAttributeList">
|
|
148
|
+
{{ titleProjectAttribute }}
|
|
149
|
+
</div>
|
|
150
|
+
</div>
|
|
151
|
+
<div class="pb-project-hub__section-content">
|
|
152
|
+
<m-flex
|
|
153
|
+
class="pb-project-hub__section-content--loading"
|
|
154
|
+
v-if="isLoadingProjectAttributes && !projectAttributesLoadError"
|
|
155
|
+
direction="column"
|
|
156
|
+
align-items="center"
|
|
157
|
+
justify-content="center"
|
|
158
|
+
align-content="center"
|
|
159
|
+
>
|
|
160
|
+
<pb-animable-loader class="pb-project-hub__section-content--loading-loader" />
|
|
161
|
+
<div class="pb-project-hub__section-content--loading-label">Chargement...</div>
|
|
162
|
+
</m-flex>
|
|
163
|
+
<pb-empty-state
|
|
164
|
+
v-else-if="project && Object.values(projectAttributes).length === 0 && !projectAttributesLoadError"
|
|
165
|
+
subtitle="Aucune information renseignée"
|
|
166
|
+
disabled
|
|
167
|
+
/>
|
|
168
|
+
<m-container
|
|
169
|
+
class="pb-project-hub__section-content-cards-container"
|
|
170
|
+
fluid
|
|
171
|
+
v-else-if="project && projectAttributes && !projectAttributesLoadError"
|
|
172
|
+
>
|
|
173
|
+
<pb-project-attributes :project-attributes="projectAttributes" />
|
|
174
|
+
</m-container>
|
|
175
|
+
<m-flex v-else-if="projectAttributesLoadError" direction="column" align-items="center">
|
|
176
|
+
<div>Une erreur est survenue</div>
|
|
177
|
+
</m-flex>
|
|
178
|
+
</div>
|
|
179
|
+
</m-flex>
|
|
140
180
|
<m-flex
|
|
141
181
|
v-if="isEstimatesDisplayed"
|
|
142
182
|
class="pb-project-hub__section"
|
|
@@ -401,46 +441,6 @@
|
|
|
401
441
|
/>
|
|
402
442
|
</div>
|
|
403
443
|
</m-flex>
|
|
404
|
-
<m-flex
|
|
405
|
-
v-if="areProjectAttributesDisplayed && projectAttributes && Object.keys(projectAttributes).length > 0"
|
|
406
|
-
class="pb-project-hub__section"
|
|
407
|
-
direction="column"
|
|
408
|
-
full-width
|
|
409
|
-
>
|
|
410
|
-
<div class="pb-project-hub__section-header">
|
|
411
|
-
<div class="pb-project-hub__section-title" ref="pbProjectAttributeList">
|
|
412
|
-
{{ titleProjectAttribute }}
|
|
413
|
-
</div>
|
|
414
|
-
</div>
|
|
415
|
-
<div class="pb-project-hub__section-content">
|
|
416
|
-
<m-flex
|
|
417
|
-
class="pb-project-hub__section-content--loading"
|
|
418
|
-
v-if="isLoadingProjectAttributes && !projectAttributesLoadError"
|
|
419
|
-
direction="column"
|
|
420
|
-
align-items="center"
|
|
421
|
-
justify-content="center"
|
|
422
|
-
align-content="center"
|
|
423
|
-
>
|
|
424
|
-
<pb-animable-loader class="pb-project-hub__section-content--loading-loader" />
|
|
425
|
-
<div class="pb-project-hub__section-content--loading-label">Chargement...</div>
|
|
426
|
-
</m-flex>
|
|
427
|
-
<pb-empty-state
|
|
428
|
-
v-else-if="project && Object.values(projectAttributes).length === 0 && !projectAttributesLoadError"
|
|
429
|
-
subtitle="Aucune information renseignée"
|
|
430
|
-
disabled
|
|
431
|
-
/>
|
|
432
|
-
<m-container
|
|
433
|
-
class="pb-project-hub__section-content-cards-container"
|
|
434
|
-
fluid
|
|
435
|
-
v-else-if="project && projectAttributes && !projectAttributesLoadError"
|
|
436
|
-
>
|
|
437
|
-
<pb-project-attributes :project-attributes="projectAttributes" />
|
|
438
|
-
</m-container>
|
|
439
|
-
<m-flex v-else-if="projectAttributesLoadError" direction="column" align-items="center">
|
|
440
|
-
<div>Une erreur est survenue</div>
|
|
441
|
-
</m-flex>
|
|
442
|
-
</div>
|
|
443
|
-
</m-flex>
|
|
444
444
|
<m-flex
|
|
445
445
|
v-if="isPlannerDisplayed"
|
|
446
446
|
class="pb-project-hub__section pb-project-hub__planner-section"
|
|
@@ -427,8 +427,8 @@ export default defineComponent({
|
|
|
427
427
|
this.pageSize = this.payload.viewModel.showMore.itemsPerPage;
|
|
428
428
|
}
|
|
429
429
|
|
|
430
|
+
const answerValues = this.answers?.get(this.stepName ?? '') ?? [];
|
|
430
431
|
for (const { code: answerCode } of Object.values(Object.fromEntries(this.questionPossibleAnswers))) {
|
|
431
|
-
const answerValues = this.answers?.get(this.stepName ?? '') ?? [];
|
|
432
432
|
const questionPossibleAnswer = this.questionPossibleAnswers.get(answerCode);
|
|
433
433
|
if (
|
|
434
434
|
questionPossibleAnswer &&
|
|
@@ -195,7 +195,10 @@ export default defineComponent({
|
|
|
195
195
|
remainingSteps: 0,
|
|
196
196
|
});
|
|
197
197
|
const reverseAnimation = ref(false);
|
|
198
|
+
const forceRefresh = ref(false);
|
|
198
199
|
const noPointerEvents = ref(false);
|
|
200
|
+
const stepAnimationTimeoutId = ref<ReturnType<typeof setTimeout>>();
|
|
201
|
+
const progressUpdateTimeoutId = ref<ReturnType<typeof setTimeout>>();
|
|
199
202
|
|
|
200
203
|
const initScenario = (currentScenarioCode: string, stepToResume: ScenarioStep | undefined = undefined) => {
|
|
201
204
|
if (currentScenarioCode === '__START__') {
|
|
@@ -312,6 +315,7 @@ export default defineComponent({
|
|
|
312
315
|
currentStep: state.value.currentStep,
|
|
313
316
|
stepIndex: state.value.history.stepIndex,
|
|
314
317
|
stepHistory: state.value.history.steps,
|
|
318
|
+
stepsToResume: state.value.stepsToResume,
|
|
315
319
|
},
|
|
316
320
|
});
|
|
317
321
|
};
|
|
@@ -368,7 +372,7 @@ export default defineComponent({
|
|
|
368
372
|
|
|
369
373
|
state.value.stepsToResume = requestedStep.stepsToResume!;
|
|
370
374
|
|
|
371
|
-
state.value.currentStep =
|
|
375
|
+
state.value.currentStep = requestedStep?.step;
|
|
372
376
|
|
|
373
377
|
animateDisplayedStep(stepIndex < state.value.history.stepIndex);
|
|
374
378
|
state.value.history.stepIndex = stepIndex;
|
|
@@ -395,41 +399,47 @@ export default defineComponent({
|
|
|
395
399
|
}
|
|
396
400
|
};
|
|
397
401
|
const updateProgressInScenario = () => {
|
|
398
|
-
if (state.value.stepsToResume
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
progress.value.progress =
|
|
407
|
-
(100 * (progress.value.currentPosition - 1)) /
|
|
408
|
-
(progress.value.currentPosition + progress.value.remainingSteps);
|
|
409
|
-
}, 450);
|
|
410
|
-
} else if (state.value.stepsToResume.slice(-2, -1)[0]?.trackProgress) {
|
|
411
|
-
// Use current last progress tracked scenario step props for first step of nested scenario
|
|
412
|
-
setTimeout(() => {
|
|
413
|
-
const currentProgress = trackProgress(state.value.history.stepIndex - 1, state.value.history.steps!);
|
|
414
|
-
|
|
415
|
-
if (currentProgress.currentPosition === 1) {
|
|
416
|
-
const previousProgress = trackProgress(state.value.history.stepIndex - 3, state.value.history.steps!);
|
|
417
|
-
previousProgress.currentPosition++;
|
|
418
|
-
previousProgress.remainingSteps--;
|
|
402
|
+
if (state.value.stepsToResume) {
|
|
403
|
+
if (progressUpdateTimeoutId.value) {
|
|
404
|
+
clearTimeout(progressUpdateTimeoutId.value);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
if (state.value.stepsToResume.slice(-1)[0]?.trackProgress) {
|
|
408
|
+
// Use current step props
|
|
409
|
+
progressUpdateTimeoutId.value = setTimeout(() => {
|
|
419
410
|
progress.value = {
|
|
420
411
|
...progress.value,
|
|
421
|
-
...
|
|
412
|
+
...trackProgress(state.value.history.stepIndex - 1, state.value.history.steps!),
|
|
422
413
|
};
|
|
414
|
+
|
|
423
415
|
progress.value.progress =
|
|
424
416
|
(100 * (progress.value.currentPosition - 1)) /
|
|
425
417
|
(progress.value.currentPosition + progress.value.remainingSteps);
|
|
426
|
-
}
|
|
427
|
-
},
|
|
418
|
+
}, 450);
|
|
419
|
+
} else if (state.value.stepsToResume.slice(-2, -1)[0]?.trackProgress) {
|
|
420
|
+
// Use current last progress tracked scenario step props for first step of nested scenario
|
|
421
|
+
progressUpdateTimeoutId.value = setTimeout(() => {
|
|
422
|
+
const currentProgress = trackProgress(state.value.history.stepIndex - 1, state.value.history.steps!);
|
|
423
|
+
|
|
424
|
+
if (currentProgress.currentPosition === 1) {
|
|
425
|
+
const previousProgress = trackProgress(state.value.history.stepIndex - 3, state.value.history.steps!);
|
|
426
|
+
previousProgress.currentPosition++;
|
|
427
|
+
previousProgress.remainingSteps--;
|
|
428
|
+
progress.value = {
|
|
429
|
+
...progress.value,
|
|
430
|
+
...previousProgress,
|
|
431
|
+
};
|
|
432
|
+
progress.value.progress =
|
|
433
|
+
(100 * (progress.value.currentPosition - 1)) /
|
|
434
|
+
(progress.value.currentPosition + progress.value.remainingSteps);
|
|
435
|
+
}
|
|
436
|
+
}, 450);
|
|
437
|
+
}
|
|
428
438
|
}
|
|
429
439
|
};
|
|
430
440
|
const trackProgress = (originIndex: number, steps: ScenarioHistoryItem[]) => {
|
|
431
441
|
let currentPosition = 1;
|
|
432
|
-
for (let index = originIndex; index
|
|
442
|
+
for (let index = Math.max(originIndex, 0); index >= 0; index--) {
|
|
433
443
|
if (steps[index]?.step?.type === 'SCENARIO') {
|
|
434
444
|
break;
|
|
435
445
|
}
|
|
@@ -469,7 +479,11 @@ export default defineComponent({
|
|
|
469
479
|
const animateDisplayedStep = (reversed = false) => {
|
|
470
480
|
reverseAnimation.value = reversed;
|
|
471
481
|
|
|
472
|
-
|
|
482
|
+
if (stepAnimationTimeoutId.value) {
|
|
483
|
+
clearTimeout(stepAnimationTimeoutId.value);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
stepAnimationTimeoutId.value = setTimeout(() => {
|
|
473
487
|
nextTick(() => {
|
|
474
488
|
state.value.displayedStep = state.value.currentStep;
|
|
475
489
|
setTimeout(() => {
|
|
@@ -580,7 +594,8 @@ export default defineComponent({
|
|
|
580
594
|
watch(route, () => {
|
|
581
595
|
const requestedStepIndex = route.params?.stepCode as string;
|
|
582
596
|
|
|
583
|
-
if (requestedStepIndex && requestedStepIndex !== `${state.value.history.stepIndex}`) {
|
|
597
|
+
if ((requestedStepIndex && requestedStepIndex !== `${state.value.history.stepIndex}`) || forceRefresh.value) {
|
|
598
|
+
forceRefresh.value = false;
|
|
584
599
|
goToStep(parseInt(requestedStepIndex));
|
|
585
600
|
}
|
|
586
601
|
});
|
|
@@ -609,7 +624,9 @@ export default defineComponent({
|
|
|
609
624
|
if (state.value.answers && !(state.value.answers instanceof Map)) {
|
|
610
625
|
state.value.answers = new Map<string, ScenarioStepAnswer[]>(Object.entries(state.value.answers));
|
|
611
626
|
}
|
|
612
|
-
|
|
627
|
+
const newRoute = `/steps/${state.value.history.stepIndex}/previous/${uuidv4()}`;
|
|
628
|
+
forceRefresh.value = true;
|
|
629
|
+
router.replace(newRoute);
|
|
613
630
|
}
|
|
614
631
|
},
|
|
615
632
|
);
|
|
@@ -620,7 +637,9 @@ export default defineComponent({
|
|
|
620
637
|
},
|
|
621
638
|
);
|
|
622
639
|
|
|
623
|
-
|
|
640
|
+
if (!props.previousState) {
|
|
641
|
+
initScenario('__START__');
|
|
642
|
+
}
|
|
624
643
|
onMounted(() => {
|
|
625
644
|
document.getElementsByTagName('body')[0].style.setProperty('overflow-x', 'hidden');
|
|
626
645
|
});
|
package/src/types/pb/Scenario.ts
CHANGED