forked from capacitor-community/date-picker
-
Notifications
You must be signed in to change notification settings - Fork 3
/
definitions.ts
188 lines (183 loc) · 4.56 KB
/
definitions.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
export type DatePickerMode = 'time' | 'date' | 'dateAndTime' | 'countDownTimer';
export type DatePickerTheme = 'light' | 'dark' | string;
export type DatePickerIosStyle = 'wheels' | 'inline';
export interface DatePickerBaseOptions {
/**
* @type {string}
* @default "yyyy-MM-dd'T'HH:mm:ss.sssZ"
*
* @description ISO String format
* @deprecated please, migrate this to ios and android props because the api is a little bit differen
* @note For ios read (https://developer.apple.com/documentation/foundation/dateformatter)
* @note For android read (https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html)
*/
format?: string;
/**
* @type {string}
* @default null
*
* @description If null, empty or undefined, use the device locale
* @note for ios you can read abouth locale here (https://developer.apple.com/documentation/foundation/locale)
* @note for android you can read abouth locale here (https://docs.oracle.com/javase/7/docs/api/java/util/Locale.html)
*/
locale?: string;
/**
* @type {DatePickerMode}
* @default "dateAndTime"
*
* @description Datepicker mode
*/
mode?: DatePickerMode;
/**
* @type {DatePickerTheme}
* @default "light"
*
* @description Datepicker themes
*/
theme?: DatePickerTheme;
/**
* @type: string
* @default: null
*
* @description If null, empty or undefined, will be the device timezone
*/
timezone?: string;
/**
* @type {string}
* @default null
*
* @description If null, empty or undefined, will be "OK".
*/
doneText?: string;
/**
* @type {string}
* @default null
*
* @description If null, empty or undefined, will be "CANCEL".
*/
cancelText?: string;
/**
* @type {string}
* @default null
*
* @description If null, empty or undefined, will be "false".
*/
is24h?: boolean;
}
export interface DatePickerAndroidptions extends DatePickerBaseOptions {
/**
* @type {string}
* @default "yyyy-MM-dd'T'HH:mm:ss.sss"
*
* @description ISO String format
* @note For android read (https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html)
*/
format?: string;
}
export interface DatePickerIosOptions extends DatePickerBaseOptions {
/**
* @type {DatePickerIosStyle}
* @default "inline"
* @note works only iOS 14.0 or heiger
* @description Modal style for ios, for mor information, access: https://developer.apple.com/documentation/uikit/uidatepicker
*/
style?: DatePickerIosStyle;
/**
* @type {string}
* @default "yyyy-MM-dd'T'HH:mm:ss.sssZ"
*
* @description ISO String format
* @note Read (https://developer.apple.com/documentation/foundation/dateformatter)
*/
format?: string;
/**
* @type {string}
* @default null
*
* @description hex string for title font color
*/
titleFontColor?: string;
/**
* @type {string}
* @default null
*
* @description hex string for title background color
*/
titleBgColor?: string;
/**
* @type {string}
* @default null
*
* @description hex string for picker background color
*/
bgColor?: string;
/**
* @type {string}
* @default null
*
* @description hex string for picker font color
* @note not work in inline style
*/
fontColor?: string;
/**
* @type {string}
* @default null
*
* @description hex string for buttons background color
*/
buttonBgColor?: string;
/**
* @type {string}
* @default null
*
* @description hex string for button font color
*/
buttonFontColor?: string;
/**
* @type {boolean}
* @default null
*
* @description Format dateAndTime picker for ios
*/
mergedDateAndTime?: boolean;
}
export interface DatePickerOptions extends DatePickerBaseOptions {
/**
* @type {string}
* @default null
*
* @description If null, empty or undefined, will be none. use Date.toISOString()
*/
min?: string;
/**
* @type {string}
* @default null
*
* @description If null, empty or undefined, will be none. use Date.toISOString()
*/
max?: string;
/**
* @type {string}
* @default null
*
* @description If null, empty or undefined, will be current date
*/
date?: string;
/**
* @type {DatePickerIosOptions}
* @default null
*
* @description Personal configs for ios
*/
ios?: DatePickerIosOptions;
/**
* @type {DatePickerBaseOptions}
* @default null
*
* @description Personal configs for android
*/
android?: DatePickerBaseOptions;
}
export interface DatePickerPlugin {
present(options: DatePickerOptions): Promise<{ value: string }>;
}