vue-intergrall-plugins 0.0.4 → 0.0.8

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.
@@ -1,35 +1,32 @@
1
1
  <template>
2
- <div class="templates-container" :class="{'text-footer-template' : footerStyle}" v-if="templates && identifier">
3
- <div class="options-container">
2
+ <div class="tg-container" v-if="templates && identifier">
3
+ <div class="tg-options" :class="{'column' : columnSelect}">
4
4
  <h4> Template: </h4>
5
- <div class="select-container">
6
- <v-select
7
- :class="{'template-select' : !smartStyle, 'sm__select' : smartStyle}"
8
- appendToBody
9
- :calculatePosition="calculateSelectPosition"
10
- :options="templateOptions"
11
- :value="codTemplate"
12
- :reduce="template => template.cod"
13
- :clearable="false"
14
- @input="setTemplate"
15
- :getOptionLabel="template => template.label">
16
- <div slot="no-options" v-text="dictionary.msg_sem_resultados"></div>
17
- </v-select>
18
- </div>
5
+ <v-select
6
+ class="tg-select"
7
+ appendToBody
8
+ :calculatePosition="calculateSelectPosition"
9
+ :options="templateOptions"
10
+ :value="codTemplate"
11
+ :reduce="template => template.cod"
12
+ :clearable="false"
13
+ @input="setTemplate"
14
+ :getOptionLabel="template => template.label">
15
+ <div slot="no-options" v-text="dictionary.msg_sem_resultados"></div>
16
+ </v-select>
19
17
  </div>
20
18
  <template v-if="selectedTemplate">
21
- <div class="template-field" v-if="selectedTemplate.components">
22
- <TemplateSingle :template="selectedTemplate" @set-vars="setFinalMessage" :hasButton="hasButton" :iconButton="iconButton" @click-trigger="$emit('click-trigger')" :smartStyle="smartStyle" :identifier="identifier" :allVariables="allVariables" :dictionary="dictionary" />
19
+ <div class="tg-component" v-if="selectedTemplate.components">
20
+ <TemplateSingle :template="selectedTemplate" @set-vars="setFinalMessage" :hasButton="hasButton" :iconButton="iconButton" @click-trigger="$emit('click-trigger')" :identifier="identifier" :allVariables="allVariables" :dictionary="dictionary" />
23
21
  </div>
24
- <div class="template-field" v-else>
25
- <TemplateMessage @final-message="setMessage" :smartStyle="smartStyle" :hasButton="hasButton" :iconButton="iconButton" @click-trigger="$emit('click-trigger', true)" :dictionary="dictionary" />
22
+ <div class="tg-component" v-else>
23
+ <TemplateMessage @final-message="setMessage" :hasButton="hasButton" :iconButton="iconButton" @click-trigger="$emit('click-trigger', true)" :dictionary="dictionary" />
26
24
  </div>
27
25
  </template>
28
26
  </div>
29
27
  </template>
30
28
 
31
29
  <script>
32
- /*eslint no-mixed-spaces-and-tabs: ["error", "smart-tabs"]*/
33
30
  import { createPopper } from "@popperjs/core"
34
31
  import TemplateSingle from "./TemplateSingle"
35
32
  import TemplateMessage from "./TemplateMessage"
@@ -46,19 +43,11 @@
46
43
  required: false,
47
44
  default: true
48
45
  },
49
- smartStyle: {
50
- type: Boolean,
51
- required: false
52
- },
53
- adjustBoxOnSelect: {
54
- type: Boolean,
55
- required: false
56
- },
57
- adjustChatOnSelect: {
46
+ columnSelect: {
58
47
  type: Boolean,
59
48
  required: false
60
49
  },
61
- footerStyle: {
50
+ resizeParentOnSelect: {
62
51
  type: Boolean,
63
52
  required: false
64
53
  },
@@ -164,8 +153,7 @@
164
153
  }
165
154
  },
166
155
  adjustOnSelect() {
167
- if(this.adjustBoxOnSelect) if(this.$root.$refs.boxFlutuante) this.$root.$refs.boxFlutuante.setBoxPosition()
168
- if(this.adjustChatOnSelect) this.$emit("adjust-chat")
156
+ if(this.resizeParentOnSelect) this.$emit("resize-parent")
169
157
  },
