comand-component-library 4.0.16 → 4.0.18

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,18 +1,23 @@
1
1
  <template>
2
2
  <div class="cmd-pages-basic-form">
3
- <!-- being CmdForm -->
4
- <CmdForm @submit="onSubmit"
5
- novalidate="novalidate"
6
- :textLegend="getMessage('basic_form.legend')"
7
- :submitButton="submitButton"
3
+ <!-- begin CmdHeadline -->
4
+ <CmdHeadline v-if="cmdHeadline" v-bind="cmdHeadline" />
5
+ <!-- end CmdHeadline -->
6
+
7
+ <!-- begin CmdForm -->
8
+ <CmdForm
9
+ @submit="onSubmit"
10
+ novalidate="novalidate"
11
+ :textLegend="getMessage('basic_form.legend')"
12
+ :submitButton="submitButton"
8
13
  >
9
- <div v-if="configuration.salutation" class="flex-container no-flex">
14
+ <div v-if="configuration.salutation" class="flex-container no-flex order-male-female">
10
15
  <!-- begin cmd-form-element -->
11
16
  <CmdFormElement
12
17
  element="input"
13
18
  type="radio"
14
19
  :labelText="getMessage('basic_form.labeltext.salutation_male')"
15
- :name="configuration.salutation?.name || salutation"
20
+ :name="configuration.salutation?.name || 'salutation'"
16
21
  inputValue="m"
17
22
  :replaceInputType="configuration.salutation?.replaceInputType"
18
23
  v-model="formData.salutation"
@@ -25,7 +30,7 @@
25
30
  element="input"
26
31
  type="radio"
27
32
  :labelText="getMessage('basic_form.labeltext.salutation_female')"
28
- :name="configuration.salutation?.name || salutation"
33
+ :name="configuration.salutation?.name || 'salutation'"
29
34
  inputValue="f"
30
35
  :replaceInputType="configuration.salutation?.replaceInputType"
31
36
  v-model="formData.salutation"
@@ -38,7 +43,7 @@
38
43
  <slot name="top"></slot>
39
44
  <!-- end slot (top) -->
40
45
 
41
- <div v-if="configuration.lastName || configuration.firstName" class="flex-container">
46
+ <div v-if="configuration.lastName || configuration.firstName" class="flex-container order-lastname-firstname">
42
47
  <!-- begin cmd-form-element -->
43
48
  <CmdFormElement
44
49
  v-if="configuration.lastName"
@@ -71,7 +76,7 @@
71
76
  />
72
77
  <!-- end cmd-form-element -->
73
78
  </div>
74
- <div v-if="configuration.email || configuration.phone" class="flex-container">
79
+ <div v-if="configuration.email || configuration.phone" class="flex-container order-phone-email">
75
80
  <!-- begin cmd-form-element -->
76
81
  <CmdFormElement
77
82
  v-if="configuration.email"
@@ -105,7 +110,22 @@
105
110
  <!-- end cmd-form-element -->
106
111
  </div>
107
112
 
108
- <div v-if="configuration.streetNo || configuration.zip || configuration.city" class="flex-container">
113
+ <div v-if="configuration.streetNo || configuration.streetNo || (configuration.zip && configuration.city)" class="flex-container">
114
+ <!-- begin cmd-form-element -->
115
+ <CmdFormElement
116
+ v-if="configuration.country"
117
+ element="select"
118
+ :labelText="getMessage('basic_form.labeltext.country')"
119
+ :selectOptions="configuration.country?.selectOptions"
120
+ :required="configuration.country?.required"
121
+ :name="configuration.country?.name || 'country'"
122
+ v-model="formData.country.value"
123
+ :status="formData.country.error ? 'error' : ''"
124
+ @validate="onValidate"
125
+ @update:modelValue="onCountrySelect"
126
+ />
127
+ <!-- end cmd-form-element -->
128
+
109
129
  <!-- begin cmd-form-element -->
110
130
  <CmdFormElement
111
131
  v-if="configuration.streetNo"
@@ -121,11 +141,27 @@
121
141
  />
122
142
  <!-- end cmd-form-element -->
123
143
 
