vue-intergrall-plugins 0.0.236 → 0.0.239

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-intergrall-plugins",
3
- "version": "0.0.236",
3
+ "version": "0.0.239",
4
4
  "description": "",
5
5
  "main": "dist/vue-intergrall-plugins.ssr.js",
6
6
  "browser": "dist/vue-intergrall-plugins.esm.js",
@@ -7,7 +7,7 @@
7
7
  </transition> -->
8
8
  <fa-icon :icon="['fas', 'paperclip']" :title="dictionary.title_selecionar_anexo" />
9
9
  <transition name="fade">
10
- <span v-if="fileSize > 0" @click.stop="toggleFilePreview" v-tippy :content="dictionary.msg_abrir_anexos" :class="`${fileSettings.filePreviewStyle == 2 ? 'files-counter-2' : 'files-counter'}`">
10
+ <span v-if="fileSize > 0" @click.stop="toggleFilePreview" v-tippy :content="!fileSettings.handleFilePreview ? dictionary.msg_abrir_anexos : `${file.length} anexo(s) selecionado(s)`" :class="`${fileSettings.filePreviewStyle == 2 ? 'files-counter-2' : 'files-counter'}`">
11
11
  <template v-if="fileSettings.filePreviewStyle == 1">
12
12
  {{ fileSize }}
13
13
  </template>
@@ -236,7 +236,7 @@ export default {
236
236
  if(fileInput) fileInput.click()
237
237
  if(!fileInput) if (!document.querySelector(".toasted.toasted-primary.error")) this.$toasted.global.defaultError()
238
238
  },
