UNPKG

geecko-react-appointment-picker

Version:

A React component to pick appointments.

89 lines (86 loc) 3.83 kB
import { Component } from 'react'; declare type IdentifierType = string | number; interface AddedAppointmentInterface { day: string; number: IdentifierType; time: string; id?: IdentifierType; } declare type AddCallbackType = (day: string, number: IdentifierType, time: string, id?: IdentifierType) => void; declare type RemoveCallbackType = (day: string, number: IdentifierType) => void; interface SimpleAddCaseInterface { addedAppointment: AddedAppointmentInterface; addCb: AddCallbackType; } interface ContinuousAddCaseInterface extends SimpleAddCaseInterface { removedAppointment: AddedAppointmentInterface; removeCb: RemoveCallbackType; } declare type AddAppointmentType = (args: ContinuousAddCaseInterface | SimpleAddCaseInterface) => void; declare type RemoveAppointmentType = (appointment: AddedAppointmentInterface, removeCb: RemoveCallbackType) => void; interface DefaultPropsInterface { addAppointmentCallback: AddAppointmentType; removeAppointmentCallback: RemoveAppointmentType; maxReservableAppointments: number; initialDay: Date; unitTime: number; local: string; localeTimeOptions: Object; } declare type AppointmentAttributesType = { id?: IdentifierType; number: IdentifierType; isReserved?: boolean; isOptioned?: boolean; isSelected?: boolean; periods?: number; } | null; interface AppointmentPickerPropsInterface { addAppointmentCallback?: AddAppointmentType; removeAppointmentCallback?: RemoveAppointmentType; alpha?: boolean; continuous?: boolean; selectedByDefault?: boolean; maxReservableAppointments?: number; initialDay?: Date; unitTime?: number; local?: string; localeTimeOptions?: Object; visible?: boolean; loading?: boolean; days: AppointmentAttributesType[][]; } interface SelectedAppointmentInterface { time: string; id?: IdentifierType; } declare type SelectedAppointmentMapType = Map<string, Map<IdentifierType, SelectedAppointmentInterface>>; interface AppointmentPickerStateInterface { selectedAppointments: SelectedAppointmentMapType; size: number; dayPeriods: number[]; dayLength: number; } declare class AppointmentPicker extends Component<AppointmentPickerPropsInterface, AppointmentPickerStateInterface> { static defaultProps: DefaultPropsInterface; constructor(props: AppointmentPickerPropsInterface); static getDerivedStateFromProps(props: AppointmentPickerPropsInterface, state: AppointmentPickerStateInterface): { selectedAppointments: Map<any, any>; size: number; }; shouldComponentUpdate(nextProps: AppointmentPickerPropsInterface, nextState: AppointmentPickerStateInterface): boolean; getAlreadySelectedAppointments: () => { selectedAppointments: Map<any, any>; size: number; }; includeAppointment: (selectedAppointments: SelectedAppointmentMapType, day: string, number: IdentifierType) => boolean; addAppointment: (selectedAppointments: SelectedAppointmentMapType, day: string, number: IdentifierType, time: string, id?: IdentifierType) => void; deleteAppointment: (day: string, number: IdentifierType) => void; acceptSelection: (day: string, number: IdentifierType, time: string, id?: IdentifierType) => void; acceptDeselection: (day: string, number: IdentifierType) => void; selectAppointment: (day: string, number: IdentifierType, time: string, id?: IdentifierType) => void; render(): JSX.Element; renderDays(): JSX.Element[]; renderAppointments(appointments: AppointmentAttributesType[], dayNumber: string, isDaySelected: boolean, periods: number, actualDay: Date): JSX.Element[]; } export { AppointmentAttributesType, AppointmentPicker };