comand-component-library 3.1.43 → 3.1.46

Sign up to get free protection for your applications and to get access to all the features.
Files changed (236) hide show
  1. package/dist/comand-component-library.css +1 -1
  2. package/dist/comand-component-library.umd.min.js +1 -1
  3. package/package.json +47 -40
  4. package/src/App.vue +379 -136
  5. package/src/ComponentDocumentation.vue +156 -0
  6. package/src/ComponentLibraryHelp.vue +20 -0
  7. package/src/assets/data/accordion.json +21 -24
  8. package/src/assets/data/address-data.json +34 -0
  9. package/src/assets/data/bank-account-data.json +22 -0
  10. package/src/assets/data/box-product.json +14 -4
  11. package/src/assets/data/box-user.json +48 -22
  12. package/src/assets/data/breadcrumbs.json +11 -3
  13. package/src/assets/data/cookie-disclaimer.json +4 -4
  14. package/src/assets/data/fake-select-colors.json +4 -0
  15. package/src/assets/data/fake-select-countries.json +12 -12
  16. package/src/assets/data/fake-select-filter-options.json +14 -0
  17. package/src/assets/data/fake-select-options-with-icons.json +6 -12
  18. package/src/assets/data/fake-select-options.json +3 -3
  19. package/src/assets/data/list-of-links-section-anchors.json +23 -0
  20. package/src/assets/data/list-of-links-top-header-navigation.json +20 -0
  21. package/src/assets/data/list-of-links.json +42 -0
  22. package/src/assets/data/main-navigation.json +48 -0
  23. package/src/assets/data/multistep-form-progress-bar.json +33 -0
  24. package/src/assets/data/select-options.json +4 -0
  25. package/src/assets/data/{share-buttons.json → share-buttons-page-by-json.json} +8 -8
  26. package/src/assets/data/share-buttons-page-by-property.json +30 -0
  27. package/src/assets/data/switch-language.json +20 -0
  28. package/src/assets/data/table-large.json +1 -1
  29. package/src/assets/data/table-small.json +1 -1
  30. package/src/assets/styles/global-styles.scss +43 -14
  31. package/src/assets/styles/transitions.scss +21 -1
  32. package/src/components/CmdAccordion.vue +43 -42
  33. package/src/components/CmdAddressData.vue +124 -56
  34. package/src/components/CmdBackToTopButton.vue +3 -3
  35. package/src/components/CmdBankAccountData.vue +104 -0
  36. package/src/components/CmdBox.vue +253 -56
  37. package/src/components/CmdBoxSiteSearch.vue +138 -39
  38. package/src/components/CmdBoxWrapper.vue +206 -0
  39. package/src/components/CmdBreadcrumbs.vue +29 -13
  40. package/src/components/CmdCompanyLogo.vue +6 -4
  41. package/src/components/CmdCookieDisclaimer.vue +99 -75
  42. package/src/components/CmdCopyrightInformation.vue +1 -1
  43. package/src/components/CmdCustomHeadline.vue +93 -0
  44. package/src/components/CmdFakeSelect.vue +330 -66
  45. package/src/components/CmdFancyBox.vue +47 -33
  46. package/src/components/CmdForm.vue +107 -0
  47. package/src/components/CmdFormElement.vue +528 -83
  48. package/src/components/CmdFormFilters.vue +25 -11
  49. package/src/components/CmdGoogleMaps.vue +9 -3
  50. package/src/components/CmdImageGallery.vue +28 -5
  51. package/src/components/CmdImageZoom.vue +9 -1
  52. package/src/components/CmdListOfLinks.vue +169 -0
  53. package/src/components/CmdLoginForm.vue +146 -66
  54. package/src/components/CmdMainNavigation.vue +140 -42
  55. package/src/components/CmdMultipleSwitch.vue +33 -2
  56. package/src/components/CmdMultistepFormProgressBar.vue +60 -10
  57. package/src/components/CmdOpeningHours.vue +36 -10
  58. package/src/components/CmdPager.vue +7 -5
  59. package/src/components/CmdProgressBar.vue +21 -4
  60. package/src/components/CmdShareButtons.vue +64 -9
  61. package/src/components/CmdSiteHeader.vue +25 -12
  62. package/src/components/CmdSlideButton.vue +5 -2
  63. package/src/components/CmdSlideshow.vue +23 -7
  64. package/src/components/CmdSwitchButton.vue +15 -6
  65. package/src/components/CmdSwitchLanguage.vue +18 -10
  66. package/src/components/CmdSystemMessage.vue +30 -17
  67. package/src/components/CmdTable.vue +15 -7
  68. package/src/components/CmdTabs.vue +43 -3
  69. package/src/components/CmdThumbnailScroller.vue +22 -6
  70. package/src/components/CmdTooltip.vue +184 -11
  71. package/src/components/CmdUploadForm.vue +830 -176
  72. package/src/components/CmdWidthLimitationWrapper.vue +9 -6
  73. package/src/composables/event.js +8 -0
  74. package/src/composables/scrollspy.js +52 -0
  75. package/src/directives/focus.js +19 -0
  76. package/src/directives/telephone.js +1 -1
  77. package/src/documentation/commonProps.js +6 -0
  78. package/src/documentation/components/ComponentCode.vue +50 -0
  79. package/src/documentation/components/ComponentProperties.vue +237 -0
  80. package/src/documentation/components/ExampleSectionWrapper.vue +46 -0
  81. package/src/documentation/components/ViewCodeData.vue +113 -0
  82. package/src/documentation/data/CmdAccordionHelp.js +22 -0
  83. package/src/documentation/data/CmdAddressDataHelp.js +17 -0
  84. package/src/documentation/data/CmdBackToTopButtonHelp.js +3 -0
  85. package/src/documentation/data/CmdBankAccountDataHelp.js +8 -0
  86. package/src/documentation/data/CmdBoxHelp.js +45 -0
  87. package/src/documentation/data/CmdBoxSiteSearchHelp.js +11 -0
  88. package/src/documentation/data/CmdBreadcrumbsHelp.js +6 -0
  89. package/src/documentation/data/CmdCompanyLogoHelp.js +8 -0
  90. package/src/documentation/data/CmdCookieDisclaimerHelp.js +9 -0
  91. package/src/documentation/data/CmdCopyrightInformation.js +2 -0
  92. package/src/documentation/data/CmdCustomHeadlineHelp.js +8 -0
  93. package/src/documentation/data/CmdFakeSelectHelp.js +60 -0
  94. package/src/documentation/data/CmdFancyBoxHelp.js +7 -0
  95. package/src/documentation/data/CmdFooterNavigationHelp.js +5 -0
  96. package/src/documentation/data/CmdFormElementHelp.js +189 -0
  97. package/src/documentation/data/CmdFormFiltersHelp.js +6 -0
  98. package/src/documentation/data/CmdFormHelp.js +10 -0
  99. package/src/documentation/data/CmdGoogleMapsHelp.js +5 -0
  100. package/src/documentation/data/CmdImageGalleryHelp.js +5 -0
  101. package/src/documentation/data/CmdImageZoomHelp.js +6 -0
  102. package/src/documentation/data/CmdListOfLinksHelp.js +24 -0
  103. package/src/documentation/data/CmdLoginFormHelp.js +6 -0
  104. package/src/documentation/data/CmdMainNavigationHelp.js +7 -0
  105. package/src/documentation/data/CmdMultistepFormProgressBarHelp.js +6 -0
  106. package/src/documentation/data/CmdOpeningHoursHelp.js +10 -0
  107. package/src/documentation/data/CmdPagerHelp.js +7 -0
  108. package/src/documentation/data/CmdProgressBarHelp.js +13 -0
  109. package/src/documentation/data/CmdShareButtonsHelp.js +13 -0
  110. package/src/documentation/data/CmdSiteHeaderHelp.js +21 -0
  111. package/src/documentation/data/CmdSlideButtonHelp.js +10 -0
  112. package/src/documentation/data/CmdSlideshowHelp.js +7 -0
  113. package/src/documentation/data/CmdSwitchLanguageHelp.js +6 -0
  114. package/src/documentation/data/CmdSystemMessageHelp.js +32 -0
  115. package/src/documentation/data/CmdTableHelp.js +14 -0
  116. package/src/documentation/data/CmdTabsHelp.js +10 -0
  117. package/src/documentation/data/CmdThumbnailScrollerHelp.js +5 -0
  118. package/src/documentation/data/CmdTooltipHelp.js +13 -0
  119. package/src/documentation/data/CmdUploadFormHelp.js +17 -0
  120. package/src/documentation/data/CmdWidthLimitationWrapperHelp.js +7 -0
  121. package/src/documentation/data/componentsDescription.json +158 -0
  122. package/src/documentation/generated/CmdAccordionPropertyDescriptions.json +57 -0
  123. package/src/documentation/generated/CmdAddressDataPropertyDescriptions.json +32 -0
  124. package/src/documentation/generated/CmdBackToTopButtonPropertyDescriptions.json +12 -0
  125. package/src/documentation/generated/CmdBankAccountDataPropertyDescriptions.json +34 -0
  126. package/src/documentation/generated/CmdBoxPropertyDescriptions.json +91 -0
  127. package/src/documentation/generated/CmdBoxSiteSearchPropertyDescriptions.json +41 -0
  128. package/src/documentation/generated/CmdBoxWrapperPropertyDescriptions.json +47 -0
  129. package/src/documentation/generated/CmdBreadcrumbsPropertyDescriptions.json +17 -0
  130. package/src/documentation/generated/CmdCompanyLogoPropertyDescriptions.json +27 -0
  131. package/src/documentation/generated/CmdCookieDisclaimerPropertyDescriptions.json +22 -0
  132. package/src/documentation/generated/CmdCustomHeadlinePropertyDescriptions.json +22 -0
  133. package/src/documentation/generated/CmdFakeSelectPropertyDescriptions.json +79 -0
  134. package/src/documentation/generated/CmdFancyBoxPropertyDescriptions.json +62 -0
  135. package/src/documentation/generated/CmdFooterNavigationPropertyDescriptions.json +17 -0
  136. package/src/documentation/generated/CmdFormElementPropertyDescriptions.json +178 -0
  137. package/src/documentation/generated/CmdFormFiltersPropertyDescriptions.json +32 -0
  138. package/src/documentation/generated/CmdFormPropertyDescriptions.json +40 -0
  139. package/src/documentation/generated/CmdGoogleMapsPropertyDescriptions.json +7 -0
  140. package/src/documentation/generated/CmdImageGalleryPropertyDescriptions.json +22 -0
  141. package/src/documentation/generated/CmdImageZoomPropertyDescriptions.json +12 -0
  142. package/src/documentation/generated/CmdListOfLinksPropertyDescriptions.json +60 -0
  143. package/src/documentation/generated/CmdLoginFormPropertyDescriptions.json +90 -0
  144. package/src/documentation/generated/CmdMainNavigationPropertyDescriptions.json +62 -0
  145. package/src/documentation/generated/CmdMultipleSwitchPropertyDescriptions.json +52 -0
  146. package/src/documentation/generated/CmdMultistepFormProgressBarPropertyDescriptions.json +17 -0
  147. package/src/documentation/generated/CmdOpeningHoursPropertyDescriptions.json +42 -0
  148. package/src/documentation/generated/CmdPagerPropertyDescriptions.json +37 -0
  149. package/src/documentation/generated/CmdProgressBarPropertyDescriptions.json +32 -0
  150. package/src/documentation/generated/CmdShareButtonsPropertyDescriptions.json +34 -0
  151. package/src/documentation/generated/CmdSiteHeaderPropertyDescriptions.json +27 -0
  152. package/src/documentation/generated/CmdSlideButtonPropertyDescriptions.json +25 -0
  153. package/src/documentation/generated/CmdSlideshowPropertyDescriptions.json +42 -0
  154. package/src/documentation/generated/CmdSwitchButtonPropertyDescriptions.json +79 -0
  155. package/src/documentation/generated/CmdSwitchLanguagePropertyDescriptions.json +7 -0
  156. package/src/documentation/generated/CmdSystemMessagePropertyDescriptions.json +40 -0
  157. package/src/documentation/generated/CmdTablePropertyDescriptions.json +62 -0
  158. package/src/documentation/generated/CmdTabsPropertyDescriptions.json +27 -0
  159. package/src/documentation/generated/CmdThumbnailScrollerPropertyDescriptions.json +32 -0
  160. package/src/documentation/generated/CmdTooltipPropertyDescriptions.json +17 -0
  161. package/src/documentation/generated/CmdUploadFormPropertyDescriptions.json +90 -0
  162. package/src/documentation/generated/CmdWidthLimitationWrapperPropertyDescriptions.json +41 -0
  163. package/src/documentation/generated/frameworkIcons.json +730 -0
  164. package/src/documentation/generated/logosIcons.json +110 -0
  165. package/src/documentation/tabs.js +46 -0
  166. package/src/documentation/views/ContainerPage.vue +237 -0
  167. package/src/documentation/views/HelpHome.vue +13 -0
  168. package/src/documentation/views/IconFont.vue +80 -0
  169. package/src/documentation/views/components/CmdAccordionHelp.vue +78 -0
  170. package/src/documentation/views/components/CmdAddressDataHelp.vue +65 -0
  171. package/src/documentation/views/components/CmdBackToTopButtonHelp.vue +62 -0
  172. package/src/documentation/views/components/CmdBankAccountDataHelp.vue +88 -0
  173. package/src/documentation/views/components/CmdBoxHelp.vue +137 -0
  174. package/src/documentation/views/components/CmdBoxSiteSearchHelp.vue +60 -0
  175. package/src/documentation/views/components/CmdBoxWrapperHelp.vue +111 -0
  176. package/src/documentation/views/components/CmdBreadcrumbsHelp.vue +51 -0
  177. package/src/documentation/views/components/CmdCompanyLogoHelp.vue +48 -0
  178. package/src/documentation/views/components/CmdCookieDisclaimerHelp.vue +105 -0
  179. package/src/documentation/views/components/CmdCustomHeadlineHelp.vue +53 -0
  180. package/src/documentation/views/components/CmdFakeSelectHelp.vue +175 -0
  181. package/src/documentation/views/components/CmdFancyBoxHelp.vue +79 -0
  182. package/src/documentation/views/components/CmdFormElementHelp.vue +412 -0
  183. package/src/documentation/views/components/CmdFormFiltersHelp.vue +69 -0
  184. package/src/documentation/views/components/CmdFormHelp.vue +41 -0
  185. package/src/documentation/views/components/CmdGoogleMapsHelp.vue +55 -0
  186. package/src/documentation/views/components/CmdImageGalleryHelp.vue +46 -0
  187. package/src/documentation/views/components/CmdImageZoomHelp.vue +34 -0
  188. package/src/documentation/views/components/CmdListOfLinksHelp.vue +64 -0
  189. package/src/documentation/views/components/CmdLoginFormHelp.vue +117 -0
  190. package/src/documentation/views/components/CmdMainNavigationHelp.vue +94 -0
  191. package/src/documentation/views/components/CmdMultistepFormProgressBarHelp.vue +49 -0
  192. package/src/documentation/views/components/CmdOpeningHoursHelp.vue +49 -0
  193. package/src/documentation/views/components/CmdPagerHelp.vue +57 -0
  194. package/src/documentation/views/components/CmdProgressBarHelp.vue +47 -0
  195. package/src/documentation/views/components/CmdShareButtonsHelp.vue +65 -0
  196. package/src/documentation/views/components/CmdSiteHeaderHelp.vue +72 -0
  197. package/src/documentation/views/components/CmdSlideButtonHelp.vue +90 -0
  198. package/src/documentation/views/components/CmdSlideshowHelp.vue +60 -0
  199. package/src/documentation/views/components/CmdSwitchLanguageHelp.vue +64 -0
  200. package/src/documentation/views/components/CmdSystemMessageHelp.vue +86 -0
  201. package/src/documentation/views/components/CmdTableHelp.vue +84 -0
  202. package/src/documentation/views/components/CmdTabsHelp.vue +52 -0
  203. package/src/documentation/views/components/CmdThumbnailScrollerHelp.vue +50 -0
  204. package/src/documentation/views/components/CmdTooltipHelp.vue +59 -0
  205. package/src/documentation/views/components/CmdUploadFormHelp.vue +59 -0
  206. package/src/documentation/views/components/CmdWidthLimitationWrapperHelp.vue +46 -0
  207. package/src/index.js +6 -3
  208. package/src/main.js +25 -15
  209. package/src/mixins/CmdAddressData/DefaultMessageProperties.js +17 -0
  210. package/src/mixins/CmdBox/DefaultMessageProperties.js +10 -0
  211. package/src/mixins/CmdFakeSelect/DefaultMessageProperties.js +9 -0
  212. package/src/mixins/CmdFormElement/DefaultMessageProperties.js +9 -0
  213. package/src/mixins/CmdImageGallery/DefaultMessageProperties.js +9 -0
  214. package/src/mixins/CmdSiteSearch/DefaultMessageProperties.js +14 -0
  215. package/src/mixins/CmdUploadForm/DefaultMessageProperties.js +53 -0
  216. package/src/mixins/FieldValidation.js +220 -0
  217. package/src/mixins/GlobalDefaultMessageProperties.js +15 -0
  218. package/src/mixins/I18n.js +56 -0
  219. package/src/mixins/Tooltip.js +26 -0
  220. package/src/router/index.js +67 -0
  221. package/src/utilities.js +3 -6
  222. package/src/utils/GetFileExtension.js +15 -0
  223. package/src/utils/common.js +6 -0
  224. package/src/utils/dom.js +8 -0
  225. package/src/utils/globalSequence.js +13 -0
  226. package/src/utils/string.js +8 -0
  227. package/src/assets/data/address.json +0 -13
  228. package/src/assets/data/footer-navigation.json +0 -38
  229. package/src/assets/data/languages.json +0 -31
  230. package/src/assets/data/multisteps.json +0 -27
  231. package/src/assets/data/navigation.json +0 -47
  232. package/src/assets/data/pager.json +0 -11
  233. package/src/assets/data/top-header-navigation.json +0 -27
  234. package/src/components/CmdFooterNavigation.vue +0 -71
  235. package/src/components/CmdMainHeadline.vue +0 -75
  236. package/src/components/CmdTopHeaderNavigation.vue +0 -88
