@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,135 @@
1
+ import { isNil } from 'lodash-unified'
2
+ import { useSizeProp } from 'element-plus/es/hooks/index'
3
+ import {
4
+ buildProps,
5
+ isNumber,
6
+ CHANGE_EVENT,
7
+ INPUT_EVENT,
8
+ UPDATE_MODEL_EVENT,
9
+ } from '@/utils'
10
+
11
+ export const inputNumberProps = buildProps({
12
+ /**
13
+ * @description same as `id` in native input
14
+ */
15
+ id: {
16
+ type: String,
17
+ default: undefined,
18
+ },
19
+ /**
20
+ * @description incremental step
21
+ */
22
+ step: {
23
+ type: Number,
24
+ default: 1,
25
+ },
26
+ /**
27
+ * @description whether input value can only be multiple of step
28
+ */
29
+ stepStrictly: Boolean,
30
+ /**
31
+ * @description the maximum allowed value
32
+ */
33
+ max: {
34
+ type: Number,
35
+ default: Number.POSITIVE_INFINITY,
36
+ },
37
+ /**
38
+ * @description the minimum allowed value
39
+ */
40
+ min: {
41
+ type: Number,
42
+ default: Number.NEGATIVE_INFINITY,
43
+ },
44
+ /**
45
+ * @description binding value
46
+ */
47
+ modelValue: {
48
+ type: [Number, String],
49
+ default: null
50
+ },
51
+ /**
52
+ * @description same as `readonly` in native input
53
+ */
54
+ readonly: Boolean,
55
+ /**
56
+ * @description whether the component is disabled
57
+ */
58
+ disabled: Boolean,
59
+ /**
60
+ * @description size of the component
61
+ */
62
+ size: useSizeProp,
63
+ /**
64
+ * @description whether to enable the control buttons
65
+ */
66
+ controls: {
67
+ type: Boolean,
68
+ default: true,
69
+ },
70
+ /**
71
+ * @description position of the control buttons
72
+ */
73
+ controlsPosition: {
74
+ type: String,
75
+ default: '',
76
+ values: ['', 'right'],
77
+ },
78
+ /**
79
+ * @description value should be set when input box is cleared
80
+ */
81
+ valueOnClear: {
82
+ type: [String, Number, null],
83
+ validator: (val) =>
84
+ val === null || isNumber(val) || ['min', 'max'].includes(val),
85
+ default: null,
86
+ },
87
+ /**
88
+ * @description same as `name` in native input
89
+ */
90
+ name: String,
91
+ /**
92
+ * @description same as `label` in native input
93
+ */
94
+ label: String,
95
+ /**
96
+ * @description same as `placeholder` in native input
97
+ */
98
+ placeholder: String,
99
+ /**
100
+ * @tagplus default 2
101
+ * @description precision of input value
102
+ */
103
+ precision: {
104
+ type: Number,
105
+ default: 2,
106
+ validator: (val) =>
107
+ val >= 0 && val === Number.parseInt(`${val}`, 10),
108
+ },
109
+ /**
110
+ * @description whether to trigger form validation
111
+ */
112
+ validateEvent: {
113
+ type: Boolean,
114
+ default: true,
115
+ },
116
+ /**
117
+ * @tagplus
118
+ * Se false permite campo vazio
119
+ **/
120
+ stringDefaultsZero: {
121
+ type: Boolean,
122
+ default: true
123
+ }
124
+ })
125
+
126
+ export const inputNumberEmits = {
127
+ [CHANGE_EVENT]: (cur, prev) =>
128
+ prev !== cur,
129
+ blur: (e) => e instanceof FocusEvent,
130
+ focus: (e) => e instanceof FocusEvent,
131
+ [INPUT_EVENT]: (val) =>
132
+ isNumber(val) || isNil(val),
133
+ [UPDATE_MODEL_EVENT]: (val) =>
134
+ isNumber(val) || isNil(val),
135
+ }
@@ -1,19 +1,9 @@
1
1
  <template>
2
2
  <div class="tp-loader">
3
3
  <div class="wrapper">
4
- <svg
5
- xmlns="http://www.w3.org/2000/svg"
6
- width="150px"
7
- height="150px"
8
- >
4
+ <svg xmlns="http://www.w3.org/2000/svg" width="150px" height="150px">
9
5
  <mask id="mascara">
10
- <rect
11
- x="0"
12
- y="0"
13
- width="100%"
14
- height="100%"
15
- fill="white"
16
- />
6
+ <rect x="0" y="0" width="100%" height="100%" fill="white" />
17
7
  <circle
18
8
  id="circulo-interno"
19
9
  class="circulo"
@@ -38,10 +28,7 @@
38
28
  fill="#1F7DE7"
39
29
  mask="url(#mascara)"
40
30
  />
