@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,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
+ }