239
- isFileValid(type, fileName) {
239
+ isFileValid(type, fileName, fileType) {
240
240
  if((type == "img" && !this.fileSettings.imagesExtensions) || (type == "doc" && !this.fileSettings.docsExtensions)) {
241
241
  this.$toasted.global.defaultInfo({ msg: this.dictionary.sem_extensoes_parametrizadas })
242
242
  this.hasAnyFile = false
@@ -244,7 +244,7 @@ export default {
244
244
  }
245
245
  const extensions = type === "img" ? this.fileSettings.imagesExtensions : this.fileSettings.docsExtensions
246
246
  const regex = new RegExp("("+extensions+")", "i")
247
- if(regex.test(fileName)) return true
247
+ if(regex.test(fileName) || regex.test(fileType)) return true
248
248
  this.hasAnyFile = false
249
249
  this.showToastedValidFormats()
250
250
  return false
@@ -266,6 +266,19 @@ export default {
266
266
  const isStackable = this.fileSettings.stackFiles && this.fileSettings.multiple
267
267
  this.file = filesAux.length ? isStackable ? this.file.concat(...filesAux) : filesAux : this.file
268
268
  if(!this.file.length) return
269
+
270
+ let sizeInBytes = 0
271
+ Array.from(this.file).forEach(file => sizeInBytes += file.size)
272
+ const sizeInMb = parseFloat((sizeInBytes / (1024*1024)).toFixed(2))
273
+ if(sizeInMb == 0) {
274
+ this.file = []
275
+ return this.$toasted.global.defaultInfo({ msg: this.dictionary.msg_arquivo_invalido })
276
+ }
277
+ if(sizeInMb >= 9.5) {
278
+ this.file = []
279
+ return this.$toasted.global.defaultInfo({ msg: `Limite de 9.5 MB por arquivo` })
280
+ }
281
+
269
282
  if(this.file.length > this.fileSettings.max) {
270
283
  this.file = []
271
284
  return this.$toasted.global.defaultInfo({ msg: `Limite de ${this.fileSettings.max} arquivos` })
@@ -274,7 +287,7 @@ export default {
274
287
  this.fileSize = this.file.length
275
288
  if(!this.fileSettings.multiple) {
276
289
  this.file = this.file[0]
277
- this.singleFileUpload(type, this.file.name)
290
+ this.singleFileUpload(type, this.file.name, this.file.type)
278
291
  }else {
279
292
  this.multipleFileUpload()
280
293
  }
@@ -309,7 +322,7 @@ export default {
309
322
  const singleFileType = this.returnFileType(file)
310
323
  if(!singleFileType) file.invalid = true
311
324
  file.imgOrDoc = singleFileType ? singleFileType : ""
312
- if(this.isFileValid(file.imgOrDoc, file.name)) {
325
+ if(this.isFileValid(file.imgOrDoc, file.name, file.type)) {
313
326
  if(file.imgOrDoc == "img") {
314
327
  const fileReader = new FileReader();
315
328
  waitForImageLoad = true
@@ -337,8 +350,8 @@ export default {
337
350
 
338
351
  if(this.isDoc && !waitForImageLoad) this.emitFileVars()
339
352
  },
340
- singleFileUpload(type, fileName) {
341
- if(this.isFileValid(type, fileName)) {
353
+ singleFileUpload(type, fileName, fileType) {
354
+ if(this.isFileValid(type, fileName, fileType)) {
342
355
  const fileReader = new FileReader()
343
356
  if(type === "img") {
344
357
  fileReader.onload = () => this.imagePreview = fileReader.result
@@ -0,0 +1,32 @@
1
+ <template>
2
+ <div class="text-footer-actions--btn" @click="$emit('toggle-standard-messages')" :title="dictionary.title_screen_share">
3
+ <fa-icon :icon="['fas', 'desktop']" />
4
+ <fa-icon :icon="['fas', 'share']" />
5
+ </div>
6
+ </template>
7
+
8
+ <style scoped>
9
+ .text-footer-actions--btn {
10
+ position: relative;
11
+ }
12
+ .text-footer-actions--btn > svg:nth-child(1) {
13
+ font-size: 1.2rem;
14
+ }
15
+ .text-footer-actions--btn > svg:nth-child(2) {
16
+ font-size: .6rem;
17
+ position: absolute;
18
+ transform: translateY(-2px)
19
+ }
20
+ </style>
21
+
22
+ <script>
23
+ export default {
24
+ props: {
25
+ dictionary: {
26
+ type: Object,
27
+ default: {},
28
+ required: false
29
+ }
30
+ }
31
+ }
32
+ </script>
@@ -38,12 +38,13 @@
38
38
  :message="message"
39
39
  :maxCharacters="textareaSettings.maxCharacters"
40
40
  />
41
- <div class="text-footer-actions" v-if="buttons.hasSendButton">
42
- <span class="text-footer-actions--btn" :title="dictionary.title_enviar_msg" @click="sendMessageHandler">
43
- <fa-icon :icon="['fas', 'paper-plane']" />
44
- </span>
45
- </div>
46
- <div v-if="buttons.hasFiles || buttons.hasAudio || buttons.hasExpand || formattedMessageSettings.hasStandardMessages" class="text-footer-actions" :class="{'outside-buttons' : cssStyle.outsideButtons && !audioFile}">
41
+ <div v-if="buttons.hasFiles || buttons.hasAudio || buttons.hasExpand || formattedMessageSettings.hasStandardMessages || buttons.hasScreenShare" class="text-footer-actions" :class="{'outside-buttons' : cssStyle.outsideButtons && !audioFile}">
42
+ <BtnScreenShare
43
+ v-show="buttons.hasScreenShare && !audioFile"
44
+ @handle-screen-share="handleScreenShare"
45
+ :dictionary="dictionary"
46
+ :ref="`${textId}-screen-share`"
47
+ />
47
48
  <BtnMic
48
49
  v-show="buttons.hasAudio && !audioFile"
49
50
  :dictionary="dictionary"
@@ -79,6 +80,11 @@
79
80
  :dictionary="dictionary"
80
81
  />
81
82
  </div>
83
+ <div class="text-footer-actions" v-if="buttons.hasSendButton">
84
+ <span class="text-footer-actions--btn" :title="dictionary.title_enviar_msg" @click="sendMessageHandler">
85
+ <fa-icon :icon="['fas', 'paper-plane']" />
86
+ </span>
87
+ </div>
82
88
  </div>
83
89
  <transition name="fade">
84
90
  <StandardMessages
@@ -116,14 +122,15 @@ import BtnFiles from "./BtnFiles"
116
122
  import BtnExpand from "./BtnExpand"
117
123
  import BtnStandardMessages from "./BtnStandardMessages"
118
124
  import StandardMessages from "./StandardMessages"
125
+ import BtnScreenShare from "./BtnScreenShare"
119
126
 
120
127
  export default {
121
- components: { BtnEmojis, Loader, BtnMic, BtnFiles, BtnExpand, RemainingCharacters, BtnStandardMessages, StandardMessages },
128
+ components: { BtnEmojis, Loader, BtnMic, BtnFiles, BtnExpand, RemainingCharacters, BtnStandardMessages, StandardMessages, BtnScreenShare },
122
129
  mixins: [ clickaway ],
123
130
  props: {
124
131
  buttons: {
125
132
  type: Object,
126
- default: () => { return { hasEmojis: false, hasSendButton: false, hasFiles: false, hasAudio: false, hasExpand: false } },
133
+ default: () => { return { hasEmojis: false, hasSendButton: false, hasFiles: false, hasAudio: false, hasExpand: false, hasScreenShare: false } },
127
134
  required: false
128
135
  },
129
136
  cssStyle: {
@@ -463,6 +470,9 @@ export default {
463
470
  console.error(e)
464
471
  }
465
472
  },
473
+ handleScreenShare() {
474
+ this.$emit("handle-screen-share")
475
+ },
466
476
  toggleStandardMessages() {
467
477
  this.showStandardMessages = !this.showStandardMessages
468
478
  },