vue-intergrall-plugins 1.0.31 → 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-on-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,15 +59,17 @@
43
59
  </template>
44
60
 
45
61
  <script>
46
- // import sanitizeHtml from 'sanitize-html'
47
- import EmailFile from "./EmailFile.vue"
48
- import EmailTo from "./EmailTo.vue"
49
- import EmailFrom from "./EmailFrom.vue"
50
- import { textoLongo } from "@/mixins/formatarTexto"
51
- import { mixin as clickaway } from "vue-clickaway";
62
+ import EmailFile from "./EmailFile.vue";
63
+ import EmailTo from "./EmailTo.vue";
64
+ import EmailFrom from "./EmailFrom.vue";
65
+ import { textoLongo } from "@/mixins/formatarTexto";
66
+ import Clickaway from '@/directives/clickaway';
52
67
 
53
68
  export default {
54
- mixins: [textoLongo, clickaway],
69
+ mixins: [textoLongo],
70
+ directives: {
71
+ clickaway: Clickaway
72
+ },
55
73
  components: { EmailFile, EmailTo, EmailFrom },
56
74
  props: {
57
75
  dominio: {
@@ -64,98 +82,134 @@ export default {
64
82
  },
65
83
  from: {
66
84
  type: Array,
67
- required: false,
68
85
  default: () => []
69
86
  },
70
87
  para: {
71
88
  type: Array,
72
- required: false,
73
89
  default: () => []
74
90
  },
75
91
  html: {
76
92
  type: String,
77
- required: false,
78
93
  default: ""
79
94
  },
80
95
  assunto: {
81
96
  type: String,
82
- required: false,
83
97
  default: ""
84
98
  },
85
99
  dataHora: {
86
100
  type: String,
87
- required: false,
88
101
  default: ""
89
102
  },
90
103
  mensagem: {
91
104
  type: String,
92
- required: false,
93
105
  default: ""
94
106
  },
95
107
  anexos: {
96
108
  type: [Array, String],
97
- required: false,
98
- default: () => { return [] }
109
+ default: () => []
99
110
  },
100
111
  iniciarAberto: {
101
112
  type: Boolean,
102
- required: false,
103
113
  default: false
104
114
  },
105
115
  dataServer: {
106
116
  type: String,
107
- required: false,
108
117
  default: ""
109
118
  },
110
119
  isOpenClass: {
111
120
  type: String,
112
- required: false,
113
121
  default: 'bg-dark-white-2'
114
122
  },
115
123
  isClosedClass: {
116
124
  type: String,
117
- required: false,
118
125
  default: 'bg-light-gray-2'
119
126
  },
120
127
  sanitizeOptions: {
121
128
  type: Object,
122
- required: false,
123
129
  default: null
124
130
  }
125
131
  },
126
132
  data() {
127
133
  return {
128
- isOpen: false,
134
+ isOpen: this.iniciarAberto,
129
135
  openMessage: false,
130
- actionsOpen: false
131
- }
136
+ actionsOpen: false,
137
+ showInfos: false
138
+ };
132
139
  },
133
- methods: {
134
- toggleIsOpen() {
135
- this.isOpen = !this.isOpen
136
- },
137
- toggleActions() {
138
- this.actionsOpen = !this.actionsOpen
139
- },
140
- toggleOpenMessage() {
141
- this.openMessage = !this.openMessage
140
+ computed: {
141
+ formattedDate() {
142
+ return this.formataDateHoraDateFns(this.dataHora, this.dataServer, this.dicionario);
142
143
  },
143
- returnCleanHtml(html) {
144
- const options = this.sanitizeOptions ? this.sanitizeOptions : {
145
- allowedTags: [
146
- 'a', 'b', 'br', 'div', 'i', 'p', 'span', 'strong', 'u', 'ul', 'ol', 'li', 'img', 'link'
147
- ],
144
+ cleanHtml() {
145
+ const defaultOptions = {
146
+ allowedTags: ['a', 'b', 'br', 'div', 'i', 'p', 'span', 'strong', 'u', 'ul', 'ol', 'li', 'img', 'link'],
148
147
  allowedAttributes: {
149
148
  'a': ['href'],
150
149
  'img': ['src', 'width', 'height', 'alt'],
151
150
  'link': ['rel', 'href'],
152
151
  '*': ['style']
153
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
154
163
  }
155
- 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 ? ', ' : ''}` : '';
156
210
  }
157
211
  }
158
- }
212
+ };
159
213
  </script>
160
214
 
161
215
  <style scoped>
@@ -184,7 +238,7 @@ export default {
184
238
 
185
239
  .email-item {
186
240
  flex: 1;
187
- margin: 0 10px 10px;
241
+ margin: 0 0 10px 0;
188
242
  color: #222;
189
243
  min-height: 60px;
190
244
  display: flex;
@@ -204,32 +258,39 @@ export default {
204
258
  cursor: pointer;
205
259
  border-top-right-radius: 5px;
206
260
  border-top-left-radius: 5px;
261
+ position: relative;
207
262
  }
208
263
 
209
264
  .email-header-content {
210
265
  display: flex;
211
- justify-content: center;
212
266
  align-items: center;
213
- margin: 10px
267
+ margin: 10px;
268
+ flex: 1;
269
+ min-width: 275px;
214
270
  }
215
271
 
216
272
  .email-header-infos {
217
273
  display: flex;
218
274
  flex-direction: column;
275
+ flex: 1;
219
276
  }
220
277
 
221
278
  .email-subject {
222
- margin: 0;
279
+ margin: 0 0 5px 0;
223
280
  font-weight: bold;
224
- font-size: .9rem;
281
+ font-size: .95rem;
225
282
  }
226
283
 
227
284
  .email-date {
285
+ --width: 245px;
228
286
  font-size: .8rem;
229
287
  margin-right: 10px;
230
288
  text-overflow: ellipsis;
231
289
  white-space: nowrap;
232
- overflow: hidden
290
+ overflow: hidden;
291
+ min-width: var(--width);
292
+ width: var(--width);
293
+ max-width: var(--width);
233
294
  }
234
295
 
235
296
  .email-content {
@@ -247,13 +308,17 @@ export default {
247
308
  .email-actions {
248
309
  align-self: flex-end;
249
310
  display: flex;
250
- border-radius: 5px;
311
+ border-radius: 10px;
251
312
  cursor: pointer;
252
313
  align-items: center;
253
314
  justify-content: center;
254
315
  gap: 3px;
255
- padding: 10px 5px;
256
- background-color: #FFF;
316
+ padding: 5px 7px;
317
+ background-color: #dddddd;
318
+ position: absolute;
319
+ right: 5px;
320
+ top: 5px;
321
+ z-index: 1;
257
322
  }
258
323
 
259
324
  .email-actions.active {
@@ -261,17 +326,17 @@ export default {
261
326
  }
262
327
 
263
328
  .email-actions>span {
264
- width: 7px;
265
- height: 7px;
329
+ width: 4px;
330
+ height: 4px;
266
331
  background-color: #222;
267
332
  border-radius: 50%;
268
333
  }
269
334
 
270
335
  .email-actions-list {
271
336
  position: absolute;
272
- right: 60px;
337
+ right: 45px;
273
338
  width: 250px;
274
- top: 15px;
339
+ top: 5px;
275
340
  margin: 0;
276
341
  list-style-type: none;
277
342
  padding: 0;
@@ -303,11 +368,13 @@ export default {
303
368
  }
304
369
 
305
370
  .email-html {
371
+ width: 100%;
306
372
  max-width: 100%;
307
373
  padding: 10px;
308
374
  }
309
375
 
310
376
  .email-raw {
377
+ width: 100%;
311
378
  max-width: 100%;
312
379
  font-size: .9rem;
313
380
  color: #222;
@@ -319,4 +386,60 @@ export default {
319
386
  flex-wrap: wrap;
320
387
  width: 100%
321
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
+ }
322
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
  }
@@ -125,13 +125,13 @@
125
125
  </span>
126
126
  </template>
127
127
  </div>
128
- <div class="emoji-message-container" v-if="isEmojisOpen" v-on-clickaway="closeEmojis">
128
+ <div class="emoji-message-container" v-if="isEmojisOpen" v-clickaway="closeEmojis">
129
129
  <fa-icon :icon="['fas', 'times-circle']" class="sc-icone-fechar sc-icone-fechar--externo"
130
130
  @click="closeEmojis" />
131
131
  <Picker @insert-emoji="addReaction" />
132
132
  </div>
133
133
  <transition name="fade" mode="out-in" v-if="isMenuOpen">
134
- <ul class="menu-flutuante" :class="origem" v-on-clickaway="closeMenu">
134
+ <ul class="menu-flutuante" :class="origem" v-clickaway="closeMenu">
135
135
  <li @click="responderMensagemHandler" v-if="showMenu.reply">
136
136
  <span> {{ dictionary.tit_responder_msg }} </span>
137
137
  </li>
@@ -156,7 +156,7 @@ import InteratividadeFormulario from "./InteratividadeFormulario";
156
156
  import Picker from "../Chat/Picker";
157
157
  import { formataTimezoneData } from "../../services/textFormatting";
158
158
  import LinkPreview from "./LinkPreview";
159
- import * as VueClickAway from "vue-clickaway";
159
+ import Clickaway from '@/directives/clickaway';
160
160
 
161
161
  export default {
162
162
  components: {
@@ -214,7 +214,9 @@ export default {
214
214
  created() {
215
215
  if (!this.$root.$refs.chatMessages) this.$root.$refs.chatMessages = this;
216
216
  },
217
- mixins: [VueClickAway.mixin],
217
+ directives: {
218
+ clickaway: Clickaway
219
+ },
218
220
  data() {
219
221
  return {
220
222
  strTooltipAux: "",
@@ -294,8 +296,8 @@ export default {
294
296
 
295
297
  if (this.tipo_origem) {
296
298
  tooltipStar += `${this.dictionary["tipo_origem"]}: ${this.dictionary[`tipo_origem_${this.tipo_origem}`]
297
- ? this.dictionary[`tipo_origem_${this.tipo_origem}`]
298
- : this.tipo_origem
299
+ ? this.dictionary[`tipo_origem_${this.tipo_origem}`]
300
+ : this.tipo_origem
299
301
  }<br/>`;
300
302
  }
301
303
 
@@ -1,32 +1,16 @@
1
1
  <template>
2
- <div class="interatividade-popup box-shadow" v-on-clickaway="away">
2
+ <div class="interatividade-popup box-shadow" v-clickaway="away">
3
3
  <div class="interatividade-popup-titulo" v-if="titulo">
4
4
  <h1>
5
5
  <span v-html="titulo"></span>
6
6
  <fa-icon :icon="['fas', 'times-circle']" @click="away" />
7
7
  </h1>
8
8
  </div>
9
- <div
10
- class="interatividade-popup-conteudo"
11
- v-for="(objItem, index) in lista"
12
- :key="index"
13
- >
9
+ <div class="interatividade-popup-conteudo" v-for="(objItem, index) in lista" :key="index">
14
10
  <template v-if="objItem.items && objItem.items.length">
15
- <div
16
- class="interatividade-popup-item"
17
- v-for="(item, indexItem) in objItem.items"
18
- :key="`${index}${indexItem}`"
19
- >
20
- <p
21
- v-if="item.title"
22
- v-html="item.title"
23
- class="interatividade-popup-item-titulo"
24
- ></p>
25
- <p
26
- v-if="item.description"
27
- v-html="item.description"
28
- class="interatividade-popup-item-desc"
29
- ></p>
11
+ <div class="interatividade-popup-item" v-for="(item, indexItem) in objItem.items" :key="`${index}${indexItem}`">
12
+ <p v-if="item.title" v-html="item.title" class="interatividade-popup-item-titulo"></p>
13
+ <p v-if="item.description" v-html="item.description" class="interatividade-popup-item-desc"></p>
30
14
  </div>
31
15
  </template>
32
16
  </div>
@@ -34,10 +18,12 @@
34
18
  </template>
35
19
 
36
20
  <script>
37
- import * as VueClickAway from "vue-clickaway";
21
+ import Clickaway from '@/directives/clickaway';
38
22
 
39
23
  export default {
40
- mixins: [VueClickAway.mixin],
24
+ directives: {
25
+ clickaway: Clickaway
26
+ },
41
27
  props: {
42
28
  lista: {
43
29
  type: [Array, Object],
@@ -90,6 +76,7 @@ export default {
90
76
  justify-content: space-between;
91
77
  align-items: center;
92
78
  }
79
+
93
80
  .interatividade-popup-titulo h1 svg {
94
81
  color: #e74c3c;
95
82
  cursor: pointer;