@digitalcrafted/vue-scheduler
Version:
A Vue 3 scheduler component with day/week/month/year views for displaying calendar events
127 lines (113 loc) • 4.02 kB
TypeScript
import { ComponentOptionsMixin } from 'vue';
import { ComponentProvideOptions } from 'vue';
import { ComputedRef } from 'vue';
import { DefineComponent } from 'vue';
import { ExtractPropTypes } from 'vue';
import { PropType } from 'vue';
import { PublicProps } from 'vue';
import { Ref } from 'vue';
declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
declare type __VLS_Prettify<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_WithDefaults<P, D> = {
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
default: D[K];
}> : P[K];
};
export declare interface DateRange {
start: Date;
end: Date;
}
declare const _default: DefineComponent<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<SchedulerProps>, {
viewMode: string;
dateLocale: undefined;
translations: () => {};
hideViewModeSelector: boolean;
}>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<SchedulerProps>, {
viewMode: string;
dateLocale: undefined;
translations: () => {};
hideViewModeSelector: boolean;
}>>> & Readonly<{}>, {
hideViewModeSelector: boolean;
viewMode: "day" | "week" | "month" | "year";
dateLocale: string;
translations: Record<string, string>;
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
export { _default as Scheduler }
export default _default;
export declare interface ProcessedEvent extends SchedulerEvent {
startDate: Date;
endDate: Date;
isAllDay: boolean;
duration: number;
}
export declare interface SchedulerEvent {
label: string;
start: string | Date | number;
end?: string | Date | number;
bgColor?: string;
id?: string | number;
}
export declare interface SchedulerProps {
events: SchedulerEvent[] | ((params: {
dateRange: DateRange;
setEvents: (events: SchedulerEvent[]) => void;
}) => void);
initialDate?: string | Date | number;
viewMode?: "day" | "week" | "month" | "year";
dateLocale?: string;
translations?: Record<string, string>;
hideViewModeSelector?: boolean;
}
export declare function useEvents(eventsInput: SchedulerEvent[] | ((params: {
dateRange: DateRange;
setEvents: (events: SchedulerEvent[]) => void;
}) => void), dateRange: Ref<DateRange>): {
events: Ref<{
startDate: Date;
endDate: Date;
isAllDay: boolean;
duration: number;
label: string;
start: string | Date | number;
end?: (string | Date | number) | undefined;
bgColor?: string | undefined;
id?: string | number | undefined;
}[], ProcessedEvent[] | {
startDate: Date;
endDate: Date;
isAllDay: boolean;
duration: number;
label: string;
start: string | Date | number;
end?: (string | Date | number) | undefined;
bgColor?: string | undefined;
id?: string | number | undefined;
}[]>;
visibleEvents: ComputedRef<ProcessedEvent[]>;
loading: Ref<boolean, boolean>;
reload: () => Promise<void>;
};
export declare function useScheduler(initialDate?: string | Date | number, initialViewMode?: ViewMode, locale?: string): {
currentDate: Ref<Date, Date>;
viewMode: Ref<ViewMode, ViewMode>;
periodLabel: ComputedRef<string>;
dateRange: ComputedRef<DateRange>;
goToToday: () => void;
goToPrevious: () => void;
goToNext: () => void;
setViewMode: (mode: ViewMode) => void;
setCurrentDate: (date: Date) => void;
};
declare type ViewMode = "day" | "week" | "month" | "year";
export { }