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 * Content scroll direction. 23 * 24 * @enum { number } 25 * @syscap SystemCapability.ArkUI.ArkUI.Full 26 * @since 7 27 */ 28/** 29 * Content scroll direction. 30 * 31 * @enum { number } 32 * @syscap SystemCapability.ArkUI.ArkUI.Full 33 * @crossplatform 34 * @since 10 35 */ 36/** 37 * Content scroll direction. 38 * 39 * @enum { number } 40 * @syscap SystemCapability.ArkUI.ArkUI.Full 41 * @crossplatform 42 * @atomicservice 43 * @since 11 44 */ 45declare enum ScrollDirection { 46 /** 47 * Vertical scrolling is supported. 48 * 49 * @syscap SystemCapability.ArkUI.ArkUI.Full 50 * @since 7 51 */ 52 /** 53 * Vertical scrolling is supported. 54 * 55 * @syscap SystemCapability.ArkUI.ArkUI.Full 56 * @crossplatform 57 * @since 10 58 */ 59 /** 60 * Vertical scrolling is supported. 61 * 62 * @syscap SystemCapability.ArkUI.ArkUI.Full 63 * @crossplatform 64 * @atomicservice 65 * @since 11 66 */ 67 Vertical, 68 69 /** 70 * Horizontal scrolling is supported. 71 * 72 * @syscap SystemCapability.ArkUI.ArkUI.Full 73 * @since 7 74 */ 75 /** 76 * Horizontal scrolling is supported. 77 * 78 * @syscap SystemCapability.ArkUI.ArkUI.Full 79 * @crossplatform 80 * @since 10 81 */ 82 /** 83 * Horizontal scrolling is supported. 84 * 85 * @syscap SystemCapability.ArkUI.ArkUI.Full 86 * @crossplatform 87 * @atomicservice 88 * @since 11 89 */ 90 Horizontal, 91 92 /** 93 * Free scrolling is supported. 94 * 95 * @syscap SystemCapability.ArkUI.ArkUI.Full 96 * @since 7 97 * @deprecated since 9 98 */ 99 Free, 100 101 /** 102 * Non-scrollable. 103 * 104 * @syscap SystemCapability.ArkUI.ArkUI.Full 105 * @since 7 106 */ 107 /** 108 * Non-scrollable. 109 * 110 * @syscap SystemCapability.ArkUI.ArkUI.Full 111 * @crossplatform 112 * @since 10 113 */ 114 /** 115 * Non-scrollable. 116 * 117 * @syscap SystemCapability.ArkUI.ArkUI.Full 118 * @crossplatform 119 * @atomicservice 120 * @since 11 121 */ 122 None, 123} 124 125/** 126 * ScrollAlign. 127 * 128 * @enum { number } ScrollAlign 129 * @syscap SystemCapability.ArkUI.ArkUI.Full 130 * @crossplatform 131 * @since 10 132 */ 133/** 134 * ScrollAlign. 135 * 136 * @enum { number } ScrollAlign 137 * @syscap SystemCapability.ArkUI.ArkUI.Full 138 * @crossplatform 139 * @atomicservice 140 * @since 11 141 */ 142declare enum ScrollAlign { 143 /** 144 * Start position alignment. 145 * 146 * @syscap SystemCapability.ArkUI.ArkUI.Full 147 * @crossplatform 148 * @since 10 149 */ 150 /** 151 * Start position alignment. 152 * 153 * @syscap SystemCapability.ArkUI.ArkUI.Full 154 * @crossplatform 155 * @atomicservice 156 * @since 11 157 */ 158 START, 159 160 /** 161 * Center alignment. 162 * 163 * @syscap SystemCapability.ArkUI.ArkUI.Full 164 * @crossplatform 165 * @since 10 166 */ 167 /** 168 * Center alignment. 169 * 170 * @syscap SystemCapability.ArkUI.ArkUI.Full 171 * @crossplatform 172 * @atomicservice 173 * @since 11 174 */ 175 CENTER, 176 177 /** 178 * End position alignment. 179 * 180 * @syscap SystemCapability.ArkUI.ArkUI.Full 181 * @crossplatform 182 * @since 10 183 */ 184 /** 185 * End position alignment. 186 * 187 * @syscap SystemCapability.ArkUI.ArkUI.Full 188 * @crossplatform 189 * @atomicservice 190 * @since 11 191 */ 192 END, 193 194 /** 195 * Scroll the minimum distance to fully display the specified item. 196 * 197 * @syscap SystemCapability.ArkUI.ArkUI.Full 198 * @crossplatform 199 * @since 10 200 */ 201 /** 202 * Scroll the minimum distance to fully display the specified item. 203 * 204 * @syscap SystemCapability.ArkUI.ArkUI.Full 205 * @crossplatform 206 * @atomicservice 207 * @since 11 208 */ 209 AUTO, 210} 211 212/** 213 * OffsetResult info. 214 * 215 * @interface OffsetResult 216 * @syscap SystemCapability.ArkUI.ArkUI.Full 217 * @crossplatform 218 * @atomicservice 219 * @since 11 220 */ 221declare interface OffsetResult { 222 /** 223 * The X-axis offset. 224 * 225 * @type { number } 226 * @syscap SystemCapability.ArkUI.ArkUI.Full 227 * @crossplatform 228 * @atomicservice 229 * @since 11 230 */ 231 xOffset: number; 232 233 /** 234 * The y-axis offset. 235 * 236 * @type { number } 237 * @syscap SystemCapability.ArkUI.ArkUI.Full 238 * @crossplatform 239 * @atomicservice 240 * @since 11 241 */ 242 yOffset: number; 243} 244 245/** 246 * Define scroll edge options 247 * 248 * @interface ScrollEdgeOptions 249 * @syscap SystemCapability.ArkUI.ArkUI.Full 250 * @crossplatform 251 * @atomicservice 252 * @since 12 253 */ 254declare interface ScrollEdgeOptions { 255 /** 256 * The fasten speed of scrolling to the edge, unit is vp/s. 257 * 258 * @type { ?number } 259 * @syscap SystemCapability.ArkUI.ArkUI.Full 260 * @crossplatform 261 * @atomicservice 262 * @since 12 263 */ 264 velocity?: number; 265} 266 267/** 268 * Define scrollToIndex options 269 * 270 * @interface ScrollToIndexOptions 271 * @syscap SystemCapability.ArkUI.ArkUI.Full 272 * @crossplatform 273 * @atomicservice 274 * @since 12 275 */ 276declare interface ScrollToIndexOptions { 277 /** 278 * The extra offset of scrolling to the index, unit is vp. 279 * 280 * @type { ?LengthMetrics } 281 * @syscap SystemCapability.ArkUI.ArkUI.Full 282 * @crossplatform 283 * @atomicservice 284 * @since 12 285 */ 286 extraOffset?: LengthMetrics; 287} 288 289/** 290 * Provides custom animation parameters. 291 * 292 * @interface ScrollAnimationOptions 293 * @syscap SystemCapability.ArkUI.ArkUI.Full 294 * @crossplatform 295 * @atomicservice 296 * @since 12 297 */ 298declare interface ScrollAnimationOptions { 299 /** 300 * Set the duration of the animation. 301 * 302 * @type { ?number } 303 * @syscap SystemCapability.ArkUI.ArkUI.Full 304 * @crossplatform 305 * @atomicservice 306 * @since 12 307 */ 308 duration?: number; 309 310 /** 311 * Set the curve of the animation. 312 * 313 * @type { ?(Curve | ICurve) } 314 * @syscap SystemCapability.ArkUI.ArkUI.Full 315 * @crossplatform 316 * @atomicservice 317 * @since 12 318 */ 319 curve?: Curve | ICurve; 320 321 /** 322 * Set whether the animation can over the boundary. 323 * 324 * @type { ?boolean } 325 * @default false 326 * @syscap SystemCapability.ArkUI.ArkUI.Full 327 * @crossplatform 328 * @atomicservice 329 * @since 12 330 */ 331 canOverScroll?: boolean; 332} 333 334/** 335 * OffsetOptions info. 336 * 337 * @interface OffsetOptions 338 * @syscap SystemCapability.ArkUI.ArkUI.Full 339 * @crossplatform 340 * @atomicservice 341 * @since 12 342 */ 343declare interface OffsetOptions { 344 /** 345 * The X-axis offset. 346 * 347 * @type { ?Dimension } 348 * @syscap SystemCapability.ArkUI.ArkUI.Full 349 * @crossplatform 350 * @atomicservice 351 * @since 12 352 */ 353 xOffset?: Dimension; 354 355 /** 356 * The y-axis offset. 357 * 358 * @type { ?Dimension } 359 * @syscap SystemCapability.ArkUI.ArkUI.Full 360 * @crossplatform 361 * @atomicservice 362 * @since 12 363 */ 364 yOffset?: Dimension; 365} 366 367/** 368 * Scroller 369 * 370 * @syscap SystemCapability.ArkUI.ArkUI.Full 371 * @since 7 372 */ 373/** 374 * Scroller 375 * 376 * @syscap SystemCapability.ArkUI.ArkUI.Full 377 * @crossplatform 378 * @since 10 379 */ 380/** 381 * Scroller 382 * 383 * @syscap SystemCapability.ArkUI.ArkUI.Full 384 * @crossplatform 385 * @atomicservice 386 * @since 11 387 */ 388declare class Scroller { 389 /** 390 * constructor. 391 * 392 * @syscap SystemCapability.ArkUI.ArkUI.Full 393 * @since 7 394 */ 395 /** 396 * constructor. 397 * 398 * @syscap SystemCapability.ArkUI.ArkUI.Full 399 * @crossplatform 400 * @since 10 401 */ 402 /** 403 * constructor. 404 * 405 * @syscap SystemCapability.ArkUI.ArkUI.Full 406 * @crossplatform 407 * @atomicservice 408 * @since 11 409 */ 410 constructor(); 411 412 /** 413 * Called when the setting slides to the specified position. 414 * 415 * @param { object } value 416 * @syscap SystemCapability.ArkUI.ArkUI.Full 417 * @since 7 418 */ 419 /** 420 * Called when the setting slides to the specified position. 421 * 422 * @param { object } value 423 * @syscap SystemCapability.ArkUI.ArkUI.Full 424 * @crossplatform 425 * @since 10 426 */ 427 /** 428 * Called when the setting slides to the specified position. 429 * 430 * @param { object } value 431 * @syscap SystemCapability.ArkUI.ArkUI.Full 432 * @crossplatform 433 * @atomicservice 434 * @since 11 435 */ 436 scrollTo(value: { 437 /** 438 * The X-axis offset. 439 * 440 * @type { number | string } 441 * @syscap SystemCapability.ArkUI.ArkUI.Full 442 * @crossplatform 443 * @since 10 444 */ 445 /** 446 * The X-axis offset. 447 * 448 * @type { number | string } 449 * @syscap SystemCapability.ArkUI.ArkUI.Full 450 * @crossplatform 451 * @atomicservice 452 * @since 11 453 */ 454 xOffset: number | string; 455 456 /** 457 * The Y-axis offset. 458 * 459 * @type { number | string } 460 * @syscap SystemCapability.ArkUI.ArkUI.Full 461 * @crossplatform 462 * @since 10 463 */ 464 /** 465 * The Y-axis offset. 466 * 467 * @type { number | string } 468 * @syscap SystemCapability.ArkUI.ArkUI.Full 469 * @crossplatform 470 * @atomicservice 471 * @since 11 472 */ 473 yOffset: number | string; 474 475 /** 476 * Descriptive animation. 477 * 478 * @type { ?({ duration?: number; curve?: Curve | ICurve } | boolean) } The object type provides custom animation parameters 479 * and the boolean type enables default spring animation. 480 * @syscap SystemCapability.ArkUI.ArkUI.Full 481 * @crossplatform 482 * @since 10 483 */ 484 /** 485 * Descriptive animation. 486 * 487 * @type { ?({ duration?: number; curve?: Curve | ICurve } | boolean) } The object type provides custom animation parameters 488 * and the boolean type enables default spring animation. 489 * @syscap SystemCapability.ArkUI.ArkUI.Full 490 * @crossplatform 491 * @atomicservice 492 * @since 11 493 */ 494 /** 495 * Descriptive animation. 496 * 497 * @type { ?( ScrollAnimationOptions | boolean) } The ScrollAnimationOptions type provides custom animation parameters 498 * and the boolean type enables default spring animation. 499 * @syscap SystemCapability.ArkUI.ArkUI.Full 500 * @crossplatform 501 * @atomicservice 502 * @since 12 503 */ 504 animation?: ScrollAnimationOptions | boolean; 505 }); 506 507 /** 508 * Called when scrolling to the edge of the container. 509 * 510 * @param { Edge } value 511 * @syscap SystemCapability.ArkUI.ArkUI.Full 512 * @since 7 513 */ 514 /** 515 * Called when scrolling to the edge of the container. 516 * 517 * @param { Edge } value 518 * @syscap SystemCapability.ArkUI.ArkUI.Full 519 * @crossplatform 520 * @since 10 521 */ 522 /** 523 * Called when scrolling to the edge of the container. 524 * 525 * @param { Edge } value 526 * @syscap SystemCapability.ArkUI.ArkUI.Full 527 * @crossplatform 528 * @atomicservice 529 * @since 11 530 */ 531 /** 532 * Called when scrolling to the edge of the container. 533 * 534 * @param { Edge } value - Edge type of the container. 535 * @param { ScrollEdgeOptions } [options] - Options of scrolling to edge. 536 * @syscap SystemCapability.ArkUI.ArkUI.Full 537 * @crossplatform 538 * @atomicservice 539 * @since 12 540 */ 541 scrollEdge(value: Edge, options?: ScrollEdgeOptions); 542 543 544 /** 545 * Fling the scroll view. 546 * 547 * @param { number } velocity - initial velocity of fling, in vp/s. 548 * @throws { BusinessError } 401 - Parameter error. Possible causes: 549 * <br> 1. Mandatory parameters are left unspecified. 550 * <br> 2. Incorrect parameters types. 551 * <br> 3. Parameter verification failed. 552 * @throws { BusinessError } 100004 - Controller not bound to component. 553 * @syscap SystemCapability.ArkUI.ArkUI.Full 554 * @crossplatform 555 * @atomicservice 556 * @since 12 557 */ 558 fling(velocity: number): void; 559 560 /** 561 * Called when page turning mode is set. 562 * 563 * @param { object } value 564 * @syscap SystemCapability.ArkUI.ArkUI.Full 565 * @since 9 566 */ 567 /** 568 * Called when page turning mode is set. 569 * 570 * @param { object } value 571 * @syscap SystemCapability.ArkUI.ArkUI.Full 572 * @crossplatform 573 * @since 10 574 */ 575 /** 576 * Called when page turning mode is set. 577 * 578 * @param { object } value 579 * @syscap SystemCapability.ArkUI.ArkUI.Full 580 * @crossplatform 581 * @atomicservice 582 * @since 11 583 */ 584 scrollPage(value: { next: boolean }); 585 586 /** 587 * Called when page turning mode is set. 588 * 589 * @param { object } value 590 * @syscap SystemCapability.ArkUI.ArkUI.Full 591 * @since 7 592 * @deprecated since 9 593 */ 594 scrollPage(value: { next: boolean; direction?: Axis }); 595 596 /** 597 * Called when viewing the scroll offset. 598 * 599 * @syscap SystemCapability.ArkUI.ArkUI.Full 600 * @since 7 601 */ 602 /** 603 * Called when viewing the scroll offset. 604 * 605 * @syscap SystemCapability.ArkUI.ArkUI.Full 606 * @crossplatform 607 * @since 10 608 */ 609 /** 610 * Called when viewing the scroll offset. 611 * 612 * @returns { OffsetResult } Returns the current scrolling offset. If the scroller not bound to a component, the return value is void. 613 * @syscap SystemCapability.ArkUI.ArkUI.Full 614 * @crossplatform 615 * @atomicservice 616 * @since 11 617 */ 618 currentOffset() : OffsetResult; 619 620 /** 621 * Called when sliding to the specified index. 622 * 623 * @param { number } value 624 * @param { boolean } smooth 625 * @param { ScrollAlign } align 626 * @syscap SystemCapability.ArkUI.ArkUI.Full 627 * @since 7 628 */ 629 /** 630 * Called when sliding to the specified index. 631 * 632 * @param { number } value - Index to jump to. 633 * @param { boolean } smooth - If true, scroll to index item with animation. If false, scroll to index item without animation. 634 * @param { ScrollAlign } align - Sets the alignment mode of a specified index. 635 * @syscap SystemCapability.ArkUI.ArkUI.Full 636 * @crossplatform 637 * @since 10 638 */ 639 /** 640 * Called when sliding to the specified index. 641 * 642 * @param { number } value - Index to jump to. 643 * @param { boolean } smooth - If true, scroll to index item with animation. If false, scroll to index item without animation. 644 * @param { ScrollAlign } align - Sets the alignment mode of a specified index. 645 * @syscap SystemCapability.ArkUI.ArkUI.Full 646 * @crossplatform 647 * @atomicservice 648 * @since 11 649 */ 650 /** 651 * Scroll to the specified index. 652 * 653 * @param { number } value - Index to jump to. 654 * @param { boolean } [smooth] - If true, scroll to index item with animation. If false, scroll to index item without animation. 655 * @param { ScrollAlign } [align] - Sets the alignment mode of a specified index. 656 * @param { ScrollToIndexOptions } [options] - Sets the options of a specified index, such as extra offset. 657 * @syscap SystemCapability.ArkUI.ArkUI.Full 658 * @crossplatform 659 * @atomicservice 660 * @since 12 661 */ 662 scrollToIndex(value: number, smooth?: boolean, align?: ScrollAlign, options?: ScrollToIndexOptions); 663 664 /** 665 * Called when the setting slides by offset. 666 * 667 * @param { Length } dx 668 * @param { Length } dy 669 * @syscap SystemCapability.ArkUI.ArkUI.Full 670 * @since 9 671 */ 672 /** 673 * Called when the setting slides by offset. 674 * 675 * @param { Length } dx 676 * @param { Length } dy 677 * @syscap SystemCapability.ArkUI.ArkUI.Full 678 * @crossplatform 679 * @since 10 680 */ 681 /** 682 * Called when the setting slides by offset. 683 * 684 * @param { Length } dx 685 * @param { Length } dy 686 * @syscap SystemCapability.ArkUI.ArkUI.Full 687 * @crossplatform 688 * @atomicservice 689 * @since 11 690 */ 691 scrollBy(dx: Length, dy: Length); 692 693 /** 694 * Indicates whether the component scrolls to the end position. 695 * 696 * @returns { boolean } Returns whether the component scrolls to the end position. 697 * @syscap SystemCapability.ArkUI.ArkUI.Full 698 * @crossplatform 699 * @since 10 700 */ 701 /** 702 * Indicates whether the component scrolls to the end position. 703 * 704 * @returns { boolean } Returns whether the component scrolls to the end position. 705 * @syscap SystemCapability.ArkUI.ArkUI.Full 706 * @crossplatform 707 * @atomicservice 708 * @since 11 709 */ 710 isAtEnd(): boolean; 711 712 /** 713 * Get child item size and position. 714 * 715 * @param { number } index - Index of the item. 716 * @returns { RectResult } Returns the size and position. 717 * @throws { BusinessError } 401 - Parameter error. Possible causes: 718 * <br> 1. Mandatory parameters are left unspecified. 719 * <br> 2. Incorrect parameters types. 720 * <br> 3. Parameter verification failed. 721 * @throws { BusinessError } 100004 - Controller not bound to component. 722 * @syscap SystemCapability.ArkUI.ArkUI.Full 723 * @crossplatform 724 * @since 11 725 */ 726 /** 727 * Get child item size and position. 728 * 729 * @param { number } index - Index of the item. 730 * @returns { RectResult } Returns the size and position. 731 * @throws { BusinessError } 401 - Parameter error. Possible causes: 732 * <br> 1. Mandatory parameters are left unspecified. 733 * <br> 2. Incorrect parameters types. 734 * <br> 3. Parameter verification failed. 735 * @throws { BusinessError } 100004 - Controller not bound to component. 736 * @syscap SystemCapability.ArkUI.ArkUI.Full 737 * @crossplatform 738 * @atomicservice 739 * @since 12 740 */ 741 getItemRect(index: number): RectResult; 742} 743 744/** 745 * Define scroll snap options 746 * 747 * @interface ScrollSnapOptions 748 * @syscap SystemCapability.ArkUI.ArkUI.Full 749 * @since 10 750 */ 751/** 752 * Define scroll snap options 753 * 754 * @interface ScrollSnapOptions 755 * @syscap SystemCapability.ArkUI.ArkUI.Full 756 * @atomicservice 757 * @since 11 758 */ 759declare interface ScrollSnapOptions { 760 /** 761 * Set scroll snap alignment. 762 * 763 * @type { ScrollSnapAlign } 764 * @syscap SystemCapability.ArkUI.ArkUI.Full 765 * @since 10 766 */ 767 /** 768 * Set scroll snap alignment. 769 * 770 * @type { ScrollSnapAlign } 771 * @syscap SystemCapability.ArkUI.ArkUI.Full 772 * @atomicservice 773 * @since 11 774 */ 775 snapAlign: ScrollSnapAlign; 776 777 /** 778 * Set snap positions. When the type of snapPositions is Dimension, Scroll content is paginated by an integer 779 * multiple of snapPositions. When the type of snapPositions is Array<number>, Scroll content is paginated based 780 * on the array of snapPositions. 781 * 782 * @type { ?(Dimension | Array<Dimension>) } 783 * @default 100% 784 * @syscap SystemCapability.ArkUI.ArkUI.Full 785 * @since 10 786 */ 787 /** 788 * Set snap positions. When the type of snapPositions is Dimension, Scroll content is paginated by an integer 789 * multiple of snapPositions. When the type of snapPositions is Array<number>, Scroll content is paginated based 790 * on the array of snapPositions. 791 * 792 * @type { ?(Dimension | Array<Dimension>) } 793 * @default 100% 794 * @syscap SystemCapability.ArkUI.ArkUI.Full 795 * @atomicservice 796 * @since 11 797 */ 798 snapPagination?: Dimension | Array<Dimension>; 799 800 /** 801 * Set whether the beginning of the Scroll content counts an a snap. 802 * 803 * @type { ?boolean } 804 * @default true 805 * @syscap SystemCapability.ArkUI.ArkUI.Full 806 * @since 10 807 */ 808 /** 809 * Set whether the beginning of the Scroll content counts an a snap. 810 * 811 * @type { ?boolean } 812 * @default true 813 * @syscap SystemCapability.ArkUI.ArkUI.Full 814 * @atomicservice 815 * @since 11 816 */ 817 enableSnapToStart?: boolean; 818 819 /** 820 * Set whether the end of the Scroll content counts an a snap. 821 * 822 * @type { ?boolean } 823 * @default true 824 * @syscap SystemCapability.ArkUI.ArkUI.Full 825 * @since 10 826 */ 827 /** 828 * Set whether the end of the Scroll content counts an a snap. 829 * 830 * @type { ?boolean } 831 * @default true 832 * @syscap SystemCapability.ArkUI.ArkUI.Full 833 * @atomicservice 834 * @since 11 835 */ 836 enableSnapToEnd?: boolean; 837} 838 839/** 840 * Provides interfaces for scrollable containers. 841 * 842 * @interface ScrollInterface 843 * @syscap SystemCapability.ArkUI.ArkUI.Full 844 * @since 7 845 */ 846/** 847 * Provides interfaces for scrollable containers. 848 * 849 * @interface ScrollInterface 850 * @syscap SystemCapability.ArkUI.ArkUI.Full 851 * @crossplatform 852 * @since 10 853 */ 854/** 855 * Provides interfaces for scrollable containers. 856 * 857 * @interface ScrollInterface 858 * @syscap SystemCapability.ArkUI.ArkUI.Full 859 * @crossplatform 860 * @atomicservice 861 * @since 11 862 */ 863interface ScrollInterface { 864 /** 865 * Called when a scrollable container is set. 866 * 867 * @param { Scroller } scroller 868 * @returns { ScrollAttribute } 869 * @syscap SystemCapability.ArkUI.ArkUI.Full 870 * @since 7 871 */ 872 /** 873 * Called when a scrollable container is set. 874 * 875 * @param { Scroller } scroller 876 * @returns { ScrollAttribute } 877 * @syscap SystemCapability.ArkUI.ArkUI.Full 878 * @crossplatform 879 * @since 10 880 */ 881 /** 882 * Called when a scrollable container is set. 883 * 884 * @param { Scroller } scroller 885 * @returns { ScrollAttribute } 886 * @syscap SystemCapability.ArkUI.ArkUI.Full 887 * @crossplatform 888 * @atomicservice 889 * @since 11 890 */ 891 (scroller?: Scroller): ScrollAttribute; 892} 893 894/** 895 * Defines the scroll attribute functions. 896 * 897 * @extends CommonMethod<ScrollAttribute> 898 * @syscap SystemCapability.ArkUI.ArkUI.Full 899 * @since 7 900 */ 901/** 902 * Defines the scroll attribute functions. 903 * 904 * @extends CommonMethod<ScrollAttribute> 905 * @syscap SystemCapability.ArkUI.ArkUI.Full 906 * @crossplatform 907 * @since 10 908 */ 909/** 910 * Defines the scroll attribute functions. 911 * 912 * @extends ScrollableCommonMethod<ScrollAttribute> 913 * @syscap SystemCapability.ArkUI.ArkUI.Full 914 * @crossplatform 915 * @atomicservice 916 * @since 11 917 */ 918declare class ScrollAttribute extends ScrollableCommonMethod<ScrollAttribute> { 919 /** 920 * Called when the scroll method is slid. 921 * 922 * @param { ScrollDirection } value 923 * @returns { ScrollAttribute } 924 * @syscap SystemCapability.ArkUI.ArkUI.Full 925 * @since 7 926 */ 927 /** 928 * Called when the scroll method is slid. 929 * 930 * @param { ScrollDirection } value 931 * @returns { ScrollAttribute } 932 * @syscap SystemCapability.ArkUI.ArkUI.Full 933 * @crossplatform 934 * @since 10 935 */ 936 /** 937 * Called when the scroll method is slid. 938 * 939 * @param { ScrollDirection } value 940 * @returns { ScrollAttribute } 941 * @syscap SystemCapability.ArkUI.ArkUI.Full 942 * @crossplatform 943 * @atomicservice 944 * @since 11 945 */ 946 scrollable(value: ScrollDirection): ScrollAttribute; 947 948 /** 949 * Called when the setting slides to the specified position. 950 * 951 * @param { function } event 952 * @returns { ScrollAttribute } 953 * @syscap SystemCapability.ArkUI.ArkUI.Full 954 * @since 7 955 */ 956 /** 957 * Called when the setting slides to the specified position. 958 * 959 * @param { function } event 960 * @returns { ScrollAttribute } 961 * @syscap SystemCapability.ArkUI.ArkUI.Full 962 * @crossplatform 963 * @since 10 964 */ 965 /** 966 * Called when the setting slides to the specified position. 967 * 968 * @param { function } event 969 * @returns { ScrollAttribute } 970 * @syscap SystemCapability.ArkUI.ArkUI.Full 971 * @crossplatform 972 * @atomicservice 973 * @since 11 974 * @deprecated since 12 975 * @useinstead scroll/Scroll#onWillScroll 976 * 977 */ 978 onScroll(event: (xOffset: number, yOffset: number) => void): ScrollAttribute; 979 980 /** 981 * Called when the Scroll will scroll. 982 * 983 * @param { ScrollOnWillScrollCallback } handler - callback of Scroll 984 * @returns { ScrollAttribute } 985 * @syscap SystemCapability.ArkUI.ArkUI.Full 986 * @crossplatform 987 * @atomicservice 988 * @since 12 989 */ 990 onWillScroll(handler: ScrollOnWillScrollCallback): ScrollAttribute; 991 992 /** 993 * Called when the Scroll did scroll. 994 * 995 * @param { ScrollOnScrollCallback } handler - callback of Scroll, 996 * xOffset and yOffset are offsets this frame did scroll, scrollState is current scroll state. 997 * @returns { ScrollAttribute } 998 * @syscap SystemCapability.ArkUI.ArkUI.Full 999 * @crossplatform 1000 * @atomicservice 1001 * @since 12 1002 */ 1003 onDidScroll(handler: ScrollOnScrollCallback): ScrollAttribute; 1004 1005 /** 1006 * Called when scrolling to the edge of the container. 1007 * 1008 * @param { function } event 1009 * @returns { ScrollAttribute } 1010 * @syscap SystemCapability.ArkUI.ArkUI.Full 1011 * @since 7 1012 */ 1013 /** 1014 * Called when scrolling to the edge of the container. 1015 * 1016 * @param { function } event 1017 * @returns { ScrollAttribute } 1018 * @syscap SystemCapability.ArkUI.ArkUI.Full 1019 * @crossplatform 1020 * @since 10 1021 */ 1022 /** 1023 * Called when scrolling to the edge of the container. 1024 * 1025 * @param { function } event 1026 * @returns { ScrollAttribute } 1027 * @syscap SystemCapability.ArkUI.ArkUI.Full 1028 * @crossplatform 1029 * @atomicservice 1030 * @since 11 1031 */ 1032 onScrollEdge(event: (side: Edge) => void): ScrollAttribute; 1033 1034 /** 1035 * Called when scrolling start. 1036 * 1037 * @param { function } event 1038 * @returns { ScrollAttribute } 1039 * @syscap SystemCapability.ArkUI.ArkUI.Full 1040 * @since 9 1041 */ 1042 /** 1043 * Called when scrolling start. 1044 * 1045 * @param { function } event 1046 * @returns { ScrollAttribute } 1047 * @syscap SystemCapability.ArkUI.ArkUI.Full 1048 * @crossplatform 1049 * @since 10 1050 */ 1051 /** 1052 * Called when scrolling start. 1053 * 1054 * @param { function } event 1055 * @returns { ScrollAttribute } 1056 * @syscap SystemCapability.ArkUI.ArkUI.Full 1057 * @crossplatform 1058 * @atomicservice 1059 * @since 11 1060 */ 1061 onScrollStart(event: () => void): ScrollAttribute; 1062 1063 /** 1064 * Called when scrolling has stopped. 1065 * 1066 * @param { function } event 1067 * @returns { ScrollAttribute } 1068 * @syscap SystemCapability.ArkUI.ArkUI.Full 1069 * @since 7 1070 * @deprecated since 9 1071 * @useinstead scroll/Scroll#onScrollStop 1072 */ 1073 onScrollEnd(event: () => void): ScrollAttribute; 1074 1075 /** 1076 * Called when scrolling has stopped. 1077 * 1078 * @param { function } event 1079 * @returns { ScrollAttribute } 1080 * @syscap SystemCapability.ArkUI.ArkUI.Full 1081 * @since 9 1082 */ 1083 /** 1084 * Called when scrolling has stopped. 1085 * 1086 * @param { function } event 1087 * @returns { ScrollAttribute } 1088 * @syscap SystemCapability.ArkUI.ArkUI.Full 1089 * @crossplatform 1090 * @since 10 1091 */ 1092 /** 1093 * Called when scrolling has stopped. 1094 * 1095 * @param { function } event 1096 * @returns { ScrollAttribute } 1097 * @syscap SystemCapability.ArkUI.ArkUI.Full 1098 * @crossplatform 1099 * @atomicservice 1100 * @since 11 1101 */ 1102 onScrollStop(event: () => void): ScrollAttribute; 1103 1104 /** 1105 * Called when the status of the scroll bar is set. 1106 * 1107 * @param { BarState } barState 1108 * @returns { ScrollAttribute } 1109 * @syscap SystemCapability.ArkUI.ArkUI.Full 1110 * @since 7 1111 */ 1112 /** 1113 * Called when the status of the scroll bar is set. 1114 * 1115 * @param { BarState } barState 1116 * @returns { ScrollAttribute } 1117 * @syscap SystemCapability.ArkUI.ArkUI.Full 1118 * @crossplatform 1119 * @since 10 1120 */ 1121 /** 1122 * Called when the status of the scroll bar is set. 1123 * 1124 * @param { BarState } barState 1125 * @returns { ScrollAttribute } 1126 * @syscap SystemCapability.ArkUI.ArkUI.Full 1127 * @crossplatform 1128 * @atomicservice 1129 * @since 11 1130 */ 1131 scrollBar(barState: BarState): ScrollAttribute; 1132 1133 /** 1134 * Called when the color of the scroll bar is set. 1135 * 1136 * @param { Color | number | string } color 1137 * @returns { ScrollAttribute } 1138 * @syscap SystemCapability.ArkUI.ArkUI.Full 1139 * @since 7 1140 */ 1141 /** 1142 * Called when the color of the scroll bar is set. 1143 * 1144 * @param { Color | number | string } color 1145 * @returns { ScrollAttribute } 1146 * @syscap SystemCapability.ArkUI.ArkUI.Full 1147 * @crossplatform 1148 * @since 10 1149 */ 1150 /** 1151 * Called when the color of the scroll bar is set. 1152 * 1153 * @param { Color | number | string } color 1154 * @returns { ScrollAttribute } 1155 * @syscap SystemCapability.ArkUI.ArkUI.Full 1156 * @crossplatform 1157 * @atomicservice 1158 * @since 11 1159 */ 1160 scrollBarColor(color: Color | number | string): ScrollAttribute; 1161 1162 /** 1163 * Called when the width of the scroll bar is set. 1164 * 1165 * @param { number | string } value 1166 * @returns { ScrollAttribute } 1167 * @syscap SystemCapability.ArkUI.ArkUI.Full 1168 * @since 7 1169 */ 1170 /** 1171 * Called when the width of the scroll bar is set. 1172 * 1173 * @param { number | string } value 1174 * @returns { ScrollAttribute } 1175 * @syscap SystemCapability.ArkUI.ArkUI.Full 1176 * @crossplatform 1177 * @since 10 1178 */ 1179 /** 1180 * Called when the width of the scroll bar is set. 1181 * 1182 * @param { number | string } value 1183 * @returns { ScrollAttribute } 1184 * @syscap SystemCapability.ArkUI.ArkUI.Full 1185 * @crossplatform 1186 * @atomicservice 1187 * @since 11 1188 */ 1189 scrollBarWidth(value: number | string): ScrollAttribute; 1190 1191 /** 1192 * Called when the sliding effect is set. 1193 * 1194 * @param { EdgeEffect } edgeEffect 1195 * @returns { ScrollAttribute } 1196 * @syscap SystemCapability.ArkUI.ArkUI.Full 1197 * @since 7 1198 */ 1199 /** 1200 * Called when the sliding effect is set. 1201 * 1202 * @param { EdgeEffect } edgeEffect 1203 * @returns { ScrollAttribute } 1204 * @syscap SystemCapability.ArkUI.ArkUI.Full 1205 * @crossplatform 1206 * @since 10 1207 */ 1208 /** 1209 * Called when the sliding effect is set. 1210 * 1211 * @param { EdgeEffect } edgeEffect 1212 * @param { EdgeEffectOptions } options 1213 * @returns { ScrollAttribute } 1214 * @syscap SystemCapability.ArkUI.ArkUI.Full 1215 * @crossplatform 1216 * @atomicservice 1217 * @since 11 1218 */ 1219 edgeEffect(edgeEffect: EdgeEffect, options?: EdgeEffectOptions): ScrollAttribute; 1220 1221 /** 1222 * Called when scrolling begin each frame. 1223 * 1224 * @param { function } event 1225 * @returns { ScrollAttribute } 1226 * @syscap SystemCapability.ArkUI.ArkUI.Full 1227 * @since 9 1228 */ 1229 /** 1230 * Called when scrolling begin each frame. 1231 * 1232 * @param { function } event 1233 * @returns { ScrollAttribute } 1234 * @syscap SystemCapability.ArkUI.ArkUI.Full 1235 * @crossplatform 1236 * @since 10 1237 */ 1238 /** 1239 * Called when scrolling begin each frame. 1240 * 1241 * @param { function } event 1242 * @returns { ScrollAttribute } 1243 * @syscap SystemCapability.ArkUI.ArkUI.Full 1244 * @crossplatform 1245 * @atomicservice 1246 * @since 11 1247 */ 1248 onScrollFrameBegin(event: (offset: number, state: ScrollState) => { offsetRemain: number }): ScrollAttribute; 1249 1250 /** 1251 * Called to setting the nested scroll options. 1252 * 1253 * @param { NestedScrollOptions } value - options for nested scrolling. 1254 * @returns { ScrollAttribute } the attribute of the scroll. 1255 * @syscap SystemCapability.ArkUI.ArkUI.Full 1256 * @since 10 1257 */ 1258 /** 1259 * Called to setting the nested scroll options. 1260 * 1261 * @param { NestedScrollOptions } value - options for nested scrolling. 1262 * @returns { ScrollAttribute } the attribute of the scroll. 1263 * @syscap SystemCapability.ArkUI.ArkUI.Full 1264 * @crossplatform 1265 * @atomicservice 1266 * @since 11 1267 */ 1268 nestedScroll(value: NestedScrollOptions): ScrollAttribute; 1269 1270 /** 1271 * Called when setting whether to enable scroll by gesture or mouse. 1272 * 1273 * @param { boolean } value 1274 * @returns { ScrollAttribute } The attribute of the scroll 1275 * @syscap SystemCapability.ArkUI.ArkUI.Full 1276 * @crossplatform 1277 * @since 10 1278 */ 1279 /** 1280 * Called when setting whether to enable scroll by gesture or mouse. 1281 * 1282 * @param { boolean } value 1283 * @returns { ScrollAttribute } The attribute of the scroll 1284 * @syscap SystemCapability.ArkUI.ArkUI.Full 1285 * @crossplatform 1286 * @atomicservice 1287 * @since 11 1288 */ 1289 enableScrollInteraction(value: boolean): ScrollAttribute; 1290 1291 /** 1292 * Called to setting the friction. 1293 * 1294 * @param { number | Resource } value - options for scrolling friction. 1295 * @returns { ScrollAttribute } the attribute of the scroll. 1296 * @syscap SystemCapability.ArkUI.ArkUI.Full 1297 * @crossplatform 1298 * @since 10 1299 */ 1300 /** 1301 * Called to setting the friction. 1302 * 1303 * @param { number | Resource } value - options for scrolling friction. 1304 * @returns { ScrollAttribute } the attribute of the scroll. 1305 * @syscap SystemCapability.ArkUI.ArkUI.Full 1306 * @crossplatform 1307 * @atomicservice 1308 * @since 11 1309 */ 1310 friction(value: number | Resource): ScrollAttribute; 1311 1312 /** 1313 * Called to setting the scroll snap options. 1314 * 1315 * @param { ScrollSnapOptions } value - options for scroll snap. 1316 * @returns { ScrollAttribute } the attribute of the scroll. 1317 * @syscap SystemCapability.ArkUI.ArkUI.Full 1318 * @since 10 1319 */ 1320 /** 1321 * Called to setting the scroll snap options. 1322 * 1323 * @param { ScrollSnapOptions } value - options for scroll snap. 1324 * @returns { ScrollAttribute } the attribute of the scroll. 1325 * @syscap SystemCapability.ArkUI.ArkUI.Full 1326 * @atomicservice 1327 * @since 11 1328 */ 1329 scrollSnap(value: ScrollSnapOptions): ScrollAttribute; 1330 1331 /** 1332 * Determines whether the scroll view stops on multiples of the content size when the user scrolls. 1333 * 1334 * @param { boolean } value - A boolean value determines whether paging is enabled for scroll. 1335 * @returns { ScrollAttribute } the attribute of the scroll. 1336 * @syscap SystemCapability.ArkUI.ArkUI.Full 1337 * @crossplatform 1338 * @since 11 1339 */ 1340 /** 1341 * Determines whether the scroll view stops on multiples of the content size when the user scrolls. 1342 * 1343 * @param { boolean } value - A boolean value determines whether paging is enabled for scroll. 1344 * @returns { ScrollAttribute } the attribute of the scroll. 1345 * @syscap SystemCapability.ArkUI.ArkUI.Full 1346 * @crossplatform 1347 * @atomicservice 1348 * @since 12 1349 */ 1350 enablePaging(value: boolean): ScrollAttribute; 1351 1352 /** 1353 * Called to setting the initial offset 1354 * 1355 * @param { OffsetOptions } value - options for scroll initial offset. 1356 * @returns { ScrollAttribute } the attribute of the scroll. 1357 * @syscap SystemCapability.ArkUI.ArkUI.Full 1358 * @crossplatform 1359 * @atomicservice 1360 * @since 12 1361 */ 1362 initialOffset(value: OffsetOptions): ScrollAttribute; 1363} 1364 1365/** 1366 * callback of Scroll, using in onDidScroll. 1367 * 1368 * @typedef { function } ScrollOnScrollCallback 1369 * @param { number } xOffset - horizontal offset this frame did scroll. 1370 * @param { number } yOffset - vertical offset this frame did scroll. 1371 * @param { ScrollState } scrollState - current scroll state. 1372 * @syscap SystemCapability.ArkUI.ArkUI.Full 1373 * @crossplatform 1374 * @atomicservice 1375 * @since 12 1376 */ 1377declare type ScrollOnScrollCallback = (xOffset: number, yOffset: number, scrollState: ScrollState) => void; 1378 1379/** 1380 * Called before scroll to allow developer to control real offset the Scroll can scroll. 1381 * 1382 * @typedef { function } ScrollOnWillScrollCallback 1383 * @param { number } xOffset - horizontal offset this frame will scroll, which may or may not be reached. 1384 * @param { number } yOffset - vertical offset this frame will scroll, which may or may not be reached. 1385 * @param { ScrollState } scrollState - current scroll state. 1386 * @param { ScrollSource } scrollSource - source of current scroll. 1387 * @returns { void | OffsetResult } the remain offset for the Scroll, 1388 * same as (xOffset, yOffset) when no OffsetResult is returned. 1389 * @syscap SystemCapability.ArkUI.ArkUI.Full 1390 * @crossplatform 1391 * @atomicservice 1392 * @since 12 1393 */ 1394declare type ScrollOnWillScrollCallback = 1395 (xOffset: number, yOffset: number, scrollState: ScrollState, scrollSource: ScrollSource) => void | OffsetResult; 1396 1397/** 1398 * Defines Scroll Component. 1399 * 1400 * @syscap SystemCapability.ArkUI.ArkUI.Full 1401 * @since 7 1402 */ 1403/** 1404 * Defines Scroll Component. 1405 * 1406 * @syscap SystemCapability.ArkUI.ArkUI.Full 1407 * @crossplatform 1408 * @since 10 1409 */ 1410/** 1411 * Defines Scroll Component. 1412 * 1413 * @syscap SystemCapability.ArkUI.ArkUI.Full 1414 * @crossplatform 1415 * @atomicservice 1416 * @since 11 1417 */ 1418declare const Scroll: ScrollInterface; 1419 1420/** 1421 * Defines Scroll Component instance. 1422 * 1423 * @syscap SystemCapability.ArkUI.ArkUI.Full 1424 * @since 7 1425 */ 1426/** 1427 * Defines Scroll Component instance. 1428 * 1429 * @syscap SystemCapability.ArkUI.ArkUI.Full 1430 * @crossplatform 1431 * @since 10 1432 */ 1433/** 1434 * Defines Scroll Component instance. 1435 * 1436 * @syscap SystemCapability.ArkUI.ArkUI.Full 1437 * @crossplatform 1438 * @atomicservice 1439 * @since 11 1440 */ 1441declare const ScrollInstance: ScrollAttribute; 1442