comand-component-library 3.3.84 → 3.3.86

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. package/dist/comand-component-library.js +5623 -3929
  2. package/dist/comand-component-library.umd.cjs +4 -4
  3. package/dist/style.css +1 -1
  4. package/package.json +2 -2
  5. package/src/App.vue +215 -112
  6. package/src/assets/data/component-structure.json +228 -0
  7. package/src/assets/data/form-elements.json +156 -0
  8. package/src/assets/data/opening-hours.json +79 -37
  9. package/src/components/CmdAddressData.vue +187 -201
  10. package/src/components/CmdAddressDataItem.vue +306 -0
  11. package/src/components/CmdBox.vue +1 -0
  12. package/src/components/CmdBoxWrapper.vue +53 -5
  13. package/src/components/CmdFancyBox.vue +31 -4
  14. package/src/components/CmdForm.vue +98 -4
  15. package/src/components/CmdFormElement.vue +5 -1
  16. package/src/components/CmdHeadline.vue +179 -52
  17. package/src/components/CmdImage.vue +205 -76
  18. package/src/components/CmdImageGallery.vue +88 -85
  19. package/src/components/CmdListOfLinks.vue +63 -43
  20. package/src/components/CmdListOfLinksItem.vue +97 -0
  21. package/src/components/CmdLoginForm.vue +3 -6
  22. package/src/components/CmdMultistepFormProgressBar.vue +37 -8
  23. package/src/components/CmdOpeningHours.vue +280 -63
  24. package/src/components/CmdOpeningHoursItem.vue +264 -0
  25. package/src/components/{CmdPager.vue → CmdPagination.vue} +2 -2
  26. package/src/components/CmdSlideshow.vue +137 -10
  27. package/src/components/CmdSocialNetworks.vue +115 -28
  28. package/src/components/CmdSocialNetworksItem.vue +184 -0
  29. package/src/components/CmdTable.vue +0 -1
  30. package/src/components/CmdTextImageBlock.vue +158 -0
  31. package/src/components/CmdThumbnailScroller.vue +132 -12
  32. package/src/components/CmdToggleDarkMode.vue +58 -1
  33. package/src/components/EditComponentWrapper.vue +553 -0
  34. package/src/index.js +2 -2
  35. package/src/mixins/EditMode.vue +28 -9
  36. package/src/utils/editmode.js +30 -5
  37. package/src/components/CmdTextBlock.vue +0 -73
  38. package/src/editmode/editModeContext.js +0 -50
@@ -1,6 +1,21 @@
1
1
  <template>
2
- <div :class="['cmd-thumbnail-scroller', {'gallery-scroller' : !allowOpenFancyBox, 'full-width' : fullWidth, 'large-icons': largeIcons}]"
2
+ <div :class="[
3
+ 'cmd-thumbnail-scroller',
4
+ {
5
+ 'gallery-scroller' : useGalleryScroller,
6
+ 'large-icons': largeIcons,
7
+ vertical: orientation === 'vertical'
8
+ },
9
+ fullWidthClass
10
+ ]"
3
11
  ref="thumbnail-scroller">
12
+ <!-- begin cmd-headline -->
13
+ <CmdHeadline
14
+ v-if="cmdHeadline?.headlineText || editModeContext"
15
+ v-bind="cmdHeadline"
16
+ />
17
+ <!-- end cmd-headline -->
18
+
4
19
  <div class="inner-thumbnail-wrapper">
5
20
  <!-- begin CmdSlideButton -->
6
21
  <CmdSlideButton
@@ -14,9 +29,9 @@
14
29
  <transition-group name="slide" tag="ul">
15
30
  <li v-for="(item, index) in items" :key="index"
16
31
  :class="[{'active' : activeItemIndex === index}, item.id ? 'item-' + item.id : '']">
17
- <a :href="executeOnClick === 'url' ? item.url : '#'"
32
+ <a v-if="!editModeContext" :href="executeOnClick === 'url' ? item.url : '#'"
18
33
  @click="executeLink(index, $event)"
19
- :title="getTooltip"
34
+ :title="tooltip"
20
35
  :target="executeOnClick === 'url' ? '_blank' : null"
