comand-component-library 3.3.84 → 3.3.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/comand-component-library.js +5623 -3929
- package/dist/comand-component-library.umd.cjs +4 -4
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/src/App.vue +215 -112
- package/src/assets/data/component-structure.json +228 -0
- package/src/assets/data/form-elements.json +156 -0
- package/src/assets/data/opening-hours.json +79 -37
- package/src/components/CmdAddressData.vue +187 -201
- package/src/components/CmdAddressDataItem.vue +306 -0
- package/src/components/CmdBox.vue +1 -0
- package/src/components/CmdBoxWrapper.vue +53 -5
- package/src/components/CmdFancyBox.vue +31 -4
- package/src/components/CmdForm.vue +98 -4
- package/src/components/CmdFormElement.vue +5 -1
- package/src/components/CmdHeadline.vue +179 -52
- package/src/components/CmdImage.vue +205 -76
- package/src/components/CmdImageGallery.vue +88 -85
- package/src/components/CmdListOfLinks.vue +63 -43
- package/src/components/CmdListOfLinksItem.vue +97 -0
- package/src/components/CmdLoginForm.vue +3 -6
- package/src/components/CmdMultistepFormProgressBar.vue +37 -8
- package/src/components/CmdOpeningHours.vue +280 -63
- package/src/components/CmdOpeningHoursItem.vue +264 -0
- package/src/components/{CmdPager.vue → CmdPagination.vue} +2 -2
- package/src/components/CmdSlideshow.vue +137 -10
- package/src/components/CmdSocialNetworks.vue +115 -28
- package/src/components/CmdSocialNetworksItem.vue +184 -0
- package/src/components/CmdTable.vue +0 -1
- package/src/components/CmdTextImageBlock.vue +158 -0
- package/src/components/CmdThumbnailScroller.vue +132 -12
- package/src/components/CmdToggleDarkMode.vue +58 -1
- package/src/components/EditComponentWrapper.vue +553 -0
- package/src/index.js +2 -2
- package/src/mixins/EditMode.vue +28 -9
- package/src/utils/editmode.js +30 -5
- package/src/components/CmdTextBlock.vue +0 -73
- package/src/editmode/editModeContext.js +0 -50
@@ -1,42 +1,129 @@
|
|
1
1
|
<template>
|
2
2
|
<div class="cmd-opening-hours">
|
3
|
-
<!-- begin cmd-
|
4
|
-
<CmdHeadline
|
5
|
-
|
3
|
+
<!-- begin cmd-headline -->
|
4
|
+
<CmdHeadline
|
5
|
+
v-if="cmdHeadline?.headlineText || editModeContext"
|
6
|
+
v-bind="cmdHeadline"
|
7
|
+
/>
|
8
|
+
<!-- end cmd-headline -->
|
6
9
|
|
7
10
|
<!-- begin opening-status with link to detail-page -->
|
8
|
-
<template v-if="
|
9
|
-
<
|
10
|
-
|
11
|
-
|
11
|
+
<template v-if="!editing">
|
12
|
+
<template v-if="link && link?.path && link?.show">
|
13
|
+
<a v-if="link.type === 'href'" :href="link.path" :class="{closed: isClosed}">{{ textOpenClosed }}</a>
|
14
|
+
<router-link v-if="link.type === 'router'" :to="link.path" :class="{closed: isClosed}">{{
|
15
|
+
textOpenClosed
|
16
|
+
}}
|
17
|
+
</router-link>
|
18
|
+
<button v-if="link.type === 'button'" :class="['button', {closed: isClosed}]">{{
|
19
|
+
textOpenClosed
|
20
|
+
}}
|
21
|
+
</button>
|
22
|
+
</template>
|
23
|
+
<!-- end opening-status with link to detail-page -->
|
24
|
+
|
25
|
+
<!-- begin opening-status (without link) -->
|
26
|
+
<span v-else :class="{'closed': isClosed}">{{ textOpenClosed }}</span>
|
27
|
+
<!-- end opening-status (without link) -->
|
12
28
|
</template>
|
13
|
-
<!-- end opening-status with link to detail-page -->
|
14
29
|
|
15
|
-
<!-- begin
|
16
|
-
<
|
17
|
-
|
30
|
+
<!-- begin edit-mode -->
|
31
|
+
<div v-else class="flex-container">
|
32
|
+
<CmdFormElement
|
33
|
+
element="input"
|
34
|
+
type="text"
|
35
|
+
:showLabel="false"
|
36
|
+
labelText="Text for 'open'"
|
37
|
+
placeholder="Text for 'open'"
|
38
|
+
v-model="textOpenModel"
|
39
|
+
/>
|
40
|
+
<CmdFormElement
|
41
|
+
element="input"
|
42
|
+
type="text"
|
43
|
+
:showLabel="false"
|
44
|
+
labelText="Text for 'closed'"
|
45
|
+
placeholder="Text for 'closed'"
|
46
|
+
v-model="textClosedModel"
|
47
|
+
/>
|
48
|
+
</div>
|
49
|
+
<!-- end edit-mode -->
|
18
50
|
|
19
|
-
<!-- begin
|
20
|
-
<dl>
|
21
|
-
<
|
22
|
-
|
23
|
-
|
24
|
-
|
51
|
+
<!-- begin default view -->
|
52
|
+
<dl v-if="!editModeContext">
|
53
|
+
<CmdOpeningHoursItem
|
54
|
+
v-for="(day, index) in openingHoursFormatted"
|
55
|
+
:key="index"
|
56
|
+
:day="day"
|
57
|
+
:separator="separator"
|
58
|
+
:abbreviationText="abbreviationText"
|
59
|
+
/>
|
25
60
|
</dl>
|
26
|
-
<!-- end
|
61
|
+
<!-- end default view -->
|
62
|
+
|
63
|
+
<!-- begin edit-mode -->
|
64
|
+
<button v-if="openingHoursFormatted.length === 0" type="button" class="button confirm small" @click="onAddItem">
|
65
|
+
<span class="icon-plus"></span>
|
66
|
+
<span>Add new entry</span>
|
67
|
+
</button>
|
68
|
+
|
69
|
+
<EditComponentWrapper
|
70
|
+
v-else
|
71
|
+
v-for="(day, index) in openingHoursFormatted"
|
72
|
+
:key="'x' + index"
|
73
|
+
class="edit-items"
|
74
|
+
:showComponentName="false"
|
75
|
+
componentName="CmdOpeningHoursItem"
|
76
|
+
:componentProps="day"
|
77
|
+
:allowedComponentTypes="[]"
|
78
|
+
:componentPath="['props', 'openingHours', index]"
|
79
|
+
:itemProvider="itemProvider"
|
80
|
+
>
|
81
|
+
<dl class="edit-mode-opening-hours-item">
|
82
|
+
<CmdOpeningHoursItem
|
83
|
+
:day="day"
|
84
|
+
:separator="separator"
|
85
|
+
:abbreviationText="abbreviationText"
|
86
|
+
/>
|
87
|
+
</dl>
|
88
|
+
</EditComponentWrapper>
|
89
|
+
<!-- end edit-mode -->
|
27
90
|
|
28
91
|
<!-- begin holiday-closes-text and miscellaneous information -->
|
29
|
-
<div v-if="
|
30
|
-
<p v-if="
|
31
|
-
<strong>{{
|
92
|
+
<div v-if="!editing && (textHolidays || textMiscInfo)">
|
93
|
+
<p v-if="textHolidays">
|
94
|
+
<strong>{{ textHolidays }}</strong>
|
32
95
|
</p>
|
33
96
|
<p v-if="textMiscInfo">{{ textMiscInfo }}</p>
|
34
97
|
</div>
|
35
98
|
<!-- end holiday-closes-text and miscellaneous information -->
|
99
|
+
|
100
|
+
<!-- begin edit-mode -->
|
101
|
+
<div v-if="editing" class="flex-container vertical">
|
102
|
+
<CmdFormElement
|
103
|
+
element="input"
|
104
|
+
type="text"
|
105
|
+
:showLabel="false"
|
106
|
+
labelText="Text for 'holidays'"
|
107
|
+
placeholder="Text for 'holidays'"
|
108
|
+
v-model="textHolidaysModel"
|
109
|
+
/>
|
110
|
+
<CmdFormElement
|
111
|
+
element="input"
|
112
|
+
type="text"
|
113
|
+
:showLabel="false"
|
114
|
+
labelText="Miscellaneous information"
|
115
|
+
placeholder="Miscellaneous information"
|
116
|
+
v-model="textMiscInfoModel"
|
117
|
+
/>
|
118
|
+
</div>
|
119
|
+
<!-- end edit-mode -->
|
36
120
|
</div>
|
37
121
|
</template>
|
38
122
|
|
39
123
|
<script>
|
124
|
+
import EditMode from "../mixins/EditMode.vue"
|
125
|
+
import {buildComponentPath, updateHandlerProvider} from "../utils/editmode.js"
|
126
|
+
|
40
127
|
export function localizedTime(language) {
|
41
128
|
return (hour, minute) => {
|
42
129
|
const now = new Date()
|
@@ -47,17 +134,17 @@ export function localizedTime(language) {
|
|
47
134
|
|
48
135
|
export function timeFormatting(separator, suffix1, suffix2, hoursLeadingZero = true) {
|
49
136
|
function addLeadingZero(time, addLeadingZero) {
|
50
|
-
if(addLeadingZero && time < 10) {
|
137
|
+
if (addLeadingZero && time < 10) {
|
51
138
|
return "0" + time
|
52
139
|
}
|
53
140
|
return time
|
54
141
|
}
|
55
142
|
|
56
143
|
return (hour, minute) => {
|
57
|
-
if(suffix2) {
|
144
|
+
if (suffix2) {
|
58
145
|
let hour12 = hour
|
59
146
|
let currentSuffix = suffix1
|
60
|
-
if(hour12 > 12) {
|
147
|
+
if (hour12 > 12) {
|
61
148
|
hour12 -= 12
|
62
149
|
currentSuffix = suffix2
|
63
150
|
}
|
@@ -69,6 +156,17 @@ export function timeFormatting(separator, suffix1, suffix2, hoursLeadingZero = t
|
|
69
156
|
|
70
157
|
export default {
|
71
158
|
name: "CmdOpeningHours",
|
159
|
+
mixins: [EditMode],
|
160
|
+
data() {
|
161
|
+
return {
|
162
|
+
currentTime: new Date(),
|
163
|
+
editableOpeningHours: [],
|
164
|
+
editableTextOpen: null,
|
165
|
+
editableTextClosed: null,
|
166
|
+
editableTextHolidays: null,
|
167
|
+
editableTextMiscInfo: null
|
168
|
+
}
|
169
|
+
},
|
72
170
|
props: {
|
73
171
|
/**
|
74
172
|
* set a link to a detail page
|
@@ -100,6 +198,14 @@ export default {
|
|
100
198
|
type: String,
|
101
199
|
default: "Closed right now!"
|
102
200
|
},
|
201
|
+
separator: {
|
202
|
+
type: String,
|
203
|
+
default: "–"
|
204
|
+
},
|
205
|
+
abbreviationText: {
|
206
|
+
type: String,
|
207
|
+
default: "h"
|
208
|
+
},
|
103
209
|
/**
|
104
210
|
* list of opening-hours
|
105
211
|
*/
|
@@ -108,9 +214,9 @@ export default {
|
|
108
214
|
required: true
|
109
215
|
},
|
110
216
|
/**
|
111
|
-
* text to show
|
217
|
+
* text to show for holidays (shown below opening-hours)
|
112
218
|
*/
|
113
|
-
|
219
|
+
textHolidays: {
|
114
220
|
type: String,
|
115
221
|
required: false
|
116
222
|
},
|
@@ -151,7 +257,7 @@ export default {
|
|
151
257
|
}
|
152
258
|
},
|
153
259
|
mounted() {
|
154
|
-
if(this.componentHandlesClosedStatus && this.checkInterval > 0) {
|
260
|
+
if (this.componentHandlesClosedStatus && this.checkInterval > 0) {
|
155
261
|
// create new property on component by 'this.property-name' and assign value (id) from setInterval (so it can be cleared in unmount)
|
156
262
|
this.$_CmdOpeningHours_intervalId = setInterval(() => {
|
157
263
|
// use arrow-function to assure that 'this' is the component
|
@@ -159,44 +265,95 @@ export default {
|
|
159
265
|
}, this.checkInterval)
|
160
266
|
}
|
161
267
|
},
|
162
|
-
|
163
|
-
|
164
|
-
|
268
|
+
beforeUnmount() {
|
269
|
+
if (this.$_CmdOpeningHours_intervalId) {
|
270
|
+
// remove interval
|
271
|
+
clearInterval(this.$_CmdOpeningHours_intervalId)
|
272
|
+
|
273
|
+
// clear interval-id
|
274
|
+
this.$_CmdOpeningHours_intervalId = null
|
165
275
|
}
|
166
276
|
},
|
167
277
|
computed: {
|
168
|
-
textOpenClosed() {
|
169
|
-
return this.isClosed ? this.textClosed : this.textOpen
|
170
|
-
},
|
171
278
|
openingHoursFormatted() {
|
172
279
|
const weekdays = []
|
173
|
-
for(let i = 0; i < this.openingHours.length; i++) {
|
280
|
+
for (let i = 0; i < this.openingHours.length; i++) {
|
174
281
|
const openingHours = {}
|
175
|
-
const
|
176
|
-
const
|
282
|
+
const splitAmFromTime = this.openingHours[i].am.fromTime.split(/[:.]/)
|
283
|
+
const splitAmTillTime = this.openingHours[i].am.tillTime.split(/[:.]/)
|
284
|
+
const splitPmFromTime = this.openingHours[i].pm.fromTime.split(/[:.]/)
|
285
|
+
const splitPmTillTime = this.openingHours[i].pm.tillTime.split(/[:.]/)
|
177
286
|
|
178
287
|
openingHours.day = this.openingHours[i].day
|
179
|
-
|
180
|
-
|
181
|
-
|
288
|
+
|
289
|
+
openingHours.am = {...this.openingHours[i].am}
|
290
|
+
openingHours.am.fromTime = {
|
291
|
+
hours: parseInt(splitAmFromTime[0]),
|
292
|
+
mins: parseInt(splitAmFromTime[1])
|
293
|
+
}
|
294
|
+
openingHours.am.tillTime = {
|
295
|
+
hours: parseInt(splitAmTillTime[0]),
|
296
|
+
mins: parseInt(splitAmTillTime[1])
|
297
|
+
}
|
298
|
+
|
299
|
+
openingHours.pm = {...this.openingHours[i].pm}
|
300
|
+
openingHours.pm.fromTime = {
|
301
|
+
hours: parseInt(splitPmFromTime[0]),
|
302
|
+
mins: parseInt(splitPmFromTime[1])
|
182
303
|
}
|
183
|
-
openingHours.tillTime = {
|
184
|
-
hours: parseInt(
|
185
|
-
mins: parseInt(
|
304
|
+
openingHours.pm.tillTime = {
|
305
|
+
hours: parseInt(splitPmTillTime[0]),
|
306
|
+
mins: parseInt(splitPmTillTime[1])
|
186
307
|
}
|
308
|
+
|
187
309
|
weekdays.push(openingHours)
|
188
310
|
}
|
189
311
|
return weekdays
|
190
312
|
},
|
313
|
+
textOpenModel: {
|
314
|
+
get() {
|
315
|
+
return this.editableTextOpen == null ? this.textOpen : this.editableTextOpen
|
316
|
+
},
|
317
|
+
set(value) {
|
318
|
+
this.editableTextOpen = value
|
319
|
+
}
|
320
|
+
},
|
321
|
+
textClosedModel: {
|
322
|
+
get() {
|
323
|
+
return this.editableTextClosed == null ? this.textClosed : this.editableTextClosed
|
324
|
+
},
|
325
|
+
set(value) {
|
326
|
+
this.editableTextClosed = value
|
327
|
+
}
|
328
|
+
},
|
329
|
+
textHolidaysModel: {
|
330
|
+
get() {
|
331
|
+
return this.editableTextHolidays == null ? this.textHolidays : this.editableTextHolidays
|
332
|
+
},
|
333
|
+
set(value) {
|
334
|
+
this.editableTextHolidays = value
|
335
|
+
}
|
336
|
+
},
|
337
|
+
textMiscInfoModel: {
|
338
|
+
get() {
|
339
|
+
return this.editableTextMiscInfo == null ? this.textMiscInfo : this.editableTextMiscInfo
|
340
|
+
},
|
341
|
+
set(value) {
|
342
|
+
this.editableTextMiscInfo = value
|
343
|
+
}
|
344
|
+
},
|
345
|
+
textOpenClosed() {
|
346
|
+
return this.isClosed ? this.textClosed : this.textOpen
|
347
|
+
},
|
191
348
|
isClosed() {
|
192
|
-
if(!this.componentHandlesClosedStatus) {
|
349
|
+
if (!this.componentHandlesClosedStatus) {
|
193
350
|
return this.closed
|
194
351
|
}
|
195
352
|
|
196
353
|
let currentDay = this.currentTime.getDay()
|
197
354
|
|
198
355
|
// fix order and check if currentDay equals 0 === sunday. Data are expected to start with monday
|
199
|
-
if (currentDay === 0){
|
356
|
+
if (currentDay === 0) {
|
200
357
|
currentDay = 6
|
201
358
|
} else {
|
202
359
|
currentDay -= 1
|
@@ -204,14 +361,23 @@ export default {
|
|
204
361
|
|
205
362
|
const openingHours = this.openingHoursFormatted[currentDay]
|
206
363
|
|
207
|
-
if(this.openingHoursFormatted[currentDay]) {
|
208
|
-
|
209
|
-
|
364
|
+
if (this.openingHoursFormatted[currentDay]) {
|
365
|
+
// set hours for AM
|
366
|
+
const openingHoursAmFrom = new Date()
|
367
|
+
openingHoursAmFrom.setHours(openingHours.am.fromTime.hours, openingHours.am.fromTime.mins)
|
210
368
|
|
211
|
-
const
|
212
|
-
|
369
|
+
const openingHoursAmTill = new Date()
|
370
|
+
openingHoursAmTill.setHours(openingHours.am.tillTime.hours, openingHours.am.tillTime.mins)
|
213
371
|
|
214
|
-
|
372
|
+
// set hours for PM
|
373
|
+
const openingHoursPmFrom = new Date()
|
374
|
+
openingHoursPmFrom.setHours(openingHours.pm.fromTime.hours, openingHours.pm.fromTime.mins)
|
375
|
+
|
376
|
+
const openingHoursPmTill = new Date()
|
377
|
+
openingHoursPmTill.setHours(openingHours.pm.tillTime.hours, openingHours.pm.tillTime.mins)
|
378
|
+
|
379
|
+
// compare am/pm times with current time to determine if closed/open-text will be displayed
|
380
|
+
if ((openingHoursAmFrom <= this.currentTime && this.currentTime <= openingHoursAmTill) && (openingHoursPmFrom <= this.currentTime && this.currentTime <= openingHoursPmTill)) {
|
215
381
|
return false
|
216
382
|
}
|
217
383
|
}
|
@@ -219,20 +385,50 @@ export default {
|
|
219
385
|
}
|
220
386
|
},
|
221
387
|
methods: {
|
388
|
+
onAddItem() {
|
389
|
+
this.editModeContext.content.addContent(
|
390
|
+
buildComponentPath(this, 'props', 'openingHours', -1),
|
391
|
+
this.itemProvider)
|
392
|
+
},
|
393
|
+
itemProvider() {
|
394
|
+
return {
|
395
|
+
"day": "Weekday",
|
396
|
+
"am": {
|
397
|
+
"fromTime": "00:00",
|
398
|
+
"tillTime": "00:00"
|
399
|
+
},
|
400
|
+
"pm": {
|
401
|
+
"fromTime": "00:00",
|
402
|
+
"tillTime": "00:00"
|
403
|
+
}
|
404
|
+
}
|
405
|
+
},
|
222
406
|
getTime(time) {
|
223
|
-
if(this.timeFormatter) {
|
407
|
+
if (this.timeFormatter) {
|
224
408
|
return this.timeFormatter(time.hours, time.mins)
|
225
409
|
}
|
226
|
-
|
227
|
-
}
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
410
|
+
return timeFormatting(":", " hrs", "", false)(time.hours, time.mins)
|
411
|
+
},
|
412
|
+
updateHandlerProvider() {
|
413
|
+
const openingHours = this.editableOpeningHours
|
414
|
+
const textOpen = this.editableTextOpen
|
415
|
+
const textClosed = this.editableTextClosed
|
416
|
+
const textHolidays = this.editableTextHolidays
|
417
|
+
const textMiscInfo = this.editableTextMiscInfo
|
418
|
+
return updateHandlerProvider(this, {
|
419
|
+
update(props, childUpdateHandlers) {
|
420
|
+
props.openingHours = openingHours
|
421
|
+
props.textOpen = textOpen
|
422
|
+
props.textClosed = textClosed
|
423
|
+
props.textHolidays = textHolidays
|
424
|
+
props.textMiscInfo = textMiscInfo
|
425
|
+
const cmdHeadlineUpdateHandler = childUpdateHandlers?.find(handler => handler.name === "CmdHeadline")
|
426
|
+
if (cmdHeadlineUpdateHandler) {
|
427
|
+
props.cmdHeadline = props.cmdHeadline || {}
|
428
|
+
cmdHeadlineUpdateHandler.update(props.cmdHeadline)
|
429
|
+
}
|
430
|
+
}
|
431
|
+
})
|
236
432
|
}
|
237
433
|
}
|
238
434
|
}
|
@@ -247,10 +443,10 @@ export default {
|
|
247
443
|
display: table;
|
248
444
|
margin-bottom: var(--default-margin);
|
249
445
|
color: var(--pure-white);
|
250
|
-
background:
|
446
|
+
background: var(--success-color);
|
251
447
|
|
252
448
|
&.closed {
|
253
|
-
background:
|
449
|
+
background: var(--error-color);
|
254
450
|
}
|
255
451
|
}
|
256
452
|
|
@@ -261,9 +457,30 @@ export default {
|
|
261
457
|
}
|
262
458
|
}
|
263
459
|
|
460
|
+
span.pm {
|
461
|
+
margin-left: var(--default-margin);
|
462
|
+
}
|
463
|
+
|
264
464
|
p:last-child {
|
265
465
|
margin: 0;
|
266
466
|
}
|
467
|
+
|
468
|
+
.edit-component-wrapper {
|
469
|
+
dl {
|
470
|
+
margin-bottom: 0;
|
471
|
+
}
|
472
|
+
}
|
473
|
+
}
|
474
|
+
|
475
|
+
.edit-component-wrapper .cmd-opening-hours {
|
476
|
+
display: flex;
|
477
|
+
flex-direction: column;
|
478
|
+
align-items: flex-start;
|
479
|
+
gap: calc(var(--default-gap) / 2);
|
480
|
+
|
481
|
+
dt {
|
482
|
+
min-width: 2.5rem;
|
483
|
+
}
|
267
484
|
}
|
268
485
|
|
269
486
|
/* end cmd-opening-hours ------------------------------------------------------------------------------------------ */
|