jamis
Version:
一种支持通过JSON配置方式生成页面的组件库
73 lines (72 loc) • 2.6 kB
TypeScript
/**
* @file 基于 react-datetime 改造。
*/
import React from 'react';
import type { Moment } from 'moment';
import moment from 'moment';
import type { CalendarProps, CalendarState, DateBoundary, DateType, PickerOption } from '../../types';
type AllowedSetTime = 'hours' | 'minutes' | 'seconds' | 'milliseconds';
export default class Calendar extends React.Component<CalendarProps, CalendarState> {
static defaultProps: Partial<CalendarProps>;
tzWarning: boolean;
timeCellLength: {
year: number;
month: number;
date: number;
hours: number;
minutes: number;
seconds: number;
milliseconds: number;
};
constructor(props: CalendarProps);
getFormats(props: CalendarProps): any;
componentDidUpdate(prevProps: CalendarProps): void;
checkTZ(props: CalendarProps): void;
localMoment(date?: Moment | string, format?: string, props?: any): Moment;
parseDate(date: Moment | string | undefined, formats: any): Moment | null | undefined;
getStateFromProps(props: CalendarProps): CalendarState;
getUpdateOn: (formats: any) => "days" | "months" | "years" | "quarters";
showView: (view: CalendarState["currentView"]) => () => void;
subtractTime: (amount: number, type: string, toSelected: boolean) => () => void;
addTime: (amount: number, type: string, toSelected: boolean) => () => void;
updateTime(op: string, amount: number, type: string, toSelected: boolean): void;
setTime: (type: AllowedSetTime, value: any) => void;
setDate: (type: "month" | "year" | "quarters") => (e: any) => void;
updateSelectedDate: (e: React.MouseEvent, close?: boolean) => void;
getDateBoundary: (currentDate: moment.Moment) => {
year: {
max: number;
min: number;
};
month: {
max: number;
min: number;
};
date: {
max: number;
min: number;
};
hours: {
max: number;
min: number;
};
minutes: {
max: number;
min: number;
};
seconds: {
max: number;
min: number;
};
};
timeCell: (value: number, type: DateType) => string;
getColumns: (types: DateType[], dateBoundary: DateBoundary) => {
options: PickerOption[];
}[];
onConfirm: (value: number[], types: string[]) => void;
renderYearSwitch: () => JSX.Element;
renderMonthSwitch: () => JSX.Element;
renderBody: () => JSX.Element | null;
render(): JSX.Element;
}
export {};