comand-component-library 3.1.74 → 3.1.75

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) 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 +3 -3
  4. package/src/App.vue +65 -71
  5. package/src/assets/data/input-group-radiobuttons.json +23 -0
  6. package/src/assets/data/input-group-replaced-radiobuttons.json +23 -0
  7. package/src/assets/data/input-group-toggle-switch-radiobuttons.json +23 -0
  8. package/src/assets/styles/global-styles.scss +10 -19
  9. package/src/components/CmdAddressData.vue +7 -7
  10. package/src/components/CmdBankAccountData.vue +7 -7
  11. package/src/components/CmdBox.vue +24 -30
  12. package/src/components/CmdBoxSiteSearch.vue +9 -9
  13. package/src/components/CmdCookieDisclaimer.vue +17 -17
  14. package/src/components/CmdFakeSelect.vue +32 -29
  15. package/src/components/CmdFormElement.vue +34 -35
  16. package/src/components/{CmdCustomHeadline.vue → CmdHeadline.vue} +1 -1
  17. package/src/components/CmdInputGroup.vue +51 -53
  18. package/src/components/CmdListOfLinks.vue +8 -8
  19. package/src/components/CmdListOfRequirements.vue +37 -15
  20. package/src/components/CmdLoginForm.vue +17 -17
  21. package/src/components/CmdOpeningHours.vue +5 -5
  22. package/src/components/CmdSiteFooter.vue +76 -0
  23. package/src/components/CmdSiteHeader.vue +2 -1
  24. package/src/components/CmdSystemMessage.vue +28 -11
  25. package/src/components/CmdTabs.vue +8 -8
  26. package/src/components/CmdToggleDarkMode.vue +42 -2
  27. package/src/components/CmdTooltip.vue +13 -13
  28. package/src/components/CmdTooltipForInputElements.vue +122 -0
  29. package/src/components/CmdUploadForm.vue +32 -32
  30. package/src/components/CmdWidthLimitationWrapper.vue +0 -17
  31. package/src/documentation/generated/CmdAddressDataPropertyDescriptions.json +2 -2
  32. package/src/documentation/generated/CmdBankAccountDataPropertyDescriptions.json +2 -2
  33. package/src/documentation/generated/CmdBoxPropertyDescriptions.json +2 -2
  34. package/src/documentation/generated/CmdBoxSiteSearchPropertyDescriptions.json +2 -2
  35. package/src/documentation/generated/CmdCookieDisclaimerPropertyDescriptions.json +2 -2
  36. package/src/documentation/generated/CmdFormElementPropertyDescriptions.json +6 -1
  37. package/src/documentation/generated/CmdHeadlinePropertyDescriptions.json +22 -0
  38. package/src/documentation/generated/CmdInputGroupPropertyDescriptions.json +0 -5
  39. package/src/documentation/generated/CmdListOfLinksPropertyDescriptions.json +2 -2
  40. package/src/documentation/generated/CmdListOfRequirementsPropertyDescriptions.json +14 -4
  41. package/src/documentation/generated/CmdLoginFormPropertyDescriptions.json +4 -4
  42. package/src/documentation/generated/CmdOpeningHoursPropertyDescriptions.json +2 -2
  43. package/src/documentation/generated/CmdSiteFooterPropertyDescriptions.json +12 -0
  44. package/src/documentation/generated/CmdSystemMessagePropertyDescriptions.json +5 -0
  45. package/src/documentation/generated/CmdTabsPropertyDescriptions.json +2 -2
  46. package/src/documentation/generated/CmdTooltipForInputElementsPropertyDescriptions.json +42 -0
  47. package/src/documentation/generated/CmdTooltipPropertyDescriptions.json +1 -1
  48. package/src/documentation/generated/CmdUploadFormPropertyDescriptions.json +14 -14
  49. package/src/index.js +2 -1
  50. package/src/mixins/FieldValidation.js +15 -5
  51. package/src/mixins/Tooltip.js +1 -1
@@ -3,17 +3,12 @@
3
3
  <div v-if="boxType === 'content'" :class="['cmd-box box content', {open : open, collapsible: collapsible, 'stretch-vertically': stretchVertically}]">