170
158
  setFinalMessage(vars) {
171
159
  const keys = Object.keys(vars),
@@ -205,6 +193,7 @@
205
193
  })
206
194
  }
207
195
  }
196
+
208
197
  this.$emit("template-data", this.selectedTemplate)
209
198
  },
210
199
  setMessage(message) {
@@ -215,180 +204,137 @@
215
204
  </script>
216
205
 
217
206
  <style>
218
- .toasted svg {
219
- margin-right: 10px; }
220
-
221
- .d-none {
222
- display: none; }
207
+ * { box-sizing: border-box; }
208
+ .toasted svg { margin-right: 10px }
209
+ .d-none { display: none }
210
+ ul { list-style-type: none }
211
+ h1, h2, h3, h4, p { margin: 0; padding: 0 }
223
212
 
224
- ul {
225
- list-style-type: none; }
226
-
227
- .templates-container {
213
+ .tg-container {
214
+ width: 100%;
228
215
  display: flex;
229
216
  flex-direction: column;
230
217
  overflow-x: hidden;
231
218
  overflow-y: auto;
232
- padding: 0 5px;
219
+ }
220
+
221
+ .tg-options {
222
+ width: 100%;
223
+ display: flex;
224
+ }
225
+ .tg-options.column {
226
+ flex-direction: column;
227
+ }
228
+ .tg-options h4 {
229
+ margin-right: 5px;
230
+ }
231
+
232
+ .tg-select {
233
+ flex: 1;
234
+ height: 34px;
235
+ overflow: hidden;
236
+ }
237
+ .tg-select .vs__dropdown-toggle {
238
+ background-color: #FFF;
239
+ height: 34px;
240
+ overflow: hidden;
241
+ display: flex;
242
+ align-items: center;
243
+ }
244
+ .tg-select .vs__selected-options {
245
+ height: 34px;
246
+ overflow: hidden;
247
+ }
248
+ .tg-select .vs__selected-options > span {
249
+ white-space: nowrap;
250
+ text-overflow: ellipsis;
251
+ flex: 1;
252
+ }
253
+
254
+ .vs__dropdown-option {
255
+ transition: background-color 150ms;
256
+ white-space: normal;
257
+ }
258
+ .vs__dropdown-option:nth-child(odd) {
259
+ background-color: #F1F1F1;
260
+ }
261
+ .vs__dropdown-option:hover, .vs__dropdown-option:focus, .vs__dropdown-option:active, .vs__dropdown-option:focus, .vs__dropdown-option--selected, .vs__dropdown-option--highlight {
262
+ background-color: #5897fb!important;
263
+ color: #FFF;
264
+ }
265
+
266
+ .tg-component {
233
267
  width: 100%;
234
- height: auto;
235
- min-height: 50%;
236
- max-height: calc(100% - 24px); }
237
- .templates-container.text-footer-template {
238
- padding: 0;
239
- margin-top: 10px; }
240
- .templates-container.text-footer-template .options-container {
241
- display: flex;
242
- flex-wrap: wrap;
243
- font-size: .8rem; }
244
- .templates-container.text-footer-template .options-container h4 {
245
- width: 100%;
246
- margin-left: 0;
247
- padding: 5px 0 0 0; }
248
- .templates-container.text-footer-template .template-content {
249
- flex: 2 !important;
250
- padding-bottom: 0 !important; }
251
- .templates-container .options-container {
252
- width: 100%;
253
- display: flex;
254
- align-items: center;
255
- overflow: hidden;
256
- padding: 3px 0;
257
- min-height: 35px; }
258
- .templates-container .options-container h4 {
259
- white-space: nowrap;
260
- text-overflow: ellipsis;
261
- overflow: hidden;
262
- margin: 0 5px 0 0;
263
- z-index: 1; }
264
- .templates-container hr {
265
- border: unset;
266
- height: 1px;
267
- background-color: #CCC;
268
- margin: 2.5px 0; }
269
- .templates-container .template-field {
270
- width: 100%; }
271
- .templates-container .template-field .template-single {
272
- width: 100%;
273
- display: flex;
274
- justify-content: space-between; }
275
- .templates-container .template-field .template-content {
276
- font-size: .7rem;
277
- padding: 10px 0;
278
- flex: 1; }
279
- .templates-container .template-field .template-content header {
280
- padding: 3px 5px;
281
- border-top-left-radius: 5px;
282
- border-top-right-radius: 5px;
283
- background-color: #dff0d8;
284
- border-top: 1px solid #CCC;
285
- border-right: 1px solid #CCC;
286
- border-left: 1px solid #CCC; }
287
- .templates-container .template-field .template-content header p {
288
- font-weight: 600; }
289
- .templates-container .template-field .template-content section {
290
- line-height: 25px;
291
- padding: 3px 5px;
292
- border-left: 1px solid #CCC;
293
- border-right: 1px solid #CCC;
294
- background-color: #dff0d8; }
295
- .templates-container .template-field .template-content section.margin-bottom {
296
- border-bottom-left-radius: 5px;
297
- border-bottom-right-radius: 5px;
298
- border-bottom: 1px solid #CCC; }
299
- .templates-container .template-field .template-content footer {
300
- padding: 3px 5px;
301
- background-color: #dff0d8;
302
- border: 1px solid #CCC;
303
- border-top: unset;
304
- border-bottom-left-radius: 5px;
305
- border-bottom-right-radius: 5px; }
306
- .templates-container .template-field .template-content input {
307
- border: 1px solid transparent;
308
- outline: 0;
309
- font-size: .8rem;
310
- padding: 2.5px 5px;
311
- background-color: #FFF; }
312
- .templates-container .template-field .template-content input::placeholder {
313
- color: #bbb; }
314
- .templates-container .template-field .template-content input.active {
315
- border: 1px solid #007bff; }
316
- .templates-container .template-field .template-content input.invalid {
317
- border: 1px solid #E74C3C !important; }
318
- .templates-container .template-field .template-content .text-footer {
319
- height: 4rem;
320
- width: 90%; }
321
- .templates-container .template-field .template-content .text-footer textarea {
322
- height: 3rem;
323
- min-height: auto;
324
- max-height: 4rem;
325
- width: 90%; }
326
- .templates-container .template-field .template-content .emoji-mart {
327
- top: -30px !important;
328
- left: 30px !important; }
329
- .templates-container .template-field .template-content .sm__template {
330
- display: flex; }
331
- .templates-container .template-field .template-btn {
332
- width: 40%;
333
- display: flex;
334
- justify-content: center;
335
- align-items: center; }
336
- .templates-container .template-field .template-btn button {
337
- outline: unset;
338
- border: unset;
339
- display: block;
340
- min-width: 180px;
341
- height: 35px;
342
- padding: 0 10px;
343
- font-weight: 500;
344
- background-color: #007bff;
345
- color: #FFF;
346
- transition-duration: 300ms;
347
- user-select: none;
348
- cursor: pointer;
349
- box-shadow: inset 0 -2px rgba(0, 0, 0, 0.2);
350
- opacity: 0.9;
351
- border-radius: 25px; }
352
- .templates-container .template-field .template-btn button:hover {
353
- opacity: 1; }
354
- .templates-container .template-field .template-btn button:active {
355
- opacity: 1;
356
- box-shadow: inset 0 -1px rgba(0, 0, 0, 0.2);
357
- -webkit-transform: translateY(1px);
358
- -moz-transform: translateY(1px);
359
- -o-transform: translateY(1px);
360
- -ms-transform: translateY(1px);
361
- transform: translateY(1px); }
362
- .templates-container .template-field .template-btn button:focus, .templates-container .template-field .template-btn button:active {
363
- outline: unset; }
364
- .templates-container .template-field .template-btn.small-btn {
365
- width: auto;
366
- margin-left: 5px; }
367
- .templates-container .template-field .template-btn.small-btn button {
368
- min-width: 35px;
369
- width: 35px;
370
- padding: 0;
371
- display: flex;
372
- justify-content: center;
373
- align-items: center; }
268
+ }
374
269
 
375
- .select-container {
270
+ .ts-container {
271
+ width: 100%;
376
272
  display: flex;
377
- flex: 1; }
378
- .select-container .template-select {
379
- flex: 1; }
273
+ justify-content: space-between;
274
+ }
380
275
 
381
- .vs__dropdown-menu {
382
- overflow-x: hidden;
383
- overflow-y: auto; }
384
- .vs__dropdown-menu .vs__dropdown-option {
385
- white-space: normal; }
276
+ .ts-content {
277
+ --border-color: #CCC;
278
+ --background-color: #DFF0D8;
279
+ --input-background-color: #FFF;
280
+ --input-border-default: #007BFF;
281
+ --input-border-error: #E74C3C;
282
+ --placeholder-color: #BBB;
386
283
 
387
- .template-var {
388
- display: inline;
389
- position: relative; }
284
+ flex: 2;
285
+ font-size: .7rem;
286
+ padding: 10px 0;
287
+ }
288
+ .ts-content header, .ts-content section, .ts-content footer {
289
+ padding: 3px 5px;
290
+ background-color: var(--background-color);
291
+ }
292
+ .ts-content header, .ts-content section {
293
+ border-right: 1px solid var(--border-color);
294
+ border-left: 1px solid var(--border-color);
295
+ }
296
+ .ts-content header {
297
+ border-top-left-radius: 5px;
298
+ border-top-right-radius: 5px;
299
+ border-top: 1px solid var(--border-color);
300
+ }
301
+ .ts-content header { font-weight: 550 }
302
+ .ts-content section {
303
+ line-height: 25px;
304
+ }
305
+ .ts-content section.margin-bottom {
306
+ border-bottom-left-radius: 5px;
307
+ border-bottom-right-radius: 5px;
308
+ border-bottom: 1px solid var(--border-color);
309
+ }
310
+ .ts-content footer {
311
+ border: 1px solid var(--border-color);
312
+ border-top: unset;
313
+ border-bottom-left-radius: 5px;
314
+ border-bottom-right-radius: 5px;
315
+ }
316
+ .ts-content input {
317
+ border: 1px solid transparent;
318
+ outline: 0;
319
+ font-size: .8rem;
320
+ padding: 2.5px 5px;
321
+ background-color: var(--input-background-color);
322
+ }
323
+ .ts-content input::placeholder {
324
+ color: var(--placeholder-color);
325
+ }
326
+ .ts-content input.active, .ts-content input:focus{
327
+ border: 1px solid var(--input-border-default);
328
+ }
329
+ .ts-content input.invalid {
330
+ border: 1px solid var(--input-border-error)!important;
331
+ }
332
+ .ts-content__var {
333
+ display: inline-block;
334
+ position: relative;
335
+ }
390
336
 
391
- .var-list-dropdown {
337
+ .ts-dropdown {
392
338
  margin: 0;
393
339
  padding: 0;
394
340
  position: absolute;
@@ -402,21 +348,89 @@ ul {
402
348
  opacity: 0;
403
349
  list-style-type: none;
404
350
  border: 1px solid #444;
405
- border-top: unset; }
406
- .var-list-dropdown li {
407
- width: 100%;
408
- opacity: .9;
409
- cursor: pointer;
410
- font-weight: 550;
411
- padding: 2px 5px;
412
- transition: background-color 150ms; }
413
- .var-list-dropdown li:hover, .var-list-dropdown li:focus-within, .var-list-dropdown li:focus {
414
- opacity: 1;
415
- background-color: #555;
416
- color: #FFF; }
417
-
418
- .var-list-dropdown.visible {
351
+ border-top: unset;
352
+ }
353
+ .ts-dropdown li {
354
+ width: 100%;
355
+ opacity: .9;
356
+ cursor: pointer;
357
+ font-weight: 550;
358
+ padding: 2px 5px;
359
+ transition: background-color 150ms;
360
+ }
361
+ .ts-dropdown li:hover, .ts-dropdown li:focus-within, .ts-dropdown li:focus {
362
+ opacity: 1;
363
+ background-color: #555;
364
+ color: #FFF;
365
+ }
366
+ .ts-dropdown.visible {
419
367
  visibility: visible;
420
- opacity: 1; }
368
+ opacity: 1;
369
+ }
370
+ .tg-btn {
371
+ width: 40%;
372
+ display: flex;
373
+ justify-content: center;
374
+ align-items: center;
375
+ }
376
+ .tg-btn button {
377
+ outline: unset;
378
+ border: unset;
379
+ display: block;
380
+ min-width: 180px;
381
+ height: 35px;
382
+ padding: 0 10px;
383
+ font-weight: 500;
384
+ background-color: #007bff;
385
+ color: #FFF;
386
+ transition-duration: 300ms;
387
+ user-select: none;
388
+ cursor: pointer;
389
+ box-shadow: inset 0 -2px rgba(0, 0, 0, 0.2);
390
+ opacity: 0.9;
391
+ border-radius: 25px;
392
+ }
393
+ .tg-btn button:hover {
394
+ opacity: 1;
395
+ }
396
+ .tg-btn button:active {
397
+ opacity: 1;
398
+ box-shadow: inset 0 -1px rgba(0, 0, 0, 0.2);
399
+ -webkit-transform: translateY(1px);
400
+ -moz-transform: translateY(1px);
401
+ -o-transform: translateY(1px);
402
+ -ms-transform: translateY(1px);
403
+ transform: translateY(1px);
404
+ }
405
+ .tg-btn button:active {
406
+ opacity: 1;
407
+ box-shadow: inset 0 -1px rgba(0, 0, 0, 0.2);
408
+ -webkit-transform: translateY(1px);
409
+ -moz-transform: translateY(1px);
410
+ -o-transform: translateY(1px);
411
+ -ms-transform: translateY(1px);
412
+ transform: translateY(1px);
413
+ }
414
+ .tg-btn button:focus, .tg-btn button:active {
415
+ outline: unset;
416
+ }
417
+ .tg-btn.small-btn {
418
+ width: auto;
419
+ margin-left: 5px;
420
+ }
421
+ .tg-btn.small-btn button {
422
+ min-width: 35px;
423
+ width: 35px;
424
+ padding: 0;
425
+ display: flex;
426
+ justify-content: center;
427
+ align-items: center;
428
+ }
429
+
430
+ .tm-container {
431
+ border: 1px solid var(--border-color);
432
+ border-radius: 5px;
433
+ display: flex;
434
+ }
421
435
 
422
436
  </style>
@@ -1,7 +1,7 @@
1
1
  <template>
2
- <div class="template-single">
3
- <div class="template-content">
4
- <section :class="{ 'sm__template': smartStyle }">
2
+ <div class="ts-container">
3
+ <div class="ts-content">
4
+ <section :class="{'tm-container' : hasButton}">
5
5
  <TextFooter
6
6
  :textId="'var_1'"
7
7
  width="full"
@@ -10,11 +10,12 @@
10
10
  @final-message="preencherMensagem"
11
11
  :placeholderMessage="'Escreva sua mensagem'"
12
12
  :ignoreHideTextarea="true"
13
+ :dictionary="dictionary"
13
14
  ></TextFooter>
14
- <div class="template-btn" :class="{'small-btn' : iconButton}" v-if="hasButton">
15
+ <div class="tg-btn" :class="{'small-btn' : iconButton}" v-if="hasButton">
15
16
  <button @click="sendMessage">
16
17
  <template v-if="!iconButton"> {{ dictionary.btn_contatar_clientes }} </template>
17
- <font-awesome-icon v-else :icon="['fas', 'paper-plane']"></font-awesome-icon>
18
+ <fa-icon v-else :icon="['fas', 'paper-plane']" />
18
19
  </button>
19
20
  </div>
20
21
  </section>
@@ -33,10 +34,6 @@ export default {
33
34
  };
34
35
  },
35
36
  props: {
36
- smartStyle: {
37
- type: Boolean,
38
- required: false,
39
- },
40
37
  hasButton: {
41
38
  type: Boolean,
42
39
  required: false
@@ -69,13 +66,6 @@ export default {
69
66
  elem.classList.toggle("active");
70
67
  }
71
68
  }
72
- },
73
- isValid(textValue) {
74
- const regex =
75
- /^[ ?????�����??��?���?��??????�������?���?��???��??\w?-�\r\n()[\]{}.,:;@??�????!&?�`�=%^*+\-$|/]+$/;
76
- const value = textValue ? textValue.trim("") : "";
77
-
78
- return regex.test(value);
79
69
  }
80
70
  }
81
71
  };