@@ -1,121 +1,254 @@
1
1
  <template>
2
- <div :class="[status, 'cmd-fake-select label']">
3
- <span>{{ labelText }}</span>
2
+ <div
3
+ :class="[
4
+ validationStatus,
5
+ 'cmd-fake-select label',
6
+ {
7
+ color: type === 'color',
8
+ 'has-state': validationStatus && validationStatus !== 'none'
9
+ }
10
+ ]"
11
+ :aria-labelledby="labelText"
12
+ :aria-required="$attrs.required !== undefined"
13
+ ref="fakeselect"
14
+ >
15
+ <span>
16
+ <!-- begin label -->
17
+ <span>
18
+ {{ labelText }}<sup v-if="$attrs.required !== undefined">*</sup>
19
+ </span>
20
+ <!-- end label -->
21
+ <a v-if="$attrs.required || inputRequirements.length"
22
+ href="#"
23
+ @click.prevent
24
+ :class="getStatusIconClass"
25
+ :title="!useCustomTooltip ? getValidationMessage : ''"
26
+ :aria-errormessage="getValidationMessage"
27
+ aria-live="assertive"
28
+ :id="tooltipId"
29
+ :role="validationStatus === 'error' ? 'alert' : 'dialog'">
30
+ </a>
31
+ </span>
4
32
  <ul :class="{'open': showOptions}" @clickout="closeOptions">
