comand-component-library 3.1.87 → 3.1.90

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.
@@ -24,6 +24,16 @@
24
24
  "day": "Fr",
25
25
  "fromTime": "08:00",
26
26
  "tillTime": "15:00"
27
+ },
28
+ {
29
+ "day": "Sa",
30
+ "fromTime": "08:00",
31
+ "tillTime": "17:28"
32
+ },
33
+ {
34
+ "day": "So",
35
+ "fromTime": "08:00",
36
+ "tillTime": "22:22"
27
37
  }
28
38
  ]
29
39
 
@@ -4,6 +4,12 @@
4
4
  /*
5
5
  - IMPORTS ------------------------
6
6
  - COMPONENTS AND GLOBAL STYLES ------------------------
7
+ * ------------------------
8
+ - main structure
9
+
10
+ A ------------------------
11
+ - avoid-scrolling
12
+
7
13
  E ------------------------
8
14
  - error-styles (for form-elements)
9
15
 
@@ -33,12 +39,29 @@
33
39
  @import 'variables'; /* scss-variables (only used for media-query-breakpoints) */
34
40
  /* ---------------------------------------------- END IMPORTS -------------------------------------------------- */
35
41
 
42
+ /* ---------------------------------------------- BEGIN COMPONENTS AND GLOBAL STYLES -------------------------------------------------- */
43
+ /* begin styles for main structure --------------------------------------------------------------------------------------------------------------------------------------------------- */
44
+ #page-wrapper {
45
+ display: flex;
46
+ flex-direction: column;
47
+ min-height: 100vh;
48
+
49
+ .cmd-site-footer {
50
+ margin-top: auto;
51
+ }
52
+ }
53
+
54
+ #component-library {
55
+ border: 1px solid red;
56
+ scroll-padding-top: unset !important;
57
+ scroll-snap-type: unset !important;
58
+ }
59
+
36
60
  body, .cmd-site-header, .cmd-site-footer, .cmd-copyright-information {
37
61
  transition: background linear .5s;
38
62
  }
63
+ /* end styles for main structure --------------------------------------------------------------------------------------------------------------------------------------------------- */
39
64
 
40
-
41
- /* ---------------------------------------------- BEGIN COMPONENTS AND GLOBAL STYLES -------------------------------------------------- */
42
65
  /* begin .avoid-scrolling --------------------------------------------------------------------------------------------------------------------------------------------------- */
