comand-component-library 3.1.82 → 3.1.83

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "comand-component-library",
3
- "version": "3.1.82",
3
+ "version": "3.1.83",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
package/src/App.vue CHANGED
@@ -137,7 +137,6 @@
137
137
  <h2>Inputfields in Columns</h2>
138
138
  <div class="flex-container">
139
139
  <CmdFormElement element="input"
140
- labelText="Label for inputfield (with tooltip):"
141
140
  type="text"
142
141
  minlength="5"
143
142
  id="inputfield1"
@@ -145,10 +144,13 @@
145
144
  v-model="inputField1"
146
145
  tooltipText="This is a tooltip!"
147
146
  :status="validationStatus"
148
- :disabled="disabledStatus"
149
- />
147
+ :disabled="disabledStatus">
148
+ <template v-slot:labeltext>
149
+ <span v-html="'Label with <a href=\'#\'>Link</a> given by slot'"></span>
150
+ </template>
151
+ </CmdFormElement>
150
152
  <CmdFormElement element="input"
151
- labelText="Label for inputfield (required):"
153
+ labelText="Label for inputfield (required, with tooltip):"
152
154
  type="text"
153
155
  required="required"
154
156
  minlength="5"
@@ -1079,7 +1081,10 @@
1079
1081
  <a id="section-thumbnail-scroller"></a>
1080
1082
  <CmdWidthLimitationWrapper>
1081
1083
  <h2 class="headline-demopage">Thumbnail-Scroller</h2>
1084
+ <h3>Thumbnail-Scroller as wide as content</h3>
1082
1085
  <CmdThumbnailScroller :thumbnail-scroller-items="thumbnailScrollerData"/>
1086
+ <h3>Thumbnail-Scroller stretched to full width</h3>
1087
+ <CmdThumbnailScroller :thumbnail-scroller-items="thumbnailScrollerData" :fullWidth="true" />
1083
1088
  </CmdWidthLimitationWrapper>
1084
1089
 
1085
1090
  <a id="section-tooltip"></a>
@@ -1134,7 +1139,7 @@
1134
1139
  textMiscInfo="Miscellaneous information"
1135
1140
  />
1136
1141
  <CmdAddressData :addressData="addressData"
1137
- :linkGoogleMaps="true"
1142
+ :linkGoogleMaps="false"
1138
1143
  :cmdHeadline="{headlineText: 'Address data', headlineLevel: 6}"
1139
1144
  />
1140
1145
  </div>
@@ -1226,8 +1231,8 @@ import CmdSiteHeader from "./components/CmdSiteHeader"
1226
1231
  import CmdSlideshow from "@/components/CmdSlideshow.vue"
1227
1232
  import CmdSwitchLanguage from "@/components/CmdSwitchLanguage.vue"
1228
1233
  import CmdSystemMessage from "@/components/CmdSystemMessage.vue"
1229
- import CmdTabs from "@/components/CmdTabs.vue"
1230
1234
  import CmdTable from "@/components/CmdTable.vue"
1235
+ import CmdTabs from "@/components/CmdTabs.vue"
1231
1236
  import CmdThumbnailScroller from "@/components/CmdThumbnailScroller.vue"
1232
1237
  import CmdToggleDarkMode from "@/components/CmdToggleDarkMode.vue"
1233
1238
  import CmdTooltip from "@/components/CmdTooltip.vue"
@@ -137,19 +137,12 @@ export default {
137
137
  default: true
138
138
  },
139
139
  /**
140
- * show a label-text
140
+ * show a label-text for each entry
141
141
  */
142
142
  showLabelTexts: {
143
143
  type: Boolean,
144
144
  default: true
145
145
  },
146
- /**
147
- * properties for CmdHeadline-component
148
- */
149
- cmdHeadline: {
150
- type: Object,
151
- required: false
152
- },
153
146
  /**
154
147
  * option to toggle labels (i.e. telephone, email etc.) in front/left of data
155
148
  */
