UNPKG

2.62 kBTypeScriptView Raw
1/// <reference types="react" />
2
3import * as React from 'react';
4import CommonProps from '../util';
5import { PopupProps } from '../overlay';
6
7interface HTMLAttributesWeak extends React.HTMLAttributes<HTMLElement> {
8 defaultValue?: any;
9 onChange?: any;
10}
11
12export interface TimePickerProps extends HTMLAttributesWeak, CommonProps {
13 /**
14 * 按钮的文案
15 */
16 label?: React.ReactNode;
17 name?: string;
18
19 /**
20 * 输入框状态
21 */
22 state?: 'error' | 'success';
23
24 /**
25 * 输入框提示
26 */
27 placeholder?: string;
28
29 /**
30 * 时间值(moment 对象或时间字符串,受控状态使用)
31 */
32 value?: any;
33
34 /**
35 * 时间初值(moment 对象或时间字符串,非受控状态使用)
36 */
37 defaultValue?: any;
38
39 /**
40 * 时间选择框的尺寸
41 */
42 size?: 'small' | 'medium' | 'large';
43
44 /**
45 * 是否允许清空时间
46 */
47 hasClear?: boolean;
48
49 /**
50 * 时间的格式
51 * https://momentjs.com/docs/#/parsing/string-format/
52 */
53 format?: string;
54
55 /**
56 * 小时选项步长
57 */
58 hourStep?: number;
59
60 /**
61 * 分钟选项步长
62 */
63 minuteStep?: number;
64
65 /**
66 * 秒钟选项步长
67 */
68 secondStep?: number;
69
70 /**
71 * 禁用小时函数
72 */
73 disabledHours?: (index: number) => boolean;
74
75 /**
76 * 禁用分钟函数
77 */
78 disabledMinutes?: (index: number) => boolean;
79
80 /**
81 * 禁用秒钟函数
82 */
83 disabledSeconds?: (index: number) => boolean;
84
85 /**
86 * 弹层是否显示(受控)
87 */
88 visible?: boolean;
89
90 /**
91 * 弹层默认是否显示(非受控)
92 */
93 defaultVisible?: boolean;
94
95 /**
96 * 弹层容器
97 */
98 popupContainer?: string | HTMLElement | ((target: HTMLElement) => HTMLElement);
99
100 /**
101 * 弹层对齐方式, 详情见Overlay 文档
102 */
103 popupAlign?: string;
104
105 /**
106 * 弹层触发方式
107 */
108 popupTriggerType?: 'click' | 'hover';
109
110 /**
111 * 弹层展示状态变化时的回调
112 */
113 onVisibleChange?: (visible: boolean, reason: string) => void;
114
115 /**
116 * 弹层自定义样式
117 */
118 popupStyle?: React.CSSProperties;
119
120 /**
121 * 弹层自定义样式类
122 */
123 popupClassName?: string;
124
125 /**
126 * 弹层属性
127 */
128 popupProps?: PopupProps;
129
130 /**
131 * 是否禁用
132 */
133 disabled?: boolean;
134
135 /**
136 * 时间值改变时的回调
137 */
138 onChange?: (value: any | string) => void;
139}
140
141export default class TimePicker extends React.Component<TimePickerProps, any> {}