///
declare module "types" {
export type OnChangeCallback = (newDateRange: DateRange | undefined, rangeIndex: number) => void;
export type Coords = {
x: number;
y: number;
};
export type ScheduleType = DateRange[];
export type CellInfo = {
spanX: number;
spanY: number;
startX: number;
startY: number;
endX: number;
endY: number;
};
export type DateRange = [Date, Date];
export type MapCellInfoToDateRange = (options: MapCellInfoToDateRangeOptions) => (cellInfo: CellInfo) => DateRange[];
export type MapCellInfoToDateRangeOptions = {
fromY: (y: number) => number;
fromX: (x: number) => number;
originDate: Date;
};
export type Grid = {
cellHeight: number;
cellWidth: number;
totalWidth: number;
totalHeight: number;
numVerticalCells: number;
numHorizontalCells: number;
getRectFromCell(cell: CellInfo): Rect;
getCellFromRect(rect: Rect): CellInfo;
};
export type Rect = ClientRect & {
startX: number;
endX: number;
startY: number;
endY: number;
};
}
declare module "utils/createPageMapCoordsToContainer" {
export const createPageMapCoordsToContainer: (container: HTMLElement) => (event: MouseEvent | import("react").MouseEvent | TouchEvent) => {
clientX: number;
clientY: number;
pageX: number;
pageY: number;
top: number;
left: number;
x: number;
y: number;
};
}
declare module "hooks/useClickAndDrag" {
import React from 'react';
import { Rect } from "types";
export function useClickAndDrag(ref: React.RefObject): {
style: {
transform: string;
width: number;
height: number;
};
box: Rect | null;
isDragging: boolean;
cancel: () => void;
hasFinishedDragging: boolean;
};
}
declare module "hooks/useMousetrap" {
/**
* Use mousetrap hook
*
* @param handlerKey - A key, key combo or array of combos according to Mousetrap documentation.
* @param handlerCallback - A function that is triggered on key combo catch.
*/
export default function useMousetrap(handlerKey: string | string[], handlerCallback: () => void, element: typeof document | Element | null): void;
}
declare module "hooks/useEventListener" {
export function useEventListener(ref: React.RefObject, event: K, listener: (this: Element, event: HTMLElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions, { enabled }?: {
enabled?: boolean | undefined;
}): void;
}
declare module "hooks/useScrollPosition" {
export function useScrollPosition(root: React.RefObject, { passive, enabled }?: {
passive?: boolean | undefined;
enabled?: boolean | undefined;
}): {
scrollTop: number;
scrollLeft: number;
};
}
declare module "hooks/useStickyStyle" {
import React from 'react';
export function useStickyStyle(scrollParent: React.RefObject, { top, left }: {
top?: boolean;
left?: boolean;
}): React.CSSProperties;
}
declare module "utils/getSpan" {
export const getSpan: (x1: number, x2: number) => number;
}
declare module "utils/createGrid" {
import { Grid } from "types";
export const createGrid: ({ totalHeight, totalWidth, numVerticalCells, numHorizontalCells, }: {
totalHeight: number;
totalWidth: number;
numVerticalCells: number;
numHorizontalCells: number;
}) => Grid;
}
declare module "utils/cellToDate" {
export const cellToDate: ({ startX, startY, toMin, originDate, }: {
startX: number;
startY: number;
toMin: (y: number) => number;
toDay: (x: number) => number;
originDate: Date;
}) => Date;
}
declare module "utils/createMapCellInfoToContiguousDateRange" {
import { MapCellInfoToDateRange } from "types";
export const createMapCellInfoToContiguousDateRange: MapCellInfoToDateRange;
}
declare module "utils/createMapCellInfoToRecurringTimeRange" {
import { DateRange, MapCellInfoToDateRange } from "types";
export type RecurringTimeRange = DateRange[];
export const createMapCellInfoToRecurringTimeRange: MapCellInfoToDateRange;
}
declare module "utils/createMapDateRangeToCells" {
import { CellInfo } from "types";
export const createMapDateRangeToCells: ({ toX, toY, numVerticalCells, originDate, }: {
toX: (day: number) => number;
toY: (min: number) => number;
numHorizontalCells: number;
numVerticalCells: number;
originDate: Date;
}) => ([start, end]: [Date, Date]) => CellInfo[];
}
declare module "utils/mergeEvents" {
import { ScheduleType } from "types";
export function mergeRanges(event: ScheduleType): ScheduleType;
export function mergeEvents(event1: ScheduleType, event2: ScheduleType | null): ScheduleType;
}
declare module "components/Cell" {
import React from 'react';
import { CellInfo } from "types";
export const Cell: React.NamedExoticComponent<{
timeIndex: number;
classes: Record;
getDateRangeForVisualGrid(cell: CellInfo): [Date, Date][];
}>;
}
declare module "utils/getTextForDateRange" {
export const getTextForDateRange: (dates: [Date, Date], template?: string | undefined, template2?: string | undefined) => string;
}
declare module "components/RangeBox" {
import React from 'react';
import { CellInfo } from "types";
import { ScheduleProps } from "components/Schedule";
export const RangeBox: React.NamedExoticComponent;
}
declare module "components/Schedule" {
import React from 'react';
import { CellInfo, DateRange, Grid, OnChangeCallback } from "types";
export type ScheduleProps = {
classes: Record;
grid: Grid;
onChange?: OnChangeCallback;
isResizable?: boolean;
isDeletable?: boolean;
moveAxis: 'none' | 'both' | 'x' | 'y';
isBeingEdited?(cell: CellInfo): boolean;
cellInfoToDateRange(cell: CellInfo): DateRange;
onActiveChange?(index: [number, number] | [null, null]): void;
};
export const Schedule: React.NamedExoticComponent<{
dateRangeToCells(range: [Date, Date]): CellInfo[];
ranges: [Date, Date][];
className?: string | undefined;
classes: Record;
} & ScheduleProps>;
}
declare module "components/TimeGridScheduler" {
import React from 'react';
export const TimeGridScheduler: React.NamedExoticComponent<{
originDate?: Date | undefined;
verticalPrecision?: number | undefined;
visualGridVerticalPrecision?: number | undefined;
style?: React.CSSProperties | undefined;
schedule: [Date, Date][];
classes: Record;
className?: string | undefined;
onChange(newSchedule: [Date, Date][]): void;
}>;
}
declare module "styles/index" {
import classes from './styles.module.scss';
export default classes;
}
declare module "index" {
import { TimeGridScheduler } from "components/TimeGridScheduler";
import classes from "styles/index";
export { TimeGridScheduler, classes };
}
declare module "utils/createMapCellInfoToSingleDayRange" {
import { MapCellInfoToDateRange } from "types";
export const createMapCellInfoToSingleDayRange: MapCellInfoToDateRange;
}