comand-component-library 3.1.82 → 3.1.85

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. package/dist/comand-component-library.css +1 -1
  2. package/dist/comand-component-library.umd.min.js +1 -1
  3. package/package.json +1 -1
  4. package/src/App.vue +16 -6
  5. package/src/assets/data/address-data.json +2 -1
  6. package/src/components/CmdAddressData.vue +46 -39
  7. package/src/components/CmdCompanyLogo.vue +1 -1
  8. package/src/components/CmdFakeSelect.vue +5 -1
  9. package/src/components/CmdFormElement.vue +56 -26
  10. package/src/components/CmdListOfRequirements.vue +9 -2
  11. package/src/components/CmdMainNavigation.vue +4 -4
  12. package/src/components/CmdOpeningHours.vue +10 -8
  13. package/src/components/CmdShareButtons.vue +1 -1
  14. package/src/components/CmdSlideButton.vue +1 -1
  15. package/src/components/CmdSwitchLanguage.vue +18 -5
  16. package/src/components/CmdTable.vue +0 -7
  17. package/src/components/CmdThumbnailScroller.vue +24 -15
  18. package/src/components/CmdToggleDarkMode.vue +31 -6
  19. package/src/components/CmdTooltip.vue +1 -1
  20. package/src/components/CmdTooltipForInputElements.vue +20 -54
  21. package/src/documentation/generated/CmdAddressDataPropertyDescriptions.json +6 -6
  22. package/src/documentation/generated/CmdFormElementPropertyDescriptions.json +17 -4
  23. package/src/documentation/generated/CmdListOfRequirementsPropertyDescriptions.json +5 -0
  24. package/src/documentation/generated/CmdOpeningHoursPropertyDescriptions.json +5 -5
  25. package/src/documentation/generated/CmdShareButtonsPropertyDescriptions.json +1 -1
  26. package/src/documentation/generated/CmdThumbnailScrollerPropertyDescriptions.json +10 -0
  27. package/src/documentation/generated/CmdTooltipForInputElementsPropertyDescriptions.json +2 -27
  28. package/src/mixins/FieldValidation.js +2 -2
  29. package/src/mixins/GlobalDefaultMessageProperties.js +2 -1
  30. package/src/utilities.js +4 -0
@@ -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
@@ -177,7 +177,7 @@ export default {
177
177
  line-height: 100%;
178
178
  font-size: 1.1rem;
179
179
  position: fixed;
180
- background: var(--pure-white);
180
+ background: var(--color-scheme-background-color);
181
181
  z-index: 100;
182
182
  border: var(--default-border);
183
183
  border-color: hsl(220, 2%, 25%);
@@ -18,13 +18,14 @@
18
18
 
19
19
  <!-- begin CmdListOfRequirements -->
20
20
  <CmdListOfRequirements
21
- v-if="showRequirements"
22
- :inputRequirements="inputRequirements"
23
- :helplink="helplink"
24
- :inputModelValue="inputModelValue"
25
- :inputAttributes="inputAttributes"
26
- :validationTooltip="validationTooltip"
27
- :labelText="labelText"
21
+ v-if="cmdListOfRequirements.showRequirements"
22
+ :showHeadline="cmdListOfRequirements.showHeadline"
23
+ :inputRequirements="cmdListOfRequirements.inputRequirements"
24
+ :helplink="cmdListOfRequirements.helplink"
25
+ :inputModelValue="cmdListOfRequirements.inputModelValue"
26
+ :inputAttributes="cmdListOfRequirements.inputAttributes"
27
+ :validationTooltip="cmdListOfRequirements.validationTooltip"
28
+ :labelText="cmdListOfRequirements.labelText"
28
29
  />
29
30
  <!-- end CmdListOfRequirements -->
30
31
  </CmdTooltip>
@@ -45,13 +46,6 @@ export default {
45
46
  CmdTooltip
46
47
  },
47
48
  props: {
48
- /**
49
- * text for label (used in headline)
50
- */
51
- labelText: {
52
- type: String,
53
- required: false
54
- },
55
49
  /**
56
50
  * related-id for CmdTooltip-component
57
51
  */
@@ -74,50 +68,22 @@ export default {
74
68
  default: ""
75
69
  },
76
70
  /**
77
- * toggle visibility for CmdListOfRequirements-component
78
- */
79
- showRequirements: {
80
- type: Boolean,
81
- default: false
82
- },
83
- /**
84
- * validation-tooltip for CmdListOfRequirements-component
85
- */
86
- validationTooltip: {
87
- type: String,
88
- default: ""
89
- },
90
- /**
91
- * list of input-requirements for CmdListOfRequirements-component
92
- */
93
- inputRequirements: {
94
- type: Array,
95
- default() {
96
- return []
97
- }
98
- },
99
- /**
100
- * input-attributes for CmdListOfRequirements-component
71
+ * properties for CmdListOfRequirements-component
101
72
  */
102
- inputAttributes: {
73
+ cmdListOfRequirements: {
103
74
  type: Object,
104
75
  default() {
105
- return {}
76
+ return {
77
+ showRequirements: true,
78
+ validationTooltip: "",
79
+ inputRequirements: [],
80
+ inputAttributes: {},
81
+ showHeadline: true,
82
+ inputModelValue: "",
83
+ helplink: {},
84
+ labelText: ""
85
+ }
106
86
  }
107
- },
108
- /**
109
- * input-model-value for CmdListOfRequirements-component
110
- */
111
- inputModelValue: {
112
- type: [String, Boolean, Array, Number],
113
- default: ""
114
- },
115
- /**
116
- * helplink for CmdListOfRequirements-component
117
- */
118
- helplink: {
119
- type: String,
120
- default: ""
121
87
  }
122
88
  },
123
89
  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)"
@@ -185,7 +193,7 @@
185
193
  "icon for error-validated items in list-of-requirements",
186
194
  "",
187
195
  "element-property must me set to 'input'",
188
- "showRequirements-property must be set to 'true'",
196
+ "showRequirements-subproperty (of CmdListOfRequirements) must be set to 'true'",
189
197
  ""
190
198
  ]
