@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
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@tagplus/components",
3
3
  "description": "Componentes customizados TagPlus Baseados no ElementUI",
4
+ "target": "web",
4
5
  "maintainers": [
5
6
  {
6
7
  "name": "Bruno Barbosa",
7
8
  "email": "bruno@tagplus.com.br"
8
9
  }
9
10
  ],
10
- "version": "0.2.110",
11
+ "version": "1.0.5",
11
12
  "main": "./dist/tp.common.js",
12
13
  "directories": {
13
14
  "lib": "src/lib"
@@ -44,35 +45,38 @@
44
45
  "axios": "^0.27.0",
45
46
  "core-js": "^3.21.1",
46
47
  "element-theme-chalk": "^2.13",
47
- "element-ui": "^2.13",
48
+ "element-ui": "^2.15.9",
48
49
  "js-cookie": "^3.0.1",
49
50
  "vue": "^2.6.14",
50
51
  "vue-axios": "^2.1.5",
51
52
  "vue-i18n": "^8.14.0"
52
53
  },
53
54
  "devDependencies": {
55
+ "@babel/core": "^7.18.5",
54
56
  "@babel/eslint-parser": "^7.17.0",
55
- "@nuxtjs/eslint-config": "^8.0.0",
56
- "@nuxtjs/eslint-module": "^3.0.2",
57
57
  "@vue/cli-plugin-babel": "^5.0.3",
58
58
  "@vue/cli-plugin-unit-jest": "^5.0.3",
59
59
  "@vue/cli-service": "^5.0.3",
60
- "@vue/test-utils": "1.0.0-beta.30",
60
+ "@vue/test-utils": "^1.0.0-beta.31",
61
61
  "@vuese/cli": "^2.10.0",
62
- "babel-core": "7.0.0-bridge.0",
63
62
  "babel-jest": "^24.9.0",
64
63
  "babel-plugin-module-resolver": "^3.2.0",
64
+ "babel-plugin-require-context-hook": "^1.0.0",
65
65
  "eslint": "^8.9.0",
66
66
  "eslint-config-prettier": "^8.4.0",
67
- "eslint-config-standard": "^16.0.3",
68
- "eslint-plugin-nuxt": ">=0.4.2",
67
+ "eslint-config-standard": "^17.0.0",
68
+ "eslint-import-resolver-babel-module": "^5.3.1",
69
+ "eslint-plugin-import": "^2.25.2",
70
+ "eslint-plugin-n": "^15.0.0",
69
71
  "eslint-plugin-prettier": "^4.0.0",
70
- "node-sass": "^4.9.0",
71
- "nodemon": "^2.0.1",
72
- "prettier": "^1.18.2",
72
+ "eslint-plugin-promise": "^6.0.0",
73
+ "eslint-plugin-vue": "^9.1.1",
74
+ "node-sass": "^4.14.1",
75
+ "nodemon": "^2.0.2",
76
+ "prettier": "^2.5.1",
73
77
  "sass-loader": "^7.1.0",
78
+ "vue": "^2.6.14",
74
79
  "vue-template-compiler": "^2.6.10",
75
- "webpack": "^5.61.0",
76
- "webpack-bundle-analyzer": "^3.5.0"
80
+ "webpack": "4.46.0"
77
81
  }
78
82
  }
@@ -11,6 +11,7 @@
11
11
  :manual="true"
12
12
  :value="tooltipVisible"
13
13
  :content="selectedLabel + ''"
14
+ :tabindex="-1"
14
15
  >
15
16
  <!-- Div é importante para funcionar o tooltip -->
16
17
  <div />
@@ -276,17 +277,17 @@ export default {
276
277
  }
277
278
  },
278
279
 
