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