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/dist/comand-component-library.css +1 -1
- package/dist/comand-component-library.umd.min.js +1 -1
- package/package.json +1 -1
- package/src/App.vue +11 -6
- package/src/components/CmdAddressData.vue +9 -10
- package/src/components/CmdCompanyLogo.vue +1 -1
- package/src/components/CmdFormElement.vue +16 -5
- package/src/components/CmdListOfRequirements.vue +1 -1
- package/src/components/CmdShareButtons.vue +1 -1
- package/src/components/CmdSwitchLanguage.vue +18 -5
- package/src/components/CmdThumbnailScroller.vue +24 -15
- package/src/components/CmdToggleDarkMode.vue +31 -6
- package/src/components/CmdTooltipForInputElements.vue +2 -2
- package/src/documentation/generated/CmdAddressDataPropertyDescriptions.json +6 -6
- package/src/documentation/generated/CmdFormElementPropertyDescriptions.json +8 -0
- package/src/documentation/generated/CmdShareButtonsPropertyDescriptions.json +1 -1
- package/src/documentation/generated/CmdThumbnailScrollerPropertyDescriptions.json +10 -0
- package/src/utilities.js +4 -0
package/package.json
CHANGED
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="
|
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
|
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);
|
@@ -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: "
|
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 "
|
654
|
+
return this.textCharacters + " " + this.modelValue.length + "/" + this.getMaxLength()
|
644
655
|
},
|
645
656
|
validationTooltip() {
|
646
657
|
if (!this.useCustomTooltip) {
|
@@ -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
|
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
|
-
|
17
|
-
|
18
|
-
|
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
|
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
|
-
|
91
|
-
|
102
|
+
next: {
|
103
|
+
next: {
|
92
104
|
type: "next",
|
93
|
-
|
94
|
-
|
105
|
+
iconClass: "icon-single-arrow-right",
|
106
|
+
tooltip: "Next"
|
95
107
|
}
|
96
108
|
},
|
97
|
-
|
98
|
-
|
109
|
+
prev: {
|
110
|
+
prev: {
|
99
111
|
type: "prev",
|
100
|
-
|
101
|
-
|
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(
|
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(
|
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(
|
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.
|
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.
|
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
|
@@ -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)"
|
@@ -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
|
|