@bildvitta/quasar-ui-asteroid 3.11.0-beta.13 → 3.11.0-beta.14

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bildvitta/quasar-ui-asteroid",
3
3
  "description": "Asteroid",
4
- "version": "3.11.0-beta.13",
4
+ "version": "3.11.0-beta.14",
5
5
  "author": "Bild & Vitta <systemteam@bild.com.br>",
6
6
  "license": "MIT",
7
7
  "main": "dist/asteroid.cjs.min.js",
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div v-if="hasActions" class="qas-actions-menu">
3
- <component :is="component.is" v-bind="component.props" variant="tertiary">
3
+ <component :is="component.is" v-bind="component.props" variant="tertiary" @click.stop.prevent>
4
4
  <q-list v-if="isBtnDropdown">
5
5
  <slot v-for="(item, key) in actions" :item="item" :name="key">
6
6
  <q-item v-bind="item.props" :key="key" clickable @click="onClick(item)">
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <qas-input ref="input" v-bind="attributes" v-model="currentValue" :unmasked-value="false" @blur="validateDateTimeOnBlur" @focus="resetError" @update:model-value="updateModelValue">
2
+ <qas-input ref="input" v-bind="attributes" v-model="currentValue" inputmode="numeric" :unmasked-value="false" @blur="validateDateTimeOnBlur" @focus="resetError" @update:model-value="updateModelValue">
3
3
  <template #append>
4
4
  <qas-btn v-if="!useTimeOnly" color="grey-9" :disable="$attrs.readonly" icon="sym_r_event" variant="tertiary">
5
5
  <q-popup-proxy ref="dateProxy" transition-hide="scale" transition-show="scale">
@@ -189,7 +189,9 @@ export default {
189
189
  },
190
190
 
191
191
  hasRenderFunction () {
192
- return typeof this.card.description?.render === 'function'
192
+ const description = this.card.description
193
+
194
+ return typeof description === 'object' && description !== null && !Array.isArray(description)
193
195
  },
194
196
 
