vue-intergrall-plugins 0.0.137 → 0.0.141

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.137",
3
+ "version": "0.0.141",
4
4
  "description": "",
5
5
  "main": "dist/vue-intergrall-plugins.ssr.js",
6
6
  "browser": "dist/vue-intergrall-plugins.esm.js",
@@ -0,0 +1,394 @@
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">
49
+ <template v-if="files && files.length">
50
+ <div class="card-file" v-for="(file, index) in files" :key="`${index}`">
51
+ <CardFile :file="file" :dictionary="dictionary" :domain="domain" />
52
+ </div>
53
+ </template>
54
+ <CardCheck
55
+ v-if="messageStatus"
56
+ :messageStatus="messageStatus"
57
+ :hasReply="hasReply"
58
+ :replyMessage="replyMessage"
59
+ :tooltipContent="tooltipContent"
60
+ @reply-msg="$emit('reply-msg')"
61
+ />
62
+ </div>
63
+ </div>
64
+ </div>
65
+ </template>
66
+
67
+ <script>
68
+ import { textoLongo } from "@/mixins/formatarTexto"
69
+ import { formataTimezoneData, formataDataHora } from "../../services/textFormatting"
70
+ import CardFile from "./CardFile"
71
+ import CardCheck from "./CardCheck"
72
+
73
+ export default {
74
+ components: { CardFile, CardCheck },
75
+ props: {
76
+ dictionary: {
77
+ type: Object,
78
+ required: true
79
+ },
80
+ messageIndex: {
81
+ type: [Number, String],
82
+ required: true
83
+ },
84
+ domain: {
85
+ type: String,
86
+ required: true
87
+ },
88
+ hasExpand: {
89
+ type: Boolean,
90
+ required: false,
91
+ default: true
92
+ },
93
+ origin: {
94
+ type: String,
95
+ required: true
96
+ },
97
+ author: {
98
+ type: String
99
+ },
100
+ login: {
101
+ type: String
102
+ },
103
+ message: {
104
+ type: String
105
+ },
106
+ files: {
107
+ type: Array
108
+ },
109
+ date: {
110
+ type: String
111
+ },
112
+ chipInfos: {
113
+ type: Object
114
+ },
115
+ newMessage: {
116
+ type: Boolean
117
+ },
118
+ hasReply: {
119
+ type: Boolean
120
+ },
121
+ replyMessage: {
122
+ type: String
123
+ },
124
+ messageStatus: {
125
+ type: String
126
+ },
127
+ tooltipContent: {
128
+ type: String
129
+ }
130
+ },
131
+ mixins: [textoLongo],
132
+ computed: {
133
+ randomizeValue() {
134
+ return `${(Math.floor(Math.random() * 7770))}${Date.now()}`
135
+ },
136
+ formattedMessage() {
137
+ if(this.message) {
138
+ const regex = /(\n|\r|&nbsp;)/g
139
+ if(regex.test(this.message)) return this.message.replace(regex, "<br>")
140
+ }
141
+ return this.message
142
+ },
143
+ currentIcon() {
144
+ return this.origin === "outros" ? ['fas', 'user'] : ['fas', 'headset']
145
+ },
146
+ currentClasses() {
147
+ return `${this.origin === "outros" ? "card-cli" : "card-ope"} ${this.newMessage ? "newMessage" : ""}`
148
+ },
149
+ chipInfosClasses() {
150
+ if(!this.chipInfos || !this.chipInfos.cod) return ""
151
+ const { cod } = this.chipInfos
152
+ switch(cod) {
153
+ case 9:
154
+ case "9":
155
+ case 8:
156
+ case "8":
157
+ return "red"
158
+ case 3:
159
+ case "3":
160
+ case 6:
161
+ case "6":
162
+ return "yellow"
163
+ default:
164
+ return ""
165
+ }
166
+ }
167
+ },
168
+ methods: {
169
+ formataTimezoneData(timezoneData) {
170
+ return formataTimezoneData(timezoneData)
171
+ },
172
+ returnFormataDataHora(dataHora) {
173
+ return formataDataHora(dataHora, false, false, this.dictionary)
174
+ },
175
+ cardExpand() {
176
+ this.$emit("card-expand", this.$props)
177
+ }
178
+ }
179
+ }
180
+ </script>
181
+
182
+ <style>
183
+ .fade-enter-active,
184
+ .fade-leave-active {
185
+ transition: opacity 200ms;
186
+ }
187
+ .fade-enter,
188
+ .fade-leave-to {
189
+ opacity: 0;
190
+ }
191
+
192
+ .card-cli, .card-ope {
193
+ display: flex;
194
+ width: 95%;
195
+ margin: 5px 0;
196
+ position: relative;
197
+ }
198
+ .card-cli.newMessage, .card-ope.newMessage {
199
+ margin-top: 30px;
200
+ }
201
+
202
+ .new-messages {
203
+ position: absolute;
204
+ top: -30px;
205
+ width: 100%;
206
+ display: flex;
207
+ justify-content: center;
208
+ align-items: center;
209
+ margin: 2.5px 0;
210
+ background-color: lighten(#FFF249, 15)
211
+ }
212
+
213
+ .card-cli .card {
214
+ border-left: 3px solid #90B823;
215
+ }
216
+
217
+
218
+ .card-ope {
219
+ align-self: flex-end;
220
+ background-color: lighten(#007535, 72);
221
+ }
222
+ .card-ope .card {
223
+ border-right: 3px solid #007535;
224
+ }
225
+
226
+ .card {
227
+ background-color: rgba(255, 255, 255, .9);
228
+ overflow: hidden;
229
+ width: 100%;
230
+ padding: 2.5px 5px;
231
+ }
232
+ .card p {
233
+ word-break: break-all;
234
+ }
235
+
236
+ .card-header {
237
+ width: 100%;
238
+ border-bottom: 1px solid #ddd;
239
+ margin-bottom: 5px;
240
+ display: flex;
241
+ justify-content: space-between;
242
+ }
243
+ .card-header svg {
244
+ font-size: 1rem
245
+ }
246
+
247
+ .card-author {
248
+ display: flex;
249
+ align-items: center;
250
+ }
251
+ .card-author svg {
252
+ margin-right: 5px;
253
+ }
254
+
255
+ .card-canal {
256
+ flex: 1;
257
+ margin-right: 10px;
258
+ }
259
+
260
+ .card-dates {
261
+ display: flex;
262
+ flex-direction: column;
263
+ margin-right: 10px;
264
+ font-size: .9rem
265
+ }
266
+
267
+ .card-date {
268
+ overflow: hidden;
269
+ display: flex;
270
+ align-content: center;
271
+ }
272
+ .card-date span {
273
+ white-space: nowrap;
274
+ text-overflow: ellipsis;
275
+ overflow: hidden;
276
+ }
277
+ .card-date svg {
278
+ margin-right: 5px;
279
+ color: #232323;
280
+ }
281
+
282
+ .card-expand {
283
+ display: flex;
284
+ justify-content: center;
285
+ align-items: center;
286
+ margin: 2.5px;
287
+ cursor: pointer;
288
+ opacity: .8;
289
+ transition: opacity 150ms;
290
+ }
291
+ .card-expand:hover {
292
+ opacity: 1;
293
+ }
294
+
295
+ .card-footer {
296
+ margin-top: 5px;
297
+ border-top: 1px solid #ddd;
298
+ display: flex;
299
+ flex-wrap: wrap;
300
+ min-height: 25px;
301
+ }
302
+
303
+
304
+ .card-chip {
305
+ font-size: .8rem;
306
+ width: fit-content;
307
+ border-radius: 15px;
308
+ transition: all 150ms ease-in-out;
309
+ padding: 2.5px 7px;
310
+ color: rgb(31, 105, 193);
311
+ background-color: rgba(207, 216, 244, .6);
312
+ margin-bottom: 5px;
313
+ }
314
+ .card-chip:hover {
315
+ background-color: rgba(207, 216, 244, 1);
316
+ }
317
+ .card-chip.orange {
318
+ color: #e14924;
319
+ background-color: rgba(228, 92, 58, .15);
320
+ }
321
+ .card-chip.orange:hover {
322
+ background-color: rgba(228, 92, 58, .2);
323
+ }
324
+ .card-chip.yellow {
325
+ color: #f4a304;
326
+ background-color: rgba(252, 191, 73, .15);
327
+ }
328
+ .card-chip.yellow:hover {
329
+ background-color: rgba(252, 191, 73, .2);
330
+ }
331
+ .card-chip.red {
332
+ color: rgb(231, 76, 60);
333
+ background-color: rgba(231, 76, 60, .2);
334
+ }
335
+ .card-chip.red:hover {
336
+ background-color: rgba(231, 76, 60, .25);
337
+ }
338
+
339
+ .card-file {
340
+ width: 60px;
341
+ height: 50px;
342
+ margin-right: 5px;
343
+ display: flex;
344
+ justify-content: center;
345
+ align-items: center;
346
+ }
347
+
348
+ .card-reply {
349
+ cursor: pointer;
350
+ position: absolute;
351
+ right: 30px;
352
+ bottom: 5px;
353
+ font-size: .6rem;
354
+ color: #67a332;
355
+ width: .9rem;
356
+ height: .9rem;
357
+ display: flex;
358
+ justify-content: center;
359
+ align-items: center;
360
+ border-radius: 50%;
361
+ background-color: #FFF;
362
+ }
363
+ .card-reply svg {
364
+ margin-top: -1px;
365
+ margin-right: -1px;
366
+ }
367
+
368
+ .card-check{
369
+ position: absolute;
370
+ bottom: 5px;
371
+ right: 5px;
372
+ cursor: pointer;
373
+ font-size: 0.7rem;
374
+ }
375
+ .card-check svg {
376
+ font-size: 0.8rem;
377
+ }
378
+ .card-check.seen, .card-check.seen svg{
379
+ color: #006DAA
380
+ }
381
+ .card-check.green, .card-check.green svg{
382
+ color: #4f772d
383
+ }
384
+ .card-check.red, .card-check.red svg{
385
+ color: #ba181b
386
+ }
387
+ .card-check.gray, .card-check.gray svg{
388
+ color: #999
389
+ }
390
+ .card-check.black, .card-check.black svg{
391
+ color: #666
392
+ }
393
+
394
+ </style>
@@ -0,0 +1,35 @@
1
+ <template>
2
+ <div>
3
+ <transition name="fade" mode="out-in">
4
+ <span class="card-reply" v-if="hasReply && (messageStatus == 'C' || messageStatus == 'T')" v-tippy :content="replyMessage ? replyMessage : 'Fazer reenvio da mensagem'" @click="$emit('reply-msg')"> <fa-icon :icon="['fas', 'reply']" /> </span>
5
+ </transition>
6
+ <transition name="fade" mode="out-in">
7
+ <span class="card-check" v-if="messageStatus == 'D'" :content="tooltipContent" v-tippy key="check-padrao"> <fa-icon :icon="['fas', 'check']" /> </span>
8
+ <span class="card-check gray" v-else-if="messageStatus == 'Q'" :content="tooltipContent" v-tippy key="check-gray"> <fa-icon :icon="['fas', 'check']" /> </span>
9
+ <span class="card-check black" v-else-if="messageStatus == 'G'" :content="tooltipContent" v-tippy key="check-black"> <fa-icon :icon="['fas', 'check']" /> </span>
10
+ <span class="card-check black" v-else-if="messageStatus == 'E'" :content="tooltipContent" v-tippy key="double-check-black"> <fa-icon :icon="['fas', 'check-double']" /> </span>
11
+ <span class="card-check seen" v-else-if="messageStatus == 'L'" :content="tooltipContent" v-tippy key="double-check-seen"> <fa-icon :icon="['fas', 'check-double']" /> </span> <!-- messageStatus finalizador -->
12
+ <span class="card-check red" v-else-if="messageStatus == 'C'" :content="tooltipContent" v-tippy key="times-circle"> <fa-icon :icon="['fas', 'times-circle']" /> </span> <!-- messageStatus finalizador -->
13
+ <span class="card-check red" v-else-if="messageStatus == 'T'" :content="tooltipContent" v-tippy key="hourglass"> <fa-icon :icon="['fas', 'hourglass']" /> </span> <!-- Status finalizador -->
14
+ </transition>
15
+ </div>
16
+ </template>
17
+
18
+ <script>
19
+ export default {
20
+ props: {
21
+ hasReply: {
22
+ type: Boolean
23
+ },
24
+ messageStatus: {
25
+ type: String
26
+ },
27
+ replyMessage: {
28
+ type: String
29
+ },
30
+ tooltipContent: {
31
+ type: String
32
+ }
33
+ }
34
+ }
35
+ </script>
@@ -0,0 +1,213 @@
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>
118
+
119
+ <style>
120
+ .file-item {
121
+ width: 100%;
122
+ height: 100%;
123
+ display: flex;
124
+ justify-content: center;
125
+ align-items: center;
126
+ position: relative;
127
+ }
128
+ .file-item-transition {
129
+ max-width: 100%;
130
+ max-height: 100%;
131
+ display: flex;
132
+ justify-content: center;
133
+ align-items: center;
134
+ position: relative;
135
+ }
136
+ .file-item .req-loader {
137
+ position: absolute;
138
+ top: calc(50% - 12.5px);
139
+ right: calc(50% - 12.5px);
140
+ }
141
+ .file-item-transition img {
142
+ max-width: 45px;
143
+ max-height: 45px;
144
+ }
145
+ .file-item a {
146
+ margin-left: 5px;
147
+ text-decoration: none;
148
+ color: #333;
149
+ }
150
+
151
+ .file-icon {
152
+ display: flex;
153
+ justify-content: center;
154
+ align-items: center;
155
+ font-size: 30px;
156
+ cursor: pointer;
157
+ }
158
+ .file-icon:hover {
159
+ opacity: 1
160
+ }
161
+ .file-icon:visited {
162
+ color: inherit;
163
+ }
164
+ svg {
165
+ font-size: 30px;
166
+ z-index: 1;
167
+ }
168
+ .file-icon.pdf {
169
+ position: relative;
170
+ }
171
+ .file-icon.pdf svg {
172
+ color: rgb(231, 76, 60);
173
+ }
174
+ .file-icon.pdf::after {
175
+ content: "";
176
+ position: absolute;
177
+ bottom: 2px;
178
+ transform: translateY(2px);
179
+ width: 20px;
180
+ height: 20px;
181
+ background-color: #FFF;
182
+ }
183
+ .file-icon.doc {
184
+ color: #15517F;
185
+ }
186
+ .file-icon.doc::after {
187
+ content: "";
188
+ position: absolute;
189
+ width: 20px;
190
+ height: 20px;
191
+ background-color: #FFF;
192
+ }
193
+ .file-img {
194
+ display: flex;
195
+ justify-content: center;
196
+ align-items: center;
197
+ width: 100%;
198
+ height: 100%;
199
+ overflow: hidden;
200
+ background-color: rgba(0, 0, 0, .2);
201
+ border-radius: 2.5px;
202
+ cursor: pointer;
203
+ opacity: .9;
204
+ transition: opacity 150ms;
205
+ }
206
+
207
+ .file-img:hover {
208
+ opacity: 1;
209
+ }
210
+ .file-img img {
211
+ width: 95%;
212
+ }
213
+ </style>