vue-intergrall-plugins 0.0.151 → 0.0.155

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.151",
3
+ "version": "0.0.155",
4
4
  "description": "",
5
5
  "main": "dist/vue-intergrall-plugins.ssr.js",
6
6
  "browser": "dist/vue-intergrall-plugins.esm.js",
@@ -19,7 +19,6 @@
19
19
  "build:es": "cross-env NODE_ENV=production rollup --config build/rollup.config.js --format es",
20
20
  "build:unpkg": "cross-env NODE_ENV=production rollup --config build/rollup.config.js --format iife"
21
21
  },
22
- "dependencies": {},
23
22
  "devDependencies": {
24
23
  "@babel/core": "^7.15.5",
25
24
  "@babel/preset-env": "^7.15.6",
@@ -43,14 +42,14 @@
43
42
  "vue-template-compiler": "^2.6.14"
44
43
  },
45
44
  "peerDependencies": {
46
- "vue": "^2.6.14",
47
45
  "@fortawesome/fontawesome-free": "^5.15.4",
48
46
  "@fortawesome/fontawesome-svg-core": "^1.2.36",
49
47
  "@fortawesome/free-solid-svg-icons": "^5.15.4",
50
48
  "@fortawesome/vue-fontawesome": "^2.0.2",
51
- "@popperjs/core": "^2.10.2",
49
+ "@popperjs/core": "^2.11.2",
52
50
  "core-js": "^3.18.1",
53
51
  "postcss": "^8.3.8",
52
+ "vue": "^2.6.14",
54
53
  "vue-clickaway": "^2.2.2",
55
54
  "vue-select": "^3.13.0",
56
55
  "vue-tippy": "^4.12.0",
@@ -59,5 +58,8 @@
59
58
  },
60
59
  "engines": {
61
60
  "node": ">=12"
61
+ },
62
+ "dependencies": {
63
+ "axios": "^0.26.0"
62
64
  }
63
65
  }
@@ -1,17 +1,20 @@
1
1
  <template>
2
- <span class="text-footer-actions--btn" :class="{'files-activated' : openFiles || file.length}" @click="fileSettings.multiple ? openSelectFileHandler('both') : toggleFiles">
2
+ <span class="text-footer-actions--btn" :class="{'files-activated' : openFiles || file.length}" @click="openFilesByClip()">
3
3
  <transition name="fade">
4
4
  <span v-if="file.length" class="files-counter" v-text="file.length" @click.stop="toggleFilePreview" :title="dictionary.msg_abrir_anexos"></span>
5
5
  </transition>
6
6
  <fa-icon :icon="['fas', 'paperclip']" :title="dictionary.title_selecionar_anexo" />
7
7
  <transition name="show">
8
- <div v-if="openFiles" class="text-footer-files-container" :class="{'horizontal' : cssStyle.outsideButtons}">
8
+ <div v-if="openFiles && hasButtonFiles" class="text-footer-files-container" :class="{'horizontal' : cssStyle.outsideButtons}">
9
9
  <div class="files-btn images" :class="{'margin-bottom' : cssStyle.outsideButtons}" :title="dictionary.title_anexo_img" @click="openSelectFileHandler('img')">
10
10
  <fa-icon :icon="['fas', 'image']" />
11
11
  </div>
12
12
  <div class="files-btn docs" :title="dictionary.title_anexo_doc" @click="openSelectFileHandler('doc')">
13
13
  <fa-icon :icon="['fas', 'file-alt']" />
14
14
  </div>
15
+ <div class="files-btn system" :title="dictionary.title_anexo_sistema" @click="openSelectFileHandler('system')">
16
+ <fa-icon :icon="['fas', 'server']" />
17
+ </div>
15
18
  </div>
16
19
  </transition>
17
20
  <div class="files-pointers d-none">
@@ -22,7 +25,7 @@
22
25
  <transition name="fade">
23
26
  <div class="text-footer-preview-container" @click.stop v-show="showFilePreview" :class="[previewContainerClass]" v-on-clickaway="away">
24
27
  <SingleFilePreview
25
- v-if="!fileSettings.multiple"
28
+ v-if="!fileSettings.multiple && showFilePreview"
26
29
  :dictionary="dictionary"
27
30
  :file="file"
28
31
  :isDoc="isDoc"
@@ -33,7 +36,7 @@
33
36
  @open-image="openImage"
34
37
  />
35
38
  <MultipleFilePreview
36
- v-else
39
+ v-else-if="fileSettings.multiple && showFilePreview"
37
40
  :dictionary="dictionary"
38
41
  :file="file"
