vue-hotel-booking-calendar
Version:
A Vue 3 calendar component suite featuring hotel booking calendars, dashboard management, and resource scheduler with yearly/monthly/weekly/daily/hourly views. Includes price calculation, recurring events, event categories, working hours, and full interna
679 lines (625 loc) • 18.9 kB
TypeScript
import { App } from 'vue';
import { ComponentOptionsMixin } from 'vue';
import { ComponentProvideOptions } from 'vue';
import { DefineComponent } from 'vue';
import { ExtractPropTypes } from 'vue';
import { PropType } from 'vue';
import { PublicProps } from 'vue';
declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
declare type __VLS_NonUndefinedable_2<T> = T extends undefined ? never : T;
declare type __VLS_NonUndefinedable_3<T> = T extends undefined ? never : T;
declare type __VLS_Prettify<T> = {
[K in keyof T]: T[K];
} & {};
declare type __VLS_Prettify_2<T> = {
[K in keyof T]: T[K];
} & {};
declare type __VLS_Prettify_3<T> = {
[K in keyof T]: T[K];
} & {};
declare type __VLS_TypePropsToRuntimeProps<T> = {
[K in keyof T]-?: {} extends Pick<T, K> ? {
type: PropType<__VLS_NonUndefinedable<T[K]>>;
} : {
type: PropType<T[K]>;
required: true;
};
};
declare type __VLS_TypePropsToRuntimeProps_2<T> = {
[K in keyof T]-?: {} extends Pick<T, K> ? {
type: PropType<__VLS_NonUndefinedable_2<T[K]>>;
} : {
type: PropType<T[K]>;
required: true;
};
};
declare type __VLS_TypePropsToRuntimeProps_3<T> = {
[K in keyof T]-?: {} extends Pick<T, K> ? {
type: PropType<__VLS_NonUndefinedable_3<T[K]>>;
} : {
type: PropType<T[K]>;
required: true;
};
};
declare type __VLS_WithDefaults<P, D> = {
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
default: D[K];
}> : P[K];
};
declare type __VLS_WithDefaults_2<P, D> = {
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify_2<P[K] & {
default: D[K];
}> : P[K];
};
declare type __VLS_WithDefaults_3<P, D> = {
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify_3<P[K] & {
default: D[K];
}> : P[K];
};
declare type __VLS_WithTemplateSlots<T, S> = T & {
new (): {
$slots: S;
};
};
export declare type AvailabilityStatus = 'available' | 'blocked' | 'checkout-only';
export declare interface Booking {
id: string;
guestName: string;
roomNumber: string;
checkIn: string;
checkOut: string;
status: string;
}
export declare type BookingStatus = 'confirmed' | 'pending' | 'cancelled' | 'checked-in' | 'checked-out' | 'no-show';
export declare interface CalendarDay {
date: Date;
dateString: string;
isToday: boolean;
isCurrentMonth: boolean;
isPreviousMonth: boolean;
isNextMonth: boolean;
availability?: DateAvailability;
}
export declare interface CalendarEmits {
'update:modelValue': [value: DateRange];
'date-click': [date: string, status: AvailabilityStatus];
'date-select': [date: Date];
'selection-change': [selection: DateRange];
'selection-error': [error: SelectionError | null];
'price-calculation': [calculation: PriceCalculation | null];
'book-now': [bookingData: {
selection: DateRange;
calculation: PriceCalculation;
}];
}
export declare interface CalendarProps {
modelValue: DateRange;
availabilityData?: DateAvailability[];
minDate?: string | Date;
maxDate?: string | Date;
locale?: string;
disablePastDates?: boolean;
allowPreviousMonthNavigation?: boolean;
showPrices?: boolean;
allowSingleDay?: boolean;
theme?: 'light' | 'dark';
basePrice?: number;
currency?: string;
showPriceCalculation?: boolean;
showSelectionErrors?: boolean;
textLabels?: CalendarTextLabels;
}
export declare interface CalendarTextLabels {
previousMonth?: string;
nextMonth?: string;
bookingSummary?: string;
nights?: string;
night?: string;
priceBreakdown?: string;
total?: string;
bookNow?: string;
available?: string;
checkoutOnly?: string;
blocked?: string;
clearSelection?: string;
dismissError?: string;
}
export declare interface DashboardCalendarEmits {
'update:selectedMonth': [value: Date];
'booking-click': [booking: Booking];
'booking-create': [data: {
roomId: string;
date: string;
}];
}
export declare interface DashboardCalendarProps {
rooms: Room[];
bookings: Booking[];
selectedMonth?: Date;
theme?: 'light' | 'dark';
statusConfig?: StatusConfig[];
allowPreviousMonthNavigation?: boolean;
textLabels?: DashboardTextLabels;
}
export declare interface DashboardTextLabels {
previousMonth?: string;
nextMonth?: string;
room?: string;
available?: string;
createBooking?: string;
clickForDetails?: string;
}
export declare interface DateAvailability {
date: string;
status: AvailabilityStatus;
price?: number;
minStay?: number;
maxStay?: number;
}
export declare interface DateRange {
checkIn: string | null;
checkOut: string | null;
}
export declare interface EventCategory {
id: string;
name: string;
color: string;
backgroundColor: string;
darkBackgroundColor?: string;
}
export declare interface EventConflict {
eventId: string;
conflictingEventIds: string[];
message: string;
}
export declare interface HeaderOptions {
showNavigation?: boolean;
showToday?: boolean;
showViewSwitcher?: boolean;
showTitle?: boolean;
}
export declare const HotelBookingCalendar: __VLS_WithTemplateSlots<DefineComponent<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<CalendarProps>, {
modelValue: () => {
checkIn: null;
checkOut: null;
};
availabilityData: () => never[];
locale: string;
disablePastDates: boolean;
allowPreviousMonthNavigation: boolean;
showPrices: boolean;
allowSingleDay: boolean;
theme: string;
basePrice: number;
currency: string;
showPriceCalculation: boolean;
showSelectionErrors: boolean;
textLabels: () => {};
}>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
"update:modelValue": (value: DateRange) => void;
"date-click": (date: string, status: AvailabilityStatus) => void;
"date-select": (date: Date) => void;
"selection-change": (selection: DateRange) => void;
"selection-error": (error: SelectionError | null) => void;
"price-calculation": (calculation: PriceCalculation | null) => void;
"book-now": (bookingData: {
selection: DateRange;
calculation: PriceCalculation;
}) => void;
}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<CalendarProps>, {
modelValue: () => {
checkIn: null;
checkOut: null;
};
availabilityData: () => never[];
locale: string;
disablePastDates: boolean;
allowPreviousMonthNavigation: boolean;
showPrices: boolean;
allowSingleDay: boolean;
theme: string;
basePrice: number;
currency: string;
showPriceCalculation: boolean;
showSelectionErrors: boolean;
textLabels: () => {};
}>>> & Readonly<{
"onUpdate:modelValue"?: ((value: DateRange) => any) | undefined;
"onDate-click"?: ((date: string, status: AvailabilityStatus) => any) | undefined;
"onDate-select"?: ((date: Date) => any) | undefined;
"onSelection-change"?: ((selection: DateRange) => any) | undefined;
"onSelection-error"?: ((error: SelectionError | null) => any) | undefined;
"onPrice-calculation"?: ((calculation: PriceCalculation | null) => any) | undefined;
"onBook-now"?: ((bookingData: {
selection: DateRange;
calculation: PriceCalculation;
}) => any) | undefined;
}>, {
modelValue: DateRange;
availabilityData: DateAvailability[];
locale: string;
disablePastDates: boolean;
allowPreviousMonthNavigation: boolean;
showPrices: boolean;
allowSingleDay: boolean;
theme: "light" | "dark";
basePrice: number;
currency: string;
showPriceCalculation: boolean;
showSelectionErrors: boolean;
textLabels: CalendarTextLabels;
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>, {
legend?(_: {}): any;
}>;
export declare const HotelDashboardCalendar: DefineComponent<ExtractPropTypes<__VLS_WithDefaults_2<__VLS_TypePropsToRuntimeProps_2<DashboardCalendarProps>, {
selectedMonth: () => Date;
theme: string;
allowPreviousMonthNavigation: boolean;
textLabels: () => {};
}>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
"update:selectedMonth": (value: Date) => void;
"booking-click": (booking: Booking) => void;
"booking-create": (data: {
roomId: string;
date: string;
}) => void;
}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_WithDefaults_2<__VLS_TypePropsToRuntimeProps_2<DashboardCalendarProps>, {
selectedMonth: () => Date;
theme: string;
allowPreviousMonthNavigation: boolean;
textLabels: () => {};
}>>> & Readonly<{
"onUpdate:selectedMonth"?: ((value: Date) => any) | undefined;
"onBooking-click"?: ((booking: Booking) => any) | undefined;
"onBooking-create"?: ((data: {
roomId: string;
date: string;
}) => any) | undefined;
}>, {
allowPreviousMonthNavigation: boolean;
theme: "light" | "dark";
textLabels: DashboardTextLabels;
selectedMonth: Date;
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
export declare interface LegendOptions {
show?: boolean;
position?: 'top' | 'bottom';
}
declare const plugin: {
install(app: App): void;
};
export default plugin;
export declare interface PriceCalculation {
basePrice: number;
nights: number;
dailyPrices: {
date: string;
price: number;
}[];
totalPrice: number;
currency: string;
averagePerNight: number;
taxesAndFees?: number;
discounts?: number;
}
export declare type RecurrenceFrequency = 'daily' | 'weekly' | 'monthly' | 'yearly';
export declare interface RecurrencePattern {
frequency: RecurrenceFrequency;
interval: number;
endDate?: string;
endAfterOccurrences?: number;
daysOfWeek?: number[];
dayOfMonth?: number;
}
export declare interface ResourceEvent {
id: string;
title: string;
description?: string;
start: string;
end: string;
allDay?: boolean;
categoryId?: string;
color?: string;
backgroundColor?: string;
recurrence?: RecurrencePattern;
location?: string;
metadata?: Record<string, unknown>;
}
export declare const ResourceSchedulerCalendar: DefineComponent<ExtractPropTypes<__VLS_WithDefaults_3<__VLS_TypePropsToRuntimeProps_3<SchedulerCalendarProps>, {
events: () => never[];
categories: () => never[];
selectedDate: () => Date;
view: string;
theme: string;
locale: string;
timeInterval: number;
workingHours: () => {
start: number;
end: number;
daysOfWeek: number[];
};
showWeekNumbers: boolean;
showAllDaySlot: boolean;
allowEventCreation: boolean;
allowEventEditing: boolean;
allowEventDeletion: boolean;
firstDayOfWeek: number;
textLabels: () => {};
enabledViews: () => string[];
slotHeight: () => {
hourly: number;
daily: number;
weekly: number;
};
responsiveBreakpoints: () => {
mobile: number;
tablet: number;
desktop: number;
};
headerOptions: () => {
showNavigation: boolean;
showToday: boolean;
showViewSwitcher: boolean;
showTitle: boolean;
};
legendOptions: () => {
show: boolean;
position: string;
};
showCurrentTimeIndicator: boolean;
highlightToday: boolean;
highlightWeekends: boolean;
maxEventsPerSlot: number;
eventMinHeight: number;
compactMode: boolean;
}>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
"date-click": (date: string) => void;
"event-click": (event: ResourceEvent) => void;
"slot-click": (slot: TimeSlot) => void;
"update:selectedDate": (value: Date) => void;
"update:view": (value: SchedulerViewType) => void;
"event-create": (data: {
start: string;
end: string;
allDay?: boolean | undefined;
}) => void;
"event-update": (event: ResourceEvent) => void;
"event-delete": (eventId: string) => void;
"view-change": (view: SchedulerViewType) => void;
"date-range-change": (range: {
start: string;
end: string;
}) => void;
"conflict-detected": (conflict: EventConflict) => void;
}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_WithDefaults_3<__VLS_TypePropsToRuntimeProps_3<SchedulerCalendarProps>, {
events: () => never[];
categories: () => never[];
selectedDate: () => Date;
view: string;
theme: string;
locale: string;
timeInterval: number;
workingHours: () => {
start: number;
end: number;
daysOfWeek: number[];
};
showWeekNumbers: boolean;
showAllDaySlot: boolean;
allowEventCreation: boolean;
allowEventEditing: boolean;
allowEventDeletion: boolean;
firstDayOfWeek: number;
textLabels: () => {};
enabledViews: () => string[];
slotHeight: () => {
hourly: number;
daily: number;
weekly: number;
};
responsiveBreakpoints: () => {
mobile: number;
tablet: number;
desktop: number;
};
headerOptions: () => {
showNavigation: boolean;
showToday: boolean;
showViewSwitcher: boolean;
showTitle: boolean;
};
legendOptions: () => {
show: boolean;
position: string;
};
showCurrentTimeIndicator: boolean;
highlightToday: boolean;
highlightWeekends: boolean;
maxEventsPerSlot: number;
eventMinHeight: number;
compactMode: boolean;
}>>> & Readonly<{
"onDate-click"?: ((date: string) => any) | undefined;
"onEvent-click"?: ((event: ResourceEvent) => any) | undefined;
"onSlot-click"?: ((slot: TimeSlot) => any) | undefined;
"onUpdate:selectedDate"?: ((value: Date) => any) | undefined;
"onUpdate:view"?: ((value: SchedulerViewType) => any) | undefined;
"onEvent-create"?: ((data: {
start: string;
end: string;
allDay?: boolean | undefined;
}) => any) | undefined;
"onEvent-update"?: ((event: ResourceEvent) => any) | undefined;
"onEvent-delete"?: ((eventId: string) => any) | undefined;
"onView-change"?: ((view: SchedulerViewType) => any) | undefined;
"onDate-range-change"?: ((range: {
start: string;
end: string;
}) => any) | undefined;
"onConflict-detected"?: ((conflict: EventConflict) => any) | undefined;
}>, {
locale: string;
theme: "light" | "dark";
textLabels: SchedulerTextLabels;
view: SchedulerViewType;
events: ResourceEvent[];
categories: EventCategory[];
highlightToday: boolean;
firstDayOfWeek: 0 | 1 | 2 | 3 | 4 | 5 | 6;
highlightWeekends: boolean;
maxEventsPerSlot: number;
showWeekNumbers: boolean;
workingHours: WorkingHours;
timeInterval: TimeInterval;
showAllDaySlot: boolean;
showCurrentTimeIndicator: boolean;
slotHeight: SlotHeightConfig;
eventMinHeight: number;
selectedDate: Date;
allowEventCreation: boolean;
allowEventEditing: boolean;
allowEventDeletion: boolean;
enabledViews: SchedulerViewType[];
responsiveBreakpoints: ResponsiveBreakpoints;
headerOptions: HeaderOptions;
legendOptions: LegendOptions;
compactMode: boolean;
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
export declare interface ResponsiveBreakpoints {
mobile?: number;
tablet?: number;
desktop?: number;
}
export declare interface Room {
id: string;
number: string;
}
export declare interface SchedulerCalendarEmits {
'update:selectedDate': [value: Date];
'update:view': [value: SchedulerViewType];
'event-click': [event: ResourceEvent];
'event-create': [data: {
start: string;
end: string;
allDay?: boolean;
}];
'event-update': [event: ResourceEvent];
'event-delete': [eventId: string];
'slot-click': [slot: TimeSlot];
'date-click': [date: string];
'view-change': [view: SchedulerViewType];
'date-range-change': [range: {
start: string;
end: string;
}];
'conflict-detected': [conflict: EventConflict];
}
export declare interface SchedulerCalendarProps {
events?: ResourceEvent[];
categories?: EventCategory[];
selectedDate?: Date;
view?: SchedulerViewType;
theme?: 'light' | 'dark';
locale?: string;
timeInterval?: TimeInterval;
workingHours?: WorkingHours;
showWeekNumbers?: boolean;
showAllDaySlot?: boolean;
allowEventCreation?: boolean;
allowEventEditing?: boolean;
allowEventDeletion?: boolean;
minDate?: string | Date;
maxDate?: string | Date;
textLabels?: SchedulerTextLabels;
firstDayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
enabledViews?: SchedulerViewType[];
defaultView?: SchedulerViewType;
slotHeight?: SlotHeightConfig;
responsiveBreakpoints?: ResponsiveBreakpoints;
headerOptions?: HeaderOptions;
legendOptions?: LegendOptions;
showCurrentTimeIndicator?: boolean;
highlightToday?: boolean;
highlightWeekends?: boolean;
maxEventsPerSlot?: number;
eventMinHeight?: number;
compactMode?: boolean;
}
export declare interface SchedulerDay {
date: Date;
dateString: string;
isToday: boolean;
isCurrentMonth: boolean;
isCurrentWeek: boolean;
isWeekend: boolean;
isWorkingDay: boolean;
events: ResourceEvent[];
weekNumber?: number;
}
export declare interface SchedulerMonth {
date: Date;
month: number;
year: number;
name: string;
shortName: string;
eventCount: number;
hasEvents: boolean;
}
export declare interface SchedulerTextLabels {
today?: string;
previousPeriod?: string;
nextPeriod?: string;
yearView?: string;
monthView?: string;
weekView?: string;
dayView?: string;
hourView?: string;
allDay?: string;
noEvents?: string;
createEvent?: string;
editEvent?: string;
deleteEvent?: string;
eventDetails?: string;
conflictWarning?: string;
cancel?: string;
save?: string;
}
export declare interface SchedulerTimeSlot {
time: string;
hour: number;
minute: number;
isWorkingHour: boolean;
events: ResourceEvent[];
}
export declare type SchedulerViewType = 'yearly' | 'monthly' | 'weekly' | 'daily' | 'hourly';
export declare interface SelectionError {
type: 'blocked-dates-in-range' | 'min-stay-not-met' | 'max-stay-exceeded' | 'invalid-range' | 'checkout-only-in-range';
message: string;
blockedDates?: string[];
}
export declare interface SlotHeightConfig {
hourly?: number;
daily?: number;
weekly?: number;
}
export declare interface StatusConfig {
key: string;
label: string;
color: string;
backgroundColor: string;
darkBackgroundColor?: string;
}
export declare type TimeInterval = 15 | 30 | 60;
export declare interface TimeSlot {
start: string;
end: string;
date: string;
hour?: number;
minute?: number;
}
export declare interface WorkingHours {
start: number;
end: number;
daysOfWeek?: number[];
}
export { }