Correct onSelect signature for unenhanced calendars

This commit is contained in:
Christian Chown
2018-11-27 12:05:37 +00:00
parent d418385331
commit 97c9978a56
+16 -7
View File
@@ -8,6 +8,21 @@ import * as React from 'react';
export type DateType = Date | string | number;
export enum EVENT_TYPE {
START = 1,
HOVER,
END
}
export interface RangedSelection {
eventType: EVENT_TYPE;
start: Date;
end: Date;
}
type RangedSelectFunction = (rangedDate: RangedSelection) => void;
type DateSelectFunction = (date: string) => void;
export interface ReactInfiniteCalendarProps {
selected?: DateType | false | { start: DateType; end: DateType };
width?: number | 'auto' | '100%';
@@ -57,7 +72,7 @@ export interface ReactInfiniteCalendarProps {
weekdayColor?: string;
};
className?: string;
onSelect?: (date: string | { eventType: EVENT_TYPE; start: Date; end: Date }) => void;
onSelect?: DateSelectFunction | RangedSelectFunction;
onScroll?: (scrollTop: number) => void;
onScrollEnd?: (scrollTop: number) => void;
rowHeight?: number;
@@ -75,10 +90,4 @@ export function withMultipleDates(component: CalendarClass): CalendarClass;
export function withKeyboardSupport(component: CalendarClass): CalendarClass;
export function defaultMultipleDateInterpolation(component: CalendarClass): CalendarClass;
export enum EVENT_TYPE {
START = 1,
HOVER,
END
}
export default class ReactInfiniteCalendar extends React.Component<ReactInfiniteCalendarProps> {}