21
36
  >
22
37
  <!-- begin CmdImage -->
@@ -32,15 +47,44 @@
32
47
  </template>
33
48
  <!-- end contentType === text -->
34
49
  </a>
50
+
51
+ <!-- begin edit-mode -->
52
+ <!-- begin CmdImage -->
53
+ <CmdImage
54
+ v-else-if="contentType === 'image'"
55
+ :image="item.image"
56
+ :figcaption="item.figcaption"
57
+ :componentPath="['props', 'thumbnailScrollerItems', index]"
58
+ :editModeConfig="imageStructure()"
59
+ />
60
+ <!-- end CmdImage -->
61
+
62
+ <!-- begin contentType === text -->
63
+ <template v-else-if="contentType === 'text'">
64
+ <!-- begin CmdIcon -->
65
+ <CmdIcon v-if="item.iconClass" :iconClass="item.iconClass" :type="item.iconType"/>
66
+ <!-- end CmdIcon -->
67
+ <span v-if="item.text">{{ item.text }}</span>
68
+ </template>
69
+ <!-- end contentType === text -->
70
+ <!-- end edit-mode -->
71
+ </li>
72
+ <li v-if="!items.length && contentType === 'image'">
73
+ <!-- begin show placeholder if no image exists (and component is not edited) -->
74
+ <button type="button" class="button confirm" @click="onAddItem">
75
+ <span class="icon-plus"></span>
76
+ <span>Add new thumbnail-scroller-image</span>
77
+ </button>
78
+ <!-- end show placeholder if no image exists (and component is not edited) -->
35
79
  </li>
36
80
  </transition-group>
37
81
  <!-- end list of images to slide -->
38
82
 
39
83
  <!-- begin CmdSlideButton -->
40
84
  <CmdSlideButton
41
- v-if="showSlidebuttons"
42
- @click.prevent="showNextItem"
43
- :slideButtons="cmdSlideButtons.next"
85
+ v-if="showSlidebuttons"
86
+ @click.prevent="showNextItem"
87
+ :slideButtons="cmdSlideButtons.next"
44
88
  />
45
89
  <!-- end CmdSlideButton -->
46
90
  </div>
@@ -49,18 +93,22 @@
49
93
 
50
94
  <script>
51
95
  // import functions
96
+ import {createUuid} from "../utils/common"
52
97
  import {openFancyBox} from './CmdFancyBox.vue'
53
98
 
54
99
  // import mixins
55
100
  import I18n from "../mixins/I18n"
56
101
  import DefaultMessageProperties from "../mixins/CmdThumbnailScroller/DefaultMessageProperties"
102
+ import EditMode from "../mixins/EditMode.vue"
103
+ import {buildComponentPath} from "../utils/editmode.js"
57
104
 
