comand-component-library 3.1.90 → 3.1.92
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.
- 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 +119 -45
- package/src/assets/data/main-navigation.json +1 -0
- package/src/assets/data/tabs.json +1 -0
- package/src/assets/styles/global-styles.scss +0 -1
- package/src/components/CmdBox.vue +15 -9
- package/src/components/CmdCookieDisclaimer.vue +38 -9
- package/src/components/CmdFakeSelect.vue +11 -19
- package/src/components/CmdFancyBox.vue +46 -13
- package/src/components/CmdFormElement.vue +29 -32
- package/src/components/CmdImageGallery.vue +2 -2
- package/src/components/CmdInputGroup.vue +9 -16
- package/src/components/CmdLoginForm.vue +80 -103
- package/src/components/CmdMainNavigation.vue +6 -6
- package/src/components/CmdMultipleSwitch.vue +4 -12
- package/src/components/CmdNewsletterSubscription.vue +205 -0
- package/src/components/CmdShareButtons.vue +100 -27
- package/src/components/{CmdBoxSiteSearch.vue → CmdSiteSearch.vue} +34 -13
- 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/components/CmdTooltipForInputElements.vue +1 -19
- package/src/documentation/generated/CmdFancyBoxPropertyDescriptions.json +10 -0
- package/src/documentation/generated/CmdFormElementPropertyDescriptions.json +0 -5
- package/src/documentation/generated/CmdLoginFormPropertyDescriptions.json +3 -3
- package/src/documentation/generated/CmdNewsletterSubscriptionPropertyDescriptions.json +42 -0
- package/src/documentation/generated/CmdShareButtonsPropertyDescriptions.json +24 -0
- package/src/documentation/generated/CmdSiteSearchPropertyDescriptions.json +79 -0
- package/src/documentation/generated/CmdTooltipForInputElementsPropertyDescriptions.json +1 -6
- package/src/index.js +1 -1
- package/src/mixins/CmdFormElement/DefaultMessageProperties.js +2 -1
- package/src/mixins/CmdThumbnailScroller/DefaultMessageProperties.js +9 -0
- package/src/mixins/FieldValidation.js +19 -7
- package/src/mixins/Identifier.js +28 -0
- package/src/utils/common.js +5 -1
@@ -1,10 +1,12 @@
|
|
1
1
|
<template>
|
2
2
|
<!-- begin login-form -->
|
3
|
-
<fieldset v-
|
4
|
-
<legend :class="{hidden : !showLegend}">{{
|
3
|
+
<fieldset v-show="!sendLogin" class="cmd-login-form flex-container">
|
4
|
+
<legend :class="{hidden : !showLegend}">{{ textLegendLoginForm }}</legend>
|
5
5
|
<!-- begin CmdHeadline -->
|
6
|
-
<CmdHeadline
|
7
|
-
|
6
|
+
<CmdHeadline
|
7
|
+
v-if="cmdHeadlineLoginForm"
|
8
|
+
v-bind="cmdHeadlineLoginForm"
|
9
|
+
/>
|
8
10
|
<!-- end CmdHeadline -->
|
9
11
|
|
10
12
|
<!-- being form elements -->
|
@@ -19,6 +21,8 @@
|
|
19
21
|
:fieldIconClass="cmdFormElementUsername.innerIconClass"
|
20
22
|
:labelText="cmdFormElementUsername.labelText"
|
21
23
|
:placeholder="cmdFormElementUsername.placeholder"
|
24
|
+
:required="cmdFormElementUsername.required"
|
25
|
+
@validationStatusChange="checkValidationStatus($event, 'username')"
|
22
26
|
/>
|
23
27
|
<!-- end CmdFormElement -->
|
24
28
|
|
@@ -32,6 +36,8 @@
|
|
32
36
|
v-model="password"
|
33
37
|
:labelText="cmdFormElementPassword.labelText"
|
34
38
|
:placeholder="cmdFormElementPassword.placeholder"
|
39
|
+
:required="cmdFormElementPassword.required"
|
40
|
+
@validationStatusChange="checkValidationStatus($event, 'password')"
|
35
41
|
/>
|
36
42
|
<!-- end CmdFormElement -->
|
37
43
|
</div>
|
@@ -39,6 +45,7 @@
|
|
39
45
|
|
40
46
|
<div class="option-wrapper flex-container" v-focus>
|
41
47
|
<template v-if="options.forgotPassword || options.createAccount">
|
48
|
+
<!-- begin link for 'forgot password' -->
|
42
49
|
<a v-if="options.forgotPassword" href="#" @click.prevent="sendLogin = true">
|
43
50
|
<span v-if="options.forgotPassword.icon && options.forgotPassword.icon.show && options.forgotPassword.icon.iconClass"
|
44
51
|
:class="options.forgotPassword.icon.iconClass"
|
@@ -46,7 +53,9 @@
|
|
46
53
|
</span>
|
47
54
|
<span v-if="options.forgotPassword.text">{{ options.forgotPassword.text }}</span>
|
48
55
|
</a>
|
49
|
-
<!--
|
56
|
+
<!-- end link for 'forgot password' -->
|
57
|
+
|
58
|
+
<!-- begin link-type 'href' for 'create account' -->
|
50
59
|
<a v-if="options.createAccount && options.createAccount.linkType === 'href'" :href="options.createAccount.path">
|
51
60
|
<span v-if="options.createAccount.icon && options.createAccount.icon.show && options.createAccount.icon.iconClass"
|
52
61
|
:class="options.createAccount.icon.iconClass"
|
@@ -54,9 +63,9 @@
|
|
54
63
|
</span>
|
55
64
|
<span v-if="options.createAccount.text">{{ options.createAccount.text }}</span>
|
56
65
|
</a>
|
57
|
-
<!-- end link-type 'href' -->
|
66
|
+
<!-- end link-type 'href' for 'create account' -->
|
58
67
|
|
59
|
-
<!-- begin link-type 'router' -->
|
68
|
+
<!-- begin link-type 'router' for 'create account' -->
|
60
69
|
<router-link v-else-if="options.createAccount && options.createAccount.linkType === 'router'" :to="options.createAccount.path">
|
61
70
|
<span v-if="options.createAccount.icon && options.createAccount.icon.show && options.createAccount.icon.iconClass"
|
62
71
|
:class="options.createAccount.icon.iconClass"
|
@@ -64,47 +73,16 @@
|
|
64
73
|
</span>
|
65
74
|
<span v-if="options.createAccount.text">{{ options.createAccount.text }}</span>
|
66
75
|
</router-link>
|
67
|
-
<!-- end link-type 'router -->
|
76
|
+
<!-- end link-type 'router' for 'create account' -->
|
68
77
|
</template>
|
69
78
|
|
70
|
-
<!-- begin link-type 'href' -->
|
71
|
-
<a
|
72
|
-
v-if="buttons.login.linkType === 'href'"
|
73
|
-
:class="['button', { primary: buttons.login.primary }]"
|
74
|
-
:href="buttons.login.path"
|
75
|
-
@click.prevent="onClick"
|
76
|
-
>
|
77
|
-
<span
|
78
|
-
v-if="buttons.login.icon.iconClass"
|
79
|
-
:class="buttons.login.icon.iconClass"
|
80
|
-
:title="buttons.login.icon.tooltip"
|
81
|
-
></span>
|
82
|
-
<span v-if="buttons.login.text">{{ buttons.login.text }}</span>
|
83
|
-
</a>
|
84
|
-
<!-- begin link-type 'href' -->
|
85
|
-
|
86
|
-
<!-- begin link-type 'router' -->
|
87
|
-
<router-link
|
88
|
-
v-if="buttons.login.linkType === 'router'"
|
89
|
-
:class="['button', { primary: buttons.login.primary }]"
|
90
|
-
:to="buttons.login.path"
|
91
|
-
@click.prevent="onClick"
|
92
|
-
>
|
93
|
-
<span
|
94
|
-
v-if="buttons.login.icon.iconClass"
|
95
|
-
:class="buttons.login.icon.iconClass"
|
96
|
-
:title="buttons.login.icon.tooltip"
|
97
|
-
></span>
|
98
|
-
<span v-if="buttons.login.text">{{ buttons.login.text }}</span>
|
99
|
-
</router-link>
|
100
|
-
<!-- begin link-type 'router' -->
|
101
|
-
|
102
79
|
<!-- begin link-type 'button' -->
|
103
80
|
<button
|
104
81
|
v-if="buttons.login.linkType === 'button'"
|
105
82
|
:type="buttons.login.type === 'submit' ? 'submit' : 'button'"
|
106
83
|
:class="['button', { primary: buttons.login.primary }]"
|
107
84
|
@click="onClick"
|
85
|
+
:disabled="buttonLoginDisabled"
|
108
86
|
>
|
109
87
|
<span
|
110
88
|
v-if="buttons.login.icon.iconClass"
|
@@ -119,14 +97,13 @@
|
|
119
97
|
<!-- end login-form -->
|
120
98
|
|
121
99
|
<!-- begin send-login-form -->
|
122
|
-
<fieldset v-
|
123
|
-
<legend :class="{'hidden' : !
|
100
|
+
<fieldset v-show="sendLogin" class="cmd-login-form flex-container">
|
101
|
+
<legend :class="{'hidden' : !showLegend}">{{ textLegendForgotLoginForm }}</legend>
|
124
102
|
<!-- begin CmdHeadline -->
|
125
|
-
<CmdHeadline
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
:headlineText="cmdHeadlineSendLoginForm.headlineText"/>
|
103
|
+
<CmdHeadline
|
104
|
+
v-if="cmdHeadlineSendLoginForm"
|
105
|
+
v-bind="cmdHeadlineSendLoginForm"
|
106
|
+
/>
|
130
107
|
<!-- end CmdHeadline -->
|
131
108
|
|
132
109
|
<!-- begin CmdFormElement -->
|
@@ -137,8 +114,10 @@
|
|
137
114
|
:labelText="cmdFormElementSendLogin.labelText"
|
138
115
|
:placeholder="cmdFormElementSendLogin.placeholder"
|
139
116
|
:name="cmdFormElementSendLogin.name"
|
117
|
+
:required="cmdFormElementSendLogin.required"
|
140
118
|
:id="cmdFormElementSendLogin.id"
|
141
|
-
|
119
|
+
@validationStatusChange="checkValidationStatus($event, 'email')"
|
120
|
+
v-model="sendLoginMail"
|
142
121
|
/>
|
143
122
|
<!-- end CmdFormElement -->
|
144
123
|
|
@@ -153,43 +132,12 @@
|
|
153
132
|
</span>
|
154
133
|
</a>
|
155
134
|
|
156
|
-
<!-- begin link-type 'href' -->
|
157
|
-
<a
|
158
|
-
v-if="buttons.sendLogin.linkType === 'href'"
|
159
|
-
:class="['button', { primary: buttons.sendLogin.primary }]"
|
160
|
-
:href="buttons.sendLogin.path"
|
161
|
-
@click.prevent="sendLogin"
|
162
|
-
>
|
163
|
-
<span
|
164
|
-
v-if="buttons.sendLogin.icon.iconClass"
|
165
|
-
:class="buttons.sendLogin.icon.iconClass"
|
166
|
-
:title="buttons.sendLogin.icon.tooltip"
|
167
|
-
></span>
|
168
|
-
<span v-if="buttons.sendLogin.text">{{ buttons.sendLogin.text }}</span>
|
169
|
-
</a>
|
170
|
-
<!-- end link-type 'href' -->
|
171
|
-
|
172
|
-
<!-- begin link-type 'router' -->
|
173
|
-
<router-link
|
174
|
-
v-if="buttons.sendLogin.linkType === 'router'"
|
175
|
-
:class="['button', { primary: buttons.sendLogin.primary }]"
|
176
|
-
:to="buttons.sendLogin.path"
|
177
|
-
@click.prevent="sendLogin"
|
178
|
-
>
|
179
|
-
<span
|
180
|
-
v-if="buttons.sendLogin.icon.iconClass"
|
181
|
-
:class="buttons.sendLogin.icon.iconClass"
|
182
|
-
:title="buttons.sendLogin.icon.tooltip"
|
183
|
-
></span>
|
184
|
-
<span v-if="buttons.sendLogin.text">{{ buttons.sendLogin.text }}</span>
|
185
|
-
</router-link>
|
186
|
-
<!-- end link-type 'router' -->
|
187
|
-
|
188
135
|
<!-- begin link-type 'button' -->
|
189
136
|
<button
|
190
137
|
v-if="buttons.sendLogin.linkType === 'button'"
|
191
138
|
:type="buttons.sendLogin.type === 'submit' ? 'submit' : 'button'"
|
192
139
|
:class="['button', { primary: buttons.sendLogin.primary }]"
|
140
|
+
:disabled="buttonSendLoginDisabled"
|
193
141
|
>
|
194
142
|
<span
|
195
143
|
v-if="buttons.sendLogin.icon?.iconClass"
|
@@ -216,8 +164,9 @@ export default {
|
|
216
164
|
name: "CmdLoginForm",
|
217
165
|
data() {
|
218
166
|
return {
|
219
|
-
|
220
|
-
|
167
|
+
usernameValidationStatus: false,
|
168
|
+
passwordValidationStatus: false,
|
169
|
+
emailValidationStatus: false,
|
221
170
|
sendLoginMail: "",
|
222
171
|
sendLogin: false
|
223
172
|
}
|
@@ -244,7 +193,7 @@ export default {
|
|
244
193
|
*
|
245
194
|
* @requiredForAccessibility: true
|
246
195
|
*/
|
247
|
-
|
196
|
+
textLegendLoginForm: {
|
248
197
|
type: String,
|
249
198
|
default: "Login form"
|
250
199
|
},
|
@@ -256,18 +205,13 @@ export default {
|
|
256
205
|
default: true
|
257
206
|
},
|
258
207
|
/**
|
259
|
-
* legend for
|
208
|
+
* legend for forgot-login-fieldset
|
260
209
|
*
|
261
210
|
* @requiredForAccessibility: true
|
262
|
-
|
263
|
-
|
264
|
-
type:
|
265
|
-
default
|
266
|
-
return {
|
267
|
-
show: false,
|
268
|
-
text: "Forgot login form"
|
269
|
-
}
|
270
|
-
}
|
211
|
+
*/
|
212
|
+
textLegendForgotLoginForm: {
|
213
|
+
type: String,
|
214
|
+
default: "Forgot login form"
|
271
215
|
},
|
272
216
|
/**
|
273
217
|
* properties for CmdHeadline-component for login-form
|
@@ -281,13 +225,7 @@ export default {
|
|
281
225
|
*/
|
282
226
|
cmdHeadlineSendLoginForm: {
|
283
227
|
type: Object,
|
284
|
-
|
285
|
-
return {
|
286
|
-
show: true,
|
287
|
-
headlineText: "Send Login",
|
288
|
-
headlineLevel: 2
|
289
|
-
}
|
290
|
-
}
|
228
|
+
required: false
|
291
229
|
},
|
292
230
|
/**
|
293
231
|
* properties for CmdFormElement-component for username-field
|
@@ -302,7 +240,8 @@ export default {
|
|
302
240
|
placeholder: "Type in username",
|
303
241
|
innerIconClass: "icon-user-profile",
|
304
242
|
name: "login-username",
|
305
|
-
id: "login-username"
|
243
|
+
id: "login-username",
|
244
|
+
required: true
|
306
245
|
}
|
307
246
|
}
|
308
247
|
},
|
@@ -319,7 +258,8 @@ export default {
|
|
319
258
|
placeholder: "Type in password",
|
320
259
|
innerIconClass: "icon-security-settings",
|
321
260
|
name: "login-password",
|
322
|
-
id: "login-password"
|
261
|
+
id: "login-password",
|
262
|
+
required: true
|
323
263
|
}
|
324
264
|
}
|
325
265
|
},
|
@@ -336,7 +276,8 @@ export default {
|
|
336
276
|
placeholder: "Type in email-address you are registered with",
|
337
277
|
innerIconClass: "icon-mail",
|
338
278
|
name: "login-send-login",
|
339
|
-
id: "login-send-login"
|
279
|
+
id: "login-send-login",
|
280
|
+
required: true
|
340
281
|
}
|
341
282
|
}
|
342
283
|
},
|
@@ -416,6 +357,30 @@ export default {
|
|
416
357
|
}
|
417
358
|
}
|
418
359
|
},
|
360
|
+
computed: {
|
361
|
+
buttonLoginDisabled() {
|
362
|
+
return !(this.usernameValidationStatus && this.passwordValidationStatus)
|
363
|
+
},
|
364
|
+
buttonSendLoginDisabled() {
|
365
|
+
return !this.emailValidationStatus
|
366
|
+
},
|
367
|
+
username: {
|
368
|
+
get() {
|
369
|
+
return this.modelValue.username
|
370
|
+
},
|
371
|
+
set(value) {
|
372
|
+
this.$emit("update:modelValue", {username: value, password: this.password})
|
373
|
+
}
|
374
|
+
},
|
375
|
+
password: {
|
376
|
+
get() {
|
377
|
+
return this.modelValue.password
|
378
|
+
},
|
379
|
+
set(value) {
|
380
|
+
this.$emit("update:modelValue", {username: this.username, password: value})
|
381
|
+
}
|
382
|
+
}
|
383
|
+
},
|
419
384
|
methods: {
|
420
385
|
modelChange() {
|
421
386
|
this.$emit("update:modelValue", { "username": this.username, "password": this.password })
|
@@ -425,6 +390,18 @@ export default {
|
|
425
390
|
},
|
426
391
|
getRoute(language) {
|
427
392
|
return getRoute(language)
|
393
|
+
},
|
394
|
+
checkValidationStatus(event, fieldType) {
|
395
|
+
if (event == null) {
|
396
|
+
return
|
397
|
+
}
|
398
|
+
if(fieldType === "username") {
|
399
|
+
this.usernameValidationStatus = event === "success";
|
400
|
+
} else if(fieldType === "password") {
|
401
|
+
this.passwordValidationStatus = event === "success";
|
402
|
+
} else {
|
403
|
+
this.emailValidationStatus = event === "success";
|
404
|
+
}
|
428
405
|
}
|
429
406
|
},
|
430
407
|
watch: {
|
@@ -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,205 @@
|
|
1
|
+
<template>
|
2
|
+
<fieldset class="cmd-newsletter-subscription flex-container">
|
3
|
+
<!-- begin legend -->
|
4
|
+
<legend :class="{'hidden' : !showLegend}">{{ textLegend }}</legend>
|
5
|
+
<!-- end legend -->
|
6
|
+
|
7
|
+
<!-- begin cmd-input-group -->
|
8
|
+
<CmdInputGroup
|
9
|
+
inputTypes="radio"
|
10
|
+
:labelText="cmdInputGroup.labelText"
|
11
|
+
:showLabel="cmdInputGroup.showLabel"
|
12
|
+
:inputElements="cmdInputGroup.inputElements"
|
13
|
+
v-model="subscription"
|
14
|
+
/>
|
15
|
+
<!-- end cmd-input-group -->
|
16
|
+
|
17
|
+
<!-- begin cmd-form-element -->
|
18
|
+
<CmdFormElement
|
19
|
+
element="input"
|
20
|
+
type="email"
|
21
|
+
:placeholder="cmdFormElementEmail.placeholder"
|
22
|
+
:labelText="cmdFormElementEmail.labelText"
|
23
|
+
id="cmd-email-newsletter-subscription"
|
24
|
+
:required="cmdFormElementEmail.required"
|
25
|
+
:useCustomTooltip="cmdFormElementEmail.useCustomTooltip"
|
26
|
+
v-model="email"
|
27
|
+
@validationStatusChange="checkValidationStatus"
|
28
|
+
/>
|
29
|
+
<!-- end cmd-form-element -->
|
30
|
+
|
31
|
+
<div class="button-wrapper">
|
32
|
+
<!-- begin cmd-form-element -->
|
33
|
+
<CmdFormElement
|
34
|
+
element="button"
|
35
|
+
:type="buttonType"
|
36
|
+
:disabled="buttonDisabled"
|
37
|
+
:nativeButton="cmdFormElementSubmit"
|
38
|
+
@click="sendData"
|
39
|
+
/>
|
40
|
+
<!-- end cmd-form-element -->
|
41
|
+
</div>
|
42
|
+
</fieldset>
|
43
|
+
</template>
|
44
|
+
|
45
|
+
<script>
|
46
|
+
// import components
|
47
|
+
import CmdFormElement from "./CmdFormElement"
|
48
|
+
import CmdInputGroup from "./CmdInputGroup"
|
49
|
+
|
50
|
+
export default {
|
51
|
+
name: "CmdNewsletterSubscription",
|
52
|
+
emits: ["button-click"],
|
53
|
+
components: {
|
54
|
+
CmdFormElement,
|
55
|
+
CmdInputGroup
|
56
|
+
},
|
57
|
+
data() {
|
58
|
+
return {
|
59
|
+
buttonDisabled: true
|
60
|
+
}
|
61
|
+
},
|
62
|
+
props: {
|
63
|
+
/**
|
64
|
+
* set value for v-model (must be named modelValue in vue3 if default v-model should be used)
|
65
|
+
*/
|
66
|
+
modelValue: {
|
67
|
+
type: Object,
|
68
|
+
default() {
|
69
|
+
return {
|
70
|
+
subscription: "subscribe",
|
71
|
+
email: ""
|
72
|
+
}
|
73
|
+
}
|
74
|
+
},
|
75
|
+
buttonType: {
|
76
|
+
type: String,
|
77
|
+
default: "button",
|
78
|
+
validator(value) {
|
79
|
+
return value === "submit" || value === "button"
|
80
|
+
}
|
81
|
+
},
|
82
|
+
/**
|
83
|
+
* text used as legend for login-fieldset
|
84
|
+
*
|
85
|
+
* @requiredForAccessibility: true
|
86
|
+
*/
|
87
|
+
textLegend: {
|
88
|
+
type: String,
|
89
|
+
default: "Stay up-to-date"
|
90
|
+
},
|
91
|
+
/**
|
92
|
+
* toggle legend visibility
|
93
|
+
*/
|
94
|
+
showLegend: {
|
95
|
+
type: Boolean,
|
96
|
+
default: true
|
97
|
+
},
|
98
|
+
/**
|
99
|
+
* properties for CmdInputGroup-component
|
100
|
+
*/
|
101
|
+
cmdInputGroup: {
|
102
|
+
type: Object,
|
103
|
+
default: function () {
|
104
|
+
return {
|
105
|
+
labelText: "Choose option",
|
106
|
+
showLabel: false,
|
107
|
+
inputElements: [
|
108
|
+
{
|
109
|
+
labelText: "Subscribe",
|
110
|
+
id: "radio-subscribe",
|
111
|
+
name: "cmd-subscribe-group",
|
112
|
+
value: "subscribe"
|
113
|
+
},
|
114
|
+
{
|
115
|
+
labelText: "Unsubscribe",
|
116
|
+
id: "radio-unsubscribe",
|
117
|
+
name: "cmd-subscribe-group",
|
118
|
+
value: "unsubscribe"
|
119
|
+
}
|
120
|
+
]
|
121
|
+
}
|
122
|
+
}
|
123
|
+
},
|
124
|
+
/**
|
125
|
+
* properties for CmdFormElement-component for email-field
|
126
|
+
*/
|
127
|
+
cmdFormElementEmail: {
|
128
|
+
type: Object,
|
129
|
+
default: function () {
|
130
|
+
return {
|
131
|
+
labelText: "Email-Address:",
|
132
|
+
placeholder: "Enter your email-address",
|
133
|
+
required: true
|
134
|
+
}
|
135
|
+
}
|
136
|
+
},
|
137
|
+
/**
|
138
|
+
* properties for CmdFormElement-component for submit-button
|
139
|
+
*/
|
140
|
+
cmdFormElementSubmit: {
|
141
|
+
type: Object,
|
142
|
+
default: function () {
|
143
|
+
return {
|
144
|
+
text: "Submit",
|
145
|
+
icon: {
|
146
|
+
show: true,
|
147
|
+
iconClass: "icon-message-send",
|
148
|
+
position: "before",
|
149
|
+
tooltip: ""
|
150
|
+
}
|
151
|
+
}
|
152
|
+
}
|
153
|
+
}
|
154
|
+
},
|
155
|
+
computed: {
|
156
|
+
subscription: {
|
157
|
+
get() {
|
158
|
+
return this.modelValue.subscription || "subscribe"
|
159
|
+
},
|
160
|
+
set(value) {
|
161
|
+
this.$emit("update:modelValue", {subscription: value, email: this.email})
|
162
|
+
}
|
163
|
+
},
|
164
|
+
email: {
|
165
|
+
get() {
|
166
|
+
return this.modelValue.email
|
167
|
+
},
|
168
|
+
set(value) {
|
169
|
+
this.$emit("update:modelValue", {subscription: this.subscription, email: value})
|
170
|
+
}
|
171
|
+
}
|
172
|
+
},
|
173
|
+
methods: {
|
174
|
+
sendData(event) {
|
175
|
+
this.$emit("button-click", {subscription: this.subscription, email: this.email, originalEvent: event})
|
176
|
+
},
|
177
|
+
checkValidationStatus(event) {
|
178
|
+
this.buttonDisabled = event !== "success"
|
179
|
+
}
|
180
|
+
}
|
181
|
+
}
|
182
|
+
</script>
|
183
|
+
|
184
|
+
<style lang="scss">
|
185
|
+
/* begin cmd-back-to-top-button ---------------------------------------------------------------------------------------- */
|
186
|
+
.cmd-back-to-top-button {
|
187
|
+
padding: var(--default-padding);
|
188
|
+
display: inline-block;
|
189
|
+
position: fixed;
|
190
|
+
right: 1rem;
|
191
|
+
bottom: 1rem;
|
192
|
+
text-decoration: none;
|
193
|
+
z-index: 1000;
|
194
|
+
border: var(--default-border);
|
195
|
+
background: var(--color-scheme-background-color);
|
196
|
+
border-radius: var(--full-circle);
|
197
|
+
|
198
|
+
&:hover, &:active, &:focus {
|
199
|
+
border-color: var(--primary-color);
|
200
|
+
transition: var(--default-transition);
|
201
|
+
}
|
202
|
+
}
|
203
|
+
|
204
|
+
/* cmd-back-to-top-button ------------------------------------------------------------------------------------------ */
|
205
|
+
</style>
|