@bildvitta/quasar-ui-asteroid 3.14.0-beta.0 → 3.14.0-beta.2

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 (51) hide show
  1. package/package.json +1 -1
  2. package/src/components/actions-menu/QasActionsMenu.vue +16 -14
  3. package/src/components/alert/QasAlert.vue +1 -1
  4. package/src/components/app-bar/QasAppBar.vue +5 -5
  5. package/src/components/app-menu/QasAppMenu.vue +8 -8
  6. package/src/components/app-menu/private/PvAppMenuDropdown.vue +1 -1
  7. package/src/components/app-user/QasAppUser.vue +10 -10
  8. package/src/components/avatar/QasAvatar.vue +2 -2
  9. package/src/components/breakline/QasBreakline.vue +5 -6
  10. package/src/components/btn-dropdown/QasBtnDropdown.vue +74 -95
  11. package/src/components/card/QasCard.vue +55 -73
  12. package/src/components/chart-view/QasChartView.vue +37 -9
  13. package/src/components/chart-view/QasChartView.yml +6 -0
  14. package/src/components/checkbox-group/QasCheckboxGroup.vue +81 -92
  15. package/src/components/copy/QasCopy.vue +20 -27
  16. package/src/components/date/QasDate.vue +316 -355
  17. package/src/components/date/QasDate.yml +0 -5
  18. package/src/components/date/enums/DateMaskOptions.js +6 -0
  19. package/src/components/date-time-input/QasDateTimeInput.vue +198 -209
  20. package/src/components/debugger/QasDebugger.vue +20 -12
  21. package/src/components/delete/QasDelete.vue +70 -80
  22. package/src/components/dialog/QasDialog.vue +7 -7
  23. package/src/components/dialog/composables/use-cancel.js +3 -3
  24. package/src/components/dialog/composables/use-dynamic-components.js +4 -4
  25. package/src/components/dialog/composables/use-ok.js +3 -3
  26. package/src/components/dialog-router/QasDialogRouter.vue +68 -67
  27. package/src/components/empty-result-text/QasEmptyResultText.vue +8 -10
  28. package/src/components/form-generator/QasFormGenerator.vue +2 -2
  29. package/src/components/gallery/QasGallery.vue +175 -196
  30. package/src/components/gallery/composables/use-delete.js +54 -0
  31. package/src/components/gallery/private/PvGalleryCarouselDialog.vue +48 -55
  32. package/src/components/gallery/private/PvGalleryDeleteDialog.vue +41 -50
  33. package/src/components/gallery-card/QasGalleryCard.vue +90 -103
  34. package/src/components/grid-generator/QasGridGenerator.vue +2 -2
  35. package/src/components/header-actions/QasHeaderActions.vue +35 -50
  36. package/src/components/header-actions/QasHeaderActions.yml +1 -1
  37. package/src/components/infinite-scroll/QasInfiniteScroll.vue +2 -2
  38. package/src/components/label/QasLabel.vue +42 -54
  39. package/src/components/list-items/QasListItems.vue +32 -41
  40. package/src/components/map/QasMap.vue +44 -46
  41. package/src/components/numeric-input/QasNumericInput.vue +2 -2
  42. package/src/components/page-header/QasPageHeader.vue +74 -87
  43. package/src/components/pagination/QasPagination.vue +21 -21
  44. package/src/components/select-list-dialog/QasSelectListDialog.vue +4 -2
  45. package/src/components/tabs-generator/QasTabsGenerator.vue +55 -63
  46. package/src/components/timeline/QasTimeline.vue +1 -1
  47. package/src/components/uploader/private/PvUploaderGalleryCard.vue +1 -1
  48. package/src/components/whatsapp-link/QasWhatsappLink.vue +34 -0
  49. package/src/components/whatsapp-link/QasWhatsappLink.yml +18 -0
  50. package/src/composables/private/use-generator.js +0 -8
  51. package/src/vue-plugin.js +7 -1
@@ -45,11 +45,6 @@ props:
45
45
  default: true
46
46
  type: Boolean
47
47
 
48
- use-unmask-events:
49
- desc: A propriedade 'events' do Quasar só funciona com a formatação '/' mesmo que seja passada uma outra máscara. Esta propriedade transforma a formatação da propriedade 'events' de '-' em '/' (mas só funciona caso 'events' seja um Array).
50
- default: true
51
- type: Boolean
52
-
53
48
  use-unmask-options:
