@bildvitta/quasar-ui-asteroid 3.10.0-beta.7 → 3.10.0-beta.9
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 +21 -23
- package/src/components/date/QasDate.vue +298 -70
- package/src/components/date/QasDate.yml +6 -1
- package/src/components/date-time-input/QasDateTimeInput.vue +1 -1
- package/src/components/filters/QasFilters.vue +1 -1
- package/src/components/gallery/QasGallery.vue +0 -1
- package/src/components/grid-generator/QasGridGenerator.vue +35 -30
- package/src/components/search-box/QasSearchBox.vue +2 -3
- package/src/components/search-box/QasSearchBox.yml +1 -1
- package/src/components/select/QasSelect.vue +71 -4
- package/src/components/select/QasSelect.yml +1 -1
- package/src/mixins/search-filter.js +10 -9
- package/src/shared/fuse-config.js +4 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bildvitta/quasar-ui-asteroid",
|
|
3
3
|
"description": "Asteroid",
|
|
4
|
-
"version": "3.10.0-beta.
|
|
4
|
+
"version": "3.10.0-beta.9",
|
|
5
5
|
"author": "Bild & Vitta <systemteam@bild.com.br>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/asteroid.cjs.min.js",
|
|
@@ -12,8 +12,7 @@
|
|
|
12
12
|
"src"
|
|
13
13
|
],
|
|
14
14
|
"scripts": {
|
|
15
|
-
"build": "npx rollup -c"
|
|
16
|
-
"dev": "cd dev && npm i && npm run dev && cd .."
|
|
15
|
+
"build": "npx rollup -c --bundleConfigAsCjs"
|
|
17
16
|
},
|
|
18
17
|
"publishConfig": {
|
|
19
18
|
"access": "public",
|
|
@@ -28,34 +27,33 @@
|
|
|
28
27
|
"components"
|
|
29
28
|
],
|
|
30
29
|
"devDependencies": {
|
|
31
|
-
"@rollup/plugin-json": "^
|
|
32
|
-
"@rollup/plugin-replace": "^
|
|
33
|
-
"@rollup/plugin-url": "^
|
|
34
|
-
"@vue/compiler-sfc": "^3.
|
|
35
|
-
"autoprefixer": "^10.4.
|
|
36
|
-
"core-js": "^3.
|
|
37
|
-
"postcss": "^8.4.
|
|
38
|
-
"quasar": "^2.
|
|
39
|
-
"rimraf": "^
|
|
40
|
-
"rollup": "^
|
|
30
|
+
"@rollup/plugin-json": "^6.0.0",
|
|
31
|
+
"@rollup/plugin-replace": "^5.0.2",
|
|
32
|
+
"@rollup/plugin-url": "^8.0.1",
|
|
33
|
+
"@vue/compiler-sfc": "^3.3.4",
|
|
34
|
+
"autoprefixer": "^10.4.14",
|
|
35
|
+
"core-js": "^3.30.2",
|
|
36
|
+
"postcss": "^8.4.24",
|
|
37
|
+
"quasar": "^2.12.0",
|
|
38
|
+
"rimraf": "^5.0.1",
|
|
39
|
+
"rollup": "^3.23.1",
|
|
41
40
|
"rollup-plugin-local-resolve": "^1.0.7",
|
|
42
|
-
"rollup-plugin-scss": "^
|
|
43
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
41
|
+
"rollup-plugin-scss": "^4.0.0",
|
|
44
42
|
"rollup-plugin-vue": "^6.0.0",
|
|
45
|
-
"sass": "^1.
|
|
43
|
+
"sass": "^1.62.1"
|
|
46
44
|
},
|
|
47
45
|
"dependencies": {
|
|
48
46
|
"@bildvitta/store-adapter": "^1.0.0",
|
|
49
|
-
"@fawmi/vue-google-maps": "^0.9.
|
|
50
|
-
"autonumeric": "^4.
|
|
51
|
-
"axios": "^
|
|
52
|
-
"date-fns": "^2.
|
|
53
|
-
"fuse.js": "^6.
|
|
47
|
+
"@fawmi/vue-google-maps": "^0.9.79",
|
|
48
|
+
"autonumeric": "^4.9.0",
|
|
49
|
+
"axios": "^1.4.0",
|
|
50
|
+
"date-fns": "^2.30.0",
|
|
51
|
+
"fuse.js": "^6.6.2",
|
|
54
52
|
"humps": "^2.0.1",
|
|
55
53
|
"lodash-es": "^4.17.21",
|
|
56
54
|
"pica": "^9.0.1",
|
|
57
|
-
"signature_pad": "^4.
|
|
58
|
-
"sortablejs": "^1.
|
|
55
|
+
"signature_pad": "^4.1.5",
|
|
56
|
+
"sortablejs": "^1.15.0"
|
|
59
57
|
},
|
|
60
58
|
"browserslist": [
|
|
61
59
|
"defaults"
|
|
@@ -27,6 +27,11 @@ export default {
|
|
|
27
27
|
default: () => []
|
|
28
28
|
},
|
|
29
29
|
|
|
30
|
+
eventColor: {
|
|
31
|
+
type: [String, Function],
|
|
32
|
+
default: ''
|
|
33
|
+
},
|
|
34
|
+
|
|
30
35
|
mask: {
|
|
31
36
|
type: String,
|
|
32
37
|
default: MaskOptions.Dash,
|
|
@@ -79,7 +84,9 @@ export default {
|
|
|
79
84
|
|
|
80
85
|
data () {
|
|
81
86
|
return {
|
|
82
|
-
currentDate: {}
|
|
87
|
+
currentDate: {},
|
|
88
|
+
dateElement: null,
|
|
89
|
+
dateObserver: undefined
|
|
83
90
|
}
|
|
84
91
|
},
|
|
85
92
|
|
|
@@ -95,7 +102,6 @@ export default {
|
|
|
95
102
|
return {
|
|
96
103
|
class: this.classes,
|
|
97
104
|
color: 'primary',
|
|
98
|
-
events: this.normalizedEvents,
|
|
99
105
|
mask: this.mask,
|
|
100
106
|
minimal: true,
|
|
101
107
|
multiple: this.multiple,
|
|
@@ -103,7 +109,6 @@ export default {
|
|
|
103
109
|
ref: 'date',
|
|
104
110
|
style: this.styles,
|
|
105
111
|
textColor: 'white',
|
|
106
|
-
eventColor: this.getEventColor,
|
|
107
112
|
|
|
108
113
|
// events
|
|
109
114
|
onNavigation: this.onNavigation,
|
|
@@ -116,14 +121,18 @@ export default {
|
|
|
116
121
|
return ['qas-date', 'shadow-2', { 'qas-date--inative': this.useInactiveDates }]
|
|
117
122
|
},
|
|
118
123
|
|
|
119
|
-
hasEvents () {
|
|
120
|
-
return !!Object.keys(this.events)?.length
|
|
121
|
-
},
|
|
122
|
-
|
|
123
124
|
hasModelValue () {
|
|
124
125
|
return this.multiple ? !!this.modelValue.length : !!this.modelValue
|
|
125
126
|
},
|
|
126
127
|
|
|
128
|
+
isEventsCallback () {
|
|
129
|
+
return typeof this.events === 'function'
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
isEventColorCallback () {
|
|
133
|
+
return typeof this.eventColor === 'function'
|
|
134
|
+
},
|
|
135
|
+
|
|
127
136
|
model: {
|
|
128
137
|
get () {
|
|
129
138
|
return this.modelValue
|
|
@@ -140,10 +149,6 @@ export default {
|
|
|
140
149
|
}
|
|
141
150
|
},
|
|
142
151
|
|
|
143
|
-
normalizedEvents () {
|
|
144
|
-
return this.useUnmaskEvents ? this.getUnmaskedList(this.events) : this.events
|
|
145
|
-
},
|
|
146
|
-
|
|
147
152
|
normalizedOptions () {
|
|
148
153
|
return this.useUnmaskOptions ? this.getUnmaskedList(this.options) : this.options
|
|
149
154
|
}
|
|
@@ -151,20 +156,70 @@ export default {
|
|
|
151
156
|
|
|
152
157
|
watch: {
|
|
153
158
|
events () {
|
|
154
|
-
|
|
159
|
+
this.setEvents(this.currentDate)
|
|
155
160
|
}
|
|
156
161
|
},
|
|
157
162
|
|
|
158
163
|
mounted () {
|
|
164
|
+
this.dateElement = this.$refs.date.$el
|
|
165
|
+
|
|
166
|
+
// muda estilo da navegação
|
|
159
167
|
this.setNewNavigatorDisplay()
|
|
160
168
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
169
|
+
// observa as mudanças no DOM do QDate > .q-date__content
|
|
170
|
+
this.setObserveDate()
|
|
171
|
+
|
|
172
|
+
// seta data atual de acordo com a view do mês atual
|
|
173
|
+
this.setCurrentDate()
|
|
174
|
+
|
|
175
|
+
// seta os eventos, ativos e inativos
|
|
176
|
+
this.setEvents(this.currentDate)
|
|
177
|
+
},
|
|
178
|
+
|
|
179
|
+
unmounted () {
|
|
180
|
+
this.dateObserver.disconnect()
|
|
165
181
|
},
|
|
166
182
|
|
|
167
183
|
methods: {
|
|
184
|
+
createActiveEventElement (dayElement, eventElement) {
|
|
185
|
+
const buttonElement = dayElement.querySelector('.q-btn__content')
|
|
186
|
+
|
|
187
|
+
buttonElement?.appendChild?.(eventElement)
|
|
188
|
+
},
|
|
189
|
+
|
|
190
|
+
createCounterInactiveEventElement (dayElement, eventElement) {
|
|
191
|
+
const spanElement = document.createElement('span')
|
|
192
|
+
const [child] = dayElement.children
|
|
193
|
+
|
|
194
|
+
spanElement.setAttribute('data-event', true)
|
|
195
|
+
dayElement.setAttribute('data-has-inactive-event', true)
|
|
196
|
+
|
|
197
|
+
spanElement.classList.add('flex', 'items-center', 'justify-center', 'text-center')
|
|
198
|
+
|
|
199
|
+
child.setAttribute('data-day-content', child.textContent)
|
|
200
|
+
|
|
201
|
+
spanElement.appendChild(child)
|
|
202
|
+
spanElement.appendChild(eventElement)
|
|
203
|
+
dayElement.appendChild(spanElement)
|
|
204
|
+
},
|
|
205
|
+
|
|
206
|
+
createPointerEventElement (isInactive, currentColor, eventElement) {
|
|
207
|
+
const eventPointerElement = document.createElement('div')
|
|
208
|
+
|
|
209
|
+
eventPointerElement.classList.add(
|
|
210
|
+
'qas-date__event-pointer',
|
|
211
|
+
`bg-${isInactive ? 'grey-4' : currentColor || 'primary'}`
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
eventElement.appendChild(eventPointerElement)
|
|
215
|
+
},
|
|
216
|
+
|
|
217
|
+
getCurrentColor (date, color) {
|
|
218
|
+
return (
|
|
219
|
+
(this.isEventColorCallback ? this.eventColor(date) : this.eventColor) || color
|
|
220
|
+
)
|
|
221
|
+
},
|
|
222
|
+
|
|
168
223
|
getCurrentDate () {
|
|
169
224
|
const modelDate = this.multiple ? this.modelValue[0] : this.modelValue
|
|
170
225
|
const extractedDate = this.hasModelValue ? date.extractDate(modelDate, this.mask) : new Date()
|
|
@@ -172,6 +227,10 @@ export default {
|
|
|
172
227
|
return this.getDate(extractedDate)
|
|
173
228
|
},
|
|
174
229
|
|
|
230
|
+
getCurrentEvent (date) {
|
|
231
|
+
return this.events.find(event => event.date === date)
|
|
232
|
+
},
|
|
233
|
+
|
|
175
234
|
getDate (date) {
|
|
176
235
|
return {
|
|
177
236
|
year: date.getFullYear(),
|
|
@@ -193,6 +252,18 @@ export default {
|
|
|
193
252
|
return extractedModel.includes(currentDate) ? 'white' : 'primary'
|
|
194
253
|
},
|
|
195
254
|
|
|
255
|
+
getEventClasses (currentColor, hasCounter, isInactive) {
|
|
256
|
+
return [
|
|
257
|
+
'qas-date__event',
|
|
258
|
+
|
|
259
|
+
isInactive ? 'qas-date__event--inactive' : 'qas-date__event--active',
|
|
260
|
+
|
|
261
|
+
`text-${currentColor || (isInactive ? 'grey-4' : 'primary')}`,
|
|
262
|
+
|
|
263
|
+
hasCounter ? 'qas-date__event--counter' : 'qas-date__event--pointer'
|
|
264
|
+
]
|
|
265
|
+
},
|
|
266
|
+
|
|
196
267
|
getISODate (value) {
|
|
197
268
|
if (!value || (this.multiple && !value.length)) return value
|
|
198
269
|
|
|
@@ -206,53 +277,145 @@ export default {
|
|
|
206
277
|
|
|
207
278
|
return invalidTypes.includes(typeof list)
|
|
208
279
|
? list
|
|
209
|
-
: list.map(
|
|
280
|
+
: list.map(item => asteroidDate(item, 'yyyy/MM/dd'))
|
|
281
|
+
},
|
|
282
|
+
|
|
283
|
+
getStatusDay ({ currentDay, index }) {
|
|
284
|
+
const status = {
|
|
285
|
+
isPrevious: false,
|
|
286
|
+
isNext: false,
|
|
287
|
+
isActiveMonthDay: false
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
if (currentDay > index) {
|
|
291
|
+
status.isPrevious = true
|
|
292
|
+
|
|
293
|
+
return status
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
if (index - 7 > currentDay) {
|
|
297
|
+
status.isNext = true
|
|
298
|
+
|
|
299
|
+
return status
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
status.isActiveMonthDay = true
|
|
303
|
+
|
|
304
|
+
return status
|
|
210
305
|
},
|
|
211
306
|
|
|
212
|
-
|
|
213
|
-
if (
|
|
307
|
+
getNormalizedYear ({ isNext, isPrevious, month, year }) {
|
|
308
|
+
if (isPrevious && month === 1) return year - 1
|
|
214
309
|
|
|
215
|
-
|
|
310
|
+
if (isNext && month === 12) return year + 1
|
|
216
311
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
312
|
+
return year
|
|
313
|
+
},
|
|
314
|
+
|
|
315
|
+
getNormalizedMonth ({ month, isPrevious, isNext }) {
|
|
316
|
+
if (isPrevious) return month === 1 ? (month = 12) : month - 1
|
|
220
317
|
|
|
221
|
-
|
|
318
|
+
if (isNext) return month === 12 ? (month = 1) : month + 1
|
|
319
|
+
|
|
320
|
+
return month
|
|
321
|
+
},
|
|
222
322
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
323
|
+
resetInactiveEvents () {
|
|
324
|
+
const inactiveElementsToRemove = this.dateElement.querySelectorAll('[data-has-inactive-event]')
|
|
325
|
+
|
|
326
|
+
inactiveElementsToRemove.forEach(inactiveElement => {
|
|
327
|
+
const [element] = inactiveElement.children
|
|
328
|
+
|
|
329
|
+
const hasDayContent = element.querySelector('[data-day-content]')
|
|
330
|
+
|
|
331
|
+
if (hasDayContent) inactiveElement.append(hasDayContent)
|
|
332
|
+
})
|
|
333
|
+
},
|
|
334
|
+
|
|
335
|
+
resetEvents () {
|
|
336
|
+
if (this.useInactiveDates) this.resetInactiveEvents()
|
|
337
|
+
|
|
338
|
+
this.resetActiveEvents()
|
|
339
|
+
},
|
|
340
|
+
|
|
341
|
+
resetActiveEvents () {
|
|
342
|
+
const elementsToRemove = this.dateElement.querySelectorAll('[data-event]')
|
|
343
|
+
|
|
344
|
+
elementsToRemove.forEach(nodeElement => nodeElement.remove())
|
|
345
|
+
},
|
|
346
|
+
|
|
347
|
+
setCurrentDate (date) {
|
|
348
|
+
this.currentDate = date || this.getCurrentDate()
|
|
349
|
+
},
|
|
350
|
+
|
|
351
|
+
setEventClasses (currentColor, eventElement, hasCounter, isInactive) {
|
|
352
|
+
const classes = this.getEventClasses(currentColor, hasCounter, isInactive)
|
|
353
|
+
|
|
354
|
+
eventElement.classList.add(...classes)
|
|
355
|
+
},
|
|
356
|
+
|
|
357
|
+
setEvents ({ year, month }) {
|
|
358
|
+
if (!this.events.length || !year || !month) return
|
|
359
|
+
|
|
360
|
+
this.resetEvents()
|
|
361
|
+
|
|
362
|
+
const daysElement = this.dateElement.querySelectorAll('.q-date__calendar-days .q-date__calendar-item')
|
|
363
|
+
const daysElementList = Array.from(daysElement)
|
|
364
|
+
|
|
365
|
+
daysElementList.forEach((dayElement, index) => {
|
|
366
|
+
const [child] = dayElement.children
|
|
367
|
+
|
|
368
|
+
const day = child.textContent
|
|
369
|
+
|
|
370
|
+
const { isActiveMonthDay, isNext, isPrevious } = this.getStatusDay({ currentDay: day, index: index + 1 })
|
|
371
|
+
|
|
372
|
+
const normalizedYear = this.getNormalizedYear({ isNext, month, isPrevious, year })
|
|
373
|
+
const normalizedMonth = this.getNormalizedMonth({ isNext, isPrevious, month })
|
|
374
|
+
const newDate = date.buildDate({ year: normalizedYear, month: normalizedMonth, day })
|
|
375
|
+
const normalizedDate = asteroidDate(newDate, 'yyyy-MM-dd')
|
|
376
|
+
|
|
377
|
+
const currentEvent = this.isEventsCallback ? this.events(normalizedDate) : this.getCurrentEvent(normalizedDate)
|
|
378
|
+
|
|
379
|
+
const hasDisabledClass = dayElement.classList.contains('q-date__calendar-item--out')
|
|
380
|
+
const isInactive = !isActiveMonthDay || hasDisabledClass
|
|
227
381
|
|
|
228
382
|
/*
|
|
229
|
-
* Se
|
|
230
|
-
*
|
|
231
|
-
*
|
|
383
|
+
* Se não tiver evento para o dia atual no loop ou
|
|
384
|
+
* a opção de eventos inativos estiver desabilitada e o dia atual do loop
|
|
385
|
+
* for referente ao mês anterior ou ao mês posterior, então retorna
|
|
232
386
|
*/
|
|
233
|
-
if (
|
|
234
|
-
monthIncrement += 2
|
|
235
|
-
}
|
|
387
|
+
if (!currentEvent || (!this.useInactiveDates && !isActiveMonthDay)) return
|
|
236
388
|
|
|
237
|
-
const
|
|
238
|
-
const newDate = date.buildDate({ year, month: normalizedMonth, day: inactiveDay })
|
|
239
|
-
const normalizedDate = asteroidDate(newDate, 'yyyy/MM/dd')
|
|
389
|
+
const hasCounter = currentEvent.counter
|
|
240
390
|
|
|
241
|
-
const
|
|
242
|
-
const hasArrayInactiveEvent = Array.isArray(this.events) && this.normalizedEvents.includes(normalizedDate)
|
|
391
|
+
const currentColor = this.getCurrentColor(normalizedDate, currentEvent?.color)
|
|
243
392
|
|
|
244
|
-
|
|
245
|
-
const divElement = document.createElement('div')
|
|
246
|
-
divElement.classList.add('q-date__event', 'qas-date__event-inactive')
|
|
393
|
+
const eventElement = document.createElement('div')
|
|
247
394
|
|
|
248
|
-
|
|
395
|
+
eventElement.setAttribute('data-event', true)
|
|
396
|
+
|
|
397
|
+
dayElement.classList.add('qas-date__calendar-item-event')
|
|
398
|
+
|
|
399
|
+
this.setEventClasses(currentColor, eventElement, hasCounter, isInactive)
|
|
400
|
+
|
|
401
|
+
if (hasCounter) {
|
|
402
|
+
this.setTextCountEvent(eventElement, currentEvent)
|
|
403
|
+
} else {
|
|
404
|
+
this.createPointerEventElement(isInactive, currentColor, eventElement)
|
|
249
405
|
}
|
|
406
|
+
|
|
407
|
+
if (isInactive) {
|
|
408
|
+
this.createCounterInactiveEventElement(dayElement, eventElement)
|
|
409
|
+
|
|
410
|
+
return
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
this.createActiveEventElement(dayElement, eventElement)
|
|
250
414
|
})
|
|
251
415
|
},
|
|
252
416
|
|
|
253
417
|
setNewNavigatorDisplay () {
|
|
254
|
-
const
|
|
255
|
-
const navigationElement = dateElement.querySelector('.q-date__navigation')
|
|
418
|
+
const navigationElement = this.dateElement.querySelector('.q-date__navigation')
|
|
256
419
|
const navigationChildren = navigationElement?.children || []
|
|
257
420
|
|
|
258
421
|
const nodesList = Array.from(navigationChildren)
|
|
@@ -275,27 +438,40 @@ export default {
|
|
|
275
438
|
this.$nextTick(() => secondList.forEach(node => newSecondElement.appendChild(node)))
|
|
276
439
|
},
|
|
277
440
|
|
|
278
|
-
|
|
279
|
-
this
|
|
441
|
+
setObserveDate () {
|
|
442
|
+
const element = this.dateElement.querySelector('.q-date__content')
|
|
443
|
+
const config = { childList: true, subtree: true }
|
|
280
444
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
* do componente QDate para assegurar que esta logica não quebre.
|
|
285
|
-
*/
|
|
286
|
-
if (this.useInactiveDates) setTimeout(() => { this.setInactiveEvents(date) }, 350)
|
|
445
|
+
const callback = mutationList => {
|
|
446
|
+
mutationList.forEach(({ removedNodes, target }) => {
|
|
447
|
+
const [removedNode] = removedNodes
|
|
287
448
|
|
|
288
|
-
|
|
289
|
-
},
|
|
449
|
+
if (!removedNode) return
|
|
290
450
|
|
|
291
|
-
|
|
292
|
-
|
|
451
|
+
const hasCalendarDaysContainer = target.classList.contains('q-date__calendar-days-container')
|
|
452
|
+
const hasContent = target.classList.contains('q-date__content')
|
|
453
|
+
const hasMonths = removedNode.classList.contains('q-date__months')
|
|
293
454
|
|
|
294
|
-
|
|
295
|
-
|
|
455
|
+
if (hasCalendarDaysContainer || (hasContent && hasMonths)) {
|
|
456
|
+
this.setEvents(this.currentDate)
|
|
457
|
+
}
|
|
458
|
+
})
|
|
296
459
|
}
|
|
297
460
|
|
|
298
|
-
|
|
461
|
+
this.dateObserver = new MutationObserver(callback)
|
|
462
|
+
this.dateObserver.observe(element, config)
|
|
463
|
+
},
|
|
464
|
+
|
|
465
|
+
setTextCountEvent (eventElement, currentEvent) {
|
|
466
|
+
eventElement.innerText = `(${currentEvent.counter})`
|
|
467
|
+
},
|
|
468
|
+
|
|
469
|
+
async onNavigation (date) {
|
|
470
|
+
this.$emit('navigation', date)
|
|
471
|
+
|
|
472
|
+
this.setCurrentDate(date)
|
|
473
|
+
|
|
474
|
+
this.$nextTick(() => this.setNewNavigatorDisplay())
|
|
299
475
|
}
|
|
300
476
|
}
|
|
301
477
|
}
|
|
@@ -307,18 +483,67 @@ export default {
|
|
|
307
483
|
min-width: 100%;
|
|
308
484
|
width: 100%;
|
|
309
485
|
|
|
310
|
-
&__event
|
|
311
|
-
|
|
312
|
-
|
|
486
|
+
&__event {
|
|
487
|
+
@include set-typography($caption);
|
|
488
|
+
|
|
489
|
+
bottom: -6px;
|
|
490
|
+
color: $primary;
|
|
491
|
+
font-size: 10px !important;
|
|
492
|
+
height: 20px;
|
|
493
|
+
left: 50%;
|
|
494
|
+
position: absolute;
|
|
495
|
+
transform: translateX(-50%);
|
|
496
|
+
width: 100%;
|
|
497
|
+
|
|
498
|
+
&--pointer {
|
|
499
|
+
bottom: -6px;
|
|
500
|
+
display: flex;
|
|
501
|
+
justify-content: center;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
&__event-pointer {
|
|
506
|
+
border-radius: 100%;
|
|
507
|
+
display: flex;
|
|
508
|
+
height: 6px;
|
|
509
|
+
justify-content: center;
|
|
510
|
+
margin-top: var(--qas-spacing-xs);
|
|
511
|
+
width: 6px;
|
|
313
512
|
}
|
|
314
513
|
|
|
315
514
|
&--inative {
|
|
316
515
|
.q-date {
|
|
516
|
+
&__calendar-item--out,
|
|
317
517
|
&__calendar-item--fill {
|
|
318
518
|
@include set-typography($subtitle2);
|
|
319
519
|
|
|
320
520
|
color: $grey-4;
|
|
321
521
|
visibility: unset;
|
|
522
|
+
|
|
523
|
+
span {
|
|
524
|
+
height: 36px;
|
|
525
|
+
padding: var(--qas-spacing-xs);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
.qas-date__event--inactive.qas-date__event--counter {
|
|
531
|
+
color: $grey-4 !important;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
&__calendar-item-event {
|
|
536
|
+
.q-btn {
|
|
537
|
+
&.bg-primary span {
|
|
538
|
+
padding-bottom: 4px;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
&.bg-primary .qas-date__event {
|
|
542
|
+
bottom: -2px;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
&.bg-primary .qas-date__event--pointer {
|
|
546
|
+
bottom: -2px;
|
|
322
547
|
}
|
|
323
548
|
}
|
|
324
549
|
}
|
|
@@ -358,12 +583,6 @@ export default {
|
|
|
358
583
|
opacity: 1;
|
|
359
584
|
}
|
|
360
585
|
|
|
361
|
-
&__event {
|
|
362
|
-
bottom: -1;
|
|
363
|
-
height: 6px;
|
|
364
|
-
width: 6px;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
586
|
&__months,
|
|
368
587
|
&__years {
|
|
369
588
|
.q-btn {
|
|
@@ -387,8 +606,9 @@ export default {
|
|
|
387
606
|
|
|
388
607
|
.q-btn {
|
|
389
608
|
border: 0;
|
|
609
|
+
border-radius: $generic-border-radius;
|
|
390
610
|
box-shadow: none;
|
|
391
|
-
height:
|
|
611
|
+
height: 36px !important;
|
|
392
612
|
min-height: 30px;
|
|
393
613
|
min-width: 30px;
|
|
394
614
|
transition: color var(--qas-generic-transition);
|
|
@@ -399,6 +619,14 @@ export default {
|
|
|
399
619
|
display: none !important;
|
|
400
620
|
}
|
|
401
621
|
|
|
622
|
+
&.bg-primary .qas-date__event--active {
|
|
623
|
+
color: white !important;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
&.bg-primary .qas-date__event--active .qas-date__event-pointer {
|
|
627
|
+
background-color: white !important;
|
|
628
|
+
}
|
|
629
|
+
|
|
402
630
|
&:hover {
|
|
403
631
|
color: var(--q-primary-contrast);
|
|
404
632
|
}
|
|
@@ -5,10 +5,15 @@ meta:
|
|
|
5
5
|
|
|
6
6
|
props:
|
|
7
7
|
events:
|
|
8
|
-
desc: Marcador de eventos do calendário
|
|
8
|
+
desc: Marcador de eventos do calendário.
|
|
9
9
|
default: []
|
|
10
10
|
type: [Array, Function]
|
|
11
11
|
|
|
12
|
+
event-color:
|
|
13
|
+
desc: Define a cor dos eventos.
|
|
14
|
+
default: ''
|
|
15
|
+
type: [String, Function]
|
|
16
|
+
|
|
12
17
|
mask:
|
|
13
18
|
desc: Máscara do model (repassada para o quasar).
|
|
14
19
|
default: YYYY-MM-DD
|
|
@@ -233,7 +233,7 @@ export default {
|
|
|
233
233
|
if (this.useDateOnly) return this.validateDateOnly(value)
|
|
234
234
|
if (this.useTimeOnly) return this.validateTimeOnly(value)
|
|
235
235
|
|
|
236
|
-
const [date, time] = value?.split(' ')
|
|
236
|
+
const [date, time] = value?.split(' ') || []
|
|
237
237
|
|
|
238
238
|
return this.validateDateOnly(date) || this.validateTimeOnly(time)
|
|
239
239
|
},
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<div v-if="showSearch" class="col-12 col-md-6">
|
|
5
5
|
<slot :filter="filter" name="search">
|
|
6
6
|
<q-form v-if="useSearch" @submit.prevent="filter()">
|
|
7
|
-
<qas-search-input v-model="search" :placeholder="searchPlaceholder" :use-search-on-type="useSearchOnType" @filter="filter()" @update:model-value="onSearch">
|
|
7
|
+
<qas-search-input v-model="search" :placeholder="searchPlaceholder" :use-search-on-type="useSearchOnType" @clear="clearSearch" @filter="filter()" @update:model-value="onSearch">
|
|
8
8
|
<template v-if="showFilterButton" #after-clear>
|
|
9
9
|
<slot :context="mx_context" :filter="filter" :filters="activeFilters" name="filter-button" :remove-filter="removeFilter">
|
|
10
10
|
<pv-filters-button v-if="useFilterButton" ref="filtersButton" v-model="filters" v-bind="filterButtonProps" />
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="mx_classes">
|
|
3
|
-
<div v-for="(field, key) in
|
|
4
|
-
<slot :field="
|
|
5
|
-
<slot :field="
|
|
6
|
-
<header :class="headerClass" :data-cy="`grid-generator-${field.name}-field`">
|
|
3
|
+
<div v-for="(field, key) in fieldsByResult" :key="key" :class="mx_getFieldClass(key, true)">
|
|
4
|
+
<slot :field="field" :name="`field-${field.name}`">
|
|
5
|
+
<slot :field="field" name="header">
|
|
6
|
+
<header :class="headerClass" :data-cy="`grid-generator-${field.name}-field`">
|
|
7
|
+
{{ field.label }}
|
|
8
|
+
</header>
|
|
7
9
|
</slot>
|
|
8
10
|
|
|
9
|
-
<slot :field="
|
|
10
|
-
<div :class="contentClass" :data-cy="`grid-generator-${field.name}-result`">
|
|
11
|
+
<slot :field="field" name="content">
|
|
12
|
+
<div :class="contentClass" :data-cy="`grid-generator-${field.name}-result`">
|
|
13
|
+
{{ field.formattedResult }}
|
|
14
|
+
</div>
|
|
11
15
|
</slot>
|
|
12
16
|
</slot>
|
|
13
17
|
</div>
|
|
@@ -17,7 +21,6 @@
|
|
|
17
21
|
<script>
|
|
18
22
|
import { generatorMixin } from '../../mixins'
|
|
19
23
|
import { humanize } from '../../helpers/filters'
|
|
20
|
-
import { extend } from 'quasar'
|
|
21
24
|
import { isObject } from 'lodash-es'
|
|
22
25
|
|
|
23
26
|
export default {
|
|
@@ -54,15 +57,13 @@ export default {
|
|
|
54
57
|
|
|
55
58
|
data () {
|
|
56
59
|
return {
|
|
57
|
-
|
|
60
|
+
fieldsByResult: {}
|
|
58
61
|
}
|
|
59
62
|
},
|
|
60
63
|
|
|
61
64
|
computed: {
|
|
62
65
|
formattedFields () {
|
|
63
|
-
if (this.useEmptyResult)
|
|
64
|
-
return this.fields
|
|
65
|
-
}
|
|
66
|
+
if (this.useEmptyResult) return this.fields
|
|
66
67
|
|
|
67
68
|
const fields = {}
|
|
68
69
|
|
|
@@ -78,37 +79,41 @@ export default {
|
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
|
|
81
|
-
this.$qas.logger.group('QasGridGenerator - formattedFields', [fields])
|
|
82
|
-
|
|
83
82
|
return fields
|
|
84
|
-
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
watch: {
|
|
87
|
+
formattedFields: {
|
|
88
|
+
handler () {
|
|
89
|
+
this.setFieldsByResult()
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
immediate: true
|
|
88
93
|
}
|
|
89
94
|
},
|
|
90
95
|
|
|
91
96
|
methods: {
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
const
|
|
97
|
+
getFieldsByResult () {
|
|
98
|
+
const result = { ...this.result }
|
|
99
|
+
const fieldsByResult = {}
|
|
95
100
|
|
|
96
101
|
for (const key in result) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
formattedResult: formattedResult[key]
|
|
105
|
-
}
|
|
102
|
+
const field = this.formattedFields[key] || {}
|
|
103
|
+
|
|
104
|
+
if (!field.type) continue
|
|
105
|
+
|
|
106
|
+
fieldsByResult[key] = {
|
|
107
|
+
...field,
|
|
108
|
+
formattedResult: humanize(field, result[key]) || this.emptyResultText
|
|
106
109
|
}
|
|
107
110
|
}
|
|
108
111
|
|
|
109
|
-
|
|
112
|
+
return fieldsByResult
|
|
113
|
+
},
|
|
110
114
|
|
|
111
|
-
|
|
115
|
+
setFieldsByResult () {
|
|
116
|
+
this.fieldsByResult = this.getFieldsByResult()
|
|
112
117
|
}
|
|
113
118
|
}
|
|
114
119
|
}
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
<script>
|
|
28
28
|
import { QInfiniteScroll } from 'quasar'
|
|
29
29
|
import Fuse from 'fuse.js'
|
|
30
|
-
|
|
30
|
+
import fuseConfig from '../../shared/fuse-config'
|
|
31
31
|
import QasBox from '../box/QasBox.vue'
|
|
32
32
|
import { searchFilterMixin } from '../../mixins'
|
|
33
33
|
|
|
@@ -139,8 +139,7 @@ export default {
|
|
|
139
139
|
|
|
140
140
|
defaultFuseOptions () {
|
|
141
141
|
return {
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
...fuseConfig,
|
|
144
143
|
...this.fuseOptions
|
|
145
144
|
}
|
|
146
145
|
},
|
|
@@ -29,8 +29,10 @@
|
|
|
29
29
|
</template>
|
|
30
30
|
|
|
31
31
|
<script>
|
|
32
|
+
import { uid } from 'quasar'
|
|
32
33
|
import { searchFilterMixin } from '../../mixins'
|
|
33
34
|
import Fuse from 'fuse.js'
|
|
35
|
+
import fuseConfig from '../../shared/fuse-config'
|
|
34
36
|
|
|
35
37
|
export default {
|
|
36
38
|
name: 'QasSelect',
|
|
@@ -69,21 +71,25 @@ export default {
|
|
|
69
71
|
}
|
|
70
72
|
},
|
|
71
73
|
|
|
72
|
-
emits: ['update:modelValue'],
|
|
74
|
+
emits: ['popup-hide', 'popup-show', 'update:modelValue', 'virtual-scroll'],
|
|
73
75
|
|
|
74
76
|
data () {
|
|
75
77
|
return {
|
|
76
|
-
fuse: null
|
|
78
|
+
fuse: null,
|
|
79
|
+
isPopupContentOpen: false
|
|
77
80
|
}
|
|
78
81
|
},
|
|
79
82
|
|
|
80
83
|
computed: {
|
|
81
84
|
attributes () {
|
|
82
85
|
return {
|
|
86
|
+
class: 'qas-select',
|
|
83
87
|
clearable: this.isSearchable,
|
|
84
88
|
emitValue: true,
|
|
85
89
|
mapOptions: true,
|
|
86
90
|
outlined: true,
|
|
91
|
+
popupContentClass: this.popupContentClass,
|
|
92
|
+
|
|
87
93
|
...this.$attrs,
|
|
88
94
|
|
|
89
95
|
error: this.hasError,
|
|
@@ -91,14 +97,20 @@ export default {
|
|
|
91
97
|
loading: this.hasLoading,
|
|
92
98
|
options: this.mx_filteredOptions,
|
|
93
99
|
useInput: this.isSearchable,
|
|
100
|
+
|
|
94
101
|
...(this.isSearchable && { onFilter: this.onFilter }),
|
|
95
|
-
|
|
102
|
+
|
|
103
|
+
...(this.useLazyLoading && {
|
|
104
|
+
onPopupHide: this.onPopupHide,
|
|
105
|
+
onPopupShow: this.onPopupShow,
|
|
106
|
+
onVirtualScroll: this.mx_onVirtualScroll
|
|
107
|
+
})
|
|
96
108
|
}
|
|
97
109
|
},
|
|
98
110
|
|
|
99
111
|
defaultFuseOptions () {
|
|
100
112
|
return {
|
|
101
|
-
|
|
113
|
+
...fuseConfig,
|
|
102
114
|
keys: ['label', 'value'],
|
|
103
115
|
|
|
104
116
|
...this.fuseOptions
|
|
@@ -139,6 +151,10 @@ export default {
|
|
|
139
151
|
set (value) {
|
|
140
152
|
this.$emit('update:modelValue', value)
|
|
141
153
|
}
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
popupContentClass () {
|
|
157
|
+
return `qas-select__popup-content-${uid()}`
|
|
142
158
|
}
|
|
143
159
|
},
|
|
144
160
|
|
|
@@ -162,6 +178,7 @@ export default {
|
|
|
162
178
|
|
|
163
179
|
created () {
|
|
164
180
|
this.setSearchMethod()
|
|
181
|
+
this.setIsFetchingWatcher()
|
|
165
182
|
},
|
|
166
183
|
|
|
167
184
|
methods: {
|
|
@@ -192,6 +209,30 @@ export default {
|
|
|
192
209
|
this.mx_filteredOptions = this.mx_getNormalizedFuseResults(results)
|
|
193
210
|
},
|
|
194
211
|
|
|
212
|
+
onPopupHide () {
|
|
213
|
+
this.isPopupContentOpen = false
|
|
214
|
+
this.$emit('popup-hide')
|
|
215
|
+
},
|
|
216
|
+
|
|
217
|
+
onPopupShow () {
|
|
218
|
+
this.isPopupContentOpen = true
|
|
219
|
+
this.$emit('popup-show')
|
|
220
|
+
|
|
221
|
+
if (this.mx_isFetching) {
|
|
222
|
+
this.togglePopupContentClass(true)
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
|
|
226
|
+
setIsFetchingWatcher () {
|
|
227
|
+
if (this.useLazyLoading) {
|
|
228
|
+
this.$watch('mx_isFetching', value => {
|
|
229
|
+
if (!this.isPopupContentOpen) return
|
|
230
|
+
|
|
231
|
+
this.togglePopupContentClass(value)
|
|
232
|
+
})
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
|
|
195
236
|
setLazyLoading () {
|
|
196
237
|
this.mx_setCachedOptions('options')
|
|
197
238
|
|
|
@@ -202,7 +243,33 @@ export default {
|
|
|
202
243
|
if (this.useLazyLoading) return this.setLazyLoading()
|
|
203
244
|
|
|
204
245
|
if (this.hasFuse) this.setFuse()
|
|
246
|
+
},
|
|
247
|
+
|
|
248
|
+
async togglePopupContentClass (force) {
|
|
249
|
+
await this.$nextTick()
|
|
250
|
+
|
|
251
|
+
const popupContentElement = document.querySelector(`.${this.popupContentClass}`)
|
|
252
|
+
|
|
253
|
+
if (popupContentElement) {
|
|
254
|
+
popupContentElement.classList.toggle('qas-select__is-fetching', force)
|
|
255
|
+
}
|
|
205
256
|
}
|
|
206
257
|
}
|
|
207
258
|
}
|
|
208
259
|
</script>
|
|
260
|
+
|
|
261
|
+
<style lang="scss">
|
|
262
|
+
.qas-select {
|
|
263
|
+
&__is-fetching {
|
|
264
|
+
cursor: not-allowed !important;
|
|
265
|
+
|
|
266
|
+
.q-virtual-scroll__content {
|
|
267
|
+
pointer-events: none;
|
|
268
|
+
|
|
269
|
+
.q-item {
|
|
270
|
+
color: $grey-6;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
</style>
|
|
@@ -27,7 +27,7 @@ props:
|
|
|
27
27
|
default:
|
|
28
28
|
ignoreLocation: true
|
|
29
29
|
keys: [label, value]
|
|
30
|
-
threshold: 0.
|
|
30
|
+
threshold: 0.4
|
|
31
31
|
|
|
32
32
|
label-key:
|
|
33
33
|
desc: O componente internamente espera receber na propriedade "options" um array de objeto contendo "label" e "value", caso o seu objeto não tenha "label" mas um "name" por exemplo, você pode definir esta prop "label-key" como "name".
|
|
@@ -77,21 +77,19 @@ export default {
|
|
|
77
77
|
|
|
78
78
|
mx_hasFilteredOptions () {
|
|
79
79
|
return !!this.mx_filteredOptions.length
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
mx_isMultiple () {
|
|
83
|
-
return this.$attrs.multiple || this.$attrs.multiple === ''
|
|
84
80
|
}
|
|
85
81
|
},
|
|
86
82
|
|
|
87
83
|
watch: {
|
|
88
|
-
lazyLoadingProps: {
|
|
89
|
-
handler (
|
|
90
|
-
if (isEqual(
|
|
84
|
+
'lazyLoadingProps.params': {
|
|
85
|
+
handler (newParams, oldParams) {
|
|
86
|
+
if (isEqual(newParams, oldParams)) return
|
|
87
|
+
|
|
88
|
+
this.mx_cachedOptions = []
|
|
91
89
|
|
|
92
90
|
this.mx_filterOptionsByStore('')
|
|
93
91
|
|
|
94
|
-
this.$emit('update:modelValue',
|
|
92
|
+
this.$emit('update:modelValue', undefined)
|
|
95
93
|
}
|
|
96
94
|
}
|
|
97
95
|
},
|
|
@@ -126,7 +124,8 @@ export default {
|
|
|
126
124
|
}
|
|
127
125
|
},
|
|
128
126
|
|
|
129
|
-
async mx_onVirtualScroll (
|
|
127
|
+
async mx_onVirtualScroll (details) {
|
|
128
|
+
const { index, ref } = details
|
|
130
129
|
const lastIndex = this.mx_filteredOptions.length - 1
|
|
131
130
|
|
|
132
131
|
if (index === lastIndex && this.mx_canFetchOptions()) {
|
|
@@ -137,6 +136,8 @@ export default {
|
|
|
137
136
|
ref.refresh(lastIndex)
|
|
138
137
|
})
|
|
139
138
|
}
|
|
139
|
+
|
|
140
|
+
this.$emit('virtual-scroll', details)
|
|
140
141
|
},
|
|
141
142
|
|
|
142
143
|
async mx_loadMoreOptions () {
|