@tagplus/components 0.2.108 → 1.0.0
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/tp.common.js +1 -8714
- package/dist/tp.common.js.map +1 -1
- package/dist/tp.css +1 -1
- package/dist/tp.umd.js +1 -8724
- 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 +22 -16
- package/src/components/Autosuggest/Autosuggest.vue +39 -39
- package/src/components/Inline/Inline.vue +9 -10
- package/src/components/Inline/index.js +1 -1
- package/src/components/InputNumber/InputNumber.vue +3 -3
- package/src/components/InputNumber/index.js +1 -1
- package/src/components/Loader/Loader.vue +6 -6
- package/src/components/Loader/index.js +1 -1
- package/src/components/Money/Money.vue +9 -9
- package/src/components/Money/index.js +1 -1
- package/src/components/Multisuggest/Multisuggest.vue +39 -40
- package/src/components/OptionsList/OptionsList.vue +1 -1
- package/src/components/OptionsList/index.js +1 -1
- package/src/components/OptionsListItem/OptionsListItem.vue +4 -4
- package/src/components/OptionsListItem/index.js +1 -1
- package/src/components/Percent/Percent.vue +9 -9
- package/src/components/Percent/index.js +1 -1
- package/src/components/Skeleton/Skeleton.vue +7 -7
- package/src/components/Skeleton/index.js +1 -1
- 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/Tip/Tip.vue +19 -15
- package/src/components/Tip/index.js +2 -2
- package/src/components/index.js +5 -1
- package/src/locale/index.js +13 -15
- package/src/locale/lang/en.js +3 -3
- package/src/locale/lang/pt-br.js +3 -3
- package/src/main.js +3 -6
- package/src/mixins/locale.js +2 -2
- package/src/utils/currency.js +15 -15
- package/src/utils/filters.js +9 -14
|
@@ -5,20 +5,24 @@
|
|
|
5
5
|
align="middle"
|
|
6
6
|
:class="tptipclasses"
|
|
7
7
|
>
|
|
8
|
-
<el-col
|
|
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
|
|
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: #
|
|
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: #
|
|
110
|
-
border: 1px solid #
|
|
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
|
-
|
|
117
|
+
color: #ffc437;
|
|
114
118
|
}
|
|
115
119
|
::v-deep em {
|
|
116
|
-
|
|
120
|
+
color: #ffc437;
|
|
117
121
|
}
|
|
118
122
|
}
|
|
119
123
|
|
|
120
124
|
.tp-tip-success {
|
|
121
|
-
background: #
|
|
122
|
-
border: 1px solid #
|
|
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
|
-
|
|
129
|
+
color: #08a19e;
|
|
126
130
|
}
|
|
127
131
|
::v-deep em {
|
|
128
|
-
|
|
132
|
+
color: #08a19e;
|
|
129
133
|
}
|
|
130
134
|
}
|
|
131
135
|
</style>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import Tip
|
|
1
|
+
import Tip from './Tip'
|
|
2
2
|
|
|
3
|
-
export default Tip
|
|
3
|
+
export default Tip
|
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/locale/index.js
CHANGED
|
@@ -4,15 +4,14 @@ import Format from 'element-ui/src/locale/format'
|
|
|
4
4
|
|
|
5
5
|
const format = Format(Vue)
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if(this && this.$i18n){
|
|
7
|
+
const i18nHandler = function () {
|
|
8
|
+
// Existe this e contem função "$t"
|
|
9
|
+
if (this && this.$i18n) {
|
|
11
10
|
return this.$i18n
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
//Tenta usar o vueI18n da instancia do TP, caso tenha sido carregada
|
|
15
|
-
if(Vue.prototype.$tpI18n) {
|
|
13
|
+
// Tenta usar o vueI18n da instancia do TP, caso tenha sido carregada
|
|
14
|
+
if (Vue.prototype.$tpI18n) {
|
|
16
15
|
return Vue.prototype.$tpI18n
|
|
17
16
|
}
|
|
18
17
|
|
|
@@ -29,8 +28,8 @@ export const getCurrentLocale = () => {
|
|
|
29
28
|
/**
|
|
30
29
|
* Retorna as messages definidas na lang
|
|
31
30
|
*/
|
|
32
|
-
export const messages = function(){
|
|
33
|
-
|
|
31
|
+
export const messages = function () {
|
|
32
|
+
const i18n = i18nHandler.apply(this, arguments)
|
|
34
33
|
if (i18n !== null && i18n !== undefined && i18n.messages) {
|
|
35
34
|
return i18n.messages
|
|
36
35
|
}
|
|
@@ -40,11 +39,11 @@ export const messages = function(){
|
|
|
40
39
|
/**
|
|
41
40
|
* Recupera um item de linguagem nas messages registradas.
|
|
42
41
|
* Caso não haja i18n registrado, utiliza da lingua padrão
|
|
43
|
-
* @param {String} path
|
|
44
|
-
* @param {Object} options
|
|
42
|
+
* @param {String} path
|
|
43
|
+
* @param {Object} options
|
|
45
44
|
*/
|
|
46
|
-
export const t = function(path, options) {
|
|
47
|
-
|
|
45
|
+
export const t = function (path, options) {
|
|
46
|
+
const i18n = i18nHandler.apply(this, arguments)
|
|
48
47
|
if (i18n !== null && i18n !== undefined && i18n.t) {
|
|
49
48
|
return i18n.t(path)
|
|
50
49
|
}
|
|
@@ -56,7 +55,7 @@ export const t = function(path, options) {
|
|
|
56
55
|
for (let i = 0, j = array.length; i < j; i++) {
|
|
57
56
|
const property = array[i]
|
|
58
57
|
value = current[property]
|
|
59
|
-
if (!value){
|
|
58
|
+
if (!value) {
|
|
60
59
|
// eslint-disable-next-line
|
|
61
60
|
console.warn(`[Tp-i18n] Fall back to translate '${path}'. Key does not exist on language messages. Assuming key as value`)
|
|
62
61
|
return path
|
|
@@ -67,5 +66,4 @@ export const t = function(path, options) {
|
|
|
67
66
|
return ''
|
|
68
67
|
}
|
|
69
68
|
|
|
70
|
-
|
|
71
|
-
export default { t, messages }
|
|
69
|
+
export default { t, messages }
|
package/src/locale/lang/en.js
CHANGED
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
|
|
6
6
|
tp: {
|
|
7
7
|
money: {
|
|
8
|
-
currency: '$'
|
|
8
|
+
currency: '$'
|
|
9
9
|
}
|
|
10
10
|
},
|
|
11
11
|
|
|
@@ -21,7 +21,7 @@ export default {
|
|
|
21
21
|
thousands: '',
|
|
22
22
|
prefix: '',
|
|
23
23
|
suffix: '',
|
|
24
|
-
precision: 2
|
|
24
|
+
precision: 2
|
|
25
25
|
},
|
|
26
26
|
|
|
27
27
|
date: {
|
|
@@ -31,4 +31,4 @@ export default {
|
|
|
31
31
|
common: {
|
|
32
32
|
placeholder: 'placeholder'
|
|
33
33
|
}
|
|
34
|
-
}
|
|
34
|
+
}
|
package/src/locale/lang/pt-br.js
CHANGED
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
|
|
6
6
|
tp: {
|
|
7
7
|
money: {
|
|
8
|
-
currency: 'R$'
|
|
8
|
+
currency: 'R$'
|
|
9
9
|
}
|
|
10
10
|
},
|
|
11
11
|
|
|
@@ -21,7 +21,7 @@ export default {
|
|
|
21
21
|
thousands: '.',
|
|
22
22
|
prefix: '',
|
|
23
23
|
suffix: '',
|
|
24
|
-
precision: 2
|
|
24
|
+
precision: 2
|
|
25
25
|
},
|
|
26
26
|
|
|
27
27
|
date: {
|
|
@@ -31,4 +31,4 @@ export default {
|
|
|
31
31
|
common: {
|
|
32
32
|
placeholder: 'placeholder'
|
|
33
33
|
}
|
|
34
|
-
}
|
|
34
|
+
}
|
package/src/main.js
CHANGED
|
@@ -3,12 +3,11 @@ import './assets/scss/index.scss'
|
|
|
3
3
|
import * as components from './components'
|
|
4
4
|
|
|
5
5
|
const install = function (Vue, opts = {}) {
|
|
6
|
-
|
|
7
6
|
Vue.prototype.$defaultLang = 'en'
|
|
8
7
|
Vue.prototype.$tpI18n = opts.locale || {}
|
|
9
8
|
opts.locale = null
|
|
10
9
|
|
|
11
|
-
//Element
|
|
10
|
+
// Element
|
|
12
11
|
ElementUI.install(Vue, opts)
|
|
13
12
|
|
|
14
13
|
// components
|
|
@@ -16,15 +15,13 @@ const install = function (Vue, opts = {}) {
|
|
|
16
15
|
const component = components[componentName]
|
|
17
16
|
Vue.component(component.name, component)
|
|
18
17
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
18
|
}
|
|
22
19
|
|
|
23
20
|
if (typeof window !== 'undefined' && window.Vue) {
|
|
24
21
|
install(window.Vue)
|
|
25
22
|
}
|
|
26
23
|
|
|
27
|
-
//TODO: Validar encapsulamento do ElementUI
|
|
24
|
+
// TODO: Validar encapsulamento do ElementUI
|
|
28
25
|
export default Object.assign({}, ElementUI, components, {
|
|
29
26
|
install
|
|
30
|
-
})
|
|
27
|
+
})
|
package/src/mixins/locale.js
CHANGED
package/src/utils/currency.js
CHANGED
|
@@ -5,21 +5,21 @@ function format (input, opt = defaults) {
|
|
|
5
5
|
if (typeof input === 'number') {
|
|
6
6
|
input = input.toFixed(fixed(opt.precision))
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
const negative = input.indexOf('-') >= 0 ? '-' : ''
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
const numbers = onlyNumbers(input)
|
|
11
|
+
const currency = numbersToCurrency(numbers, opt.precision)
|
|
12
|
+
const parts = toStr(currency).split('.')
|
|
13
|
+
let integer = parts[0]
|
|
14
|
+
const decimal = parts[1]
|
|
15
15
|
integer = addThousandSeparator(integer, opt.thousands)
|
|
16
16
|
return opt.prefix + negative + joinIntegerAndDecimal(integer, decimal, opt.decimal) + opt.suffix
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
function unformat (input, precision = defaults.precision) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
const negative = input.indexOf('-') >= 0 ? -1 : 1
|
|
21
|
+
const numbers = onlyNumbers(input)
|
|
22
|
+
const currency = numbersToCurrency(numbers, precision)
|
|
23
23
|
return parseFloat(currency) * negative
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -37,8 +37,8 @@ function between (min, n, max) {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
function numbersToCurrency (numbers, precision) {
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
const exp = Math.pow(10, precision)
|
|
41
|
+
const float = parseFloat(numbers) / exp
|
|
42
42
|
return float.toFixed(fixed(precision))
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -46,7 +46,7 @@ function addThousandSeparator (integer, separator) {
|
|
|
46
46
|
return integer.replace(/(\d)(?=(?:\d{3})+\b)/gm, `$1${separator}`)
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
//eslint-disable-next-line
|
|
49
|
+
// eslint-disable-next-line
|
|
50
50
|
function currencyToIntegerAndDecimal (float) {
|
|
51
51
|
return toStr(float).split('.')
|
|
52
52
|
}
|
|
@@ -60,7 +60,7 @@ function toStr (value) {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
function setCursor (el, position) {
|
|
63
|
-
|
|
63
|
+
const setSelectionRange = function () { el.setSelectionRange(position, position) }
|
|
64
64
|
if (el === document.activeElement) {
|
|
65
65
|
setSelectionRange()
|
|
66
66
|
setTimeout(setSelectionRange, 1) // Android Fix
|
|
@@ -69,7 +69,7 @@ function setCursor (el, position) {
|
|
|
69
69
|
|
|
70
70
|
// https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Creating_and_triggering_events#The_old-fashioned_way
|
|
71
71
|
function event (name) {
|
|
72
|
-
|
|
72
|
+
const evt = document.createEvent('Event')
|
|
73
73
|
evt.initEvent(name, true, true)
|
|
74
74
|
return evt
|
|
75
75
|
}
|
|
@@ -79,4 +79,4 @@ export {
|
|
|
79
79
|
unformat,
|
|
80
80
|
setCursor,
|
|
81
81
|
event
|
|
82
|
-
}
|
|
82
|
+
}
|
package/src/utils/filters.js
CHANGED
|
@@ -1,35 +1,30 @@
|
|
|
1
1
|
// import moment from 'moment'
|
|
2
2
|
import { t } from 'tp-ui/locale'
|
|
3
3
|
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
|
-
*
|
|
5
|
+
*
|
|
7
6
|
* Filtros
|
|
8
7
|
* Importe um a um ou faça import * para utilizar
|
|
9
|
-
*
|
|
10
|
-
* Ex:
|
|
8
|
+
*
|
|
9
|
+
* Ex:
|
|
11
10
|
* ```import { toCurrency } from 'tp-ui/utils/filters'```
|
|
12
11
|
* e dentro do Componente:
|
|
13
12
|
* ```filters: { toCurrency }```
|
|
14
|
-
*
|
|
13
|
+
*
|
|
15
14
|
* @author bbarbosa
|
|
16
15
|
*/
|
|
17
16
|
|
|
18
|
-
|
|
19
17
|
/**
|
|
20
18
|
* Transforma valor em String para exibição conforme localidade
|
|
21
|
-
* @param {Number} val
|
|
19
|
+
* @param {Number} val
|
|
22
20
|
*/
|
|
23
21
|
export const toCurrency = (val) => {
|
|
24
|
-
return val.toLocaleString(t('locale.prefix')
|
|
25
|
-
minimumFractionDigits: 2,
|
|
26
|
-
maximumFractionDigits: 2,
|
|
27
|
-
})
|
|
22
|
+
return (parseInt(val * 100) / 100).toLocaleString(t('locale.prefix'))
|
|
28
23
|
}
|
|
29
24
|
|
|
30
25
|
/**
|
|
31
26
|
* Converte uma string de data em um objeto Date
|
|
32
|
-
* @param {String} val
|
|
27
|
+
* @param {String} val
|
|
33
28
|
*/
|
|
34
29
|
export const toDate = function (val) {
|
|
35
30
|
if (val === undefined || val === '' || val === null) return ''
|
|
@@ -50,7 +45,7 @@ export const toDate = function (val) {
|
|
|
50
45
|
|
|
51
46
|
/**
|
|
52
47
|
* Transforma em lowercase
|
|
53
|
-
* @param {String} val
|
|
48
|
+
* @param {String} val
|
|
54
49
|
*/
|
|
55
50
|
export const toLowerCase = function (val) {
|
|
56
51
|
return val.toLowerCase()
|
|
@@ -58,7 +53,7 @@ export const toLowerCase = function (val) {
|
|
|
58
53
|
|
|
59
54
|
/**
|
|
60
55
|
* Transforma valor em uppercase
|
|
61
|
-
* @param {String} val
|
|
56
|
+
* @param {String} val
|
|
62
57
|
*/
|
|
63
58
|
export const toUpperCase = function (val) {
|
|
64
59
|
return val.toUpperCase()
|