project-booster-vue 9.2.4 → 9.3.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "project-booster-vue",
3
- "version": "9.2.4",
3
+ "version": "9.3.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -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"
@@ -196,6 +196,8 @@ export default defineComponent({
196
196
  });
197
197
  const reverseAnimation = ref(false);
198
198
  const noPointerEvents = ref(false);
199
+ const stepAnimationTimeoutId = ref<ReturnType<typeof setTimeout>>();
200
+ const progressUpdateTimeoutId = ref<ReturnType<typeof setTimeout>>();
199
201
 
200
202
  const initScenario = (currentScenarioCode: string, stepToResume: ScenarioStep | undefined = undefined) => {
201
203
  if (currentScenarioCode === '__START__') {
@@ -312,6 +314,7 @@ export default defineComponent({
312
314
  currentStep: state.value.currentStep,
313
315
  stepIndex: state.value.history.stepIndex,
314
316
  stepHistory: state.value.history.steps,
317
+ stepsToResume: state.value.stepsToResume,
315
318
  },
316
319
  });
317
320
  };
@@ -395,36 +398,42 @@ export default defineComponent({
395
398
  }
396
399
  };
397
400
  const updateProgressInScenario = () => {
398
- if (state.value.stepsToResume.slice(-1)[0]?.trackProgress) {
399
- // Use current step props
400
- setTimeout(() => {
401
- progress.value = {
402
- ...progress.value,
403
- ...trackProgress(state.value.history.stepIndex - 1, state.value.history.steps!),
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--;
401
+ if (state.value.stepsToResume) {
402
+ if (progressUpdateTimeoutId.value) {
403
+ clearTimeout(progressUpdateTimeoutId.value);
404
+ }
405
+
406
+ if (state.value.stepsToResume.slice(-1)[0]?.trackProgress) {
407
+ // Use current step props
408
+ progressUpdateTimeoutId.value = setTimeout(() => {
419
409
  progress.value = {
420
410
  ...progress.value,
421
- ...previousProgress,
411
+ ...trackProgress(state.value.history.stepIndex - 1, state.value.history.steps!),
422
412
  };
413
+
423
414
  progress.value.progress =
424
415
  (100 * (progress.value.currentPosition - 1)) /
425
416
  (progress.value.currentPosition + progress.value.remainingSteps);
426
- }
427
- }, 450);
417
+ }, 450);
418
+ } else if (state.value.stepsToResume.slice(-2, -1)[0]?.trackProgress) {
419
+ // Use current last progress tracked scenario step props for first step of nested scenario
420
+ progressUpdateTimeoutId.value = setTimeout(() => {
421
+ const currentProgress = trackProgress(state.value.history.stepIndex - 1, state.value.history.steps!);
422
+
423
+ if (currentProgress.currentPosition === 1) {
424
+ const previousProgress = trackProgress(state.value.history.stepIndex - 3, state.value.history.steps!);
425
+ previousProgress.currentPosition++;
426
+ previousProgress.remainingSteps--;
427
+ progress.value = {
428
+ ...progress.value,
429
+ ...previousProgress,
430
+ };
431
+ progress.value.progress =
432
+ (100 * (progress.value.currentPosition - 1)) /
433
+ (progress.value.currentPosition + progress.value.remainingSteps);
434
+ }
435
+ }, 450);
436
+ }
428
437
  }
429
438
  };
430
439
  const trackProgress = (originIndex: number, steps: ScenarioHistoryItem[]) => {
@@ -469,7 +478,11 @@ export default defineComponent({
469
478
  const animateDisplayedStep = (reversed = false) => {
470
479
  reverseAnimation.value = reversed;
471
480
 
472
- setTimeout(() => {
481
+ if (stepAnimationTimeoutId.value) {
482
+ clearTimeout(stepAnimationTimeoutId.value);
483
+ }
484
+
485
+ stepAnimationTimeoutId.value = setTimeout(() => {
473
486
  nextTick(() => {
474
487
  state.value.displayedStep = state.value.currentStep;
475
488
  setTimeout(() => {
@@ -609,7 +622,8 @@ export default defineComponent({
609
622
  if (state.value.answers && !(state.value.answers instanceof Map)) {
610
623
  state.value.answers = new Map<string, ScenarioStepAnswer[]>(Object.entries(state.value.answers));
611
624
  }
612
- goToStep(state.value.history.stepIndex);
625
+ const newRoute = `/steps/${state.value.history.stepIndex}/previous/${uuidv4()}`;
626
+ router.replace(newRoute);
613
627
  }
614
628
  },
615
629
  );
@@ -147,7 +147,6 @@ export interface ScenarioState {
147
147
  currentStep: ScenarioStep | undefined;
148
148
  displayedStep: ScenarioStep | undefined;
149
149
  history: ScenarioHistory;
150
- refreshSteps: boolean;
151
150
  }
152
151
 
153
152
  export interface ScenarioStepAnswerData {