54
49
  desc: A propriedade 'options' do Quasar só funciona com a formatação '/' mesmo que seja passada uma outra máscara. Esta propriedade transforma a formatação da propriedade 'options' de '-' em '/' (mas só funciona caso 'options' seja um Array).
55
50
  default: true
@@ -0,0 +1,6 @@
1
+ export const MaskOptions = {
2
+ Dash: 'YYYY-MM-DD',
3
+ Slash: 'YYYY/MM/DD',
4
+ SlashPtBR: 'DD/MM/YYYY',
5
+ SlashDateAndHourPtBR: 'DD/MM/YYYY HH:mm'
6
+ }
@@ -1,14 +1,14 @@
1
1
  <template>
2
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
- <qas-btn v-if="!useTimeOnly" color="grey-10" :disable="$attrs.readonly" icon="sym_r_event" variant="tertiary">
5
- <q-popup-proxy ref="dateProxy" transition-hide="scale" transition-show="scale" v-bind="datePopupProxyProps">
4
+ <qas-btn v-if="!props.useTimeOnly" color="grey-10" :disable="attrs.readonly" icon="sym_r_event" variant="tertiary">
5
+ <q-popup-proxy ref="dateProxy" transition-hide="scale" transition-show="scale" v-bind="props.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
- <qas-btn v-if="!useDateOnly" class="q-ml-sm" color="grey-10" :disable="$attrs.readonly" icon="sym_r_access_time">
11
- <q-popup-proxy ref="timeProxy" transition-hide="scale" transition-show="scale" v-bind="timePopupProxyProps">
10
+ <qas-btn v-if="!props.useDateOnly" class="q-ml-sm" color="grey-10" :disable="attrs.readonly" icon="sym_r_access_time">
11
+ <q-popup-proxy ref="timeProxy" transition-hide="scale" transition-show="scale" v-bind="props.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>
@@ -16,255 +16,244 @@
16
16
  </qas-input>
17
17
  </template>
18
18
 
19
- <script>
20
- import { date } from 'quasar'
19
+ <script setup>
21
20
  import { date as dateFn } from '../../helpers/filters'
22
21
 