43
66
  body.avoid-scrolling {
44
67
  overflow: hidden;
@@ -8,7 +8,7 @@
8
8
  <dl>
9
9
  <template v-for="(entry, index) in accountData" :key="index">
10
10
  <dt>{{ entry.text }}</dt>
11
- <dd v-if="allowCopyByClick && entry.allowCopy" class="flex-container no-flex">
11
+ <dd v-if="allowCopyByClick && entry.allowCopy">
12
12
  <span>{{ entry.value }}</span>
13
13
  <a href="#" @click.prevent="copyToClipboard(entry.value)" :title="iconCopy.tooltip">
14
14
  <span :class="iconCopy.iconClass"></span>
@@ -92,7 +92,8 @@ export default {
92
92
  <style lang="scss">
93
93
  /* begin cmd-bank-account-data ---------------------------------------------------------------------------------------- */
94
94
  .cmd-bank-account-data {
95
- dd.flex-container {
95
+ dd {
96
+ display: flex;
96
97
  gap: calc(var(--default-gap) / 2);
97
98
 
98
99
  > span {
@@ -1,14 +1,14 @@
1
1
  <template>
2
2
  <div
3
3
  :class="[
4
- 'cmd-main-navigation main-navigation-wrapper',
4
+ 'cmd-main-navigation',
5
5
  {
6
6
  'hide-sub-navigation' : !showSubNavigations,
7
7
  'open-off-canvas': showOffcanvas,
8
8
  'persist-on-mobile': persistOnMobile,
9
9
  'show-content-overlay': showContentOverlay
10
10
  }
11
- ]">
11
+ ]" id="main-navigation-wrapper">
12
12
  <nav>
13
13
  <!-- begin main-level -->
14
14
  <ul :class="{'stretch-items' : stretchMainItems}">
@@ -225,22 +225,27 @@ export default {
225
225
  },
226
226
  methods: {
227
227
  executeLink(event, navigationEntry) {
228
+ // execute default-link
228
229
  if (navigationEntry.target || (navigationEntry.path.length > 1)) {
229
230
  this.showOffcanvas = false
230
231
  return true
231
232
  }
232
- if (navigationEntry.path === '#' || navigationEntry.path === '') {
233
- event.preventDefault()
234
- this.showOffcanvas = false
235
- this.$emit('click', navigationEntry.path)
236
233
 
237
- }
238
- if (!(navigationEntry?.subentries?.length)) {
239
- this.showOffcanvas = false
240
- } else {
234
+ // toggle subentries (no link execution)
235
+ if(navigationEntry?.subentries?.length) {
236
+ event.preventDefault()
241
237
  // add entry "open" to navigationEntry-object (will be watched by vue3 automatically)
242
238
  navigationEntry.open = !navigationEntry.open
239
+ return
240
+ }
241
+
242
+ // emit event to handle navigation from outside
243
+ if (navigationEntry.path === '#' || navigationEntry.path === '') {
244
+ event.preventDefault()
245
+ this.$emit('click', navigationEntry.path)
243
246
  }
247
+
248
+ this.showOffcanvas = false
244
249
  },
245
250
  getRoute(navigationEntry) {
246
251
  return getRoute(navigationEntry)
@@ -295,9 +300,8 @@ export default {
295
300
  }
296
301
  }
297
302
 
298
-
299
303
  @media only screen and (max-width: $medium-max-width) {
300
- .cmd-main-navigation {
304
+ .cmd-main-navigation#main-navigation-wrapper {
301
305
  --nav-transition: all .5s linear;
302
306
  display: flex;
303
307
  background: none; /* overwrite framework-css */
@@ -388,14 +392,6 @@ export default {
388
392
  }
389
393
  }
390
394
 
391
- > a {
392
- span {
393
- & + span[class*="icon"]::before {
394
- display: inline-block;
395
- }
396
- }
397
- }
398
-
399
395
  /* sub-level 1 */
400
396
  ul {
401
397
  li {
@@ -406,9 +402,15 @@ export default {
406
402
  &:last-child {
407
403
  border-bottom: 0;
408
404
  }
409
-
410
- a {
405
+ > a {
411
406
  padding-left: calc(var(--default-margin) * 2);
407
+
408
+ span {
409
+ & + span[class*="icon"]::before {
410
+ display: inline-block;
411
+ transform: rotate(0);
412
+ }
413
+ }
412
414
  }
413
415
 
414
416
  /* sub-level 2 */
@@ -435,26 +437,6 @@ export default {
435
437
  display: block;
436
438
  opacity: 1;
437
439
  transition: var(--nav-transition);
438
-
439
- > li {
440
- > a {
441
- span {
442
- + span[class*="icon"]::before {
443
-
444
- }
445
- }
446
- }
447
-
448
- &.open {
449
- > a {
450
- span {
451
- + span[class*="icon"]::before {
452
-
453
- }
454
- }
455
- }
456
- }
457
- }
458
440
  }
459
441
  }
460
442
  }
@@ -134,13 +134,40 @@ export default {
134
134
  type: Object,
135
135
  required: false
136
136
  },
137
+ /**
138
+ * option to set custom time format by function
139
+ */
137
140
  timeFormatter: {
138
141
  type: Function,
139
142
  required: false
140
143
  },
144
+ /**
145
+ * activate if component should update open-/closed-status on its own
146
+ */
141
147
  componentHandlesClosedStatus: {
142
148
  type: Boolean,
143
149
  default: true
150
+ },
151
+ /**
152
+ * set the interval (in milliseconds) when the open-/closed-status should be checked (and updated)
153
+ */
154
+ checkInterval: {
155
+ type: Number,
156
+ default: 5000
157
+ }
158
+ },
159
+ mounted() {
160
+ if(this.componentHandlesClosedStatus && this.checkInterval > 0) {
161
+ // create new property on component by 'this.property-name' and assign value (id) from setInterval (so it can be cleared in unmount)
162
+ this.$_CmdOpeningHours_intervalId = setInterval(() => {
163
+ // use arrow-function to assure that 'this' is the component
164
+ this.currentTime = new Date()
165
+ }, this.checkInterval)
166
+ }
167
+ },
168
+ data() {
169
+ return {
170
+ currentTime: new Date()
144
171
  }
145
172
  },
146
173
  computed: {
@@ -172,8 +199,7 @@ export default {
172
199
  return this.closed
173
200
  }
174
201
 
175
- const currentDate = new Date()
176
- let currentDay = currentDate.getDay()
202
+ let currentDay = this.currentTime.getDay()
177
203
 
178
204
  // fix order and check if currentDay equals 0 === sunday. Data are expected to start with monday
179
205
  if (currentDay === 0){
@@ -191,7 +217,7 @@ export default {
191
217
  const openingHoursTill = new Date()
192
218
  openingHoursTill.setHours(openingHours.tillTime.hours, openingHours.tillTime.mins)
193
219
 
194
- if (openingHoursFrom <= currentDate && currentDate <= openingHoursTill) {
220
+ if (openingHoursFrom <= this.currentTime && this.currentTime <= openingHoursTill) {
195
221
  return false
196
222
  }
197
223
  }
@@ -205,6 +231,15 @@ export default {
205
231
  }
206
232
  return timeFormatting(":", " hrs", "", false)(time.hours, time.mins)
207
233
  }
234
+ },
235
+ beforeUnmount() {
236
+ if(this.$_CmdOpeningHours_intervalId) {
237
+ // remove interval
238
+ clearInterval(this.$_CmdOpeningHours_intervalId)
239
+
240
+ // clear interval-id
241
+ this.$_CmdOpeningHours_intervalId = null
242
+ }
208
243
  }
209
244
  }
210
245
  </script>
@@ -89,6 +89,10 @@ export default {
89
89
  padding: 0 var(--default-padding);
90
90
  }
91
91
 
92
+ .cmd-main-navigation nav {
93
+ width: auto;
94
+ }
95
+
92
96
  .top-header {
93
97
  .cmd-list-of-links {
94
98
  padding-top: calc(var(--default-padding) / 2);
@@ -96,7 +100,8 @@ export default {
96
100
  }
97
101
  }
98
102
 
99
- > .cmd-main-navigation:last-child {
103
+ // use id to ensure high specificity
104
+ > .cmd-main-navigation#main-navigation-wrapper:last-child {
100
105
  border-bottom: 0;
101
106
  }
102
107
 
@@ -8,6 +8,7 @@
8
8
  </a>
9
9
  </li>
10
10
  </ul>
11
+ <!-- begin slot -->
11
12
  <template v-if="useSlot">
12
13
  <div v-show="showTab === index - 1" v-for="index in tabs.length" :key="index" aria-live="assertive">
13
14
  <!-- begin slot-content -->
@@ -15,10 +16,12 @@
15
16
  <!-- end slot-content -->
16
17
  </div>
17
18
  </template>
19
+ <!-- end slot -->
18
20
  <div v-else aria-live="assertive">
19
21
  <!-- begin CmdHeadline -->
20
22
  <CmdHeadline
21
- v-bind="CmdHeadline"
23
+ v-if="cmdHeadline"
24
+ v-bind="cmdHeadline"
22
25
  :headlineText="tabs[showTab].headlineText"
23
26
  :headlineLevel="tabs[showTab].headlineLevel"
24
27
  />
@@ -1,11 +1,11 @@
1
1
  <template>
2
2
  <div class="cmd-width-limitation-wrapper" :class="{'sticky': sticky}">
3
- <component v-if="innerWrapper" :is="innerComponent" :class="setInnerClass">
3
+ <section v-if="innerWrapper" :class="setInnerClass">
4
4
  <a v-if="anchorId" :id="anchorId"></a>
5
5
  <!-- begin slot-content -->
6
6
  <slot></slot>
7
7
  <!-- end slot-content -->
8
- </component>
8
+ </section>
9
9
  <template v-else>
10
10
  <!-- begin slot-content -->
11
11
  <a v-if="anchorId" :id="anchorId"></a>
@@ -0,0 +1,6 @@
1
+ export default {
2
+ mounted(el) {
3
+ const heightHeader = el.outerHeight
4
+ document.documentElement.style.scrollPaddingTop = (heightHeader / 10) + "rem"
5
+ }
6
+ }
@@ -46,12 +46,17 @@
46
46
  },
47
47
  "timeFormatter": {
48
48
  "comments": [
49
- "properties for CmdHeadline-component"
49
+ "option to set custom time format by function"
50
50
  ]
51
51
  },
52
52
  "componentHandlesClosedStatus": {
53
53
  "comments": [
54
- "properties for CmdHeadline-component"
54
+ "activate if component should update open-/closed-status on its own"
55
+ ]
56
+ },
57
+ "checkInterval": {
58
+ "comments": [
59
+ "set the interval (in milliseconds) when the open-/closed-status should be checked (and updated)"
55
60
  ]
56
61
  }
57
62
  }
package/src/main.js CHANGED
@@ -23,6 +23,8 @@ import "clickout-event"
23
23
  import directiveTelephone from "./directives/telephone"
24
24
  // directive to set focus on specific form-elements
25
25
  import directiveFocus from "./directives/focus"
26
+ // directive to set scroll-padding to place anchors correctly below sticky header
27
+ import directiveScrollPadding from "./directives/scrollPadding"
26
28
 
27
29
  /* begin imports css from comand-component-library ---------------------------------------------------------------------------------------- */
28
30
  /* import additional iconfont containing company-logos */
@@ -58,4 +60,4 @@ import router from "./router"
58
60
  // })
59
61
 
60
62
  // createApp(App).use(router).directive('telephone', directiveTelephone).directive('focus', directiveFocus).mount('#app')
61
- createApp(App).use(router).directive('telephone', directiveTelephone).directive('focus', directiveFocus).mount('#app')
63
+ createApp(App).use(router).directive('telephone', directiveTelephone).directive('focus', directiveFocus).directive('scrollPadding', directiveScrollPadding).mount('#app')
@@ -210,8 +210,8 @@ export default {
210
210
  inputRequirements() {
211
211
  const standardRequirements = []
212
212
  // check if field is required
213
- if(this.$attrs.required || this.required) {
214
- const inputRequired = this.required
213
+ if(this.$attrs.required || (Object.hasOwn(this, "required") && this.required)) {
214
+ const inputRequired = Object.hasOwn(this, "required") ? this.required : this.$attrs.required
215
215
  standardRequirements.push({
216
216
  message: this.getRequirementMessage(),
217
217
  valid(value, attributes) {
@@ -53,10 +53,11 @@ export default {
53
53
  return message
54
54
  },
55
55
  getDefaultMessageProperty(key) {
56
- if (this.defaultMessageProperties && this.defaultMessageProperties[key]) {
56
+ if (Object.hasOwn(this, "defaultMessageProperties") && this.defaultMessageProperties && this.defaultMessageProperties[key]) {
57
57
  return this.defaultMessageProperties[key]
58
58
  }
59
- const propertyKey = Object.keys(this).find(p => p.slice(-24) === "DefaultMessageProperties")
59
+ //const propertyKey = Object.keys(this).find(p => p.slice(-24) === "DefaultMessageProperties")
60
+ const propertyKey = Object.hasOwn(this, "fieldValidationDefaultMessageProperties") ? "fieldValidationDefaultMessageProperties" : null
60
61
  if (propertyKey && this[propertyKey]?.[key]) {
61
62
  return this[propertyKey][key]
62
63
  }