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 * editMode 705 * 706 * @param { boolean } value 707 * @returns { GridAttribute } 708 * @syscap SystemCapability.ArkUI.ArkUI.Full 709 * @since 8 710 */ 711 /** 712 * editMode 713 * 714 * @param { boolean } value 715 * @returns { GridAttribute } 716 * @syscap SystemCapability.ArkUI.ArkUI.Full 717 * @crossplatform 718 * @since 10 719 */ 720 /** 721 * editMode 722 * 723 * @param { boolean } value 724 * @returns { GridAttribute } 725 * @syscap SystemCapability.ArkUI.ArkUI.Full 726 * @crossplatform 727 * @atomicservice 728 * @since 11 729 */ 730 editMode(value: boolean): GridAttribute; 731 732 /** 733 * Called when judging whether it is multiSelectable. 734 * 735 * @param { boolean } value 736 * @returns { GridAttribute } 737 * @syscap SystemCapability.ArkUI.ArkUI.Full 738 * @since 8 739 */ 740 /** 741 * Called when judging whether it is multiSelectable. 742 * 743 * @param { boolean } value 744 * @returns { GridAttribute } 745 * @syscap SystemCapability.ArkUI.ArkUI.Full 746 * @crossplatform 747 * @since 10 748 */ 749 /** 750 * Called when judging whether it is multiSelectable. 751 * 752 * @param { boolean } value 753 * @returns { GridAttribute } 754 * @syscap SystemCapability.ArkUI.ArkUI.Full 755 * @crossplatform 756 * @atomicservice 757 * @since 11 758 */ 759 multiSelectable(value: boolean): GridAttribute; 760 761 /** 762 * maxCount 763 * 764 * @param { number } value 765 * @returns { GridAttribute } 766 * @syscap SystemCapability.ArkUI.ArkUI.Full 767 * @since 8 768 */ 769 /** 770 * maxCount 771 * 772 * @param { number } value 773 * @returns { GridAttribute } 774 * @syscap SystemCapability.ArkUI.ArkUI.Full 775 * @crossplatform 776 * @since 10 777 */ 778 /** 779 * maxCount 780 * 781 * @param { number } value 782 * @returns { GridAttribute } 783 * @syscap SystemCapability.ArkUI.ArkUI.Full 784 * @crossplatform 785 * @atomicservice 786 * @since 11 787 */ 788 maxCount(value: number): GridAttribute; 789 790 /** 791 * minCount 792 * 793 * @param { number } value 794 * @returns { GridAttribute } 795 * @syscap SystemCapability.ArkUI.ArkUI.Full 796 * @since 8 797 */ 798 /** 799 * minCount 800 * 801 * @param { number } value 802 * @returns { GridAttribute } 803 * @syscap SystemCapability.ArkUI.ArkUI.Full 804 * @crossplatform 805 * @since 10 806 */ 807 /** 808 * minCount 809 * 810 * @param { number } value 811 * @returns { GridAttribute } 812 * @syscap SystemCapability.ArkUI.ArkUI.Full 813 * @crossplatform 814 * @atomicservice 815 * @since 11 816 */ 817 minCount(value: number): GridAttribute; 818 819 /** 820 * cellLength 821 * 822 * @param { number } value 823 * @returns { GridAttribute } 824 * @syscap SystemCapability.ArkUI.ArkUI.Full 825 * @since 8 826 */ 827 /** 828 * cellLength 829 * 830 * @param { number } value 831 * @returns { GridAttribute } 832 * @syscap SystemCapability.ArkUI.ArkUI.Full 833 * @crossplatform 834 * @since 10 835 */ 836 /** 837 * cellLength 838 * 839 * @param { number } value 840 * @returns { GridAttribute } 841 * @syscap SystemCapability.ArkUI.ArkUI.Full 842 * @crossplatform 843 * @atomicservice 844 * @since 11 845 */ 846 cellLength(value: number): GridAttribute; 847 848 /** 849 * Control GridDirection of the grid. 850 * 851 * @param { GridDirection } value 852 * @returns { GridAttribute } 853 * @syscap SystemCapability.ArkUI.ArkUI.Full 854 * @since 8 855 */ 856 /** 857 * Control GridDirection of the grid. 858 * 859 * @param { GridDirection } value 860 * @returns { GridAttribute } 861 * @syscap SystemCapability.ArkUI.ArkUI.Full 862 * @crossplatform 863 * @since 10 864 */ 865 /** 866 * Control GridDirection of the grid. 867 * 868 * @param { GridDirection } value 869 * @returns { GridAttribute } 870 * @syscap SystemCapability.ArkUI.ArkUI.Full 871 * @crossplatform 872 * @atomicservice 873 * @since 11 874 */ 875 layoutDirection(value: GridDirection): GridAttribute; 876 877 /** 878 * Control if the grid supports animation. 879 * 880 * @param { boolean } value 881 * @returns { GridAttribute } 882 * @syscap SystemCapability.ArkUI.ArkUI.Full 883 * @since 8 884 */ 885 /** 886 * Control if the grid supports animation. 887 * 888 * @param { boolean } value 889 * @returns { GridAttribute } 890 * @syscap SystemCapability.ArkUI.ArkUI.Full 891 * @crossplatform 892 * @since 10 893 */ 894 /** 895 * Control if the grid supports animation. 896 * 897 * @param { boolean } value 898 * @returns { GridAttribute } 899 * @syscap SystemCapability.ArkUI.ArkUI.Full 900 * @crossplatform 901 * @atomicservice 902 * @since 11 903 */ 904 supportAnimation(value: boolean): GridAttribute; 905 906 /** 907 * After a listener is bound, the component can be dragged. After the drag occurs, a callback is triggered. 908 * (To be triggered, press and hold for 170 milliseconds (ms)) 909 * 910 * @param { function } event 911 * @returns { GridAttribute } 912 * @syscap SystemCapability.ArkUI.ArkUI.Full 913 * @since 8 914 */ 915 /** 916 * After a listener is bound, the component can be dragged. After the drag occurs, a callback is triggered. 917 * (To be triggered, press and hold for 170 milliseconds (ms)) 918 * 919 * @param { function } event 920 * @returns { GridAttribute } 921 * @syscap SystemCapability.ArkUI.ArkUI.Full 922 * @crossplatform 923 * @since 10 924 */ 925 /** 926 * After a listener is bound, the component can be dragged. After the drag occurs, a callback is triggered. 927 * (To be triggered, press and hold for 170 milliseconds (ms)) 928 * 929 * @param { function } event 930 * @returns { GridAttribute } 931 * @syscap SystemCapability.ArkUI.ArkUI.Full 932 * @crossplatform 933 * @atomicservice 934 * @since 11 935 */ 936 onItemDragStart(event: (event: ItemDragInfo, itemIndex: number) => (() => any) | void): GridAttribute; 937 938 /** 939 * After binding, a callback is triggered when the component is dragged to the range of the component. 940 * 941 * @param { function } event 942 * @returns { GridAttribute } 943 * @syscap SystemCapability.ArkUI.ArkUI.Full 944 * @since 8 945 */ 946 /** 947 * After binding, a callback is triggered when the component is dragged to the range of the component. 948 * 949 * @param { function } event 950 * @returns { GridAttribute } 951 * @syscap SystemCapability.ArkUI.ArkUI.Full 952 * @crossplatform 953 * @since 10 954 */ 955 /** 956 * After binding, a callback is triggered when the component is dragged to the range of the component. 957 * 958 * @param { function } event 959 * @returns { GridAttribute } 960 * @syscap SystemCapability.ArkUI.ArkUI.Full 961 * @crossplatform 962 * @atomicservice 963 * @since 11 964 */ 965 onItemDragEnter(event: (event: ItemDragInfo) => void): GridAttribute; 966 967 /** 968 * After binding, a callback is triggered when the drag moves within the range of a placeable component. 969 * 970 * @param { function } event 971 * @returns { GridAttribute } 972 * @syscap SystemCapability.ArkUI.ArkUI.Full 973 * @since 8 974 */ 975 /** 976 * After binding, a callback is triggered when the drag moves within the range of a placeable component. 977 * 978 * @param { function } event 979 * @returns { GridAttribute } 980 * @syscap SystemCapability.ArkUI.ArkUI.Full 981 * @crossplatform 982 * @since 10 983 */ 984 /** 985 * After binding, a callback is triggered when the drag moves within the range of a placeable component. 986 * 987 * @param { function } event 988 * @returns { GridAttribute } 989 * @syscap SystemCapability.ArkUI.ArkUI.Full 990 * @crossplatform 991 * @atomicservice 992 * @since 11 993 */ 994 onItemDragMove(event: (event: ItemDragInfo, itemIndex: number, insertIndex: number) => void): GridAttribute; 995 996 /** 997 * After binding, a callback is triggered when the component is dragged out of the component range. 998 * 999 * @param { function } event 1000 * @returns { GridAttribute } 1001 * @syscap SystemCapability.ArkUI.ArkUI.Full 1002 * @since 8 1003 */ 1004 /** 1005 * After binding, a callback is triggered when the component is dragged out of the component range. 1006 * 1007 * @param { function } event 1008 * @returns { GridAttribute } 1009 * @syscap SystemCapability.ArkUI.ArkUI.Full 1010 * @crossplatform 1011 * @since 10 1012 */ 1013 /** 1014 * After binding, a callback is triggered when the component is dragged out of the component range. 1015 * 1016 * @param { function } event 1017 * @returns { GridAttribute } 1018 * @syscap SystemCapability.ArkUI.ArkUI.Full 1019 * @crossplatform 1020 * @atomicservice 1021 * @since 11 1022 */ 1023 onItemDragLeave(event: (event: ItemDragInfo, itemIndex: number) => void): GridAttribute; 1024 1025 /** 1026 * The component bound to this event can be used as the drag release target. 1027 * This callback is triggered when the drag behavior is stopped within the scope of the component. 1028 * 1029 * @param { function } event 1030 * @returns { GridAttribute } 1031 * @syscap SystemCapability.ArkUI.ArkUI.Full 1032 * @since 8 1033 */ 1034 /** 1035 * The component bound to this event can be used as the drag release target. 1036 * This callback is triggered when the drag behavior is stopped within the scope of the component. 1037 * 1038 * @param { function } event 1039 * @returns { GridAttribute } 1040 * @syscap SystemCapability.ArkUI.ArkUI.Full 1041 * @crossplatform 1042 * @since 10 1043 */ 1044 /** 1045 * The component bound to this event can be used as the drag release target. 1046 * This callback is triggered when the drag behavior is stopped within the scope of the component. 1047 * 1048 * @param { function } event 1049 * @returns { GridAttribute } 1050 * @syscap SystemCapability.ArkUI.ArkUI.Full 1051 * @crossplatform 1052 * @atomicservice 1053 * @since 11 1054 */ 1055 onItemDrop( 1056 event: (event: ItemDragInfo, itemIndex: number, insertIndex: number, isSuccess: boolean) => void, 1057 ): GridAttribute; 1058 1059 /** 1060 * Called when the sliding effect is set. 1061 * 1062 * @param { EdgeEffect } value - Scroll effect. For details, see EdgeEffect. 1063 * @returns { GridAttribute } The attribute of the grid 1064 * @syscap SystemCapability.ArkUI.ArkUI.Full 1065 * @crossplatform 1066 * @since 10 1067 */ 1068 /** 1069 * Called when the sliding effect is set. 1070 * 1071 * @param { EdgeEffect } value 1072 * @param { EdgeEffectOptions } options 1073 * @returns { GridAttribute } The attribute of the grid 1074 * @syscap SystemCapability.ArkUI.ArkUI.Full 1075 * @crossplatform 1076 * @atomicservice 1077 * @since 11 1078 */ 1079 edgeEffect(value: EdgeEffect, options?: EdgeEffectOptions): GridAttribute; 1080 1081 /** 1082 * Called to setting the nested scroll options. 1083 * 1084 * @param { NestedScrollOptions } value - options for nested scrolling. 1085 * @returns { GridAttribute } the attribute of the grid. 1086 * @syscap SystemCapability.ArkUI.ArkUI.Full 1087 * @since 10 1088 */ 1089 /** 1090 * Called to setting the nested scroll options. 1091 * 1092 * @param { NestedScrollOptions } value - options for nested scrolling. 1093 * @returns { GridAttribute } the attribute of the grid. 1094 * @syscap SystemCapability.ArkUI.ArkUI.Full 1095 * @crossplatform 1096 * @atomicservice 1097 * @since 11 1098 */ 1099 nestedScroll(value: NestedScrollOptions): GridAttribute; 1100 1101 /** 1102 * Called when setting whether to enable scroll by gesture or mouse. 1103 * 1104 * @param { boolean } value 1105 * @returns { GridAttribute } The attribute of the grid 1106 * @syscap SystemCapability.ArkUI.ArkUI.Full 1107 * @crossplatform 1108 * @since 10 1109 */ 1110 /** 1111 * Called when setting whether to enable scroll by gesture or mouse. 1112 * 1113 * @param { boolean } value 1114 * @returns { GridAttribute } The attribute of the grid 1115 * @syscap SystemCapability.ArkUI.ArkUI.Full 1116 * @crossplatform 1117 * @atomicservice 1118 * @since 11 1119 */ 1120 enableScrollInteraction(value: boolean): GridAttribute; 1121 1122 /** 1123 * Called to setting the friction. 1124 * 1125 * @param { number | Resource } value - options for scrolling friction. 1126 * @returns { GridAttribute } the attribute of the grid. 1127 * @syscap SystemCapability.ArkUI.ArkUI.Full 1128 * @crossplatform 1129 * @since 10 1130 */ 1131 /** 1132 * Called to setting the friction. 1133 * 1134 * @param { number | Resource } value - options for scrolling friction. 1135 * @returns { GridAttribute } the attribute of the grid. 1136 * @syscap SystemCapability.ArkUI.ArkUI.Full 1137 * @crossplatform 1138 * @atomicservice 1139 * @since 11 1140 */ 1141 friction(value: number | Resource): GridAttribute; 1142 1143 /** 1144 * Set the alignment of grid items. 1145 * 1146 * @param { Optional<GridItemAlignment> } alignment - Items alignment 1147 * @returns { GridAttribute } The attribute of the grid. 1148 * @syscap SystemCapability.ArkUI.ArkUI.Full 1149 * @crossplatform 1150 * @atomicservice 1151 * @since 12 1152 */ 1153 alignItems(alignment: Optional<GridItemAlignment>): GridAttribute; 1154 1155 /** 1156 * Called When sliding the grid. 1157 * 1158 * @param { function } event - callback of grid scroll, 1159 * scrollOffset is offset per frame scrolling, ScrollState is current sliding state. 1160 * @returns { GridAttribute } 1161 * @syscap SystemCapability.ArkUI.ArkUI.Full 1162 * @crossplatform 1163 * @since 10 1164 */ 1165 /** 1166 * Called When sliding the grid. 1167 * 1168 * @param { function } event - callback of grid scroll, 1169 * scrollOffset is offset per frame scrolling, ScrollState is current sliding state. 1170 * @returns { GridAttribute } 1171 * @syscap SystemCapability.ArkUI.ArkUI.Full 1172 * @crossplatform 1173 * @atomicservice 1174 * @since 11 1175 * @deprecated since 12 1176 * @useinstead common.ScrollableCommonMethod#onDidScroll 1177 */ 1178 onScroll(event: (scrollOffset: number, scrollState: ScrollState) => void): GridAttribute; 1179 1180 /** 1181 * Called when the grid begins to arrive. 1182 * 1183 * @param { function } event 1184 * @returns { GridAttribute } 1185 * @syscap SystemCapability.ArkUI.ArkUI.Full 1186 * @crossplatform 1187 * @since 10 1188 */ 1189 /** 1190 * Called when the grid begins to arrive. 1191 * 1192 * @param { function } event 1193 * @returns { GridAttribute } 1194 * @syscap SystemCapability.ArkUI.ArkUI.Full 1195 * @crossplatform 1196 * @atomicservice 1197 * @since 11 1198 */ 1199 onReachStart(event: () => void): GridAttribute; 1200 1201 /** 1202 * Called when the grid reaches the end. 1203 * 1204 * @param { function } event 1205 * @returns { GridAttribute } 1206 * @syscap SystemCapability.ArkUI.ArkUI.Full 1207 * @crossplatform 1208 * @since 10 1209 */ 1210 /** 1211 * Called when the grid reaches the end. 1212 * 1213 * @param { function } event 1214 * @returns { GridAttribute } 1215 * @syscap SystemCapability.ArkUI.ArkUI.Full 1216 * @crossplatform 1217 * @atomicservice 1218 * @since 11 1219 */ 1220 onReachEnd(event: () => void): GridAttribute; 1221 1222 /** 1223 * Called when the slider start. 1224 * 1225 * @param { function } event 1226 * @returns { GridAttribute } 1227 * @syscap SystemCapability.ArkUI.ArkUI.Full 1228 * @crossplatform 1229 * @since 10 1230 */ 1231 /** 1232 * Called when the slider start. 1233 * 1234 * @param { function } event 1235 * @returns { GridAttribute } 1236 * @syscap SystemCapability.ArkUI.ArkUI.Full 1237 * @crossplatform 1238 * @atomicservice 1239 * @since 11 1240 */ 1241 onScrollStart(event: () => void): GridAttribute; 1242 1243 /** 1244 * Called when the slider stops. 1245 * 1246 * @param { function } event 1247 * @returns { GridAttribute } 1248 * @syscap SystemCapability.ArkUI.ArkUI.Full 1249 * @crossplatform 1250 * @since 10 1251 */ 1252 /** 1253 * Called when the slider stops. 1254 * 1255 * @param { function } event 1256 * @returns { GridAttribute } 1257 * @syscap SystemCapability.ArkUI.ArkUI.Full 1258 * @crossplatform 1259 * @atomicservice 1260 * @since 11 1261 */ 1262 onScrollStop(event: () => void): GridAttribute; 1263 1264 /** 1265 * Called when scrolling begin each frame. 1266 * 1267 * @param { function } event - callback of grid scroll, 1268 * offset is the amount of sliding that is about to occur, state is current sliding state, 1269 * return number to actual sliding offset. 1270 * @returns { GridAttribute } 1271 * @syscap SystemCapability.ArkUI.ArkUI.Full 1272 * @crossplatform 1273 * @since 10 1274 */ 1275 /** 1276 * Called when scrolling begin each frame. 1277 * 1278 * @param { function } event - callback of grid scroll, 1279 * offset is the amount of sliding that is about to occur, state is current sliding state, 1280 * return number to actual sliding offset. 1281 * @returns { GridAttribute } 1282 * @syscap SystemCapability.ArkUI.ArkUI.Full 1283 * @crossplatform 1284 * @atomicservice 1285 * @since 11 1286 */ 1287 onScrollFrameBegin(event: (offset: number, state: ScrollState) => { offsetRemain: number }): GridAttribute; 1288} 1289 1290/** 1291 * Defines Grid Component. 1292 * 1293 * @syscap SystemCapability.ArkUI.ArkUI.Full 1294 * @since 7 1295 */ 1296/** 1297 * Defines Grid Component. 1298 * 1299 * @syscap SystemCapability.ArkUI.ArkUI.Full 1300 * @crossplatform 1301 * @since 10 1302 */ 1303/** 1304 * Defines Grid Component. 1305 * 1306 * @syscap SystemCapability.ArkUI.ArkUI.Full 1307 * @crossplatform 1308 * @atomicservice 1309 * @since 11 1310 */ 1311declare const Grid: GridInterface; 1312 1313/** 1314 * Defines Grid Component instance. 1315 * 1316 * @syscap SystemCapability.ArkUI.ArkUI.Full 1317 * @since 7 1318 */ 1319/** 1320 * Defines Grid Component instance. 1321 * 1322 * @syscap SystemCapability.ArkUI.ArkUI.Full 1323 * @crossplatform 1324 * @since 10 1325 */ 1326/** 1327 * Defines Grid Component instance. 1328 * 1329 * @syscap SystemCapability.ArkUI.ArkUI.Full 1330 * @crossplatform 1331 * @atomicservice 1332 * @since 11 1333 */ 1334declare const GridInstance: GridAttribute; 1335