@tagplus/components 4.7.12 → 5.1.0

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.
Files changed (88) hide show
  1. package/dist/tp.common.js +2 -1
  2. package/dist/tp.common.js.LICENSE.txt +9 -0
  3. package/dist/tp.common.js.map +1 -1
  4. package/dist/tp.common.lang-tp-en-js.js +2 -0
  5. package/dist/tp.common.lang-tp-en-js.js.map +1 -0
  6. package/dist/tp.css +11 -167
  7. package/dist/tp.umd.js +2 -1
  8. package/dist/tp.umd.js.LICENSE.txt +9 -0
  9. package/dist/tp.umd.js.map +1 -1
  10. package/dist/tp.umd.lang-tp-en-js.js +2 -0
  11. package/dist/tp.umd.lang-tp-en-js.js.map +1 -0
  12. package/dist/tp.umd.min.js +2 -1
  13. package/dist/tp.umd.min.js.LICENSE.txt +9 -0
  14. package/dist/tp.umd.min.js.map +1 -1
  15. package/dist/tp.umd.min.lang-tp-en-js.js +2 -0
  16. package/dist/tp.umd.min.lang-tp-en-js.js.map +1 -0
  17. package/package.json +51 -50
  18. package/src/assets/scss/_fonts.scss +24 -23
  19. package/src/assets/scss/_helpers.scss +4 -0
  20. package/src/assets/scss/_mixins.scss +2 -2
  21. package/src/assets/scss/_overrides.scss +5 -52
  22. package/src/assets/scss/_resass.scss +21 -12
  23. package/src/assets/scss/_variables.scss +0 -1
  24. package/src/assets/scss/index.scss +1 -4
  25. package/src/components/Autosuggest/Autosuggest.vue +340 -767
  26. package/src/components/Autosuggest/Multisuggest.vue +22 -0
  27. package/src/components/Autosuggest/autosuggest-props.js +210 -0
  28. package/src/components/Autosuggest/autosuggest-style.scss +127 -0
  29. package/src/components/Autosuggest/core.js +63 -0
  30. package/src/components/Autosuggest/index.js +2 -0
  31. package/src/components/Autosuggest/multisuggest-props.js +9 -0
  32. package/src/components/Autosuggest/option.vue +136 -0
  33. package/src/components/Autosuggest/select-dropdown.vue +64 -0
  34. package/src/components/Autosuggest/useOption.js +120 -0
  35. package/src/components/Autosuggest/useSelect.js +1133 -0
  36. package/src/components/AutosuggestTest.vue +56 -0
  37. package/src/components/CardExemplo.vue +49 -0
  38. package/src/components/CodeSample.vue +78 -0
  39. package/src/components/Inline/Inline.vue +24 -32
  40. package/src/components/InputNumber/InputNumber.vue +329 -378
  41. package/src/components/InputNumber/input-number.js +135 -0
  42. package/src/components/Loader/Loader.vue +42 -53
  43. package/src/components/Loader/animations.scss +13 -0
  44. package/src/components/Money/Money.vue +11 -20
  45. package/src/components/Multisuggest/index.js +2 -3
  46. package/src/components/MultisuggestTest.vue +56 -0
  47. package/src/components/OptionsList/OptionsList.vue +7 -6
  48. package/src/components/OptionsListItem/OptionsListItem.vue +46 -42
  49. package/src/components/Percent/Percent.vue +8 -14
  50. package/src/components/Skeleton/Skeleton.vue +16 -11
  51. package/src/components/Step/Step.vue +42 -35
  52. package/src/components/Steps/Steps.vue +4 -7
  53. package/src/components/TesteToCurrency.vue +171 -0
  54. package/src/components/Tip/Tip.vue +45 -30
  55. package/src/components/ValueSelector.vue +60 -0
  56. package/src/components/autosuggestMixin.js +301 -0
  57. package/src/components/index.js +4 -1
  58. package/src/locale/i18n.js +162 -0
  59. package/src/locale/lang/en.js +3 -2
  60. package/src/locale/lang/pt-br.js +3 -2
  61. package/src/main.js +8 -14
  62. package/src/mixins/floatFormatter.js +12 -16
  63. package/src/plugins/currency.js +100 -0
  64. package/src/utils/browser.js +6 -0
  65. package/src/utils/constants.js +3 -0
  66. package/src/utils/error.js +22 -0
  67. package/src/utils/filters.js +1 -14
  68. package/src/utils/helpers.js +41 -0
  69. package/src/utils/i18n.js +2 -0
  70. package/src/utils/icon.js +35 -0
  71. package/src/utils/index.js +20 -0
  72. package/src/utils/objects.js +17 -0
  73. package/src/utils/runtime.js +86 -0
  74. package/src/utils/scroll.js +100 -0
  75. package/src/utils/strings.js +17 -0
  76. package/src/utils/style.js +80 -0
  77. package/src/utils/types.js +39 -0
  78. package/src/utils/use-derived-namespace.js +112 -0
  79. package/src/utils/use-form-common-props.js +41 -0
  80. package/src/utils/use-form-item.js +80 -0
  81. package/src/utils/use-id.js +40 -0
  82. package/src/utils/use-input.js +33 -0
  83. package/src/components/Dialog/Dialog.vue +0 -253
  84. package/src/components/Dialog/index.js +0 -3
  85. package/src/components/Multisuggest/Multisuggest.vue +0 -858
  86. package/src/locale/index.js +0 -78
  87. package/src/mixins/locale.js +0 -9
  88. package/src/utils/currency.js +0 -180
