vue-intergrall-plugins 0.0.153 → 0.0.156

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.153",
3
+ "version": "0.0.156",
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
  }
@@ -5,7 +5,7 @@
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>
@@ -36,7 +36,7 @@
36
36
  @open-image="openImage"
37
37
  />
38
38
  <MultipleFilePreview
39
- v-else
39
+ v-else-if="fileSettings.multiple && showFilePreview"
40
40
  :dictionary="dictionary"
41
41
  :file="file"
42
42
  :fileFormatError="fileFormatError"
@@ -108,6 +108,10 @@ export default {
108
108
  cssStyle: {
109
109
  type: Object,
110
110
  required: false
111
+ },
112
+ hasButtonFiles: {
113
+ type: Boolean,
114
+ required: false
111
115
  }
112
116
  },
113
117
  data() {
@@ -132,7 +136,7 @@ export default {
132
136
  },
133
137
  methods: {
134
138
  openFilesByClip(){
135
- if(this.fileSettings.multiple){
139
+ if(this.fileSettings.multiple && !this.hasButtonFiles){
136
140
  return this.openSelectFileHandler('both')
137
141
  }
138
142
  return this.toggleFiles()
@@ -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
  },
@@ -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,17 +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"
62
69
  @open-file-system="openFileSystem"
63
70
  />
64
71
  <BtnExpand
65
72
  v-show="buttons.hasExpand && !audioFile"
73
+ :ref="`${textId}-expand`"
66
74
  @expand-textarea="$emit('expand-textarea')"
67
75
  :dictionary="dictionary"
68
76
  />
69
77
  </div>
70
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>
71
96
  </div>
72
97
  </template>
73
98
 
@@ -82,9 +107,11 @@ import RemainingCharacters from "./RemainingCharacters"
82
107
  import BtnMic from "./BtnMic"
83
108
  import BtnFiles from "./BtnFiles"
84
109
  import BtnExpand from "./BtnExpand"
110
+ import BtnStandardMessages from "./BtnStandardMessages"
111
+ import StandardMessages from "./StandardMessages"
85
112
 
86
113
  export default {
87
- components: { BtnEmojis, Loader, BtnMic, BtnFiles, BtnExpand, RemainingCharacters },
114
+ components: { BtnEmojis, Loader, BtnMic, BtnFiles, BtnExpand, RemainingCharacters, BtnStandardMessages, StandardMessages },
88
115
  mixins: [ clickaway ],
89
116
  props: {
90
117
  buttons: {
@@ -109,7 +136,7 @@ export default {
109
136
  },
110
137
  formattedMessageSettings: {
111
138
  type: Object,
112
- default: () => { return { hasHsm: false, msgType: 0 } },
139
+ default: () => { return { hasStandardMessages: false, msgType: 0, token_cliente: "" } },
113
140
  required: false
114
141
  },
115
142
  fileSettings: {
@@ -134,6 +161,10 @@ export default {
134
161
  dictionary: {
135
162
  type: Object,
136
163
  required: true
164
+ },
165
+ hasButtonFiles: {
166
+ type: Boolean,
167
+ required: false
137
168
  }
138
169
  },
139
170
  data() {
@@ -146,7 +177,9 @@ export default {
146
177
  isDoc: false,
147
178
  fileFormatError: false,
148
179
  audioFile: "",
149
- audioSource: ""
180
+ audioSource: "",
181
+ showStandardMessages: false,
182
+ messageType: 1
150
183
  }
151
184
  },
152
185
  created() {
@@ -156,7 +189,7 @@ export default {
156
189
  setResizeListeners(this.$el, ".js-autoresize", ".js-parentresize")
157
190
 
158
191
  // this.$root.$on("drop-file", (file, type) => { if(this.buttons.hasFiles) this.fileUpload(file, type, true) })
159
- // this.$root.$on("toggle-msg-formatada", () => { this.toggleHSM() })
192
+ // this.$root.$on("toggle-msg-formatada", () => { this.toggleStandardMessages() })
160
193
  // this.$root.$on("textarea-focus", () => { this.focusTextarea() })
161
194
  // this.$root.$on("resize-footer-template", () => { this.adjustChatHeight() })
162
195
  // this.$root.$on("clear-footer-message", () => { this.message = "" })
@@ -397,6 +430,25 @@ export default {
397
430
  console.error(e)
398
431
  }
399
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
+ },
400
452
  },
401
453
  destroyed() {
402
454
  // this.$root.$off("drop-file")