comand-component-library 3.1.85 → 3.1.88

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,29 +1,39 @@
1
1
  [
2
2
  {
3
3
  "day": "Mo",
4
- "fromTime": "08:00h",
5
- "tillTime": "17:00h"
4
+ "fromTime": "08:00",
5
+ "tillTime": "17:00"
6
6
  },
7
7
  {
8
8
  "day": "Tu",
9
- "fromTime": "08:00h",
10
- "tillTime": "17:00h"
9
+ "fromTime": "08:00",
10
+ "tillTime": "17:00"
11
11
  },
12
12
  {
13
13
  "day": "We",
14
- "fromTime": "08:00h",
15
- "tillTime": "17:30h"
14
+ "fromTime": "08:00",
15
+ "tillTime": "17:30"
16
16
  },
17
17
 
18
18
  {
19
19
  "day": "Th",
20
- "fromTime": "08:00h",
21
- "tillTime": "17:00h"
20
+ "fromTime": "08:00",
21
+ "tillTime": "17:00"
22
22
  },
23
23
  {
24
24
  "day": "Fr",
25
- "fromTime": "08:00h",
26
- "tillTime": "15:00h"
25
+ "fromTime": "08:00",
26
+ "tillTime": "15:00"
27
+ },
28
+ {
29
+ "day": "Sa",
30
+ "fromTime": "08:00",
31
+ "tillTime": "15:00"
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,23 @@
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
+
36
54
  body, .cmd-site-header, .cmd-site-footer, .cmd-copyright-information {
37
55
  transition: background linear .5s;
38
56
  }
57
+ /* end styles for main structure --------------------------------------------------------------------------------------------------------------------------------------------------- */
39
58
 
40
-
41
- /* ---------------------------------------------- BEGIN COMPONENTS AND GLOBAL STYLES -------------------------------------------------- */
42
59
  /* begin .avoid-scrolling --------------------------------------------------------------------------------------------------------------------------------------------------- */
43
60
  body.avoid-scrolling {
44
61
  overflow: hidden;
@@ -271,7 +288,7 @@ html {
271
288
  --color-scheme-background-inverted: var(--light-mode-background-color);
272
289
  --default-background-color-lightness: 20%;
273
290
 
274
- :where(label, .label) .label-text [class*="icon"] {
291
+ :where(label, .label) .label-text > [class*="icon"] {
275
292
  background: var(--dark-gray);
276
293
  }
277
294
  }
@@ -23,15 +23,11 @@
23
23
  <CmdTooltipForInputElements
24
24
  v-if="useCustomTooltip && (validationStatus === '' || validationStatus === 'error')"
25
25
  ref="tooltip"
26
- :showRequirements="showRequirements"
27
- :inputRequirements="inputRequirements"
28
26
  :validationStatus="validationStatus"
29
27
  :validationMessage="getValidationMessage"
30
28
  :validationTooltip="validationTooltip"
31
- :inputAttributes="$attrs"
32
- :inputModelValue="modelValue"
33
- :helplink="helplink"
34
29
  :relatedId="tooltipId"
30
+ :cmdListOfRequirements="listOfRequirements"
35
31
  />
36
32
  <!-- end CmdTooltipForInputElements -->
37
33
 
@@ -22,8 +22,13 @@
22
22
  <!-- begin label-text (+ required asterisk) -->
23
23
  <span v-if="(labelText || $slots.labeltext) && $attrs.type !== 'checkbox' && $attrs.type !== 'radio'"
24
24
  :class="['label-text', !showLabel ? 'hidden' : undefined]">
25
- <span v-if="labelText">{{ labelText }}<sup v-if="$attrs.required">*</sup></span>
26
- <slot name="labeltext" />
25
+ <span>
26
+ <template v-if="labelText">{{ labelText }}</template>
27
+ <!-- begin slot 'labeltext' -->
28
+ <slot v-else name="labeltext" />
29
+ <!-- end slot 'labeltext' -->
30
+ <sup v-if="$attrs.required">*</sup>
31
+ </span>
27
32
 
28
33
  <!-- begin CmdTooltipForInputElements -->
29
34
  <CmdTooltipForInputElements
@@ -108,7 +113,15 @@
108
113
  :disabled="$attrs.disabled"
109
114
  :aria-invalid="validationStatus === 'error'"
110
115
  />
111
- <span v-if="labelText" :class="['label-text', { hidden: !showLabel }]"><span>{{ labelText }}<sup v-if="$attrs.required">*</sup></span></span>
116
+ <span v-if="labelText || $slots.labeltext" :class="['label-text', { hidden: !showLabel }]">
117
+ <span>
118
+ <template v-if="labelText">{{ labelText }}</template>
119
+ <!-- begin slot 'labeltext' -->
120
+ <slot v-else name="labeltext" />
121
+ <!-- end slot 'labeltext' -->
122
+ <sup v-if="$attrs.required">*</sup>
123
+ </span>
124
+ </span>
112
125
  </template>
113
126
 
114
127
  <!-- begin labels for toggle-switch with switch-label -->
@@ -597,33 +610,9 @@ export default {
597
610
  iconClass: "icon-not-visible",
598
611
  }
599
612
  }
600
- },
601
- /**
602
- * properties for CmdListOfRequirements-component
603
- */
604
- cmdListOfRequirements: {
605
- type: Object,
606
- default() {
607
- return {}
608
- }
609
613
  }
610
614
  },
611
615
  computed: {
612
- listOfRequirements() {
613
- if (this.cmdListOfRequirements === undefined) {
614
- return {
615
- showRequirements: true,
616
- showHeadline: true,
617
- validationTooltip: this.validationTooltip,
618
- inputRequirements: [],
619
- inputAttributes: this.$attrs,
620
- inputModelValue: this.modelValue,
621
- helplink: {},
622
- labelText: this.labelText
623
- }
624
- }
625
- return this.cmdListOfRequirements
626
- },
627
616
  elementAttributes() {
628
617
  const commonAttributes = ["name", "required", "readonly", "disabled", "autofocus"]
629
618
  const attributes = {
@@ -807,7 +796,9 @@ export default {
807
796
  },
808
797
  closeTooltipOnBlur() {
809
798
  // close tooltip by calling function from CmdTooltipForInputElements using $refs
810
- this.$refs.tooltip.hideTooltip()
799
+ if(this.$refs.tooltip) {
800
+ this.$refs.tooltip.hideTooltip()
801
+ }
811
802
  }
812
803
  },
813
804
  watch: {
@@ -135,7 +135,7 @@ export default {
135
135
  type: Object,
136
136
  default() {
137
137
  return {
138
- headlineLevel: 4
138
+ headlineLevel: 6
139
139
  }
140
140
  }
141
141
  }
@@ -1,6 +1,5 @@
1
1
  <template>
2
2
  <div
3
- v-if="navigationEntries.length"
4
3
  :class="[
5
4
  'cmd-main-navigation main-navigation-wrapper',
6
5
  {
@@ -20,7 +19,7 @@
20
19
  </a>
21
20
  </li>
22
21
  <li v-for="(navigationEntry, index) in navigationEntries" :key="index"
23
- :class="{'open' : navigationEntry.open, 'has-subentries': navigationEntry.subentries}">
22
+ :class="{'active' : navigationEntry.active, 'open' : navigationEntry.open, 'has-subentries': navigationEntry?.subentries?.length}">
24
23
  <!-- begin type === href -->
25
24
  <a
26
25
  v-if="navigationEntry.type === 'href'"
@@ -31,7 +30,7 @@
31
30
  >
32
31
  <span v-if="navigationEntry.iconClass" :class="navigationEntry.iconClass"></span>
33
32
  <span v-if="navigationEntry.text">{{ navigationEntry.text }}</span>
34
- <span v-if="navigationEntry.subentries && navigationEntry.subentries.length > 0"
33
+ <span v-if="navigationEntry?.subentries?.length"
35
34
  :class="subentriesIconClass"
36
35
  ></span>
37
36
  </a>
@@ -53,7 +52,7 @@
53
52
  <!-- end type === router -->
54
53
 
55
54
  <!-- begin sub-level 1 -->
56
- <ul v-if="navigationEntry.subentries" aria-expanded="true">
55
+ <ul v-if="navigationEntry?.subentries?.length" aria-expanded="true">
57
56
  <li v-for="(navigationSubEntry, subindex) in navigationEntry.subentries" :key="subindex"
58
57
  :class="{'open' : navigationSubEntry.open}">
59
58
  <!-- begin type === href -->
@@ -227,14 +226,16 @@ export default {
227
226
  methods: {
228
227
  executeLink(event, navigationEntry) {
229
228
  if (navigationEntry.target || (navigationEntry.path.length > 1)) {
229
+ this.showOffcanvas = false
230
230
  return true
231
231
  }
232
232
  if (navigationEntry.path === '#' || navigationEntry.path === '') {
233
233
  event.preventDefault()
234
+ this.showOffcanvas = false
234
235
  this.$emit('click', navigationEntry.path)
235
236
 
236
237
  }
237
- if (!(navigationEntry.subentries && navigationEntry.subentries.length > 0)) {
238
+ if (!(navigationEntry?.subentries?.length)) {
238
239
  this.showOffcanvas = false
239
240
  } else {
240
241
  // add entry "open" to navigationEntry-object (will be watched by vue3 automatically)
@@ -6,21 +6,21 @@
6
6
 
7
7
  <!-- begin opening-status with link to detail-page -->
8
8
  <template v-if="link && link?.path && link?.show">
9
- <a v-if="link.type === 'href'" :href="link.path" :class="{closed: closed}">{{ textOpenClosed }}</a>
10
- <router-link v-if="link.type === 'router'" :to="link.path" :class="{closed: closed}">{{ textOpenClosed }}</router-link>
11
- <button v-if="link.type === 'button'" :class="['button', {closed: closed}]">{{ textOpenClosed }}</button>
9
+ <a v-if="link.type === 'href'" :href="link.path" :class="{closed: isClosed}">{{ textOpenClosed }}</a>
10
+ <router-link v-if="link.type === 'router'" :to="link.path" :class="{closed: isClosed}">{{ textOpenClosed }}</router-link>
11
+ <button v-if="link.type === 'button'" :class="['button', {closed: isClosed}]">{{ textOpenClosed }}</button>
12
12
  </template>
13
13
  <!-- end opening-status with link to detail-page -->
14
14
 
15
15
  <!-- begin opening-status (without link) -->
16
- <span v-else :class="{'closed': closed}">{{ textOpenClosed }}</span>
16
+ <span v-else :class="{'closed': isClosed}">{{ textOpenClosed }}</span>
17
17
  <!-- end opening-status (without link) -->
18
18
 
19
19
  <!-- begin opening-days and -hours -->
20
20
  <dl>
21
- <template v-for="day in openingHours" :key="day.day">
21
+ <template v-for="day in openingHoursFormatted" :key="day.day">
22
22
  <dt>{{ day.day }}:</dt>
23
- <dd>{{ day.fromTime }}&ndash;{{ day.tillTime }}</dd>
23
+ <dd>{{ getTime(day.fromTime)}}&ndash;{{ getTime(day.tillTime)}}</dd>
24
24
  </template>
25
25
  </dl>
26
26
  <!-- end opening-days and -hours -->
@@ -40,6 +40,36 @@
40
40
  // import components
41
41
  import CmdHeadline from "./CmdHeadline"
42
42
 
43
+ export function localizedTime(language) {
44
+ return (hour, minute) => {
45
+ const now = new Date()
46
+ now.setHours(hour, minute, 0, 0)
47
+ return new Intl.DateTimeFormat(language, {timeStyle: "short"}).format(now)
48
+ }
49
+ }
50
+
51
+ export function timeFormatting(separator, suffix1, suffix2, hoursLeadingZero = true) {
52
+ function addLeadingZero(time, addLeadingZero) {
53
+ if(addLeadingZero && time < 10) {
54
+ return "0" + time
55
+ }
56
+ return time
57
+ }
58
+
59
+ return (hour, minute) => {
60
+ if(suffix2) {
61
+ let hour12 = hour
62
+ let currentSuffix = suffix1
63
+ if(hour12 > 12) {
64
+ hour12 -= 12
65
+ currentSuffix = suffix2
66
+ }
67
+ return addLeadingZero(hour12, hoursLeadingZero) + separator + addLeadingZero(minute, true) + currentSuffix
68
+ }
69
+ return addLeadingZero(hour, hoursLeadingZero) + separator + addLeadingZero(minute, true) + suffix1
70
+ }
71
+ }
72
+
43
73
  export default {
44
74
  name: "CmdOpeningHours",
45
75
  components: {
@@ -63,11 +93,18 @@ export default {
63
93
  default: false
64
94
  },
65
95
  /**
66
- * text for open/closed-information
96
+ * text for 'open'-information
67
97
  */
68
- textOpenClosed: {
98
+ textOpen: {
69
99
  type: String,
70
- required: true
100
+ default: "Open right now!"
101
+ },
102
+ /**
103
+ * text for 'closed'-information
104
+ */
105
+ textClosed: {
106
+ type: String,
107
+ default: "Closed right now!"
71
108
  },
72
109
  /**
73
110
  * list of opening-hours
@@ -96,6 +133,88 @@ export default {
96
133
  cmdHeadline: {
97
134
  type: Object,
98
135
  required: false
136
+ },
137
+ /**
138
+ * option to set custom time format by function
139
+ */
140
+ timeFormatter: {
141
+ type: Function,
142
+ required: false
143
+ },
144
+ /**
145
+ * activate if component should update open-/closed-status on its own
146
+ */
147
+ componentHandlesClosedStatus: {
148
+ type: Boolean,
149
+ default: true
150
+ }
151
+ },
152
+ created() {
153
+ setInterval(function () {
154
+ this.isClosed()
155
+ }, 5000)
156
+ },
157
+ computed: {
158
+ textOpenClosed() {
159
+ return this.isClosed ? this.textClosed : this.textOpen
160
+ },
161
+ openingHoursFormatted() {
162
+ const weekdays = []
163
+ for(let i = 0; i < this.openingHours.length; i++) {
164
+ const openingHours = {}
165
+ const splitFromTime = this.openingHours[i].fromTime.split(/[:.]/)
166
+ const splitTillTime = this.openingHours[i].tillTime.split(/[:.]/)
167
+
168
+ openingHours.day = this.openingHours[i].day
169
+ openingHours.fromTime = {
170
+ hours: parseInt(splitFromTime[0]),
171
+ mins: parseInt(splitFromTime[1])
172
+ }
173
+ openingHours.tillTime = {
174
+ hours: parseInt(splitTillTime[0]),
175
+ mins: parseInt(splitTillTime[1])
176
+ }
177
+ weekdays.push(openingHours)
178
+ }
179
+ return weekdays
180
+ },
181
+ isClosed() {
182
+ if(!this.componentHandlesClosedStatus) {
183
+ return this.closed
184
+ }
185
+
186
+ const currentDate = new Date()
187
+ let currentDay = currentDate.getDay()
188
+
189
+ // fix order and check if currentDay equals 0 === sunday. Data are expected to start with monday
190
+ if (currentDay === 0){
191
+ currentDay = 6
192
+ } else {
193
+ currentDay -= 1
194
+ }
195
+
196
+ const openingHours = this.openingHoursFormatted[currentDay]
197
+
198
+ if(this.openingHoursFormatted[currentDay]) {
199
+ const openingHoursFrom = new Date()
200
+ openingHoursFrom.setHours(openingHours.fromTime.hours, openingHours.fromTime.mins)
201
+
202
+ const openingHoursTill = new Date()
203
+ openingHoursTill.setHours(openingHours.tillTime.hours, openingHours.tillTime.mins)
204
+
205
+ if (openingHoursFrom <= currentDate && currentDate <= openingHoursTill) {
206
+ return false
207
+ }
208
+ }
209
+ return true
210
+ }
211
+ },
212
+ methods: {
213
+ getTime(time) {
214
+ if(this.timeFormatter) {
215
+ return this.timeFormatter(time.hours, time.mins)
216
+ }
217
+ return timeFormatting(":", " hrs", "", false)(time.hours, time.mins)
99
218
  }
100
219
  }
101
220
  }
@@ -32,13 +32,6 @@ export default {
32
32
  CmdMainNavigation
33
33
  },
34
34
  props: {
35
- /**
36
- * properties for CmdMainNavigation-component
37
- */
38
- cmdMainNavigation: {
39
- type: Object,
40
- required: true
41
- },
42
35
  /**
43
36
  * use only if default-button of inner navigation-component should not be used
44
37
  */
@@ -61,6 +54,13 @@ export default {
61
54
  useGrid: {
62
55
  type: Boolean,
63
56
  default: true
57
+ },
58
+ /**
59
+ * properties for CmdMainNavigation-component
60
+ */
61
+ cmdMainNavigation: {
62
+ type: Object,
63
+ required: true
64
64
  }
65
65
  }
66
66
  }
@@ -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);
@@ -47,9 +47,7 @@ export default {
47
47
  return require("../assets/images/flags/flag-" + isoCode + ".svg")
48
48
  },
49
49
  activeLanguage(language) {
50
- if(language.active || language.iso2 === navigator.language) {
51
- return true
52
- }
50
+ return language.active
53
51
  }
54
52
  }
55
53
  }
@@ -67,7 +65,7 @@ export default {
67
65
  list-style-type: none;
68
66
  margin: 0;
69
67
 
70
- a:not(.active) {
68
+ a:not([class*="active"]) {
71
69
  filter: contrast(.5);
72
70
 
73
71
  &:hover, &:focus, &:active {
@@ -23,8 +23,7 @@ export default {
23
23
  },
24
24
  data() {
25
25
  return {
26
- darkMode: false,
27
- labelText: ""
26
+ darkMode: false
28
27
  }
29
28
  },
30
29
  props: {
@@ -99,6 +98,11 @@ export default {
99
98
  this.darkMode = event.detail === "dark-mode"
100
99
  }
101
100
  },
101
+ computed: {
102
+ labelText() {
103
+ return this.darkMode ? this.labelTextDarkMode : this.labelTextLightMode
104
+ }
105
+ },
102
106
  watch: {
103
107
  darkMode: {
104
108
  handler() {
@@ -106,10 +110,8 @@ export default {
106
110
  const htmlTag = document.documentElement
107
111
  if (this.darkMode) {
108
112
  htmlTag.classList.replace("light-mode", "dark-mode")
109
- this.labelText = this.labelTextDarkMode
110
113
  } else {
111
114
  htmlTag.classList.replace("dark-mode", "light-mode")
112
- this.labelText = this.labelTextLightMode
113
115
  }
114
116
 
115
117
  // emits custom events from html-tag
@@ -9,7 +9,7 @@
9
9
 
10
10
  <!-- begin CmdSystemMessage -->
11
11
  <CmdSystemMessage
12
- v-if="inputAttributes.required && validationMessage"
12
+ v-if="cmdListOfRequirements?.inputAttributes?.required && validationMessage"
13
13
  :systemMessage="validationMessage"
14
14
  :validation-status="validationStatus"
15
15
  :iconClose="{show: false}"
@@ -262,10 +262,5 @@
262
262
  "type-property must be set to 'password'",
263
263
  ""
264
264
  ]
265
- },
266
- "cmdListOfRequirements": {
267
- "comments": [
268
- "properties for CmdListOfRequirements-component"
269
- ]
270
265
  }
271
266
  }
@@ -14,9 +14,14 @@
14
14
  ]
15
15
  }
16
16
  },
17
- "textOpenClosed": {
17
+ "textOpen": {
18
18
  "comments": [
19
- "text for open/closed-information"
19
+ "text for 'open'-information"
20
+ ]
21
+ },
22
+ "textClosed": {
23
+ "comments": [
24
+ "text for 'closed'-information"
20
25
  ]
21
26
  },
22
27
  "openingHours": {
@@ -38,5 +43,15 @@
38
43
  "comments": [
39
44
  "properties for CmdHeadline-component"
40
45
  ]
46
+ },
47
+ "timeFormatter": {
48
+ "comments": [
49
+ "option to set custom time format by function"
50
+ ]
51
+ },
52
+ "componentHandlesClosedStatus": {
53
+ "comments": [
54
+ "activate if component should update open-/closed-status on its own"
55
+ ]
41
56
  }
42
57
  }
@@ -1,9 +1,4 @@
1
1
  {
2
- "cmdMainNavigation": {
3
- "comments": [
4
- "properties for CmdMainNavigation-component"
5
- ]
6
- },
7
2
  "closeOffcanvas": {
8
3
  "comments": [
9
4
  "use only if default-button of inner navigation-component should not be used"
@@ -23,5 +18,10 @@
23
18
  "true"
24
19
  ]
25
20
  }
21
+ },
22
+ "cmdMainNavigation": {
23
+ "comments": [
24
+ "properties for CmdMainNavigation-component"
25
+ ]
26
26
  }
27
27
  }
@@ -142,9 +142,31 @@ export default {
142
142
  iconClass: "icon-not-visible"
143
143
  }
144
144
  }
145
+ },
146
+ /**
147
+ * properties for CmdListOfRequirements-component
148
+ */
149
+ cmdListOfRequirements: {
150
+ type: Object,
151
+ required: false
145
152
  }
146
153
  },
147
154
  computed: {
155
+ listOfRequirements() {
156
+ if (this.cmdListOfRequirements == null) {
157
+ return {
158
+ showRequirements: true,
159
+ showHeadline: true,
160
+ validationTooltip: this.validationTooltip,
161
+ inputRequirements: this.inputRequirements,
162
+ inputAttributes: this.$attrs,
163
+ inputModelValue: this.modelValue,
164
+ helplink: {},
165
+ labelText: this.labelText
166
+ }
167
+ }
168
+ return this.cmdListOfRequirements
169
+ },
148
170
  getValidationMessage() {
149
171
  // check if all requirements are valid
150
172
  // const allRequirementsValid = !this.inputRequirements.some((item) => {