vue-intergrall-plugins 0.0.1085 → 1.0.0

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.
Files changed (37) hide show
  1. package/README.md +13 -5
  2. package/dist/vue-intergrall-plugins.min.js +1 -1
  3. package/package.json +70 -62
  4. package/src/lib-components/Buttons/IconButton.vue +27 -0
  5. package/src/lib-components/Buttons/SimpleButton.vue +140 -0
  6. package/src/lib-components/Cards/Card.vue +429 -0
  7. package/src/lib-components/Cards/CardCheck.vue +35 -0
  8. package/src/lib-components/Cards/CardFile.vue +157 -0
  9. package/src/lib-components/Chat/AudioSpeedControl.vue +60 -0
  10. package/src/lib-components/Chat/BtnDownloadAllFiles.vue +36 -0
  11. package/src/lib-components/Chat/BtnEmojis.vue +51 -45
  12. package/src/lib-components/Chat/BtnFiles.vue +408 -131
  13. package/src/lib-components/Chat/BtnScreenShare.vue +36 -0
  14. package/src/lib-components/Chat/BtnStandardMessages.vue +17 -0
  15. package/src/lib-components/Chat/ExpandTextarea.vue +5 -6
  16. package/src/lib-components/Chat/MultipleFilePreview.vue +40 -22
  17. package/src/lib-components/Chat/Picker.vue +185 -149
  18. package/src/lib-components/Chat/SingleFilePreview.vue +28 -7
  19. package/src/lib-components/Chat/StandardMessages.vue +245 -0
  20. package/src/lib-components/Chat/TextFooter.vue +791 -451
  21. package/src/lib-components/Email/EmailFile.vue +126 -0
  22. package/src/lib-components/Email/EmailItem.vue +186 -0
  23. package/src/lib-components/Loader/Loader.vue +6 -1
  24. package/src/lib-components/Messages/AnexoMensagem.vue +442 -0
  25. package/src/lib-components/Messages/CardAttachment.vue +61 -0
  26. package/src/lib-components/Messages/CardMessages.vue +666 -0
  27. package/src/lib-components/Messages/ChatMessages.vue +1082 -0
  28. package/src/lib-components/Messages/InteratividadeBotoes.vue +165 -0
  29. package/src/lib-components/Messages/InteratividadeFormulario.vue +392 -0
  30. package/src/lib-components/Messages/InteratividadePopup.vue +89 -0
  31. package/src/lib-components/Messages/LinkPreview.vue +189 -0
  32. package/src/lib-components/Scroll/ScrollContent.vue +166 -0
  33. package/src/lib-components/Templates/TemplateGenerator.vue +187 -50
  34. package/src/lib-components/Templates/TemplateMessage.vue +12 -1
  35. package/src/lib-components/Templates/TemplateSingle.vue +232 -13
  36. package/dist/vue-intergrall-plugins.esm.js +0 -5693
  37. package/dist/vue-intergrall-plugins.ssr.js +0 -5033
