1/*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit ArkUI
19 */
20
21/**
22 * The type of alignment between entry and calendar.
23 * @enum {number}
24 * @syscap SystemCapability.ArkUI.ArkUI.Full
25 * @crossplatform
26 * @since 10
27 */
28/**
29 * The type of alignment between entry and calendar.
30 * @enum {number}
31 * @syscap SystemCapability.ArkUI.ArkUI.Full
32 * @crossplatform
33 * @atomicservice
34 * @since 11
35 */
36declare enum CalendarAlign {
37  /**
38   * The value of calendar align type start.
39   * @syscap SystemCapability.ArkUI.ArkUI.Full
40   * @crossplatform
41   * @since 10
42   */
43  /**
44   * The value of calendar align type start.
45   * @syscap SystemCapability.ArkUI.ArkUI.Full
46   * @crossplatform
47   * @atomicservice
48   * @since 11
49   */
50  START = 0,
51  /**
52   * The value of calendar align type center.
53   * @syscap SystemCapability.ArkUI.ArkUI.Full
54   * @crossplatform
55   * @since 10
56   */
57  /**
58   * The value of calendar align type center.
59   * @syscap SystemCapability.ArkUI.ArkUI.Full
60   * @crossplatform
61   * @atomicservice
62   * @since 11
63   */
64  CENTER = 1,
65  /**
66   * The value of calendar align type end.
67   * @syscap SystemCapability.ArkUI.ArkUI.Full
68   * @crossplatform
69   * @since 10
70   */
71  /**
72   * The value of calendar align type end.
73   * @syscap SystemCapability.ArkUI.ArkUI.Full
74   * @crossplatform
75   * @atomicservice
76   * @since 11
77   */
78  END = 2
79}
80
81/**
82 * Defines the options of CalendarPicker.
83 * @interface CalendarOptions
84 * @syscap SystemCapability.ArkUI.ArkUI.Full
85 * @crossplatform
86 * @since 10
87 */
88/**
89 * Defines the options of CalendarPicker.
90 * @interface CalendarOptions
91 * @syscap SystemCapability.ArkUI.ArkUI.Full
92 * @crossplatform
93 * @atomicservice
94 * @since 11
95 */
96declare interface CalendarOptions {
97  /**
98   * Specifies the radius of the background of the day in calendar.
99   * @type { ?(number | Resource) }
100   * @syscap SystemCapability.ArkUI.ArkUI.Full
101   * @crossplatform
102   * @since 10
103   */
104  /**
105   * Specifies the radius of the background of the day in calendar.
106   * @type { ?(number | Resource) }
107   * @syscap SystemCapability.ArkUI.ArkUI.Full
108   * @crossplatform
109   * @atomicservice
110   * @since 11
111   */
112  hintRadius?: number | Resource;
113
114  /**
115   * Specifies the date selector check date.
116   * @type { ?Date }
117   * @syscap SystemCapability.ArkUI.ArkUI.Full
118   * @crossplatform
119   * @since 10
120   */
121  /**
122   * Specifies the date selector check date.
123   * @type { ?Date }
124   * @syscap SystemCapability.ArkUI.ArkUI.Full
125   * @crossplatform
126   * @atomicservice
127   * @since 11
128   */
129  selected?: Date;
130}
131
132/**
133 * Defines the CalendarPicker Component.
134 * @interface CalendarPickerInterface
135 * @syscap SystemCapability.ArkUI.ArkUI.Full
136 * @crossplatform
137 * @since 10
138 */
139/**
140 * Defines the CalendarPicker Component.
141 * @interface CalendarPickerInterface
142 * @syscap SystemCapability.ArkUI.ArkUI.Full
143 * @crossplatform
144 * @atomicservice
145 * @since 11
146 */
147interface CalendarPickerInterface {
148  /**
149   * Defines the CalendarPicker constructor.
150   * @param { CalendarOptions } options - the option of th calendarPicker.
151   * @returns { CalendarPickerAttribute } the attribute of the CalendarPicker.
152   * @syscap SystemCapability.ArkUI.ArkUI.Full
153   * @crossplatform
154   * @since 10
155   */
156  /**
157   * Defines the CalendarPicker constructor.
158   * @param { CalendarOptions } options - the option of th calendarPicker.
159   * @returns { CalendarPickerAttribute } the attribute of the CalendarPicker.
160   * @syscap SystemCapability.ArkUI.ArkUI.Full
161   * @crossplatform
162   * @atomicservice
163   * @since 11
164   */
165  (options?: CalendarOptions): CalendarPickerAttribute;
166}
167
168/**
169 * Defines the CalendarPicker attribute functions.
170 * @extends CommonMethod<CalendarPickerAttribute>
171 * @syscap SystemCapability.ArkUI.ArkUI.Full
172 * @crossplatform
173 * @since 10
174 */
175/**
176 * Defines the CalendarPicker attribute functions.
177 * @extends CommonMethod<CalendarPickerAttribute>
178 * @syscap SystemCapability.ArkUI.ArkUI.Full
179 * @crossplatform
180 * @atomicservice
181 * @since 11
182 */
183declare class CalendarPickerAttribute extends CommonMethod<CalendarPickerAttribute> {
184  /**
185   * Set the alignment between entry and calendar dialog.
186   * @param { CalendarAlign } alignType - The type of alignment between entry and calendar dialog.
187   * @param { Offset } offset - The offset between entry and calendar dialog.
188   * @returns { CalendarPickerAttribute } the attribute of the CalendarPicker.
189   * @syscap SystemCapability.ArkUI.ArkUI.Full
190   * @crossplatform
191   * @since 10
192   */
193  /**
194   * Set the alignment between entry and calendar dialog.
195   * @param { CalendarAlign } alignType - The type of alignment between entry and calendar dialog.
196   * @param { Offset } offset - The offset between entry and calendar dialog.
197   * @returns { CalendarPickerAttribute } the attribute of the CalendarPicker.
198   * @syscap SystemCapability.ArkUI.ArkUI.Full
199   * @crossplatform
200   * @atomicservice
201   * @since 11
202   */
203  edgeAlign(alignType: CalendarAlign, offset?: Offset): CalendarPickerAttribute;
204
205  /**
206   * Sets the text style of entry
207   * @param { PickerTextStyle } value - indicates the text style of entry.
208   * @returns { CalendarPickerAttribute } the attribute of the CalendarPicker.
209   * @syscap SystemCapability.ArkUI.ArkUI.Full
210   * @crossplatform
211   * @since 10
212   */
213  /**
214   * Sets the text style of entry
215   * @param { PickerTextStyle } value - indicates the text style of entry.
216   * @returns { CalendarPickerAttribute } the attribute of the CalendarPicker.
217   * @syscap SystemCapability.ArkUI.ArkUI.Full
218   * @crossplatform
219   * @atomicservice
220   * @since 11
221   */
222  textStyle(value: PickerTextStyle): CalendarPickerAttribute;
223
224  /**
225   * Callback for selected date changed.
226   * @param { function } callback - Callback for selected date changed.
227   * @returns { CalendarPickerAttribute } the attribute of the CalendarPicker.
228   * @syscap SystemCapability.ArkUI.ArkUI.Full
229   * @crossplatform
230   * @since 10
231   */
232  /**
233   * Callback for selected date changed.
234   * @param { function } callback - Callback for selected date changed.
235   * @returns { CalendarPickerAttribute } the attribute of the CalendarPicker.
236   * @syscap SystemCapability.ArkUI.ArkUI.Full
237   * @crossplatform
238   * @atomicservice
239   * @since 11
240   */
241  /**
242   * Callback for selected date changed.
243   * @param { Callback<Date> } callback - callback for selected date changed.
244   * @returns { CalendarPickerAttribute } the attribute of the CalendarPicker.
245   * @syscap SystemCapability.ArkUI.ArkUI.Full
246   * @crossplatform
247   * @atomicservice
248   * @since 13
249   */
250  onChange(callback: Callback<Date>): CalendarPickerAttribute;
251}
252
253/**
254 * Defines the DatePickerDialogOptions for Calendar Picker Dialog.
255 * @interface CalendarDialogOptions
256 * @syscap SystemCapability.ArkUI.ArkUI.Full
257 * @crossplatform
258 * @since 10
259 */
260/**
261 * Defines the DatePickerDialogOptions for Calendar Picker Dialog.
262 * @interface CalendarDialogOptions
263 * @syscap SystemCapability.ArkUI.ArkUI.Full
264 * @crossplatform
265 * @atomicservice
266 * @since 11
267 */
268declare interface CalendarDialogOptions extends CalendarOptions {
269  /**
270   * Called when the OK button in the dialog is clicked.
271   * @type { ?function }
272   * @syscap SystemCapability.ArkUI.ArkUI.Full
273   * @crossplatform
274   * @since 10
275   */
276  /**
277   * Called when the OK button in the dialog is clicked.
278   * @type { ?function }
279   * @syscap SystemCapability.ArkUI.ArkUI.Full
280   * @crossplatform
281   * @atomicservice
282   * @since 11
283   */
284  /**
285   * Called when the OK button in the dialog is clicked.
286   * @type { ?Callback<Date> }
287   * @syscap SystemCapability.ArkUI.ArkUI.Full
288   * @crossplatform
289   * @atomicservice
290   * @since 13
291   */
292  onAccept?: Callback<Date>;
293
294  /**
295   * Called when the Cancel button in the dialog is clicked.
296   * @type { ?function }
297   * @syscap SystemCapability.ArkUI.ArkUI.Full
298   * @crossplatform
299   * @since 10
300   */
301  /**
302   * Called when the Cancel button in the dialog is clicked.
303   * @type { ?function }
304   * @syscap SystemCapability.ArkUI.ArkUI.Full
305   * @crossplatform
306   * @atomicservice
307   * @since 11
308   */
309  /**
310   * Called when the Cancel button in the dialog is clicked.
311   * @type { ?VoidCallback }
312   * @syscap SystemCapability.ArkUI.ArkUI.Full
313   * @crossplatform
314   * @atomicservice
315   * @since 13
316   */
317  onCancel?: VoidCallback;
318
319  /**
320   * This event is triggered when a date is selected in dialog.
321   * @type { ?function }
322   * @syscap SystemCapability.ArkUI.ArkUI.Full
323   * @crossplatform
324   * @since 10
325   */
326  /**
327   * This event is triggered when a date is selected in dialog.
328   * @type { ?function }
329   * @syscap SystemCapability.ArkUI.ArkUI.Full
330   * @crossplatform
331   * @atomicservice
332   * @since 11
333   */
334  /**
335   * This event is triggered when a date is selected in dialog.
336   * @type { ?Callback<Date> }
337   * @syscap SystemCapability.ArkUI.ArkUI.Full
338   * @crossplatform
339   * @atomicservice
340   * @since 13
341   */
342  onChange?: Callback<Date>;
343
344  /**
345   * Defines the calendarPickerDialog's background color
346   *
347   * @type { ?ResourceColor }
348   * @default Color.Transparent
349   * @syscap SystemCapability.ArkUI.ArkUI.Full
350   * @crossplatform
351   * @since 11
352   */
353  /**
354   * Defines the calendarPickerDialog's background color
355   *
356   * @type { ?ResourceColor }
357   * @default Color.Transparent
358   * @syscap SystemCapability.ArkUI.ArkUI.Full
359   * @crossplatform
360   * @atomicservice
361   * @since 12
362   */
363  backgroundColor?: ResourceColor;
364
365  /**
366   * Defines the calendarPickerDialog's background blur Style
367   *
368   * @type { ?BlurStyle }
369   * @default BlurStyle.COMPONENT_ULTRA_THICK
370   * @syscap SystemCapability.ArkUI.ArkUI.Full
371   * @crossplatform
372   * @since 11
373   */
374  /**
375   * Defines the calendarPickerDialog's background blur Style
376   *
377   * @type { ?BlurStyle }
378   * @default BlurStyle.COMPONENT_ULTRA_THICK
379   * @syscap SystemCapability.ArkUI.ArkUI.Full
380   * @crossplatform
381   * @atomicservice
382   * @since 12
383   */
384  backgroundBlurStyle?: BlurStyle;
385
386  /**
387   * Style of accept button.
388   *
389   * @type { ?PickerDialogButtonStyle }
390   * @syscap SystemCapability.ArkUI.ArkUI.Full
391   * @crossplatform
392   * @atomicservice
393   * @since 12
394   */
395  acceptButtonStyle?: PickerDialogButtonStyle;
396
397  /**
398   * Style of cancel button.
399   *
400   * @type { ?PickerDialogButtonStyle }
401   * @syscap SystemCapability.ArkUI.ArkUI.Full
402   * @crossplatform
403   * @atomicservice
404   * @since 12
405   */
406  cancelButtonStyle?: PickerDialogButtonStyle;
407
408  /**
409   * Callback function when the dialog appears.
410   *
411   * @type { ?function }
412   * @syscap SystemCapability.ArkUI.ArkUI.Full
413   * @crossplatform
414   * @atomicservice
415   * @since 12
416   */
417  /**
418   * Callback function when the dialog appears.
419   *
420   * @type { ?VoidCallback }
421   * @syscap SystemCapability.ArkUI.ArkUI.Full
422   * @crossplatform
423   * @atomicservice
424   * @since 13
425   */
426  onDidAppear?: VoidCallback;
427
428  /**
429   * Callback function when the dialog disappears.
430   *
431   * @type { ?function }
432   * @syscap SystemCapability.ArkUI.ArkUI.Full
433   * @crossplatform
434   * @atomicservice
435   * @since 12
436   */
437  /**
438   * Callback function when the dialog disappears.
439   *
440   * @type { ?VoidCallback }
441   * @syscap SystemCapability.ArkUI.ArkUI.Full
442   * @crossplatform
443   * @atomicservice
444   * @since 13
445   */
446  onDidDisappear?: VoidCallback;
447
448  /**
449   * Callback function before the dialog openAnimation starts.
450   *
451   * @type { ?function }
452   * @syscap SystemCapability.ArkUI.ArkUI.Full
453   * @crossplatform
454   * @atomicservice
455   * @since 12
456   */
457  /**
458   * Callback function before the dialog openAnimation starts.
459   *
460   * @type { ?VoidCallback }
461   * @syscap SystemCapability.ArkUI.ArkUI.Full
462   * @crossplatform
463   * @atomicservice
464   * @since 13
465   */
466  onWillAppear?: VoidCallback;
467
468  /**
469   * Callback function before the dialog closeAnimation starts.
470   *
471   * @type { ?function }
472   * @syscap SystemCapability.ArkUI.ArkUI.Full
473   * @crossplatform
474   * @atomicservice
475   * @since 12
476   */
477  /**
478   * Callback function before the dialog closeAnimation starts.
479   *
480   * @type { ?VoidCallback }
481   * @syscap SystemCapability.ArkUI.ArkUI.Full
482   * @crossplatform
483   * @atomicservice
484   * @since 13
485   */
486  onWillDisappear?: VoidCallback;
487
488  /**
489   * Defines the dialog's shadow.
490   *
491   * @type { ?(ShadowOptions | ShadowStyle) }
492   * @syscap SystemCapability.ArkUI.ArkUI.Full
493   * @crossplatform
494   * @atomicservice
495   * @since 12
496   */
497  shadow?: ShadowOptions | ShadowStyle;
498
499  /**
500   * Defines whether to respond to the hover mode.
501   *
502   * @type { ?boolean }
503   * @default false
504   * @syscap SystemCapability.ArkUI.ArkUI.Full
505   * @crossplatform
506   * @atomicservice
507   * @since 13
508   */
509  enableHoverMode?: boolean;
510
511  /**
512   * Defines the dialog's display area in hover mode.
513   *
514   * @type { ?HoverModeAreaType }
515   * @default HoverModeAreaType.BOTTOM_SCREEN
516   * @syscap SystemCapability.ArkUI.ArkUI.Full
517   * @crossplatform
518   * @atomicservice
519   * @since 13
520   */
521  hoverModeArea?: HoverModeAreaType;
522}
523
524/**
525 * Defines CalendarPickerDialog which uses show method to show CalendarPicker dialog.
526 * @syscap SystemCapability.ArkUI.ArkUI.Full
527 * @crossplatform
528 * @since 10
529 */
530/**
531 * Defines CalendarPickerDialog which uses show method to show CalendarPicker dialog.
532 * @syscap SystemCapability.ArkUI.ArkUI.Full
533 * @crossplatform
534 * @atomicservice
535 * @since 11
536 */
537declare class CalendarPickerDialog {
538  /**
539   * Invoking method display.
540   * @param { CalendarDialogOptions } options - the option of th calendarPicker.
541   * @syscap SystemCapability.ArkUI.ArkUI.Full
542   * @crossplatform
543   * @since 10
544   */
545  /**
546   * Invoking method display.
547   * @param { CalendarDialogOptions } options - the option of th calendarPicker.
548   * @syscap SystemCapability.ArkUI.ArkUI.Full
549   * @crossplatform
550   * @atomicservice
551   * @since 11
552   */
553  static show(options?: CalendarDialogOptions): void;
554}
555
556/**
557 * Defines CalendarPicker Component.
558 * @syscap SystemCapability.ArkUI.ArkUI.Full
559 * @crossplatform
560 * @since 10
561 */
562/**
563 * Defines CalendarPicker Component.
564 * @syscap SystemCapability.ArkUI.ArkUI.Full
565 * @crossplatform
566 * @atomicservice
567 * @since 11
568 */
569declare const CalendarPicker: CalendarPickerInterface;
570
571/**
572 * Defines CalendarPicker Component instance.
573 * @syscap SystemCapability.ArkUI.ArkUI.Full
574 * @crossplatform
575 * @since 10
576 */
577/**
578 * Defines CalendarPicker Component instance.
579 * @syscap SystemCapability.ArkUI.ArkUI.Full
580 * @crossplatform
581 * @atomicservice
582 * @since 11
583 */
584declare const CalendarPickerInstance: CalendarPickerAttribute;
585