jamis
Version:
一种支持通过JSON配置方式生成页面的组件库
49 lines (48 loc) • 2.02 kB
TypeScript
import type { LocaleProps, SchemaClassName, ThemeProps } from 'jamis-core';
import type { Moment } from 'moment';
import type { CalendarViewMode, SchedularItem, TimeConstraints } from './Calendar.types';
export type ShortcutValue<T extends number = number> = T extends number ? 'now' | 'today' | 'yesterday' | 'tomorrow' | 'thisweek' | 'endofthisweek' | 'thismonth' | 'prevmonth' | 'endofthismonth' | 'endoflastmonth' | 'thisquarter' | 'prevquarter' | 'thisyear' | 'prevyear' | 'halfyearago' | 'halfyearlater' | `${T}${'hoursago' | 'hourslater' | 'daysago' | 'dayslater' | 'weeksago' | 'weekslater' | 'monthsago' | 'monthslater' | 'quartersago' | 'quarterslater' | 'yearsago' | 'yearslater'}` : never;
export type Shortcuts = Array<{
label: string;
value: ShortcutValue | Moment;
} | ShortcutValue>;
export interface DatePickerProps extends LocaleProps, ThemeProps {
viewMode: CalendarViewMode;
popoverClassName?: string;
placeholder?: string;
inputFormat?: string;
timeFormat?: string;
format?: string;
closeOnSelect: boolean;
disabled?: boolean;
minDate?: Moment;
maxDate?: Moment;
clearable?: boolean;
defaultValue?: any;
utc?: boolean;
value?: any;
shortcuts?: Shortcuts | string;
shortcutsRefDate?: Moment;
shortcutsPosition?: 'picker' | 'input';
overlayPlacement: string;
dateFormat?: string;
timeConstraints?: TimeConstraints;
popOverContainer?: any;
label?: string | false;
borderMode?: 'full' | 'half' | 'none';
embed?: boolean;
schedules?: SchedularItem[];
scheduleClassNames?: Array<string>;
largeMode?: boolean;
todayActiveStyle?: React.CSSProperties;
mobileCalendarMode?: 'picker' | 'calendar';
/** 是否有校验错误 */
hasError?: boolean;
pickerInputClassName?: SchemaClassName;
disableMonthSwitch?: boolean;
onFocus?: Function;
onBlur?: Function;
onRef?: any;
onChange: (value: any) => void;
onScheduleClick?: (scheduleData: any) => void;
}