comand-component-library 4.2.39 → 4.2.41

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.
@@ -0,0 +1,81 @@
1
+ <template>
2
+ <section :class="['cmd-section flex-container', {box: styleAsBox, 'vertical': orientation === 'vertical'}]">
3
+ <!-- begin CmdHeadline -->
4
+ <CmdHeadline
5
+ v-if="cmdHeadline?.headlineText"
6
+ v-bind="cmdHeadlineProperties"
7
+ />
8
+ <!-- end CmdHeadline -->
9
+
10
+ <!-- begin content provided by property -->
11
+ <div v-if="content && !useSlot" v-html="content"></div>
12
+ <!-- end content provided by property -->
13
+
14
+ <!-- begin slot -->
15
+ <slot v-else></slot>
16
+ <!-- end slot -->
17
+ </section>
18
+ </template>
19
+
20
+ <script>
21
+ export default {
22
+ name: "CmdSection",
23
+ props: {
24
+ /**
25
+ * provide content for section
26
+ */
27
+ content: {
28
+ type: String,
29
+ required: false
30
+ },
31
+ /**
32
+ * define if (default) slot should be used
33
+ */
34
+ useSlot: {
35
+ type: Boolean,
36
+ default: false
37
+ },
38
+ /**
39
+ * set if section should be styled as box
40
+ */
41
+ styleAsBox: {
42
+ type: Boolean,
43
+ default: false
44
+ },
45
+ /**
46
+ * set orientation for content
47
+ *
48
+ * @allowedValues: horizontal, vertical
49
+ */
50
+ orientation: {
51
+ type: String,
52
+ default: "vertical"
53
+ },
54
+ /**
55
+ * set properties for CmdHeadline-component
56
+ *
57
+ * @requiredForAccessibility: true
58
+ */
59
+ cmdHeadline: {
60
+ type: Object,
61
+ default: false
62
+ }
63
+ },
64
+ computed: {
65
+ cmdHeadlineProperties() {
66
+ return {
67
+ headlineLevel: 2,
68
+ ...this.cmdHeadline
69
+ }
70
+ }
71
+ }
72
+ }
73
+ </script>
74
+
75
+ <style>
76
+ .cmd-section {
77
+ &:not(.box) {
78
+ padding: 0;
79
+ }
80
+ }
81
+ </style>
package/src/index.js CHANGED
@@ -34,6 +34,7 @@ export { default as CmdPagination } from '@/components/CmdPagination.vue'
34
34
  export { default as CmdPageFooter } from '@/components/CmdPageFooter.vue'
35
35
  export { default as CmdPageHeader } from '@/components/CmdPageHeader.vue'
36
36
  export { default as CmdProgressBar } from '@/components/CmdProgressBar.vue'
37
+ export { default as CmdSection } from '@/components/CmdSection.vue'
37
38
  export { default as CmdSidebar } from '@/components/CmdSidebar.vue'
38
39
  export { default as CmdSiteFooter } from '@/components/CmdSiteFooter.vue'
39
40
  export { default as CmdSiteHeader } from '@/components/CmdSiteHeader.vue'
@@ -71,7 +72,7 @@ export { createUuid, createHtmlId } from '@/utils/common'
71
72
  export { getFileExtension } from '@/utils/getFileExtension'
72
73
  export { capitalizeFirstLetter, lowercaseFirstLetter, fullName } from '@/utils/string'
73
74
  export { setCookieDisclaimerCookie, getCookieDisclaimerCookie } from '@/utils/cookie'
74
- export { currentDate, currentTime, formatDate, formatTime } from "@/utils/date"
75
+ export { currentDate, currentTime, getDate, getWeekday, formatDate, formatTime } from "@/utils/date"
75
76
 
76
77
  // export composables
77
78
  export { useSequence } from '@/composables/sequence'
package/src/utils/date.js CHANGED
@@ -25,6 +25,25 @@ function getDate(inputDate, operator = "+", days = 1) {
25
25
  return date
26
26
  }
27
27
 
28
+ function getWeekday(dateString, format = "short") {
29
+ // Create date object from YYYY-MM-DD string
30
+ const date = new Date(dateString);
31
+
32
+ // Arrays for codes and full names
33
+ const codes = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
34
+ const fullNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
35
+
36
+ // Decide what to return
37
+ if (format === "short") {
38
+ return codes[date.getDay()];
39
+ } else if (format === "long") {
40
+ return fullNames[date.getDay()];
41
+ } else {
42
+ throw new Error("Invalid format. Use 'short' or 'long'.");
43
+ }
44
+ }
45
+
46
+
28
47
  function formatDate(inputDate, format = "dmy", separator= ".") {
29
48
  // Ensure the input is a valid date object or string
30
49
  const date = new Date(inputDate)
@@ -77,4 +96,4 @@ function formatTime(timeString = "00:00", format = 24, textAfter = "h") {
77
96
  }
78
97
  }
79
98
 
80
- export {currentDate, currentTime, formatDate, formatTime}
99
+ export {currentDate, currentTime, getDate, getWeekday, formatDate, formatTime}