191
199
  },
@@ -194,7 +202,7 @@
194
202
  "icon for warning-validated items in list-of-requirements",
195
203
  "",
196
204
  "element-property must me set to 'input'",
197
- "showRequirements-property must be set to 'true'",
205
+ "showRequirements-subproperty (of CmdListOfRequirements) must be set to 'true'",
198
206
  ""
199
207
  ]
200
208
  },
@@ -203,7 +211,7 @@
203
211
  "icon for success-validated items in list-of-requirements",
204
212
  "",
205
213
  "element-property must me set to 'input'",
206
- "showRequirements-property must be set to 'true'",
214
+ "showRequirements-subproperty (of CmdListOfRequirements) must be set to 'true'",
207
215
  ""
208
216
  ]
209
217
  },
@@ -212,7 +220,7 @@
212
220
  "icon for info-validated items in list-of-requirements",
213
221
  "",
214
222
  "element-property must me set to 'input'",
215
- "showRequirements-property must be set to 'true'",
223
+ "showRequirements-subproperty (of CmdListOfRequirements) must be set to 'true'",
216
224
  ""
217
225
  ]
218
226
  },
@@ -254,5 +262,10 @@
254
262
  "type-property must be set to 'password'",
255
263
  ""
256
264
  ]
265
+ },
266
+ "cmdListOfRequirements": {
267
+ "comments": [
268
+ "properties for CmdListOfRequirements-component"
269
+ ]
257
270
  }
258
271
  }
@@ -34,6 +34,11 @@
34
34
  "icon to show error-status"
35
35
  ]
36
36
  },
37
+ "showHeadline": {
38
+ "comments": [
39
+ "toggle headline-visibility"
40
+ ]
41
+ },
37
42
  "cmdHeadline": {
38
43
  "comments": [
39
44
  "properties of CmdHeadline-component"
@@ -1,9 +1,4 @@
1
1
  {
2
- "cmdHeadline": {
3
- "comments": [
4
- "properties for CmdHeadline-component"
5
- ]
6
- },
7
2
  "link": {
8
3
  "comments": [
9
4
  "set a link to a detail page"
@@ -38,5 +33,10 @@
38
33
  "comments": [
39
34
  "additional/miscellaneous text (shown below holiday-closed-text/opening hours)"
40
35
  ]
36
+ },
37
+ "cmdHeadline": {
38
+ "comments": [
39
+ "properties for CmdHeadline-component"
40
+ ]
41
41
  }
42
42
  }
@@ -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"
@@ -1,9 +1,4 @@
1
1
  {
2
- "labelText": {
3
- "comments": [
4
- "text for label (used in headline)"
5
- ]
6
- },
7
2
  "relatedId": {
8
3
  "comments": [
9
4
  "related-id for CmdTooltip-component"
@@ -19,29 +14,9 @@
19
14
  "validation-message for CmdSystemMessage-component"
20
15
  ]
21
16
  },
22
- "showRequirements": {
23
- "comments": [
24
- "toggle visibility for CmdListOfRequirements-component"
25
- ]
26
- },
27
- "validationTooltip": {
28
- "comments": [
29
- "validation-tooltip for CmdListOfRequirements-component"
30
- ]
31
- },
32
- "inputRequirements": {
33
- "comments": [
34
- "list of input-requirements for CmdListOfRequirements-component"
35
- ]
36
- },
37
- "inputAttributes": {
38
- "comments": [
39
- "helplink for CmdListOfRequirements-component"
40
- ]
41
- },
42
- "methods": {
17
+ "cmdListOfRequirements": {
43
18
  "comments": [
44
- "helplink for CmdListOfRequirements-component"
19
+ "properties for CmdListOfRequirements-component"
45
20
  ]
46
21
  }
47
22
  }
@@ -200,7 +200,7 @@ export default {
200
200
  // check if field has a minimum length
201
201
  if(this.$attrs.minlength) {
202
202
  standardRequirements.push({
203
- message: "Input has minimum length (" + this.modelValue.length + "/" + this.$attrs.minlength + ")",
203
+ message: this.getMessage("cmdfieldvalidation.input_has_minimum_length") + "(" + this.modelValue.length + "/" + this.$attrs.minlength + ")",
204
204
  valid(value, attributes) {
205
205
  return value.length >= attributes.minlength
206
206
  }
@@ -230,7 +230,7 @@ export default {
230
230
  }
231
231
  }
232
232
 
233
- function validateSpecialCharacters(message = "Field contains special character") {
233
+ function validateSpecialCharacters(message = "special character - replace with getMessage") {
234
234
  return {
235
235
  message,
236
236
  valid(value) {
@@ -7,7 +7,8 @@ export default {
7
7
  "cmdfieldvalidation.information_filled_correctly": "This information is filled correctly!",
8
8
  "cmdfieldvalidation.caps_lock_is_activated": "Attention: Caps lock is activated!",
9
9
  "cmdfieldvalidation.required_field_is_filled": "Required field is filled!",
10
- "cmdfieldvalidation.field_contains_special_character": "Field contains Special character"
10
+ "cmdfieldvalidation.field_contains_special_character": "Field contains special character",
11
+ "cmdfieldvalidation.input_has_minimum_length": "Input has minimum length"
11
12
  }
12
13
  }
13
14
  }
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