@bildvitta/quasar-ui-asteroid 3.11.0-alpha.2 → 3.11.0-beta.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.
- package/package.json +7 -8
- package/src/components/alert/QasAlert.test.js +43 -0
- package/src/components/alert/QasAlert.vue +1 -1
- package/src/components/breakline/QasBreakline.vue +25 -23
- package/src/components/date/QasDate.vue +298 -70
- package/src/components/date/QasDate.yml +6 -1
- package/src/components/filters/QasFilters.vue +26 -16
- package/src/components/filters/QasFilters.yml +7 -0
- package/src/components/form-generator/QasFormGenerator.vue +123 -115
- package/src/components/gallery/QasGallery.vue +0 -1
- package/src/components/grid-generator/QasGridGenerator.vue +85 -78
- package/src/components/nested-fields/QasNestedFields.vue +17 -6
- 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/components/status/QasStatus.test.js +11 -0
- package/src/components/status/QasStatus.vue +13 -16
- package/src/components/text-truncate/QasTextTruncate.vue +145 -101
- package/src/components/uploader/QasUploader.vue +9 -7
- package/src/composables/index.js +2 -0
- package/src/composables/private/use-generator.js +164 -0
- package/src/composables/use-form.js +32 -0
- package/src/composables/use-screen.js +42 -0
- package/src/enums/Spacing.js +57 -0
- package/src/mixins/search-filter.js +22 -10
- package/src/shared/fuse-config.js +4 -0
- package/src/vue-plugin/components/map-component.js +26 -0
- package/src/vue-plugin/third-party-component-handler.js +29 -0
- package/src/vue-plugin/third-party-components-initializer.js +29 -0
- package/src/vue-plugin.js +10 -8
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-
|
|
4
|
+
"version": "3.11.0-beta.0",
|
|
5
5
|
"author": "Bild & Vitta <systemteam@bild.com.br>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/asteroid.cjs.min.js",
|
|
@@ -30,13 +30,13 @@
|
|
|
30
30
|
"@rollup/plugin-json": "^6.0.0",
|
|
31
31
|
"@rollup/plugin-replace": "^5.0.2",
|
|
32
32
|
"@rollup/plugin-url": "^8.0.1",
|
|
33
|
-
"@vue/compiler-sfc": "^3.3.
|
|
33
|
+
"@vue/compiler-sfc": "^3.3.4",
|
|
34
34
|
"autoprefixer": "^10.4.14",
|
|
35
35
|
"core-js": "^3.30.2",
|
|
36
|
-
"postcss": "^8.4.
|
|
36
|
+
"postcss": "^8.4.24",
|
|
37
37
|
"quasar": "^2.12.0",
|
|
38
|
-
"rimraf": "^5.0.
|
|
39
|
-
"rollup": "^3.
|
|
38
|
+
"rimraf": "^5.0.1",
|
|
39
|
+
"rollup": "^3.23.1",
|
|
40
40
|
"rollup-plugin-local-resolve": "^1.0.7",
|
|
41
41
|
"rollup-plugin-scss": "^4.0.0",
|
|
42
42
|
"rollup-plugin-vue": "^6.0.0",
|
|
@@ -44,8 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@bildvitta/store-adapter": "^1.0.0",
|
|
47
|
-
"
|
|
48
|
-
"autonumeric": "^4.8.3",
|
|
47
|
+
"autonumeric": "^4.9.0",
|
|
49
48
|
"axios": "^1.4.0",
|
|
50
49
|
"date-fns": "^2.30.0",
|
|
51
50
|
"fuse.js": "^6.6.2",
|
|
@@ -62,4 +61,4 @@
|
|
|
62
61
|
"tags": "dist/vetur/asteroid-tags.json",
|
|
63
62
|
"attributes": "dist/vetur/asteroid-attributes.json"
|
|
64
63
|
}
|
|
65
|
-
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { mount } from '@vue/test-utils'
|
|
2
|
+
import { h } from 'vue'
|
|
3
|
+
|
|
4
|
+
import { describe, expect, test } from 'vitest'
|
|
5
|
+
import QasAlert from './QasAlert.vue'
|
|
6
|
+
import QasBtn from '../btn/QasBtn.vue'
|
|
7
|
+
import QasBreakline from '../breakline/QasBreakline.vue'
|
|
8
|
+
import { Quasar } from 'quasar'
|
|
9
|
+
|
|
10
|
+
// Descrevemos o grupo de testes para o componente QasAlert
|
|
11
|
+
describe('QasAlert', () => {
|
|
12
|
+
const wrapper = mount(QasAlert, {
|
|
13
|
+
slots: {
|
|
14
|
+
default: 'Default Text'
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
global: {
|
|
18
|
+
plugins: [Quasar],
|
|
19
|
+
|
|
20
|
+
slots: {
|
|
21
|
+
default: h('div', 'Test 111')
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
components: {
|
|
25
|
+
'qas-btn': QasBtn,
|
|
26
|
+
'qas-breakline': QasBreakline
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
test('renders correctly', () => {
|
|
32
|
+
expect(wrapper.exists()).toBe(true)
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
// Teste para verificar a propriedade "title"
|
|
36
|
+
test('renders title correctly', async () => {
|
|
37
|
+
await wrapper.setProps({ title: 'Test Title' })
|
|
38
|
+
|
|
39
|
+
const titleElement = wrapper.get('[data-test="alert-title"]')
|
|
40
|
+
|
|
41
|
+
expect(titleElement.text()).toBe('Test Title')
|
|
42
|
+
})
|
|
43
|
+
})
|
|
@@ -4,34 +4,36 @@
|
|
|
4
4
|
</component>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
|
-
<script>
|
|
7
|
+
<script setup>
|
|
8
|
+
import { computed } from 'vue'
|
|
8
9
|
import { getSlotChildrenText } from '../../helpers'
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
name: 'QasBreakline'
|
|
11
|
+
defineOptions({
|
|
12
|
+
name: 'QasBreakline'
|
|
13
|
+
})
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
tag: {
|
|
20
|
-
default: 'div',
|
|
21
|
-
type: String
|
|
22
|
-
},
|
|
15
|
+
const props = defineProps({
|
|
16
|
+
split: {
|
|
17
|
+
default: '\n',
|
|
18
|
+
type: String
|
|
19
|
+
},
|
|
23
20
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
21
|
+
tag: {
|
|
22
|
+
default: 'div',
|
|
23
|
+
type: String
|
|
28
24
|
},
|
|
29
25
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return text.split(this.split)
|
|
34
|
-
}
|
|
26
|
+
text: {
|
|
27
|
+
default: '',
|
|
28
|
+
type: String
|
|
35
29
|
}
|
|
36
|
-
}
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
const slots = defineSlots()
|
|
33
|
+
|
|
34
|
+
const lines = computed(() => {
|
|
35
|
+
const text = props.text || getSlotChildrenText(slots.default())
|
|
36
|
+
|
|
37
|
+
return text.split(props.split)
|
|
38
|
+
})
|
|
37
39
|
</script>
|
|
@@ -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
|
+
this.resetEvents()
|
|
359
|
+
|
|
360
|
+
if (!this.events.length || !year || !month) return
|
|
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
|