fullcalendar
Version:
FullCalendar Vanilla JS package for rendering a calendar
1,629 lines (1,545 loc) • 84.6 kB
TypeScript
import { RawOptionsFromRefiners, RefinedOptionsFromRefiners, BaseOptionsRefined, EventRefiners, BaseOptions, EventSourceOptions, EventSourceOptionsRefined } from '@fullcalendar/core/protected-api';
import { NativeDateFormatterOptions, FuncDateFormatterFunc, DateFormatter, DateMarker, DateEnv, DateRange, Duration, DateTimeFormatPartWithWeek as DateTimeFormatPartWithWeek$1, DateInput, DurationInput, DateRangeInput, CmdDateFormatterFunc, OpenDateRange, LocaleCodeArg, createDuration, WeekNumberCalculation } from '@full-ui/headless-calendar';
import * as preact from 'preact';
import { Ref, ComponentType, Component, ReactNode, ReactElement, RefObject, CSSProperties, FC } 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;
}
declare function guid(): string;
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 valuesIdentical<T>(a: T, b: T): boolean;
declare function computeViewBorderless(options: CalendarOptions): {
borderlessX: boolean;
borderlessTop: boolean;
borderlessBottom: 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;
}
interface EventInstance {
instanceId: string;
defId: string;
range: DateRange;
}
type EventInstanceHash = {
[instanceId: string]: EventInstance;
};
type BusinessHoursInput = boolean | EventInput | EventInput[];
declare function parseBusinessHours(input: BusinessHoursInput, context: CalendarContext): EventStore;
interface Point {
left: number;
top: number;
}
interface Rect {
left: number;
right: number;
top: number;
bottom: number;
}
declare function getRectCenter(rect: Rect): Point;
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;
declare function refineClassNameGenerator<RenderProps>(input: ClassNameGenerator<RenderProps>, optionName: string): ClassNameGenerator<RenderProps>;
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;
}
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;
}
interface DateMeta {
dow: number;
date: Date;
isDisabled: boolean;
isOther: boolean;
isToday: boolean;
isPast: boolean;
isFuture: boolean;
}
declare function getDateMeta(dateMarker: DateMarker, dateEnv: DateEnv, dateProfile?: DateProfile, todayRange?: DateRange, nowDate?: DateMarker): DateMeta;
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;
declare function setRef<RefType>(ref: Ref<RefType> | void, current: RefType): void;
type ElRef = Ref<HTMLElement>;
type ElAttrs = {
ref?: ElRef;
} & Record<string, any>;
interface ElAttrsProps {
attrs?: ElAttrs;
className?: string;
style?: CSSProperties & Record<string, any>;
elRef?: ElRef;
}
interface ElProps extends ElAttrsProps {
tag: string;
}
interface ContentGeneratorProps<RenderProps> {
renderProps: RenderProps;
generatorName: string | undefined;
customGenerator?: ContentGenerator<RenderProps>;
defaultGenerator?: (renderProps: RenderProps) => ReactNode;
}
type ContentInjectorProps<RenderProps> = ElProps & ContentGeneratorProps<RenderProps> & {
renderId: number;
};
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 ViewContainerProps extends Partial<ElProps> {
viewSpec: ViewSpec;
attrs?: any;
children?: ReactNode;
}
interface ViewDisplayInfo {
view: ViewApi;
borderlessX: boolean;
borderlessTop: boolean;
borderlessBottom: boolean;
options: {
headerToolbar: ToolbarInput | false | undefined;
footerToolbar: ToolbarInput | false | undefined;
};
isHeightAuto: boolean;
}
declare class ViewContainer extends BaseComponent<ViewContainerProps> {
private refineRenderProps;
render(): preact.JSX.Element;
}
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;
}
interface EventSegUiInteractionState<S> {
affectedInstances: EventInstanceHash;
segs: (S & EventRangeProps)[];
isEvent: boolean;
}
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 CalendarInnerProps extends CalendarData {
forPrint: boolean;
baseId: string;
}
interface CalendarContentProps extends CalendarData {
toolbarProps: CalendarToolbarProps;
forPrint: boolean;
}
declare class CalendarInner extends PureComponent<CalendarInnerProps> {
private buildViewContext;
private buildViewPropTransformers;
private interactionsStore;
private calendarInteractions;
private get viewTitleId();
render(): preact.JSX.Element;
private renderView;
private buildAppendContent;
componentDidMount(): void;
componentDidUpdate(prevProps: Readonly<CalendarData>): void;
componentWillUnmount(): void;
private registerInteractiveComponent;
private unregisterInteractiveComponent;
}
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;
declare function getIsHeightAuto(options: {
height?: CssDimValue;
contentHeight?: CssDimValue;
}): boolean;
declare function getTableHeaderSticky(options: {
height?: CssDimValue;
contentHeight?: CssDimValue;
tableHeaderSticky?: boolean | 'auto';
}): boolean;
declare function getFooterScrollbarSticky(options: {
height?: CssDimValue;
contentHeight?: CssDimValue;
footerScrollbarSticky?: boolean | 'auto';
}): boolean;
type ContentContainerProps<RenderProps> = ElAttrsProps & ContentGeneratorProps<RenderProps> & {
tag?: string;
classNameGenerator?: ClassNameGenerator<RenderProps> | undefined;
didMount?: ((renderProps: RenderProps & {
el: HTMLElement;
}) => void) | undefined;
willUnmount?: ((renderProps: RenderProps & {
el: HTMLElement;
}) => void) | undefined;
children?: InnerContainerFunc<RenderProps>;
};
declare class ContentContainer<RenderProps> extends Component<ContentContainerProps<RenderProps>> {
static contextType: preact.Context<number>;
didMountMisfire?: boolean;
context: number;
el: HTMLElement;
InnerContent: (props: ElProps) => preact.VNode<ContentInjectorProps<unknown>>;
render(): ReactNode;
handleEl: (el: HTMLElement | null) => void;
componentDidMount(): void;
componentWillUnmount(): void;
}
type InnerContainerComponent = FC<ElProps>;
type InnerContainerFunc<RenderProps> = (InnerContainer: InnerContainerComponent, renderProps: RenderProps, attrs: ElAttrs) => ReactNode;
declare function generateClassName<RenderProps>(classNameGenerator: ClassNameGenerator<RenderProps> | undefined, renderProps: RenderProps): string;
interface NowIndicatorHeaderContainerProps extends Partial<ElProps> {
date: DateMarker;
children?: InnerContainerFunc<NowIndicatorHeaderInfo>;
}
interface NowIndicatorHeaderInfo {
date: Date;
view: ViewApi;
}
declare const NowIndicatorHeaderContainer: (props: NowIndicatorHeaderContainerProps) => preact.JSX.Element;
interface NowIndicatorLineContainerProps extends Partial<ElProps> {
date: DateMarker;
children?: InnerContainerFunc<NowIndicatorLineInfo>;
}
interface NowIndicatorLineInfo {
date: Date;
view: ViewApi;
}
declare const NowIndicatorLineContainer: (props: NowIndicatorLineContainerProps) => preact.JSX.Element;
interface MoreLinkContainerProps extends Partial<ElAttrsProps> {
dateProfile: DateProfile;
todayRange: DateRange;
allDayDate: DateMarker | null;
segs: EventRangeProps[];
hiddenSegs: EventRangeProps[];
dateSpanProps?: Dictionary;
alignElRef?: RefObject<HTMLElement>;
alignParentTop?: string;
forceTimed?: boolean;
popoverContent: () => ReactNode;
isNarrow: boolean;
isMicro: boolean;
display: 'row' | 'column';
}
interface MoreLinkInfo$1 {
num: number;
numericText: string;
longText: string;
text: string;
isNarrow: boolean;
view: ViewApi;
}
interface MoreLinkContainerState {
isPopoverOpen: boolean;
}
declare class MoreLinkContainer extends BaseComponent<MoreLinkContainerProps, MoreLinkContainerState> {
private linkEl;
state: {
isPopoverOpen: boolean;
};
render(): preact.JSX.Element;
handleLinkEl: (linkEl: HTMLElement | null) => void;
handleClick: (ev: MouseEvent) => void;
handlePopoverClose: () => void;
}
interface CalendarDisplayInfo {
borderlessX: boolean;
borderlessTop: boolean;
borderlessBottom: boolean;
}
interface CalendarMediaRootProps {
emitter: Emitter<Required<CalendarListeners>>;
children?: (forPrint: boolean) => ReactElement;
}
interface CalendarMediaRootState {
forPrint: boolean;
}
declare class CalendarMediaRoot extends Component<CalendarMediaRootProps, CalendarMediaRootState> {
state: CalendarMediaRootState;
render(): ReactElement<{}>;
componentDidMount(): void;
componentWillUnmount(): void;
private handleBeforePrint;
private handleAfterPrint;
}
declare function computeRootClassName(options: CalendarOptions, forPrint: boolean): string;
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 EventRangeProps {
eventRange: EventRenderRange;
}
declare function getEventKey(seg: EventRangeProps): string;
declare function sortEventSegs<S extends EventRangeProps>(segs: S[], eventOrderSpecs: OrderSpec<EventImpl>[]): S[];
interface MinimalEventProps {
eventRange: EventRenderRange;
slicedStart?: DateMarker;
slicedEnd?: DateMarker;
isStart: boolean;
isEnd: boolean;
isFirst?: boolean;
isLast?: boolean;
isDragging: boolean;
isResizing: boolean;
isMirror: boolean;
isSelected: boolean;
isPast: boolean;
isFuture: boolean;
isToday: 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;
};
}
declare function getEventRangeMeta(eventRange: EventRenderRange, todayRange: DateRange, nowDate?: DateMarker): {
isPast: boolean;
isFuture: boolean;
isToday: boolean;
};
declare function buildEventRangeKey(eventRange: EventRenderRange): string;
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;
};
declare function createEventUi(refined: EventUiRefined, context: CalendarContext): EventUi;
declare function combineEventUis(uis: EventUi[]): 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;
}
declare function mergeEventStores(store0: EventStore, store1: EventStore): EventStore;
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;
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;
}
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 buildLoc