@bagelink/vue 1.2.15 → 1.2.18
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/calendar/CalendarTypes.d.ts +13 -0
- package/dist/components/calendar/CalendarTypes.d.ts.map +1 -0
- package/dist/components/calendar/Index.vue.d.ts +39 -507
- package/dist/components/calendar/Index.vue.d.ts.map +1 -1
- package/dist/components/calendar/utils.d.ts +31 -0
- package/dist/components/calendar/utils.d.ts.map +1 -0
- package/dist/components/calendar/views/AgendaView.vue.d.ts +16 -0
- package/dist/components/calendar/views/AgendaView.vue.d.ts.map +1 -0
- package/dist/components/calendar/views/DayView.vue.d.ts +50 -0
- package/dist/components/calendar/views/DayView.vue.d.ts.map +1 -0
- package/dist/components/calendar/views/MonthView.vue.d.ts +20 -0
- package/dist/components/calendar/views/MonthView.vue.d.ts.map +1 -0
- package/dist/components/calendar/views/WeekView.vue.d.ts +33 -0
- package/dist/components/calendar/views/WeekView.vue.d.ts.map +1 -0
- package/dist/components/form/BglMultiStepForm.vue.d.ts +63 -0
- package/dist/components/form/BglMultiStepForm.vue.d.ts.map +1 -0
- package/dist/components/form/index.d.ts +1 -0
- package/dist/components/form/index.d.ts.map +1 -1
- package/dist/components/form/inputs/CodeEditor/Index.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/DateInput.vue.d.ts +3 -3
- package/dist/components/form/inputs/DateInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/DatePicker.vue.d.ts +3 -3
- package/dist/components/form/inputs/DatePicker.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
- package/dist/index.cjs +2166 -3870
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +2167 -3871
- package/dist/style.css +604 -628
- package/dist/utils/BagelFormUtils.d.ts +4 -2
- package/dist/utils/BagelFormUtils.d.ts.map +1 -1
- package/dist/utils/calendar/EDate.d.ts +2 -0
- package/dist/utils/calendar/EDate.d.ts.map +1 -0
- package/dist/utils/calendar/Helpers.d.ts +19 -0
- package/dist/utils/calendar/Helpers.d.ts.map +1 -0
- package/dist/utils/calendar/constants.d.ts +3 -0
- package/dist/utils/calendar/constants.d.ts.map +1 -0
- package/dist/utils/calendar/dateUtils.d.ts +30 -0
- package/dist/utils/calendar/dateUtils.d.ts.map +1 -0
- package/dist/utils/calendar/event.interface.d.ts +32 -0
- package/dist/utils/calendar/event.interface.d.ts.map +1 -0
- package/dist/utils/calendar/time.d.ts +117 -0
- package/dist/utils/calendar/time.d.ts.map +1 -0
- package/dist/utils/calendar/types.d.ts +27 -0
- package/dist/utils/calendar/types.d.ts.map +1 -0
- package/dist/utils/calendar/typings.d.ts +87 -0
- package/dist/utils/calendar/typings.d.ts.map +1 -0
- package/dist/utils/calendar/week.d.ts +117 -0
- package/dist/utils/calendar/week.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/components/calendar/CalendarTypes.ts +13 -0
- package/src/components/calendar/Index.vue +124 -389
- package/src/components/calendar/utils.ts +70 -0
- package/src/components/calendar/views/AgendaView.vue +263 -0
- package/src/components/calendar/views/DayView.vue +417 -0
- package/src/components/calendar/views/MonthView.vue +313 -0
- package/src/components/calendar/views/WeekView.vue +432 -0
- package/src/components/form/BglMultiStepForm.vue +323 -70
- package/src/components/form/index.ts +1 -0
- package/src/components/form/inputs/CodeEditor/Index.vue +11 -0
- package/src/components/form/inputs/DateInput.vue +3 -3
- package/src/components/form/inputs/DatePicker.vue +3 -3
- package/src/components/form/inputs/SelectInput.vue +2 -0
- package/src/components/form/inputs/Upload/upload.types.d.ts +0 -1
- package/src/index.ts +2 -2
- package/src/styles/inputs.css +138 -137
- package/src/styles/layout.css +3 -2
- package/src/styles/mobilLayout.css +4 -2
- package/src/utils/BagelFormUtils.ts +6 -2
- package/src/utils/calendar/EDate.ts +0 -0
- package/src/{components/calendar/helpers → utils/calendar}/Helpers.ts +6 -6
- package/src/utils/calendar/constants.ts +2 -0
- package/src/utils/{timeAgo.ts → calendar/dateUtils.ts} +38 -1
- package/src/utils/calendar/event.interface.ts +33 -0
- package/src/{components/calendar/helpers/Time.ts → utils/calendar/time.ts} +15 -15
- package/src/utils/calendar/types.ts +27 -0
- package/src/{components/calendar/typings/config.interface.ts → utils/calendar/typings.ts} +13 -6
- package/src/utils/calendar/week.ts +588 -0
- package/src/components/calendar/assets/base.css +0 -60
- package/src/components/calendar/components/header/Header.vue +0 -153
- package/src/components/calendar/components/month/AgendaEventTile.vue +0 -135
- package/src/components/calendar/components/month/AgendaEvents.vue +0 -72
- package/src/components/calendar/components/month/Day.vue +0 -256
- package/src/components/calendar/components/month/Event.vue +0 -164
- package/src/components/calendar/components/month/Month.vue +0 -241
- package/src/components/calendar/components/month/WeekDay.vue +0 -15
- package/src/components/calendar/components/partials/EventFlyout.vue +0 -430
- package/src/components/calendar/components/week/Day.vue +0 -198
- package/src/components/calendar/components/week/DayEvent.vue +0 -584
- package/src/components/calendar/components/week/DayTimeline.vue +0 -80
- package/src/components/calendar/components/week/FullDayEvent.vue +0 -121
- package/src/components/calendar/components/week/Week.vue +0 -414
- package/src/components/calendar/components/week/WeekTimeline.vue +0 -101
- package/src/components/calendar/constants.ts +0 -13
- package/src/components/calendar/helpers/DayIntervals.ts +0 -48
- package/src/components/calendar/helpers/EDate.ts +0 -18
- package/src/components/calendar/helpers/Errors.ts +0 -69
- package/src/components/calendar/helpers/EventChange.ts +0 -88
- package/src/components/calendar/helpers/EventConcurrency.ts +0 -69
- package/src/components/calendar/helpers/EventFlyoutPosition.ts +0 -96
- package/src/components/calendar/helpers/EventPosition.ts +0 -154
- package/src/components/calendar/helpers/EventsFilter.ts +0 -50
- package/src/components/calendar/helpers/Week.ts +0 -37
- package/src/components/calendar/language/index.ts +0 -41
- package/src/components/calendar/language/keys.ts +0 -99
- package/src/components/calendar/models/Event.ts +0 -112
- package/src/components/calendar/styles/_mixins.css +0 -21
- package/src/components/calendar/styles/_variables.css +0 -47
- package/src/components/calendar/typings/interfaces/day.interface.ts +0 -10
- package/src/components/calendar/typings/interfaces/event.interface.ts +0 -32
- package/src/components/calendar/typings/interfaces/full-day-events-week.type.ts +0 -8
- package/src/components/calendar/typings/interfaces/period.interface.ts +0 -5
- package/src/components/calendar/typings/interfaces/time-modes.ts +0 -11
- package/src/components/calendar/typings/types.ts +0 -27
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { CalendarEvent } from '../CalendarTypes'
|
|
3
|
+
import type { PopoverState } from '../utils'
|
|
4
|
+
import { Card, formatDate } from '@bagelink/vue'
|
|
5
|
+
import { ref, computed, useSlots } from 'vue'
|
|
6
|
+
import {
|
|
7
|
+
openPopover as openPopoverUtil,
|
|
8
|
+
closePopover as closePopoverUtil,
|
|
9
|
+
} from '../utils'
|
|
10
|
+
|
|
11
|
+
interface MonthViewEvent {
|
|
12
|
+
date: Date
|
|
13
|
+
events: CalendarEvent[]
|
|
14
|
+
isToday: boolean
|
|
15
|
+
isCurrentMonth: boolean
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const props = defineProps<{
|
|
19
|
+
events: CalendarEvent[]
|
|
20
|
+
startDate: Date
|
|
21
|
+
}>()
|
|
22
|
+
|
|
23
|
+
const emit = defineEmits<{
|
|
24
|
+
(e: 'eventClick', event: CalendarEvent): void
|
|
25
|
+
}>()
|
|
26
|
+
|
|
27
|
+
const slots = useSlots()
|
|
28
|
+
|
|
29
|
+
// Responsive state
|
|
30
|
+
const isMobile = computed(() => window.innerWidth < 768)
|
|
31
|
+
|
|
32
|
+
// Popover state
|
|
33
|
+
const activeEvent = ref<CalendarEvent | null>(null)
|
|
34
|
+
const showPopover = ref(false)
|
|
35
|
+
const popoverPosition = ref({ top: 0, left: 0, width: 0, height: 0 })
|
|
36
|
+
const popoverRef = ref<HTMLElement | null>(null)
|
|
37
|
+
|
|
38
|
+
const popoverState: PopoverState = {
|
|
39
|
+
activeEvent,
|
|
40
|
+
showPopover,
|
|
41
|
+
popoverPosition,
|
|
42
|
+
popoverRef
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Calendar data
|
|
46
|
+
const weekDays = computed(() => ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'])
|
|
47
|
+
|
|
48
|
+
// Calculate days for the current month view
|
|
49
|
+
const currentMonth = computed(() => {
|
|
50
|
+
const year = props.startDate.getFullYear()
|
|
51
|
+
const month = props.startDate.getMonth()
|
|
52
|
+
const firstDay = new Date(year, month, 1)
|
|
53
|
+
const lastDay = new Date(year, month + 1, 0)
|
|
54
|
+
const daysInMonth = lastDay.getDate()
|
|
55
|
+
const startingDay = firstDay.getDay() // 0 = Sunday, 1 = Monday, etc.
|
|
56
|
+
const today = new Date().toDateString()
|
|
57
|
+
const days: MonthViewEvent[] = []
|
|
58
|
+
|
|
59
|
+
// Add days from previous month to fill the calendar grid
|
|
60
|
+
const prevMonthLastDay = new Date(year, month, 0).getDate()
|
|
61
|
+
for (let i = startingDay - 1; i >= 0; i--) {
|
|
62
|
+
const date = new Date(year, month - 1, prevMonthLastDay - i)
|
|
63
|
+
days.push({
|
|
64
|
+
date,
|
|
65
|
+
events: [],
|
|
66
|
+
isToday: false,
|
|
67
|
+
isCurrentMonth: false
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Add days from current month
|
|
72
|
+
for (let i = 1; i <= daysInMonth; i++) {
|
|
73
|
+
const date = new Date(year, month, i)
|
|
74
|
+
const dayEvents = props.events.filter((event) => {
|
|
75
|
+
const eventDate = new Date(event.start_time)
|
|
76
|
+
return eventDate.getDate() === i
|
|
77
|
+
&& eventDate.getMonth() === month
|
|
78
|
+
&& eventDate.getFullYear() === year
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
days.push({
|
|
82
|
+
date,
|
|
83
|
+
events: dayEvents,
|
|
84
|
+
isToday: date.toDateString() === today,
|
|
85
|
+
isCurrentMonth: true
|
|
86
|
+
})
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Add days from next month to complete the grid
|
|
90
|
+
const remainingDays = 42 - days.length // 42 = 6 rows * 7 days
|
|
91
|
+
for (let i = 1; i <= remainingDays; i++) {
|
|
92
|
+
const date = new Date(year, month + 1, i)
|
|
93
|
+
days.push({
|
|
94
|
+
date,
|
|
95
|
+
events: [],
|
|
96
|
+
isToday: false,
|
|
97
|
+
isCurrentMonth: false
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return days
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
// Popover handling functions
|
|
105
|
+
function openPopover(event: CalendarEvent, e: MouseEvent) {
|
|
106
|
+
openPopoverUtil(
|
|
107
|
+
event,
|
|
108
|
+
e,
|
|
109
|
+
popoverState,
|
|
110
|
+
!!slots.eventContent,
|
|
111
|
+
(evt) => { emit('eventClick', evt) }
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function closePopover() {
|
|
116
|
+
closePopoverUtil(popoverState)
|
|
117
|
+
}
|
|
118
|
+
</script>
|
|
119
|
+
|
|
120
|
+
<template>
|
|
121
|
+
<div class="month-view">
|
|
122
|
+
<div class="month-header">
|
|
123
|
+
<div v-for="day in weekDays" :key="day" class="weekday">
|
|
124
|
+
{{ day }}
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
<div class="month-grid">
|
|
128
|
+
<div
|
|
129
|
+
v-for="day in currentMonth"
|
|
130
|
+
:key="day.date.toISOString()"
|
|
131
|
+
class="day-cell"
|
|
132
|
+
:class="{
|
|
133
|
+
'current-month': day.isCurrentMonth,
|
|
134
|
+
'today': day.isToday,
|
|
135
|
+
'other-month': !day.isCurrentMonth,
|
|
136
|
+
}"
|
|
137
|
+
>
|
|
138
|
+
<div class="day-number">
|
|
139
|
+
{{ formatDate(day.date, 'DD') }}
|
|
140
|
+
</div>
|
|
141
|
+
<div class="day-events">
|
|
142
|
+
<template v-if="isMobile">
|
|
143
|
+
<div v-if="day.events.length > 0" class="event-dot" />
|
|
144
|
+
</template>
|
|
145
|
+
<template v-else>
|
|
146
|
+
<div
|
|
147
|
+
v-for="event in day.events"
|
|
148
|
+
:key="event.id"
|
|
149
|
+
class="event-item"
|
|
150
|
+
:style="{ backgroundColor: event.color || 'var(--bgl-primary)' }"
|
|
151
|
+
@click.stop="slots.eventContent ? openPopover(event, $event) : emit('eventClick', event)"
|
|
152
|
+
>
|
|
153
|
+
<div class="event-title">
|
|
154
|
+
{{ event.title }}
|
|
155
|
+
</div>
|
|
156
|
+
<div class="event-time">
|
|
157
|
+
{{ formatDate(event.start_time, 'HH:mm') }}
|
|
158
|
+
</div>
|
|
159
|
+
</div>
|
|
160
|
+
</template>
|
|
161
|
+
</div>
|
|
162
|
+
</div>
|
|
163
|
+
</div>
|
|
164
|
+
|
|
165
|
+
<!-- Custom Popover -->
|
|
166
|
+
<Card
|
|
167
|
+
v-if="showPopover && activeEvent"
|
|
168
|
+
ref="popoverRef"
|
|
169
|
+
v-click-outside="closePopover"
|
|
170
|
+
thin
|
|
171
|
+
class="custom-popover"
|
|
172
|
+
:style="{
|
|
173
|
+
top: `${popoverPosition.top}px`,
|
|
174
|
+
left: `${popoverPosition.left}px`,
|
|
175
|
+
maxWidth: `${popoverPosition.width}px`,
|
|
176
|
+
}"
|
|
177
|
+
>
|
|
178
|
+
<slot name="eventContent" :event="activeEvent" />
|
|
179
|
+
</Card>
|
|
180
|
+
</div>
|
|
181
|
+
</template>
|
|
182
|
+
|
|
183
|
+
<style scoped>
|
|
184
|
+
.month-view {
|
|
185
|
+
display: flex;
|
|
186
|
+
flex-direction: column;
|
|
187
|
+
height: 100%;
|
|
188
|
+
overflow: hidden;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.month-header {
|
|
192
|
+
display: grid;
|
|
193
|
+
grid-template-columns: repeat(7, 1fr);
|
|
194
|
+
border-bottom: 1px solid var(--border-color);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.weekday {
|
|
198
|
+
padding: 0.5rem;
|
|
199
|
+
text-align: center;
|
|
200
|
+
color: var(--text-muted);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.month-grid {
|
|
204
|
+
display: grid;
|
|
205
|
+
grid-template-columns: repeat(7, 1fr);
|
|
206
|
+
grid-template-rows: repeat(6, 1fr);
|
|
207
|
+
flex-grow: 1;
|
|
208
|
+
overflow: auto;
|
|
209
|
+
border-inline-end: 1px solid var(--border-color);
|
|
210
|
+
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.day-cell {
|
|
214
|
+
border-inline-start: 1px solid var(--border-color);
|
|
215
|
+
border-bottom: 1px solid var(--border-color);
|
|
216
|
+
padding: 0.5rem;
|
|
217
|
+
min-height: 100px;
|
|
218
|
+
display: flex;
|
|
219
|
+
flex-direction: column;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.day-number {
|
|
223
|
+
margin-bottom: 0.5rem;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.other-month {
|
|
227
|
+
background-color: var(--bgl-gray-light);
|
|
228
|
+
color: var(--bgl-gray);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.today {
|
|
232
|
+
background-color: var(--bgl-primary-light);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.today .day-number {
|
|
236
|
+
color: var(--bgl-primary);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.day-events {
|
|
240
|
+
flex-grow: 1;
|
|
241
|
+
overflow-y: auto;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.event-item {
|
|
245
|
+
margin-bottom: 0.25rem;
|
|
246
|
+
padding: 0.25rem;
|
|
247
|
+
border-radius: 4px;
|
|
248
|
+
color: white;
|
|
249
|
+
font-size: 0.8rem;
|
|
250
|
+
cursor: pointer;
|
|
251
|
+
transition: all 0.2s ease;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.event-title {
|
|
255
|
+
font-weight: 500;
|
|
256
|
+
white-space: nowrap;
|
|
257
|
+
overflow: hidden;
|
|
258
|
+
text-overflow: ellipsis;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.event-time {
|
|
262
|
+
font-size: 0.7rem;
|
|
263
|
+
opacity: 0.8;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.event-dot {
|
|
267
|
+
width: 6px;
|
|
268
|
+
height: 6px;
|
|
269
|
+
background-color: var(--bgl-primary);
|
|
270
|
+
border-radius: 50%;
|
|
271
|
+
margin: 0.25rem auto;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
@media (max-width: 768px) {
|
|
275
|
+
.day-cell {
|
|
276
|
+
min-height: 60px;
|
|
277
|
+
padding: 0.25rem;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.day-number {
|
|
281
|
+
font-size: 0.8rem;
|
|
282
|
+
margin-bottom: 0.25rem;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.weekday {
|
|
286
|
+
font-size: 0.8rem;
|
|
287
|
+
padding: 0.25rem;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.custom-popover {
|
|
292
|
+
position: fixed;
|
|
293
|
+
z-index: 1000;
|
|
294
|
+
min-width: 250px;
|
|
295
|
+
max-width: 350px;
|
|
296
|
+
background-color: white;
|
|
297
|
+
border-radius: 4px;
|
|
298
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
299
|
+
animation: fadeIn 0.2s ease;
|
|
300
|
+
transform-origin: center left;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
@keyframes fadeIn {
|
|
304
|
+
from {
|
|
305
|
+
opacity: 0;
|
|
306
|
+
transform: scale(0.95);
|
|
307
|
+
}
|
|
308
|
+
to {
|
|
309
|
+
opacity: 1;
|
|
310
|
+
transform: scale(1);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
</style>
|