5
33
  <li>
6
- <a href="#" @click.prevent="toggleOptions">
7
- <img v-if="type === 'country'" :src="pathFlag(optionCountry)" :alt="optionCountry" class="flag" :class="optionCountry"/>
8
- <span v-else-if="type === 'color'" class="color"
9
- :style="'background: ' + optionColor"></span>
34
+ <!-- begin default/selected-option -->
35
+ <a href="#" @click.prevent="toggleOptions" @blur="onBlur">
36
+ <img v-if="type === 'country' && optionCountry" :src="pathFlag(optionCountry)" :alt="optionCountry" :class="['flag', optionCountry]"/>
37
+ <span v-else-if="type === 'color'" :style="'background: ' + optionColor"></span>
10
38
  <span v-if="optionIcon" :class="optionIcon"></span>
11
- <span>{{ optionName }}</span>
12
- <span :class="dropdownIconClass"></span>
39
+ <span class="option-name" :style="limitWidthStyle">{{ optionName }}</span>
40
+ <span v-if="dropdownIcon" :class="dropdownIcon.iconClass" :title="dropdownIcon.tooltip"></span>
13
41
  </a>
42
+ <!-- end default/selected-option-->
14
43
 
15
44
  <!-- begin default dropdown (incl. optional icon) -->
