vue-intergrall-plugins 0.0.138 → 0.0.139

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.138",
3
+ "version": "0.0.139",
4
4
  "description": "",
5
5
  "main": "dist/vue-intergrall-plugins.ssr.js",
6
6
  "browser": "dist/vue-intergrall-plugins.esm.js",
@@ -0,0 +1,401 @@
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-canal {
225
+ flex: 1;
226
+ margin-right: 10px;
227
+ }
228
+
229
+ .card-dates {
230
+ display: flex;
231
+ flex-direction: column;
232
+ margin-right: 10px;
233
+ }
234
+
235
+ .card-date {
236
+ overflow: hidden;
237
+ display: flex;
238
+ align-content: center;
239
+ }
240
+ .card-date span {
241
+ white-space: nowrap;
242
+ text-overflow: ellipsis;
243
+ overflow: hidden;
244
+ }
245
+ .card-date svg {
246
+ margin-right: 5px;
247
+ color: #232323;
248
+ }
249
+
250
+ .card-expand {
251
+ display: flex;
252
+ justify-content: center;
253
+ align-items: center;
254
+ margin: 2.5px;
255
+ cursor: pointer;
256
+ opacity: .8;
257
+ transition: opacity 150ms;
258
+ }
259
+ .card-expand:hover {
260
+ opacity: 1;
261
+ }
262
+
263
+ .card-footer {
264
+ margin-top: 5px;
265
+ border-top: 1px solid #ddd;
266
+ display: flex;
267
+ flex-wrap: wrap;
268
+ }
269
+
270
+
271
+ .card-chip {
272
+ font-size: .8rem;
273
+ width: fit-content;
274
+ border-radius: 15px;
275
+ transition: all 150ms ease-in-out;
276
+ padding: 2.5px 7px;
277
+ color: rgb(31, 105, 193);
278
+ background-color: rgba(207, 216, 244, .6);
279
+ margin-bottom: 5px;
280
+ }
281
+ .card-chip:hover {
282
+ background-color: rgba(207, 216, 244, 1);
283
+ }
284
+ .card-chip.orange {
285
+ color: #e14924;
286
+ background-color: rgba(228, 92, 58, .15);
287
+ }
288
+ .card-chip.orange:hover {
289
+ background-color: rgba(228, 92, 58, .2);
290
+ }
291
+ .card-chip.yellow {
292
+ color: #f4a304;
293
+ background-color: rgba(252, 191, 73, .15);
294
+ }
295
+ .card-chip.yellow:hover {
296
+ background-color: rgba(252, 191, 73, .2);
297
+ }
298
+ .card-chip.red {
299
+ color: rgb(231, 76, 60);
300
+ background-color: rgba(231, 76, 60, .2);
301
+ }
302
+ .card-chip.red:hover {
303
+ background-color: rgba(231, 76, 60, .25);
304
+ }
305
+
306
+ .card-file {
307
+ width: 50px;
308
+ height: 50px;
309
+ margin-right: 5px;
310
+ display: flex;
311
+ justify-content: center;
312
+ align-items: center;
313
+ }
314
+ .file-item {
315
+ width: 100%;
316
+ height: 100%;
317
+ display: flex;
318
+ justify-content: center;
319
+ align-items: center;
320
+ position: relative;
321
+ }
322
+ .file-item .file-item-transition {
323
+ max-width: 100%;
324
+ max-height: 100%;
325
+ }
326
+ .file-item .req-loader {
327
+ position: absolute;
328
+ top: calc(50% - 12.5px);
329
+ right: calc(50% - 12.5px);
330
+ }
331
+ .file-item .file-item-transition img {
332
+ max-width: 45px;
333
+ max-height: 45px;
334
+ }
335
+
336
+ .file-icon {
337
+ opacity: .9;
338
+ transition: opacity 200ms;
339
+ color: #222;
340
+ cursor: pointer;
341
+ display: flex;
342
+ justify-content: center;
343
+ align-items: center;
344
+ }
345
+ .file-icon:hover {
346
+ opacity: 1
347
+ }
348
+ .file-icon:visited {
349
+ color: inherit;
350
+ }
351
+ svg {
352
+ font-size: 30px;
353
+ z-index: 1;
354
+ }
355
+ .file-icon.pdf {
356
+ position: relative;
357
+ }
358
+ .file-icon.pdf svg {
359
+ color: rgb(231, 76, 60);
360
+ }
361
+ .file-icon.pdf::after {
362
+ content: "";
363
+ position: absolute;
364
+ bottom: 2px;
365
+ transform: translateY(2px);
366
+ width: 20px;
367
+ height: 20px;
368
+ background-color: #FFF;
369
+ }
370
+ .file-icon.doc {
371
+ color: #15517F;
372
+ }
373
+ .file-icon.doc::after {
374
+ content: "";
375
+ position: absolute;
376
+ width: 20px;
377
+ height: 20px;
378
+ background-color: #FFF;
379
+ }
380
+ .file-img {
381
+ display: flex;
382
+ justify-content: center;
383
+ align-items: center;
384
+ width: 100%;
385
+ height: 100%;
386
+ overflow: hidden;
387
+ background-color: rgba(0, 0, 0, .2);
388
+ border-radius: 2.5px;
389
+ cursor: pointer;
390
+ opacity: .9;
391
+ transition: opacity 150ms;
392
+ }
393
+
394
+ .file-img:hover {
395
+ opacity: 1;
396
+ }
397
+ .file-img img {
398
+ width: 95%;
399
+ }
400
+
401
+ </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>