vue-intergrall-plugins 0.0.244 → 0.0.247

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.244",
3
+ "version": "0.0.247",
4
4
  "description": "",
5
5
  "main": "dist/vue-intergrall-plugins.ssr.js",
6
6
  "browser": "dist/vue-intergrall-plugins.esm.js",
@@ -0,0 +1,32 @@
1
+ <template>
2
+ <div class="text-footer-actions--btn" @click="$emit('click-trigger')" :title="dictionary.msg_baixar_todos_anexos">
3
+ <span class="multiplos">
4
+ <fa-icon :icon="['fas', 'download']" />
5
+ <fa-icon :icon="['fas', 'paperclip']" class="small" />
6
+ </span>
7
+ </div>
8
+ </template>
9
+
10
+ <style scoped>
11
+ .multiplos {
12
+ display: flex;
13
+ }
14
+ .multiplos svg {
15
+ font-size: .95rem
16
+ }
17
+ .multiplos svg.small {
18
+ font-size: .7rem!important;
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,7 +38,13 @@
38
38
  :message="message"
39
39
  :maxCharacters="textareaSettings.maxCharacters"
40
40
  />
41
- <div v-if="buttons.hasFiles || buttons.hasAudio || buttons.hasExpand || formattedMessageSettings.hasStandardMessages || buttons.hasScreenShare" class="text-footer-actions" :class="{'outside-buttons' : cssStyle.outsideButtons && !audioFile}">
41
+ <div v-if="buttons.hasFiles || buttons.hasAudio || buttons.hasExpand || formattedMessageSettings.hasStandardMessages || buttons.hasScreenShare || buttons.hasDownloadAll" class="text-footer-actions" :class="{'outside-buttons' : cssStyle.outsideButtons && !audioFile}">
42
+ <BtnDownloadAllFiles
43
+ v-show="buttons.hasDownloadAll && !audioFile"
44
+ @click-trigger="$emit('handle-download-files')"
45
+ :dictionary="dictionary"
46
+ :ref="`${textId}-download-files`"
47
+ />
42
48
  <BtnScreenShare
43
49
  v-show="buttons.hasScreenShare && !audioFile"
44
50
  @handle-screen-share="handleScreenShare"
@@ -123,9 +129,10 @@ import BtnExpand from "./BtnExpand"
123
129
  import BtnStandardMessages from "./BtnStandardMessages"
124
130
  import StandardMessages from "./StandardMessages"
125
131
  import BtnScreenShare from "./BtnScreenShare"
132
+ import BtnDownloadAllFiles from './BtnDownloadAllFiles'
126
133
 
127
134
  export default {
128
- components: { BtnEmojis, Loader, BtnMic, BtnFiles, BtnExpand, RemainingCharacters, BtnStandardMessages, StandardMessages, BtnScreenShare },
135
+ components: { BtnEmojis, Loader, BtnMic, BtnFiles, BtnExpand, RemainingCharacters, BtnStandardMessages, StandardMessages, BtnScreenShare, BtnDownloadAllFiles },
129
136
  mixins: [ clickaway ],
130
137
  props: {
131
138
  buttons: {
@@ -31,6 +31,7 @@ export default {
31
31
  <style>
32
32
  .req-loader-container {
33
33
  position: absolute;
34
+ z-index: 1;
34
35
  top: 0;
35
36
  left: 0;
36
37
  width: 100%;
@@ -1,43 +1,41 @@
1
1
  <template>
2
2
  <div class="mensagem-div-anexo">
3
- <transition-group name="fade" mode="out-in" class="anexo-transition">
4
- <div v-if="imgErro" key="error-msg" v-tippy :content="imgMsgErro">
5
- <div class="alert alert-danger" role="alert">
6
- <fa-icon :icon="['fas', 'file-image']" />
7
- {{dictionary.img_com_erro}}
8
- </div>
3
+ <div class="anexo-mensagem">
4
+ <img v-if="imageURL" @click="showImage(imageURL)" :src="imageURL" :alt="dictionary.alt_msg_img">
5
+ <audio v-else-if="audio" controls>
6
+ <source :src="docURL" :type="fileType" />
7
+ Sem suporte para o elemento audio
8
+ </audio>
9
+ <video v-else-if="video" controls>
10
+ <source :src="docURL" :type="fileType" />
11
+ Sem suporte para o elemento video
12
+ </video>
13
+ <a v-else-if="docURL" :href="docURL" target="_blank" rel="noreferrer noopener" class="default-doc">
14
+ <fa-icon :class="[iconClass]" :icon="icon" />
15
+ <p v-text="filename" :title="filename"></p>
16
+ </a>
17
+ <span v-else class="default-doc">
18
+ <fa-icon :class="[iconClass ? iconClass : '']" :icon="['fas', 'file-alt']" />
19
+ <p v-text="filename" :title="filename"></p>
20
+ </span>
21
+ <!-- Acoes -->
22
+ <div class="file-actions">
23
+ <span v-if="imageURL" class="file-action-button" @click="showImage(imageURL)">
24
+ <fa-icon :icon="['fas', 'search-plus']" v-tippy :content="`${dictionary.titulo_visualizar_img}`" />
25
+ </span>
26
+ <a v-if="docURL" :href="docURL" target="_blank" rel="noreferrer noopener" v-tippy :content="`Visualizar anexo`" class="file-action-button">
27
+ <fa-icon :icon="['fas', 'search-plus']" />
28
+ </a>
29
+ <a v-if="imageURL || docURL" :href="imageURL ? imageURL : docURL" :download="`${filename}`" target="_blank" rel="noreferrer noopener" v-tippy :content="`Fazer o download do anexo`" class="file-action-button">
30
+ <fa-icon :icon="['fas', 'download']" />
31
+ </a>
32
+ <span class="file-action-button" v-tippy :content="`Fazer download de todos anexos da tela`" @click="downloadAllFilesHandler">
33
+ <fa-icon :icon="['fas', 'download']" />
34
+ <fa-icon :icon="['fas', 'download']" />
35
+ <fa-icon :icon="['fas', 'download']" />
36
+ </span>
9
37
  </div>
10
- <Loader v-if="isLoading" :small="true" key="anexo-loader" :slow="true" />
11
- <div v-else key="anexo-mensagem" class="anexo-mensagem">
12
- <img v-if="imageURL" @click="showImage(imageURL)" :src="imageURL" :alt="dictionary.alt_msg_img">
13
- <div class="anexos-links-container" v-if="imageURL">
14
- <a href="#" @click.prevent="showImage(imageURL)"> {{ dictionary.titulo_visualizar_img }} </a>
15
- <fa-icon :icon="['fas', 'search-plus']" @click="showImage(imageURL)" />
16
- </div>
17
- <div v-else-if="docURL" class="anexo-container">
18
- <template v-if="audio || video">
19
- <audio v-if="audio" :src="docURL" controls :title="`${fileType} - ${filename}`">
20
- <p> {{ dictionary.msg_erro_audio }} <a :href="docURL" target="_blank" rel="noreferrer noopener"> {{ dictionary.msg_abrir_audio }} </a> </p>
21
- </audio>
22
- <video v-if="video" :src="docURL" controls :title="`${fileType} - ${filename}`">
23
- <p> {{ dictionary.msg_erro_video }} <a v-if="fileType != 'erro'" :href="docURL" target="_blank" rel="noreferrer noopener"> {{ dictionary.msg_abrir_video }} </a> </p>
24
- </video>
25
- </template>
26
- <template v-else>
27
- <a v-if="fileType != 'erro'" :href="docURL" target="_blank" rel="noreferrer noopener" :title="`${fileType} - ${filename}`">
28
- <fa-icon :class="[iconClass]" :icon="icon" />
29
- <p v-text="filename"></p>
30
- </a>
31
- <p v-else :title="`${fileType} - ${filename}`" class="arquivo-erro">
32
- <fa-icon :icon="['fas', 'file-alt']" />
33
- {{ filename }}
34
- </p>
35
- </template>
36
- </div>
37
- <a v-if="imageURL" :href="imageURL" :download="`${filename}`" target="_blank" rel="noreferrer noopener"> {{ dictionary.titulo_baixar_img }} <fa-icon :icon="['fas', 'download']" /> </a>
38
- <a v-if="docURL" :href="docURL" :download="`${filename}`" target="_blank" rel="noreferrer noopener"> {{ dictionary.titulo_baixar_doc }} <fa-icon :icon="['fas', 'download']" /> </a>
39
- </div>
40
- </transition-group>
38
+ </div>
41
39
  </div>
42
40
  </template>
43
41
 
@@ -105,6 +103,73 @@ export default {
105
103
  </script>
106
104
 
107
105
  <style scoped>
106
+ .mensagem__principal .default-doc {
107
+ background-color: rgba(255, 255, 255, 0.1);
108
+ }
109
+
110
+ .mensagem__outros .default-doc {
111
+ background-color: rgba(100, 100, 100, 0.1);
112
+ }
113
+
114
+ .default-doc {
115
+ display: flex;
116
+ align-items: center;
117
+ padding: 10px;
118
+ border-radius: 5px;
119
+ width: 100%;
120
+ max-width: 100%;
121
+ }
122
+ .default-doc svg {
123
+ font-size: 1.2rem;
124
+ margin-right: 5px;
125
+ }
126
+ .default-doc p {
127
+ overflow: hidden;
128
+ text-overflow: ellipsis;
129
+ white-space: nowrap;
130
+ }
131
+
132
+ .file-actions {
133
+ display: flex;
134
+ justify-content: flex-end;
135
+ width: 100%;
136
+ padding: 5px;
137
+ }
138
+ .file-actions a {
139
+ margin-right: 0;
140
+ }
141
+
142
+ .mensagem__principal .file-action-button {
143
+ background-color: rgba(255, 255, 255, 0.1);
144
+ }
145
+
146
+ .mensagem__outros .file-action-button {
147
+ background-color: rgba(100, 100, 100, 0.1);
148
+ }
149
+
150
+ .mensagem__principal .file-action-button:hover {
151
+ background-color: rgba(255, 255, 255, 0.3);
152
+ }
153
+
154
+ .mensagem__outros .file-action-button:hover {
155
+ background-color: rgba(100, 100, 100, 0.3);
156
+ }
157
+
158
+ .file-action-button {
159
+ display: flex;
160
+ justify-content: center;
161
+ align-items: center;
162
+ margin-left: 12px;
163
+ cursor: pointer;
164
+ padding: 5px;
165
+ border-radius: 5px;
166
+ transition: background-color 150ms ease-in-out;
167
+ }
168
+
169
+ .file-action-button a {
170
+ margin: 0
171
+ }
172
+
108
173
  .fade-enter-active, .fade-leave-active {
109
174
  transition: opacity .5s;
110
175
  }
@@ -145,15 +210,19 @@ export default {
145
210
  .anexo-container svg{
146
211
  font-size: 2rem;
147
212
  }
148
- .anexo-container audio{
213
+
214
+ .anexo-mensagem audio{
149
215
  outline: none;
150
216
  width: 100%;
217
+ margin-bottom: 5px;
151
218
  }
152
- .anexo-container video{
219
+
220
+ .anexo-mensagem video{
153
221
  flex: 1;
154
222
  width: 100%;
155
223
  max-width: 350px;
156
224
  cursor: pointer;
225
+ margin-bottom: 5px;
157
226
  }
158
227
 
159
228
  .anexos-links-container{
@@ -193,6 +262,7 @@ export default {
193
262
  justify-content: center;
194
263
  align-items: center;
195
264
  flex-direction: column;
265
+ width: 100%;
196
266
  }
197
267
 
198
268
  .alert-danger {
@@ -222,4 +292,4 @@ export default {
222
292
  .doc {
223
293
  color: #006bc9
224
294
  }
225
- </style>
295
+ </style>
@@ -11,7 +11,7 @@
11
11
  <div v-else class="mensagem" :class="{mapa, 'hist-msg' : histMsg, 'max-w-60' : link && !mapa}">
12
12
  <template v-if="anexos && anexos.length">
13
13
  <div class="mensagem-anexo" v-for="(anexo, index) in anexos" :key="index">
14
- <AnexoMensagem :dictionary="dictionary" :anexo="anexo" :origemExterna="origemExterna" :dominio="dominio" @abrir-imagem="abrirImagem"/>
14
+ <AnexoMensagem :dictionary="dictionary" :anexo="anexo" :origemExterna="origemExterna" :dominio="dominio" @abrir-imagem="abrirImagem" @download-all="$emit('download-all')"/>
15
15
  </div>
16
16
  </template>
17
17
  <img class="default-stick-size" v-if="urlSticker" :src="urlSticker" :title="urlFileName">
@@ -78,7 +78,10 @@ import LinkPreview from './LinkPreview'
78
78
 
79
79
  export default {
80
80
  components: { AnexoMensagem, InteratividadeBotoes, InteratividadeFormulario, LinkPreview },
81
- 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"],
81
+ 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"],
82
+ created() {
83
+ if(!this.$root.$refs.chatMessages) this.$root.$refs.chatMessages = this
84
+ },
82
85
  data(){
83
86
  return{
84
87
  strTooltipAux: "",
@@ -11,7 +11,9 @@
11
11
  :reduce="template => template.cod"
12
12
  :clearable="false"
13
13
  @input="setTemplate"
14
- :getOptionLabel="template => template.label">
14
+ :getOptionLabel="template => template.label"
15
+ ref="template-v-select"
16
+ >
15
17
  <div slot="no-options" v-text="dictionary.msg_sem_resultados"></div>
16
18
  </v-select>
17
19
  </div>
@@ -131,11 +133,17 @@
131
133
  this.selectedTemplate = this.templates[key]
132
134
  this.codTemplate = key
133
135
  this.$emit('selected-template', key)
136
+ this.$nextTick(() => {
137
+ if(this.$root.$refs[`template-single-${this.identifier}`]) this.$root.$refs[`template-single-${this.identifier}`].handleInitialFocus()
138
+ })
134
139
  }else{
135
140
  this.selectedTemplate = null
136
141
  }
137
142
  this.adjustOnSelect()
138
143
  },
144
+ focusSelect() {
145
+ if(this.$refs["template-v-select"] && this.$refs["template-v-select"].$el) this.$refs["template-v-select"].$el.querySelector("input").focus()
146
+ },
139
147
  selectIfIsUnique() {
140
148
  if(Object.keys(this.templates).length === 1) {
141
149
  for(let key in this.templates) {
@@ -145,6 +153,7 @@
145
153
  this.adjustOnSelect()
146
154
  }
147
155
  }
156
+ if(!this.codTemplate) this.focusSelect()
148
157
  },
149
158
  selectIfHasContact24h() {
150
159
  if(this.templates['envio_msg']) {
@@ -383,7 +392,6 @@ h1, h2, h3, h4, p { margin: 0; padding: 0 }
383
392
  align-items: center;
384
393
  }
385
394
  .tg-btn button {
386
- outline: unset;
387
395
  border: unset;
388
396
  display: block;
389
397
  min-width: 180px;
@@ -392,7 +400,7 @@ h1, h2, h3, h4, p { margin: 0; padding: 0 }
392
400
  font-weight: 500;
393
401
  background-color: #007bff;
394
402
  color: #FFF;
395
- transition-duration: 300ms;
403
+ transition: transform 300ms ease-in-out;
396
404
  user-select: none;
397
405
  cursor: pointer;
398
406
  box-shadow: inset 0 -2px rgba(0, 0, 0, 0.2);
@@ -425,11 +433,11 @@ h1, h2, h3, h4, p { margin: 0; padding: 0 }
425
433
  transform: translateY(1px);
426
434
  }
427
435
  .tg-btn button:focus, .tg-btn button:active {
428
- outline: unset;
436
+ outline: 2px solid black;
429
437
  }
430
438
  .tg-btn.small-btn {
431
439
  width: auto;
432
- margin-left: 5px;
440
+ margin: 0 5px;
433
441
  }
434
442
  .tg-btn.small-btn svg {
435
443
  margin-right: 0;
@@ -11,6 +11,7 @@
11
11
  :placeholderMessage="'Escreva sua mensagem'"
12
12
  :ignoreHideTextarea="true"
13
13
  :dictionary="dictionary"
14
+ ref="text-footer-template-message"
14
15
  ></TextFooter>
15
16
  <div class="tg-btn" :class="{'small-btn' : iconButton}" v-if="hasButton">
16
17
  <button @click="sendMessage">
@@ -47,7 +48,17 @@ export default {
47
48
  required: true
48
49
  }
49
50
  },
51
+ mounted() {
52
+ this.initFocus()
53
+ },
50
54
  methods: {
55
+ initFocus() {
56
+ this.$nextTick(() => {
57
+ if(this.$refs["text-footer-template-message"] && this.$refs["text-footer-template-message"].$el) {
58
+ this.$refs["text-footer-template-message"].$el.querySelector("textarea").focus()
59
+ }
60
+ })
61
+ },
51
62
  sendMessage() {
52
63
  this.$emit('click-trigger')
53
64
  },
@@ -52,7 +52,7 @@
52
52
  </div>
53
53
  </div>
54
54
  <div class="tg-btn" :class="{'small-btn' : iconButton}" v-if="hasButton">
55
- <button @click="$emit('click-trigger')">
55
+ <button @click="$emit('click-trigger')" ref="template-single-button">
56
56
  <template v-if="!iconButton">
57
57
  <fa-icon :icon="['fas', 'paper-plane']" />
58
58
  {{ dictionary.btn_contatar_clientes }}
@@ -121,6 +121,11 @@ export default {
121
121
  })
122
122
  },
123
123
  methods: {
124
+ handleInitialFocus() {
125
+ const allInputs = document.querySelectorAll(`.input-var-${this.identifier}`);
126
+ if(allInputs.length) allInputs[0].focus()
127
+ else if(this.$refs["template-single-button"]) this.$refs["template-single-button"].focus()
128
+ },
124
129
  limparInputVar() {
125
130
  const allInputs = document.querySelectorAll(`.input-var-${this.identifier}`);
126
131
  allInputs.forEach((input) => {
@@ -166,6 +171,8 @@ export default {
166
171
  setEvent(input) {
167
172
  const varList = input.nextSibling
168
173
 
174
+ const currentInstance = this
175
+
169
176
  input.setAttribute("placeholder", `{{var_${this.lastVar}}}`);
170
177
  input.setAttribute("id", `{{var_${this.lastVar}}}`);
171
178
  input.addEventListener("input", (event) => {
@@ -176,11 +183,26 @@ export default {
176
183
  input.classList.remove("invalid");
177
184
  input.classList.add("active");
178
185
  if(varList) {
186
+ const handleNextFocus = () => {
187
+ const allInputs = document.querySelectorAll(`.input-var-${currentInstance.identifier}`)
188
+ let stop = false
189
+ if(allInputs.length) {
190
+ allInputs.forEach(elem => {
191
+ if(!elem.value && !stop) {
192
+ stop = true
193
+ elem.focus()
194
+ }
195
+ })
196
+ }
197
+ if(!stop && this.$refs["template-single-button"]) this.$refs["template-single-button"].focus()
198
+ }
199
+
179
200
  for(let i = 0; i < varList.children.length; i++) {
180
201
  varList.children[i].addEventListener("click", function() {
181
202
  input.value = `[${this.innerText}]`
182
203
  input.classList.add("active")
183
204
  input.dispatchEvent(new Event('input'))
205
+ handleNextFocus()
184
206
  })
185
207
  }
186
208
 
@@ -208,8 +230,7 @@ export default {
208
230
  if(varList) varList.classList.remove("visible")
209
231
  });
210
232
  input.addEventListener("keydown", (event) => {
211
- if (event.keyCode == 13 && this.hasButton)
212
- this.$emit("click-trigger");
233
+ if (event.keyCode == 13 && this.hasButton) this.$emit("click-trigger");
213
234
  });
214
235
  this.lastVar += 1;
215
236
  },