comand-component-library 3.1.90 → 3.1.91
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/comand-component-library.css +1 -1
- package/dist/comand-component-library.umd.min.js +1 -1
- package/package.json +2 -2
- package/src/App.vue +85 -13
- package/src/assets/data/main-navigation.json +1 -0
- package/src/assets/data/tabs.json +1 -0
- package/src/components/CmdBox.vue +12 -7
- package/src/components/CmdBoxSiteSearch.vue +2 -1
- package/src/components/CmdCookieDisclaimer.vue +19 -6
- package/src/components/CmdFakeSelect.vue +11 -19
- package/src/components/CmdFancyBox.vue +46 -13
- package/src/components/CmdFormElement.vue +17 -29
- package/src/components/CmdImageGallery.vue +2 -2
- package/src/components/CmdInputGroup.vue +9 -16
- package/src/components/CmdLoginForm.vue +1 -1
- package/src/components/CmdMainNavigation.vue +6 -6
- package/src/components/CmdMultipleSwitch.vue +4 -12
- package/src/components/CmdNewsletterSubscription.vue +199 -0
- package/src/components/CmdShareButtons.vue +100 -27
- package/src/components/CmdSystemMessage.vue +6 -0
- package/src/components/CmdTabs.vue +5 -5
- package/src/components/CmdThumbnailScroller.vue +9 -1
- package/src/components/CmdTooltip.vue +1 -1
- package/src/documentation/generated/CmdFancyBoxPropertyDescriptions.json +10 -0
- package/src/documentation/generated/CmdFormElementPropertyDescriptions.json +0 -5
- package/src/documentation/generated/CmdNewsletterSubscriptionPropertyDescriptions.json +42 -0
- package/src/documentation/generated/CmdShareButtonsPropertyDescriptions.json +24 -0
- package/src/mixins/CmdThumbnailScroller/DefaultMessageProperties.js +9 -0
- package/src/mixins/FieldValidation.js +8 -1
- package/src/mixins/Identifier.js +28 -0
- package/src/utils/common.js +5 -1
@@ -3,9 +3,9 @@
|
|
3
3
|
<div v-if="showFancyBox"
|
4
4
|
:class="['cmd-fancybox', {'show-overlay': showOverlay}]"
|
5
5
|
role="dialog"
|
6
|
-
aria-labelledby="
|
6
|
+
:aria-labelledby="htmlId">
|
7
7
|
<div class="popup" :class="{'image' : fancyBoxImageUrl || fancyBoxGallery }">
|
8
|
-
<!-- begin print
|
8
|
+
<!-- begin print buttons -->
|
9
9
|
<div class="button-wrapper no-flex"
|
10
10
|
v-if="(fancyboxOptions.printButtons && (fancyboxOptions.printButtons.color || fancyboxOptions.printButtons.grayscale)) || fancyboxOptions.closeIcon">
|
11
11
|
<a href="#"
|
@@ -22,15 +22,27 @@
|
|
22
22
|
id="print-grayscale"
|
23
23
|
@click.prevent="printInGrayscale = true">
|
24
24
|
</a>
|
25
|
-
<!-- end print
|
25
|
+
<!-- end print buttons -->
|
26
|
+
|
27
|
+
<!-- begin close-icon -->
|
26
28
|
<a href="#"
|
27
29
|
v-if="fancyboxOptions.closeIcon"
|
28
30
|
:class="fancyboxOptions.closeIcon.iconClass"
|
29
31
|
:title="fancyboxOptions.closeIcon.tooltip"
|
30
32
|
@click.prevent="close">
|
31
33
|
</a>
|
34
|
+
<!-- end close-icon -->
|
32
35
|
</div>
|
33
36
|
<div :class="{'grayscale' : printInGrayscale}">
|
37
|
+
<!-- begin CmdHeadline -->
|
38
|
+
<CmdHeadline
|
39
|
+
v-show="cmdHeadline?.show"
|
40
|
+
:headlineText="cmdHeadline?.headlineText"
|
41
|
+
:headlineLevel="cmdHeadline?.headlineLevel"
|
42
|
+
:id="htmlId"
|
43
|
+
/>
|
44
|
+
<!-- end CmdHeadline -->
|
45
|
+
|
34
46
|
<div v-if="fancyBoxImageUrl" class="content">
|
35
47
|
<img :src="fancyBoxImageUrl" :alt="altText" />
|
36
48
|
</div>
|
@@ -75,7 +87,11 @@
|
|
75
87
|
<script>
|
76
88
|
import {defineComponent, createApp} from "vue"
|
77
89
|
|
90
|
+
// import mixins
|
91
|
+
import Identifier from "../mixins/Identifier"
|
92
|
+
|
78
93
|
// import components
|
94
|
+
import CmdHeadline from "./CmdHeadline"
|
79
95
|
import CmdSlideButton from "./CmdSlideButton.vue"
|
80
96
|
import CmdThumbnailScroller from './CmdThumbnailScroller.vue'
|
81
97
|
|
@@ -92,9 +108,23 @@
|
|
92
108
|
const FancyBox = defineComponent({
|
93
109
|
name: "CmdFancyBox",
|
94
110
|
components: {
|
111
|
+
CmdHeadline,
|
95
112
|
CmdSlideButton,
|
96
113
|
CmdThumbnailScroller
|
97
114
|
},
|
115
|
+
mixins: [
|
116
|
+
Identifier
|
117
|
+
],
|
118
|
+
data() {
|
119
|
+
return {
|
120
|
+
fancyBoxContent: null,
|
121
|
+
fancyBoxElements: null,
|
122
|
+
fancyBoxImageUrl: null,
|
123
|
+
index: this.defaultGalleryIndex,
|
124
|
+
printInGrayscale: false,
|
125
|
+
showFancyBox: this.show
|
126
|
+
}
|
127
|
+
},
|
98
128
|
props: {
|
99
129
|
/**
|
100
130
|
* set if content should be loaded by url
|
@@ -188,16 +218,15 @@
|
|
188
218
|
altText: {
|
189
219
|
type: String,
|
190
220
|
required: false
|
191
|
-
}
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
index: this.defaultGalleryIndex
|
221
|
+
},
|
222
|
+
/**
|
223
|
+
* properties for CmdHeadline-component
|
224
|
+
*
|
225
|
+
* @requiredForAccessibility: true
|
226
|
+
*/
|
227
|
+
cmdHeadline: {
|
228
|
+
type: Object,
|
229
|
+
required: false
|
201
230
|
}
|
202
231
|
},
|
203
232
|
created() {
|
@@ -362,6 +391,10 @@
|
|
362
391
|
border-radius: var(--border-radius);
|
363
392
|
overflow-y: auto;
|
364
393
|
|
394
|
+
.cmd-cookie-disclaimer {
|
395
|
+
padding: 0;
|
396
|
+
}
|
397
|
+
|
365
398
|
> .grayscale {
|
366
399
|
filter: grayscale(1);
|
367
400
|
}
|
@@ -15,13 +15,14 @@
|
|
15
15
|
'has-state': validationStatus
|
16
16
|
}
|
17
17
|
]"
|
18
|
-
:for="
|
18
|
+
:for="htmlId"
|
19
19
|
:title="$attrs.title"
|
20
20
|
ref="label">
|
21
21
|
|
22
22
|
<!-- begin label-text (+ required asterisk) -->
|
23
23
|
<span v-if="(labelText || $slots.labeltext) && $attrs.type !== 'checkbox' && $attrs.type !== 'radio'"
|
24
|
-
|
24
|
+
v-show="showLabel"
|
25
|
+
class="label-text">
|
25
26
|
<span>
|
26
27
|
<template v-if="labelText">{{ labelText }}</template>
|
27
28
|
<!-- begin slot 'labeltext' -->
|
@@ -36,9 +37,9 @@
|
|
36
37
|
ref="tooltip"
|
37
38
|
:validationStatus="validationStatus"
|
38
39
|
:validationMessage="getValidationMessage"
|
39
|
-
:validationTooltip="validationTooltip"
|
40
40
|
:relatedId="tooltipId"
|
41
41
|
:cmdListOfRequirements="listOfRequirements"
|
42
|
+
:role="validationStatus === 'error' ? 'alert' : 'dialog'"
|
42
43
|
/>
|
43
44
|
<!-- end CmdTooltipForInputElements -->
|
44
45
|
|
@@ -47,10 +48,9 @@
|
|
47
48
|
@click.prevent
|
48
49
|
:class="getStatusIconClass"
|
49
50
|
:title="validationTooltip"
|
50
|
-
:aria-errormessage="
|
51
|
+
:aria-errormessage="tooltipId"
|
51
52
|
aria-live="assertive"
|
52
|
-
:id="tooltipId"
|
53
|
-
:role="validationStatus === 'error' ? 'alert' : 'dialog'">
|
53
|
+
:id="tooltipId">
|
54
54
|
</a>
|
55
55
|
</span>
|
56
56
|
<!-- end label-text (+ required asterisk) -->
|
@@ -63,13 +63,14 @@
|
|
63
63
|
<template v-if="element === 'input' && $attrs.type !== 'checkbox' && $attrs.type !== 'radio' && $attrs.type !== 'search'">
|
64
64
|
<input
|
65
65
|
v-bind="elementAttributes"
|
66
|
-
:id="
|
66
|
+
:id="htmlId"
|
67
67
|
:class="inputClass"
|
68
68
|
@focus="tooltip = true"
|
69
69
|
@blur="onBlur"
|
70
70
|
@input="onInput"
|
71
71
|
@mouseover="datalistFocus"
|
72
72
|
@keyup="checkForCapsLock"
|
73
|
+
@change="$emit('change', $event)"
|
73
74
|
:autocomplete="autocomplete"
|
74
75
|
:list="datalist ? datalist.id : null"
|
75
76
|
:value="modelValue"
|
@@ -109,7 +110,7 @@
|
|
109
110
|
:checked="isChecked"
|
110
111
|
:value="inputValue"
|
111
112
|
:class="[inputClass, validationStatus, toggleSwitchIconClass, { 'replace-input-type': replaceInputType, 'toggle-switch': toggleSwitch }]"
|
112
|
-
:id="
|
113
|
+
:id="htmlId"
|
113
114
|
:disabled="$attrs.disabled"
|
114
115
|
:aria-invalid="validationStatus === 'error'"
|
115
116
|
/>
|
@@ -133,7 +134,7 @@
|
|
133
134
|
:checked="isChecked"
|
134
135
|
:value="inputValue"
|
135
136
|
:class="{inputClass, validationStatus}"
|
136
|
-
:id="
|
137
|
+
:id="htmlId"
|
137
138
|
:disabled="$attrs.disabled"
|
138
139
|
:aria-invalid="validationStatus === 'error'"
|
139
140
|
/>
|
@@ -152,7 +153,7 @@
|
|
152
153
|
<!-- begin selectbox -->
|
153
154
|
<select v-if="element === 'select'"
|
154
155
|
v-bind="elementAttributes"
|
155
|
-
:id="
|
156
|
+
:id="htmlId"
|
156
157
|
@blur="onBlur"
|
157
158
|
@change="$emit('update:modelValue', $event.target.value)">
|
158
159
|
<option v-for="(option, index) in selectOptions" :key="index" :value="option.value"
|
@@ -164,7 +165,7 @@
|
|
164
165
|
<!-- begin textarea -->
|
165
166
|
<textarea v-if="element === 'textarea'"
|
166
167
|
v-bind="elementAttributes"
|
167
|
-
:id="
|
168
|
+
:id="htmlId"
|
168
169
|
:value="modelValue"
|
169
170
|
:maxlength="getMaxLength()"
|
170
171
|
@input="onInput"
|
@@ -179,7 +180,7 @@
|
|
179
180
|
<span class="search-field-wrapper flex-container no-gap">
|
180
181
|
<input
|
181
182
|
v-bind="elementAttributes"
|
182
|
-
:id="
|
183
|
+
:id="htmlId"
|
183
184
|
@input="onInput"
|
184
185
|
:maxlength="getMaxLength()"
|
185
186
|
:value="modelValue"
|
@@ -206,13 +207,11 @@
|
|
206
207
|
</template>
|
207
208
|
|
208
209
|
<script>
|
209
|
-
// import utils
|
210
|
-
import {createUuid} from "../utils/common.js"
|
211
|
-
|
212
210
|
// import mixins
|
213
211
|
import I18n from "../mixins/I18n"
|
214
212
|
import DefaultMessageProperties from "../mixins/CmdFormElement/DefaultMessageProperties"
|
215
213
|
import FieldValidation from "../mixins/FieldValidation.js"
|
214
|
+
import Identifier from "../mixins/Identifier.js"
|
216
215
|
import Tooltip from "../mixins/Tooltip.js"
|
217
216
|
|
218
217
|
// import components
|
@@ -228,6 +227,7 @@ export default {
|
|
228
227
|
I18n,
|
229
228
|
DefaultMessageProperties,
|
230
229
|
FieldValidation,
|
230
|
+
Identifier,
|
231
231
|
Tooltip
|
232
232
|
],
|
233
233
|
data() {
|
@@ -347,13 +347,6 @@ export default {
|
|
347
347
|
type: String,
|
348
348
|
required: false
|
349
349
|
},
|
350
|
-
/**
|
351
|
-
* if for native form-element
|
352
|
-
*/
|
353
|
-
id: {
|
354
|
-
type: String,
|
355
|
-
required: false
|
356
|
-
},
|
357
350
|
/**
|
358
351
|
* set if a native datalist should be used
|
359
352
|
*/
|
@@ -682,13 +675,6 @@ export default {
|
|
682
675
|
}
|
683
676
|
return null
|
684
677
|
},
|
685
|
-
// get ID for accessibility
|
686
|
-
labelId() {
|
687
|
-
if (this.$attrs.id !== undefined) {
|
688
|
-
return this.$attrs.id
|
689
|
-
}
|
690
|
-
return "label-" + createUuid()
|
691
|
-
},
|
692
678
|
// toggle icons for toggle-switch
|
693
679
|
toggleSwitchIconClass() {
|
694
680
|
if(this.toggleSwitch && this.useIconsForToggleSwitch && this.toggleSwitchUncheckedIconClass && this.toggleSwitchCheckedIconClass) {
|
@@ -742,6 +728,8 @@ export default {
|
|
742
728
|
}
|
743
729
|
}
|
744
730
|
}
|
731
|
+
|
732
|
+
this.$emit('validation-status-change', this.validationStatus)
|
745
733
|
}
|
746
734
|
},
|
747
735
|
onBlur(event) {
|
@@ -4,7 +4,7 @@
|
|
4
4
|
:key="index"
|
5
5
|
@click.prevent="showFancyBox(index)"
|
6
6
|
href="#"
|
7
|
-
:title="getMessage('
|
7
|
+
:title="getMessage('cmdimagegallery.tooltip.open_large_image')">
|
8
8
|
<figure>
|
9
9
|
<figcaption v-if="image.figcaption && figcaptionPosition === 'top'">{{ image.figcaption }}</figcaption>
|
10
10
|
<img :src="image.srcImageSmall" :alt="image.alt" />
|
@@ -19,7 +19,7 @@ import {openFancyBox} from "./CmdFancyBox"
|
|
19
19
|
|
20
20
|
// import mixins
|
21
21
|
import I18n from "../mixins/I18n"
|
22
|
-
import DefaultMessageProperties from "../mixins/
|
22
|
+
import DefaultMessageProperties from "../mixins/CmdImageGallery/DefaultMessageProperties"
|
23
23
|
|
24
24
|
export default {
|
25
25
|
name: "CmdImageGallery",
|
@@ -8,9 +8,10 @@
|
|
8
8
|
'toggle-switch': toggleSwitch,
|
9
9
|
'has-state': validationStatus
|
10
10
|
}
|
11
|
-
]"
|
12
|
-
|
13
|
-
|
11
|
+
]"
|
12
|
+
:aria-labelledby="htmlId">
|
13
|
+
<span v-show="showLabel" class="label-text">
|
14
|
+
<span :id="htmlId">{{ labelText }}<sup v-if="required">*</sup></span>
|
14
15
|
|
15
16
|
<!-- begin CmdTooltipForInputElements -->
|
16
17
|
<CmdTooltipForInputElements
|
@@ -20,11 +21,11 @@
|
|
20
21
|
:inputRequirements="inputRequirements"
|
21
22
|
:validationStatus="validationStatus"
|
22
23
|
:validationMessage="getValidationMessage"
|
23
|
-
:validationTooltip="validationTooltip"
|
24
24
|
:inputAttributes="$attrs"
|
25
25
|
:inputModelValue="modelValue"
|
26
26
|
:helplink="helplink"
|
27
27
|
:relatedId="tooltipId"
|
28
|
+
:role="validationStatus === 'error' ? 'alert' : 'dialog'"
|
28
29
|
/>
|
29
30
|
<!-- end CmdTooltipForInputElements -->
|
30
31
|
|
@@ -33,10 +34,9 @@
|
|
33
34
|
@click.prevent
|
34
35
|
:class="getStatusIconClass"
|
35
36
|
:title="validationTooltip"
|
36
|
-
:aria-errormessage="
|
37
|
+
:aria-errormessage="tooltipId"
|
37
38
|
aria-live="assertive"
|
38
|
-
:id="tooltipId"
|
39
|
-
:role="validationStatus === 'error' ? 'alert' : 'dialog'">
|
39
|
+
:id="tooltipId">
|
40
40
|
</a>
|
41
41
|
</span>
|
42
42
|
<span v-if="!useSlot" :class="['flex-container', {'no-flex': !stretchHorizontally, 'no-gap': multipleSwitch}]">
|
@@ -66,10 +66,9 @@
|
|
66
66
|
</template>
|
67
67
|
|
68
68
|
<script>
|
69
|
-
import {createUuid} from "../utils/common"
|
70
|
-
|
71
69
|
// import mixins
|
72
70
|
import FieldValidation from "../mixins/FieldValidation.js"
|
71
|
+
import Identifier from "../mixins/Identifier"
|
73
72
|
import Tooltip from "../mixins/Tooltip.js"
|
74
73
|
|
75
74
|
// import components
|
@@ -81,6 +80,7 @@ export default {
|
|
81
80
|
},
|
82
81
|
mixins: [
|
83
82
|
FieldValidation,
|
83
|
+
Identifier,
|
84
84
|
Tooltip
|
85
85
|
],
|
86
86
|
data() {
|
@@ -239,13 +239,6 @@ export default {
|
|
239
239
|
}
|
240
240
|
return this.getMessage("cmdformelement.validationTooltip.open_field_requirements")
|
241
241
|
},
|
242
|
-
// get ID for accessibility
|
243
|
-
labelId() {
|
244
|
-
if (this.$attrs.id !== undefined) {
|
245
|
-
return this.$attrs.id
|
246
|
-
}
|
247
|
-
return "label-" + createUuid()
|
248
|
-
},
|
249
242
|
inputValue: {
|
250
243
|
// read inputValue
|
251
244
|
get() {
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<legend :class="{hidden : !showLegend}">{{ textLegend }}</legend>
|
5
5
|
<!-- begin CmdHeadline -->
|
6
6
|
<CmdHeadline v-if="cmdHeadlineLoginForm"
|
7
|
-
|
7
|
+
v-bind="cmdHeadlineLoginForm"/>
|
8
8
|
<!-- end CmdHeadline -->
|
9
9
|
|
10
10
|
<!-- being form elements -->
|
@@ -31,7 +31,7 @@
|
|
31
31
|
<span v-if="navigationEntry.iconClass" :class="navigationEntry.iconClass"></span>
|
32
32
|
<span v-if="navigationEntry.text">{{ navigationEntry.text }}</span>
|
33
33
|
<span v-if="navigationEntry?.subentries?.length"
|
34
|
-
:class="subentriesIconClass"
|
34
|
+
:class="['subentry-icon', subentriesIconClass]"
|
35
35
|
></span>
|
36
36
|
</a>
|
37
37
|
<!-- end type === href -->
|
@@ -47,7 +47,7 @@
|
|
47
47
|
<span v-if="navigationEntry.iconClass" :class="navigationEntry.iconClass"></span>
|
48
48
|
<span v-if="navigationEntry.text">{{ navigationEntry.text }}</span>
|
49
49
|
<span v-if="navigationEntry.subentries && navigationEntry.subentries.length > 0"
|
50
|
-
:class="subentriesIconClass"></span>
|
50
|
+
:class="['subentry-icon', subentriesIconClass]"></span>
|
51
51
|
</router-link>
|
52
52
|
<!-- end type === router -->
|
53
53
|
|
@@ -64,7 +64,7 @@
|
|
64
64
|
<span v-if="navigationSubEntry.iconClass" :class="navigationSubEntry.iconClass"></span>
|
65
65
|
<span v-if="navigationSubEntry.text">{{ navigationSubEntry.text }}</span>
|
66
66
|
<span v-if="navigationSubEntry.subentries && navigationSubEntry.subentries.length > 0"
|
67
|
-
:class="subentriesIconClass"
|
67
|
+
:class="['subentry-icon', subentriesIconClass]"
|
68
68
|
></span>
|
69
69
|
</a>
|
70
70
|
<!-- end type === href -->
|
@@ -78,7 +78,7 @@
|
|
78
78
|
<span v-if="navigationSubEntry.iconClass" :class="navigationSubEntry.iconClass"></span>
|
79
79
|
<span v-if="navigationSubEntry.text">{{ navigationSubEntry.text }}</span>
|
80
80
|
<span v-if="navigationSubEntry.subentries && navigationSubEntry.subentries.length > 0"
|
81
|
-
:class="subentriesIconClass"></span>
|
81
|
+
:class="['subentry-icon', subentriesIconClass]"></span>
|
82
82
|
</router-link>
|
83
83
|
<!-- end type === router -->
|
84
84
|
|
@@ -95,7 +95,7 @@
|
|
95
95
|
<span v-if="navigationSubSubEntry.iconClass" :class="navigationSubSubEntry.iconClass"></span>
|
96
96
|
<span v-if="navigationSubSubEntry.text">{{ navigationSubSubEntry.text }}</span>
|
97
97
|
<span v-if="navigationSubSubEntry.subentries && navigationSubSubEntry.subentries.length > 0"
|
98
|
-
:class="subentriesIconClass"
|
98
|
+
:class="['subentry-icon', subentriesIconClass]"
|
99
99
|
></span>
|
100
100
|
</a>
|
101
101
|
<!-- end type === href -->
|
@@ -109,7 +109,7 @@
|
|
109
109
|
<span v-if="navigationSubSubEntry.iconClass" :class="navigationSubSubEntry.iconClass"></span>
|
110
110
|
<span v-if="navigationSubSubEntry.text">{{ navigationSubSubEntry.text }}</span>
|
111
111
|
<span v-if="navigationSubSubEntry.subentries && navigationSubSubEntry.subentries.length > 0"
|
112
|
-
:class="subentriesIconClass"></span>
|
112
|
+
:class="['subentry-icon', subentriesIconClass]"></span>
|
113
113
|
</router-link>
|
114
114
|
<!-- end type === router -->
|
115
115
|
</li>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<template>
|
2
2
|
<div :class="['cmd-multiple-switch multiple-switch label', {disabled: status === 'disabled', error: status === 'error'}]" :aria-labelledby="labelId">
|
3
|
-
<span
|
3
|
+
<span v-show="showLabel" :id="htmlId">{{ labelText }}</span>
|
4
4
|
<span class="flex-container no-gap no-flex">
|
5
5
|
<label :class="{disabled: status === 'disabled'}" :for="multipleswitch.id"
|
6
6
|
v-for="(multipleswitch, index) in multipleSwitches" :key="index">
|
@@ -20,11 +20,12 @@
|
|
20
20
|
</template>
|
21
21
|
|
22
22
|
<script>
|
23
|
-
// import
|
24
|
-
import
|
23
|
+
// import mixins
|
24
|
+
import Identifier from "../mixins/Identifier"
|
25
25
|
|
26
26
|
export default {
|
27
27
|
name: "CmdMultipleSwitch",
|
28
|
+
mixins: [Identifier],
|
28
29
|
props: {
|
29
30
|
/**
|
30
31
|
* value for v-model
|
@@ -83,15 +84,6 @@ export default {
|
|
83
84
|
required: false
|
84
85
|
}
|
85
86
|
},
|
86
|
-
computed: {
|
87
|
-
// get ID for accessibility
|
88
|
-
labelId() {
|
89
|
-
if(this.$attrs.id !== undefined) {
|
90
|
-
return this.$attrs.id
|
91
|
-
}
|
92
|
-
return "label-" + createUuid()
|
93
|
-
}
|
94
|
-
},
|
95
87
|
methods: {
|
96
88
|
onChange(e) {
|
97
89
|
if (typeof this.value === "string") {
|
@@ -0,0 +1,199 @@
|
|
1
|
+
<template>
|
2
|
+
<!-- begin cmd-input-group -->
|
3
|
+
<CmdInputGroup
|
4
|
+
inputTypes="radio"
|
5
|
+
:labelText="cmdInputGroup.labelText"
|
6
|
+
:showLabel="cmdInputGroup.showLabel"
|
7
|
+
:inputElements="cmdInputGroup.inputElements"
|
8
|
+
v-model="subscription"
|
9
|
+
/>
|
10
|
+
<!-- end cmd-input-group -->
|
11
|
+
|
12
|
+
<!-- begin cmd-form-element -->
|
13
|
+
<CmdFormElement
|
14
|
+
element="input"
|
15
|
+
type="email"
|
16
|
+
:placeholder="cmdFormElementEmail.placeholder"
|
17
|
+
:labelText="cmdFormElementEmail.labelText"
|
18
|
+
id="cmd-email-newsletter-subscription"
|
19
|
+
:required="cmdFormElementEmail.required"
|
20
|
+
:useCustomTooltip="cmdFormElementEmail.useCustomTooltip"
|
21
|
+
v-model="email"
|
22
|
+
@validationStatusChange="checkValidationStatus"
|
23
|
+
/>
|
24
|
+
<!-- end cmd-form-element -->
|
25
|
+
|
26
|
+
<div class="button-wrapper">
|
27
|
+
<!-- begin cmd-form-element -->
|
28
|
+
<CmdFormElement
|
29
|
+
element="button"
|
30
|
+
:type="buttonType"
|
31
|
+
:disabled="buttonDisabled"
|
32
|
+
:nativeButton="cmdFormElementSubmit"
|
33
|
+
@click="sendData"
|
34
|
+
/>
|
35
|
+
<!-- end cmd-form-element -->
|
36
|
+
</div>
|
37
|
+
</template>
|
38
|
+
|
39
|
+
<script>
|
40
|
+
// import components
|
41
|
+
import CmdFormElement from "./CmdFormElement"
|
42
|
+
import CmdInputGroup from "./CmdInputGroup"
|
43
|
+
|
44
|
+
export default {
|
45
|
+
name: "CmdNewsletterSubscription",
|
46
|
+
emits: ["button-click"],
|
47
|
+
components: {
|
48
|
+
CmdFormElement,
|
49
|
+
CmdInputGroup
|
50
|
+
},
|
51
|
+
data() {
|
52
|
+
return {
|
53
|
+
buttonDisabled: true
|
54
|
+
}
|
55
|
+
},
|
56
|
+
props: {
|
57
|
+
/**
|
58
|
+
* set value for v-model (must be named modelValue in vue3 if default v-model should be used)
|
59
|
+
*/
|
60
|
+
modelValue: {
|
61
|
+
type: Object,
|
62
|
+
default() {
|
63
|
+
return {
|
64
|
+
subscription: "subscribe",
|
65
|
+
email: ""
|
66
|
+
}
|
67
|
+
}
|
68
|
+
},
|
69
|
+
buttonType: {
|
70
|
+
type: String,
|
71
|
+
default: "button",
|
72
|
+
validator(value) {
|
73
|
+
return value === "submit" || value === "button"
|
74
|
+
}
|
75
|
+
},
|
76
|
+
/**
|
77
|
+
* text used as legend for login-fieldset
|
78
|
+
*
|
79
|
+
* @requiredForAccessibility: true
|
80
|
+
*/
|
81
|
+
textLegend: {
|
82
|
+
type: String,
|
83
|
+
default: "Stay up-to-date"
|
84
|
+
},
|
85
|
+
/**
|
86
|
+
* toggle legend visibility
|
87
|
+
*/
|
88
|
+
showLegend: {
|
89
|
+
type: Boolean,
|
90
|
+
default: true
|
91
|
+
},
|
92
|
+
/**
|
93
|
+
* properties for CmdInputGroup-component
|
94
|
+
*/
|
95
|
+
cmdInputGroup: {
|
96
|
+
type: Object,
|
97
|
+
default: function () {
|
98
|
+
return {
|
99
|
+
labelText: "Choose option",
|
100
|
+
showLabel: false,
|
101
|
+
inputElements: [
|
102
|
+
{
|
103
|
+
labelText: "Subscribe",
|
104
|
+
id: "radio-subscribe",
|
105
|
+
name: "cmd-subscribe-group",
|
106
|
+
value: "subscribe"
|
107
|
+
},
|
108
|
+
{
|
109
|
+
labelText: "Unsubscribe",
|
110
|
+
id: "radio-unsubscribe",
|
111
|
+
name: "cmd-subscribe-group",
|
112
|
+
value: "unsubscribe"
|
113
|
+
}
|
114
|
+
]
|
115
|
+
}
|
116
|
+
}
|
117
|
+
},
|
118
|
+
/**
|
119
|
+
* properties for CmdFormElement-component for email-field
|
120
|
+
*/
|
121
|
+
cmdFormElementEmail: {
|
122
|
+
type: Object,
|
123
|
+
default: function () {
|
124
|
+
return {
|
125
|
+
labelText: "Email-Address:",
|
126
|
+
placeholder: "Enter your email-address",
|
127
|
+
required: true
|
128
|
+
}
|
129
|
+
}
|
130
|
+
},
|
131
|
+
/**
|
132
|
+
* properties for CmdFormElement-component for submit-button
|
133
|
+
*/
|
134
|
+
cmdFormElementSubmit: {
|
135
|
+
type: Object,
|
136
|
+
default: function () {
|
137
|
+
return {
|
138
|
+
text: "Submit",
|
139
|
+
icon: {
|
140
|
+
show: true,
|
141
|
+
iconClass: "icon-message-send",
|
142
|
+
position: "before",
|
143
|
+
tooltip: ""
|
144
|
+
}
|
145
|
+
}
|
146
|
+
}
|
147
|
+
}
|
148
|
+
},
|
149
|
+
computed: {
|
150
|
+
subscription: {
|
151
|
+
get() {
|
152
|
+
return this.modelValue.subscription || "subscribe"
|
153
|
+
},
|
154
|
+
set(value) {
|
155
|
+
this.$emit("update:modelValue", {subscription: value, email: this.email})
|
156
|
+
}
|
157
|
+
},
|
158
|
+
email: {
|
159
|
+
get() {
|
160
|
+
return this.modelValue.email
|
161
|
+
},
|
162
|
+
set(value) {
|
163
|
+
this.$emit("update:modelValue", {subscription: this.subscription, email: value})
|
164
|
+
}
|
165
|
+
}
|
166
|
+
},
|
167
|
+
methods: {
|
168
|
+
sendData(event) {
|
169
|
+
this.$emit("button-click", {subscription: this.subscription, email: this.email, originalEvent: event})
|
170
|
+
},
|
171
|
+
checkValidationStatus(event) {
|
172
|
+
this.buttonDisabled = event !== "success"
|
173
|
+
}
|
174
|
+
}
|
175
|
+
}
|
176
|
+
</script>
|
177
|
+
|
178
|
+
<style lang="scss">
|
179
|
+
/* begin cmd-back-to-top-button ---------------------------------------------------------------------------------------- */
|
180
|
+
.cmd-back-to-top-button {
|
181
|
+
padding: var(--default-padding);
|
182
|
+
display: inline-block;
|
183
|
+
position: fixed;
|
184
|
+
right: 1rem;
|
185
|
+
bottom: 1rem;
|
186
|
+
text-decoration: none;
|
187
|
+
z-index: 1000;
|
188
|
+
border: var(--default-border);
|
189
|
+
background: var(--color-scheme-background-color);
|
190
|
+
border-radius: var(--full-circle);
|
191
|
+
|
192
|
+
&:hover, &:active, &:focus {
|
193
|
+
border-color: var(--primary-color);
|
194
|
+
transition: var(--default-transition);
|
195
|
+
}
|
196
|
+
}
|
197
|
+
|
198
|
+
/* cmd-back-to-top-button ------------------------------------------------------------------------------------------ */
|
199
|
+
</style>
|