UNPKG

@fullcalendar/core

Version:

FullCalendar core package for rendering a calendar

1,445 lines (1,379 loc) 107 kB
import * as preact from 'preact'; import { ComponentChildren, ComponentType, Context, Ref, Component, VNode, createElement, JSX, ComponentChild, FunctionalComponent, RefObject } from './preact.js'; import { ViewApi as ViewApi$1 } from './index.js'; type DurationInput = DurationObjectInput | string | number; interface DurationObjectInput { years?: number; year?: number; months?: number; month?: number; weeks?: number; week?: number; days?: number; day?: number; hours?: number; hour?: number; minutes?: number; minute?: number; seconds?: number; second?: number; milliseconds?: number; millisecond?: number; ms?: number; } interface Duration { years: number; months: number; days: number; milliseconds: number; specifiedWeeks?: boolean; } declare function createDuration(input: DurationInput, unit?: string): Duration | null; declare function asCleanDays(dur: Duration): number; declare function addDurations(d0: Duration, d1: Duration): { years: number; months: number; days: number; milliseconds: number; }; declare function multiplyDuration(d: Duration, n: number): { years: number; months: number; days: number; milliseconds: number; }; declare function asRoughMinutes(dur: Duration): number; declare function asRoughSeconds(dur: Duration): number; declare function asRoughMs(dur: Duration): number; declare function wholeDivideDurations(numerator: Duration, denominator: Duration): number; declare function greatestDurationDenominator(dur: Duration): { unit: string; value: number; }; type DateMarker = Date; declare function addWeeks(m: DateMarker, n: number): Date; declare function addDays(m: DateMarker, n: number): Date; declare function addMs(m: DateMarker, n: number): Date; declare function diffWeeks(m0: any, m1: any): number; declare function diffDays(m0: any, m1: any): number; declare function diffDayAndTime(m0: DateMarker, m1: DateMarker): Duration; declare function diffWholeWeeks(m0: DateMarker, m1: DateMarker): number; declare function diffWholeDays(m0: DateMarker, m1: DateMarker): number; declare function startOfDay(m: DateMarker): DateMarker; declare function isValidDate(m: DateMarker): boolean; interface CalendarSystem { getMarkerYear(d: DateMarker): number; getMarkerMonth(d: DateMarker): number; getMarkerDay(d: DateMarker): number; arrayToMarker(arr: number[]): DateMarker; markerToArray(d: DateMarker): number[]; } type LocaleCodeArg = string | string[]; type LocaleSingularArg = LocaleCodeArg | LocaleInput; interface Locale { codeArg: LocaleCodeArg; codes: string[]; week: { dow: number; doy: number; }; simpleNumberFormat: Intl.NumberFormat; options: CalendarOptionsRefined; } interface LocaleInput extends CalendarOptions { code: string; } type LocaleInputMap = { [code: string]: LocaleInput; }; interface RawLocaleInfo { map: LocaleInputMap; defaultCode: string; } interface ZonedMarker { marker: DateMarker; timeZoneOffset: number; } interface ExpandedZonedMarker extends ZonedMarker { array: number[]; year: number; month: number; day: number; hour: number; minute: number; second: number; millisecond: number; } interface VerboseFormattingArg { date: ExpandedZonedMarker; start: ExpandedZonedMarker; end?: ExpandedZonedMarker; timeZone: string; localeCodes: string[]; defaultSeparator: string; } type CmdFormatterFunc = (cmd: string, arg: VerboseFormattingArg) => string; interface DateFormattingContext { timeZone: string; locale: Locale; calendarSystem: CalendarSystem; computeWeekNumber: (d: DateMarker) => number; weekText: string; weekTextLong: string; cmdFormatter?: CmdFormatterFunc; defaultSeparator: string; } interface DateFormatter { format(date: ZonedMarker, context: DateFormattingContext): string; formatRange(start: ZonedMarker, end: ZonedMarker, context: DateFormattingContext, betterDefaultSeparator?: string): string; } interface NativeFormatterOptions extends Intl.DateTimeFormatOptions { week?: 'long' | 'short' | 'narrow' | 'numeric'; meridiem?: 'lowercase' | 'short' | 'narrow' | boolean; omitZeroMinute?: boolean; omitCommas?: boolean; separator?: string; } type FuncFormatterFunc = (arg: VerboseFormattingArg) => string; type FormatterInput = NativeFormatterOptions | string | FuncFormatterFunc; declare function createFormatter(input: FormatterInput): DateFormatter; declare function guid(): string; declare function disableCursor(): void; declare function enableCursor(): void; declare function preventSelection(el: HTMLElement): void; declare function allowSelection(el: HTMLElement): void; declare function preventContextMenu(el: HTMLElement): void; declare function allowContextMenu(el: HTMLElement): void; 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>[]; declare function compareByFieldSpecs<Subject>(obj0: Subject, obj1: Subject, fieldSpecs: OrderSpec<Subject>[]): number; declare function flexibleCompare(a: any, b: any): number; declare function padStart(val: any, len: any): string; declare function compareNumbers(a: any, b: any): number; declare function isInt(n: any): boolean; 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; } declare abstract class NamedTimeZoneImpl { timeZoneName: string; constructor(timeZoneName: string); abstract offsetForArray(a: number[]): number; abstract timestampToArray(ms: number): number[]; } type NamedTimeZoneImplClass = { new (timeZoneName: string): NamedTimeZoneImpl; }; type WeekNumberCalculation = 'local' | 'ISO' | ((m: Date) => number); interface DateEnvSettings { timeZone: string; namedTimeZoneImpl?: NamedTimeZoneImplClass; calendarSystem: string; locale: Locale; weekNumberCalculation?: WeekNumberCalculation; firstDay?: number; weekText?: string; weekTextLong?: string; cmdFormatter?: CmdFormatterFunc; defaultSeparator?: string; } type DateInput = Date | string | number | number[]; interface DateMarkerMeta { marker: DateMarker; isTimeUnspecified: boolean; forcedTzo: number | null; } declare class DateEnv { timeZone: string; namedTimeZoneImpl: NamedTimeZoneImpl; canComputeOffset: boolean; calendarSystem: CalendarSystem; locale: Locale; weekDow: number; weekDoy: number; weekNumberFunc: any; weekText: string; weekTextLong: string; cmdFormatter?: CmdFormatterFunc; defaultSeparator: string; constructor(settings: DateEnvSettings); createMarker(input: DateInput): DateMarker; createNowMarker(): DateMarker; createMarkerMeta(input: DateInput): DateMarkerMeta; parse(s: string): { marker: Date; isTimeUnspecified: boolean; forcedTzo: any; }; getYear(marker: DateMarker): number; getMonth(marker: DateMarker): number; getDay(marker: DateMarker): number; add(marker: DateMarker, dur: Duration): DateMarker; subtract(marker: DateMarker, dur: Duration): DateMarker; addYears(marker: DateMarker, n: number): Date; addMonths(marker: DateMarker, n: number): Date; diffWholeYears(m0: DateMarker, m1: DateMarker): number; diffWholeMonths(m0: DateMarker, m1: DateMarker): number; greatestWholeUnit(m0: DateMarker, m1: DateMarker): { unit: string; value: number; }; countDurationsBetween(m0: DateMarker, m1: DateMarker, d: Duration): number; startOf(m: DateMarker, unit: string): Date; startOfYear(m: DateMarker): DateMarker; startOfMonth(m: DateMarker): DateMarker; startOfWeek(m: DateMarker): DateMarker; computeWeekNumber(marker: DateMarker): number; format(marker: DateMarker, formatter: DateFormatter, dateOptions?: { forcedTzo?: number; }): string; formatRange(start: DateMarker, end: DateMarker, formatter: DateFormatter, dateOptions?: { forcedStartTzo?: number; forcedEndTzo?: number; isEndExclusive?: boolean; defaultSeparator?: string; }): string; formatIso(marker: DateMarker, extraOptions?: any): string; timestampToMarker(ms: number): Date; offsetForMarker(m: DateMarker): number; toDate(m: DateMarker, forcedTzo?: number): Date; } interface DateRangeInput { start?: DateInput; end?: DateInput; } interface OpenDateRange { start: DateMarker | null; end: DateMarker | null; } interface DateRange { start: DateMarker; end: DateMarker; } declare function intersectRanges(range0: OpenDateRange, range1: OpenDateRange): OpenDateRange; declare function rangesEqual(range0: OpenDateRange, range1: OpenDateRange): boolean; declare function rangesIntersect(range0: OpenDateRange, range1: OpenDateRange): boolean; declare function rangeContainsRange(outerRange: OpenDateRange, innerRange: OpenDateRange): boolean; declare function rangeContainsMarker(range: OpenDateRange, date: DateMarker | number): boolean; interface EventInstance { instanceId: string; defId: string; range: DateRange; forcedStartTzo: number | null; forcedEndTzo: number | null; } type EventInstanceHash = { [instanceId: string]: EventInstance; }; declare function createEventInstance(defId: string, range: DateRange, forcedStartTzo?: number, forcedEndTzo?: number): EventInstance; interface PointerDragEvent { origEvent: UIEvent; isTouch: boolean; subjectEl: EventTarget; pageX: number; pageY: number; deltaX: number; deltaY: number; } interface EventMutation { datesDelta?: Duration; startDelta?: Duration; endDelta?: Duration; standardProps?: any; extendedProps?: any; } declare function applyMutationToEventStore(eventStore: EventStore, eventConfigBase: EventUiHash, mutation: EventMutation, context: CalendarContext): EventStore; type eventDefMutationApplier = (eventDef: EventDef, mutation: EventMutation, context: CalendarContext) => 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 backgroundColor(): string; get borderColor(): string; get textColor(): string; get classNames(): string[]; get extendedProps(): Dictionary; toPlainObject(settings?: { collapseExtendedProps?: boolean; collapseColor?: boolean; }): Dictionary; toJSON(): Dictionary; } declare function buildEventApis(eventStore: EventStore, context: CalendarContext, excludeInstance?: EventInstance): EventImpl[]; 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: CalendarImpl; } interface DateProfileOptions { slotMinTime: Duration; slotMaxTime: Duration; showNonCurrentDates?: boolean; dayCount?: number; dateAlignment?: string; dateIncrement?: Duration; hiddenDays?: number[]; weekends?: boolean; nowInput?: DateInput | (() => DateInput); validRangeInput?: DateRangeInput | ((this: CalendarImpl, nowDate: Date) => DateRangeInput); visibleRangeInput?: DateRangeInput | ((this: CalendarImpl, nowDate: Date) => DateRangeInput); fixedWeekCount?: boolean; } type DateProfileGeneratorClass = { new (props: DateProfileGeneratorProps): DateProfileGenerator; }; declare class DateProfileGenerator { protected props: DateProfileGeneratorProps; nowDate: DateMarker; isHiddenDayHash: boolean[]; constructor(props: DateProfileGeneratorProps); buildPrev(currentDateProfile: DateProfile, currentDate: DateMarker, forceToValid?: boolean): DateProfile; buildNext(currentDateProfile: DateProfile, currentDate: DateMarker, forceToValid?: boolean): DateProfile; build(currentDate: DateMarker, direction?: any, forceToValid?: boolean): DateProfile; buildValidRange(): 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; } interface EventInteractionState { affectedEvents: EventStore; mutatedEvents: EventStore; isEvent: boolean; } interface ViewProps { dateProfile: DateProfile; businessHours: EventStore; eventStore: EventStore; eventUiBases: EventUiHash; dateSelection: DateSpan | null; eventSelection: string; eventDrag: EventInteractionState | null; eventResize: EventInteractionState | null; isHeightAuto: boolean; forPrint: boolean; } declare function sliceEvents(props: ViewProps & { dateProfile: DateProfile; nextDayThreshold: Duration; }, allDay?: boolean): EventRenderRange[]; type ClassNamesInput = string | string[]; declare function parseClassNames(raw: ClassNamesInput): string[]; type MountArg<ContentArg> = ContentArg & { el: HTMLElement; }; type DidMountHandler<TheMountArg extends { el: HTMLElement; }> = (mountArg: TheMountArg) => void; type WillUnmountHandler<TheMountArg extends { el: HTMLElement; }> = (mountArg: TheMountArg) => void; interface ObjCustomContent { html: string; domNodes: any[]; } type CustomContent = ComponentChildren | ObjCustomContent; type CustomContentGenerator<RenderProps> = CustomContent | ((renderProps: RenderProps, createElement: any) => (CustomContent | true)); type ClassNamesGenerator<RenderProps> = ClassNamesInput | ((renderProps: RenderProps) => ClassNamesInput); type ViewComponentType = ComponentType<ViewProps>; type ViewConfigInput = ViewComponentType | ViewOptions; type ViewConfigInputHash = { [viewType: string]: ViewConfigInput; }; interface SpecificViewContentArg extends ViewProps { nextDayThreshold: Duration; } type SpecificViewMountArg = MountArg<SpecificViewContentArg>; interface ViewSpec { type: string; component: ViewComponentType; duration: Duration; durationUnit: string; singleUnit: string; optionDefaults: ViewOptions; optionOverrides: ViewOptions; buttonTextOverride: string; buttonTextDefault: string; buttonTitleOverride: string | ((...args: any[]) => string); buttonTitleDefault: string | ((...args: any[]) => string); } 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 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; } declare class Theme { classes: any; iconClasses: any; rtlIconClasses: any; baseIconClass: string; iconOverrideOption: any; iconOverrideCustomButtonOption: any; iconOverridePrefix: string; constructor(calendarOptions: CalendarOptionsRefined); setIconOverride(iconOverrideHash: any): void; applyIconOverridePrefix(className: any): any; getClass(key: any): any; getIconClass(buttonName: any, isRtl?: boolean): string; getCustomButtonIconClass(customButtonProps: any): string; } type ThemeClass = { new (calendarOptions: any): Theme; }; 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; } interface CalendarOptionsData { localeDefaults: CalendarOptions; calendarOptions: CalendarOptionsRefined; toolbarConfig: any; availableRawLocales: any; dateEnv: DateEnv; theme: Theme; pluginHooks: PluginHooks; viewSpecs: ViewSpecHash; } interface CalendarCurrentViewData { viewSpec: ViewSpec; options: ViewOptionsRefined; viewApi: ViewImpl; dateProfileGenerator: DateProfileGenerator; } type CalendarDataBase = CalendarOptionsData & CalendarCurrentViewData & CalendarDataManagerState; interface CalendarData extends CalendarDataBase { viewTitle: string; calendarApi: CalendarImpl; dispatch: (action: Action) => void; emitter: Emitter<CalendarListeners>; getCurrentData(): CalendarData; } declare class CalendarImpl implements CalendarApi { currentDataManager?: CalendarDataManager; getCurrentData(): CalendarData; dispatch(action: Action): void; get view(): ViewImpl; batchRendering(callback: () => void): void; updateSize(): 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: CalendarListeners[ListenerName]): void; off<ListenerName extends keyof CalendarListeners>(handlerName: ListenerName, handler: CalendarListeners[ListenerName]): void; trigger<ListenerName extends keyof CalendarListeners>(handlerName: ListenerName, ...args: Parameters<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; } type EventSourceSuccessResponseHandler = (this: CalendarImpl, 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> = (arg: { eventSource: EventSource<Meta>; range: DateRange; isRefetch: boolean; context: CalendarContext; }, successCallback: (res: EventSourceFetcherRes) => void, errorCallback: (error: Error) => void) => void; type Action = { type: 'NOTHING'; } | // hack { type: 'SET_OPTION'; optionName: string; rawOptionValue: any; } | // TODO: how to link this to CalendarOptions? { 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 CalendarDataManagerProps { optionOverrides: CalendarOptions; calendarApi: CalendarImpl; onAction?: (action: Action) => void; onData?: (data: CalendarData) => void; } type ReducerFunc = (// TODO: rename to CalendarDataInjector. move view-props-manip hook here as well? currentState: Dictionary | null, action: Action | null, context: CalendarContext & CalendarDataManagerState) => Dictionary; declare class CalendarDataManager { private computeCurrentViewData; private organizeRawLocales; private buildLocale; private buildPluginHooks; private buildDateEnv; private buildTheme; private parseToolbars; private buildViewSpecs; private buildDateProfileGenerator; private buildViewApi; private buildViewUiProps; private buildEventUiBySource; private buildEventUiBases; private parseContextBusinessHours; private buildTitle; emitter: Emitter<Required<RefinedOptionsFromRefiners<Required<CalendarListenerRefiners>>>>; private actionRunner; private props; private state; private data; currentCalendarOptionsInput: CalendarOptions; private currentCalendarOptionsRefined; private currentViewOptionsInput; private currentViewOptionsRefined; currentCalendarOptionsRefiners: any; private stableOptionOverrides; private stableDynamicOptionOverrides; private stableCalendarOptionsData; private optionsForRefining; private optionsForHandling; constructor(props: CalendarDataManagerProps); getCurrentData: () => CalendarData; dispatch: (action: Action) => void; resetOptions(optionOverrides: CalendarOptions, changedOptionNames?: string[]): void; _handleAction(action: Action): void; updateData(): void; computeOptionsData(optionOverrides: CalendarOptions, dynamicOptionOverrides: CalendarOptions, calendarApi: CalendarImpl): CalendarOptionsData; processRawCalendarOptions(optionOverrides: CalendarOptions, dynamicOptionOverrides: CalendarOptions): { rawOptions: CalendarOptions; refinedOptions: CalendarOptionsRefined; pluginHooks: PluginHooks; availableLocaleData: RawLocaleInfo; localeDefaults: CalendarOptionsRefined; extra: {}; }; _computeCurrentViewData(viewType: string, optionsData: CalendarOptionsData, optionOverrides: CalendarOptions, dynamicOptionOverrides: CalendarOptions): CalendarCurrentViewData; processRawViewOptions(viewSpec: ViewSpec, pluginHooks: PluginHooks, localeDefaults: CalendarOptions, optionOverrides: CalendarOptions, dynamicOptionOverrides: CalendarOptions): { rawOptions: ViewOptions; refinedOptions: ViewOptionsRefined; extra: {}; }; } 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 DateSelectArg extends DateSpanApi { jsEvent: MouseEvent | null; view: ViewApi; } declare function triggerDateSelect(selection: DateSpan, pev: PointerDragEvent | null, context: CalendarContext & { viewApi?: ViewImpl; }): void; interface DateUnselectArg { jsEvent: MouseEvent; view: ViewApi; } declare function getDefaultEventEnd(allDay: boolean, marker: DateMarker, context: CalendarContext): DateMarker; interface ScrollRequest { time?: Duration; [otherProp: string]: any; } type ScrollRequestHandler = (request: ScrollRequest) => boolean; declare class ScrollResponder { private execFunc; private emitter; private scrollTime; private scrollTimeReset; queuedRequest: ScrollRequest; constructor(execFunc: ScrollRequestHandler, emitter: Emitter<CalendarListeners>, scrollTime: Duration, scrollTimeReset: boolean); detach(): void; update(isDatesNew: boolean): void; private fireInitialScroll; private handleScrollRequest; private drain; } declare const ViewContextType: Context<any>; type ResizeHandler = (force: boolean) => void; interface ViewContext extends CalendarContext { options: ViewOptionsRefined; theme: Theme; isRtl: boolean; dateProfileGenerator: DateProfileGenerator; viewSpec: ViewSpec; viewApi: ViewImpl; addResizeHandler: (handler: ResizeHandler) => void; removeResizeHandler: (handler: ResizeHandler) => void; createScrollResponder: (execFunc: ScrollRequestHandler) => ScrollResponder; registerInteractiveComponent: (component: DateComponent<any>, settingsInput: InteractionSettingsInput) => void; unregisterInteractiveComponent: (component: DateComponent<any>) => void; } declare function filterHash(hash: any, func: any): {}; declare function mapHash<InputItem, OutputItem>(hash: { [key: string]: InputItem; }, func: (input: InputItem, key: string) => OutputItem): { [key: string]: OutputItem; }; declare function isPropsEqual(obj0: any, obj1: any): boolean; type EqualityFunc<T> = (a: T, b: T) => boolean; type EqualityThing<T> = EqualityFunc<T> | true; type EqualityFuncs<ObjType> = { [K in keyof ObjType]?: EqualityThing<ObjType[K]>; }; declare function compareObjs(oldProps: any, newProps: any, equalityFuncs?: EqualityFuncs<any>): boolean; declare function collectFromHash<Item>(hash: { [key: string]: Item; }, startIndex?: number, endIndex?: number, step?: number): Item[]; 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>; debug: boolean; shouldComponentUpdate(nextProps: Props, nextState: State): boolean; safeSetState(newState: Partial<State>): void; } 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; declare function setRef<RefType>(ref: Ref<RefType> | void, current: RefType): void; interface Point { left: number; top: number; } interface Rect { left: number; right: number; top: number; bottom: number; } declare function pointInsideRect(point: Point, rect: Rect): boolean; declare function intersectRects(rect1: Rect, rect2: Rect): Rect | false; declare function translateRect(rect: Rect, deltaX: number, deltaY: number): Rect; declare function constrainPoint(point: Point, rect: Rect): Point; declare function getRectCenter(rect: Rect): Point; declare function diffPoints(point1: Point, point2: Point): Point; interface Hit { componentId?: string; context?: ViewContext; dateProfile: DateProfile; dateSpan: DateSpan; dayEl: HTMLElement; rect: Rect; layer: number; largeUnit?: string; } interface Seg { component?: DateComponent<any, any>; isStart: boolean; isEnd: boolean; eventRange?: EventRenderRange; [otherProp: string]: any; el?: never; } interface EventSegUiInteractionState { affectedInstances: EventInstanceHash; segs: Seg[]; isEvent: boolean; } declare abstract class DateComponent<Props = Dictionary, State = Dictionary> extends BaseComponent<Props, State> { uid: string; prepareHits(): void; queryHit(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; } interface InteractionSettings { component: DateComponent<any>; el: HTMLElement; useEventCenter: boolean; isHitComboAllowed: ((hit0: Hit, hit1: Hit) => boolean) | null; } type InteractionSettingsStore = { [componenUid: string]: InteractionSettings; }; declare function interactionSettingsToStore(settings: InteractionSettings): { [x: string]: InteractionSettings; }; declare const interactionSettingsStore: InteractionSettingsStore; declare class DelayedRunner { private drainedOption?; private isRunning; private isDirty; private pauseDepths; private timeoutId; constructor(drainedOption?: () => void); request(delay?: number): void; pause(scope?: string): void; resume(scope?: string, force?: boolean): void; isPaused(): number; tryDrain(): void; clear(): void; private clearTimeout; protected drained(): void; } interface CalendarContentProps extends CalendarData { forPrint: boolean; isHeightAuto: boolean; } 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; declare const DRAG_META_REFINERS: { startTime: typeof createDuration; duration: typeof createDuration; create: BooleanConstructor; sourceId: StringConstructor; }; type DragMetaInput = RawOptionsFromRefiners<typeof DRAG_META_REFINERS> & { [otherProp: string]: any; }; interface DragMeta { startTime: Duration | null; duration: Duration | null; create: boolean; sourceId: string; leftoverProps: Dictionary; } declare function parseDragMeta(raw: DragMetaInput): DragMeta; type ExternalDefTransform = (dateSpan: DateSpan, dragMeta: DragMeta) => any; type EventSourceFuncArg = { start: Date; end: Date; startStr: string; endStr: string; timeZone: string; }; type EventSourceFunc = ((arg: EventSourceFuncArg, successCallback: (eventInputs: EventInput[]) => void, failureCallback: (error: Error) => void) => void) | ((arg: EventSourceFuncArg) => 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; interface EventSourceRefiners extends BuiltInEventSourceRefiners { } type EventSourceInputObject = EventUiInput & RawOptionsFromRefiners<Required<EventSourceRefiners>>; type EventSourceInput = EventSourceInputObject | // object in extended form EventInput[] | EventSourceFunc | // just a function string; type EventSourceRefined = EventUiRefined & RefinedOptionsFromRefiners<Required<EventSourceRefiners>>; 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[]; } declare abstract class ElementDragging { emitter: Emitter<any>; constructor(el: HTMLElement, selector?: string); destroy(): void; abstract setIgnoreMove(bool: boolean): void; setMirrorIsVisible(bool: boolean): void; setMirrorNeedsRevert(bool: boolean): void; setAutoScrollEnabled(bool: boolean): void; } type ElementDraggingClass = { new (el: HTMLElement, selector?: string): ElementDragging; }; type CssDimValue = string | number; interface ColProps { width?: CssDimValue; minWidth?: CssDimValue; span?: number; } interface SectionConfig { outerContent?: VNode; type: 'body' | 'header' | 'footer'; className?: string; maxHeight?: number; liquid?: boolean; expandRows?: boolean; syncRowHeights?: boolean; isSticky?: boolean; } type ChunkConfigContent = (contentProps: ChunkContentCallbackArgs) => VNode; type ChunkConfigRowContent = VNode | ChunkConfigContent; interface ChunkConfig { elRef?: Ref<HTMLTableCellElement>; outerContent?: VNode; content?: ChunkConfigContent; rowContent?: ChunkConfigRowContent; scrollerElRef?: Ref<HTMLDivElement>; tableClassName?: string; } interface ChunkContentCallbackArgs { tableColGroupNode: VNode; tableMinWidth: CssDimValue; clientWidth: number | null; clientHeight: number | null; expandRows: boolean; syncRowHeights: boolean; rowSyncHeights: number[]; reportRowHeightChange: (rowEl: HTMLElement, isStable: boolean) => void; } declare function computeShrinkWidth(chunkEls: HTMLElement[]): number; interface ScrollerLike { needsYScrolling(): boolean; needsXScrolling(): boolean; } declare function getSectionHasLiquidHeight(props: { liquid: boolean; }, sectionConfig: SectionConfig): boolean; declare function getAllowYScrolling(props: { liquid: boolean; }, sectionConfig: SectionConfig): boolean; declare function renderChunkContent(sectionConfig: SectionConfig, chunkConfig: ChunkConfig, arg: ChunkContentCallbackArgs, isHeader: boolean): VNode<{}>; declare function isColPropsEqual(cols0: ColProps[], cols1: ColProps[]): boolean; declare function renderMicroColGroup(cols: ColProps[], shrinkWidth?: number): VNode; declare function sanitizeShrinkWidth(shrinkWidth?: number): number; declare function hasShrinkWidth(cols: ColProps[]): boolean; declare function getScrollGridClassNames(liquid: boolean, context: ViewContext): any[]; declare function getSectionClassNames(sectionConfig: SectionConfig, wholeTableVGrow: boolean): string[]; declare function renderScrollShim(arg: ChunkContentCallbackArgs): createElement.JSX.Element; declare function getStickyHeaderDates(options: BaseOptionsRefined): boolean; declare function getStickyFooterScrollbar(options: BaseOptionsRefined): boolean; interface ScrollGridProps { elRef?: Ref<any>; colGroups?: ColGroupConfig[]; sections: ScrollGridSectionConfig[]; liquid: boolean; forPrint: boolean; collapsibleWidth: boolean; } interface ScrollGridSectionConfig extends SectionConfig { key: string; chunks?: ScrollGridChunkConfig[]; } interface ScrollGridChunkConfig extends ChunkConfig { key: string; } interface ColGroupConfig { width?: CssDimValue; cols: ColProps[]; } type ScrollGridImpl = { new (props: ScrollGridProps, context: ViewContext): Component<ScrollGridProps>; }; interface PluginDefInput { name: string; premiumReleaseDate?: string; deps?: PluginDef[]; 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[]; themeClasses?: { [themeSystemName: string]: ThemeClass; }; eventSourceDefs?: EventSourceDef<any>[]; cmdFormatter?: CmdFormatterFunc; recurringTypes?: RecurringType<any>[]; namedTimeZonedImpl?: NamedTimeZoneImplClass; initialView?: string; elementDraggingImpl?: ElementDraggingClass; optionChangeHandlers?: OptionChangeHandlerMap; scrollGridImpl?: ScrollGridImpl; listenerRefiners?: GenericListenerRefiners; optionRefiners?: GenericRefiners; 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[]; themeClasses: { [themeSystemName: string]: ThemeClass; }; eventSourceDefs: EventSourceDef<any>[]; cmdFormatter?: CmdFormatterFunc; recurringTypes: RecurringType<any>[]; namedTimeZonedImpl?: NamedTimeZoneImplClass; initialView: string; elementDraggingImpl?: ElementDraggingClass; optionChangeHandlers: OptionChangeHandlerMap; scrollGridImpl: ScrollGridImpl | null; listenerRefiners: GenericListenerRefiners; optionRefiners: GenericRefiners; propSetHandlers: { [propName: string]: (val: any, context: CalendarData) => void; }; } interface PluginDef extends PluginHooks { id: string; name: string; deps: PluginDef[]; } type ViewPropsTransformerClass = new () => ViewPropsTransformer; interface ViewPropsTransformer { transform(viewProps: ViewProps, calendarProps: CalendarContentProps): any; } type ViewContainerAppend = (context: CalendarContext) => ComponentChildren; interface CalendarContext { dateEnv: DateEnv; options: BaseOptionsRefined; pluginHooks: PluginHooks; emitter: Emitter<CalendarListeners>; dispatch(action: Action): void; getCurrentData(): CalendarData; calendarApi: CalendarImpl; } type EventDefIdMap = { [publicId: string]: string; }; 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; interface EventRefiners extends BuiltInEventRefiners { } 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>; declare function refineEventDef(raw: EventInput, context: CalendarContext, refiners?: GenericRefiners): { refined: RefinedOptionsFromRefiners<GenericRefiners>; extra: Dictionary; }; declare function parseEventDef(refined: EventRefined, extra: Dictionary, sourceId: string, allDay: boolean, hasEnd: boolean, context: CalendarContext, defIdMap?: EventDefIdMap): EventDef; interface EventStore { defs: EventDefHash; instances: EventInstanceHash; } declare function eventTupleToStore(tuple: EventTuple, eventStore?: EventStore): EventStore; declare function getRelevantEvents(eventStore: EventStore, instanceId: string): EventStore; declare function createEmptyEventStore(): EventStore; declare function mergeEventStores(store0: EventStore, store1: EventStore): EventStore; interface SplittableProps { businessHours: EventStore | null; dateSelection: DateSpan | null; eventStore: EventStore; eventUiBases: EventUiHash; eventSelection: string; eventDrag: EventInteractionState | null; eventResize: EventInteractionState | null; } declare abstract class Splitter<PropsType extends SplittableProps = SplittableProps> { private getKeysForEventDefs; private splitDateSelection; private splitEventStore; private splitIndividualUi; private splitEventDrag; private splitEventResize; private eventUiBuilders; abstract getKeyInfo(props: PropsType): { [key: string]: { ui?: EventUi; businessHours?: EventStore; }; }; abstract getKeysForDateSpan(dateSpan: DateSpan): string[]; abstract getKeysForEventDef(eventDef: EventDef): string[]; splitProps(props: PropsType): { [key: string]: SplittableProps; }; private _splitDateSpan; private _getKeysForEventDefs; private _splitEventStore; private _splitIndividualUi; private _splitInteraction; } 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>; className: typeof parseClassNames; classNames: typeof parseClassNames; color: StringConstructor; backgroundColor: StringConstructor; borderColor: StringConstructor; textColor: 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[]; backgroundColor: string; borderColor: string; textColor: string; classNames: string[]; } type EventUiHash = { [defId: string]: EventUi; }; declare function createEventUi(