41
- <g
42
- fill="none"
43
- fill-rule="evenodd"
44
- >
31
+ <g fill="none" fill-rule="evenodd">
45
32
  <circle
46
33
  class="residuo top center"
47
34
  cx="45"
@@ -127,18 +114,19 @@
127
114
  </template>
128
115
 
129
116
  <script>
117
+ import { defineComponent } from 'vue'
130
118
  /*
131
119
  Cria componente de loader com overlayer em toda a página
132
120
  `<tp-loader />`
133
121
  */
134
- export default {
122
+ export default defineComponent({
135
123
  name: 'TpLoader',
136
124
  props: {
137
125
  // Lista contendo as classes de icones a serem exibidos no loader
138
126
  icons: {
139
127
  type: Array,
140
128
  required: false,
141
- default: () => ([
129
+ default: () => [
142
130
  'fa-solid fa-badge-percent',
143
131
  'fa-solid fa-box-usd',
144
132
  'fa-solid fa-credit-card-front',
@@ -155,46 +143,40 @@ export default {
155
143
  'fa-solid fa-dolly-flatbed-alt',
156
144
  'fa-solid fa-receipt',
157
145
  'fa-solid fa-chart-pie-alt'
158
- ])
146
+ ]
159
147
  }
160
148
  }
161
- }
149
+ })
162
150
  </script>
163
151
 
164
152
  <style lang="scss" scoped>
165
- @import url("animations.scss");
166
- $oTop: 0;
167
- $oBottom: 70%;
168
- $oMiddle: 35%;
169
- $oLeft: 0;
170
- $oRight: 65%;
171
- $oCenter: 30%;
153
+ @import 'animations';
172
154
 
173
- $oTrans: 40px;
155
+ $o-top: 0;
156
+ $o-bottom: 70%;
157
+ $o-middle: 35%;
158
+ $o-left: 0;
159
+ $o-right: 65%;
160
+ $o-center: 30%;
161
+ $o-trans: 40px;
174
162
 
175
- //tempo da animacao em segundos
176
- $animationTime: 2;
177
- $numIcons: 8;
163
+ // tempo da animacao em segundos
164
+ $animation-time: 2;
178
165
 
179
166
  .tp-loader {
180
167
  position: fixed;
181
- top: 0;
182
- left: 0;
183
- right: 0;
184
- bottom: 0;
168
+ inset: 0;
185
169
  z-index: 5000;
186
170
 
187
171
  > .overlay {
188
172
  position: absolute;
189
173
  width: 100%;
190
174
  height: 100%;
191
- top: 0;
192
- bottom: 0;
193
- left: 0;
194
- right: 0;
175
+ inset: 0;
195
176
  background-color: #fff;
196
177
  opacity: 1;
197
178
  }
179
+
198
180
  .wrapper {
199
181
  text-align: center;
200
182
  display: flex;
@@ -212,16 +194,18 @@ $numIcons: 8;
212
194
  .circulo {
213
195
  transform-origin: 30% 32%;
214
196
  }
197
+
215
198
  #circulo {
216
199
  animation-name: expande;
217
- animation-duration: #{$animationTime}s;
200
+ animation-duration: #{$animation-time}s;
218
201
  animation-direction: normal;
219
202
  animation-iteration-count: infinite;
220
203
  animation-timing-function: linear;
221
204
  }
205
+
222
206
  #circulo-interno {
223
207
  animation-name: expandeInterno;
224
- animation-duration: #{$animationTime}s;
208
+ animation-duration: #{$animation-time}s;
225
209
  animation-direction: normal;
226
210
  animation-iteration-count: infinite;
227
211
  animation-timing-function: linear;
@@ -246,12 +230,12 @@ $numIcons: 8;
246
230
  opacity: 0;
247
231
  transform-origin: center center;
248
232
  color: $--color-primary;
249
-
250
233
  animation-name: icone;
251
- animation-duration: #{$animationTime}s;
234
+ animation-duration: #{$animation-time}s;
252
235
  animation-timing-function: ease-out;
253
236
  animation-iteration-count: 1;
254
- animation-delay: calc(var(--iconsItem) * #{$animationTime}s);
237
+ /* stylelint-disable-next-line custom-property-pattern */
238
+ animation-delay: calc(var(--iconsItem) * #{$animation-time}s);
255
239
 
256
240
  &:last-child {
257
241
  animation-iteration-count: infinite;
@@ -262,42 +246,47 @@ $numIcons: 8;
262
246
  #bola {
263
247
  .residuo {
264
248
  animation-name: residuo;
265
- animation-duration: #{$animationTime}s;
249
+ animation-duration: #{$animation-time}s;
266
250
  animation-direction: reverse;
267
251
  animation-iteration-count: infinite;
268
252
  animation-timing-function: ease-in;
269
253
  transform: scale(0.1);
270
254
 
271
255
  &.top {
272
- transform-origin: #{$oCenter} #{$oTop};
256
+ transform-origin: #{$o-center} #{$o-top};
273
257
 
274
258
  &.right {
275
259
  transform-origin: 45% 5%;
276
- transform: translate(#{$oTrans}, -#{$oTrans}) scale(0.1);
260
+ transform: translate(#{$o-trans}, -#{$o-trans}) scale(0.1);
277
261
  }
262
+
278
263
  &.left {
279
264
  transform-origin: 15% 5%;
280
- transform: translate(-#{$oTrans}, -#{$oTrans}) scale(0.1);
265
+ transform: translate(-#{$o-trans}, -#{$o-trans}) scale(0.1);
281
266
  }
282
267
  }
268
+
283
269
  &.bottom {
284
- transform-origin: #{$oCenter} #{$oBottom};
270
+ transform-origin: #{$o-center} #{$o-bottom};
285
271
 
286
272
  &.right {
287
273
  transform-origin: 45% 65%;
288
- transform: translate(#{$oTrans}, #{$oTrans}) scale(0.1);
274
+ transform: translate(#{$o-trans}, #{$o-trans}) scale(0.1);
289
275
  }
276
+
290
277
  &.left {
291
278
  transform-origin: 15% 65%;
292
- transform: translate(-#{$oTrans}, #{$oTrans}) scale(0.1);
279
+ transform: translate(-#{$o-trans}, #{$o-trans}) scale(0.1);
293
280
  }
294
281
  }
282
+
295
283
  &.middle {
296
284
  &.right {
297
- transform-origin: #{$oRight} #{$oMiddle};
285
+ transform-origin: #{$o-right} #{$o-middle};
298
286
  }
287
+
299
288
  &.left {
300
- transform-origin: #{$oLeft} #{$oMiddle};
289
+ transform-origin: #{$o-left} #{$o-middle};
301
290
  }
302
291
  }
303
292
  }
@@ -3,27 +3,33 @@
3
3
  transform: scale(0);
4
4
  opacity: 1;
5
5
  }
6
+
6
7
  25%{
7
8
  transform: scale(1);
8
9
  opacity: 1;
9
10
  }
11
+
10
12
  40%{
11
13
  transform: scale(0.8);
12
14
  opacity: 0;
13
15
  }
16
+
14
17
  50%{
15
18
  transform: scale(0);
16
19
  opacity: 0;
17
20
  }
21
+
18
22
  100% {
19
23
  opacity: 0;
20
24
  transform: scale(0);
21
25
  }
22
26
  }
27
+
23
28
  @keyframes expandeInterno {
24
29
  0%, 10%, 100%{
25
30
  transform: scale(0);
26
31
  }
32
+
27
33
  50%{
28
34
  transform: scale(2);
29
35
  }
@@ -33,15 +39,19 @@
33
39
  0%, 30%{
34
40
  opacity: 0;
35
41
  }
42
+
36
43
  40%{
37
44
  opacity: 0.5;
38
45
  }
46
+
39
47
  60%{
40
48
  opacity: 1;
41
49
  }
50
+
42
51
  70% {
43
52
  opacity: 0;
44
53
  }
54
+
45
55
  100% {
46
56
  opacity: 0;
47
57
  transform: scale(1.2);
@@ -53,14 +63,17 @@
53
63
  opacity: 1;
54
64
  transform: scale(0.1);
55
65
  }
66
+
56
67
  35%{
57
68
  opacity: 1;
58
69
  transform: scale(1);
59
70
  }
71
+
60
72
  85% {
61
73
  opacity: 1;
62
74
  transform: scale(1.2);
63
75
  }
76
+
64
77
  100% {
65
78
  opacity: 0;
66
79
  transform: scale(1.8);
@@ -2,40 +2,31 @@
2
2
  <el-input
3
3
  :id="`${_id}`"
4
4
  class="tp-money"
5
- :value="formattedValue"
5
+ :model-value="formattedValue"
6
6
  v-bind="$attrs"
7
7
  :maxlength="maxlength"
8
8
  @input="input"
9
9
  @change="handleChange"
10
10
  @focus="$event.target.select()"
11
11
  >
12
- <template
13
- v-if="!removePrepend"
14
- slot="prepend"
15
- >
12
+ <template v-if="!removePrepend" #prepend>
16
13
  {{ prepend }}
17
14
  </template>
18
15
 
19
- <template
20
- v-for="(_, slot) of $scopedSlots"
21
- #[slot]="scope"
22
- >
23
- <slot
24
- :name="slot"
25
- v-bind="scope"
26
- />
16
+ <template v-for="(_, slot) of $slots" #[slot]="scope">
17
+ <slot :name="slot" v-bind="scope" />
27
18
  </template>
28
19
  </el-input>
29
20
  </template>
30
21
 
31
22
  <script>
32
- import Locale from 'tp-ui/mixins/locale'
23
+ import { defineComponent } from 'vue'
33
24
  import floatFormatterMixin from 'tp-ui/mixins/floatFormatter'
34
25
 
35
- export default {
26
+ export default defineComponent({
36
27
  name: 'TpMoney',
37
-
38
- mixins: [Locale, floatFormatterMixin],
28
+ mixins: [floatFormatterMixin],
29
+ inheritAttrs: false,
39
30
  props: {
40
31
  id: {
41
32
  type: String,
@@ -49,7 +40,7 @@ export default {
49
40
  default: false
50
41
  },
51
42
  // valor do campo. Pode ser usado como v-model também
52
- value: {
43
+ modelValue: {
53
44
  type: [Number, String],
54
45
  default: 0
55
46
  },
@@ -67,10 +58,10 @@ export default {
67
58
  },
68
59
 
69
60
  prepend () {
70
- return this.t('tp.money.currency')
61
+ return this.$t('tp.money.currency')
71
62
  }
72
63
  }
73
- }
64
+ })
74
65
  </script>
75
66
 
76
67
  <style lang="scss" scoped>
@@ -1,3 +1,2 @@
1
- import Multisuggest from './Multisuggest'
2
-
3
- export default Multisuggest
1
+ import { Multisuggest } from '@src/components/Autosuggest'
2
+ export default Multisuggest
@@ -0,0 +1,56 @@
1
+ <template>
2
+ <tp-multisuggest
3
+ :id="_id"
4
+ :model-value="modelValue"
5
+ :placeholder="$t($options.placeholder)"
6
+ :label-key="$options.labelKey"
7
+ :remote-method="remoteMethod"
8
+ :suggestions="list"
9
+ :loading="loading"
10
+ :load-on-create="isLoadOnCreate"
11
+ :disabled="_disabled"
12
+ :allow-create="true"
13
+ :multiple="true"
14
+ @update:model-value="autosuggestMixin_input"
15
+ @handleOptionClick="autosuggestMixin_handleCreate"
16
+ @change="autosuggestMixin_handleChange"
17
+ />
18
+ </template>
19
+
20
+ <script>
21
+ import { defineComponent } from 'vue'
22
+ import AutosuggestsMixin from '@/components/autosuggestMixin'
23
+
24
+ export default defineComponent({
25
+ name: 'MultisuggestTest',
26
+ valueKey: 'id',
27
+ labelKey: 'name',
28
+ placeholder: 'common.placeholder',
29
+
30
+ mixins: [AutosuggestsMixin],
31
+
32
+ data () {
33
+ return {
34
+ uri: 'https://jsonplaceholder.typicode.com/users',
35
+ loading: false
36
+ }
37
+ },
38
+
39
+ methods: {
40
+ remoteMethod (query) {
41
+ this.loading = true
42
+ this.axios
43
+ .get(`${this.uri}?q=${query}`)
44
+ .then(res => {
45
+ this.list = res.data
46
+ this.loading = false
47
+ })
48
+ .catch(err => {
49
+ console.log(err)
50
+ this.loading = false
51
+ this.list = []
52
+ })
53
+ }
54
+ }
55
+ })
56
+ </script>
@@ -1,16 +1,17 @@
1
1
  <template>
2
- <ul :class="[justifyContent, 'tp-options-list', (disabled ? 'disabled' : '')]">
2
+ <ul :class="[justifyContent, 'tp-options-list', disabled ? 'disabled' : '']">
3
3
  <!-- Conteúdo do OptionList -->
4
4
  <slot />
5
5
  </ul>
6
6
  </template>
7
7
 
8
8
  <script>
9
+ import { defineComponent } from 'vue'
9
10
  /**
10
11
  * Container de uma lista de opções
11
12
  * `<tp-options-list></tp-options-list>`
12
13
  */
13
- export default {
14
+ export default defineComponent({
14
15
  name: 'TpOptionsList',
15
16
  props: {
16
17
  justifyContent: {
@@ -23,7 +24,7 @@ export default {
23
24
  default: false
24
25
  }
25
26
  }
26
- }
27
+ })
27
28
  </script>
28
29
 
29
30
  <style lang="scss" scoped>
@@ -49,13 +50,13 @@ export default {
49
50
  div,
50
51
  li {
51
52
  // só aplicar em telas grandes
52
- @media screen and ( min-width: 992px ) {
53
+ @media screen and (width >= 992px) {
53
54
  margin-right: 10px;
54
55
  }
55
56
  }
56
57
  }
57
58
 
58
- ul{
59
- padding-inline-start: 0px;
59
+ ul {
60
+ padding-inline-start: 0;
60
61
  }
61
62
  </style>