124
- <div class="input-wrapper">
144
+ <!-- begin cmd-form-element -->
145
+ <CmdFormElement
146
+ v-if="configuration.pobox"
147
+ element="input"
148
+ :type="configuration.pobox?.type || 'text'"
149
+ :labelText="getMessage('basic_form.labeltext.pobox')"
150
+ :placeholder="getMessage('basic_form.placeholder.pobox')"
151
+ :required="configuration.pobox?.required"
152
+ :name="configuration.pobox?.name || 'pobox'"
153
+ v-model="formData.pobox.value"
154
+ :status="formData.pobox.error ? 'error' : ''"
155
+ @validate="onValidate"
156
+ />
157
+ <!-- end cmd-form-element -->
158
+
159
+ <div class="input-wrapper" :class="cityBeforeZip ? 'order-city-zip' : 'order-zip-city'">
125
160
  <!-- begin cmd-form-element -->
126
161
  <CmdFormElement
127
162
  v-if="configuration.zip"
128
163
  element="input"
164
+ class="input-zip"
129
165
  :type="configuration.zip?.type || 'number'"
130
166
  :labelText="getMessage('basic_form.labeltext.zip')"
131
167
  :placeholder="getMessage('basic_form.placeholder.zip')"
@@ -210,9 +246,9 @@
210
246
 
211
247
  <script>
212
248
  // import mixins
213
- import I18n from "../mixins/I18n"
214
- import DefaultMessageProperties from "../mixins/pages/BasicForm/DefaultMessageProperties"
215
- import FieldValidation from "../mixins/FieldValidation"
249
+ import I18n from "../mixins/I18n.js"
250
+ import DefaultMessageProperties from "../mixins/CmdBasicForm/DefaultMessageProperties.js"
251
+ import FieldValidation from "../mixins/FieldValidation.js"
216
252
 
217
253
  export default {
218
254
  mixins: [
@@ -227,7 +263,6 @@ export default {
227
263
  },
228
264
  data() {
229
265
  return {
230
- //validator: new ContactFormValidator(name => this.label(name)),
231
266
  formData: {
232
267
  salutation: this.configuration.salutation.default,
233
268
  lastName: {value: ''},
@@ -237,18 +272,13 @@ export default {
237
272
  streetNo: {value: ''},
238
273
  zip: {value: ''},
239
274
  city: {value: ''},
275
+ pobox: {value: ''},
276
+ country: {value: ''},
240
277
  additionalAddressInfo: {value: ''},
241
278
  additionalText: {value: ''},
242
279
  acceptPrivacy: {value: false}
243
280
  },
244
- nativeButton: {
245
- icon: {
246
- show: true,
247
- iconClass: "icon-message-send",
248
- tooltip: "Send message"
249
- },
250
- text: "Send"
251
- }
281
+ cityBeforeZip: this.showCityBeforeZip
252
282
  }
253
283
  },
254
284
  props: {
@@ -281,6 +311,24 @@ export default {
281
311
  required: false,
282
312
  type: "phone"
283
313
  },
314
+ country: {
315
+ required: false,
316
+ element: "select",
317
+ selectOptions: [
318
+ {
319
+ text: "Please select...",
320
+ value: ""
321
+ },
322
+ {
323
+ text: "United States",
324
+ value: "us"
325
+ },
326
+ {
327
+ text: "Germany",
328
+ value: "de"
329
+ },
330
+ ]
331
+ },
284
332
  streetNo: {
285
333
  required: false,
286
334
  type: "text"
@@ -308,6 +356,13 @@ export default {
308
356
  }
309
357
  }
310
358
  },
359
+ /**
360
+ * activate to show city first/left then zip next/right
361
+ */
362
+ showCityBeforeZip: {
363
+ type: Boolean,
364
+ default: false
365
+ },
311
366
  /**
312
367
  * receiver e-mail-address the form is sent to
313
368
  */
@@ -329,12 +384,24 @@ export default {
329
384
  primary: true
330
385
  }
331
386
  }
387
+ },
388
+ /**
389
+ * properties for CmdHeadline-component
390
+ */
391
+ cmdHeadline: {
392
+ type: Object,
393
+ default() {
394
+ return {
395
+ headlineText: "Basic Form",
396
+ headlineLevel: 3
397
+ }
398
+ }
332
399
  }
333
400
  },
