@tagplus/components 4.7.12 → 5.1.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.
Files changed (88) hide show
  1. package/dist/tp.common.js +2 -1
  2. package/dist/tp.common.js.LICENSE.txt +9 -0
  3. package/dist/tp.common.js.map +1 -1
  4. package/dist/tp.common.lang-tp-en-js.js +2 -0
  5. package/dist/tp.common.lang-tp-en-js.js.map +1 -0
  6. package/dist/tp.css +11 -167
  7. package/dist/tp.umd.js +2 -1
  8. package/dist/tp.umd.js.LICENSE.txt +9 -0
  9. package/dist/tp.umd.js.map +1 -1
  10. package/dist/tp.umd.lang-tp-en-js.js +2 -0
  11. package/dist/tp.umd.lang-tp-en-js.js.map +1 -0
  12. package/dist/tp.umd.min.js +2 -1
  13. package/dist/tp.umd.min.js.LICENSE.txt +9 -0
  14. package/dist/tp.umd.min.js.map +1 -1
  15. package/dist/tp.umd.min.lang-tp-en-js.js +2 -0
  16. package/dist/tp.umd.min.lang-tp-en-js.js.map +1 -0
  17. package/package.json +51 -50
  18. package/src/assets/scss/_fonts.scss +24 -23
  19. package/src/assets/scss/_helpers.scss +4 -0
  20. package/src/assets/scss/_mixins.scss +2 -2
  21. package/src/assets/scss/_overrides.scss +5 -52
  22. package/src/assets/scss/_resass.scss +21 -12
  23. package/src/assets/scss/_variables.scss +0 -1
  24. package/src/assets/scss/index.scss +1 -4
  25. package/src/components/Autosuggest/Autosuggest.vue +340 -767
  26. package/src/components/Autosuggest/Multisuggest.vue +22 -0
  27. package/src/components/Autosuggest/autosuggest-props.js +210 -0
  28. package/src/components/Autosuggest/autosuggest-style.scss +127 -0
  29. package/src/components/Autosuggest/core.js +63 -0
  30. package/src/components/Autosuggest/index.js +2 -0
  31. package/src/components/Autosuggest/multisuggest-props.js +9 -0
  32. package/src/components/Autosuggest/option.vue +136 -0
  33. package/src/components/Autosuggest/select-dropdown.vue +64 -0
  34. package/src/components/Autosuggest/useOption.js +120 -0
  35. package/src/components/Autosuggest/useSelect.js +1133 -0
  36. package/src/components/AutosuggestTest.vue +56 -0
  37. package/src/components/CardExemplo.vue +49 -0
  38. package/src/components/CodeSample.vue +78 -0
  39. package/src/components/Inline/Inline.vue +24 -32
  40. package/src/components/InputNumber/InputNumber.vue +329 -378
  41. package/src/components/InputNumber/input-number.js +135 -0
  42. package/src/components/Loader/Loader.vue +42 -53
  43. package/src/components/Loader/animations.scss +13 -0
  44. package/src/components/Money/Money.vue +11 -20
  45. package/src/components/Multisuggest/index.js +2 -3
  46. package/src/components/MultisuggestTest.vue +56 -0
  47. package/src/components/OptionsList/OptionsList.vue +7 -6
  48. package/src/components/OptionsListItem/OptionsListItem.vue +46 -42
  49. package/src/components/Percent/Percent.vue +8 -14
  50. package/src/components/Skeleton/Skeleton.vue +16 -11
  51. package/src/components/Step/Step.vue +42 -35
  52. package/src/components/Steps/Steps.vue +4 -7
  53. package/src/components/TesteToCurrency.vue +171 -0
  54. package/src/components/Tip/Tip.vue +45 -30
  55. package/src/components/ValueSelector.vue +60 -0
  56. package/src/components/autosuggestMixin.js +301 -0
  57. package/src/components/index.js +4 -1
  58. package/src/locale/i18n.js +162 -0
  59. package/src/locale/lang/en.js +3 -2
  60. package/src/locale/lang/pt-br.js +3 -2
  61. package/src/main.js +8 -14
  62. package/src/mixins/floatFormatter.js +12 -16
  63. package/src/plugins/currency.js +100 -0
  64. package/src/utils/browser.js +6 -0
  65. package/src/utils/constants.js +3 -0
  66. package/src/utils/error.js +22 -0
  67. package/src/utils/filters.js +1 -14
  68. package/src/utils/helpers.js +41 -0
  69. package/src/utils/i18n.js +2 -0
  70. package/src/utils/icon.js +35 -0
  71. package/src/utils/index.js +20 -0
  72. package/src/utils/objects.js +17 -0
  73. package/src/utils/runtime.js +86 -0
  74. package/src/utils/scroll.js +100 -0
  75. package/src/utils/strings.js +17 -0
  76. package/src/utils/style.js +80 -0
  77. package/src/utils/types.js +39 -0
  78. package/src/utils/use-derived-namespace.js +112 -0
  79. package/src/utils/use-form-common-props.js +41 -0
  80. package/src/utils/use-form-item.js +80 -0
  81. package/src/utils/use-id.js +40 -0
  82. package/src/utils/use-input.js +33 -0
  83. package/src/components/Dialog/Dialog.vue +0 -253
  84. package/src/components/Dialog/index.js +0 -3
  85. package/src/components/Multisuggest/Multisuggest.vue +0 -858
  86. package/src/locale/index.js +0 -78
  87. package/src/mixins/locale.js +0 -9
  88. package/src/utils/currency.js +0 -180