58
105
  export default {
59
106
  name: "CmdThumbnailScroller",
60
107
  emits: ["click"],
61
108
  mixins: [
62
109
  I18n,
63
- DefaultMessageProperties
110
+ DefaultMessageProperties,
111
+ EditMode
64
112
  ],
65
113
  data() {
66
114
  return {
@@ -69,6 +117,10 @@ export default {
69
117
  }
70
118
  },
71
119
  props: {
120
+ orientation: {
121
+ type: String,
122
+ default: "horizontal"
123
+ },
72
124
  /**
73
125
  * activate to stretch component to full width (of parent element)
74
126
  *
@@ -138,6 +190,20 @@ export default {
138
190
  }
139
191
  }
140
192
  },
193
+ /**
194
+ * activate if the thumbnail-scroller should be used as gallery-scroller stuck at the bottom of the page
195
+ */
196
+ useGalleryScroller: {
197
+ type: Boolean,
198
+ default: false
199
+ },
200
+ /**
201
+ * properties for CmdHeadline-component
202
+ */
203
+ cmdHeadline: {
204
+ type: Object,
205
+ required: false
206
+ },
141
207
  /**
142
208
  * properties for CmdSlideButtons-component
143
209
  *
@@ -167,14 +233,14 @@ export default {
167
233
  },
168
234
  mounted() {
169
235
  const thumbnailScrollerWrapper = this.$refs["thumbnail-scroller"]
170
- const innerListWrapper = thumbnailScrollerWrapper.querySelector(":scope > ul")
236
+ const innerListWrapper = thumbnailScrollerWrapper.querySelector("ul")
171
237
 
172
238
  // watch container-size / -overflow on resize
173
239
  const resizeObserver = new ResizeObserver(() => this.toggleSlideButtons(innerListWrapper))
174
240
  resizeObserver.observe(thumbnailScrollerWrapper)
175
241
  },
176
242
  computed: {
177
- getTooltip() {
243
+ tooltip() {
178
244
  if (this.contentType === "image") {
179
245
  return this.getMessage("cmdthumbnailscroller.tooltip.open_large_image")
180
246
  }
@@ -182,9 +248,49 @@ export default {
182
248
  return this.getMessage("cmdthumbnailscroller.tooltip.open_url")
183
249
  }
184
250
  return this.getMessage("cmdthumbnailscroller.tooltip.open")
251
+ },
252
+ fullWidthClass() {
253
+ if (this.orientation === "horizontal") {
254
+ return "full-width"
255
+ }
256
+ return null
185
257
  }
186
258
  },
187
259
  methods: {
260
+ itemProvider() {
261
+ return {
262
+ "image": {
263
+ "id": createUuid(),
264
+ "src": "/media/images/demo-images/small/landscape-01.jpg",
265
+ "srcImageLarge": "/media/images/demo-images/large/landscape-01.jpg",
266
+ "alt": "Alternative Text",
267
+ "tooltip": "Tooltip 1"
268
+ },
269
+ "figcaption": {
270
+ "text": "Figcaption DE",
271
+ "position": "bottom",
272
+ "textAlign": "center",
273
+ "show": true
274
+ }
275
+ }
276
+ },
277
+ onAddItem() {
278
+ this.editModeContext.content.addContent(
279
+ buildComponentPath(this, 'props', 'thumbnailScrollerItems', -1),
280
+ this.itemProvider)
281
+ },
282
+ imageStructure() {
283
+ return {
284
+ itemProviderOverwrite: () => ({
285
+ "image": {
286
+ "id": createUuid(),
287
+ "src": "/media/images/demo-images/small/landscape-01.jpg",
288
+ "srcImageLarge": "/media/images/demo-images/large/landscape-01.jpg",
289
+ "tooltip": "Tooltip DE"
290
+ }
291
+ })
292
+ }
293
+ },
188
294
  toggleSlideButtons(innerListWrapper) {
189
295
  this.showSlidebuttons = innerListWrapper.scrollWidth > innerListWrapper.clientWidth
190
296
  },
@@ -244,7 +350,8 @@ export default {
244
350
  return newItem
245
351
  })
246
352
  },
247
- immediate: true
353
+ immediate: true,
354
+ deep: true
248
355
  }
249
356
  }
250
357
  }
@@ -256,9 +363,11 @@ export default {
256
363
 
257
364
  .cmd-thumbnail-scroller {
258
365
  display: inline-flex; /* do not set to table to avoid overflow is not hidden on small devices */
366
+ flex-direction: column;
367
+ gap: var(--default-gap);
259
368
  width: 100%;
260
369
 
261
- &.full-width {
370
+ &.full-width:not(.vertical) {
262
371
  display: flex; /* allows flex-items to stretch equally over full space */
263
372
 
264
373
  > div {
@@ -268,7 +377,8 @@ export default {
268
377
 
269
378
  > .inner-thumbnail-wrapper {
270
379
  border-radius: var(--border-radius);
271
- padding: var(--default-padding);
380
+ padding: calc(var(--default-padding) * 2);
381
+ padding-top: 0;
272
382
  margin: 0 auto;
273
383
  border: var(--default-border);
274
384
  background: var(--color-scheme-background-color);
@@ -286,6 +396,7 @@ export default {
286
396
  align-self: center;
287
397
  list-style-type: none;
288
398
  margin: 0;
399
+ margin-top: 2rem;
289
400
 
290
401
  a {
291
402
  text-align: center;
@@ -293,6 +404,7 @@ export default {
293
404
 
294
405
  img {
295
406
  border-radius: var(--border-radius);
407
+ min-width: 15rem;
296
408
  max-height: 10rem;
297
409
  }
298
410
 
@@ -303,11 +415,18 @@ export default {
303
415
  }
304
416
  }
305
417
  }
418
+
419
+ .image-wrapper {
420
+ min-width: 11.1rem; // assure to be as wide as action-buttons in edit-mode
421
+ }
306
422
  }
307
423
  }
308
424
  }
309
425
 
310
426
  &.vertical {
427
+ width: auto;
428
+
429
+ .inner-thumbnail-wrapper {
311
430
  display: inline-flex;
312
431
  left: 50%;
313
432
  height: 75rem; /* remove later !!! */
@@ -335,6 +454,7 @@ export default {
335
454
  bottom: 0;
336
455
  }
337
456
  }
457
+ }
338
458
 
339
459
  &.gallery-scroller {
340
460
  max-width: var(--max-width);
@@ -1,5 +1,6 @@
1
1
  <template>
2
2
  <div :class="['cmd-toggle-dark-mode', {'styled-layout': useStyledLayout, 'dark-mode': darkMode}]">
3
+ <template v-if="!editing">
3
4
  <!-- begin button-style -->
4
5
  <a v-if="styledAsButton"
5
6
  href="#"
@@ -30,15 +31,44 @@
30
31
  @update:modelValue="setColorScheme"
31
32
  />
32
33
  <!-- end CmdFormElement -->
34
+ </template>
35
+
36
+ <template v-else>
37
+ <!-- begin edit-mode -->
38
+ <CmdFormElement
39
+ element="input"
40
+ type="text"
41
+ labelText="Label for Light Mode"
42
+ placeholder="Label for Light Mode"
43
+ v-model="labelTextLightModeModel"
44
+ />
45
+
46
+ <CmdFormElement
47
+ element="input"
48
+ type="text"
49
+ labelText="Label for Dark Mode"
50
+ placeholder="Label for Dark Mode"
51
+ v-model="labelTextDarkModeModel"
52
+ />
53
+ <!-- end edit-mode -->
54
+ </template>
33
55
  </div>
34
56
  </template>
35
57
 
36
58
  <script>
59
+ import EditMode from "../mixins/EditMode.vue"
60
+ import {updateHandlerProvider} from "../utils/editmode.js"
61
+
37
62
  export default {
38
63
  name: "ToggleDarkMode",
64
+ mixins: [
65
+ EditMode
66
+ ],
39
67
  data() {
40
68
  return {
41
- darkMode: false
69
+ darkMode: false,
70
+ editableLabelTextLightMode: null,
71
+ editableLabelTextDarkMode: null
42
72
  }
43
73
  },
44
74
  props: {
@@ -152,9 +182,36 @@ export default {
152
182
  toggleColorScheme() {
153
183
  this.darkMode = !this.darkMode
154
184
  this.setColorScheme()
185
+ },
186
+ updateHandlerProvider() {
187
+ const labelTextLightMode = this.labelTextLightModeModel
188
+ const labelTextDarkMode = this.labelTextDarkModeModel
189
+
190
+ return updateHandlerProvider(this, {
191
+ update(props) {
192
+ props.labelTextLightMode = labelTextLightMode
193
+ props.labelTextDarkMode = labelTextDarkMode
194
+ }
195
+ })
155
196
  }
156
197
  },
157
198
  computed: {
199
+ labelTextLightModeModel: {
200
+ get() {
201
+ return this.editableLabelTextLightMode == null ? this.labelTextLightMode: this.editableLabelTextLightMode
202
+ },
203
+ set(value) {
204
+ this.editableLabelTextLightMode = value
205
+ }
206
+ },
207
+ labelTextDarkModeModel: {
208
+ get() {
209
+ return this.editableLabelTextDarkMode == null ? this.labelTextDarkMode: this.editableLabelTextDarkMode
210
+ },
211
+ set(value) {
212
+ this.editableLabelTextDarkMode = value
213
+ }
214
+ },
158
215
  labelText() {
159
216
  return this.darkMode ? this.labelTextDarkMode : this.labelTextLightMode
160
217
  },