UNPKG

test-nut-ui

Version:

<p align="center"> <img alt="logo" src="https://img11.360buyimg.com/imagetools/jfs/t1/211965/25/7152/22022/61b16785E433119bb/aa41d7a9f7e823f3.png" width="150" style="margin-bottom: 10px;"> </p>

120 lines (119 loc) 3.15 kB
import React, { FunctionComponent } from 'react'; import { PickerOption } from '../../packages/picker/index'; import { BasicComponent } from '../../utils/typings'; export interface DatePickerProps extends BasicComponent { /** * 受控 * @default null */ value?: Date | null /** * 初始值 * @default null */ defaultValue?: Date | null /** * 是否可见 * @default false */ visible: boolean /** * 设置标题 * @default null */ title: string /** * isTabs 为 true 时的每个tab的title * @default [] */ titles: string[] /** * 类时间类型,可选值 date time year month year-month month-day datehour datetime datesecond hour-minutes month-day-year * @default date */ type: 'date' | 'time' | 'year' | 'month' | 'year-month' | 'month-day' | 'datehour' | 'datetime' | 'hour-minutes' | 'datesecond' | 'month-day-year' /** * isTabs 为 true 时每个选项内的日期类型,可选值 date time year month year-month month-day datehour datetime datesecond hour-minutes month-day-year * @default [] */ tabs: ('date' | 'time' | 'year' | 'month' | 'year-month' | 'month-day' | 'datehour' | 'datetime' | 'hour-minutes' | 'datesecond' | 'month-day-year')[] /** * 是否是选项切换日期 * @default [] */ isTabs: boolean /** * isTabs 为 true 时每个选项的标题 * @default [] */ tabsTitle: string[] /** * 每列是否展示中文 * @default true */ showChinese: boolean /** * 分钟步进值 * @default 1 */ minuteStep: number /** * 开始日期 * @default 十年前 */ startDate: Date cellHeight: number; /** * 结束日期 * @default 十年后 */ endDate: Date /** * 是否开启3D效果 * @default false */ threeDimensional: boolean /** * 弹出框顶部圆角 * @default string */ borderRadius?: string | number /** * 是否显示时分秒分割符 * @default false */ withSeparator?: boolean /** * isTabs 为 true 时每个选项内是否加上分割符 * @default [false, false] */ tabsWithSeparator?: boolean[] confirmText?: string; cancelText?: string; /** * 选项格式化函数 * @default - */ formatter?: (type: string, option: PickerOption) => PickerOption /** * 选项过滤函数 * @default - */ filter?: (type: string, option: PickerOption[]) => PickerOption[] /** * 关闭时触发 * @default - */ onClose?: () => void /** * 点击确定按钮时触发 * @default - */ onConfirm?: (selectedOptions: PickerOption[], selectedValue: (string | number)[]) => void /** * 选项改变时触发 * @default - */ onChange?: (selectedOptions: PickerOption[], selectedValue: (string | number)[], columnIndex: number) => void } export declare const DatePicker: FunctionComponent<Partial<DatePickerProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'>>;