@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.
- package/dist/tp.common.js +2 -1
- package/dist/tp.common.js.LICENSE.txt +9 -0
- package/dist/tp.common.js.map +1 -1
- package/dist/tp.common.lang-tp-en-js.js +2 -0
- package/dist/tp.common.lang-tp-en-js.js.map +1 -0
- package/dist/tp.css +11 -167
- package/dist/tp.umd.js +2 -1
- package/dist/tp.umd.js.LICENSE.txt +9 -0
- package/dist/tp.umd.js.map +1 -1
- package/dist/tp.umd.lang-tp-en-js.js +2 -0
- package/dist/tp.umd.lang-tp-en-js.js.map +1 -0
- package/dist/tp.umd.min.js +2 -1
- package/dist/tp.umd.min.js.LICENSE.txt +9 -0
- package/dist/tp.umd.min.js.map +1 -1
- package/dist/tp.umd.min.lang-tp-en-js.js +2 -0
- package/dist/tp.umd.min.lang-tp-en-js.js.map +1 -0
- package/package.json +51 -50
- package/src/assets/scss/_fonts.scss +24 -23
- package/src/assets/scss/_helpers.scss +4 -0
- package/src/assets/scss/_mixins.scss +2 -2
- package/src/assets/scss/_overrides.scss +5 -52
- package/src/assets/scss/_resass.scss +21 -12
- package/src/assets/scss/_variables.scss +0 -1
- package/src/assets/scss/index.scss +1 -4
- package/src/components/Autosuggest/Autosuggest.vue +340 -767
- package/src/components/Autosuggest/Multisuggest.vue +22 -0
- package/src/components/Autosuggest/autosuggest-props.js +210 -0
- package/src/components/Autosuggest/autosuggest-style.scss +127 -0
- package/src/components/Autosuggest/core.js +63 -0
- package/src/components/Autosuggest/index.js +2 -0
- package/src/components/Autosuggest/multisuggest-props.js +9 -0
- package/src/components/Autosuggest/option.vue +136 -0
- package/src/components/Autosuggest/select-dropdown.vue +64 -0
- package/src/components/Autosuggest/useOption.js +120 -0
- package/src/components/Autosuggest/useSelect.js +1133 -0
- package/src/components/AutosuggestTest.vue +56 -0
- package/src/components/CardExemplo.vue +49 -0
- package/src/components/CodeSample.vue +78 -0
- package/src/components/Inline/Inline.vue +24 -32
- package/src/components/InputNumber/InputNumber.vue +329 -378
- package/src/components/InputNumber/input-number.js +135 -0
- package/src/components/Loader/Loader.vue +42 -53
- package/src/components/Loader/animations.scss +13 -0
- package/src/components/Money/Money.vue +11 -20
- package/src/components/Multisuggest/index.js +2 -3
- package/src/components/MultisuggestTest.vue +56 -0
- package/src/components/OptionsList/OptionsList.vue +7 -6
- package/src/components/OptionsListItem/OptionsListItem.vue +46 -42
- package/src/components/Percent/Percent.vue +8 -14
- package/src/components/Skeleton/Skeleton.vue +16 -11
- package/src/components/Step/Step.vue +42 -35
- package/src/components/Steps/Steps.vue +4 -7
- package/src/components/TesteToCurrency.vue +171 -0
- package/src/components/Tip/Tip.vue +45 -30
- package/src/components/ValueSelector.vue +60 -0
- package/src/components/autosuggestMixin.js +301 -0
- package/src/components/index.js +4 -1
- package/src/locale/i18n.js +162 -0
- package/src/locale/lang/en.js +3 -2
- package/src/locale/lang/pt-br.js +3 -2
- package/src/main.js +8 -14
- package/src/mixins/floatFormatter.js +12 -16
- package/src/plugins/currency.js +100 -0
- package/src/utils/browser.js +6 -0
- package/src/utils/constants.js +3 -0
- package/src/utils/error.js +22 -0
- package/src/utils/filters.js +1 -14
- package/src/utils/helpers.js +41 -0
- package/src/utils/i18n.js +2 -0
- package/src/utils/icon.js +35 -0
- package/src/utils/index.js +20 -0
- package/src/utils/objects.js +17 -0
- package/src/utils/runtime.js +86 -0
- package/src/utils/scroll.js +100 -0
- package/src/utils/strings.js +17 -0
- package/src/utils/style.js +80 -0
- package/src/utils/types.js +39 -0
- package/src/utils/use-derived-namespace.js +112 -0
- package/src/utils/use-form-common-props.js +41 -0
- package/src/utils/use-form-item.js +80 -0
- package/src/utils/use-id.js +40 -0
- package/src/utils/use-input.js +33 -0
- package/src/components/Dialog/Dialog.vue +0 -253
- package/src/components/Dialog/index.js +0 -3
- package/src/components/Multisuggest/Multisuggest.vue +0 -858
- package/src/locale/index.js +0 -78
- package/src/mixins/locale.js +0 -9
- package/src/utils/currency.js +0 -180
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { computed, getCurrentInstance, inject, toRaw, watch } from 'vue'
|
|
3
|
+
import { get, isEqual } from 'lodash-unified'
|
|
4
|
+
import { escapeStringRegexp, isObject } from '@/utils'
|
|
5
|
+
|
|
6
|
+
export function useOption (props, states) {
|
|
7
|
+
// inject
|
|
8
|
+
const select = inject('select')
|
|
9
|
+
const selectGroup = inject('ElSelectGroup', { disabled: false })
|
|
10
|
+
|
|
11
|
+
// computed
|
|
12
|
+
const itemSelected = computed(() => {
|
|
13
|
+
if (select.props.multiple) {
|
|
14
|
+
return contains(select.props.modelValue, props.value)
|
|
15
|
+
} else {
|
|
16
|
+
return contains([select.props.modelValue], props.value)
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const limitReached = computed(() => {
|
|
21
|
+
if (select.props.multiple) {
|
|
22
|
+
const modelValue = (select.props.modelValue || [])
|
|
23
|
+
return (
|
|
24
|
+
!itemSelected.value &&
|
|
25
|
+
modelValue.length >= select.props.multipleLimit &&
|
|
26
|
+
select.props.multipleLimit > 0
|
|
27
|
+
)
|
|
28
|
+
} else {
|
|
29
|
+
return false
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
const currentLabel = computed(() => {
|
|
34
|
+
return props.label || (isObject(props.value) ? '' : props.value)
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
const currentValue = computed(() => {
|
|
38
|
+
return props.value || props.label || ''
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
const isDisabled = computed(() => {
|
|
42
|
+
return props.disabled || states.groupDisabled || limitReached.value
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
const instance = getCurrentInstance()
|
|
46
|
+
|
|
47
|
+
const contains = (arr = [], target) => {
|
|
48
|
+
if (!isObject(props.value)) {
|
|
49
|
+
return arr && arr.includes(target)
|
|
50
|
+
} else {
|
|
51
|
+
const valueKey = select.props.valueKey
|
|
52
|
+
return (
|
|
53
|
+
arr &&
|
|
54
|
+
arr.some((item) => {
|
|
55
|
+
return toRaw(get(item, valueKey)) === get(target, valueKey)
|
|
56
|
+
})
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const hoverItem = () => {
|
|
62
|
+
if (!props.disabled && !selectGroup.disabled) {
|
|
63
|
+
select.states.hoveringIndex = select.optionsArray.indexOf(instance.proxy)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const updateOption = (query) => {
|
|
68
|
+
const regexp = new RegExp(escapeStringRegexp(query), 'i')
|
|
69
|
+
states.visible = regexp.test(currentLabel.value) || props.created
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
watch(
|
|
73
|
+
() => currentLabel.value,
|
|
74
|
+
() => {
|
|
75
|
+
if (!props.created && !select.props.remote) select.setSelected()
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
watch(
|
|
80
|
+
() => props.value,
|
|
81
|
+
(val, oldVal) => {
|
|
82
|
+
const { remote, valueKey } = select.props
|
|
83
|
+
|
|
84
|
+
if (!isEqual(val, oldVal)) {
|
|
85
|
+
select.onOptionDestroy(oldVal, instance.proxy)
|
|
86
|
+
select.onOptionCreate(instance.proxy)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (!props.created && !remote) {
|
|
90
|
+
if (
|
|
91
|
+
valueKey &&
|
|
92
|
+
isObject(val) &&
|
|
93
|
+
isObject(oldVal) &&
|
|
94
|
+
val[valueKey] === oldVal[valueKey]
|
|
95
|
+
) {
|
|
96
|
+
return
|
|
97
|
+
}
|
|
98
|
+
select.setSelected()
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
watch(
|
|
104
|
+
() => selectGroup.disabled,
|
|
105
|
+
() => {
|
|
106
|
+
states.groupDisabled = selectGroup.disabled
|
|
107
|
+
},
|
|
108
|
+
{ immediate: true }
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
return {
|
|
112
|
+
select,
|
|
113
|
+
currentLabel,
|
|
114
|
+
currentValue,
|
|
115
|
+
itemSelected,
|
|
116
|
+
isDisabled,
|
|
117
|
+
hoverItem,
|
|
118
|
+
updateOption,
|
|
119
|
+
}
|
|
120
|
+
}
|