project-booster-vue 8.120.3 → 8.121.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": "8.120.3",
3
+ "version": "8.121.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "test:unit": "vue-cli-service test:unit --forceExit --detectOpenHandles",
@@ -80,21 +80,21 @@
80
80
  "@mswjs/interceptors": "0.12.7",
81
81
  "@semantic-release/changelog": "5.0.1",
82
82
  "@semantic-release/git": "9.0.0",
83
- "@storybook/addon-a11y": "6.4.13",
84
- "@storybook/addon-essentials": "6.4.13",
83
+ "@storybook/addon-a11y": "6.4.17",
84
+ "@storybook/addon-essentials": "6.4.17",
85
85
  "@storybook/addon-knobs": "6.3.1",
86
- "@storybook/addon-links": "6.4.13",
86
+ "@storybook/addon-links": "6.4.17",
87
87
  "@storybook/addon-postcss": "2.0.0",
88
- "@storybook/addon-storyshots": "6.4.13",
89
- "@storybook/addon-storyshots-puppeteer": "6.4.13",
90
- "@storybook/addon-storysource": "6.4.13",
91
- "@storybook/addons": "6.4.13",
92
- "@storybook/builder-webpack5": "6.4.13",
93
- "@storybook/manager-webpack5": "6.4.13",
94
- "@storybook/source-loader": "6.4.13",
88
+ "@storybook/addon-storyshots": "6.4.17",
89
+ "@storybook/addon-storyshots-puppeteer": "6.4.17",
90
+ "@storybook/addon-storysource": "6.4.17",
91
+ "@storybook/addons": "6.4.17",
92
+ "@storybook/builder-webpack5": "6.4.17",
93
+ "@storybook/manager-webpack5": "6.4.17",
94
+ "@storybook/source-loader": "6.4.17",
95
95
  "@storybook/storybook-deployer": "2.8.10",
96
- "@storybook/theming": "6.4.13",
97
- "@storybook/vue3": "6.4.13",
96
+ "@storybook/theming": "6.4.17",
97
+ "@storybook/vue3": "6.4.17",
98
98
  "@testing-library/jest-dom": "5.14.1",
99
99
  "@testing-library/vue": "6.4.2",
100
100
  "@vue/cli": "5.0.0-beta.7",
@@ -1,3 +1,4 @@
1
+ import { ref } from 'vue';
1
2
  import { Story, Meta, Canvas } from '@storybook/addon-docs';
2
3
  import { nestedAppDecorator } from '../../../../.storybook/nested-app-decorator';
3
4
  import { useStore } from 'vuex';
@@ -308,6 +309,152 @@ The `PbProjectHub` component to access your project.
308
309
  </Story>
309
310
  </Canvas>
310
311
 
