nuxt-ui-elements-pro 0.1.4 → 0.1.6
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/module.json +1 -1
- package/dist/module.mjs +50 -15
- package/dist/runtime/components/EventCalendar.d.vue.ts +48 -42
- package/dist/runtime/components/EventCalendar.vue +116 -606
- package/dist/runtime/components/EventCalendar.vue.d.ts +48 -42
- package/dist/runtime/components/EventCalendarHeader.d.vue.ts +26 -0
- package/dist/runtime/components/EventCalendarHeader.vue +48 -0
- package/dist/runtime/components/EventCalendarHeader.vue.d.ts +26 -0
- package/dist/runtime/components/EventCalendarListView.d.vue.ts +25 -0
- package/dist/runtime/components/EventCalendarListView.vue +95 -0
- package/dist/runtime/components/EventCalendarListView.vue.d.ts +25 -0
- package/dist/runtime/components/EventCalendarMonthView.d.vue.ts +34 -0
- package/dist/runtime/components/EventCalendarMonthView.vue +336 -0
- package/dist/runtime/components/EventCalendarMonthView.vue.d.ts +34 -0
- package/dist/runtime/components/EventCalendarTimeGrid.d.vue.ts +31 -0
- package/dist/runtime/components/EventCalendarTimeGrid.vue +306 -0
- package/dist/runtime/components/EventCalendarTimeGrid.vue.d.ts +31 -0
- package/dist/runtime/composables/useEventCalendar.d.ts +52 -0
- package/dist/runtime/composables/useEventCalendar.js +362 -0
- package/dist/runtime/composables/useEventCalendarContext.d.ts +8 -0
- package/dist/runtime/composables/useEventCalendarContext.js +11 -0
- package/dist/runtime/composables/useEventCalendarDragDrop.d.ts +1 -1
- package/dist/runtime/composables/useEventCalendarDragDrop.js +11 -9
- package/dist/runtime/composables/useEventCalendarKeyboard.d.ts +20 -0
- package/dist/runtime/composables/useEventCalendarKeyboard.js +128 -0
- package/dist/runtime/composables/useEventCalendarResize.d.ts +31 -0
- package/dist/runtime/composables/useEventCalendarResize.js +87 -0
- package/dist/runtime/composables/useEventCalendarSelect.d.ts +21 -0
- package/dist/runtime/composables/useEventCalendarSelect.js +119 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/types/event-calendar.d.ts +169 -0
- package/dist/runtime/types/index.d.ts +4 -0
- package/dist/runtime/types/index.js +4 -0
- package/dist/runtime/utils/event-calendar.d.ts +22 -1
- package/dist/runtime/utils/event-calendar.js +199 -1
- package/dist/runtime/utils/recurrence.d.ts +30 -0
- package/dist/runtime/utils/recurrence.js +150 -0
- package/package.json +15 -6
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { Primitive } from "reka-ui";
|
|
3
|
+
import { computed } from "vue";
|
|
4
|
+
import { useEventCalendarContext } from "../composables/useEventCalendarContext";
|
|
5
|
+
import { format } from "#std/date";
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script setup>
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
as: { type: null, required: false }
|
|
11
|
+
});
|
|
12
|
+
defineSlots();
|
|
13
|
+
const ctx = useEventCalendarContext();
|
|
14
|
+
const isEmpty = computed(
|
|
15
|
+
() => !ctx.loading.value && ctx.timeGridDays.value.every(
|
|
16
|
+
(day) => day.allDayEvents.length === 0 && day.timedEvents.length === 0
|
|
17
|
+
)
|
|
18
|
+
);
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<Primitive
|
|
23
|
+
v-if="ctx.view.value === 'week' || ctx.view.value === 'day'"
|
|
24
|
+
:as="props.as ?? 'div'"
|
|
25
|
+
data-slot="timeGridRoot"
|
|
26
|
+
:class="ctx.ui.value.timeGridRoot({ class: ctx.propUi.value?.timeGridRoot })"
|
|
27
|
+
role="region"
|
|
28
|
+
:aria-label="`${ctx.view.value === 'week' ? 'Week' : 'Day'} view: ${ctx.headerTitle.value}`"
|
|
29
|
+
@keydown="ctx.onGridKeydown">
|
|
30
|
+
<!-- Column headers -->
|
|
31
|
+
<div data-slot="columnHeaders" :class="ctx.ui.value.columnHeaders({ class: ctx.propUi.value?.columnHeaders })">
|
|
32
|
+
<div data-slot="timeGutterSpacer" :class="ctx.ui.value.timeGutterSpacer({ class: ctx.propUi.value?.timeGutterSpacer })" />
|
|
33
|
+
<div
|
|
34
|
+
v-for="day in ctx.timeGridDays.value"
|
|
35
|
+
:key="day.dateKey"
|
|
36
|
+
data-slot="dayColumnHeader"
|
|
37
|
+
:aria-label="ctx.formatDateAriaLabel(day.date)"
|
|
38
|
+
:aria-current="day.isToday ? 'date' : void 0"
|
|
39
|
+
:class="ctx.ui.value.dayColumnHeader({ class: ctx.propUi.value?.dayColumnHeader })">
|
|
40
|
+
<div :class="ctx.ui.value.dayColumnHeaderLabel({ class: ctx.propUi.value?.dayColumnHeaderLabel })">
|
|
41
|
+
{{ format(day.date, ctx.timeGridDays.value.length === 1 ? "dddd" : "ddd", ctx.locale.value) }}
|
|
42
|
+
</div>
|
|
43
|
+
<div
|
|
44
|
+
:class="[
|
|
45
|
+
day.isToday ? ctx.ui.value.dayColumnHeaderToday({ class: ctx.propUi.value?.dayColumnHeaderToday }) : ctx.ui.value.dayColumnHeaderNumber({ class: ctx.propUi.value?.dayColumnHeaderNumber })
|
|
46
|
+
]">
|
|
47
|
+
{{ day.date.day }}
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<!-- All-day events row -->
|
|
53
|
+
<div data-slot="allDayRow" aria-label="All-day events" :class="ctx.ui.value.allDayRow({ class: ctx.propUi.value?.allDayRow })">
|
|
54
|
+
<div data-slot="allDayLabel" :class="ctx.ui.value.allDayLabel({ class: ctx.propUi.value?.allDayLabel })">all-day</div>
|
|
55
|
+
|
|
56
|
+
<!-- Day view: single column with all-day slot -->
|
|
57
|
+
<template v-if="ctx.timeGridDays.value.length === 1">
|
|
58
|
+
<div
|
|
59
|
+
v-for="day in ctx.timeGridDays.value"
|
|
60
|
+
:key="`allday-${day.dateKey}`"
|
|
61
|
+
data-slot="allDayCell"
|
|
62
|
+
:class="[
|
|
63
|
+
'flex-1 p-0.5 flex flex-wrap gap-0.5',
|
|
64
|
+
ctx.ui.value.allDayCell({ class: ctx.propUi.value?.allDayCell }),
|
|
65
|
+
ctx.dropTargetKey.value === `allday-${day.dateKey}` && ctx.ui.value.dropTarget({ class: ctx.propUi.value?.dropTarget })
|
|
66
|
+
]"
|
|
67
|
+
@dragover="ctx.onDragOver(`allday-${day.dateKey}`, $event)"
|
|
68
|
+
@dragleave="ctx.onDragLeave"
|
|
69
|
+
@drop="ctx.onDropMonthCell(day.date, $event)">
|
|
70
|
+
<slot name="all-day" :events="day.allDayEvents.map((e) => e.original)" :date="day.date">
|
|
71
|
+
<div
|
|
72
|
+
v-for="event in day.allDayEvents"
|
|
73
|
+
:key="event.id"
|
|
74
|
+
role="button"
|
|
75
|
+
:aria-label="ctx.formatEventAriaLabel(event)"
|
|
76
|
+
tabindex="0"
|
|
77
|
+
:draggable="ctx.editable.value && event.draggable"
|
|
78
|
+
:class="[ctx.ui.value.eventChip({ class: ctx.propUi.value?.eventChip }), 'w-full']"
|
|
79
|
+
:style="ctx.getEventStyle(event)"
|
|
80
|
+
@click="ctx.handleEventClick(event, $event)"
|
|
81
|
+
@keydown.enter.stop="ctx.handleEventClick(event, $event)"
|
|
82
|
+
@keydown.space.prevent.stop="ctx.handleEventClick(event, $event)"
|
|
83
|
+
@dragstart="ctx.onDragStart(event, $event)"
|
|
84
|
+
@dragend="ctx.onDragEnd">
|
|
85
|
+
<slot name="event" :event="event.original" :view="ctx.view.value">
|
|
86
|
+
<UIcon
|
|
87
|
+
v-if="event.recurringEventId"
|
|
88
|
+
name="i-lucide-repeat"
|
|
89
|
+
data-slot="recurringIcon"
|
|
90
|
+
:class="ctx.ui.value.recurringIcon({ class: ctx.propUi.value?.recurringIcon })"
|
|
91
|
+
aria-hidden="true" />
|
|
92
|
+
{{ event.title }}
|
|
93
|
+
</slot>
|
|
94
|
+
</div>
|
|
95
|
+
</slot>
|
|
96
|
+
</div>
|
|
97
|
+
</template>
|
|
98
|
+
|
|
99
|
+
<!-- Week view: CSS Grid with spanning bars -->
|
|
100
|
+
<template v-else>
|
|
101
|
+
<div
|
|
102
|
+
data-slot="allDayGrid"
|
|
103
|
+
:class="ctx.ui.value.allDayGrid({ class: ctx.propUi.value?.allDayGrid })"
|
|
104
|
+
:style="{
|
|
105
|
+
display: 'grid',
|
|
106
|
+
gridTemplateColumns: `repeat(${ctx.timeGridDays.value.length}, minmax(0, 1fr))`,
|
|
107
|
+
gridTemplateRows: ctx.allDayLayout.value.laneCount > 0 ? `repeat(${ctx.allDayLayout.value.laneCount}, 24px)` : 'minmax(24px, auto)'
|
|
108
|
+
}">
|
|
109
|
+
<!-- Background cells (drop targets + borders) -->
|
|
110
|
+
<div
|
|
111
|
+
v-for="(day, colIdx) in ctx.timeGridDays.value"
|
|
112
|
+
:key="`allday-bg-${day.dateKey}`"
|
|
113
|
+
data-slot="allDayCell"
|
|
114
|
+
:class="[
|
|
115
|
+
ctx.ui.value.allDayCell({ class: ctx.propUi.value?.allDayCell }),
|
|
116
|
+
ctx.dropTargetKey.value === `allday-${day.dateKey}` && ctx.ui.value.dropTarget({ class: ctx.propUi.value?.dropTarget })
|
|
117
|
+
]"
|
|
118
|
+
:style="{
|
|
119
|
+
gridColumn: `${colIdx + 1}`,
|
|
120
|
+
gridRow: '1 / -1'
|
|
121
|
+
}"
|
|
122
|
+
@dragover="ctx.onDragOver(`allday-${day.dateKey}`, $event)"
|
|
123
|
+
@dragleave="ctx.onDragLeave"
|
|
124
|
+
@drop="ctx.onDropMonthCell(day.date, $event)" />
|
|
125
|
+
|
|
126
|
+
<!-- Spanning event bars -->
|
|
127
|
+
<div
|
|
128
|
+
v-for="spanEvent in ctx.allDayLayout.value.spanning"
|
|
129
|
+
:key="`allday-span-${spanEvent.event.id}-${spanEvent.startCol}`"
|
|
130
|
+
data-slot="allDaySpanningChip"
|
|
131
|
+
role="button"
|
|
132
|
+
:aria-label="ctx.formatEventAriaLabel(spanEvent.event)"
|
|
133
|
+
tabindex="0"
|
|
134
|
+
:draggable="ctx.editable.value && spanEvent.event.draggable && spanEvent.isStart"
|
|
135
|
+
:class="[
|
|
136
|
+
ctx.ui.value.allDaySpanningChip({ class: ctx.propUi.value?.allDaySpanningChip }),
|
|
137
|
+
spanEvent.isStart && 'rounded-l border-l-2 border-[var(--event-color)] ml-0.5',
|
|
138
|
+
spanEvent.isEnd && 'rounded-r mr-0.5',
|
|
139
|
+
!spanEvent.isStart && 'pl-1',
|
|
140
|
+
!spanEvent.isEnd && 'pr-1',
|
|
141
|
+
ctx.draggedEventId.value === spanEvent.event.id && 'opacity-50'
|
|
142
|
+
]"
|
|
143
|
+
:style="{
|
|
144
|
+
...ctx.getEventStyle(spanEvent.event, 15),
|
|
145
|
+
gridColumn: `${spanEvent.startCol + 1} / span ${spanEvent.span}`,
|
|
146
|
+
gridRow: `${spanEvent.lane + 1}`
|
|
147
|
+
}"
|
|
148
|
+
@click="ctx.handleEventClick(spanEvent.event, $event)"
|
|
149
|
+
@keydown.enter.stop="ctx.handleEventClick(spanEvent.event, $event)"
|
|
150
|
+
@keydown.space.prevent.stop="ctx.handleEventClick(spanEvent.event, $event)"
|
|
151
|
+
@dragstart="ctx.onDragStart(spanEvent.event, $event)"
|
|
152
|
+
@dragend="ctx.onDragEnd">
|
|
153
|
+
<slot name="event" :event="spanEvent.event.original" :view="ctx.view.value">
|
|
154
|
+
<template v-if="spanEvent.isStart">
|
|
155
|
+
<UIcon
|
|
156
|
+
v-if="spanEvent.event.recurringEventId"
|
|
157
|
+
name="i-lucide-repeat"
|
|
158
|
+
data-slot="recurringIcon"
|
|
159
|
+
:class="ctx.ui.value.recurringIcon({ class: ctx.propUi.value?.recurringIcon })"
|
|
160
|
+
aria-hidden="true" />
|
|
161
|
+
{{ spanEvent.event.title }}
|
|
162
|
+
</template>
|
|
163
|
+
<span v-else class="sr-only">{{ spanEvent.event.title }} (continued)</span>
|
|
164
|
+
</slot>
|
|
165
|
+
</div>
|
|
166
|
+
</div>
|
|
167
|
+
</template>
|
|
168
|
+
</div>
|
|
169
|
+
|
|
170
|
+
<!-- Time grid -->
|
|
171
|
+
<div class="relative">
|
|
172
|
+
<div data-slot="timeGrid" :class="ctx.ui.value.timeGrid({ class: ctx.propUi.value?.timeGrid })" @selectstart.prevent>
|
|
173
|
+
<!-- Time gutter -->
|
|
174
|
+
<div data-slot="timeGutter" :class="ctx.ui.value.timeGutter({ class: ctx.propUi.value?.timeGutter })">
|
|
175
|
+
<div
|
|
176
|
+
v-for="slot in ctx.timeGridSlots.value"
|
|
177
|
+
:key="`gutter-${slot.hour}-${slot.minute}`"
|
|
178
|
+
data-slot="timeGutterSlot"
|
|
179
|
+
:class="ctx.ui.value.timeGutterSlot({ class: ctx.propUi.value?.timeGutterSlot })"
|
|
180
|
+
:style="{ height: `${ctx.SLOT_HEIGHT}px` }">
|
|
181
|
+
<div v-if="slot.label" data-slot="timeLabel" :class="ctx.ui.value.timeLabel({ class: ctx.propUi.value?.timeLabel })">
|
|
182
|
+
<slot name="time-label" :hour="slot.hour" :label="slot.label">
|
|
183
|
+
{{ slot.label }}
|
|
184
|
+
</slot>
|
|
185
|
+
</div>
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
|
|
189
|
+
<!-- Day columns -->
|
|
190
|
+
<div
|
|
191
|
+
v-for="day in ctx.timeGridDays.value"
|
|
192
|
+
:key="`col-${day.dateKey}`"
|
|
193
|
+
data-slot="dayColumn"
|
|
194
|
+
:class="ctx.ui.value.dayColumn({ class: ctx.propUi.value?.dayColumn })"
|
|
195
|
+
@dragover="ctx.onTimeGridDragOver(`time-${day.dateKey}`, $event)"
|
|
196
|
+
@dragleave="ctx.onDragLeave"
|
|
197
|
+
@drop="ctx.onDropTimeGrid(day.date, $event)">
|
|
198
|
+
<!-- Time slot rows (grid lines + drag targets) -->
|
|
199
|
+
<div
|
|
200
|
+
v-for="slot in ctx.timeGridSlots.value"
|
|
201
|
+
:key="`row-${slot.hour}-${slot.minute}`"
|
|
202
|
+
data-slot="timeSlotRow"
|
|
203
|
+
:class="[
|
|
204
|
+
ctx.ui.value.timeSlotRow({ class: ctx.propUi.value?.timeSlotRow }),
|
|
205
|
+
ctx.dragSnapSlot.value === `time-${day.dateKey}-${slot.hour}-${slot.minute}` && ctx.ui.value.dragSnapSlot({ class: ctx.propUi.value?.dragSnapSlot }),
|
|
206
|
+
ctx.isSlotInSelection(day.date, slot.hour, slot.minute) && ctx.ui.value.selectionOverlay({ class: ctx.propUi.value?.selectionOverlay })
|
|
207
|
+
]"
|
|
208
|
+
:style="{ height: `${ctx.SLOT_HEIGHT}px` }"
|
|
209
|
+
@click="ctx.handleDateClick(day)"
|
|
210
|
+
@pointerdown="ctx.onSlotPointerDown(day.date, slot.hour, slot.minute, $event)"
|
|
211
|
+
@pointermove="ctx.onSlotPointerMove(day.date, slot.hour, slot.minute)"
|
|
212
|
+
@pointerup="ctx.onSelectionPointerUp()"
|
|
213
|
+
@dragover="ctx.onSlotDragOver(`time-${day.dateKey}-${slot.hour}-${slot.minute}`, $event)" />
|
|
214
|
+
|
|
215
|
+
<!-- Timed events (absolutely positioned) -->
|
|
216
|
+
<div
|
|
217
|
+
v-for="event in day.timedEvents"
|
|
218
|
+
:key="`ev-${event.id}`"
|
|
219
|
+
data-slot="timeEvent"
|
|
220
|
+
role="button"
|
|
221
|
+
:aria-label="ctx.formatEventAriaLabel(event)"
|
|
222
|
+
tabindex="0"
|
|
223
|
+
:draggable="ctx.editable.value && event.draggable && ctx.resizingEventId.value == null"
|
|
224
|
+
:class="[
|
|
225
|
+
ctx.ui.value.timeEvent({ class: ctx.propUi.value?.timeEvent }),
|
|
226
|
+
ctx.draggedEventId.value != null && ctx.draggedEventId.value !== event.id && 'pointer-events-none',
|
|
227
|
+
ctx.draggedEventId.value === event.id && 'opacity-50',
|
|
228
|
+
ctx.resizingEventId.value != null && ctx.resizingEventId.value !== event.id && 'pointer-events-none',
|
|
229
|
+
ctx.resizingEventId.value === event.id && 'select-none'
|
|
230
|
+
]"
|
|
231
|
+
:style="{
|
|
232
|
+
...ctx.getEventStyle(event, 15),
|
|
233
|
+
top: `${event.topPx}px`,
|
|
234
|
+
height: ctx.resizingEventId.value === event.id && ctx.resizePreviewHeightPx.value != null ? `${ctx.resizePreviewHeightPx.value}px` : `${event.heightPx}px`,
|
|
235
|
+
minHeight: '20px',
|
|
236
|
+
left: `calc(${event.column / event.totalColumns * 100}% + 2px)`,
|
|
237
|
+
width: `calc(${1 / event.totalColumns * 100}% - 4px)`
|
|
238
|
+
}"
|
|
239
|
+
@click="ctx.handleEventClick(event, $event)"
|
|
240
|
+
@keydown.enter.stop="ctx.handleEventClick(event, $event)"
|
|
241
|
+
@keydown.space.prevent.stop="ctx.handleEventClick(event, $event)"
|
|
242
|
+
@dragstart="ctx.onDragStart(event, $event)"
|
|
243
|
+
@dragend="ctx.onDragEnd">
|
|
244
|
+
<slot name="event" :event="event.original" :view="ctx.view.value">
|
|
245
|
+
<div data-slot="timeEventTitle" :class="ctx.ui.value.timeEventTitle({ class: ctx.propUi.value?.timeEventTitle })">
|
|
246
|
+
<UIcon
|
|
247
|
+
v-if="event.recurringEventId"
|
|
248
|
+
name="i-lucide-repeat"
|
|
249
|
+
data-slot="recurringIcon"
|
|
250
|
+
:class="ctx.ui.value.recurringIcon({ class: ctx.propUi.value?.recurringIcon })"
|
|
251
|
+
aria-hidden="true" />
|
|
252
|
+
{{ event.title }}
|
|
253
|
+
</div>
|
|
254
|
+
<div data-slot="timeEventTime" :class="ctx.ui.value.timeEventTime({ class: ctx.propUi.value?.timeEventTime })">
|
|
255
|
+
{{ ctx.formatTimeRange(event.start, event.end) }}
|
|
256
|
+
</div>
|
|
257
|
+
</slot>
|
|
258
|
+
<!-- Resize handle (bottom edge) -->
|
|
259
|
+
<div
|
|
260
|
+
v-if="ctx.editable.value && event.resizable"
|
|
261
|
+
data-slot="resizeHandle"
|
|
262
|
+
:class="ctx.ui.value.resizeHandle({ class: ctx.propUi.value?.resizeHandle })"
|
|
263
|
+
@pointerdown.stop="ctx.onResizePointerDown(event, $event)">
|
|
264
|
+
<div
|
|
265
|
+
data-slot="resizeHandleBar"
|
|
266
|
+
:class="ctx.ui.value.resizeHandleBar({ class: ctx.propUi.value?.resizeHandleBar })" />
|
|
267
|
+
</div>
|
|
268
|
+
</div>
|
|
269
|
+
</div>
|
|
270
|
+
</div>
|
|
271
|
+
|
|
272
|
+
<!-- Loading overlay -->
|
|
273
|
+
<div
|
|
274
|
+
v-if="ctx.loading.value"
|
|
275
|
+
data-slot="loadingOverlay"
|
|
276
|
+
role="status"
|
|
277
|
+
:class="ctx.ui.value.loadingOverlay({ class: ctx.propUi.value?.loadingOverlay })">
|
|
278
|
+
<slot name="loading">
|
|
279
|
+
<UIcon
|
|
280
|
+
name="i-lucide-loader-circle"
|
|
281
|
+
data-slot="loadingIcon"
|
|
282
|
+
:class="ctx.ui.value.loadingIcon({ class: ctx.propUi.value?.loadingIcon })"
|
|
283
|
+
aria-hidden="true" />
|
|
284
|
+
<span class="sr-only">Loading events</span>
|
|
285
|
+
</slot>
|
|
286
|
+
</div>
|
|
287
|
+
|
|
288
|
+
<!-- Empty state -->
|
|
289
|
+
<div
|
|
290
|
+
v-else-if="isEmpty"
|
|
291
|
+
data-slot="emptyState"
|
|
292
|
+
:class="ctx.ui.value.emptyState({ class: ctx.propUi.value?.emptyState })">
|
|
293
|
+
<slot name="empty">
|
|
294
|
+
<UIcon
|
|
295
|
+
name="i-lucide-calendar-x2"
|
|
296
|
+
data-slot="emptyStateIcon"
|
|
297
|
+
:class="ctx.ui.value.emptyStateIcon({ class: ctx.propUi.value?.emptyStateIcon })"
|
|
298
|
+
aria-hidden="true" />
|
|
299
|
+
<p data-slot="emptyStateText" :class="ctx.ui.value.emptyStateText({ class: ctx.propUi.value?.emptyStateText })">
|
|
300
|
+
No events
|
|
301
|
+
</p>
|
|
302
|
+
</slot>
|
|
303
|
+
</div>
|
|
304
|
+
</div>
|
|
305
|
+
</Primitive>
|
|
306
|
+
</template>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { CalendarDate } from "@internationalized/date";
|
|
2
|
+
import type { CalendarEvent, CalendarView } from "../types/event-calendar.js";
|
|
3
|
+
import { type Component } from "vue";
|
|
4
|
+
export interface EventCalendarTimeGridProps {
|
|
5
|
+
/** Rendered element type @defaultValue 'div' */
|
|
6
|
+
as?: string | Component;
|
|
7
|
+
}
|
|
8
|
+
export interface EventCalendarTimeGridSlots {
|
|
9
|
+
event: (props: {
|
|
10
|
+
event: CalendarEvent;
|
|
11
|
+
view: CalendarView;
|
|
12
|
+
}) => any;
|
|
13
|
+
"time-label": (props: {
|
|
14
|
+
hour: number;
|
|
15
|
+
label: string;
|
|
16
|
+
}) => any;
|
|
17
|
+
"all-day": (props: {
|
|
18
|
+
events: CalendarEvent[];
|
|
19
|
+
date: CalendarDate;
|
|
20
|
+
}) => any;
|
|
21
|
+
loading: () => any;
|
|
22
|
+
empty: () => any;
|
|
23
|
+
}
|
|
24
|
+
declare const _default: typeof __VLS_export;
|
|
25
|
+
export default _default;
|
|
26
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<EventCalendarTimeGridProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<EventCalendarTimeGridProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, EventCalendarTimeGridSlots>;
|
|
27
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
28
|
+
new (): {
|
|
29
|
+
$slots: S;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { CalendarDate, CalendarDateTime, DateValue } from "@internationalized/date";
|
|
2
|
+
import type { CalendarEvent, CalendarDay, CalendarView, CalendarWeek, NormalizedEvent, TimeSlot, TimeGridDay, MonthViewOptions, WeekViewOptions, DayViewOptions, MonthWeekLayout, AllDayLayout } from "../types/event-calendar.js";
|
|
3
|
+
export declare const SLOT_HEIGHT = 48;
|
|
4
|
+
export interface UseEventCalendarOptions {
|
|
5
|
+
events: () => CalendarEvent[];
|
|
6
|
+
modelValue: () => Date | string | DateValue | undefined;
|
|
7
|
+
view: () => CalendarView;
|
|
8
|
+
locale: () => string;
|
|
9
|
+
weekStartsOn: () => 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
10
|
+
monthOptions: () => MonthViewOptions | undefined;
|
|
11
|
+
weekOptions: () => WeekViewOptions | undefined;
|
|
12
|
+
dayOptions: () => DayViewOptions | undefined;
|
|
13
|
+
onUpdateModelValue: (date: CalendarDate) => void;
|
|
14
|
+
onUpdateView: (view: CalendarView) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare function useEventCalendar(options: UseEventCalendarOptions): {
|
|
17
|
+
displayDate: import("vue").ComputedRef<CalendarDate>;
|
|
18
|
+
monthConfig: import("vue").ComputedRef<{
|
|
19
|
+
maxEvents: number;
|
|
20
|
+
fixedWeeks: boolean;
|
|
21
|
+
}>;
|
|
22
|
+
weekConfig: import("vue").ComputedRef<{
|
|
23
|
+
startHour: number;
|
|
24
|
+
endHour: number;
|
|
25
|
+
slotDuration: 15 | 30 | 60;
|
|
26
|
+
}>;
|
|
27
|
+
dayConfig: import("vue").ComputedRef<{
|
|
28
|
+
startHour: number;
|
|
29
|
+
endHour: number;
|
|
30
|
+
slotDuration: 15 | 30 | 60;
|
|
31
|
+
}>;
|
|
32
|
+
monthWeeks: import("vue").ComputedRef<CalendarWeek[]>;
|
|
33
|
+
monthWeekLayouts: import("vue").ComputedRef<MonthWeekLayout[]>;
|
|
34
|
+
weekdayLabels: import("vue").ComputedRef<string[]>;
|
|
35
|
+
weekDays: import("vue").ComputedRef<CalendarDay[]>;
|
|
36
|
+
dayViewDate: import("vue").ComputedRef<CalendarDay>;
|
|
37
|
+
listDays: import("vue").ComputedRef<CalendarDay[]>;
|
|
38
|
+
timeGridDays: import("vue").ComputedRef<TimeGridDay[]>;
|
|
39
|
+
allDayLayout: import("vue").ComputedRef<AllDayLayout>;
|
|
40
|
+
timeGridSlots: import("vue").ComputedRef<TimeSlot[]>;
|
|
41
|
+
headerTitle: import("vue").ComputedRef<string>;
|
|
42
|
+
formatTime: (d: CalendarDate | CalendarDateTime) => string;
|
|
43
|
+
formatTimeRange: (start: CalendarDate | CalendarDateTime, end: CalendarDate | CalendarDateTime) => string;
|
|
44
|
+
getEventStyle: (event: NormalizedEvent, bgOpacity?: number) => Record<string, string>;
|
|
45
|
+
isEventStart: (event: NormalizedEvent, date: CalendarDate) => boolean;
|
|
46
|
+
goToPrev: () => void;
|
|
47
|
+
goToNext: () => void;
|
|
48
|
+
goToToday: () => void;
|
|
49
|
+
setView: (v: CalendarView) => void;
|
|
50
|
+
normalizedEvents: import("vue").ComputedRef<NormalizedEvent[]>;
|
|
51
|
+
SLOT_HEIGHT: number;
|
|
52
|
+
};
|