vue-intergrall-plugins 1.0.32 → 1.0.33

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.
@@ -1,39 +1,55 @@
1
1
  <template>
2
- <div class="email-item box-shadow" :class="`${isOpen ? isOpenClass : isClosedClass}`">
3
- <div class="email-header" @click="toggleIsOpen()">
2
+ <div :class="['email-item box-shadow', isOpen ? isOpenClass : isClosedClass]">
3
+ <div class="email-header" @click="toggleIsOpen">
4
4
  <div class="email-header-content">
5
5
  <div class="email-header-infos">
6
- <p class="email-subject" v-text="tratarTextoLongo(assunto || '(Sem assunto)', 30)"
7
- :title="assunto || '(Sem assunto)'"></p>
6
+ <p class="email-subject" :title="htmlEntityToEmoji(replaceUnicodeWithEmoji(assunto)) || '(Sem assunto)'">
7
+ {{ htmlEntityToEmoji(replaceUnicodeWithEmoji(tratarTextoLongo(assunto, 30))) || '(Sem assunto)' }}
8
+ </p>
8
9
  <template v-if="from && from.length">
9
- <EmailFrom v-for="({ name, mail }, index) in from" :key="`from-${index}`" :currentName="name" :mail="mail"
10
- :showMail="from.length == 1" :isLastIndex="index == from.length - 1" />
10
+ <div class="email-to-from-container">
11
+ <EmailFrom v-for="(sender, index) in from" :key="`from-${index}`"
12
+ :currentName="formattedName(sender.name, index, from.length, isOpen)"
13
+ :mail="formattedMail(sender.mail, index, from.length, isOpen)" :showMail="isOpen" />
14
+ </div>
11
15
  </template>
12
16
  <template v-if="para && para.length && isOpen">
13
- <EmailTo v-for="({ name, mail }, index) in para" :key="`to-${index}`"
14
- :currentName="index == '0' ? `Para: ${name ? name : ''}` : name ? name : ''" :mail="mail"
15
- :showMail="para.length == 1" :isLastIndex="index == para.length - 1" />
17
+ <div class="email-to-from-container">
18
+ <EmailTo v-for="(recipient, index) in para" :key="`to-${index}`"
19
+ :currentName="formattedToName(recipient.name, index, para.length)" :mail="recipient.mail"
20
+ :showMail="para.length === 1" />
21
+ <div class="email-to-btn" @click.stop="toggleShowInfos()">
22
+ <fa-icon :icon="['fas', 'caret-down']" />
23
+ </div>
24
+ <ul v-if="showInfos" class="email-to-infos box-shadow" v-clickaway="() => showInfos = false" @click.stop>
25
+ <li v-for="(info, index) in mailInfos" :key="`info-${index}`" class="email-info">
26
+ <span v-text="info.label"></span>
27
+ {{ info.value }}
28
+ </li>
29
+ </ul>
30
+ </div>
16
31
  </template>
17
32
  </div>
18
33
  </div>
19
- <span class="email-date" :title="formataDateHoraDateFns(dataHora, dataServer, dicionario)">
34
+ <span class="email-date" :title="formattedDate">
20
35
  <fa-icon :icon="['fas', 'calendar']" />
21
- {{ formataDateHoraDateFns(dataHora, dataServer, dicionario) }}
36
+ {{ formattedDate }}
22
37
  </span>
38
+ <span v-if="isOpen" :class="['email-actions box-shadow', { active: actionsOpen }]" @click.stop="toggleActions">
39
+ <span></span>
40
+ <span></span>
41
+ <span></span>
42
+ </span>
43
+ <ul class="email-actions-list box-shadow" v-if="actionsOpen && isOpen" v-clickaway="closeActions" @click.stop>
44
+ <li class="email-action" @click="toggleOpenMessage">
45
+ {{ !openMessage ? 'Visualizar' : 'Esconder' }} texto do e-mail
46
+ </li>
47
+ </ul>
23
48
  </div>
24
49
  <transition name="show-y-top">
25
50
  <div class="email-content" v-if="isOpen">