@@ -1,7 +1,11 @@
1
1
  <template>
2
2
  <li
3
3
  :id="id"
4
- :class="['tp-options-list-item', itemType, active == optValue ? 'active' : '']"
4
+ :class="[
5
+ 'tp-options-list-item',
6
+ itemType,
7
+ active === optValue ? 'active' : '',
8
+ ]"
5
9
  tabindex="0"
6
10
  @click="updateOption"
7
11
  @keyup.enter="updateOption"
@@ -9,10 +13,7 @@
9
13
  <div :class="['icon', direction]">
10
14
  <em :class="[icon, 'options-icon']" />
11
15
  <p class="text">
12
- <span
13
- v-for="(text, index) in texts"
14
- :key="index"
15
- >
16
+ <span v-for="(text, index) in texts" :key="index">
16
17
  {{ text }}
17
18
  </span>
18
19
  </p>
@@ -22,7 +23,8 @@
22
23
  </template>
23
24
 
24
25
  <script>
25
- export default {
26
+ import { defineComponent } from 'vue'
27
+ export default defineComponent({
26
28
  name: 'TpOptionsListItem',
27
29
  props: {
28
30
  itemType: {
@@ -70,13 +72,14 @@ export default {
70
72
  default: ''
71
73
  }
72
74
  },
75
+ emits: ['input', 'updateValor'],
73
76
  methods: {
74
77
  updateOption () {
75
78
  this.$emit('updateValor', this.optValue)
76
79
  this.$emit('input', this.optValue)
77
80
  }
78
81
  }
79
- }
82
+ })
80
83
  </script>
81
84
 
82
85
  <style lang="scss" scoped>
@@ -118,7 +121,7 @@ export default {
118
121
  }
119
122
  }
120
123
 
