project-booster-vue 10.3.2-beta.1 → 10.4.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.
Files changed (39) hide show
  1. package/package.json +1 -1
  2. package/src/components/question/upload-document/UploadDocument.ts +2 -0
  3. package/src/components/rework/cards/MPbCards.stories.mdx +2 -1
  4. package/src/components/rework/cards/MPbCards.vue +233 -231
  5. package/src/components/rework/cards/MPbCardsList.stories.mdx +72 -0
  6. package/src/components/rework/cards/MPbCardsList.vue +125 -0
  7. package/src/components/rework/cards/decorators/MPbCardSelectionIndicator.vue +10 -13
  8. package/src/components/rework/cards/decorators/MPbCardTypeIndicator.vue +17 -26
  9. package/src/components/rework/exit-options/MPbExitOptions.vue +13 -21
  10. package/src/components/rework/question/MPbQuestion.vue +364 -458
  11. package/src/components/rework/question/default-payload.json +3 -17
  12. package/src/components/rework/question/incremental-amount-input/MPbIncrementalAmountInput.vue +95 -116
  13. package/src/components/rework/question/name-input/MPbNameInput.vue +100 -123
  14. package/src/components/rework/question/space-input/MPbSpaceInput.vue +83 -144
  15. package/src/components/rework/question/space-input/default-payload.json +4 -4
  16. package/src/components/rework/question/upload-document/MPbUploadDocument.vue +141 -179
  17. package/src/components/rework/restitution/MPbRestitutionListBlock.vue +18 -32
  18. package/src/components/rework/restitution/MPbRestitutionListLine.vue +15 -28
  19. package/src/components/rework/services/emit.ts +1 -0
  20. package/src/components/rework/services/navigate.ts +18 -0
  21. package/src/components/rework/services/validator.ts +5 -0
  22. package/src/components/scenario/PbScenario-Features-Russian-Playground.stories.mdx +1 -1
  23. package/src/components/trezor/PbTrezor.vue +7 -7
  24. package/src/components/trezor/default-payload.json +2 -1
  25. package/src/services/api/appointmentQualificationsApi.ts +3 -4
  26. package/src/services/api/configApi.ts +3 -4
  27. package/src/services/api/configurationsApi.ts +3 -4
  28. package/src/services/api/consentApi.ts +3 -4
  29. package/src/services/api/documentsApi.ts +3 -4
  30. package/src/services/api/estimatesApi.ts +3 -4
  31. package/src/services/api/eventsApi.ts +3 -4
  32. package/src/services/api/inhabitantsApi.ts +3 -4
  33. package/src/services/api/productApi.ts +4 -4
  34. package/src/services/api/productsApi.ts +4 -4
  35. package/src/services/api/projectsApi.ts +3 -4
  36. package/src/services/api/scenarioApi.ts +4 -5
  37. package/src/services/api/toolsApi.ts +3 -3
  38. package/src/services/api/trezorApi.ts +7 -7
  39. /package/src/components/rework/services/{navigateScenario.ts → format.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "project-booster-vue",
3
- "version": "10.3.2-beta.1",
3
+ "version": "10.4.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -3,6 +3,7 @@ import { ScenarioStepNextStep } from '@/types/pb/Scenario';
3
3
  export interface UploadDocumentMultiSelectAction {
4
4
  label: string;
5
5
  nextStep: ScenarioStepNextStep;
6
+ next?: any;
6
7
  }
7
8
 
8
9
  export interface UploadDocumentMultiSelect {
@@ -56,6 +57,7 @@ export interface UploadDocumentViewModel {
56
57
  backLink?: string;
57
58
  mediaPayload: UploadDocumentMediaPayload;
58
59
  showMore?: boolean;
60
+ analytics?: any;
59
61
  }
60
62
 
61
63
  export interface UploadDocumentPayload {
@@ -2,7 +2,8 @@ import cloneDeep from 'lodash.clonedeep';
2
2
  import isEqual from 'lodash.isequal';
3
3
  import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs';
4
4
  import { computeAllCombinations } from '../../../services/computeAllCombinations';
5
- import MPbCard, { PB_CARD_VALIDATOR } from './MPbCards';
5
+ import MPbCard from './MPbCards';
6
+ import { PB_CARD_VALIDATOR } from '../services/validator';
6
7
 
7
8
  export const serializeValues = (values) => {
8
9
  return values.reduce((accumulator, value, index) => {
@@ -92,253 +92,255 @@
92
92
  </div>
93
93
  <div class="pb-card__image__checkbox" :class="{ active: selected }"></div>
94
94
  </div>
95
- <m-pb-card-selection-indicator :selectable="selectable" :selected="selected" ref="MPbCardSelectionIndicator" />
96
- <m-pb-card-type-indicator v-if="typeIcon" :type-icon="typeIcon" ref="MPbCardTypeIcon" />
95
+ <m-pb-card-selection-indicator :selectable="selectable" :selected="selected" />
96
+ <m-pb-card-type-indicator v-if="typeIcon" :type-icon="typeIcon" />
97
97
  </div>
98
98
  </div>
99
99
  </template>
100
100
 
101
- <script lang="ts">
102
- import { defineComponent } from 'vue';
101
+ <script lang="ts" setup>
103
102
  import MImage from '../../mozaic/image/MImage.vue';
104
103
  import MPbCardSelectionIndicator from './decorators/MPbCardSelectionIndicator.vue';
105
104
  import MPbCardTypeIndicator from './decorators/MPbCardTypeIndicator.vue';
106
105
  import { sanitizeCerberusAttribut } from '@/services/sanitize';
107
106
  import { MFlag, MButton, MLink } from '@mozaic-ds/vue-3';
108
-
109
- export const PB_CARD_VALIDATOR = {
110
- cardMinRatio: ['auto', '16x9', '3x2', '4x3', '1x1', '3x4', '2x3'],
111
- imageRatio: ['16x9', '3x2', '4x3', '1x1', '3x4', '2x3'],
112
- alignText: ['left', 'center', 'right'],
113
- };
114
-
115
- export default defineComponent({
116
- name: 'MPbCard',
117
-
118
- components: {
119
- MLink,
120
- MButton,
121
- MFlag,
122
- MImage,
123
- MPbCardSelectionIndicator,
124
- MPbCardTypeIndicator,
107
+ import { computed } from '@vue/reactivity';
108
+ import { defineProps, defineEmits } from 'vue';
109
+ import { PB_CARD_VALIDATOR } from '../services/validator';
110
+
111
+ const props = defineProps({
112
+ /**
113
+ * The image URL
114
+ */
115
+ image: {
116
+ type: String,
117
+ default: null,
125
118
  },
126
-
127
- props: {
128
- /**
129
- * The image URL
130
- */
131
- image: {
132
- type: String,
133
- default: null,
134
- },
135
- /**
136
- * Flag indicating whether the is covers or is contained in its container.
137
- */
138
- imageIsContained: {
139
- type: Boolean,
140
- default: false,
141
- },
142
- /**
143
- * The title displayed over the image
144
- */
145
- imageTitle: {
146
- type: String,
147
- default: null,
148
- },
149
- /**
150
- * The flag label
151
- */
152
- flagLabel: {
153
- type: String,
154
- default: null,
155
- },
156
- /**
157
- * The flag theme
158
- */
159
- flagTheme: {
160
- type: String,
161
- default: 'solid',
162
- },
163
- /**
164
- * The hero text
165
- */
166
- hero: {
167
- type: String,
168
- default: null,
169
- },
170
- /**
171
- * The card title
172
- */
173
- title: {
174
- type: String,
175
- default: null,
176
- },
177
- /**
178
- * The card text
179
- */
180
- text: {
181
- type: String,
182
- default: null,
183
- },
184
- /**
185
- * The button HREF. Will turn the button into a link.
186
- */
187
- cardLink: {
188
- type: String,
189
- default: null,
190
- },
191
- /**
192
- * The button HREF. Will turn the button into a link.
193
- */
194
- buttonHref: {
195
- type: String,
196
- default: null,
197
- },
198
- /**
199
- * The button label
200
- */
201
- buttonLabel: {
202
- type: String,
203
- default: null,
204
- },
205
- /**
206
- * Defines if the card is disabled
207
- */
208
- disabled: {
209
- type: Boolean,
210
- default: false,
211
- },
212
- /**
213
- * Defines if the multiselect indicator is displayed
214
- */
215
- selectable: {
216
- type: Boolean,
217
- default: false,
218
- },
219
- /**
220
- * Defines if the selected indicator is displayed
221
- */
222
- selected: {
223
- type: Boolean,
224
- default: false,
225
- },
226
- /**
227
- * Defines the text alignment
228
- */
229
- alignText: {
230
- type: String,
231
- default: 'left',
232
- validator: (value: string) => {
233
- return PB_CARD_VALIDATOR.alignText.indexOf(value) !== -1;
234
- },
235
- },
236
- /**
237
- * Defines the alignment along the horizontal axis
238
- */
239
- alignHorizontal: {
240
- type: String,
241
- default: 'flex-start',
242
- },
243
- /**
244
- * Defines the default behavior for how flex items are laid out along the vertical axis
245
- */
246
- alignVertical: {
247
- type: String,
248
- default: 'flex-start',
249
- },
250
- /**
251
- * Minimum card ratio
252
- */
253
- cardMinRatio: {
254
- type: String,
255
- default: null,
256
- validator: (value: string) => {
257
- return PB_CARD_VALIDATOR.cardMinRatio.indexOf(value) !== -1;
258
- },
259
- },
260
- /**
261
- * Defines if the image ratio
262
- */
263
- imageRatio: {
264
- type: String,
265
- default: '3x2',
266
- validator: (value: string) => {
267
- return PB_CARD_VALIDATOR.imageRatio.indexOf(value) !== -1;
268
- },
269
- },
270
- /**
271
- * The card type icon
272
- */
273
- typeIcon: {
274
- type: String,
275
- default: null,
276
- },
277
- /**
278
- * The link label
279
- */
280
- linkLabel: {
281
- type: String,
282
- default: null,
283
- },
284
- /**
285
- * Defines if the card is flatenned (borders instead of shadows, no interaction available)
286
- */
287
- flattened: {
288
- type: [Boolean, String],
289
- default: false,
290
- },
291
- /**
292
- * Definies if the card has a border top
293
- */
294
- borderTop: {
295
- type: String,
296
- default: null,
297
- },
298
- /**
299
- * Get the answer code
300
- */
301
- answerCode: {
302
- type: String,
303
- default: null,
304
- },
119
+ /**
120
+ * Flag indicating whether the is covers or is contained in its container.
121
+ */
122
+ imageIsContained: {
123
+ type: Boolean,
124
+ default: false,
305
125
  },
306
-
307
- computed: {
308
- cardMinHeight() {
309
- let cardMinHeight = 0;
310
- if (this.$refs.pbCardSelectionIndicator) {
311
- cardMinHeight = this.typeIcon
312
- ? this.$refs.pbCardTypeIcon.$el.clientHeight
313
- : this.$refs.pbCardSelectionIndicator.$el.clientHeight;
314
- }
315
- return cardMinHeight;
316
- },
126
+ /**
127
+ * The title displayed over the image
128
+ */
129
+ imageTitle: {
130
+ type: String,
131
+ default: null,
317
132
  },
318
-
319
- methods: {
320
- handleLinkClicked() {
321
- this.$emit('link-click');
322
- },
323
- handleCardClick() {
324
- this.cardLink ? window.open(this.cardLink, '_self') : '';
325
- !this.buttonLabel && !this.linkLabel ? this.$emit('card-click') : '';
133
+ /**
134
+ * The flag label
135
+ */
136
+ flagLabel: {
137
+ type: String,
138
+ default: null,
139
+ },
140
+ /**
141
+ * The flag theme
142
+ */
143
+ flagTheme: {
144
+ type: String,
145
+ default: 'solid',
146
+ },
147
+ /**
148
+ * The hero text
149
+ */
150
+ hero: {
151
+ type: String,
152
+ default: null,
153
+ },
154
+ /**
155
+ * The card title
156
+ */
157
+ title: {
158
+ type: String,
159
+ default: null,
160
+ },
161
+ /**
162
+ * The card text
163
+ */
164
+ text: {
165
+ type: String,
166
+ default: null,
167
+ },
168
+ /**
169
+ * The button HREF. Will turn the button into a link.
170
+ */
171
+ cardLink: {
172
+ type: String,
173
+ default: null,
174
+ },
175
+ /**
176
+ * The button HREF. Will turn the button into a link.
177
+ */
178
+ buttonHref: {
179
+ type: String,
180
+ default: null,
181
+ },
182
+ /**
183
+ * The button label
184
+ */
185
+ buttonLabel: {
186
+ type: String,
187
+ default: null,
188
+ },
189
+ /**
190
+ * Defines if the card is disabled
191
+ */
192
+ disabled: {
193
+ type: Boolean,
194
+ default: false,
195
+ },
196
+ /**
197
+ * Defines if the multiselect indicator is displayed
198
+ */
199
+ selectable: {
200
+ type: Boolean,
201
+ default: false,
202
+ },
203
+ /**
204
+ * Defines if the selected indicator is displayed
205
+ */
206
+ selected: {
207
+ type: Boolean,
208
+ default: false,
209
+ },
210
+ /**
211
+ * Defines the text alignment
212
+ */
213
+ alignText: {
214
+ type: String,
215
+ default: 'left',
216
+ validator: (value: string) => {
217
+ return PB_CARD_VALIDATOR.alignText.indexOf(value) !== -1;
326
218
  },
327
- handleButtonLinkClicked(href: string) {
328
- this.handleButtonClicked();
329
- window.open(href, '_self');
219
+ },
220
+ /**
221
+ * Defines the alignment along the horizontal axis
222
+ */
223
+ alignHorizontal: {
224
+ type: String,
225
+ default: 'flex-start',
226
+ },
227
+ /**
228
+ * Defines the default behavior for how flex items are laid out along the vertical axis
229
+ */
230
+ alignVertical: {
231
+ type: String,
232
+ default: 'flex-start',
233
+ },
234
+ /**
235
+ * Minimum card ratio
236
+ */
237
+ cardMinRatio: {
238
+ type: String,
239
+ default: null,
240
+ validator: (value: string) => {
241
+ return PB_CARD_VALIDATOR.cardMinRatio.indexOf(value) !== -1;
330
242
  },
331
- handleButtonClicked() {
332
- /**
333
- * Emitted when clicking on the card button
334
- * @event button-click
335
- * @type {Event}
336
- */
337
- this.$emit('button-click', { label: this.buttonLabel });
243
+ },
244
+ /**
245
+ * Defines if the image ratio
246
+ */
247
+ imageRatio: {
248
+ type: String,
249
+ default: '3x2',
250
+ validator: (value: string) => {
251
+ return PB_CARD_VALIDATOR.imageRatio.indexOf(value) !== -1;
338
252
  },
339
- sanitizeCerberusAttribut,
253
+ },
254
+ /**
255
+ * The card type icon
256
+ */
257
+ typeIcon: {
258
+ type: String,
259
+ default: null,
260
+ },
261
+ /**
262
+ * The link label
263
+ */
264
+ linkLabel: {
265
+ type: String,
266
+ default: null,
267
+ },
268
+ /**
269
+ * Defines if the card is flatenned (borders instead of shadows, no interaction available)
270
+ */
271
+ flattened: {
272
+ type: [Boolean, String],
273
+ default: false,
274
+ },
275
+ /**
276
+ * Definies if the card has a border top
277
+ */
278
+ borderTop: {
279
+ type: String,
280
+ default: null,
281
+ },
282
+ /**
283
+ * Get the answer code
284
+ */
285
+ answerCode: {
286
+ type: String,
287
+ default: null,
340
288
  },
341
289
  });
290
+
291
+ /**
292
+ * Define many emits to link, button and card clicked
293
+ */
294
+ const $emit = defineEmits(['card-click', 'link-click', 'button-click']);
295
+
296
+ /**
297
+ * Define min height card
298
+ */
299
+ const cardMinHeight = computed(() => {
300
+ let cardMinHeightValue = 0;
301
+ if (MPbCardSelectionIndicator.value) {
302
+ cardMinHeightValue = props.typeIcon
303
+ ? MPbCardTypeIndicator.value.$el.clientHeight
304
+ : MPbCardSelectionIndicator.value.$el.clientHeight;
305
+ }
306
+ return cardMinHeightValue;
307
+ });
308
+
309
+ /**
310
+ * Link clicked
311
+ */
312
+ const handleLinkClicked = () => {
313
+ $emit('link-click');
314
+ };
315
+
316
+ /**
317
+ * Card clicked
318
+ */
319
+ const handleCardClick = () => {
320
+ props.cardLink ? window.open(props.cardLink, '_self') : '';
321
+ !props.buttonLabel && !props.linkLabel ? $emit('card-click') : '';
322
+ };
323
+
324
+ /**
325
+ * Open link to another tabs
326
+ * @param href
327
+ */
328
+ const handleButtonLinkClicked = (href: string) => {
329
+ handleButtonClicked();
330
+ window.open(href, '_self');
331
+ };
332
+
333
+ /**
334
+ * Button clicked
335
+ */
336
+ const handleButtonClicked = () => {
337
+ /**
338
+ * Emitted when clicking on the card button
339
+ * @event button-click
340
+ * @type {Event}
341
+ */
342
+ $emit('button-click', { label: props.buttonLabel });
343
+ };
342
344
  </script>
343
345
 
344
346
  <style lang="scss" scoped>
@@ -388,7 +390,7 @@ $responsive-breakpoint: 's';
388
390
  &__image-container {
389
391
  padding: $mu050 $mu050 0 $mu050;
390
392
  position: relative;
391
- width: 100%;
393
+ width: calc(100% - $mu100);
392
394
 
393
395
  & > div {
394
396
  border-radius: 5px;
@@ -0,0 +1,72 @@
1
+ import { nestedAppDecorator } from '../../../../.storybook/nested-app-decorator';
2
+ import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs';
3
+ import MPbCardsList from './MPbCardsList.vue';
4
+ import CARDS_LIST from './cards-list';
5
+ import CARDS_LIST_3 from './3-cards-list';
6
+ import CARDS_LIST_4 from './4-cards-list';
7
+
8
+ <Meta
9
+ title="Project Booster/Rework/Cards/MPbCardsList 🧬"
10
+ component={MPbCardsList}
11
+ decorators={[nestedAppDecorator({}, [])]}
12
+ />
13
+
14
+ # 🦠 `MPbCardsList` - Component
15
+
16
+ The `MPbCardsList` component is a list of `PbCard` component.
17
+
18
+ # `MPbCardsList` - Component props
19
+
20
+ export const TemplateSandbox = (args, { argTypes }) => {
21
+ return {
22
+ props: Object.keys(argTypes),
23
+ components: { MPbCardsList },
24
+ setup() {
25
+ return {
26
+ args,
27
+ };
28
+ },
29
+ template: `<m-pb-cards-list
30
+ :cards="args.cards"
31
+ style="margin: 0 auto; max-width: 1024px; width: 95vw;"
32
+ />`,
33
+ };
34
+ };
35
+
36
+ <Canvas>
37
+ <Story
38
+ name="101 Sandbox"
39
+ parameters={{ controls: { disable: true } }}
40
+ args={{
41
+ cards: CARDS_LIST.cards,
42
+ }}
43
+ >
44
+ {TemplateSandbox.bind({})}
45
+ </Story>
46
+ </Canvas>
47
+
48
+ <ArgsTable story="101 Sandbox" />
49
+
50
+ <Canvas>
51
+ <Story
52
+ name="Features/3 cards"
53
+ parameters={{ controls: { disable: true } }}
54
+ args={{
55
+ cards: CARDS_LIST_3.cards,
56
+ }}
57
+ >
58
+ {TemplateSandbox.bind({})}
59
+ </Story>
60
+ </Canvas>
61
+
62
+ <Canvas>
63
+ <Story
64
+ name="Features/4 cards"
65
+ parameters={{ controls: { disable: true } }}
66
+ args={{
67
+ cards: CARDS_LIST_4.cards,
68
+ }}
69
+ >
70
+ {TemplateSandbox.bind({})}
71
+ </Story>
72
+ </Canvas>