195
197
  descriptionComponentTag () {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <q-input ref="input" v-model="model" bottom-slots :error="errorData" v-bind="$attrs" :error-message="errorMessage" :mask="mask" :outlined="outlined" :unmasked-value="unmaskedValue" @paste="onPaste">
2
+ <q-input ref="input" v-model="model" bottom-slots :error="errorData" v-bind="$attrs" :error-message="errorMessage" :inputmode="defaultInputmode" :mask="currentMask" :outlined="outlined" :unmasked-value="unmaskedValue" @paste="onPaste">
3
3
  <template v-for="(_, name) in $slots" #[name]="context">
4
4
  <slot :name="name" v-bind="context || {}" />
5
5
  </template>
@@ -7,6 +7,14 @@
7
7
  </template>
8
8
 
9
9
  <script>
10
+ const Masks = {
11
+ CompanyDocument: 'company-document',
12
+ Document: 'document',
13
+ PersonalDocument: 'personal-document',
14
+ Phone: 'phone',
15
+ PostalCode: 'postal-code'
16
+ }
17
+
10
18
  export default {
11
19
  name: 'QasInput',
12
20
 
@@ -22,6 +30,11 @@ export default {
22
30
  default: ''
23
31
  },
24
32
 
33
+ mask: {
34
+ type: String,
35
+ default: ''
36
+ },
37
+
25
38
  modelValue: {
26
39
  default: '',
27
40
  type: [String, Number]
@@ -47,7 +60,7 @@ export default {
47
60
  data () {
48
61
  return {
49
62
  errorData: false,
50
- mask: ''
63
+ currentMask: ''
51
64
  }
52
65
  },
53
66
 
@@ -62,14 +75,31 @@ export default {
62
75
 
63
76
  masks () {
64
77
  return {
65
- 'company-document': () => '##.###.###/####-##',
66
- document: () => this.toggleMask('###.###.###-###', '##.###.###/####-##'),
67
- 'personal-document': () => '###.###.###-##',
68
- phone: () => this.toggleMask('(##) ####-#####', '(##) #####-####'),
69
- 'postal-code': () => '#####-###'
78
+ [Masks.CompanyDocument]: () => '##.###.###/####-##',
79
+ [Masks.Document]: () => this.toggleMask('###.###.###-###', '##.###.###/####-##'),
80
+ [Masks.PersonalDocument]: () => '###.###.###-##',
81
+ [Masks.Phone]: () => this.toggleMask('(##) ####-#####', '(##) #####-####'),
82
+ [Masks.PostalCode]: () => '#####-###'
70
83
  }
71
84
  },
72
85
 
86
+ defaultInputmode () {
87
+ const { inputmode, type } = this.$attrs
88
+
89
+ const defaults = {
90
+ [Masks.CompanyDocument]: 'numeric',
91
+ [Masks.Document]: 'numeric',
92
+ [Masks.PersonalDocument]: 'numeric',
93
+ [Masks.Phone]: 'tel',
94
+ [Masks.PostalCode]: 'numeric',
95
+
96
+ // types
97
+ email: 'email'
98
+ }
99
+
100
+ return inputmode || defaults[this.mask || type]
101
+ },
102
+
73
103
  model: {
74
104
  get () {
75
105
  return this.modelValue
@@ -129,7 +159,7 @@ export default {
129
159
  },
130
160
 
131
161
  onPaste (event) {
132
- if (!this.mask) return
162
+ if (!this.currentMask) return
133
163
 
134
164
  const value = event.clipboardData.getData('text')
135
165
  const input = this.getInput()
@@ -153,11 +183,10 @@ export default {
153
183
  handleMask () {
154
184
  if (!this.modelValue?.length) return
155
185
 
156
- const { mask } = this.$attrs
157
- const hasDefaultMask = Object.prototype.hasOwnProperty.call(this.masks, mask)
186
+ const hasDefaultMask = Object.prototype.hasOwnProperty.call(this.masks, this.mask)
158
187
 
159
188
  this.$nextTick(() => {
160
- this.mask = hasDefaultMask ? this.masks[mask]() : mask
189
+ this.currentMask = hasDefaultMask ? this.masks[this.mask]() : this.mask
161
190
  })
162
191
  }
163
192
  }
@@ -15,6 +15,12 @@ props:
15
15
  desc: Controla cor da borda do input.
16
16
  type: Boolean
17
17
 
18
+ mask:
19
+ desc: Máscara do input, é possível passar um slug de mascara ou um pattern personalizado.
20
+ type: String
21
+ default: ''
22
+ examples: [document, personal-document, company-document, phone, postal-code, '##/##/####']
23
+
18
24
  model-value:
19
25
  desc: Model do componente.
20
26
  type: [String, Input]
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <q-field :model-value="modelValue" outlined>
3
3
  <template #control="{ floatingLabel, id }">
4
- <input v-show="floatingLabel" :id="id" ref="input" class="q-field__input" @blur="emitValue" @click="setSelect" @input="emitUpdateModel($event.target.value)">
4
+ <input v-show="floatingLabel" :id="id" ref="input" class="q-field__input" inputmode="numeric" @blur="emitValue" @click="setSelect" @input="emitUpdateModel($event.target.value)">
5
5
  </template>
6
6
  </q-field>
7
7
  </template>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div class="qas-filter-input">
3
- <qas-input ref="input" v-model="model" v-bind="$attrs" class="bg-white rounded-borders-sm" data-cy="search-input" :debounce="debounce" dense hide-bottom-space input-class="ellipsis text-grey-8" type="search">
3
+ <qas-input ref="input" v-model="model" v-bind="$attrs" class="bg-white rounded-borders-sm" data-cy="search-input" :debounce="debounce" dense hide-bottom-space input-class="ellipsis text-grey-8" inputmode="search" type="search">
4
4
  <template #prepend>
5
5
  <q-icon v-if="useSearchOnType" color="grey-8" name="sym_r_search" />
6
6
  <qas-btn v-else color="grey-9" icon="sym_r_search" variant="tertiary" @click="$emit('filter')" />