16
- <ul v-if="type === 'default' && showOptions">
17
- <li v-for="(option, index) in selectData" :key="index">
18
- <a href="#" @click.prevent="selectOption(option.value)" :class="{'active' : option.value === value}">
19
- <span v-if="option.icon?.iconClass" :class="option.icon.iconClass"></span>
45
+ <ul v-if="type === 'default' && showOptions" :aria-expanded="showOptions">
46
+ <li v-for="(option, index) in selectData" :key="index" role="option">
47
+ <!-- begin type 'href' -->
48
+ <a v-if="optionLinkType === 'href'" href="#" @click.prevent="selectOption(option.value)" :class="{'active' : option.value === modelValue}">
49
+ <span v-if="option.iconClass" :class="option.iconClass"></span>
20
50
  <span>{{ option.text }}</span>
21
51
  </a>
52
+ <!-- end type 'href' -->
53
+
54
+ <!-- begin type 'router' -->
55
+ <router-link v-if="optionLinkType === 'router'" to="#" @click.prevent="selectOption(option.value)" :class="{'active' : option.value === modelValue}">
56
+ <span v-if="option.iconClass" :class="option.iconClass"></span>
57
+ <span>{{ option.text }}</span>
58
+ </router-link>
59
+ <!-- end type 'router' -->
22
60
  </li>
