@tagplus/components 0.2.110 → 1.0.5

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.
Files changed (40) hide show
  1. package/dist/tp.common.js +1 -9055
  2. package/dist/tp.common.js.map +1 -1
  3. package/dist/tp.css +180 -1
  4. package/dist/tp.umd.js +1 -9082
  5. package/dist/tp.umd.js.map +1 -1
  6. package/dist/tp.umd.min.js +1 -1
  7. package/dist/tp.umd.min.js.map +1 -1
  8. package/package.json +17 -13
  9. package/src/components/Autosuggest/Autosuggest.vue +40 -39
  10. package/src/components/Inline/Inline.vue +9 -10
  11. package/src/components/Inline/index.js +1 -1
  12. package/src/components/InputNumber/InputNumber.vue +3 -3
  13. package/src/components/InputNumber/index.js +1 -1
  14. package/src/components/Loader/Loader.vue +6 -6
  15. package/src/components/Loader/index.js +1 -1
  16. package/src/components/Money/Money.vue +8 -8
  17. package/src/components/Money/index.js +1 -1
  18. package/src/components/Multisuggest/Multisuggest.vue +39 -40
  19. package/src/components/OptionsList/OptionsList.vue +1 -1
  20. package/src/components/OptionsList/index.js +1 -1
  21. package/src/components/OptionsListItem/OptionsListItem.vue +10 -4
  22. package/src/components/OptionsListItem/index.js +1 -1
  23. package/src/components/Percent/Percent.vue +9 -9
  24. package/src/components/Percent/index.js +1 -1
  25. package/src/components/Skeleton/Skeleton.vue +7 -7
  26. package/src/components/Skeleton/index.js +1 -1
  27. package/src/components/Step/Step.vue +22 -23
  28. package/src/components/Step/index.js +1 -1
  29. package/src/components/Steps/Steps.vue +3 -3
  30. package/src/components/Steps/index.js +2 -2
  31. package/src/components/Tip/Tip.vue +19 -15
  32. package/src/components/Tip/index.js +2 -2
  33. package/src/components/index.js +1 -1
  34. package/src/locale/index.js +13 -15
  35. package/src/locale/lang/en.js +3 -3
  36. package/src/locale/lang/pt-br.js +3 -3
  37. package/src/main.js +3 -6
  38. package/src/mixins/locale.js +2 -2
  39. package/src/utils/currency.js +15 -15
  40. package/src/utils/filters.js +8 -10
@@ -344,7 +344,7 @@ export default {
344
344
  }
345
345
  },
346
346
 
