vue-intergrall-plugins 1.0.28 → 1.0.29

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-intergrall-plugins",
3
- "version": "1.0.28",
3
+ "version": "1.0.29",
4
4
  "description": "",
5
5
  "main": "dist/vue-intergrall-plugins.ssr.js",
6
6
  "browser": "dist/vue-intergrall-plugins.esm.js",
@@ -61,6 +61,7 @@
61
61
  },
62
62
  "dependencies": {
63
63
  "axios": "^0.26.0",
64
- "kind-of": "^6.0.3"
64
+ "kind-of": "^6.0.3",
65
+ "vue-sanitize": "^0.2.3"
65
66
  }
66
67
  }
@@ -1,21 +1,17 @@
1
1
  <template>
2
2
  <transition-group name="fade" mode="out-in">
3
3
  <VueLoader v-if="isLoading" key="file-loader" />
4
- <div v-else key="file-container" class="mb-5 mx-5 d-flex flex-wrap align-items-center">
5
- <span v-if="imageURL" class="anexo-img box-shadow" @click="openWindowFromURL(imageURL, true)" :title="`Visualizar ${filename}`">
4
+ <div v-else key="file-container" class="email-file">
5
+ <span v-if="imageURL" class="anexo-img box-shadow" @click="openWindowFromURL(imageURL, true)"
6
+ :title="`Visualizar ${filename}`">
6
7
  <img :src="`${imageURL}`" :alt="filename" />
7
8
  </span>
8
- <span
9
- v-else
10
- class="anexo-icone mr-5"
11
- :class="[iconClass]"
12
- @click="openWindowFromURL(docURL, false)"
13
- :title="`Visualizar ${filename}`"
14
- target="_blank"
15
- >
9
+ <span v-else class="anexo-icone" :class="[iconClass]" @click="openWindowFromURL(docURL, false)"
10
+ :title="`Visualizar ${filename}`" target="_blank">
16
11
  <fa-icon :icon="icon" />
17
12
  </span>
18
- <a :href="imageURL ? imageURL : docURL" :download="`${filename}`" target="_blank" :title="`Download ${filename}`">
13
+ <a class="anexo-download box-shadow" :href="imageURL ? imageURL : docURL" :download="`${filename}`"
14
+ target="_blank" :title="`Download ${filename}`">
19
15
  <fa-icon :icon="['fas', 'download']" />
20
16
  </a>
21
17
  </div>
@@ -43,9 +39,16 @@ export default {
43
39
  }
44
40
  </script>
45
41
  <style>
46
- .mr-5 {
47
- margin-right: 5px;
42
+ .email-file {
43
+ display: flex;
44
+ align-items: center;
45
+ min-width: 50px;
46
+ width: auto;
47
+ max-width: 100px;
48
+ height: 70px;
49
+ position: relative;
48
50
  }
51
+
49
52
  .anexo-img {
50
53
  display: flex;
51
54
  justify-content: center;
@@ -59,37 +62,47 @@ export default {
59
62
  opacity: .9;
60
63
  transition: opacity 150ms;
61
64
  }
65
+
62
66
  .anexo-img:hover {
63
67
  opacity: 1;
64
68
  }
69
+
65
70
  .anexo-img img {
66
- width: 95%;
67
- max-height: 50px;
71
+ max-width: 100%;
72
+ max-height: 100%;
68
73
  }
74
+
69
75
  .box-shadow {
70
76
  -webkit-box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);
71
77
  -moz-box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);
72
78
  box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);
73
79
  }
80
+
74
81
  .anexo-icone {
75
82
  display: flex;
76
83
  justify-content: center;
77
84
  align-items: center;
78
85
  font-size: 30px;
79
86
  cursor: pointer;
87
+ margin-right: 5px;
80
88
  }
89
+
81
90
  .anexo-icone:hover {
82
91
  opacity: 1
83
92
  }
93
+
84
94
  .anexo-icone:visited {
85
95
  color: inherit;
86
96
  }
