comand-component-library 4.0.14 → 4.0.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,14 @@
1
1
  <template>
2
2
  <div
3
- :class="['cmd-site-header site-header', {sticky: sticky, 'navigation-inline': navigationInline, 'off-canvas-right': cmdMainNavigation?.offcanvasPosition === 'right'}]"
3
+ ref="site-header"
4
+ :class="[
5
+ 'cmd-site-header site-header',
6
+ {
7
+ sticky: sticky,
8
+ 'navigation-inline': navigationInline,
9
+ 'off-canvas-right': cmdMainNavigation?.offcanvasPosition === 'right'
10
+ }
11
+ ]"
4
12
  role="banner">
5
13
  <!-- begin slot for elements above header -->
6
14
  <div v-if="$slots.topheader" class="top-header">
@@ -8,6 +16,7 @@
8
16
  </div>
9
17
  <!-- end slot for elements above header -->
10
18
 
19
+ <!-- begin (inner) header -->
11
20
  <header
12
21
  :class="[
13
22
  useGrid ? 'grid-container-create-columns': 'flex-container',
@@ -27,6 +36,7 @@
27
36
  <CmdCompanyLogo
28
37
  v-if="cmdCompanyLogo"
29
38
  v-bind="cmdCompanyLogo"
39
+ @image-loaded="onImageLoaded"
30
40
  />
31
41
  <!-- end CmdCompanyLogo -->
32
42
 
@@ -43,6 +53,7 @@
43
53
  </template>
44
54
  <!-- end content given by data -->
45
55
  </header>
56
+ <!-- end (inner) header -->
46
57
 
47
58
  <!-- begin CmdMainNavigation -->
48
59
  <CmdMainNavigation