121
- &:focus{
124
+ &:focus {
122
125
  border: 1px solid #437cf9;
123
126
  }
124
127
 
@@ -126,33 +129,25 @@ export default {
126
129
  color: #565b66;
127
130
  display: flex;
128
131
  align-items: center;
132
+
129
133
  // text-align: center;
130
134
  transition: color 150ms ease-in-out;
131
135
  line-height: 1.75em;
132
136
  min-width: 120px;
133
137
 
134
- &.horizontal {
135
- justify-content: space-around;
136
- min-width: 130px;
137
-
138
- .text {
139
- text-align: center;
140
- width: 70px;
141
-
142
- span {
143
- &:first-child {
144
- font-weight: $bold;
145
- }
146
- }
138
+ .text {
139
+ span {
140
+ display: block;
147
141
  }
142
+ }
148
143
 
149
- .options-icon {
150
- font-size: 47px;
151
- }
144
+ .options-icon {
145
+ font-size: 24px;
152
146
  }
153
147
 
154
148
  &.vertical {
155
149
  flex-direction: column;
150
+
156
151
  .text {
157
152
  span {
158
153
  font-size: 14px;
@@ -164,28 +159,37 @@ export default {
164
159
  }
165
160
  }
166
161
 
167
- .text {
168
- span {
169
- display: block;
162
+ &.horizontal {
163
+ justify-content: space-around;
164
+ min-width: 130px;
165
+
166
+ .text {
167
+ text-align: center;
168
+ width: 70px;
169
+
170
+ span {
171
+ &:first-child {
172
+ font-weight: $bold;
173
+ }
174
+ }
170
175
  }
171
- }
172
176
 
173
- .options-icon {
174
- font-size: 24px;
177
+ .options-icon {
178
+ font-size: 47px;
179
+ }
175
180
  }
176
181
  }
177
-
178
182
  }
179
183
 
180
- .option-item-badge{
181
- background-color: #F56C6C;
182
- border: 1px solid #FFF;
183
- position: absolute;
184
- top: 0;
185
- transform: translateY(-50%) translateX(100%);
186
- height: 12px;
187
- width: 12px;
188
- right: 5px;
189
- border-radius: 50%;
190
- }
184
+ .option-item-badge {
185
+ background-color: #f56c6c;
186
+ border: 1px solid #fff;
187
+ position: absolute;
188
+ top: 0;
189
+ transform: translateY(-50%) translateX(100%);
190
+ height: 12px;
191
+ width: 12px;
192
+ right: 5px;
193
+ border-radius: 50%;
194
+ }
191
195
  </style>
@@ -2,36 +2,30 @@
2
2
  <el-input
3
3
  :id="`${_id}`"
4
4
  class="tp-percent"
5
- :value="formattedValue"
5
+ :model-value="formattedValue"
6
6
  v-bind="$attrs"
7
7
  :maxlength="maxlength"
8
8
  @input="input"
9
9
  @change="handleChange"
10
10
  @focus="$event.target.select()"
11
11
  >
12
- <template
13
- v-if="!removePrepend"
14
- slot="prepend"
15
- >
12
+ <template v-if="!removePrepend" #prepend>
16
13
  %
17
14
  </template>
18
- <template
19
- v-if="showAppend"
20
- slot="append"
21
- >
15
+ <template v-if="showAppend" #append>
22
16
  %
23
17
  </template>
24
18
  </el-input>
25
19
  </template>
26
20
 
27
21
  <script>
28
- import Locale from 'tp-ui/mixins/locale'
22
+ import { defineComponent } from 'vue'
29
23
  import floatFormatterMixin from 'tp-ui/mixins/floatFormatter'
30
24
 
31
- export default {
25
+ export default defineComponent({
32
26
  name: 'TpPercent',
33
-
34
- mixins: [Locale, floatFormatterMixin],
27
+ mixins: [floatFormatterMixin],
28
+ inheritAttrs: false,
35
29
  props: {
36
30
  id: {
37
31
  type: String,
@@ -69,7 +63,7 @@ export default {
69
63
  return this.id || this.$options.name
70
64
  }
71
65
  }
72
- }
66
+ })
73
67
  </script>
74
68
 
75
69
  <style lang="scss" scoped>
@@ -3,7 +3,7 @@
3
3
  <span
4
4
  v-for="item in count"
5
5
  :key="item"
6
- :class="{'circle':circle}"
6
+ :class="{ circle: circle }"
7
7
  :style="`--duration:${duration}; --item:${item}; width: ${cWidth}; height: ${cHeight}`"
8
8
  >
9
9
  &nbsp;
@@ -12,12 +12,13 @@
12
12
  </template>
13
13
 
14
14
  <script>
15
+ import { defineComponent } from 'vue'
15
16
  /**
16
17
  * Placeholder de elemententos enquanto estão sendo carregados.
17
18
  * Exibe retângulos e circulos para mostrar ao usuario a estrutura dos dados que serão exibidos.
18
19
  * `<tp-skeleton />`
19
20
  */
20
- export default {
21
+ export default defineComponent({
21
22
  name: 'TpSkeleton',
22
23
  props: {
23
24
  /**
@@ -84,14 +85,15 @@ export default {
84
85
  return `${this.height}em`
85
86
  }
86
87
  }
87
- }
88
+ })
88
89
  </script>
89
90
 
90
91
  <style lang="scss" scoped>
91
- @keyframes skeleton{
92
+ @keyframes skeleton {
92
93
  0% {
93
94
  background-position: -200px 0;
94
95
  }
96
+
95
97
  100% {
96
98
  background-position: calc(200px + 100%) 0;
97
99
  }
@@ -101,15 +103,19 @@ export default {
101
103
  display: block;
102
104
  height: 100%;
103
105
 
106
+ /* stylelint-disable-next-line custom-property-pattern */
104
107
  --baseColor: #ebeef2;
105
108
 
106
109
  span {
107
- background-color: var(--baseColor);
110
+ /* stylelint-disable-next-line custom-property-pattern */
111
+ $base-color: var(--baseColor);
112
+
113
+ background-color: var($base-color);
108
114
  background-image: linear-gradient(
109
115
  90deg,
110
- var(--baseColor),
111
- mix($--color-white, $--border-color-light, 70%),
112
- var(--baseColor)
116
+ var($base-color),
117
+ color-mix($--color-white, $--border-color-light, 70%),
118
+ var($base-color)
113
119
  );
114
120
  background-size: 200px 100%;
115
121
  background-repeat: no-repeat;
@@ -120,18 +126,17 @@ export default {
120
126
  margin-bottom: 3px;
121
127
  width: 100%;
122
128
  min-height: 15px;
123
-
124
129
  animation-name: skeleton;
125
130
  animation-duration: calc(var(--duration) * 1s);
126
131
  animation-timing-function: ease-in-out;
127
132
  animation-iteration-count: infinite;
133
+
128
134
  // animation-delay: calc(var(--item) * 300ms);
129
135
 
130
- &.circle{
136
+ &.circle {
131
137
  width: inherit;
132
138
  border-radius: 50%;
133
139
  }
134
140
  }
135
141
  }
136
-
137
142
  </style>
@@ -6,7 +6,8 @@
6
6
  !isSimple && `is-${$parent.direction}`,
7
7
  isSimple && 'is-simple',
8
8
  isLast && !space && !isCenter && 'is-flex',
9
- isCenter && !isVertical && !isSimple && 'is-center']"
9
+ isCenter && !isVertical && !isSimple && 'is-center',
10
+ ]"
10
11
  >
11
12
  <!-- icon & line -->
12
13
  <div
@@ -18,6 +19,7 @@
18
19
  :style="isLast ? '' : { marginRight: $parent.stepOffset + 'px' }"
19
20
  >
20
21
  <em class="el-step__line-inner" :style="lineStyle" />
22
+
21
23
  </div>
22
24
 
23
25
  <div class="el-step__icon" :class="`is-${icon ? 'icon' : 'text'}`">
@@ -32,28 +34,22 @@
32
34
  </slot>
33
35
  <em
34
36
  v-else
35
- :class="['el-icon-' + (currentStatus === 'success' ? 'check' : 'close')]"
37
+ :class="[
38
+ 'el-icon-' + (currentStatus === 'success' ? 'check' : 'close'),
39
+ ]"
36
40
  class="el-step__icon-inner is-status"
37
41
  />
38
42
  </div>
39
43
  </div>
40
44
  <!-- title & description -->
41
45
  <div class="el-step__main">
42
- <div
43
- ref="title"
44
- class="el-step__title"
45
- :class="['is-' + currentStatus]"
46
- >
46
+ <div ref="title" class="el-step__title" :class="['is-' + currentStatus]">
47
47
  <slot name="title">
48
48
  {{ title }}
49
49
  </slot>
50
50
  </div>
51
51
  <div v-if="isSimple" class="el-step__arrow" />
52
- <div
53
- v-else
54
- class="el-step__description"
55
- :class="['is-' + currentStatus]"
56
- >
52
+ <div v-else class="el-step__description" :class="['is-' + currentStatus]">
57
53
  <slot name="description">
58
54
  {{ description }}
59
55
  </slot>
@@ -61,8 +57,11 @@
61
57
  </div>
62
58
  </div>
63
59
  </template>
60
+
64
61
  <script>
65
- export default {
62
+ import { defineComponent } from 'vue'
63
+
64
+ export default defineComponent({
66
65
  name: 'TpStep',
67
66
 
68
67
  props: {
@@ -119,7 +118,10 @@ export default {
119
118
  return this.$parent.steps.length
120
119
  },
121
120
  space () {
122
- const { isSimple, $parent: { space } } = this
121
+ const {
122
+ isSimple,
123
+ $parent: { space }
124
+ } = this
123
125
 
124
126
  return isSimple ? '' : space
125
127
  },
@@ -128,20 +130,21 @@ export default {
128
130
  const parent = this.$parent
129
131
  const len = parent.steps.length
130
132
 
131
- const space = (typeof this.space === 'number'
132
- ? `${this.space }px`
133
- : this.space
134
- ? this.space
135
- : `${100 / (len - (this.isCenter ? 0 : 1)) }%`)
133
+ const space =
134
+ typeof this.space === 'number'
135
+ ? `${this.space}px`
136
+ : this.space
137
+ ? this.space
138
+ : `${100 / (len - (this.isCenter ? 0 : 1))}%`
136
139
 
137
140
  style.flexBasis = space
138
141
 
139
142
  if (this.isVertical) return style
140
143
 
141
144
  if (this.isLast) {
142
- style.maxWidth = `${100 / this.stepsCount }%`
145
+ style.maxWidth = `${100 / this.stepsCount}%`
143
146
  } else {
144
- style.marginRight = `${-this.$parent.stepOffset }px`
147
+ style.marginRight = `${-this.$parent.stepOffset}px`
145
148
  }
146
149
 
147
150
  return style
@@ -153,14 +156,13 @@ export default {
153
156
  this.updateStatus(this.$parent.active)
154
157
  this.internalStatus = this.status
155
158
  }
156
-
157
159
  },
158
160
 
159
161
  beforeCreate () {
160
162
  this.$parent.steps.push(this)
161
163
  },
162
164
 
163
- beforeDestroy () {
165
+ beforeUnmount () {
164
166
  const steps = this.$parent.steps
165
167
  const index = steps.indexOf(this)
166
168
 
@@ -172,11 +174,15 @@ export default {
172
174
  mounted () {
173
175
  const unwatch = this.$watch('index', () => {
174
176
  this.$watch('$parent.active', this.updateStatus, { immediate: true })
175
- this.$watch('$parent.processStatus', () => {
176
- const activeIndex = this.$parent.active
177
-
178
- this.updateStatus(activeIndex)
179
- }, { immediate: true })
177
+ this.$watch(
178
+ '$parent.processStatus',
179
+ () => {
180
+ const activeIndex = this.$parent.active
181
+
182
+ this.updateStatus(activeIndex)
183
+ },
184
+ { immediate: true }
185
+ )
180
186
  unwatch()
181
187
  })
182
188
  },
@@ -202,29 +208,30 @@ export default {
202
208
  let step = 100
203
209
  const style = {}
204
210
 
205
- style.transitionDelay = `${150 * this.index }ms`
211
+ style.transitionDelay = `${150 * this.index}ms`
206
212
 
207
213
  // if (status === this.$parent.processStatus) {
208
214
  // step = this.currentStatus !== 'error' ? 0 : 0
209
215
  // } else
210
216
  if (status === 'wait') {
211
217
  step = 0
212
- style.transitionDelay = `${-50 * this.index }ms`
218
+ style.transitionDelay = `${-50 * this.index}ms`
213
219
  }
214
220
 
215
221
  style.borderWidth = step && !this.isSimple ? '1px' : 0
216
222
  this.$parent.direction === 'vertical'
217
- ? style.height = `${step }%`
218
- : style.width = `${step }%`
223
+ ? (style.height = `${step}%`)
224
+ : (style.width = `${step}%`)
219
225
 
220
226
  this.lineStyle = style
221
227
  }
222
228
  }
223
- }
229
+ })
224
230
  </script>
231
+
225
232
  <style lang="scss" scoped>
226
233
  .el-step__head.is-process {
227
- color: #2d6eda;
228
- border-color: #2d6eda;
234
+ color: #2d6eda;
235
+ border-color: #2d6eda;
229
236
  }
230
237
  </style>
@@ -1,7 +1,8 @@
1
1
  <script>
2
- import { Steps } from 'element-ui'
2
+ import { defineComponent } from 'vue'
3
+ import { ElSteps as Steps } from 'element-plus'
3
4
 
4
- export default {
5
+ export default defineComponent({
5
6
  name: 'TpSteps',
6
7
  extends: Steps,
7
8
  props: {
@@ -10,9 +11,5 @@ export default {
10
11
  default: false
11
12
  }
12
13
  }
13
- }
14
-
14
+ })
15
15
  </script>
16
-
17
- <style lang="scss" scoped>
18
- </style>
@@ -0,0 +1,171 @@
1
+ <template>
2
+ <div>
3
+ Começo do teste com {{ decimais }} casas decimais, até o número {{ limite }}, com o locale atual {{ $t('locale.prefix') }}.
4
+ <div v-if="ready">
5
+ <div v-if="listaErros.length">
6
+ Acabou o teste com erros, log:
7
+ </div>
8
+ <div v-else>
9
+ Acabou o teste sem erros
10
+ </div>
11
+ <div
12
+ v-for="(message, key) in listaErros"
13
+ :key="key"
14
+ >
15
+ {{ message }}
16
+ </div>
17
+ </div>
18
+ <el-button
19
+ v-if="!start"
20
+ type="primary"
21
+ size="default"
22
+ @click="startTest"
23
+ >
24
+ Start
25
+ </el-button>
26
+ </div>
27
+ </template>
28
+
29
+ <script>
30
+ import { defineComponent } from 'vue'
31
+ // import { toCurrency } from 'tp-ui/utils/filters'
32
+
33
+ export default defineComponent({
34
+ name: 'TesteToCurrency',
35
+ // filters: { toCurrency },
36
+
37
+ data () {
38
+ return {
39
+ start: false,
40
+ ready: false,
41
+ listaErros: [],
42
+ testeFixo: [1000, 0, 0.1, 0.2, 0.01],
43
+ max: 10000,
44
+ decimais: 2,
45
+ limiteErros: 100
46
+ }
47
+ },
48
+
49
+ computed: {
50
+ divisorDecimais () {
51
+ return Math.pow(10, this.decimais)
52
+ },
53
+
54
+ limite () {
55
+ return this.max * this.divisorDecimais
56
+ }
57
+ },
58
+
59
+ mounted () {
60
+ for (let i = 0; i < this.testeFixo.length; i++) {
61
+ const res = this.testeNum(this.testeFixo[i])
62
+
63
+ if (res !== true) {
64
+ this.listaErros.push(res)
65
+ }
66
+ }
67
+
68
+ this.ready = true
69
+ },
70
+
71
+ methods: {
72
+ toCurrency (val) {
73
+ if (val === '') {
74
+ return val
75
+ }
76
+
77
+ try {
78
+ let with2Decimals = val.toString().match(/^-?\d+(?:\.\d{0,2})?/)[0]
79
+
80
+ with2Decimals = Number(with2Decimals).toLocaleString(this.$t('locale.prefix'), {
81
+ minimumFractionDigits: 2,
82
+ maximumFractionDigits: 2
83
+ })
84
+
85
+ return with2Decimals
86
+ } catch (Exception) {
87
+ return val.toLocaleString(this.$t('locale.prefix'), {
88
+ minimumFractionDigits: 2,
89
+ maximumFractionDigits: 2
90
+ })
91
+ }
92
+ },
93
+
94
+ reverseString (str) {
95
+ return str.split('').reverse().join('')
96
+ },
97
+
98
+ startTest () {
99
+ this.ready = true
100
+ this.listaErros = []
101
+ this.start = false
102
+
103
+ for (let i = 0; i < this.limite && this.listaErros.length < this.limiteErros; i++) {
104
+ const num = i / this.divisorDecimais
105
+ const res = this.testeNum(num)
106
+
107
+ if (res !== true) {
108
+ this.listaErros.push(res)
109
+ }
110
+ }
111
+
112
+ this.ready = true
113
+ },
114
+
115
+ addThousandsSeparator (number) {
116
+ const numStr = number.toString()
117
+ const parts = numStr.split(this.$t('locale.number.decimal'))
118
+
119
+ const integerPart = parts[0]
120
+ let formattedInteger = ''
121
+
122
+ // Insert commas for thousands separation
123
+ for (let i = 0; i < integerPart.length; i++) {
124
+ if (i > 0 && (integerPart.length - i) % 3 === 0) {
125
+ formattedInteger += this.$t('locale.number.thousands')
126
+ }
127
+ formattedInteger += integerPart[i]
128
+ }
129
+
130
+ if (parts.length === 2) {
131
+ const decimalPart = parts[1]
132
+ return formattedInteger + ',' + decimalPart
133
+ } else {
134
+ return formattedInteger
135
+ }
136
+ },
137
+
138
+ testeNum (num) {
139
+ const newNum = `${this.toCurrency(num) }`
140
+
141
+ let numF = (`${num }`).substring(0, newNum.length)
142
+ let i = ''
143
+ if (this.$t('locale.number.decimal') === '.') {
144
+ i = this.reverseString(numF).indexOf('.')
145
+ }
146
+ if (this.$t('locale.number.decimal') === ',') {
147
+ numF = numF.replace('.', ',')
148
+ i = this.reverseString(numF).indexOf(',')
149
+ }
150
+
151
+ if (i === -1) {
152
+ numF += `${ this.$t('locale.number.decimal') + '00' }`
153
+ } else if (i !== 2) {
154
+ const qntZeros = Math.abs(i - 2)
155
+ if (qntZeros > 0) {
156
+ numF += '0'.repeat(qntZeros)
157
+ }
158
+ }
159
+ if (numF.split(this.$t('locale.number.decimal'))[0].length >= 4) {
160
+ numF = this.addThousandsSeparator(numF)
161
+ }
162
+
163
+ if (numF !== newNum) {
164
+ return `errado | ${ num } | ${ newNum}`
165
+ }
166
+
167
+ return true
168
+ }
169
+ }
170
+ })
171
+ </script>