comand-component-library 4.2.51 → 4.2.52

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 (57) hide show
  1. package/dist/comand-component-library.js +2444 -2145
  2. package/dist/style.css +1 -1
  3. package/package.json +2 -2
  4. package/src/ComponentLibrary.vue +131 -37
  5. package/src/assets/data/box-product.json +15 -10
  6. package/src/assets/data/box-user.json +8 -8
  7. package/src/assets/data/listOfComponents.json +1 -1
  8. package/src/assets/data/pages/boxes-team-overview.json +8 -8
  9. package/src/componentSettingsDataAndControls.vue +82 -10
  10. package/src/components/CmdAddressData.vue +2 -0
  11. package/src/components/CmdAddressDataItem.vue +2 -1
  12. package/src/components/CmdBackToTopButton.vue +12 -3
  13. package/src/components/CmdBankAccountData.vue +2 -0
  14. package/src/components/CmdBasicForm.vue +6 -2
  15. package/src/components/CmdBox.vue +62 -35
  16. package/src/components/CmdBoxWrapper.vue +6 -0
  17. package/src/components/CmdBreadcrumbs.vue +2 -0
  18. package/src/components/CmdCodeOutput.vue +2 -0
  19. package/src/components/CmdCompanyLogo.vue +2 -0
  20. package/src/components/CmdContainer.vue +100 -87
  21. package/src/components/CmdCookieDisclaimer.vue +12 -1
  22. package/src/components/CmdCopyrightInformation.vue +2 -0
  23. package/src/components/CmdFakeSelect.vue +10 -6
  24. package/src/components/CmdFancyBox.vue +2 -0
  25. package/src/components/CmdFlexibleScrollContainer.vue +2 -0
  26. package/src/components/CmdForm.vue +2 -0
  27. package/src/components/CmdFormElement.vue +11 -1
  28. package/src/components/CmdFormFilters.vue +2 -0
  29. package/src/components/CmdGoogleMaps.vue +2 -0
  30. package/src/components/CmdHeadline.vue +23 -1
  31. package/src/components/CmdIcon.vue +2 -0
  32. package/src/components/CmdImage.vue +3 -0
  33. package/src/components/CmdImageGallery.vue +3 -1
  34. package/src/components/CmdImageZoom.vue +2 -0
  35. package/src/components/CmdInnerLink.vue +2 -0
  36. package/src/components/CmdInputGroup.vue +2 -0
  37. package/src/components/CmdLink.vue +16 -10
  38. package/src/components/CmdList.vue +136 -99
  39. package/src/components/CmdListOfLinksItem.vue +2 -0
  40. package/src/components/CmdListOfRequirements.vue +2 -0
  41. package/src/components/CmdLoginForm.vue +2 -2
  42. package/src/components/CmdMailTool.vue +2 -0
  43. package/src/components/CmdMailToolEntry.vue +2 -1
  44. package/src/components/CmdMailToolFilter.vue +2 -0
  45. package/src/components/CmdMainNavigation.vue +2 -0
  46. package/src/components/CmdMultistepFormProgressBar.vue +16 -10
  47. package/src/components/CmdProgressBar.vue +1 -1
  48. package/src/components/CmdSiteSearch.vue +10 -1
  49. package/src/components/CmdSlideButton.vue +3 -4
  50. package/src/components/CmdSlideshow.vue +10 -1
  51. package/src/components/CmdSmartSearch.vue +42 -11
  52. package/src/components/CmdSystemMessage.vue +8 -5
  53. package/src/components/CmdTable.vue +8 -6
  54. package/src/components/CmdTabs.vue +37 -3
  55. package/src/components/CmdThumbnailScroller.vue +12 -3
  56. package/src/components/CmdUploadForm.vue +12 -1
  57. package/src/components/CmdFlexContainer.vue +0 -109
@@ -1,103 +1,90 @@
1
1
  <template>
