UNPKG

@fullcalendar/web-component

Version:
1,595 lines (1,519 loc) 73.7 kB
import { RawOptionsFromRefiners, RefinedOptionsFromRefiners, BaseOptionsRefined, EventRefiners, BaseOptions, EventSourceOptions, EventSourceOptionsRefined } from '@fullcalendar/core/protected-api'; import { NativeDateFormatterOptions, FuncDateFormatterFunc, Duration, DateTimeFormatPartWithWeek as DateTimeFormatPartWithWeek$1, DateMarker, DateInput, DurationInput, DateRangeInput, DateRange, CmdDateFormatterFunc, DateEnv, LocaleCodeArg, OpenDateRange, createDuration, WeekNumberCalculation, DateFormatter } from '@full-ui/headless-calendar'; import { ComponentType, ReactNode, Component } from 'preact/compat'; type FormatterInput = NativeDateFormatterOptions | string | FuncDateFormatterFunc; declare function createFormatter(input: FormatterInput): DateFormatter; interface PointerDragEvent { origEvent: UIEvent; isTouch: boolean; subjectEl: EventTarget; pageX: number; pageY: number; deltaX: number; deltaY: number; } interface OrderSpec<Subject> { field?: string; order?: number; func?: FieldSpecInputFunc<Subject>; } type FieldSpecInput<Subject> = string | string[] | FieldSpecInputFunc<Subject> | FieldSpecInputFunc<Subject>[]; type FieldSpecInputFunc<Subject> = (a: Subject, b: Subject) => number; declare function parseFieldSpecs<Subject>(input: FieldSpecInput<Subject>): OrderSpec<Subject>[]; interface ViewApi { calendar: CalendarApi; type: string; title: string; activeStart: Date; activeEnd: Date; currentStart: Date; currentEnd: Date; getOption(name: string): any; } interface EventSourceApi { id: string; url: string; format: string; remove(): void; refetch(): void; } interface EventInstance { instanceId: string; defId: string; range: DateRange; } type EventInstanceHash = { [instanceId: string]: EventInstance; }; type BusinessHoursInput = boolean | EventInput | EventInput[]; interface Rect { left: number; right: number; top: number; bottom: number; } type MountInfo<DisplayInfo> = DisplayInfo & { el: HTMLElement; }; type DidMountHandler<DisplayInfo> = (mountData: MountInfo<DisplayInfo>) => void; type WillUnmountHandler<DisplayInfo> = (mountData: MountInfo<DisplayInfo>) => void; interface ObjCustomContent { html?: string; domNodes?: any[]; } type CustomContent = ReactNode | ObjCustomContent; type ContentGenerator<RenderProps> = CustomContent | ((renderProps: RenderProps) => (CustomContent | true | void | undefined)); type ClassNameInput = string | undefined | null | false | 0; type ClassNameGenerator<RenderProps> = ClassNameInput | ((renderProps: RenderProps) => ClassNameInput); declare function refineClassName(input: unknown, optionName: string): ClassNameInput; interface EventInteractionState { affectedEvents: EventStore; mutatedEvents: EventStore; isEvent: boolean; } interface SplittableProps { businessHours: EventStore | null; dateSelection: DateSpan | null; eventStore: EventStore; eventUiBases: EventUiHash; eventDrag: EventInteractionState | null; eventResize: EventInteractionState | null; eventSelection: string; } interface DateMeta { dow: number; date: Date; isDisabled: boolean; isOther: boolean; isToday: boolean; isPast: boolean; isFuture: boolean; } type EventSourceSuccessResponseHandler = (this: CalendarApiImpl, rawData: any, response: any) => EventInput[] | void; type EventSourceErrorResponseHandler = (error: Error) => void; interface EventSource<Meta> { _raw: any; sourceId: string; sourceDefId: number; meta: Meta; publicId: string; isFetching: boolean; latestFetchId: string; fetchRange: DateRange | null; defaultAllDay: boolean | null; eventDataTransform: EventInputTransformer; ui: EventUi; success: EventSourceSuccessResponseHandler | null; failure: EventSourceErrorResponseHandler | null; extendedProps: Dictionary; } type EventSourceHash = { [sourceId: string]: EventSource<any>; }; interface EventSourceFetcherRes { rawEvents: EventInput[]; response?: Response; } type EventSourceFetcher<Meta> = (data: { eventSource: EventSource<Meta>; range: DateRange; isRefetch: boolean; context: CalendarContext; }, successCallback: (res: EventSourceFetcherRes) => void, errorCallback: (error: Error) => void) => void; type EqualityFunc<T> = (a: T, b: T) => boolean; type EqualityFuncs<P> = { [K in keyof P]?: EqualityFunc<P[K]>; }; declare abstract class PureComponent<Props = Dictionary, State = Dictionary> extends Component<Props, State> { static addPropsEquality: typeof addPropsEquality; static addStateEquality: typeof addStateEquality; static contextType: any; context: ViewContext; propEquality: EqualityFuncs<Props>; stateEquality: EqualityFuncs<State>; shouldComponentUpdate(nextProps: Props, nextState: State): boolean; } declare abstract class BaseComponent<Props = Dictionary, State = Dictionary> extends PureComponent<Props, State> { static contextType: any; context: ViewContext; } declare function addPropsEquality(this: { prototype: { propEquality: any; }; }, propEquality: any): void; declare function addStateEquality(this: { prototype: { stateEquality: any; }; }, stateEquality: any): void; interface ToolbarModel { sectionWidgets: { start: ToolbarWidget[][]; center: ToolbarWidget[][]; end: ToolbarWidget[][]; }; viewsWithButtons: string[]; hasTitle: boolean; } interface ToolbarInfo { borderlessX: boolean; borderlessTop: boolean; borderlessBottom: boolean; } interface ToolbarSectionInfo { name: string; } interface ButtonGroupInfo { hasSelection: boolean; } interface ButtonInfo { name: string; text: string; isPrimary: boolean; isSelected: boolean; isDisabled: boolean; isIconOnly: boolean; buttonGroup: ButtonGroupInfo | null; } type ButtonDisplay = 'auto' | 'icon' | 'text' | 'icon-text' | 'text-icon'; interface ButtonInput { didMount?: DidMountHandler<ButtonInfo>; willUnmount?: WillUnmountHandler<ButtonInfo>; click?: (ev: MouseEvent) => void; hint?: string | ((viewOrCurrentUnitText: string, viewOrCurrentUnit: string) => string); class?: ClassNameGenerator<ButtonInfo>; className?: ClassNameGenerator<ButtonInfo>; display?: ButtonDisplay; iconClass?: string | undefined; iconContent?: ContentGenerator<{}>; text?: string; isPrimary?: boolean; } interface ToolbarWidget { name: string; isView?: boolean; customElement?: ToolbarElementInput; buttonText?: string; buttonHint?: string | ((currentUnit: string) => string); buttonDisplay?: ButtonDisplay; buttonIconClass?: string | undefined; buttonIconContent?: ContentGenerator<{}>; buttonClick?: (ev: MouseEvent) => void; buttonIsPrimary?: boolean; buttonClass?: ClassNameGenerator<ButtonInfo>; buttonDidMount?: DidMountHandler<ButtonInfo>; buttonWillUnmount?: WillUnmountHandler<ButtonInfo>; } interface ToolbarInput { left?: string; center?: string; right?: string; start?: string; end?: string; } type ToolbarElementInput = ContentGenerator<{}>; interface ViewDisplayInfo { view: ViewApi; borderlessX: boolean; borderlessTop: boolean; borderlessBottom: boolean; options: { headerToolbar: ToolbarInput | false | undefined; footerToolbar: ToolbarInput | false | undefined; }; isHeightAuto: boolean; } interface ViewProps { className?: string; dateProfile: DateProfile; businessHours: EventStore; eventStore: EventStore; eventUiBases: EventUiHash; dateSelection: DateSpan | null; eventSelection: string; eventDrag: EventInteractionState | null; eventResize: EventInteractionState | null; forPrint: boolean; labelId: string | undefined; labelStr: string | undefined; } type ViewContentInfo = ViewProps & ViewDisplayInfo & { nextDayThreshold: Duration; }; declare function sliceEvents(props: ViewContentInfo, allDay?: boolean): EventRenderRange[]; type ViewComponentType = ComponentType<ViewProps>; type ViewConfigInput = ViewComponentType | ViewOptions; type ViewConfigInputHash = { [viewType: string]: ViewConfigInput; }; interface ViewSpec { type: string; component: ViewComponentType; duration: Duration; durationUnit: string; singleUnit: string; optionDefaults: ViewOptions; optionOverrides: ViewOptions; } type ViewSpecHash = { [viewType: string]: ViewSpec; }; interface HandlerFuncTypeHash { [eventName: string]: (...args: any[]) => any; } declare class Emitter<HandlerFuncs extends HandlerFuncTypeHash> { private handlers; private options; private thisContext; setThisContext(thisContext: any): void; setOptions(options: Partial<HandlerFuncs>): void; on<Prop extends keyof HandlerFuncs>(type: Prop, handler: HandlerFuncs[Prop]): void; off<Prop extends keyof HandlerFuncs>(type: Prop, handler?: HandlerFuncs[Prop]): void; trigger<Prop extends keyof HandlerFuncs>(type: Prop, ...args: Parameters<HandlerFuncs[Prop]>): void; hasHandlers(type: keyof HandlerFuncs): boolean; } declare class CalendarNowManager { private dateEnv?; private resetListeners; private nowAnchorDate?; private nowAnchorQueried?; private nowFn?; handleInput(dateEnv: DateEnv, // will change if timezone setup changed nowInput: DateInput | (() => DateInput)): void; getDateMarker(): DateMarker; addResetListener(handler: () => void): void; removeResetListener(handler: () => void): void; } interface CalendarDataManagerState { dynamicOptionOverrides: CalendarOptions; currentViewType: string; currentDate: DateMarker; dateProfile: DateProfile; businessHours: EventStore; eventSources: EventSourceHash; eventUiBases: EventUiHash; eventStore: EventStore; renderableEventStore: EventStore; dateSelection: DateSpan | null; eventSelection: string; eventDrag: EventInteractionState | null; eventResize: EventInteractionState | null; selectionConfig: EventUi; nowDate: DateMarker; } interface CalendarToolbarProps { title: string; selectedButton: string; navUnit: string; isTodayEnabled: boolean; isPrevEnabled: boolean; isNextEnabled: boolean; } interface CalendarOptionsData { localeDefaults: CalendarOptions; calendarOptions: CalendarOptionsRefined; toolbarConfig: { [toolbarName: string]: ToolbarModel; }; availableRawLocales: any; dateEnv: DateEnv; pluginHooks: PluginHooks; viewSpecs: ViewSpecHash; } interface CalendarCurrentViewData { viewSpec: ViewSpec; options: ViewOptionsRefined; viewApi: ViewImpl; dateProfileGenerator: DateProfileGenerator; } type CalendarDataBase = CalendarOptionsData & CalendarCurrentViewData & CalendarDataManagerState; interface CalendarData extends CalendarDataBase { nowManager: CalendarNowManager; viewTitle: string; calendarApi: CalendarApiImpl; dispatch: (action: Action) => void; emitter: Emitter<Required<CalendarListeners>>; getCurrentData(): CalendarData; toolbarProps: CalendarToolbarProps; } declare class ViewImpl implements ViewApi { type: string; private getCurrentData; private dateEnv; constructor(type: string, getCurrentData: () => CalendarData, dateEnv: DateEnv); get calendar(): CalendarApi; get title(): string; get activeStart(): Date; get activeEnd(): Date; get currentStart(): Date; get currentEnd(): Date; getOption(name: string): any; } interface Hit { componentId?: string; context?: ViewContext; dateProfile: DateProfile; dateSpan: DateSpan; getDayEl: () => HTMLElement; rect: Rect; layer: number; largeUnit?: string; } declare abstract class DateComponent<Props = Dictionary, State = Dictionary> extends BaseComponent<Props, State> { uid: string; prepareHits(): void; queryHit(isRtl: boolean, positionLeft: number, positionTop: number, elWidth: number, elHeight: number): Hit | null; isValidSegDownEl(el: HTMLElement): boolean; isValidDateDownEl(el: HTMLElement): boolean; } declare abstract class Interaction { component: DateComponent<any>; isHitComboAllowed: ((hit0: Hit, hit1: Hit) => boolean) | null; constructor(settings: InteractionSettings); destroy(): void; } type InteractionClass = { new (settings: InteractionSettings): Interaction; }; interface InteractionSettingsInput { el: HTMLElement; useEventCenter?: boolean; isHitComboAllowed?: (hit0: Hit, hit1: Hit) => boolean; disableHits?: boolean; } interface InteractionSettings { component: DateComponent<any>; el: HTMLElement; useEventCenter: boolean; isHitComboAllowed: ((hit0: Hit, hit1: Hit) => boolean) | null; } interface ViewContext extends CalendarContext { options: ViewOptionsRefined; dateProfileGenerator: DateProfileGenerator; viewSpec: ViewSpec; viewApi: ViewImpl; baseId: string; registerInteractiveComponent: (component: DateComponent<any>, settingsInput: InteractionSettingsInput) => void; unregisterInteractiveComponent: (component: DateComponent<any>) => void; } declare abstract class ElementDragging { emitter: Emitter<any>; constructor(el: HTMLElement, selector?: string); destroy(): void; abstract cancel(): void; setMirrorIsVisible(bool: boolean): void; setMirrorNeedsRevert(bool: boolean): void; setAutoScrollEnabled(bool: boolean): void; } type ElementDraggingClass = { new (el: HTMLElement, selector?: string): ElementDragging; }; interface CalendarContentProps extends CalendarData { toolbarProps: CalendarToolbarProps; forPrint: boolean; } interface ScrollerInterface { x: number; y: number; scrollTo(options: { x?: number; y?: number; }): void; addScrollStartListener(handler: () => void): void; removeScrollStartListener(handler: () => void): void; addScrollEndListener(handler: (isDevice: boolean) => void): void; removeScrollEndListener(handler: (isDevice: boolean) => void): void; } interface ScrollerSyncerClass { new (horizontal?: boolean): ScrollerSyncerInterface; } interface ScrollerSyncerInterface extends ScrollerInterface { handleChildren(scrollers: ScrollerInterface[]): void; destroy(): void; addScrollStartListener(handler: (isDevice: boolean) => void): void; removeScrollStartListener(handler: (isDevice: boolean) => void): void; addScrollListener(handler: (isDevice: boolean, scroll: number) => void): void; removeScrollListener(handler: (isDevice: boolean, scroll: number) => void): void; } type CssDimValue = string | number; interface NowIndicatorHeaderInfo { date: Date; view: ViewApi; } interface NowIndicatorLineInfo { date: Date; view: ViewApi; } interface MoreLinkInfo$1 { num: number; numericText: string; longText: string; text: string; isNarrow: boolean; view: ViewApi; } interface CalendarDisplayInfo { borderlessX: boolean; borderlessTop: boolean; borderlessBottom: boolean; } declare class Store<Value> { private handlers; private currentValue; set(value: Value): void; subscribe(handler: (value: Value) => void): void; } type CustomRenderingHandler<RenderProps> = (customRender: CustomRendering<RenderProps>) => void; interface CustomRendering<RenderProps> { id: string; isActive: boolean; containerEl: HTMLElement; generatorMeta: any; renderProps: RenderProps; } declare class CustomRenderingStore<RenderProps> extends Store<Map<string, CustomRendering<RenderProps>>> { private map; handle(customRendering: CustomRendering<RenderProps>): void; } interface SlotLaneInfo extends DateMeta { time?: Duration; isMajor: boolean; isMinor: boolean; view: ViewApi; } interface SlotHeaderInfo extends SlotLaneInfo { level: number; isTime: boolean; text: string; isNarrow: boolean; hasNavLink: boolean; isFirst: boolean; } interface AllDayHeaderInfo { text: string; view: ViewApi; isNarrow: boolean; } interface DayHeaderInfo extends DateMeta { date: Date; isNarrow: boolean; isMajor: boolean; inPopover: boolean; hasNavLink: boolean; level: number; text: string; textParts: DateTimeFormatPartWithWeek$1[]; weekdayText: string; dayNumberText: string; view: ViewApi; [otherProp: string]: any; } interface DayHeaderDividerInfo { isSticky: boolean; multiMonthColumns: number; options: { allDaySlot: boolean; }; } interface DayCellInfo extends DateMeta { date: DateMarker; isMajor: boolean; isNarrow: boolean; inPopover: boolean; hasNavLink: boolean; view: ViewApi; text: string; textParts: DateTimeFormatPartWithWeek$1[]; weekdayText: string; dayNumberText: string; monthText: string; options: { businessHours: boolean; }; [extraProp: string]: any; } type EventSourceFuncInfo = { start: Date; end: Date; startStr: string; endStr: string; timeZone: string; }; type EventSourceFunc = ((info: EventSourceFuncInfo, successCallback: (eventInputs: EventInput[]) => void, failureCallback: (error: Error) => void) => void) | ((info: EventSourceFuncInfo) => Promise<EventInput[]>); declare const JSON_FEED_EVENT_SOURCE_REFINERS: { method: StringConstructor; extraParams: Identity<Dictionary | (() => Dictionary)>; startParam: StringConstructor; endParam: StringConstructor; timeZoneParam: StringConstructor; }; declare const EVENT_SOURCE_REFINERS: { id: StringConstructor; defaultAllDay: BooleanConstructor; url: StringConstructor; format: StringConstructor; events: Identity<EventInput[] | EventSourceFunc>; eventDataTransform: Identity<EventInputTransformer>; success: Identity<EventSourceSuccessResponseHandler>; failure: Identity<EventSourceErrorResponseHandler>; }; type BuiltInEventSourceRefiners = typeof EVENT_SOURCE_REFINERS & typeof JSON_FEED_EVENT_SOURCE_REFINERS; type EventSourceInputObject = EventUiInput & EventSourceOptions; type EventSourceInput = EventSourceInputObject | // object in extended form EventInput[] | EventSourceFunc | // just a function string; type EventSourceRefined = EventUiRefined & EventSourceOptionsRefined; type DateTimeFormatPartWithWeek = Omit<Intl.DateTimeFormatPart, 'type'> & { type: Intl.DateTimeFormatPart['type'] | 'week'; }; interface WeekNumberHeaderInfo { num?: number; date?: Date; text: string; textParts: DateTimeFormatPartWithWeek[]; isNarrow: boolean; hasNavLink: boolean; options: { dayMinWidth: number | undefined; }; } interface InlineWeekNumberInfo { num: number; date: Date; text: string; textParts: DateTimeFormatPartWithWeek[]; isNarrow: boolean; hasNavLink: boolean; } interface EventSegment { event: EventApi; start: Date; end: Date; isStart: boolean; isEnd: boolean; } type MoreLinkAction = MoreLinkSimpleAction | MoreLinkHandler; type MoreLinkSimpleAction = 'popover' | 'week' | 'day' | 'timeGridWeek' | 'timeGridDay' | string; interface MoreLinkInfo { date: Date; allDay: boolean; allSegs: EventSegment[]; hiddenSegs: EventSegment[]; jsEvent: UIEvent; view: ViewApi; } type MoreLinkHandler = (info: MoreLinkInfo) => MoreLinkSimpleAction | void; interface DayLaneInfo extends DateMeta { date: DateMarker; isNarrow: boolean; isStack: boolean; isMajor: boolean; view: ViewApi; [extraProp: string]: any; } type TableDisplayInfo = { borderlessX: boolean; borderlessTop: boolean; borderlessBottom: boolean; multiMonthColumns: number; }; type TableHeaderInfo = TableDisplayInfo & { isSticky: boolean; }; type TableBodyInfo = TableDisplayInfo; interface EventClickInfo { el: HTMLElement; event: EventImpl; jsEvent: MouseEvent; view: ViewApi; } interface EventHoveringInfo { el: HTMLElement; event: EventImpl; jsEvent: MouseEvent; view: ViewApi; } interface DateSelectionApi extends DateSpanApi { jsEvent: UIEvent; view: ViewApi; } type DatePointTransform = (dateSpan: DateSpan, context: CalendarContext) => any; type DateSpanTransform = (dateSpan: DateSpan, context: CalendarContext) => any; type CalendarInteraction = { destroy: () => void; }; type CalendarInteractionClass = { new (context: CalendarContext): CalendarInteraction; }; type OptionChangeHandler = (propValue: any, context: CalendarContext) => void; type OptionChangeHandlerMap = { [propName: string]: OptionChangeHandler; }; interface DateSelectInfo extends DateSpanApi { jsEvent: MouseEvent | null; view: ViewApi; } interface DateUnselectInfo { jsEvent: MouseEvent; view: ViewApi; } type DatesSetInfo = RangeApiWithTimeZone & { view: ViewApi; }; interface EventAddInfo { event: EventImpl; relatedEvents: EventImpl[]; revert: () => void; } interface EventChangeInfo { oldEvent: EventImpl; event: EventImpl; relatedEvents: EventImpl[]; revert: () => void; } interface EventDropInfo extends EventChangeInfo { el: HTMLElement; delta: Duration; jsEvent: MouseEvent; view: ViewApi; } interface EventRemoveInfo { event: EventImpl; relatedEvents: EventImpl[]; revert: () => void; } interface ButtonState { text: string; hint: string; } interface NavButtonState extends ButtonState { isDisabled: boolean; } interface ButtonStateMap { today: NavButtonState; prev: NavButtonState; next: NavButtonState; prevYear: NavButtonState; nextYear: NavButtonState; [availableView: string]: ButtonState; } interface NoEventsInfo { text: string; view: ViewApi; } interface ListDayInfo extends DateMeta { isFirst: boolean; isLast: boolean; view: ViewApi; } interface ListDayHeaderInfo extends DateMeta { view: ViewApi; } interface ListDayEventsInfo extends DateMeta { view: ViewApi; } interface ListDayHeaderInnerInfo extends DateMeta { text: string; textParts: DateTimeFormatPartWithWeek$1[]; weekdayText: string; dayNumberText: string; hasNavLink: boolean; level: number; view: ViewApi; } interface SingleMonthInfo { multiMonthColumns: number; isFirst: boolean; isLast: boolean; } type SingleMonthHeaderInfo = { isSticky: boolean; isNarrow: boolean; hasNavLink: boolean; multiMonthColumns: number; }; type EventDragStopInfo = EventDragInfo; type EventDragStartInfo = EventDragInfo; interface EventDragInfo { el: HTMLElement; event: EventApi; jsEvent: MouseEvent; view: ViewApi; } type EventResizeStartInfo = EventResizeStartStopData; type EventResizeStopInfo = EventResizeStartStopData; interface EventResizeStartStopData { el: HTMLElement; event: EventApi; jsEvent: MouseEvent; view: ViewApi; } interface EventResizeDoneInfo extends EventChangeInfo { el: HTMLElement; startDelta: Duration; endDelta: Duration; jsEvent: MouseEvent; view: ViewApi; } interface DateClickInfo extends DatePointApi { dayEl: HTMLElement; jsEvent: MouseEvent; view: ViewApi; } interface DropInfo extends DatePointApi { draggedEl: HTMLElement; jsEvent: MouseEvent; view: ViewApi; } type EventReceiveInfo = EventReceiveLeaveData; type EventLeaveInfo = EventReceiveLeaveData; interface EventReceiveLeaveData { draggedEl: HTMLElement; event: EventApi; relatedEvents: EventApi[]; revert: () => void; view: ViewApi; } interface EventApi { source: EventSourceApi | null; start: Date | null; end: Date | null; startStr: string; endStr: string; id: string; groupId: string; allDay: boolean; title: string; url: string; display: string; startEditable: boolean; durationEditable: boolean; constraint: any; overlap: boolean; allow: any; color: string; contrastColor: string; className: string; extendedProps: Dictionary; setProp(name: string, val: any): void; setExtendedProp(name: string, val: any): void; setStart(startInput: DateInput, options?: { granularity?: string; maintainDuration?: boolean; }): void; setEnd(endInput: DateInput | null, options?: { granularity?: string; }): void; setDates(startInput: DateInput, endInput: DateInput | null, options?: { allDay?: boolean; granularity?: string; }): void; moveStart(deltaInput: DurationInput): void; moveEnd(deltaInput: DurationInput): void; moveDates(deltaInput: DurationInput): void; setAllDay(allDay: boolean, options?: { maintainDuration?: boolean; }): void; formatRange(formatInput: FormatterInput): any; remove(): void; toPlainObject(settings?: { collapseExtendedProps?: boolean; }): Dictionary; toJSON(): Dictionary; } interface CalendarApi { view: ViewApi; setOption<OptionName extends keyof CalendarOptions>(name: OptionName, val: CalendarOptions[OptionName]): void; getOption<OptionName extends keyof CalendarOptions>(name: OptionName): CalendarOptions[OptionName]; getAvailableLocaleCodes(): string[]; on<ListenerName extends keyof CalendarListeners>(handlerName: ListenerName, handler: Required<CalendarListeners>[ListenerName]): void; off<ListenerName extends keyof CalendarListeners>(handlerName: ListenerName, handler: Required<CalendarListeners>[ListenerName]): void; trigger<ListenerName extends keyof CalendarListeners>(handlerName: ListenerName, ...args: Parameters<Required<CalendarListeners>[ListenerName]>): void; changeView(viewType: string, dateOrRange?: DateRangeInput | DateInput): void; zoomTo(dateMarker: Date, viewType?: string): void; prev(): void; next(): void; prevYear(): void; nextYear(): void; today(): void; gotoDate(zonedDateInput: DateInput): void; incrementDate(deltaInput: DurationInput): void; getDate(): Date; formatDate(d: DateInput, formatter: FormatterInput): string; formatRange(d0: DateInput, d1: DateInput, settings: any): string; formatIso(d: DateInput, omitTime?: boolean): string; select(dateOrObj: DateInput | any, endDate?: DateInput): void; unselect(): void; addEvent(eventInput: EventInput, sourceInput?: EventSourceApi | string | boolean): EventApi | null; getEventById(id: string): EventApi | null; getEvents(): EventApi[]; removeAllEvents(): void; getEventSources(): EventSourceApi[]; getEventSourceById(id: string): EventSourceApi | null; addEventSource(sourceInput: EventSourceInput): EventSourceApi; removeAllEventSources(): void; refetchEvents(): void; scrollToTime(timeInput: DurationInput): void; } declare class CalendarController { private handleDateChange?; private calendarApi?; constructor(handleDateChange?: () => void); today(): void; prev(): void; next(): void; prevYear(): void; nextYear(): void; gotoDate(zonedDateInput: DateInput): void; incrementDate(duration: DurationInput): void; changeView(viewType: string): void; get view(): ViewApi | undefined; getDate(): Date | undefined; getButtonState(): ButtonStateMap; _setApi(calendarApi: CalendarApi | undefined): void; } declare class EventSourceImpl implements EventSourceApi { private context; internalEventSource: EventSource<any>; constructor(context: CalendarContext, internalEventSource: EventSource<any>); remove(): void; refetch(): void; get id(): string; get url(): string; get format(): string; } declare class EventImpl implements EventApi { _context: CalendarContext; _def: EventDef; _instance: EventInstance | null; constructor(context: CalendarContext, def: EventDef, instance?: EventInstance); setProp(name: string, val: any): void; setExtendedProp(name: string, val: any): void; setStart(startInput: DateInput, options?: { granularity?: string; maintainDuration?: boolean; }): void; setEnd(endInput: DateInput | null, options?: { granularity?: string; }): void; setDates(startInput: DateInput, endInput: DateInput | null, options?: { allDay?: boolean; granularity?: string; }): void; moveStart(deltaInput: DurationInput): void; moveEnd(deltaInput: DurationInput): void; moveDates(deltaInput: DurationInput): void; setAllDay(allDay: boolean, options?: { maintainDuration?: boolean; }): void; formatRange(formatInput: FormatterInput): string; mutate(mutation: EventMutation): void; remove(): void; get source(): EventSourceImpl | null; get start(): Date | null; get end(): Date | null; get startStr(): string; get endStr(): string; get id(): string; get groupId(): string; get allDay(): boolean; get title(): string; get url(): string; get display(): string; get startEditable(): boolean; get durationEditable(): boolean; get constraint(): string | EventStore; get overlap(): boolean; get allow(): AllowFunc; get color(): string; get contrastColor(): string; get className(): string; get extendedProps(): Dictionary; toPlainObject(settings?: { collapseExtendedProps?: boolean; }): Dictionary; toJSON(): Dictionary; } interface EventRenderRange extends EventTuple { ui: EventUi; range: DateRange; isStart: boolean; isEnd: boolean; } interface EventDisplayInfo { event: EventImpl; timeText: string; color: string; contrastColor: string; isDraggable: boolean; isStartResizable: boolean; isEndResizable: boolean; isMirror: boolean; isStart: boolean; isEnd: boolean; isFirst: boolean; isLast: boolean; isPast: boolean; isFuture: boolean; isToday: boolean; isSelected: boolean; isDragging: boolean; isResizing: boolean; isInteractive: boolean; view: ViewApi; isNarrow: boolean; isShort: boolean; level: number; timeClass: string; titleClass: string; options: { eventOverlap: boolean; }; } interface OpenDateSpanInput { start?: DateInput; end?: DateInput; allDay?: boolean; [otherProp: string]: any; } interface DateSpanInput extends OpenDateSpanInput { start: DateInput; end: DateInput; } interface OpenDateSpan { range: OpenDateRange; allDay: boolean; [otherProp: string]: any; } interface DateSpan extends OpenDateSpan { range: DateRange; } interface RangeApi { start: Date; end: Date; startStr: string; endStr: string; } interface DateSpanApi extends RangeApi { allDay: boolean; } interface RangeApiWithTimeZone extends RangeApi { timeZone: string; } interface DatePointApi { date: Date; dateStr: string; allDay: boolean; } type ConstraintInput = 'businessHours' | string | EventInput | EventInput[]; type Constraint = 'businessHours' | string | EventStore | false; type OverlapFunc = ((stillEvent: EventImpl, movingEvent: EventImpl | null) => boolean); type AllowFunc = (span: DateSpanApi, movingEvent: EventImpl | null) => boolean; type isPropsValidTester = (props: SplittableProps, context: CalendarContext) => boolean; declare const EVENT_UI_REFINERS: { display: StringConstructor; editable: BooleanConstructor; startEditable: BooleanConstructor; durationEditable: BooleanConstructor; constraint: Identity<any>; overlap: Identity<boolean>; allow: Identity<AllowFunc>; class: typeof refineClassName; className: typeof refineClassName; color: StringConstructor; contrastColor: StringConstructor; }; type BuiltInEventUiRefiners = typeof EVENT_UI_REFINERS; interface EventUiRefiners extends BuiltInEventUiRefiners { } type EventUiInput = RawOptionsFromRefiners<Required<EventUiRefiners>>; type EventUiRefined = RefinedOptionsFromRefiners<Required<EventUiRefiners>>; interface EventUi { display: string | null; startEditable: boolean | null; durationEditable: boolean | null; constraints: Constraint[]; overlap: boolean | null; allows: AllowFunc[]; color: string; contrastColor: string; className: string; } type EventUiHash = { [defId: string]: EventUi; }; interface EventDef { defId: string; sourceId: string; publicId: string; groupId: string; allDay: boolean; hasEnd: boolean; recurringDef: { typeId: number; typeData: any; duration: Duration | null; } | null; title: string; url: string; ui: EventUi; interactive?: boolean; extendedProps: Dictionary; } type EventDefHash = { [defId: string]: EventDef; }; interface EventStore { defs: EventDefHash; instances: EventInstanceHash; } interface EventMutation { datesDelta?: Duration; startDelta?: Duration; endDelta?: Duration; standardProps?: any; extendedProps?: any; } type eventDefMutationApplier = (eventDef: EventDef, mutation: EventMutation, context: CalendarContext) => void; type eventDragMutationMassager = (mutation: EventMutation, hit0: Hit, hit1: Hit) => void; type EventDropTransformers = (mutation: EventMutation, context: CalendarContext) => Dictionary; type eventIsDraggableTransformer = (val: boolean, eventDef: EventDef, eventUi: EventUi, context: CalendarContext) => boolean; type dateSelectionJoinTransformer = (hit0: Hit, hit1: Hit) => any; interface DragMeta { startTime: Duration | null; duration: Duration | null; create: boolean; sourceId: string; leftoverProps: Dictionary; } type ExternalDefTransform = (dateSpan: DateSpan, dragMeta: DragMeta) => any; interface EventSourceDef<Meta> { ignoreRange?: boolean; parseMeta: (refined: EventSourceRefined) => Meta | null; fetch: EventSourceFetcher<Meta>; } interface ParsedRecurring<RecurringData> { typeData: RecurringData; allDayGuess: boolean | null; duration: Duration | null; } interface RecurringType<RecurringData> { parse: (refined: EventRefined, dateEnv: DateEnv) => ParsedRecurring<RecurringData> | null; expand: (typeData: any, framingRange: DateRange, dateEnv: DateEnv) => DateMarker[]; } interface PluginInput { name: string; premiumReleaseDate?: string; deps?: PluginInput[]; reducers?: ReducerFunc[]; isLoadingFuncs?: ((state: Dictionary) => boolean)[]; contextInit?: (context: CalendarContext) => void; eventRefiners?: GenericRefiners; eventDefMemberAdders?: EventDefMemberAdder[]; eventSourceRefiners?: GenericRefiners; isDraggableTransformers?: eventIsDraggableTransformer[]; eventDragMutationMassagers?: eventDragMutationMassager[]; eventDefMutationAppliers?: eventDefMutationApplier[]; dateSelectionTransformers?: dateSelectionJoinTransformer[]; datePointTransforms?: DatePointTransform[]; dateSpanTransforms?: DateSpanTransform[]; views?: ViewConfigInputHash; viewPropsTransformers?: ViewPropsTransformerClass[]; isPropsValid?: isPropsValidTester; externalDefTransforms?: ExternalDefTransform[]; viewContainerAppends?: ViewContainerAppend[]; eventDropTransformers?: EventDropTransformers[]; componentInteractions?: InteractionClass[]; calendarInteractions?: CalendarInteractionClass[]; eventSourceDefs?: EventSourceDef<any>[]; cmdFormatter?: CmdDateFormatterFunc; recurringTypes?: RecurringType<any>[]; initialView?: string; elementDraggingImpl?: ElementDraggingClass; optionChangeHandlers?: OptionChangeHandlerMap; scrollerSyncerClass?: ScrollerSyncerClass; listenerRefiners?: GenericListenerRefiners; optionRefiners?: GenericRefiners; optionDefaults?: CalendarOptions; propSetHandlers?: { [propName: string]: (val: any, context: CalendarData) => void; }; } interface PluginHooks { premiumReleaseDate: Date | undefined; reducers: ReducerFunc[]; isLoadingFuncs: ((state: Dictionary) => boolean)[]; contextInit: ((context: CalendarContext) => void)[]; eventRefiners: GenericRefiners; eventDefMemberAdders: EventDefMemberAdder[]; eventSourceRefiners: GenericRefiners; isDraggableTransformers: eventIsDraggableTransformer[]; eventDragMutationMassagers: eventDragMutationMassager[]; eventDefMutationAppliers: eventDefMutationApplier[]; dateSelectionTransformers: dateSelectionJoinTransformer[]; datePointTransforms: DatePointTransform[]; dateSpanTransforms: DateSpanTransform[]; views: ViewConfigInputHash; viewPropsTransformers: ViewPropsTransformerClass[]; isPropsValid: isPropsValidTester | null; externalDefTransforms: ExternalDefTransform[]; viewContainerAppends: ViewContainerAppend[]; eventDropTransformers: EventDropTransformers[]; componentInteractions: InteractionClass[]; calendarInteractions: CalendarInteractionClass[]; eventSourceDefs: EventSourceDef<any>[]; cmdFormatter?: CmdDateFormatterFunc; recurringTypes: RecurringType<any>[]; initialView: string; elementDraggingImpl?: ElementDraggingClass; optionChangeHandlers: OptionChangeHandlerMap; scrollerSyncerClass: ScrollerSyncerClass | null; listenerRefiners: GenericListenerRefiners; optionRefiners: GenericRefiners; optionDefaults: CalendarOptions[]; propSetHandlers: { [propName: string]: (val: any, context: CalendarData) => void; }; } type ViewPropsTransformerClass = new () => ViewPropsTransformer; interface ViewPropsTransformer { transform(viewProps: ViewProps, calendarProps: CalendarContentProps): any; } type ViewContainerAppend = (context: CalendarContext) => ReactNode; interface CalendarContext { nowManager: CalendarNowManager; dateEnv: DateEnv; options: BaseOptionsRefined; pluginHooks: PluginHooks; emitter: Emitter<Required<CalendarListeners>>; dispatch(action: Action): void; getCurrentData(): CalendarData; calendarApi: CalendarApiImpl; } declare const EVENT_REFINERS: { extendedProps: Identity<Dictionary>; start: Identity<DateInput>; end: Identity<DateInput>; date: Identity<DateInput>; allDay: BooleanConstructor; id: StringConstructor; groupId: StringConstructor; title: StringConstructor; url: StringConstructor; interactive: BooleanConstructor; }; type BuiltInEventRefiners = typeof EVENT_REFINERS; type EventInput = EventUiInput & RawOptionsFromRefiners<Required<EventRefiners>> & // Required hack { [extendedProp: string]: any; }; type EventRefined = EventUiRefined & RefinedOptionsFromRefiners<Required<EventRefiners>>; interface EventTuple { def: EventDef; instance: EventInstance | null; } type EventInputTransformer = (input: EventInput) => EventInput; type EventDefMemberAdder = (refined: EventRefined) => Partial<EventDef>; type Action = { type: 'IDLE'; } | // hack { type: 'UPDATE_NOW'; } | { type: 'SET_OPTION'; optionName: string; rawOptionValue: any; } | // TODO: how to link this to CalendarOptions? { type: 'RESET_OPTIONS'; } | { type: 'PREV'; } | { type: 'NEXT'; } | { type: 'CHANGE_DATE'; dateMarker: DateMarker; } | { type: 'CHANGE_VIEW_TYPE'; viewType: string; dateMarker?: DateMarker; } | { type: 'SELECT_DATES'; selection: DateSpan; } | { type: 'UNSELECT_DATES'; } | { type: 'SELECT_EVENT'; eventInstanceId: string; } | { type: 'UNSELECT_EVENT'; } | { type: 'SET_EVENT_DRAG'; state: EventInteractionState; } | { type: 'UNSET_EVENT_DRAG'; } | { type: 'SET_EVENT_RESIZE'; state: EventInteractionState; } | { type: 'UNSET_EVENT_RESIZE'; } | { type: 'ADD_EVENT_SOURCES'; sources: EventSource<any>[]; } | { type: 'REMOVE_EVENT_SOURCE'; sourceId: string; } | { type: 'REMOVE_ALL_EVENT_SOURCES'; } | { type: 'FETCH_EVENT_SOURCES'; sourceIds?: string[]; isRefetch?: boolean; } | // if no sourceIds, fetch all { type: 'RECEIVE_EVENTS'; sourceId: string; fetchId: string; fetchRange: DateRange | null; rawEvents: EventInput[]; } | { type: 'RECEIVE_EVENT_ERROR'; sourceId: string; fetchId: string; fetchRange: DateRange | null; error: Error; } | // need all these? { type: 'ADD_EVENTS'; eventStore: EventStore; } | { type: 'RESET_EVENTS'; eventStore: EventStore; } | { type: 'RESET_RAW_EVENTS'; rawEvents: EventInput[]; sourceId: string; } | { type: 'MERGE_EVENTS'; eventStore: EventStore; } | { type: 'REMOVE_EVENTS'; eventStore: EventStore; } | { type: 'REMOVE_ALL_EVENTS'; }; interface CalendarDataManagerConfig { calendarApi: CalendarApiImpl; onDataChange?: (data: CalendarData, actionsComplete: Action[]) => void; } type ReducerFunc = (currentState: Dictionary | undefined, action: Action | undefined, context: CalendarContext & CalendarDataManagerState) => Dictionary; declare class CalendarDataManager { private computeCurrentViewData; private organizeRawLocales; private buildLocale; private buildPluginHooks; private buildDateEnv; private parseToolbars; private buildViewSpecs; private buildDateProfileGenerator; private buildViewApi; private buildViewUiProps; private buildEventUiBySource; private buildEventUiBases; private parseContextBusinessHours; private buildToolbarProps; private buildTitle; private nowManager; private nowTimer; private isDrainingActionQueue; private actionQueue; private optionOverrides; private config; private state; private data; emitter: Emitter<Required<CalendarListeners>>; currentCalendarOptionsRefiners: any; currentCalendarOptionsInput: CalendarOptions; private currentCalendarOptionsRefined; private currentViewOptionsInput; private currentViewOptionsRefined; private stableOptionOverrides; private stableDynamicOptionOverrides; private stableCalendarOptionsData; private optionsForRefining; private optionsForHandling; constructor(config: CalendarDataManagerConfig); destroy(): void; update(optionOverrides: CalendarOptions): CalendarData; resetOptions(optionOverrides: CalendarOptions, changedOptionNames?: string[]): void; getCurrentData: () => CalendarData; private handleNowChange; dispatch: (action: Action) => void; private drainActionQueue; private reduce; private computeOptionsData; private processRawCalendarOptions; private _computeCurrentViewData; private processRawViewOptions; } declare class CalendarApiImpl implements CalendarApi { currentDataManager?: CalendarDataManager; getCurrentData(): CalendarData; dispatch(action: Action): void; get view(): ViewImpl; batchRendering(callback: () => void): void; setOption<OptionName extends keyof CalendarOptions>(name: OptionName, val: CalendarOptions[OptionName]): void; getOption<OptionName extends keyof CalendarOptions>(name: OptionName): CalendarOptions[OptionName]; getAvailableLocaleCodes(): string[]; on<ListenerName extends keyof CalendarListeners>(handlerName: ListenerName, handler: Required<CalendarListeners>[ListenerName]): void; off<ListenerName extends keyof CalendarListeners>(handlerName: ListenerName, handler: Required<CalendarListeners>[ListenerName]): void; trigger<ListenerName extends keyof CalendarListeners>(handlerName: ListenerName, ...args: Parameters<Required<CalendarListeners>[ListenerName]>): void; changeView(viewType: string, dateOrRange?: DateRangeInput | DateInput): void; zoomTo(dateMarker: Date, viewType?: string): void; private getUnitViewSpec; prev(): void; next(): void; prevYear(): void; nextYear(): void; today(): void; gotoDate(zonedDateInput: DateInput): void; incrementDate(deltaInput: DurationInput): void; getDate(): Date; formatDate(d: DateInput, formatter: FormatterInput): string; formatRange(d0: DateInput, d1: DateInput, settings: any): string; formatIso(d: DateInput, omitTime?: boolean): string; select(dateOrObj: DateInput | any, endDate?: DateInput): void; unselect(pev?: PointerDragEvent): void; addEvent(eventInput: EventInput, sourceInput?: EventSourceImpl | string | boolean): EventImpl | null; private triggerEventAdd; getEventById(id: string): EventImpl | null; getEvents(): EventImpl[]; removeAllEvents(): void; getEventSources(): EventSourceImpl[]; getEventSourceById(id: string): EventSourceImpl | null; addEventSource(sourceInput: EventSourceInput): EventSourceImpl; removeAllEventSources(): void; refetchEvents(): void; scrollToTime(timeInput: DurationInput): void; getButtonState(): ButtonStateMap; } interface DateProfile { currentDate: DateMarker; isValid: boolean; validRange: OpenDateRange; renderRange: DateRange; activeRange: DateRange | null; currentRange: DateRange; currentRangeUnit: string; isRangeAllDay: boolean; dateIncrement: Duration; slotMinTime: Duration; slotMaxTime: Duration; } interface DateProfileGeneratorProps extends DateProfileOptions { dateProfileGeneratorClass: DateProfileGeneratorClass; duration: Duration; durationUnit: string; usesMinMaxTime: boolean; dateEnv: DateEnv; calendarApi: CalendarApiImpl; } interface DateProfileOptions { slotMinTime: Duration; slotMaxTime: Duration; showNonCurrentDates?: boolean; dayCount?: number; dateAlignment?: string; dateIncrement?: Duration; hiddenDays?: number[]; weekends?: boolean; validRangeInput?: DateRangeInput | ((this: CalendarApiImpl, nowDate: Date) => DateRangeInput); visibleRangeInput?: DateRangeInput | ((this: CalendarApiImpl, nowDate: Date) => DateRangeInput); fixedWeekCount?: boolean; } type DateProfileGeneratorClass = { new (props: DateProfileGeneratorProps): DateProfileGenerator; }; declare class DateProfileGenerator { protected props: DateProfileGeneratorProps; isHiddenDayHash: boolean[]; constructor(props: DateProfileGeneratorProps); buildPrev(currentDateProfile: DateProfile, currentDate: DateMarker, nowDate: DateMarker, forceToValid?: boolean): DateProfile; buildNext(currentDateProfile: DateProfile, currentDate: DateMarker, nowDate: DateMarker, forceToValid?: boolean): DateProfile; build(currentDate: DateMarker, nowDate: DateMarker, direction?: any, forceToValid?: boolean): DateProfile; buildValidRange(nowDate: DateMarker): OpenDateRange; buildCurrentRangeInfo(date: DateMarker, direction: any): { duration: any; unit: any; range: any; }; getFallbackDuration(): Duration; adjustActiveRange(range: DateRange): { start: Date; end: Date; }; buildRangeFromDuration(date: DateMarker, direction: any, duration: Duration, unit: any): any; buildRangeFromDayCount(date: DateMarker, direction: any, dayCount: any): { start: Date; end: Date; }; buildCustomVisibleRange(date: DateMarker): DateRange; buildRenderRange(currentRange: DateRange, currentRangeUnit: any, isRangeAllDay: any): DateRange; buildDateIncrement(fallback: any): Duration; refineRange(rangeInput: DateRangeInput | undefined): DateRange | null; initHiddenDays(): void; trimHiddenDays(range: DateRange): DateRange | null; isHiddenDay(day: any): boolean; skipHiddenDays(date: DateMarker, inc?: number, isExclusive?: boolean): Date; } declare const BASE_OPTION_REFINERS: { navLinkDayClick: Identity<string | ((this: CalendarApi, date: Date, jsEvent: UIEvent) => void)>; navLinkWeekClick: Identity<string | ((this: CalendarApi, weekStart: Date, jsEvent: UIEvent) => void)>; duration: typeof createDuration; buttons: Identity<Partial<{ today: ButtonInput; prev: ButtonInput; next: ButtonInput; prevYear: ButtonInput; nextYear: ButtonInput; year: ButtonInput; month: ButtonInput; week: ButtonInput; day: ButtonInput; [buttonName: string]: ButtonInput; }>>; toolbarElements: Identity<{ [elementName: string]: ToolbarElementInput; }>; prevText: StringConstructor; nextText: StringConstructor; prevYearText: StringConstructor; nextYearText: StringConstructor; todayText: StringConstructor; yearText: StringConstructor; monthText: StringConstructor; weekTextLong: StringConstructor; weekTextShort: StringConstructor; dayText: StringConstructor; listText: Identity<string | false>; todayHint: Identity<string | ((currentUnitText: string, currentUnit: string) => string)>; prevHint: Identity<string | ((currentUnitText: string, currentUnit: string) => string)>; nextHint: Identity<string | ((currentUnitText: string, currentUnit: string) => string)>; buttonDisplay: Identity<ButtonDisplay>; buttonGroupClass: Identity<ClassNameGenerator<ButtonGroupInfo>>; buttonClass: Identity<ClassNameGenerator<ButtonInfo>>; defaultAllDayEventDuration: typeof createDuration; defaultTimedEventDuration: typeof createDuration; nextDayThreshold: typeof createDuration; scrollTime: typeof createDuration; scrollTimeReset: BooleanConstructor; slotMinTime: typeof createDuration; slotMaxTime: typeof createDuration; popoverFormat: typeof createFormatter; slotDuration: typeof createDuration; snapDuration: typeof createDuration; headerToolbar: Identity<ToolbarInput | false>; footerToolbar: Identity<ToolbarInput | false>; forceEventDuration: BooleanConstructor; dayLaneClass: Identity<ClassNameGen