@tagplus/components 5.3.2 → 5.3.4

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 (203) hide show
  1. package/dist/demo.html +1 -0
  2. package/dist/fonts/bevi-bold.7e4dcd11.woff +0 -0
  3. package/dist/fonts/bevi-bold.873def84.woff2 +0 -0
  4. package/dist/fonts/bevi-medium.6187e050.woff2 +0 -0
  5. package/dist/fonts/bevi-medium.65b3056d.woff +0 -0
  6. package/dist/fonts/bevi-regular.c89f126e.woff +0 -0
  7. package/dist/fonts/bevi-regular.f81e4b8f.woff2 +0 -0
  8. package/dist/tp.common.js +2 -0
  9. package/dist/tp.common.js.map +1 -0
  10. package/dist/tp.css +167 -0
  11. package/dist/tp.umd.js +2 -0
  12. package/dist/tp.umd.js.map +1 -0
  13. package/dist/tp.umd.min.js +2 -0
  14. package/dist/tp.umd.min.js.map +1 -0
  15. package/package.json +61 -74
  16. package/src/assets/scss/_fonts.scss +27 -0
  17. package/src/assets/scss/_functions.scss +22 -0
  18. package/src/assets/scss/_helpers.scss +112 -0
  19. package/src/assets/scss/_mixins.scss +69 -0
  20. package/src/assets/scss/_overrides.scss +69 -0
  21. package/src/assets/scss/_resass.scss +83 -0
  22. package/src/assets/scss/_variables.scss +27 -0
  23. package/src/assets/scss/index.scss +11 -0
  24. package/src/components/Autosuggest/Autosuggest.vue +791 -0
  25. package/src/components/Autosuggest/index.js +3 -0
  26. package/src/components/Dialog/Dialog.vue +253 -0
  27. package/src/components/Dialog/index.js +3 -0
  28. package/src/components/Inline/Inline.vue +149 -0
  29. package/src/components/Inline/index.js +3 -0
  30. package/src/components/InputNumber/InputNumber.vue +430 -0
  31. package/src/components/InputNumber/index.js +3 -0
  32. package/src/components/Loader/Loader.vue +317 -0
  33. package/src/components/Loader/animations.scss +68 -0
  34. package/src/components/Loader/index.js +3 -0
  35. package/src/components/Money/Money.vue +82 -0
  36. package/src/components/Money/index.js +3 -0
  37. package/src/components/Multisuggest/Multisuggest.vue +858 -0
  38. package/src/components/Multisuggest/index.js +3 -0
  39. package/src/components/OptionsList/OptionsList.vue +61 -0
  40. package/src/components/OptionsList/index.js +3 -0
  41. package/src/components/OptionsListItem/OptionsListItem.vue +191 -0
  42. package/src/components/OptionsListItem/index.js +3 -0
  43. package/src/components/Percent/Percent.vue +81 -0
  44. package/src/components/Percent/index.js +3 -0
  45. package/src/components/Skeleton/Skeleton.vue +137 -0
  46. package/src/components/Skeleton/index.js +3 -0
  47. package/src/components/Step/Step.vue +230 -0
  48. package/src/components/Step/index.js +3 -0
  49. package/src/components/Steps/Steps.vue +18 -0
  50. package/src/components/Steps/index.js +3 -0
  51. package/src/components/Tip/Tip.vue +193 -0
  52. package/src/components/Tip/index.js +3 -0
  53. package/src/components/index.js +31 -0
  54. package/src/locale/index.js +78 -0
  55. package/{dist → src/locale}/lang/en.js +2 -3
  56. package/{dist → src/locale}/lang/pt-br.js +2 -3
  57. package/src/main.js +26 -0
  58. package/src/mixins/floatFormatter.js +53 -0
  59. package/src/mixins/locale.js +9 -0
  60. package/src/utils/currency.js +180 -0
  61. package/src/utils/filters.js +84 -0
  62. package/dist/es/_virtual/_plugin-vue_export-helper.mjs +0 -10
  63. package/dist/es/components.css +0 -2391
  64. package/dist/es/node_modules/@element-plus/icons-vue/dist/index.mjs +0 -148
  65. package/dist/es/node_modules/@popperjs/core/lib/enums.mjs +0 -22
  66. package/dist/es/node_modules/@vue/shared/dist/shared.esm-bundler.mjs +0 -28
  67. package/dist/es/node_modules/@vueuse/core/index.mjs +0 -172
  68. package/dist/es/node_modules/@vueuse/shared/index.mjs +0 -68
  69. package/dist/es/node_modules/element-plus/es/constants/size.mjs +0 -4
  70. package/dist/es/node_modules/element-plus/es/hooks/use-focus-controller/index.mjs +0 -64
  71. package/dist/es/node_modules/element-plus/es/hooks/use-id/index.mjs +0 -30
  72. package/dist/es/node_modules/element-plus/es/hooks/use-locale/index.mjs +0 -29
  73. package/dist/es/node_modules/element-plus/es/hooks/use-namespace/index.mjs +0 -79
  74. package/dist/es/node_modules/element-plus/es/hooks/use-prop/index.mjs +0 -11
  75. package/dist/es/node_modules/element-plus/es/hooks/use-size/index.mjs +0 -20
  76. package/dist/es/node_modules/element-plus/es/locale/lang/en.mjs +0 -182
  77. package/dist/es/node_modules/element-plus/es/utils/error.mjs +0 -16
  78. package/dist/es/node_modules/element-plus/es/utils/types.mjs +0 -9
  79. package/dist/es/node_modules/element-plus/es/utils/vue/props/runtime.mjs +0 -42
  80. package/dist/es/src/components/Autosuggest/Autosuggest.vue.mjs +0 -446
  81. package/dist/es/src/components/Autosuggest/Multisuggest.vue.mjs +0 -17
  82. package/dist/es/src/components/Autosuggest/autosuggest-props.mjs +0 -204
  83. package/dist/es/src/components/Autosuggest/core.mjs +0 -56
  84. package/dist/es/src/components/Autosuggest/multisuggest-props.mjs +0 -11
  85. package/dist/es/src/components/Autosuggest/option.vue.mjs +0 -118
  86. package/dist/es/src/components/Autosuggest/select-dropdown.vue.mjs +0 -62
  87. package/dist/es/src/components/Autosuggest/useOption.mjs +0 -93
  88. package/dist/es/src/components/Autosuggest/useSelect.mjs +0 -803
  89. package/dist/es/src/components/Inline/Inline.vue.mjs +0 -125
  90. package/dist/es/src/components/Inline/index.mjs +0 -4
  91. package/dist/es/src/components/InputNumber/InputNumber.vue.mjs +0 -360
  92. package/dist/es/src/components/InputNumber/index.mjs +0 -4
  93. package/dist/es/src/components/InputNumber/input-number.mjs +0 -128
  94. package/dist/es/src/components/Loader/Loader.vue.mjs +0 -59
  95. package/dist/es/src/components/Loader/index.mjs +0 -4
  96. package/dist/es/src/components/Money/Money.vue.mjs +0 -72
  97. package/dist/es/src/components/Money/index.mjs +0 -4
  98. package/dist/es/src/components/Multisuggest/index.mjs +0 -4
  99. package/dist/es/src/components/OptionsList/OptionsList.vue.mjs +0 -28
  100. package/dist/es/src/components/OptionsList/index.mjs +0 -4
  101. package/dist/es/src/components/OptionsListItem/OptionsListItem.vue.mjs +0 -96
  102. package/dist/es/src/components/OptionsListItem/index.mjs +0 -4
  103. package/dist/es/src/components/Percent/Percent.vue.mjs +0 -73
  104. package/dist/es/src/components/Percent/index.mjs +0 -4
  105. package/dist/es/src/components/Skeleton/Skeleton.vue.mjs +0 -79
  106. package/dist/es/src/components/Skeleton/index.mjs +0 -4
  107. package/dist/es/src/components/Step/Step.vue.mjs +0 -206
  108. package/dist/es/src/components/Step/index.mjs +0 -4
  109. package/dist/es/src/components/Steps/Steps.vue.mjs +0 -15
  110. package/dist/es/src/components/Steps/index.mjs +0 -4
  111. package/dist/es/src/components/Tip/Tip.vue.mjs +0 -160
  112. package/dist/es/src/components/Tip/index.mjs +0 -4
  113. package/dist/es/src/components/index.mjs +0 -32
  114. package/dist/es/src/locale/i18nCreator.mjs +0 -93
  115. package/dist/es/src/locale/lang/pt-br.mjs +0 -21
  116. package/dist/es/src/main.mjs +0 -17
  117. package/dist/es/src/mixins/floatFormatter.mjs +0 -42
  118. package/dist/es/src/plugins/currency.mjs +0 -69
  119. package/dist/es/src/utils/constants.mjs +0 -6
  120. package/dist/es/src/utils/error.mjs +0 -22
  121. package/dist/es/src/utils/i18n.mjs +0 -4
  122. package/dist/es/src/utils/icon.mjs +0 -9
  123. package/dist/es/src/utils/index.mjs +0 -11
  124. package/dist/es/src/utils/runtime.mjs +0 -50
  125. package/dist/es/src/utils/scroll.mjs +0 -28
  126. package/dist/es/src/utils/strings.mjs +0 -4
  127. package/dist/es/src/utils/types.mjs +0 -9
  128. package/dist/es/src/utils/use-derived-namespace.mjs +0 -15
  129. package/dist/es/src/utils/use-form-common-props.mjs +0 -25
  130. package/dist/es/src/utils/use-form-item.mjs +0 -61
  131. package/dist/es/src/utils/use-id.mjs +0 -35
  132. package/dist/es/src/utils/use-input.mjs +0 -31
  133. package/dist/lib/_virtual/_plugin-vue_export-helper.js +0 -10
  134. package/dist/lib/components.css +0 -2391
  135. package/dist/lib/node_modules/@element-plus/icons-vue/dist/index.js +0 -148
  136. package/dist/lib/node_modules/@popperjs/core/lib/enums.js +0 -22
  137. package/dist/lib/node_modules/@vue/shared/dist/shared.esm-bundler.js +0 -28
  138. package/dist/lib/node_modules/@vueuse/core/index.js +0 -170
  139. package/dist/lib/node_modules/@vueuse/shared/index.js +0 -68
  140. package/dist/lib/node_modules/element-plus/es/constants/size.js +0 -4
  141. package/dist/lib/node_modules/element-plus/es/hooks/use-focus-controller/index.js +0 -64
  142. package/dist/lib/node_modules/element-plus/es/hooks/use-id/index.js +0 -30
  143. package/dist/lib/node_modules/element-plus/es/hooks/use-locale/index.js +0 -29
  144. package/dist/lib/node_modules/element-plus/es/hooks/use-namespace/index.js +0 -79
  145. package/dist/lib/node_modules/element-plus/es/hooks/use-prop/index.js +0 -11
  146. package/dist/lib/node_modules/element-plus/es/hooks/use-size/index.js +0 -20
  147. package/dist/lib/node_modules/element-plus/es/locale/lang/en.js +0 -182
  148. package/dist/lib/node_modules/element-plus/es/utils/error.js +0 -16
  149. package/dist/lib/node_modules/element-plus/es/utils/types.js +0 -9
  150. package/dist/lib/node_modules/element-plus/es/utils/vue/props/runtime.js +0 -42
  151. package/dist/lib/src/components/Autosuggest/Autosuggest.vue.js +0 -446
  152. package/dist/lib/src/components/Autosuggest/Multisuggest.vue.js +0 -17
  153. package/dist/lib/src/components/Autosuggest/autosuggest-props.js +0 -204
  154. package/dist/lib/src/components/Autosuggest/core.js +0 -56
  155. package/dist/lib/src/components/Autosuggest/multisuggest-props.js +0 -11
  156. package/dist/lib/src/components/Autosuggest/option.vue.js +0 -118
  157. package/dist/lib/src/components/Autosuggest/select-dropdown.vue.js +0 -62
  158. package/dist/lib/src/components/Autosuggest/useOption.js +0 -93
  159. package/dist/lib/src/components/Autosuggest/useSelect.js +0 -803
  160. package/dist/lib/src/components/Inline/Inline.vue.js +0 -125
  161. package/dist/lib/src/components/Inline/index.js +0 -4
  162. package/dist/lib/src/components/InputNumber/InputNumber.vue.js +0 -360
  163. package/dist/lib/src/components/InputNumber/index.js +0 -4
  164. package/dist/lib/src/components/InputNumber/input-number.js +0 -128
  165. package/dist/lib/src/components/Loader/Loader.vue.js +0 -59
  166. package/dist/lib/src/components/Loader/index.js +0 -4
  167. package/dist/lib/src/components/Money/Money.vue.js +0 -72
  168. package/dist/lib/src/components/Money/index.js +0 -4
  169. package/dist/lib/src/components/Multisuggest/index.js +0 -4
  170. package/dist/lib/src/components/OptionsList/OptionsList.vue.js +0 -28
  171. package/dist/lib/src/components/OptionsList/index.js +0 -4
  172. package/dist/lib/src/components/OptionsListItem/OptionsListItem.vue.js +0 -96
  173. package/dist/lib/src/components/OptionsListItem/index.js +0 -4
  174. package/dist/lib/src/components/Percent/Percent.vue.js +0 -73
  175. package/dist/lib/src/components/Percent/index.js +0 -4
  176. package/dist/lib/src/components/Skeleton/Skeleton.vue.js +0 -79
  177. package/dist/lib/src/components/Skeleton/index.js +0 -4
  178. package/dist/lib/src/components/Step/Step.vue.js +0 -206
  179. package/dist/lib/src/components/Step/index.js +0 -4
  180. package/dist/lib/src/components/Steps/Steps.vue.js +0 -15
  181. package/dist/lib/src/components/Steps/index.js +0 -4
  182. package/dist/lib/src/components/Tip/Tip.vue.js +0 -160
  183. package/dist/lib/src/components/Tip/index.js +0 -4
  184. package/dist/lib/src/components/index.js +0 -32
  185. package/dist/lib/src/locale/i18nCreator.js +0 -93
  186. package/dist/lib/src/locale/lang/pt-br.js +0 -21
  187. package/dist/lib/src/main.js +0 -17
  188. package/dist/lib/src/mixins/floatFormatter.js +0 -42
  189. package/dist/lib/src/plugins/currency.js +0 -69
  190. package/dist/lib/src/utils/constants.js +0 -6
  191. package/dist/lib/src/utils/error.js +0 -22
  192. package/dist/lib/src/utils/i18n.js +0 -4
  193. package/dist/lib/src/utils/icon.js +0 -9
  194. package/dist/lib/src/utils/index.js +0 -14
  195. package/dist/lib/src/utils/runtime.js +0 -50
  196. package/dist/lib/src/utils/scroll.js +0 -28
  197. package/dist/lib/src/utils/strings.js +0 -4
  198. package/dist/lib/src/utils/types.js +0 -12
  199. package/dist/lib/src/utils/use-derived-namespace.js +0 -15
  200. package/dist/lib/src/utils/use-form-common-props.js +0 -25
  201. package/dist/lib/src/utils/use-form-item.js +0 -61
  202. package/dist/lib/src/utils/use-id.js +0 -35
  203. package/dist/lib/src/utils/use-input.js +0 -31