347
- data() {
347
+ data () {
348
348
  return {
349
349
  selectedLabelsArray: [],
350
350
  selectedLabels: ''
@@ -352,19 +352,18 @@ export default {
352
352
  },
353
353
 
354
354
  computed: {
355
- _id() {
355
+ _id () {
356
356
  return this.id || this.$options.name
357
357
  },
358
358
 
359
359
  /**
360
360
  * Trata o caso que o autosuggest recebe um objeto com o valueKey e labelKey
361
361
  */
362
- formatedValue() {
362
+ formatedValue () {
363
363
  let newVal = ''
364
364
  if (typeof this.value === 'boolean') {
365
365
  newVal = ''
366
- }
367
- else if (Array.isArray(this.value)) {
366
+ } else if (Array.isArray(this.value)) {
368
367
  this.value.forEach((item) => {
369
368
  if (!item[this.valueKey]) {
370
369
  if (process.env.DEBUG === 'true') {
@@ -372,31 +371,31 @@ export default {
372
371
  }
373
372
  }
374
373
  })
375
-
374
+
376
375
  newVal = this.value
377
376
  }
378
377
 
379
378
  return newVal
380
379
  },
381
- iconClass() {
380
+ iconClass () {
382
381
  return this.visible ? 'arrow-up is-reverse' : 'arrow-up'
383
382
  },
384
- showNewOption() {
385
- let hasExistingOption = this.options
383
+ showNewOption () {
384
+ const hasExistingOption = this.options
386
385
  .filter(option => !option.created)
387
386
  .some(option => option.currentLabel === this.query)
388
387
  return this.filterable && this.allowCreate && !hasExistingOption
389
388
  },
390
389
  // Monta a lista com ou sem "Cadastrar Novo Item"
391
- suggestionsList() {
390
+ suggestionsList () {
392
391
  if (this.loading) return []
393
- //transformando em Array
394
- let list =
392
+ // transformando em Array
393
+ const list =
395
394
  typeof this.suggestions === 'object'
396
395
  ? Object.values(this.suggestions)
397
396
  : this.suggestions
398
397
  if (this.allowCreate) {
399
- let createdSuggestion = { created: true }
398
+ const createdSuggestion = { created: true }
400
399
  createdSuggestion[this.valueKey] = this.query !== '' ? this.query : null
401
400
  createdSuggestion[this.labelKey] = ''
402
401
  list.push(createdSuggestion)
@@ -404,12 +403,13 @@ export default {
404
403
  return list
405
404
  },
406
405
 
407
- emptyText() {
406
+ emptyText () {
408
407
  if (this.loading) {
409
408
  return this.loadingText || this.t('el.select.loading')
410
409
  } else {
411
410
  if (this.remote && this.query === '' && this.options.length === 0) {
412
- return this.noDataText || this.$tpI18n.t('autosuggests.sem_dados')}
411
+ return this.noDataText || this.$tpI18n.t('autosuggests.sem_dados')
412
+ }
413
413
  if (this.filterable && this.query && this.options.length > 0 && this.filteredOptionsCount === 0) {
414
414
  return this.noMatchText || this.t('el.select.noMatch')
415
415
  }
@@ -423,19 +423,19 @@ export default {
423
423
 
424
424
  watch: {
425
425
  // eslint-disable-next-line no-unused-vars
426
- value(newValue, oldValue) {
426
+ value (newValue, oldValue) {
427
427
  // Se limpou com o X
428
428
  if (!Array.isArray(newValue)) {
429
429
  this.selectedLabelsArray = []
430
430
  } else if (newValue.length > oldValue.length) {
431
- let novoItem = newValue.filter(x => !oldValue.includes(x))
431
+ const novoItem = newValue.filter(x => !oldValue.includes(x))
432
432
  this.suggestionsList.forEach(item => {
433
433
  if (item[this.valueKey] === novoItem[0]) {
434
434
  this.selectedLabelsArray.push(item)
435
435
  }
436
436
  })
437
437
  } else {
438
- let itemApagado = oldValue.filter(x => !newValue.includes(x))
438
+ const itemApagado = oldValue.filter(x => !newValue.includes(x))
439
439
  this.selectedLabelsArray.forEach((item, index) => {
440
440
  if (item.id === itemApagado[0]) {
441
441
  this.selectedLabelsArray.splice(index, 1)
@@ -451,7 +451,7 @@ export default {
451
451
  }
452
452
  },
453
453
 
454
- created() {
454
+ created () {
455
455
  this.debouncedQueryChange = debounce(this.debounce, e => {
456
456
  if (e.isComposing) {
457
457
  // Se está apagando
@@ -473,16 +473,16 @@ export default {
473
473
  }
474
474
  })
475
475
 
476
- if(Array.isArray(this.value)){
477
- this.value.forEach((item,key) => {
476
+ if (Array.isArray(this.value)) {
477
+ this.value.forEach((item, key) => {
478
478
  if (item[this.valueKey]) {
479
479
  this.value[key] = item[this.valueKey]
480
- if(item[this.labelKey]) {
480
+ if (item[this.labelKey]) {
481
481
  this.selectedLabelsArray.push(item)
482
482
  }
483
483
  }
484
484
  })
485
- }else if(process.env.DEBUG === 'true'){
485
+ } else if (process.env.DEBUG === 'true') {
486
486
  console.log(`'${this.$options.name}' recebeu valor em formato inválido.`)
487
487
  console.log(this.value)
488
488
  }
@@ -508,7 +508,7 @@ export default {
508
508
  },
509
509
 
510
510
  methods: {
511
- emitChange(val) {
511
+ emitChange (val) {
512
512
  if (!valueEquals(this.formatedValue, val)) {
513
513
  this.$nextTick(() => {
514
514
  this.$emit('change', val, this.createdSelected)
@@ -517,7 +517,7 @@ export default {
517
517
  },
518
518
 
519
519
  // eslint-disable-next-line no-unused-vars
520
- clearTags(event) {
520
+ clearTags (event) {
521
521
  // Faz uma requisição limpa
522
522
  this.query = ''
523
523
  this.doRequest = true
@@ -534,7 +534,7 @@ export default {
534
534
  /**
535
535
  * Sobrescreve o getOption do select para mostrar o labelValue em vez do idValue
536
536
  */
537
- getOption(val) {
537
+ getOption (val) {
538
538
  let value = ''
539
539
  let initialLabel = false
540
540
 
@@ -542,9 +542,8 @@ export default {
542
542
  value = ''
543
543
  } else if (Array.isArray(val)) {
544
544
  value = val
545
- }
546
- else if (val && typeof val === 'object') {
547
- // Se val for Object converte para outro tipo
545
+ } else if (val && typeof val === 'object') {
546
+ // Se val for Object converte para outro tipo
548
547
  if (!val[this.valueKey]) {
549
548
  console.error(`Multisuggest '${this.$options.name}' option doesn't have a valueKey '${this.valueKey}' key`)
550
549
  } else {
@@ -581,16 +580,16 @@ export default {
581
580
  }
582
581
  if (option) return option
583
582
  const label = !isObject && !isNull && !isUndefined ? value : ''
584
- let newOption = {
585
- value: value,
586
- currentLabel: initialLabel ? initialLabel : label
583
+ const newOption = {
584
+ value,
585
+ currentLabel: initialLabel || label
587
586
  }
588
587
  if (this.multiple) {
589
588
  newOption.hitState = false
590
589
  }
591
590
  return newOption
592
591
  },
593
- checkDefaultFirstOption() {
592
+ checkDefaultFirstOption () {
594
593
  this.$nextTick(() => {
595
594
  this.hoverIndex = -1
596
595
 
@@ -615,7 +614,7 @@ export default {
615
614
  /**
616
615
  * Sobrescreve a função de abrir menu do select para fazer a busca quando loadOnCreate = false
617
616
  */
618
- toggleMenu() {
617
+ toggleMenu () {
619
618
  if (!this.selectDisabled) {
620
619
  // Se mantem visivel quando clica nele aberto
621
620
  if (this.menuVisibleOnFocus) {
@@ -631,7 +630,7 @@ export default {
631
630
  }
632
631
  },
633
632
 
634
- handleClose() {
633
+ handleClose () {
635
634
  this.visible && this.$emit('closeSelect')
636
635
  this.visible = false
637
636
  // Limpa busca quando fecha
@@ -641,8 +640,8 @@ export default {
641
640
  /**
642
641
  * Sobrescreve função do select
643
642
  */
644
- handleQueryChange(val, forceBusca = false) {
645
- var _this6 = this
643
+ handleQueryChange (val, forceBusca = false) {
644
+ const _this6 = this
646
645
  // Correção aqui para forçar primeira request com createOnLoad = false
647
646
  // Não considera isOnComposition mais
648
647
  if (!this.doRequest && this.previousQuery === val) return
@@ -657,13 +656,13 @@ export default {
657
656
  }
658
657
  }
659
658
  this.previousQuery = val
660
- this.$nextTick(function() {
659
+ this.$nextTick(function () {
661
660
  if (_this6.visible) _this6.broadcast('ElSelectDropdown', 'updatePopper')
662
661
  })
663
662
  this.hoverIndex = -1
664
663
  if (this.multiple && this.filterable) {
665
- this.$nextTick(function() {
666
- var length = _this6.$refs.input.value.length * 15 + 20
664
+ this.$nextTick(function () {
665
+ const length = _this6.$refs.input.value.length * 15 + 20
667
666
  _this6.inputLength = _this6.collapseTags
668
667
  ? Math.min(50, length)
669
668
  : length
@@ -16,7 +16,7 @@ export default {
16
16
  justifyContent: {
17
17
  // 'space-between' / 'space-around' / (any flex property)
18
18
  type: String,
19
- default: 'space-between',
19
+ default: 'space-between'
20
20
  },
21
21
  disabled: {
22
22
  type: Boolean,
@@ -1,3 +1,3 @@
1
1
  import OptionsList from './OptionsList'
2
2
 
3
- export default OptionsList
3
+ export default OptionsList
@@ -2,7 +2,9 @@
2
2
  <li
3
3
  :id="id"
4
4
  :class="['tp-options-list-item', itemType, active == optValue ? 'active' : '']"
5
+ tabindex="0"
5
6
  @click="updateOption"
7
+ @keyup.enter="updateOption"
6
8
  >
7
9
  <div :class="['icon', direction]">
8
10
  <i :class="[icon, 'options-icon']" />
@@ -57,7 +59,7 @@ export default {
57
59
  },
58
60
  checked: {
59
61
  type: Boolean,
60
- default: false,
62
+ default: false
61
63
  },
62
64
  type: {
63
65
  type: String,
@@ -66,14 +68,14 @@ export default {
66
68
  active: {
67
69
  type: String,
68
70
  default: ''
69
- },
71
+ }
70
72
  },
71
73
  methods: {
72
74
  updateOption () {
73
75
  this.$emit('updateValor', this.optValue)
74
76
  this.$emit('input', this.optValue)
75
- },
76
- },
77
+ }
78
+ }
77
79
  }
78
80
  </script>
79
81
 
@@ -171,6 +173,10 @@ export default {
171
173
 
172
174
  }
173
175
 
176
+ .tp-options-list-item:focus{
177
+ border: 1px solid #437cf9;
178
+ }
179
+
174
180
  .option-item-badge{
175
181
  background-color: #F56C6C;
176
182
  border: 1px solid #FFF;
@@ -1,3 +1,3 @@
1
1
  import OptionsListItem from './OptionsListItem'
2
2
 
3
- export default OptionsListItem
3
+ export default OptionsListItem
@@ -39,34 +39,34 @@ export default {
39
39
  required: false,
40
40
  default: null
41
41
  },
42
-
42
+
43
43
  // remove o simbolo em prepend
44
44
  removePrepend: {
45
- type:Boolean,
45
+ type: Boolean,
46
46
  default: false
47
- },
47
+ },
48
48
 
49
49
  // coloca o simbolo no append
50
50
  showAppend: {
51
- type:Boolean,
51
+ type: Boolean,
52
52
  default: false
53
- },
53
+ },
54
54
 
55
- //valor do campo. Pode ser usado como v-model também
55
+ // valor do campo. Pode ser usado como v-model também
56
56
  value: {
57
57
  type: [Number, String],
58
58
  default: 0
59
59
  },
60
60
 
61
- //tamanho máximo do campo. limitado por padrão a 21 caracteres por limitações do JS
61
+ // tamanho máximo do campo. limitado por padrão a 21 caracteres por limitações do JS
62
62
  maxlength: {
63
63
  type: Number,
64
64
  default: 21
65
- },
65
+ }
66
66
  },
67
67
 
68
68
  computed: {
69
- _id(){
69
+ _id () {
70
70
  return this.id || this.$options.name
71
71
  }
72
72
  },
@@ -1,3 +1,3 @@
1
1
  import Percent from './Percent'
2
2
 
3
- export default Percent
3
+ export default Percent
@@ -40,7 +40,7 @@ export default {
40
40
 
41
41
  /**
42
42
  * Largura em "%"". Quando círculo, em "px"
43
- *
43
+ *
44
44
  */
45
45
  width: {
46
46
  type: Number,
@@ -68,15 +68,15 @@ export default {
68
68
  },
69
69
 
70
70
  computed: {
71
- cWidth() {
72
- if(this.circle && this.width){
71
+ cWidth () {
72
+ if (this.circle && this.width) {
73
73
  return `${this.width}px`
74
74
  }
75
75
  return `${this.width}%`
76
76
  },
77
77
 
78
- cHeight() {
79
- if(this.circle && this.width){
78
+ cHeight () {
79
+ if (this.circle && this.width) {
80
80
  return `${this.width}px`
81
81
  }
82
82
  return `${this.height}em`
@@ -98,7 +98,7 @@ export default {
98
98
  .tp-skeleton {
99
99
  display: block;
100
100
  height: 100%;
101
-
101
+
102
102
  --baseColor: #ebeef2;
103
103
 
104
104
  span {
@@ -132,4 +132,4 @@ export default {
132
132
  }
133
133
  }
134
134
 
135
- </style>
135
+ </style>
@@ -1,3 +1,3 @@
1
1
  import Skeleton from './Skeleton'
2
2
 
3
- export default Skeleton
3
+ export default Skeleton
@@ -84,7 +84,7 @@ export default {
84
84
  }
85
85
  },
86
86
 
87
- data() {
87
+ data () {
88
88
  return {
89
89
  index: -1,
90
90
  lineStyle: {},
@@ -93,34 +93,34 @@ export default {
93
93
  },
94
94
 
95
95
  computed: {
96
- currentStatus() {
96
+ currentStatus () {
97
97
  return this.internalStatus
98
98
  },
99
- prevStatus() {
99
+ prevStatus () {
100
100
  const prevStep = this.$parent.steps[this.index - 1]
101
101
  return prevStep ? prevStep.currentStatus : 'wait'
102
102
  },
103
- isCenter() {
103
+ isCenter () {
104
104
  return this.$parent.alignCenter
105
105
  },
106
- isVertical() {
106
+ isVertical () {
107
107
  return this.$parent.direction === 'vertical'
108
108
  },
109
- isSimple() {
109
+ isSimple () {
110
110
  return this.$parent.simple
111
111
  },
112
- isLast() {
112
+ isLast () {
113
113
  const parent = this.$parent
114
114
  return parent.steps[parent.steps.length - 1] === this
115
115
  },
116
- stepsCount() {
116
+ stepsCount () {
117
117
  return this.$parent.steps.length
118
118
  },
119
- space() {
119
+ space () {
120
120
  const { isSimple, $parent: { space } } = this
121
- return isSimple ? '' : space
121
+ return isSimple ? '' : space
122
122
  },
123
- style: function() {
123
+ style: function () {
124
124
  const style = {}
125
125
  const parent = this.$parent
126
126
  const len = parent.steps.length
@@ -143,19 +143,18 @@ export default {
143
143
  },
144
144
 
145
145
  watch: {
146
- status (newVal) {
147
- if(newVal === 'process' || newVal === 'error'){
148
- this.updateStatus(this.$parent.active)
149
- }
150
- },
146
+ status () {
147
+ this.updateStatus(this.$parent.active)
148
+ this.internalStatus = this.status
149
+ }
151
150
 
152
151
  },
153
152
 
154
- beforeCreate() {
153
+ beforeCreate () {
155
154
  this.$parent.steps.push(this)
156
155
  },
157
156
 
158
- beforeDestroy() {
157
+ beforeDestroy () {
159
158
  const steps = this.$parent.steps
160
159
  const index = steps.indexOf(this)
161
160
  if (index >= 0) {
@@ -163,7 +162,7 @@ export default {
163
162
  }
164
163
  },
165
164
 
166
- mounted() {
165
+ mounted () {
167
166
  const unwatch = this.$watch('index', () => {
168
167
  this.$watch('$parent.active', this.updateStatus, { immediate: true })
169
168
  this.$watch('$parent.processStatus', () => {
@@ -175,10 +174,10 @@ export default {
175
174
  },
176
175
 
177
176
  methods: {
178
- updateStatus(val) {
177
+ updateStatus (val) {
179
178
  const prevChild = this.$parent.$children[this.index - 1]
180
179
 
181
- if (this.status === 'error'){
180
+ if (this.status === 'error') {
182
181
  this.internalStatus = 'error'
183
182
  } else if (val > this.index) {
184
183
  this.internalStatus = this.$parent.finishStatus
@@ -191,14 +190,14 @@ export default {
191
190
  if (prevChild) prevChild.calcProgress(this.internalStatus)
192
191
  },
193
192
 
194
- calcProgress(status) {
193
+ calcProgress (status) {
195
194
  let step = 100
196
195
  const style = {}
197
196
 
198
197
  style.transitionDelay = 150 * this.index + 'ms'
199
198
  // if (status === this.$parent.processStatus) {
200
199
  // step = this.currentStatus !== 'error' ? 0 : 0
201
- // } else
200
+ // } else
202
201
  if (status === 'wait') {
203
202
  step = 0
204
203
  style.transitionDelay = (-50 * this.index) + 'ms'
@@ -1,3 +1,3 @@
1
1
  import Step from './Step'
2
2
 
3
- export default Step
3
+ export default Step
@@ -10,10 +10,10 @@ export default {
10
10
  type: Boolean,
11
11
  default: false
12
12
  }
13
- },
14
- }
13
+ }
14
+ }
15
15
 
16
16
  </script>
17
17
 
18
18
  <style lang="scss" scoped>
19
- </style>
19
+ </style>
@@ -1,3 +1,3 @@
1
- import Steps from './Steps'
1
+ import Steps from './Steps'
2
2
 
3
- export default Steps
3
+ export default Steps
@@ -5,20 +5,24 @@
5
5
  align="middle"
6
6
  :class="tptipclasses"
7
7
  >
8
- <el-col :sm="24" :lg="3">
8
+ <el-col
9
+ :sm="24"
10
+ :lg="3"
11
+ >
9
12
  <div style="display: flex; min-width:25px; justify-content: center; margin:15px; padding: auto">
10
13
  <em class="far fa-lightbulb-on" />
11
14
  </div>
12
15
  </el-col>
13
16
 
14
- <el-col :sm="24" :lg="21">
17
+ <el-col
18
+ :sm="24"
19
+ :lg="21"
20
+ >
15
21
  <div
16
22
  :id="`${_id}-text`"
17
23
  style="margin:15px; margin-left:0px"
18
24
  v-html="text"
19
- >
20
- {{ text }}
21
- </div>
25
+ />
22
26
  </el-col>
23
27
  </el-row>
24
28
  </template>
@@ -36,7 +40,7 @@ export default {
36
40
  text: {
37
41
  type: String,
38
42
  required: true,
39
- default: '',
43
+ default: ''
40
44
  },
41
45
 
42
46
  type: {
@@ -81,7 +85,7 @@ export default {
81
85
  padding: 1rem;
82
86
  font-size: 14px;
83
87
  line-height: 24px;
84
- color: #586D93;
88
+ color: #586d93;
85
89
  }
86
90
 
87
91
  .info-text {
@@ -106,26 +110,26 @@ export default {
106
110
  }
107
111
 
108
112
  .tp-tip-warning {
109
- background: #FFF9EA 0% 0% no-repeat padding-box;
110
- border: 1px solid #FFC437;
113
+ background: #fff9ea 0% 0% no-repeat padding-box;
114
+ border: 1px solid #ffc437;
111
115
  ::v-deep strong,
112
116
  ::v-deep b {
113
- color: #FFC437;
117
+ color: #ffc437;
114
118
  }
115
119
  ::v-deep em {
116
- color: #FFC437;
120
+ color: #ffc437;
117
121
  }
118
122
  }
119
123
 
120
124
  .tp-tip-success {
121
- background: #F3FCFC 0% 0% no-repeat padding-box;
122
- border: 1px solid #08A19E;
125
+ background: #f3fcfc 0% 0% no-repeat padding-box;
126
+ border: 1px solid #08a19e;
123
127
  ::v-deep strong,
124
128
  ::v-deep b {
125
- color: #08A19E;
129
+ color: #08a19e;
126
130
  }
127
131
  ::v-deep em {
128
- color: #08A19E;
132
+ color: #08a19e;
129
133
  }
130
134
  }
131
135
  </style>
@@ -1,3 +1,3 @@
1
- import Tip from './Tip'
1
+ import Tip from './Tip'
2
2
 
3
- export default Tip
3
+ export default Tip
@@ -26,4 +26,4 @@ export {
26
26
  Step,
27
27
  Steps,
28
28
  InputNumber
29
- }
29
+ }