23
61
  </ul>
24
62
  <!-- end default dropdown (incl. optional icon) -->
25
63
 
26
64
  <!-- begin dropdown with checkboxes -->
27
- <ul v-else-if="type !== 'default' && type !== 'content' && showOptions" class="checkbox-options">
65
+ <ul v-else-if="type !== 'default' && type !== 'content' && showOptions" :class="{'checkbox-options': type === 'checkboxOptions'}" :aria-expanded="showOptions">
28
66
  <li v-for="(option, index) in selectData" :key="index">
29
- <label v-if="type === 'checkboxOptions'" :for="'option-' + (index + 1)" :class="{'active' : value.includes(`${option.value}`)}">
67
+ <label v-if="type === 'checkboxOptions'" :for="'option-' + (index + 1)" :class="{'active' : modelValue.includes(`${option.value}`)}">
30
68
  <input type="checkbox" :value="option.value" @change="optionSelect"
31
- :checked="value.includes(`${option.value}`)" :id="'option-' + (index + 1)"/>
69
+ :checked="modelValue.includes(`${option.value}`)" :id="'option-' + (index + 1)"/>
32
70
  <span>{{ option.text }}</span>
33
71
  </label>
34
72
 
35
73
  <a v-else-if="type === 'country'" href="#"
36
- @click.prevent="selectOption(option.value)" :class="{'active' : option.value === value}">
74
+ @click.prevent="selectOption(option.value)" :class="{'active' : option.value === modelValue}">
37
75
  <img class="flag" :src="pathFlag(option.value)"
38
76
  :alt="option.text"/>
39
77
  <span>{{ option.text }}</span>
40
78
  </a>
41
79
 
42
- <a v-else href="#" @click.prevent="selectOption(option.value)" :class="{'active' : option.value === value}">
80
+ <a v-else-if="type === 'color'" href="#" @click.prevent="selectOption(option.value)" :class="{'active' : option.value === modelValue}">
43
81
  <span class="color" :style="'background: ' + option.value"></span>
44
- <span>{{
45
- option.text
46
- }}</span>
82
+ <span>{{ option.text }}</span>
83
+ </a>
84
+ </li>
85
+ <li v-if="showSelectAllOptions && type === 'checkboxOptions'" class="select-all-options">
86
+ <a href="#" @click.prevent="toggleAllOptions">
87
+ <span :class="selectAllOptionsIcon"></span>
88
+ <span>{{ selectAllOptionsText }}</span>
47
89
  </a>
48
90
  </li>
49
91
  </ul>
50
92
  <!-- end dropdown with checkboxes -->
51
93
 
52
94
  <!-- begin dropdown with slot -->
53
- <template v-else-if="type === 'content' && showOptions">
95
+ <template v-else-if="type === 'content' && showOptions" :aria-expanded="showOptions">
54
96
  <slot></slot>
55
97
  </template>
56
98
  <!-- end dropdown with slot -->
57
99
  </li>
58
100
  </ul>
59
101
  </div>
