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 * The options to help grid layout 23 * 24 * @interface GridLayoutOptions 25 * @syscap SystemCapability.ArkUI.ArkUI.Full 26 * @crossplatform 27 * @since 10 28 */ 29/** 30 * The options to help grid layout 31 * 32 * @interface GridLayoutOptions 33 * @syscap SystemCapability.ArkUI.ArkUI.Full 34 * @crossplatform 35 * @atomicservice 36 * @since 11 37 */ 38declare interface GridLayoutOptions { 39 /** 40 * The size of most grid items, in [rows, columns], generally [1, 1] 41 * 42 * @type { [number, number] } regularSize 43 * @syscap SystemCapability.ArkUI.ArkUI.Full 44 * @crossplatform 45 * @since 10 46 */ 47 /** 48 * The size of most grid items, in [rows, columns], generally [1, 1] 49 * 50 * @type { [number, number] } regularSize 51 * @syscap SystemCapability.ArkUI.ArkUI.Full 52 * @crossplatform 53 * @atomicservice 54 * @since 11 55 */ 56 regularSize: [number, number]; 57 58 /** 59 * The indexes of grid items with irregular size. 60 * 61 * @type { ?number[] } irregularIndexes 62 * @default number[] no irregular grid item 63 * @syscap SystemCapability.ArkUI.ArkUI.Full 64 * @crossplatform 65 * @since 10 66 */ 67 /** 68 * The indexes of grid items with irregular size. 69 * 70 * @type { ?number[] } irregularIndexes 71 * @default number[] no irregular grid item 72 * @syscap SystemCapability.ArkUI.ArkUI.Full 73 * @crossplatform 74 * @atomicservice 75 * @since 11 76 */ 77 irregularIndexes?: number[]; 78 79 /** 80 * Called to return the size of the irregular grid items with the specified index in [rows, columns]. 81 * 82 * @type { ?function } onGetIrregularSizeByIndex, 83 * all irregular grid items will occupy an entire line if not set 84 * @syscap SystemCapability.ArkUI.ArkUI.Full 85 * @crossplatform 86 * @since 10 87 */ 88 /** 89 * Called to return the size of the irregular grid items with the specified index in [rows, columns]. 90 * 91 * @type { ?function } onGetIrregularSizeByIndex, 92 * all irregular grid items will occupy an entire line if not set 93 * @syscap SystemCapability.ArkUI.ArkUI.Full 94 * @crossplatform 95 * @atomicservice 96 * @since 11 97 */ 98 onGetIrregularSizeByIndex?: (index: number) => [number, number] 99 100 /** 101 * Called to return the size of the grid items with the specified index in 102 * [rowStart, columnStart, rowSpan, columnSpan]. 103 * 104 * @type { ?function } onGetRectByIndex 105 * @syscap SystemCapability.ArkUI.ArkUI.Full 106 * @crossplatform 107 * @since 11 108 */ 109 /** 110 * Called to return the size of the grid items with the specified index in 111 * [rowStart, columnStart, rowSpan, columnSpan]. 112 * 113 * @type { ?function } onGetRectByIndex 114 * @syscap SystemCapability.ArkUI.ArkUI.Full 115 * @crossplatform 116 * @atomicservice 117 * @since 12 118 */ 119 onGetRectByIndex?: (index: number) => [number, number, number, number] 120} 121 122/** 123 * Defines the grid interface. 124 * 125 * @interface GridInterface 126 * @syscap SystemCapability.ArkUI.ArkUI.Full 127 * @since 7 128 */ 129/** 130 * Defines the grid interface. 131 * 132 * @interface GridInterface 133 * @syscap SystemCapability.ArkUI.ArkUI.Full 134 * @crossplatform 135 * @since 10 136 */ 137/** 138 * Defines the grid interface. 139 * 140 * @interface GridInterface 141 * @syscap SystemCapability.ArkUI.ArkUI.Full 142 * @crossplatform 143 * @atomicservice 144 * @since 11 145 */ 146interface GridInterface { 147 /** 148 * Grid is returned when the parameter is transferred. 149 * 150 * @param { Scroller } scroller 151 * @returns { GridAttribute } 152 * @syscap SystemCapability.ArkUI.ArkUI.Full 153 * @since 7 154 */ 155 /** 156 * Grid is returned when the parameter is transferred. 157 * 158 * @param { Scroller } scroller - Controller bound to the grid 159 * @param { GridLayoutOptions } layoutOptions - The options to help grid layout 160 * @returns { GridAttribute } The attribute of the grid 161 * @syscap SystemCapability.ArkUI.ArkUI.Full 162 * @crossplatform 163 * @since 10 164 */ 165 /** 166 * Grid is returned when the parameter is transferred. 167 * 168 * @param { Scroller } scroller - Controller bound to the grid 169 * @param { GridLayoutOptions } layoutOptions - The options to help grid layout 170 * @returns { GridAttribute } The attribute of the grid 171 * @syscap SystemCapability.ArkUI.ArkUI.Full 172 * @crossplatform 173 * @atomicservice 174 * @since 11 175 */ 176 (scroller?: Scroller, layoutOptions?: GridLayoutOptions): GridAttribute; 177} 178 179/** 180 * The enum of property layoutDirection 181 * 182 * @enum { number } 183 * @syscap SystemCapability.ArkUI.ArkUI.Full 184 * @since 8 185 */ 186/** 187 * The enum of property layoutDirection 188 * 189 * @enum { number } 190 * @syscap SystemCapability.ArkUI.ArkUI.Full 191 * @crossplatform 192 * @since 10 193 */ 194/** 195 * The enum of property layoutDirection 196 * 197 * @enum { number } 198 * @syscap SystemCapability.ArkUI.ArkUI.Full 199 * @crossplatform 200 * @atomicservice 201 * @since 11 202 */ 203declare enum GridDirection { 204 /** 205 * The row direction. 206 * 207 * @syscap SystemCapability.ArkUI.ArkUI.Full 208 * @since 8 209 */ 210 /** 211 * The row direction. 212 * 213 * @syscap SystemCapability.ArkUI.ArkUI.Full 214 * @crossplatform 215 * @since 10 216 */ 217 /** 218 * The row direction. 219 * 220 * @syscap SystemCapability.ArkUI.ArkUI.Full 221 * @crossplatform 222 * @atomicservice 223 * @since 11 224 */ 225 Row, 226 227 /** 228 * The column direction. 229 * 230 * @syscap SystemCapability.ArkUI.ArkUI.Full 231 * @since 8 232 */ 233 /** 234 * The column direction. 235 * 236 * @syscap SystemCapability.ArkUI.ArkUI.Full 237 * @crossplatform 238 * @since 10 239 */ 240 /** 241 * The column direction. 242 * 243 * @syscap SystemCapability.ArkUI.ArkUI.Full 244 * @crossplatform 245 * @atomicservice 246 * @since 11 247 */ 248 Column, 249 250 /** 251 * The row reverse direction. 252 * 253 * @syscap SystemCapability.ArkUI.ArkUI.Full 254 * @since 8 255 */ 256 /** 257 * The row reverse direction. 258 * 259 * @syscap SystemCapability.ArkUI.ArkUI.Full 260 * @crossplatform 261 * @since 10 262 */ 263 /** 264 * The row reverse direction. 265 * 266 * @syscap SystemCapability.ArkUI.ArkUI.Full 267 * @crossplatform 268 * @atomicservice 269 * @since 11 270 */ 271 RowReverse, 272 273 /** 274 * The column reverse direction. 275 * 276 * @syscap SystemCapability.ArkUI.ArkUI.Full 277 * @since 8 278 */ 279 /** 280 * The column reverse direction. 281 * 282 * @syscap SystemCapability.ArkUI.ArkUI.Full 283 * @crossplatform 284 * @since 10 285 */ 286 /** 287 * The column reverse direction. 288 * 289 * @syscap SystemCapability.ArkUI.ArkUI.Full 290 * @crossplatform 291 * @atomicservice 292 * @since 11 293 */ 294 ColumnReverse, 295} 296 297/** 298 * Declare grid item alignment status 299 * 300 * @enum { number } 301 * @syscap SystemCapability.ArkUI.ArkUI.Full 302 * @crossplatform 303 * @atomicservice 304 * @since 12 305 */ 306declare enum GridItemAlignment { 307 308 /** 309 * Use the default alignment of the Grid. 310 * 311 * @syscap SystemCapability.ArkUI.ArkUI.Full 312 * @crossplatform 313 * @atomicservice 314 * @since 12 315 */ 316 DEFAULT = 0, 317 318 /** 319 * The height of the tallest grid item in the current line 320 * will be used as the height for the other items in the same line 321 * 322 * @syscap SystemCapability.ArkUI.ArkUI.Full 323 * @crossplatform 324 * @atomicservice 325 * @since 12 326 */ 327 STRETCH = 1, 328} 329 330/** 331 * The attribute of scrollbar to compute scrollbar position and height. 332 * 333 * @interface ComputedBarAttribute 334 * @syscap SystemCapability.ArkUI.ArkUI.Full 335 * @crossplatform 336 * @since 10 337 */ 338/** 339 * The attribute of scrollbar to compute scrollbar position and height. 340 * 341 * @interface ComputedBarAttribute 342 * @syscap SystemCapability.ArkUI.ArkUI.Full 343 * @crossplatform 344 * @atomicservice 345 * @since 11 346 */ 347declare interface ComputedBarAttribute { 348 /** 349 * The offset of the grid. 350 * 351 * @type { number } 352 * @syscap SystemCapability.ArkUI.ArkUI.Full 353 * @crossplatform 354 * @since 10 355 */ 356 /** 357 * The offset of the grid. 358 * 359 * @type { number } 360 * @syscap SystemCapability.ArkUI.ArkUI.Full 361 * @crossplatform 362 * @atomicservice 363 * @since 11 364 */ 365 totalOffset: number; 366 367 /** 368 * The range of the grid. 369 * 370 * @type { number } 371 * @syscap SystemCapability.ArkUI.ArkUI.Full 372 * @crossplatform 373 * @since 10 374 */ 375 /** 376 * The range of the grid. 377 * 378 * @type { number } 379 * @syscap SystemCapability.ArkUI.ArkUI.Full 380 * @crossplatform 381 * @atomicservice 382 * @since 11 383 */ 384 totalLength: number; 385} 386 387/** 388 * Defines the grid attribute functions. 389 * 390 * @extends CommonMethod<GridAttribute> 391 * @syscap SystemCapability.ArkUI.ArkUI.Full 392 * @since 7 393 */ 394/** 395 * Defines the grid attribute functions. 396 * 397 * @extends CommonMethod<GridAttribute> 398 * @syscap SystemCapability.ArkUI.ArkUI.Full 399 * @crossplatform 400 * @since 10 401 */ 402/** 403 * Defines the grid attribute functions. 404 * 405 * @extends ScrollableCommonMethod<GridAttribute> 406 * @syscap SystemCapability.ArkUI.ArkUI.Full 407 * @crossplatform 408 * @atomicservice 409 * @since 11 410 */ 411declare class GridAttribute extends ScrollableCommonMethod<GridAttribute> { 412 /** 413 * This parameter specifies the number of columns in the current grid layout. 414 * 415 * @param { string } value 416 * @returns { GridAttribute } 417 * @syscap SystemCapability.ArkUI.ArkUI.Full 418 * @since 7 419 */ 420 /** 421 * This parameter specifies the number of columns in the current grid layout. 422 * 423 * @param { string } value 424 * @returns { GridAttribute } 425 * @syscap SystemCapability.ArkUI.ArkUI.Full 426 * @crossplatform 427 * @since 10 428 */ 429 /** 430 * This parameter specifies the number of columns in the current grid layout. 431 * 432 * @param { string } value 433 * @returns { GridAttribute } 434 * @syscap SystemCapability.ArkUI.ArkUI.Full 435 * @crossplatform 436 * @atomicservice 437 * @since 11 438 */ 439 columnsTemplate(value: string): GridAttribute; 440 441 /** 442 * Lets you set the number of rows in the current grid layout, 443 * 444 * @param { string } value 445 * @returns { GridAttribute } 446 * @syscap SystemCapability.ArkUI.ArkUI.Full 447 * @since 7 448 */ 449 /** 450 * Lets you set the number of rows in the current grid layout, 451 * 452 * @param { string } value 453 * @returns { GridAttribute } 454 * @syscap SystemCapability.ArkUI.ArkUI.Full 455 * @crossplatform 456 * @since 10 457 */ 458 /** 459 * Lets you set the number of rows in the current grid layout, 460 * 461 * @param { string } value 462 * @returns { GridAttribute } 463 * @syscap SystemCapability.ArkUI.ArkUI.Full 464 * @crossplatform 465 * @atomicservice 466 * @since 11 467 */ 468 rowsTemplate(value: string): GridAttribute; 469 470 /** 471 * Allows you to set the spacing between columns. 472 * 473 * @param { Length } value 474 * @returns { GridAttribute } 475 * @syscap SystemCapability.ArkUI.ArkUI.Full 476 * @since 7 477 */ 478 /** 479 * Allows you to set the spacing between columns. 480 * 481 * @param { Length } value 482 * @returns { GridAttribute } 483 * @syscap SystemCapability.ArkUI.ArkUI.Full 484 * @crossplatform 485 * @since 10 486 */ 487 /** 488 * Allows you to set the spacing between columns. 489 * 490 * @param { Length } value 491 * @returns { GridAttribute } 492 * @syscap SystemCapability.ArkUI.ArkUI.Full 493 * @crossplatform 494 * @atomicservice 495 * @since 11 496 */ 497 columnsGap(value: Length): GridAttribute; 498 499 /** 500 * Lets you set the spacing between rows. 501 * 502 * @param { Length } value 503 * @returns { GridAttribute } 504 * @syscap SystemCapability.ArkUI.ArkUI.Full 505 * @since 7 506 */ 507 /** 508 * Lets you set the spacing between rows. 509 * 510 * @param { Length } value 511 * @returns { GridAttribute } 512 * @syscap SystemCapability.ArkUI.ArkUI.Full 513 * @crossplatform 514 * @since 10 515 */ 516 /** 517 * Lets you set the spacing between rows. 518 * 519 * @param { Length } value 520 * @returns { GridAttribute } 521 * @syscap SystemCapability.ArkUI.ArkUI.Full 522 * @crossplatform 523 * @atomicservice 524 * @since 11 525 */ 526 rowsGap(value: Length): GridAttribute; 527 528 /** 529 * This parameter specifies the width of the scroll bar. 530 * 531 * @param { number | string } value 532 * @returns { GridAttribute } 533 * @syscap SystemCapability.ArkUI.ArkUI.Full 534 * @since 7 535 */ 536 /** 537 * This parameter specifies the width of the scroll bar. 538 * 539 * @param { number | string } value 540 * @returns { GridAttribute } 541 * @syscap SystemCapability.ArkUI.ArkUI.Full 542 * @crossplatform 543 * @since 10 544 */ 545 /** 546 * This parameter specifies the width of the scroll bar. 547 * 548 * @param { number | string } value 549 * @returns { GridAttribute } 550 * @syscap SystemCapability.ArkUI.ArkUI.Full 551 * @crossplatform 552 * @atomicservice 553 * @since 11 554 */ 555 scrollBarWidth(value: number | string): GridAttribute; 556 557 /** 558 * Sets the color of the scroll bar. 559 * 560 * @param { Color | number | string } value 561 * @returns { GridAttribute } 562 * @syscap SystemCapability.ArkUI.ArkUI.Full 563 * @since 7 564 */ 565 /** 566 * Sets the color of the scroll bar. 567 * 568 * @param { Color | number | string } value 569 * @returns { GridAttribute } 570 * @syscap SystemCapability.ArkUI.ArkUI.Full 571 * @crossplatform 572 * @since 10 573 */ 574 /** 575 * Sets the color of the scroll bar. 576 * 577 * @param { Color | number | string } value 578 * @returns { GridAttribute } 579 * @syscap SystemCapability.ArkUI.ArkUI.Full 580 * @crossplatform 581 * @atomicservice 582 * @since 11 583 */ 584 scrollBarColor(value: Color | number | string): GridAttribute; 585 586 /** 587 * Lets you set the spacing between rows. 588 * 589 * @param { BarState } value 590 * @returns { GridAttribute } 591 * @syscap SystemCapability.ArkUI.ArkUI.Full 592 * @since 7 593 */ 594 /** 595 * Lets you set the spacing between rows. 596 * 597 * @param { BarState } value 598 * @returns { GridAttribute } 599 * @syscap SystemCapability.ArkUI.ArkUI.Full 600 * @crossplatform 601 * @since 10 602 */ 603 /** 604 * Lets you set the spacing between rows. 605 * 606 * @param { BarState } value 607 * @returns { GridAttribute } 608 * @syscap SystemCapability.ArkUI.ArkUI.Full 609 * @crossplatform 610 * @atomicservice 611 * @since 11 612 */ 613 scrollBar(value: BarState): GridAttribute; 614 615 /** 616 * Set scrollbar position. 617 * 618 * @param { function } event - callback of grid scroll, 619 * index is the current first displayed item, offset is the grid offset, 620 * return ComputedBarAttribute to update scrollbar position and height. 621 * @returns { GridAttribute } 622 * @syscap SystemCapability.ArkUI.ArkUI.Full 623 * @crossplatform 624 * @since 10 625 */ 626 /** 627 * Set scrollbar position. 628 * 629 * @param { function } event - callback of grid scroll, 630 * index is the current first displayed item, offset is the grid offset, 631 * return ComputedBarAttribute to update scrollbar position and height. 632 * @returns { GridAttribute } 633 * @syscap SystemCapability.ArkUI.ArkUI.Full 634 * @crossplatform 635 * @atomicservice 636 * @since 11 637 */ 638 onScrollBarUpdate(event: (index: number, offset: number) => ComputedBarAttribute): GridAttribute; 639 640 /** 641 * Called when the first item displayed in the grid changes. 642 * 643 * @param { function } event - of grid scroll, 644 * first is the index of the first item of the grid. 645 * @returns { GridAttribute } 646 * @syscap SystemCapability.ArkUI.ArkUI.Full 647 * @since 7 648 */ 649 /** 650 * Called when the first or last item displayed in the grid changes. 651 * 652 * @param { function } event - of grid scroll, 653 * first is the index of the first item displayed in the grid, 654 * last is the index of the last item displayed in the grid. 655 * @returns { GridAttribute } 656 * @syscap SystemCapability.ArkUI.ArkUI.Full 657 * @crossplatform 658 * @since 10 659 */ 660 /** 661 * Called when the first or last item displayed in the grid changes. 662 * 663 * @param { function } event - of grid scroll, 664 * first is the index of the first item displayed in the grid, 665 * last is the index of the last item displayed in the grid. 666 * @returns { GridAttribute } 667 * @syscap SystemCapability.ArkUI.ArkUI.Full 668 * @crossplatform 669 * @atomicservice 670 * @since 11 671 */ 672 onScrollIndex(event: (first: number, last: number) => void): GridAttribute; 673 674 /** 675 * cached Count 676 * 677 * @param { number } value 678 * @returns { GridAttribute } 679 * @syscap SystemCapability.ArkUI.ArkUI.Full 680 * @since 7 681 */ 682 /** 683 * cached Count 684 * 685 * @param { number } value 686 * @returns { GridAttribute } 687 * @syscap SystemCapability.ArkUI.ArkUI.Full 688 * @crossplatform 689 * @since 10 690 */ 691 /** 692 * cached Count 693 * 694 * @param { number } value 695 * @returns { GridAttribute } 696 * @syscap SystemCapability.ArkUI.ArkUI.Full 697 * @crossplatform 698 * @atomicservice 699 * @since 11 700 */ 701 cachedCount(value: number): GridAttribute; 702 703 /** 704 * Called to set number of GridItems to be preloaded (cached) in LazyForEach / Repeat. 705 * @param { number } count - number of GridItems to be preloaded (cached). 706 * @param { boolean } show - if true, cached items are displayed when clip is disabled. 707 * @returns { GridAttribute } 708 * @syscap SystemCapability.ArkUI.ArkUI.Full 709 * @crossplatform 710 * @atomicservice 711 * @since 14 712 */ 713 cachedCount(count: number, show: boolean): GridAttribute; 714 715 /** 716 * editMode 717 * 718 * @param { boolean } value 719 * @returns { GridAttribute } 720 * @syscap SystemCapability.ArkUI.ArkUI.Full 721 * @since 8 722 */ 723 /** 724 * editMode 725 * 726 * @param { boolean } value 727 * @returns { GridAttribute } 728 * @syscap SystemCapability.ArkUI.ArkUI.Full 729 * @crossplatform 730 * @since 10 731 */ 732 /** 733 * editMode 734 * 735 * @param { boolean } value 736 * @returns { GridAttribute } 737 * @syscap SystemCapability.ArkUI.ArkUI.Full 738 * @crossplatform 739 * @atomicservice 740 * @since 11 741 */ 742 editMode(value: boolean): GridAttribute; 743 744 /** 745 * Called when judging whether it is multiSelectable. 746 * 747 * @param { boolean } value 748 * @returns { GridAttribute } 749 * @syscap SystemCapability.ArkUI.ArkUI.Full 750 * @since 8 751 */ 752 /** 753 * Called when judging whether it is multiSelectable. 754 * 755 * @param { boolean } value 756 * @returns { GridAttribute } 757 * @syscap SystemCapability.ArkUI.ArkUI.Full 758 * @crossplatform 759 * @since 10 760 */ 761 /** 762 * Called when judging whether it is multiSelectable. 763 * 764 * @param { boolean } value 765 * @returns { GridAttribute } 766 * @syscap SystemCapability.ArkUI.ArkUI.Full 767 * @crossplatform 768 * @atomicservice 769 * @since 11 770 */ 771 multiSelectable(value: boolean): GridAttribute; 772 773 /** 774 * maxCount 775 * 776 * @param { number } value 777 * @returns { GridAttribute } 778 * @syscap SystemCapability.ArkUI.ArkUI.Full 779 * @since 8 780 */ 781 /** 782 * maxCount 783 * 784 * @param { number } value 785 * @returns { GridAttribute } 786 * @syscap SystemCapability.ArkUI.ArkUI.Full 787 * @crossplatform 788 * @since 10 789 */ 790 /** 791 * maxCount 792 * 793 * @param { number } value 794 * @returns { GridAttribute } 795 * @syscap SystemCapability.ArkUI.ArkUI.Full 796 * @crossplatform 797 * @atomicservice 798 * @since 11 799 */ 800 maxCount(value: number): GridAttribute; 801 802 /** 803 * minCount 804 * 805 * @param { number } value 806 * @returns { GridAttribute } 807 * @syscap SystemCapability.ArkUI.ArkUI.Full 808 * @since 8 809 */ 810 /** 811 * minCount 812 * 813 * @param { number } value 814 * @returns { GridAttribute } 815 * @syscap SystemCapability.ArkUI.ArkUI.Full 816 * @crossplatform 817 * @since 10 818 */ 819 /** 820 * minCount 821 * 822 * @param { number } value 823 * @returns { GridAttribute } 824 * @syscap SystemCapability.ArkUI.ArkUI.Full 825 * @crossplatform 826 * @atomicservice 827 * @since 11 828 */ 829 minCount(value: number): GridAttribute; 830 831 /** 832 * cellLength 833 * 834 * @param { number } value 835 * @returns { GridAttribute } 836 * @syscap SystemCapability.ArkUI.ArkUI.Full 837 * @since 8 838 */ 839 /** 840 * cellLength 841 * 842 * @param { number } value 843 * @returns { GridAttribute } 844 * @syscap SystemCapability.ArkUI.ArkUI.Full 845 * @crossplatform 846 * @since 10 847 */ 848 /** 849 * cellLength 850 * 851 * @param { number } value 852 * @returns { GridAttribute } 853 * @syscap SystemCapability.ArkUI.ArkUI.Full 854 * @crossplatform 855 * @atomicservice 856 * @since 11 857 */ 858 cellLength(value: number): GridAttribute; 859 860 /** 861 * Control GridDirection of the grid. 862 * 863 * @param { GridDirection } value 864 * @returns { GridAttribute } 865 * @syscap SystemCapability.ArkUI.ArkUI.Full 866 * @since 8 867 */ 868 /** 869 * Control GridDirection of the grid. 870 * 871 * @param { GridDirection } value 872 * @returns { GridAttribute } 873 * @syscap SystemCapability.ArkUI.ArkUI.Full 874 * @crossplatform 875 * @since 10 876 */ 877 /** 878 * Control GridDirection of the grid. 879 * 880 * @param { GridDirection } value 881 * @returns { GridAttribute } 882 * @syscap SystemCapability.ArkUI.ArkUI.Full 883 * @crossplatform 884 * @atomicservice 885 * @since 11 886 */ 887 layoutDirection(value: GridDirection): GridAttribute; 888 889 /** 890 * Control if the grid supports animation. 891 * 892 * @param { boolean } value 893 * @returns { GridAttribute } 894 * @syscap SystemCapability.ArkUI.ArkUI.Full 895 * @since 8 896 */ 897 /** 898 * Control if the grid supports animation. 899 * 900 * @param { boolean } value 901 * @returns { GridAttribute } 902 * @syscap SystemCapability.ArkUI.ArkUI.Full 903 * @crossplatform 904 * @since 10 905 */ 906 /** 907 * Control if the grid supports animation. 908 * 909 * @param { boolean } value 910 * @returns { GridAttribute } 911 * @syscap SystemCapability.ArkUI.ArkUI.Full 912 * @crossplatform 913 * @atomicservice 914 * @since 11 915 */ 916 supportAnimation(value: boolean): GridAttribute; 917 918 /** 919 * After a listener is bound, the component can be dragged. After the drag occurs, a callback is triggered. 920 * (To be triggered, press and hold for 170 milliseconds (ms)) 921 * 922 * @param { function } event 923 * @returns { GridAttribute } 924 * @syscap SystemCapability.ArkUI.ArkUI.Full 925 * @since 8 926 */ 927 /** 928 * After a listener is bound, the component can be dragged. After the drag occurs, a callback is triggered. 929 * (To be triggered, press and hold for 170 milliseconds (ms)) 930 * 931 * @param { function } event 932 * @returns { GridAttribute } 933 * @syscap SystemCapability.ArkUI.ArkUI.Full 934 * @crossplatform 935 * @since 10 936 */ 937 /** 938 * After a listener is bound, the component can be dragged. After the drag occurs, a callback is triggered. 939 * (To be triggered, press and hold for 170 milliseconds (ms)) 940 * 941 * @param { function } event 942 * @returns { GridAttribute } 943 * @syscap SystemCapability.ArkUI.ArkUI.Full 944 * @crossplatform 945 * @atomicservice 946 * @since 11 947 */ 948 onItemDragStart(event: (event: ItemDragInfo, itemIndex: number) => (() => any) | void): GridAttribute; 949 950 /** 951 * After binding, a callback is triggered when the component is dragged to the range of the component. 952 * 953 * @param { function } event 954 * @returns { GridAttribute } 955 * @syscap SystemCapability.ArkUI.ArkUI.Full 956 * @since 8 957 */ 958 /** 959 * After binding, a callback is triggered when the component is dragged to the range of the component. 960 * 961 * @param { function } event 962 * @returns { GridAttribute } 963 * @syscap SystemCapability.ArkUI.ArkUI.Full 964 * @crossplatform 965 * @since 10 966 */ 967 /** 968 * After binding, a callback is triggered when the component is dragged to the range of the component. 969 * 970 * @param { function } event 971 * @returns { GridAttribute } 972 * @syscap SystemCapability.ArkUI.ArkUI.Full 973 * @crossplatform 974 * @atomicservice 975 * @since 11 976 */ 977 onItemDragEnter(event: (event: ItemDragInfo) => void): GridAttribute; 978 979 /** 980 * After binding, a callback is triggered when the drag moves within the range of a placeable component. 981 * 982 * @param { function } event 983 * @returns { GridAttribute } 984 * @syscap SystemCapability.ArkUI.ArkUI.Full 985 * @since 8 986 */ 987 /** 988 * After binding, a callback is triggered when the drag moves within the range of a placeable component. 989 * 990 * @param { function } event 991 * @returns { GridAttribute } 992 * @syscap SystemCapability.ArkUI.ArkUI.Full 993 * @crossplatform 994 * @since 10 995 */ 996 /** 997 * After binding, a callback is triggered when the drag moves within the range of a placeable component. 998 * 999 * @param { function } event 1000 * @returns { GridAttribute } 1001 * @syscap SystemCapability.ArkUI.ArkUI.Full 1002 * @crossplatform 1003 * @atomicservice 1004 * @since 11 1005 */ 1006 onItemDragMove(event: (event: ItemDragInfo, itemIndex: number, insertIndex: number) => void): GridAttribute; 1007 1008 /** 1009 * After binding, a callback is triggered when the component is dragged out of the component range. 1010 * 1011 * @param { function } event 1012 * @returns { GridAttribute } 1013 * @syscap SystemCapability.ArkUI.ArkUI.Full 1014 * @since 8 1015 */ 1016 /** 1017 * After binding, a callback is triggered when the component is dragged out of the component range. 1018 * 1019 * @param { function } event 1020 * @returns { GridAttribute } 1021 * @syscap SystemCapability.ArkUI.ArkUI.Full 1022 * @crossplatform 1023 * @since 10 1024 */ 1025 /** 1026 * After binding, a callback is triggered when the component is dragged out of the component range. 1027 * 1028 * @param { function } event 1029 * @returns { GridAttribute } 1030 * @syscap SystemCapability.ArkUI.ArkUI.Full 1031 * @crossplatform 1032 * @atomicservice 1033 * @since 11 1034 */ 1035 onItemDragLeave(event: (event: ItemDragInfo, itemIndex: number) => void): GridAttribute; 1036 1037 /** 1038 * The component bound to this event can be used as the drag release target. 1039 * This callback is triggered when the drag behavior is stopped within the scope of the component. 1040 * 1041 * @param { function } event 1042 * @returns { GridAttribute } 1043 * @syscap SystemCapability.ArkUI.ArkUI.Full 1044 * @since 8 1045 */ 1046 /** 1047 * The component bound to this event can be used as the drag release target. 1048 * This callback is triggered when the drag behavior is stopped within the scope of the component. 1049 * 1050 * @param { function } event 1051 * @returns { GridAttribute } 1052 * @syscap SystemCapability.ArkUI.ArkUI.Full 1053 * @crossplatform 1054 * @since 10 1055 */ 1056 /** 1057 * The component bound to this event can be used as the drag release target. 1058 * This callback is triggered when the drag behavior is stopped within the scope of the component. 1059 * 1060 * @param { function } event 1061 * @returns { GridAttribute } 1062 * @syscap SystemCapability.ArkUI.ArkUI.Full 1063 * @crossplatform 1064 * @atomicservice 1065 * @since 11 1066 */ 1067 onItemDrop( 1068 event: (event: ItemDragInfo, itemIndex: number, insertIndex: number, isSuccess: boolean) => void, 1069 ): GridAttribute; 1070 1071 /** 1072 * Called when the sliding effect is set. 1073 * 1074 * @param { EdgeEffect } value - Scroll effect. For details, see EdgeEffect. 1075 * @returns { GridAttribute } The attribute of the grid 1076 * @syscap SystemCapability.ArkUI.ArkUI.Full 1077 * @crossplatform 1078 * @since 10 1079 */ 1080 /** 1081 * Called when the sliding effect is set. 1082 * 1083 * @param { EdgeEffect } value 1084 * @param { EdgeEffectOptions } options 1085 * @returns { GridAttribute } The attribute of the grid 1086 * @syscap SystemCapability.ArkUI.ArkUI.Full 1087 * @crossplatform 1088 * @atomicservice 1089 * @since 11 1090 */ 1091 edgeEffect(value: EdgeEffect, options?: EdgeEffectOptions): GridAttribute; 1092 1093 /** 1094 * Called to setting the nested scroll options. 1095 * 1096 * @param { NestedScrollOptions } value - options for nested scrolling. 1097 * @returns { GridAttribute } the attribute of the grid. 1098 * @syscap SystemCapability.ArkUI.ArkUI.Full 1099 * @since 10 1100 */ 1101 /** 1102 * Called to setting the nested scroll options. 1103 * 1104 * @param { NestedScrollOptions } value - options for nested scrolling. 1105 * @returns { GridAttribute } the attribute of the grid. 1106 * @syscap SystemCapability.ArkUI.ArkUI.Full 1107 * @crossplatform 1108 * @atomicservice 1109 * @since 11 1110 */ 1111 nestedScroll(value: NestedScrollOptions): GridAttribute; 1112 1113 /** 1114 * Called when setting whether to enable scroll by gesture or mouse. 1115 * 1116 * @param { boolean } value 1117 * @returns { GridAttribute } The attribute of the grid 1118 * @syscap SystemCapability.ArkUI.ArkUI.Full 1119 * @crossplatform 1120 * @since 10 1121 */ 1122 /** 1123 * Called when setting whether to enable scroll by gesture or mouse. 1124 * 1125 * @param { boolean } value 1126 * @returns { GridAttribute } The attribute of the grid 1127 * @syscap SystemCapability.ArkUI.ArkUI.Full 1128 * @crossplatform 1129 * @atomicservice 1130 * @since 11 1131 */ 1132 enableScrollInteraction(value: boolean): GridAttribute; 1133 1134 /** 1135 * Called to setting the friction. 1136 * 1137 * @param { number | Resource } value - options for scrolling friction. 1138 * @returns { GridAttribute } the attribute of the grid. 1139 * @syscap SystemCapability.ArkUI.ArkUI.Full 1140 * @crossplatform 1141 * @since 10 1142 */ 1143 /** 1144 * Called to setting the friction. 1145 * 1146 * @param { number | Resource } value - options for scrolling friction. 1147 * @returns { GridAttribute } the attribute of the grid. 1148 * @syscap SystemCapability.ArkUI.ArkUI.Full 1149 * @crossplatform 1150 * @atomicservice 1151 * @since 11 1152 */ 1153 friction(value: number | Resource): GridAttribute; 1154 1155 /** 1156 * Set the alignment of grid items. 1157 * 1158 * @param { Optional<GridItemAlignment> } alignment - Items alignment 1159 * @returns { GridAttribute } The attribute of the grid. 1160 * @syscap SystemCapability.ArkUI.ArkUI.Full 1161 * @crossplatform 1162 * @atomicservice 1163 * @since 12 1164 */ 1165 alignItems(alignment: Optional<GridItemAlignment>): GridAttribute; 1166 1167 /** 1168 * Called When sliding the grid. 1169 * 1170 * @param { function } event - callback of grid scroll, 1171 * scrollOffset is offset per frame scrolling, ScrollState is current sliding state. 1172 * @returns { GridAttribute } 1173 * @syscap SystemCapability.ArkUI.ArkUI.Full 1174 * @crossplatform 1175 * @since 10 1176 */ 1177 /** 1178 * Called When sliding the grid. 1179 * 1180 * @param { function } event - callback of grid scroll, 1181 * scrollOffset is offset per frame scrolling, ScrollState is current sliding state. 1182 * @returns { GridAttribute } 1183 * @syscap SystemCapability.ArkUI.ArkUI.Full 1184 * @crossplatform 1185 * @atomicservice 1186 * @since 11 1187 * @deprecated since 12 1188 * @useinstead common.ScrollableCommonMethod#onDidScroll 1189 */ 1190 onScroll(event: (scrollOffset: number, scrollState: ScrollState) => void): GridAttribute; 1191 1192 /** 1193 * Called when the grid begins to arrive. 1194 * 1195 * @param { function } event 1196 * @returns { GridAttribute } 1197 * @syscap SystemCapability.ArkUI.ArkUI.Full 1198 * @crossplatform 1199 * @since 10 1200 */ 1201 /** 1202 * Called when the grid begins to arrive. 1203 * 1204 * @param { function } event 1205 * @returns { GridAttribute } 1206 * @syscap SystemCapability.ArkUI.ArkUI.Full 1207 * @crossplatform 1208 * @atomicservice 1209 * @since 11 1210 */ 1211 onReachStart(event: () => void): GridAttribute; 1212 1213 /** 1214 * Called when the grid reaches the end. 1215 * 1216 * @param { function } event 1217 * @returns { GridAttribute } 1218 * @syscap SystemCapability.ArkUI.ArkUI.Full 1219 * @crossplatform 1220 * @since 10 1221 */ 1222 /** 1223 * Called when the grid reaches the end. 1224 * 1225 * @param { function } event 1226 * @returns { GridAttribute } 1227 * @syscap SystemCapability.ArkUI.ArkUI.Full 1228 * @crossplatform 1229 * @atomicservice 1230 * @since 11 1231 */ 1232 onReachEnd(event: () => void): GridAttribute; 1233 1234 /** 1235 * Called when the slider start. 1236 * 1237 * @param { function } event 1238 * @returns { GridAttribute } 1239 * @syscap SystemCapability.ArkUI.ArkUI.Full 1240 * @crossplatform 1241 * @since 10 1242 */ 1243 /** 1244 * Called when the slider start. 1245 * 1246 * @param { function } event 1247 * @returns { GridAttribute } 1248 * @syscap SystemCapability.ArkUI.ArkUI.Full 1249 * @crossplatform 1250 * @atomicservice 1251 * @since 11 1252 */ 1253 onScrollStart(event: () => void): GridAttribute; 1254 1255 /** 1256 * Called when the slider stops. 1257 * 1258 * @param { function } event 1259 * @returns { GridAttribute } 1260 * @syscap SystemCapability.ArkUI.ArkUI.Full 1261 * @crossplatform 1262 * @since 10 1263 */ 1264 /** 1265 * Called when the slider stops. 1266 * 1267 * @param { function } event 1268 * @returns { GridAttribute } 1269 * @syscap SystemCapability.ArkUI.ArkUI.Full 1270 * @crossplatform 1271 * @atomicservice 1272 * @since 11 1273 */ 1274 onScrollStop(event: () => void): GridAttribute; 1275 1276 /** 1277 * Called when scrolling begin each frame. 1278 * 1279 * @param { function } event - callback of grid scroll, 1280 * offset is the amount of sliding that is about to occur, state is current sliding state, 1281 * return number to actual sliding offset. 1282 * @returns { GridAttribute } 1283 * @syscap SystemCapability.ArkUI.ArkUI.Full 1284 * @crossplatform 1285 * @since 10 1286 */ 1287 /** 1288 * Called when scrolling begin each frame. 1289 * 1290 * @param { function } event - callback of grid scroll, 1291 * offset is the amount of sliding that is about to occur, state is current sliding state, 1292 * return number to actual sliding offset. 1293 * @returns { GridAttribute } 1294 * @syscap SystemCapability.ArkUI.ArkUI.Full 1295 * @crossplatform 1296 * @atomicservice 1297 * @since 11 1298 */ 1299 onScrollFrameBegin(event: (offset: number, state: ScrollState) => { offsetRemain: number }): GridAttribute; 1300} 1301 1302/** 1303 * Defines Grid Component. 1304 * 1305 * @syscap SystemCapability.ArkUI.ArkUI.Full 1306 * @since 7 1307 */ 1308/** 1309 * Defines Grid Component. 1310 * 1311 * @syscap SystemCapability.ArkUI.ArkUI.Full 1312 * @crossplatform 1313 * @since 10 1314 */ 1315/** 1316 * Defines Grid Component. 1317 * 1318 * @syscap SystemCapability.ArkUI.ArkUI.Full 1319 * @crossplatform 1320 * @atomicservice 1321 * @since 11 1322 */ 1323declare const Grid: GridInterface; 1324 1325/** 1326 * Defines Grid Component instance. 1327 * 1328 * @syscap SystemCapability.ArkUI.ArkUI.Full 1329 * @since 7 1330 */ 1331/** 1332 * Defines Grid Component instance. 1333 * 1334 * @syscap SystemCapability.ArkUI.ArkUI.Full 1335 * @crossplatform 1336 * @since 10 1337 */ 1338/** 1339 * Defines Grid Component instance. 1340 * 1341 * @syscap SystemCapability.ArkUI.ArkUI.Full 1342 * @crossplatform 1343 * @atomicservice 1344 * @since 11 1345 */ 1346declare const GridInstance: GridAttribute; 1347