2
- <div :class="['cmd-list',
3
- {
4
- box: styleAsBox,
5
- 'section-anchors': sectionAnchors,
6
- 'large-icons': largeIcons,
7
- 'show-list-style-items': showListStyleItems,
8
- },
9
- 'list-type-' + listType
10
- ]">
11
- <!-- begin cmd-headline -->
12
- <CmdHeadline
13
- v-if="cmdHeadline?.headlineText || editModeContext"
14
- v-bind="cmdHeadline"
15
- />
16
- <!-- end cmd-headline -->
17
-
18
- <!-- begin list of links -->
19
- <ul :class="['flex-container', {'no-gap': !useGap}, 'align-' + align, setStretchClass, {horizontal: orientation === 'horizontal'}]">
20
- <template v-if="listType === 'links'">
21
- <!-- begin CmdListOfLinksItem-->
22
- <CmdListOfLinksItem
23
- v-if="!editModeContext"
24
- v-for="(link, index) in items"
25
- :key="index"
26
- :class="{'active': sectionAnchors && activeSection === index}"
27
- :link="link"
28
- @click="emitClick($event, linkType)"
29
- />
30
- <!-- end CmdListOfLinksItem-->
2
+ <transition :name="transition">
3
+ <div :class="['cmd-list',
4
+ {
5
+ box: styleAsBox,
6
+ 'section-anchors': sectionAnchors,
7
+ 'large-icons': largeIcons,
8
+ 'show-list-style-items': showListStyleItems,
9
+ },
10
+ 'list-type-' + listType
11
+ ]">
12
+ <!-- begin cmd-headline -->
13
+ <CmdHeadline v-if="cmdHeadline?.headlineText || editModeContext" v-bind="cmdHeadline" />
14
+ <!-- end cmd-headline -->
31
15
 
32
- <!-- begin edit-mode -->
33
- <li v-else>
34
- <EditComponentWrapper
35
- v-for="(link, index) in links"
36
- :key="'x' + index"
37
- class="edit-items"
38
- :showComponentName="false"
39
- componentTag="ul"
40
- componentName="CmdLinkItem"
41
- :componentProps="link"
42
- :allowedComponentTypes="[]"
43
- :componentPath="['props', 'links', index]"
44
- :itemProvider="itemProvider"
45
- >
16
+ <!-- begin list of links -->
17
+ <component :is="listTag"
18
+ :class="['flex-container', { 'no-gap': !useGap }, 'align-' + align, setStretchClass, { horizontal: orientation === 'horizontal' }]">
19
+ <template v-if="listType === 'links'">
20
+ <slot>
46
21
  <!-- begin CmdListOfLinksItem-->
47
- <CmdListOfLinksItem
48
- :class="{'active': sectionAnchors && activeSection === index}"
49
- :link="link"
50
- />
22
+ <CmdListOfLinksItem v-if="!editModeContext" v-for="(link, index) in items" :key="index"
23
+ :class="{ 'active': sectionAnchors && activeSection === index }" :link="link"
24
+ @click="emitClick($event, linkType)" />
51
25
  <!-- end CmdListOfLinksItem-->
52
- </EditComponentWrapper>
53
26
 
54
- <button v-if="links.length === 0" type="button" class="button confirm small" @click="onAddItem">
55
- <span class="icon-plus"></span>
56
- <span>Add new entry</span>
57
- </button>
58
- </li>
59
- <!-- end edit-mode -->
60
- </template>
27
+ <!-- begin edit-mode -->
28
+ <li v-else>
29
+ <EditComponentWrapper v-for="(link, index) in links" :key="'x' + index" class="edit-items"
30
+ :showComponentName="false" componentTag="ul" componentName="CmdLinkItem"
31
+ :componentProps="link" :allowedComponentTypes="[]"
32
+ :componentPath="['props', 'links', index]" :itemProvider="itemProvider">
33
+ <!-- begin CmdListOfLinksItem-->
34
+ <CmdListOfLinksItem :class="{ 'active': sectionAnchors && activeSection === index }"
35
+ :link="link" />
36
+ <!-- end CmdListOfLinksItem-->
37
+ </EditComponentWrapper>
61
38
 
