@nutui/nutui-react
Version:
京东风格的轻量级移动端 React 组件库,支持一套代码生成 H5 和小程序
92 lines (91 loc) • 2.3 kB
TypeScript
import { default as React, FunctionComponent } from 'react';
import { PickerOption, PickerProps } from '../picker/index';
import { BasicComponent } from '../../utils/typings';
export interface DatePickerProps extends BasicComponent {
/**
* 受控
* @default null
*/
value?: Date
/**
* 初始值
* @default null
*/
defaultValue?: Date
/**
* 是否可见
* @default false
*/
visible: boolean
/**
* 设置标题
* @default null
*/
title: string
/**
* 类时间类型,可选值 date time year-month month-day datehour datetime hour-minutes
* @default date
*/
type: 'date' | 'time' | 'year-month' | 'month-day' | 'datehour' | 'datetime' | 'hour-minutes'
/**
* 每列是否展示中文
* @default false
*/
showChinese: boolean
/**
* 分钟步进值
* @default 1
*/
minuteStep: number
/**
* 开始日期
* @default 十年前
*/
startDate: Date
/**
* 结束日期
* @default 十年后
*/
endDate: Date
/**
* 是否开启3D效果
* @default true
*/
threeDimensional: boolean
/**
* 透传picker属性
* @default -
*/
pickerProps: Partial<Omit<PickerProps, 'defaultValue' | 'threeDimensional' | 'title' | 'value' | 'onConfirm' | 'onClose' | 'onCancel' | 'onChange'>>
/**
* 选项格式化函数
* @default -
*/
formatter: (type: string, option: PickerOption) => PickerOption
/**
* 选项过滤函数
* @default -
*/
filter: (type: string, option: PickerOption[]) => PickerOption[]
/**
* 确定和取消时,都触发
* @default -
*/
onClose: () => void
/**
* 点击取消按钮时触发
* @default -
*/
onCancel: () => 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'>>;