Skip to content

Commit 8226cc9

Browse files
fix(VCalendar): missing events under certain circumstances (#13763)
fixes #13720
1 parent 5fbea51 commit 8226cc9

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

packages/vuetify/src/components/VCalendar/mixins/calendar-with-events.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -172,23 +172,25 @@ export default CalendarBase.extend({
172172

173173
const parentBounds = parent.getBoundingClientRect()
174174
const last = events.length - 1
175-
let hide = false
175+
const eventsSorted = events.map(event => ({
176+
event,
177+
bottom: event.getBoundingClientRect().bottom,
178+
})).sort((a, b) => a.bottom - b.bottom)
176179
let hidden = 0
177180

178181
for (let i = 0; i <= last; i++) {
179-
if (!hide) {
180-
const eventBounds = events[i].getBoundingClientRect()
181-
hide = i === last
182-
? (eventBounds.bottom > parentBounds.bottom)
183-
: (eventBounds.bottom + eventHeight > parentBounds.bottom)
184-
}
182+
const bottom = eventsSorted[i].bottom
183+
const hide = i === last
184+
? (bottom > parentBounds.bottom)
185+
: (bottom + eventHeight > parentBounds.bottom)
186+
185187
if (hide) {
186-
events[i].style.display = 'none'
188+
eventsSorted[i].event.style.display = 'none'
187189
hidden++
188190
}
189191
}
190192

191-
if (hide) {
193+
if (hidden) {
192194
more.style.display = ''
193195
more.innerHTML = this.$vuetify.lang.t(this.eventMoreText, hidden)
194196
} else {

0 commit comments

Comments
 (0)