@tagplus/components 0.2.105 → 0.2.108
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.
- package/dist/tp.common.js +141 -51
- package/dist/tp.common.js.map +1 -1
- package/dist/tp.css +1 -1
- package/dist/tp.umd.js +141 -51
- package/dist/tp.umd.js.map +1 -1
- package/dist/tp.umd.min.js +1 -1
- package/dist/tp.umd.min.js.map +1 -1
- package/package.json +10 -10
- package/src/components/Autosuggest/Autosuggest.vue +39 -15
- package/src/components/InputNumber/InputNumber.vue +52 -1
- package/src/components/Multisuggest/Multisuggest.vue +16 -0
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"email": "bruno@tagplus.com.br"
|
|
8
8
|
}
|
|
9
9
|
],
|
|
10
|
-
"version": "0.2.
|
|
10
|
+
"version": "0.2.108",
|
|
11
11
|
"main": "./dist/tp.common.js",
|
|
12
12
|
"directories": {
|
|
13
13
|
"lib": "src/lib"
|
|
@@ -41,20 +41,20 @@
|
|
|
41
41
|
"test:unit": "vue-cli-service test:unit"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"axios": "^0.
|
|
45
|
-
"core-js": "^3.
|
|
44
|
+
"axios": "^0.27.0",
|
|
45
|
+
"core-js": "^3.21.1",
|
|
46
46
|
"element-theme-chalk": "^2.13",
|
|
47
47
|
"element-ui": "^2.13",
|
|
48
|
-
"js-cookie": "^
|
|
49
|
-
"vue": "^2.6.
|
|
50
|
-
"vue-axios": "^2.1.
|
|
48
|
+
"js-cookie": "^3.0.1",
|
|
49
|
+
"vue": "^2.6.14",
|
|
50
|
+
"vue-axios": "^2.1.5",
|
|
51
51
|
"vue-i18n": "^8.14.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@vue/cli-plugin-babel": "^
|
|
55
|
-
"@vue/cli-plugin-eslint": "^
|
|
56
|
-
"@vue/cli-plugin-unit-jest": "^
|
|
57
|
-
"@vue/cli-service": "^
|
|
54
|
+
"@vue/cli-plugin-babel": "^5.0.3",
|
|
55
|
+
"@vue/cli-plugin-eslint": "^5.0.3",
|
|
56
|
+
"@vue/cli-plugin-unit-jest": "^5.0.3",
|
|
57
|
+
"@vue/cli-service": "^5.0.3",
|
|
58
58
|
"@vue/eslint-config-prettier": "^6.0.0",
|
|
59
59
|
"@vue/test-utils": "1.0.0-beta.30",
|
|
60
60
|
"@vuese/cli": "^2.10.0",
|
|
@@ -286,8 +286,10 @@ export default {
|
|
|
286
286
|
_id() {
|
|
287
287
|
return this.id || this.$options.name
|
|
288
288
|
},
|
|
289
|
-
newItem(){
|
|
290
|
-
return this.query
|
|
289
|
+
newItem() {
|
|
290
|
+
return this.query
|
|
291
|
+
? this.$tpI18n.t('autosuggests.cadastrar', { nameItem: this.query })
|
|
292
|
+
: this.$tpI18n.t(`autosuggests.newItem.${this.$parent.$options.name}`)
|
|
291
293
|
},
|
|
292
294
|
|
|
293
295
|
/**
|
|
@@ -302,7 +304,9 @@ export default {
|
|
|
302
304
|
} else if (this.value && typeof this.value === 'object') {
|
|
303
305
|
if (!this.value[this.valueKey]) {
|
|
304
306
|
if (process.env.DEBUG === 'true') {
|
|
305
|
-
console.error(
|
|
307
|
+
console.error(
|
|
308
|
+
`Autosuggest '${this.$options.name}' option doesn't have a valueKey '${this.valueKey}' key`
|
|
309
|
+
)
|
|
306
310
|
}
|
|
307
311
|
} else {
|
|
308
312
|
newVal = this.value[this.valueKey]
|
|
@@ -335,6 +339,22 @@ export default {
|
|
|
335
339
|
list.push(createdSuggestion)
|
|
336
340
|
}
|
|
337
341
|
return list
|
|
342
|
+
},
|
|
343
|
+
|
|
344
|
+
emptyText() {
|
|
345
|
+
if (this.loading) {
|
|
346
|
+
return this.loadingText || this.t('el.select.loading')
|
|
347
|
+
} else {
|
|
348
|
+
if (this.remote && this.query === '' && this.options.length === 0) {
|
|
349
|
+
return this.noDataText || this.$tpI18n.t('autosuggests.sem_dados')}
|
|
350
|
+
if (this.filterable && this.query && this.options.length > 0 && this.filteredOptionsCount === 0) {
|
|
351
|
+
return this.noMatchText || this.t('el.select.noMatch')
|
|
352
|
+
}
|
|
353
|
+
if (this.options.length === 0) {
|
|
354
|
+
return this.noDataText || this.$tpI18n.t('autosuggests.sem_dados')
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
return null
|
|
338
358
|
}
|
|
339
359
|
},
|
|
340
360
|
|
|
@@ -354,7 +374,7 @@ export default {
|
|
|
354
374
|
})
|
|
355
375
|
},
|
|
356
376
|
|
|
357
|
-
beforeMount
|
|
377
|
+
beforeMount() {
|
|
358
378
|
this.doRequest = false
|
|
359
379
|
|
|
360
380
|
if (this.loadOnCreate) {
|
|
@@ -458,7 +478,9 @@ export default {
|
|
|
458
478
|
} else if (val && typeof val === 'object') {
|
|
459
479
|
// Se val for Object converte para outro tipo
|
|
460
480
|
if (!this.value[this.valueKey]) {
|
|
461
|
-
console.error(
|
|
481
|
+
console.error(
|
|
482
|
+
`Autosuggest '${this.$options.name}' option doesn't have a valueKey '${this.valueKey}' key`
|
|
483
|
+
)
|
|
462
484
|
} else {
|
|
463
485
|
// Se mandou a label no objeto value
|
|
464
486
|
if (this.value[this.labelKey]) {
|
|
@@ -604,18 +626,20 @@ export default {
|
|
|
604
626
|
|
|
605
627
|
// Correção para habilitar teclado mobile em iOS
|
|
606
628
|
fixElSelect() {
|
|
607
|
-
document
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
elInput
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
629
|
+
document
|
|
630
|
+
.querySelectorAll('.el-select[data-is-search="true"]:hover')
|
|
631
|
+
.forEach(() => {
|
|
632
|
+
let elInput = document.querySelector(
|
|
633
|
+
'.el-select[data-is-search="true"]:hover input[readonly]'
|
|
634
|
+
)
|
|
635
|
+
if (elInput) {
|
|
636
|
+
elInput.readOnly = false
|
|
637
|
+
elInput.blur()
|
|
638
|
+
elInput.focus()
|
|
639
|
+
}
|
|
640
|
+
})
|
|
615
641
|
}
|
|
616
642
|
}
|
|
617
|
-
|
|
618
|
-
|
|
619
643
|
}
|
|
620
644
|
</script>
|
|
621
645
|
|
|
@@ -6,10 +6,61 @@ export default {
|
|
|
6
6
|
|
|
7
7
|
extends: InputNumber,
|
|
8
8
|
|
|
9
|
+
props: {
|
|
10
|
+
usarVirgula: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: true
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
computed: {
|
|
17
|
+
displayValue() {
|
|
18
|
+
if (this.userInput !== null) {
|
|
19
|
+
return this.userInput
|
|
20
|
+
}
|
|
21
|
+
let currentValue = this.currentValue
|
|
22
|
+
|
|
23
|
+
if (typeof currentValue === 'number') {
|
|
24
|
+
if (this.stepStrictly) {
|
|
25
|
+
const stepPrecision = this.getPrecision(this.step)
|
|
26
|
+
const precisionFactor = Math.pow(10, stepPrecision)
|
|
27
|
+
currentValue =
|
|
28
|
+
(Math.round(currentValue / this.step) *
|
|
29
|
+
precisionFactor *
|
|
30
|
+
this.step) /
|
|
31
|
+
precisionFactor
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (this.precision !== undefined) {
|
|
35
|
+
currentValue = currentValue.toFixed(this.precision)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (this.usarVirgula) {
|
|
40
|
+
currentValue = (currentValue + '').replace('.', ',')
|
|
41
|
+
}
|
|
42
|
+
return currentValue
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
|
|
9
46
|
methods: {
|
|
10
47
|
handleInput(value) {
|
|
11
48
|
this.userInput = value
|
|
12
|
-
this.$emit('change', value)
|
|
49
|
+
this.$emit('change', Number(value.replace(',', '.')))
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
handleInputChange(value) {
|
|
53
|
+
let newVal
|
|
54
|
+
if (value === '') {
|
|
55
|
+
newVal = 0
|
|
56
|
+
} else {
|
|
57
|
+
newVal = Number(value.replace(',', '.'))
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (!isNaN(newVal) || value === '') {
|
|
61
|
+
this.setCurrentValue(newVal)
|
|
62
|
+
}
|
|
63
|
+
this.userInput = null
|
|
13
64
|
}
|
|
14
65
|
}
|
|
15
66
|
}
|
|
@@ -402,6 +402,22 @@ export default {
|
|
|
402
402
|
list.push(createdSuggestion)
|
|
403
403
|
}
|
|
404
404
|
return list
|
|
405
|
+
},
|
|
406
|
+
|
|
407
|
+
emptyText() {
|
|
408
|
+
if (this.loading) {
|
|
409
|
+
return this.loadingText || this.t('el.select.loading')
|
|
410
|
+
} else {
|
|
411
|
+
if (this.remote && this.query === '' && this.options.length === 0) {
|
|
412
|
+
return this.noDataText || this.$tpI18n.t('autosuggests.sem_dados')}
|
|
413
|
+
if (this.filterable && this.query && this.options.length > 0 && this.filteredOptionsCount === 0) {
|
|
414
|
+
return this.noMatchText || this.t('el.select.noMatch')
|
|
415
|
+
}
|
|
416
|
+
if (this.options.length === 0) {
|
|
417
|
+
return this.noDataText || this.$tpI18n.t('autosuggests.sem_dados')
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
return null
|
|
405
421
|
}
|
|
406
422
|
},
|
|
407
423
|
|