@@ -61,6 +72,11 @@
61
72
  export default {
62
73
  name: "CmdSiteHeader",
63
74
  emits: ["offcanvas"],
75
+ data() {
76
+ return {
77
+ defaultLogoHeight: ""
78
+ }
79
+ },
64
80
  props: {
65
81
  /**
66
82
  * use only if default-button of inner navigation-component should not be used
@@ -85,6 +101,24 @@ export default {
85
101
  type: Boolean,
86
102
  default: false
87
103
  },
104
+ /**
105
+ * set if header (incl. logo) should be resized if user scrolls page
106
+ *
107
+ * scrollContainerToResizeHeader-property must be defined
108
+ */
109
+ resizeHeaderOnScroll: {
110
+ type: Boolean,
111
+ default: true
112
+ },
113
+ /**
114
+ * set selector the user scrolls to resize header
115
+ *
116
+ * resizeHeaderOnScroll-property must be activated
117
+ */
118
+ scrollContainerToResizeHeader: {
119
+ type: String,
120
+ default: "#page-wrapper"
121
+ },
88
122
  /**
89
123
  * use a grid for positioning of inner-elements (else a flex-container will be used)
90
124
  *
@@ -109,10 +143,34 @@ export default {
109
143
  required: false
110
144
  }
111
145
  },
146
+ mounted() {
147
+ if (this.resizeHeaderOnScroll) {
148
+ const scrollContainer = document.querySelector(this.scrollContainerToResizeHeader);
149
+
150
+ scrollContainer.addEventListener("scroll", function () {
151
+ const header = document.querySelector(".cmd-site-header > header");
152
+
153
+ if (scrollContainer.scrollTop > 0) {
154
+ header.classList.add("resize-on-scroll");
155
+ } else {
156
+ header.classList.remove("resize-on-scroll");
157
+ }
158
+ });
159
+ }
160
+ },
112
161
  methods: {
162
+ onImageLoaded(event) {
163
+ this.defaultLogoHeight = (event.target.height / 10) + "rem"
164
+ },
113
165
  emitOffcanvasStatus(event) {
114
166
  this.$emit("offcanvas", event)
115
167
  }
168
+ },
169
+ watch: {
170
+ defaultLogoHeight() {
171
+ const logo = this.$refs["site-header"].querySelector(".cmd-company-logo img")
172
+ logo.style.height = this.defaultLogoHeight
173
+ }
116
174
  }
117
175
  }
118
176
  </script>
@@ -130,6 +188,36 @@ export default {
130
188
  &.sticky {
131
189
  position: sticky;
132
190
  z-index: 300;
191
+
192
+ header {
193
+ --header-scroll-animation: var(--default-transition);
194
+ transition: var(--header-scroll-animation);
195
+
196
+ .cmd-company-logo {
197
+ figure {
198
+ img {
199
+ transform-origin: top left;
200
+ transition: var(--header-scroll-animation);
201
+ margin: 0;
202
+ }
203
+ }
204
+ }
205
+
206
+ &.resize-on-scroll {
207
+ padding-top: var(--default-padding);
208
+ padding-bottom: var(--default-padding);
209
+ transition: var(--header-scroll-animation);
210
+
211
+ .cmd-company-logo {
212
+ figure {
213
+ img {
214
+ transition: var(--header-scroll-animation);
215
+ height: 5rem;
216
+ }
217
+ }
218
+ }
219
+ }
220
+ }
133
221
  }
134
222
 
135
223
  header, .cmd-main-navigation nav, .cmd-list-of-links {
@@ -150,12 +238,12 @@ export default {
150
238
  }
151
239
  }
152
240
 
153
- #main-navigation-wrapper {
241
+ .main-navigation-wrapper {
154
242
  grid-column: span var(--grid-columns);
155
243
  border-bottom: 0;
156
244
  }
157
245
 
158
- & + #main-navigation-wrapper {
246
+ & + .main-navigation-wrapper {
159
247
  nav {
160
248
  border-left: 0;
161
249
  border-right: 0;
@@ -163,7 +251,7 @@ export default {
163
251
  }
164
252
 
165
253
  /* use id to ensure high specificity */
166
- > .cmd-main-navigation#main-navigation-wrapper:last-child {
254
+ > .cmd-main-navigation.main-navigation-wrapper:last-child {
167
255
  border-bottom: 0;
168
256
  }
169
257
 
@@ -211,7 +299,7 @@ export default {
211
299
  grid-column: span var(--grid-small-span);
212
300
  }
213
301
 
214
- #main-navigation-wrapper {
302
+ .main-navigation-wrapper {
215
303
  grid-area: main-navigation;
216
304
  display: flex;
217
305
  align-items: center;
@@ -245,26 +333,28 @@ export default {
245
333
  header {
246
334
  grid-auto-rows: auto; /* items should be as large as their content */
247
335
 
248
- .cmd-main-navigation#main-navigation-wrapper {
336
+ .cmd-main-navigation.main-navigation-wrapper {
249
337
  &:not(.persist-on-mobile) {
250
338
  padding: 0;
251
339
  }
252
340
  }
253
341
 
254
- & + .cmd-main-navigation#main-navigation-wrapper {
342
+ /* main-navigation below logo */
343
+ & + .cmd-main-navigation.main-navigation-wrapper {
255
344
  padding-bottom: var(--default-padding);
256
345
  }
257
346
  }
258
347
 
348
+ /* main-navigation inline with logo */
259
349
  &.navigation-inline {
260
- .cmd-main-navigation#main-navigation-wrapper {
350
+ .cmd-main-navigation.main-navigation-wrapper {
261
351
  &:not(.persist-on-mobile) {
262
352
  padding-left: var(--default-padding);
263
353
  }
264
354
  }
265
355
 
266
356
  &.off-canvas-right {
267
- .cmd-main-navigation#main-navigation-wrapper {
357
+ .cmd-main-navigation.main-navigation-wrapper {
268
358
  &:not(.persist-on-mobile) {
269
359
  padding: 0;
270
360
  }
@@ -290,7 +380,7 @@ export default {
290
380
 
291
381
  &.navigation-inline {
292
382
  header {
293
- .cmd-company-logo, #main-navigation-wrapper {
383
+ .cmd-company-logo, .main-navigation-wrapper {
294
384
  grid-column: span calc(var(--grid-small-span) / 2);
295
385
  }
296
386
  }
@@ -4,7 +4,6 @@
4
4
  :collapsible="true"
5
5
  :cmdHeadline="{headlineText: readableName(componentName), headlineLevel: 4, headlineIcon: {iconClass: 'icon-settings-template'}}"
6
6
  :openCollapsedBox="true"
7
- :allowContentToScroll="true"
8
7
  boxBodyClass="settings-body"
9
8
  >
10
9
  <template v-slot:body>
@@ -1,13 +1,12 @@
1
1
  <template>
2
2
  <div class="cmd-pages-basic-form">
3
3
  <!-- being CmdForm -->
4
- <CmdForm :action="formAction"
5
- @submit="onSubmit"
4
+ <CmdForm @submit="onSubmit"
6
5
  novalidate="novalidate"
7
6
  :textLegend="getMessage('basic_form.legend')"
8
7
  :submitButton="submitButton"
9
8
  >
10
- <div class="flex-container no-flex">
9
+ <div v-if="configuration.salutation" class="flex-container no-flex">
11
10
  <!-- begin cmd-form-element -->
12
11
  <CmdFormElement
13
12
  element="input"
@@ -39,7 +38,7 @@
39
38
  <slot name="top"></slot>
40
39
  <!-- end slot (top) -->
41
40
 
42
- <div class="flex-container">
41
+ <div v-if="configuration.lastName || configuration.firstName" class="flex-container">
43
42
  <!-- begin cmd-form-element -->
44
43
  <CmdFormElement
45
44
  v-if="configuration.lastName"
@@ -47,7 +46,6 @@
47
46
  :type="configuration.lastName?.type || 'text'"
48
47
  iconClass="icon-user-profile"
49
48
  :labelText="getMessage('basic_form.labeltext.last_name')"
50
- :tooltipText="formData.lastName.error ? formData.lastName.errorMessage : 'Type your surname!'"
51
49
  :required="configuration.lastName?.required"
52
50
  :name="configuration.lastName?.name || 'last-name'"
53
51
  :placeholder="getMessage('basic_form.placeholder.last_name')"
@@ -64,7 +62,6 @@
64
62
  :type="configuration.firstName?.type || 'text'"
65
63
  iconClass="icon-user-profile"
66
64
  :labelText="getMessage('basic_form.labeltext.first_name')"
67
- :tooltipText="formData.firstName.error ? formData.firstName.errorMessage : 'Type your first name!'"
68
65
  :placeholder="getMessage('basic_form.placeholder.first_name')"
69
66
  :required="configuration.firstName?.required"
70
67
  :name="configuration.firstName?.name || 'first-name'"
@@ -87,7 +84,6 @@
87
84
  :name="configuration.email?.name || 'email'"
88
85
  v-model="formData.email.value"
89
86
  :status="formData.email.error ? 'error' : ''"
90
- :tooltipText="formData.email.error ? formData.email.errorMessage : 'Type your email!'"
91
87
  @validate="onValidate"
92
88
  />
93
89
  <!-- end cmd-form-element -->
@@ -104,15 +100,15 @@
104
100
  :required="configuration.phone?.required"
105
101
  :name="configuration.phone?.name || 'phone'"
106
102
  :status="formData.phone.error ? 'error' : ''"
107
- :tooltipText="formData.phone.error ? formData.phone.errorMessage : 'Type your phone number!'"
108
103
  @validate="onValidate"
109
104
  />
110
105
  <!-- end cmd-form-element -->
111
106
  </div>
112
107
 
113
- <div class="flex-container">
108
+ <div v-if="configuration.streetNo || configuration.zip || configuration.city" class="flex-container">
114
109
  <!-- begin cmd-form-element -->
115
110
  <CmdFormElement
111
+ v-if="configuration.streetNo"
116
112
  element="input"
117
113
  :type="configuration.streetNo?.type || 'text'"
118
114
  :labelText="getMessage('basic_form.labeltext.street_no')"
@@ -121,7 +117,6 @@
121
117
  :name="configuration.streetNo?.name || 'street-no'"
122
118
  v-model="formData.streetNo.value"
123
119
  :status="formData.streetNo.error ? 'error' : ''"
124
- :tooltipText="formData.streetNo.error ? formData.streetNo.errorMessage : 'Type your street and number!'"
125
120
  @validate="onValidate"
126
121
  />
127
122
  <!-- end cmd-form-element -->
@@ -129,6 +124,7 @@
129
124
  <div class="input-wrapper">
130
125
  <!-- begin cmd-form-element -->
131
126
  <CmdFormElement
127
+ v-if="configuration.zip"
132
128
  element="input"
133
129
  :type="configuration.zip?.type || 'number'"
134
130
  :labelText="getMessage('basic_form.labeltext.zip')"
@@ -137,12 +133,13 @@
137
133
  :name="configuration.zip?.name || 'zip'"
138
134
  v-model="formData.zip.value"
139
135
  :status="formData.zip.error ? 'error' : ''"
140
- :tooltipText="formData.zip.error ? formData.zip.errorMessage : 'Type your zip/postal code!'"
141
136
  @validate="onValidate"
142
137
  />
143
138
  <!-- end cmd-form-element -->
139
+
144
140
  <!-- begin cmd-form-element -->
145
141
  <CmdFormElement
142
+ v-if="configuration.city"
146
143
  element="input"
147
144
  :type="configuration.city?.type || 'text'"
148
145
  :labelText="getMessage('basic_form.labeltext.city')"
@@ -151,7 +148,6 @@
151
148
  :name="configuration.city?.name || 'zip'"
152
149
  v-model="formData.city.value"
153
150
  :status="formData.city.error ? 'error' : ''"
154
- :tooltipText="formData.city.error ? formData.city.errorMessage : 'Type your city!'"
155
151
  @validate="onValidate"
156
152
  />
157
153
  <!-- end cmd-form-element -->
@@ -159,6 +155,7 @@
159
155
 
160
156
  <!-- begin cmd-form-element -->
161
157
  <CmdFormElement
158
+ v-if="configuration.additionalAddressInfo"
162
159
  element="input"
163
160
  :type="configuration.additionalAddressInfo?.type || 'text'"
164
161
  :labelText="getMessage('basic_form.labeltext.additional_address_info')"
@@ -167,7 +164,6 @@
167
164
  :name="configuration.additionalAddressInfo?.name || 'additional-address-info'"
168
165
  v-model="formData.additionalAddressInfo.value"
169
166
  :status="formData.additionalAddressInfo.error ? 'error' : ''"
170
- :tooltipText="formData.additionalAddressInfo.error ? formData.additionalAddressInfo.errorMessage : 'Type additional address information!'"
171
167
  @validate="onValidate"
172
168
  />
173
169
  <!-- end cmd-form-element -->
@@ -175,7 +171,8 @@
175
171
 
176
172
  <!-- begin cmd-form-element -->
177
173
  <CmdFormElement
178
- :type="configuration.additionalText?.type || 'textarea'"
174
+ v-if="configuration.additionalText"
175
+ :element="configuration.additionalText?.element || 'textarea'"
179
176
  :labelText="getMessage('basic_form.labeltext.additional_text')"
180
177
  :placeholder="getMessage('basic_form.placeholder.additional_text')"
181
178
  :required="configuration.additionalText?.required"
@@ -192,6 +189,7 @@
192
189
 
193
190
  <!-- begin cmd-form-element -->
194
191
  <CmdFormElement
192
+ v-if="configuration.acceptPrivacy"
195
193
  element="input"
196
194
  type="checkbox"
197
195
  :required="configuration.acceptPrivacy?.required"
@@ -254,6 +252,9 @@ export default {
254
252
  }
255
253
  },
256
254
  props: {
255
+ /**
256
+ * configuration for form-elements used in form
257
+ */
257
258
  configuration: {
258
259
  type: Object,
259
260
  default() {
@@ -298,7 +299,7 @@ export default {
298
299
  },
299
300
  additionalText: {
300
301
  required: false,
301
- type: "textarea"
302
+ element: "textarea"
302
303
  },
303
304
  acceptPrivacy: {
304
305
  required: true,
@@ -307,14 +308,16 @@ export default {
307
308
  }
308
309
  }
309
310
  },
311
+ /**
312
+ * receiver e-mail-address the form is sent to
313
+ */
310
314
  receiverEmailAddress: {
311
315
  type: String,
312
316
  default: ""
313
317
  },
314
- formAction: {
315
- type: String,
316
- required: true
317
- },
318
+ /**
319
+ * submit-button to submit all form-data
320
+ */
318
321
  submitButton: {
319
322
  type: Object,
320
323
  default() {
@@ -322,6 +325,7 @@ export default {
322
325
  iconClass: "icon-message-send",
323
326
  text: "Send mail",
324
327
  type: "submit",
328
+ position: "belowFieldset",
325
329
  primary: true
326
330
  }
327
331
  }
@@ -333,7 +337,6 @@ export default {
333
337
  openFancyBox({url: event.target.getAttribute('href')})
334
338
  })
335
339
  },
336
-
337
340
  methods: {
338
341
  onSubmit(event) {
339
342
  this.onValidate();
@@ -1,12 +1,12 @@
1
1
  <template>
2
- <!-- begin CmdBasicForm -->
2
+ <!-- begin basicForm -->
3
3
  <BasicForm v-if="contactFormOnly" v-bind="basicForm" />
4
- <!-- end CmdBasicForm -->
4
+ <!-- end basicForm -->
5
5
 
6
6
  <div v-else class="flex-container">
7
- <!-- begin CmdBasicForm -->
7
+ <!-- begin basicForm -->
8
8
  <BasicForm v-bind="basicForm" />
9
- <!-- end CmdBasicForm -->
9
+ <!-- end basicForm -->
10
10
 
11
11
  <!-- begin additional-columns -->
12
12
  <div class="flex-container vertical">
@@ -30,14 +30,23 @@
30
30
  export default {
31
31
  name: "ContactInformation",
32
32
  props: {
33
+ /**
34
+ * properties for basicForm-component
35
+ */
33
36
  basicForm: {
34
37
  type: Object,
35
38
  default: null
36
39
  },
40
+ /**
41
+ * properties for CmdAddressData-component
42
+ */
37
43
  cmdAddressData: {
38
44
  type: Object,
39
45
  default: null
40
46
  },
47
+ /**
48
+ * properties for CmdGoogleMaps-component
49
+ */
41
50
  cmdGoogleMaps: {
42
51
  type: Object,
43
52
  default: null
@@ -14,7 +14,7 @@
14
14
  <span>Contact Information</span>
15
15
  </h2>
16
16
  <ContactInformation
17
- :cmdBasicForm="{}"
17
+ :basicForm="basicForm"
18
18
  :cmdAddressData="{}"
19
19
  :cmdGoogleMaps="{}">
20
20
  <template v-slot:additional-info>
@@ -68,7 +68,38 @@ export default {
68
68
  listOfDownloadsData,
69
69
  listOfSiteLinksData,
70
70
  basicForm: {
71
- formAction: "POST"
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
+ }
72
103
  }
73
104
  }
74
105
  }