@tagplus/components 5.3.4 → 5.3.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.
- package/dist/es/_virtual/_plugin-vue_export-helper.mjs +10 -0
- package/dist/es/components.css +2391 -0
- package/dist/es/node_modules/@element-plus/icons-vue/dist/index.mjs +148 -0
- package/dist/es/node_modules/@popperjs/core/lib/enums.mjs +22 -0
- package/dist/es/node_modules/@vue/shared/dist/shared.esm-bundler.mjs +28 -0
- package/dist/es/node_modules/@vueuse/core/index.mjs +172 -0
- package/dist/es/node_modules/@vueuse/shared/index.mjs +68 -0
- package/dist/es/node_modules/element-plus/es/constants/size.mjs +4 -0
- package/dist/es/node_modules/element-plus/es/hooks/use-focus-controller/index.mjs +64 -0
- package/dist/es/node_modules/element-plus/es/hooks/use-id/index.mjs +30 -0
- package/dist/es/node_modules/element-plus/es/hooks/use-locale/index.mjs +29 -0
- package/dist/es/node_modules/element-plus/es/hooks/use-namespace/index.mjs +79 -0
- package/dist/es/node_modules/element-plus/es/hooks/use-prop/index.mjs +11 -0
- package/dist/es/node_modules/element-plus/es/hooks/use-size/index.mjs +20 -0
- package/dist/es/node_modules/element-plus/es/locale/lang/en.mjs +182 -0
- package/dist/es/node_modules/element-plus/es/utils/error.mjs +16 -0
- package/dist/es/node_modules/element-plus/es/utils/types.mjs +9 -0
- package/dist/es/node_modules/element-plus/es/utils/vue/props/runtime.mjs +42 -0
- package/dist/es/src/components/Autosuggest/Autosuggest.vue.mjs +446 -0
- package/dist/es/src/components/Autosuggest/Multisuggest.vue.mjs +17 -0
- package/dist/es/src/components/Autosuggest/autosuggest-props.mjs +204 -0
- package/dist/es/src/components/Autosuggest/core.mjs +62 -0
- package/dist/es/src/components/Autosuggest/multisuggest-props.mjs +11 -0
- package/dist/es/src/components/Autosuggest/option.vue.mjs +118 -0
- package/dist/es/src/components/Autosuggest/select-dropdown.vue.mjs +62 -0
- package/dist/es/src/components/Autosuggest/useOption.mjs +93 -0
- package/dist/es/src/components/Autosuggest/useSelect.mjs +803 -0
- package/dist/es/src/components/Inline/Inline.vue.mjs +130 -0
- package/dist/es/src/components/Inline/index.mjs +4 -0
- package/dist/es/src/components/InputNumber/InputNumber.vue.mjs +358 -0
- package/dist/es/src/components/InputNumber/index.mjs +4 -0
- package/dist/es/src/components/InputNumber/input-number.mjs +128 -0
- package/dist/es/src/components/Loader/Loader.vue.mjs +59 -0
- package/dist/es/src/components/Loader/index.mjs +4 -0
- package/dist/es/src/components/Money/Money.vue.mjs +76 -0
- package/dist/es/src/components/Money/index.mjs +4 -0
- package/dist/es/src/components/Multisuggest/index.mjs +4 -0
- package/dist/es/src/components/OptionsList/OptionsList.vue.mjs +28 -0
- package/dist/es/src/components/OptionsList/index.mjs +4 -0
- package/dist/es/src/components/OptionsListItem/OptionsListItem.vue.mjs +96 -0
- package/dist/es/src/components/OptionsListItem/index.mjs +4 -0
- package/dist/es/src/components/Percent/Percent.vue.mjs +77 -0
- package/dist/es/src/components/Percent/index.mjs +4 -0
- package/dist/es/src/components/Skeleton/Skeleton.vue.mjs +79 -0
- package/dist/es/src/components/Skeleton/index.mjs +4 -0
- package/dist/es/src/components/Step/Step.vue.mjs +206 -0
- package/dist/es/src/components/Step/index.mjs +4 -0
- package/dist/es/src/components/Steps/Steps.vue.mjs +15 -0
- package/dist/es/src/components/Steps/index.mjs +4 -0
- package/dist/es/src/components/Tip/Tip.vue.mjs +165 -0
- package/dist/es/src/components/Tip/index.mjs +4 -0
- package/dist/es/src/components/index.mjs +22 -0
- package/dist/es/src/locale/i18nCreator.mjs +93 -0
- package/dist/es/src/locale/lang/pt-br.mjs +21 -0
- package/dist/es/src/main.mjs +18 -0
- package/dist/es/src/mixins/floatFormatter.mjs +42 -0
- package/dist/es/src/plugins/currency.mjs +69 -0
- package/dist/es/src/utils/constants.mjs +6 -0
- package/dist/es/src/utils/error.mjs +20 -0
- package/dist/es/src/utils/i18n.mjs +4 -0
- package/dist/es/src/utils/icon.mjs +9 -0
- package/dist/es/src/utils/index.mjs +8 -0
- package/dist/es/src/utils/runtime.mjs +50 -0
- package/dist/es/src/utils/scroll.mjs +26 -0
- package/dist/es/src/utils/strings.mjs +4 -0
- package/dist/es/src/utils/types.mjs +9 -0
- package/dist/es/src/utils/use-derived-namespace.mjs +15 -0
- package/dist/es/src/utils/use-form-common-props.mjs +25 -0
- package/dist/es/src/utils/use-form-item.mjs +61 -0
- package/dist/es/src/utils/use-id.mjs +35 -0
- package/dist/es/src/utils/use-input.mjs +31 -0
- package/{src/locale → dist}/lang/en.js +3 -2
- package/{src/locale → dist}/lang/pt-br.js +3 -2
- package/dist/lib/_virtual/_plugin-vue_export-helper.js +10 -0
- package/dist/lib/components.css +2391 -0
- package/dist/lib/node_modules/@element-plus/icons-vue/dist/index.js +148 -0
- package/dist/lib/node_modules/@popperjs/core/lib/enums.js +22 -0
- package/dist/lib/node_modules/@vue/shared/dist/shared.esm-bundler.js +28 -0
- package/dist/lib/node_modules/@vueuse/core/index.js +170 -0
- package/dist/lib/node_modules/@vueuse/shared/index.js +68 -0
- package/dist/lib/node_modules/element-plus/es/constants/size.js +4 -0
- package/dist/lib/node_modules/element-plus/es/hooks/use-focus-controller/index.js +64 -0
- package/dist/lib/node_modules/element-plus/es/hooks/use-id/index.js +30 -0
- package/dist/lib/node_modules/element-plus/es/hooks/use-locale/index.js +29 -0
- package/dist/lib/node_modules/element-plus/es/hooks/use-namespace/index.js +79 -0
- package/dist/lib/node_modules/element-plus/es/hooks/use-prop/index.js +11 -0
- package/dist/lib/node_modules/element-plus/es/hooks/use-size/index.js +20 -0
- package/dist/lib/node_modules/element-plus/es/locale/lang/en.js +182 -0
- package/dist/lib/node_modules/element-plus/es/utils/error.js +16 -0
- package/dist/lib/node_modules/element-plus/es/utils/types.js +9 -0
- package/dist/lib/node_modules/element-plus/es/utils/vue/props/runtime.js +42 -0
- package/dist/lib/src/components/Autosuggest/Autosuggest.vue.js +446 -0
- package/dist/lib/src/components/Autosuggest/Multisuggest.vue.js +17 -0
- package/dist/lib/src/components/Autosuggest/autosuggest-props.js +204 -0
- package/dist/lib/src/components/Autosuggest/core.js +62 -0
- package/dist/lib/src/components/Autosuggest/multisuggest-props.js +11 -0
- package/dist/lib/src/components/Autosuggest/option.vue.js +118 -0
- package/dist/lib/src/components/Autosuggest/select-dropdown.vue.js +62 -0
- package/dist/lib/src/components/Autosuggest/useOption.js +93 -0
- package/dist/lib/src/components/Autosuggest/useSelect.js +803 -0
- package/dist/lib/src/components/Inline/Inline.vue.js +130 -0
- package/dist/lib/src/components/Inline/index.js +4 -0
- package/dist/lib/src/components/InputNumber/InputNumber.vue.js +358 -0
- package/dist/lib/src/components/InputNumber/index.js +4 -0
- package/dist/lib/src/components/InputNumber/input-number.js +128 -0
- package/dist/lib/src/components/Loader/Loader.vue.js +59 -0
- package/dist/lib/src/components/Loader/index.js +4 -0
- package/dist/lib/src/components/Money/Money.vue.js +76 -0
- package/dist/lib/src/components/Money/index.js +4 -0
- package/dist/lib/src/components/Multisuggest/index.js +4 -0
- package/dist/lib/src/components/OptionsList/OptionsList.vue.js +28 -0
- package/dist/lib/src/components/OptionsList/index.js +4 -0
- package/dist/lib/src/components/OptionsListItem/OptionsListItem.vue.js +96 -0
- package/dist/lib/src/components/OptionsListItem/index.js +4 -0
- package/dist/lib/src/components/Percent/Percent.vue.js +77 -0
- package/dist/lib/src/components/Percent/index.js +4 -0
- package/dist/lib/src/components/Skeleton/Skeleton.vue.js +79 -0
- package/dist/lib/src/components/Skeleton/index.js +4 -0
- package/dist/lib/src/components/Step/Step.vue.js +206 -0
- package/dist/lib/src/components/Step/index.js +4 -0
- package/dist/lib/src/components/Steps/Steps.vue.js +15 -0
- package/dist/lib/src/components/Steps/index.js +4 -0
- package/dist/lib/src/components/Tip/Tip.vue.js +165 -0
- package/dist/lib/src/components/Tip/index.js +4 -0
- package/dist/lib/src/components/index.js +22 -0
- package/dist/lib/src/locale/i18nCreator.js +93 -0
- package/dist/lib/src/locale/lang/pt-br.js +21 -0
- package/dist/lib/src/main.js +18 -0
- package/dist/lib/src/mixins/floatFormatter.js +42 -0
- package/dist/lib/src/plugins/currency.js +69 -0
- package/dist/lib/src/utils/constants.js +6 -0
- package/dist/lib/src/utils/error.js +20 -0
- package/dist/lib/src/utils/i18n.js +4 -0
- package/dist/lib/src/utils/icon.js +9 -0
- package/dist/lib/src/utils/index.js +8 -0
- package/dist/lib/src/utils/runtime.js +50 -0
- package/dist/lib/src/utils/scroll.js +26 -0
- package/dist/lib/src/utils/strings.js +4 -0
- package/dist/lib/src/utils/types.js +12 -0
- package/dist/lib/src/utils/use-derived-namespace.js +15 -0
- package/dist/lib/src/utils/use-form-common-props.js +25 -0
- package/dist/lib/src/utils/use-form-item.js +61 -0
- package/dist/lib/src/utils/use-id.js +35 -0
- package/dist/lib/src/utils/use-input.js +31 -0
- package/package.json +84 -62
- package/dist/demo.html +0 -1
- 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 +0 -2
- package/dist/tp.common.js.map +0 -1
- package/dist/tp.css +0 -167
- package/dist/tp.umd.js +0 -2
- package/dist/tp.umd.js.map +0 -1
- package/dist/tp.umd.min.js +0 -2
- package/dist/tp.umd.min.js.map +0 -1
- package/src/assets/scss/_fonts.scss +0 -27
- package/src/assets/scss/_functions.scss +0 -22
- package/src/assets/scss/_helpers.scss +0 -112
- package/src/assets/scss/_mixins.scss +0 -69
- package/src/assets/scss/_overrides.scss +0 -69
- package/src/assets/scss/_resass.scss +0 -83
- package/src/assets/scss/_variables.scss +0 -27
- package/src/assets/scss/index.scss +0 -11
- package/src/components/Autosuggest/Autosuggest.vue +0 -791
- package/src/components/Autosuggest/index.js +0 -3
- package/src/components/Dialog/Dialog.vue +0 -253
- package/src/components/Dialog/index.js +0 -3
- package/src/components/Inline/Inline.vue +0 -149
- package/src/components/Inline/index.js +0 -3
- package/src/components/InputNumber/InputNumber.vue +0 -430
- package/src/components/InputNumber/index.js +0 -3
- package/src/components/Loader/Loader.vue +0 -317
- package/src/components/Loader/animations.scss +0 -68
- package/src/components/Loader/index.js +0 -3
- package/src/components/Money/Money.vue +0 -82
- package/src/components/Money/index.js +0 -3
- package/src/components/Multisuggest/Multisuggest.vue +0 -858
- package/src/components/Multisuggest/index.js +0 -3
- package/src/components/OptionsList/OptionsList.vue +0 -61
- package/src/components/OptionsList/index.js +0 -3
- package/src/components/OptionsListItem/OptionsListItem.vue +0 -191
- package/src/components/OptionsListItem/index.js +0 -3
- package/src/components/Percent/Percent.vue +0 -81
- package/src/components/Percent/index.js +0 -3
- package/src/components/Skeleton/Skeleton.vue +0 -137
- package/src/components/Skeleton/index.js +0 -3
- package/src/components/Step/Step.vue +0 -230
- package/src/components/Step/index.js +0 -3
- package/src/components/Steps/Steps.vue +0 -18
- package/src/components/Steps/index.js +0 -3
- package/src/components/Tip/Tip.vue +0 -193
- package/src/components/Tip/index.js +0 -3
- package/src/components/index.js +0 -31
- package/src/locale/index.js +0 -78
- package/src/main.js +0 -26
- package/src/mixins/floatFormatter.js +0 -53
- package/src/mixins/locale.js +0 -9
- package/src/utils/currency.js +0 -180
- package/src/utils/filters.js +0 -84
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-row
|
|
3
|
-
v-if="!title"
|
|
4
|
-
:id="`${_id}`"
|
|
5
|
-
type="flex"
|
|
6
|
-
align="middle"
|
|
7
|
-
:class="tptipclasses"
|
|
8
|
-
class="text-black"
|
|
9
|
-
>
|
|
10
|
-
<el-col :xs="3" :sm="1" style="align-self: start;">
|
|
11
|
-
<em class="far fa-lightbulb-on" />
|
|
12
|
-
</el-col>
|
|
13
|
-
|
|
14
|
-
<el-col :xs="21" :sm="23">
|
|
15
|
-
<div
|
|
16
|
-
:id="`${_id}-text`"
|
|
17
|
-
v-html="text"
|
|
18
|
-
/>
|
|
19
|
-
</el-col>
|
|
20
|
-
</el-row>
|
|
21
|
-
|
|
22
|
-
<el-row
|
|
23
|
-
v-else
|
|
24
|
-
:id="`${_id}`"
|
|
25
|
-
type="flex"
|
|
26
|
-
align="middle"
|
|
27
|
-
justify="center"
|
|
28
|
-
:class="tptipclasses"
|
|
29
|
-
class="text-black"
|
|
30
|
-
>
|
|
31
|
-
|
|
32
|
-
<el-col :xs="3" :sm="1">
|
|
33
|
-
<el-row type="flex" justify="start">
|
|
34
|
-
<em class="far fa-lightbulb-on" />
|
|
35
|
-
</el-row>
|
|
36
|
-
</el-col>
|
|
37
|
-
|
|
38
|
-
<el-col :xs="18" :sm="22">
|
|
39
|
-
<b class="tp-title">{{ title }}</b>
|
|
40
|
-
</el-col>
|
|
41
|
-
|
|
42
|
-
<el-col :xs="3" :sm="1">
|
|
43
|
-
<el-row type="flex" justify="end">
|
|
44
|
-
<em v-if="closed" class="fa fa-plus tp-close-button" @click="closed = !closed" />
|
|
45
|
-
<em v-else class="fa fa-minus tp-close-button" @click="closed = !closed" />
|
|
46
|
-
</el-row>
|
|
47
|
-
</el-col>
|
|
48
|
-
|
|
49
|
-
<el-col :xs="18" :sm="22" :class="'tp-text ' + (closed ? 'tp-vanish' : '' )">
|
|
50
|
-
<div
|
|
51
|
-
:id="`${_id}-text`"
|
|
52
|
-
v-html="text"
|
|
53
|
-
/>
|
|
54
|
-
</el-col>
|
|
55
|
-
</el-row>
|
|
56
|
-
</template>
|
|
57
|
-
|
|
58
|
-
<script>
|
|
59
|
-
export default {
|
|
60
|
-
name: 'TpTip',
|
|
61
|
-
props: {
|
|
62
|
-
id: {
|
|
63
|
-
type: String,
|
|
64
|
-
required: false,
|
|
65
|
-
default: null
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
text: {
|
|
69
|
-
type: String,
|
|
70
|
-
required: true,
|
|
71
|
-
default: ''
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
title: {
|
|
75
|
-
type: String,
|
|
76
|
-
default: ''
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
type: {
|
|
80
|
-
type: String,
|
|
81
|
-
default: 'default'
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
data () {
|
|
86
|
-
return {
|
|
87
|
-
closed: true
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
computed: {
|
|
92
|
-
_id () {
|
|
93
|
-
return this.id || this.$options.name
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
tptipclasses () {
|
|
97
|
-
const classes = ['grid-content', 'pa-3']
|
|
98
|
-
|
|
99
|
-
if (this.type === 'error') {
|
|
100
|
-
classes.push('tp-tip-error')
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (this.type === 'warning') {
|
|
104
|
-
classes.push('tp-tip-warning')
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (this.type === 'success') {
|
|
108
|
-
classes.push('tp-tip-success')
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
return classes
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
</script>
|
|
116
|
-
|
|
117
|
-
<style lang="scss" scoped>
|
|
118
|
-
.far.fa-lightbulb-on {
|
|
119
|
-
font-size: 20px;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.grid-content {
|
|
123
|
-
flex-wrap: wrap;
|
|
124
|
-
border-radius: 4px;
|
|
125
|
-
background-color: rgba(76, 135, 251, 0.1);
|
|
126
|
-
border-radius: 4px;
|
|
127
|
-
border: solid 1px rgba(76, 135, 251, 0.2);
|
|
128
|
-
padding: 1rem;
|
|
129
|
-
font-size: 14px;
|
|
130
|
-
line-height: 24px;
|
|
131
|
-
color: #586d93;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
.info-text {
|
|
135
|
-
font-size: 12px;
|
|
136
|
-
font-stretch: normal;
|
|
137
|
-
font-style: normal;
|
|
138
|
-
line-height: 1.33;
|
|
139
|
-
letter-spacing: normal;
|
|
140
|
-
text-align: left;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.tp-tip-error {
|
|
144
|
-
background: #f56c6c1a 0% 0% no-repeat padding-box;
|
|
145
|
-
border: 1px solid #ff6077;
|
|
146
|
-
:deep(){
|
|
147
|
-
strong, b, em {
|
|
148
|
-
color: #ff425f;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
.tp-tip-warning {
|
|
154
|
-
background: #fff9ea 0% 0% no-repeat padding-box;
|
|
155
|
-
border: 1px solid #ffc437;
|
|
156
|
-
:deep(){
|
|
157
|
-
strong, b, em {
|
|
158
|
-
color: #ffc437;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
.tp-tip-success {
|
|
164
|
-
background: #f3fcfc 0% 0% no-repeat padding-box;
|
|
165
|
-
border: 1px solid #08a19e;
|
|
166
|
-
:deep(){
|
|
167
|
-
strong, b, em {
|
|
168
|
-
color: #08a19e;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
.tp-close-button {
|
|
174
|
-
cursor: pointer;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
.tp-title {
|
|
178
|
-
font-size: 16px;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
.tp-text {
|
|
182
|
-
height: auto;
|
|
183
|
-
transition: 0.4s opacity ease-out;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
.tp-vanish {
|
|
187
|
-
position: absolute;
|
|
188
|
-
max-height:0;
|
|
189
|
-
transform: scale(0);
|
|
190
|
-
opacity:0;
|
|
191
|
-
transition: 0s opacity linear;
|
|
192
|
-
}
|
|
193
|
-
</style>
|
package/src/components/index.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import Autosuggest from './Autosuggest'
|
|
2
|
-
import Inline from './Inline'
|
|
3
|
-
import Money from './Money'
|
|
4
|
-
import Percent from './Percent'
|
|
5
|
-
import OptionsList from './OptionsList'
|
|
6
|
-
import OptionsListItem from './OptionsListItem'
|
|
7
|
-
import Loader from './Loader'
|
|
8
|
-
import Skeleton from './Skeleton'
|
|
9
|
-
import Tip from './Tip'
|
|
10
|
-
import Multisuggest from './Multisuggest'
|
|
11
|
-
import Step from './Step'
|
|
12
|
-
import Steps from './Steps'
|
|
13
|
-
import InputNumber from './InputNumber'
|
|
14
|
-
import Dialog from './Dialog'
|
|
15
|
-
|
|
16
|
-
export {
|
|
17
|
-
Autosuggest,
|
|
18
|
-
Inline,
|
|
19
|
-
Money,
|
|
20
|
-
Percent,
|
|
21
|
-
OptionsList,
|
|
22
|
-
OptionsListItem,
|
|
23
|
-
Loader,
|
|
24
|
-
Skeleton,
|
|
25
|
-
Tip,
|
|
26
|
-
Multisuggest,
|
|
27
|
-
Step,
|
|
28
|
-
Steps,
|
|
29
|
-
InputNumber,
|
|
30
|
-
Dialog
|
|
31
|
-
}
|
package/src/locale/index.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import defaultLang from 'tp-ui/locale/lang/en'
|
|
2
|
-
import Vue from 'vue'
|
|
3
|
-
import Format from 'element-ui/src/locale/format'
|
|
4
|
-
|
|
5
|
-
const format = Format(Vue)
|
|
6
|
-
|
|
7
|
-
const i18nHandler = function () {
|
|
8
|
-
// Existe this e contem função "$t"
|
|
9
|
-
if (this && this.$i18n) {
|
|
10
|
-
return this.$i18n
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// Tenta usar o vueI18n da instancia do TP, caso tenha sido carregada
|
|
14
|
-
if (Vue.prototype.$tpI18n) {
|
|
15
|
-
return Vue.prototype.$tpI18n
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return null
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Recupera qual a locale de linguagem atualmente sendo utilizada
|
|
23
|
-
*/
|
|
24
|
-
export const getCurrentLocale = () => {
|
|
25
|
-
return (Vue.prototype.$tpI18n) ? Vue.prototype.$tpI18n.locale : Vue.prototype.$defaultLang
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Retorna as messages definidas na lang
|
|
30
|
-
*/
|
|
31
|
-
export const messages = function () {
|
|
32
|
-
const i18n = i18nHandler.apply(this, arguments)
|
|
33
|
-
|
|
34
|
-
if (i18n !== null && i18n !== undefined && i18n.messages) {
|
|
35
|
-
return i18n.messages
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return defaultLang
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Recupera um item de linguagem nas messages registradas.
|
|
43
|
-
* Caso não haja i18n registrado, utiliza da lingua padrão
|
|
44
|
-
* @param {String} path
|
|
45
|
-
* @param {Object} options
|
|
46
|
-
*/
|
|
47
|
-
export const t = function (path, options) {
|
|
48
|
-
const i18n = i18nHandler.apply(this, arguments)
|
|
49
|
-
|
|
50
|
-
if (i18n !== null && i18n !== undefined && i18n.t) {
|
|
51
|
-
return i18n.t(path)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const array = path.split('.')
|
|
55
|
-
let current = defaultLang
|
|
56
|
-
let value = null
|
|
57
|
-
|
|
58
|
-
for (let i = 0, j = array.length; i < j; i++) {
|
|
59
|
-
const property = array[i]
|
|
60
|
-
|
|
61
|
-
value = current[property]
|
|
62
|
-
|
|
63
|
-
if (!value) {
|
|
64
|
-
// eslint-disable-next-line
|
|
65
|
-
console.warn(`[Tp-i18n] Fall back to translate '${path}'. Key does not exist on language messages. Assuming key as value`)
|
|
66
|
-
|
|
67
|
-
return path
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (i === j - 1) return format(value, options)
|
|
71
|
-
|
|
72
|
-
current = value
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return ''
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export default { t, messages }
|
package/src/main.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import ElementUI from 'element-ui'
|
|
2
|
-
// import './assets/scss/index.scss'
|
|
3
|
-
import * as components from './components'
|
|
4
|
-
|
|
5
|
-
const install = function (Vue, opts = {}) {
|
|
6
|
-
Vue.prototype.$defaultLang = 'en'
|
|
7
|
-
Vue.prototype.$tpI18n = opts.locale || {}
|
|
8
|
-
opts.locale = null
|
|
9
|
-
|
|
10
|
-
// Element
|
|
11
|
-
ElementUI.install(Vue, opts)
|
|
12
|
-
|
|
13
|
-
// components
|
|
14
|
-
for (const componentName in components) {
|
|
15
|
-
const component = components[componentName]
|
|
16
|
-
|
|
17
|
-
Vue.component(component.name, component)
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (typeof window !== 'undefined' && window.Vue) {
|
|
22
|
-
install(window.Vue)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// TODO: Validar encapsulamento do ElementUI
|
|
26
|
-
export default ({ ...ElementUI, ...components, install })
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { formatMoney } from 'tp-ui/utils/currency'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Eventos para componentes tp-money e tp-percent mostratem o número formatado com a precisão correta e devolver float sem arredondar
|
|
5
|
-
*/
|
|
6
|
-
export default {
|
|
7
|
-
data () {
|
|
8
|
-
return {
|
|
9
|
-
formattedValue: this.value
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
props: {
|
|
14
|
-
allowEmpty: {
|
|
15
|
-
type: Boolean,
|
|
16
|
-
default: false
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
customPrecision: {
|
|
20
|
-
default: false
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
computed: {
|
|
25
|
-
locale () {
|
|
26
|
-
return this.t('locale')
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
watch: {
|
|
31
|
-
value: {
|
|
32
|
-
immediate: true,
|
|
33
|
-
handler (newValue, oldValue) {
|
|
34
|
-
if (newValue === '' && this.allowEmpty) { this.formattedValue = ''; return }
|
|
35
|
-
this.formattedValue = formatMoney(newValue, true, this.locale, this.customPrecision)
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
methods: {
|
|
41
|
-
input (evt) {
|
|
42
|
-
this.formattedValue = formatMoney(evt, true, this.locale, this.customPrecision)
|
|
43
|
-
const moneyFormatado = formatMoney(evt, false, this.locale, this.customPrecision)
|
|
44
|
-
|
|
45
|
-
this.$emit('input', moneyFormatado)
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
handleChange (evt) {
|
|
49
|
-
this.$emit('change', formatMoney(evt, false, this.locale, this.customPrecision))
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
}
|
package/src/mixins/locale.js
DELETED
package/src/utils/currency.js
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { messages } from 'tp-ui/locale'
|
|
2
|
-
|
|
3
|
-
const defaults = messages().locale.number
|
|
4
|
-
|
|
5
|
-
function format (input, opt = defaults) {
|
|
6
|
-
if (typeof input === 'number') {
|
|
7
|
-
input = input.toFixed(fixed(opt.precision))
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const negative = input.indexOf('-') >= 0 ? '-' : ''
|
|
11
|
-
|
|
12
|
-
const numbers = onlyNumbers(input)
|
|
13
|
-
const currency = numbersToCurrency(numbers, opt.precision)
|
|
14
|
-
const parts = toStr(currency).split('.')
|
|
15
|
-
let integer = parts[0]
|
|
16
|
-
const decimal = parts[1]
|
|
17
|
-
|
|
18
|
-
integer = addThousandSeparator(integer, opt.thousands)
|
|
19
|
-
|
|
20
|
-
return opt.prefix + negative + joinIntegerAndDecimal(integer, decimal, opt.decimal) + opt.suffix
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function unformat (input, precision = defaults.precision) {
|
|
24
|
-
const negative = (`${input}`).indexOf('-') >= 0 ? -1 : 1
|
|
25
|
-
const numbers = onlyNumbers(input)
|
|
26
|
-
const currency = numbersToCurrency(numbers, precision)
|
|
27
|
-
|
|
28
|
-
return currency * negative
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Formata dinheiro para float sem arredondar ou para string garantindo decimais completos (.00) e respeitando caracter de decimal
|
|
33
|
-
* @author gteixeira
|
|
34
|
-
* @param {Float} input Valor
|
|
35
|
-
* @param {Boolean} toString Se o retorno será float ou string
|
|
36
|
-
* @param {Object} locale Configuração de localidade para saber número de casas decimais (precision) e caracter de decimal (decimal)
|
|
37
|
-
* @param {Number} customPrecision Caso o usuário queira sobrescrever o número de casas decimais (precision) da configuração de localidade.
|
|
38
|
-
* @returns
|
|
39
|
-
*/
|
|
40
|
-
function formatMoney (input, toString = false, locale = defaults, customPrecision = false) {
|
|
41
|
-
let inputString = removeSecondSeparator(`${input}`, locale)
|
|
42
|
-
|
|
43
|
-
// Impede de digitar . ou , porque o formatador já adiciona
|
|
44
|
-
if ((inputString.slice(-1).match(/[.,]/))) {
|
|
45
|
-
inputString = inputString.substring(0, inputString.length - 1)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const negative = inputString.indexOf('-') >= 0 ? -1 : 1
|
|
49
|
-
|
|
50
|
-
if (toString) {
|
|
51
|
-
input = completeZeros(customPrecision, inputString, locale)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const precision = customPrecision || locale.number.precision
|
|
55
|
-
|
|
56
|
-
const numbers = onlyNumbers(input, precision)
|
|
57
|
-
const currency = numbersToCurrency(numbers, precision)
|
|
58
|
-
|
|
59
|
-
if (toString) {
|
|
60
|
-
let num = negative === -1 ? `-${currency}` : `${currency}`
|
|
61
|
-
|
|
62
|
-
if (locale?.number?.decimal) {
|
|
63
|
-
const decimalChar = locale?.number?.decimal
|
|
64
|
-
|
|
65
|
-
num = num.replaceAll(',', decimalChar).replaceAll('.', decimalChar)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return num
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return currency * negative
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function completeZeros (customPrecision, input, locale) {
|
|
75
|
-
const precision = customPrecision || locale?.number?.precision || defaults.precision
|
|
76
|
-
const decimal = locale?.number?.decimal || defaults.decimal
|
|
77
|
-
let i = input.lastIndexOf('.')
|
|
78
|
-
const j = input.lastIndexOf(',')
|
|
79
|
-
|
|
80
|
-
i = i > j ? i : j
|
|
81
|
-
const qntDecimais = i ? input.length - i - 1 : 0
|
|
82
|
-
|
|
83
|
-
// correção para decimal quebrado
|
|
84
|
-
if (i === -1) {
|
|
85
|
-
input = input + decimal + '0'.repeat(precision)
|
|
86
|
-
} else if (i && qntDecimais < precision) {
|
|
87
|
-
input += '0'.repeat(precision - qntDecimais)
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return input
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// Impede que seja adicionado um segundo separadador apos o ponto ou a virgula
|
|
94
|
-
function removeSecondSeparator (input, locale) {
|
|
95
|
-
const decimal = locale?.number?.decimal
|
|
96
|
-
|
|
97
|
-
if (!decimal || !input) {
|
|
98
|
-
return input
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// Separa a string pelo decimal
|
|
102
|
-
const newInputParts = input.split(decimal)
|
|
103
|
-
|
|
104
|
-
if (newInputParts.length) {
|
|
105
|
-
let newInput = ''
|
|
106
|
-
|
|
107
|
-
// Percorre as partes dividas da string limpando tudo que nao for numerico depois do separador decimal
|
|
108
|
-
for (let i = 0; i < newInputParts.length; i++) {
|
|
109
|
-
newInputParts[i] = i >= 1 ? newInputParts[i].replace(/[^0-9]/g, '') : newInputParts[i] + decimal
|
|
110
|
-
newInput += newInputParts[i]
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
return newInput
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return input
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function onlyNumbers (input) {
|
|
120
|
-
return toStr(input).replace(/\D+/g, '') || '0'
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// Uncaught RangeError: toFixed() digits argument must be between 0 and 20 at Number.toFixed
|
|
124
|
-
function fixed (precision = defaults.precision) {
|
|
125
|
-
return between(0, precision, 20)
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function between (min, n, max) {
|
|
129
|
-
return Math.max(min, Math.min(n, max))
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function numbersToCurrency (numbers, precision) {
|
|
133
|
-
const exp = Math.pow(10, precision)
|
|
134
|
-
const float = parseFloat(numbers) / exp
|
|
135
|
-
return float.toFixed(fixed(precision))
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
function addThousandSeparator (integer, separator) {
|
|
139
|
-
return integer.replace(/(\d)(?=(?:\d{3})+\b)/g, `$1${separator}`)
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// eslint-disable-next-line
|
|
143
|
-
function currencyToIntegerAndDecimal (float) {
|
|
144
|
-
return toStr(float).split('.')
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
function joinIntegerAndDecimal (integer, decimal, separator) {
|
|
148
|
-
return decimal ? integer + separator + decimal : integer
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
function toStr (value) {
|
|
152
|
-
return value ? value.toString() : ''
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
function setCursor (el, position) {
|
|
156
|
-
const setSelectionRange = function () { el.setSelectionRange(position, position) }
|
|
157
|
-
|
|
158
|
-
if (el === document.activeElement) {
|
|
159
|
-
setSelectionRange()
|
|
160
|
-
setTimeout(setSelectionRange, 1) // Android Fix
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Creating_and_triggering_events#The_old-fashioned_way
|
|
165
|
-
function event (name) {
|
|
166
|
-
const evt = document.createEvent('Event')
|
|
167
|
-
|
|
168
|
-
evt.initEvent(name, true, true)
|
|
169
|
-
|
|
170
|
-
return evt
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
export {
|
|
174
|
-
formatMoney,
|
|
175
|
-
format,
|
|
176
|
-
unformat,
|
|
177
|
-
setCursor,
|
|
178
|
-
completeZeros,
|
|
179
|
-
event
|
|
180
|
-
}
|
package/src/utils/filters.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
// import moment from 'moment'
|
|
2
|
-
import { t } from 'tp-ui/locale'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
* Filtros
|
|
7
|
-
* Importe um a um ou faça import * para utilizar
|
|
8
|
-
*
|
|
9
|
-
* Ex:
|
|
10
|
-
* ```import { toCurrency } from 'tp-ui/utils/filters'```
|
|
11
|
-
* e dentro do Componente:
|
|
12
|
-
* ```filters: { toCurrency }```
|
|
13
|
-
*
|
|
14
|
-
* @author bbarbosa
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Transforma valor em String para exibição conforme localidade
|
|
19
|
-
* @param {Number} val
|
|
20
|
-
* @param {String} locale
|
|
21
|
-
*/
|
|
22
|
-
export const toCurrency = (val, locale = false) => {
|
|
23
|
-
if (val === '') {
|
|
24
|
-
return val
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
try {
|
|
28
|
-
if (!locale) {
|
|
29
|
-
locale = t('locale.prefix')
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
let with2Decimals = val.toString().match(/^-?\d+(?:\.\d{0,2})?/)[0]
|
|
33
|
-
|
|
34
|
-
with2Decimals = Number(with2Decimals).toLocaleString(locale, {
|
|
35
|
-
minimumFractionDigits: 2,
|
|
36
|
-
maximumFractionDigits: 2
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
return with2Decimals
|
|
40
|
-
} catch (Exception) {
|
|
41
|
-
return val.toLocaleString(locale, {
|
|
42
|
-
minimumFractionDigits: 2,
|
|
43
|
-
maximumFractionDigits: 2
|
|
44
|
-
})
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Converte uma string de data em um objeto Date
|
|
50
|
-
* @param {String} val
|
|
51
|
-
*/
|
|
52
|
-
export const toDate = function (val) {
|
|
53
|
-
if (val === undefined || val === '' || val === null) return ''
|
|
54
|
-
|
|
55
|
-
if (val === '0000-00-00') return 'N/A'
|
|
56
|
-
|
|
57
|
-
// let defaultFormat = 'DD/MM/YYYY'
|
|
58
|
-
|
|
59
|
-
// switch (getCurrentLocale()) {
|
|
60
|
-
// case 'en-US':
|
|
61
|
-
// defaultFormat = 'YYYY-MM-DD'
|
|
62
|
-
// break
|
|
63
|
-
// default:
|
|
64
|
-
// defaultFormat
|
|
65
|
-
// }
|
|
66
|
-
|
|
67
|
-
// return moment(val).format(defaultFormat)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Transforma em lowercase
|
|
72
|
-
* @param {String} val
|
|
73
|
-
*/
|
|
74
|
-
export const toLowerCase = function (val) {
|
|
75
|
-
return val.toLowerCase()
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Transforma valor em uppercase
|
|
80
|
-
* @param {String} val
|
|
81
|
-
*/
|
|
82
|
-
export const toUpperCase = function (val) {
|
|
83
|
-
return val.toUpperCase()
|
|
84
|
-
}
|