1/* 2 * Copyright (c) 2021 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 * Defines the struct of TimePickerResult. 18 * @since 8 19 */ 20declare interface TimePickerResult { 21 /** 22 * Application hour 23 * @since 8 24 */ 25 hour?: number; 26 27 /** 28 * Application minute 29 * @since 8 30 */ 31 minute?: number; 32} 33 34/** 35 * Defines the options of TimePicker. 36 * @since 8 37 */ 38declare interface TimePickerOptions { 39 /** 40 * Specifies the time selector check time. 41 */ 42 selected?: Date; 43} 44 45/** 46 * Defines the TimePicker Component. 47 * @since 8 48 */ 49interface TimePickerInterface { 50 /** 51 * Defines the TimePicker constructor. 52 * @since 8 53 */ 54 (options?: TimePickerOptions): TimePickerAttribute; 55} 56 57/** 58 * Defines the TimePicker attribute functions. 59 * @since 8 60 */ 61declare class TimePickerAttribute extends CommonMethod<TimePickerAttribute> { 62 /** 63 * Time Selector: indicates whether to display the 24-hour clock. 64 * @since 8 65 */ 66 useMilitaryTime(value: boolean): TimePickerAttribute; 67 68 /** 69 * This event is triggered when a TimePicker time is selected. 70 * @since 8 71 */ 72 onChange(callback: (value: TimePickerResult) => void): TimePickerAttribute; 73} 74 75/** 76 * Defines the TimePickerDialogOptions for Data Picker Dialog. 77 * @since 8 78 */ 79declare interface TimePickerDialogOptions extends TimePickerOptions { 80 /** 81 * Time Selector: indicates whether to display the 24-hour clock. 82 * @since 8 83 */ 84 useMilitaryTime?: boolean; 85 /** 86 * Called when the OK button in the dialog is clicked. 87 * @since 8 88 */ 89 onAccept?: (value: TimePickerResult) => void; 90 /** 91 * Called when the Cancel button in the dialog is clicked. 92 * @since 8 93 */ 94 onCancel?: () => void; 95 /** 96 * This event is triggered when a TimePicker Time or time is selected in dialog. 97 * @since 8 98 */ 99 onChange?: (value: TimePickerResult) => void; 100} 101 102/** 103 * Defines TimePickerDialog which uses show method to show TimePicker dialog. 104 * @since 8 105 */ 106declare class TimePickerDialog { 107 /** 108 * Invoking method display. 109 * @since 8 110 */ 111 static show(options?: TimePickerDialogOptions); 112} 113 114/** 115 * Defines TimePicker Component. 116 * @since 8 117 */ 118declare const TimePicker: TimePickerInterface; 119 120/** 121 * Defines TimePicker Component instance. 122 * @since 8 123 */ 124declare const TimePickerInstance: TimePickerAttribute; 125