102
+ <!-- begin CmdTooltip -->
103
+ <CmdTooltip v-if="useCustomTooltip" class="box" :class="validationStatus" :relatedId="tooltipId" :toggle-visibility-by-click="true">
104
+ <!-- begin CmdSystemMessage -->
105
+ <CmdSystemMessage
106
+ v-if="getValidationMessage"
107
+ :message="getValidationMessage"
108
+ :validatioStatus="validationStatus"
109
+ :iconClose="{show: false}"
110
+ />
111
+ <!-- end CmdSystemMessage -->
112
+
113
+ <template v-if="showRequirements && (validationStatus === '' || validationStatus === 'error')">
114
+ <!-- begin list of requirements -->
115
+ <h6>{{ getMessage("cmdfakeselect.headline.requirements_for_input") }}<br />"{{labelText}}"</h6>
116
+ <dl class="list-of-requirements">
117
+ <template v-for="(requirement, index) in inputRequirements" :key="index">
118
+ <dt aria-live="assertive" :class="requirement.valid(modelValue, $attrs) ? 'success' : 'error'">{{requirement.message}}:</dt>
119
+ <dd :class="requirement.valid(modelValue, $attrs) ? 'success' : 'error'">
120
+ <span aria-live="assertive" :class="requirement.valid(modelValue, $attrs) ? 'icon-check-circle' : 'icon-error-circle'" :title="requirement.valid(modelValue, $attrs) ? 'success' : 'error'"></span>
121
+ </dd>
122
+ </template>
123
+ </dl>
124
+ <!-- end list of requirements -->
125
+
126
+ <!-- begin helplink -->
127
+ <template v-if="helplink">
128
+ <hr v-if="helplink.show" />
129
+ <a v-if="helplink.show && helplink.url"
130
+ :href="helplink.url"
131
+ :target="helplink.target"
132
+ @click.prevent>
133
+ <span v-if="helplink.icon?.iconClass"
134
+ :class="helplink.icon?.iconClass"
135
+ :title="helplink.icon?.tooltip">
136
+ </span>
137
+ <span v-if="helplink.text">
138
+ {{ helplink.text }}
139
+ </span>
140
+ </a>
141
+ </template>
142
+ <!-- end helplink -->
143
+ </template>
144
+ </CmdTooltip>
145
+ <!-- end CmdTooltip -->
60
146
  </template>
61
147
 
62
148
  <script>
