vue-intergrall-plugins 0.0.136 → 0.0.140

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.136",
3
+ "version": "0.0.140",
4
4
  "description": "",
5
5
  "main": "dist/vue-intergrall-plugins.ssr.js",
6
6
  "browser": "dist/vue-intergrall-plugins.esm.js",
@@ -0,0 +1,410 @@
1
+ <template>
2
+ <div
3
+ v-if="origin"
4
+ :class="[currentClasses]"
5
+ :id="`card-${messageIndex ? messageIndex : randomizeValue}`"
6
+ >
7
+ <transition name="fade">
8
+ <span v-if="newMessage" class="new-messages" v-text="`Nova mensagem`"></span>
9
+ </transition>
10
+ <div class="card box-shadow">
11
+ <div class="card-header">
12
+ <div class="card-author">
13
+ <fa-icon :icon="currentIcon" />
14
+ <p
15
+ v-if="author"
16
+ class="text-bold"
17
+ v-text="`${tratarTextoLongo(author)}`"
18
+ :title="author">
19
+ </p>
20
+ <p
21
+ v-if="origin === 'principal' && login"
22
+ v-text="`| ${login}`"
23
+ :title="login">
24
+ </p>
25
+ </div>
26
+ <div class="card-right">
27
+ <div class="card-dates">
28
+ <div
29
+ v-if="date"
30
+ class="card-date"
31
+ :title="`${dictionary.data_criacao}: ${origin === 'outros' ? formataTimezoneData(date) : returnFormataDataHora(date)}`"
32
+ >
33
+ <span v-text="origin === 'outros' ? formataTimezoneData(date) : returnFormataDataHora(date)"></span>
34
+ </div>
35
+ </div>
36
+ <div v-if="hasExpand" class="card-expand" @click="cardExpand()">
37
+ <fa-icon :icon="['fas', 'expand-alt']" />
38
+ </div>
39
+ </div>
40
+ </div>
41
+ <p
42
+ v-if="chipInfos.cod && chipInfos.desc"
43
+ class="card-chip"
44
+ :class="[chipInfosClasses]"
45
+ v-text="`${chipInfos.desc} (${chipInfos.cod})`" :title="`${chipInfos.desc} (${chipInfos.cod})`">
46
+ </p>
47
+ <p class="card-message" v-html="formattedMessage"></p>
48
+ <div class="card-footer" v-if="files && files.length">
49
+ <div class="card-file" v-for="(file, index) in files" :key="`${index}`">
50
+ <CardFile :file="file" :dictionary="dictionary" :domain="domain" />
51
+ </div>
52
+ </div>
53
+ </div>
54
+ </div>
55
+ </template>
56
+
57
+ <script>
58
+ import { textoLongo } from "@/mixins/formatarTexto"
59
+ import { formataTimezoneData, formataDataHora } from "../../services/textFormatting"
60
+ import CardFile from "./CardFile"
61
+
62
+ export default {
63
+ components: { CardFile },
64
+ props: {
65
+ dictionary: {
66
+ type: Object,
67
+ required: true
68
+ },
69
+ messageIndex: {
70
+ type: [Number, String],
71
+ required: true
72
+ },
73
+ domain: {
74
+ type: String,
75
+ required: true
76
+ },
77
+ hasExpand: {
78
+ type: Boolean,
79
+ required: false,
80
+ default: true
81
+ },
82
+ origin: {
83
+ type: String,
84
+ required: true
85
+ },
86
+ author: {
87
+ type: String
88
+ },
89
+ login: {
90
+ type: String
91
+ },
92
+ message: {
93
+ type: String
94
+ },
95
+ files: {
96
+ type: Array
97
+ },
98
+ date: {
99
+ type: String
100
+ },
101
+ chipInfos: {
102
+ type: Object
103
+ },
104
+ newMessage: {
105
+ type: Boolean
106
+ }
107
+ },
108
+ mixins: [textoLongo],
109
+ computed: {
110
+ randomizeValue() {
111
+ return `${(Math.floor(Math.random() * 7770))}${Date.now()}`
112
+ },
113
+ formattedMessage() {
114
+ if(this.message) {
115
+ const regex = /(\n|\r|&nbsp;)/g
116
+ if(regex.test(this.message)) return this.message.replace(regex, "<br>")
117
+ }
118
+ return this.message
119
+ },
120
+ currentIcon() {
121
+ return this.origin === "outros" ? ['fas', 'user'] : ['fas', 'headset']
122
+ },
123
+ currentClasses() {
124
+ return `${this.origin === "outros" ? "card-cli" : "card-ope"} ${this.newMessage ? "newMessage" : ""}`
125
+ },
126
+ chipInfosClasses() {
127
+ if(!this.chipInfos || !this.chipInfos.cod) return ""
128
+ const { cod } = this.chipInfos
129
+ switch(cod) {
130
+ case 9:
131
+ case "9":
132
+ case 8:
133
+ case "8":
134
+ return "red"
135
+ case 3:
136
+ case "3":
137
+ case 6:
138
+ case "6":
139
+ return "yellow"
140
+ default:
141
+ return ""
142
+ }
143
+ }
144
+ },
145
+ methods: {
146
+ formataTimezoneData(timezoneData) {
147
+ return formataTimezoneData(timezoneData)
148
+ },
149
+ returnFormataDataHora(dataHora) {
150
+ return formataDataHora(dataHora, false, false, this.dictionary)
151
+ },
152
+ cardExpand() {
153
+ this.$emit("card-expand", this.$props)
154
+ }
155
+ }
156
+ }
157
+ </script>
158
+
159
+ <style scoped>
160
+ .fade-enter-active,
161
+ .fade-leave-active {
162
+ transition: opacity 200ms;
163
+ }
164
+ .fade-enter,
165
+ .fade-leave-to {
166
+ opacity: 0;
167
+ }
168
+
169
+ .card-cli, .card-ope {
170
+ display: flex;
171
+ width: 95%;
172
+ margin: 5px 0;
173
+ position: relative;
174
+ }
175
+ .card-cli.newMessage, .card-ope.newMessage {
176
+ margin-top: 30px;
177
+ }
178
+
179
+ .new-messages {
180
+ position: absolute;
181
+ top: -30px;
182
+ width: 100%;
183
+ display: flex;
184
+ justify-content: center;
185
+ align-items: center;
186
+ margin: 2.5px 0;
187
+ background-color: lighten(#FFF249, 15)
188
+ }
189
+
190
+ .card-cli .card {
191
+ border-left: 3px solid #90B823;
192
+ }
193
+
194
+
195
+ .card-ope {
196
+ align-self: flex-end;
197
+ background-color: lighten(#007535, 72);
198
+ }
199
+ .card-ope .card {
200
+ border-right: 3px solid #007535;
201
+ }
202
+
203
+ .card {
204
+ background-color: rgba(255, 255, 255, .9);
205
+ overflow: hidden;
206
+ width: 100%;
207
+ padding: 2.5px 5px;
208
+ }
209
+ .card p {
210
+ word-break: break-all;
211
+ }
212
+
213
+ .card-header {
214
+ width: 100%;
215
+ border-bottom: 1px solid #ddd;
216
+ margin-bottom: 5px;
217
+ display: flex;
218
+ justify-content: space-between;
219
+ }
220
+ .card-header svg {
221
+ font-size: 1rem
222
+ }
223
+
224
+ .card-author {
225
+ display: flex;
226
+ align-items: center;
227
+ }
228
+ .card-author svg {
229
+ margin-right: 5px;
230
+ }
231
+
232
+ .card-canal {
233
+ flex: 1;
234
+ margin-right: 10px;
235
+ }
236
+
237
+ .card-dates {
238
+ display: flex;
239
+ flex-direction: column;
240
+ margin-right: 10px;
241
+ font-size: .9rem
242
+ }
243
+
244
+ .card-date {
245
+ overflow: hidden;
246
+ display: flex;
247
+ align-content: center;
248
+ }
249
+ .card-date span {
250
+ white-space: nowrap;
251
+ text-overflow: ellipsis;
252
+ overflow: hidden;
253
+ }
254
+ .card-date svg {
255
+ margin-right: 5px;
256
+ color: #232323;
257
+ }
258
+
259
+ .card-expand {
260
+ display: flex;
261
+ justify-content: center;
262
+ align-items: center;
263
+ margin: 2.5px;
264
+ cursor: pointer;
265
+ opacity: .8;
266
+ transition: opacity 150ms;
267
+ }
268
+ .card-expand:hover {
269
+ opacity: 1;
270
+ }
271
+
272
+ .card-footer {
273
+ margin-top: 5px;
274
+ border-top: 1px solid #ddd;
275
+ display: flex;
276
+ flex-wrap: wrap;
277
+ }
278
+
279
+
280
+ .card-chip {
281
+ font-size: .8rem;
282
+ width: fit-content;
283
+ border-radius: 15px;
284
+ transition: all 150ms ease-in-out;
285
+ padding: 2.5px 7px;
286
+ color: rgb(31, 105, 193);
287
+ background-color: rgba(207, 216, 244, .6);
288
+ margin-bottom: 5px;
289
+ }
290
+ .card-chip:hover {
291
+ background-color: rgba(207, 216, 244, 1);
292
+ }
293
+ .card-chip.orange {
294
+ color: #e14924;
295
+ background-color: rgba(228, 92, 58, .15);
296
+ }
297
+ .card-chip.orange:hover {
298
+ background-color: rgba(228, 92, 58, .2);
299
+ }
300
+ .card-chip.yellow {
301
+ color: #f4a304;
302
+ background-color: rgba(252, 191, 73, .15);
303
+ }
304
+ .card-chip.yellow:hover {
305
+ background-color: rgba(252, 191, 73, .2);
306
+ }
307
+ .card-chip.red {
308
+ color: rgb(231, 76, 60);
309
+ background-color: rgba(231, 76, 60, .2);
310
+ }
311
+ .card-chip.red:hover {
312
+ background-color: rgba(231, 76, 60, .25);
313
+ }
314
+
315
+ .card-file {
316
+ width: 50px;
317
+ height: 50px;
318
+ margin-right: 5px;
319
+ display: flex;
320
+ justify-content: center;
321
+ align-items: center;
322
+ }
323
+ .file-item {
324
+ width: 100%;
325
+ height: 100%;
326
+ display: flex;
327
+ justify-content: center;
328
+ align-items: center;
329
+ position: relative;
330
+ }
331
+ .file-item-transition {
332
+ max-width: 100%;
333
+ max-height: 100%;
334
+ }
335
+ .file-item .req-loader {
336
+ position: absolute;
337
+ top: calc(50% - 12.5px);
338
+ right: calc(50% - 12.5px);
339
+ }
340
+ .file-item-transition img {
341
+ max-width: 45px;
342
+ max-height: 45px;
343
+ }
344
+
345
+ .file-icon {
346
+ opacity: .9;
347
+ transition: opacity 200ms;
348
+ color: #222;
349
+ cursor: pointer;
350
+ display: flex;
351
+ justify-content: center;
352
+ align-items: center;
353
+ }
354
+ .file-icon:hover {
355
+ opacity: 1
356
+ }
357
+ .file-icon:visited {
358
+ color: inherit;
359
+ }
360
+ svg {
361
+ font-size: 30px;
362
+ z-index: 1;
363
+ }
364
+ .file-icon.pdf {
365
+ position: relative;
366
+ }
367
+ .file-icon.pdf svg {
368
+ color: rgb(231, 76, 60);
369
+ }
370
+ .file-icon.pdf::after {
371
+ content: "";
372
+ position: absolute;
373
+ bottom: 2px;
374
+ transform: translateY(2px);
375
+ width: 20px;
376
+ height: 20px;
377
+ background-color: #FFF;
378
+ }
379
+ .file-icon.doc {
380
+ color: #15517F;
381
+ }
382
+ .file-icon.doc::after {
383
+ content: "";
384
+ position: absolute;
385
+ width: 20px;
386
+ height: 20px;
387
+ background-color: #FFF;
388
+ }
389
+ .file-img {
390
+ display: flex;
391
+ justify-content: center;
392
+ align-items: center;
393
+ width: 100%;
394
+ height: 100%;
395
+ overflow: hidden;
396
+ background-color: rgba(0, 0, 0, .2);
397
+ border-radius: 2.5px;
398
+ cursor: pointer;
399
+ opacity: .9;
400
+ transition: opacity 150ms;
401
+ }
402
+
403
+ .file-img:hover {
404
+ opacity: 1;
405
+ }
406
+ .file-img img {
407
+ width: 95%;
408
+ }
409
+
410
+ </style>
@@ -0,0 +1,117 @@
1
+ <template>
2
+ <span class="file-item">
3
+ <transition-group name="fade" mode="out-in" class="file-item-transition">
4
+ <div v-if="loading" :small="true" key="card-file-loader" class="req-loader slow"></div>
5
+ <template v-else>
6
+ <span v-if="imageUrl" class="file-img box-shadow" @click="openFile(imageUrl, true)" key="card-file-img" :title="fileName">
7
+ <img :src="`${imageUrl}`" :alt="fileName" />
8
+ </span>
9
+ <span
10
+ v-else
11
+ class="file-icon"
12
+ key="card-file-doc"
13
+ :class="[currentClass]"
14
+ @click="openFile(docUrl, false)"
15
+ :title="fileName"
16
+ target="_blank"
17
+ rel="noreferrer noopener"
18
+ >
19
+ <fa-icon :icon="icon" />
20
+ </span>
21
+ <a :href="imageUrl ? imageUrl : docUrl" :download="`${fileName}`" target="_blank" rel="noreferrer noopener" key="card-file-download-icon" :title="`Download ${fileName}`">
22
+ <fa-icon :icon="['fas', 'download']" />
23
+ </a>
24
+ </template>
25
+ </transition-group>
26
+ </span>
27
+ </template>
28
+
29
+ <style scoped>
30
+ .fade-enter-active, .fade-leave-active {
31
+ transition: opacity .5s;
32
+ }
33
+ .fade-enter, .fade-leave-to {
34
+ opacity: 0;
35
+ }
36
+ </style>
37
+
38
+ <script>
39
+ import { gerarVariaveisAnexo } from "../../services/formatMessage"
40
+
41
+ export default {
42
+ props: {
43
+ file: {
44
+ type: Object,
45
+ required: true
46
+ },
47
+ dictionary: {
48
+ type: Object,
49
+ required: true
50
+ },
51
+ domain: {
52
+ type: String,
53
+ required: true
54
+ }
55
+ },
56
+ computed: {
57
+ currentClass() {
58
+ return this.fileExt === "pdf" ? "pdf" : "doc"
59
+ }
60
+ },
61
+ data() {
62
+ return {
63
+ loading: true,
64
+ isAnexo: false,
65
+ imageUrl: "",
66
+ fileExt: "",
67
+ docUrl: "",
68
+ fileName: "",
69
+ audio: false,
70
+ video: false,
71
+ icon: []
72
+ }
73
+ },
74
+ mounted() {
75
+ this.setFileVars()
76
+ },
77
+ methods: {
78
+ setFileVars() {
79
+ try {
80
+ const {
81
+ anexo,
82
+ imgAnexo,
83
+ tipoDoc,
84
+ docAnexo,
85
+ nomeArquivo,
86
+ audio,
87
+ video
88
+ } = gerarVariaveisAnexo(this.file, { dominio: this.domain });
89
+
90
+ this.isAnexo = anexo;
91
+ this.imageUrl = imgAnexo;
92
+ this.fileExt = tipoDoc;
93
+ this.docUrl = docAnexo;
94
+ this.fileName = nomeArquivo;
95
+ this.audio = audio;
96
+ this.video = video;
97
+
98
+ this.generateIcon();
99
+
100
+ this.loading = false;
101
+ }catch(e) {
102
+ console.error("Erro ao gerar as variaveis dos anexos")
103
+ console.error(e)
104
+ }
105
+ },
106
+ generateIcon() {
107
+ this.icon = this.fileExt === "pdf" ? ['fas', 'file-pdf'] : ['fas', 'file-alt']
108
+ },
109
+ openFile(link, isImg) {
110
+ const width = window.innerWidth
111
+ const height = window.innerHeight
112
+ const options = !isImg ? `width=${width},height=${height}` : "width=auto,height=auto"
113
+ window.open(link, "card-file", options)
114
+ }
115
+ }
116
+ }
117
+ </script>
@@ -11,14 +11,14 @@
11
11
  <div v-else-if="docAnexo" class="anexo-container">
12
12
  <template v-if="audio || video">
13
13
  <audio v-if="audio" :src="docAnexo" controls :title="`${tipoDoc} - ${nomeArquivo}`">
14
- <p> {{ dictionary.msg_erro_audio }} <a :href="docAnexo" target="_blank"> {{ dictionary.msg_abrir_audio }} </a> </p>
14
+ <p> {{ dictionary.msg_erro_audio }} <a :href="docAnexo" target="_blank" rel="noreferrer noopener"> {{ dictionary.msg_abrir_audio }} </a> </p>
15
15
  </audio>
16
16
  <video v-if="video" :src="docAnexo" controls :title="`${tipoDoc} - ${nomeArquivo}`">
17
- <p> {{ dictionary.msg_erro_video }} <a v-if="tipoDoc != 'erro'" :href="docAnexo" target="_blank"> {{ dictionary.msg_abrir_video }} </a> </p>
17
+ <p> {{ dictionary.msg_erro_video }} <a v-if="tipoDoc != 'erro'" :href="docAnexo" target="_blank" rel="noreferrer noopener"> {{ dictionary.msg_abrir_video }} </a> </p>
18
18
  </video>
19
19
  </template>
20
20
  <template v-else>
21
- <a v-if="tipoDoc != 'erro'" :href="docAnexo" target="_blank" :title="`${tipoDoc} - ${nomeArquivo}`">
21
+ <a v-if="tipoDoc != 'erro'" :href="docAnexo" target="_blank" rel="noreferrer noopener" :title="`${tipoDoc} - ${nomeArquivo}`">
22
22
  <fa-icon :icon="this.icone" />
23
23
  <p v-text="nomeArquivo"></p>
24
24
  </a>
@@ -28,8 +28,8 @@
28
28
  </p>
29
29
  </template>
30
30
  </div>
31
- <a v-if="imgAnexo" :href="imgAnexo" :download="`${nomeArquivo}`" target="_blank"> {{ dictionary.titulo_baixar_img }} <fa-icon :icon="['fas', 'download']" /> </a>
32
- <a v-if="docAnexo" :href="docAnexo" :download="`${nomeArquivo}`" target="_blank"> {{ dictionary.titulo_baixar_doc }} <fa-icon :icon="['fas', 'download']" /> </a>
31
+ <a v-if="imgAnexo" :href="imgAnexo" :download="`${nomeArquivo}`" target="_blank" rel="noreferrer noopener"> {{ dictionary.titulo_baixar_img }} <fa-icon :icon="['fas', 'download']" /> </a>
32
+ <a v-if="docAnexo" :href="docAnexo" :download="`${nomeArquivo}`" target="_blank" rel="noreferrer noopener"> {{ dictionary.titulo_baixar_doc }} <fa-icon :icon="['fas', 'download']" /> </a>
33
33
  </div>
34
34
  </transition-group>
35
35
  </div>
@@ -13,11 +13,12 @@
13
13
  :class="[iconeClass]"
14
14
  @click="abrirAnexo(docAnexo, false)"
15
15
  :title="nomeArquivo"
16
- target="_blank"
16
+ target="_blank"
17
+ rel="noreferrer noopener"
17
18
  >
18
19
  <fa-icon :icon="icone" />
19
20
  </span>
20
- <a :href="imgAnexo ? imgAnexo : docAnexo" :download="`${nomeArquivo}`" target="_blank" key="ra-download-icon" :title="`Download ${nomeArquivo}`">
21
+ <a :href="imgAnexo ? imgAnexo : docAnexo" :download="`${nomeArquivo}`" target="_blank" rel="noreferrer noopener" key="ra-download-icon" :title="`Download ${nomeArquivo}`">
21
22
  <fa-icon :icon="['fas', 'download']" />
22
23
  </a>
23
24
  </template>
@@ -1,13 +1,36 @@
1
1
  <template>
2
2
  <div class="interatividade">
3
- <div v-for="(btn, index) in arrBotoes" :key="index" :title="btn.titulo" class="interatividade-btn">
4
- <p v-text="btn.titulo" class="interatividade-titulo"></p>
5
- </div>
3
+ <transition name="show-x">
4
+ <InteratividadePopup v-if="listaEstaAberta" :lista="listaExpandida" :titulo="objItens.list.title" @close="listaEstaAberta = false" />
5
+ </transition>
6
+ <template v-if="arrBotoes.length">
7
+ <div v-for="(btn, index) in arrBotoes" :key="index" :title="btn.titulo" class="interatividade-btn">
8
+ <p v-text="btn.titulo" class="interatividade-titulo"></p>
9
+ </div>
10
+ </template>
11
+ <template v-else-if="Object.keys(objItens).length">
12
+ <div class="interatividade-lista">
13
+ <div class="interatividade-lista-conteudo">
14
+ <p v-if="objItens.header.text" v-text="objItens.header.text" class="interatividade-lista-titulo"></p>
15
+ <p v-if="objItens.body.text" v-text="objItens.body.text" class="interatividade-lista-corpo"></p>
16
+ <p v-if="objItens.footer.text" v-text="objItens.footer.text" class="interatividade-lista-rodape"></p>
17
+ </div>
18
+ <p v-if="objItens.list.title" v-text="objItens.list.title" @click="expandirLista" class="interatividade-lista-link"></p>
19
+ </div>
20
+ </template>
6
21
  </div>
7
22
  </template>
8
23
 
9
24
  <script>
25
+ import InteratividadePopup from './InteratividadePopup'
26
+
10
27
  export default {
28
+ components: {InteratividadePopup},
29
+ data() {
30
+ return {
31
+ listaEstaAberta: false
32
+ }
33
+ },
11
34
  props: {
12
35
  interatividade: {
13
36
  type: Object,
@@ -19,13 +42,46 @@ export default {
19
42
  return this.interatividade.tipo
20
43
  },
21
44
  arrBotoes() {
22
- return this.interatividade.botoes
45
+ const { botoes } = this.interatividade
46
+ return botoes ? botoes : []
47
+ },
48
+ objItens() {
49
+ const { itens } = this.interatividade
50
+ return itens ? itens : {}
51
+ },
52
+ listaExpandida() {
53
+ try {
54
+ const { list } = this.objItens
55
+ const { sections } = list
56
+ return sections ? sections : []
57
+ }catch(e) {
58
+ console.error("Erro ao definir a lista a ser expandida")
59
+ console.error(e)
60
+ return []
61
+ }
62
+ }
63
+ },
64
+ methods: {
65
+ expandirLista() {
66
+ this.listaEstaAberta = !this.listaEstaAberta
23
67
  }
24
68
  }
25
69
  }
26
70
  </script>
27
71
 
28
72
  <style>
73
+ .show-x-enter-active,
74
+ .show-x-leave-enter {
75
+ opacity: 1;
76
+ transform: translateX(0);
77
+ transition: all 200ms linear;
78
+ }
79
+ .show-x-enter,
80
+ .show-x-leave-to {
81
+ opacity: 0;
82
+ transform: translateX(5%);
83
+ }
84
+
29
85
  .interatividade-btn {
30
86
  width: 100%;
31
87
  display: flex;
@@ -48,4 +104,38 @@ export default {
48
104
  margin: 0;
49
105
  padding: 0;
50
106
  }
107
+
108
+ .interatividade-lista {
109
+ width: 100%;
110
+ min-width: 200px;
111
+ border-radius: 15px;
112
+ background-color: #FFF;
113
+ color: #333;
114
+ margin: 10px 0;
115
+ }
116
+ .interatividade-lista-conteudo {
117
+ padding: 10px;
118
+ border-bottom: 1px solid #D7D7D7;
119
+ }
120
+ .interatividade-lista-titulo {
121
+ font-weight: bold;
122
+ font-size: 1.2em;
123
+ margin-bottom: 10px;
124
+ }
125
+ .interatividade-lista-rodape {
126
+ color: #818181;
127
+ margin-top: 5px;
128
+ }
129
+ .interatividade-lista-link {
130
+ width: 100%;
131
+ text-align: center;
132
+ padding: 10px;
133
+ color: rgb(0, 110, 255);
134
+ cursor: pointer;
135
+ transition: color 200ms ease-in-out;
136
+ }
137
+ .interatividade-lista-link:hover {
138
+ color: rgb(0, 98, 143);
139
+ }
140
+
51
141
  </style>