@@ -0,0 +1,39 @@
1
+ /* eslint-disable vue/prefer-import-from-vue */
2
+ import { isArray, isObject, isString } from '@vue/shared'
3
+ import { isNil } from 'lodash-unified'
4
+
5
+ export {
6
+ isArray,
7
+ isFunction,
8
+ isObject,
9
+ isString,
10
+ isDate,
11
+ isPromise,
12
+ isSymbol,
13
+ } from '@vue/shared'
14
+ export { isVNode } from 'vue'
15
+
16
+ export const isUndefined = (val) => val === undefined
17
+ export const isBoolean = (val) => typeof val === 'boolean'
18
+ export const isNumber = (val) => typeof val === 'number'
19
+
20
+ export const isEmpty = (val) =>
21
+ (!val && val !== 0) ||
22
+ (isArray(val) && val.length === 0) ||
23
+ (isObject(val) && !Object.keys(val).length)
24
+
25
+ export const isElement = (e) => {
26
+ if (typeof Element === 'undefined') return false
27
+ return e instanceof Element
28
+ }
29
+
30
+ export const isPropAbsent = (prop) => {
31
+ return isNil(prop)
32
+ }
33
+
34
+ export const isStringNumber = (val) => {
35
+ if (!isString(val)) {
36
+ return false
37
+ }
38
+ return !Number.isNaN(Number(val))
39
+ }
@@ -0,0 +1,112 @@
1
+ import { computed, getCurrentInstance, inject, ref, unref } from 'vue'
2
+
3
+ export const defaultNamespace = 'el'
4
+ const statePrefix = 'is-'
5
+
6
+ const _bem = (
7
+ namespace,
8
+ block,
9
+ blockSuffix,
10
+ element,
11
+ modifier
12
+ ) => {
13
+ let cls = `${namespace}-${block}`
14
+ if (blockSuffix) {
15
+ cls += `-${blockSuffix}`
16
+ }
17
+ if (element) {
18
+ cls += `__${element}`
19
+ }
20
+ if (modifier) {
21
+ cls += `--${modifier}`
22
+ }
23
+ return cls
24
+ }
25
+
26
+ export const namespaceContextKey =
27
+ Symbol('namespaceContextKey')
28
+
29
+ export const useGetDerivedNamespace = ( namespaceOverrides) => {
30
+ const derivedNamespace =
31
+ namespaceOverrides ||
32
+ (getCurrentInstance()
33
+ ? inject(namespaceContextKey, ref(defaultNamespace))
34
+ : ref(defaultNamespace))
35
+ const namespace = computed(() => {
36
+ return unref(derivedNamespace) || defaultNamespace
37
+ })
38
+ return namespace
39
+ }
40
+
41
+ export const useNamespace = ( block, namespaceOverrides) => {
42
+ const namespace = useGetDerivedNamespace(namespaceOverrides)
43
+ const b = (blockSuffix = '') =>
44
+ _bem(namespace.value, block, blockSuffix, '', '')
45
+ const e = (element) =>
46
+ element ? _bem(namespace.value, block, '', element, '') : ''
47
+ const m = (modifier) =>
48
+ modifier ? _bem(namespace.value, block, '', '', modifier) : ''
49
+ const be = (blockSuffix, element) =>
50
+ blockSuffix && element
51
+ ? _bem(namespace.value, block, blockSuffix, element, '')
52
+ : ''
53
+ const em = (element, modifier) =>
54
+ element && modifier
55
+ ? _bem(namespace.value, block, '', element, modifier)
56
+ : ''
57
+ const bm = (blockSuffix, modifier) =>
58
+ blockSuffix && modifier
59
+ ? _bem(namespace.value, block, blockSuffix, '', modifier)
60
+ : ''
61
+ const bem = (blockSuffix, element, modifier) =>
62
+ blockSuffix && element && modifier
63
+ ? _bem(namespace.value, block, blockSuffix, element, modifier)
64
+ : ''
65
+ const is = (name, ...args) => {
66
+ const state = args.length >= 1 ? args[0] : true
67
+ return name && state ? `${statePrefix}${name}` : ''
68
+ }
69
+
70
+ // for css var
71
+ // --el-xxx: value;
72
+ const cssVar = (object) => {
73
+ const styles = {}
74
+ for (const key in object) {
75
+ if (object[key]) {
76
+ styles[`--${namespace.value}-${key}`] = object[key]
77
+ }
78
+ }
79
+ return styles
80
+ }
81
+ // with block
82
+ const cssVarBlock = (object) => {
83
+ const styles = {}
84
+ for (const key in object) {
85
+ if (object[key]) {
86
+ styles[`--${namespace.value}-${block}-${key}`] = object[key]
87
+ }
88
+ }
89
+ return styles
90
+ }
91
+
92
+ const cssVarName = (name) => `--${namespace.value}-${name}`
93
+ const cssVarBlockName = (name) =>
94
+ `--${namespace.value}-${block}-${name}`
95
+
96
+ return {
97
+ namespace,
98
+ b,
99
+ e,
100
+ m,
101
+ be,
102
+ em,
103
+ bm,
104
+ bem,
105
+ is,
106
+ // css
107
+ cssVar,
108
+ cssVarName,
109
+ cssVarBlock,
110
+ cssVarBlockName,
111
+ }
112
+ }
@@ -0,0 +1,41 @@
1
+ import { computed, inject, ref, unref } from 'vue'
2
+ import { useGlobalSize, useProp } from 'element-plus/es/hooks/index'
3
+ import { formContextKey, formItemContextKey } from '@/utils'
4
+
5
+ export const useFormSize = (
6
+ fallback,
7
+ ignore = {}
8
+ ) => {
9
+ const emptyRef = ref(undefined)
10
+
11
+ const size = ignore.prop ? emptyRef : useProp('size')
12
+ const globalConfig = ignore.global ? emptyRef : useGlobalSize()
13
+ const form = ignore.form
14
+ ? { size: undefined }
15
+ : inject(formContextKey, undefined)
16
+ const formItem = ignore.formItem
17
+ ? { size: undefined }
18
+ : inject(formItemContextKey, undefined)
19
+
20
+ return computed(
21
+ () =>
22
+ size.value ||
23
+ unref(fallback) ||
24
+ formItem?.size ||
25
+ form?.size ||
26
+ globalConfig.value ||
27
+ ''
28
+ )
29
+ }
30
+
31
+ export const useFormDisabled = (fallback) => {
32
+ const disabled = useProp('disabled')
33
+ const form = inject(formContextKey, undefined)
34
+ return computed(
35
+ () => disabled.value || unref(fallback) || form?.disabled || false
36
+ )
37
+ }
38
+
39
+ // These exports are used for preventing breaking changes
40
+ export const useSize = useFormSize
41
+ export const useDisabled = useFormDisabled
@@ -0,0 +1,80 @@
1
+ /* eslint-disable no-param-reassign */
2
+ import {
3
+ computed,
4
+ inject,
5
+ onMounted,
6
+ onUnmounted,
7
+ ref,
8
+ toRef,
9
+ watch,
10
+ } from 'vue'
11
+ import { useId, formContextKey, formItemContextKey } from '@/utils'
12
+
13
+ export const useFormItem = () => {
14
+ const form = inject(formContextKey, undefined)
15
+ const formItem = inject(formItemContextKey, undefined)
16
+ return {
17
+ form,
18
+ formItem,
19
+ }
20
+ }
21
+
22
+ export const useFormItemInputId = (
23
+ props,
24
+ {
25
+ formItemContext,
26
+ disableIdGeneration,
27
+ disableIdManagement,
28
+ }
29
+ ) => {
30
+ if (!disableIdGeneration) {
31
+ disableIdGeneration = ref(false)
32
+ }
33
+ if (!disableIdManagement) {
34
+ disableIdManagement = ref(false)
35
+ }
36
+
37
+ const inputId = ref()
38
+ let idUnwatch
39
+
40
+ const isLabeledByFormItem = computed(() => {
41
+ return !!(
42
+ !props.label &&
43
+ formItemContext &&
44
+ formItemContext.inputIds &&
45
+ formItemContext.inputIds?.length <= 1
46
+ )
47
+ })
48
+
49
+ // Generate id for ElFormItem label if not provided as prop
50
+ onMounted(() => {
51
+ idUnwatch = watch(
52
+ [toRef(props, 'id'), disableIdGeneration],
53
+ ([id, disableIdGeneration]) => {
54
+ const newId = id ?? (!disableIdGeneration ? useId().value : undefined)
55
+ if (newId !== inputId.value) {
56
+ if (formItemContext?.removeInputId) {
57
+ inputId.value && formItemContext.removeInputId(inputId.value)
58
+ if (!disableIdManagement?.value && !disableIdGeneration && newId) {
59
+ formItemContext.addInputId(newId)
60
+ }
61
+ }
62
+ inputId.value = newId
63
+ }
64
+ },
65
+ { immediate: true }
66
+ )
67
+ })
68
+
69
+ onUnmounted(() => {
70
+ idUnwatch && idUnwatch()
71
+ if (formItemContext?.removeInputId) {
72
+ inputId.value && formItemContext.removeInputId(inputId.value)
73
+ }
74
+ })
75
+
76
+ return {
77
+ isLabeledByFormItem,
78
+ inputId,
79
+ }
80
+ }
@@ -0,0 +1,40 @@
1
+ import { computed, getCurrentInstance, inject, unref } from 'vue'
2
+ import { debugWarn, isClient } from '@/utils'
3
+ import { useGetDerivedNamespace } from '@/utils'
4
+
5
+ const defaultIdInjection = {
6
+ prefix: Math.floor(Math.random() * 10000),
7
+ current: 0,
8
+ }
9
+
10
+ export const ID_INJECTION_KEY =
11
+ Symbol('elIdInjection')
12
+
13
+ export const useIdInjection = () => {
14
+ return getCurrentInstance()
15
+ ? inject(ID_INJECTION_KEY, defaultIdInjection)
16
+ : defaultIdInjection
17
+ }
18
+
19
+ export const useId = (deterministicId) => {
20
+ const idInjection = useIdInjection()
21
+ if (!isClient && idInjection === defaultIdInjection) {
22
+ debugWarn(
23
+ 'IdInjection',
24
+ `Looks like you are using server rendering, you must provide a id provider to ensure the hydration process to be succeed
25
+ usage: app.provide(ID_INJECTION_KEY, {
26
+ prefix: number,
27
+ current: number,
28
+ })`
29
+ )
30
+ }
31
+
32
+ const namespace = useGetDerivedNamespace()
33
+ const idRef = computed(
34
+ () =>
35
+ unref(deterministicId) ||
36
+ `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`
37
+ )
38
+
39
+ return idRef
40
+ }
@@ -0,0 +1,33 @@
1
+ /* eslint-disable vue/prefer-import-from-vue */
2
+ import { ref } from 'vue'
3
+ import { isFunction } from '@vue/shared'
4
+ import { isKorean } from '@/utils'
5
+
6
+ export function useInput (handleInput = (event) => {}) {
7
+ const isComposing = ref(false)
8
+
9
+ const handleCompositionStart = () => {
10
+ isComposing.value = true
11
+ }
12
+
13
+ const handleCompositionUpdate = (event) => {
14
+ const text = event.target.value
15
+ const lastCharacter = text[text.length - 1] || ''
16
+ isComposing.value = !isKorean(lastCharacter)
17
+ }
18
+
19
+ const handleCompositionEnd = (event) => {
20
+ if (isComposing.value) {
21
+ isComposing.value = false
22
+ if (isFunction(handleInput)) {
23
+ handleInput(event)
24
+ }
25
+ }
26
+ }
27
+
28
+ return {
29
+ handleCompositionStart,
30
+ handleCompositionUpdate,
31
+ handleCompositionEnd,
32
+ }
33
+ }
@@ -1,253 +0,0 @@
1
- <template>
2
- <transition
3
- name="dialog-fade"
4
- @after-enter="afterEnter"
5
- @after-leave="afterLeave"
6
- >
7
- <div
8
- v-show="visible"
9
- class="el-dialog__wrapper"
10
- @click.self="handleWrapperClick"
11
- >
12
- <div
13
- :key="key"
14
- ref="dialog"
15
- role="dialog"
16
- aria-modal="true"
17
- :aria-label="title || 'dialog'"
18
- :class="['el-dialog', { 'is-fullscreen': fullscreen, 'el-dialog--center': center }, customClass]"
19
- :style="style"
20
- >
21
- <div class="el-dialog__header">
22
- <slot name="title">
23
- <span class="el-dialog__title">{{ title }}</span>
24
- </slot>
25
- <button
26
- v-if="showClose"
27
- type="button"
28
- class="el-dialog__headerbtn"
29
- aria-label="Close"
30
- @click="handleClose"
31
- >
32
- <em class="el-dialog__close el-icon el-icon-close" />
33
- </button>
34
- </div>
35
- <div
36
- v-if="rendered"
37
- class="el-dialog__body"
38
- >
39
- <slot />
40
- </div>
41
- <div
42
- v-if="$slots.footer"
43
- class="el-dialog__footer"
44
- >
45
- <slot name="footer" />
46
- </div>
47
- </div>
48
- </div>
49
- </transition>
50
- </template>
51
-
52
- <script>
53
- import Popup from 'element-ui/src/utils/popup'
54
- import Migrating from 'element-ui/src/mixins/migrating'
55
- import emitter from 'element-ui/src/mixins/emitter'
56
-
57
- /**
58
- * Sobrescreve o Dialog original sem usar o extends porque trocou um watch e watch não sobrescreve
59
- * <BR /> A nossa versão chama o $emit open quando tem v-if
60
- */
61
- export default {
62
- name: 'TpDialog',
63
-
64
- mixins: [Popup, emitter, Migrating],
65
-
66
- props: {
67
- title: {
68
- type: String,
69
- default: ''
70
- },
71
-
72
- modal: {
73
- type: Boolean,
74
- default: true
75
- },
76
-
77
- modalAppendToBody: {
78
- type: Boolean,
79
- default: true
80
- },
81
-
82
- appendToBody: {
83
- type: Boolean,
84
- default: false
85
- },
86
-
87
- lockScroll: {
88
- type: Boolean,
89
- default: true
90
- },
91
-
92
- closeOnClickModal: {
93
- type: Boolean,
94
- default: true
95
- },
96
-
97
- closeOnPressEscape: {
98
- type: Boolean,
99
- default: true
100
- },
101
-
102
- showClose: {
103
- type: Boolean,
104
- default: true
105
- },
106
-
107
- width: {
108
- type: String,
109
- default: 'auto'
110
- },
111
-
112
- fullscreen: Boolean,
113
-
114
- customClass: {
115
- type: String,
116
- default: ''
117
- },
118
-
119
- top: {
120
- type: String,
121
- default: '15vh'
122
- },
123
-
124
- beforeClose: {
125
- type: Function,
126
- default: () => {}
127
- },
128
-
129
- center: {
130
- type: Boolean,
131
- default: false
132
- },
133
-
134
- destroyOnClose: Boolean
135
- },
136
-
137
- data () {
138
- return {
139
- closed: false,
140
- key: 0
141
- }
142
- },
143
-
144
- computed: {
145
- style () {
146
- const style = {}
147
-
148
- if (!this.fullscreen) {
149
- style.marginTop = this.top
150
-
151
- if (this.width) {
152
- style.width = this.width
153
- }
154
- }
155
-
156
- return style
157
- }
158
- },
159
-
160
- watch: {
161
- // CORREÇÂO Sobrescreve o watch visible do dialog original para rodar o open quando tem v-if
162
- visible: {
163
- immediate: true,
164
- handler (val, oldValue) {
165
- // Fixing undefined reference of $el with next tick.
166
- this.$nextTick(() => {
167
- if (val) {
168
- this.closed = false
169
- this.$emit('open')
170
- this.$el.addEventListener('scroll', this.updatePopper)
171
- this.$nextTick(() => {
172
- if (this.$refs?.dialog) {
173
- this.$refs.dialog.scrollTop = 0
174
- }
175
- })
176
-
177
- if (this.appendToBody) {
178
- document.body.appendChild(this.$el)
179
- }
180
- } else {
181
- this.$el.removeEventListener('scroll', this.updatePopper)
182
-
183
- if (!this.closed) this.$emit('close')
184
-
185
- if (this.destroyOnClose) {
186
- this.$nextTick(() => {
187
- this.key++
188
- })
189
- }
190
- }
191
- })
192
- }
193
- }
194
- },
195
-
196
- mounted () {
197
- if (this.visible) {
198
- this.rendered = true
199
- this.open()
200
-
201
- if (this.appendToBody) {
202
- document.body.appendChild(this.$el)
203
- }
204
- }
205
- },
206
-
207
- destroyed () {
208
- // if appendToBody is true, remove DOM node after destroy
209
- if (this.appendToBody && this.$el && this.$el.parentNode) {
210
- this.$el.parentNode.removeChild(this.$el)
211
- }
212
- },
213
-
214
- methods: {
215
- getMigratingConfig () {
216
- return {
217
- props: {
218
- size: 'size is removed.'
219
- }
220
- }
221
- },
222
- handleWrapperClick () {
223
- if (!this.closeOnClickModal) return
224
-
225
- this.handleClose()
226
- },
227
- handleClose () {
228
- if (typeof this.beforeClose === 'function') {
229
- this.beforeClose(this.hide)
230
- } else {
231
- this.hide()
232
- }
233
- },
234
- hide (cancel) {
235
- if (cancel !== false) {
236
- this.$emit('update:visible', false)
237
- this.$emit('close')
238
- this.closed = true
239
- }
240
- },
241
- updatePopper () {
242
- this.broadcast('ElSelectDropdown', 'updatePopper')
243
- this.broadcast('ElDropdownMenu', 'updatePopper')
244
- },
245
- afterEnter () {
246
- this.$emit('opened')
247
- },
248
- afterLeave () {
249
- this.$emit('closed')
250
- }
251
- }
252
- }
253
- </script>
@@ -1,3 +0,0 @@
1
- import Dialog from './Dialog'
2
-
3
- export default Dialog