@bagelink/vue 1.4.171 → 1.4.176
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/dist/components/Dropdown.vue.d.ts.map +1 -1
- package/dist/components/calendar/views/WeekView.vue.d.ts +1 -0
- package/dist/components/calendar/views/WeekView.vue.d.ts.map +1 -1
- package/dist/index.cjs +20 -20
- package/dist/index.mjs +20 -20
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/Dropdown.vue +21 -19
- package/src/components/calendar/views/WeekView.vue +13 -2
package/package.json
CHANGED
|
@@ -109,16 +109,18 @@ function hide() {
|
|
|
109
109
|
ddownRef?.hide()
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
const { isMobile } = useDevice()
|
|
112
|
+
const { isMobile, innerWidth } = useDevice()
|
|
113
113
|
|
|
114
114
|
const shouldDisablePositioning = $computed(() => {
|
|
115
115
|
return disablePlacement && isMobile
|
|
116
116
|
})
|
|
117
117
|
|
|
118
|
-
// Convert hover triggers to click on mobile
|
|
118
|
+
// Convert hover triggers to click on small screens (tablets and mobile)
|
|
119
|
+
const isSmallScreen = $computed(() => innerWidth.value < 910)
|
|
120
|
+
|
|
119
121
|
const computedTriggers = $computed((): TriggerEvent[] => {
|
|
120
|
-
if (
|
|
121
|
-
// Replace hover with click on
|
|
122
|
+
if (isSmallScreen && triggers.includes('hover')) {
|
|
123
|
+
// Replace hover with click on small screens
|
|
122
124
|
return triggers.map(trigger => trigger === 'hover' ? 'click' : trigger) as TriggerEvent[]
|
|
123
125
|
}
|
|
124
126
|
return triggers
|
|
@@ -127,8 +129,8 @@ const computedTriggers = $computed((): TriggerEvent[] => {
|
|
|
127
129
|
// Intelligent trigger configuration
|
|
128
130
|
const computedShowTriggers = $computed((): TriggerEvent[] => {
|
|
129
131
|
if (showTriggers !== undefined) {
|
|
130
|
-
// Also convert hover to click in showTriggers on
|
|
131
|
-
if (
|
|
132
|
+
// Also convert hover to click in showTriggers on small screens
|
|
133
|
+
if (isSmallScreen && showTriggers.includes('hover')) {
|
|
132
134
|
return showTriggers.map(trigger => trigger === 'hover' ? 'click' : trigger) as TriggerEvent[]
|
|
133
135
|
}
|
|
134
136
|
return showTriggers
|
|
@@ -138,8 +140,8 @@ const computedShowTriggers = $computed((): TriggerEvent[] => {
|
|
|
138
140
|
|
|
139
141
|
const computedHideTriggers = $computed((): TriggerEvent[] => {
|
|
140
142
|
if (hideTriggers !== undefined) {
|
|
141
|
-
// Also convert hover to click in hideTriggers on
|
|
142
|
-
if (
|
|
143
|
+
// Also convert hover to click in hideTriggers on small screens
|
|
144
|
+
if (isSmallScreen && hideTriggers.includes('hover')) {
|
|
143
145
|
return hideTriggers.map(trigger => trigger === 'hover' ? 'click' : trigger) as TriggerEvent[]
|
|
144
146
|
}
|
|
145
147
|
return hideTriggers
|
|
@@ -149,8 +151,8 @@ const computedHideTriggers = $computed((): TriggerEvent[] => {
|
|
|
149
151
|
return ['click'] as TriggerEvent[]
|
|
150
152
|
}
|
|
151
153
|
// For hover dropdowns, add click to hide triggers for better UX
|
|
152
|
-
// But on
|
|
153
|
-
if (
|
|
154
|
+
// But on small screens, hover becomes click, so we handle it differently
|
|
155
|
+
if (triggers.includes('hover')) {
|
|
154
156
|
return [...computedTriggers, 'click'] as TriggerEvent[]
|
|
155
157
|
}
|
|
156
158
|
return computedTriggers
|
|
@@ -159,8 +161,8 @@ const computedHideTriggers = $computed((): TriggerEvent[] => {
|
|
|
159
161
|
const computedPopperTriggers = $computed((): TriggerEvent[] => {
|
|
160
162
|
if (popperTriggers.length > 0) return popperTriggers
|
|
161
163
|
// For hover dropdowns, enable hover on popper to keep it open
|
|
162
|
-
// But on
|
|
163
|
-
if (
|
|
164
|
+
// But on small screens, don't add hover triggers since we convert to click
|
|
165
|
+
if (triggers.includes('hover') && !isSmallScreen) {
|
|
164
166
|
return ['hover'] as TriggerEvent[]
|
|
165
167
|
}
|
|
166
168
|
return []
|
|
@@ -170,8 +172,8 @@ const computedPopperTriggers = $computed((): TriggerEvent[] => {
|
|
|
170
172
|
const computedPopperShowTriggers = $computed((): TriggerEvent[] | undefined => {
|
|
171
173
|
const hasExplicitShowTriggers = Array.isArray(popperShowTriggers) && popperShowTriggers.length > 0
|
|
172
174
|
if (hasExplicitShowTriggers) return popperShowTriggers
|
|
173
|
-
// Only add hover for popper on
|
|
174
|
-
if (
|
|
175
|
+
// Only add hover for popper on large screens
|
|
176
|
+
if (triggers.includes('hover') && !isSmallScreen) return ['hover'] as TriggerEvent[]
|
|
175
177
|
return undefined
|
|
176
178
|
})
|
|
177
179
|
|
|
@@ -179,8 +181,8 @@ const computedPopperHideTriggers = $computed((): TriggerEvent[] => {
|
|
|
179
181
|
const hasExplicitHideTriggers = Array.isArray(popperHideTriggers) && popperHideTriggers.length > 0
|
|
180
182
|
if (hasExplicitHideTriggers) return popperHideTriggers
|
|
181
183
|
// For hover dropdowns, make sure popper hides on mouseout
|
|
182
|
-
// But only on
|
|
183
|
-
if (
|
|
184
|
+
// But only on large screens where hover is meaningful
|
|
185
|
+
if (triggers.includes('hover') && !isSmallScreen) {
|
|
184
186
|
return ['hover'] as TriggerEvent[]
|
|
185
187
|
}
|
|
186
188
|
return []
|
|
@@ -190,11 +192,11 @@ const computedAutoHide = $computed(() => autoHide)
|
|
|
190
192
|
|
|
191
193
|
const computedDelay = $computed((): number | { show: number, hide: number } | undefined => {
|
|
192
194
|
if (delay !== undefined) return delay
|
|
193
|
-
// For hover dropdowns, add a hide delay (but only on
|
|
194
|
-
if (
|
|
195
|
+
// For hover dropdowns, add a hide delay (but only on large screens)
|
|
196
|
+
if (triggers.includes('hover') && !isSmallScreen) {
|
|
195
197
|
return { show: 0, hide: 10 } // 10ms delay before hiding
|
|
196
198
|
}
|
|
197
|
-
// For click dropdowns (including
|
|
199
|
+
// For click dropdowns (including small screens), no delay
|
|
198
200
|
return 0
|
|
199
201
|
})
|
|
200
202
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { SetupContext, ComponentPublicInstance } from 'vue'
|
|
3
3
|
import type { CalendarEvent, WeekStart } from '../CalendarTypes'
|
|
4
4
|
import { formatDate } from '@bagelink/vue'
|
|
5
|
-
import { ref, computed, onMounted, onUnmounted, useSlots } from 'vue'
|
|
5
|
+
import { ref, computed, onMounted, onUnmounted, useSlots, nextTick } from 'vue'
|
|
6
6
|
|
|
7
7
|
interface WeekViewEvent extends CalendarEvent {
|
|
8
8
|
top: number
|
|
@@ -61,6 +61,7 @@ const timeSlotsContainer = ref<HTMLElement>()
|
|
|
61
61
|
const calendarGrid = ref<HTMLElement>()
|
|
62
62
|
const dayColumns = ref<HTMLElement[]>([])
|
|
63
63
|
const dayColumnsContainer = ref<HTMLElement>()
|
|
64
|
+
const scrollableContainer = ref<HTMLElement>()
|
|
64
65
|
|
|
65
66
|
// Calculate week days based on start date and week start preference
|
|
66
67
|
const weekDays = computed(() => {
|
|
@@ -401,10 +402,19 @@ function setDayColumnRef(el: Element | ComponentPublicInstance | null | undefine
|
|
|
401
402
|
}
|
|
402
403
|
}
|
|
403
404
|
|
|
405
|
+
function scrollToTime(time: number) {
|
|
406
|
+
if (scrollableContainer.value) {
|
|
407
|
+
scrollableContainer.value.scrollTop = time * slotHeight
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
404
411
|
// Lifecycle hooks
|
|
405
412
|
onMounted(() => {
|
|
406
413
|
updateCurrentTimeIndicator()
|
|
407
414
|
currentTimeInterval.value = setInterval(updateCurrentTimeIndicator, 60000)
|
|
415
|
+
|
|
416
|
+
// Scroll to 6:00 AM on mount
|
|
417
|
+
nextTick(() => { scrollToTime(6) })
|
|
408
418
|
})
|
|
409
419
|
|
|
410
420
|
onUnmounted(() => {
|
|
@@ -433,7 +443,7 @@ onUnmounted(() => {
|
|
|
433
443
|
</span>
|
|
434
444
|
</div>
|
|
435
445
|
</div>
|
|
436
|
-
<div class="overflow h-100p pe-05">
|
|
446
|
+
<div ref="scrollableContainer" class="overflow h-100p pe-05">
|
|
437
447
|
<div ref="dayColumnsContainer" class="weekGrid border-end relative">
|
|
438
448
|
<div ref="timeSlotsContainer">
|
|
439
449
|
<div
|
|
@@ -576,6 +586,7 @@ onUnmounted(() => {
|
|
|
576
586
|
flex-direction: column;
|
|
577
587
|
justify-content: center; */
|
|
578
588
|
}
|
|
589
|
+
|
|
579
590
|
@media (max-width: 910px) {
|
|
580
591
|
.weekGrid {
|
|
581
592
|
display: grid;
|