@@ -170,6 +163,13 @@ export default {
170
163
  linkGoogleMaps: {
171
164
  type: Boolean,
172
165
  default: false
166
+ },
167
+ /**
168
+ * properties for CmdHeadline-component
169
+ */
170
+ cmdHeadline: {
171
+ type: Object,
172
+ required: false
173
173
  }
174
174
  },
175
175
  computed: {
@@ -186,13 +186,12 @@ export default {
186
186
  dl {
187
187
  grid-row-gap: calc(var(--default-gap) / 2);
188
188
 
189
- dt, dd {
189
+ dt {
190
190
  display: flex;
191
191
  align-items: center;
192
192
  }
193
193
  }
194
194
 
195
-
196
195
  ul {
197
196
  flex-direction: column;
198
197
  gap: calc(var(--default-gap) / 2);
@@ -13,7 +13,7 @@
13
13
  import {getRoute} from "../utilities.js"
14
14
 
15
15
  export default {
16
- name: "CmdLogo",
16
+ name: "CmdCompanyLogo",
17
17
  data() {
18
18
  return {
19
19
  prefersColorScheme: ""
@@ -20,9 +20,10 @@
20
20
  ref="label">
21
21
 
22
22
  <!-- begin label-text (+ required asterisk) -->
23
- <span v-if="labelText && $attrs.type !== 'checkbox' && $attrs.type !== 'radio'"
23
+ <span v-if="(labelText || $slots.labeltext) && $attrs.type !== 'checkbox' && $attrs.type !== 'radio'"
24
24
  :class="['label-text', !showLabel ? 'hidden' : undefined]">
25
- <span>{{ labelText }}<sup v-if="$attrs.required">*</sup></span>
25
+ <span v-if="labelText">{{ labelText }}<sup v-if="$attrs.required">*</sup></span>
26
+ <slot name="labeltext" />
26
27
 
27
28
  <!-- begin CmdTooltipForInputElements -->
28
29
  <CmdTooltipForInputElements
@@ -211,7 +212,7 @@ import CmdTooltipForInputElements from "./CmdTooltipForInputElements"
211
212
 
212
213
  export default {
213
214
  inheritAttrs: false,
214
- name: "FormElement",
215
+ name: "CmdFormElement",
215
216
  components: {
216
217
  CmdTooltipForInputElements
217
218
  },
@@ -423,6 +424,16 @@ export default {
423
424
  type: Boolean,
424
425
  default: true
425
426
  },
427
+ /**
428
+ * text shown in front of character-count below textarea
429
+ *
430
+ * type-property must be set to textarea
431
+ * showCharactersTextarea-property must be activated
432
+ */
433
+ textCharacters: {
434
+ type: String,
435
+ default: "Characters"
436
+ },
426
437
  /**
427
438
  * toggle visibility of search-button (next to search-field)
428
439
  */
@@ -591,7 +602,7 @@ export default {
591
602
  iconClass: "icon-not-visible",
592
603
  }
593
604
  }
594
- },
605
+ }
595
606
  },
596
607
  computed: {
597
608
  elementAttributes() {
@@ -640,7 +651,7 @@ export default {
640
651
  return false
641
652
  },
642
653
  charactersTextarea() {
643
- return "Characters: " + this.modelValue.length + "/" + this.getMaxLength()
654
+ return this.textCharacters + " " + this.modelValue.length + "/" + this.getMaxLength()
644
655
  },
645
656
  validationTooltip() {
646
657
  if (!this.useCustomTooltip) {
@@ -94,7 +94,7 @@ export default {
94
94
  * set a helplink to a different page for further support
95
95
  */
96
96
  helplink: {
97
- type: String,
97
+ type: Object,
98
98
  required: false
99
99
  },
100
100
  /**
@@ -49,7 +49,7 @@ export default {
49
49
  required: false
50
50
  },
51
51
  /**
52
- * activate if page to share is not given by json-data)
52
+ * activate if page to share is not given by json-data
53
53
  */
54
54
  appendPage: {
55
55
  type: Boolean,
@@ -4,18 +4,18 @@
4
4
  <li v-for="(language, index) in languages" :key="index">
5
5
  <!-- begin link-type 'href' -->
6
6
  <a v-if="language.link.type === 'href'" :href="language.link.path"
7
- :class="['flag', language.iso2, {'active': language.active}]"
7
+ :class="['flag', language.iso2, {'active': activeLanguage(language)}]"
8
8
  :title="language.tooltip"
9
9
  @click="$emit('click', { originalEvent: $event, language} )">
10
10
  <img :src="getFlagURL(language.iso2)" :alt="language.name" />
11
11
  </a>
12
- <!-- end link-type 'href -->
12
+ <!-- end link-type 'href' -->
13
13
 
14
14
  <!-- begin link-type 'router' -->
15
15
  <router-link v-else
16
- :class="['flag', language.iso2]"
17
- :to="getRoute(language)" :title="language.tooltip"
18
- @click="$emit('click', { originalEvent: $event, language})">
16
+ :class="['flag', language.iso2]"
17
+ :to="getRoute(language)" :title="language.tooltip"
18
+ @click="$emit('click', { originalEvent: $event, language})">
19
19
  <img :src="getFlagURL(language.iso2)" :alt="language.name" />
20
20
  </router-link>
21
21
  <!-- end link-type 'router' -->
@@ -45,6 +45,11 @@ export default {
45
45
  },
46
46
  getFlagURL(isoCode) {
47
47
  return require("../assets/images/flags/flag-" + isoCode + ".svg")
48
+ },
49
+ activeLanguage(language) {
50
+ if(language.active || language.iso2 === navigator.language) {
51
+ return true
52
+ }
48
53
  }
49
54
  }
50
55
  }
@@ -61,6 +66,14 @@ export default {
61
66
  li {
62
67
  list-style-type: none;
63
68
  margin: 0;
69
+
70
+ a:not(.active) {
71
+ filter: contrast(.5);
72
+
73
+ &:hover, &:focus, &:active {
74
+ filter: none;
75
+ }
76
+ }
64
77
  }
65
78
  }
66
79
  }
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div :class="['cmd-thumbnail-scroller', {'gallery-scroller' : !allowOpenFancyBox}]">
2
+ <div :class="['cmd-thumbnail-scroller', {'gallery-scroller' : !allowOpenFancyBox, 'full-width' : fullWidth}]">
3
3
  <!-- begin CmdSlideButton -->
4
4
  <CmdSlideButton
5
5
  @click.prevent="showPrevItem"
@@ -31,9 +31,12 @@
31
31
  </template>
32
32
 
33
33
  <script>
34
- import {openFancyBox} from './CmdFancyBox.vue'
34
+ // import components
35
35
  import CmdSlideButton from "./CmdSlideButton.vue"
36
36
 
37
+ // import functions
38
+ import {openFancyBox} from './CmdFancyBox.vue'
39
+
37
40
  export default {
38
41
  name: "CmdThumbnailScroller",
39
42
  components: {
@@ -45,6 +48,15 @@ export default {
45
48
  }
46
49
  },
47
50
  props: {
51
+ /**
52
+ * activate to stretch component to full width (of parent element)
53
+ *
54
+ * @affectsStyling: true
55
+ */
56
+ fullWidth: {
57
+ type: Boolean,
58
+ default: false
59
+ },
48
60
  /**
49
61
  * list of thumbnail-scroller-items
50
62
  */
@@ -87,18 +99,18 @@ export default {
87
99
  type: Object,
88
100
  default() {
89
101
  return {
90
- "next": {
91
- "next": {
102
+ next: {
103
+ next: {
92
104
  type: "next",
93
- "iconClass": "icon-single-arrow-right",
94
- "tooltip": "Next"
105
+ iconClass: "icon-single-arrow-right",
106
+ tooltip: "Next"
95
107
  }
96
108
  },
97
- "prev": {
98
- "prev": {
109
+ prev: {
110
+ prev: {
99
111
  type: "prev",
100
- "iconClass": "icon-single-arrow-left",
101
- "tooltip": "Previous"
112
+ iconClass: "icon-single-arrow-left",
113
+ tooltip: "Previous"
102
114
  }
103
115
  }
104
116
  }
@@ -112,7 +124,6 @@ export default {
112
124
  this.thumbnails.push(thumbnail);
113
125
  }
114
126
  },
115
-
116
127
  showPrevItem() {
117
128
  const thumbnail = this.thumbnails.pop(); // remove last element of array
118
129
  if (thumbnail) {
@@ -123,10 +134,9 @@ export default {
123
134
  if (this.allowOpenFancyBox) {
124
135
  openFancyBox({fancyBoxGallery: this.thumbnails, defaultGalleryIndex: index})
125
136
  }
126
- this.$emit('click', this.thumbnails[index].imgId)
137
+ this.$emit("click", this.thumbnails[index].imgId)
127
138
  }
128
139
  },
129
-
130
140
  watch: {
131
141
  thumbnailScrollerItems: {
132
142
  handler() {
@@ -153,9 +163,9 @@ export default {
153
163
  > ul {
154
164
  overflow: hidden;
155
165
  margin: 0;
156
- display: -webkit-flex; /* Safari 6-8 */
157
166
  display: flex;
158
167
  gap: var(--grid-gap);
168
+ justify-content: space-between;
159
169
 
160
170
  > li {
161
171
  align-self: center;
@@ -175,7 +185,6 @@ export default {
175
185
  max-height: 10rem;
176
186
  }
177
187
 
178
-
179
188
  &.active {
180
189
  a {
181
190
  figcaption {
@@ -8,6 +8,7 @@
8
8
  v-model="darkMode"
9
9
  :toggle-switch="true"
10
10
  :title="!showLabel ? labelText: ''"
11
+ @update:modelValue="setColorScheme"
11
12
  />
12
13
  </div>
13
14
  </template>
@@ -63,31 +64,55 @@ export default {
63
64
  }
64
65
  },
65
66
  created() {
66
- const mql = window.matchMedia('(prefers-color-scheme: dark)')
67
+ const mql = window.matchMedia("(prefers-color-scheme: dark)")
67
68
  mql.addEventListener("change", this.onColorSchemeChange)
68
69
  this.onColorSchemeChange(mql)
70
+
71
+ // load color-scheme from local-storage
72
+ const savedColorScheme = window.localStorage.getItem("cmd-color-scheme")
73
+
74
+ if(savedColorScheme) {
75
+ this.darkMode = savedColorScheme === "dark-mode"
76
+ }
77
+
78
+ // add eventListener on html-tag (= documentElement) to react on 'toggle-color-scheme'-event
79
+ document.documentElement.addEventListener("toggle-color-scheme", this.onToggleColorScheme)
69
80
  },
70
81
  beforeUnmount() {
71
- window.matchMedia('(prefers-color-scheme: dark)').removeEventListener("change", this.onColorSchemeChange)
82
+ window.matchMedia("(prefers-color-scheme: dark)").removeEventListener("change", this.onColorSchemeChange)
83
+
84
+ // remove eventListener on html-tag (= documentElement)
85
+ document.documentElement.removeEventListener("toggle-color-scheme", this.onToggleColorScheme)
72
86
  },
73
87
  methods: {
74
88
  onColorSchemeChange(event) {
89
+ // assign browser/os-color-scheme to data-property (and toggle class on html-tag)
75
90
  this.darkMode = event.matches
76
- document.querySelector('html').classList.add(this.darkMode ? 'dark-mode' : 'light-mode')
91
+ document.documentElement.classList.add(this.darkMode ? "dark-mode" : "light-mode")
92
+ },
93
+ setColorScheme() {
94
+ // save color-scheme in local-storage to avoid toggling on page-reload
95
+ window.localStorage.setItem("cmd-color-scheme", this.darkMode ? "dark-mode": "light-mode")
96
+ },
97
+ onToggleColorScheme(event) {
98
+ // get current color-scheme from event-listener (if color-scheme is toggled by (another) switch or browser-/os-settings)
99
+ this.darkMode = event.detail === "dark-mode"
77
100
  }
78
101
  },
79
102
  watch: {
80
103
  darkMode: {
81
104
  handler() {
82
105
  // toggle classes to overwrite media-query styles for color-schemes
83
- const htmlTag = document.querySelector('html')
106
+ const htmlTag = document.documentElement
84
107
  if (this.darkMode) {
85
- htmlTag.classList.replace("light-mode", "dark-mode");
108
+ htmlTag.classList.replace("light-mode", "dark-mode")
86
109
  this.labelText = this.labelTextDarkMode
87
110
  } else {
88
- htmlTag.classList.replace("dark-mode", "light-mode");
111
+ htmlTag.classList.replace("dark-mode", "light-mode")
89
112
  this.labelText = this.labelTextLightMode
90
113
  }
114
+
115
+ // emits custom events from html-tag
91
116
  htmlTag.dispatchEvent(new CustomEvent('toggle-color-scheme', {detail: this.darkMode ? 'dark-mode' : 'light-mode'}))
92
117
  },
93
118
  immediate: true
@@ -116,8 +116,8 @@ export default {
116
116
  * helplink for CmdListOfRequirements-component
117
117
  */
118
118
  helplink: {
119
- type: String,
120
- default: ""
119
+ type: Object,
120
+ required: false
121
121
  }
122
122
  },
123
123
  methods: {
@@ -6,12 +6,7 @@
6
6
  },
7
7
  "showLabelTexts": {
8
8
  "comments": [
9
- "show a label-text"
10
- ]
11
- },
12
- "cmdHeadline": {
13
- "comments": [
14
- "properties for CmdHeadline-component"
9
+ "show a label-text for each entry"
15
10
  ]
16
11
  },
17
12
  "showLabels": {
@@ -28,5 +23,10 @@
28
23
  "comments": [
29
24
  "link physical address (street, no, zip and city) with Google Maps"
30
25
  ]
26
+ },
27
+ "cmdHeadline": {
28
+ "comments": [
29
+ "properties for CmdHeadline-component"
30
+ ]
31
31
  }
32
32
  }
@@ -157,6 +157,14 @@
157
157
  "type-property must be set to textarea"
158
158
  ]
159
159
  },
160
+ "textCharacters": {
161
+ "comments": [
162
+ "text shown in front of character-count below textarea",
163
+ "",
164
+ "type-property must be set to textarea",
165
+ "showCharactersTextarea-property must be activated"
166
+ ]
167
+ },
160
168
  "showSearchButton": {
161
169
  "comments": [
162
170
  "toggle visibility of search-button (next to search-field)"
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "appendPage": {
30
30
  "comments": [
31
- "activate if page to share is not given by json-data)"
31
+ "activate if page to share is not given by json-data"
32
32
  ]
33
33
  }
34
34
  }
@@ -1,4 +1,14 @@
1
1
  {
2
+ "fullWidth": {
3
+ "comments": [
4
+ "activate to stretch component to full width (of parent element)"
5
+ ],
6
+ "annotations": {
7
+ "affectsStyling": [
8
+ "true"
9
+ ]
10
+ }
11
+ },
2
12
  "thumbnailScrollerItems": {
3
13
  "comments": [
4
14
  "list of thumbnail-scroller-items"
package/src/utilities.js CHANGED
@@ -2,6 +2,10 @@ function getRoute (entry) {
2
2
  if(entry.path) {
3
3
  return entry.path
4
4
  }
5
+
6
+ if(entry.route == null || typeof entry.route !== "object" || (!entry.route.path && !entry.route.name)) {
7
+ console.error("Error in router configuration. Expected object with 'path' or 'name', got", entry.route)
8
+ }
5
9
  return entry.route
6
10
  }
7
11