26
- <span :class="`email-actions box-shadow${actionsOpen ? ' active' : ''}`" @click="toggleActions()">
27
- <span></span>
28
- <span></span>
29
- <span></span>
30
- </span>
31
- <ul class="email-actions-list box-shadow" v-if="actionsOpen" v-clickaway="() => actionsOpen = false">
32
- <li class="email-action" @click="toggleOpenMessage()"
33
- v-text="`${!openMessage ? 'Visualizar' : 'Esconder'} texto do e-mail`"></li>
34
- </ul>
35
- <section class="email-html" v-html="returnCleanHtml(html)"></section>
36
- <span class="email-raw" v-if="openMessage" v-text="mensagem"></span>
51
+ <section class="email-html" v-html="cleanHtml"></section>
52
+ <span class="email-raw" v-if="openMessage">{{ mensagem }}</span>
37
53
  </div>
38
54
  </transition>
39
55
  <div v-if="anexos && anexos.length" class="email-files">
@@ -43,10 +59,10 @@
43
59
  </template>
44
60
 
45
61
  <script>
46
- import EmailFile from "./EmailFile.vue"
47
- import EmailTo from "./EmailTo.vue"
48
- import EmailFrom from "./EmailFrom.vue"
49
- import { textoLongo } from "@/mixins/formatarTexto"
62
+ import EmailFile from "./EmailFile.vue";
63
+ import EmailTo from "./EmailTo.vue";
64
+ import EmailFrom from "./EmailFrom.vue";
65
+ import { textoLongo } from "@/mixins/formatarTexto";
50
66
  import Clickaway from '@/directives/clickaway';
51
67
 
52
68
  export default {
@@ -66,98 +82,134 @@ export default {
66
82
  },
67
83
  from: {
68
84
  type: Array,
69
- required: false,
70
85
  default: () => []
71
86
  },
72
87
  para: {
73
88
  type: Array,
74
- required: false,
75
89
  default: () => []
76
90
  },
77
91
  html: {
78
92
  type: String,
79
- required: false,
80
93
  default: ""
81
94
  },
82
95
  assunto: {
83
96
  type: String,
84
- required: false,
85
97
  default: ""
86
98
  },
87
99
  dataHora: {
88
100
  type: String,
89
- required: false,
90
101
  default: ""
91
102
  },
92
103
  mensagem: {
93
104
  type: String,
94
- required: false,
95
105
  default: ""
96
106
  },
97
107
  anexos: {
98
108
  type: [Array, String],
99
- required: false,
100
- default: () => { return [] }
109
+ default: () => []
101
110
  },
102
111
  iniciarAberto: {
103
112
  type: Boolean,
104
- required: false,
105
113
  default: false
106
114
  },
107
115
  dataServer: {
108
116
  type: String,
109
- required: false,
110
117
  default: ""
111
118
  },
112
119
  isOpenClass: {
113
120
  type: String,
114
- required: false,
115
121
  default: 'bg-dark-white-2'
116
122
  },
117
123
  isClosedClass: {
118
124
  type: String,
119
- required: false,
120
125
  default: 'bg-light-gray-2'
121
126
  },
122
127
  sanitizeOptions: {
123
128
  type: Object,
124
- required: false,
125
129
  default: null
126
130
  }
127
131
  },
128
132
  data() {
129
133
  return {
130
- isOpen: false,
134
+ isOpen: this.iniciarAberto,
131
135
  openMessage: false,
132
- actionsOpen: false
133
- }
136
+ actionsOpen: false,
137
+ showInfos: false
138
+ };
134
139
  },
