comand-component-library 4.1.91 → 4.1.92
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 +6381 -5808
- package/dist/style.css +1 -1
- package/package.json +3 -3
- package/src/ComponentLibrary.vue +23 -1
- package/src/assets/data/listOfComponents.json +1 -0
- package/src/assets/data/mail-tool.json +50 -0
- package/src/assets/data/tabs.json +3 -3
- package/src/componentSettingsDataAndControls.vue +9 -18
- package/src/components/CmdAddressData.vue +3 -2
- package/src/components/CmdBackToTopButton.vue +0 -1
- package/src/components/CmdBasicForm.vue +2 -1
- package/src/components/CmdFormElement.vue +7 -3
- package/src/components/CmdImage.vue +1 -1
- package/src/components/CmdInputGroup.vue +1 -1
- package/src/components/CmdLoginForm.vue +19 -11
- package/src/components/CmdMailTool.vue +151 -0
- package/src/components/CmdMailToolEntry.vue +230 -0
- package/src/components/CmdMailToolFilter.vue +210 -0
- package/src/components/CmdSiteHeader.vue +1 -1
- package/src/components/CmdTabs.vue +2 -2
- package/src/mixins/CmdMailToolEntry/DefaultMessageProperties.js +12 -0
- package/src/utils/address.js +29 -0
- package/src/utils/date.js +29 -20
@@ -0,0 +1,210 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="cmd-mail-tool-filter align-items-center">
|
3
|
+
<!-- begin CmdHeadline -->
|
4
|
+
<CmdHeadline v-if="headlineText" :headlineText="headlineText" :headlineLevel="headlineLevel"/>
|
5
|
+
<!-- end CmdHeadline -->
|
6
|
+
|
7
|
+
<div class="flex-container horizontal align-items-center">
|
8
|
+
<!-- begin CmdFormElement -->
|
9
|
+
<CmdFormElement
|
10
|
+
element="input"
|
11
|
+
type="search"
|
12
|
+
:placeholder="'Search ' + boxType"
|
13
|
+
:showSearchButton="false"
|
14
|
+
:id="'search-' + boxType"
|
15
|
+
:labelText="'Search ' + boxType"
|
16
|
+
:showLabel="false"
|
17
|
+
v-model="searchFilterText"
|
18
|
+
/>
|
19
|
+
<!-- end CmdFormElement -->
|
20
|
+
|
21
|
+
<!-- begin CmdFormElement -->
|
22
|
+
<CmdFormElement
|
23
|
+
element="input"
|
24
|
+
type="checkbox"
|
25
|
+
name="search-filters"
|
26
|
+
id="search-subject"
|
27
|
+
labelText="Search subjects"
|
28
|
+
v-model="searchFilterOptions"
|
29
|
+
inputValue="subjects"
|
30
|
+
/>
|
31
|
+
<!-- end CmdFormElement -->
|
32
|
+
|
33
|
+
<!-- begin CmdFormElement -->
|
34
|
+
<CmdFormElement
|
35
|
+
element="input"
|
36
|
+
type="checkbox"
|
37
|
+
name="search-filters"
|
38
|
+
:id="'search-' + senderReceiver"
|
39
|
+
:labelText="'Search ' + senderReceiver"
|
40
|
+
v-model="searchFilterOptions"
|
41
|
+
:inputValue="senderReceiver"
|
42
|
+
/>
|
43
|
+
<!-- end CmdFormElement -->
|
44
|
+
</div>
|
45
|
+
<div class="flex-container horizontal sort-wrapper">
|
46
|
+
<!-- begin link sort ascending -->
|
47
|
+
<a v-if="sortOrderAsc" href="#" @click.prevent="sortByDate('asc')" :title="linkSortAscending.title">
|
48
|
+
<span v-if="linkSortAscending.text">{{ linkSortAscending.text }}</span>
|
49
|
+
<span v-if="linkSortAscending.iconClass" :class="linkSortAscending.iconClass"></span>
|
50
|
+
</a>
|
51
|
+
<!-- end link sort ascending -->
|
52
|
+
|
53
|
+
<!-- begin link sort descending -->
|
54
|
+
<a v-else href="#" @click.prevent="sortByDate('desc')" :title="linkSortDescending.title">
|
55
|
+
<span v-if="linkSortDescending.text">{{ linkSortDescending.text }}</span>
|
56
|
+
<span v-if="linkSortDescending.iconClass" :class="linkSortDescending.iconClass"></span>
|
57
|
+
</a>
|
58
|
+
<!-- end link sort descending -->
|
59
|
+
</div>
|
60
|
+
</div>
|
61
|
+
</template>
|
62
|
+
|
63
|
+
<script>
|
64
|
+
export default {
|
65
|
+
name: "CmdMailToolFilter",
|
66
|
+
data() {
|
67
|
+
return {
|
68
|
+
searchFilterText: "",
|
69
|
+
searchFilterOptions: [],
|
70
|
+
sortOrderAsc: Boolean
|
71
|
+
}
|
72
|
+
},
|
73
|
+
props: {
|
74
|
+
modelValue: {
|
75
|
+
type: Object,
|
76
|
+
},
|
77
|
+
/**
|
78
|
+
* define boxType
|
79
|
+
*
|
80
|
+
* @allowedValues: "inbox", "outbox"
|
81
|
+
*/
|
82
|
+
boxType: {
|
83
|
+
type: String,
|
84
|
+
default: "inbox"
|
85
|
+
},
|
86
|
+
/**
|
87
|
+
* define link for sorting mails ascending
|
88
|
+
*/
|
89
|
+
linkSortAscending: {
|
90
|
+
type: Object,
|
91
|
+
default() {
|
92
|
+
return {
|
93
|
+
iconClass: "icon-sort-asc-arrows",
|
94
|
+
text: "asc (0-9)",
|
95
|
+
title: "Sort mails by date/time ascending"
|
96
|
+
}
|
97
|
+
}
|
98
|
+
},
|
99
|
+
/**
|
100
|
+
* define link for sorting mails descending
|
101
|
+
*/
|
102
|
+
linkSortDescending: {
|
103
|
+
type: Object,
|
104
|
+
default() {
|
105
|
+
return {
|
106
|
+
iconClass: "icon-sort-desc-arrows",
|
107
|
+
text: "desc (9-0)",
|
108
|
+
title: "Sort mails by date/time descending"
|
109
|
+
}
|
110
|
+
}
|
111
|
+
},
|
112
|
+
/**
|
113
|
+
* define properties for CmdHeadline-component for inbox
|
114
|
+
*/
|
115
|
+
cmdHeadlineInbox: {
|
116
|
+
type: Object,
|
117
|
+
default() {
|
118
|
+
return {
|
119
|
+
headlineText: "Inbox",
|
120
|
+
headlineLevel: 3
|
121
|
+
}
|
122
|
+
}
|
123
|
+
},
|
124
|
+
/**
|
125
|
+
* define properties for CmdHeadline-component for outbox
|
126
|
+
*/
|
127
|
+
cmdHeadlineOutbox: {
|
128
|
+
type: Object,
|
129
|
+
default() {
|
130
|
+
return {
|
131
|
+
headlineText: "Outbox",
|
132
|
+
headlineLevel: 3
|
133
|
+
}
|
134
|
+
}
|
135
|
+
}
|
136
|
+
},
|
137
|
+
computed: {
|
138
|
+
headlineText() {
|
139
|
+
return this.boxType === "inbox" ? this.cmdHeadlineInbox?.headlineText : this.cmdHeadlineOutbox?.headlineText
|
140
|
+
},
|
141
|
+
headlineLevel() {
|
142
|
+
return this.boxType === "inbox" ? this.cmdHeadlineInbox?.headlineLevel : this.cmdHeadlineOutbox?.headlineLevel
|
143
|
+
},
|
144
|
+
senderReceiver() {
|
145
|
+
return this.boxType === "inbox" ? "senders" : "receivers"
|
146
|
+
}
|
147
|
+
},
|
148
|
+
methods: {
|
149
|
+
sortByDate(sortOrder) {
|
150
|
+
this.sortOrderAsc = !this.sortOrderAsc
|
151
|
+
// todo build watcher
|
152
|
+
}
|
153
|
+
},
|
154
|
+
watch: {
|
155
|
+
modelValue: {
|
156
|
+
handler() {
|
157
|
+
this.searchFilterText = this.modelValue?.searchFilterText || ""
|
158
|
+
this.searchFilterOptions = this.modelValue?.searchFilterOptions || ["subjects", "senders"]
|
159
|
+
},
|
160
|
+
deep: true,
|
161
|
+
immediate: true
|
162
|
+
},
|
163
|
+
searchFilterText: {
|
164
|
+
handler() {
|
165
|
+
this.$emit("update:modelValue", {
|
166
|
+
searchFilterOptions: this.searchFilterOptions,
|
167
|
+
searchFilterText: this.searchFilterText
|
168
|
+
})
|
169
|
+
},
|
170
|
+
immediate: true
|
171
|
+
},
|
172
|
+
searchFilterOptions: {
|
173
|
+
handler() {
|
174
|
+
this.$emit("update:modelValue", {
|
175
|
+
searchFilterText: this.searchFilterText,
|
176
|
+
searchFilterOptions: this.searchFilterOptions
|
177
|
+
})
|
178
|
+
},
|
179
|
+
immediate: true
|
180
|
+
}
|
181
|
+
}
|
182
|
+
}
|
183
|
+
</script>
|
184
|
+
|
185
|
+
<style>
|
186
|
+
/* begin cmd-mail-tool-filter-------------------------------------------------------------------------------------------- */
|
187
|
+
.cmd-mail-tool-filter {
|
188
|
+
display: flex;
|
189
|
+
padding: var(--default-padding);
|
190
|
+
background: var(--light-gray);
|
191
|
+
|
192
|
+
& > * {
|
193
|
+
flex: 1;
|
194
|
+
}
|
195
|
+
|
196
|
+
.cmd-headline {
|
197
|
+
margin: 0;
|
198
|
+
}
|
199
|
+
|
200
|
+
.sort-wrapper {
|
201
|
+
text-align: right;
|
202
|
+
|
203
|
+
a {
|
204
|
+
text-decoration: none;
|
205
|
+
}
|
206
|
+
}
|
207
|
+
}
|
208
|
+
|
209
|
+
/* end cmd-mail-tool-filter-------------------------------------------------------------------------------------------- */
|
210
|
+
</style>
|
@@ -3,11 +3,11 @@
|
|
3
3
|
<!-- being tab-list -->
|
4
4
|
<ul :class="{'stretch-tabs' : stretchTabs}" role="tablist">
|
5
5
|
<li v-for="(tab, index) in tabs" :class="{active : showTab === index}" :key="index" role="tab">
|
6
|
-
<a href="#" @click.prevent="setActiveTab(index)" :title="!tab.
|
6
|
+
<a href="#" @click.prevent="setActiveTab(index)" :title="!tab.text ? tab.tooltip : undefined">
|
7
7
|
<!-- begin CmdIcon -->
|
8
8
|
<CmdIcon v-if="tab.iconClass" :iconClass="tab.iconClass" :type="tab.iconType" />
|
9
9
|
<!-- end CmdIcon -->
|
10
|
-
<span v-if="tab.
|
10
|
+
<span v-if="tab.text">{{ tab.text }}</span>
|
11
11
|
</a>
|
12
12
|
</li>
|
13
13
|
</ul>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
export default {
|
2
|
+
data() {
|
3
|
+
return {
|
4
|
+
defaultMessageProperties: {
|
5
|
+
"mail_tool_entry.tooltip.read_this_mail": "Read this mail",
|
6
|
+
"mail_tool_entry.description_label.from": "From:",
|
7
|
+
"mail_tool_entry.description_label.to": "To:",
|
8
|
+
"mail_tool_entry.description_label.subject": "Subject:"
|
9
|
+
}
|
10
|
+
}
|
11
|
+
}
|
12
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
function formatAddress(address, format) {
|
2
|
+
let formatedAddress = ""
|
3
|
+
|
4
|
+
if (format === "eu") {
|
5
|
+
formatedAddress += address.street + " " + address.number + "\n"
|
6
|
+
formatedAddress += address.zip + " " + address.city + "\n"
|
7
|
+
} else {
|
8
|
+
formatedAddress += address.number + " " + address.street + "\n"
|
9
|
+
formatedAddress += address.city + ", "
|
10
|
+
|
11
|
+
if(address.country) {
|
12
|
+
formatedAddress += address.state + " "
|
13
|
+
}
|
14
|
+
|
15
|
+
formatedAddress += address.zip + "\n"
|
16
|
+
}
|
17
|
+
|
18
|
+
if(address.country) {
|
19
|
+
formatedAddress += address.country + "\n"
|
20
|
+
}
|
21
|
+
|
22
|
+
if(address.misc) {
|
23
|
+
formatedAddress += address.misc
|
24
|
+
}
|
25
|
+
|
26
|
+
return formatedAddress
|
27
|
+
}
|
28
|
+
|
29
|
+
export {formatAddress}
|
package/src/utils/date.js
CHANGED
@@ -6,11 +6,11 @@ function getDate(inputDate, operator = "+", days = 1) {
|
|
6
6
|
const date = new Date(inputDate)
|
7
7
|
|
8
8
|
if (operator === "+") {
|
9
|
-
date.setDate(date.getDate() + days)
|
9
|
+
date.setDate(date.getDate() + days)
|
10
10
|
} else if (operator === '-') {
|
11
|
-
date.setDate(date.getDate() - days)
|
11
|
+
date.setDate(date.getDate() - days)
|
12
12
|
} else {
|
13
|
-
throw new Error("function 'getDate' received invalid operator as parameter. Use '+' to add or '-' to subtract days.")
|
13
|
+
throw new Error("function 'getDate()' received invalid operator as parameter. Use '+' to add or '-' to subtract days.")
|
14
14
|
}
|
15
15
|
|
16
16
|
return date
|
@@ -18,15 +18,15 @@ function getDate(inputDate, operator = "+", days = 1) {
|
|
18
18
|
|
19
19
|
function formatDate(inputDate, format = "dmy", separator= ".") {
|
20
20
|
// Ensure the input is a valid date object or string
|
21
|
-
const date = new Date(inputDate)
|
21
|
+
const date = new Date(inputDate)
|
22
22
|
|
23
23
|
if (isNaN(date)) {
|
24
|
-
console.error("function 'formatDate' received an invalid date as parameter. Provide date in format YYYY-MM-DD");
|
24
|
+
console.error("function 'formatDate()' received an invalid date as parameter. Provide date in format 'YYYY-MM-DD'");
|
25
25
|
}
|
26
26
|
|
27
|
-
const year = date.getFullYear()
|
28
|
-
const month = String(date.getMonth() + 1).padStart(2, '0')
|
29
|
-
const day = String(date.getDate()).padStart(2, '0')
|
27
|
+
const year = date.getFullYear()
|
28
|
+
const month = String(date.getMonth() + 1).padStart(2, '0') // months are zero-based
|
29
|
+
const day = String(date.getDate()).padStart(2, '0') // days are zero-based
|
30
30
|
let dateFormated = ""
|
31
31
|
|
32
32
|
switch (format) {
|
@@ -43,19 +43,28 @@ function formatDate(inputDate, format = "dmy", separator= ".") {
|
|
43
43
|
return dateFormated
|
44
44
|
}
|
45
45
|
|
46
|
-
function formatTime(timeString, format =
|
47
|
-
const [hourString, minute] = timeString.split(
|
48
|
-
let hour = parseInt(hourString, 10)
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
return
|
46
|
+
function formatTime(timeString = "00:00", format = 24, textAfter = "h") {
|
47
|
+
const [hourString, minute] = timeString.split(":")
|
48
|
+
let hour = parseInt(hourString, 10) // convert hourString to integer in decimal-system
|
49
|
+
let time = ""
|
50
|
+
format = format.toString() // convert format-parameter to string to allow strings and numbers
|
51
|
+
|
52
|
+
if (format === "12") {
|
53
|
+
const ampm = hour >= 12 ? "pm" : "am"
|
54
|
+
hour = hour % 12 || 12 // Convert 0 to 12 for 12 AM
|
55
|
+
time = `${hour}:${minute} ${ampm}`
|
56
|
+
return time
|
57
|
+
} else if (format === "24") {
|
58
|
+
const paddedHour = hour.toString().padStart(2, "0");
|
59
|
+
time = `${paddedHour}:${minute}`
|
60
|
+
|
61
|
+
if (textAfter) {
|
62
|
+
time += " " + textAfter
|
63
|
+
}
|
64
|
+
|
65
|
+
return time
|
57
66
|
} else {
|
58
|
-
throw new Error("
|
67
|
+
throw new Error("function 'formatTime()' received invalid format as parameter. Provide format-parameter as 12 or 24.");
|
59
68
|
}
|
60
69
|
}
|
61
70
|
|