vue-intergrall-plugins 0.0.300 → 0.0.501

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,411 +1,411 @@
1
- <template>
2
- <div class="expand-textarea" @drop.stop="dropFile" @dragenter.prevent @dragover.prevent v-on-clickaway="away">
3
- <fa-icon :icon="['fas', 'times-circle']" class="sc-icone-fechar sc-icone-fechar--externo" @click="$emit('fechar-expand')" />
4
- <div class="expand-textarea-content">
5
- <h1 class="expand-textarea-title" v-text="textareaSettings.title"></h1>
6
- <textarea
7
- :ref="identifier"
8
- :placeholder="textareaSettings.placeholderMessage"
9
- v-model="message"
10
- @input="sendFinalMessage"
11
- @paste="pasteImage"
12
- >
13
- </textarea>
14
- <div class="expand-textarea-footer">
15
- <BtnEmojis
16
- v-show="buttons.hasEmojis"
17
- :ref="`${identifier}-emojis`"
18
- :emojiId="`${identifier}-em`"
19
- :left="false"
20
- @insert-emoji="insertEmoji"
21
- />
22
- <BtnFiles
23
- v-if="buttons.hasFiles"
24
- :textId="identifier"
25
- :dictionary="dictionary"
26
- :fileSettings="fileSettings"
27
- :ref="`${identifier}-file`"
28
- @set-file-vars="setFileVars"
29
- @open-image="openImage"
30
- />
31
- <slot name="btn-1"></slot>
32
- <slot name="btn-2"></slot>
33
- <!-- "expand-textarea-button" -->
34
- </div>
35
- </div>
36
- </div>
37
- </template>
38
-
39
- <script>
40
- import { mixin as clickaway } from "vue-clickaway"
41
- import BtnEmojis from "./BtnEmojis"
42
- import BtnFiles from "./BtnFiles"
43
- import { returnMessageWithHexa } from "../../services/textFormatting"
44
-
45
- export default {
46
- components: { BtnEmojis, BtnFiles },
47
- mixins: [ clickaway ],
48
- props: {
49
- identifier: {
50
- type: String,
51
- required: true
52
- },
53
- dictionary: {
54
- type: Object,
55
- required: true
56
- },
57
- envioEmAndamento: {
58
- type: Boolean,
59
- required: false
60
- },
61
- buttons: {
62
- type: Object,
63
- default: () => { return { hasEmojis: false, hasSendButton: true, hasFiles: true } },
64
- required: false
65
- },
66
- fileSettings: {
67
- type: Object,
68
- default: () => { return { docsExtensions: "", imagesExtensions: "", multiple: false } },
69
- required: false
70
- },
71
- textareaSettings: {
72
- type: Object,
73
- default: () => { return { placeholderMessage: "", title: "Nova mensagem" } },
74
- required: false
75
- }
76
- },
77
- data() {
78
- return {
79
- message: "",
80
- file: [],
81
- hasAnyFile: false,
82
- imagePreview: "",
83
- isDoc: false,
84
- fileFormatError: false
85
- }
86
- },
87
- methods: {
88
- away() {
89
- if(this.$refs[`${this.identifier}-file`]) this.$refs[`${this.identifier}-file`].openFiles = false
90
- },
91
- removeHTMLElementsFromMessage(message) {
92
- const regexTags = /<\/?[\d\w\s=\-:./'";]+>/gi
93
- if(message.match(regexTags)) message = message.replace(regexTags, ' ')
94
- return message
95
- },
96
- formatMessage(message) {
97
- if(!message) return ""
98
- message = message.trim()
99
- message = message.replace(/\n$/, "", message)
100
- message = returnMessageWithHexa(message)
101
- message = this.removeHTMLElementsFromMessage(message)
102
- return message
103
- },
104
- sendFinalMessage() {
105
- const messageAux = this.formatMessage(this.message)
106
- this.$emit("final-message", messageAux)
107
- },
108
- emitirEnvio() {
109
- if(this.envioEmAndamento) return
110
- if(!this.buttons.hasSendButton) return
111
- try {
112
- if(this.verifyMessage()) {
113
- const messageAux = this.formatMessage(this.message)
114
- if(messageAux || this.hasAnyFile) {
115
- const objMessage = this.returnObjectMessage(messageAux)
116
- this.$emit("send-message", messageAux)
117
- this.$emit("obj-message", objMessage)
118
-
119
- // this.reset() // Deve ser chamada de fora do plugin
120
- }
121
- }
122
- }catch(e) {
123
- console.error("Erro ao emitir envio da mensagem")
124
- console.error(e)
125
- }
126
- },
127
- verifyMessage() {
128
- if((!this.message || !this.message.trim()) && !this.hasAnyFile) return false
129
-
130
- if(this.fileFormatError) {
131
- if (!document.querySelector(".toasted.toasted-primary.error")) this.$toasted.global.defaultError({ msg: this.dictionary.msg_formato_invalido })
132
- const str = {
133
- img: this.fileSettings.imagesExtensions.split("|").join(", "),
134
- doc: this.fileSettings.docsExtensions.split("|").join(", ")
135
- }
136
- if (!document.querySelector(".toasted.toasted-primary.info")) this.$toasted.global.showValidFormats({ msg: `Imagens: ${str.img} - Documentos: ${str.doc} ${this.dictionary.msg_extensoes_aceitas}` })
137
- return false
138
- }
139
-
140
- return true
141
- },
142
- returnObjectMessage(message) {
143
- return {
144
- message,
145
- attachment: this.hasAnyFile ? this.file : false,
146
- isDoc: this.isDoc,
147
- imagePreview: this.imagePreview
148
- }
149
- },
150
- reset() {
151
- if(this.buttons.hasEmojis && this.$refs[`emoji-text-${this.identifier}-emoji`].showEmojis) this.$refs[`emoji-text-${this.identifier}-emoji`].toggleEmojiSelection()
152
- if(this.hasAnyFile) this.$refs[`${this.identifier}-file`].deleteFile()
153
- this.message = ""
154
- this.sendFinalMessage()
155
- this.focusTextarea()
156
- },
157
- dropFile(e) {
158
- try {
159
- e.stopPropagation()
160
- e.preventDefault()
161
- const files = e.dataTransfer.files.length ? e.dataTransfer.files : ""
162
- this.filesHandler(files)
163
- }catch(e) {
164
- console.error("Erro drop file")
165
- console.error(e)
166
- }
167
- },
168
- returnFileType(file, stopAlert) {
169
- const imgRegex = new RegExp("\.("+this.fileSettings.imagesExtensions+")", "i")
170
- if(imgRegex.test(file.name)) return "img"
171
-
172
- const docRegex = new RegExp("\.("+this.fileSettings.docsExtensions+")", "i")
173
- if(docRegex.test(file.name)) return "doc"
174
-
175
- if(!stopAlert) return
176
- if (!document.querySelector(".toasted.toasted-primary.error")) this.$toasted.global.defaultError({ msg: this.dictionary.msg_formato_invalido })
177
- const str = {
178
- img: this.fileSettings.imagesExtensions.split("|").join(", "),
179
- doc: this.fileSettings.docsExtensions.split("|").join(", ")
180
- }
181
- if (!document.querySelector(".toasted.toasted-primary.info")) this.$toasted.global.showValidFormats({ msg: `Imagens: ${str.img} - Documentos: ${str.doc} ${this.dictionary.msg_extensoes_aceitas}` })
182
- return false
183
- },
184
- filesHandler(files) {
185
- if(!Array.isArray(files)) files = Array.from(files)
186
- const fileType = this.returnFileType(files[0], true)
187
- let invalidFile = false
188
- try {
189
- files.forEach(file => {
190
- const singleFileType = this.returnFileType(file, true)
191
- if(!singleFileType) {
192
- invalidFile = true
193
- file.invalid = true
194
- }
195
- file.imgOrDoc = singleFileType ? singleFileType : ""
196
- })
197
- }catch(e) {
198
- console.error("Erro ao tentar percorrer os arquivos")
199
- console.error(e)
200
- invalidFile = true
201
- }
202
-
203
- if(!invalidFile) {
204
- this.$refs[`${this.identifier}-file`].fileUpload(files, fileType, true)
205
- }else {
206
- if (!document.querySelector(".toasted.toasted-primary.error")) this.$toasted.global.defaultError({ msg: this.dictionary.msg_formato_invalido })
207
- const str = {
208
- img: this.fileSettings.imagesExtensions.split("|").join(", "),
209
- doc: this.fileSettings.docsExtensions.split("|").join(", ")
210
- }
211
- if (!document.querySelector(".toasted.toasted-primary.info")) this.$toasted.global.showValidFormats({ msg: `Imagens: ${str.img} - Documentos: ${str.doc} ${this.dictionary.msg_extensoes_aceitas}` })
212
- }
213
- },
214
- focusTextarea() {
215
- this.$refs[`${this.identifier}`].focus()
216
- },
217
- setFileVars(fileObj) {
218
- const { file, imagePreview, isDoc, fileFormatError, hasAnyFile } = fileObj;
219
-
220
- this.file = file
221
- this.imagePreview = imagePreview ? imagePreview : ""
222
- this.isDoc = isDoc
223
- this.fileFormatError = fileFormatError
224
- this.hasAnyFile = hasAnyFile
225
-
226
- this.$emit("set-file-vars", fileObj)
227
- },
228
- openImage(imagePreview) {
229
- this.$emit("open-image", imagePreview)
230
- },
231
- pasteImage(e) {
232
- try {
233
- if(e.clipboardData.files.length && !this.buttons.hasFiles) {
234
- e.preventDefault()
235
- return
236
- }else if(e.clipboardData.files.length && this.buttons.hasFiles) {
237
- const files = e.clipboardData.files
238
- this.filesHandler(files)
239
- }
240
- }catch(e) {
241
- console.error("Nao foi possivel colar a/o imagem/documento")
242
- console.error(e)
243
- }
244
- },
245
- insertEmoji(emoji) {
246
- try {
247
- if(!emoji) return
248
- const textarea = this.$refs[`${this.identifier}`]
249
- if (document.activeElement === textarea) {
250
- const cursorStart = textarea.selectionStart
251
- const cursorEnd = textarea.selectionEnd
252
- if (cursorEnd == textarea.value.length) {
253
- this.message += emoji.finalEmoji
254
- textarea.setSelectionRange(textarea.value.length, textarea.value.length);
255
- } else {
256
- const initValue = textarea.value.slice(0, cursorStart) + emoji.finalEmoji;
257
- const endValue = textarea.value.slice(cursorEnd)
258
- this.message = initValue + endValue
259
- textarea.setSelectionRange(initValue.length, initValue.length);
260
- }
261
- } else {
262
- this.message += emoji.finalEmoji
263
- }
264
- this.sendFinalMessage()
265
- }catch(e) {
266
- console.error("Erro ao inserir emoji")
267
- console.error(e)
268
- }
269
- }
270
- }
271
- }
272
- </script>
273
-
274
- <style>
275
- .sc-icone-fechar {
276
- cursor: pointer;
277
- position: absolute;
278
- top: 0;
279
- right: 0;
280
- background-color: #FFF;
281
- border-radius: 50%;
282
- z-index: 1;
283
- color: #E74C3C;
284
- font-size: 1.3rem;
285
- }
286
- .sc-icone-fechar.sc-icone-fechar--externo {
287
- top: -10px;
288
- right: -10px;
289
- }
290
- .sc-icone-fechar.sc-icone-fechar--interno {
291
- top: 10px;
292
- right: 10px;
293
- }
294
-
295
- .expand-textarea {
296
- position: relative;
297
- width: 90%;
298
- height: 90%;
299
- z-index: 1;
300
- }
301
-
302
- .expand-textarea-content {
303
- overflow-x: hidden;
304
- overflow-y: auto;
305
- background-color: #FFF;
306
- width: 100%;
307
- height: 100%;
308
- display: flex;
309
- flex-direction: column;
310
- }
311
- .expand-textarea-title {
312
- padding: 2.5px 8px;
313
- min-height: 38px;
314
- display: flex;
315
- align-items: center;
316
- width: 100%;
317
- font-size: 1.3rem;
318
- background-color: #222;
319
- color: #FFF;
320
- }
321
- .expand-textarea-content textarea{
322
- padding: 10px;
323
- flex: 1;
324
- width: 100%;
325
- border: unset;
326
- resize: none;
327
- outline: none;
328
- overflow-x: hidden;
329
- }
330
- .expand-textarea-content textarea:hover, .expand-textarea-content textarea:active {
331
- outline: none;
332
- }
333
- .expand-textarea-footer {
334
- display: flex;
335
- justify-content: flex-end;
336
- align-items: center;
337
- padding: 10px;
338
- background-color: #F7F7F7;
339
- position: relative;
340
- }
341
- .expand-textarea-footer .text-footer-preview-container {
342
- position: absolute;
343
- top: -200px;
344
- right: 145px;
345
- height: 200px;
346
- background: #F7F7F7;
347
- }
348
- .expand-textarea-footer .text-footer-actions--btn {
349
- width: 36px;
350
- height: 36px;
351
- border-radius: 50%;
352
- background-color: rgba(255, 255, 255, 0);
353
- color: #333;
354
- padding: 2.5px;
355
- margin: 0 15px 0 10px;
356
- display: flex;
357
- justify-content: center;
358
- align-items: center;
359
- font-size: 1.3rem;
360
- cursor: pointer;
361
- opacity: .9;
362
- transition: all 300ms;
363
- }
364
- .expand-textarea-footer .text-footer-actions--btn:hover {
365
- opacity: 1;
366
- background-color: rgba(30, 30, 30, .1);
367
- }
368
-
369
- .expand-textarea-button {
370
- width: 125px;
371
- height: 30px;
372
- display: flex;
373
- justify-content: center;
374
- align-items: center;
375
-
376
- transition-duration: 300ms;
377
- user-select: none;
378
- cursor: pointer;
379
- box-shadow: inset 0 -2px rgba(0, 0, 0, 0.2);
380
- opacity: .9;
381
- border-radius: 5px;
382
-
383
- padding: 5px 10px;
384
- border-radius: 2.5px;
385
- position: relative;
386
- }
387
- .expand-textarea-button.green {
388
- background-color: #2A963A;
389
- color: #FFF;
390
- margin-right: 10px;
391
- }
392
- .expand-textarea-button.red {
393
- background-color: #E74C3C;
394
- color: #FFF;
395
- }
396
- .expand-textarea-button:hover{
397
- opacity: 1;
398
- }
399
- .expand-textarea-button:active{
400
- opacity: 1;
401
- box-shadow: inset 0 -1px rgba(0, 0, 0, 0.2);
402
- -webkit-transform: translateY(1px);
403
- -moz-transform: translateY(1px);
404
- -o-transform: translateY(1px);
405
- -ms-transform: translateY(1px);
406
- transform: translateY(1px);
407
- }
408
- .expand-textarea-button.carregando {
409
- background-color: #777;
410
- }
1
+ <template>
2
+ <div class="expand-textarea" @drop.stop="dropFile" @dragenter.prevent @dragover.prevent v-on-clickaway="away">
3
+ <fa-icon :icon="['fas', 'times-circle']" class="sc-icone-fechar sc-icone-fechar--externo" @click="$emit('fechar-expand')" />
4
+ <div class="expand-textarea-content">
5
+ <h1 class="expand-textarea-title" v-text="textareaSettings.title"></h1>
6
+ <textarea
7
+ :ref="identifier"
8
+ :placeholder="textareaSettings.placeholderMessage"
9
+ v-model="message"
10
+ @input="sendFinalMessage"
11
+ @paste="pasteImage"
12
+ >
13
+ </textarea>
14
+ <div class="expand-textarea-footer">
15
+ <BtnEmojis
16
+ v-show="buttons.hasEmojis"
17
+ :ref="`${identifier}-emojis`"
18
+ :emojiId="`${identifier}-em`"
19
+ :left="false"
20
+ @insert-emoji="insertEmoji"
21
+ />
22
+ <BtnFiles
23
+ v-if="buttons.hasFiles"
24
+ :textId="identifier"
25
+ :dictionary="dictionary"
26
+ :fileSettings="fileSettings"
27
+ :ref="`${identifier}-file`"
28
+ @set-file-vars="setFileVars"
29
+ @open-image="openImage"
30
+ />
31
+ <slot name="btn-1"></slot>
32
+ <slot name="btn-2"></slot>
33
+ <!-- "expand-textarea-button" -->
34
+ </div>
35
+ </div>
36
+ </div>
37
+ </template>
38
+
39
+ <script>
40
+ import { mixin as clickaway } from "vue-clickaway"
41
+ import BtnEmojis from "./BtnEmojis"
42
+ import BtnFiles from "./BtnFiles"
43
+ import { returnMessageWithHexa } from "../../services/textFormatting"
44
+
45
+ export default {
46
+ components: { BtnEmojis, BtnFiles },
47
+ mixins: [ clickaway ],
48
+ props: {
49
+ identifier: {
50
+ type: String,
51
+ required: true
52
+ },
53
+ dictionary: {
54
+ type: Object,
55
+ required: true
56
+ },
57
+ envioEmAndamento: {
58
+ type: Boolean,
59
+ required: false
60
+ },
61
+ buttons: {
62
+ type: Object,
63
+ default: () => { return { hasEmojis: false, hasSendButton: true, hasFiles: true } },
64
+ required: false
65
+ },
66
+ fileSettings: {
67
+ type: Object,
68
+ default: () => { return { docsExtensions: "", imagesExtensions: "", multiple: false } },
69
+ required: false
70
+ },
71
+ textareaSettings: {
72
+ type: Object,
73
+ default: () => { return { placeholderMessage: "", title: "Nova mensagem" } },
74
+ required: false
75
+ }
76
+ },
77
+ data() {
78
+ return {
79
+ message: "",
80
+ file: [],
81
+ hasAnyFile: false,
82
+ imagePreview: "",
83
+ isDoc: false,
84
+ fileFormatError: false
85
+ }
86
+ },
87
+ methods: {
88
+ away() {
89
+ if(this.$refs[`${this.identifier}-file`]) this.$refs[`${this.identifier}-file`].openFiles = false
90
+ },
91
+ removeHTMLElementsFromMessage(message) {
92
+ const regexTags = /<\/?[\d\w\s=\-:./'";]+>/gi
93
+ if(message.match(regexTags)) message = message.replace(regexTags, ' ')
94
+ return message
95
+ },
96
+ formatMessage(message) {
97
+ if(!message) return ""
98
+ message = message.trim()
99
+ message = message.replace(/\n$/, "", message)
100
+ message = returnMessageWithHexa(message)
101
+ message = this.removeHTMLElementsFromMessage(message)
102
+ return message
103
+ },
104
+ sendFinalMessage() {
105
+ const messageAux = this.formatMessage(this.message)
106
+ this.$emit("final-message", messageAux)
107
+ },
108
+ emitirEnvio() {
109
+ if(this.envioEmAndamento) return
110
+ if(!this.buttons.hasSendButton) return
111
+ try {
112
+ if(this.verifyMessage()) {
113
+ const messageAux = this.formatMessage(this.message)
114
+ if(messageAux || this.hasAnyFile) {
115
+ const objMessage = this.returnObjectMessage(messageAux)
116
+ this.$emit("send-message", messageAux)
117
+ this.$emit("obj-message", objMessage)
118
+
119
+ // this.reset() // Deve ser chamada de fora do plugin
120
+ }
121
+ }
122
+ }catch(e) {
123
+ console.error("Erro ao emitir envio da mensagem")
124
+ console.error(e)
125
+ }
126
+ },
127
+ verifyMessage() {
128
+ if((!this.message || !this.message.trim()) && !this.hasAnyFile) return false
129
+
130
+ if(this.fileFormatError) {
131
+ if (!document.querySelector(".toasted.toasted-primary.error")) this.$toasted.global.defaultError({ msg: this.dictionary.msg_formato_invalido })
132
+ const str = {
133
+ img: this.fileSettings.imagesExtensions.split("|").join(", "),
134
+ doc: this.fileSettings.docsExtensions.split("|").join(", ")
135
+ }
136
+ if (!document.querySelector(".toasted.toasted-primary.info")) this.$toasted.global.showValidFormats({ msg: `Imagens: ${str.img} - Documentos: ${str.doc} ${this.dictionary.msg_extensoes_aceitas}` })
137
+ return false
138
+ }
139
+
140
+ return true
141
+ },
142
+ returnObjectMessage(message) {
143
+ return {
144
+ message,
145
+ attachment: this.hasAnyFile ? this.file : false,
146
+ isDoc: this.isDoc,
147
+ imagePreview: this.imagePreview
148
+ }
149
+ },
150
+ reset() {
151
+ if(this.buttons.hasEmojis && this.$refs[`emoji-text-${this.identifier}-emoji`].showEmojis) this.$refs[`emoji-text-${this.identifier}-emoji`].toggleEmojiSelection()
152
+ if(this.hasAnyFile) this.$refs[`${this.identifier}-file`].deleteFile()
153
+ this.message = ""
154
+ this.sendFinalMessage()
155
+ this.focusTextarea()
156
+ },
157
+ dropFile(e) {
158
+ try {
159
+ e.stopPropagation()
160
+ e.preventDefault()
161
+ const files = e.dataTransfer.files.length ? e.dataTransfer.files : ""
162
+ this.filesHandler(files)
163
+ }catch(e) {
164
+ console.error("Erro drop file")
165
+ console.error(e)
166
+ }
167
+ },
168
+ returnFileType(file, stopAlert) {
169
+ const imgRegex = new RegExp("\.("+this.fileSettings.imagesExtensions+")", "i")
170
+ if(imgRegex.test(file.name)) return "img"
171
+
172
+ const docRegex = new RegExp("\.("+this.fileSettings.docsExtensions+")", "i")
173
+ if(docRegex.test(file.name)) return "doc"
174
+
175
+ if(!stopAlert) return
176
+ if (!document.querySelector(".toasted.toasted-primary.error")) this.$toasted.global.defaultError({ msg: this.dictionary.msg_formato_invalido })
177
+ const str = {
178
+ img: this.fileSettings.imagesExtensions.split("|").join(", "),
179
+ doc: this.fileSettings.docsExtensions.split("|").join(", ")
180
+ }
181
+ if (!document.querySelector(".toasted.toasted-primary.info")) this.$toasted.global.showValidFormats({ msg: `Imagens: ${str.img} - Documentos: ${str.doc} ${this.dictionary.msg_extensoes_aceitas}` })
182
+ return false
183
+ },
184
+ filesHandler(files) {
185
+ if(!Array.isArray(files)) files = Array.from(files)
186
+ const fileType = this.returnFileType(files[0], true)
187
+ let invalidFile = false
188
+ try {
189
+ files.forEach(file => {
190
+ const singleFileType = this.returnFileType(file, true)
191
+ if(!singleFileType) {
192
+ invalidFile = true
193
+ file.invalid = true
194
+ }
195
+ file.imgOrDoc = singleFileType ? singleFileType : ""
196
+ })
197
+ }catch(e) {
198
+ console.error("Erro ao tentar percorrer os arquivos")
199
+ console.error(e)
200
+ invalidFile = true
201
+ }
202
+
203
+ if(!invalidFile) {
204
+ this.$refs[`${this.identifier}-file`].fileUpload(files, fileType, true)
205
+ }else {
206
+ if (!document.querySelector(".toasted.toasted-primary.error")) this.$toasted.global.defaultError({ msg: this.dictionary.msg_formato_invalido })
207
+ const str = {
208
+ img: this.fileSettings.imagesExtensions.split("|").join(", "),
209
+ doc: this.fileSettings.docsExtensions.split("|").join(", ")
210
+ }
211
+ if (!document.querySelector(".toasted.toasted-primary.info")) this.$toasted.global.showValidFormats({ msg: `Imagens: ${str.img} - Documentos: ${str.doc} ${this.dictionary.msg_extensoes_aceitas}` })
212
+ }
213
+ },
214
+ focusTextarea() {
215
+ this.$refs[`${this.identifier}`].focus()
216
+ },
217
+ setFileVars(fileObj) {
218
+ const { file, imagePreview, isDoc, fileFormatError, hasAnyFile } = fileObj;
219
+
220
+ this.file = file
221
+ this.imagePreview = imagePreview ? imagePreview : ""
222
+ this.isDoc = isDoc
223
+ this.fileFormatError = fileFormatError
224
+ this.hasAnyFile = hasAnyFile
225
+
226
+ this.$emit("set-file-vars", fileObj)
227
+ },
228
+ openImage(imagePreview) {
229
+ this.$emit("open-image", imagePreview)
230
+ },
231
+ pasteImage(e) {
232
+ try {
233
+ if(e.clipboardData.files.length && !this.buttons.hasFiles) {
234
+ e.preventDefault()
235
+ return
236
+ }else if(e.clipboardData.files.length && this.buttons.hasFiles) {
237
+ const files = e.clipboardData.files
238
+ this.filesHandler(files)
239
+ }
240
+ }catch(e) {
241
+ console.error("Nao foi possivel colar a/o imagem/documento")
242
+ console.error(e)
243
+ }
244
+ },
245
+ insertEmoji(emoji) {
246
+ try {
247
+ if(!emoji) return
248
+ const textarea = this.$refs[`${this.identifier}`]
249
+ if (document.activeElement === textarea) {
250
+ const cursorStart = textarea.selectionStart
251
+ const cursorEnd = textarea.selectionEnd
252
+ if (cursorEnd == textarea.value.length) {
253
+ this.message += emoji.finalEmoji
254
+ textarea.setSelectionRange(textarea.value.length, textarea.value.length);
255
+ } else {
256
+ const initValue = textarea.value.slice(0, cursorStart) + emoji.finalEmoji;
257
+ const endValue = textarea.value.slice(cursorEnd)
258
+ this.message = initValue + endValue
259
+ textarea.setSelectionRange(initValue.length, initValue.length);
260
+ }
261
+ } else {
262
+ this.message += emoji.finalEmoji
263
+ }
264
+ this.sendFinalMessage()
265
+ }catch(e) {
266
+ console.error("Erro ao inserir emoji")
267
+ console.error(e)
268
+ }
269
+ }
270
+ }
271
+ }
272
+ </script>
273
+
274
+ <style>
275
+ .sc-icone-fechar {
276
+ cursor: pointer;
277
+ position: absolute;
278
+ top: 0;
279
+ right: 0;
280
+ background-color: #FFF;
281
+ border-radius: 50%;
282
+ z-index: 1;
283
+ color: #E74C3C;
284
+ font-size: 1.3rem;
285
+ }
286
+ .sc-icone-fechar.sc-icone-fechar--externo {
287
+ top: -10px;
288
+ right: -10px;
289
+ }
290
+ .sc-icone-fechar.sc-icone-fechar--interno {
291
+ top: 10px;
292
+ right: 10px;
293
+ }
294
+
295
+ .expand-textarea {
296
+ position: relative;
297
+ width: 90%;
298
+ height: 90%;
299
+ z-index: 1;
300
+ }
301
+
302
+ .expand-textarea-content {
303
+ overflow-x: hidden;
304
+ overflow-y: auto;
305
+ background-color: #FFF;
306
+ width: 100%;
307
+ height: 100%;
308
+ display: flex;
309
+ flex-direction: column;
310
+ }
311
+ .expand-textarea-title {
312
+ padding: 2.5px 8px;
313
+ min-height: 38px;
314
+ display: flex;
315
+ align-items: center;
316
+ width: 100%;
317
+ font-size: 1.3rem;
318
+ background-color: #222;
319
+ color: #FFF;
320
+ }
321
+ .expand-textarea-content textarea{
322
+ padding: 10px;
323
+ flex: 1;
324
+ width: 100%;
325
+ border: unset;
326
+ resize: none;
327
+ outline: none;
328
+ overflow-x: hidden;
329
+ }
330
+ .expand-textarea-content textarea:hover, .expand-textarea-content textarea:active {
331
+ outline: none;
332
+ }
333
+ .expand-textarea-footer {
334
+ display: flex;
335
+ justify-content: flex-end;
336
+ align-items: center;
337
+ padding: 10px;
338
+ background-color: #F7F7F7;
339
+ position: relative;
340
+ }
341
+ .expand-textarea-footer .text-footer-preview-container {
342
+ position: absolute;
343
+ top: -200px;
344
+ right: 145px;
345
+ height: 200px;
346
+ background: #F7F7F7;
347
+ }
348
+ .expand-textarea-footer .text-footer-actions--btn {
349
+ width: 36px;
350
+ height: 36px;
351
+ border-radius: 50%;
352
+ background-color: rgba(255, 255, 255, 0);
353
+ color: #333;
354
+ padding: 2.5px;
355
+ margin: 0 15px 0 10px;
356
+ display: flex;
357
+ justify-content: center;
358
+ align-items: center;
359
+ font-size: 1.3rem;
360
+ cursor: pointer;
361
+ opacity: .9;
362
+ transition: all 300ms;
363
+ }
364
+ .expand-textarea-footer .text-footer-actions--btn:hover {
365
+ opacity: 1;
366
+ background-color: rgba(30, 30, 30, .1);
367
+ }
368
+
369
+ .expand-textarea-button {
370
+ width: 125px;
371
+ height: 30px;
372
+ display: flex;
373
+ justify-content: center;
374
+ align-items: center;
375
+
376
+ transition-duration: 300ms;
377
+ user-select: none;
378
+ cursor: pointer;
379
+ box-shadow: inset 0 -2px rgba(0, 0, 0, 0.2);
380
+ opacity: .9;
381
+ border-radius: 5px;
382
+
383
+ padding: 5px 10px;
384
+ border-radius: 2.5px;
385
+ position: relative;
386
+ }
387
+ .expand-textarea-button.green {
388
+ background-color: #2A963A;
389
+ color: #FFF;
390
+ margin-right: 10px;
391
+ }
392
+ .expand-textarea-button.red {
393
+ background-color: #E74C3C;
394
+ color: #FFF;
395
+ }
396
+ .expand-textarea-button:hover{
397
+ opacity: 1;
398
+ }
399
+ .expand-textarea-button:active{
400
+ opacity: 1;
401
+ box-shadow: inset 0 -1px rgba(0, 0, 0, 0.2);
402
+ -webkit-transform: translateY(1px);
403
+ -moz-transform: translateY(1px);
404
+ -o-transform: translateY(1px);
405
+ -ms-transform: translateY(1px);
406
+ transform: translateY(1px);
407
+ }
408
+ .expand-textarea-button.carregando {
409
+ background-color: #777;
410
+ }
411
411
  </style>