@tagplus/components 5.3.4 → 5.3.5

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/es/_virtual/_plugin-vue_export-helper.mjs +10 -0
  2. package/dist/es/components.css +2391 -0
  3. package/dist/es/node_modules/@element-plus/icons-vue/dist/index.mjs +148 -0
  4. package/dist/es/node_modules/@popperjs/core/lib/enums.mjs +22 -0
  5. package/dist/es/node_modules/@vue/shared/dist/shared.esm-bundler.mjs +28 -0
  6. package/dist/es/node_modules/@vueuse/core/index.mjs +172 -0
  7. package/dist/es/node_modules/@vueuse/shared/index.mjs +68 -0
  8. package/dist/es/node_modules/element-plus/es/constants/size.mjs +4 -0
  9. package/dist/es/node_modules/element-plus/es/hooks/use-focus-controller/index.mjs +64 -0
  10. package/dist/es/node_modules/element-plus/es/hooks/use-id/index.mjs +30 -0
  11. package/dist/es/node_modules/element-plus/es/hooks/use-locale/index.mjs +29 -0
  12. package/dist/es/node_modules/element-plus/es/hooks/use-namespace/index.mjs +79 -0
  13. package/dist/es/node_modules/element-plus/es/hooks/use-prop/index.mjs +11 -0
  14. package/dist/es/node_modules/element-plus/es/hooks/use-size/index.mjs +20 -0
  15. package/dist/es/node_modules/element-plus/es/locale/lang/en.mjs +182 -0
  16. package/dist/es/node_modules/element-plus/es/utils/error.mjs +16 -0
  17. package/dist/es/node_modules/element-plus/es/utils/types.mjs +9 -0
  18. package/dist/es/node_modules/element-plus/es/utils/vue/props/runtime.mjs +42 -0
  19. package/dist/es/src/components/Autosuggest/Autosuggest.vue.mjs +446 -0
  20. package/dist/es/src/components/Autosuggest/Multisuggest.vue.mjs +17 -0
  21. package/dist/es/src/components/Autosuggest/autosuggest-props.mjs +204 -0
  22. package/dist/es/src/components/Autosuggest/core.mjs +62 -0
  23. package/dist/es/src/components/Autosuggest/multisuggest-props.mjs +11 -0
  24. package/dist/es/src/components/Autosuggest/option.vue.mjs +118 -0
  25. package/dist/es/src/components/Autosuggest/select-dropdown.vue.mjs +62 -0
  26. package/dist/es/src/components/Autosuggest/useOption.mjs +93 -0
  27. package/dist/es/src/components/Autosuggest/useSelect.mjs +803 -0
  28. package/dist/es/src/components/Inline/Inline.vue.mjs +130 -0
  29. package/dist/es/src/components/Inline/index.mjs +4 -0
  30. package/dist/es/src/components/InputNumber/InputNumber.vue.mjs +358 -0
  31. package/dist/es/src/components/InputNumber/index.mjs +4 -0
  32. package/dist/es/src/components/InputNumber/input-number.mjs +128 -0
  33. package/dist/es/src/components/Loader/Loader.vue.mjs +59 -0
  34. package/dist/es/src/components/Loader/index.mjs +4 -0
  35. package/dist/es/src/components/Money/Money.vue.mjs +76 -0
  36. package/dist/es/src/components/Money/index.mjs +4 -0
  37. package/dist/es/src/components/Multisuggest/index.mjs +4 -0
  38. package/dist/es/src/components/OptionsList/OptionsList.vue.mjs +28 -0
  39. package/dist/es/src/components/OptionsList/index.mjs +4 -0
  40. package/dist/es/src/components/OptionsListItem/OptionsListItem.vue.mjs +96 -0
  41. package/dist/es/src/components/OptionsListItem/index.mjs +4 -0
  42. package/dist/es/src/components/Percent/Percent.vue.mjs +77 -0
  43. package/dist/es/src/components/Percent/index.mjs +4 -0
  44. package/dist/es/src/components/Skeleton/Skeleton.vue.mjs +79 -0
  45. package/dist/es/src/components/Skeleton/index.mjs +4 -0
  46. package/dist/es/src/components/Step/Step.vue.mjs +206 -0
  47. package/dist/es/src/components/Step/index.mjs +4 -0
  48. package/dist/es/src/components/Steps/Steps.vue.mjs +15 -0
  49. package/dist/es/src/components/Steps/index.mjs +4 -0
  50. package/dist/es/src/components/Tip/Tip.vue.mjs +165 -0
  51. package/dist/es/src/components/Tip/index.mjs +4 -0
  52. package/dist/es/src/components/index.mjs +22 -0
  53. package/dist/es/src/locale/i18nCreator.mjs +93 -0
  54. package/dist/es/src/locale/lang/pt-br.mjs +21 -0
  55. package/dist/es/src/main.mjs +18 -0
  56. package/dist/es/src/mixins/floatFormatter.mjs +42 -0
  57. package/dist/es/src/plugins/currency.mjs +69 -0
  58. package/dist/es/src/utils/constants.mjs +6 -0
  59. package/dist/es/src/utils/error.mjs +20 -0
  60. package/dist/es/src/utils/i18n.mjs +4 -0
  61. package/dist/es/src/utils/icon.mjs +9 -0
  62. package/dist/es/src/utils/index.mjs +8 -0
  63. package/dist/es/src/utils/runtime.mjs +50 -0
  64. package/dist/es/src/utils/scroll.mjs +26 -0
  65. package/dist/es/src/utils/strings.mjs +4 -0
  66. package/dist/es/src/utils/types.mjs +9 -0
  67. package/dist/es/src/utils/use-derived-namespace.mjs +15 -0
  68. package/dist/es/src/utils/use-form-common-props.mjs +25 -0
  69. package/dist/es/src/utils/use-form-item.mjs +61 -0
  70. package/dist/es/src/utils/use-id.mjs +35 -0
  71. package/dist/es/src/utils/use-input.mjs +31 -0
  72. package/{src/locale → dist}/lang/en.js +3 -2
  73. package/{src/locale → dist}/lang/pt-br.js +3 -2
  74. package/dist/lib/_virtual/_plugin-vue_export-helper.js +10 -0
  75. package/dist/lib/components.css +2391 -0
  76. package/dist/lib/node_modules/@element-plus/icons-vue/dist/index.js +148 -0
  77. package/dist/lib/node_modules/@popperjs/core/lib/enums.js +22 -0
  78. package/dist/lib/node_modules/@vue/shared/dist/shared.esm-bundler.js +28 -0
  79. package/dist/lib/node_modules/@vueuse/core/index.js +170 -0
  80. package/dist/lib/node_modules/@vueuse/shared/index.js +68 -0
  81. package/dist/lib/node_modules/element-plus/es/constants/size.js +4 -0
  82. package/dist/lib/node_modules/element-plus/es/hooks/use-focus-controller/index.js +64 -0
  83. package/dist/lib/node_modules/element-plus/es/hooks/use-id/index.js +30 -0
  84. package/dist/lib/node_modules/element-plus/es/hooks/use-locale/index.js +29 -0
  85. package/dist/lib/node_modules/element-plus/es/hooks/use-namespace/index.js +79 -0
  86. package/dist/lib/node_modules/element-plus/es/hooks/use-prop/index.js +11 -0
  87. package/dist/lib/node_modules/element-plus/es/hooks/use-size/index.js +20 -0
  88. package/dist/lib/node_modules/element-plus/es/locale/lang/en.js +182 -0
  89. package/dist/lib/node_modules/element-plus/es/utils/error.js +16 -0
  90. package/dist/lib/node_modules/element-plus/es/utils/types.js +9 -0
  91. package/dist/lib/node_modules/element-plus/es/utils/vue/props/runtime.js +42 -0
  92. package/dist/lib/src/components/Autosuggest/Autosuggest.vue.js +446 -0
  93. package/dist/lib/src/components/Autosuggest/Multisuggest.vue.js +17 -0
  94. package/dist/lib/src/components/Autosuggest/autosuggest-props.js +204 -0
  95. package/dist/lib/src/components/Autosuggest/core.js +62 -0
  96. package/dist/lib/src/components/Autosuggest/multisuggest-props.js +11 -0
  97. package/dist/lib/src/components/Autosuggest/option.vue.js +118 -0
  98. package/dist/lib/src/components/Autosuggest/select-dropdown.vue.js +62 -0
  99. package/dist/lib/src/components/Autosuggest/useOption.js +93 -0
  100. package/dist/lib/src/components/Autosuggest/useSelect.js +803 -0
  101. package/dist/lib/src/components/Inline/Inline.vue.js +130 -0
  102. package/dist/lib/src/components/Inline/index.js +4 -0
  103. package/dist/lib/src/components/InputNumber/InputNumber.vue.js +358 -0
  104. package/dist/lib/src/components/InputNumber/index.js +4 -0
  105. package/dist/lib/src/components/InputNumber/input-number.js +128 -0
  106. package/dist/lib/src/components/Loader/Loader.vue.js +59 -0
  107. package/dist/lib/src/components/Loader/index.js +4 -0
  108. package/dist/lib/src/components/Money/Money.vue.js +76 -0
  109. package/dist/lib/src/components/Money/index.js +4 -0
  110. package/dist/lib/src/components/Multisuggest/index.js +4 -0
  111. package/dist/lib/src/components/OptionsList/OptionsList.vue.js +28 -0
  112. package/dist/lib/src/components/OptionsList/index.js +4 -0
  113. package/dist/lib/src/components/OptionsListItem/OptionsListItem.vue.js +96 -0
  114. package/dist/lib/src/components/OptionsListItem/index.js +4 -0
  115. package/dist/lib/src/components/Percent/Percent.vue.js +77 -0
  116. package/dist/lib/src/components/Percent/index.js +4 -0
  117. package/dist/lib/src/components/Skeleton/Skeleton.vue.js +79 -0
  118. package/dist/lib/src/components/Skeleton/index.js +4 -0
  119. package/dist/lib/src/components/Step/Step.vue.js +206 -0
  120. package/dist/lib/src/components/Step/index.js +4 -0
  121. package/dist/lib/src/components/Steps/Steps.vue.js +15 -0
  122. package/dist/lib/src/components/Steps/index.js +4 -0
  123. package/dist/lib/src/components/Tip/Tip.vue.js +165 -0
  124. package/dist/lib/src/components/Tip/index.js +4 -0
  125. package/dist/lib/src/components/index.js +22 -0
  126. package/dist/lib/src/locale/i18nCreator.js +93 -0
  127. package/dist/lib/src/locale/lang/pt-br.js +21 -0
  128. package/dist/lib/src/main.js +18 -0
  129. package/dist/lib/src/mixins/floatFormatter.js +42 -0
  130. package/dist/lib/src/plugins/currency.js +69 -0
  131. package/dist/lib/src/utils/constants.js +6 -0
  132. package/dist/lib/src/utils/error.js +20 -0
  133. package/dist/lib/src/utils/i18n.js +4 -0
  134. package/dist/lib/src/utils/icon.js +9 -0
  135. package/dist/lib/src/utils/index.js +8 -0
  136. package/dist/lib/src/utils/runtime.js +50 -0
  137. package/dist/lib/src/utils/scroll.js +26 -0
  138. package/dist/lib/src/utils/strings.js +4 -0
  139. package/dist/lib/src/utils/types.js +12 -0
  140. package/dist/lib/src/utils/use-derived-namespace.js +15 -0
  141. package/dist/lib/src/utils/use-form-common-props.js +25 -0
  142. package/dist/lib/src/utils/use-form-item.js +61 -0
  143. package/dist/lib/src/utils/use-id.js +35 -0
  144. package/dist/lib/src/utils/use-input.js +31 -0
  145. package/package.json +84 -62
  146. package/dist/demo.html +0 -1
  147. package/dist/fonts/bevi-bold.7e4dcd11.woff +0 -0
  148. package/dist/fonts/bevi-bold.873def84.woff2 +0 -0
  149. package/dist/fonts/bevi-medium.6187e050.woff2 +0 -0
  150. package/dist/fonts/bevi-medium.65b3056d.woff +0 -0
  151. package/dist/fonts/bevi-regular.c89f126e.woff +0 -0
  152. package/dist/fonts/bevi-regular.f81e4b8f.woff2 +0 -0
  153. package/dist/tp.common.js +0 -2
  154. package/dist/tp.common.js.map +0 -1
  155. package/dist/tp.css +0 -167
  156. package/dist/tp.umd.js +0 -2
  157. package/dist/tp.umd.js.map +0 -1
  158. package/dist/tp.umd.min.js +0 -2
  159. package/dist/tp.umd.min.js.map +0 -1
  160. package/src/assets/scss/_fonts.scss +0 -27
  161. package/src/assets/scss/_functions.scss +0 -22
  162. package/src/assets/scss/_helpers.scss +0 -112
  163. package/src/assets/scss/_mixins.scss +0 -69
  164. package/src/assets/scss/_overrides.scss +0 -69
  165. package/src/assets/scss/_resass.scss +0 -83
  166. package/src/assets/scss/_variables.scss +0 -27
  167. package/src/assets/scss/index.scss +0 -11
  168. package/src/components/Autosuggest/Autosuggest.vue +0 -791
  169. package/src/components/Autosuggest/index.js +0 -3
  170. package/src/components/Dialog/Dialog.vue +0 -253
  171. package/src/components/Dialog/index.js +0 -3
  172. package/src/components/Inline/Inline.vue +0 -149
  173. package/src/components/Inline/index.js +0 -3
  174. package/src/components/InputNumber/InputNumber.vue +0 -430
  175. package/src/components/InputNumber/index.js +0 -3
  176. package/src/components/Loader/Loader.vue +0 -317
  177. package/src/components/Loader/animations.scss +0 -68
  178. package/src/components/Loader/index.js +0 -3
  179. package/src/components/Money/Money.vue +0 -82
  180. package/src/components/Money/index.js +0 -3
  181. package/src/components/Multisuggest/Multisuggest.vue +0 -858
  182. package/src/components/Multisuggest/index.js +0 -3
  183. package/src/components/OptionsList/OptionsList.vue +0 -61
  184. package/src/components/OptionsList/index.js +0 -3
  185. package/src/components/OptionsListItem/OptionsListItem.vue +0 -191
  186. package/src/components/OptionsListItem/index.js +0 -3
  187. package/src/components/Percent/Percent.vue +0 -81
  188. package/src/components/Percent/index.js +0 -3
  189. package/src/components/Skeleton/Skeleton.vue +0 -137
  190. package/src/components/Skeleton/index.js +0 -3
  191. package/src/components/Step/Step.vue +0 -230
  192. package/src/components/Step/index.js +0 -3
  193. package/src/components/Steps/Steps.vue +0 -18
  194. package/src/components/Steps/index.js +0 -3
  195. package/src/components/Tip/Tip.vue +0 -193
  196. package/src/components/Tip/index.js +0 -3
  197. package/src/components/index.js +0 -31
  198. package/src/locale/index.js +0 -78
  199. package/src/main.js +0 -26
  200. package/src/mixins/floatFormatter.js +0 -53
  201. package/src/mixins/locale.js +0 -9
  202. package/src/utils/currency.js +0 -180
  203. package/src/utils/filters.js +0 -84
@@ -1,430 +0,0 @@
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>
@@ -1,3 +0,0 @@
1
- import InputNumber from './InputNumber'
2
-
3
- export default InputNumber