vue-intergrall-plugins 1.1.66 → 1.1.68
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/vue-intergrall-plugins.esm.js +11426 -617
- package/dist/vue-intergrall-plugins.min.js +114 -2
- package/dist/vue-intergrall-plugins.ssr.js +11473 -687
- package/package.json +4 -1
- package/src/lib-components/Email/EmailItem.vue +176 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-intergrall-plugins",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.68",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/vue-intergrall-plugins.ssr.js",
|
|
6
6
|
"browser": "dist/vue-intergrall-plugins.esm.js",
|
|
@@ -54,5 +54,8 @@
|
|
|
54
54
|
},
|
|
55
55
|
"engines": {
|
|
56
56
|
"node": ">=12"
|
|
57
|
+
},
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"vue-html2pdf": "^1.8.0"
|
|
57
60
|
}
|
|
58
61
|
}
|
|
@@ -90,6 +90,7 @@
|
|
|
90
90
|
<fa-icon :icon="['fas', button.icon || 'question-circle']" v-if="!button.svgIcon" />
|
|
91
91
|
<span v-else v-html="button.svgIcon" :class="button.svgClass ? button.svgClass : ''"></span>
|
|
92
92
|
<span v-if="button.label" class="email-custom-action-label" v-text="button.label"></span>
|
|
93
|
+
<span v-if="status === 'C'"class="email-pdf-download cursor-pointer"@click.stop="generatePdf"title="Baixar e-mail em PDF"><fa-icon :icon="['fas', 'file-pdf']" /></span>
|
|
93
94
|
</button>
|
|
94
95
|
</template>
|
|
95
96
|
</div>
|
|
@@ -213,6 +214,59 @@
|
|
|
213
214
|
</span>
|
|
214
215
|
<!-- Status de mensagem deletada -->
|
|
215
216
|
</transition>
|
|
217
|
+
<vue-html2pdf
|
|
218
|
+
:show-layout="false"
|
|
219
|
+
:enable-download="true"
|
|
220
|
+
:preview-modal="false"
|
|
221
|
+
:paginate-elements-by-height="1400"
|
|
222
|
+
:filename="pdfFilename"
|
|
223
|
+
:pdf-quality="2"
|
|
224
|
+
ref="html2pdf"
|
|
225
|
+
:manual-pagination="true"
|
|
226
|
+
:html-to-pdf-options="htmlToPdfOptions"
|
|
227
|
+
>
|
|
228
|
+
<section slot="pdf-content" id="conteudo-pdf">
|
|
229
|
+
<div class="pdf-content">
|
|
230
|
+
<h1 class="pdf-title">{{ htmlEntityToEmoji(replaceUnicodeWithEmoji(assunto)) || '(Sem assunto)' }}</h1>
|
|
231
|
+
|
|
232
|
+
<table class="pdf-info-table">
|
|
233
|
+
<tbody>
|
|
234
|
+
<tr>
|
|
235
|
+
<th>De:</th>
|
|
236
|
+
<td>{{ formatPdfRecipients(from) }}</td>
|
|
237
|
+
</tr>
|
|
238
|
+
<tr>
|
|
239
|
+
<th>Para:</th>
|
|
240
|
+
<td>{{ formatPdfRecipients(para) }}</td>
|
|
241
|
+
</tr>
|
|
242
|
+
<tr v-if="copia && copia.length">
|
|
243
|
+
<th>Cópia:</th>
|
|
244
|
+
<td>{{ formatPdfRecipients(copia) }}</td>
|
|
245
|
+
</tr>
|
|
246
|
+
<tr>
|
|
247
|
+
<th>Data:</th>
|
|
248
|
+
<td>{{ formataDataHora(dataHora, true, false) }} - {{ formattedDate }}</td>
|
|
249
|
+
</tr>
|
|
250
|
+
</tbody>
|
|
251
|
+
</table>
|
|
252
|
+
|
|
253
|
+
<hr class="pdf-divisor" />
|
|
254
|
+
|
|
255
|
+
<div class="pdf-email-content">
|
|
256
|
+
<div v-html="formatContentForPdf()"></div>
|
|
257
|
+
</div>
|
|
258
|
+
|
|
259
|
+
<div v-if="filteredFiles && filteredFiles.length" class="pdf-attachments">
|
|
260
|
+
<h3>Anexos ({{ filteredFiles.length }}):</h3>
|
|
261
|
+
<ul>
|
|
262
|
+
<li v-for="(anexo, index) in filteredFiles" :key="index">
|
|
263
|
+
{{ anexo.name || `Anexo ${index + 1}` }}
|
|
264
|
+
</li>
|
|
265
|
+
</ul>
|
|
266
|
+
</div>
|
|
267
|
+
</div>
|
|
268
|
+
</section>
|
|
269
|
+
</vue-html2pdf>
|
|
216
270
|
</div>
|
|
217
271
|
</template>
|
|
218
272
|
|
|
@@ -221,6 +275,7 @@ import EmailFile from "./EmailFile.vue";
|
|
|
221
275
|
import EmailTo from "./EmailTo.vue";
|
|
222
276
|
import { textoLongo } from "@/mixins/formatarTexto";
|
|
223
277
|
import Clickaway from '@/directives/clickaway';
|
|
278
|
+
import VueHtml2pdf from 'vue-html2pdf';
|
|
224
279
|
import '../../styles/style.css';
|
|
225
280
|
|
|
226
281
|
export default {
|
|
@@ -228,7 +283,7 @@ export default {
|
|
|
228
283
|
directives: {
|
|
229
284
|
clickaway: Clickaway
|
|
230
285
|
},
|
|
231
|
-
components: { EmailFile, EmailTo },
|
|
286
|
+
components: { EmailFile, EmailTo, VueHtml2pdf },
|
|
232
287
|
props: {
|
|
233
288
|
dominio: {
|
|
234
289
|
type: String,
|
|
@@ -355,6 +410,29 @@ export default {
|
|
|
355
410
|
hasError: false,
|
|
356
411
|
errorCount: 0,
|
|
357
412
|
scrollToFile: false,
|
|
413
|
+
htmlToPdfOptions: {
|
|
414
|
+
margin: [15, 0, 15, 0],
|
|
415
|
+
filename: 'email.pdf',
|
|
416
|
+
image: {
|
|
417
|
+
type: 'jpeg',
|
|
418
|
+
quality: 0.98
|
|
419
|
+
},
|
|
420
|
+
enableLinks: false,
|
|
421
|
+
html2canvas: {
|
|
422
|
+
scale: 2,
|
|
423
|
+
useCORS: true,
|
|
424
|
+
letterRendering: true,
|
|
425
|
+
logging: false,
|
|
426
|
+
scrollY: 0,
|
|
427
|
+
scrollX: 0
|
|
428
|
+
},
|
|
429
|
+
jsPDF: {
|
|
430
|
+
unit: 'mm',
|
|
431
|
+
format: 'a4',
|
|
432
|
+
orientation: 'portrait',
|
|
433
|
+
compress: true
|
|
434
|
+
}
|
|
435
|
+
}
|
|
358
436
|
};
|
|
359
437
|
},
|
|
360
438
|
computed: {
|
|
@@ -456,6 +534,12 @@ export default {
|
|
|
456
534
|
const text = index === 0 ? `${this.dicionario.tit_copia || 'Cópia'}: ${name || ''}` : name ? `${name}${addVirgulaDps ? ', ' : ''}` : '';
|
|
457
535
|
return text
|
|
458
536
|
}
|
|
537
|
+
},
|
|
538
|
+
pdfFilename() {
|
|
539
|
+
const subject = this.assunto || 'email';
|
|
540
|
+
const sanitized = subject.replace(/[^a-z0-9]/gi, '_').substring(0, 50);
|
|
541
|
+
const date = this.dataHora ? new Date(this.dataHora).toISOString().split('T')[0] : '';
|
|
542
|
+
return `email_${sanitized}_${date}`;
|
|
459
543
|
}
|
|
460
544
|
},
|
|
461
545
|
watch: {
|
|
@@ -745,7 +829,97 @@ export default {
|
|
|
745
829
|
});
|
|
746
830
|
|
|
747
831
|
return Object.keys(customParams).length ? customParams : defaultParams;
|
|
832
|
+
},
|
|
833
|
+
generatePdf() {
|
|
834
|
+
if (this.$refs.html2pdf) {
|
|
835
|
+
this.$refs.html2pdf.generatePdf();
|
|
836
|
+
}
|
|
837
|
+
},
|
|
838
|
+
formatPdfRecipients(recipients) {
|
|
839
|
+
if (!recipients || !recipients.length) return '--';
|
|
840
|
+
return recipients.map(r => {
|
|
841
|
+
if (r.name && r.email) return `${r.name} <${r.email}>`;
|
|
842
|
+
return r.name || r.email || '';
|
|
843
|
+
}).join(', ');
|
|
844
|
+
},
|
|
845
|
+
formatContentForPdf() {
|
|
846
|
+
let content = this.html || this.mensagem || '';
|
|
847
|
+
|
|
848
|
+
if (!/<[a-z][\s\S]*>/i.test(content)) {
|
|
849
|
+
content = content.replace(/\n/g, '<br>');
|
|
850
|
+
content = this.gerarMensagemEstilizada(content);
|
|
851
|
+
content = `<p>${content}</p>`;
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
return content;
|
|
748
855
|
}
|
|
749
856
|
}
|
|
750
857
|
};
|
|
751
|
-
</script>
|
|
858
|
+
</script>
|
|
859
|
+
|
|
860
|
+
<style scoped>
|
|
861
|
+
.email-pdf-download {
|
|
862
|
+
padding: 5px 8px;
|
|
863
|
+
color: #d54286;
|
|
864
|
+
font-size: 16px;
|
|
865
|
+
transition: opacity 0.2s;
|
|
866
|
+
display: flex;
|
|
867
|
+
align-items: center;
|
|
868
|
+
justify-content: center;
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
.email-pdf-download:hover {
|
|
872
|
+
opacity: 0.7;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
.pdf-content {
|
|
876
|
+
padding: 20px;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
.pdf-title {
|
|
880
|
+
font-size: 20px;
|
|
881
|
+
color: #d54286;
|
|
882
|
+
margin: 0 0 15px 0;
|
|
883
|
+
padding-bottom: 10px;
|
|
884
|
+
border-bottom: 2px solid #e2e6ea;
|
|
885
|
+
word-wrap: break-word;
|
|
886
|
+
overflow-wrap: break-word;
|
|
887
|
+
page-break-after: avoid;
|
|
888
|
+
page-break-inside: avoid;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
.pdf-info-table {
|
|
892
|
+
width: 100%;
|
|
893
|
+
margin: 0 0 20px 0;
|
|
894
|
+
border-collapse: collapse;
|
|
895
|
+
table-layout: fixed;
|
|
896
|
+
page-break-inside: avoid;
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
.pdf-info-table th {
|
|
900
|
+
text-align: left;
|
|
901
|
+
padding: 10px;
|
|
902
|
+
font-weight: bold;
|
|
903
|
+
background-color: #f8f9fa;
|
|
904
|
+
border: 1px solid #e2e6ea;
|
|
905
|
+
width: 100px;
|
|
906
|
+
vertical-align: top;
|
|
907
|
+
font-size: 14px;
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
.pdf-info-table td {
|
|
911
|
+
padding: 10px;
|
|
912
|
+
border: 1px solid #e2e6ea;
|
|
913
|
+
word-wrap: break-word;
|
|
914
|
+
overflow-wrap: break-word;
|
|
915
|
+
word-break: break-word;
|
|
916
|
+
font-size: 14px;
|
|
917
|
+
line-height: 1.5;
|
|
918
|
+
max-width: 100%;
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
.pdf-info-table tr {
|
|
922
|
+
page-break-inside: avoid;
|
|
923
|
+
page-break-after: auto;
|
|
924
|
+
}
|
|
925
|
+
</style>
|