4
4
  <template v-if="useSlots?.includes('header')">
5
5
  <!-- begin collapsible header with slot -->
6
- <div v-if="collapsible" class="box-header">
6
+ <a v-if="collapsible" href="#" class="box-header" @click.prevent="toggleContentVisibility" :title="open ? iconOpen.tooltip : iconClosed.tooltip">
7
7
  <!-- begin slot 'header' -->
8
8
  <slot name="header"></slot>
9
9
  <!-- end slot 'header' -->
10
- <a href="#"
11
- class="toggle-icon"
12
- :title="open ? iconOpen.tooltip : iconClosed.tooltip"
13
- @click.prevent="toggleContentVisibility">
14
- <span :class="[open ? iconOpen.iconClass : iconClosed.iconClass]"></span>
15
- </a>
16
- </div>
10
+ <span class="toggle-icon" :class="[open ? iconOpen.iconClass : iconClosed.iconClass]"></span>
11
+ </a>
17
12
  <!-- end collapsible header with slot -->
18
13
 
19
14
  <!-- begin default header with slot -->
@@ -27,20 +22,19 @@
27
22
  <template v-else>
28
23
  <!-- begin header for collapsible -->
29
24
  <a v-if="collapsible" class="box-header" href="#" :title="open ? iconOpen.tooltip : iconClosed.tooltip" @click.prevent="toggleContentVisibility">
30
- <!-- begin CmdCustomHeadline -->
31
- <CmdCustomHeadline v-if="cmdCustomHeadline?.headlineText"
32
- v-bind="cmdCustomHeadline"/>
33
- <!-- end CmdCustomHeadline -->
25
+ <!-- begin CmdHeadline -->
26
+ <CmdHeadline v-if="CmdHeadline?.headlineText" v-bind="CmdHeadline"/>
27
+ <!-- end CmdHeadline -->
34
28
  <span class="toggle-icon" :class="[open ? iconOpen.iconClass : iconClosed.iconClass]"></span>
35
29
  </a>
36
30
  <!-- end header for collapsible -->
37
31
 
38
- <!-- begin CmdCustomHeadline -->
39
- <CmdCustomHeadline v-else-if="!collapsible && cmdCustomHeadline?.headlineText"
32
+ <!-- begin CmdHeadline -->
33
+ <CmdHeadline v-else-if="!collapsible && CmdHeadline?.headlineText"
40
34
  class="box-header"
41
- v-bind="cmdCustomHeadline"
35
+ v-bind="CmdHeadline"
42
36
  />
43
- <!-- end CmdCustomHeadline -->
37
+ <!-- end CmdHeadline -->
44
38
  </template>
45
39
 
46
40
  <!-- begin box-body -->
@@ -73,11 +67,11 @@
73
67
  <div v-if="product.discount" class="ribbon-discount">
74
68
  <span>{{ product.discount }}</span>
75
69
  </div>
76
- <!-- begin CmdCustomHeadline -->
77
- <CmdCustomHeadline v-if="cmdCustomHeadline?.headlineText || product.name"
78
- v-bind="cmdCustomHeadline || {}"
79
- :headlineText="cmdCustomHeadline?.headlineText ? cmdCustomHeadline?.headlineText : product.name"/>
80
- <!-- end CmdCustomHeadline -->
70
+ <!-- begin CmdHeadline -->
71
+ <CmdHeadline v-if="CmdHeadline?.headlineText || product.name"
72
+ v-bind="CmdHeadline || {}"
73
+ :headlineText="CmdHeadline?.headlineText ? CmdHeadline?.headlineText : product.name"/>
74
+ <!-- end CmdHeadline -->
81
75
  </div>
82
76
  <div class="box-body">
83
77
  <p v-if="product.articleNumber">{{ getMessage("cmdbox.productbox.article_no") }} {{ product.articleNumber }}</p>
@@ -94,11 +88,11 @@
94
88
  <div class="box-header">
95
89
  <img v-if="user.image" :src="user.image.src" :alt="user.image.alt"/>
96
90
  <div v-else :class="defaultProfileIconClass" :title="user.name"></div>