@@ -0,0 +1,430 @@
1
+ <template>
2
+ <div
3
+ :class="[
4
+ 'el-input-number',
5
+ inputNumberSize ? 'el-input-number--' + inputNumberSize : '',
6
+ { 'is-disabled': inputNumberDisabled },
7
+ { 'is-without-controls': !controls },
8
+ { 'is-controls-right': controlsAtRight }
9
+ ]"
10
+ @dragstart.prevent
11
+ >
12
+ <span
13
+ v-if="controls"
14
+ v-repeat-click="decrease"
15
+ class="el-input-number__decrease"
16
+ role="button"
17
+ :class="{'is-disabled': minDisabled}"
18
+ @keydown.enter="decrease"
19
+ >
20
+ <em :class="`el-icon-${controlsAtRight ? 'arrow-down' : 'minus'}`" />
21
+ </span>
22
+ <span
23
+ v-if="controls"
24
+ v-repeat-click="increase"
25
+ class="el-input-number__increase"
26
+ role="button"
27
+ :class="{'is-disabled': maxDisabled}"
28
+ @keydown.enter="increase"
29
+ >
30
+ <em :class="`el-icon-${controlsAtRight ? 'arrow-up' : 'plus'}`" />
31
+ </span>
32
+ <el-input
33
+ ref="input"
34
+ :value="displayValue"
35
+ :placeholder="placeholder"
36
+ :disabled="inputNumberDisabled"
37
+ :size="inputNumberSize"
38
+ :max="max"
39
+ :min="min"
40
+ :name="name"
41
+ :label="label"
42
+ @keydown.up.native.prevent="increase"
43
+ @keydown.down.native.prevent="decrease"
44
+ @blur="handleBlur"
45
+ @focus="handleFocus"
46
+ @input="handleInput"
47
+ @change="handleInputChange"
48
+ />
49
+ </div>
50
+ </template>
51
+
52
+ <script>
53
+ import ElInput from 'element-ui/packages/input'
54
+ import Focus from 'element-ui/src/mixins/focus'
55
+ import RepeatClick from 'element-ui/src/directives/repeat-click'
56
+
57
+ export default {
58
+ name: 'TpInputNumber',
59
+
60
+ directives: {
61
+ repeatClick: RepeatClick
62
+ },
63
+
64
+ components: {
65
+ ElInput
66
+ },
67
+
68
+ mixins: [Focus('input')],
69
+ inject: {
70
+ elForm: {
71
+ default: ''
72
+ },
73
+ elFormItem: {
74
+ default: ''
75
+ }
76
+ },
77
+
78
+ props: {
79
+ step: {
80
+ type: Number,
81
+ default: 1
82
+ },
83
+ stepStrictly: {
84
+ type: Boolean,
85
+ default: false
86
+ },
87
+ max: {
88
+ type: Number,
89
+ default: Infinity
90
+ },
91
+ min: {
92
+ type: Number,
93
+ default: -Infinity
94
+ },
95
+ value: {
96
+ type: [Number, String],
97
+ default: null
98
+ },
99
+ disabled: Boolean,
100
+ size: {
101
+ type: [String, Boolean],
102
+ default: false
103
+ },
104
+ controls: {
105
+ type: Boolean,
106
+ default: true
107
+ },
108
+ controlsPosition: {
109
+ type: String,
110
+ default: ''
111
+ },
112
+ name: {
113
+ type: [String, Boolean],
114
+ default: false
115
+ },
116
+ label: {
117
+ type: [String],
118
+ default: ''
119
+ },
120
+ placeholder: {
121
+ type: [String, Boolean],
122
+ default: false
123
+ },
124
+ precision: {
125
+ type: Number,
126
+ default: 2,
127
+ validator (val) {
128
+ return val >= 0 && val === parseInt(val, 10)
129
+ }
130
+ },
131
+ // Customizada
132
+ usarVirgula: {
133
+ type: Boolean,
134
+ default: true
135
+ },
136
+ // Customizada - Se false permite campo vazio
137
+ stringDefaultsZero: {
138
+ type: Boolean,
139
+ default: true
140
+ }
141
+ },
142
+
143
+ data () {
144
+ return {
145
+ currentValue: '',
146
+ userInput: null
147
+ }
148
+ },
149
+
150
+ computed: {
151
+ /**
152
+ * Sobrescrito do element
153
+ */
154
+ minDisabled () {
155
+ return this.value < this.min
156
+ },
157
+
158
+ /**
159
+ * Sobrescrito do element
160
+ */
161
+ maxDisabled () {
162
+ return this.value > this.max
163
+ },
164
+ numPrecision () {
165
+ const { value, step, getPrecision, precision } = this
166
+ const stepPrecision = getPrecision(step)
167
+
168
+ if (precision !== undefined) {
169
+ if (stepPrecision > precision) {
170
+ console.warn('[Element Warn][InputNumber]precision should not be less than the decimal places of step')
171
+ }
172
+
173
+ return precision
174
+ }
175
+
176
+ return Math.max(getPrecision(value), stepPrecision)
177
+ },
178
+ controlsAtRight () {
179
+ return this.controls && this.controlsPosition === 'right'
180
+ },
181
+ _elFormItemSize () {
182
+ return (this.elFormItem || {}).elFormItemSize
183
+ },
184
+ inputNumberSize () {
185
+ return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size
186
+ },
187
+ inputNumberDisabled () {
188
+ return this.disabled || Boolean((this.elForm || {}).disabled)
189
+ },
190
+ /**
191
+ * Sobrescrito do element
192
+ */
193
+ displayValue () {
194
+ if (this.userInput !== null) {
195
+ // corrige o bug para deixar limpar o campo
196
+ if (!this.stringDefaultsZero && this.userInput === '') {
197
+ this.currentValue = ''
198
+ }
199
+
200
+ return this.userInput
201
+ }
202
+
203
+ let currentValue
204
+
205
+ if (this.value === '' && !this.stringDefaultsZero) {
206
+ currentValue = ''
207
+ } else {
208
+ currentValue = this.currentValue
209
+ }
210
+
211
+ if (typeof currentValue === 'number') {
212
+ if (this.stepStrictly) {
213
+ const stepPrecision = this.getPrecision(this.step)
214
+ const precisionFactor = Math.pow(10, stepPrecision)
215
+
216
+ currentValue =
217
+ (Math.round(currentValue / this.step) *
218
+ precisionFactor *
219
+ this.step) /
220
+ precisionFactor
221
+ }
222
+
223
+ if (this.precision !== undefined) {
224
+ currentValue = currentValue.toFixed(this.precision)
225
+ }
226
+ }
227
+
228
+ if (this.usarVirgula) {
229
+ currentValue = (`${currentValue }`).replace('.', ',')
230
+ }
231
+
232
+ return currentValue
233
+ }
234
+ },
235
+
236
+ watch: {
237
+ /**
238
+ * Sobrescrito do element
239
+ */
240
+ value: {
241
+ immediate: true,
242
+ handler (value) {
243
+ let newVal
244
+
245
+ if (value === undefined) {
246
+ newVal = value
247
+ } else if (!this.stringDefaultsZero && value === '') {
248
+ newVal = ''
249
+ } else {
250
+ newVal = Number(value)
251
+ }
252
+
253
+ if (newVal !== undefined) {
254
+ if (isNaN(newVal)) {
255
+ return
256
+ }
257
+
258
+ if (this.stepStrictly) {
259
+ const stepPrecision = this.getPrecision(this.step)
260
+ const precisionFactor = Math.pow(10, stepPrecision)
261
+
262
+ newVal = Math.round(newVal / this.step) * precisionFactor * this.step / precisionFactor
263
+ }
264
+
265
+ if (this.precision !== undefined) {
266
+ newVal = this.toPrecision(newVal, this.precision)
267
+ }
268
+ }
269
+
270
+ if (newVal >= this.max) newVal = this.max
271
+
272
+ if (newVal <= this.min) newVal = this.min
273
+
274
+ this.currentValue = newVal
275
+ this.userInput = null
276
+ this.$emit('input', newVal)
277
+ }
278
+ }
279
+ },
280
+
281
+ mounted () {
282
+ const innerInput = this.$refs.input.$refs.input
283
+
284
+ innerInput.setAttribute('role', 'spinbutton')
285
+ innerInput.setAttribute('aria-valuemax', this.max)
286
+ innerInput.setAttribute('aria-valuemin', this.min)
287
+ innerInput.setAttribute('aria-valuenow', this.currentValue)
288
+ innerInput.setAttribute('aria-disabled', this.inputNumberDisabled)
289
+ },
290
+
291
+ updated () {
292
+ if (!this.$refs || !this.$refs.input) return
293
+
294
+ const innerInput = this.$refs.input.$refs.input
295
+
296
+ innerInput.setAttribute('aria-valuenow', this.currentValue)
297
+ },
298
+
299
+ methods: {
300
+ toPrecision (num, precision) {
301
+ if (precision === undefined) precision = this.numPrecision
302
+
303
+ return parseFloat(Math.round(num * Math.pow(10, precision)) / Math.pow(10, precision))
304
+ },
305
+ getPrecision (value) {
306
+ if (value === undefined) return 0
307
+
308
+ const valueString = value.toString()
309
+ const dotPosition = valueString.indexOf('.')
310
+ let precision = 0
311
+
312
+ if (dotPosition !== -1) {
313
+ precision = valueString.length - dotPosition - 1
314
+ }
315
+
316
+ return precision
317
+ },
318
+ _increase (val, step) {
319
+ if (typeof val !== 'number' && val !== undefined) return this.currentValue
320
+
321
+ const precisionFactor = Math.pow(10, this.numPrecision)
322
+
323
+ // Solve the accuracy problem of JS decimal calculation by converting the value to integer.
324
+ return this.toPrecision((precisionFactor * val + precisionFactor * step) / precisionFactor)
325
+ },
326
+ _decrease (val, step) {
327
+ if (typeof val !== 'number' && val !== undefined) return this.currentValue
328
+
329
+ const precisionFactor = Math.pow(10, this.numPrecision)
330
+
331
+ return this.toPrecision((precisionFactor * val - precisionFactor * step) / precisionFactor)
332
+ },
333
+ increase () {
334
+ if (this.inputNumberDisabled || this.maxDisabled) return
335
+
336
+ const value = this.value || 0
337
+ const newVal = this._increase(value, this.step)
338
+
339
+ this.setCurrentValue(newVal)
340
+ },
341
+ decrease () {
342
+ if (this.inputNumberDisabled || this.minDisabled) return
343
+
344
+ const value = this.value || 0
345
+ const newVal = this._decrease(value, this.step)
346
+
347
+ this.setCurrentValue(newVal)
348
+ },
349
+ handleBlur (event) {
350
+ if (!this.value && this.stringDefaultsZero && !this.precision) {
351
+ this.currentValue = 0
352
+ }
353
+
354
+ this.$emit('blur', event)
355
+ },
356
+ handleFocus (event) {
357
+ if (!this.value && !this.precision) {
358
+ this.currentValue = ''
359
+ }
360
+
361
+ this.$emit('focus', event)
362
+ },
363
+
364
+ /**
365
+ * Sobrescrito do element
366
+ */
367
+ handleInput (value) {
368
+ this.userInput = value
369
+ let newVal
370
+
371
+ if (value === '' && this.stringDefaultsZero) {
372
+ newVal = Number(value.replace(',', '.'))
373
+ } else {
374
+ newVal = value
375
+ }
376
+
377
+ this.$emit('change', newVal)
378
+ },
379
+
380
+ /**
381
+ * Sobrescrito do element
382
+ */
383
+ handleInputChange (value) {
384
+ let newVal
385
+
386
+ if (value === '') {
387
+ // Por padrão converte '' para 0
388
+ if (this.stringDefaultsZero) {
389
+ newVal = 0
390
+ } else {
391
+ newVal = ''
392
+ }
393
+ } else {
394
+ newVal = Number(value.replace(',', '.'))
395
+ }
396
+
397
+ if (!isNaN(newVal) || value === '') {
398
+ this.setCurrentValue(newVal)
399
+ }
400
+
401
+ this.userInput = null
402
+ },
403
+
404
+ /**
405
+ * Sobrescrito do element
406
+ */
407
+ setCurrentValue (newVal) {
408
+ const oldVal = this.currentValue
409
+
410
+ if (typeof newVal === 'number' && this.precision !== undefined) {
411
+ newVal = this.toPrecision(newVal, this.precision)
412
+ }
413
+
414
+ if (newVal >= this.max) newVal = this.max
415
+
416
+ if (newVal <= this.min) newVal = this.min
417
+
418
+ if (oldVal === newVal && newVal === this.value) return
419
+
420
+ this.userInput = null
421
+ this.$emit('input', newVal)
422
+ this.$emit('change', newVal, oldVal)
423
+ },
424
+
425
+ select () {
426
+ this.$refs.input.select()
427
+ }
428
+ }
429
+ }
430
+ </script>
@@ -0,0 +1,3 @@
1
+ import InputNumber from './InputNumber'
2
+
3
+ export default InputNumber