ui-complex
Version:
62 lines (60 loc) • 1.93 kB
TypeScript
import { default as React, ReactNode } from 'react';
import { DateFormatToDate } from '../utils/helpers/dateTypeToDate';
import { DateType } from '../utils/enums/dateType';
import { IRange } from '../utils/models/IRange';
export declare namespace ITimelineContext {
interface Dependence {
type: "blocking" | "waiting";
fromId?: string;
toId?: string;
isLine?: boolean;
}
interface DependenceProps {
ids?: {
id: string;
color?: string;
}[];
render?: (props: {
elm: React.ReactElement;
isVisible: boolean;
}) => React.ReactElement;
visible?: boolean;
line?: {
visible?: boolean;
color?: string;
};
icon?: {
background?: string;
color?: string;
};
}
interface IState {
contentRef: (HTMLDivElement & {
dependence?: Dependence;
}) | null;
bodyRef: HTMLDivElement | null;
randomId: string;
dateFormatTodates: DateFormatToDate;
holderWidth: number;
dateType: DateType;
dayWidthSize: Record<DateType, number>;
header?: ITimelineContext.IHeader;
topBar?: ITimelineContext.ITopBar;
dependencies: boolean;
}
interface IHeader {
extra: () => ReactNode;
}
interface ITopBar {
extra: () => ReactNode;
}
}
export interface TimelineContextDataState extends ITimelineContext.IState {
}
export interface TimelineContextData extends TimelineContextDataState {
setDateType: React.Dispatch<React.SetStateAction<DateType>>;
setDayWidthSize: React.Dispatch<React.SetStateAction<Record<DateType, number>>>;
onDragEnd?: (range: IRange) => void;
}
export declare const timelineDefaultState: TimelineContextData;
export declare const TimelineContext: React.Context<TimelineContextData>;