279
- data() {
280
+ data () {
280
281
  return {
281
282
  tooltipVisible: false
282
283
  }
283
284
  },
284
285
 
285
286
  computed: {
286
- _id() {
287
+ _id () {
287
288
  return this.id || this.$options.name
288
289
  },
289
- newItem() {
290
+ newItem () {
290
291
  return this.query
291
292
  ? this.$tpI18n.t('autosuggests.cadastrar', { nameItem: this.query })
292
293
  : this.$tpI18n.t(`autosuggests.newItem.${this.$parent.$options.name}`)
@@ -295,7 +296,7 @@ export default {
295
296
  /**
296
297
  * Trata o caso que o autosuggest recebe um objeto com o valueKey e labelKey
297
298
  */
298
- formatedValue() {
299
+ formatedValue () {
299
300
  let newVal = ''
300
301
  if (typeof this.value === 'boolean') {
301
302
  newVal = ''
@@ -315,25 +316,25 @@ export default {
315
316
 
316
317
  return newVal
317
318
  },
318
- iconClass() {
319
+ iconClass () {
319
320
  return this.visible ? 'arrow-up is-reverse' : 'arrow-up'
320
321
  },
321
- showNewOption() {
322
- let hasExistingOption = this.options
322
+ showNewOption () {
323
+ const hasExistingOption = this.options
323
324
  .filter(option => !option.created)
324
325
  .some(option => option.currentLabel === this.query)
325
326
  return this.filterable && this.allowCreate && !hasExistingOption
326
327
  },
327
328
  // Monta a lista com ou sem "Cadastrar Novo Item"
328
- suggestionsList() {
329
+ suggestionsList () {
329
330
  if (this.loading) return []
330
- //transformando em Array
331
- let list =
331
+ // transformando em Array
332
+ const list =
332
333
  typeof this.suggestions === 'object'
333
334
  ? Object.values(this.suggestions)
334
335
  : this.suggestions
335
336
  if (this.allowCreate) {
336
- let createdSuggestion = { created: true }
337
+ const createdSuggestion = { created: true }
337
338
  createdSuggestion[this.valueKey] = this.query !== '' ? this.query : null
338
339
  createdSuggestion[this.labelKey] = ''
339
340
  list.push(createdSuggestion)
@@ -341,12 +342,13 @@ export default {
341
342
  return list
342
343
  },
343
344
 
344
- emptyText() {
345
+ emptyText () {
345
346
  if (this.loading) {
346
347
  return this.loadingText || this.t('el.select.loading')
347
348
  } else {
348
349
  if (this.remote && this.query === '' && this.options.length === 0) {
349
- return this.noDataText || this.$tpI18n.t('autosuggests.sem_dados')}
350
+ return this.noDataText || this.$tpI18n.t('autosuggests.sem_dados')
351
+ }
350
352
  if (this.filterable && this.query && this.options.length > 0 && this.filteredOptionsCount === 0) {
351
353
  return this.noMatchText || this.t('el.select.noMatch')
352
354
  }
@@ -358,7 +360,7 @@ export default {
358
360
  }
359
361
  },
360
362
 
361
- created() {
363
+ created () {
362
364
  this.debouncedOnInputChange = debounce(this.debounce, e => {
363
365
  // Correção para mobile ativar a busca enquanto digita
364
366
  if (e.isComposing) {
@@ -374,7 +376,7 @@ export default {
374
376
  })
375
377
  },
376
378
 
377
- beforeMount() {
379
+ beforeMount () {
378
380
  this.doRequest = false
379
381
 
380
382
  if (this.loadOnCreate) {
@@ -387,10 +389,10 @@ export default {
387
389
  }
388
390
  },
389
391
 
390
- mounted() {
392
+ mounted () {
391
393
  this.$nextTick(() => {
392
394
  // Componente tooltip -> autosuggest -> input
393
- var componenteInputInterno = this.$children[1].$refs['input']
395
+ const componenteInputInterno = this.$children[1].$refs.input
394
396
  // Mostra o tooltip só quando
395
397
  this.createHandler(componenteInputInterno, 'mouseenter', () => {
396
398
  if (this.selectedLabel) {
@@ -406,7 +408,7 @@ export default {
406
408
  })
407
409
  },
408
410
 
409
- beforeDestroy() {
411
+ beforeDestroy () {
410
412
  document.removeEventListener('focusin', this.fixElSelect, false)
411
413
  document.removeEventListener('click', this.fixElSelect, false)
412
414
  document.removeEventListener('touchstart', this.fixElSelect, false)
@@ -419,11 +421,11 @@ export default {
419
421
  * @args ev {String} Nome do listener (mouseenter, click, etc)
420
422
  * @args func {Function} Função a ser executada
421
423
  */
422
- createHandler(el, ev, func) {
424
+ createHandler (el, ev, func) {
423
425
  if (el) {
424
426
  el.addEventListener(
425
427
  ev,
426
- function() {
428
+ function () {
427
429
  func()
428
430
  },
429
431
  false
@@ -431,14 +433,14 @@ export default {
431
433
  }
432
434
  },
433
435
 
434
- onInputChange() {
436
+ onInputChange () {
435
437
  if (this.filterable && this.query !== this.selectedLabel) {
436
438
  this.query = this.selectedLabel
437
439
  this.handleQueryChange(this.query)
438
440
  }
439
441
  },
440
442
 
441
- emitChange(val) {
443
+ emitChange (val) {
442
444
  if (!valueEquals(this.formatedValue, val)) {
443
445
  this.$nextTick(() => {
444
446
  this.$emit('change', val, this.createdSelected)
@@ -447,7 +449,7 @@ export default {
447
449
  },
448
450
 
449
451
  // eslint-disable-next-line no-unused-vars
450
- clearTags(event) {
452
+ clearTags (event) {
451
453
  this.selectedLabel = ''
452
454
  // Faz uma requisição limpa
453
455
  this.query = ''
@@ -467,7 +469,7 @@ export default {
467
469
  /**
468
470
  * Sobrescreve o getOption do select para mostrar o labelValue em vez do idValue
469
471
  */
470
- getOption(val) {
472
+ getOption (val) {
471
473
  let value = ''
472
474
  let initialLabel = false
473
475
 
@@ -514,16 +516,16 @@ export default {
514
516
  }
515
517
  if (option) return option
516
518
  const label = !isObject && !isNull && !isUndefined ? value : ''
517
- let newOption = {
518
- value: value,
519
- currentLabel: initialLabel ? initialLabel : label
519
+ const newOption = {
520
+ value,
521
+ currentLabel: initialLabel || label
520
522
  }
521
523
  if (this.multiple) {
522
524
  newOption.hitState = false
523
525
  }
524
526
  return newOption
525
527
  },
526
- checkDefaultFirstOption() {
528
+ checkDefaultFirstOption () {
527
529
  this.$nextTick(() => {
528
530
  this.hoverIndex = -1
529
531
 
@@ -548,7 +550,7 @@ export default {
548
550
  /**
549
551
  * Sobrescreve a função de abrir menu do select para fazer a busca quando loadOnCreate = false
550
552
  */
551
- toggleMenu() {
553
+ toggleMenu () {
552
554
  if (!this.selectDisabled) {
553
555
  // Se mantem visivel quando clica nele aberto
554
556
  if (this.menuVisibleOnFocus) {
@@ -564,7 +566,7 @@ export default {
564
566
  }
565
567
  },
566
568
 
567
- handleClose() {
569
+ handleClose () {
568
570
  this.visible = false
569
571
  // Limpa busca quando fecha
570
572
  this.doRequest = true
@@ -573,14 +575,13 @@ export default {
573
575
  /**
574
576
  * Sobrescreve função do select
575
577
  */
576
- handleQueryChange(val) {
577
- var _this6 = this
578
+ handleQueryChange (val) {
579
+ const _this6 = this
578
580
  // Correção aqui para forçar primeeira request com createOnLoad = false
579
581
  if (
580
582
  (!this.doRequest && this.previousQuery === val) ||
581
583
  this.isOnComposition
582
- )
583
- return
584
+ ) { return }
584
585
  if (
585
586
  this.previousQuery === null &&
586
587
  (typeof this.filterMethod === 'function' ||
@@ -590,13 +591,13 @@ export default {
590
591
  return
591
592
  }
592
593
  this.previousQuery = val
593
- this.$nextTick(function() {
594
+ this.$nextTick(function () {
594
595
  if (_this6.visible) _this6.broadcast('ElSelectDropdown', 'updatePopper')
595
596
  })
596
597
  this.hoverIndex = -1
597
598
  if (this.multiple && this.filterable) {
598
- this.$nextTick(function() {
599
- var length = _this6.$refs.input.value.length * 15 + 20
599
+ this.$nextTick(function () {
600
+ const length = _this6.$refs.input.value.length * 15 + 20
600
601
  _this6.inputLength = _this6.collapseTags
601
602
  ? Math.min(50, length)
602
603
  : length
@@ -625,11 +626,11 @@ export default {
625
626
  },
626
627
 
627
628
  // Correção para habilitar teclado mobile em iOS
628
- fixElSelect() {
629
+ fixElSelect () {
629
630
  document
630
631
  .querySelectorAll('.el-select[data-is-search="true"]:hover')
631
632
  .forEach(() => {
632
- let elInput = document.querySelector(
633
+ const elInput = document.querySelector(
633
634
  '.el-select[data-is-search="true"]:hover input[readonly]'
634
635
  )
635
636
  if (elInput) {
@@ -73,39 +73,38 @@ export default {
73
73
  }
74
74
  },
75
75
 
76
- data() {
76
+ data () {
77
77
  return {
78
- hideInput: true,
78
+ hideInput: true
79
79
  }
80
80
  },
81
81
 
82
82
  computed: {
83
- _id(){
83
+ _id () {
84
84
  return this.id || this.$options.name
85
85
  }
86
86
  },
87
87
 
88
- mounted() {
88
+ mounted () {
89
89
  this.hideInput = this.inputHidden
90
90
  },
91
91
 
92
92
  methods: {
93
- toggleInput() {
93
+ toggleInput () {
94
94
  const status = !this.hideInput
95
95
 
96
96
  if (this.readonly) {
97
97
  this.hideInput = true
98
- }
99
- else if (!this.readonly) {
98
+ } else if (!this.readonly) {
100
99
  this.hideInput = status
101
100
  if (!this.hideInput) {
102
- this.$nextTick(function() {
101
+ this.$nextTick(function () {
103
102
  this.$refs.inlineInput.focus()
104
103
  })
105
104
  }
106
105
  }
107
106
  },
108
- input(event){
107
+ input (event) {
109
108
  this.$emit('input', event)
110
109
  }
111
110
  }
@@ -137,4 +136,4 @@ export default {
137
136
  }
138
137
  }
139
138
  }
140
- </style>
139
+ </style>
@@ -1,3 +1,3 @@
1
1
  import Inline from './Inline'
2
2
 
3
- export default Inline
3
+ export default Inline
@@ -14,7 +14,7 @@ export default {
14
14
  },
15
15
 
16
16
  computed: {
17
- displayValue() {
17
+ displayValue () {
18
18
  if (this.userInput !== null) {
19
19
  return this.userInput
20
20
  }
@@ -44,12 +44,12 @@ export default {
44
44
  },
45
45
 
46
46
  methods: {
47
- handleInput(value) {
47
+ handleInput (value) {
48
48
  this.userInput = value
49
49
  this.$emit('change', Number(value.replace(',', '.')))
50
50
  },
51
51
 
52
- handleInputChange(value) {
52
+ handleInputChange (value) {
53
53
  let newVal
54
54
  if (value === '') {
55
55
  newVal = 0
@@ -1,3 +1,3 @@
1
1
  import InputNumber from './InputNumber'
2
2
 
3
- export default InputNumber
3
+ export default InputNumber
@@ -2,7 +2,7 @@
2
2
  <div class="tp-loader">
3
3
  <div class="wrapper">
4
4
  <svg xmlns="http://www.w3.org/2000/svg" width="150px" height="150px">
5
- <mask id="mascara">
5
+ <mask id="mascara">
6
6
  <rect x="0" y="0" width="100%" height="100%" fill="white" />
7
7
  <circle id="circulo-interno" class="circulo" cx="45" cy="50" r="40" fill="black" />
8
8
  </mask>
@@ -35,7 +35,7 @@
35
35
  </template>
36
36
 
37
37
  <script>
38
- /*
38
+ /*
39
39
  Cria componente de loader com overlayer em toda a página
40
40
  `<tp-loader />`
41
41
  */
@@ -65,7 +65,7 @@ export default {
65
65
  'fad fa-chart-pie-alt'
66
66
  ])
67
67
  }
68
- },
68
+ }
69
69
  }
70
70
  </script>
71
71
 
@@ -166,7 +166,7 @@ export default {
166
166
  }
167
167
  }
168
168
  }
169
-
169
+
170
170
  #bola {
171
171
  .residuo {
172
172
  animation-name: residuo;
@@ -179,7 +179,7 @@ export default {
179
179
  &.top {
180
180
  transform-origin: #{$oCenter} #{$oTop};
181
181
 
182
- &.right {
182
+ &.right {
183
183
  transform-origin: 45% 5%;
184
184
  transform: translate(#{$oTrans}, -#{$oTrans}) scale(0.1);
185
185
  }
@@ -224,4 +224,4 @@ export default {
224
224
 
225
225
  }
226
226
  }
227
- </style>
227
+ </style>
@@ -1,3 +1,3 @@
1
1
  import Loader from './Loader'
2
2
 
3
- export default Loader
3
+ export default Loader
@@ -46,27 +46,27 @@ export default {
46
46
 
47
47
  // remove o simbolo em prepend
48
48
  removePrepend: {
49
- type:Boolean,
49
+ type: Boolean,
50
50
  default: false
51
- },
52
- //valor do campo. Pode ser usado como v-model também
51
+ },
52
+ // valor do campo. Pode ser usado como v-model também
53
53
  value: {
54
54
  type: [Number, String],
55
55
  default: 0
56
56
  },
57
57
 
58
- //tamanho máximo do campo. limitado por padrão a 21 caracteres por limitações do JS
58
+ // tamanho máximo do campo. limitado por padrão a 21 caracteres por limitações do JS
59
59
  maxlength: {
60
60
  type: Number,
61
61
  default: 21
62
- },
62
+ }
63
63
  },
64
-
64
+
65
65
  computed: {
66
- _id(){
66
+ _id () {
67
67
  return this.id || this.$options.name
68
68
  },
69
-
69
+
70
70
  prepend () {
71
71
  return this.t('tp.money.currency')
72
72
  }
@@ -1,3 +1,3 @@
1
1
  import Money from './Money'
2
2
 
3
- export default Money
3
+ export default Money