97
+
87
98
  .anexo-icone.pdf {
88
99
  position: relative;
89
100
  }
101
+
90
102
  .anexo-icone.pdf svg {
91
103
  color: rgb(231, 76, 60);
92
104
  }
105
+
93
106
  .anexo-icone.pdf::after {
94
107
  content: "";
95
108
  position: absolute;
@@ -98,29 +111,30 @@ export default {
98
111
  width: 20px;
99
112
  height: 20px;
100
113
  }
114
+
101
115
  .anexo-icone.doc {
102
- color: #15517F;
116
+ color: #15517F;
103
117
  }
118
+
104
119
  .anexo-icone.doc::after {
105
120
  content: "";
106
121
  position: absolute;
107
122
  width: 20px;
108
123
  height: 20px;
109
124
  }
110
- .align-items-center {
111
- align-items: center;
112
- }
113
- .flex-wrap {
114
- flex-wrap: wrap;
115
- }
116
- .d-flex {
125
+
126
+ .anexo-download {
127
+ position: absolute;
128
+ top: 0;
129
+ right: 0;
130
+ border-radius: 5px;
131
+ padding: 5px;
117
132
  display: flex;
118
- }
119
- .mb-5 {
120
- margin-bottom: 5px;
121
- }
122
- .mx-5 {
123
- margin-left: 5px;
124
- margin-right: 5px;
133
+ justify-content: center;
134
+ align-items: center;
135
+ color: #222;
136
+ background-color: #FFF;
137
+ z-index: 1;
138
+ font-size: .8rem
125
139
  }
126
140
  </style>
@@ -0,0 +1,70 @@
1
+ <template>
2
+ <div class="email-from">
3
+ <p class="from" v-if="currentName" v-text="currentName" :title="currentName"></p>
4
+ <div v-if="showMail" class="additional-container">
5
+ <span class="additional" v-text="`<${mail}>`" :title="mail"></span>
6
+ </div>
7
+ </div>
8
+ </template>
9
+
10
+ <style scoped>
11
+ .email-from {
12
+ width: 100%;
13
+ flex: 1;
14
+ display: flex;
15
+ align-items: center;
16
+ }
17
+
18
+ .email-from .from {
19
+ font-size: .75rem;
20
+ font-weight: bold;
21
+ white-space: nowrap;
22
+ margin: 0;
23
+ }
24
+
25
+ .email-from .additional-container {
26
+ flex: 1;
27
+ overflow: hidden;
28
+ }
29
+
30
+ .email-from .additional {
31
+ text-overflow: ellipsis;
32
+ white-space: nowrap;
33
+ overflow: hidden;
34
+ margin-left: 5px;
35
+ font-size: .75rem;
36
+ color: gray;
37
+ }
38
+ </style>
39
+
40
+ <script>
41
+ export default {
42
+ props: {
43
+ currentName: {
44
+ type: String,
45
+ required: false,
46
+ default: ""
47
+ },
48
+ mail: {
49
+ type: String,
50
+ required: false,
51
+ default: ""
52
+ },
53
+ showMail: {
54
+ type: Boolean,
55
+ required: false,
56
+ default: true
57
+ },
58
+ isLastIndex: {
59
+ type: Boolean,
60
+ required: false,
61
+ default: false
62
+ }
63
+ },
64
+ computed: {
65
+ filteredName() {
66
+ return !this.isLastIndex ? `${this.currentName}, ` : this.currentName
67
+ }
68
+ }
69
+ }
70
+ </script>
@@ -1,58 +1,76 @@
1
1
  <template>
2
- <div class="w-100 text-dark min-h-60 d-flex flex-wrap px-35 border-bottom-1 border-color-gray transition-150">
3
- <div class="w-100 d-flex d-flex align-items-center justify-content-between cursor-pointer" @click="toggleEstado()">
4
- <div class="d-flex-center m-10">
5
- <span class="align-self-start border-radius-round d-flex-center w-36px h-36px border-color-gray border-1 mr-10" v-text="siglaNome"></span>
6
- <div class="d-flex flex-column">
7
- <p class="text-bold fs-_9" v-text="de" :title="de"></p>
8
- <p v-if="estado != 0" class="text-gray fs-_8" v-text="para" :title="para"></p>
9
- <p class="text-gray fs-_8" v-text="tratarTextoLongo(assunto, 30)" :title="assunto"></p>
2
+ <div class="email-item box-shadow" :class="`${isOpen ? isOpenClass : isClosedClass}`">
3
+ <div class="email-header" @click="toggleIsOpen()">
4
+ <div class="email-header-content">
5
+ <div class="email-header-infos">
6
+ <p class="email-subject" v-text="tratarTextoLongo(assunto || '(Sem assunto)', 30)"
7
+ :title="assunto || '(Sem assunto)'"></p>
8
+ <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" />
11
+ </template>
12
+ <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" />
16
+ </template>
10
17
  </div>
11
18
  </div>
12
- <span class="fs-_8 mr-10 text-ellipsis" :title="formataDataHora(dataHora)">
19
+ <span class="email-date" :title="formataDateHoraDateFns(dataHora, dataServer, dicionario)">
13
20
  <fa-icon :icon="['fas', 'calendar']" />
14
- {{ formataDataHora(dataHora) }}
21
+ {{ formataDateHoraDateFns(dataHora, dataServer, dicionario) }}
15
22
  </span>
16
23
  </div>
17
- <div class="d-flex-center w-100 p-15" v-if="estado != 0">
18
- <section v-html="html"></section>
24
+ <transition name="show-y-top">
25
+ <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>
37
+ </div>
38
+ </transition>
39
+ <div v-if="anexos && anexos.length" class="email-files">
40
+ <EmailFile v-for="(anexo, index) in anexos" :key="index" :anexo="anexo" :dominio="dominio" />
19
41
  </div>
20
- <template v-if="anexos && anexos.length">
21
- <EmailFile
22
- class="d-flex flex-wrap align-items-center"
23
- v-for="(anexo, index) in anexos" :key="index"
24
- :anexo="anexo"
25
- :dominio="dominio"
26
- />
27
- </template>
28
42
  </div>
29
43
  </template>
30
44
 
31
45
  <script>
46
+ // import sanitizeHtml from 'sanitize-html'
32
47
  import EmailFile from "./EmailFile.vue"
48
+ import EmailTo from "./EmailTo.vue"
49
+ import EmailFrom from "./EmailFrom.vue"
33
50
  import { textoLongo } from "@/mixins/formatarTexto"
51
+ import * as VueClickAway from "vue-clickaway";
34
52
 
35
53
  export default {
36
- mixins: [textoLongo],
37
- components: { EmailFile },
54
+ mixins: [textoLongo, VueClickAway.mixin],
55
+ components: { EmailFile, EmailTo, EmailFrom },
38
56
  props: {
39
57
  dominio: {
40
58
  type: String,
41
59
  required: true
42
60
  },
43
61
  dicionario: {
44
- type: Object,
45
- required: true
62
+ type: Object,
63
+ required: true
46
64
  },
47
- de: {
48
- type: String,
65
+ from: {
66
+ type: Array,
49
67
  required: false,
50
- default: ""
68
+ default: () => []
51
69
  },
52
70
  para: {
53
- type: String,
71
+ type: Array,
54
72
  required: false,
55
- default: ""
73
+ default: () => []
56
74
  },
57
75
  html: {
58
76
  type: String,
@@ -83,104 +101,212 @@ export default {
83
101
  type: Boolean,
84
102
  required: false,
85
103
  default: false
104
+ },
105
+ dataServer: {
106
+ type: String,
107
+ required: false,
108
+ default: ""
109
+ },
110
+ isOpenClass: {
111
+ type: String,
112
+ required: false,
113
+ default: 'bg-dark-white-2'
114
+ },
115
+ isClosedClass: {
116
+ type: String,
117
+ required: false,
118
+ default: 'bg-light-gray-2'
86
119
  }
87
120
  },
88
121
  data() {
89
122
  return {
90
- estado: 0
91
- }
92
- },
93
- computed: {
94
- siglaNome() {
95
- return this.de[0] ? this.de[0].toUpperCase() : ""
123
+ isOpen: false,
124
+ openMessage: false,
125
+ actionsOpen: false
96
126
  }
97
127
  },
98
128
  methods: {
99
- toggleEstado() {
100
- this.estado = this.estado == 0 ? 1 : 0
129
+ toggleIsOpen() {
130
+ this.isOpen = !this.isOpen
131
+ },
132
+ toggleActions() {
133
+ this.actionsOpen = !this.actionsOpen
134
+ },
135
+ toggleOpenMessage() {
136
+ this.openMessage = !this.openMessage
137
+ },
138
+ returnCleanHtml(html) {
139
+ const options = {
140
+ allowedTags: [
141
+ 'a', 'b', 'br', 'div', 'i', 'p', 'span', 'strong', 'u', 'ul', 'ol', 'li'
142
+ ],
143
+ allowedAttributes: {
144
+ 'a': ['href'],
145
+ '*': ['style']
146
+ }
147
+ };
148
+ return this.$sanitize(html, options);
101
149
  }
102
150
  }
103
151
  }
104
152
  </script>
153
+
154
+ <style scoped>
155
+ .show-y-top-enter-active,
156
+ .show-y-top-leave-enter {
157
+ opacity: 1;
158
+ transform: translateY(0);
159
+ transition: all 200ms linear;
160
+ }
161
+
162
+ .show-y-top-enter,
163
+ .show-y-top-leave-to {
164
+ opacity: 0;
165
+ transform: translateY(-2%);
166
+ }
167
+ </style>
168
+
105
169
  <style>
106
- .w-100 {
107
- width: 100%;
108
- }
109
- .text-dark {
110
- color: #333
111
- }
112
- .min-h-60 {
113
- min-height: 60px;
114
- }
115
- .d-flex {
116
- display: flex;
117
- }
118
- .flex-wrap {
119
- flex-wrap: wrap;
120
- }
121
- .border-bottom-1 {
122
- border-bottom: 1px solid;
123
- }
124
- .border-color-gray {
125
- border-color: #CCC
126
- }
127
- .transition-150 {
128
- transition: all 150ms ease-in-out;
129
- }
130
- .cursor-pointer {
131
- cursor: pointer;
132
- }
133
- .justify-content-between {
134
- justify-content: space-between;
135
- }
136
- .align-items-center {
137
- align-items: center;
138
- }
139
- .align-self-start {
140
- align-self: flex-start;
141
- }
142
- .border-radius-round {
143
- border-radius: 50%!important;
144
- }
145
- .w-36px {
146
- width: 36px;
147
- }
148
- .h-36px {
149
- height: 36px;
150
- }
151
- .border-1 {
152
- border: 1px solid;
153
- }
154
- .mr-10 {
155
- margin-right: 10px;
156
- }
157
- .flex-column {
158
- display: flex;
159
- flex-direction: column
160
- }
161
- .text-bold {
162
- font-weight: bold;
163
- }
164
- .fs-_9 {
165
- font-size: 14.4px;
166
- }
167
- .fs-_8 {
168
- font-size: 12.8px;
169
- }
170
- .text-gray {
171
- color: gray;
172
- }
173
- .p-15 {
174
- padding: 15px;
175
- }
176
- .text-ellipsis{
177
- white-space: nowrap;
178
- text-overflow: ellipsis;
179
- overflow: hidden
180
- }
181
- .d-flex-center{
182
- display: flex;
183
- justify-content: center;
184
- align-items: center
185
- }
170
+ .bg-dark-white-2 {
171
+ background-color: #f7f7f7;
172
+ }
173
+
174
+ .bg-light-gray-2 {
175
+ background-color: #d8d8d8;
176
+ }
177
+
178
+ .email-item {
179
+ flex: 1;
180
+ margin: 0 10px 10px;
181
+ color: #222;
182
+ min-height: 60px;
183
+ display: flex;
184
+ flex-wrap: wrap;
185
+ padding: 10px;
186
+ border-radius: 5px;
187
+ transition: all 150ms ease-in-out;
188
+ }
189
+
190
+ .email-header {
191
+ width: 100%;
192
+ display: flex;
193
+ align-items: center;
194
+ justify-content: space-between;
195
+ cursor: pointer;
196
+ border-top-right-radius: 5px;
197
+ border-top-left-radius: 5px;
198
+ }
199
+
200
+ .email-header-content {
201
+ display: flex;
202
+ justify-content: center;
203
+ align-items: center;
204
+ margin: 10px
205
+ }
206
+
207
+ .email-header-infos {
208
+ display: flex;
209
+ flex-direction: column;
210
+ }
211
+
212
+ .email-subject {
213
+ margin: 0;
214
+ font-weight: bold;
215
+ font-size: .9rem;
216
+ }
217
+
218
+ .email-date {
219
+ font-size: .8rem;
220
+ margin-right: 10px;
221
+ text-overflow: ellipsis;
222
+ white-space: nowrap;
223
+ overflow: hidden
224
+ }
225
+
226
+ .email-content {
227
+ display: flex;
228
+ flex-direction: column;
229
+ align-items: center;
230
+ justify-content: center;
231
+ width: 100%;
232
+ padding: 15px;
233
+ background-color: #FFF;
234
+ position: relative;
235
+ }
236
+
237
+ .email-actions {
238
+ align-self: flex-end;
239
+ display: flex;
240
+ border-radius: 5px;
241
+ cursor: pointer;
242
+ align-items: center;
243
+ justify-content: center;
244
+ gap: 3px;
245
+ padding: 10px 5px;
246
+ background-color: #FFF;
247
+ }
248
+
249
+ .email-actions.active {
250
+ background-color: #dfdfdf;
251
+ }
252
+
253
+ .email-actions>span {
254
+ width: 7px;
255
+ height: 7px;
256
+ background-color: #222;
257
+ border-radius: 50%;
258
+ }
259
+
260
+ .email-actions-list {
261
+ position: absolute;
262
+ right: 60px;
263
+ width: 250px;
264
+ top: 15px;
265
+ margin: 0;
266
+ list-style-type: none;
267
+ padding: 0;
268
+ border-radius: 5px;
269
+ z-index: 1;
270
+ }
271
+
272
+ .email-action {
273
+ background-color: #dfdfdf;
274
+ padding: 5px 10px;
275
+ cursor: pointer;
276
+ transition: background-color 150ms ease-in-out;
277
+ font-size: .9rem;
278
+ user-select: none;
279
+ }
280
+
281
+ .email-action:nth-child(1) {
282
+ border-top-left-radius: 5px;
283
+ border-top-right-radius: 5px;
284
+ }
285
+
286
+ .email-action:last-child {
287
+ border-bottom-left-radius: 5px;
288
+ border-bottom-right-radius: 5px;
289
+ }
290
+
291
+ .email-action:hover {
292
+ background-color: #CCC;
293
+ }
294
+
295
+ .email-html {
296
+ max-width: 100%;
297
+ padding: 10px;
298
+ }
299
+
300
+ .email-raw {
301
+ max-width: 100%;
302
+ font-size: .9rem;
303
+ color: #222;
304
+ }
305
+
306
+ .email-files {
307
+ display: flex;
308
+ gap: 10px;
309
+ flex-wrap: wrap;
310
+ width: 100%
311
+ }
186
312
  </style>