@tagplus/components 0.2.96 → 0.2.100

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/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "email": "bruno@tagplus.com.br"
8
8
  }
9
9
  ],
10
- "version": "0.2.96",
10
+ "version": "0.2.100",
11
11
  "main": "./dist/tp.common.js",
12
12
  "directories": {
13
13
  "lib": "src/lib"
@@ -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" /> Cadastrar {{ query ? `"${query}"` : "novo item" }}</a>
131
+ <a :id="`${_id}-btn-create`"><i class="far fa-plus" /> {{ newItem }}</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
 
@@ -276,6 +286,9 @@ export default {
276
286
  _id() {
277
287
  return this.id || this.$options.name
278
288
  },
289
+ newItem(){
290
+ return this.query ? this.$tpI18n.t('autosuggests.cadastrar', {nameItem: this.query}) : this.$tpI18n.t(`autosuggests.newItem.${this.$parent.$options.name}`)
291
+ },
279
292
 
280
293
  /**
281
294
  * Trata o caso que o autosuggest recebe um objeto com o valueKey e labelKey
@@ -371,9 +384,18 @@ export default {
371
384
  this.createHandler(componenteInputInterno, 'mouseleave', () => {
372
385
  this.tooltipVisible = false
373
386
  })
387
+ document.addEventListener('focusin', this.fixElSelect)
388
+ document.addEventListener('click', this.fixElSelect)
389
+ document.addEventListener('touchstart', this.fixElSelect)
374
390
  })
375
391
  },
376
392
 
393
+ beforeDestroy() {
394
+ document.removeEventListener('focusin', this.fixElSelect, false)
395
+ document.removeEventListener('click', this.fixElSelect, false)
396
+ document.removeEventListener('touchstart', this.fixElSelect, false)
397
+ },
398
+
377
399
  methods: {
378
400
  /**
379
401
  * Adiciona um evento no elemento dinamicamente
@@ -587,8 +609,22 @@ export default {
587
609
  ) {
588
610
  this.checkDefaultFirstOption()
589
611
  }
612
+ },
613
+
614
+ // Correção para habilitar teclado mobile em iOS
615
+ fixElSelect() {
616
+ document.querySelectorAll('.el-select[data-is-search="true"]:hover').forEach(() => {
617
+ let elInput = document.querySelector('.el-select[data-is-search="true"]:hover input[readonly]')
618
+ if (elInput) {
619
+ elInput.readOnly = false
620
+ elInput.blur()
621
+ elInput.focus()
622
+ }
623
+ })
590
624
  }
591
625
  }
626
+
627
+
592
628
  }
593
629
  </script>
594
630
 
@@ -611,6 +611,7 @@ export default {
611
611
  },
612
612
 
613
613
  handleClose() {
614
+ this.visible && this.$emit('closeSelect')
614
615
  this.visible = false
615
616
  // Limpa busca quando fecha
616
617
  this.doRequest = true