97
- <!-- begin CmdCustomHeadline -->
98
- <CmdCustomHeadline v-if="cmdCustomHeadline?.headlineText || user.name"
99
- v-bind="cmdCustomHeadline || {}"
100
- :headlineText="cmdCustomHeadline?.headlineText ? cmdCustomHeadline?.headlineText : user.name"/>
101
- <!-- end CmdCustomHeadline -->
91
+ <!-- begin CmdHeadline -->
92
+ <CmdHeadline v-if="CmdHeadline?.headlineText || user.name"
93
+ v-bind="CmdHeadline || {}"
94
+ :headlineText="CmdHeadline?.headlineText ? CmdHeadline?.headlineText : user.name"/>
95
+ <!-- end CmdHeadline -->
102
96
  </div>
103
97
  <div class="box-body">
104
98
  <p v-if="user.profession">{{ user.profession }}</p>
@@ -119,13 +113,13 @@ import DefaultMessageProperties from "../mixins/CmdBox/DefaultMessageProperties"
119
113
  import GlobalCurrency from "../mixins/GlobalCurrency"
120
114
 
121
115
  // import components
122
- import CmdCustomHeadline from "./CmdCustomHeadline"
116
+ import CmdHeadline from "./CmdHeadline"
123
117
  import CmdListOfLinks from "./CmdListOfLinks"
124
118
 
