@tagplus/components 0.2.92 → 0.2.96

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.92",
10
+ "version": "0.2.96",
11
11
  "main": "./dist/tp.common.js",
12
12
  "directories": {
13
13
  "lib": "src/lib"
@@ -363,20 +363,17 @@ export default {
363
363
  let newVal = ''
364
364
  if (typeof this.value === 'boolean') {
365
365
  newVal = ''
366
- } else if (Array.isArray(this.value)) {
367
- newVal = this.value
368
- } else if (this.value && typeof this.value === 'object') {
369
- if (!this.value[this.valueKey]) {
370
- if (process.env.DEBUG === 'true') {
371
- throw new TypeError(
372
- 'Autosuggest this.value doesn\'t have a valueKey \'' +
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
- } else {
378
- newVal = this.value[this.valueKey]
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 () {
@@ -467,7 +479,7 @@ export default {
467
479
  if (this.loadOnCreate) {
468
480
  this.previousQuery = false
469
481
  // Chama função do element-ui select que faz o remote method
470
- this.handleQueryChange('')
482
+ this.handleQueryChange('', true)
471
483
  } else {
472
484
  // Marca para fazer a requisição no primeiro clique
473
485
  this.doRequest = true
@@ -509,20 +521,18 @@ export default {
509
521
  value = ''
510
522
  } else if (Array.isArray(val)) {
511
523
  value = val
512
- } else if (val && typeof val === 'object') {
513
- // Se val for Object converte para outro tipo
514
- if (!this.value[this.valueKey]) {
515
- throw new TypeError(
516
- 'Autosuggest this.value doesn\'t have a valueKey \'' +
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 (this.value[this.labelKey]) {
523
- initialLabel = this.value[this.labelKey]
531
+ if (val[this.labelKey]) {
532
+ initialLabel = val[this.labelKey]
524
533
  }
525
- value = this.value[this.valueKey]
534
+
535
+ value = val
526
536
  }
527
537
  } else {
528
538
  value = val
@@ -586,19 +596,17 @@ export default {
586
596
  */
587
597
  toggleMenu() {
588
598
  if (!this.selectDisabled) {
599
+ // Se mantem visivel quando clica nele aberto
589
600
  if (this.menuVisibleOnFocus) {
590
601
  this.menuVisibleOnFocus = false
591
602
  } else {
592
603
  this.visible = !this.visible
593
604
  }
594
- // Se está visivel
595
- if (this.visible) {
596
- if (this.doRequest) {
597
- this.handleQueryChange(this.query)
598
- this.doRequest = false
599
- }
600
- (this.$refs.input || this.$refs.reference).focus()
605
+ if (this.doRequest) {
606
+ this.handleQueryChange(this.query, true)
607
+ this.doRequest = false
601
608
  }
609
+ (this.$refs.input || this.$refs.reference).focus()
602
610
  }
603
611
  },
604
612
 
@@ -747,23 +755,27 @@ input.el-input__inner {
747
755
  transition: 100ms all linear;
748
756
 
749
757
  &.hover {
750
- padding-left: 20px;
758
+ background-color: #f5f7fa;
759
+ font-weight: bold;
760
+ }
761
+
762
+ &.selected {
763
+ color: #2D6EDA;
764
+ padding-left: 30px;
765
+ background-color: #F0F3F9;
766
+ border-radius: 5px;
767
+ font-weight: none;
751
768
 
752
769
  &::before {
753
- content: "";
754
770
  position: absolute;
755
- display: inline-block;
756
- width: 4px;
757
- top: 5px;
758
- bottom: 5px;
759
- left: 5px;
760
- background: $--color-primary;
761
- border-radius: 2px;
771
+ left: 7px;
772
+ font-family: "element-icons";
773
+ content: "\e6da";
774
+ font-size: 15px;
775
+ }
776
+ &::after {
777
+ content: "";
762
778
  }
763
- }
764
-
765
- &.selected {
766
- color: $--color-text-regular;
767
779
  }
768
780
  &.created a {
769
781
  color: $--color-primary;