@tagplus/components 0.2.107 → 0.2.110
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/dist/demo.html +1 -10
- package/dist/fonts/bevi-bold.7e4dcd11.woff +0 -0
- package/dist/fonts/bevi-bold.873def84.woff2 +0 -0
- package/dist/fonts/bevi-medium.6187e050.woff2 +0 -0
- package/dist/fonts/bevi-medium.65b3056d.woff +0 -0
- package/dist/fonts/bevi-regular.c89f126e.woff +0 -0
- package/dist/fonts/bevi-regular.f81e4b8f.woff2 +0 -0
- package/dist/tp.common.js +4677 -4298
- package/dist/tp.common.js.map +1 -1
- package/dist/tp.css +1 -1
- package/dist/tp.umd.js +4676 -4280
- package/dist/tp.umd.js.map +1 -1
- package/dist/tp.umd.min.js +1 -1
- package/dist/tp.umd.min.js.map +1 -1
- package/package.json +18 -16
- package/src/components/Autosuggest/Autosuggest.vue +39 -15
- package/src/components/Money/Money.vue +1 -1
- package/src/components/Multisuggest/Multisuggest.vue +16 -0
- package/src/components/Step/Step.vue +222 -0
- package/src/components/Step/index.js +3 -0
- package/src/components/Steps/Steps.vue +19 -0
- package/src/components/Steps/index.js +3 -0
- package/src/components/index.js +4 -0
- package/src/utils/filters.js +1 -4
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"email": "bruno@tagplus.com.br"
|
|
8
8
|
}
|
|
9
9
|
],
|
|
10
|
-
"version": "0.2.
|
|
10
|
+
"version": "0.2.110",
|
|
11
11
|
"main": "./dist/tp.common.js",
|
|
12
12
|
"directories": {
|
|
13
13
|
"lib": "src/lib"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"doc": "yarn docs",
|
|
30
30
|
"docs": "nodemon --exec \"vuese gen && vuese serve\" --watch ./src -e js,vue,scss",
|
|
31
31
|
"docs:gen": "vuese gen",
|
|
32
|
-
"lint": "vue-
|
|
32
|
+
"lint": "eslint --cache --ext .js,.vue --ignore-path .gitignore .",
|
|
33
33
|
"pub": "yarn build && yarn publish --access public",
|
|
34
34
|
"pub:beta": "yarn build && yarn publish --tag beta",
|
|
35
35
|
"serve": "vue-cli-service serve --open ./examples/main.js",
|
|
@@ -41,30 +41,32 @@
|
|
|
41
41
|
"test:unit": "vue-cli-service test:unit"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"axios": "^0.
|
|
45
|
-
"core-js": "^3.
|
|
44
|
+
"axios": "^0.27.0",
|
|
45
|
+
"core-js": "^3.21.1",
|
|
46
46
|
"element-theme-chalk": "^2.13",
|
|
47
47
|
"element-ui": "^2.13",
|
|
48
|
-
"js-cookie": "^
|
|
49
|
-
"vue": "^2.6.
|
|
50
|
-
"vue-axios": "^2.1.
|
|
48
|
+
"js-cookie": "^3.0.1",
|
|
49
|
+
"vue": "^2.6.14",
|
|
50
|
+
"vue-axios": "^2.1.5",
|
|
51
51
|
"vue-i18n": "^8.14.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"@
|
|
57
|
-
"@vue/cli-
|
|
58
|
-
"@vue/
|
|
54
|
+
"@babel/eslint-parser": "^7.17.0",
|
|
55
|
+
"@nuxtjs/eslint-config": "^8.0.0",
|
|
56
|
+
"@nuxtjs/eslint-module": "^3.0.2",
|
|
57
|
+
"@vue/cli-plugin-babel": "^5.0.3",
|
|
58
|
+
"@vue/cli-plugin-unit-jest": "^5.0.3",
|
|
59
|
+
"@vue/cli-service": "^5.0.3",
|
|
59
60
|
"@vue/test-utils": "1.0.0-beta.30",
|
|
60
61
|
"@vuese/cli": "^2.10.0",
|
|
61
62
|
"babel-core": "7.0.0-bridge.0",
|
|
62
|
-
"babel-eslint": "^10.0.1",
|
|
63
63
|
"babel-jest": "^24.9.0",
|
|
64
64
|
"babel-plugin-module-resolver": "^3.2.0",
|
|
65
|
-
"eslint": "^
|
|
66
|
-
"eslint-
|
|
67
|
-
"eslint-
|
|
65
|
+
"eslint": "^8.9.0",
|
|
66
|
+
"eslint-config-prettier": "^8.4.0",
|
|
67
|
+
"eslint-config-standard": "^16.0.3",
|
|
68
|
+
"eslint-plugin-nuxt": ">=0.4.2",
|
|
69
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
68
70
|
"node-sass": "^4.9.0",
|
|
69
71
|
"nodemon": "^2.0.1",
|
|
70
72
|
"prettier": "^1.18.2",
|
|
@@ -286,8 +286,10 @@ export default {
|
|
|
286
286
|
_id() {
|
|
287
287
|
return this.id || this.$options.name
|
|
288
288
|
},
|
|
289
|
-
newItem(){
|
|
290
|
-
return this.query
|
|
289
|
+
newItem() {
|
|
290
|
+
return this.query
|
|
291
|
+
? this.$tpI18n.t('autosuggests.cadastrar', { nameItem: this.query })
|
|
292
|
+
: this.$tpI18n.t(`autosuggests.newItem.${this.$parent.$options.name}`)
|
|
291
293
|
},
|
|
292
294
|
|
|
293
295
|
/**
|
|
@@ -302,7 +304,9 @@ export default {
|
|
|
302
304
|
} else if (this.value && typeof this.value === 'object') {
|
|
303
305
|
if (!this.value[this.valueKey]) {
|
|
304
306
|
if (process.env.DEBUG === 'true') {
|
|
305
|
-
console.error(
|
|
307
|
+
console.error(
|
|
308
|
+
`Autosuggest '${this.$options.name}' option doesn't have a valueKey '${this.valueKey}' key`
|
|
309
|
+
)
|
|
306
310
|
}
|
|
307
311
|
} else {
|
|
308
312
|
newVal = this.value[this.valueKey]
|
|
@@ -335,6 +339,22 @@ export default {
|
|
|
335
339
|
list.push(createdSuggestion)
|
|
336
340
|
}
|
|
337
341
|
return list
|
|
342
|
+
},
|
|
343
|
+
|
|
344
|
+
emptyText() {
|
|
345
|
+
if (this.loading) {
|
|
346
|
+
return this.loadingText || this.t('el.select.loading')
|
|
347
|
+
} else {
|
|
348
|
+
if (this.remote && this.query === '' && this.options.length === 0) {
|
|
349
|
+
return this.noDataText || this.$tpI18n.t('autosuggests.sem_dados')}
|
|
350
|
+
if (this.filterable && this.query && this.options.length > 0 && this.filteredOptionsCount === 0) {
|
|
351
|
+
return this.noMatchText || this.t('el.select.noMatch')
|
|
352
|
+
}
|
|
353
|
+
if (this.options.length === 0) {
|
|
354
|
+
return this.noDataText || this.$tpI18n.t('autosuggests.sem_dados')
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
return null
|
|
338
358
|
}
|
|
339
359
|
},
|
|
340
360
|
|
|
@@ -354,7 +374,7 @@ export default {
|
|
|
354
374
|
})
|
|
355
375
|
},
|
|
356
376
|
|
|
357
|
-
beforeMount
|
|
377
|
+
beforeMount() {
|
|
358
378
|
this.doRequest = false
|
|
359
379
|
|
|
360
380
|
if (this.loadOnCreate) {
|
|
@@ -458,7 +478,9 @@ export default {
|
|
|
458
478
|
} else if (val && typeof val === 'object') {
|
|
459
479
|
// Se val for Object converte para outro tipo
|
|
460
480
|
if (!this.value[this.valueKey]) {
|
|
461
|
-
console.error(
|
|
481
|
+
console.error(
|
|
482
|
+
`Autosuggest '${this.$options.name}' option doesn't have a valueKey '${this.valueKey}' key`
|
|
483
|
+
)
|
|
462
484
|
} else {
|
|
463
485
|
// Se mandou a label no objeto value
|
|
464
486
|
if (this.value[this.labelKey]) {
|
|
@@ -604,18 +626,20 @@ export default {
|
|
|
604
626
|
|
|
605
627
|
// Correção para habilitar teclado mobile em iOS
|
|
606
628
|
fixElSelect() {
|
|
607
|
-
document
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
elInput
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
629
|
+
document
|
|
630
|
+
.querySelectorAll('.el-select[data-is-search="true"]:hover')
|
|
631
|
+
.forEach(() => {
|
|
632
|
+
let elInput = document.querySelector(
|
|
633
|
+
'.el-select[data-is-search="true"]:hover input[readonly]'
|
|
634
|
+
)
|
|
635
|
+
if (elInput) {
|
|
636
|
+
elInput.readOnly = false
|
|
637
|
+
elInput.blur()
|
|
638
|
+
elInput.focus()
|
|
639
|
+
}
|
|
640
|
+
})
|
|
615
641
|
}
|
|
616
642
|
}
|
|
617
|
-
|
|
618
|
-
|
|
619
643
|
}
|
|
620
644
|
</script>
|
|
621
645
|
|
|
@@ -402,6 +402,22 @@ export default {
|
|
|
402
402
|
list.push(createdSuggestion)
|
|
403
403
|
}
|
|
404
404
|
return list
|
|
405
|
+
},
|
|
406
|
+
|
|
407
|
+
emptyText() {
|
|
408
|
+
if (this.loading) {
|
|
409
|
+
return this.loadingText || this.t('el.select.loading')
|
|
410
|
+
} else {
|
|
411
|
+
if (this.remote && this.query === '' && this.options.length === 0) {
|
|
412
|
+
return this.noDataText || this.$tpI18n.t('autosuggests.sem_dados')}
|
|
413
|
+
if (this.filterable && this.query && this.options.length > 0 && this.filteredOptionsCount === 0) {
|
|
414
|
+
return this.noMatchText || this.t('el.select.noMatch')
|
|
415
|
+
}
|
|
416
|
+
if (this.options.length === 0) {
|
|
417
|
+
return this.noDataText || this.$tpI18n.t('autosuggests.sem_dados')
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
return null
|
|
405
421
|
}
|
|
406
422
|
},
|
|
407
423
|
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="el-step"
|
|
4
|
+
:style="style"
|
|
5
|
+
:class="[
|
|
6
|
+
!isSimple && `is-${$parent.direction}`,
|
|
7
|
+
isSimple && 'is-simple',
|
|
8
|
+
isLast && !space && !isCenter && 'is-flex',
|
|
9
|
+
isCenter && !isVertical && !isSimple && 'is-center']"
|
|
10
|
+
>
|
|
11
|
+
<!-- icon & line -->
|
|
12
|
+
<div
|
|
13
|
+
class="el-step__head"
|
|
14
|
+
:class="`is-${currentStatus === 'active' ? 'finish' : currentStatus}`"
|
|
15
|
+
>
|
|
16
|
+
<div
|
|
17
|
+
class="el-step__line"
|
|
18
|
+
:style="isLast ? '' : { marginRight: $parent.stepOffset + 'px' }"
|
|
19
|
+
>
|
|
20
|
+
<i class="el-step__line-inner" :style="lineStyle" />
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<div class="el-step__icon" :class="`is-${icon ? 'icon' : 'text'}`">
|
|
24
|
+
<slot
|
|
25
|
+
v-if="currentStatus !== 'success' && currentStatus !== 'error'"
|
|
26
|
+
name="icon"
|
|
27
|
+
>
|
|
28
|
+
<i v-if="icon" class="el-step__icon-inner" :class="[icon]" />
|
|
29
|
+
<div v-if="!icon && !isSimple" class="el-step__icon-inner">
|
|
30
|
+
{{ index + 1 }}
|
|
31
|
+
</div>
|
|
32
|
+
</slot>
|
|
33
|
+
<i
|
|
34
|
+
v-else
|
|
35
|
+
:class="['el-icon-' + (currentStatus === 'success' ? 'check' : 'close')]"
|
|
36
|
+
class="el-step__icon-inner is-status"
|
|
37
|
+
/>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
<!-- title & description -->
|
|
41
|
+
<div class="el-step__main">
|
|
42
|
+
<div
|
|
43
|
+
ref="title"
|
|
44
|
+
class="el-step__title"
|
|
45
|
+
:class="['is-' + currentStatus]"
|
|
46
|
+
>
|
|
47
|
+
<slot name="title">
|
|
48
|
+
{{ title }}
|
|
49
|
+
</slot>
|
|
50
|
+
</div>
|
|
51
|
+
<div v-if="isSimple" class="el-step__arrow" />
|
|
52
|
+
<div
|
|
53
|
+
v-else
|
|
54
|
+
class="el-step__description"
|
|
55
|
+
:class="['is-' + currentStatus]"
|
|
56
|
+
>
|
|
57
|
+
<slot name="description">
|
|
58
|
+
{{ description }}
|
|
59
|
+
</slot>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
</template>
|
|
64
|
+
<script>
|
|
65
|
+
export default {
|
|
66
|
+
name: 'TpStep',
|
|
67
|
+
|
|
68
|
+
props: {
|
|
69
|
+
title: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: ''
|
|
72
|
+
},
|
|
73
|
+
icon: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: ''
|
|
76
|
+
},
|
|
77
|
+
description: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: ''
|
|
80
|
+
},
|
|
81
|
+
status: {
|
|
82
|
+
type: String,
|
|
83
|
+
default: ''
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
data() {
|
|
88
|
+
return {
|
|
89
|
+
index: -1,
|
|
90
|
+
lineStyle: {},
|
|
91
|
+
internalStatus: ''
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
computed: {
|
|
96
|
+
currentStatus() {
|
|
97
|
+
return this.internalStatus
|
|
98
|
+
},
|
|
99
|
+
prevStatus() {
|
|
100
|
+
const prevStep = this.$parent.steps[this.index - 1]
|
|
101
|
+
return prevStep ? prevStep.currentStatus : 'wait'
|
|
102
|
+
},
|
|
103
|
+
isCenter() {
|
|
104
|
+
return this.$parent.alignCenter
|
|
105
|
+
},
|
|
106
|
+
isVertical() {
|
|
107
|
+
return this.$parent.direction === 'vertical'
|
|
108
|
+
},
|
|
109
|
+
isSimple() {
|
|
110
|
+
return this.$parent.simple
|
|
111
|
+
},
|
|
112
|
+
isLast() {
|
|
113
|
+
const parent = this.$parent
|
|
114
|
+
return parent.steps[parent.steps.length - 1] === this
|
|
115
|
+
},
|
|
116
|
+
stepsCount() {
|
|
117
|
+
return this.$parent.steps.length
|
|
118
|
+
},
|
|
119
|
+
space() {
|
|
120
|
+
const { isSimple, $parent: { space } } = this
|
|
121
|
+
return isSimple ? '' : space
|
|
122
|
+
},
|
|
123
|
+
style: function() {
|
|
124
|
+
const style = {}
|
|
125
|
+
const parent = this.$parent
|
|
126
|
+
const len = parent.steps.length
|
|
127
|
+
|
|
128
|
+
const space = (typeof this.space === 'number'
|
|
129
|
+
? this.space + 'px'
|
|
130
|
+
: this.space
|
|
131
|
+
? this.space
|
|
132
|
+
: 100 / (len - (this.isCenter ? 0 : 1)) + '%')
|
|
133
|
+
style.flexBasis = space
|
|
134
|
+
if (this.isVertical) return style
|
|
135
|
+
if (this.isLast) {
|
|
136
|
+
style.maxWidth = 100 / this.stepsCount + '%'
|
|
137
|
+
} else {
|
|
138
|
+
style.marginRight = -this.$parent.stepOffset + 'px'
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return style
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
watch: {
|
|
146
|
+
status (newVal) {
|
|
147
|
+
if(newVal === 'process' || newVal === 'error'){
|
|
148
|
+
this.updateStatus(this.$parent.active)
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
beforeCreate() {
|
|
155
|
+
this.$parent.steps.push(this)
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
beforeDestroy() {
|
|
159
|
+
const steps = this.$parent.steps
|
|
160
|
+
const index = steps.indexOf(this)
|
|
161
|
+
if (index >= 0) {
|
|
162
|
+
steps.splice(index, 1)
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
mounted() {
|
|
167
|
+
const unwatch = this.$watch('index', () => {
|
|
168
|
+
this.$watch('$parent.active', this.updateStatus, { immediate: true })
|
|
169
|
+
this.$watch('$parent.processStatus', () => {
|
|
170
|
+
const activeIndex = this.$parent.active
|
|
171
|
+
this.updateStatus(activeIndex)
|
|
172
|
+
}, { immediate: true })
|
|
173
|
+
unwatch()
|
|
174
|
+
})
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
methods: {
|
|
178
|
+
updateStatus(val) {
|
|
179
|
+
const prevChild = this.$parent.$children[this.index - 1]
|
|
180
|
+
|
|
181
|
+
if (this.status === 'error'){
|
|
182
|
+
this.internalStatus = 'error'
|
|
183
|
+
} else if (val > this.index) {
|
|
184
|
+
this.internalStatus = this.$parent.finishStatus
|
|
185
|
+
} else if (val === this.index && this.prevStatus !== 'error') {
|
|
186
|
+
this.internalStatus = this.$parent.processStatus
|
|
187
|
+
} else if (this.$parent.newItem && this.prevStatus !== 'error') {
|
|
188
|
+
this.internalStatus = 'wait'
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (prevChild) prevChild.calcProgress(this.internalStatus)
|
|
192
|
+
},
|
|
193
|
+
|
|
194
|
+
calcProgress(status) {
|
|
195
|
+
let step = 100
|
|
196
|
+
const style = {}
|
|
197
|
+
|
|
198
|
+
style.transitionDelay = 150 * this.index + 'ms'
|
|
199
|
+
// if (status === this.$parent.processStatus) {
|
|
200
|
+
// step = this.currentStatus !== 'error' ? 0 : 0
|
|
201
|
+
// } else
|
|
202
|
+
if (status === 'wait') {
|
|
203
|
+
step = 0
|
|
204
|
+
style.transitionDelay = (-50 * this.index) + 'ms'
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
style.borderWidth = step && !this.isSimple ? '1px' : 0
|
|
208
|
+
this.$parent.direction === 'vertical'
|
|
209
|
+
? style.height = step + '%'
|
|
210
|
+
: style.width = step + '%'
|
|
211
|
+
|
|
212
|
+
this.lineStyle = style
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
</script>
|
|
217
|
+
<style lang="scss" scoped>
|
|
218
|
+
.el-step__head.is-process {
|
|
219
|
+
color: #2d6eda;
|
|
220
|
+
border-color: #2d6eda;
|
|
221
|
+
}
|
|
222
|
+
</style>
|
package/src/components/index.js
CHANGED
|
@@ -8,6 +8,8 @@ import Loader from './Loader'
|
|
|
8
8
|
import Skeleton from './Skeleton'
|
|
9
9
|
import Tip from './Tip'
|
|
10
10
|
import Multisuggest from './Multisuggest'
|
|
11
|
+
import Step from './Step'
|
|
12
|
+
import Steps from './Steps'
|
|
11
13
|
import InputNumber from './InputNumber'
|
|
12
14
|
|
|
13
15
|
export {
|
|
@@ -21,5 +23,7 @@ export {
|
|
|
21
23
|
Skeleton,
|
|
22
24
|
Tip,
|
|
23
25
|
Multisuggest,
|
|
26
|
+
Step,
|
|
27
|
+
Steps,
|
|
24
28
|
InputNumber
|
|
25
29
|
}
|
package/src/utils/filters.js
CHANGED
|
@@ -21,10 +21,7 @@ import { t } from 'tp-ui/locale'
|
|
|
21
21
|
* @param {Number} val
|
|
22
22
|
*/
|
|
23
23
|
export const toCurrency = (val) => {
|
|
24
|
-
return val.toLocaleString(t('locale.prefix')
|
|
25
|
-
minimumFractionDigits: 2,
|
|
26
|
-
maximumFractionDigits: 2,
|
|
27
|
-
})
|
|
24
|
+
return (parseInt(val * 100) / 100).toLocaleString(t('locale.prefix'))
|
|
28
25
|
}
|
|
29
26
|
|
|
30
27
|
/**
|