62
- <!-- begin list of images -->
63
- <template v-if="listType === 'images'">
64
- <li v-for="(image, index) in items" :key="index">
65
- <!-- begin CmdImage with link-->
66
- <a v-if="image.image.url" :href="image.image.url">
67
- <CmdImage v-bind="image"/>
68
- </a>
69
- <!-- end CmdImage with link-->
39
+ <button v-if="links.length === 0" type="button" class="button confirm small"
40
+ @click="onAddItem">
41
+ <span class="icon-plus"></span>
42
+ <span>Add new entry</span>
43
+ </button>
44
+ </li>
45
+ <!-- end edit-mode -->
46
+ </slot>
47
+ </template>
70
48
 
71
- <!-- begin CmdImage without link-->
72
- <CmdImage v-else v-bind="image"/>
73
- <!-- end CmdImage without link-->
74
- </li>
75
- </template>
76
- <!-- end list of images -->
49
+ <!-- begin list of images -->
50
+ <template v-if="listType === 'images'">
51
+ <slot>
52
+ <li v-for="(image, index) in items" :key="index">
53
+ <!-- begin CmdImage with link-->
54
+ <a v-if="image.image.url" :href="image.image.url">
55
+ <CmdImage v-bind="image" />
56
+ </a>
57
+ <!-- end CmdImage with link-->
77
58
 
78
- <!-- begin tags -->
79
- <template v-if="listType === 'tags'">
80
- <li v-for="(tag, index) in listOfTagItems" :key="index">
81
- <small class="tag flex-container">
82
- <span>{{ tag }}</span>
83
- <!-- begin icon 'remove tag' -->
84
- <a v-if="iconRemoveTag.show"
85
- href="#"
86
- @click.prevent="removeTag(index)"
87
- :title="iconRemoveTag.tooltip"
88
- class="flex-none"
89
- >
90
- <span :class="iconRemoveTag.iconClass"></span>
91
- </a>
92
- <!-- end icon 'remove tag' -->
93
- </small>
59
+ <!-- begin CmdImage without link-->
60
+ <CmdImage v-else v-bind="image" />
61
+ <!-- end CmdImage without link-->
62
+ </li>
63
+ </slot>
64
+ </template>
65
+ <!-- end list of images -->
94
66
 
95
- </li>
96
- </template>
97
- <!-- end tags -->
98
- </ul>
99
- <!-- end list of links -->
100
- </div>
67
+ <!-- begin tags -->
68
+ <template v-if="listType === 'tags'">
69
+ <slot>
70
+ <li v-for="(tag, index) in listOfTagItems" :key="index">
71
+ <small :class="['tag flex-container', highlightLevel]">
72
+ <span>{{ tag }}</span>
73
+ <!-- begin icon 'remove tag' -->
74
+ <a v-if="iconRemoveTag.show" href="#" @click.prevent="removeTag(index)"
75
+ :title="iconRemoveTag.tooltip" class="flex-none">
76
+ <span :class="iconRemoveTag.iconClass"></span>
77
+ </a>
78
+ <!-- end icon 'remove tag' -->
79
+ </small>
80
+ </li>
81
+ </slot>
82
+ </template>
83
+ <!-- end tags -->
84
+ </component>
85
+ <!-- end list of links -->
86
+ </div>
87
+ </transition>
101
88
  </template>
102
89
 
103
90
  <script>
@@ -105,7 +92,7 @@
105
92
  import EditMode from "../mixins/EditMode.vue"
106
93
 
107
94
  // import utils (editMode only)
108
- import {buildComponentPath, updateHandlerProvider} from "../utils/editmode.js"
95
+ import { buildComponentPath, updateHandlerProvider } from "../utils/editmode.js"
109
96
 
110
97
  export default {
111
98
  name: "CmdListOfLinks",
@@ -117,6 +104,33 @@ export default {
117
104
  }
118
105
  },