135
- methods: {
136
- toggleIsOpen() {
137
- this.isOpen = !this.isOpen
138
- },
139
- toggleActions() {
140
- this.actionsOpen = !this.actionsOpen
141
- },
142
- toggleOpenMessage() {
143
- this.openMessage = !this.openMessage
140
+ computed: {
141
+ formattedDate() {
142
+ return this.formataDateHoraDateFns(this.dataHora, this.dataServer, this.dicionario);
144
143
  },
145
- returnCleanHtml(html) {
146
- const options = this.sanitizeOptions ? this.sanitizeOptions : {
147
- allowedTags: [
148
- 'a', 'b', 'br', 'div', 'i', 'p', 'span', 'strong', 'u', 'ul', 'ol', 'li', 'img', 'link'
149
- ],
144
+ cleanHtml() {
145
+ const defaultOptions = {
146
+ allowedTags: ['a', 'b', 'br', 'div', 'i', 'p', 'span', 'strong', 'u', 'ul', 'ol', 'li', 'img', 'link'],
150
147
  allowedAttributes: {
151
148
  'a': ['href'],
152
149
  'img': ['src', 'width', 'height', 'alt'],
153
150
  'link': ['rel', 'href'],
154
151
  '*': ['style']
155
152
  }
153
+ };
154
+ return this.$sanitize(this.html, this.sanitizeOptions || defaultOptions);
155
+ },
156
+ mailInfos() {
157
+ const formatAsString = (arr) => {
158
+ let str = ''
159
+ arr.forEach(({ name, mail }, index) => {
160
+ str += `${name} <${mail}>${index !== arr.length - 1 ? ', ' : ''}`
161
+ })
162
+ return str
156
163
  }
157
- return this.$sanitize(html, options);
164
+
165
+ return [
166
+ {
167
+ label: 'De:',
168
+ value: formatAsString(this.from)
169
+ },
170
+ {
171
+ label: 'Para:',
172
+ value: formatAsString(this.para)
173
+ },
174
+ {
175
+ label: 'Assunto:',
176
+ value: this.htmlEntityToEmoji(this.replaceUnicodeWithEmoji(this.assunto)) || '(Sem assunto)'
177
+ },
178
+ {
179
+ label: 'Data:',
180
+ value: this.formataDataHora(this.dataHora)
181
+ },
182
+ ]
183
+ },
184
+ },
185
+ methods: {
186
+ toggleShowInfos() {
187
+ this.showInfos = !this.showInfos
188
+ },
189
+ toggleIsOpen() {
190
+ this.isOpen = !this.isOpen;
191
+ if (!this.isOpen) this.actionsOpen = false;
192
+ },
193
+ toggleActions() {
194
+ this.actionsOpen = !this.actionsOpen;
195
+ },
196
+ toggleOpenMessage() {
197
+ this.openMessage = !this.openMessage;
198
+ },
199
+ closeActions() {
200
+ this.actionsOpen = false;
201
+ },
202
+ formattedName(name, index, length, isOpen) {
203
+ return `${name}${index !== length - 1 && !isOpen ? ', ' : ''}`;
204
+ },
205
+ formattedMail(mail, index, length, isOpen) {
206
+ return `<${mail}${index !== length - 1 && isOpen ? '>, ' : '>'}`;
207
+ },
208
+ formattedToName(name, index, length) {
209
+ return index === 0 ? `Para: ${name || ''}` : name ? `${name}${index !== length - 1 ? ', ' : ''}` : '';
158
210
  }
159
211
  }
160
- }
212
+ };
161
213
  </script>
162
214
 
163
215
  <style scoped>
@@ -186,7 +238,7 @@ export default {
186
238
 
187
239
  .email-item {
188
240
  flex: 1;
189
- margin: 0 10px 10px;
241
+ margin: 0 0 10px 0;
190
242
  color: #222;
191
243
  min-height: 60px;
192
244
  display: flex;
@@ -206,32 +258,39 @@ export default {
206
258
  cursor: pointer;
207
259
  border-top-right-radius: 5px;
208
260
  border-top-left-radius: 5px;
261
+ position: relative;
209
262
  }
210
263
 
211
264
  .email-header-content {
212
265
  display: flex;
213
- justify-content: center;
214
266
  align-items: center;
215
- margin: 10px
267
+ margin: 10px;
268
+ flex: 1;
269
+ min-width: 275px;
216
270
  }
217
271
 
218
272
  .email-header-infos {
219
273
  display: flex;
220
274
  flex-direction: column;
275
+ flex: 1;
221
276
  }
222
277
 
223
278
  .email-subject {
224
- margin: 0;
279
+ margin: 0 0 5px 0;
225
280
  font-weight: bold;
226
- font-size: .9rem;
281
+ font-size: .95rem;
227
282
  }
228
283
 
229
284
  .email-date {
285
+ --width: 245px;
230
286
  font-size: .8rem;
231
287
  margin-right: 10px;
232
288
  text-overflow: ellipsis;
233
289
  white-space: nowrap;
234
- overflow: hidden
290
+ overflow: hidden;
291
+ min-width: var(--width);
292
+ width: var(--width);
293
+ max-width: var(--width);
235
294
  }
236
295
 
237
296
  .email-content {
@@ -249,13 +308,17 @@ export default {
249
308
  .email-actions {
250
309
  align-self: flex-end;
251
310
  display: flex;
252
- border-radius: 5px;
311
+ border-radius: 10px;
253
312
  cursor: pointer;
254
313
  align-items: center;
255
314
  justify-content: center;
256
315
  gap: 3px;
257
- padding: 10px 5px;
258
- background-color: #FFF;
316
+ padding: 5px 7px;
317
+ background-color: #dddddd;
318
+ position: absolute;
319
+ right: 5px;
320
+ top: 5px;
321
+ z-index: 1;
259
322
  }
260
323
 
261
324
  .email-actions.active {
@@ -263,17 +326,17 @@ export default {
263
326
  }
264
327
 
265
328
  .email-actions>span {
266
- width: 7px;
267
- height: 7px;
329
+ width: 4px;
330
+ height: 4px;
268
331
  background-color: #222;
269
332
  border-radius: 50%;
270
333
  }
271
334
 
272
335
  .email-actions-list {
273
336
  position: absolute;
274
- right: 60px;
337
+ right: 45px;
275
338
  width: 250px;
276
- top: 15px;
339
+ top: 5px;
277
340
  margin: 0;
278
341
  list-style-type: none;
279
342
  padding: 0;
@@ -305,11 +368,13 @@ export default {
305
368
  }
306
369
 
307
370
  .email-html {
371
+ width: 100%;
308
372
  max-width: 100%;
309
373
  padding: 10px;
310
374
  }
311
375
 
312
376
  .email-raw {
377
+ width: 100%;
313
378
  max-width: 100%;
314
379
  font-size: .9rem;
315
380
  color: #222;
@@ -321,4 +386,60 @@ export default {
321
386
  flex-wrap: wrap;
322
387
  width: 100%
323
388
  }
389
+
390
+ .email-header-content,
391
+ .email-header-infos {
392
+ max-width: 100%;
393
+ overflow: hidden;
394
+ }
395
+
396
+ .email-to-from-container {
397
+ margin-bottom: 10px;
398
+ max-width: 100%;
399
+ display: flex;
400
+ flex-wrap: wrap;
401
+ flex: 1;
402
+ gap: 5px;
403
+ }
404
+
405
+ .email-to-from-container:last-child {
406
+ margin-bottom: 0;
407
+ }
408
+
409
+ .email-to-btn {
410
+ padding: 5px 15px;
411
+ margin-left: 5px;
412
+ font-size: .9rem;
413
+ cursor: pointer;
414
+ color: #666;
415
+ }
416
+
417
+ .email-to-infos {
418
+ position: absolute;
419
+ bottom: -315px;
420
+ border: 1px solid #CCC;
421
+ z-index: 1;
422
+ padding: 10px;
423
+ background-color: #FFF;
424
+ height: 300px;
425
+ max-height: 300px;
426
+ overflow-y: auto;
427
+ overflow-x: hidden;
428
+ width: 300px;
429
+ display: flex;
430
+ flex-direction: column;
431
+ gap: 5px;
432
+ margin: 0;
433
+ }
434
+
435
+ .email-info {
436
+ width: 100%;
437
+ font-size: .8rem;
438
+ }
439
+
440
+ .email-info>span {
441
+ font-size: .75rem;
442
+ color: gray;
443
+ margin-left: 5px;
444
+ }
324
445
  </style>
@@ -7,8 +7,6 @@
7
7
 
8
8
  <style scoped>
9
9
  .email-to {
10
- width: 100%;
11
- flex: 1;
12
10
  display: flex;
13
11
  align-items: center;
14
12
  }
@@ -48,16 +46,6 @@ export default {
48
46
  type: Boolean,
49
47
  required: false,
50
48
  default: true
51
- },
52
- isLastIndex: {
53
- type: Boolean,
54
- required: false,
55
- default: false
56
- }
57
- },
58
- computed: {
59
- filteredName() {
60
- return !this.isLastIndex ? `${this.currentName}, ` : this.currentName
61
49
  }
62
50
  }
63
51
  }