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 * @file 18 * @kit ArkUI 19 */ 20 21/** 22 * Provides a way to control the textclock status. 23 * 24 * @syscap SystemCapability.ArkUI.ArkUI.Full 25 * @since 8 26 */ 27/** 28 * Provides a way to control the textclock status. 29 * 30 * @syscap SystemCapability.ArkUI.ArkUI.Full 31 * @crossplatform 32 * @since 10 33 */ 34/** 35 * Provides a way to control the textclock status. 36 * 37 * @syscap SystemCapability.ArkUI.ArkUI.Full 38 * @crossplatform 39 * @form 40 * @atomicservice 41 * @since 11 42 */ 43declare class TextClockController { 44 /** 45 * constructor. 46 * 47 * @syscap SystemCapability.ArkUI.ArkUI.Full 48 * @since 8 49 */ 50 /** 51 * constructor. 52 * 53 * @syscap SystemCapability.ArkUI.ArkUI.Full 54 * @crossplatform 55 * @since 10 56 */ 57 /** 58 * constructor. 59 * 60 * @syscap SystemCapability.ArkUI.ArkUI.Full 61 * @crossplatform 62 * @form 63 * @atomicservice 64 * @since 11 65 */ 66 constructor(); 67 /** 68 * Provides a start event for textclock. 69 * 70 * @syscap SystemCapability.ArkUI.ArkUI.Full 71 * @since 8 72 */ 73 /** 74 * Provides a start event for textclock. 75 * 76 * @syscap SystemCapability.ArkUI.ArkUI.Full 77 * @crossplatform 78 * @since 10 79 */ 80 /** 81 * Provides a start event for textclock. 82 * 83 * @syscap SystemCapability.ArkUI.ArkUI.Full 84 * @crossplatform 85 * @form 86 * @atomicservice 87 * @since 11 88 */ 89 start(); 90 /** 91 * Provides a stop event for textclock. 92 * 93 * @syscap SystemCapability.ArkUI.ArkUI.Full 94 * @since 8 95 */ 96 /** 97 * Provides a stop event for textclock. 98 * 99 * @syscap SystemCapability.ArkUI.ArkUI.Full 100 * @crossplatform 101 * @since 10 102 */ 103 /** 104 * Provides a stop event for textclock. 105 * 106 * @syscap SystemCapability.ArkUI.ArkUI.Full 107 * @crossplatform 108 * @form 109 * @atomicservice 110 * @since 11 111 */ 112 stop(); 113} 114 115/** 116 * TextClockConfiguration used by text clock content modifier 117 * 118 * @interface TextClockConfiguration 119 * @extends CommonConfiguration<TextClockConfiguration> 120 * @syscap SystemCapability.ArkUI.ArkUI.Full 121 * @crossplatform 122 * @atomicservice 123 * @since 12 124 */ 125declare interface TextClockConfiguration extends CommonConfiguration<TextClockConfiguration> { 126 /** 127 * Specifies the current time zone. 128 * The valid value is an integer ranging from - 14 to 12, 129 * Where a negative value indicates the eastern time zone, for example, -8. 130 * 131 * @type { number } 132 * @syscap SystemCapability.ArkUI.ArkUI.Full 133 * @crossplatform 134 * @atomicservice 135 * @since 12 136 */ 137 timeZoneOffset: number; 138 139 /** 140 * TextClock is started or not. 141 * 142 * @type { boolean } 143 * @syscap SystemCapability.ArkUI.ArkUI.Full 144 * @crossplatform 145 * @atomicservice 146 * @since 12 147 */ 148 started: boolean; 149 150 /** 151 * The time of the TextClock. 152 * 153 * @type { number } 154 * @syscap SystemCapability.ArkUI.ArkUI.Full 155 * @crossplatform 156 * @atomicservice 157 * @since 12 158 */ 159 timeValue: number; 160} 161 162/** 163 * Options to construct TextClock component. 164 * 165 * @interface TextClockOptions 166 * @syscap SystemCapability.ArkUI.ArkUI.Full 167 * @crossplatform 168 * @form 169 * @atomicservice 170 * @since 14 171 */ 172declare interface TextClockOptions { 173 /** 174 * Time zone offset. 175 * 176 * @type { ?number } 177 * @syscap SystemCapability.ArkUI.ArkUI.Full 178 * @since 8 179 */ 180 /** 181 * Time zone offset. 182 * 183 * @type { ?number } 184 * @syscap SystemCapability.ArkUI.ArkUI.Full 185 * @crossplatform 186 * @since 10 187 */ 188 /** 189 * Time zone offset. 190 * 191 * @type { ?number } 192 * @syscap SystemCapability.ArkUI.ArkUI.Full 193 * @crossplatform 194 * @form 195 * @atomicservice 196 * @since 11 197 */ 198 timeZoneOffset?: number; 199 200 /** 201 * TextClock controller. 202 * 203 * @type { ?TextClockController } 204 * @syscap SystemCapability.ArkUI.ArkUI.Full 205 * @since 8 206 */ 207 /** 208 * TextClock controller. 209 * 210 * @type { ?TextClockController } 211 * @syscap SystemCapability.ArkUI.ArkUI.Full 212 * @crossplatform 213 * @since 10 214 */ 215 /** 216 * TextClock controller. 217 * 218 * @type { ?TextClockController } 219 * @syscap SystemCapability.ArkUI.ArkUI.Full 220 * @crossplatform 221 * @form 222 * @atomicservice 223 * @since 11 224 */ 225 controller?: TextClockController 226} 227 228/** 229 * TextClock component, which provides the text clock capability. 230 * 231 * @interface TextClockInterface 232 * @syscap SystemCapability.ArkUI.ArkUI.Full 233 * @since 8 234 */ 235/** 236 * TextClock component, which provides the text clock capability. 237 * 238 * @interface TextClockInterface 239 * @syscap SystemCapability.ArkUI.ArkUI.Full 240 * @crossplatform 241 * @since 10 242 */ 243/** 244 * TextClock component, which provides the text clock capability. 245 * 246 * @interface TextClockInterface 247 * @syscap SystemCapability.ArkUI.ArkUI.Full 248 * @crossplatform 249 * @form 250 * @atomicservice 251 * @since 11 252 */ 253interface TextClockInterface { 254 /** 255 * Construct the text clock component. 256 * Specifies the current time zone. 257 * The valid value is an integer ranging from - 14 to 12, 258 * Where a negative value indicates the eastern time zone, for example, -8. 259 * 260 * @param { object } options 261 * @returns { TextClockAttribute } 262 * @syscap SystemCapability.ArkUI.ArkUI.Full 263 * @since 8 264 */ 265 /** 266 * Construct the text clock component. 267 * Specifies the current time zone. 268 * The valid value is an integer ranging from - 14 to 12, 269 * Where a negative value indicates the eastern time zone, for example, -8. 270 * 271 * @param { object } options 272 * @returns { TextClockAttribute } 273 * @syscap SystemCapability.ArkUI.ArkUI.Full 274 * @crossplatform 275 * @since 10 276 */ 277 /** 278 * Construct the text clock component. 279 * Specifies the current time zone. 280 * The valid value is an integer ranging from - 14 to 12, 281 * Where a negative value indicates the eastern time zone, for example, -8. 282 * 283 * @param { object } options 284 * @returns { TextClockAttribute } 285 * @syscap SystemCapability.ArkUI.ArkUI.Full 286 * @crossplatform 287 * @form 288 * @atomicservice 289 * @since 11 290 */ 291 /** 292 * Construct the text clock component. 293 * Specifies the current time zone. 294 * The valid value is an integer ranging from - 14 to 12, 295 * Where a negative value indicates the eastern time zone, for example, -8. 296 * 297 * @param { TextClockOptions } [options] - TextClock options. 298 * @returns { TextClockAttribute } 299 * @syscap SystemCapability.ArkUI.ArkUI.Full 300 * @crossplatform 301 * @form 302 * @atomicservice 303 * @since 14 304 */ 305 (options?: TextClockOptions): TextClockAttribute; 306} 307 308/** 309 * Provides attribute for TextClock. 310 * 311 * @extends CommonMethod<TextClockAttribute> 312 * @syscap SystemCapability.ArkUI.ArkUI.Full 313 * @since 8 314 */ 315/** 316 * Provides attribute for TextClock. 317 * 318 * @extends CommonMethod<TextClockAttribute> 319 * @syscap SystemCapability.ArkUI.ArkUI.Full 320 * @crossplatform 321 * @since 10 322 */ 323/** 324 * Provides attribute for TextClock. 325 * 326 * @extends CommonMethod<TextClockAttribute> 327 * @syscap SystemCapability.ArkUI.ArkUI.Full 328 * @crossplatform 329 * @form 330 * @atomicservice 331 * @since 11 332 */ 333declare class TextClockAttribute extends CommonMethod<TextClockAttribute> { 334 /** 335 * set display time format,such as "yyyy/mm/dd","yyyy-mm-dd". 336 * support time format:yyyy,mm,mmm(English month abbreviation),mmmm(Full name of the month in English), 337 * dd,ddd(English Week abbreviation),dddd(Full name of the week in English), 338 * HH/hh(24-hour clock/12-hour clock),MM/mm(minute),SS/ss(second). 339 * 340 * @param { string } value 341 * @returns { TextClockAttribute } 342 * @syscap SystemCapability.ArkUI.ArkUI.Full 343 * @since 8 344 */ 345 /** 346 * set display time format,such as "yyyy/mm/dd","yyyy-mm-dd". 347 * support time format:yyyy,mm,mmm(English month abbreviation),mmmm(Full name of the month in English), 348 * dd,ddd(English Week abbreviation),dddd(Full name of the week in English), 349 * HH/hh(24-hour clock/12-hour clock),MM/mm(minute),SS/ss(second). 350 * 351 * @param { string } value 352 * @returns { TextClockAttribute } 353 * @syscap SystemCapability.ArkUI.ArkUI.Full 354 * @crossplatform 355 * @since 10 356 */ 357 /** 358 * set display time format,such as "yyyy/mm/dd","yyyy-mm-dd". 359 * support time format:yyyy,mm,mmm(English month abbreviation),mmmm(Full name of the month in English), 360 * dd,ddd(English Week abbreviation),dddd(Full name of the week in English), 361 * HH/hh(24-hour clock/12-hour clock),MM/mm(minute),SS/ss(second). 362 * The default value is "hh:mm:ss" when TextClock is not in a form. 363 * The default value is "hh:mm" when TextClock is in a form. 364 * If the value has second or millisecond, the value will be set to the default value. 365 * 366 * @param { string } value 367 * @returns { TextClockAttribute } 368 * @syscap SystemCapability.ArkUI.ArkUI.Full 369 * @crossplatform 370 * @form 371 * @atomicservice 372 * @since 11 373 */ 374 format(value: string): TextClockAttribute; 375 376 /** 377 * Provides a date change callback. 378 * The callback parameter is Unix Time Stamp, 379 * The number of milliseconds that have elapsed since January 1, 1970 (UTC). 380 * The minimum callback interval for this event is seconds. 381 * You can listen to this callback, 382 * Use the format attribute method to customize data display in the callback. 383 * 384 * @param { function } event - Listening date event callback. 385 * @returns { TextClockAttribute } 386 * @syscap SystemCapability.ArkUI.ArkUI.Full 387 * @since 8 388 */ 389 /** 390 * Provides a date change callback. 391 * The callback parameter is Unix Time Stamp, 392 * The number of milliseconds that have elapsed since January 1, 1970 (UTC). 393 * The minimum callback interval for this event is seconds. 394 * You can listen to this callback, 395 * Use the format attribute method to customize data display in the callback. 396 * 397 * @param { function } event - Listening date event callback. 398 * @returns { TextClockAttribute } 399 * @syscap SystemCapability.ArkUI.ArkUI.Full 400 * @crossplatform 401 * @since 10 402 */ 403 /** 404 * Provides a date change callback. 405 * The callback parameter is Unix Time Stamp, 406 * The number of milliseconds that have elapsed since January 1, 1970 (UTC). 407 * The minimum callback interval for this event default is seconds when TextClock is not in a form. 408 * The minimum callback interval for this event is minutes when TextClock is in a form. 409 * If visibility is Hidden the callback be disabled when TextClock is in a form. 410 * You can listen to this callback, 411 * Use the format attribute method to customize data display in the callback. 412 * 413 * @param { function } event - Listening date event callback. 414 * @returns { TextClockAttribute } 415 * @syscap SystemCapability.ArkUI.ArkUI.Full 416 * @crossplatform 417 * @form 418 * @atomicservice 419 * @since 11 420 */ 421 onDateChange(event: (value: number) => void): TextClockAttribute; 422 423 /** 424 * Called when the value of TextClock fontColor is set 425 * 426 * @param { ResourceColor } value 427 * @returns { TextClockAttribute } 428 * @syscap SystemCapability.ArkUI.ArkUI.Full 429 * @since 8 430 */ 431 /** 432 * Called when the value of TextClock fontColor is set 433 * 434 * @param { ResourceColor } value 435 * @returns { TextClockAttribute } 436 * @syscap SystemCapability.ArkUI.ArkUI.Full 437 * @crossplatform 438 * @since 10 439 */ 440 /** 441 * Called when the value of TextClock fontColor is set 442 * 443 * @param { ResourceColor } value 444 * @returns { TextClockAttribute } 445 * @syscap SystemCapability.ArkUI.ArkUI.Full 446 * @crossplatform 447 * @form 448 * @atomicservice 449 * @since 11 450 */ 451 fontColor(value: ResourceColor): TextClockAttribute; 452 453 /** 454 * Called when the value of TextClock fontSize is set 455 * 456 * @param { Length } value 457 * @returns { TextClockAttribute } 458 * @syscap SystemCapability.ArkUI.ArkUI.Full 459 * @since 8 460 */ 461 /** 462 * Called when the value of TextClock fontSize is set 463 * 464 * @param { Length } value 465 * @returns { TextClockAttribute } 466 * @syscap SystemCapability.ArkUI.ArkUI.Full 467 * @crossplatform 468 * @since 10 469 */ 470 /** 471 * Called when the value of TextClock fontSize is set 472 * 473 * @param { Length } value 474 * @returns { TextClockAttribute } 475 * @syscap SystemCapability.ArkUI.ArkUI.Full 476 * @crossplatform 477 * @form 478 * @atomicservice 479 * @since 11 480 */ 481 fontSize(value: Length): TextClockAttribute; 482 483 /** 484 * Called when the value of TextClock fontStyle is set 485 * 486 * @param { FontStyle } value 487 * @returns { TextClockAttribute } 488 * @syscap SystemCapability.ArkUI.ArkUI.Full 489 * @since 8 490 */ 491 /** 492 * Called when the value of TextClock fontStyle is set 493 * 494 * @param { FontStyle } value 495 * @returns { TextClockAttribute } 496 * @syscap SystemCapability.ArkUI.ArkUI.Full 497 * @crossplatform 498 * @since 10 499 */ 500 /** 501 * Called when the value of TextClock fontStyle is set 502 * 503 * @param { FontStyle } value 504 * @returns { TextClockAttribute } 505 * @syscap SystemCapability.ArkUI.ArkUI.Full 506 * @crossplatform 507 * @form 508 * @atomicservice 509 * @since 11 510 */ 511 fontStyle(value: FontStyle): TextClockAttribute; 512 513 /** 514 * Called when the value of TextClock fontWeight is set 515 * 516 * @param { number | FontWeight | string } value 517 * @returns { TextClockAttribute } 518 * @syscap SystemCapability.ArkUI.ArkUI.Full 519 * @since 8 520 */ 521 /** 522 * Called when the value of TextClock fontWeight is set 523 * 524 * @param { number | FontWeight | string } value 525 * @returns { TextClockAttribute } 526 * @syscap SystemCapability.ArkUI.ArkUI.Full 527 * @crossplatform 528 * @since 10 529 */ 530 /** 531 * Called when the value of TextClock fontWeight is set 532 * 533 * @param { number | FontWeight | string } value 534 * @returns { TextClockAttribute } 535 * @syscap SystemCapability.ArkUI.ArkUI.Full 536 * @crossplatform 537 * @form 538 * @atomicservice 539 * @since 11 540 */ 541 fontWeight(value: number | FontWeight | string): TextClockAttribute; 542 543 /** 544 * Called when the value of TextClock fontFamily is set 545 * 546 * @param { ResourceStr } value 547 * @returns { TextClockAttribute } 548 * @syscap SystemCapability.ArkUI.ArkUI.Full 549 * @since 8 550 */ 551 /** 552 * Called when the value of TextClock fontFamily is set 553 * 554 * @param { ResourceStr } value 555 * @returns { TextClockAttribute } 556 * @syscap SystemCapability.ArkUI.ArkUI.Full 557 * @crossplatform 558 * @since 10 559 */ 560 /** 561 * Called when the value of TextClock fontFamily is set 562 * 563 * @param { ResourceStr } value 564 * @returns { TextClockAttribute } 565 * @syscap SystemCapability.ArkUI.ArkUI.Full 566 * @crossplatform 567 * @form 568 * @atomicservice 569 * @since 11 570 */ 571 fontFamily(value: ResourceStr): TextClockAttribute; 572 573 /** 574 * Called when the text shadow is set. 575 * 576 * @param { ShadowOptions | Array<ShadowOptions> } value - The shadow options. 577 * @returns { TextClockAttribute } 578 * @syscap SystemCapability.ArkUI.ArkUI.Full 579 * @crossplatform 580 * @form 581 * @since 11 582 */ 583 /** 584 * Called when the text shadow is set. 585 * 586 * @param { ShadowOptions | Array<ShadowOptions> } value - The shadow options. 587 * @returns { TextClockAttribute } 588 * @syscap SystemCapability.ArkUI.ArkUI.Full 589 * @crossplatform 590 * @form 591 * @atomicservice 592 * @since 12 593 */ 594 textShadow(value: ShadowOptions | Array<ShadowOptions>): TextClockAttribute; 595 596 /** 597 * Called when the text fontFeature is set. 598 * 599 * @param { string } value - The fontFeature. 600 * normal | <feature-tag-value>, 601 * where <feature-tag-value> = <string> [ <integer> | on | off ], like: "ss01" 0 602 * number of <feature-tag-value> can be single or multiple, and separated by comma ','. 603 * @returns { TextClockAttribute } 604 * @syscap SystemCapability.ArkUI.ArkUI.Full 605 * @crossplatform 606 * @form 607 * @since 11 608 */ 609 /** 610 * Called when the text fontFeature is set. 611 * 612 * @param { string } value - The fontFeature. 613 * normal | <feature-tag-value>, 614 * where <feature-tag-value> = <string> [ <integer> | on | off ], like: "ss01" 0 615 * number of <feature-tag-value> can be single or multiple, and separated by comma ','. 616 * @returns { TextClockAttribute } 617 * @syscap SystemCapability.ArkUI.ArkUI.Full 618 * @crossplatform 619 * @form 620 * @atomicservice 621 * @since 12 622 */ 623 fontFeature(value: string): TextClockAttribute; 624 625 /** 626 * Set the content modifier of textclock. 627 * 628 * @param { ContentModifier<TextClockConfiguration> } modifier - The content modifier of textclock. 629 * @returns { TextClockAttribute } 630 * @syscap SystemCapability.ArkUI.ArkUI.Full 631 * @crossplatform 632 * @atomicservice 633 * @since 12 634 */ 635 contentModifier(modifier: ContentModifier<TextClockConfiguration>): TextClockAttribute; 636 637 /** 638 * Set hour format 639 * 640 * @param { Optional<DateTimeOptions> } dateTimeOptions - Indicates whether a leading 0 is required for the hour. 641 * @returns { TextClockAttribute } the attribute of the text clock 642 * @syscap SystemCapability.ArkUI.ArkUI.Full 643 * @crossplatform 644 * @form 645 * @atomicservice 646 * @since 12 647 */ 648 dateTimeOptions(dateTimeOptions: Optional<DateTimeOptions>): TextClockAttribute; 649} 650 651/** 652 * Defines TextClock Component. 653 * 654 * @syscap SystemCapability.ArkUI.ArkUI.Full 655 * @since 8 656 */ 657/** 658 * Defines TextClock Component. 659 * 660 * @syscap SystemCapability.ArkUI.ArkUI.Full 661 * @crossplatform 662 * @since 10 663 */ 664/** 665 * Defines TextClock Component. 666 * 667 * @syscap SystemCapability.ArkUI.ArkUI.Full 668 * @crossplatform 669 * @form 670 * @atomicservice 671 * @since 11 672 */ 673declare const TextClock: TextClockInterface; 674 675/** 676 * Defines TextClock Component instance. 677 * 678 * @syscap SystemCapability.ArkUI.ArkUI.Full 679 * @since 8 680 */ 681/** 682 * Defines TextClock Component instance. 683 * 684 * @syscap SystemCapability.ArkUI.ArkUI.Full 685 * @crossplatform 686 * @since 10 687 */ 688/** 689 * Defines TextClock Component instance. 690 * 691 * @syscap SystemCapability.ArkUI.ArkUI.Full 692 * @crossplatform 693 * @form 694 * @atomicservice 695 * @since 11 696 */ 697declare const TextClockInstance: TextClockAttribute; 698