312
+ ## Showcase autoscroll to estimates
313
+
314
+ <Canvas>
315
+ <Story
316
+ name="Showcase autoscroll to estimates"
317
+ parameters={{
318
+ controls: { disable: true },
319
+ msw: [
320
+ rest.get('/api/inhabitant-projects/:projectId', getProjectByIdResolver),
321
+ rest.get('/api/inhabitant-projects/:projectId/main-appointment', getAppointmentByIdResolver),
322
+ rest.get('/api/project-types/:projectTypeId/products-feature-flag', getEnabledProductsFeatureFlagResolver),
323
+ rest.get('/api/project-types/:projectTypeId/work-kinds', getWorkKindByProjectTypeResolver),
324
+ rest.get('/api/inhabitant-projects/:inhabitantProjectId/work-kinds', getWorkKindsByProjectIdResolver),
325
+ rest.put('/api/inhabitant-projects/:inhabitantProjectId/work-kinds', saveWorkKindResolver),
326
+ rest.get('/api/work-kinds/:workKindId/products', getProductsByWorkKindResolver),
327
+ rest.get('/api/estimates', getEstimatesByProjectIdResolver),
328
+ rest.post('/api/estimates', successResolver),
329
+ rest.get(
330
+ '/api/inhabitant-projects/:inhabitantProjectId/simulations',
331
+ getConfigurationsWithUpdatedPricesByProjectIdResolver,
332
+ ),
333
+ rest.get('/api/simulations', getConfigurationsByProjectIdResolver),
334
+ rest.get(
335
+ 'https://storage.googleapis.com/pb-dev-adeo-disp-project-tools/:id.json',
336
+ getToolsByProjectTypeResolver,
337
+ ),
338
+ rest.get('/api/project-types/:projectTypeId/products-feature-flag', getEnabledProductsFeatureFlagResolver),
339
+ rest.get('/api/media', getAllMediaPaginationResolver),
340
+ rest.get('/api/media/:mediaId', getMediumByIdResolver),
341
+ rest.get('/api/media/:mediaId/thumbnail', getMediaThumbnailResolver),
342
+ rest.get('/api/media/:mediaId/file', getMediaFileResolver),
343
+ rest.post('/api/media', uploadMediaResolver),
344
+ rest.patch('/api/media/:mediaId', getMediumByIdResolver),
345
+ rest.delete('/api/media/:mediaId', successResolver),
346
+ rest.patch('/api/media/:mediaId', notContentResolver),
347
+ rest.get('/api/inhabitant-projects/:projectId/documents/', getDocumentsByInhabitantProjectIdResolver),
348
+ rest.get('/api/inhabitant-projects/:projectId/documents/:documentId', getDocumentByIdResolver),
349
+ rest.delete('/api/inhabitant-projects/:projectId/documents/:documentId', successResolver),
350
+ rest.get(
351
+ '/api/inhabitant-projects/:projectId/documents/:documentId/thumbnail',
352
+ getDocumentsImageThumbnailResolver,
353
+ ),
354
+ rest.get('/api/inhabitant-projects/:projectId/documents/:documentId/file', getDocumentsImageFileResolver),
355
+ rest.post('/api/inhabitant-projects/:projectId/documents', uploadDocumentResolver),
356
+ rest.get('/api/inhabitant-projects/:projectId/attributes', getProjectAttributesByIdResolver),
357
+ rest.get('/api/inhabitant-api/users/:buId/:inhabitantId', getInhabitantByIdResolver),
358
+ ],
359
+ storyshots: { disable: true },
360
+ }}
361
+ height="100vh"
362
+ >
363
+ {{
364
+ components: { PbProjectHub },
365
+ setup() {
366
+ const pbProjectHub = ref(null);
367
+ setTimeout(() => {
368
+ pbProjectHub.value.scrollToEstimatesSection();
369
+ }, 600);
370
+ return {
371
+ pbProjectHub,
372
+ };
373
+ },
374
+ template: ` <div style="margin: 0 auto;min-height: 100vh;width: 100%;max-width: 1024px;">
375
+ <router-view v-slot="{ Component }">
376
+ <keep-alive include="PbProjectHub">
377
+ <component :is="Component" :key="$route.fullPath" ref="pbProjectHub" />
378
+ </keep-alive>
379
+ </router-view>
380
+ </div>`,
381
+ }}
382
+ </Story>
383
+ </Canvas>
384
+
385
+ ## Showcase autoscroll to categories
386
+
387
+ <Canvas>
388
+ <Story
389
+ name="Showcase autoscroll to categories"
390
+ parameters={{
391
+ controls: { disable: true },
392
+ msw: [
393
+ rest.get('/api/inhabitant-projects/:projectId', getProjectByIdResolver),
394
+ rest.get('/api/inhabitant-projects/:projectId/main-appointment', getAppointmentByIdResolver),
395
+ rest.get('/api/project-types/:projectTypeId/products-feature-flag', getEnabledProductsFeatureFlagResolver),
396
+ rest.get('/api/project-types/:projectTypeId/work-kinds', getWorkKindByProjectTypeResolver),
397
+ rest.get('/api/inhabitant-projects/:inhabitantProjectId/work-kinds', getWorkKindsByProjectIdResolver),
398
+ rest.put('/api/inhabitant-projects/:inhabitantProjectId/work-kinds', saveWorkKindResolver),
399
+ rest.get('/api/work-kinds/:workKindId/products', getProductsByWorkKindResolver),
400
+ rest.get('/api/estimates', getEstimatesByProjectIdResolver),
401
+ rest.post('/api/estimates', successResolver),
402
+ rest.get(
403
+ '/api/inhabitant-projects/:inhabitantProjectId/simulations',
404
+ getConfigurationsWithUpdatedPricesByProjectIdResolver,
405
+ ),
406
+ rest.get('/api/simulations', getConfigurationsByProjectIdResolver),
407
+ rest.get(
408
+ 'https://storage.googleapis.com/pb-dev-adeo-disp-project-tools/:id.json',
409
+ getToolsByProjectTypeResolver,
410
+ ),
411
+ rest.get('/api/project-types/:projectTypeId/products-feature-flag', getEnabledProductsFeatureFlagResolver),
412
+ rest.get('/api/media', getAllMediaPaginationResolver),
413
+ rest.get('/api/media/:mediaId', getMediumByIdResolver),
414
+ rest.get('/api/media/:mediaId/thumbnail', getMediaThumbnailResolver),
415
+ rest.get('/api/media/:mediaId/file', getMediaFileResolver),
416
+ rest.post('/api/media', uploadMediaResolver),
417
+ rest.patch('/api/media/:mediaId', getMediumByIdResolver),
418
+ rest.delete('/api/media/:mediaId', successResolver),
419
+ rest.patch('/api/media/:mediaId', notContentResolver),
420
+ rest.get('/api/inhabitant-projects/:projectId/documents/', getDocumentsByInhabitantProjectIdResolver),
421
+ rest.get('/api/inhabitant-projects/:projectId/documents/:documentId', getDocumentByIdResolver),
422
+ rest.delete('/api/inhabitant-projects/:projectId/documents/:documentId', successResolver),
423
+ rest.get(
424
+ '/api/inhabitant-projects/:projectId/documents/:documentId/thumbnail',
425
+ getDocumentsImageThumbnailResolver,
426
+ ),
427
+ rest.get('/api/inhabitant-projects/:projectId/documents/:documentId/file', getDocumentsImageFileResolver),
428
+ rest.post('/api/inhabitant-projects/:projectId/documents', uploadDocumentResolver),
429
+ rest.get('/api/inhabitant-projects/:projectId/attributes', getProjectAttributesByIdResolver),
430
+ rest.get('/api/inhabitant-api/users/:buId/:inhabitantId', getInhabitantByIdResolver),
431
+ ],
432
+ storyshots: { disable: true },
433
+ }}
434
+ height="100vh"
435
+ >
436
+ {{
437
+ components: { PbProjectHub },
438
+ setup() {
439
+ const pbProjectHub = ref(null);
440
+ setTimeout(() => {
441
+ pbProjectHub.value.scrollToCategoriesSection();
442
+ }, 600);
443
+ return {
444
+ pbProjectHub,
445
+ };
446
+ },
447
+ template: ` <div style="margin: 0 auto;min-height: 100vh;width: 100%;max-width: 1024px;">
448
+ <router-view v-slot="{ Component }">
449
+ <keep-alive include="PbProjectHub">
450
+ <component :is="Component" :key="$route.fullPath" ref="pbProjectHub" />
451
+ </keep-alive>
452
+ </router-view>
453
+ </div>`,
454
+ }}
455
+ </Story>
456
+ </Canvas>
457
+
311
458
  ## Showcase Company