39
42
  :fileFormatError="fileFormatError"
@@ -105,6 +108,10 @@ export default {
105
108
  cssStyle: {
106
109
  type: Object,
107
110
  required: false
111
+ },
112
+ hasButtonFiles: {
113
+ type: Boolean,
114
+ required: false
108
115
  }
109
116
  },
110
117
  data() {
@@ -128,6 +135,12 @@ export default {
128
135
  }
129
136
  },
130
137
  methods: {
138
+ openFilesByClip(){
139
+ if(this.fileSettings.multiple && !this.hasButtonFiles){
140
+ return this.openSelectFileHandler('both')
141
+ }
142
+ return this.toggleFiles()
143
+ },
131
144
  away() {
132
145
  this.showFilePreview = false
133
146
  },
@@ -135,6 +148,7 @@ export default {
135
148
  this.openFiles = !this.openFiles
136
149
  },
137
150
  openSelectFileHandler(type) {
151
+ if(type == "system"){ this.$emit("open-file-system", true); return false }
138
152
  const fileInput = document.querySelector(`#${type}-${this.textId}`)
139
153
  if(fileInput) fileInput.click()
140
154
  if(!fileInput) if (!document.querySelector(".toasted.toasted-primary.error")) this.$toasted.global.defaultError()
@@ -0,0 +1,17 @@
1
+ <template>
2
+ <div class="text-footer-actions--btn" @click="$emit('toggle-standard-messages')" :title="dictionary.title_msg_formatada">
3
+ <fa-icon :icon="['fas', 'comment']" />
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ props: {
10
+ dictionary: {
11
+ type: Object,
12
+ default: {},
13
+ required: false
14
+ }
15
+ }
16
+ }
17
+ </script>
@@ -70,7 +70,7 @@ export default {
70
70
  },
71
71
  props: {
72
72
  dictionary: { type: Object, required: true },
73
- file: { type: Array, required: true },
73
+ file: { type: File, required: true },
74
74
  fileFormatError: { type: Boolean, required: false },
75
75
  validFileFormats: { type: String, required: false, default: "" }
76
76
  },
@@ -24,7 +24,7 @@
24
24
  export default {
25
25
  props: {
26
26
  dictionary: { type: Object, required: true },
27
- file: { type: File, required: true },
27
+ file: { type: File, required: false },
28
28
  isDoc: { type: Boolean, required: false },
29
29
  fileFormatError: { type: Boolean, required: false },
30
30
  validFileFormats: { type: String, required: false, default: "" },
@@ -0,0 +1,208 @@
1
+ <template>
2
+ <div class="text-footer-hsm-container">
3
+ <v-select
4
+ appendToBody
5
+ :calculatePosition="calculateSelectPosition"
6
+ :style="`background-color: ${backgroundColor}`"
7
+ class="text-footer-v-select"
8
+ :options="formatted_messages_1"
9
+ label="value"
10
+ v-model="key_1"
11
+ :reduce="formatted_messages_1 => formatted_messages_1.cod"
12
+ @input="key_1 ? receiveValueFormattedMessage(key_1, 2) : false"
13
+ >
14
+ <div slot="no-options"> {{ dictionary.msg_sem_resultados }} </div>
15
+ </v-select>
16
+ <v-select
17
+ v-if="formatted_messages_2.length && key_1"
18
+ :style="`background-color: ${backgroundColor}`"
19
+ appendToBody
20
+ :calculatePosition="calculateSelectPosition"
21
+ class="text-footer-v-select"
22
+ :options="formatted_messages_2"
23
+ label="value"
24
+ v-model="key_2"
25
+ :reduce="formatted_messages_2 => formatted_messages_2.cod"
26
+ @input="receiveValueFormattedMessage(key_2, 3)"
27
+ >
28
+ <div slot="no-options"> {{ dictionary.msg_sem_resultados }} </div>
29
+ </v-select>
30
+ <div class="text-footer-select-03" v-if="formatted_messages_3.length && key_2">
31
+ <v-select
32
+ :style="`background-color: ${backgroundColor}`"
33
+ appendToBody
34
+ :calculatePosition="calculateSelectPosition"
35
+ class="text-footer-v-select"
36
+ :options="formatted_messages_3"
37
+ label="value"
38
+ :clearable="false"
39
+ @input="openMsg()"
40
+ v-model="key_3"
41
+ >
42
+ <div slot="no-options"> {{ dictionary.msg_sem_resultados }} </div>
43
+ </v-select>
44
+ <template v-if="key_3.cod">
45
+ <span class="text-footer--btn-select-03" v-if="messageType == 1" :title="dictionary.title_btn_preencher_msg_formatada" @click="insertFormattedMessage(key_3)">
46
+ <fa-icon :icon="['fas', 'level-up-alt']" />
47
+ </span>
48
+ <span class="text-footer--btn-select-03" v-else-if="messageType == 2" :title="dictionary.title_btn_abrir_msg_tipo_2" @click="openFormattedMsgType2(key_3)">
49
+ <fa-icon :icon="['fas', 'file-alt']" />
50
+ </span>
51
+ </template>
52
+ </div>
53
+ </div>
54
+ </template>
55
+
56
+ <script>
57
+
58
+ import { createPopper } from "@popperjs/core"
59
+ import { standardMessages } from "../../services/standardMessages"
60
+
61
+ export default {
62
+ mixins: [standardMessages],
63
+ props: {
64
+ dictionary: {
65
+ type: Object,
66
+ default: {},
67
+ required: false
68
+ },
69
+ backgroundColor: {
70
+ type: String,
71
+ default: '#fff',
72
+ required: false
73
+ },
74
+ token_cliente: {
75
+ type: String,
76
+ default: '',
77
+ required: false
78
+ },
79
+ message: {
80
+ type: String,
81
+ default: '',
82
+ required: false
83
+ },
84
+ messageType: {
85
+ type: [Number, String],
86
+ default: 1,
87
+ required: false
88
+ }
89
+ },
90
+ data() {
91
+ return {
92
+ placement: "top",
93
+ firstMount: true,
94
+ formatted_messages_1: [{ cod: "T", value: "Todos" }],
95
+ key_1: "T",
96
+ formatted_messages_2: [],
97
+ key_2: "",
98
+ formatted_messages_3: [],
99
+ key_3: ""
100
+ }
101
+ },
102
+ mounted() {
103
+ this.receiveValueFormattedMessage(this.key_1, 2)
104
+ },
105
+ methods: {
106
+ calculateSelectPosition(dropdownList, component, sizes) {
107
+ dropdownList.style.width = sizes.width
108
+ const popper = createPopper(component.$refs.toggle, dropdownList, {
109
+ placement: this.placement
110
+ })
111
+ return () => popper.destroy()
112
+ },
113
+ receiveValueFormattedMessage(cod, selectionIndex) {
114
+ try {
115
+ if(!this.token_cliente) throw new Error("Informe token_cliente como chave na propriedade formattedMessageSettings que ocorre na chamada componente TextFooter ")
116
+ if(this.firstMount) {
117
+ cod = `${this.key_1}/${cod}`
118
+ this.firstMount = false
119
+ }
120
+ this.getStandardMessages(cod, this.token_cliente).then((data) => {
121
+ if(data && typeof(data) == 'string') return this.$toasted.global.emConstrucao({msg: data})
122
+ if(data) return this.showFormattedMessage(data, selectionIndex)
123
+ this.$toasted.global.defaultError()
124
+ }).catch(e => { console.error("Error in getStandardMessages: ", e) })
125
+ }catch(e) {
126
+ console.error("Error in receiveValueFormattedMessage: ", e)
127
+ }
128
+ },
129
+ showFormattedMessage(messageData, selectionIndex) {
130
+ try {
131
+ let success = false
132
+ if(Array.isArray(messageData)) success = true
133
+ if(!success) this.$toasted.global.emConstrucao({ msg: messageData ? messageData.msg : "Nao foi possível obter mensagens" })
134
+
135
+ switch (selectionIndex) {
136
+ case 2:
137
+ if(!success){
138
+ this.formatted_messages_2.push(messageData)
139
+ this.key_2 = this.formatted_messages_2[0]
140
+ }else{
141
+ this.formatted_messages_2 = messageData
142
+ if(this.formatted_messages_2.length == 1) {
143
+ if(this.formatted_messages_2[0].cod) {
144
+ this.key_2 = this.formatted_messages_2[0].cod
145
+ this.receiveValueFormattedMessage(this.key_2, 3)
146
+ }
147
+ }
148
+ }
149
+ break
150
+ case 3:
151
+ if(!success) {
152
+ this.formatted_messages_3.push(messageData)
153
+ this.$toasted.global.emConstrucao({msg: this.dictionary.msg_erro_sem_msg_formatada})
154
+ this.$emit("close-blocker-standard-message")
155
+ }else{
156
+ if(!messageData.length){
157
+ this.formatted_messages_3.push(this.dictionary.msg_erro_sem_msg_formatada)
158
+ this.key_3 = this.formatted_messages_3[0]
159
+ }else{
160
+ this.formatted_messages_3 = messageData
161
+ if(this.formatted_messages_3.length == 1) {
162
+ if(this.formatted_messages_3[0].cod) {
163
+ this.key_3 = this.formatted_messages_3[0]
164
+ }
165
+ }
166
+ }
167
+ }
168
+ break
169
+ default:
170
+ console.error("Error in showFormattedMessage: selectionIndex not found")
171
+ break
172
+ }
173
+
174
+ }catch(e) {
175
+ console.error("Error in showFormattedMessage: ", e)
176
+ }
177
+ },
178
+ openMsg() {
179
+ try {
180
+ this.messageType == 1 ? this.insertFormattedMessage(this.key_3) : this.openFormattedMsgType2(this.key_3)
181
+ }catch(e) {
182
+ console.error("Error in openMsg: ", e)
183
+ }
184
+ },
185
+ openFormattedMsgType2(key) {
186
+ try {
187
+ if(!key || !this.key_2) return
188
+ this.$emit("open-blocker-standard-message")
189
+ key = key.cod
190
+ this.$emit("set-standard-infos", { category: this.key_2, subject: key })
191
+ }catch(e) {
192
+ console.error("Error in openFormattedMsgType2: ", e)
193
+ }
194
+ },
195
+ insertFormattedMessage(key) {
196
+ try {
197
+ if(!key) return this.$toasted.global.defaultError({msg: 'Selecione uma mensagem'})
198
+ if(!key.cod) throw new Error("Chave informada no parametro nao possue codigo")
199
+ const { value } = key
200
+ const finalMessage = `${this.message}${this.message && !this.message.endsWith(" ") ? ` ${value}` : value}`
201
+ return value ? this.$emit("add-standard-message", finalMessage) : this.$toasted.global.emConstrucao({msg: 'Mensagem vazia'})
202
+ }catch(e) {
203
+ console.error("Erro ao inserir mensagem formatada: ", e)
204
+ }
205
+ }
206
+ }
207
+ }
208
+ </script>
@@ -21,8 +21,8 @@
21
21
  :disabled="textareaSettings.disabled"
22
22
  :placeholder="textareaSettings.placeholderMessage"
23
23
  @input="sendFinalMessage"
24
- @keydown.up="toggleHSM"
25
- @keydown.down="toggleHSM"
24
+ @keydown.up="toggleStandardMessages"
25
+ @keydown.down="toggleStandardMessages"
26
26
  @keydown.esc="closeEmojis"
27
27
  @keydown.enter="sendMessageHandler"
28
28
  @paste="pasteImage"
@@ -50,6 +50,12 @@
50
50
  @set-audio="setAudio"
51
51
  :ref="`${textId}-mic`"
52
52
  />
53
+ <BtnStandardMessages
54
+ v-show="formattedMessageSettings.hasStandardMessages"
55
+ :dictionary="dictionary"
56
+ :ref="`${textId}-standard-messages`"
57
+ @toggle-standard-messages="toggleStandardMessages"
58
+ />
53
59
  <BtnFiles
54
60
  v-show="buttons.hasFiles && !audioFile"
55
61
  :textId="textId"
@@ -57,16 +63,36 @@
57
63
  :fileSettings="fileSettings"
58
64
  :cssStyle="cssStyle"
59
65
  :ref="`${textId}-file`"
66
+ :hasButtonFiles="hasButtonFiles"
60
67
  @set-file-vars="setFileVars"
61
68
  @open-image="openImage"
69
+ @open-file-system="openFileSystem"
62
70
  />
63
71
  <BtnExpand
64
72
  v-show="buttons.hasExpand && !audioFile"
73
+ :ref="`${textId}-expand`"
65
74
  @expand-textarea="$emit('expand-textarea')"
66
75
  :dictionary="dictionary"
67
76
  />
68
77
  </div>
69
78
  </div>
79
+ <transition name="fade">
80
+ <StandardMessages
81
+ v-if="showStandardMessages"
82
+ :class="cssStyle.width ? cssStyle.width: ''"
83
+ :dictionary="dictionary"
84
+ :backgroundColor="cssStyle.backgroundColor"
85
+ :token_cliente="formattedMessageSettings.token_cliente ? formattedMessageSettings.token_cliente : ''"
86
+ :message="message"
87
+ :messageType="messageType"
88
+
89
+ @open-blocker-standard-message="openBlockerStandardMessage"
90
+ @close-blocker-standard-message="closeBlockerStandardMessage"
91
+ @set-message-type="setMessageType"
92
+ @set-standard-infos="setStandardInfos"
93
+ @add-standard-message="addStandardMessage"
94
+ />
95
+ </transition>
70
96
  </div>
71
97
  </template>
72
98
 
@@ -81,9 +107,11 @@ import RemainingCharacters from "./RemainingCharacters"
81
107
  import BtnMic from "./BtnMic"
82
108
  import BtnFiles from "./BtnFiles"
83
109
  import BtnExpand from "./BtnExpand"
110
+ import BtnStandardMessages from "./BtnStandardMessages"
111
+ import StandardMessages from "./StandardMessages"
84
112
 
85
113
  export default {
86
- components: { BtnEmojis, Loader, BtnMic, BtnFiles, BtnExpand, RemainingCharacters },
114
+ components: { BtnEmojis, Loader, BtnMic, BtnFiles, BtnExpand, RemainingCharacters, BtnStandardMessages, StandardMessages },
87
115
  mixins: [ clickaway ],
88
116
  props: {
89
117
  buttons: {
@@ -108,7 +136,7 @@ export default {
108
136
  },
109
137
  formattedMessageSettings: {
110
138
  type: Object,
111
- default: () => { return { hasHsm: false, msgType: 0 } },
139
+ default: () => { return { hasStandardMessages: false, msgType: 0, token_cliente: "" } },
112
140
  required: false
113
141
  },
114
142
  fileSettings: {
@@ -133,6 +161,10 @@ export default {
133
161
  dictionary: {
134
162
  type: Object,
135
163
  required: true
164
+ },
165
+ hasButtonFiles: {
166
+ type: Boolean,
167
+ required: false
136
168
  }
137
169
  },
138
170
  data() {
@@ -145,7 +177,9 @@ export default {
145
177
  isDoc: false,
146
178
  fileFormatError: false,
147
179
  audioFile: "",
148
- audioSource: ""
180
+ audioSource: "",
181
+ showStandardMessages: false,
182
+ messageType: 1
149
183
  }
150
184
  },
151
185
  created() {
@@ -155,7 +189,7 @@ export default {
155
189
  setResizeListeners(this.$el, ".js-autoresize", ".js-parentresize")
156
190
 
157
191
  // this.$root.$on("drop-file", (file, type) => { if(this.buttons.hasFiles) this.fileUpload(file, type, true) })
158
- // this.$root.$on("toggle-msg-formatada", () => { this.toggleHSM() })
192
+ // this.$root.$on("toggle-msg-formatada", () => { this.toggleStandardMessages() })
159
193
  // this.$root.$on("textarea-focus", () => { this.focusTextarea() })
160
194
  // this.$root.$on("resize-footer-template", () => { this.adjustChatHeight() })
161
195
  // this.$root.$on("clear-footer-message", () => { this.message = "" })
@@ -311,6 +345,9 @@ export default {
311
345
  openImage(imagePreview) {
312
346
  this.$emit("open-image", imagePreview)
313
347
  },
348
+ openFileSystem(status) {
349
+ this.$emit("open-file-system", status)
350
+ },
314
351
  setAudio(audioObj) {
315
352
  const { audioFile, audioSource } = audioObj
316
353
  this.audioFile = audioFile
@@ -393,6 +430,25 @@ export default {
393
430
  console.error(e)
394
431
  }
395
432
  },
433
+ toggleStandardMessages() {
434
+ this.showStandardMessages = !this.showStandardMessages
435
+ },
436
+ openBlockerStandardMessage() {
437
+ this.$emit("open-blocker-standard-message")
438
+ },
439
+ closeBlockerStandardMessage() {
440
+ this.$emit("close-blocker-standard-message")
441
+ },
442
+ setMessageType(type) {
443
+ this.messageType = type
444
+ },
445
+ setStandardInfos(infos) {
446
+ this.$emit("set-standard-infos", infos)
447
+ },
448
+ addStandardMessage(message) {
449
+ this.message = message
450
+ this.sendFinalMessage()
451
+ },
396
452
  },
397
453
  destroyed() {
398
454
  // this.$root.$off("drop-file")
@@ -615,7 +671,10 @@ ul {
615
671
  margin-right: unset;
616
672
  margin-bottom: 5px; }
617
673
  .text-footer-container .text-footer-files-container .files-btn.docs {
618
- background-color: #7986cb; }
674
+ background-color: #7986cb;
675
+ margin-right: 5px; }
676
+ .text-footer-container .text-footer-files-container .files-btn.system {
677
+ background-color: #49a349; }
619
678
  .text-footer-container .text-footer-preview-container {
620
679
  cursor: default;
621
680
  position: absolute;