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

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.15",
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,14 +1,14 @@
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
- <q-popup-proxy ref="dateProxy" transition-hide="scale" transition-show="scale">
5
+ <q-popup-proxy ref="dateProxy" transition-hide="scale" transition-show="scale" v-bind="datePopupProxyProps">
6
6
  <qas-date v-model="currentValue" v-bind="defaultDateProps" :mask="maskDate" width="290px" @update:model-value="updateModelValue" />
7
7
  </q-popup-proxy>
8
8
  </qas-btn>
9
9
 
10
10
  <qas-btn v-if="!useDateOnly" class="q-ml-sm" color="grey-9" :disable="$attrs.readonly" icon="sym_r_access_time">
11
- <q-popup-proxy ref="timeProxy" transition-hide="scale" transition-show="scale">
11
+ <q-popup-proxy ref="timeProxy" transition-hide="scale" transition-show="scale" v-bind="timePopupProxyProps">
12
12
  <q-time v-model="currentValue" v-bind="defaultTimeProps" format24h :mask="maskDate" @update:model-value="updateModelValue" />
13
13
  </q-popup-proxy>
14
14
  </qas-btn>
@@ -36,6 +36,11 @@ export default {
36
36
  type: Object
37
37
  },
38
38
 
39
+ datePopupProxyProps: {
40
+ default: () => ({}),
41
+ type: Object
42
+ },
43
+
39
44
  timeMask: {
40
45
  default: 'HH:mm',
41
46
  type: String
@@ -46,6 +51,11 @@ export default {
46
51
  type: Object
47
52
  },
48
53
 
54
+ timePopupProxyProps: {
55
+ default: () => ({}),
56
+ type: Object
57
+ },
58
+
49
59
  useIso: {
50
60
  type: Boolean
51
61
  },
@@ -17,6 +17,11 @@ props:
17
17
  default: {}
18
18
  type: Object
19
19
 
20
+ date-popup-proxy-props:
21
+ desc: Propriedades do QPopupProxy para o popup do QDate (https://quasar.dev/vue-components/popup-proxy#qpopupproxy-api).
22
+ default: {}
23
+ type: Object
24
+
20
25
  model-value:
21
26
  desc: Model do componente, usado para v-model.
22
27
  default: ''
@@ -33,6 +38,11 @@ props:
33
38
  default: {}
34
39
  type: Object
35
40
 
41
+ time-popup-proxy-props:
42
+ desc: Propriedades do QPopupProxy para o popup do QTime (https://quasar.dev/vue-components/popup-proxy#qpopupproxy-api).
43
+ default: {}
44
+ type: Object
45
+
36
46
  use-time-only:
37
47
  desc: Habilita o componente para usar somente hora.
38
48
  type: Boolean
@@ -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,8 @@ export default {
47
60
  data () {
48
61
  return {
49
62
  errorData: false,
50
- mask: ''
63
+ currentMask: '',
64
+ inputReference: null
51
65
  }
52
66
  },
53
67
 
@@ -56,20 +70,33 @@ export default {
56
70
  return this.inputReference.hasError
57
71
  },
58
72
 
59
- inputReference () {
60
- return this.$refs.input
61
- },
62
-
63
73
  masks () {
64
74
  return {
65
- 'company-document': () => '##.###.###/####-##',
66
- document: () => this.toggleMask('###.###.###-###', '##.###.###/####-##'),
67
- 'personal-document': () => '###.###.###-##',
68
- phone: () => this.toggleMask('(##) ####-#####', '(##) #####-####'),
69
- 'postal-code': () => '#####-###'
75
+ [Masks.CompanyDocument]: () => '##.###.###/####-##',
76
+ [Masks.Document]: () => this.toggleMask('###.###.###-###', '##.###.###/####-##'),
77
+ [Masks.PersonalDocument]: () => '###.###.###-##',
78
+ [Masks.Phone]: () => this.toggleMask('(##) ####-#####', '(##) #####-####'),
79
+ [Masks.PostalCode]: () => '#####-###'
70
80
  }
71
81
  },
72
82
 
83
+ defaultInputmode () {
84
+ const { inputmode, type } = this.$attrs
85
+
86
+ const defaults = {
87
+ [Masks.CompanyDocument]: 'numeric',
88
+ [Masks.Document]: 'numeric',
89
+ [Masks.PersonalDocument]: 'numeric',
90
+ [Masks.Phone]: 'tel',
91
+ [Masks.PostalCode]: 'numeric',
92
+
93
+ // types
94
+ email: 'email'
95
+ }
96
+
97
+ return inputmode || defaults[this.mask || type]
98
+ },
99
+
73
100
  model: {
74
101
  get () {
75
102
  return this.modelValue
@@ -84,7 +111,7 @@ export default {
84
111
  },
85
112
 
86
113
  watch: {
87
- mask (value) {
114
+ currentMask (value) {
88
115
  if (!value) return
89
116
 
90
117
  const input = this.getInput()
@@ -110,6 +137,10 @@ export default {
110
137
  }
111
138
  },
112
139
 
140
+ mounted () {
141
+ this.inputReference = this.$refs.input
142
+ },
143
+
113
144
  methods: {
114
145
  focus () {
115
146
  return this.inputReference.focus()
@@ -129,7 +160,7 @@ export default {
129
160
  },
130
161
 
131
162
  onPaste (event) {
132
- if (!this.mask) return
163
+ if (!this.currentMask) return
133
164
 
134
165
  const value = event.clipboardData.getData('text')
135
166
  const input = this.getInput()
@@ -153,11 +184,10 @@ export default {
153
184
  handleMask () {
154
185
  if (!this.modelValue?.length) return
155
186
 
156
- const { mask } = this.$attrs
157
- const hasDefaultMask = Object.prototype.hasOwnProperty.call(this.masks, mask)
187
+ const hasDefaultMask = Object.prototype.hasOwnProperty.call(this.masks, this.mask)
158
188
 
159
189
  this.$nextTick(() => {
160
- this.mask = hasDefaultMask ? this.masks[mask]() : mask
190
+ this.currentMask = hasDefaultMask ? this.masks[this.mask]() : this.mask
161
191
  })
162
192
  }
163
193
  }
@@ -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')" />