23
- export default {
22
+ import { date } from 'quasar'
23
+ import { ref, watch, computed, useAttrs, onMounted } from 'vue'
24
+
25
+ defineOptions({
24
26
  name: 'QasDateTimeInput',
27
+ inheritAttrs: false
28
+ })
25
29
 
26
- inheritAttrs: false,
27
-
28
- props: {
29
- dateMask: {
30
- default: 'DD/MM/YYYY',
31
- type: String
32
- },
33
-
34
- dateProps: {
35
- default: () => ({}),
36
- type: Object
37
- },
38
-
39
- datePopupProxyProps: {
40
- default: () => ({}),
41
- type: Object
42
- },
43
-
44
- timeMask: {
45
- default: 'HH:mm',
46
- type: String
47
- },
48
-
49
- timeProps: {
50
- default: () => ({}),
51
- type: Object
52
- },
53
-
54
- timePopupProxyProps: {
55
- default: () => ({}),
56
- type: Object
57
- },
58
-
59
- useIso: {
60
- type: Boolean
61
- },
62
-
63
- useTimeOnly: {
64
- type: Boolean
65
- },
66
-
67
- useDateOnly: {
68
- type: Boolean
69
- },
70
-
71
- modelValue: {
72
- default: '',
73
- type: String
74
- }
30
+ const props = defineProps({
31
+ dateMask: {
32
+ default: 'DD/MM/YYYY',
33
+ type: String
75
34
  },
76
35
 
77
- emits: ['update:modelValue'],
36
+ dateProps: {
37
+ default: () => ({}),
38
+ type: Object
39
+ },
78
40
 
79
- data () {
80
- return {
81
- currentValue: '',
82
- error: false,
83
- errorMessage: '',
84
- hasInvalidDate: false,
85
- lastValue: ''
86
- }
41
+ datePopupProxyProps: {
42
+ default: () => ({}),
43
+ type: Object
87
44
  },
88
45
 
89
- computed: {
90
- attributes () {
91
- const { modelValue, ...attributes } = this.$attrs
92
-
93
- return {
94
- error: this.error,
95
- errorMessage: this.errorMessage,
96
- ...attributes,
97
- mask: this.mask
98
- }
99
- },
100
-
101
- defaultDateProps () {
102
- return {
103
- ...this.defaultDateTimeProps,
104
- ...this.dateProps
105
- }
106
- },
107
-
108
- defaultTimeProps () {
109
- return {
110
- ...this.defaultDateTimeProps,
111
- ...this.timeProps
112
- }
113
- },
114
-
115
- defaultDateTimeProps () {
116
- return {
117
- readonly: this.$attrs.readonly,
118
- disable: this.$attrs.disable
119
- }
120
- },
121
-
122
- inputElement () {
123
- return this.$refs.input
124
- },
125
-
126
- mask () {
127
- return this.maskDate.replace(/\w/g, '#')
128
- },
129
-
130
- maskDate () {
131
- const mask = []
132
-
133
- if (!this.useTimeOnly) { mask.push(this.dateMask) }
134
- if (!this.useDateOnly) { mask.push(this.timeMask) }
135
-
136
- return mask.join(' ')
137
- }
46
+ timeMask: {
47
+ default: 'HH:mm',
48
+ type: String
138
49
  },
139
50
 
140
- watch: {
141
- modelValue (current, original) {
142
- if (!current || this.useTimeOnly) {
143
- this.currentValue = current
144
- return
145
- }
146
-
147
- if (current !== original && current !== this.lastValue) {
148
- this.currentValue = this.toMask(current)
149
- }
150
- }
51
+ timeProps: {
52
+ default: () => ({}),
53
+ type: Object
151
54
  },
152
55
 
153
- created () {
154
- this.currentValue = this.toMask(this.modelValue)
56
+ timePopupProxyProps: {
57
+ default: () => ({}),
58
+ type: Object
155
59
  },
156
60
 
157
- methods: {
158
- blur () {
159
- this.inputElement.blur()
160
- },
61
+ useIso: {
62
+ type: Boolean
63
+ },
64
+
65
+ useTimeOnly: {
66
+ type: Boolean
67
+ },
68
+
69
+ useDateOnly: {
70
+ type: Boolean
71
+ },
72
+
73
+ modelValue: {
74
+ default: '',
75
+ type: String
76
+ }
77
+ })
78
+
79
+ const emit = defineEmits(['update:modelValue'])
80
+
81
+ const attrs = useAttrs()
161
82
 
162
- focus () {
163
- this.inputElement.focus()
164
- },
83
+ // template refs
84
+ const dateProxy = ref(null)
85
+ const timeProxy = ref(null)
86
+ const input = ref(null)
165
87
 
166
- updateModelValue (value) {
167
- this.currentValue = value
168
- const valueLength = value?.replace?.(/_/g, '')?.length
88
+ // validations
89
+ const error = ref(false)
90
+ const errorMessage = ref('')
91
+ const hasInvalidDate = ref(false)
169
92
 
170
- this.error = this.validateDateAndTime(value)
93
+ const currentValue = ref('')
94
+ const lastValue = ref('')
171
95
 
172
- if (this.error) {
173
- this.hasInvalidDate = true
174
- this.errorMessage = 'Data inválida.'
175
- return
176
- }
96
+ // computed
97
+ const maskDate = computed(() => {
98
+ const mask = []
177
99
 
178
- this.hasInvalidDate = false
100
+ if (!props.useTimeOnly) { mask.push(props.dateMask) }
101
+ if (!props.useDateOnly) { mask.push(props.timeMask) }
179
102
 
180
- if (value === '' || valueLength === this.mask.length) {
181
- this.lastValue = this.useTimeOnly ? value : this.toISOString(value)
182
- this.$emit('update:modelValue', this.lastValue)
183
- }
103
+ return mask.join(' ')
104
+ })
184
105
 
185
- if (this.useDateOnly) {
186
- this.$refs.dateProxy.hide()
187
- }
106
+ const mask = computed(() => maskDate.value.replace(/\w/g, '#'))
188
107
 
189
- if (this.useTimeOnly) {
190
- this.$refs.timeProxy.hide()
191
- }
192
- },
108
+ const attributes = computed(() => {
109
+ const { modelValue, ...restAttributes } = attrs
193
110
 
194
- toISOString (value) {
195
- if (!value) return ''
111
+ return {
112
+ error: error.value,
113
+ errorMessage: errorMessage.value,
114
+ ...restAttributes,
115
+ mask: mask.value
116
+ }
117
+ })
196
118
 
197
- if (this.useDateOnly && !this.useIso) {
198
- return dateFn(date.extractDate(value, this.maskDate), 'yyyy-MM-dd')
199
- }
119
+ const defaultDateTimeProps = computed(() => {
120
+ return {
121
+ readonly: attrs.readonly,
122
+ disable: attrs.disable
123
+ }
124
+ })
200
125
 
201
- if (this.useTimeOnly && !this.useIso) {
202
- return date.extractDate(value, 'HH:MM')
203
- }
126
+ const defaultDateProps = computed(() => {
127
+ return {
128
+ ...defaultDateTimeProps.value,
129
+ ...props.dateProps
130
+ }
131
+ })
204
132
 
205
- return date.extractDate(value, this.maskDate).toISOString()
206
- },
133
+ const defaultTimeProps = computed(() => {
134
+ return {
135
+ ...defaultDateTimeProps.value,
136
+ ...props.timeProps
137
+ }
138
+ })
207
139
 
208
- toMask (value) {
209
- if (!value || this.useTimeOnly) {
210
- return value || ''
211
- }
140
+ watch(() => props.modelValue, (current, original) => {
141
+ if (!current || props.useTimeOnly) {
142
+ currentValue.value = current
143
+ return
144
+ }
212
145
 
213
- const newDate = new Date(value).toISOString()
146
+ if (current !== original && current !== lastValue.value) {
147
+ currentValue.value = toMask(current)
148
+ }
149
+ })
214
150
 
215
- return date.formatDate(
216
- this.useDateOnly ? newDate.slice(0, 23) : newDate,
217
- this.maskDate
218
- )
219
- },
151
+ onMounted(() => {
152
+ currentValue.value = toMask(props.modelValue)
153
+ })
220
154
 
221
- validateDateTimeOnBlur () {
222
- const valueLength = this.currentValue?.replace?.(/_/g, '')?.length
155
+ // functions
156
+ function toISOString (value) {
157
+ if (!value) return ''
223
158
 
224
- // valida se o tamanho digitado é o tamanho que a mascara espera receber
225
- this.error = !!((valueLength < this.mask.length || this.error) && valueLength)
159
+ if (props.useDateOnly && !props.useIso) {
160
+ return dateFn(date.extractDate(value, maskDate.value), 'yyyy-MM-dd')
161
+ }
226
162
 
227
- if (this.error && !this.hasInvalidDate) {
228
- this.errorMessage = 'Data incompleta.'
229
- }
163
+ if (props.useTimeOnly && !props.useIso) {
164
+ return date.extractDate(value, 'HH:MM')
165
+ }
230
166
 
231
- if (this.hasInvalidDate) {
232
- this.currentValue = ''
233
- }
167
+ return date.extractDate(value, maskDate.value).toISOString()
168
+ }
234
169
 
235
- if (this.error || this.hasInvalidDate) {
236
- this.$emit('update:modelValue', '')
237
- }
238
- },
170
+ function toMask (value) {
171
+ if (!value || props.useTimeOnly) {
172
+ return value || ''
173
+ }
239
174
 
240
- validateDateAndTime (value) {
241
- if (!value) return false
175
+ const newDate = new Date(value).toISOString()
242
176
 
243
- if (this.useDateOnly) return this.validateDateOnly(value)
244
- if (this.useTimeOnly) return this.validateTimeOnly(value)
177
+ return date.formatDate(
178
+ props.useDateOnly ? newDate.slice(0, 23) : newDate,
179
+ maskDate.value
180
+ )
181
+ }
245
182
 
246
- const [date, time] = value?.split(' ') || []
183
+ function updateModelValue (value) {
184
+ currentValue.value = value
247
185
 
248
- return this.validateDateOnly(date) || this.validateTimeOnly(time)
249
- },
186
+ const valueLength = value?.replace?.(/_/g, '')?.length
250
187
 
251
- validateDateOnly (value = '') {
252
- const [day, month] = value.split('/')
188
+ error.value = validateDateAndTime(value)
253
189
 
254
- return day > 31 || month > 12
255
- },
190
+ if (error.value) {
191
+ hasInvalidDate.value = true
192
+ errorMessage.value = 'Data inválida.'
193
+ return
194
+ }
256
195
 
257
- validateTimeOnly (value = '') {
258
- const [hour, minute] = value.split(':')
196
+ hasInvalidDate.value = false
259
197
 
260
- return hour > 23 || minute > 59
261
- },
198
+ if (value === '' || valueLength === mask.value.length) {
199
+ lastValue.value = props.useTimeOnly ? value : toISOString(value)
200
+ emit('update:modelValue', lastValue.value)
201
+ }
202
+
203
+ if (props.useDateOnly) {
204
+ dateProxy.value.hide()
205
+ }
206
+
207
+ if (props.useTimeOnly) {
208
+ timeProxy.value.hide()
209
+ }
210
+ }
211
+
212
+ function validateDateOnly (value = '') {
213
+ const [day, month] = value.split('/')
214
+
215
+ return day > 31 || month > 12
216
+ }
217
+
218
+ function validateTimeOnly (value = '') {
219
+ const [hour, minute] = value.split(':')
220
+
221
+ return hour > 23 || minute > 59
222
+ }
223
+
224
+ function validateDateAndTime (value) {
225
+ if (!value) return false
226
+
227
+ if (props.useDateOnly) return validateDateOnly(value)
228
+ if (props.useTimeOnly) return validateTimeOnly(value)
229
+
230
+ const [date, time] = value?.split(' ') || []
231
+
232
+ return validateDateOnly(date) || validateTimeOnly(time)
233
+ }
234
+
235
+ function validateDateTimeOnBlur () {
236
+ const valueLength = currentValue.value?.replace?.(/_/g, '')?.length
237
+
238
+ // valida se o tamanho digitado é o tamanho que a mascara espera receber
239
+ error.value = !!((valueLength < mask.value.length || error.value) && valueLength)
240
+
241
+ if (error.value && !hasInvalidDate.value) {
242
+ errorMessage.value = 'Data incompleta.'
243
+ }
244
+
245
+ if (hasInvalidDate.value) {
246
+ currentValue.value = ''
247
+ }
248
+
249
+ if (error.value || hasInvalidDate.value) {
250
+ emit('update:modelValue', '')
251
+ }
252
+ }
262
253
 
263
- resetError () {
264
- if (!this.currentValue) {
265
- this.error = false
266
- }
267
- }
254
+ function resetError () {
255
+ if (!currentValue.value) {
256
+ error.value = false
268
257
  }
269
258
  }
270
259
  </script>
@@ -1,23 +1,31 @@
1
1
  <template>
2
- <details class="bg-grey-3 q-my-md q-pa-md rounded-borders">
2
+ <details class="bg-grey-3 q-my-md q-pa-md qas-debugger rounded-borders">
3
3
  <summary>Debugger</summary>
4
4
 
5
5
  <div class="row">
6
- <pre v-for="(item, index) in inspect" :key="index" class="col q-pa-sm scroll" style="max-height: 300px;">{{ item }}</pre>
6
+ <pre v-for="(item, index) in props.inspect" :key="index" class="col q-pa-sm qas-debugger__code scroll">
7
+ {{ item }}
8
+ </pre>
7
9
  </div>
8
10
  </details>
9
11
  </template>
10
12
 
11
- <script>
12
- export default {
13
- name: 'QasDebugger',
13
+ <script setup>
14
+ defineOptions({ name: 'QasDebugger' })
14
15
 
15
- props: {
16
- inspect: {
17
- default: () => [],
18
- required: true,
19
- type: Array
20
- }
16
+ const props = defineProps({
17
+ inspect: {
18
+ default: () => [],
19
+ required: true,
20
+ type: Array
21
21
  }
22
- }
22
+ })
23
23
  </script>
24
+
25
+ <style lang="scss">
26
+ .qas-debugger {
27
+ &__code {
28
+ max-height: 300px;
29
+ }
30
+ }
31
+ </style>