1/* 2 * Copyright (c) 2021-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 * Defines the struct of TimePickerResult. 18 * 19 * @interface TimePickerResult 20 * @syscap SystemCapability.ArkUI.ArkUI.Full 21 * @since 8 22 */ 23/** 24 * Defines the struct of TimePickerResult. 25 * 26 * @interface TimePickerResult 27 * @syscap SystemCapability.ArkUI.ArkUI.Full 28 * @crossplatform 29 * @since 10 30 */ 31declare interface TimePickerResult { 32 /** 33 * Application hour 34 * 35 * @type { ?number } 36 * @syscap SystemCapability.ArkUI.ArkUI.Full 37 * @since 8 38 */ 39 /** 40 * Application hour 41 * 42 * @type { ?number } 43 * @syscap SystemCapability.ArkUI.ArkUI.Full 44 * @crossplatform 45 * @since 10 46 */ 47 hour?: number; 48 49 /** 50 * Application minute 51 * 52 * @type { ?number } 53 * @syscap SystemCapability.ArkUI.ArkUI.Full 54 * @since 8 55 */ 56 /** 57 * Application minute 58 * 59 * @type { ?number } 60 * @syscap SystemCapability.ArkUI.ArkUI.Full 61 * @crossplatform 62 * @since 10 63 */ 64 minute?: number; 65} 66 67/** 68 * Defines the options of TimePicker. 69 * 70 * @interface TimePickerOptions 71 * @syscap SystemCapability.ArkUI.ArkUI.Full 72 * @since 8 73 */ 74/** 75 * Defines the options of TimePicker. 76 * 77 * @interface TimePickerOptions 78 * @syscap SystemCapability.ArkUI.ArkUI.Full 79 * @crossplatform 80 * @since 10 81 */ 82declare interface TimePickerOptions { 83 /** 84 * Specifies the time selector check time. 85 * 86 * @type { ?Date } 87 * @syscap SystemCapability.ArkUI.ArkUI.Full 88 * @since 8 89 */ 90 /** 91 * Specifies the time selector check time. 92 * 93 * @type { ?Date } 94 * @syscap SystemCapability.ArkUI.ArkUI.Full 95 * @crossplatform 96 * @since 10 97 */ 98 selected?: Date; 99} 100 101/** 102 * Defines the TimePicker Component. 103 * 104 * @interface TimePickerInterface 105 * @syscap SystemCapability.ArkUI.ArkUI.Full 106 * @since 8 107 */ 108/** 109 * Defines the TimePicker Component. 110 * 111 * @interface TimePickerInterface 112 * @syscap SystemCapability.ArkUI.ArkUI.Full 113 * @crossplatform 114 * @since 10 115 */ 116interface TimePickerInterface { 117 /** 118 * Defines the TimePicker constructor. 119 * 120 * @param { TimePickerOptions } options 121 * @returns { TimePickerAttribute } 122 * @syscap SystemCapability.ArkUI.ArkUI.Full 123 * @since 8 124 */ 125 /** 126 * Defines the TimePicker constructor. 127 * 128 * @param { TimePickerOptions } options 129 * @returns { TimePickerAttribute } 130 * @syscap SystemCapability.ArkUI.ArkUI.Full 131 * @crossplatform 132 * @since 10 133 */ 134 (options?: TimePickerOptions): TimePickerAttribute; 135} 136 137/** 138 * Defines the TimePicker attribute functions. 139 * 140 * @extends CommonMethod 141 * @syscap SystemCapability.ArkUI.ArkUI.Full 142 * @since 8 143 */ 144/** 145 * Defines the TimePicker attribute functions. 146 * 147 * @extends CommonMethod 148 * @syscap SystemCapability.ArkUI.ArkUI.Full 149 * @crossplatform 150 * @since 10 151 */ 152declare class TimePickerAttribute extends CommonMethod<TimePickerAttribute> { 153 /** 154 * Time Selector: indicates whether to display the 24-hour clock. 155 * 156 * @param { boolean } value 157 * @returns { TimePickerAttribute } 158 * @syscap SystemCapability.ArkUI.ArkUI.Full 159 * @since 8 160 */ 161 /** 162 * Time Selector: indicates whether to display the 24-hour clock. 163 * 164 * @param { boolean } value 165 * @returns { TimePickerAttribute } 166 * @syscap SystemCapability.ArkUI.ArkUI.Full 167 * @crossplatform 168 * @since 10 169 */ 170 useMilitaryTime(value: boolean): TimePickerAttribute; 171 172 /** 173 * Sets the text style of disappearing items 174 * 175 * @param { PickerTextStyle } value - indicates the text style of disappearing items. 176 * @returns { TimePickerAttribute } 177 * @syscap SystemCapability.ArkUI.ArkUI.Full 178 * @crossplatform 179 * @since 10 180 */ 181 disappearTextStyle(value: PickerTextStyle): TimePickerAttribute; 182 183 /** 184 * Sets the text style of normal items 185 * 186 * @param { PickerTextStyle } value - indicates the text style of normal items. 187 * @returns { TimePickerAttribute } 188 * @syscap SystemCapability.ArkUI.ArkUI.Full 189 * @crossplatform 190 * @since 10 191 */ 192 textStyle(value: PickerTextStyle): TimePickerAttribute; 193 194 /** 195 * Sets the text style of selected items 196 * 197 * @param { PickerTextStyle } value - indicates the text style of selected items. 198 * @returns { TimePickerAttribute } 199 * @syscap SystemCapability.ArkUI.ArkUI.Full 200 * @crossplatform 201 * @since 10 202 */ 203 selectedTextStyle(value: PickerTextStyle): TimePickerAttribute; 204 205 /** 206 * This event is triggered when a TimePicker time is selected. 207 * 208 * @param { function } callback 209 * @returns { TimePickerAttribute } 210 * @syscap SystemCapability.ArkUI.ArkUI.Full 211 * @since 8 212 */ 213 /** 214 * This event is triggered when a TimePicker time is selected. 215 * 216 * @param { function } callback 217 * @returns { TimePickerAttribute } 218 * @syscap SystemCapability.ArkUI.ArkUI.Full 219 * @crossplatform 220 * @since 10 221 */ 222 onChange(callback: (value: TimePickerResult) => void): TimePickerAttribute; 223} 224 225/** 226 * Defines the TimePickerDialogOptions for Data Picker Dialog. 227 * 228 * @interface TimePickerDialogOptions 229 * @syscap SystemCapability.ArkUI.ArkUI.Full 230 * @since 8 231 */ 232/** 233 * Defines the TimePickerDialogOptions for Data Picker Dialog. 234 * 235 * @interface TimePickerDialogOptions 236 * @syscap SystemCapability.ArkUI.ArkUI.Full 237 * @crossplatform 238 * @since 10 239 */ 240declare interface TimePickerDialogOptions extends TimePickerOptions { 241 /** 242 * Time Selector: indicates whether to display the 24-hour clock. 243 * 244 * @type { ?boolean } 245 * @syscap SystemCapability.ArkUI.ArkUI.Full 246 * @since 8 247 */ 248 /** 249 * Time Selector: indicates whether to display the 24-hour clock. 250 * 251 * @type { ?boolean } 252 * @syscap SystemCapability.ArkUI.ArkUI.Full 253 * @crossplatform 254 * @since 10 255 */ 256 useMilitaryTime?: boolean; 257 258 /** 259 * Text style of disappearing items 260 * 261 * @type { ?PickerTextStyle } 262 * @syscap SystemCapability.ArkUI.ArkUI.Full 263 * @crossplatform 264 * @since 10 265 */ 266 disappearTextStyle?: PickerTextStyle; 267 268 /** 269 * Text style of normal items 270 * 271 * @type { ?PickerTextStyle } 272 * @syscap SystemCapability.ArkUI.ArkUI.Full 273 * @crossplatform 274 * @since 10 275 */ 276 textStyle?: PickerTextStyle; 277 278 /** 279 * Text style of selected items 280 * 281 * @type { ?PickerTextStyle } 282 * @syscap SystemCapability.ArkUI.ArkUI.Full 283 * @crossplatform 284 * @since 10 285 */ 286 selectedTextStyle?: PickerTextStyle; 287 288 /** 289 * Mask Region of dialog. The size cannot exceed the main window. 290 * 291 * @type { ?Rectangle } 292 * @syscap SystemCapability.ArkUI.ArkUI.Full 293 * @crossplatform 294 * @since 10 295 */ 296 maskRect?: Rectangle; 297 298 /** 299 * Defines the dialog alignment of the screen. 300 * 301 * @type { ?DialogAlignment } 302 * @syscap SystemCapability.ArkUI.ArkUI.Full 303 * @crossplatform 304 * @since 10 305 */ 306 alignment?: DialogAlignment; 307 308 /** 309 * Defines the dialog offset. 310 * 311 * @type { ?Offset } 312 * @syscap SystemCapability.ArkUI.ArkUI.Full 313 * @crossplatform 314 * @since 10 315 */ 316 offset?: Offset; 317 318 /** 319 * Called when the OK button in the dialog is clicked. 320 * 321 * @type { ?function } 322 * @syscap SystemCapability.ArkUI.ArkUI.Full 323 * @since 8 324 */ 325 /** 326 * Called when the OK button in the dialog is clicked. 327 * 328 * @type { ?function } 329 * @syscap SystemCapability.ArkUI.ArkUI.Full 330 * @crossplatform 331 * @since 10 332 */ 333 onAccept?: (value: TimePickerResult) => void; 334 335 /** 336 * Called when the Cancel button in the dialog is clicked. 337 * 338 * @type { ?function } 339 * @syscap SystemCapability.ArkUI.ArkUI.Full 340 * @since 8 341 */ 342 /** 343 * Called when the Cancel button in the dialog is clicked. 344 * 345 * @type { ?function } 346 * @syscap SystemCapability.ArkUI.ArkUI.Full 347 * @crossplatform 348 * @since 10 349 */ 350 onCancel?: () => void; 351 352 /** 353 * This event is triggered when a TimePicker Time or time is selected in dialog. 354 * 355 * @type { ?function } 356 * @syscap SystemCapability.ArkUI.ArkUI.Full 357 * @since 8 358 */ 359 /** 360 * This event is triggered when a TimePicker Time or time is selected in dialog. 361 * 362 * @type { ?function } 363 * @syscap SystemCapability.ArkUI.ArkUI.Full 364 * @crossplatform 365 * @since 10 366 */ 367 onChange?: (value: TimePickerResult) => void; 368} 369 370/** 371 * Defines TimePickerDialog which uses show method to show TimePicker dialog. 372 * 373 * @since 8 374 */ 375/** 376 * Defines TimePickerDialog which uses show method to show TimePicker dialog. 377 * 378 * @crossplatform 379 * @since 10 380 */ 381declare class TimePickerDialog { 382 /** 383 * Invoking method display. 384 * 385 * @param { TimePickerDialogOptions } options 386 * @syscap SystemCapability.ArkUI.ArkUI.Full 387 * @since 8 388 */ 389 /** 390 * Invoking method display. 391 * 392 * @param { TimePickerDialogOptions } options 393 * @syscap SystemCapability.ArkUI.ArkUI.Full 394 * @crossplatform 395 * @since 10 396 */ 397 static show(options?: TimePickerDialogOptions); 398} 399 400/** 401 * Defines TimePicker Component. 402 * 403 * @syscap SystemCapability.ArkUI.ArkUI.Full 404 * @since 8 405 */ 406/** 407 * Defines TimePicker Component. 408 * 409 * @syscap SystemCapability.ArkUI.ArkUI.Full 410 * @crossplatform 411 * @since 10 412 */ 413declare const TimePicker: TimePickerInterface; 414 415/** 416 * Defines TimePicker Component instance. 417 * 418 * @syscap SystemCapability.ArkUI.ArkUI.Full 419 * @since 8 420 */ 421/** 422 * Defines TimePicker Component instance. 423 * 424 * @syscap SystemCapability.ArkUI.ArkUI.Full 425 * @crossplatform 426 * @since 10 427 */ 428declare const TimePickerInstance: TimePickerAttribute; 429 430declare module "TimePickerDialogParam" { 431 module "TimePickerDialogParam" { 432 // @ts-ignore 433 export { TimePickerDialogOptions }; 434 } 435}