@@ -0,0 +1,1082 @@
1
+ <template>
2
+ <div
3
+ :class="'mensagem__' + origem"
4
+ v-if="origem && !erro"
5
+ :id="`a${messageIndex ? messageIndex : randomizeValue}`"
6
+ >
7
+ <InteratividadeFormulario
8
+ v-if="interatividade && validateInterativity()"
9
+ :interatividade="interatividade"
10
+ :dominio="dominio"
11
+ :infoCanal="infoCanalTeste"
12
+ :anexos="anexos"
13
+ :dictionary="dictionary"
14
+ />
15
+ <div
16
+ v-else
17
+ class="mensagem"
18
+ :class="{ mapa, 'hist-msg': histMsg, 'max-w-60': link && !mapa }"
19
+ >
20
+ <!-- Estilo da mensagem do tipo reply (que foi respondida) -->
21
+ <div
22
+ v-if="isReply && replyMessage"
23
+ class="mensagem-reply"
24
+ :class="`message-reply-${origem}`"
25
+ >
26
+ <p v-if="replyMessage" v-html="replyMessage"></p>
27
+ <span v-else class="mensagem-reply-vazia">
28
+ <fa-icon :icon="['fas', 'times']" v-if="showReplyIcon" />
29
+ {{
30
+ defaultReplyMessage ? defaultReplyMessage : dictionary.mensagem_reply_padrao
31
+ }}
32
+ </span>
33
+ </div>
34
+ <!-- Anexos -->
35
+ <template v-if="anexos && anexos.length">
36
+ <div class="mensagem-anexo" v-for="(anexo, index) in anexos" :key="index">
37
+ <AnexoMensagem
38
+ :showControlFiles="showControlFiles"
39
+ :referenceSelector="referenceSelector"
40
+ :dictionary="dictionary"
41
+ :anexo="anexo"
42
+ :origemExterna="origemExterna"
43
+ :dominio="dominio"
44
+ @abrir-imagem="abrirImagem"
45
+ @download-all="$emit('download-all')"
46
+ />
47
+ </div>
48
+ </template>
49
+ <!-- sticker -->
50
+ <img
51
+ class="default-stick-size"
52
+ v-if="urlSticker"
53
+ :src="urlSticker"
54
+ :title="urlFileName"
55
+ />
56
+ <!-- Mapa -->
57
+ <div v-if="mapa" class="mensagem-div-mapa">
58
+ <GmapMap
59
+ :id="`mapa_${seq}`"
60
+ class="msg-mapa"
61
+ :center="center"
62
+ :zoom="17"
63
+ :options="mapOptions"
64
+ >
65
+ <GmapMarker :position="marker" />
66
+ </GmapMap>
67
+ <ul class="info-mapa" v-if="infos.length">
68
+ <li v-for="(info, index) in infos" :key="index" :class="info.classe">
69
+ <template v-if="!info.link"> {{ info.value }} </template>
70
+ <a v-else :href="info.value" @click.prevent="abrirPopup(info.value)">
71
+ {{ info.textLink }} <fa-icon :icon="['fas', 'map-marker-alt']" />
72
+ </a>
73
+ </li>
74
+ </ul>
75
+ </div>
76
+ <!-- Preview do link -->
77
+ <LinkPreview v-if="link && !mapa && status != 'O'" :message="message" />
78
+ <!-- Mensagem -->
79
+ <p v-html="validateInterativity() ? '' : formatMsg(message)"></p>
80
+ <!-- Botoes da interatividade -->
81
+ <InteratividadeBotoes v-if="interatividade" :interatividade="interatividade" />
82
+ <!-- Horario da mensagem -->
83
+ <span class="horario-envio" v-text="horario"></span>
84
+ <!-- Reenviar mensagem -->
85
+ <transition name="fade" mode="out-in">
86
+ <span
87
+ :class="reply"
88
+ v-if="hasReply && (status == 'C' || status == 'T' || status == 'ERRO')"
89
+ v-tippy
90
+ :content="msgReply ? msgReply : 'Fazer reenvio da mensagem'"
91
+ @click="$emit('replyMsg')"
92
+ >
93
+ <fa-icon :icon="['fas', 'reply']" />
94
+ </span>
95
+ </transition>
96
+ <!-- ?? -->
97
+ <transition name="fade" mode="out-in" v-if="validadeSeq">
98
+ <span
99
+ class="star dourado"
100
+ v-if="iniDialogo > 0"
101
+ :content="contentTooltipStar"
102
+ v-tippy
103
+ key="star-padrao-dourado"
104
+ >
105
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
106
+ <path
107
+ fill="#FFD700"
108
+ d="M224 122.8c-72.7 0-131.8 59.1-131.9 131.8 0 24.9 7 49.2 20.2 70.1l3.1 5-13.3 48.6 49.9-13.1 4.8 2.9c20.2 12 43.4 18.4 67.1 18.4h.1c72.6 0 133.3-59.1 133.3-131.8 0-35.2-15.2-68.3-40.1-93.2-25-25-58-38.7-93.2-38.7zm77.5 188.4c-3.3 9.3-19.1 17.7-26.7 18.8-12.6 1.9-22.4.9-47.5-9.9-39.7-17.2-65.7-57.2-67.7-59.8-2-2.6-16.2-21.5-16.2-41s10.2-29.1 13.9-33.1c3.6-4 7.9-5 10.6-5 2.6 0 5.3 0 7.6.1 2.4.1 5.7-.9 8.9 6.8 3.3 7.9 11.2 27.4 12.2 29.4s1.7 4.3.3 6.9c-7.6 15.2-15.7 14.6-11.6 21.6 15.3 26.3 30.6 35.4 53.9 47.1 4 2 6.3 1.7 8.6-1 2.3-2.6 9.9-11.6 12.5-15.5 2.6-4 5.3-3.3 8.9-2 3.6 1.3 23.1 10.9 27.1 12.9s6.6 3 7.6 4.6c.9 1.9.9 9.9-2.4 19.1zM400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zM223.9 413.2c-26.6 0-52.7-6.7-75.8-19.3L64 416l22.5-82.2c-13.9-24-21.2-51.3-21.2-79.3C65.4 167.1 136.5 96 223.9 96c42.4 0 82.2 16.5 112.2 46.5 29.9 30 47.9 69.8 47.9 112.2 0 87.4-72.7 158.5-160.1 158.5z"
109
+ />
110
+ </svg>
111
+ </span>
112
+ <span
113
+ class="star cinza"
114
+ v-if="iniDialogo == 0"
115
+ :content="contentTooltipStar"
116
+ v-tippy
117
+ key="star-padrao-cinza"
118
+ >
119
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
120
+ <path
121
+ fill="#808080"
122
+ d="M224 122.8c-72.7 0-131.8 59.1-131.9 131.8 0 24.9 7 49.2 20.2 70.1l3.1 5-13.3 48.6 49.9-13.1 4.8 2.9c20.2 12 43.4 18.4 67.1 18.4h.1c72.6 0 133.3-59.1 133.3-131.8 0-35.2-15.2-68.3-40.1-93.2-25-25-58-38.7-93.2-38.7zm77.5 188.4c-3.3 9.3-19.1 17.7-26.7 18.8-12.6 1.9-22.4.9-47.5-9.9-39.7-17.2-65.7-57.2-67.7-59.8-2-2.6-16.2-21.5-16.2-41s10.2-29.1 13.9-33.1c3.6-4 7.9-5 10.6-5 2.6 0 5.3 0 7.6.1 2.4.1 5.7-.9 8.9 6.8 3.3 7.9 11.2 27.4 12.2 29.4s1.7 4.3.3 6.9c-7.6 15.2-15.7 14.6-11.6 21.6 15.3 26.3 30.6 35.4 53.9 47.1 4 2 6.3 1.7 8.6-1 2.3-2.6 9.9-11.6 12.5-15.5 2.6-4 5.3-3.3 8.9-2 3.6 1.3 23.1 10.9 27.1 12.9s6.6 3 7.6 4.6c.9 1.9.9 9.9-2.4 19.1zM400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zM223.9 413.2c-26.6 0-52.7-6.7-75.8-19.3L64 416l22.5-82.2c-13.9-24-21.2-51.3-21.2-79.3C65.4 167.1 136.5 96 223.9 96c42.4 0 82.2 16.5 112.2 46.5 29.9 30 47.9 69.8 47.9 112.2 0 87.4-72.7 158.5-160.1 158.5z"
123
+ />
124
+ </svg>
125
+ </span>
126
+ </transition>
127
+ <!-- Status da mensagem -->
128
+ <transition name="fade" mode="out-in">
129
+ <span
130
+ class="check"
131
+ v-if="status == 'D'"
132
+ :content="contentTooltip"
133
+ v-tippy
134
+ key="check-padrao"
135
+ >
136
+ <fa-icon :icon="['fas', 'check']" />
137
+ </span>
138
+ <span
139
+ class="check cinza"
140
+ v-else-if="status == 'Q'"
141
+ :content="contentTooltip"
142
+ v-tippy
143
+ key="check-cinza"
144
+ >
145
+ <fa-icon :icon="['fas', 'check']" />
146
+ </span>
147
+ <span
148
+ class="check preto"
149
+ v-else-if="status == 'G'"
150
+ :content="contentTooltip"
151
+ v-tippy
152
+ key="check-preto"
153
+ >
154
+ <fa-icon :icon="['fas', 'check']" />
155
+ </span>
156
+ <span
157
+ class="check preto"
158
+ v-else-if="status == 'E'"
159
+ :content="contentTooltip"
160
+ v-tippy
161
+ key="double-check-preto"
162
+ >
163
+ <fa-icon :icon="['fas', 'check-double']" />
164
+ </span>
165
+ <span
166
+ class="check visualizado"
167
+ v-else-if="status == 'L'"
168
+ :content="contentTooltip"
169
+ v-tippy
170
+ key="double-check-visualizado"
171
+ >
172
+ <fa-icon :icon="['fas', 'check-double']" />
173
+ </span>
174
+ <!-- Status finalizador -->
175
+ <span
176
+ class="check vermelho"
177
+ v-else-if="status == 'C' || status == 'ERRO'"
178
+ :content="contentTooltip"
179
+ v-tippy
180
+ key="times-circle"
181
+ >
182
+ <fa-icon :icon="['fas', 'times-circle']" />
183
+ </span>
184
+ <!-- Status finalizador -->
185
+ <span
186
+ class="check vermelho"
187
+ v-else-if="status == 'T'"
188
+ :content="contentTooltip"
189
+ v-tippy
190
+ key="hourglass"
191
+ >
192
+ <fa-icon :icon="['fas', 'hourglass']" />
193
+ </span>
194
+ <!-- Status finalizador -->
195
+ <span
196
+ class="check vermelho"
197
+ v-else-if="status == 'O'"
198
+ :content="contentTooltip"
199
+ v-tippy
200
+ key="deleted"
201
+ >
202
+ <fa-icon :icon="['fas', 'times']" />
203
+ </span>
204
+ <!-- Status de mensagem deletada -->
205
+ </transition>
206
+ <!-- Autor da mensagem -->
207
+ <span class="autor-mensagem" v-html="autor" :title="autor"></span>
208
+ <!-- Menu de opcoes da mensagem -->
209
+ <div class="menu-primario" :class="origem" v-if="hasAnyMenu">
210
+ <!-- <span class="menu-mensagem" @click="toggleIsMenuOpen" v-tippy :content="dictionary.tit_mais_msg">
211
+ <fa-icon :icon="['fas', 'chevron-down']" />
212
+ </span> -->
213
+ <span
214
+ class="menu-mensagem"
215
+ @click="responderMensagemHandler"
216
+ v-tippy
217
+ :content="dictionary.tit_responder_msg"
218
+ v-if="showMenu.reply"
219
+ >
220
+ <fa-icon :icon="['fas', 'reply']" />
221
+ </span>
222
+ <span
223
+ class="menu-mensagem"
224
+ @click="reagirMensagemHandler"
225
+ v-tippy
226
+ :content="dictionary.tit_reagir_msg"
227
+ v-if="showMenu.reaction"
228
+ >
229
+ <fa-icon :icon="['fas', 'smile']" />
230
+ </span>
231
+ </div>
232
+ <div
233
+ class="emoji-message-container"
234
+ v-if="isEmojisOpen"
235
+ v-on-clickaway="closeEmojis"
236
+ >
237
+ <fa-icon
238
+ :icon="['fas', 'times-circle']"
239
+ class="sc-icone-fechar sc-icone-fechar--externo"
240
+ @click="closeEmojis"
241
+ />
242
+ <Picker @insert-emoji="addReaction" />
243
+ </div>
244
+ <transition name="fade" mode="out-in" v-if="isMenuOpen">
245
+ <ul class="menu-flutuante" :class="origem" v-on-clickaway="closeMenu">
246
+ <li @click="responderMensagemHandler" v-if="showMenu.reply">
247
+ <span> {{ dictionary.tit_responder_msg }} </span>
248
+ </li>
249
+ <li @click="reagirMensagemHandler" v-if="showMenu.reaction">
250
+ <span> {{ dictionary.tit_reagir_msg }} </span>
251
+ </li>
252
+ </ul>
253
+ </transition>
254
+ <transition name="fade" mode="out-in" v-if="messageReaction">
255
+ <span
256
+ class="reaction"
257
+ v-tippy
258
+ :content="`${dictionary.tit_mensagem_reagida} ${messageReaction.finalEmoji}`"
259
+ >
260
+ <span v-html="messageReaction.finalEmoji"></span>
261
+ </span>
262
+ </transition>
263
+ </div>
264
+ </div>
265
+ </template>
266
+
267
+ <script>
268
+ import AnexoMensagem from "./AnexoMensagem";
269
+ import InteratividadeBotoes from "./InteratividadeBotoes";
270
+ import InteratividadeFormulario from "./InteratividadeFormulario";
271
+ import Picker from "../Chat/Picker";
272
+ import { formataTimezoneData } from "../../services/textFormatting";
273
+ import LinkPreview from "./LinkPreview";
274
+ import { mixin as clickaway } from "vue-clickaway";
275
+
276
+ export default {
277
+ components: {
278
+ AnexoMensagem,
279
+ InteratividadeBotoes,
280
+ InteratividadeFormulario,
281
+ LinkPreview,
282
+ Picker,
283
+ },
284
+ props: [
285
+ "smartchannel",
286
+ "messageIndex",
287
+ "dictionary",
288
+ "autor",
289
+ "origem",
290
+ "msg",
291
+ "link",
292
+ "anexo",
293
+ "imgAnexo",
294
+ "tipoDoc",
295
+ "docAnexo",
296
+ "nomeArquivo",
297
+ "audio",
298
+ "video",
299
+ "horario",
300
+ "status",
301
+ "logo",
302
+ "msgTooltip",
303
+ "seq",
304
+ "mapa",
305
+ "histMsg",
306
+ "erro",
307
+ "msgErro",
308
+ "origemExterna",
309
+ "anexos",
310
+ "dominio",
311
+ "corMsg",
312
+ "interatividade",
313
+ "msgReply",
314
+ "hasReply",
315
+ "iniDialogo",
316
+ "dialogoId",
317
+ "dialogoOrigem",
318
+ "expSessao",
319
+ "referenceSelector",
320
+ "replyMessage",
321
+ "isReply",
322
+ "defaultReplyMessage",
323
+ "showReplyIcon",
324
+ "showControlFiles",
325
+ "showMenu",
326
+ "id_ext_msg",
327
+ "tipo_origem",
328
+ ],
329
+ created() {
330
+ if (!this.$root.$refs.chatMessages) this.$root.$refs.chatMessages = this;
331
+ },
332
+ mixins: [clickaway],
333
+ data() {
334
+ return {
335
+ strTooltipAux: "",
336
+ linkAux: "",
337
+ urlSticker: "",
338
+ urlFileName: "",
339
+ message: "",
340
+ reply: "reply",
341
+ center: {},
342
+ marker: {},
343
+ infos: [],
344
+ infoCanalTeste: {
345
+ PRAZO: "2022-05-05",
346
+ SITUACAO: { cod: "3", desc: "Em analise pelo fornecedor", cor: "#03A64A" },
347
+ DATA_ABERTURA: "2022-05-03 09:43:43",
348
+ },
349
+ mapOptions: {
350
+ zoomControl: true,
351
+ mapTypeControl: false,
352
+ scaleControl: false,
353
+ streetViewControl: false,
354
+ rotateControl: false,
355
+ fullscreenControl: false,
356
+ disableDefaultUI: false,
357
+ },
358
+ isMenuOpen: false,
359
+ showMenuOptions: false,
360
+ isEmojisOpen: false,
361
+ messageReaction: "",
362
+ };
363
+ },
364
+ computed: {
365
+ hrefAnexo() {
366
+ if (this.docAnexo) {
367
+ if (this.tipoDoc == "erro") {
368
+ return (this.hrefAnexo = "#");
369
+ } else {
370
+ return this.docAnexo;
371
+ }
372
+ }
373
+ },
374
+ randomizeValue() {
375
+ return `${Math.floor(Math.random() * 7770)}${Date.now()}`;
376
+ },
377
+ contentTooltip: {
378
+ get() {
379
+ if (this.status && !this.msgTooltip) {
380
+ const msgStatus = "msg_status_" + this.status;
381
+ return (this.strTooltipAux = this.dictionary[msgStatus]);
382
+ } else if (this.status && this.msgTooltip) {
383
+ return (this.strTooltipAux = this.msgTooltip);
384
+ }
385
+ },
386
+ set(msg) {
387
+ return (this.contentTooltip = msg);
388
+ },
389
+ },
390
+ contentTooltipStar() {
391
+ let tooltipStar = "";
392
+ if (this.iniDialogo == 1) {
393
+ tooltipStar += this.dictionary["ini_sessao"] + "<br/>";
394
+ } else {
395
+ tooltipStar += this.dictionary["ini_sessao_padrao"] + "<br/>";
396
+ }
397
+ tooltipStar += this.dialogoId
398
+ ? this.dictionary["id_conversa"] + " - " + this.dialogoId + "<br/>"
399
+ : "";
400
+ tooltipStar += this.dialogoOrigem
401
+ ? this.dictionary["origem_conversa"] + " - " + this.dialogoOrigem + "<br/>"
402
+ : "";
403
+ tooltipStar += this.expSessao
404
+ ? this.dictionary["expiracao_sessao"] +
405
+ " - " +
406
+ formataTimezoneData(this.expSessao) +
407
+ "<br/>"
408
+ : "";
409
+
410
+ if (this.tipo_origem) {
411
+ tooltipStar += `${this.dictionary["tipo_origem"]}: ${
412
+ this.dictionary[`tipo_origem_${this.tipo_origem}`]
413
+ ? this.dictionary[`tipo_origem_${this.tipo_origem}`]
414
+ : this.tipo_origem
415
+ }<br/>`;
416
+ }
417
+
418
+ return tooltipStar;
419
+ },
420
+ validadeSeq() {
421
+ if (this.seq && this.seq.substring(0, 2) == "HW") return true;
422
+ this.reply = "reply reply-with-2-icons";
423
+ return false;
424
+ },
425
+ hasAnyMenu() {
426
+ if (!this.showMenu || typeof this.showMenu !== "object") return false;
427
+ for (let key in this.showMenu) {
428
+ if (this.showMenu.hasOwnProperty(key) && this.showMenu[key] === true) return true;
429
+ }
430
+ return false;
431
+ },
432
+ },
433
+ mounted() {
434
+ if (this.mapa) this.setMap();
435
+ if (this.corMsg) this.setCorMsg();
436
+ this.validadeUrlToMsg();
437
+ },
438
+ methods: {
439
+ closeMenu() {
440
+ this.isMenuOpen = false;
441
+ },
442
+ toggleIsMenuOpen() {
443
+ this.isMenuOpen = !this.isMenuOpen;
444
+ },
445
+ responderMensagemHandler() {
446
+ if (this.isMenuOpen) this.closeMenu();
447
+ this.$emit("responder-mensagem", {
448
+ messageIndex: this.messageIndex,
449
+ autor: this.autor,
450
+ origem: this.origem,
451
+ msg: this.msg,
452
+ anexo: this.anexo,
453
+ imgAnexo: this.imgAnexo,
454
+ tipoDoc: this.tipoDoc,
455
+ docAnexo: this.docAnexo,
456
+ nomeArquivo: this.nomeArquivo,
457
+ audio: this.audio,
458
+ video: this.video,
459
+ seq: this.seq,
460
+ mapa: this.mapa,
461
+ anexos: this.anexos,
462
+ interatividade: this.interatividade,
463
+ referenceSelector: this.referenceSelector,
464
+ id_ext_msg: this.id_ext_msg,
465
+ });
466
+ },
467
+ reagirMensagemHandler() {
468
+ if (this.isMenuOpen) this.closeMenu();
469
+ this.isEmojisOpen = !this.isEmojisOpen;
470
+ },
471
+ addReaction(emoji) {
472
+ this.messageReaction =
473
+ this.messageReaction && this.messageReaction.hexa === emoji.hexa
474
+ ? ""
475
+ : { hexa: emoji.hexa, finalEmoji: emoji.finalEmoji };
476
+ this.isEmojisOpen = false;
477
+ this.$emit("reagir-mensagem", {
478
+ emoji,
479
+ seq: this.seq,
480
+ id_ext_msg: this.id_ext_msg,
481
+ hasEmojiReaction: this.messageReaction ? true : false,
482
+ });
483
+ },
484
+ closeEmojis() {
485
+ this.isEmojisOpen = false;
486
+ },
487
+ validateInterativity() {
488
+ try {
489
+ if (
490
+ (this.interatividade &&
491
+ this.interatividade.formulario &&
492
+ this.interatividade.formulario.length) ||
493
+ (this.interatividade.list && this.interatividade.tipo == "listItem")
494
+ ) {
495
+ return true;
496
+ }
497
+ return false;
498
+ } catch (error) {
499
+ return false;
500
+ }
501
+ },
502
+ validadeUrlToMsg() {
503
+ try {
504
+ this.message = this.msg;
505
+ if (this.validadeIfExistsSticker()) {
506
+ this.urlSticker = this.getUrlSticker();
507
+ this.urlFileName = this.getUrlFileName();
508
+ this.message = this.removeUrlStickerByString(this.urlSticker);
509
+ }
510
+ } catch (error) {
511
+ console.error("Error validating url to msg: ", error);
512
+ }
513
+ },
514
+ getUrlFileName() {
515
+ let urlRegex = /(?<=\/)[^\/\?#]+(?=[^\/]*$)/;
516
+ let urlName = this.urlSticker.match(urlRegex)[0];
517
+ return urlName;
518
+ },
519
+ removeUrlStickerByString(url) {
520
+ let msg = this.message.replace(`KSTICKERK ${url}`, "");
521
+ return msg;
522
+ },
523
+ getUrlSticker() {
524
+ let urlRegex = /(https?:\/\/[^ ]*)/;
525
+ let url = this.message.match(urlRegex)[1];
526
+ return url;
527
+ },
528
+ validadeIfExistsSticker() {
529
+ if (this.message && this.message.indexOf("KSTICKERK https://") === 0) return true;
530
+ return false;
531
+ },
532
+ setCorMsg() {
533
+ try {
534
+ const root = document.documentElement;
535
+ root.style.setProperty("--message-color", this.corMsg);
536
+ this.adjustFontColor(this.corMsg);
537
+ } catch (e) {
538
+ console.error("Erro ao atribuir a cor as mensagens");
539
+ console.error(e);
540
+ }
541
+ },
542
+ setMap() {
543
+ let objMapa =
544
+ typeof this.mapa === "string" ? JSON.parse(`${this.mapa}`) : this.mapa;
545
+ if (objMapa.latitude && objMapa.longitude) {
546
+ objMapa.latitude = parseFloat(objMapa.latitude);
547
+ objMapa.longitude = parseFloat(objMapa.longitude);
548
+
549
+ this.center.lat = objMapa.latitude;
550
+ this.center.lng = objMapa.longitude;
551
+
552
+ this.marker.lat = objMapa.latitude;
553
+ this.marker.lng = objMapa.longitude;
554
+
555
+ this.infos.push(
556
+ { classe: "title", value: objMapa.name },
557
+ { classe: "address", value: objMapa.address },
558
+ {
559
+ classe: "url",
560
+ value: `https://www.google.com/maps/search/?api=1&query=${this.marker.lat},${this.marker.lng}`,
561
+ link: true,
562
+ textLink: this.dictionary.abrir_mapa,
563
+ }
564
+ );
565
+ }
566
+ },
567
+ abrirPopup(url) {
568
+ window.open(url, "map-popup", "width=auto,height=auto");
569
+ },
570
+ abrirImagem(imagem) {
571
+ this.$emit("abrir-imagem", imagem);
572
+ },
573
+ adjustFontColor(cor) {
574
+ try {
575
+ var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(cor);
576
+
577
+ if (!result) return;
578
+
579
+ var r = parseInt(result[1], 16);
580
+ var g = parseInt(result[2], 16);
581
+ var b = parseInt(result[3], 16);
582
+
583
+ (r /= 255), (g /= 255), (b /= 255);
584
+ var max = Math.max(r, g, b),
585
+ min = Math.min(r, g, b);
586
+ var h,
587
+ s,
588
+ l = (max + min) / 2;
589
+
590
+ if (max == min) {
591
+ h = s = 0; // achromatic
592
+ } else {
593
+ var d = max - min;
594
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
595
+ switch (max) {
596
+ case r:
597
+ h = (g - b) / d + (g < b ? 6 : 0);
598
+ break;
599
+ case g:
600
+ h = (b - r) / d + 2;
601
+ break;
602
+ case b:
603
+ h = (r - g) / d + 4;
604
+ break;
605
+ }
606
+ h /= 6;
607
+ }
608
+
609
+ s = s * 100;
610
+ s = Math.round(s);
611
+ l = l * 100;
612
+ l = Math.round(l);
613
+ h = Math.round(360 * h);
614
+
615
+ const root = document.documentElement;
616
+ root.style.setProperty("--text-color", l <= 50 ? "#FFF" : "#111B21");
617
+ root.style.setProperty(
618
+ "--files-bg",
619
+ l <= 50 ? "rgba(255, 255, 255, 0.1)" : "rgba(100, 100, 100, 0.1)"
620
+ );
621
+ root.style.setProperty(
622
+ "--files-bg-hover",
623
+ l <= 50 ? "rgba(255, 255, 255, 0.3)" : "rgba(100, 100, 100, 0.3)"
624
+ );
625
+ } catch (e) {
626
+ console.error("Erro ao ajustar a cor da mensagem: ", e);
627
+ }
628
+ },
629
+ formatMsg(msg) {
630
+ if (this.status == "O")
631
+ return this.dictionary.msg_excluida
632
+ ? this.dictionary.msg_excluida
633
+ : "MENSAGEM DELETADA";
634
+ const regex = /(\n|&nbsp;)/g;
635
+ if (regex.test(msg)) msg = msg.replace(regex, "<br>");
636
+ return msg;
637
+ },
638
+ },
639
+ };
640
+ </script>
641
+
642
+ <style>
643
+ :root {
644
+ --message-color: #373737;
645
+ --text-color: #fff;
646
+ --files-bg: rgba(255, 255, 255, 0.1);
647
+ --files-bg-hover: rgba(255, 255, 255, 0.1);
648
+
649
+ --light: 80;
650
+ --threshold: 60;
651
+ }
652
+
653
+ .fade-enter-active,
654
+ .fade-leave-active {
655
+ transition: opacity 0.5s;
656
+ }
657
+ .fade-enter,
658
+ .fade-leave-to {
659
+ opacity: 0;
660
+ }
661
+
662
+ .mensagem-reply {
663
+ padding: 5px 10px;
664
+ font-size: 12px;
665
+ color: #666;
666
+ transition: background-color 150ms ease-in-out;
667
+ border-radius: 5px;
668
+ margin: 5px 0;
669
+ overflow: hidden;
670
+ max-width: 100%;
671
+ }
672
+ .mensagem-reply p {
673
+ overflow: hidden;
674
+ text-overflow: ellipsis;
675
+ white-space: nowrap;
676
+ }
677
+
678
+ .message-reply-principal {
679
+ border-left: 3px solid transparent;
680
+ background-color: rgba(100, 100, 100, 0.1);
681
+ }
682
+ .message-reply-principal:hover {
683
+ background-color: rgba(100, 100, 100, 0.2);
684
+ }
685
+
686
+ .message-reply-outros {
687
+ background-color: rgb(245, 245, 245);
688
+ border-left: 3px solid var(--message-color);
689
+ }
690
+ .message-reply-outros:hover {
691
+ background-color: rgb(235, 235, 235);
692
+ }
693
+
694
+ .mensagem-reply-vazia {
695
+ display: flex;
696
+ align-items: center;
697
+ }
698
+ .mensagem-reply-vazia svg {
699
+ margin-right: 5px;
700
+ color: #ba181b;
701
+ }
702
+
703
+ .mensagem {
704
+ padding: 20px 7px 14px 7px;
705
+ border-radius: 5px;
706
+ min-width: 150px;
707
+ min-height: 60px;
708
+ width: -webkit-fit-content;
709
+ width: -moz-fit-content;
710
+ width: fit-content;
711
+ position: relative;
712
+ max-width: 80%;
713
+ margin-bottom: 10px;
714
+ font-size: 12px;
715
+ word-break: break-word;
716
+
717
+ -webkit-box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2),
718
+ 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);
719
+ -moz-box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2),
720
+ 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);
721
+ box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14),
722
+ 0px 1px 5px 0px rgba(0, 0, 0, 0.12);
723
+ }
724
+ .mensagem.max-w-60 {
725
+ max-width: 60%;
726
+ }
727
+ .mensagem.mapa {
728
+ width: 100%;
729
+ }
730
+ .mensagem.hist-msg {
731
+ animation: show 1s;
732
+ }
733
+ .mensagem a {
734
+ margin-right: 5px;
735
+ font-weight: 550;
736
+ color: inherit;
737
+ text-decoration: none;
738
+ }
739
+ .mensagem a:hover {
740
+ text-decoration: underline;
741
+ }
742
+ .message p {
743
+ white-space: pre-wrap;
744
+ }
745
+ .mensagem:hover .menu-primario {
746
+ visibility: visible;
747
+ opacity: 1;
748
+ }
749
+
750
+ .mensagem-anexo a,
751
+ .mensagem-div-mapa a {
752
+ white-space: nowrap;
753
+ text-overflow: ellipsis;
754
+ overflow: hidden;
755
+ }
756
+
757
+ .reply {
758
+ cursor: pointer;
759
+ position: absolute;
760
+ right: 53px;
761
+ bottom: 5px;
762
+ font-size: 9.6px;
763
+ color: #67a332;
764
+ width: 14.4px;
765
+ height: 14.4px;
766
+ display: flex;
767
+ justify-content: center;
768
+ align-items: center;
769
+ border-radius: 50%;
770
+ background-color: #fff;
771
+ }
772
+ .reply svg {
773
+ margin-top: -1px;
774
+ margin-right: -1px;
775
+ }
776
+ .reply-with-2-icons {
777
+ right: 30px;
778
+ }
779
+
780
+ .check {
781
+ cursor: pointer;
782
+ position: absolute;
783
+ right: 10px;
784
+ bottom: 2px;
785
+ font-size: 11.2px;
786
+ }
787
+ .check.visualizado,
788
+ .check.visualizado svg {
789
+ color: #006daa;
790
+ }
791
+ .check.verde,
792
+ .check.verde svg {
793
+ color: #4f772d;
794
+ }
795
+ .check.vermelho,
796
+ .check.vermelho svg {
797
+ color: #ba181b;
798
+ }
799
+ .check.cinza,
800
+ .check.cinza svg {
801
+ color: #999;
802
+ }
803
+ .check.preto,
804
+ .check.preto svg {
805
+ color: #666;
806
+ }
807
+ .star {
808
+ cursor: pointer;
809
+ position: absolute;
810
+ right: 30px;
811
+ bottom: 2px;
812
+ font-size: 6.4px;
813
+ width: 11.2px;
814
+ }
815
+ .default-stick-size {
816
+ width: 180px;
817
+ height: auto;
818
+ }
819
+ .horario-envio {
820
+ margin-right: 15px;
821
+ font-size: 11.2px;
822
+ position: absolute;
823
+ left: 10px;
824
+ bottom: 2px;
825
+ }
826
+
827
+ .autor-mensagem {
828
+ position: absolute;
829
+ font-size: 9.6px;
830
+ white-space: nowrap;
831
+ text-overflow: ellipsis;
832
+ overflow: hidden;
833
+ max-width: 90%;
834
+ font-weight: bold;
835
+ top: 2px;
836
+ }
837
+
838
+ .menu-primario {
839
+ visibility: hidden;
840
+ opacity: 0;
841
+ transition: opacity 150ms ease-in-out;
842
+ position: absolute;
843
+ font-size: 11.2px;
844
+ top: 3px;
845
+ display: flex;
846
+ gap: 5px;
847
+ padding: 2px 4px;
848
+ }
849
+ .menu-primario.principal {
850
+ left: 4px;
851
+ color: var(--text-color);
852
+ background-color: var(--message-color);
853
+ }
854
+ .menu-primario.outros {
855
+ right: 4px;
856
+ color: var(--text-color);
857
+ background-color: #fff;
858
+ }
859
+
860
+ .menu-primario.outros > span:nth-child(1) {
861
+ order: 10;
862
+ }
863
+
864
+ .menu-mensagem {
865
+ cursor: pointer;
866
+ padding: 1px;
867
+ }
868
+
869
+ .menu-flutuante {
870
+ background-color: #fff;
871
+ -webkit-box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2),
872
+ 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);
873
+ -moz-box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2),
874
+ 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);
875
+ box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14),
876
+ 0px 1px 5px 0px rgba(0, 0, 0, 0.12);
877
+ border-radius: 10px;
878
+ position: absolute;
879
+ top: 20px;
880
+ width: 120px;
881
+ min-height: 50px;
882
+ height: 50px;
883
+ max-height: 50px;
884
+ overflow-x: hidden;
885
+ overflow-y: auto;
886
+ margin: 0;
887
+ padding: 0;
888
+ display: flex;
889
+ flex-direction: column;
890
+ z-index: 1;
891
+ }
892
+
893
+ .menu-flutuante.principal {
894
+ left: 3px;
895
+ }
896
+
897
+ .menu-flutuante.outros {
898
+ right: 3px;
899
+ }
900
+
901
+ .menu-flutuante li {
902
+ transition: background-color 300ms ease-in-out;
903
+ width: 100%;
904
+ cursor: pointer;
905
+ padding: 5px 10px;
906
+ display: flex;
907
+ align-items: center;
908
+ }
909
+
910
+ .menu-flutuante li:hover {
911
+ background-color: #e9e9e9;
912
+ }
913
+
914
+ /* Principal */
915
+ .mensagem__principal {
916
+ width: 100%;
917
+ display: flex;
918
+ justify-content: flex-end;
919
+ }
920
+ .mensagem__principal > .mensagem::after {
921
+ content: "";
922
+ width: 0;
923
+ height: 0;
924
+ position: absolute;
925
+ border-left: 10px solid transparent;
926
+ border-right: 10px solid transparent;
927
+ border-top: 10px solid var(--message-color);
928
+ bottom: 5px;
929
+ right: -10px;
930
+ transform: rotate(-90deg);
931
+ }
932
+ .mensagem__principal > .mensagem {
933
+ background-color: var(--message-color);
934
+ color: var(--text-color);
935
+ }
936
+
937
+ .mensagem__principal > .mensagem .horario-envio {
938
+ color: var(--text-color);
939
+ }
940
+ .mensagem__principal > .mensagem .autor-mensagem {
941
+ right: 5px;
942
+ color: var(--text-color);
943
+ }
944
+ /* Outros */
945
+ .mensagem__outros {
946
+ width: 100%;
947
+ display: flex;
948
+ }
949
+ .mensagem__outros > .mensagem {
950
+ background-color: #fff;
951
+ color: #333;
952
+ }
953
+ .mensagem__outros > .mensagem::after {
954
+ content: "";
955
+ width: 0;
956
+ height: 0;
957
+ position: absolute;
958
+ border-left: 10px solid transparent;
959
+ border-right: 10px solid transparent;
960
+ border-top: 10px solid #fff;
961
+ bottom: 5px;
962
+ left: -10px;
963
+ transform: rotate(90deg);
964
+ }
965
+ /* .mensagem__outros .check{
966
+ display: none
967
+ } */
968
+ .mensagem__outros > .autor-mensagem {
969
+ left: 5px;
970
+ color: #333;
971
+ }
972
+ /* Mapa */
973
+ .mensagem-div-mapa {
974
+ width: 100%;
975
+ display: flex;
976
+ justify-content: center;
977
+ align-items: center;
978
+ flex-direction: column;
979
+ margin-bottom: 5px;
980
+ }
981
+
982
+ .msg-mapa {
983
+ width: 100%;
984
+ min-height: 225px;
985
+ height: 100%;
986
+ box-sizing: initial;
987
+ }
988
+ .msg-mapa img {
989
+ max-width: none !important;
990
+ }
991
+
992
+ .info-mapa {
993
+ list-style-type: none;
994
+ }
995
+ .info-mapa li.title {
996
+ font-size: 0.85em;
997
+ }
998
+ .info-mapa li.address,
999
+ .info-mapa li.url {
1000
+ font-size: 0.85em;
1001
+ }
1002
+ .info-mapa li.url {
1003
+ font-size: 0.85em;
1004
+ }
1005
+
1006
+ .tooltip-list {
1007
+ margin: 0;
1008
+ padding: 0;
1009
+ display: flex;
1010
+ flex-direction: column;
1011
+ justify-content: center;
1012
+ align-items: flex-start;
1013
+ }
1014
+
1015
+ .emoji-message-container {
1016
+ position: absolute;
1017
+ top: 0;
1018
+ z-index: 1;
1019
+ width: 300px;
1020
+ height: 250px;
1021
+ }
1022
+ /* .emoji-message-container {
1023
+ z-index: 1;
1024
+ overflow: hidden;
1025
+ width: 300px;
1026
+ height: 250px;
1027
+
1028
+ >.sm-emoji-picker {
1029
+ position: relative;
1030
+ width: 300px;
1031
+ height: 250px;
1032
+ }
1033
+ }
1034
+
1035
+ .mensagem .reaction {
1036
+ $size: 1.8em;
1037
+ width: $size;
1038
+ height: $size;
1039
+ min-width: $size;
1040
+ min-height: $size;
1041
+ max-width: $size;
1042
+ max-height: $size;
1043
+ } */
1044
+
1045
+ .emoji-message-container .sm-emoji-picker {
1046
+ width: 300px;
1047
+ height: 250px;
1048
+ }
1049
+ .emoji-message-container .sm-emoji-picker .sm-emoji-header {
1050
+ overflow-x: auto;
1051
+ overflow-y: hidden;
1052
+ }
1053
+
1054
+ .reaction {
1055
+ position: absolute;
1056
+ bottom: 0;
1057
+ border-radius: 50%;
1058
+ display: flex;
1059
+ justify-content: center;
1060
+ align-items: center;
1061
+ background-color: rgba(100, 100, 100, 0.4);
1062
+ padding: 5px;
1063
+ font-size: 1.3em;
1064
+ min-width: 1.8em;
1065
+ min-height: 1.8em;
1066
+ max-width: 1.8em;
1067
+ max-height: 1.8em;
1068
+ }
1069
+
1070
+ .reaction > span {
1071
+ display: block;
1072
+ transform: translateY(-1px);
1073
+ }
1074
+
1075
+ .mensagem__outros .reaction {
1076
+ right: -30px;
1077
+ }
1078
+
1079
+ .mensagem__principal .reaction {
1080
+ left: -30px;
1081
+ }
1082
+ </style>