312
459
 
313
460
  <Canvas>
@@ -111,7 +111,13 @@
111
111
  <m-button label="Réessayer" @click="$store.dispatch('tasks/reloadPlanner')" />
112
112
  </m-flex>
113
113
  </m-flex>
114
- <m-flex v-if="isEstimatesDisplayed" class="pb-project-hub__section" direction="column" full-width>
114
+ <m-flex
115
+ v-if="isEstimatesDisplayed"
116
+ class="pb-project-hub__section"
117
+ direction="column"
118
+ full-width
119
+ ref="PbProjectHubEstimatesSection"
120
+ >
115
121
  <div class="pb-project-hub__section-header">
116
122
  <div class="pb-project-hub__section-title" ref="pbEstimateList">{{ titleEstimation }}</div>
117
123
  </div>
@@ -1339,6 +1345,16 @@ export default {
1339
1345
  });
1340
1346
  },
1341
1347
 
1348
+ scrollToEstimatesSection() {
1349
+ const top = this.$refs.PbProjectHubEstimatesSection.$el.offsetTop;
1350
+
1351
+ window.scroll({
1352
+ top,
1353
+ left: 0,
1354
+ behavior: 'smooth',
1355
+ });
1356
+ },
1357
+
1342
1358
  scrollToCategoriesSection() {
1343
1359
  const top = this.$refs.PbProjectHubCategoriesSection.$el.offsetTop;
1344
1360
 
@@ -1,3 +1,6 @@
1
+ import { ref } from 'vue';
2
+ import { useStore } from 'vuex';
3
+ import { useRouter } from 'vue-router';
1
4
  import { Story, Meta, Canvas } from '@storybook/addon-docs';
2
5
  import { nestedAppDecorator } from '../../../../.storybook/nested-app-decorator';
3
6
  import PbProjects from './PbProjects';
@@ -11,6 +14,7 @@ import {
11
14
  getProjectsResolver,
12
15
  getProjectByIdResolver,
13
16
  } from '../../../services/api/mocks/projectsMock';
17
+ import { getEstimatesByProjectIdResolver } from '../../../services/api/mocks/estimatesMock';
14
18
 
15
19
  <Meta
16
20
  title="Project Booster/Components/Projects/PbProjects 🦠"
@@ -40,7 +44,11 @@ import {
40
44
  component: PbProjectHub,
41
45
  props: { showBackButton: true },
42
46
  beforeEnter: async (to, from, next, store) => {
47
+ if (store.getters['tasks/getCurrentProjectId'] !== to.params.projectId) {
48
+ store.dispatch('tasks/loadPlanner', { projectId: to.params.projectId, buId: 'bu-dev-planner' });
49
+ }
43
50
  await store.dispatch('projects/loadProject', to.params.projectId);
51
+ await store.dispatch('estimates/loadEstimates', to.params.projectId);
44
52
  if (store.getters['projects/getProjects']?.length === 0) {
45
53
  store.dispatch('sendEventToBus', {
46
54
  code: 'projectHubProjectLoaded',
@@ -115,3 +123,74 @@ The `PbProjects` component to access your projects.
115
123
  {TemplateSandbox.bind({})}
116
124
  </Story>
117
125
  </Canvas>
126
+
127
+ ## Showcase with autoscroll to estimates
128
+
129
+ <Canvas>
130
+ <Story
131
+ name="Showcase autoscroll to estimates"
132
+ parameters={{
133
+ controls: { disable: true },
134
+ msw: [
135
+ rest.get('/api/inhabitant-projects', getProjectsResolver),
136
+ rest.get('/api/inhabitant-projects/:projectId', getProjectByIdResolver),
137
+ rest.get('/api/estimates', getEstimatesByProjectIdResolver),
138
+ rest.delete('/api/inhabitant-projects/:projectId', successResolver),
139
+ ],
140
+ }}
141
+ height="100vh"
142
+ >
143
+ {{
144
+ components: { PbProjects },
145
+ setup() {
146
+ const router = useRouter();
147
+ const pbProjects = ref(null);
148
+ router.push('/projects/1');
149
+ setTimeout(() => {
150
+ pbProjects.value.$refs.displayedComponent.scrollToEstimatesSection();
151
+ }, 900);
152
+ return {
153
+ pbProjects,
154
+ };
155
+ },
156
+ template: `<div style="margin: 0 auto;min-height: 100vh;width: 100%;">
157
+ <pb-projects ref="pbProjects" />
158
+ </div>`,
159
+ }}
160
+ </Story>
161
+ </Canvas>
162
+
163
+ ## Showcase with project creation loader
164
+
165
+ <Canvas>
166
+ <Story
167
+ name="Showcase project creation loader"
168
+ parameters={{
169
+ msw: [
170
+ rest.get('/api/inhabitant-projects', getProjectsResolver),
171
+ rest.get('/api/inhabitant-projects/:projectId', getProjectByIdResolver),
172
+ rest.get('/api/estimates', getEstimatesByProjectIdResolver),
173
+ rest.delete('/api/inhabitant-projects/:projectId', successResolver),
174
+ ],
175
+ controls: { disable: true },
176
+ }}
177
+ height="100vh"
178
+ >
179
+ {{
180
+ components: { PbProjects },
181
+ setup() {
182
+ const store = useStore();
183
+ const router = useRouter();
184
+ const pbProjects = ref(null);
185
+ router.push('/projects/new');
186
+ store.dispatch('projects/saveProject', { projectToSave: {}, metaData: {} });
187
+ return {
188
+ pbProjects,
189
+ };
190
+ },
191
+ template: `<div style="margin: 0 auto;min-height: 100vh;width: 100%;">
192
+ <pb-projects ref="pbProjects" />
193
+ </div>`,
194
+ }}
195
+ </Story>
196
+ </Canvas>
@@ -1,11 +1,20 @@
1
1
  <template>
2
2
  <router-view v-slot="{ Component }">
3
- <component :is="Component" :key="$route.fullPath" v-bind="$attrs" />
3
+ <component :is="Component" :key="$route.fullPath" v-bind="$attrs" ref="displayedComponent" />
4
4
  </router-view>
5
5
  </template>
6
6
 
7
7
  <script>
8
+ import { ref } from 'vue';
9
+
8
10
  export default {
9
11
  name: 'PbProjects',
12
+
13
+ setup() {
14
+ const displayedComponent = ref(null);
15
+ return {
16
+ displayedComponent,
17
+ };
18
+ },
10
19
  };
11
20
  </script>