125
119
  export default {
126
120
  name: "CmdBox",
127
121
  components: {
128
- CmdCustomHeadline,
122
+ CmdHeadline,
129
123
  CmdListOfLinks,
130
124
  },
131
125
  mixins: [
@@ -250,9 +244,9 @@ export default {
250
244
  default: true
251
245
  },
252
246
  /**
253
- * properties for CmdCustomHeadline-component
247
+ * properties for CmdHeadline-component
254
248
  */
255
- cmdCustomHeadline: {
249
+ CmdHeadline: {
256
250
  type: Object,
257
251
  required: false
258
252
  }
@@ -4,12 +4,12 @@
4
4
  <legend v-if="showLegend">{{ textLegend }}</legend>
5
5
  <!-- begin legend -->
6
6
 
7
- <!-- begin CmdCustomHeadline -->
8
- <CmdCustomHeadline
9
- v-if="cmdCustomHeadline"
10
- v-bind="cmdCustomHeadline"
7
+ <!-- begin CmdHeadline -->
8
+ <CmdHeadline
9
+ v-if="CmdHeadline"
10
+ v-bind="CmdHeadline"
11
11
  />
12
- <!-- end CmdCustomHeadline -->
12
+ <!-- end CmdHeadline -->
13
13
 
14
14
  <!-- begin form-elements -->
15
15
  <div class="flex-container">
@@ -95,7 +95,7 @@ import I18n from "../mixins/I18n"
95
95
  import DefaultMessageProperties from "../mixins/CmdSiteSearch/DefaultMessageProperties"
96
96
 
97
97
  // import files for components
98
- import CmdCustomHeadline from "./CmdCustomHeadline"
98
+ import CmdHeadline from "./CmdHeadline"
99
99
  import CmdFakeSelect from "./CmdFakeSelect"
100
100
  import CmdFormElement from "./CmdFormElement"
101
101
  import CmdFormFilters from "./CmdFormFilters"
@@ -111,7 +111,7 @@ export default {
111
111
  name: "CmdBoxSiteSearch",
112
112
  mixins: [I18n, DefaultMessageProperties],
113
113
  components: {
114
- CmdCustomHeadline,
114
+ CmdHeadline,
115
115
  CmdFakeSelect,
116
116
  CmdFormElement,
117
117
  CmdFormFilters
@@ -183,9 +183,9 @@ export default {
183
183
  required: false
184
184
  },
185
185
  /**
186
- * properties for CmdCustomHeadline-component
186
+ * properties for CmdHeadline-component
187
187
  */
188
- cmdCustomHeadline: {
188
+ CmdHeadline: {
189
189
  type: Object,
190
190
  required: false
191
191
  },
@@ -1,22 +1,22 @@
1
1
  <template>
2
2
  <transition name="fade">
3
3
  <div class="cmd-cookie-disclaimer flex-container vertical">
4
- <!-- begin CmdCustomHeadline -->
5
- <CmdCustomHeadline
6
- v-if="cmdCustomHeadlineCookieDisclaimer?.show && cmdCustomHeadlineCookieDisclaimer?.headlineText && cmdCustomHeadlineCookieDisclaimer?.headlineLevel"
7
- v-bind="cmdCustomHeadlineCookieDisclaimer"
8
- :headlineText="cmdCustomHeadlineCookieDisclaimer.headlineText"
9
- :headlineLevel="cmdCustomHeadlineCookieDisclaimer.headlineLevel"
4
+ <!-- begin CmdHeadline -->
5
+ <CmdHeadline
6
+ v-if="CmdHeadlineCookieDisclaimer?.show && CmdHeadlineCookieDisclaimer?.headlineText && CmdHeadlineCookieDisclaimer?.headlineLevel"
7
+ v-bind="CmdHeadlineCookieDisclaimer"
8
+ :headlineText="CmdHeadlineCookieDisclaimer.headlineText"
9
+ :headlineLevel="CmdHeadlineCookieDisclaimer.headlineLevel"
10
10
  />
11
- <!-- end CmdCustomHeadline -->
11
+ <!-- end CmdHeadline -->
12
12
 
13
13
  <!-- begin slot for cookie-options -->
14
14
  <slot name="cookie-options">
15
15
  <!-- begin required cookies -->
16
- <div v-if="cookieOptions.required" class="flex-container vertical">
17
- <CmdCustomHeadline v-if="cmdBoxRequiredCookies?.showHeadline" :headline-text="cmdBoxRequiredCookies?.headlineText" :headline-level="cmdBoxRequiredCookies?.headlineLevel "/>
16
+ <div v-if="cookieOptions?.required" class="flex-container vertical">
17
+ <CmdHeadline v-if="cmdBoxRequiredCookies?.showHeadline" :headline-text="cmdBoxRequiredCookies?.headlineText" :headline-level="cmdBoxRequiredCookies?.headlineLevel "/>
18
18
  <!-- begin CmdBox -->
19
- <CmdBox v-for="(cookie, index) in cookieOptions.required.cookies"
19
+ <CmdBox v-for="(cookie, index) in cookieOptions.required.cookies || []"
20
20
  :useSlots="['header', 'body']"
21
21
  v-bind="cmdBoxRequiredCookies"
22
22
  :key="index"
@@ -56,10 +56,10 @@
56
56
  <hr/>
57
57
 
58
58
  <!-- begin optional cookies -->
59
- <div v-if="cookieOptions.optional" class="flex-container vertical">
60
- <CmdCustomHeadline v-if="cmdBoxOptionalCookies?.showHeadline" :headline-text="cmdBoxOptionalCookies?.headlineText" :headline-level="cmdBoxOptionalCookies?.headlineLevel "/>
59
+ <div v-if="cookieOptions?.optional" class="flex-container vertical">
60
+ <CmdHeadline v-if="cmdBoxOptionalCookies?.showHeadline" :headline-text="cmdBoxOptionalCookies?.headlineText" :headline-level="cmdBoxOptionalCookies?.headlineLevel "/>
61
61
  <!-- begin CmdBox -->
62
- <CmdBox v-for="(cookie, index) in cookieOptions.optional.cookies"
62
+ <CmdBox v-for="(cookie, index) in cookieOptions.optional.cookies || []"
63
63
  :useSlots="['header', 'body']"
64
64
  v-bind="cmdBoxOptionalCookies"
65
65
  :key="index"
@@ -123,7 +123,7 @@ import DefaultMessageProperties from "../mixins/CmdCookieDisclaimer/DefaultMessa
123
123
 
124
124
  // import components
125
125
  import CmdBox from "./CmdBox"
126
- import CmdCustomHeadline from "./CmdCustomHeadline"
126
+ import CmdHeadline from "./CmdHeadline"
127
127
  import CmdFormElement from "./CmdFormElement"
128
128
 
129
129
  export default {
@@ -131,7 +131,7 @@ export default {
131
131
  mixins: [I18n, DefaultMessageProperties],
132
132
  components: {
133
133
  CmdBox,
134
- CmdCustomHeadline,
134
+ CmdHeadline,
135
135
  CmdFormElement
136
136
  },
137
137
  data() {
@@ -149,9 +149,9 @@ export default {
149
149
  required: false
150
150
  },
151
151
  /**
152
- * properties for CmdCustomHeadline-component at top of cookie disclaimer
152
+ * properties for CmdHeadline-component at top of cookie disclaimer
153
153
  */
154
- cmdCustomHeadlineCookieDisclaimer: {
154
+ CmdHeadlineCookieDisclaimer: {
155
155
  type: Object,
156
156
  default() {
157
157
  return {
@@ -9,6 +9,7 @@
9
9
  disabled: $attrs.disabled
10
10
  }
11
11
  ]"
12
+ :title="$attrs.title"
12
13
  :aria-labelledby="labelId"
13
14
  :aria-required="$attrs.required !== undefined"
14
15
  ref="fakeselect"
@@ -18,28 +19,21 @@
18
19
  <span class="label-text" :id="labelId">
19
20
  <span>{{ labelText }}<sup v-if="$attrs.required !== undefined">*</sup></span>
20
21
 
21
- <!-- begin CmdTooltip -->
22
- <CmdTooltip v-if="useCustomTooltip" class="box" :class="validationStatus" :relatedId="tooltipId" :toggle-visibility-by-click="true">
23
- <!-- begin CmdSystemMessage -->
24
- <CmdSystemMessage
25
- v-if="getValidationMessage"
26
- :message="getValidationMessage"
27
- :validation-status="validationStatus"
28
- :iconClose="{show: false}"
29
- />
30
- <!-- end CmdSystemMessage -->
31
-
32
- <!-- begin CmdListOfRequirements -->
33
- <CmdListOfRequirements
34
- v-if="showRequirements && (validationStatus === '' || validationStatus === 'error')"
35
- :inputRequirements="inputRequirements"
36
- :inputModelValue="modelValue"
37
- :inputAttributes="$attrs"
38
- :helplink="helplink"
39
- />
40
- <!-- end CmdListOfRequirements -->
41
- </CmdTooltip>
42
- <!-- end CmdTooltip -->
22
+ <!-- begin CmdTooltipForInputElements -->
23
+ <CmdTooltipForInputElements
24
+ v-if="useCustomTooltip && (validationStatus === '' || validationStatus === 'error')"
25
+ ref="tooltip"
26
+ :showRequirements="showRequirements"
27
+ :inputRequirements="inputRequirements"
28
+ :validationStatus="validationStatus"
29
+ :validationMessage="getValidationMessage"
30
+ :validationTooltip="validationTooltip"
31
+ :inputAttributes="$attrs"
32
+ :inputModelValue="modelValue"
33
+ :helplink="helplink"
34
+ :relatedId="tooltipId"
35
+ />
36
+ <!-- end CmdTooltipForInputElements -->
43
37
 
44
38
  <a v-if="$attrs.required || inputRequirements.length"
45
39
  href="#"
@@ -139,9 +133,7 @@ import FieldValidation from "../mixins/FieldValidation.js"
139
133
  import Tooltip from "../mixins/Tooltip.js"
140
134
 
141
135
  // import components
142
- import CmdListOfRequirements from "./CmdListOfRequirements"
143
- import CmdSystemMessage from "./CmdSystemMessage"
144
- import CmdTooltip from "./CmdTooltip"
136
+ import CmdTooltipForInputElements from "./CmdTooltipForInputElements"
145
137
 
146
138
  export default {
147
139
  name: 'CmdFakeSelect',
@@ -153,9 +145,7 @@ export default {
153
145
  Tooltip
154
146
  ],
155
147
  components: {
156
- CmdListOfRequirements,
157
- CmdSystemMessage,
158
- CmdTooltip
148
+ CmdTooltipForInputElements
159
149
  },
160
150
  data() {
161
151
  return {
@@ -258,6 +248,19 @@ export default {
258
248
  }
259
249
  },
260
250
  computed: {
251
+ validationTooltip() {
252
+ if (!this.useCustomTooltip) {
253
+ return this.getValidationMessage
254
+ }
255
+
256
+ // set default-tooltip if customTooltip is not set
257
+ if (this.validationStatus === 'error') {
258
+ return this.getMessage("cmdformelement.validationTooltip.an_error_occurred")
259
+ } else if (this.validationStatus === 'success') {
260
+ return this.getMessage("cmdformelement.validationTooltip.information_is_filled_correctly")
261
+ }
262
+ return this.getMessage("cmdformelement.validationTooltip.open_field_requirements")
263
+ },
261
264
  // get the displayed option name
262
265
  optionName() {
263
266
  // fake a native selectbox
@@ -558,7 +561,7 @@ export default {
558
561
  margin: 0;
559
562
  border-bottom-right-radius: var(--border-radius);
560
563
  border-bottom-left-radius: var(--border-radius);
561
- background: var(--pure-white);
564
+ background: var(--color-scheme-background-color);
562
565
  border: var(--primary-border);
563
566
 
564
567
  li {
@@ -13,7 +13,8 @@
13
13
  on: colored && isChecked,
14
14
  off: colored && !isChecked,
15
15
  'has-state': validationStatus
16
- }]"
16
+ }
17
+ ]"
17
18
  :for="labelId"
18
19
  :title="$attrs.title"
19
20
  ref="label">
@@ -23,29 +24,21 @@
23
24
  :class="['label-text', !showLabel ? 'hidden' : undefined]">
24
25
  <span>{{ labelText }}<sup v-if="$attrs.required">*</sup></span>
25
26
 
26
- <!-- begin CmdTooltip -->
27
- <CmdTooltip v-if="useCustomTooltip" class="box" :class="validationStatus" :relatedId="tooltipId" :toggle-visibility-by-click="true">
28
- <!-- begin CmdSystemMessage -->
29
- <CmdSystemMessage
30
- v-if="getValidationMessage"
31
- :message="getValidationMessage"
32
- :validation-status="validationStatus"
33
- :iconClose="{show: false}"
34
- />
35
- <!-- end CmdSystemMessage -->
36
-
37
- <!-- begin CmdListOfRequirements -->
38
- <CmdListOfRequirements
39
- v-if="showRequirements && (validationStatus === '' || validationStatus === 'error')"
40
- :inputRequirements="inputRequirements"
41
- :helplink="helplink"
42
- :inputModelValue="modelValue"
43
- :inputAttributes="$attrs"
44
- :validationTooltip="validationTooltip"
45
- />
46
- <!-- end CmdListOfRequirements -->
47
- </CmdTooltip>
48
- <!-- end CmdTooltip -->
27
+ <!-- begin CmdTooltipForInputElements -->
28
+ <CmdTooltipForInputElements
29
+ v-if="useCustomTooltip && (validationStatus === '' || validationStatus === 'error')"
30
+ ref="tooltip"
31
+ :showRequirements="showRequirements"
32
+ :inputRequirements="inputRequirements"
33
+ :validationStatus="validationStatus"
34
+ :validationMessage="getValidationMessage"
35
+ :validationTooltip="validationTooltip"
36
+ :inputAttributes="$attrs"
37
+ :inputModelValue="modelValue"
38
+ :helplink="helplink"
39
+ :relatedId="tooltipId"
40
+ />
41
+ <!-- end CmdTooltipForInputElements -->
49
42
 
50
43
  <a v-if="$attrs.required || inputRequirements.length"
51
44
  href="#"
@@ -212,17 +205,13 @@ import FieldValidation from "../mixins/FieldValidation.js"
212
205
  import Tooltip from "../mixins/Tooltip.js"
213
206
 
214
207
  // import components
215
- import CmdListOfRequirements from "./CmdListOfRequirements"
216
- import CmdSystemMessage from "./CmdSystemMessage"
217
- import CmdTooltip from "./CmdTooltip"
208
+ import CmdTooltipForInputElements from "./CmdTooltipForInputElements"
218
209
 
219
210
  export default {
220
211
  inheritAttrs: false,
221
212
  name: "FormElement",
222
213
  components: {
223
- CmdListOfRequirements,
224
- CmdSystemMessage,
225
- CmdTooltip
214
+ CmdTooltipForInputElements
226
215
  },
227
216
  mixins: [
228
217
  I18n,
@@ -269,6 +258,8 @@ export default {
269
258
  },
270
259
  /**
271
260
  * text for label
261
+ *
262
+ * @requiredForAccessibility: true
272
263
  */
273
264
  labelText: {
274
265
  type: String,
@@ -703,12 +694,11 @@ export default {
703
694
  }
704
695
  return null
705
696
  },
706
- onBlur(event) {
697
+ validateInput(event) {
707
698
  // check if surrounding form with data-use-validation exists
708
699
  const useValidation = event.target.closest("form")?.dataset.useValidation === "true"
709
700
 
710
701
  if (useValidation) {
711
- this.tooltip = false
712
702
  this.validationStatus = ""
713
703
 
714
704
  // if input is filled, set status to success (expect for checkboxes and radiobuttons)
@@ -733,6 +723,14 @@ export default {
733
723
  }
734
724
  }
735
725
  },
726
+ onBlur(event) {
727
+ this.validateInput(event)
728
+ this.closeTooltipOnBlur()
729
+ },
730
+ onInput(event) {
731
+ this.validateInput(event)
732
+ this.$emit('update:modelValue', event.target.value)
733
+ },
736
734
  onChange(event) {
737
735
  if (typeof this.modelValue === "boolean") {
738
736
  this.$emit("update:modelValue", event.target.checked)
@@ -754,9 +752,6 @@ export default {
754
752
  this.$refs.label.focus()
755
753
  }
756
754
  },
757
- onInput(event) {
758
- this.$emit('update:modelValue', event.target.value)
759
- },
760
755
  showPassword() {
761
756
  // get password-field
762
757
  const passwordField = this.$refs.input
@@ -777,6 +772,10 @@ export default {
777
772
  },
778
773
  executeSearch() {
779
774
  this.$emit("search", this.value)
775
+ },
776
+ closeTooltipOnBlur() {
777
+ // close tooltip by calling function from CmdTooltipForInputElements using $refs
778
+ this.$refs.tooltip.hideTooltip()
780
779
  }
781
780
  },
782
781
  watch: {
@@ -15,7 +15,7 @@
15
15
 
16
16
  <script>
17
17
  export default {
18
- name: "CmdCustomHeadline",
18
+ name: "CmdHeadline",
19
19
  props: {
20
20
  /**
21
21
  * text for headline
@@ -12,28 +12,21 @@
12
12
  <span :class="['label-text', { hidden: !showLabel}]" :id="labelId" :aria-labelledby="labelId">
13
13
  <span>{{ labelText }}<sup v-if="required">*</sup></span>
14
14
 
15
- <!-- begin CmdTooltip -->
16
- <CmdTooltip v-if="useCustomTooltip" class="box" :class="validationStatus" :relatedId="tooltipId" :toggle-visibility-by-click="true">
17
- <!-- begin CmdSystemMessage -->
18
- <CmdSystemMessage
19
- v-if="getValidationMessage"
20
- :message="getValidationMessage"
21
- :validation-status="validationStatus"
22
- :iconClose="{show: false}"
23
- />
24
- <!-- end CmdSystemMessage -->
25
-
26
- <!-- begin CmdListOfRequirements -->
27
- <CmdListOfRequirements
28
- v-if="showRequirements && (validationStatus === '' || validationStatus === 'error')"
29
- :inputRequirements="inputRequirements"
30
- :helplink="helplink"
31
- :inputModelValue="modelValue"
32
- :inputAttributes="$attrs"
33
- />
34
- <!-- end CmdListOfRequirements -->
35
- </CmdTooltip>
36
- <!-- end CmdTooltip -->
15
+ <!-- begin CmdTooltipForInputElements -->
16
+ <CmdTooltipForInputElements
17
+ v-if="useCustomTooltip && (validationStatus === '' || validationStatus === 'error')"
18
+ ref="tooltip"
19
+ :showRequirements="showRequirements"
20
+ :inputRequirements="inputRequirements"
21
+ :validationStatus="validationStatus"
22
+ :validationMessage="getValidationMessage"
23
+ :validationTooltip="validationTooltip"
24
+ :inputAttributes="$attrs"
25
+ :inputModelValue="modelValue"
26
+ :helplink="helplink"
27
+ :relatedId="tooltipId"
28
+ />
29
+ <!-- end CmdTooltipForInputElements -->
37
30
 
38
31
  <a v-if="required || inputRequirements.length"
39
32
  href="#"
@@ -80,15 +73,11 @@ import FieldValidation from "../mixins/FieldValidation.js"
80
73
  import Tooltip from "../mixins/Tooltip.js"
81
74
 
82
75
  // import components
83
- import CmdListOfRequirements from "./CmdListOfRequirements"
84
- import CmdSystemMessage from "./CmdSystemMessage"
85
- import CmdTooltip from "./CmdTooltip"
76
+ import CmdTooltipForInputElements from "./CmdTooltipForInputElements"
86
77
 
87
78
  export default {
88
79
  components: {
89
- CmdListOfRequirements,
90
- CmdSystemMessage,
91
- CmdTooltip
80
+ CmdTooltipForInputElements
92
81
  },
93
82
  mixins: [
94
83
  FieldValidation,
@@ -96,8 +85,7 @@ export default {
96
85
  ],
97
86
  data() {
98
87
  return {
99
- value: "",
100
- validationStatus: ""
88
+ value: ""
101
89
  }
102
90
  },
103
91
  props: {
@@ -115,13 +103,6 @@ export default {
115
103
  type: Boolean,
116
104
  default: false
117
105
  },
118
- /**
119
- * tooltip for validation
120
- */
121
- validationTooltip: {
122
- type: String,
123
- default: ""
124
- },
125
106
  /**
126
107
  * list of input-elements inside group
127
108
  *
@@ -231,7 +212,33 @@ export default {
231
212
  default: false
232
213
  }
233
214
  },
215
+ methods: {
216
+ updateStatus() {
217
+ if (this.required) {
218
+ if(this.inputValue?.length) {
219
+ this.validationStatus = ""
220
+ return
221
+ }
222
+ this.validationStatus = "error"
223
+ return
224
+ }
225
+ this.validationStatus = this.status
226
+ }
227
+ },
234
228
  computed: {
229
+ validationTooltip() {
230
+ if (!this.useCustomTooltip) {
231
+ return this.getValidationMessage
232
+ }
233
+
234
+ // set default-tooltip if customTooltip is not set
235
+ if (this.validationStatus === 'error') {
236
+ return this.getMessage("cmdformelement.validationTooltip.an_error_occurred")
237
+ } else if (this.validationStatus === 'success') {
238
+ return this.getMessage("cmdformelement.validationTooltip.information_is_filled_correctly")
239
+ }
240
+ return this.getMessage("cmdformelement.validationTooltip.open_field_requirements")
241
+ },
235
242
  // get ID for accessibility
236
243
  labelId() {
237
244
  if (this.$attrs.id !== undefined) {
@@ -250,25 +257,16 @@ export default {
250
257
  }
251
258
  }
252
259
  },
253
- methods: {
254
- onChange(e) {
255
- if (typeof this.value === "string") {
256
- this.$emit("update:value", e.target.value)
257
- } else if (this.value !== undefined) {
258
- let values = [...this.value]
259
- if (e.target.checked) {
260
- values.push(e.target.value)
261
- } else {
262
- values = values.filter(value => value !== e.target.value)
263
- }
264
- this.$emit("update:modelValue", values)
265
- }
266
- }
267
- },
268
260
  watch: {
269
261
  status: {
270
262
  handler() {
271
- this.validationStatus = this.status
263
+ this.updateStatus()
264
+ },
265
+ immediate: true
266
+ },
267
+ modelValue: {
268
+ handler() {
269
+ this.updateStatus()
272
270
  },
273
271
  immediate: true
274
272
  }