@tagplus/components 2.1.1 → 2.1.2

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
@@ -8,7 +8,7 @@
8
8
  "email": "bruno@tagplus.com.br"
9
9
  }
10
10
  ],
11
- "version": "2.1.1",
11
+ "version": "2.1.2",
12
12
  "main": "./dist/tp.common.js",
13
13
  "directories": {
14
14
  "lib": "src/lib"
@@ -31,8 +31,8 @@
31
31
  :class="{ 'is-focus': visible }"
32
32
  :tabindex="(multiple && filterable) ? '-1' : null"
33
33
  popper-append-to-body="teste"
34
- @focus="handleFocus"
35
- @blur="handleBlur"
34
+ @focus="ativarFocus"
35
+ @blur="ativarBlur"
36
36
  @keyup.native="debouncedOnInputChange"
37
37
  @keydown.native.down.stop.prevent="navigateOptions('next')"
38
38
  @keydown.native.up.stop.prevent="navigateOptions('prev')"
@@ -99,13 +99,14 @@
99
99
  </el-row>
100
100
  </template>
101
101
  </el-input>
102
+
102
103
  <transition
103
104
  name="el-zoom-in-top"
104
105
  @before-enter="handleMenuEnter"
105
106
  @after-leave="doDestroy"
106
107
  >
107
108
  <el-select-menu
108
- v-show="visible && emptyText !== false"
109
+ v-show="visible &&! hideOptions && emptyText !== false"
109
110
  :id="`${_id}-select`"
110
111
  ref="popper"
111
112
  :append-to-body="popperAppendToBody"
@@ -279,7 +280,8 @@ export default {
279
280
 
280
281
  data () {
281
282
  return {
282
- tooltipVisible: false
283
+ tooltipVisible: false,
284
+ hideOptions: false
283
285
  }
284
286
  },
285
287
 
@@ -371,6 +373,8 @@ export default {
371
373
 
372
374
  created () {
373
375
  this.debouncedOnInputChange = debounce(this.debounce, e => {
376
+ this.hideOptions = false
377
+
374
378
  // Correção para mobile ativar a busca enquanto digita
375
379
  if (e.isComposing) {
376
380
  // Se está apagando
@@ -426,6 +430,32 @@ export default {
426
430
  },
427
431
 
428
432
  methods: {
433
+
434
+ ativarFocus (ev) {
435
+ const input = this.$refs.reference.$el.getElementsByTagName('input')[0]
436
+
437
+ // Rensponsavel por nao mostrar o menu de opcoes no fist focus
438
+ if (input.dataset.firstFocus && !this.fistFocusFlag) {
439
+ this.hideOptions = true
440
+
441
+ // Demora um tempo para o firstFocus ser removido
442
+ // Entao precisamos ter certeza que ele nao cai aqui de novo.
443
+ this.fistFocusFlag = true
444
+ delete input.dataset.firstFocus
445
+ }
446
+
447
+ this.handleFocus(ev)
448
+ },
449
+
450
+ ativarBlur (ev) {
451
+ this.handleBlur(ev)
452
+
453
+ // Evita animacao do blur
454
+ if (this.hideOptions) {
455
+ setTimeout(() => { this.hideOptions = false }, 1000)
456
+ }
457
+ },
458
+
429
459
  /**
430
460
  * Adiciona um evento no elemento dinamicamente
431
461
  * @args el {Object} Elemento que tem o listener
@@ -711,6 +741,7 @@ input.el-input__inner {
711
741
  margin: 0px;
712
742
  }
713
743
  .tp-autosuggest.el-select {
744
+
714
745
  > .el-input {
715
746
  display: inline-table;
716
747
  }
@@ -1,4 +1,3 @@
1
-
2
1
  <script>
3
2
  import { Steps } from 'element-ui'
4
3