334
401
  mounted() {
335
- this.$refs.dataPrivacy?.querySelector('.fancybox')?.addEventListener('click', event => {
402
+ this.$refs.dataPrivacy?.querySelector(".fancybox")?.addEventListener("click", event => {
336
403
  event.preventDefault()
337
- openFancyBox({url: event.target.getAttribute('href')})
404
+ openFancyBox({url: event.target.getAttribute("href")})
338
405
  })
339
406
  },
340
407
  methods: {
@@ -349,6 +416,9 @@ export default {
349
416
 
350
417
  event.preventDefault();
351
418
  },
419
+ onCountrySelect(event) {
420
+ this.cityBeforeZip = event === 'us' || event === 'uk';
421
+ },
352
422
  onValidate() {
353
423
  this.formData = Object.assign({}, this.validator.validate(this.formData));
354
424
  },
@@ -361,6 +431,11 @@ export default {
361
431
  openDataPrivacy(url) {
362
432
  openFancyBox({url})
363
433
  }
434
+ },
435
+ watch: {
436
+ showCityBeforeZip() {
437
+ this.cityBeforeZip = this.showCityBeforeZip
438
+ }
364
439
  }
365
440
  }
366
441
  </script>
@@ -369,6 +444,14 @@ export default {
369
444
  .cmd-pages-basic-form {
370
445
  fieldset {
371
446
  margin: 0;
447
+
448
+ .order-city-zip {
449
+ flex-direction: row-reverse;
450
+ }
451
+
452
+ .input-zip {
453
+ max-width: 30%;
454
+ }
372
455
  }
373
456
  }
374
457
  </style>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <ul class="cmd-breadcrumbs">
3
- <li v-if="breadcrumbLabel">{{ breadcrumbLabel }}</li>
3
+ <li v-if="breadcrumbLabel" class="breadcrumb-label">{{ breadcrumbLabel }}</li>
4
4
  <li v-for="(link, index) in breadcrumbLinks || []" :key="index">
5
5
  <!-- begin type 'href' -->
6
6
  <a v-if="link.type === 'href'" :href="link.path">
@@ -84,7 +84,7 @@ export default {
84
84
  padding: 0 calc(var(--default-padding) / 2);
85
85
  }
86
86
 
87
- &:first-child {
87
+ &.breadcrumb-label {
88
88
  margin-right: calc(var(--default-margin) / 2);
89
89
  }
90
90
 
@@ -73,7 +73,7 @@
73
73
  <!-- end CmdImage -->
74
74
  </div>
75
75
  <div v-else-if="fancyBoxContent" class="content" v-html="fancyBoxContent"></div>
76
- <div v-else-if="fancyBoxElements" class="content"></div>
76
+ <div v-else-if="fancyBoxElements" class="content" ref="elements"></div>
77
77
  <div v-else-if="fancyBoxGallery" class="content">
78
78
  <!-- begin CmdSlideButton -->
79
79
  <CmdSlideButton @click.prevent="showPrevItem" slideButtonType="prev"/>
@@ -259,7 +259,7 @@ const FancyBox = defineComponent({
259
259
  required: false
260
260
  },
261
261
  /**
262
- * list of show elements (not images)
262
+ * list of shown elements (not images)
263
263
  */
264
264
  elements: {
265
265
  type: Array,
@@ -382,7 +382,7 @@ const FancyBox = defineComponent({
382
382
  } else if (this.elements) {
383
383
  this.fancyBoxElements = this.elements.map(el => el.cloneNode(true))
384
384
  this.$nextTick(() => {
385
- this.$el.querySelector(".content").append(...this.fancyBoxElements)
385
+ this.$refs.elements.append(...this.fancyBoxElements)
386
386
  })
387
387
  }
388
388
  },
@@ -874,7 +874,6 @@ export default {
874
874
  }
875
875
 
876
876
  &.has-state, & + .cmd-tooltip {
877
-
878
877
  &.error {
879
878
  * {
880
879
  --status-color: var(--error-color);
@@ -902,6 +901,12 @@ export default {
902
901
  ~ .label-text span {
903
902
  color: var(--hyperlink-color);
904
903
  }
904
+
905
+ &:hover, &:active, &:focus {
906
+ ~ .label-text span {
907
+ color: var(--hyperlink-color-highlighted);
908
+ }
909
+ }
905
910
  }
906
911
 
907
912
  &.inline {
@@ -14,7 +14,7 @@
14
14
  <!-- end pre-headline-text -->
15
15
 
16
16
  <span>
17
- <!-- being slot -->
17
+ <!-- begin slot -->
18
18
  <slot>{{ headlineText }}</slot>
19
19
  <!-- end slot -->
20
20
  </span>
@@ -27,7 +27,7 @@
27
27
  <!-- end CmdIcon -->
28
28
 
29
29
  <span>
30
- <!-- being slot -->
30
+ <!-- begin slot -->
31
31
  <slot>{{ headlineText }}</slot>
32
32
  <!-- end slot -->
33
33
  </span>
@@ -74,13 +74,13 @@
74
74
  <span class="pre-headline-text">{{ preHeadlineText }}</span>
75
75
  <!-- end pre-headline-text -->
76
76
 
77
- <!-- being slot -->
77
+ <!-- begin slot -->
78
78
  <slot>{{ headlineText }}</slot>
79
79
  <!-- end slot -->
80
80
  </component>
81
81
  </template>
82
82
  <component v-else-if="headlineText" :is="headlineTag">
83
- <!-- being slot -->
83
+ <!-- begin slot -->
84
84
  <slot>{{ headlineText }}</slot>
85
85
  <!-- end slot -->
86
86
  </component>
@@ -9,7 +9,7 @@
9
9
  />
10
10
  <!-- end CmdHeadline -->
11
11
 
12
- <!-- being form elements -->
12
+ <!-- begin form elements -->
13
13
  <div class="flex-container">
14
14
  <!-- begin CmdFormElement -->
15
15
  <CmdFormElement
@@ -96,7 +96,7 @@
96
96
  <!-- end type === router -->
97
97
 
98
98
  <!-- begin sub-level 2 -->
99
- <ul v-if="navigationSubEntry.subentries" :aria-expanded="openSubentry ? 'true' : 'false'">
99
+ <ul v-if="navigationSubEntry.subentries?.length" :aria-expanded="openSubentry ? 'true' : 'false'">
100
100
  <li v-for="(navigationSubSubEntry, subsubindex) in navigationSubEntry.subentries"
101
101
  :key="subsubindex">
102
102
  <!-- begin type === href -->
@@ -16,6 +16,7 @@
16
16
  v-if="buttonPrintView.show"
17
17
  :class="['button', {'primary': buttonPrintView.primary}]"
18
18
  :title="buttonPrintView.text ? buttonPrintView.icon?.tooltip : null"
19
+ @click="showFancyBox"
19
20
  >
20
21
  <span v-if="buttonPrintView.icon?.show" :class="buttonPrintView.icon?.iconClass"></span>
21
22
  <span v-if="buttonPrintView.text">{{buttonPrintView.text}}</span>
@@ -26,6 +27,8 @@
26
27
  </template>
27
28
 
28
29
  <script>
30
+ import { openFancyBox } from "./CmdFancyBox.vue"
31
+
29
32
  export default {
30
33
  name: "CmdPageFooter",
31
34
  props: {
@@ -60,6 +63,38 @@ export default {
60
63
  cmdSocialNetworks: {
61
64
  type: Array,
62
65
  required: false
66
+ },
67
+ /**
68
+ * properties for CmdFancyBox-component
69
+ */
70
+ cmdFancyBox: {
71
+ type: Object,
72
+ default() {
73
+ return {
74
+ showPrintButtons: true,
75
+ defaultAriaLabelText: "print-preview"
76
+ }
77
+ }
78
+ }
79
+ },
80
+ methods: {
81
+ showFancyBox() {
82
+ let elements = []
83
+ if(typeof this.cmdFancyBox.elements === "function") {
84
+ elements = this.cmdFancyBox.elements()
85
+ } else {
86
+ elements = [document.querySelector("main")]
87
+ }
88
+
89
+ openFancyBox({
90
+ elements: elements,
91
+ showPrintButtons: this.cmdFancyBox.showPrintButtons,
92
+ defaultAriaLabelText: this.cmdFancyBox.defaultAriaLabelText,
93
+ cmdHeadline: this.cmdFancyBox.cmdHeadline,
94
+ showOverlay: this.cmdFancyBox.showOverlay,
95
+ showSubmitButtons: this.cmdFancyBox.showSubmitButtons,
96
+ allowEscapeKey: this.cmdFancyBox.allowEscapeKey
97
+ })
63
98
  }
64
99
  }
65
100
  }
@@ -90,6 +125,7 @@ export default {
90
125
  justify-content: flex-end;
91
126
  margin-left: auto;
92
127
  gap: calc(var(--default-gap) / 2);
128
+ flex: none;
93
129
  }
94
130
  }
95
131
  /* end cmd-page-footer -------------------------------------------------------------------------------------------- */
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <header class="cmd-page-header flex-container">
2
+ <header v-if="cmdBreadcrumbs || cmdHeadline || $slots.default" class="cmd-page-header flex-container">
3
3
  <div v-if="cmdBreadcrumbs || cmdHeadline" class="headline-wrapper flex-container vertical">
4
4
  <!-- begin CmdBreadcrumbs -->
5
5
  <CmdBreadcrumbs v-if="cmdBreadcrumbs" v-bind="cmdBreadcrumbs" />
@@ -11,7 +11,7 @@
11
11
  </div>
12
12
 
13
13
  <!-- begin slot -->
14
- <slot></slot>
14
+ <slot v-if="$slots.default"></slot>
15
15
  <!-- end slot -->
16
16
  </header>
17
17
  </template>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="cmd-site-footer">
2
+ <div class="cmd-site-footer site-footer">
3
3
  <footer :class="['flex-container', {vertical: orientation === 'vertical'}]">
4
4
  <slot></slot>
5
5
  </footer>
@@ -31,8 +31,6 @@ export default {
31
31
  /* begin cmd-site-footer ---------------------------------------------------------------------------------------- */
32
32
  .cmd-site-footer {
33
33
  padding: var(--grid-gap) 0;
34
- border-top: var(--default-border);
35
- background: var(--default-background);
36
34
  margin-top: auto;
37
35
  flex: none;
38
36
 
@@ -178,12 +178,12 @@ export default {
178
178
  <style>
179
179
  /* begin cmd-site-header ---------------------------------------------------------------------------------------- */
180
180
  .cmd-site-header {
181
+ --logo-width-on-scroll: 50%;
182
+
181
183
  grid-area: site-header;
182
184
  display: flex;
183
185
  flex-direction: column;
184
186
  flex: none;
185
- border-bottom: var(--default-border);
186
- background: var(--color-scheme-background);
187
187
 
188
188
  &.sticky {
189
189
  position: sticky;
@@ -199,6 +199,7 @@ export default {
199
199
  transform-origin: top left;
200
200
  transition: var(--header-scroll-animation);
201
201
  margin: 0;
202
+ width: 100%;
202
203
  }
203
204
  }
204
205
  }
@@ -212,7 +213,7 @@ export default {
212
213
  figure {
213
214
  img {
214
215
  transition: var(--header-scroll-animation);
215
- height: 5rem;
216
+ width: var(--logo-width-on-scroll);
216
217
  }
217
218
  }
218
219
  }
@@ -223,12 +224,12 @@ export default {
223
224
  header, .cmd-main-navigation nav, .cmd-list-of-links {
224
225
  max-width: var(--max-width);
225
226
  width: 100%; /* stretch flex-item */
226
- margin: 0 auto;
227
227
  padding: 0 var(--default-padding);
228
228
  }
229
229
 
230
230
  .cmd-main-navigation nav {
231
231
  width: auto;
232
+ margin: 0 0 0 auto; /* align nav to right */
232
233
  }
233
234
 
234
235
  .top-header {
@@ -3,7 +3,7 @@
3
3
  @click.prevent
4
4
  :class="['cmd-slide-button', 'button', 'keep-behavior-on-small-devices', slideButtonType]"
5
5
  :title="getDirection.tooltip">
6
- <!-- being CmdIcon -->
6
+ <!-- begin CmdIcon -->
7
7
  <CmdIcon :iconClass="getDirection.iconClass || 'next'" />
8
8
  <!-- end CmdIcon -->
9
9
  </a>
@@ -95,7 +95,7 @@ export default {
95
95
  a:not([class*="active"]) {
96
96
  filter: contrast(.5);
97
97
 
98
- &:hover, &:focus-visible, &:active, &.active {
98
+ &:hover, &:focus-visible, &:active, &.active, &.router-link-active {
99
99
  filter: none;
100
100
  padding: 0; /* overwrite default settings from frontend-framework for .active */
101
101
  background: none; /* overwrite default settings from frontend-framework for .active */
package/src/index.js CHANGED
@@ -51,7 +51,7 @@ export { default as CmdWidthLimitationWrapper } from '@/components/CmdWidthLimit
51
51
  export { default as EditComponentWrapper } from '@/components/EditComponentWrapper.vue'
52
52
 
53
53
  // export page-components
54
- export { default as BasicForm } from '@/pages/BasicForm.vue'
54
+ export { default as BasicForm } from '@/components/CmdBasicForm.vue'
55
55
  export { default as ContactInformation } from '@/pages/ContactInformation.vue'
56
56
  export { default as MultipleBoxWrapper } from '@/pages/MultipleBoxWrapper.vue'
57
57
  export { default as MultipleListsOfLinks } from '@/pages/MultipleListsOfLinks.vue'
@@ -19,9 +19,12 @@ export default {
19
19
  "basic_form.placeholder.zip": "Zip:",
20
20
  "basic_form.labeltext.city": "City:",
21
21
  "basic_form.placeholder.city": "City:",
22
- "basic_form.labeltext.additional_address_info": "Additional address information",
22
+ "basic_form.labeltext.pobox": "PO Box:",
23
+ "basic_form.placeholder.pobox": "PO Box:",
24
+ "basic_form.labeltext.country": "Country:",
25
+ "basic_form.labeltext.additional_address_info": "Additional address information:",
23
26
  "basic_form.placeholder.additional_address_info": "Additional address information",
24
- "basic_form.labeltext.additional_text": "Additional text",
27
+ "basic_form.labeltext.additional_text": "Additional text:",
25
28
  "basic_form.placeholder.additional_text": "Additional text",
26
29
  "basic_form.labeltext.data_privacy": "I accept handling and saving of my personal data a mentioned in the <a href='/content/data-privacy-en.html' class='fancybox'>private policy</a>."
27
30
  }
@@ -1,12 +1,4 @@
1
1
  <template>
2
- <!-- begin basic-form ------------------------------------------------------------------------------------------------------------------------------------------------------->
3
- <CmdWidthLimitationWrapper>
4
- <h2 class="headline-demopage" id="section-basic-form">
5
- <span>Basic Form</span>
6
- </h2>
7
- <BasicForm :formAction="basicForm.formAction" />
8
- </CmdWidthLimitationWrapper>
9
- <!-- end basic-form ------------------------------------------------------------------------------------------------------------------------------------------------------->
10
2
 
11
3
  <!-- begin basic-form ------------------------------------------------------------------------------------------------------------------------------------------------------->
12
4
  <CmdWidthLimitationWrapper>
@@ -66,41 +58,7 @@ export default {
66
58
  faqsData,
67
59
  boxesTeamOverviewData,
68
60
  listOfDownloadsData,
69
- listOfSiteLinksData,
70
- basicForm: {
71
- configuration: {
72
- salutation: {
73
- name: "salutation",
74
- default: "m",
75
- replaceInputType: true
76
- },
77
- lastName: {
78
- name: "surname",
79
- required: true,
80
- type: "text"
81
- },
82
- firstName: {
83
- required: false,
84
- type: "text"
85
- },
86
- email: {
87
- required: true,
88
- type: "email"
89
- },
90
- phone: {
91
- required: false,
92
- type: "phone"
93
- },
94
- additionalText: {
95
- required: false,
96
- element: "textarea"
97
- },
98
- acceptPrivacy: {
99
- required: true,
100
- replaceInputType: true
101
- }
102
- }
103
- }
61
+ listOfSiteLinksData
104
62
  }
105
63
  }
106
64
  }