choerodon-ui
Version:
An enterprise-class UI design language and React-based implementation
59 lines (58 loc) • 2.38 kB
TypeScript
import { Component, CSSProperties, ReactNode } from 'react';
import moment, { Moment } from 'moment';
import noop from 'lodash/noop';
import ConfigContext, { ConfigContextValue } from '../config-provider/ConfigContext';
import { RadioProps } from '../radio';
import { SelectProps } from '../select';
export { HeaderProps } from './Header';
export declare type CalendarMode = 'month' | 'year';
export interface CalendarProps {
prefixCls?: string;
selectProps?: SelectProps;
radioProps?: RadioProps;
className?: string;
value?: Moment;
defaultValue?: Moment;
mode?: CalendarMode;
fullscreen?: boolean;
dateCellRender?: (date: Moment) => ReactNode;
monthCellRender?: (date: Moment) => ReactNode;
dateFullCellRender?: (date: Moment) => ReactNode;
monthFullCellRender?: (date: Moment) => ReactNode;
locale?: any;
style?: CSSProperties;
onPanelChange?: (date?: Moment, mode?: CalendarMode) => void;
onSelect?: (date?: Moment) => void;
disabledDate?: (current: Moment) => boolean;
validRange?: [Moment, Moment];
}
export interface CalendarState {
value: Moment;
mode?: CalendarMode;
}
export default class Calendar extends Component<CalendarProps, CalendarState> {
static displayName: string;
static get contextType(): typeof ConfigContext;
static defaultProps: {
locale: {};
fullscreen: boolean;
mode: string;
onSelect: typeof noop;
onPanelChange: typeof noop;
};
context: ConfigContextValue;
constructor(props: CalendarProps);
componentWillReceiveProps(nextProps: CalendarProps): void;
getPrefixCls(): string;
monthCellRender: (value: moment.Moment) => JSX.Element;
dateCellRender: (value: moment.Moment) => JSX.Element;
setValue: (value: moment.Moment, way: "select" | "changePanel") => void;
setType: (type: string) => void;
onHeaderValueChange: (value: moment.Moment) => void;
onHeaderTypeChange: (type: string) => void;
onPanelChange(value: Moment, mode: CalendarMode | undefined): void;
onSelect: (value: moment.Moment) => void;
getDateRange: (validRange: [moment.Moment, moment.Moment], disabledDate?: ((current: moment.Moment) => boolean) | undefined) => (current: moment.Moment) => boolean;
renderCalendar: (locale: any, localeCode: string) => JSX.Element;
render(): JSX.Element;
}