UNPKG

@cainiaofe/cn-ui-m

Version:
129 lines (128 loc) 3.11 kB
import { ReactNode } from 'react'; import { Dayjs } from "../../../utils/dayjs"; import { BasicComponentProps, BasicSizeType } from "../../../types"; import { CnTimePickerProps } from '../../cn-time-picker-pro/types'; import { IAvailableDate } from './i-available-date'; import { IPrecision } from './i-precision'; import { TLanguage } from '@cainiaofe/cn-i18n'; export interface CnDatePickerProps extends Omit<BasicComponentProps, 'defaultValue' | 'onChange'> { /** * 对齐模式 */ align?: 'left' | 'right'; /** * 尺寸 */ size?: BasicSizeType; /** * 是否在form.item中,在form中会使用small尺寸 * @ignore 内部使用 */ insideForm?: boolean; /** * 是否在快捷筛选中 * @ignore 内部使用 */ insideFilter?: boolean; /** * 抽屉标题 */ formLabel?: string; /** * string number Date Dayjs */ value?: IAvailableDate; /** * 默认值 */ defaultValue?: IAvailableDate; /** * 展示模式 * @default picker */ mode?: 'picker' | 'calendar'; /** * 图标类型 */ iconType?: string; /** * 占位提示 */ placeholder?: string; /** * 是否禁用 */ disabled?: boolean; /** * 日期格式化方法 */ format?: string | ((value: Dayjs) => string); /** * 日期输出的格式化方法,影响onChange的返回值 */ outputFormat?: string | ((value: Dayjs) => any); /** * 自定义渲染每列展示的内容 */ renderLabel?: ((type: string, data: number) => React.ReactNode) | ((date: Date) => React.ReactNode); /** * 是否选择时间 */ showTime?: boolean; /** * 时间选择器的属性 */ timePanelProps?: CnTimePickerProps; /** * 精度设置:"year" | "month" | "day" | "hour" | "minute" | "second" | "week" | "week-day" */ precision?: IPrecision; /** * 最小值 */ min?: Date; /** * 最大值 */ max?: Date; /** * 判断日期是否可选,使用后会忽略 min 和 max 设置(仅mode=calendar有效) */ disabledDate?: (date: Date, mode: 'date') => boolean; /** * 选择日期时,时间戳是否取当天的时间末尾(23:59:59) */ endOfDay?: boolean; /** * 是否可清空 */ hasClear?: boolean; /** * 是否只读 */ readOnly?: boolean; /** * 垂直层级 */ zIndex?: number; /** * 面板页脚定制 */ extraFooterRender?: ReactNode | (() => ReactNode); /** * 日期值改变时的回调 */ onChange?: (value: number | number[] | undefined, dateStr: string) => void; /** * 清空事件 */ onClear?: () => void; /** * 取消事件 */ onCancel?: (reason: string) => void; /** *开启国际化适配:不设置 跟随系统配置;true 开启;false 关闭;配置语种 固定语种格式 */ adapterLocale?: boolean | TLanguage; }