vue-intergrall-plugins 0.0.237 → 0.0.240

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.237",
3
+ "version": "0.0.240",
4
4
  "description": "",
5
5
  "main": "dist/vue-intergrall-plugins.ssr.js",
6
6
  "browser": "dist/vue-intergrall-plugins.esm.js",
@@ -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
@@ -287,7 +287,7 @@ export default {
287
287
  this.fileSize = this.file.length
288
288
  if(!this.fileSettings.multiple) {
289
289
  this.file = this.file[0]
290
- this.singleFileUpload(type, this.file.name)
290
+ this.singleFileUpload(type, this.file.name, this.file.type)
291
291
  }else {
292
292
  this.multipleFileUpload()
293
293
  }
@@ -322,7 +322,7 @@ export default {
322
322
  const singleFileType = this.returnFileType(file)
323
323
  if(!singleFileType) file.invalid = true
324
324
  file.imgOrDoc = singleFileType ? singleFileType : ""
325
- if(this.isFileValid(file.imgOrDoc, file.name)) {
325
+ if(this.isFileValid(file.imgOrDoc, file.name, file.type)) {
326
326
  if(file.imgOrDoc == "img") {
327
327
  const fileReader = new FileReader();
328
328
  waitForImageLoad = true
@@ -350,8 +350,8 @@ export default {
350
350
 
351
351
  if(this.isDoc && !waitForImageLoad) this.emitFileVars()
352
352
  },
353
- singleFileUpload(type, fileName) {
354
- if(this.isFileValid(type, fileName)) {
353
+ singleFileUpload(type, fileName, fileType) {
354
+ if(this.isFileValid(type, fileName, fileType)) {
355
355
  const fileReader = new FileReader()
356
356
  if(type === "img") {
357
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
  },
@@ -596,10 +606,10 @@ ul {
596
606
  align-items: center;
597
607
  justify-content: flex-end;
598
608
  position: absolute;
599
- top: -42px;
600
- right: 2px;
601
- background-color: #DDD;
602
- box-shadow: inset 0px -10px 5px -11px rgba(0, 0, 0, 0.5); }
609
+ top: -20px;
610
+ right: 35px;
611
+ background-color: #FAFAFA;
612
+ }
603
613
  .text-footer-container .text-footer-actions .text-footer-actions--btn {
604
614
  display: flex;
605
615
  justify-content: center;
@@ -197,6 +197,7 @@ export default {
197
197
  try {
198
198
  const root = document.documentElement
199
199
  root.style.setProperty('--message-color', this.corMsg)
200
+ this.adjustFontColor(this.corMsg)
200
201
  }catch(e) {
201
202
  console.error("Erro ao atribuir a cor as mensagens")
202
203
  console.error(e)
@@ -227,6 +228,34 @@ export default {
227
228
  abrirImagem(imagem) {
228
229
  this.$emit("abrir-imagem", imagem)
229
230
  },
231
+ adjustFontColor(cor) {
232
+ try {
233
+ let result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(cor)
234
+
235
+ result = result ? {
236
+ r: parseInt(result[1], 16),
237
+ g: parseInt(result[2], 16),
238
+ b: parseInt(result[3], 16)
239
+ } : null
240
+
241
+ if(!result) return
242
+
243
+ const { r, g, b }= result
244
+
245
+ const rgb = parseInt(`${r}${g}${b}`, 16)
246
+ const r1 = rgb >> 16 & 0xFF
247
+ const g1 = rgb >> 8 & 0xFF
248
+ const b1 = rgb & 0xFF
249
+
250
+ const luma = 0.2126 * r1 + 0.7152 * g1 + 0.0722 * b1
251
+ console.log({ luma })
252
+
253
+ const root = document.documentElement
254
+ root.style.setProperty('--text-color', luma < 50 ? "#111B21" : "#FFF")
255
+ }catch(e) {
256
+ console.error("Erro ao ajustar a cor da mensagem: ", e)
257
+ }
258
+ },
230
259
  formatMsg(msg) {
231
260
  const regex = /(\n|&nbsp;)/g
232
261
  if(regex.test(msg)) msg = msg.replace(regex, "<br>")
@@ -238,7 +267,8 @@ export default {
238
267
 
239
268
  <style>
240
269
  :root {
241
- --message-color: #373737
270
+ --message-color: #373737;
271
+ --text-color: #FFF;
242
272
  }
243
273
 
244
274
  .fade-enter-active, .fade-leave-active {
@@ -250,7 +280,7 @@ export default {
250
280
 
251
281
  .mensagem {
252
282
  padding: 14px 7px;
253
- border-radius: 2.5px;
283
+ border-radius: 5px;
254
284
  min-width: 150px;
255
285
  min-height: 60px;
256
286
  width: -webkit-fit-content;
@@ -259,8 +289,12 @@ export default {
259
289
  position: relative;
260
290
  max-width: 80%;
261
291
  margin-bottom: 10px;
262
- font-size: .85rem;
292
+ font-size: .75rem;
263
293
  word-break: break-word;
294
+
295
+ -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);
296
+ -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);
297
+ 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);
264
298
  }
265
299
  .mensagem.max-w-60 {
266
300
  max-width: 60%;
@@ -385,15 +419,15 @@ export default {
385
419
  }
386
420
  .mensagem__principal > .mensagem {
387
421
  background-color: var(--message-color);
388
- color: #FFF;
422
+ color: var(--text-color);
389
423
  }
390
424
 
391
425
  .mensagem__principal > .mensagem .horario-envio {
392
- color: #FFF;
426
+ color: var(--text-color);
393
427
  }
394
428
  .mensagem__principal > .mensagem .autor-mensagem {
395
429
  right: 5px;
396
- color: #FFF;
430
+ color: var(--text-color);
397
431
  }
398
432
  /* Outros */
399
433
  .mensagem__outros {
@@ -450,10 +484,10 @@ export default {
450
484
  font-size: .85em
451
485
  }
452
486
  .info-mapa li.address, .info-mapa li.url {
453
- font-size: .7em
487
+ font-size: .85em
454
488
  }
455
489
  .info-mapa li.url {
456
- font-size: .7em
490
+ font-size: .85em
457
491
  }
458
492
 
459
493
  .tooltip-list {
@@ -88,7 +88,7 @@ export default {
88
88
  justify-content: center;
89
89
  align-items: center;
90
90
  background-color: #FFF;
91
- color: var(--message-color);
91
+ color: var(--text-color);
92
92
  padding: 10px 12px;
93
93
  border-radius: 5px;
94
94
  margin-bottom: 10px;