vue-intergrall-plugins 0.0.300 → 0.0.500

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