commit | author | age
|
92485e
|
1 |
// Type definitions for react-datetime |
IV |
2 |
// Project: https://github.com/YouCanBookMe/react-datetime |
|
3 |
// Definitions by: Ivan Verevkin <vereva@x-root.org> |
|
4 |
|
|
5 |
//// <reference path="../moment/moment-node.d.ts" /> |
|
6 |
|
|
7 |
declare module ReactDatetime { |
|
8 |
import React = __React; |
|
9 |
// import * as moment from 'moment'; |
|
10 |
|
|
11 |
export interface DatetimepickerProps { |
|
12 |
/* |
|
13 |
Represents the selected date by the component, in order to use it as a controlled component. |
|
14 |
This prop is parsed by moment.js, so it is possible to use a date string or a moment.js date. |
|
15 |
*/ |
|
16 |
value?: string; |
|
17 |
/* |
|
18 |
Represents the selected date for the component to use it as a uncontrolled component. |
|
19 |
This prop is parsed by moment.js, so it is possible to use a date string or a moment.js date. |
|
20 |
*/ |
|
21 |
defaultValue?: string; |
|
22 |
/* |
|
23 |
Defines the format for the date. It accepts any moment.js date format. |
|
24 |
If true the date will be displayed using the defaults for the current locale. |
|
25 |
If false the datepicker is disabled and the component can be used as timepicker. |
|
26 |
*/ |
|
27 |
dateFormat?: boolean|string; |
|
28 |
/* |
|
29 |
Defines the format for the time. It accepts any moment.js time format. |
|
30 |
If true the time will be displayed using the defaults for the current locale. |
|
31 |
If false the timepicker is disabled and the component can be used as datepicker. |
|
32 |
*/ |
|
33 |
timeFormat?: boolean|string; |
|
34 |
/* |
|
35 |
Wether to show an input field to edit the date manually. |
|
36 |
*/ |
|
37 |
input?: boolean; |
|
38 |
/* |
|
39 |
Wether to open or close the picker. If not set react-datetime will open the |
|
40 |
datepicker on input focus and close it on click outside. |
|
41 |
*/ |
|
42 |
open?: boolean; |
|
43 |
/* |
|
44 |
Manually set the locale for the react-datetime instance. |
|
45 |
Moment.js locale needs to be loaded to be used, see i18n docs. |
|
46 |
*/ |
|
47 |
locale?: string; |
|
48 |
/* |
|
49 |
Callback trigger when the date changes. The callback receives the selected moment object as |
|
50 |
only parameter, if the date in the input is valid. If it isn't, the value |
|
51 |
of the input (a string) is returned. |
|
52 |
*/ |
|
53 |
onChange?:(x: string) => void; |
|
54 |
/* |
|
55 |
Callback trigger for when the user opens the datepicker. |
|
56 |
*/ |
|
57 |
onFocus?: (e) => void; |
|
58 |
/* |
|
59 |
Callback trigger for when the user clicks outside of the input, simulating a regular onBlur. |
|
60 |
The callback receives the selected moment object as only parameter, if the date in the |
|
61 |
input is valid. If it isn't, the value of the input (a string) is returned. |
|
62 |
*/ |
|
63 |
onBlurs?: (e) => void; |
|
64 |
/* |
|
65 |
The default view to display when the picker is shown. ('years', 'months', 'days', 'time') |
|
66 |
*/ |
|
67 |
viewMode?: string|number; |
|
68 |
/* |
|
69 |
Extra class names for the component markup. |
|
70 |
*/ |
|
71 |
className?: string; |
|
72 |
/* |
|
73 |
Defines additional attributes for the input element of the component. |
|
74 |
*/ |
|
75 |
inputProps?: Object; |
|
76 |
/* |
|
77 |
Define the dates that can be selected. The function receives (currentDate, selectedDate) |
|
78 |
and should return a true or false whether the currentDate is valid or not. See selectable dates. |
|
79 |
*/ |
|
80 |
isValidDate?: (x: string) => void; |
|
81 |
/* |
|
82 |
Customize the way that the days are shown in the day picker. The accepted function has |
|
83 |
the selectedDate, the current date and the default calculated props for the cell, |
|
84 |
and must return a React component. See appearance customization |
|
85 |
*/ |
|
86 |
renderDay?: (x: string) => void; |
|
87 |
/* |
|
88 |
Customize the way that the months are shown in the month picker. |
|
89 |
The accepted function has the selectedDate, the current date and the default calculated |
|
90 |
props for the cell, the month and the year to be shown, and must return a |
|
91 |
React component. See appearance customization |
|
92 |
*/ |
|
93 |
renderMonth?: (x: string) => void; |
|
94 |
/* |
|
95 |
Customize the way that the years are shown in the year picker. |
|
96 |
The accepted function has the selectedDate, the current date and the default calculated |
|
97 |
props for the cell, the year to be shown, and must return a React component. |
|
98 |
See appearance customization |
|
99 |
*/ |
|
100 |
renderYear?: (x: string) => void; |
|
101 |
/* |
|
102 |
Whether to use moment's strict parsing when parsing input. |
|
103 |
*/ |
|
104 |
strictParsing?: boolean; |
|
105 |
/* |
|
106 |
When true, once the day has been selected, the react-datetime will be automatically closed. |
|
107 |
*/ |
|
108 |
closeOnSelect?: boolean; |
|
109 |
} |
|
110 |
|
|
111 |
interface DatetimeComponent extends React.ComponentClass<DatetimepickerProps> { |
|
112 |
} |
|
113 |
} |
|
114 |
|
|
115 |
declare module "react-datetime" { |
|
116 |
var ReactDatetime: ReactDatetime.DatetimeComponent; |
|
117 |
export = ReactDatetime; |
|
118 |
} |