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,59 +1,57 @@
1
1
  <template>
2
- <div class="template-single">
3
- <div class="template-content">
2
+ <div class="ts-container">
3
+ <div class="ts-content">
4
4
  <div v-for="(component, cIndex) in template.components" :key="cIndex">
5
5
  <header
6
6
  v-if="component.type === 'header'"
7
- :class="{ sm__template: smartStyle }"
8
7
  id="template_header"
9
8
  >
10
- <span v-for="(param, pIndex) in component.parameters" :key="pIndex">
9
+ <div v-for="(param, pIndex) in component.parameters" :key="pIndex">
11
10
  <template v-if="param.type === 'text'">
12
- <p
11
+ <div
13
12
  v-if="regexVars.test(param.text)"
14
13
  v-html="
15
14
  param.text.replace(
16
15
  regexVars,
17
- `<div class='template-var'>${htmlInputString}${varListValues}</div>`
16
+ `<div class='ts-content__var'>${htmlInputString}${varListValues}</div>`
18
17
  )
19
18
  "
20
- ></p>
19
+ ></div>
21
20
  <p v-else v-html="param.text"></p>
22
21
  </template>
23
- </span>
22
+ </div>
24
23
  </header>
25
24
  <section
26
25
  v-if="component.type === 'body'"
27
- :class="{ sm__template: smartStyle, 'margin-bottom' : template.components.length === 2 }"
26
+ :class="{'margin-bottom' : template.components.length === 2 }"
28
27
  id="template_body"
29
28
  >
30
- <span v-for="(param, pIndex) in component.parameters" :key="pIndex">
29
+ <div v-for="(param, pIndex) in component.parameters" :key="pIndex">
31
30
  <template v-if="param.type === 'text'">
32
- <p
31
+ <div
33
32
  v-if="regexVars.test(param.text)"
34
33
  v-html="
35
34
  param.text.replace(
36
35
  regexVars,
37
- `<div class='template-var'>${htmlInputString}${varListValues}</div>`
36
+ `<div class='ts-content__var'>${htmlInputString}${varListValues}</div>`
38
37
  )
39
38
  "
40
- ></p>
39
+ ></div>
41
40
  <p v-else v-html="param.text"></p>
42
41
  </template>
43
- </span>
42
+ </div>
44
43
  </section>
45
44
  <footer
46
45
  v-if="component.type == 'footer'"
47
- :class="{ sm__template: smartStyle }"
48
46
  id="template_footer"
49
47
  >
50
- <span v-for="(param, pIndex) in component.parameters" :key="pIndex">
48
+ <div v-for="(param, pIndex) in component.parameters" :key="pIndex">
51
49
  <small v-if="param.type == 'text'" v-html="param.text"> </small>
52
- </span>
50
+ </div>
53
51
  </footer>
54
52
  </div>
55
53
  </div>
56
- <div class="template-btn" :class="{'small-btn' : iconButton}" v-if="hasButton">
54
+ <div class="tg-btn" :class="{'small-btn' : iconButton}" v-if="hasButton">
57
55
  <button @click="$emit('click-trigger')">
58
56
  <template v-if="!iconButton"> {{ dictionary.btn_contatar_clientes }} </template>
59
57
  <fa-icon v-else :icon="['fas', 'paper-plane']" />
@@ -83,10 +81,6 @@ export default {
83
81
  required: false,
84
82
  default: true,
85
83
  },
86
- smartStyle: {
87
- type: Boolean,
88
- required: false,
89
- },
90
84
  allVariables: {
91
85
  type: Boolean,
92
86
  required: false,
@@ -135,14 +129,13 @@ export default {
135
129
  },
136
130
  getListOpts() {
137
131
  this.varListValues =
138
- `<ul class="var-list-dropdown">
132
+ `<ul class="ts-dropdown">
139
133
  <li> nome </li>
140
134
  ${this.allVariables ? '<li> telefone </li>' : ''}
141
135
  </ul>`
142
136
  },
143
137
  setInputs() {
144
138
  let qtdInputs = 0
145
-
146
139
  const header = document.querySelector("#template_header");
147
140
  const body = document.querySelector("#template_body");
148
141
  const footer = document.querySelector("#template_footer");
@@ -150,9 +143,7 @@ export default {
150
143
  header.querySelectorAll(`.input-var-${this.identifier}`).forEach((input) => { this.setEvent(input) })
151
144
  qtdInputs += header.querySelectorAll(`.input-var-${this.identifier}`).length
152
145
  }
153
- if (this.lastVar === 0) {
154
- this.lastVar += 1;
155
- }
146
+ if (this.lastVar === 0) this.lastVar += 1
156
147
  if (body !== null) {
157
148
  body.querySelectorAll(`.input-var-${this.identifier}`).forEach((input) => { this.setEvent(input) });
158
149
  qtdInputs += body.querySelectorAll(`.input-var-${this.identifier}`).length
@@ -163,12 +154,9 @@ export default {
163
154
  }
164
155
 
165
156
  if(qtdInputs === 1) {
166
- document.querySelector(`.input-var-${this.identifier}`).parentElement.parentElement.parentElement.style.width = "100%"
167
157
  document.querySelector(`.input-var-${this.identifier}`).parentElement.style.width = "100%"
168
158
  document.querySelector(`.input-var-${this.identifier}`).style.width = "100%"
169
- }
170
-
171
- if(qtdInputs === 0) {
159
+ }else if(qtdInputs === 0) {
172
160
  this.$emit("set-vars", this.template)
173
161
  }
174
162
  },
@@ -193,7 +181,7 @@ export default {
193
181
  })
194
182
  }
195
183
 
196
- const containerGeral = document.querySelector(".templates-container")
184
+ const containerGeral = document.querySelector(".tg-container")
197
185
  varList.classList.add("visible")
198
186
  const maxBottom = containerGeral.getBoundingClientRect().bottom,
199
187
  currentBottom = varList.getBoundingClientRect().bottom
@@ -235,10 +223,21 @@ export default {
235
223
  }
236
224
  },
237
225
  isValid(textValue) {
238
- const regex =
239
- /^[ ?????�����??��?���?��??????�������?���?��???��??\w?-�\r\n()[\]{}.,:;@??�????!&?�`�=%^*+\-$|/]+$/;
240
- const value = textValue ? textValue.trim("") : ""
241
- return regex.test(value);
226
+ const regex = {
227
+ htmlTags: /<\/?[\d\w\s=\-:\.\/\'\";]+>/gi,
228
+ enter: /\n/g,
229
+ consecutiveSpaces: /\s{3,}/g
230
+ }
231
+ const value = textValue ? textValue.trim("") : "";
232
+ if(!value.length) return false
233
+
234
+ let isValueValid = true
235
+ for(let key in regex) {
236
+ if(!isValueValid) return isValueValid
237
+ if(regex[key].test(value)) isValueValid = false
238
+ }
239
+
240
+ return isValueValid
242
241
  },
243
242
  setVar(event, key, notificar) {
244
243
  if (event && event.target) {
@@ -1,25 +0,0 @@
1
- <template>
2
- <div class="req-loader-container" :class="{'align-right' : alignRight, 'light-bg' : hasBg}">
3
- <div class="req-loader" :class="{'big' : size == 'big'}"></div>
4
- </div>
5
- </template>
6
-
7
- <script>
8
- export default {
9
- props: {
10
- hasBg: {
11
- type: Boolean,
12
- required: false
13
- },
14
- alignRight: {
15
- type: Boolean,
16
- required: false
17
- },
18
- size: {
19
- type: String,
20
- required: false,
21
- default: "small"
22
- }
23
- }
24
- }
25
- </script>