@tagplus/components 0.2.110 → 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/demo.html +10 -1
- package/dist/tp.common.js +1 -9055
- package/dist/tp.common.js.map +1 -1
- package/dist/tp.css +1 -1
- package/dist/tp.umd.js +1 -9082
- 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 +17 -13
- 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 +8 -8
- 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 +20 -20
- package/src/components/Step/index.js +1 -1
- package/src/components/Steps/Steps.vue +3 -3
- package/src/components/Steps/index.js +2 -2
- package/src/components/Tip/Tip.vue +19 -15
- package/src/components/Tip/index.js +2 -2
- package/src/components/index.js +1 -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 +8 -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/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,24 +1,22 @@
|
|
|
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
22
|
return (parseInt(val * 100) / 100).toLocaleString(t('locale.prefix'))
|
|
@@ -26,7 +24,7 @@ export const toCurrency = (val) => {
|
|
|
26
24
|
|
|
27
25
|
/**
|
|
28
26
|
* Converte uma string de data em um objeto Date
|
|
29
|
-
* @param {String} val
|
|
27
|
+
* @param {String} val
|
|
30
28
|
*/
|
|
31
29
|
export const toDate = function (val) {
|
|
32
30
|
if (val === undefined || val === '' || val === null) return ''
|
|
@@ -47,7 +45,7 @@ export const toDate = function (val) {
|
|
|
47
45
|
|
|
48
46
|
/**
|
|
49
47
|
* Transforma em lowercase
|
|
50
|
-
* @param {String} val
|
|
48
|
+
* @param {String} val
|
|
51
49
|
*/
|
|
52
50
|
export const toLowerCase = function (val) {
|
|
53
51
|
return val.toLowerCase()
|
|
@@ -55,7 +53,7 @@ export const toLowerCase = function (val) {
|
|
|
55
53
|
|
|
56
54
|
/**
|
|
57
55
|
* Transforma valor em uppercase
|
|
58
|
-
* @param {String} val
|
|
56
|
+
* @param {String} val
|
|
59
57
|
*/
|
|
60
58
|
export const toUpperCase = function (val) {
|
|
61
59
|
return val.toUpperCase()
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|