@tagplus/components 0.2.94 → 0.2.98
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 +624 -1026
- package/dist/tp.common.js.map +1 -1
- package/dist/tp.css +1 -1
- package/dist/tp.umd.js +624 -1026
- 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 +1 -1
- package/src/components/Autosuggest/Autosuggest.vue +34 -1
- package/src/components/Multisuggest/Multisuggest.vue +34 -24
package/package.json
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<div
|
|
3
3
|
v-clickoutside="handleClose"
|
|
4
4
|
class="el-select tp-autosuggest"
|
|
5
|
+
data-is-search="true"
|
|
5
6
|
:class="[selectSize ? 'el-select--' + selectSize : '']"
|
|
6
7
|
@click.stop="toggleMenu"
|
|
7
8
|
>
|
|
@@ -127,7 +128,7 @@
|
|
|
127
128
|
:class="{'created': item.created}"
|
|
128
129
|
>
|
|
129
130
|
<template v-if="item.created">
|
|
130
|
-
<a :id="`${_id}-btn-create`"><i class="far fa-plus" />
|
|
131
|
+
<a :id="`${_id}-btn-create`"><i class="far fa-plus" /> {{ query ? `Cadastrar "${query}"` : msgNewItem }}</a>
|
|
131
132
|
</template>
|
|
132
133
|
<slot
|
|
133
134
|
v-else
|
|
@@ -263,6 +264,15 @@ export default {
|
|
|
263
264
|
remoteMethod: {
|
|
264
265
|
type: Function,
|
|
265
266
|
required: true
|
|
267
|
+
},
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Informa a mensagem de cadastrar novo item
|
|
271
|
+
*/
|
|
272
|
+
msgNewItem: {
|
|
273
|
+
type: String,
|
|
274
|
+
required: false,
|
|
275
|
+
default: 'Cadastrar novo item'
|
|
266
276
|
}
|
|
267
277
|
},
|
|
268
278
|
|
|
@@ -371,9 +381,18 @@ export default {
|
|
|
371
381
|
this.createHandler(componenteInputInterno, 'mouseleave', () => {
|
|
372
382
|
this.tooltipVisible = false
|
|
373
383
|
})
|
|
384
|
+
document.addEventListener('focusin', this.fixElSelect)
|
|
385
|
+
document.addEventListener('click', this.fixElSelect)
|
|
386
|
+
document.addEventListener('touchstart', this.fixElSelect)
|
|
374
387
|
})
|
|
375
388
|
},
|
|
376
389
|
|
|
390
|
+
beforeDestroy() {
|
|
391
|
+
document.removeEventListener('focusin', this.fixElSelect, false)
|
|
392
|
+
document.removeEventListener('click', this.fixElSelect, false)
|
|
393
|
+
document.removeEventListener('touchstart', this.fixElSelect, false)
|
|
394
|
+
},
|
|
395
|
+
|
|
377
396
|
methods: {
|
|
378
397
|
/**
|
|
379
398
|
* Adiciona um evento no elemento dinamicamente
|
|
@@ -587,8 +606,22 @@ export default {
|
|
|
587
606
|
) {
|
|
588
607
|
this.checkDefaultFirstOption()
|
|
589
608
|
}
|
|
609
|
+
},
|
|
610
|
+
|
|
611
|
+
// Correção para habilitar teclado mobile em iOS
|
|
612
|
+
fixElSelect() {
|
|
613
|
+
document.querySelectorAll('.el-select[data-is-search="true"]:hover').forEach(() => {
|
|
614
|
+
let elInput = document.querySelector('.el-select[data-is-search="true"]:hover input[readonly]')
|
|
615
|
+
if (elInput) {
|
|
616
|
+
elInput.readOnly = false
|
|
617
|
+
elInput.blur()
|
|
618
|
+
elInput.focus()
|
|
619
|
+
}
|
|
620
|
+
})
|
|
590
621
|
}
|
|
591
622
|
}
|
|
623
|
+
|
|
624
|
+
|
|
592
625
|
}
|
|
593
626
|
</script>
|
|
594
627
|
|
|
@@ -363,20 +363,17 @@ export default {
|
|
|
363
363
|
let newVal = ''
|
|
364
364
|
if (typeof this.value === 'boolean') {
|
|
365
365
|
newVal = ''
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
this.valueKey +
|
|
374
|
-
'\' key'
|
|
375
|
-
)
|
|
366
|
+
}
|
|
367
|
+
else if (Array.isArray(this.value)) {
|
|
368
|
+
this.value.forEach((item) => {
|
|
369
|
+
if (!item[this.valueKey]) {
|
|
370
|
+
if (process.env.DEBUG === 'true') {
|
|
371
|
+
throw new TypeError('Autosuggest this.value doesn\'t have a valueKey \'' + this.valueKey + '\' key')
|
|
372
|
+
}
|
|
376
373
|
}
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
|
|
374
|
+
})
|
|
375
|
+
|
|
376
|
+
newVal = this.value
|
|
380
377
|
}
|
|
381
378
|
|
|
382
379
|
return newVal
|
|
@@ -459,6 +456,21 @@ export default {
|
|
|
459
456
|
this.handleQueryChange(e.target.value, forceBusca)
|
|
460
457
|
}
|
|
461
458
|
})
|
|
459
|
+
|
|
460
|
+
this.value.forEach((item,key) => {
|
|
461
|
+
if (item[this.valueKey]) {
|
|
462
|
+
this.value[key] = item[this.valueKey]
|
|
463
|
+
if(item[this.labelKey]) {
|
|
464
|
+
this.selectedLabelsArray.push(item)
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
})
|
|
468
|
+
|
|
469
|
+
this.selectedLabels = this.selectedLabelsArray
|
|
470
|
+
.map(item => {
|
|
471
|
+
return item[this.labelKey]
|
|
472
|
+
})
|
|
473
|
+
.join(', ')
|
|
462
474
|
},
|
|
463
475
|
|
|
464
476
|
beforeMount () {
|
|
@@ -509,20 +521,18 @@ export default {
|
|
|
509
521
|
value = ''
|
|
510
522
|
} else if (Array.isArray(val)) {
|
|
511
523
|
value = val
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
this.valueKey +
|
|
518
|
-
'\' key'
|
|
519
|
-
)
|
|
524
|
+
}
|
|
525
|
+
else if (val && typeof val === 'object') {
|
|
526
|
+
// Se val for Object converte para outro tipo
|
|
527
|
+
if (!val[this.valueKey]) {
|
|
528
|
+
throw new TypeError('Multisuggest option doesn\'t have a valueKey \'' + this.valueKey + '\' key')
|
|
520
529
|
} else {
|
|
521
530
|
// Se mandou a label no objeto value
|
|
522
|
-
if (
|
|
523
|
-
initialLabel =
|
|
531
|
+
if (val[this.labelKey]) {
|
|
532
|
+
initialLabel = val[this.labelKey]
|
|
524
533
|
}
|
|
525
|
-
|
|
534
|
+
|
|
535
|
+
value = val
|
|
526
536
|
}
|
|
527
537
|
} else {
|
|
528
538
|
value = val
|