119
106
  props: {
107
+ /**
108
+ * define the transition when the list appears/disappears
109
+ *
110
+ * @allowedValues: "none", "fade", "scroll"
111
+ */
112
+ transition: {
113
+ type: String,
114
+ default: "fade"
115
+ },
116
+ /**
117
+ * define the highlight-level
118
+ *
119
+ * @allowedValues: "none", "primary", "secondary", "tertiary"
120
+ */
121
+ highlightLevel: {
122
+ type: String,
123
+ default() {
124
+ return "none"
125
+ }
126
+ },
127
+ /**
128
+ * define if an order-list should be used (else an unordered one will be used)
129
+ */
130
+ orderedList: {
131
+ type: Boolean,
132
+ default: false
133
+ },
120
134
  /**
121
135
  * set list-type
122
136
  *
@@ -238,18 +252,24 @@ export default {
238
252
  required: false
239
253
  }
240
254
  },
255
+ mounted() {
256
+ this.updateActiveClass()
257
+ },
241
258
  computed: {
242
259
  setStretchClass() {
243
260
  if (this.largeIcons && this.orientation === "horizontal") {
244
261
  return "stretch"
245
262
  }
246
263
  return null
264
+ },
265
+ listTag() {
266
+ return this.orderedList ? "ol" : "ul"
247
267
  }
248
268
  },
249
269
  methods: {
250
270
  removeTag(event, index) {
251
271
  this.listOfTagItems.splice(index, 1);
252
- this.$emit("remove-tag", {originalEvent: event, tagIndex: index})
272
+ this.$emit("remove-tag", { originalEvent: event, tagIndex: index })
253
273
  },
254
274
  onAddItem() {
255
275
  this.editModeContext.content.addContent(
@@ -278,9 +298,18 @@ export default {
278
298
  })
279
299
  },
280
300
  emitClick(event, linkType) {
281
- this.$emit("click", {originalEvent: event, linkType: linkType})
301
+ this.$emit("click", { originalEvent: event, linkType: linkType })
302
+ },
303
+ updateActiveClass() {
304
+ // remove "active" from all links first
305
+ document.querySelectorAll(".router-link-exact-active").forEach(el => {
306
+ el.classList.add("active")
307
+ })
282
308
  }
283
- }
309
+ },
310
+ watch: (() => route.fullPath, () => {
311
+ this.updateActiveClass();
312
+ })
284
313
  }
285
314
  </script>
286
315
 
@@ -294,11 +323,18 @@ export default {
294
323
 
295
324
  li {
296
325
  list-style: none;
297
- margin-left: 0 !important; /* overwrite default-settings from frontend-framework */
326
+ margin-left: 0 !important;
327
+ /* overwrite default-settings from frontend-framework */
298
328
 
299
329
  &:has(.tag) {
300
330
  .tag {
301
331
  gap: var(--default-gap-half);
332
+
333
+ &.primary, &.secondary, &.tertiary {
334
+ [class*="icon-"] {
335
+ color: var(--color-white);
336
+ }
337
+ }
302
338
  }
303
339
 
304
340
  [class*="icon-"] {
@@ -337,7 +373,8 @@ export default {
337
373
  flex: none;
338
374
  display: flex;
339
375
  flex-direction: column;
340
- max-width: 100%; /* avoid li to be stretched by large content */
376
+ max-width: 100%;
377
+ /* avoid li to be stretched by large content */
341
378
  }
342
379
 
343
380
  &.align-right {
@@ -379,11 +416,11 @@ export default {
379
416
 
380
417
  @media only screen and (max-width: $medium-max-width) {
381
418
  .cmd-list {
382
- > ul {
419
+ >ul {
383
420
  ul {
384
421
  gap: calc(var(--default-gap) / 2);
385
422
 
386
- > li:first-child {
423
+ >li:first-child {
387
424
  margin-top: calc(var(--default-gap) / 2);
388
425
  }
389
426
  }
@@ -1,4 +1,5 @@
1
1
  <template>
2
+ <!-- begin CmdLinkOfLinksItem ---------------------------------------------------------------------------------------- -->
2
3
  <!-- begin default-view -->
3
4
  <li v-if="!editing" class="cmd-list-of-links-item">
4
5
  <!-- begin CmdLink -->
@@ -44,6 +45,7 @@
44
45
  </div>
45
46
  </template>
46
47
  <!-- end edit-mode -->
48
+ <!-- end CmdLinkOfLinksItem ---------------------------------------------------------------------------------------- -->
47
49
  </template>
48
50
 
49
51
  <script>
@@ -1,4 +1,5 @@
1
1
  <template>
2
+ <!-- begin CmdListOfRequirements ---------------------------------------------------------------------------------------- -->
2
3
  <div class="cmd-list-of-requirements">
3
4
  <!-- begin CmdHeadline -->
4
5
  <CmdHeadline v-if="showHeadline" :headline-level="cmdHeadline.headlineLevel">
@@ -47,6 +48,7 @@
47
48
  </template>
48
49
  <!-- end helplink -->
49
50
  </div>
51
+ <!-- end CmdListOfRequirements ---------------------------------------------------------------------------------------- -->
50
52
  </template>
51
53
 
52
54
  <script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <!-- begin login-form -->
2
+ <!-- begin CmdLoginForm ---------------------------------------------------------------------------------------- -->
3
3
  <fieldset v-show="!sendLogin" class="cmd-login-form flex-container">
4
4
  <legend :class="{hidden : !legendLoginForm.show, 'align-left': legendLoginForm.align === 'left'}">
5
5
  {{ legendLoginForm.text }}
@@ -215,7 +215,7 @@
215
215
  <!-- end link-type 'button' -->
216
216
  </div>
217
217
  </fieldset>
218
- <!-- end send-login-form -->
218
+ <!-- end CmdLoginForm ---------------------------------------------------------------------------------------- -->
219
219
  </template>
220
220
 
221
221
  <script>
@@ -1,4 +1,5 @@
1
1
  <template>
2
+ <!-- begin CmdMailTool ---------------------------------------------------------------------------------------- -->
2
3
  <CmdTabs class="cmd-mail-tool" v-bind="cmdTabs">
3
4
  <!-- begin tab "inbox" -->
4
5
  <template v-slot:tab-content-0>
@@ -24,6 +25,7 @@
24
25
  </template>
25
26
  <!-- end tab "outbox" -->
26
27
  </CmdTabs>
28
+ <!-- end CmdMailTool ---------------------------------------------------------------------------------------- -->
27
29
  </template>
28
30
 
29
31
  <script>
@@ -1,4 +1,5 @@
1
1
  <template>
2
+ <!-- begin CmdMailToolEntry ---------------------------------------------------------------------------------------- -->
2
3
  <template v-if="mails.length"
3
4
  v-for="(mail, index) in mails"
4
5
  :key="index">
@@ -59,7 +60,7 @@
59
60
  <!-- begin CmdSystemMessage (if no mails exist) -->
60
61
  <CmdSystemMessage v-else v-bind="cmdSystemMessage"/>
61
62
  <!-- end CmdSystemMessage (if no mails exist) -->
62
-
63
+ <!-- end CmdMailToolEntry ---------------------------------------------------------------------------------------- -->
63
64
  </template>
64
65
 
65
66
  <script>
@@ -1,4 +1,5 @@
1
1
  <template>
2
+ <!-- begin CmdMailToolFilter ---------------------------------------------------------------------------------------- -->
2
3
  <div class="cmd-mail-tool-filter">
3
4
  <!-- begin CmdHeadline -->
4
5
  <CmdHeadline v-if="headlineText" :headlineText="headlineText" :headlineLevel="headlineLevel"/>
@@ -60,6 +61,7 @@
60
61
  <!-- end link sort descending -->
61
62
  </div>
62
63
  </div>
64
+ <!-- end CmdMailToolFilter ---------------------------------------------------------------------------------------- -->
63
65
  </template>
64
66
 
65
67
  <script>
@@ -1,4 +1,5 @@
1
1
  <template>
2
+ <!-- begin CmdMainNavigationWrapper ---------------------------------------------------------------------------------------- -->
2
3
  <div
3
4
  :class="[
4
5
  'cmd-main-navigation main-navigation-wrapper',
@@ -151,6 +152,7 @@
151
152
  </a>
152
153
  <!-- end off-canvas-button -->
153
154
  </div>
155
+ <!-- end CmdMainNavigationWrapper ---------------------------------------------------------------------------------------- -->
154
156
  </template>
155
157
 
156
158
  <script>
@@ -6,7 +6,7 @@
6
6
  :linkType="step.linkType"
7
7
  :class="['stretch-on-small-devices', activeLinkClass(step.linkType, index)]"
8
8
  :styleAsButton="styleAsButtons"
9
- :primaryButton="usePrimaryButtons"
9
+ :highlightLevel="highlightLevel"
10
10
  :path="step.path"
11
11
  :title="step.tooltip"
12
12
  :disabled="step.disabled"
@@ -40,6 +40,21 @@ export default {
40
40
  }
41
41
  },
42
42
  props: {
43
+ /**
44
+ * set highlight-level for steps
45
+ *
46
+ * @allowedValues: "none", "primary", "secondary", "tertiary"
47
+ */
48
+ highlightLevel: {
49
+ type: Boolean,
50
+ default: "primary",
51
+ validator(value) {
52
+ return value === "none" ||
53
+ value === "primary" ||
54
+ value === "secondary" ||
55
+ value === "tertiary"
56
+ }
57
+ },
43
58
  /**
44
59
  * toggle if steps should be stretched to full-width of parent container (else steps will be centered)
45
60
  */
@@ -63,15 +78,6 @@ export default {
63
78
  type: Boolean,
64
79
  default: false
65
80
  },
66
- /**
67
- * activate if step-buttons should be primary-buttons (linkType for steps must be "button" or styleAsButton-property must be activated)
68
- *
69
- * @affectsStyling: true
70
- */
71
- usePrimaryButtons: {
72
- type: Boolean,
73
- default: true
74
- },
75
81
  /**
76
82
  * list of multisteps
77
83
  */
@@ -65,7 +65,7 @@ export default {
65
65
  left: 50%;
66
66
  transform: translateX(-50%);
67
67
  z-index: 1;
68
- line-height: 1;
68
+ line-height: 1.2;
69
69
  }
70
70
  }
71
71
  }
@@ -77,7 +77,7 @@
77
77
  <span v-if="showFilters">{{ getMessage("site_search.hide_filter_options") }}</span>
78
78
  <span v-else>{{ getMessage("site_search.show_filter_options") }}</span>
79
79
  </a>
80
- <transition name="fade">
80
+ <transition :name="transitionFilters">
81
81
  <div v-if="showFilters && cmdFakeSelect?.selectData.length" class="flex-container flex-none" role="listbox" aria-expanded="true">
82
82
  <!-- begin CmdFakeSelect -->
83
83
  <CmdFakeSelect
@@ -121,6 +121,15 @@ export default {
121
121
  }
122
122
  },
123
123
  props: {
124
+ /**
125
+ * define the transition when filters disappear
126
+ *
127
+ * @allowedValues: "none", "fade", "scroll"
128
+ */
129
+ transitionFilters: {
130
+ type: String,
131
+ default: "fade"
132
+ },
124
133
  /**
125
134
  * custom modelValue for first input-field
126
135
  */
@@ -75,14 +75,15 @@ export default {
75
75
  }
76
76
  </script>
77
77
 
78
- <style lang="scss">
78
+ <style>
79
79
  /* begin cmd-slide-button ---------------------------------------------------------------------------------------- */
80
80
  .cmd-slide-button {
81
81
  &.button {
82
82
  font-size: 2rem;
83
83
  z-index: 10;
84
- height: 100%;
85
84
  position: absolute;
85
+ top: 50%;
86
+ transform: translateY(-50%);
86
87
  display: flex;
87
88
  justify-content: center;
88
89
  text-decoration: none;
@@ -95,12 +96,10 @@ export default {
95
96
 
96
97
  &.left {
97
98
  left: 0;
98
- top: 0;
99
99
  }
100
100
 
101
101
  &.right {
102
102
  right: 0;
103
- top: 0;
104
103
  }
105
104
 
106
105
  &.up, &.down {
@@ -12,7 +12,7 @@
12
12
  <!-- end CmdSlideButton -->
13
13
 
14
14
  <!-- begin area to slide -->
15
- <transition-group name="fade">
15
+ <transition-group :name="transition">
16
16
  <template v-if="currentItem">
17
17
  <template v-if="!useSlot">
18
18
  <template v-if="!editModeContext">
@@ -103,6 +103,15 @@ export default {
103
103
  }
104
104
  },
105
105
  props: {
106
+ /**
107
+ * define the transition when images change
108
+ *
109
+ * @allowedValues: "none", "fade", "scroll"
110
+ */
111
+ transition: {
112
+ type: String,
113
+ default: "fade"
114
+ },
106
115
  /**
107
116
  * use slot for images
108
117
  */
@@ -76,6 +76,13 @@ export default {
76
76
  openListToTop: {
77
77
  type: Boolean,
78
78
  default: false
79
+ },
80
+ /**
81
+ * allows user to enter a new term, that is not included in the listOfRecommendations-property
82
+ */
83
+ allowUserToEnterNewTerm: {
84
+ type: Boolean,
85
+ default: true
79
86
  }
80
87
  },
81
88
  computed: {
@@ -107,28 +114,36 @@ export default {
107
114
  methods: {
108
115
  showRecommendations() {
109
116
  this.item = {} // reset item
110
- if(typeof this.modelValue === "string") {
111
- this.$emit("update:modelValue", "")
112
- } else {
113
- this.$emit("update:modelValue", {itemId: "", displayValue: ""})
114
- }
115
-
116
117
  this.showListOfRecommendations = true
117
118
  },
118
119
  optionSelected(item) {
119
120
  this.searchTerm = item.displayValue // set search-field to selected option
120
121
  this.showListOfRecommendations = false
121
- if(typeof this.modelValue === "string") {
122
- this.$emit("update:modelValue", item.displayValue)
123
- } else {
124
- this.$emit("update:modelValue", {itemId: item.id, displayValue: item.displayValue})
125
- }
122
+ this.emitValue(item)
126
123
  },
127
124
  linkItem(item) {
128
125
  return {
129
126
  ...item,
130
127
  text: item.displayValue
131
128
  }
129
+ },
130
+ emitValue(item) {
131
+ let entryOfRecommendations = null
132
+
133
+ if(typeof item === "string") {
134
+ entryOfRecommendations = this.listOfRecommendations.find((entry) => {
135
+ return entry.displayValue === item
136
+ })
137
+ }
138
+
139
+ const displayValue = typeof item === "string" ? item : item.displayValue
140
+
141
+ if(typeof this.modelValue === "string") {
142
+ this.$emit("update:modelValue", displayValue)
143
+ } else {
144
+ // modelValue is object, check if it exist as entry in listOfRecommendations and emit id and displayValue, if just a string is ented, emit id: 0 and the displayValue
145
+ this.$emit("update:modelValue", {id: entryOfRecommendations ? entryOfRecommendations.id : (typeof item === "string" ? 0 : item.id), displayValue})
146
+ }
132
147
  }
133
148
  },
134
149
  watch: {
@@ -136,6 +151,22 @@ export default {
136
151
  if(!this.searchTerm.length) {
137
152
  this.showListOfRecommendations = false
138
153
  }
154
+ if(this.allowUserToEnterNewTerm) {
155
+ this.emitValue(this.searchTerm)
156
+ }
157
+ },
158
+ modelValue: {
159
+ handler() {
160
+ if(typeof this.modelValue === "string") {
161
+ this.searchTerm = this.modelValue
162
+ } else {
163
+ const idExists = this.listOfRecommendations.find((entry) => {
164
+ return entry.id === this.modelValue?.id
165
+ })
166
+ this.searchTerm = idExists?.displayValue || this.modelValue?.displayValue || ""
167
+ }
168
+ },
169
+ immediate: true
139
170
  }
140
171
  }
141
172
  }