149
+ // import mixins
150
+ import I18n from "../mixins/I18n"
151
+ import DefaultMessageProperties from "../mixins/CmdBox/DefaultMessageProperties"
152
+ import FieldValidation from "../mixins/FieldValidation.js"
153
+ import Tooltip from "../mixins/Tooltip.js"
154
+
155
+ // import components
156
+ import CmdSystemMessage from "./CmdSystemMessage"
157
+ import CmdTooltip from "./CmdTooltip"
158
+
63
159
  export default {
64
160
  name: 'CmdFakeSelect',
161
+ inheritAttrs: false,
162
+ mixins: [
163
+ I18n,
164
+ DefaultMessageProperties,
165
+ FieldValidation,
166
+ Tooltip
167
+ ],
168
+ components: {
169
+ CmdSystemMessage,
170
+ CmdTooltip
171
+ },
65
172
  data() {
66
173
  return {
67
- showOptions: false
174
+ showOptions: false,
175
+ validationStatus: "",
176
+ limitWidthStyle: {}
68
177
  }
69
178
  },
70
179
  props: {
71
180
  /**
72
181
  * set different default selectbox-types for
73
182
  *
74
- * values: "(none), color, country, filterlist"
183
+ * @allowedValues: default, color, country, checkboxOptions
75
184
  */
76
185
  type: {
77
186
  type: String,
78
187
  default: "default"
79
188
  },
80
189
  /**
81
- * set default value
190
+ * set type of option-links
191
+ *
192
+ * @allowedValues: href, router
82
193
  */
83
- value: {
84
- type: [String, Array],
85
- required: false
194
+ optionLinkType: {
195
+ type: String,
196
+ default: "href"
86
197
  },
87
198
  /**
88
- * set default option name
199
+ * set default v-model (must be named modelValue in Vue3)
89
200
  */
90
- defaultOptionName: {
91
- type: String,
92
- required: false
201
+ modelValue: {
202
+ type: [String, Array],
203
+ default: ""
93
204
  },
94
205
  /**
95
206
  * list of options to select (incl. displayed names and values)
207
+ *
208
+ * type-property must be set to "checkboxOptions"
96
209
  */
97
210
  selectData: {
98
211
  type: Array,
99
212
  required: false
100
213
  },
214
+ /**
215
+ * toggles option to (de)select all options in a checkbox-list
216
+ *
217
+ * type-property must be set to "checkboxOptions"
218
+ */
219
+ showSelectAllOptions: {
220
+ type: Boolean,
221
+ default: true
222
+ },
101
223
  /**
102
224
  * status (i.e. for validation)
103
225
  *
104
- * values: "error, success, disabled"
226
+ * @allowedValues: error, success, disabled
227
+ * @affectsStyling: true
105
228
  */
106
229
  status: {
107
230
  type: String,
108
231
  required: false
109
232
  },
110
233
  /**
111
- * icon-class for dropdown icon (i.e. an angle/arrow)
234
+ * icon for dropdown-icon (i.e. an angle/arrow)
235
+ *
236
+ * @requiredForAccessibility: partial
237
+ * @defaultIcon: icon-single-arrow-down
112
238
  */
113
- dropdownIconClass: {
114
- type: String,
115
- default: "icon-single-arrow-down"
239
+ dropdownIcon: {
240
+ type: Object,
241
+ default() {
242
+ return {
243
+ iconClass: "icon-single-arrow-down",
244
+ tooltip: "Toggle dropdown visibility"
245
+ }
246
+ }
116
247
  },
117
248
  /**
118
249
  * label-text for fake-select
250
+ *
251
+ * @requiredForAccessibility: true
119
252
  */
120
253
  labelText: {
121
254
  type: String,
@@ -133,8 +266,8 @@ export default {
133
266
  // get the displayed option name
134
267
  optionName() {
135
268
  // fake a normal checkbox
136
- if (this.type !== "checkboxOptions" && this.type !== "content" && this.value) {
137
- const result = this.selectData.find(option => option.value === this.value)?.text
269
+ if (this.type !== "checkboxOptions" && this.type !== "content" && this.modelValue) {
270
+ const result = this.selectData.find(option => option.value === this.modelValue)?.text
138
271
 
139
272
  // if find() returns some data, return this data
140
273
  if (result) {
@@ -144,67 +277,149 @@ export default {
144
277
 
145
278
  // selectbox with checkbox-options
146
279
  else if (this.type === "checkboxOptions") {
147
- if (this.value.length === 1) {
148
- return this.selectData.find(option => option.value === this.value[0])?.text
149
- } else if (this.value.length > 1) {
150
- return this.value.length + " options selected"
280
+ if (this.modelValue.length === 1) {
281
+ return this.selectData.find(option => option.value === this.modelValue[0])?.text
282
+ } else if (this.modelValue.length > 1) {
283
+ return this.modelValue.length + " options selected"
151
284
  }
152
285
  }
153
286
 
154
- // if nothing is selected return the set default option name
155
- if (this.defaultOptionName) {
156
- return this.defaultOptionName
287
+ else if (this.selectData?.length) {
288
+ return this.selectData[0].text
157
289
  }
158
290
 
159
- // if nothing is selected and no default option name is set, return default text (so selectbox is not empty)
160
- return "Please select\u2026"
291
+ return "Please select"
161
292
  },
162
293
  // get the displayed icon (only available for default selectbox)
163
294
  optionIcon() {
164
295
  if (this.type === "default") {
165
296
  return this.selectData.find(option => {
166
- return option.value === this.value
297
+ return option.value === this.modelValue
167
298
  })?.icon?.iconClass
168
299
  }
169
300
  return null
170
301
  },
171
302
  optionCountry() {
172
303
  if (this.type === "country") {
173
- return this.value
304
+ return this.modelValue
174
305
  }
175
306
  return null
176
307
  },
177
308
  optionColor() {
178
309
  if (this.type === "color") {
179
- return this.value
310
+ return this.modelValue
180
311
  }
181
312
  return null
313
+ },
314
+ selectAllOptionsText() {
315
+ if(Array.isArray(this.modelValue) && this.modelValue.length === this.selectData.length) {
316
+ return "Deselect all options"
317
+ }
318
+ return "Select all options"
319
+ },
320
+ selectAllOptionsIcon() {
321
+ return "icon-check"
182
322
  }
183
323
  },
324
+ mounted() {
325
+ //this.$nextTick(this.limitWidth)
326
+ //setTimeout(this.limitWidth, 250)
327
+ const hnd = setInterval(() => {
328
+ if (this.$refs.fakeselect) {
329
+ clearInterval(hnd)
330
+ this.limitWidth()
331
+ }
332
+ }, 100)
333
+ },
184
334
  methods: {
335
+ toggleAllOptions() {
336
+ this.validationStatus = "success"
337
+ const checkboxValues = []
338
+ if(this.modelValue.length === this.selectData.length) {
339
+ if(this.$attrs.required) {
340
+ this.validationStatus = "error"
341
+ }
342
+ } else {
343
+ for (let i = 0; i < this.selectData.length; i++) {
344
+ checkboxValues.push(this.selectData[i].value)
345
+ }
346
+ }
347
+
348
+ this.$emit("update:modelValue", checkboxValues)
349
+ },
350
+ limitWidth() {
351
+ if(this.$refs.fakeselect) {
352
+ const outerWidth = this.$refs.fakeselect.offsetWidth
353
+ this.limitWidthStyle = {width: outerWidth / 100 * 90 + "px"}
354
+ }
355
+ },
185
356
  toggleOptions() {
186
357
  if (this.status !== 'disabled') {
187
358
  this.showOptions = !this.showOptions
188
359
  }
189
360
  },
361
+ // check is an option is selected for default-selectbox
362
+ selectOption(optionValue) {
363
+ this.validationStatus = "success"
364
+ if(this.$attrs.required !== undefined) {
365
+ if(!optionValue) {
366
+ this.validationStatus = "error"
367
+ }
368
+ }
369
+
370
+ this.showOptions = false
371
+ this.$emit('update:modelValue', optionValue);
372
+ },
373
+ // check if a checkbox is changed for selectbox with checkboxes
190
374
  optionSelect(event) {
191
- let value = [...this.value] // copy array from props
375
+ this.validationStatus = "success"
376
+
377
+ let value = [...this.modelValue] // copy array from props
192
378
  if (event.target.checked) {
193
379
  value.push(event.target.value); // attention: value will be transformed into string!
194
380
  } else {
195
381
  value = value.filter(v => v !== event.target.value);
196
382
  }
197
- this.$emit('update:value', value);
198
- },
199
- selectOption(optionValue) {
200
- this.showOptions = false
201
- this.$emit('update:value', optionValue);
383
+ if(this.$attrs.required !== undefined && !value.length) {
384
+ this.validationStatus = "error"
385
+ }
386
+
387
+ this.$emit('update:modelValue', value);
202
388
  },
203
389
  closeOptions() {
204
390
  this.showOptions = false
205
391
  },
206
392
  pathFlag(isoCode) {
207
393
  return this.pathFlags + "/flag-" + isoCode + ".svg"
394
+ },
395
+ onBlur() {
396
+ this.validationStatus = "success"
397
+
398
+ if (this.$attrs.required !== undefined && (!this.modelValue || this.modelValue.length === 0)) {
399
+ this.validationStatus = "error"
400
+ }
401
+ },
402
+ // overwrite requirement-message form fieldValidation.js
403
+ getRequirementMessage() {
404
+ return "An option is selected"
405
+ }
406
+ },
407
+ watch: {
408
+ status: {
409
+ handler() {
410
+ this.validationStatus = this.status
411
+ },
412
+ immediate: true
413
+ },
414
+ selectData: {
415
+ handler() {
416
+ // check if given value by modelValue exists (else pre-select first option)
417
+ if(this.type === "default" && this.selectData?.length && !this.selectData.some((option) => option.value === this.modelValue)) {
418
+ this.$emit("update:modelValue", this.selectData[0].value)
419
+ }
420
+ },
421
+ immediate: true,
422
+ deep: true
208
423
  }
209
424
  }
210
425
  }
@@ -219,6 +434,18 @@ export default {
219
434
  }
220
435
 
221
436
  .cmd-fake-select {
437
+ align-self: flex-end;
438
+
439
+ & + .cmd-tooltip {
440
+ border-color: var(--status-color);
441
+ }
442
+
443
+ > span:first-child {
444
+ a {
445
+ align-self: flex-end;
446
+ }
447
+ }
448
+
222
449
  > ul {
223
450
  height: var(--input-height);
224
451
  margin: 0;
@@ -236,7 +463,12 @@ export default {
236
463
  height: inherit;
237
464
  border: var(--default-border);
238
465
 
239
- > [class*='icon-']:last-child {
466
+ .option-name {
467
+ text-overflow: ellipsis;
468
+ overflow: hidden;
469
+ }
470
+
471
+ > [class*="icon-"]:last-child {
240
472
  margin-left: auto;
241
473
  font-size: 1rem;
242
474
  }
@@ -245,6 +477,8 @@ export default {
245
477
  }
246
478
 
247
479
  &.open {
480
+ border-bottom: 0;
481
+
248
482
  > li {
249
483
  &:first-child {
250
484
  > a {
@@ -299,23 +533,23 @@ export default {
299
533
  }
300
534
 
301
535
  label {
302
- &.active {
303
- background: var(--light-gray);
304
- }
536
+ display: flex;
537
+ }
538
+
539
+ span {
540
+ white-space: nowrap;
305
541
  }
306
542
 
307
543
  ul {
308
544
  position: absolute;
309
545
  list-style: none;
310
546
  z-index: 10;
311
- width: 100%;
312
- margin-left: 0;
313
- border-top: 0;
547
+ min-width: 100%;
548
+ margin: 0;
314
549
  border-bottom-right-radius: var(--border-radius);
315
550
  border-bottom-left-radius: var(--border-radius);
316
551
  background: var(--pure-white);
317
552
  border: var(--primary-border);
318
- border-top: 0;
319
553
 
320
554
  li {
321
555
  &:last-child {
@@ -325,9 +559,22 @@ export default {
325
559
  }
326
560
  }
327
561
 
562
+ &.custom-fake-select-content {
563
+ padding: var(--default-padding);
564
+
565
+ img {
566
+ display: block;
567
+ }
568
+ }
569
+
328
570
  &.checkbox-options {
329
571
  li {
330
572
  padding: calc(var(--default-padding) / 2);
573
+
574
+ &.select-all-options {
575
+ border-top: var(--primary-border);
576
+ padding: 0;
577
+ }
331
578
  }
332
579
  }
333
580
  }
@@ -344,8 +591,7 @@ export default {
344
591
  }
345
592
 
346
593
  &:hover, &:active, &:focus {
347
- border-color: var(--error-color);
348
- background: var(--error-background);
594
+ background: var(--pure-white);
349
595
 
350
596
  span {
351
597
  color: var(--error-color);
@@ -390,6 +636,24 @@ export default {
390
636
  }
391
637
  }
392
638
  }
639
+
640
+ &.color {
641
+ li {
642
+ a {
643
+ gap: calc(var(--default-gap) / 2);
644
+
645
+ > span:first-child {
646
+ width: 1.5rem;
647
+ aspect-ratio: 1;
648
+ border: var(--default-border);
649
+
650
+ &[style=""] {
651
+ display: none;
652
+ }
653
+ }
654
+ }
655
+ }
656
+ }
393
657
  }
394
658
 
395
659
  /* end cmd-fake-select ------------------------------------------------------------------------------------------ */